[{"data":1,"prerenderedAt":3054},["ShallowReactive",2],{"navigation_docs":3,"-runtypes-guide-pure-functions":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":213,"body":401,"description":3048,"extension":3049,"links":3050,"meta":3051,"navigation":553,"path":214,"seo":3052,"stem":215,"__hash__":3053},"docs\u002F02.runtypes\u002F02.guide\u002F09.pure-functions.md",{"type":402,"value":403},"minimark",[404,412,417,448,1228,1232,1246,1412,1416,1423,1624,1628,1635,1709,1713,1730,1783,1786,1932,1936,1939,2139,2143,2150,2409,2413,2426,2434,2437,2441,2448,2452,2468,2559,2563,2580,2750,2760,2764,2775,2893,2905,2908,2912,2923,3033,3037,3040,3044],[405,406,407,411],"tip",{},[408,409,410],"strong",{},"Pure functions"," are small, self-contained helpers that the compiler inlines into the generated code. A helper that reaches outside itself fails the build.",[413,414,416],"h2",{"id":415},"registering-custom-format-patterns","Registering Custom Format Patterns",[418,419,420,421,425,426,429,430,433,434,438,439,443,444,447],"p",{},"Register a string pattern once with ",[422,423,424],"code",{},"registerFormatPattern",", then reference it from any number of ",[422,427,428],{},"TF.String"," types. Its optional ",[422,431,432],{},"mockSamples"," are the values the ",[435,436,437],"a",{"href":206},"mock generator"," draws from. The build rejects a regex a crafted input could use to freeze the validator (see ",[435,440,442],{"href":441},"\u002Fruntypes\u002Ftype-formats\u002Fstring#unsafe-regex-patterns","Unsafe Regex Patterns","); set ",[422,445,446],{},"unsafePattern: true"," for the rare pattern that check reads wrongly.",[449,450,455],"pre",{"className":451,"code":452,"language":453,"meta":454,"style":454},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import * as TF from '@mionjs\u002Frun-types\u002Fformats';\nimport * as RT from '@mionjs\u002Frun-types\u002Fbuilders';\nimport {createValidateFn, registerFormatPattern} from '@mionjs\u002Frun-types';\n\n\u002F\u002F a sample that does not match the regex throws at registration\nconst slug = registerFormatPattern({\n  source: '^[a-z0-9]+(?:-[a-z0-9]+)*$',\n  mockSamples: ['my-post', 'hello-world-2'],\n  message: 'must be a kebab-case slug',\n});\n\n\u002F\u002F no samples: each build draws new ones from the regex, unless a literal createMockDataFn seed pins them\nconst sku = registerFormatPattern({source: '^[A-Z]{3}-[0-9]{4}$'});\n\n\u002F\u002F `(\\w+\\s?)*` fails the freeze check; unsafePattern says you checked it yourself\nconst wordRun = registerFormatPattern({\n  source: '^(\\\\w+\\\\s?)*$',\n  mockSamples: ['one two'],\n  unsafePattern: true,\n});\n\n\u002F\u002F validation and mocks both use the pattern\ntype Slug = TF.String\u003C{pattern: typeof slug}>;\ntype Sku = TF.String\u003C{pattern: typeof sku}>;\ntype WordRun = TF.String\u003C{pattern: typeof wordRun}>;\n\n\u002F\u002F a builder schema takes the pattern value itself, no typeof\nconst Product = RT.object({sku: TF.string({pattern: sku})});\n\ntype Post = {slug: Slug; sku: Sku; title: string};\n\nconst isPost = createValidateFn\u003CPost>();\nisPost({slug: 'my-first-post', sku: 'ABC-1234', title: 'Hi'}); \u002F\u002F true\nisPost({slug: 'Not A Slug!', sku: 'ABC-1234', title: 'Hi'}); \u002F\u002F false\n\nexport {slug, sku, wordRun, isPost, Product};\nexport type {Slug, Sku, WordRun, Post};\n","ts","",[422,456,457,493,516,548,555,562,584,604,636,653,663,668,674,709,714,720,736,763,783,797,806,811,817,856,885,914,919,925,979,984,1025,1030,1057,1113,1166,1171,1201],{"__ignoreMap":454},[458,459,462,466,470,473,477,480,483,487,490],"span",{"class":460,"line":461},"line",1,[458,463,465],{"class":464},"s7zQu","import",[458,467,469],{"class":468},"sMK4o"," *",[458,471,472],{"class":464}," as",[458,474,476],{"class":475},"sTEyZ"," TF ",[458,478,479],{"class":464},"from",[458,481,482],{"class":468}," '",[458,484,486],{"class":485},"sfazB","@mionjs\u002Frun-types\u002Fformats",[458,488,489],{"class":468},"'",[458,491,492],{"class":468},";\n",[458,494,496,498,500,502,505,507,509,512,514],{"class":460,"line":495},2,[458,497,465],{"class":464},[458,499,469],{"class":468},[458,501,472],{"class":464},[458,503,504],{"class":475}," RT ",[458,506,479],{"class":464},[458,508,482],{"class":468},[458,510,511],{"class":485},"@mionjs\u002Frun-types\u002Fbuilders",[458,513,489],{"class":468},[458,515,492],{"class":468},[458,517,519,521,524,527,530,533,536,539,541,544,546],{"class":460,"line":518},3,[458,520,465],{"class":464},[458,522,523],{"class":468}," {",[458,525,526],{"class":475},"createValidateFn",[458,528,529],{"class":468},",",[458,531,532],{"class":475}," registerFormatPattern",[458,534,535],{"class":468},"}",[458,537,538],{"class":464}," from",[458,540,482],{"class":468},[458,542,543],{"class":485},"@mionjs\u002Frun-types",[458,545,489],{"class":468},[458,547,492],{"class":468},[458,549,551],{"class":460,"line":550},4,[458,552,554],{"emptyLinePlaceholder":553},true,"\n",[458,556,558],{"class":460,"line":557},5,[458,559,561],{"class":560},"sHwdD","\u002F\u002F a sample that does not match the regex throws at registration\n",[458,563,565,569,572,575,578,581],{"class":460,"line":564},6,[458,566,568],{"class":567},"spNyl","const",[458,570,571],{"class":475}," slug ",[458,573,574],{"class":468},"=",[458,576,532],{"class":577},"s2Zo4",[458,579,580],{"class":475},"(",[458,582,583],{"class":468},"{\n",[458,585,587,591,594,596,599,601],{"class":460,"line":586},7,[458,588,590],{"class":589},"swJcz","  source",[458,592,593],{"class":468},":",[458,595,482],{"class":468},[458,597,598],{"class":485},"^[a-z0-9]+(?:-[a-z0-9]+)*$",[458,600,489],{"class":468},[458,602,603],{"class":468},",\n",[458,605,607,610,612,615,617,620,622,624,626,629,631,634],{"class":460,"line":606},8,[458,608,609],{"class":589},"  mockSamples",[458,611,593],{"class":468},[458,613,614],{"class":475}," [",[458,616,489],{"class":468},[458,618,619],{"class":485},"my-post",[458,621,489],{"class":468},[458,623,529],{"class":468},[458,625,482],{"class":468},[458,627,628],{"class":485},"hello-world-2",[458,630,489],{"class":468},[458,632,633],{"class":475},"]",[458,635,603],{"class":468},[458,637,639,642,644,646,649,651],{"class":460,"line":638},9,[458,640,641],{"class":589},"  message",[458,643,593],{"class":468},[458,645,482],{"class":468},[458,647,648],{"class":485},"must be a kebab-case slug",[458,650,489],{"class":468},[458,652,603],{"class":468},[458,654,656,658,661],{"class":460,"line":655},10,[458,657,535],{"class":468},[458,659,660],{"class":475},")",[458,662,492],{"class":468},[458,664,666],{"class":460,"line":665},11,[458,667,554],{"emptyLinePlaceholder":553},[458,669,671],{"class":460,"line":670},12,[458,672,673],{"class":560},"\u002F\u002F no samples: each build draws new ones from the regex, unless a literal createMockDataFn seed pins them\n",[458,675,677,679,682,684,686,688,691,694,696,698,701,703,705,707],{"class":460,"line":676},13,[458,678,568],{"class":567},[458,680,681],{"class":475}," sku ",[458,683,574],{"class":468},[458,685,532],{"class":577},[458,687,580],{"class":475},[458,689,690],{"class":468},"{",[458,692,693],{"class":589},"source",[458,695,593],{"class":468},[458,697,482],{"class":468},[458,699,700],{"class":485},"^[A-Z]{3}-[0-9]{4}$",[458,702,489],{"class":468},[458,704,535],{"class":468},[458,706,660],{"class":475},[458,708,492],{"class":468},[458,710,712],{"class":460,"line":711},14,[458,713,554],{"emptyLinePlaceholder":553},[458,715,717],{"class":460,"line":716},15,[458,718,719],{"class":560},"\u002F\u002F `(\\w+\\s?)*` fails the freeze check; unsafePattern says you checked it yourself\n",[458,721,723,725,728,730,732,734],{"class":460,"line":722},16,[458,724,568],{"class":567},[458,726,727],{"class":475}," wordRun ",[458,729,574],{"class":468},[458,731,532],{"class":577},[458,733,580],{"class":475},[458,735,583],{"class":468},[458,737,739,741,743,745,748,751,754,756,759,761],{"class":460,"line":738},17,[458,740,590],{"class":589},[458,742,593],{"class":468},[458,744,482],{"class":468},[458,746,747],{"class":485},"^(",[458,749,750],{"class":475},"\\\\",[458,752,753],{"class":485},"w+",[458,755,750],{"class":475},[458,757,758],{"class":485},"s?)*$",[458,760,489],{"class":468},[458,762,603],{"class":468},[458,764,766,768,770,772,774,777,779,781],{"class":460,"line":765},18,[458,767,609],{"class":589},[458,769,593],{"class":468},[458,771,614],{"class":475},[458,773,489],{"class":468},[458,775,776],{"class":485},"one two",[458,778,489],{"class":468},[458,780,633],{"class":475},[458,782,603],{"class":468},[458,784,786,789,791,795],{"class":460,"line":785},19,[458,787,788],{"class":589},"  unsafePattern",[458,790,593],{"class":468},[458,792,794],{"class":793},"sfNiH"," true",[458,796,603],{"class":468},[458,798,800,802,804],{"class":460,"line":799},20,[458,801,535],{"class":468},[458,803,660],{"class":475},[458,805,492],{"class":468},[458,807,809],{"class":460,"line":808},21,[458,810,554],{"emptyLinePlaceholder":553},[458,812,814],{"class":460,"line":813},22,[458,815,816],{"class":560},"\u002F\u002F validation and mocks both use the pattern\n",[458,818,820,823,827,830,833,836,839,842,845,847,850,853],{"class":460,"line":819},23,[458,821,822],{"class":567},"type",[458,824,826],{"class":825},"sBMFI"," Slug",[458,828,829],{"class":468}," =",[458,831,832],{"class":825}," TF",[458,834,835],{"class":468},".",[458,837,838],{"class":825},"String",[458,840,841],{"class":468},"\u003C{",[458,843,844],{"class":589},"pattern",[458,846,593],{"class":468},[458,848,849],{"class":468}," typeof",[458,851,852],{"class":475}," slug",[458,854,855],{"class":468},"}>;\n",[458,857,859,861,864,866,868,870,872,874,876,878,880,883],{"class":460,"line":858},24,[458,860,822],{"class":567},[458,862,863],{"class":825}," Sku",[458,865,829],{"class":468},[458,867,832],{"class":825},[458,869,835],{"class":468},[458,871,838],{"class":825},[458,873,841],{"class":468},[458,875,844],{"class":589},[458,877,593],{"class":468},[458,879,849],{"class":468},[458,881,882],{"class":475}," sku",[458,884,855],{"class":468},[458,886,888,890,893,895,897,899,901,903,905,907,909,912],{"class":460,"line":887},25,[458,889,822],{"class":567},[458,891,892],{"class":825}," WordRun",[458,894,829],{"class":468},[458,896,832],{"class":825},[458,898,835],{"class":468},[458,900,838],{"class":825},[458,902,841],{"class":468},[458,904,844],{"class":589},[458,906,593],{"class":468},[458,908,849],{"class":468},[458,910,911],{"class":475}," wordRun",[458,913,855],{"class":468},[458,915,917],{"class":460,"line":916},26,[458,918,554],{"emptyLinePlaceholder":553},[458,920,922],{"class":460,"line":921},27,[458,923,924],{"class":560},"\u002F\u002F a builder schema takes the pattern value itself, no typeof\n",[458,926,928,930,933,935,938,940,943,945,947,950,952,954,956,959,961,963,965,967,969,971,973,975,977],{"class":460,"line":927},28,[458,929,568],{"class":567},[458,931,932],{"class":475}," Product ",[458,934,574],{"class":468},[458,936,937],{"class":475}," RT",[458,939,835],{"class":468},[458,941,942],{"class":577},"object",[458,944,580],{"class":475},[458,946,690],{"class":468},[458,948,949],{"class":589},"sku",[458,951,593],{"class":468},[458,953,832],{"class":475},[458,955,835],{"class":468},[458,957,958],{"class":577},"string",[458,960,580],{"class":475},[458,962,690],{"class":468},[458,964,844],{"class":589},[458,966,593],{"class":468},[458,968,882],{"class":475},[458,970,535],{"class":468},[458,972,660],{"class":475},[458,974,535],{"class":468},[458,976,660],{"class":475},[458,978,492],{"class":468},[458,980,982],{"class":460,"line":981},29,[458,983,554],{"emptyLinePlaceholder":553},[458,985,987,989,992,994,996,999,1001,1003,1006,1008,1010,1012,1014,1017,1019,1022],{"class":460,"line":986},30,[458,988,822],{"class":567},[458,990,991],{"class":825}," Post",[458,993,829],{"class":468},[458,995,523],{"class":468},[458,997,998],{"class":589},"slug",[458,1000,593],{"class":468},[458,1002,826],{"class":825},[458,1004,1005],{"class":468},";",[458,1007,882],{"class":589},[458,1009,593],{"class":468},[458,1011,863],{"class":825},[458,1013,1005],{"class":468},[458,1015,1016],{"class":589}," title",[458,1018,593],{"class":468},[458,1020,1021],{"class":825}," string",[458,1023,1024],{"class":468},"};\n",[458,1026,1028],{"class":460,"line":1027},31,[458,1029,554],{"emptyLinePlaceholder":553},[458,1031,1033,1035,1038,1040,1043,1046,1049,1052,1055],{"class":460,"line":1032},32,[458,1034,568],{"class":567},[458,1036,1037],{"class":475}," isPost ",[458,1039,574],{"class":468},[458,1041,1042],{"class":577}," createValidateFn",[458,1044,1045],{"class":468},"\u003C",[458,1047,1048],{"class":825},"Post",[458,1050,1051],{"class":468},">",[458,1053,1054],{"class":475},"()",[458,1056,492],{"class":468},[458,1058,1060,1063,1065,1067,1069,1071,1073,1076,1078,1080,1082,1084,1086,1089,1091,1093,1095,1097,1099,1102,1104,1106,1108,1110],{"class":460,"line":1059},33,[458,1061,1062],{"class":577},"isPost",[458,1064,580],{"class":475},[458,1066,690],{"class":468},[458,1068,998],{"class":589},[458,1070,593],{"class":468},[458,1072,482],{"class":468},[458,1074,1075],{"class":485},"my-first-post",[458,1077,489],{"class":468},[458,1079,529],{"class":468},[458,1081,882],{"class":589},[458,1083,593],{"class":468},[458,1085,482],{"class":468},[458,1087,1088],{"class":485},"ABC-1234",[458,1090,489],{"class":468},[458,1092,529],{"class":468},[458,1094,1016],{"class":589},[458,1096,593],{"class":468},[458,1098,482],{"class":468},[458,1100,1101],{"class":485},"Hi",[458,1103,489],{"class":468},[458,1105,535],{"class":468},[458,1107,660],{"class":475},[458,1109,1005],{"class":468},[458,1111,1112],{"class":560}," \u002F\u002F true\n",[458,1114,1116,1118,1120,1122,1124,1126,1128,1131,1133,1135,1137,1139,1141,1143,1145,1147,1149,1151,1153,1155,1157,1159,1161,1163],{"class":460,"line":1115},34,[458,1117,1062],{"class":577},[458,1119,580],{"class":475},[458,1121,690],{"class":468},[458,1123,998],{"class":589},[458,1125,593],{"class":468},[458,1127,482],{"class":468},[458,1129,1130],{"class":485},"Not A Slug!",[458,1132,489],{"class":468},[458,1134,529],{"class":468},[458,1136,882],{"class":589},[458,1138,593],{"class":468},[458,1140,482],{"class":468},[458,1142,1088],{"class":485},[458,1144,489],{"class":468},[458,1146,529],{"class":468},[458,1148,1016],{"class":589},[458,1150,593],{"class":468},[458,1152,482],{"class":468},[458,1154,1101],{"class":485},[458,1156,489],{"class":468},[458,1158,535],{"class":468},[458,1160,660],{"class":475},[458,1162,1005],{"class":468},[458,1164,1165],{"class":560}," \u002F\u002F false\n",[458,1167,1169],{"class":460,"line":1168},35,[458,1170,554],{"emptyLinePlaceholder":553},[458,1172,1174,1177,1179,1181,1183,1185,1187,1189,1191,1194,1196,1199],{"class":460,"line":1173},36,[458,1175,1176],{"class":464},"export",[458,1178,523],{"class":468},[458,1180,998],{"class":475},[458,1182,529],{"class":468},[458,1184,882],{"class":475},[458,1186,529],{"class":468},[458,1188,911],{"class":475},[458,1190,529],{"class":468},[458,1192,1193],{"class":475}," isPost",[458,1195,529],{"class":468},[458,1197,1198],{"class":475}," Product",[458,1200,1024],{"class":468},[458,1202,1204,1206,1209,1211,1214,1216,1218,1220,1222,1224,1226],{"class":460,"line":1203},37,[458,1205,1176],{"class":464},[458,1207,1208],{"class":464}," type",[458,1210,523],{"class":468},[458,1212,1213],{"class":475},"Slug",[458,1215,529],{"class":468},[458,1217,863],{"class":475},[458,1219,529],{"class":468},[458,1221,892],{"class":475},[458,1223,529],{"class":468},[458,1225,991],{"class":475},[458,1227,1024],{"class":468},[413,1229,1231],{"id":1230},"registering-custom-mock-functions","Registering Custom Mock Functions",[418,1233,1234,1235,1238,1239,1242,1243,835],{},"Register a mock function for a ",[422,1236,1237],{},"RunTypeKind"," to change what the mock generator returns for that kind. It gets the format annotation, so you can branch on its ",[422,1240,1241],{},"name"," or ",[422,1244,1245],{},"params",[449,1247,1249],{"className":451,"code":1248,"language":453,"meta":454,"style":454},"import {RunTypeKind, type FormatAnnotation} from '@mionjs\u002Frun-types';\nimport {registerMockingFunction} from '@mionjs\u002Frun-types\u002Fmocking';\n\n\u002F\u002F from now on createMockDataFn uses this for every mocked string format\nregisterMockingFunction(RunTypeKind.string, (annotation: FormatAnnotation) => {\n  if (annotation.name === 'email') return 'someone@example.com'; \u002F\u002F friendlier than a random string\n  return undefined; \u002F\u002F defer to the built-in mock for everything else\n});\n\nexport {};\n",[422,1250,1251,1278,1300,1304,1309,1341,1382,1393,1401,1405],{"__ignoreMap":454},[458,1252,1253,1255,1257,1259,1261,1263,1266,1268,1270,1272,1274,1276],{"class":460,"line":461},[458,1254,465],{"class":464},[458,1256,523],{"class":468},[458,1258,1237],{"class":475},[458,1260,529],{"class":468},[458,1262,1208],{"class":464},[458,1264,1265],{"class":475}," FormatAnnotation",[458,1267,535],{"class":468},[458,1269,538],{"class":464},[458,1271,482],{"class":468},[458,1273,543],{"class":485},[458,1275,489],{"class":468},[458,1277,492],{"class":468},[458,1279,1280,1282,1284,1287,1289,1291,1293,1296,1298],{"class":460,"line":495},[458,1281,465],{"class":464},[458,1283,523],{"class":468},[458,1285,1286],{"class":475},"registerMockingFunction",[458,1288,535],{"class":468},[458,1290,538],{"class":464},[458,1292,482],{"class":468},[458,1294,1295],{"class":485},"@mionjs\u002Frun-types\u002Fmocking",[458,1297,489],{"class":468},[458,1299,492],{"class":468},[458,1301,1302],{"class":460,"line":518},[458,1303,554],{"emptyLinePlaceholder":553},[458,1305,1306],{"class":460,"line":550},[458,1307,1308],{"class":560},"\u002F\u002F from now on createMockDataFn uses this for every mocked string format\n",[458,1310,1311,1313,1316,1318,1320,1322,1325,1329,1331,1333,1335,1338],{"class":460,"line":557},[458,1312,1286],{"class":577},[458,1314,1315],{"class":475},"(RunTypeKind",[458,1317,835],{"class":468},[458,1319,958],{"class":475},[458,1321,529],{"class":468},[458,1323,1324],{"class":468}," (",[458,1326,1328],{"class":1327},"sHdIc","annotation",[458,1330,593],{"class":468},[458,1332,1265],{"class":825},[458,1334,660],{"class":468},[458,1336,1337],{"class":567}," =>",[458,1339,1340],{"class":468}," {\n",[458,1342,1343,1346,1348,1350,1352,1354,1357,1359,1362,1364,1367,1370,1372,1375,1377,1379],{"class":460,"line":564},[458,1344,1345],{"class":464},"  if",[458,1347,1324],{"class":589},[458,1349,1328],{"class":475},[458,1351,835],{"class":468},[458,1353,1241],{"class":475},[458,1355,1356],{"class":468}," ===",[458,1358,482],{"class":468},[458,1360,1361],{"class":485},"email",[458,1363,489],{"class":468},[458,1365,1366],{"class":589},") ",[458,1368,1369],{"class":464},"return",[458,1371,482],{"class":468},[458,1373,1374],{"class":485},"someone@example.com",[458,1376,489],{"class":468},[458,1378,1005],{"class":468},[458,1380,1381],{"class":560}," \u002F\u002F friendlier than a random string\n",[458,1383,1384,1387,1390],{"class":460,"line":586},[458,1385,1386],{"class":464},"  return",[458,1388,1389],{"class":468}," undefined;",[458,1391,1392],{"class":560}," \u002F\u002F defer to the built-in mock for everything else\n",[458,1394,1395,1397,1399],{"class":460,"line":606},[458,1396,535],{"class":468},[458,1398,660],{"class":475},[458,1400,492],{"class":468},[458,1402,1403],{"class":460,"line":638},[458,1404,554],{"emptyLinePlaceholder":553},[458,1406,1407,1409],{"class":460,"line":655},[458,1408,1176],{"class":464},[458,1410,1411],{"class":468}," {};\n",[413,1413,1415],{"id":1414},"registering-a-pure-function","Registering a Pure Function",[418,1417,1418,1419,1422],{},"Register a pure helper that needs one-time setup (a compiled regex, a lookup table) or composes another pure fn with ",[422,1420,1421],{},"registerPureFnFactory(factory)",". The factory returns the real function.",[449,1424,1426],{"className":451,"code":1425,"language":453,"meta":454,"style":454},"import {registerPureFnFactory} from '@mionjs\u002Frun-types\u002Fruntime';\n\n\u002F\u002F You get back the helper's id: your package name plus a hash of the helper, like '@acme\u002Ftext#pf_9Zt1bRm4cVaPqL'.\nexport const slugify = registerPureFnFactory(function () {\n  \u002F\u002F Anything declared INSIDE the factory is fine: it ships with the helper.\n  const NON_WORD = \u002F[^a-z0-9]+\u002Fg;\n  return function _slugify(input: string): string {\n    return input.toLowerCase().replace(NON_WORD, '-').replace(\u002F^-|-$\u002Fg, '');\n  };\n});\n",[422,1427,1428,1450,1454,1459,1484,1489,1514,1540,1611,1616],{"__ignoreMap":454},[458,1429,1430,1432,1434,1437,1439,1441,1443,1446,1448],{"class":460,"line":461},[458,1431,465],{"class":464},[458,1433,523],{"class":468},[458,1435,1436],{"class":475},"registerPureFnFactory",[458,1438,535],{"class":468},[458,1440,538],{"class":464},[458,1442,482],{"class":468},[458,1444,1445],{"class":485},"@mionjs\u002Frun-types\u002Fruntime",[458,1447,489],{"class":468},[458,1449,492],{"class":468},[458,1451,1452],{"class":460,"line":495},[458,1453,554],{"emptyLinePlaceholder":553},[458,1455,1456],{"class":460,"line":518},[458,1457,1458],{"class":560},"\u002F\u002F You get back the helper's id: your package name plus a hash of the helper, like '@acme\u002Ftext#pf_9Zt1bRm4cVaPqL'.\n",[458,1460,1461,1463,1466,1469,1471,1474,1476,1479,1482],{"class":460,"line":550},[458,1462,1176],{"class":464},[458,1464,1465],{"class":567}," const",[458,1467,1468],{"class":475}," slugify ",[458,1470,574],{"class":468},[458,1472,1473],{"class":577}," registerPureFnFactory",[458,1475,580],{"class":475},[458,1477,1478],{"class":567},"function",[458,1480,1481],{"class":468}," ()",[458,1483,1340],{"class":468},[458,1485,1486],{"class":460,"line":557},[458,1487,1488],{"class":560},"  \u002F\u002F Anything declared INSIDE the factory is fine: it ships with the helper.\n",[458,1490,1491,1494,1497,1499,1502,1505,1508,1512],{"class":460,"line":564},[458,1492,1493],{"class":567},"  const",[458,1495,1496],{"class":475}," NON_WORD",[458,1498,829],{"class":468},[458,1500,1501],{"class":468}," \u002F[^",[458,1503,1504],{"class":485},"a-z0-9",[458,1506,1507],{"class":468},"]+\u002F",[458,1509,1511],{"class":1510},"sbssI","g",[458,1513,492],{"class":468},[458,1515,1516,1518,1521,1524,1526,1529,1531,1533,1536,1538],{"class":460,"line":586},[458,1517,1386],{"class":464},[458,1519,1520],{"class":567}," function",[458,1522,1523],{"class":577}," _slugify",[458,1525,580],{"class":468},[458,1527,1528],{"class":1327},"input",[458,1530,593],{"class":468},[458,1532,1021],{"class":825},[458,1534,1535],{"class":468},"):",[458,1537,1021],{"class":825},[458,1539,1340],{"class":468},[458,1541,1542,1545,1548,1550,1553,1555,1557,1560,1562,1565,1567,1569,1572,1574,1576,1578,1580,1582,1585,1588,1590,1593,1595,1598,1600,1602,1604,1607,1609],{"class":460,"line":606},[458,1543,1544],{"class":464},"    return",[458,1546,1547],{"class":475}," input",[458,1549,835],{"class":468},[458,1551,1552],{"class":577},"toLowerCase",[458,1554,1054],{"class":589},[458,1556,835],{"class":468},[458,1558,1559],{"class":577},"replace",[458,1561,580],{"class":589},[458,1563,1564],{"class":475},"NON_WORD",[458,1566,529],{"class":468},[458,1568,482],{"class":468},[458,1570,1571],{"class":485},"-",[458,1573,489],{"class":468},[458,1575,660],{"class":589},[458,1577,835],{"class":468},[458,1579,1559],{"class":577},[458,1581,580],{"class":589},[458,1583,1584],{"class":468},"\u002F",[458,1586,1587],{"class":464},"^",[458,1589,1571],{"class":485},[458,1591,1592],{"class":468},"|",[458,1594,1571],{"class":485},[458,1596,1597],{"class":464},"$",[458,1599,1584],{"class":468},[458,1601,1511],{"class":1510},[458,1603,529],{"class":468},[458,1605,1606],{"class":468}," ''",[458,1608,660],{"class":589},[458,1610,492],{"class":468},[458,1612,1613],{"class":460,"line":638},[458,1614,1615],{"class":468},"  };\n",[458,1617,1618,1620,1622],{"class":460,"line":655},[458,1619,535],{"class":468},[458,1621,660],{"class":475},[458,1623,492],{"class":468},[413,1625,1627],{"id":1626},"registering-a-pure-function-without-setup","Registering a Pure Function Without Setup",[418,1629,1630,1631,1634],{},"When the helper needs neither setup nor another pure fn, ",[422,1632,1633],{},"registerPureFn(fn)"," takes the function itself.",[449,1636,1638],{"className":451,"code":1637,"language":453,"meta":454,"style":454},"import {registerPureFn} from '@mionjs\u002Frun-types\u002Fruntime';\n\nexport const double = registerPureFn((input: number): number => input * 2);\n",[422,1639,1640,1661,1665],{"__ignoreMap":454},[458,1641,1642,1644,1646,1649,1651,1653,1655,1657,1659],{"class":460,"line":461},[458,1643,465],{"class":464},[458,1645,523],{"class":468},[458,1647,1648],{"class":475},"registerPureFn",[458,1650,535],{"class":468},[458,1652,538],{"class":464},[458,1654,482],{"class":468},[458,1656,1445],{"class":485},[458,1658,489],{"class":468},[458,1660,492],{"class":468},[458,1662,1663],{"class":460,"line":495},[458,1664,554],{"emptyLinePlaceholder":553},[458,1666,1667,1669,1671,1674,1676,1679,1681,1683,1685,1687,1690,1692,1694,1696,1699,1702,1705,1707],{"class":460,"line":518},[458,1668,1176],{"class":464},[458,1670,1465],{"class":567},[458,1672,1673],{"class":475}," double ",[458,1675,574],{"class":468},[458,1677,1678],{"class":577}," registerPureFn",[458,1680,580],{"class":475},[458,1682,580],{"class":468},[458,1684,1528],{"class":1327},[458,1686,593],{"class":468},[458,1688,1689],{"class":825}," number",[458,1691,1535],{"class":468},[458,1693,1689],{"class":825},[458,1695,1337],{"class":567},[458,1697,1698],{"class":475}," input ",[458,1700,1701],{"class":468},"*",[458,1703,1704],{"class":1510}," 2",[458,1706,660],{"class":475},[458,1708,492],{"class":468},[413,1710,1712],{"id":1711},"pure-function-rules","Pure Function Rules",[418,1714,1715,1716,1719,1720,1242,1723,1726,1727,1729],{},"A helper must be self-contained: no outer-scope captures, no ",[422,1717,1718],{},"this",", no ",[422,1721,1722],{},"await",[422,1724,1725],{},"yield",", and no dynamic ",[422,1728,465],{},". Anything it needs goes inside the function. Break a rule and the build reports an error.",[418,1731,1732,1733,1736,1737,1736,1740,1736,1743,1746,1747,1736,1750,1736,1753,1736,1756,1759,1760,1763,1764,1767,1768,1242,1771,1774,1775,1778,1779,1782],{},"Standard built-ins are allowed: ",[422,1734,1735],{},"Math",", ",[422,1738,1739],{},"JSON",[422,1741,1742],{},"ArrayBuffer",[422,1744,1745],{},"DataView",", typed arrays like ",[422,1748,1749],{},"Uint8Array",[422,1751,1752],{},"TextEncoder",[422,1754,1755],{},"TextDecoder",[422,1757,1758],{},"btoa"," and ",[422,1761,1762],{},"atob",". I\u002FO and async are not, because the helper is inlined into synchronous code: no ",[422,1765,1766],{},"fetch"," or network, no timers, no ",[422,1769,1770],{},"process",[422,1772,1773],{},"globalThis",", nothing awaited. So ",[422,1776,1777],{},"crypto.subtle.digest"," does not fit (hash over typed arrays instead), while a synchronous call like ",[422,1780,1781],{},"crypto.randomUUID"," is fine.",[418,1784,1785],{},"Write the helper inline, right where you register it: a name anything else could reach is rejected.",[449,1787,1789],{"className":451,"code":1788,"language":453,"meta":454,"style":454},"\u002F\u002F Rejected: a name something else could reach\nimport {validate} from '.\u002Fvalidators';        \u002F\u002F imported\nexport const validate = (v) => \u002F* … *\u002F true;  \u002F\u002F exported\nconst validate = (v) => \u002F* … *\u002F true;         \u002F\u002F a named local binding\nregisterValidator(validate);\n\n\u002F\u002F Fine: inline at the call site\nregisterValidator((v: unknown) => typeof v === 'string');\n",[422,1790,1791,1796,1821,1851,1876,1886,1890,1895],{"__ignoreMap":454},[458,1792,1793],{"class":460,"line":461},[458,1794,1795],{"class":560},"\u002F\u002F Rejected: a name something else could reach\n",[458,1797,1798,1800,1802,1805,1807,1809,1811,1814,1816,1818],{"class":460,"line":495},[458,1799,465],{"class":464},[458,1801,523],{"class":468},[458,1803,1804],{"class":475},"validate",[458,1806,535],{"class":468},[458,1808,538],{"class":464},[458,1810,482],{"class":468},[458,1812,1813],{"class":485},".\u002Fvalidators",[458,1815,489],{"class":468},[458,1817,1005],{"class":468},[458,1819,1820],{"class":560},"        \u002F\u002F imported\n",[458,1822,1823,1825,1827,1830,1832,1834,1837,1839,1841,1844,1846,1848],{"class":460,"line":518},[458,1824,1176],{"class":464},[458,1826,1465],{"class":567},[458,1828,1829],{"class":475}," validate ",[458,1831,574],{"class":468},[458,1833,1324],{"class":468},[458,1835,1836],{"class":1327},"v",[458,1838,660],{"class":468},[458,1840,1337],{"class":567},[458,1842,1843],{"class":560}," \u002F* … *\u002F",[458,1845,794],{"class":793},[458,1847,1005],{"class":468},[458,1849,1850],{"class":560},"  \u002F\u002F exported\n",[458,1852,1853,1855,1857,1859,1861,1863,1865,1867,1869,1871,1873],{"class":460,"line":550},[458,1854,568],{"class":567},[458,1856,1829],{"class":475},[458,1858,574],{"class":468},[458,1860,1324],{"class":468},[458,1862,1836],{"class":1327},[458,1864,660],{"class":468},[458,1866,1337],{"class":567},[458,1868,1843],{"class":560},[458,1870,794],{"class":793},[458,1872,1005],{"class":468},[458,1874,1875],{"class":560},"         \u002F\u002F a named local binding\n",[458,1877,1878,1881,1884],{"class":460,"line":557},[458,1879,1880],{"class":577},"registerValidator",[458,1882,1883],{"class":475},"(validate)",[458,1885,492],{"class":468},[458,1887,1888],{"class":460,"line":564},[458,1889,554],{"emptyLinePlaceholder":553},[458,1891,1892],{"class":460,"line":586},[458,1893,1894],{"class":560},"\u002F\u002F Fine: inline at the call site\n",[458,1896,1897,1899,1901,1903,1905,1907,1910,1912,1914,1916,1919,1922,1924,1926,1928,1930],{"class":460,"line":606},[458,1898,1880],{"class":577},[458,1900,580],{"class":475},[458,1902,580],{"class":468},[458,1904,1836],{"class":1327},[458,1906,593],{"class":468},[458,1908,1909],{"class":825}," unknown",[458,1911,660],{"class":468},[458,1913,1337],{"class":567},[458,1915,849],{"class":468},[458,1917,1918],{"class":475}," v ",[458,1920,1921],{"class":468},"===",[458,1923,482],{"class":468},[458,1925,958],{"class":485},[458,1927,489],{"class":468},[458,1929,660],{"class":475},[458,1931,492],{"class":468},[413,1933,1935],{"id":1934},"reusing-one-pure-function-from-another","Reusing One Pure Function From Another",[418,1937,1938],{},"To call one pure function from another, import its id and pass it to the factory utilities. The id is a real value, so your editor completes it and your type checker follows a rename or a move.",[449,1940,1942],{"className":451,"code":1941,"language":453,"meta":454,"style":454},"import {registerPureFnFactory} from '@mionjs\u002Frun-types\u002Fruntime';\nimport {slugify} from '.\u002Fcustom-pure-fn.js';\n\nexport const slugList = registerPureFnFactory(function (utl) {\n  \u002F\u002F recorded at build time: slugify ships with slugList, and a typo fails the build\n  const toSlug = utl.getPureFn(slugify) as (input: string) => string;\n  return function _slugList(values: string[]): string[] {\n    return values.map((value) => toSlug(value));\n  };\n});\n",[422,1943,1944,1964,1986,1990,2016,2021,2063,2093,2127,2131],{"__ignoreMap":454},[458,1945,1946,1948,1950,1952,1954,1956,1958,1960,1962],{"class":460,"line":461},[458,1947,465],{"class":464},[458,1949,523],{"class":468},[458,1951,1436],{"class":475},[458,1953,535],{"class":468},[458,1955,538],{"class":464},[458,1957,482],{"class":468},[458,1959,1445],{"class":485},[458,1961,489],{"class":468},[458,1963,492],{"class":468},[458,1965,1966,1968,1970,1973,1975,1977,1979,1982,1984],{"class":460,"line":495},[458,1967,465],{"class":464},[458,1969,523],{"class":468},[458,1971,1972],{"class":475},"slugify",[458,1974,535],{"class":468},[458,1976,538],{"class":464},[458,1978,482],{"class":468},[458,1980,1981],{"class":485},".\u002Fcustom-pure-fn.js",[458,1983,489],{"class":468},[458,1985,492],{"class":468},[458,1987,1988],{"class":460,"line":518},[458,1989,554],{"emptyLinePlaceholder":553},[458,1991,1992,1994,1996,1999,2001,2003,2005,2007,2009,2012,2014],{"class":460,"line":550},[458,1993,1176],{"class":464},[458,1995,1465],{"class":567},[458,1997,1998],{"class":475}," slugList ",[458,2000,574],{"class":468},[458,2002,1473],{"class":577},[458,2004,580],{"class":475},[458,2006,1478],{"class":567},[458,2008,1324],{"class":468},[458,2010,2011],{"class":1327},"utl",[458,2013,660],{"class":468},[458,2015,1340],{"class":468},[458,2017,2018],{"class":460,"line":557},[458,2019,2020],{"class":560},"  \u002F\u002F recorded at build time: slugify ships with slugList, and a typo fails the build\n",[458,2022,2023,2025,2028,2030,2033,2035,2038,2040,2042,2044,2047,2049,2051,2053,2055,2057,2059,2061],{"class":460,"line":564},[458,2024,1493],{"class":567},[458,2026,2027],{"class":475}," toSlug",[458,2029,829],{"class":468},[458,2031,2032],{"class":475}," utl",[458,2034,835],{"class":468},[458,2036,2037],{"class":577},"getPureFn",[458,2039,580],{"class":589},[458,2041,1972],{"class":475},[458,2043,1366],{"class":589},[458,2045,2046],{"class":464},"as",[458,2048,1324],{"class":468},[458,2050,1528],{"class":1327},[458,2052,593],{"class":468},[458,2054,1021],{"class":825},[458,2056,660],{"class":468},[458,2058,1337],{"class":567},[458,2060,1021],{"class":825},[458,2062,492],{"class":468},[458,2064,2065,2067,2069,2072,2074,2077,2079,2081,2084,2086,2088,2091],{"class":460,"line":586},[458,2066,1386],{"class":464},[458,2068,1520],{"class":567},[458,2070,2071],{"class":577}," _slugList",[458,2073,580],{"class":468},[458,2075,2076],{"class":1327},"values",[458,2078,593],{"class":468},[458,2080,1021],{"class":825},[458,2082,2083],{"class":589},"[]",[458,2085,1535],{"class":468},[458,2087,1021],{"class":825},[458,2089,2090],{"class":589},"[] ",[458,2092,583],{"class":468},[458,2094,2095,2097,2100,2102,2105,2107,2109,2112,2114,2116,2118,2120,2122,2125],{"class":460,"line":606},[458,2096,1544],{"class":464},[458,2098,2099],{"class":475}," values",[458,2101,835],{"class":468},[458,2103,2104],{"class":577},"map",[458,2106,580],{"class":589},[458,2108,580],{"class":468},[458,2110,2111],{"class":1327},"value",[458,2113,660],{"class":468},[458,2115,1337],{"class":567},[458,2117,2027],{"class":577},[458,2119,580],{"class":589},[458,2121,2111],{"class":475},[458,2123,2124],{"class":589},"))",[458,2126,492],{"class":468},[458,2128,2129],{"class":460,"line":638},[458,2130,1615],{"class":468},[458,2132,2133,2135,2137],{"class":460,"line":655},[458,2134,535],{"class":468},[458,2136,660],{"class":475},[458,2138,492],{"class":468},[413,2140,2142],{"id":2141},"wrapping-the-registrar-in-your-own-api","Wrapping the Registrar in Your Own API",[418,2144,2145,2146,2149],{},"A library can wrap the registrar in its own function, with no diagnostics and no configuration. The id belongs to the ",[408,2147,2148],{},"caller's"," package and hashes the caller's own helper, so a wrapper is invisible in the result.",[449,2151,2153],{"className":451,"code":2152,"language":453,"meta":454,"style":454},"import {type PureFunction, type InjectPureFnId} from '@mionjs\u002Frun-types';\nimport {registerPureFn} from '@mionjs\u002Frun-types\u002Fruntime';\n\nexport function registerAcmePureFn\u003CF extends (...args: any[]) => any>(\n  fn: PureFunction\u003CF>,\n  id?: InjectPureFnId\u003CF> \u002F\u002F the build injects the id at every call site of the wrapper\n) {\n  if (!id) throw new Error('mion plugin did not run');\n  return registerPureFn(fn, id);\n}\n\n\u002F\u002F a consumer passes only the function and gets back the id of its own binding\nexport const compiledUpper = registerAcmePureFn((s: string): string =>\n  s.toUpperCase()\n);\n",[422,2154,2155,2185,2205,2209,2248,2264,2283,2289,2325,2345,2350,2354,2359,2390,2403],{"__ignoreMap":454},[458,2156,2157,2159,2161,2163,2166,2168,2170,2173,2175,2177,2179,2181,2183],{"class":460,"line":461},[458,2158,465],{"class":464},[458,2160,523],{"class":468},[458,2162,822],{"class":464},[458,2164,2165],{"class":475}," PureFunction",[458,2167,529],{"class":468},[458,2169,1208],{"class":464},[458,2171,2172],{"class":475}," InjectPureFnId",[458,2174,535],{"class":468},[458,2176,538],{"class":464},[458,2178,482],{"class":468},[458,2180,543],{"class":485},[458,2182,489],{"class":468},[458,2184,492],{"class":468},[458,2186,2187,2189,2191,2193,2195,2197,2199,2201,2203],{"class":460,"line":495},[458,2188,465],{"class":464},[458,2190,523],{"class":468},[458,2192,1648],{"class":475},[458,2194,535],{"class":468},[458,2196,538],{"class":464},[458,2198,482],{"class":468},[458,2200,1445],{"class":485},[458,2202,489],{"class":468},[458,2204,492],{"class":468},[458,2206,2207],{"class":460,"line":518},[458,2208,554],{"emptyLinePlaceholder":553},[458,2210,2211,2213,2215,2218,2220,2223,2226,2229,2232,2234,2237,2239,2241,2243,2245],{"class":460,"line":550},[458,2212,1176],{"class":464},[458,2214,1520],{"class":567},[458,2216,2217],{"class":577}," registerAcmePureFn",[458,2219,1045],{"class":468},[458,2221,2222],{"class":825},"F",[458,2224,2225],{"class":567}," extends",[458,2227,2228],{"class":468}," (...",[458,2230,2231],{"class":1327},"args",[458,2233,593],{"class":468},[458,2235,2236],{"class":825}," any",[458,2238,2083],{"class":475},[458,2240,660],{"class":468},[458,2242,1337],{"class":567},[458,2244,2236],{"class":825},[458,2246,2247],{"class":468},">(\n",[458,2249,2250,2253,2255,2257,2259,2261],{"class":460,"line":557},[458,2251,2252],{"class":1327},"  fn",[458,2254,593],{"class":468},[458,2256,2165],{"class":825},[458,2258,1045],{"class":468},[458,2260,2222],{"class":825},[458,2262,2263],{"class":468},">,\n",[458,2265,2266,2269,2272,2274,2276,2278,2280],{"class":460,"line":564},[458,2267,2268],{"class":1327},"  id",[458,2270,2271],{"class":468},"?:",[458,2273,2172],{"class":825},[458,2275,1045],{"class":468},[458,2277,2222],{"class":825},[458,2279,1051],{"class":468},[458,2281,2282],{"class":560}," \u002F\u002F the build injects the id at every call site of the wrapper\n",[458,2284,2285,2287],{"class":460,"line":586},[458,2286,660],{"class":468},[458,2288,1340],{"class":468},[458,2290,2291,2293,2295,2298,2301,2303,2306,2309,2312,2314,2316,2319,2321,2323],{"class":460,"line":606},[458,2292,1345],{"class":464},[458,2294,1324],{"class":589},[458,2296,2297],{"class":468},"!",[458,2299,2300],{"class":475},"id",[458,2302,1366],{"class":589},[458,2304,2305],{"class":464},"throw",[458,2307,2308],{"class":468}," new",[458,2310,2311],{"class":577}," Error",[458,2313,580],{"class":589},[458,2315,489],{"class":468},[458,2317,2318],{"class":485},"mion plugin did not run",[458,2320,489],{"class":468},[458,2322,660],{"class":589},[458,2324,492],{"class":468},[458,2326,2327,2329,2331,2333,2336,2338,2341,2343],{"class":460,"line":638},[458,2328,1386],{"class":464},[458,2330,1678],{"class":577},[458,2332,580],{"class":589},[458,2334,2335],{"class":475},"fn",[458,2337,529],{"class":468},[458,2339,2340],{"class":475}," id",[458,2342,660],{"class":589},[458,2344,492],{"class":468},[458,2346,2347],{"class":460,"line":655},[458,2348,2349],{"class":468},"}\n",[458,2351,2352],{"class":460,"line":665},[458,2353,554],{"emptyLinePlaceholder":553},[458,2355,2356],{"class":460,"line":670},[458,2357,2358],{"class":560},"\u002F\u002F a consumer passes only the function and gets back the id of its own binding\n",[458,2360,2361,2363,2365,2368,2370,2372,2374,2376,2379,2381,2383,2385,2387],{"class":460,"line":676},[458,2362,1176],{"class":464},[458,2364,1465],{"class":567},[458,2366,2367],{"class":475}," compiledUpper ",[458,2369,574],{"class":468},[458,2371,2217],{"class":577},[458,2373,580],{"class":475},[458,2375,580],{"class":468},[458,2377,2378],{"class":1327},"s",[458,2380,593],{"class":468},[458,2382,1021],{"class":825},[458,2384,1535],{"class":468},[458,2386,1021],{"class":825},[458,2388,2389],{"class":567}," =>\n",[458,2391,2392,2395,2397,2400],{"class":460,"line":711},[458,2393,2394],{"class":475},"  s",[458,2396,835],{"class":468},[458,2398,2399],{"class":577},"toUpperCase",[458,2401,2402],{"class":475},"()\n",[458,2404,2405,2407],{"class":460,"line":716},[458,2406,660],{"class":475},[458,2408,492],{"class":468},[413,2410,2412],{"id":2411},"publishing-pure-functions-in-a-package","Publishing Pure Functions in a Package",[418,2414,2415,2416,2419,2420,2422,2423,835],{},"A pure function registered in one package can be used from another, like any export. Build the package with a mion bundler plugin or with ",[422,2417,2418],{},"mion compile",", and the build adds one directory next to the bundle, published with the rest of dist. With ",[422,2421,2418],{},", put the gen dir inside the output dir, for example ",[422,2424,2425],{},"--gen-dir dist\u002F.mion",[449,2427,2432],{"className":2428,"code":2430,"language":2431},[2429],"language-text","dist\u002F\n  index.js\n  index.d.ts\n  mion-pure-fns\u002F\n    index.json                     # maps every exported name to its id\n    @acme\u002Ftext\u002F9Zt1bRm4cVaPqL.js   # one compiled file per pure function\n    @acme\u002Ftext\u002FQ2xVn7eK0sLmYb.js\n","text",[422,2433,2430],{"__ignoreMap":454},[405,2435,2436],{},"The directory is build-time input only, so it adds nothing to any bundle. Its files are the same compiled modules your own build uses.",[413,2438,2440],{"id":2439},"using-pure-functions-from-a-package","Using Pure Functions From a Package",[418,2442,2443,2444,2447],{},"A consuming build compiles only the functions it uses from that directory into its own output, and registers each one before anything calls it. A package built without mion has no such directory, so importing one of its ids fails the build with ",[422,2445,2446],{},"purefn-package-not-built",", which names the id and the package. Build that package with mion, or publish its TypeScript sources with its output, and the build reads those instead.",[413,2449,2451],{"id":2450},"looking-up-a-pure-function-at-runtime","Looking Up a Pure Function at Runtime",[418,2453,2454,2457,2458,1759,2461,2464,2465,2467],{},[422,2455,2456],{},"usePureFn"," and the other tracked lookups need an id the build can read. When the id only exists at runtime, such as one from a request, use ",[422,2459,2460],{},"getPureFnByKey",[422,2462,2463],{},"hasPureFnByKey",": they take a plain string, and the build does not check them. Keep ",[422,2466,2456],{}," for ids known at build time.",[449,2469,2471],{"className":451,"code":2470,"language":453,"meta":454,"style":454},"import {getRTUtils} from '@mionjs\u002Frun-types';\n\n\u002F\u002F wireId came in over the network\nif (getRTUtils().hasPureFnByKey(wireId)) {\n  const fn = getRTUtils().getPureFnByKey(wireId);\n  \u002F\u002F dispatch on it\n}\n",[422,2472,2473,2494,2498,2503,2523,2550,2555],{"__ignoreMap":454},[458,2474,2475,2477,2479,2482,2484,2486,2488,2490,2492],{"class":460,"line":461},[458,2476,465],{"class":464},[458,2478,523],{"class":468},[458,2480,2481],{"class":475},"getRTUtils",[458,2483,535],{"class":468},[458,2485,538],{"class":464},[458,2487,482],{"class":468},[458,2489,543],{"class":485},[458,2491,489],{"class":468},[458,2493,492],{"class":468},[458,2495,2496],{"class":460,"line":495},[458,2497,554],{"emptyLinePlaceholder":553},[458,2499,2500],{"class":460,"line":518},[458,2501,2502],{"class":560},"\u002F\u002F wireId came in over the network\n",[458,2504,2505,2508,2510,2512,2514,2516,2518,2521],{"class":460,"line":550},[458,2506,2507],{"class":464},"if",[458,2509,1324],{"class":475},[458,2511,2481],{"class":577},[458,2513,1054],{"class":475},[458,2515,835],{"class":468},[458,2517,2463],{"class":577},[458,2519,2520],{"class":475},"(wireId)) ",[458,2522,583],{"class":468},[458,2524,2525,2527,2530,2532,2535,2537,2539,2541,2543,2546,2548],{"class":460,"line":557},[458,2526,1493],{"class":567},[458,2528,2529],{"class":475}," fn",[458,2531,829],{"class":468},[458,2533,2534],{"class":577}," getRTUtils",[458,2536,1054],{"class":589},[458,2538,835],{"class":468},[458,2540,2460],{"class":577},[458,2542,580],{"class":589},[458,2544,2545],{"class":475},"wireId",[458,2547,660],{"class":589},[458,2549,492],{"class":468},[458,2551,2552],{"class":460,"line":564},[458,2553,2554],{"class":560},"  \u002F\u002F dispatch on it\n",[458,2556,2557],{"class":460,"line":586},[458,2558,2349],{"class":468},[413,2560,2562],{"id":2561},"sharing-compiled-functions-across-bundles","Sharing Compiled Functions Across Bundles",[418,2564,2565,2566,2569,2570,2572,2573,2576,2577,835],{},"A validator or encoder the build generates in one bundle can run in another that never runs the compiler, such as a browser client; mion's router works this way. Send the entry's ",[422,2567,2568],{},"CompiledFnData",", whose ",[422,2571,422],{}," field holds the function body as text. On the other side, restore it with ",[422,2574,2575],{},"buildFactoryFromCode"," and write it into the runtime cache with ",[422,2578,2579],{},"addToRTCache",[449,2581,2583],{"className":451,"code":2582,"language":453,"meta":454,"style":454},"import {getRTUtils, buildFactoryFromCode, type CompiledFnData, type CompiledTypeFn} from '@mionjs\u002Frun-types';\n\n\u002F\u002F `wire` arrived over the network as plain data.\nfunction ingest(wire: CompiledFnData) {\n  const restored: CompiledTypeFn = {...wire, createRTFn: buildFactoryFromCode(wire.code!)};\n  getRTUtils().addToRTCache(restored);\n}\n\n\u002F\u002F later, on the client, look it up by its hash\nconst isUser = getRTUtils().getRTFn(rtFnHash);\n",[422,2584,2585,2624,2628,2633,2653,2694,2714,2718,2722,2727],{"__ignoreMap":454},[458,2586,2587,2589,2591,2593,2595,2598,2600,2602,2605,2607,2609,2612,2614,2616,2618,2620,2622],{"class":460,"line":461},[458,2588,465],{"class":464},[458,2590,523],{"class":468},[458,2592,2481],{"class":475},[458,2594,529],{"class":468},[458,2596,2597],{"class":475}," buildFactoryFromCode",[458,2599,529],{"class":468},[458,2601,1208],{"class":464},[458,2603,2604],{"class":475}," CompiledFnData",[458,2606,529],{"class":468},[458,2608,1208],{"class":464},[458,2610,2611],{"class":475}," CompiledTypeFn",[458,2613,535],{"class":468},[458,2615,538],{"class":464},[458,2617,482],{"class":468},[458,2619,543],{"class":485},[458,2621,489],{"class":468},[458,2623,492],{"class":468},[458,2625,2626],{"class":460,"line":495},[458,2627,554],{"emptyLinePlaceholder":553},[458,2629,2630],{"class":460,"line":518},[458,2631,2632],{"class":560},"\u002F\u002F `wire` arrived over the network as plain data.\n",[458,2634,2635,2637,2640,2642,2645,2647,2649,2651],{"class":460,"line":550},[458,2636,1478],{"class":567},[458,2638,2639],{"class":577}," ingest",[458,2641,580],{"class":468},[458,2643,2644],{"class":1327},"wire",[458,2646,593],{"class":468},[458,2648,2604],{"class":825},[458,2650,660],{"class":468},[458,2652,1340],{"class":468},[458,2654,2655,2657,2660,2662,2664,2666,2669,2671,2673,2676,2678,2680,2682,2684,2686,2688,2690,2692],{"class":460,"line":557},[458,2656,1493],{"class":567},[458,2658,2659],{"class":475}," restored",[458,2661,593],{"class":468},[458,2663,2611],{"class":825},[458,2665,829],{"class":468},[458,2667,2668],{"class":468}," {...",[458,2670,2644],{"class":475},[458,2672,529],{"class":468},[458,2674,2675],{"class":589}," createRTFn",[458,2677,593],{"class":468},[458,2679,2597],{"class":577},[458,2681,580],{"class":589},[458,2683,2644],{"class":475},[458,2685,835],{"class":468},[458,2687,422],{"class":475},[458,2689,2297],{"class":468},[458,2691,660],{"class":589},[458,2693,1024],{"class":468},[458,2695,2696,2699,2701,2703,2705,2707,2710,2712],{"class":460,"line":564},[458,2697,2698],{"class":577},"  getRTUtils",[458,2700,1054],{"class":589},[458,2702,835],{"class":468},[458,2704,2579],{"class":577},[458,2706,580],{"class":589},[458,2708,2709],{"class":475},"restored",[458,2711,660],{"class":589},[458,2713,492],{"class":468},[458,2715,2716],{"class":460,"line":586},[458,2717,2349],{"class":468},[458,2719,2720],{"class":460,"line":606},[458,2721,554],{"emptyLinePlaceholder":553},[458,2723,2724],{"class":460,"line":638},[458,2725,2726],{"class":560},"\u002F\u002F later, on the client, look it up by its hash\n",[458,2728,2729,2731,2734,2736,2738,2740,2742,2745,2748],{"class":460,"line":655},[458,2730,568],{"class":567},[458,2732,2733],{"class":475}," isUser ",[458,2735,574],{"class":468},[458,2737,2534],{"class":577},[458,2739,1054],{"class":475},[458,2741,835],{"class":468},[458,2743,2744],{"class":577},"getRTFn",[458,2746,2747],{"class":475},"(rtFnHash)",[458,2749,492],{"class":468},[418,2751,2752,2753,1759,2756,2759],{},"Pure functions work the same way, with ",[422,2754,2755],{},"buildPureFnFactoryFromCode",[422,2757,2758],{},"addPureFn",". Your framework decides which entries a payload needs and how to version the envelope.",[413,2761,2763],{"id":2762},"overriding-generated-functions","Overriding Generated Functions",[418,2765,2766,2767,2770,2771,2774],{},"The ",[422,2768,2769],{},"overrideX"," helpers register your own pure function for one type, and every matching ",[422,2772,2773],{},"createX"," call returns it instead of the generated body. Use one for a hand-tuned encoder, a wire format that is not the plain shape of your type, or a one-off bug workaround.",[449,2776,2778],{"className":451,"code":2777,"language":453,"meta":454,"style":454},"import {overrideJsonEncoder, createJsonEncoderFn} from '@mionjs\u002Frun-types';\n\n\u002F\u002F declared once, near the type; the function must be pure\noverrideJsonEncoder\u003CUser>((user) => `{\"id\":${user.id}}`);\n\n\u002F\u002F the call site does not change\nconst encode = createJsonEncoderFn\u003CUser>();\n",[422,2779,2780,2806,2810,2815,2863,2867,2872],{"__ignoreMap":454},[458,2781,2782,2784,2786,2789,2791,2794,2796,2798,2800,2802,2804],{"class":460,"line":461},[458,2783,465],{"class":464},[458,2785,523],{"class":468},[458,2787,2788],{"class":475},"overrideJsonEncoder",[458,2790,529],{"class":468},[458,2792,2793],{"class":475}," createJsonEncoderFn",[458,2795,535],{"class":468},[458,2797,538],{"class":464},[458,2799,482],{"class":468},[458,2801,543],{"class":485},[458,2803,489],{"class":468},[458,2805,492],{"class":468},[458,2807,2808],{"class":460,"line":495},[458,2809,554],{"emptyLinePlaceholder":553},[458,2811,2812],{"class":460,"line":518},[458,2813,2814],{"class":560},"\u002F\u002F declared once, near the type; the function must be pure\n",[458,2816,2817,2819,2821,2824,2826,2828,2830,2833,2835,2837,2840,2843,2846,2848,2850,2852,2854,2856,2859,2861],{"class":460,"line":550},[458,2818,2788],{"class":577},[458,2820,1045],{"class":468},[458,2822,2823],{"class":825},"User",[458,2825,1051],{"class":468},[458,2827,580],{"class":475},[458,2829,580],{"class":468},[458,2831,2832],{"class":1327},"user",[458,2834,660],{"class":468},[458,2836,1337],{"class":567},[458,2838,2839],{"class":468}," `",[458,2841,2842],{"class":485},"{\"id\":",[458,2844,2845],{"class":468},"${",[458,2847,2832],{"class":475},[458,2849,835],{"class":468},[458,2851,2300],{"class":475},[458,2853,535],{"class":468},[458,2855,535],{"class":485},[458,2857,2858],{"class":468},"`",[458,2860,660],{"class":475},[458,2862,492],{"class":468},[458,2864,2865],{"class":460,"line":557},[458,2866,554],{"emptyLinePlaceholder":553},[458,2868,2869],{"class":460,"line":564},[458,2870,2871],{"class":560},"\u002F\u002F the call site does not change\n",[458,2873,2874,2876,2879,2881,2883,2885,2887,2889,2891],{"class":460,"line":586},[458,2875,568],{"class":567},[458,2877,2878],{"class":475}," encode ",[458,2880,574],{"class":468},[458,2882,2793],{"class":577},[458,2884,1045],{"class":468},[458,2886,2823],{"class":825},[458,2888,1051],{"class":468},[458,2890,1054],{"class":475},[458,2892,492],{"class":468},[418,2894,2895,2896,1736,2899,1736,2901,2904],{},"Every factory has an override twin (",[422,2897,2898],{},"overrideValidate",[422,2900,2788],{},[422,2902,2903],{},"overrideJsonDecoder",", and so on). Your function takes the same arguments as the generated one: a validation-errors override receives the value, the path, and the errors list.",[418,2906,2907],{},"You can register one override per type and function; a second one, with any body, is a build error. Decoders use validation to tell union branches apart, so a looser validator loosens those decoders too, and the build warns you.",[413,2909,2911],{"id":2910},"limiting-an-override-to-one-type","Limiting an Override to One Type",[418,2913,2914,2915,2918,2919,2922],{},"An override is matched by the ",[408,2916,2917],{},"shape"," of the type, not its name, so ",[422,2920,2921],{},"overrideValidate\u003Cstring>"," applies to every string in the build, including string fields inside other objects. Give the type a brand when you mean one specific type.",[449,2924,2926],{"className":451,"code":2925,"language":453,"meta":454,"style":454},"type UserId = string & {readonly __brand: 'UserId'};\n\n\u002F\u002F Only UserId, not every string.\noverrideValidate\u003CUserId>((v): v is UserId => typeof v === 'string' && v.startsWith('u_'));\n",[422,2927,2928,2961,2965,2970],{"__ignoreMap":454},[458,2929,2930,2932,2935,2937,2939,2942,2944,2947,2950,2952,2954,2957,2959],{"class":460,"line":461},[458,2931,822],{"class":567},[458,2933,2934],{"class":825}," UserId",[458,2936,829],{"class":468},[458,2938,1021],{"class":825},[458,2940,2941],{"class":468}," &",[458,2943,523],{"class":468},[458,2945,2946],{"class":567},"readonly",[458,2948,2949],{"class":589}," __brand",[458,2951,593],{"class":468},[458,2953,482],{"class":468},[458,2955,2956],{"class":485},"UserId",[458,2958,489],{"class":468},[458,2960,1024],{"class":468},[458,2962,2963],{"class":460,"line":495},[458,2964,554],{"emptyLinePlaceholder":553},[458,2966,2967],{"class":460,"line":518},[458,2968,2969],{"class":560},"\u002F\u002F Only UserId, not every string.\n",[458,2971,2972,2974,2976,2978,2980,2982,2984,2986,2988,2991,2994,2996,2998,3000,3002,3004,3006,3008,3010,3013,3015,3017,3020,3022,3024,3027,3029,3031],{"class":460,"line":550},[458,2973,2898],{"class":577},[458,2975,1045],{"class":468},[458,2977,2956],{"class":825},[458,2979,1051],{"class":468},[458,2981,580],{"class":475},[458,2983,580],{"class":468},[458,2985,1836],{"class":1327},[458,2987,1535],{"class":468},[458,2989,2990],{"class":1327}," v",[458,2992,2993],{"class":468}," is",[458,2995,2934],{"class":825},[458,2997,1337],{"class":567},[458,2999,849],{"class":468},[458,3001,1918],{"class":475},[458,3003,1921],{"class":468},[458,3005,482],{"class":468},[458,3007,958],{"class":485},[458,3009,489],{"class":468},[458,3011,3012],{"class":468}," &&",[458,3014,2990],{"class":475},[458,3016,835],{"class":468},[458,3018,3019],{"class":577},"startsWith",[458,3021,580],{"class":475},[458,3023,489],{"class":468},[458,3025,3026],{"class":485},"u_",[458,3028,489],{"class":468},[458,3030,2124],{"class":475},[458,3032,492],{"class":468},[413,3034,3036],{"id":3035},"overrides-in-a-published-package","Overrides in a Published Package",[418,3038,3039],{},"A package built with mion ships its overrides with its pure functions. Your project uses them for that package's types, under the ids the package's build gave them. Overriding one of those types again is a build error.",[3041,3042,3043],"note",{},"A package built without mion ships no overrides, so its types use the generated functions.",[3045,3046,3047],"style",{},"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 .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}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 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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .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}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}","Extend RunTypes with pure inline helpers and your own formats and mock generators.","md",null,{"toc":24},{"title":213,"description":3048},"fMeDXwNKUOVB5arCdFnqjfiVCzpr7Fukv32VLXBb9JQ",1793324363741]