[{"data":1,"prerenderedAt":1962},["ShallowReactive",2],{"navigation_docs":3,"-rpc-server-call-context":399},[4,162,346],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":24},"RPC","icon-park-outline:lightning","\u002Frpc","01.rpc",[10,25,63,77,102,136],{"title":11,"icon":12,"redirect":7,"path":13,"stem":14,"children":15,"page":24},"Introduction","icon-park-outline:home","\u002Frpc\u002Fintroduction","01.rpc\u002F01.introduction",[16,20],{"title":17,"path":18,"stem":19},"Quick Start","\u002Frpc\u002Fintroduction\u002Fquick-start","01.rpc\u002F01.introduction\u002F02.quick-start",{"title":21,"path":22,"stem":23},"Manual Install","\u002Frpc\u002Fintroduction\u002Fmanual-install","01.rpc\u002F01.introduction\u002F03.manual-install",false,{"title":26,"icon":27,"path":28,"stem":29,"children":30,"page":24},"Server","icon-park-outline:server","\u002Frpc\u002Fserver","01.rpc\u002F02.server",[31,35,39,43,47,51,55,59],{"title":32,"path":33,"stem":34},"Routes","\u002Frpc\u002Fserver\u002Froutes","01.rpc\u002F02.server\u002F01.routes",{"title":36,"path":37,"stem":38},"Middleware","\u002Frpc\u002Fserver\u002Fmiddleware","01.rpc\u002F02.server\u002F02.middleware",{"title":40,"path":41,"stem":42},"Call Context","\u002Frpc\u002Fserver\u002Fcall-context","01.rpc\u002F02.server\u002F03.call-context",{"title":44,"path":45,"stem":46},"Headers","\u002Frpc\u002Fserver\u002Fheaders","01.rpc\u002F02.server\u002F04.headers",{"title":48,"path":49,"stem":50},"Error Handling","\u002Frpc\u002Fserver\u002Ferror-handling","01.rpc\u002F02.server\u002F05.error-handling",{"title":52,"path":53,"stem":54},"Validation","\u002Frpc\u002Fserver\u002Fvalidation","01.rpc\u002F02.server\u002F06.validation",{"title":56,"path":57,"stem":58},"JSON Round Trip","\u002Frpc\u002Fserver\u002Fjson-round-trip","01.rpc\u002F02.server\u002F07.json-round-trip",{"title":60,"path":61,"stem":62},"Drizzle Tables","\u002Frpc\u002Fserver\u002Fdrizzle-tables","01.rpc\u002F02.server\u002F08.drizzle-tables",{"title":64,"icon":65,"path":66,"stem":67,"children":68,"page":24},"Middlewares","icon-park-outline:link-one","\u002Frpc\u002Fmiddlewares","01.rpc\u002F03.middlewares",[69,73],{"title":70,"path":71,"stem":72},"fetchMetadata","\u002Frpc\u002Fmiddlewares\u002Ffetch-metadata","01.rpc\u002F03.middlewares\u002F01.fetch-metadata",{"title":74,"path":75,"stem":76},"syncRoutes","\u002Frpc\u002Fmiddlewares\u002Fsync-routes","01.rpc\u002F03.middlewares\u002F02.sync-routes",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":24},"Client","icon-park-outline:computer","\u002Frpc\u002Fclient","01.rpc\u002F04.client",[83,87,91,94,98],{"title":84,"path":85,"stem":86},"Client Overview","\u002Frpc\u002Fclient\u002Fclient-overview","01.rpc\u002F04.client\u002F00.client-overview",{"title":88,"path":89,"stem":90},"Client Middleware","\u002Frpc\u002Fclient\u002Fclient-middleware","01.rpc\u002F04.client\u002F01.client-middleware",{"title":48,"path":92,"stem":93},"\u002Frpc\u002Fclient\u002Ferror-handling","01.rpc\u002F04.client\u002F02.error-handling",{"title":95,"path":96,"stem":97},"Batch Requests","\u002Frpc\u002Fclient\u002Fbatch","01.rpc\u002F04.client\u002F03.batch",{"title":99,"path":100,"stem":101},"Cancellation & Timeouts","\u002Frpc\u002Fclient\u002Fcancellation-timeouts","01.rpc\u002F04.client\u002F04.cancellation-timeouts",{"title":103,"redirect":104,"icon":105,"path":106,"stem":107,"children":108,"page":24},"Platforms","\u002Frpc\u002Fplatforms\u002Fnode-js","icon-park-outline:play","\u002Frpc\u002Fplatforms","01.rpc\u002F06.platforms",[109,112,116,120,124,128,132],{"title":110,"path":104,"stem":111},"Node.js","01.rpc\u002F06.platforms\u002F01.node-js",{"title":113,"path":114,"stem":115},"Bun","\u002Frpc\u002Fplatforms\u002Fbun","01.rpc\u002F06.platforms\u002F02.bun",{"title":117,"path":118,"stem":119},"AWS Lambda","\u002Frpc\u002Fplatforms\u002Faws-lambda","01.rpc\u002F06.platforms\u002F03.aws-lambda",{"title":121,"path":122,"stem":123},"Google Cloud Functions","\u002Frpc\u002Fplatforms\u002Fgoogle-cloud-functions","01.rpc\u002F06.platforms\u002F04.google-cloud-functions",{"title":125,"path":126,"stem":127},"Cloudflare Workers","\u002Frpc\u002Fplatforms\u002Fcloudflare","01.rpc\u002F06.platforms\u002F05.cloudflare",{"title":129,"path":130,"stem":131},"Vercel","\u002Frpc\u002Fplatforms\u002Fvercel","01.rpc\u002F06.platforms\u002F06.vercel",{"title":133,"path":134,"stem":135},"uWebSockets.js","\u002Frpc\u002Fplatforms\u002Fuwebsockets","01.rpc\u002F06.platforms\u002F07.uwebsockets",{"title":137,"icon":138,"path":139,"stem":140,"children":141,"page":24},"Devtools","icon-park-outline:tool","\u002Frpc\u002Fdevtools","01.rpc\u002F07.devtools",[142,146,150,154,158],{"title":143,"path":144,"stem":145},"Linter","\u002Frpc\u002Fdevtools\u002Flinter","01.rpc\u002F07.devtools\u002F01.linter",{"title":147,"path":148,"stem":149},"Vite","\u002Frpc\u002Fdevtools\u002Fvite","01.rpc\u002F07.devtools\u002F02.vite",{"title":151,"path":152,"stem":153},"Next.js","\u002Frpc\u002Fdevtools\u002Fnextjs","01.rpc\u002F07.devtools\u002F03.nextjs",{"title":155,"path":156,"stem":157},"CLI","\u002Frpc\u002Fdevtools\u002Fcli","01.rpc\u002F07.devtools\u002F04.cli",{"title":159,"path":160,"stem":161},"API Types","\u002Frpc\u002Fdevtools\u002Fapi-types","01.rpc\u002F07.devtools\u002F05.api-types",{"title":163,"icon":164,"path":165,"stem":166,"children":167,"page":24},"RunTypes","i-lucide-braces","\u002Fruntypes","02.runtypes",[168,184,224,254,268,290,332],{"title":11,"icon":169,"redirect":165,"path":170,"stem":171,"children":172,"page":24},"i-lucide-rocket","\u002Fruntypes\u002Fintroduction","02.runtypes\u002F01.introduction",[173,177,180],{"title":174,"path":175,"stem":176},"Built on typescript-go","\u002Fruntypes\u002Fintroduction\u002Fbuilt-on-typescript-go","02.runtypes\u002F01.introduction\u002F02.built-on-typescript-go",{"title":17,"path":178,"stem":179},"\u002Fruntypes\u002Fintroduction\u002Fquick-start","02.runtypes\u002F01.introduction\u002F03.quick-start",{"title":181,"path":182,"stem":183},"Configuration","\u002Fruntypes\u002Fintroduction\u002Fconfiguration","02.runtypes\u002F01.introduction\u002F04.configuration",{"title":185,"icon":186,"redirect":187,"path":188,"stem":189,"children":190,"page":24},"Guide","i-lucide-book-open","\u002Fruntypes\u002Fguide\u002Ftype-builders","\u002Fruntypes\u002Fguide","02.runtypes\u002F02.guide",[191,194,198,201,204,208,212,216,220],{"title":192,"path":187,"stem":193},"Types vs Type Builders","02.runtypes\u002F02.guide\u002F01.type-builders",{"title":195,"path":196,"stem":197},"Reflection","\u002Fruntypes\u002Fguide\u002Freflection","02.runtypes\u002F02.guide\u002F02.reflection",{"title":52,"path":199,"stem":200},"\u002Fruntypes\u002Fguide\u002Fvalidation","02.runtypes\u002F02.guide\u002F03.validation",{"title":56,"path":202,"stem":203},"\u002Fruntypes\u002Fguide\u002Fjson-round-trip","02.runtypes\u002F02.guide\u002F04.json-round-trip",{"title":205,"path":206,"stem":207},"Data Mocking","\u002Fruntypes\u002Fguide\u002Fmocking","02.runtypes\u002F02.guide\u002F07.mocking",{"title":209,"path":210,"stem":211},"JSON Schemas","\u002Fruntypes\u002Fguide\u002Fjson-schemas","02.runtypes\u002F02.guide\u002F08.json-schemas",{"title":213,"path":214,"stem":215},"Pure Functions","\u002Fruntypes\u002Fguide\u002Fpure-functions","02.runtypes\u002F02.guide\u002F09.pure-functions",{"title":217,"path":218,"stem":219},"Compiler Markers","\u002Fruntypes\u002Fguide\u002Fcompiler-markers","02.runtypes\u002F02.guide\u002F10.compiler-markers",{"title":221,"path":222,"stem":223},"All Compiled Functions","\u002Fruntypes\u002Fguide\u002Fall-compiled-functions","02.runtypes\u002F02.guide\u002F11.all-compiled-functions",{"title":225,"icon":226,"redirect":227,"path":228,"stem":229,"children":230,"page":24},"Type Formats","i-lucide-shapes","\u002Fruntypes\u002Ftype-formats\u002Foverview","\u002Fruntypes\u002Ftype-formats","02.runtypes\u002F03.type-formats",[231,234,238,242,246,250],{"title":232,"path":227,"stem":233},"Overview","02.runtypes\u002F03.type-formats\u002F01.overview",{"title":235,"path":236,"stem":237},"String Formats","\u002Fruntypes\u002Ftype-formats\u002Fstring","02.runtypes\u002F03.type-formats\u002F02.string",{"title":239,"path":240,"stem":241},"Number Formats","\u002Fruntypes\u002Ftype-formats\u002Fnumber","02.runtypes\u002F03.type-formats\u002F03.number",{"title":243,"path":244,"stem":245},"BigInt Formats","\u002Fruntypes\u002Ftype-formats\u002Fbigint","02.runtypes\u002F03.type-formats\u002F04.bigint",{"title":247,"path":248,"stem":249},"Date and Time Formats","\u002Fruntypes\u002Ftype-formats\u002Fdate-time","02.runtypes\u002F03.type-formats\u002F05.date-time",{"title":251,"path":252,"stem":253},"Collection Formats","\u002Fruntypes\u002Ftype-formats\u002Fcollections","02.runtypes\u002F03.type-formats\u002F06.collections",{"title":255,"icon":256,"redirect":257,"path":258,"stem":259,"children":260,"page":24},"Tooling","i-lucide-wrench","\u002Fruntypes\u002Ftooling\u002Flinting","\u002Fruntypes\u002Ftooling","02.runtypes\u002F04.tooling",[261,264],{"title":262,"path":257,"stem":263},"Linting","02.runtypes\u002F04.tooling\u002F01.linting",{"title":265,"path":266,"stem":267},"Source Conversion","\u002Fruntypes\u002Ftooling\u002Fsource-conversion","02.runtypes\u002F04.tooling\u002F02.source-conversion",{"title":269,"icon":270,"redirect":271,"path":272,"stem":273,"children":274,"page":24},"AI Integration","i-lucide-sparkles","\u002Fruntypes\u002Fai-integration\u002Fworkflow-and-commands","\u002Fruntypes\u002Fai-integration","02.runtypes\u002F05.ai-integration",[275,278,282,286],{"title":276,"path":271,"stem":277},"AI Workflow","02.runtypes\u002F05.ai-integration\u002F01.workflow-and-commands",{"title":279,"path":280,"stem":281},"FriendlyText","\u002Fruntypes\u002Fai-integration\u002Ffriendly-text","02.runtypes\u002F05.ai-integration\u002F02.friendly-text",{"title":283,"path":284,"stem":285},"MockData","\u002Fruntypes\u002Fai-integration\u002Fmock-data","02.runtypes\u002F05.ai-integration\u002F03.mock-data",{"title":287,"path":288,"stem":289},"Translations (i18n)","\u002Fruntypes\u002Fai-integration\u002Fi18n","02.runtypes\u002F05.ai-integration\u002F04.i18n",{"title":291,"icon":292,"redirect":293,"path":294,"stem":295,"children":296,"page":24},"Drizzle ORM","i-lineicons-drizzle","\u002Fruntypes\u002Fdrizzle-orm\u002Fdrizzle-overview","\u002Fruntypes\u002Fdrizzle-orm","02.runtypes\u002F06.drizzle-orm",[297,300,304,308,312,316,320,324,328],{"title":298,"path":293,"stem":299},"Drizzle Overview","02.runtypes\u002F06.drizzle-orm\u002F00.drizzle-overview",{"title":301,"path":302,"stem":303},"Column Formats","\u002Fruntypes\u002Fdrizzle-orm\u002Fcolumn-formats","02.runtypes\u002F06.drizzle-orm\u002F01.column-formats",{"title":305,"path":306,"stem":307},"Views","\u002Fruntypes\u002Fdrizzle-orm\u002Fviews","02.runtypes\u002F06.drizzle-orm\u002F02.views",{"title":309,"path":310,"stem":311},"Indexes and Constraints","\u002Fruntypes\u002Fdrizzle-orm\u002Fconstraints","02.runtypes\u002F06.drizzle-orm\u002F03.constraints",{"title":313,"path":314,"stem":315},"Row Level Security","\u002Fruntypes\u002Fdrizzle-orm\u002Frow-level-security","02.runtypes\u002F06.drizzle-orm\u002F04.row-level-security",{"title":317,"path":318,"stem":319},"Relations","\u002Fruntypes\u002Fdrizzle-orm\u002Frelations","02.runtypes\u002F06.drizzle-orm\u002F05.relations",{"title":321,"path":322,"stem":323},"The Schema File","\u002Fruntypes\u002Fdrizzle-orm\u002Fschema-file","02.runtypes\u002F06.drizzle-orm\u002F06.schema-file",{"title":325,"path":326,"stem":327},"Migrate an Existing Schema","\u002Fruntypes\u002Fdrizzle-orm\u002Fmigrate-an-existing-schema","02.runtypes\u002F06.drizzle-orm\u002F07.migrate-an-existing-schema",{"title":329,"path":330,"stem":331},"Cloudflare D1 and Durable Objects","\u002Fruntypes\u002Fdrizzle-orm\u002Fcloudflare-storage","02.runtypes\u002F06.drizzle-orm\u002F08.cloudflare-storage",{"title":333,"icon":334,"redirect":335,"path":336,"stem":337,"children":338,"page":24},"Diagnostics","i-lucide-triangle-alert","\u002Fruntypes\u002Fdiagnostics\u002Ferror-levels","\u002Fruntypes\u002Fdiagnostics","02.runtypes\u002F08.diagnostics",[339,342],{"title":340,"path":335,"stem":341},"Error Levels","02.runtypes\u002F08.diagnostics\u002F01.error-levels",{"title":343,"path":344,"stem":345},"All Diagnostics","\u002Fruntypes\u002Fdiagnostics\u002Fall-diagnostics","02.runtypes\u002F08.diagnostics\u002F02.all-diagnostics",{"title":347,"icon":348,"path":349,"stem":350,"children":351,"page":24},"Benchmarks","i-lucide-gauge","\u002Fbenchmarks","03.benchmarks",[352,372],{"title":5,"icon":6,"redirect":353,"path":354,"stem":355,"children":356,"page":24},"\u002Fbenchmarks\u002Frpc\u002Fhello-world","\u002Fbenchmarks\u002Frpc","03.benchmarks\u002F02.rpc",[357,360,364,368],{"title":358,"path":353,"stem":359},"Hello World","03.benchmarks\u002F02.rpc\u002F01.hello-world",{"title":361,"path":362,"stem":363},"Light Validation","\u002Fbenchmarks\u002Frpc\u002Flight-validation","03.benchmarks\u002F02.rpc\u002F02.light-validation",{"title":365,"path":366,"stem":367},"Heavy Validation","\u002Fbenchmarks\u002Frpc\u002Fheavy-validation","03.benchmarks\u002F02.rpc\u002F03.heavy-validation",{"title":369,"path":370,"stem":371},"Payload Sizes","\u002Fbenchmarks\u002Frpc\u002Fpayload-sizes","03.benchmarks\u002F02.rpc\u002F04.payload-sizes",{"title":163,"icon":164,"redirect":373,"path":374,"stem":375,"children":376,"page":24},"\u002Fbenchmarks\u002Fruntypes\u002Fis-valid","\u002Fbenchmarks\u002Fruntypes","03.benchmarks\u002F03.runtypes",[377,380,384,388,392,395],{"title":378,"path":373,"stem":379},"Is Valid","03.benchmarks\u002F03.runtypes\u002F01.is-valid",{"title":381,"path":382,"stem":383},"Is Valid Formats","\u002Fbenchmarks\u002Fruntypes\u002Fis-valid-formats","03.benchmarks\u002F03.runtypes\u002F02.is-valid-formats",{"title":385,"path":386,"stem":387},"Get Errors","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors","03.benchmarks\u002F03.runtypes\u002F03.get-errors",{"title":389,"path":390,"stem":391},"Get Errors Formats","\u002Fbenchmarks\u002Fruntypes\u002Fget-errors-formats","03.benchmarks\u002F03.runtypes\u002F04.get-errors-formats",{"title":56,"path":393,"stem":394},"\u002Fbenchmarks\u002Fruntypes\u002Fjson-round-trip","03.benchmarks\u002F03.runtypes\u002F05.json-round-trip",{"title":396,"path":397,"stem":398},"Type Checking","\u002Fbenchmarks\u002Fruntypes\u002Ftype-checking","03.benchmarks\u002F03.runtypes\u002F07.type-checking",{"id":400,"title":40,"body":401,"description":1956,"extension":1957,"links":1958,"meta":1959,"navigation":705,"path":41,"seo":1960,"stem":42,"__hash__":1961},"docs\u002F01.rpc\u002F02.server\u002F03.call-context.md",{"type":402,"value":403},"minimark",[404,408,411,416,428,1070,1074,1078,1097,1503,1509,1513,1524,1777,1788,1819,1826,1840,1844,1851,1869,1873,1893,1902,1906,1909,1952],[405,406,407],"p",{},"Every route and middleware gets the call context as its first parameter. It holds everything about one request: the request, the response and the data your routes and middleware share.",[405,409,410],{},"Unlike Express, a route does not parse the request or write the response. It reads its params and returns a value, and mion sends both over HTTP.",[412,413,415],"h2",{"id":414},"call-context-fields","Call Context Fields",[405,417,418,419,423,424,427],{},"The context is typed ",[420,421,422],"code",{},"CallContext",". To read headers, see ",[425,426,44],"a",{"href":45},".",[429,430,435],"pre",{"className":431,"code":432,"language":433,"meta":434,"style":434},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F** The call Context object passed as first parameter to any middleware or route *\u002F\nexport interface CallContext\u003CContextData extends Record\u003Cstring, any> = any> {\n  \u002F** The route's URL path, like `\u002Fusers\u002FgetUser` *\u002F\n  readonly path: string;\n  readonly request: MionRequest;\n  readonly response: MionResponse;\n  \u002F** Shared by the chain's handlers, never sent back. *\u002F\n  shared: ContextData;\n  readonly executionChain: MethodsExecutionChain;\n  \u002F** The request limit this request was read against: the chain's number capped by the platform's *\u002F\n  readonly maxBodySize: number;\n  \u002F** False on a not-found chain: the body is never read or parsed, `alwaysRun` middlewares still run *\u002F\n  readonly readsBody: boolean;\n  \u002F** Query string from URL, used by the batch endpoint (`id=\u003CbatchId>`) and by query routes *\u002F\n  readonly urlQuery?: string;\n  \u002F** Id of the batch a batch request is running *\u002F\n  readonly batchId?: string;\n  \u002F** Route ids a batch request is running, in call order. Exposed for consumers (logging, metrics). *\u002F\n  readonly batchRouteIds?: string[];\n}\n\n\u002F\u002F ####### REQUEST & RESPONSE #######\n\n\u002F** Request body as the adapter hands it over: a JSON string, or an object a host already parsed *\u002F\nexport type RawRequestBody = string | AnyObject;\n\n\u002F** Router's own request object, do not confuse with the underlying raw request *\u002F\nexport interface MionRequest {\n  readonly headers: Readonly\u003COmit\u003CMionHeaders, 'append' | 'set' | 'delete'>>;\n  readonly rawBody: RawRequestBody;\n  readonly bodyType: SerializerCode;\n  \u002F** The parsed request body *\u002F\n  readonly body: Readonly\u003CAnyObject>;\n  \u002F** Errors outside the route's return type (validation, serialization, thrown), sent in `@thrownErrors` *\u002F\n  readonly thrownErrors?: Readonly\u003CRecord\u003Cstring, RpcError\u003Cstring>>>;\n}\n\n\u002F** Router's own response object, do not confuse with the underlying raw response *\u002F\nexport interface MionResponse {\n  readonly statusCode: number;\n  \u002F** Set by the body serializer; the adapter writes it after every header, so no handler overrides it *\u002F\n  readonly contentType: string;\n  readonly headers: Readonly\u003CMionHeaders>;\n  \u002F** The router response data, never to be modified by hand *\u002F\n  readonly body: Readonly\u003CResponseBody>;\n  \u002F** true once something ended the execution chain: a thrown error or a returned FatalError *\u002F\n  readonly hasErrors: boolean;\n  \u002F** The error that ended the chain (thrown or a returned FatalError), first one wins. An `alwaysRun` logger reads it here. *\u002F\n  readonly fatalError?: RpcError\u003Cstring>;\n}\n","ts","",[420,436,437,446,498,504,523,538,553,559,572,587,593,608,614,629,635,650,656,670,676,694,700,707,713,718,724,747,752,758,769,825,839,854,860,880,886,919,924,929,935,946,960,966,980,997,1003,1021,1027,1041,1047,1065],{"__ignoreMap":434},[438,439,442],"span",{"class":440,"line":441},"line",1,[438,443,445],{"class":444},"sHwdD","\u002F** The call Context object passed as first parameter to any middleware or route *\u002F\n",[438,447,449,453,457,461,465,468,471,474,476,479,482,485,488,491,493,495],{"class":440,"line":448},2,[438,450,452],{"class":451},"s7zQu","export",[438,454,456],{"class":455},"spNyl"," interface",[438,458,460],{"class":459},"sBMFI"," CallContext",[438,462,464],{"class":463},"sMK4o","\u003C",[438,466,467],{"class":459},"ContextData",[438,469,470],{"class":455}," extends",[438,472,473],{"class":459}," Record",[438,475,464],{"class":463},[438,477,478],{"class":459},"string",[438,480,481],{"class":463},",",[438,483,484],{"class":459}," any",[438,486,487],{"class":463},">",[438,489,490],{"class":463}," =",[438,492,484],{"class":459},[438,494,487],{"class":463},[438,496,497],{"class":463}," {\n",[438,499,501],{"class":440,"line":500},3,[438,502,503],{"class":444},"  \u002F** The route's URL path, like `\u002Fusers\u002FgetUser` *\u002F\n",[438,505,507,510,514,517,520],{"class":440,"line":506},4,[438,508,509],{"class":455},"  readonly",[438,511,513],{"class":512},"swJcz"," path",[438,515,516],{"class":463},":",[438,518,519],{"class":459}," string",[438,521,522],{"class":463},";\n",[438,524,526,528,531,533,536],{"class":440,"line":525},5,[438,527,509],{"class":455},[438,529,530],{"class":512}," request",[438,532,516],{"class":463},[438,534,535],{"class":459}," MionRequest",[438,537,522],{"class":463},[438,539,541,543,546,548,551],{"class":440,"line":540},6,[438,542,509],{"class":455},[438,544,545],{"class":512}," response",[438,547,516],{"class":463},[438,549,550],{"class":459}," MionResponse",[438,552,522],{"class":463},[438,554,556],{"class":440,"line":555},7,[438,557,558],{"class":444},"  \u002F** Shared by the chain's handlers, never sent back. *\u002F\n",[438,560,562,565,567,570],{"class":440,"line":561},8,[438,563,564],{"class":512},"  shared",[438,566,516],{"class":463},[438,568,569],{"class":459}," ContextData",[438,571,522],{"class":463},[438,573,575,577,580,582,585],{"class":440,"line":574},9,[438,576,509],{"class":455},[438,578,579],{"class":512}," executionChain",[438,581,516],{"class":463},[438,583,584],{"class":459}," MethodsExecutionChain",[438,586,522],{"class":463},[438,588,590],{"class":440,"line":589},10,[438,591,592],{"class":444},"  \u002F** The request limit this request was read against: the chain's number capped by the platform's *\u002F\n",[438,594,596,598,601,603,606],{"class":440,"line":595},11,[438,597,509],{"class":455},[438,599,600],{"class":512}," maxBodySize",[438,602,516],{"class":463},[438,604,605],{"class":459}," number",[438,607,522],{"class":463},[438,609,611],{"class":440,"line":610},12,[438,612,613],{"class":444},"  \u002F** False on a not-found chain: the body is never read or parsed, `alwaysRun` middlewares still run *\u002F\n",[438,615,617,619,622,624,627],{"class":440,"line":616},13,[438,618,509],{"class":455},[438,620,621],{"class":512}," readsBody",[438,623,516],{"class":463},[438,625,626],{"class":459}," boolean",[438,628,522],{"class":463},[438,630,632],{"class":440,"line":631},14,[438,633,634],{"class":444},"  \u002F** Query string from URL, used by the batch endpoint (`id=\u003CbatchId>`) and by query routes *\u002F\n",[438,636,638,640,643,646,648],{"class":440,"line":637},15,[438,639,509],{"class":455},[438,641,642],{"class":512}," urlQuery",[438,644,645],{"class":463},"?:",[438,647,519],{"class":459},[438,649,522],{"class":463},[438,651,653],{"class":440,"line":652},16,[438,654,655],{"class":444},"  \u002F** Id of the batch a batch request is running *\u002F\n",[438,657,659,661,664,666,668],{"class":440,"line":658},17,[438,660,509],{"class":455},[438,662,663],{"class":512}," batchId",[438,665,645],{"class":463},[438,667,519],{"class":459},[438,669,522],{"class":463},[438,671,673],{"class":440,"line":672},18,[438,674,675],{"class":444},"  \u002F** Route ids a batch request is running, in call order. Exposed for consumers (logging, metrics). *\u002F\n",[438,677,679,681,684,686,688,692],{"class":440,"line":678},19,[438,680,509],{"class":455},[438,682,683],{"class":512}," batchRouteIds",[438,685,645],{"class":463},[438,687,519],{"class":459},[438,689,691],{"class":690},"sTEyZ","[]",[438,693,522],{"class":463},[438,695,697],{"class":440,"line":696},20,[438,698,699],{"class":463},"}\n",[438,701,703],{"class":440,"line":702},21,[438,704,706],{"emptyLinePlaceholder":705},true,"\n",[438,708,710],{"class":440,"line":709},22,[438,711,712],{"class":444},"\u002F\u002F ####### REQUEST & RESPONSE #######\n",[438,714,716],{"class":440,"line":715},23,[438,717,706],{"emptyLinePlaceholder":705},[438,719,721],{"class":440,"line":720},24,[438,722,723],{"class":444},"\u002F** Request body as the adapter hands it over: a JSON string, or an object a host already parsed *\u002F\n",[438,725,727,729,732,735,737,739,742,745],{"class":440,"line":726},25,[438,728,452],{"class":451},[438,730,731],{"class":455}," type",[438,733,734],{"class":459}," RawRequestBody",[438,736,490],{"class":463},[438,738,519],{"class":459},[438,740,741],{"class":463}," |",[438,743,744],{"class":459}," AnyObject",[438,746,522],{"class":463},[438,748,750],{"class":440,"line":749},26,[438,751,706],{"emptyLinePlaceholder":705},[438,753,755],{"class":440,"line":754},27,[438,756,757],{"class":444},"\u002F** Router's own request object, do not confuse with the underlying raw request *\u002F\n",[438,759,761,763,765,767],{"class":440,"line":760},28,[438,762,452],{"class":451},[438,764,456],{"class":455},[438,766,535],{"class":459},[438,768,497],{"class":463},[438,770,772,774,777,779,782,784,787,789,792,794,797,801,804,806,808,811,813,815,817,820,822],{"class":440,"line":771},29,[438,773,509],{"class":455},[438,775,776],{"class":512}," headers",[438,778,516],{"class":463},[438,780,781],{"class":459}," Readonly",[438,783,464],{"class":463},[438,785,786],{"class":459},"Omit",[438,788,464],{"class":463},[438,790,791],{"class":459},"MionHeaders",[438,793,481],{"class":463},[438,795,796],{"class":463}," '",[438,798,800],{"class":799},"sfazB","append",[438,802,803],{"class":463},"'",[438,805,741],{"class":463},[438,807,796],{"class":463},[438,809,810],{"class":799},"set",[438,812,803],{"class":463},[438,814,741],{"class":463},[438,816,796],{"class":463},[438,818,819],{"class":799},"delete",[438,821,803],{"class":463},[438,823,824],{"class":463},">>;\n",[438,826,828,830,833,835,837],{"class":440,"line":827},30,[438,829,509],{"class":455},[438,831,832],{"class":512}," rawBody",[438,834,516],{"class":463},[438,836,734],{"class":459},[438,838,522],{"class":463},[438,840,842,844,847,849,852],{"class":440,"line":841},31,[438,843,509],{"class":455},[438,845,846],{"class":512}," bodyType",[438,848,516],{"class":463},[438,850,851],{"class":459}," SerializerCode",[438,853,522],{"class":463},[438,855,857],{"class":440,"line":856},32,[438,858,859],{"class":444},"  \u002F** The parsed request body *\u002F\n",[438,861,863,865,868,870,872,874,877],{"class":440,"line":862},33,[438,864,509],{"class":455},[438,866,867],{"class":512}," body",[438,869,516],{"class":463},[438,871,781],{"class":459},[438,873,464],{"class":463},[438,875,876],{"class":459},"AnyObject",[438,878,879],{"class":463},">;\n",[438,881,883],{"class":440,"line":882},34,[438,884,885],{"class":444},"  \u002F** Errors outside the route's return type (validation, serialization, thrown), sent in `@thrownErrors` *\u002F\n",[438,887,889,891,894,896,898,900,903,905,907,909,912,914,916],{"class":440,"line":888},35,[438,890,509],{"class":455},[438,892,893],{"class":512}," thrownErrors",[438,895,645],{"class":463},[438,897,781],{"class":459},[438,899,464],{"class":463},[438,901,902],{"class":459},"Record",[438,904,464],{"class":463},[438,906,478],{"class":459},[438,908,481],{"class":463},[438,910,911],{"class":459}," RpcError",[438,913,464],{"class":463},[438,915,478],{"class":459},[438,917,918],{"class":463},">>>;\n",[438,920,922],{"class":440,"line":921},36,[438,923,699],{"class":463},[438,925,927],{"class":440,"line":926},37,[438,928,706],{"emptyLinePlaceholder":705},[438,930,932],{"class":440,"line":931},38,[438,933,934],{"class":444},"\u002F** Router's own response object, do not confuse with the underlying raw response *\u002F\n",[438,936,938,940,942,944],{"class":440,"line":937},39,[438,939,452],{"class":451},[438,941,456],{"class":455},[438,943,550],{"class":459},[438,945,497],{"class":463},[438,947,949,951,954,956,958],{"class":440,"line":948},40,[438,950,509],{"class":455},[438,952,953],{"class":512}," statusCode",[438,955,516],{"class":463},[438,957,605],{"class":459},[438,959,522],{"class":463},[438,961,963],{"class":440,"line":962},41,[438,964,965],{"class":444},"  \u002F** Set by the body serializer; the adapter writes it after every header, so no handler overrides it *\u002F\n",[438,967,969,971,974,976,978],{"class":440,"line":968},42,[438,970,509],{"class":455},[438,972,973],{"class":512}," contentType",[438,975,516],{"class":463},[438,977,519],{"class":459},[438,979,522],{"class":463},[438,981,983,985,987,989,991,993,995],{"class":440,"line":982},43,[438,984,509],{"class":455},[438,986,776],{"class":512},[438,988,516],{"class":463},[438,990,781],{"class":459},[438,992,464],{"class":463},[438,994,791],{"class":459},[438,996,879],{"class":463},[438,998,1000],{"class":440,"line":999},44,[438,1001,1002],{"class":444},"  \u002F** The router response data, never to be modified by hand *\u002F\n",[438,1004,1006,1008,1010,1012,1014,1016,1019],{"class":440,"line":1005},45,[438,1007,509],{"class":455},[438,1009,867],{"class":512},[438,1011,516],{"class":463},[438,1013,781],{"class":459},[438,1015,464],{"class":463},[438,1017,1018],{"class":459},"ResponseBody",[438,1020,879],{"class":463},[438,1022,1024],{"class":440,"line":1023},46,[438,1025,1026],{"class":444},"  \u002F** true once something ended the execution chain: a thrown error or a returned FatalError *\u002F\n",[438,1028,1030,1032,1035,1037,1039],{"class":440,"line":1029},47,[438,1031,509],{"class":455},[438,1033,1034],{"class":512}," hasErrors",[438,1036,516],{"class":463},[438,1038,626],{"class":459},[438,1040,522],{"class":463},[438,1042,1044],{"class":440,"line":1043},48,[438,1045,1046],{"class":444},"  \u002F** The error that ended the chain (thrown or a returned FatalError), first one wins. An `alwaysRun` logger reads it here. *\u002F\n",[438,1048,1050,1052,1055,1057,1059,1061,1063],{"class":440,"line":1049},49,[438,1051,509],{"class":455},[438,1053,1054],{"class":512}," fatalError",[438,1056,645],{"class":463},[438,1058,911],{"class":459},[438,1060,464],{"class":463},[438,1062,478],{"class":459},[438,1064,879],{"class":463},[438,1066,1068],{"class":440,"line":1067},50,[438,1069,699],{"class":463},[1071,1072,1073],"tip",{},"Never keep the context in a module-level variable or a cache. It holds the whole request body, so that memory is never freed.",[412,1075,1077],{"id":1076},"sharing-data-between-handlers","Sharing Data Between Handlers",[405,1079,1080,1083,1084,1087,1088,1090,1091,1093,1094,427],{},[420,1081,1082],{},"ctx.shared"," passes data from one middleware or route to the next in the same request. It is never sent to the client. The ",[420,1085,1086],{},"contextDataFactory"," router option is a function that creates it for each request, and its return type is the type of ",[420,1089,1082],{}," everywhere. Without a factory, ",[420,1092,1082],{}," is an empty object typed ",[420,1095,1096],{},"any",[429,1098,1100],{"className":431,"code":1099,"language":433,"meta":434,"style":434},"import {createMionRouter, Routes} from '@mionjs\u002Frouter';\nimport {getSessionUser, type AuthUser} from '.\u002FmyAuth.ts';\n\n\u002F\u002F without this return type, `me` would be typed as only `null`\nconst newSharedData = (): {me: AuthUser | null} => ({me: null});\n\nconst mion = createMionRouter({contextDataFactory: newSharedData});\n\nconst routes = {\n  auth: mion.middleware(async (ctx): Promise\u003Cvoid> => {\n    const cookie = ctx.request.headers.get('cookie');\n    ctx.shared.me = (await getSessionUser(cookie)) ?? null;\n  }),\n  sayHello: mion.route((ctx): string => `Hello ${ctx.shared.me?.name}`), \u002F\u002F written by auth above\n} satisfies Routes;\n\nexport const api = mion.initRoutes(routes);\n",[420,1101,1102,1133,1162,1166,1171,1222,1226,1257,1261,1272,1315,1356,1393,1403,1464,1475,1479],{"__ignoreMap":434},[438,1103,1104,1107,1110,1113,1115,1118,1121,1124,1126,1129,1131],{"class":440,"line":441},[438,1105,1106],{"class":451},"import",[438,1108,1109],{"class":463}," {",[438,1111,1112],{"class":690},"createMionRouter",[438,1114,481],{"class":463},[438,1116,1117],{"class":690}," Routes",[438,1119,1120],{"class":463},"}",[438,1122,1123],{"class":451}," from",[438,1125,796],{"class":463},[438,1127,1128],{"class":799},"@mionjs\u002Frouter",[438,1130,803],{"class":463},[438,1132,522],{"class":463},[438,1134,1135,1137,1139,1142,1144,1146,1149,1151,1153,1155,1158,1160],{"class":440,"line":448},[438,1136,1106],{"class":451},[438,1138,1109],{"class":463},[438,1140,1141],{"class":690},"getSessionUser",[438,1143,481],{"class":463},[438,1145,731],{"class":451},[438,1147,1148],{"class":690}," AuthUser",[438,1150,1120],{"class":463},[438,1152,1123],{"class":451},[438,1154,796],{"class":463},[438,1156,1157],{"class":799},".\u002FmyAuth.ts",[438,1159,803],{"class":463},[438,1161,522],{"class":463},[438,1163,1164],{"class":440,"line":500},[438,1165,706],{"emptyLinePlaceholder":705},[438,1167,1168],{"class":440,"line":506},[438,1169,1170],{"class":444},"\u002F\u002F without this return type, `me` would be typed as only `null`\n",[438,1172,1173,1176,1179,1182,1185,1187,1190,1192,1194,1196,1199,1201,1204,1207,1210,1212,1214,1217,1220],{"class":440,"line":525},[438,1174,1175],{"class":455},"const",[438,1177,1178],{"class":690}," newSharedData ",[438,1180,1181],{"class":463},"=",[438,1183,1184],{"class":463}," ():",[438,1186,1109],{"class":463},[438,1188,1189],{"class":512},"me",[438,1191,516],{"class":463},[438,1193,1148],{"class":459},[438,1195,741],{"class":463},[438,1197,1198],{"class":459}," null",[438,1200,1120],{"class":463},[438,1202,1203],{"class":455}," =>",[438,1205,1206],{"class":690}," (",[438,1208,1209],{"class":463},"{",[438,1211,1189],{"class":512},[438,1213,516],{"class":463},[438,1215,1216],{"class":463}," null}",[438,1218,1219],{"class":690},")",[438,1221,522],{"class":463},[438,1223,1224],{"class":440,"line":540},[438,1225,706],{"emptyLinePlaceholder":705},[438,1227,1228,1230,1233,1235,1239,1242,1244,1246,1248,1251,1253,1255],{"class":440,"line":555},[438,1229,1175],{"class":455},[438,1231,1232],{"class":690}," mion ",[438,1234,1181],{"class":463},[438,1236,1238],{"class":1237},"s2Zo4"," createMionRouter",[438,1240,1241],{"class":690},"(",[438,1243,1209],{"class":463},[438,1245,1086],{"class":512},[438,1247,516],{"class":463},[438,1249,1250],{"class":690}," newSharedData",[438,1252,1120],{"class":463},[438,1254,1219],{"class":690},[438,1256,522],{"class":463},[438,1258,1259],{"class":440,"line":561},[438,1260,706],{"emptyLinePlaceholder":705},[438,1262,1263,1265,1268,1270],{"class":440,"line":574},[438,1264,1175],{"class":455},[438,1266,1267],{"class":690}," routes ",[438,1269,1181],{"class":463},[438,1271,497],{"class":463},[438,1273,1274,1277,1279,1282,1284,1287,1289,1292,1294,1298,1301,1304,1306,1309,1311,1313],{"class":440,"line":589},[438,1275,1276],{"class":512},"  auth",[438,1278,516],{"class":463},[438,1280,1281],{"class":690}," mion",[438,1283,427],{"class":463},[438,1285,1286],{"class":1237},"middleware",[438,1288,1241],{"class":690},[438,1290,1291],{"class":455},"async",[438,1293,1206],{"class":463},[438,1295,1297],{"class":1296},"sHdIc","ctx",[438,1299,1300],{"class":463},"):",[438,1302,1303],{"class":459}," Promise",[438,1305,464],{"class":463},[438,1307,1308],{"class":459},"void",[438,1310,487],{"class":463},[438,1312,1203],{"class":455},[438,1314,497],{"class":463},[438,1316,1317,1320,1323,1325,1328,1330,1333,1335,1338,1340,1343,1345,1347,1350,1352,1354],{"class":440,"line":595},[438,1318,1319],{"class":455},"    const",[438,1321,1322],{"class":690}," cookie",[438,1324,490],{"class":463},[438,1326,1327],{"class":690}," ctx",[438,1329,427],{"class":463},[438,1331,1332],{"class":690},"request",[438,1334,427],{"class":463},[438,1336,1337],{"class":690},"headers",[438,1339,427],{"class":463},[438,1341,1342],{"class":1237},"get",[438,1344,1241],{"class":512},[438,1346,803],{"class":463},[438,1348,1349],{"class":799},"cookie",[438,1351,803],{"class":463},[438,1353,1219],{"class":512},[438,1355,522],{"class":463},[438,1357,1358,1361,1363,1366,1368,1370,1372,1374,1377,1380,1382,1384,1387,1390],{"class":440,"line":610},[438,1359,1360],{"class":690},"    ctx",[438,1362,427],{"class":463},[438,1364,1365],{"class":690},"shared",[438,1367,427],{"class":463},[438,1369,1189],{"class":690},[438,1371,490],{"class":463},[438,1373,1206],{"class":512},[438,1375,1376],{"class":451},"await",[438,1378,1379],{"class":1237}," getSessionUser",[438,1381,1241],{"class":512},[438,1383,1349],{"class":690},[438,1385,1386],{"class":512},")) ",[438,1388,1389],{"class":463},"??",[438,1391,1392],{"class":463}," null;\n",[438,1394,1395,1398,1400],{"class":440,"line":616},[438,1396,1397],{"class":463},"  }",[438,1399,1219],{"class":690},[438,1401,1402],{"class":463},",\n",[438,1404,1405,1408,1410,1412,1414,1417,1419,1421,1423,1425,1427,1429,1432,1435,1438,1440,1442,1444,1446,1448,1451,1454,1457,1459,1461],{"class":440,"line":631},[438,1406,1407],{"class":512},"  sayHello",[438,1409,516],{"class":463},[438,1411,1281],{"class":690},[438,1413,427],{"class":463},[438,1415,1416],{"class":1237},"route",[438,1418,1241],{"class":690},[438,1420,1241],{"class":463},[438,1422,1297],{"class":1296},[438,1424,1300],{"class":463},[438,1426,519],{"class":459},[438,1428,1203],{"class":455},[438,1430,1431],{"class":463}," `",[438,1433,1434],{"class":799},"Hello ",[438,1436,1437],{"class":463},"${",[438,1439,1297],{"class":690},[438,1441,427],{"class":463},[438,1443,1365],{"class":690},[438,1445,427],{"class":463},[438,1447,1189],{"class":690},[438,1449,1450],{"class":463},"?.",[438,1452,1453],{"class":690},"name",[438,1455,1456],{"class":463},"}`",[438,1458,1219],{"class":690},[438,1460,481],{"class":463},[438,1462,1463],{"class":444}," \u002F\u002F written by auth above\n",[438,1465,1466,1468,1471,1473],{"class":440,"line":637},[438,1467,1120],{"class":463},[438,1469,1470],{"class":451}," satisfies",[438,1472,1117],{"class":459},[438,1474,522],{"class":463},[438,1476,1477],{"class":440,"line":652},[438,1478,706],{"emptyLinePlaceholder":705},[438,1480,1481,1483,1486,1489,1491,1493,1495,1498,1501],{"class":440,"line":658},[438,1482,452],{"class":451},[438,1484,1485],{"class":455}," const",[438,1487,1488],{"class":690}," api ",[438,1490,1181],{"class":463},[438,1492,1281],{"class":690},[438,1494,427],{"class":463},[438,1496,1497],{"class":1237},"initRoutes",[438,1499,1500],{"class":690},"(routes)",[438,1502,522],{"class":463},[1071,1504,1505,1506,1508],{},"The factory must return a new object each time, never a module-level one, or all requests share it. A factory that returns an empty object makes ",[420,1507,1497],{}," throw.",[412,1510,1512],{"id":1511},"request-and-response-format","Request and Response Format",[405,1514,1515,1516,1519,1520,1523],{},"The URL path is the route id: the route's keys in your routes object, joined by ",[420,1517,1518],{},"\u002F",", after the ",[420,1521,1522],{},"basePath",". The body is a JSON object whose keys are route and middleware ids, each holding an array of params. The response uses the same keys for the return values. A route or middleware with no params, or no return value, has no key.",[429,1525,1527],{"className":431,"code":1526,"language":433,"meta":434,"style":434},"import {createMionRouter, Routes} from '@mionjs\u002Frouter';\n\nconst mion = createMionRouter();\n\nconst routes = {\n  \u002F\u002F takes a trace id and returns the time the server got the request\n  trace: mion.middleware((ctx, traceId: string): number => Date.now()),\n  users: {\n    getUser: mion.route((ctx, id: number): {id: number; name: string} => ({\n      id,\n      name: 'Leo',\n    })),\n  },\n} satisfies Routes;\n\nexport const api = mion.initRoutes(routes);\n",[420,1528,1529,1553,1557,1572,1576,1586,1591,1638,1647,1705,1712,1728,1738,1743,1753,1757],{"__ignoreMap":434},[438,1530,1531,1533,1535,1537,1539,1541,1543,1545,1547,1549,1551],{"class":440,"line":441},[438,1532,1106],{"class":451},[438,1534,1109],{"class":463},[438,1536,1112],{"class":690},[438,1538,481],{"class":463},[438,1540,1117],{"class":690},[438,1542,1120],{"class":463},[438,1544,1123],{"class":451},[438,1546,796],{"class":463},[438,1548,1128],{"class":799},[438,1550,803],{"class":463},[438,1552,522],{"class":463},[438,1554,1555],{"class":440,"line":448},[438,1556,706],{"emptyLinePlaceholder":705},[438,1558,1559,1561,1563,1565,1567,1570],{"class":440,"line":500},[438,1560,1175],{"class":455},[438,1562,1232],{"class":690},[438,1564,1181],{"class":463},[438,1566,1238],{"class":1237},[438,1568,1569],{"class":690},"()",[438,1571,522],{"class":463},[438,1573,1574],{"class":440,"line":506},[438,1575,706],{"emptyLinePlaceholder":705},[438,1577,1578,1580,1582,1584],{"class":440,"line":525},[438,1579,1175],{"class":455},[438,1581,1267],{"class":690},[438,1583,1181],{"class":463},[438,1585,497],{"class":463},[438,1587,1588],{"class":440,"line":540},[438,1589,1590],{"class":444},"  \u002F\u002F takes a trace id and returns the time the server got the request\n",[438,1592,1593,1596,1598,1600,1602,1604,1606,1608,1610,1612,1615,1617,1619,1621,1623,1625,1628,1630,1633,1636],{"class":440,"line":555},[438,1594,1595],{"class":512},"  trace",[438,1597,516],{"class":463},[438,1599,1281],{"class":690},[438,1601,427],{"class":463},[438,1603,1286],{"class":1237},[438,1605,1241],{"class":690},[438,1607,1241],{"class":463},[438,1609,1297],{"class":1296},[438,1611,481],{"class":463},[438,1613,1614],{"class":1296}," traceId",[438,1616,516],{"class":463},[438,1618,519],{"class":459},[438,1620,1300],{"class":463},[438,1622,605],{"class":459},[438,1624,1203],{"class":455},[438,1626,1627],{"class":690}," Date",[438,1629,427],{"class":463},[438,1631,1632],{"class":1237},"now",[438,1634,1635],{"class":690},"())",[438,1637,1402],{"class":463},[438,1639,1640,1643,1645],{"class":440,"line":561},[438,1641,1642],{"class":512},"  users",[438,1644,516],{"class":463},[438,1646,497],{"class":463},[438,1648,1649,1652,1654,1656,1658,1660,1662,1664,1666,1668,1671,1673,1675,1677,1679,1682,1684,1686,1689,1692,1694,1696,1698,1700,1702],{"class":440,"line":574},[438,1650,1651],{"class":512},"    getUser",[438,1653,516],{"class":463},[438,1655,1281],{"class":690},[438,1657,427],{"class":463},[438,1659,1416],{"class":1237},[438,1661,1241],{"class":690},[438,1663,1241],{"class":463},[438,1665,1297],{"class":1296},[438,1667,481],{"class":463},[438,1669,1670],{"class":1296}," id",[438,1672,516],{"class":463},[438,1674,605],{"class":459},[438,1676,1300],{"class":463},[438,1678,1109],{"class":463},[438,1680,1681],{"class":512},"id",[438,1683,516],{"class":463},[438,1685,605],{"class":459},[438,1687,1688],{"class":463},";",[438,1690,1691],{"class":512}," name",[438,1693,516],{"class":463},[438,1695,519],{"class":459},[438,1697,1120],{"class":463},[438,1699,1203],{"class":455},[438,1701,1206],{"class":690},[438,1703,1704],{"class":463},"{\n",[438,1706,1707,1710],{"class":440,"line":589},[438,1708,1709],{"class":690},"      id",[438,1711,1402],{"class":463},[438,1713,1714,1717,1719,1721,1724,1726],{"class":440,"line":595},[438,1715,1716],{"class":512},"      name",[438,1718,516],{"class":463},[438,1720,796],{"class":463},[438,1722,1723],{"class":799},"Leo",[438,1725,803],{"class":463},[438,1727,1402],{"class":463},[438,1729,1730,1733,1736],{"class":440,"line":610},[438,1731,1732],{"class":463},"    }",[438,1734,1735],{"class":690},"))",[438,1737,1402],{"class":463},[438,1739,1740],{"class":440,"line":616},[438,1741,1742],{"class":463},"  },\n",[438,1744,1745,1747,1749,1751],{"class":440,"line":631},[438,1746,1120],{"class":463},[438,1748,1470],{"class":451},[438,1750,1117],{"class":459},[438,1752,522],{"class":463},[438,1754,1755],{"class":440,"line":637},[438,1756,706],{"emptyLinePlaceholder":705},[438,1758,1759,1761,1763,1765,1767,1769,1771,1773,1775],{"class":440,"line":652},[438,1760,452],{"class":451},[438,1762,1485],{"class":455},[438,1764,1488],{"class":690},[438,1766,1181],{"class":463},[438,1768,1281],{"class":690},[438,1770,427],{"class":463},[438,1772,1497],{"class":1237},[438,1774,1500],{"class":690},[438,1776,522],{"class":463},[405,1778,1779,1780,1783,1784,1787],{},"A call to ",[420,1781,1782],{},"users.getUser"," also sends the params of the ",[420,1785,1786],{},"trace"," middleware, and gets both return values back:",[429,1789,1793],{"className":1790,"code":1791,"language":1792,"meta":434,"style":434},"language-http shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","POST \u002Fusers\u002FgetUser\n{\"trace\": [\"a1b2c3\"], \"users\u002FgetUser\": [42]}\n\n200 OK\n{\"trace\": 1790812800000, \"users\u002FgetUser\": {\"id\": 42, \"name\": \"Leo\"}}\n","http",[420,1794,1795,1800,1805,1809,1814],{"__ignoreMap":434},[438,1796,1797],{"class":440,"line":441},[438,1798,1799],{},"POST \u002Fusers\u002FgetUser\n",[438,1801,1802],{"class":440,"line":448},[438,1803,1804],{},"{\"trace\": [\"a1b2c3\"], \"users\u002FgetUser\": [42]}\n",[438,1806,1807],{"class":440,"line":500},[438,1808,706],{"emptyLinePlaceholder":705},[438,1810,1811],{"class":440,"line":506},[438,1812,1813],{},"200 OK\n",[438,1815,1816],{"class":440,"line":525},[438,1817,1818],{},"{\"trace\": 1790812800000, \"users\u002FgetUser\": {\"id\": 42, \"name\": \"Leo\"}}\n",[405,1820,1821,1822,427],{},"Headers go as HTTP headers, never in the body. Errors use their own keys, see ",[425,1823,1825],{"href":1824},"\u002Frpc\u002Fserver\u002Ferror-handling#error-response-format","Error Response Format",[1071,1827,1828,1829,1832,1833,1836,1837,427],{},"The body can also be a plain JSON array of the route's params, like ",[420,1830,1831],{},"[42]",". Use it for a quick ",[420,1834,1835],{},"curl"," call when no middleware needs params and you do not use ",[425,1838,1839],{"href":75},"mionSyncRoutes",[412,1841,1843],{"id":1842},"json-round-trip-steps","JSON Round Trip Steps",[405,1845,1846,1847,427],{},"mion runs these steps for each request. A failed step ends the request with an error. To pick how params and return values are encoded, see ",[425,1848,1850],{"href":1849},"\u002Frpc\u002Fserver\u002Fjson-round-trip#parser-strategies","Parser Strategies",[1852,1853,1854,1858,1866],"ol",{},[1855,1856,1857],"li",{},"Parses the body as JSON, once.",[1855,1859,1860,1861,1865],{},"For each middleware and route in the ",[425,1862,1864],{"href":1863},"\u002Frpc\u002Fserver\u002Fmiddleware#execution-chain","execution chain"," (the order they run in), turns its params back into their types (a Date from a string, a Map from an array), validates them, then runs it.",[1855,1867,1868],{},"Encodes every return value and sends the response.",[412,1870,1872],{"id":1871},"queries-in-the-url","Queries in the URL",[405,1874,1875,1876,1879,1880,1883,1884,1886,1887,1889,1890,427],{},"The client sends a route made with ",[420,1877,1878],{},"mion.query()"," as a GET request when the URL fits in 4096 characters. The JSON body goes base64url encoded in the ",[420,1881,1882],{},"data"," query parameter. The server reads ",[420,1885,1882],{}," only when the request has no body. A ",[420,1888,1882],{}," value that is not base64url fails with ",[420,1891,1892],{},"invalid-query-body",[429,1894,1896],{"className":1790,"code":1895,"language":1792,"meta":434,"style":434},"GET \u002Fusers\u002FgetUser?data=eyJ1c2Vycy9nZXRVc2VyIjpbNDJdfQ\n",[420,1897,1898],{"__ignoreMap":434},[438,1899,1900],{"class":440,"line":441},[438,1901,1895],{},[412,1903,1905],{"id":1904},"request-body-safety","Request Body Safety",[405,1907,1908],{},"The router checks every body before your middleware and routes run:",[1910,1911,1912,1922,1928,1946],"ul",{},[1855,1913,1914,1915,1918,1919,427],{},"The body must be valid JSON holding an object or an array. Anything else fails with ",[420,1916,1917],{},"parsing-json-request-error"," or ",[420,1920,1921],{},"invalid-request-body",[1855,1923,1924,1925,427],{},"Each handler's value must be an array of params, or the request fails with ",[420,1926,1927],{},"serialization-error",[1855,1929,1930,1931,1934,1935,1937,1938,1941,1942,1945],{},"A ",[420,1932,1933],{},"__proto__"," key in data typed as a record or index signature fails with ",[420,1936,1927],{},", so a request cannot change an object's prototype. ",[420,1939,1940],{},"prototype"," and ",[420,1943,1944],{},"constructor"," are ordinary keys.",[1855,1947,1948,1949,427],{},"Params nested too deep to decode or validate fail with ",[420,1950,1951],{},"request-nesting-too-deep",[1953,1954,1955],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}","The first parameter of every handler, and the request format mion uses.","md",null,{"toc":24},{"title":40,"description":1956},"OsG7wTG0VrIcCOFbn7JgKkcjV8D3_F9ZdF6x0QWmznM",1793324369244]