[{"data":1,"prerenderedAt":3997},["ShallowReactive",2],{"navigation_docs":3,"-learn-catalogs":581,"-learn-catalogs-surround":3992},[4,35,85,138,318,458,517,556],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Start","\u002Fstart","1.start",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fstart\u002Fintroduction","1.start\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Why start with evlog","\u002Fstart\u002Fwhy-evlog","1.start\u002F2.why-evlog","i-lucide-rocket",{"title":20,"path":21,"stem":22,"icon":23},"Installation","\u002Fstart\u002Finstallation","1.start\u002F3.installation","i-lucide-download",{"title":25,"path":26,"stem":27,"icon":28},"Quick Start","\u002Fstart\u002Fquick-start","1.start\u002F4.quick-start","i-lucide-zap",{"title":30,"path":31,"stem":32,"icon":33},"Choose your logger","\u002Fstart\u002Ftypescript-logging-library","1.start\u002F5.typescript-logging-library","i-lucide-file-code",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Learn","\u002Flearn","2.learn",[40,45,50,55,60,65,70,75,80],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flearn\u002Foverview","2.learn\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flearn\u002Fsimple-logging","2.learn\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flearn\u002Fwide-events","2.learn\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flearn\u002Fstructured-errors","2.learn\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Lifecycle","\u002Flearn\u002Flifecycle","2.learn\u002F4.lifecycle","i-lucide-arrow-right-left",{"title":66,"path":67,"stem":68,"icon":69},"Sampling","\u002Flearn\u002Fsampling","2.learn\u002F5.sampling","i-lucide-filter",{"title":71,"path":72,"stem":73,"icon":74},"Auto-Redaction","\u002Flearn\u002Fredaction","2.learn\u002F6.redaction","i-lucide-eye-off",{"title":76,"path":77,"stem":78,"icon":79},"Typed Fields","\u002Flearn\u002Ftyped-fields","2.learn\u002F7.typed-fields","i-simple-icons-typescript",{"title":81,"path":82,"stem":83,"icon":84},"Catalogs","\u002Flearn\u002Fcatalogs","2.learn\u002F8.catalogs","i-lucide-book-open",{"title":86,"path":87,"stem":88,"children":89,"page":34},"CLI","\u002Fcli","3.cli",[90,93,98,103,108,113,118,123,128,133],{"title":41,"path":91,"stem":92,"icon":49},"\u002Fcli\u002Foverview","3.cli\u002F0.overview",{"title":94,"path":95,"stem":96,"icon":97},"init","\u002Fcli\u002Finit","3.cli\u002F1.init","i-lucide-wand-sparkles",{"title":99,"path":100,"stem":101,"icon":102},"map","\u002Fcli\u002Fmap","3.cli\u002F2.map","i-lucide-radar",{"title":104,"path":105,"stem":106,"icon":107},"Rules","\u002Fcli\u002Frules","3.cli\u002F3.rules","i-lucide-list-checks",{"title":109,"path":110,"stem":111,"icon":112},"Scoring","\u002Fcli\u002Fscoring","3.cli\u002F4.scoring","i-lucide-gauge",{"title":114,"path":115,"stem":116,"icon":117},"CI","\u002Fcli\u002Fci","3.cli\u002F5.ci","i-lucide-git-pull-request",{"title":119,"path":120,"stem":121,"icon":122},"doctor","\u002Fcli\u002Fdoctor","3.cli\u002F6.doctor","i-lucide-stethoscope",{"title":124,"path":125,"stem":126,"icon":127},"telemetry","\u002Fcli\u002Ftelemetry","3.cli\u002F7.telemetry","i-lucide-bar-chart-3",{"title":129,"path":130,"stem":131,"icon":132},"agents","\u002Fcli\u002Fagents","3.cli\u002F8.agents","i-lucide-bot",{"title":134,"path":135,"stem":136,"icon":137},"Observability Score","\u002Fcli\u002Fobservability-score","3.cli\u002F9.observability-score","i-lucide-activity",{"title":139,"path":140,"stem":141,"children":142,"page":34},"Integrate","\u002Fintegrate","4.integrate",[143,147,230],{"title":41,"path":144,"stem":145,"icon":146},"\u002Fintegrate\u002Foverview","4.integrate\u002F0.overview","i-lucide-plug",{"title":148,"path":149,"stem":150,"children":151,"page":34},"Adapters","\u002Fintegrate\u002Fadapters","4.integrate\u002Fadapters",[152,155,185,210],{"title":41,"path":153,"stem":154,"icon":44},"\u002Fintegrate\u002Fadapters\u002Foverview","4.integrate\u002Fadapters\u002F01.overview",{"title":156,"path":157,"stem":158,"children":159,"page":34},"Cloud","\u002Fintegrate\u002Fadapters\u002Fcloud","4.integrate\u002Fadapters\u002Fcloud",[160,165,170,175,180],{"title":161,"path":162,"stem":163,"icon":164},"Axiom","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Faxiom","4.integrate\u002Fadapters\u002Fcloud\u002F01.axiom","i-custom-axiom",{"title":166,"path":167,"stem":168,"icon":169},"PostHog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fposthog","4.integrate\u002Fadapters\u002Fcloud\u002F02.posthog","i-simple-icons-posthog",{"title":171,"path":172,"stem":173,"icon":174},"Sentry","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fsentry","4.integrate\u002Fadapters\u002Fcloud\u002F03.sentry","i-simple-icons-sentry",{"title":176,"path":177,"stem":178,"icon":179},"Better Stack","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fbetter-stack","4.integrate\u002Fadapters\u002Fcloud\u002F04.better-stack","i-simple-icons-betterstack",{"title":181,"path":182,"stem":183,"icon":184},"Datadog","\u002Fintegrate\u002Fadapters\u002Fcloud\u002Fdatadog","4.integrate\u002Fadapters\u002Fcloud\u002F05.datadog","i-simple-icons-datadog",{"title":186,"path":187,"stem":188,"children":189,"page":34},"Cloud or Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fhybrid","4.integrate\u002Fadapters\u002Fhybrid",[190,195,200,205],{"title":191,"path":192,"stem":193,"icon":194},"Grafana Loki","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Floki","4.integrate\u002Fadapters\u002Fhybrid\u002F01.loki","i-simple-icons-grafana",{"title":196,"path":197,"stem":198,"icon":199},"ClickHouse","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fclickhouse","4.integrate\u002Fadapters\u002Fhybrid\u002F02.clickhouse","i-simple-icons-clickhouse",{"title":201,"path":202,"stem":203,"icon":204},"OTLP","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fotlp","4.integrate\u002Fadapters\u002Fhybrid\u002F03.otlp","i-simple-icons-opentelemetry",{"title":206,"path":207,"stem":208,"icon":209},"HyperDX","\u002Fintegrate\u002Fadapters\u002Fhybrid\u002Fhyperdx","4.integrate\u002Fadapters\u002Fhybrid\u002F04.hyperdx","i-custom-hyperdx",{"title":211,"path":212,"stem":213,"children":214,"page":34},"Self-Hosted","\u002Fintegrate\u002Fadapters\u002Fself-hosted","4.integrate\u002Fadapters\u002Fself-hosted",[215,220,225],{"title":216,"path":217,"stem":218,"icon":219},"File System","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Ffs","4.integrate\u002Fadapters\u002Fself-hosted\u002F01.fs","i-lucide-hard-drive",{"title":221,"path":222,"stem":223,"icon":224},"NuxtHub","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fnuxthub","4.integrate\u002Fadapters\u002Fself-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":226,"path":227,"stem":228,"icon":229},"Memory","\u002Fintegrate\u002Fadapters\u002Fself-hosted\u002Fmemory","4.integrate\u002Fadapters\u002Fself-hosted\u002F03.memory","i-lucide-cpu",{"title":231,"path":232,"stem":233,"children":234,"page":34},"Frameworks","\u002Fintegrate\u002Fframeworks","4.integrate\u002Fframeworks",[235,239,244,249,254,259,264,269,274,279,284,289,294,299,303,308,313],{"title":41,"path":236,"stem":237,"icon":238},"\u002Fintegrate\u002Fframeworks\u002Foverview","4.integrate\u002Fframeworks\u002F00.overview","i-lucide-layout-grid",{"title":240,"path":241,"stem":242,"icon":243},"Nuxt","\u002Fintegrate\u002Fframeworks\u002Fnuxt","4.integrate\u002Fframeworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":245,"path":246,"stem":247,"icon":248},"Next.js","\u002Fintegrate\u002Fframeworks\u002Fnextjs","4.integrate\u002Fframeworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":250,"path":251,"stem":252,"icon":253},"SvelteKit","\u002Fintegrate\u002Fframeworks\u002Fsveltekit","4.integrate\u002Fframeworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":255,"path":256,"stem":257,"icon":258},"Nitro","\u002Fintegrate\u002Fframeworks\u002Fnitro","4.integrate\u002Fframeworks\u002F04.nitro","i-custom-nitro",{"title":260,"path":261,"stem":262,"icon":263},"TanStack Start","\u002Fintegrate\u002Fframeworks\u002Ftanstack-start","4.integrate\u002Fframeworks\u002F05.tanstack-start","i-custom-tanstack",{"title":265,"path":266,"stem":267,"icon":268},"NestJS","\u002Fintegrate\u002Fframeworks\u002Fnestjs","4.integrate\u002Fframeworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":270,"path":271,"stem":272,"icon":273},"Express","\u002Fintegrate\u002Fframeworks\u002Fexpress","4.integrate\u002Fframeworks\u002F07.express","i-simple-icons-express",{"title":275,"path":276,"stem":277,"icon":278},"Hono","\u002Fintegrate\u002Fframeworks\u002Fhono","4.integrate\u002Fframeworks\u002F08.hono","i-simple-icons-hono",{"title":280,"path":281,"stem":282,"icon":283},"Fastify","\u002Fintegrate\u002Fframeworks\u002Ffastify","4.integrate\u002Fframeworks\u002F09.fastify","i-simple-icons-fastify",{"title":285,"path":286,"stem":287,"icon":288},"Elysia","\u002Fintegrate\u002Fframeworks\u002Felysia","4.integrate\u002Fframeworks\u002F10.elysia","i-custom-elysia",{"title":290,"path":291,"stem":292,"icon":293},"React Router","\u002Fintegrate\u002Fframeworks\u002Freact-router","4.integrate\u002Fframeworks\u002F11.react-router","i-custom-reactrouter",{"title":295,"path":296,"stem":297,"icon":298},"Cloudflare Workers","\u002Fintegrate\u002Fframeworks\u002Fcloudflare-workers","4.integrate\u002Fframeworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":300,"path":301,"stem":302,"icon":79},"Standalone","\u002Fintegrate\u002Fframeworks\u002Fstandalone","4.integrate\u002Fframeworks\u002F13.standalone",{"title":304,"path":305,"stem":306,"icon":307},"Astro","\u002Fintegrate\u002Fframeworks\u002Fastro","4.integrate\u002Fframeworks\u002F14.astro","i-simple-icons-astro",{"title":309,"path":310,"stem":311,"icon":312},"oRPC","\u002Fintegrate\u002Fframeworks\u002Forpc","4.integrate\u002Fframeworks\u002F15.orpc","i-lucide-network",{"title":314,"path":315,"stem":316,"icon":317},"AWS Lambda","\u002Fintegrate\u002Fframeworks\u002Faws-lambda","4.integrate\u002Fframeworks\u002F16.aws-lambda","i-custom-lambda",{"title":319,"path":320,"stem":321,"children":322,"page":34},"Use Cases","\u002Fuse-cases","5.use-cases",[323,326,331,359,386,418,439,444,449,453],{"title":41,"path":324,"stem":325,"icon":107},"\u002Fuse-cases\u002Foverview","5.use-cases\u002F0.overview",{"title":327,"path":328,"stem":329,"icon":330},"Client Logging","\u002Fuse-cases\u002Fclient-logging","5.use-cases\u002F1.client-logging","i-lucide-monitor",{"title":332,"icon":333,"path":334,"stem":335,"children":336,"page":34},"AI SDK","i-simple-icons-vercel","\u002Fuse-cases\u002Fai-sdk","5.use-cases\u002F2.ai-sdk",[337,340,345,350,355],{"title":41,"path":338,"stem":339,"icon":44},"\u002Fuse-cases\u002Fai-sdk\u002Foverview","5.use-cases\u002F2.ai-sdk\u002F01.overview",{"title":341,"path":342,"stem":343,"icon":344},"Usage","\u002Fuse-cases\u002Fai-sdk\u002Fusage","5.use-cases\u002F2.ai-sdk\u002F02.usage","i-lucide-code",{"title":346,"path":347,"stem":348,"icon":349},"Options","\u002Fuse-cases\u002Fai-sdk\u002Foptions","5.use-cases\u002F2.ai-sdk\u002F03.options","i-lucide-sliders",{"title":351,"path":352,"stem":353,"icon":354},"Metadata","\u002Fuse-cases\u002Fai-sdk\u002Fmetadata","5.use-cases\u002F2.ai-sdk\u002F04.metadata","i-lucide-database",{"title":356,"path":357,"stem":358,"icon":137},"Telemetry","\u002Fuse-cases\u002Fai-sdk\u002Ftelemetry","5.use-cases\u002F2.ai-sdk\u002F05.telemetry",{"title":360,"icon":361,"path":362,"stem":363,"children":364,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Fuse-cases\u002Fbetter-auth","5.use-cases\u002F3.better-auth",[365,368,373,378,382],{"title":41,"path":366,"stem":367,"icon":44},"\u002Fuse-cases\u002Fbetter-auth\u002Foverview","5.use-cases\u002F3.better-auth\u002F01.overview",{"title":369,"path":370,"stem":371,"icon":372},"Identify User","\u002Fuse-cases\u002Fbetter-auth\u002Fidentify-user","5.use-cases\u002F3.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":374,"path":375,"stem":376,"icon":377},"Middleware","\u002Fuse-cases\u002Fbetter-auth\u002Fmiddleware","5.use-cases\u002F3.better-auth\u002F03.middleware","i-lucide-shield",{"title":379,"path":380,"stem":381,"icon":330},"Client Sync","\u002Fuse-cases\u002Fbetter-auth\u002Fclient-sync","5.use-cases\u002F3.better-auth\u002F04.client-sync",{"title":383,"path":384,"stem":385,"icon":112},"Performance","\u002Fuse-cases\u002Fbetter-auth\u002Fperformance","5.use-cases\u002F3.better-auth\u002F05.performance",{"title":387,"icon":388,"path":389,"stem":390,"children":391,"page":34},"Audit Logs","i-lucide-shield-check","\u002Fuse-cases\u002Faudit","5.use-cases\u002F4.audit",[392,395,400,405,410,414],{"title":41,"path":393,"stem":394,"icon":44},"\u002Fuse-cases\u002Faudit\u002Foverview","5.use-cases\u002F4.audit\u002F01.overview",{"title":396,"path":397,"stem":398,"icon":399},"Schema","\u002Fuse-cases\u002Faudit\u002Fschema","5.use-cases\u002F4.audit\u002F02.schema","i-lucide-file-text",{"title":401,"path":402,"stem":403,"icon":404},"Recording","\u002Fuse-cases\u002Faudit\u002Frecording","5.use-cases\u002F4.audit\u002F03.recording","i-lucide-pen-line",{"title":406,"path":407,"stem":408,"icon":409},"Drains","\u002Fuse-cases\u002Faudit\u002Fpipeline","5.use-cases\u002F4.audit\u002F04.pipeline","i-lucide-link",{"title":411,"path":412,"stem":413,"icon":388},"Compliance","\u002Fuse-cases\u002Faudit\u002Fcompliance","5.use-cases\u002F4.audit\u002F05.compliance",{"title":415,"path":416,"stem":417,"icon":84},"Recipes","\u002Fuse-cases\u002Faudit\u002Frecipes","5.use-cases\u002F4.audit\u002F06.recipes",{"title":356,"icon":112,"path":419,"stem":420,"children":421,"page":34},"\u002Fuse-cases\u002Ftelemetry","5.use-cases\u002F4.telemetry",[422,425,430,435],{"title":41,"path":423,"stem":424,"icon":44},"\u002Fuse-cases\u002Ftelemetry\u002Foverview","5.use-cases\u002F4.telemetry\u002F01.overview",{"title":426,"path":427,"stem":428,"icon":429},"Setup","\u002Fuse-cases\u002Ftelemetry\u002Fsetup","5.use-cases\u002F4.telemetry\u002F02.setup","i-lucide-wrench",{"title":431,"path":432,"stem":433,"icon":434},"Ingest","\u002Fuse-cases\u002Ftelemetry\u002Fingest","5.use-cases\u002F4.telemetry\u002F03.ingest","i-lucide-server",{"title":436,"path":437,"stem":438,"icon":84},"Reference","\u002Fuse-cases\u002Ftelemetry\u002Freference","5.use-cases\u002F4.telemetry\u002F04.reference",{"title":440,"path":441,"stem":442,"icon":443},"Enrichers","\u002Fuse-cases\u002Fenrichers","5.use-cases\u002F5.enrichers","i-lucide-sparkles",{"title":445,"path":446,"stem":447,"icon":448},"eve","\u002Fuse-cases\u002Feve","5.use-cases\u002F5.eve","i-custom-eve",{"title":450,"path":451,"stem":452,"icon":434},"Node.js request logging","\u002Fuse-cases\u002Fstructured-logging-nodejs","5.use-cases\u002F6.structured-logging-nodejs",{"title":454,"path":455,"stem":456,"icon":457},"Libraries","\u002Fuse-cases\u002Flibraries","5.use-cases\u002F7.libraries","i-lucide-package",{"title":459,"path":460,"stem":461,"children":462,"page":34},"Extend","\u002Fextend","6.extend",[463,467,472,477,481,486,490,494,498,502,507,512],{"title":41,"path":464,"stem":465,"icon":466},"\u002Fextend\u002Foverview","6.extend\u002F0.overview","i-lucide-blocks",{"title":468,"path":469,"stem":470,"icon":471},"Stream","\u002Fextend\u002Fstream","6.extend\u002F1.stream","i-lucide-radio-tower",{"title":473,"path":474,"stem":475,"icon":476},"Custom framework","\u002Fextend\u002Fcustom-framework","6.extend\u002F10.custom-framework","i-lucide-puzzle",{"title":478,"path":479,"stem":480,"icon":471},"Diagnostics channel","\u002Fextend\u002Fdiagnostics-channel","6.extend\u002F11.diagnostics-channel",{"title":482,"path":483,"stem":484,"icon":485},"FS reader","\u002Fextend\u002Ffs-reader","6.extend\u002F2.fs-reader","i-lucide-folder-search",{"title":415,"path":487,"stem":488,"icon":489},"\u002Fextend\u002Fconsumer-recipes","6.extend\u002F3.consumer-recipes","i-lucide-chef-hat",{"title":491,"path":492,"stem":493,"icon":466},"Plugins","\u002Fextend\u002Fplugins","6.extend\u002F4.plugins",{"title":495,"path":496,"stem":497,"icon":443},"Custom enrichers","\u002Fextend\u002Fcustom-enrichers","6.extend\u002F5.custom-enrichers",{"title":499,"path":500,"stem":501,"icon":69},"Tail sampling","\u002Fextend\u002Ftail-sampling","6.extend\u002F6.tail-sampling",{"title":503,"path":504,"stem":505,"icon":506},"Identity headers","\u002Fextend\u002Fidentity-headers","6.extend\u002F7.identity-headers","i-lucide-fingerprint",{"title":508,"path":509,"stem":510,"icon":511},"Custom drains","\u002Fextend\u002Fcustom-drains","6.extend\u002F8.custom-drains","i-lucide-share-2",{"title":513,"path":514,"stem":515,"icon":516},"Drain pipeline","\u002Fextend\u002Fdrain-pipeline","6.extend\u002F9.drain-pipeline","i-lucide-workflow",{"title":436,"path":518,"stem":519,"children":520,"page":34},"\u002Freference","7.reference",[521,525,530,533,538,542,547,551],{"title":41,"path":522,"stem":523,"icon":524},"\u002Freference\u002Foverview","7.reference\u002F0.overview","i-lucide-book-marked",{"title":526,"path":527,"stem":528,"icon":529},"Configuration","\u002Freference\u002Fconfiguration","7.reference\u002F1.configuration","i-lucide-settings",{"title":383,"path":531,"stem":532,"icon":112},"\u002Freference\u002Fperformance","7.reference\u002F2.performance",{"title":534,"path":535,"stem":536,"icon":537},"Vite Plugin","\u002Freference\u002Fvite-plugin","7.reference\u002F3.vite-plugin","i-custom-vite",{"title":539,"path":540,"stem":541,"icon":388},"Best Practices","\u002Freference\u002Fbest-practices","7.reference\u002F4.best-practices",{"title":543,"path":544,"stem":545,"icon":546},"vs Other Loggers","\u002Freference\u002Fvs-other-loggers","7.reference\u002F5.vs-other-loggers","i-lucide-scale",{"title":548,"path":549,"stem":550,"icon":443},"Agent Skills","\u002Freference\u002Fagent-skills","7.reference\u002F6.agent-skills",{"title":552,"path":553,"stem":554,"icon":555},"Cost","\u002Freference\u002Fcost","7.reference\u002F7.cost","i-lucide-receipt",{"title":557,"path":558,"stem":559,"children":560,"page":34},"Compare","\u002Fcompare","8.compare",[561,565,569,573,577],{"title":562,"path":563,"stem":564,"icon":546},"evlog vs Pino","\u002Fcompare\u002Fpino","8.compare\u002F1.pino",{"title":566,"path":567,"stem":568,"icon":204},"evlog vs OpenTelemetry","\u002Fcompare\u002Fopentelemetry","8.compare\u002F2.opentelemetry",{"title":570,"path":571,"stem":572,"icon":546},"evlog vs LogTape","\u002Fcompare\u002Flogtape","8.compare\u002F3.logtape",{"title":574,"path":575,"stem":576,"icon":546},"evlog vs Winston: formats and request events","\u002Fcompare\u002Fwinston","8.compare\u002F4.winston",{"title":578,"path":579,"stem":580,"icon":546},"evlog vs Consola: reporters and request context","\u002Fcompare\u002Fconsola","8.compare\u002F5.consola",{"id":582,"title":81,"body":583,"description":3982,"extension":3983,"links":3984,"meta":3988,"navigation":3989,"path":82,"seo":3990,"stem":83,"__hash__":3991},"docs\u002F2.learn\u002F8.catalogs.md",{"type":584,"value":585,"toc":3955},"minimark",[586,605,756,769,774,777,880,886,890,893,898,909,1309,1313,1327,1335,1548,1558,1562,1574,1580,1760,1770,1774,1784,1790,1794,1803,1809,2060,2064,2354,2367,2371,2443,2500,2649,2669,2673,2677,2687,2915,2919,2922,2967,3089,3093,3117,3254,3258,3277,3281,3340,3346,3350,3353,3399,3482,3491,3495,3615,3622,3626,3642,3655,3671,3748,3752,3908,3914,3918,3951],[587,588,589,590,594,595,594,598,594,601,604],"p",{},"The catalog primitives (",[591,592,593],"code",{},"defineError",", ",[591,596,597],{},"defineErrorCatalog",[591,599,600],{},"defineAuditAction",[591,602,603],{},"defineAuditCatalog",") are the same regardless of project size. What changes is how you organise them. This page is the deep-dive: conventions, scaling recipes from one file to a published npm package, composition patterns, and the opt-in type augmentation.",[606,607,610,616,747],"prompt",{":actions":608,"description":609,"icon":84},"[\"copy\",\"cursor\",\"claude\"]","Set up typed error and audit catalogs in my app",[587,611,612,613,615],{},"Group errors and audit actions in typed catalogs to eliminate magic strings, get autocomplete on ",[591,614,591],{}," everywhere, and ship them as npm packages in a monorepo.",[617,618,619,631,641,655,664,674,681,688,706,713,727,737],"ul",{},[620,621,622,623,626,627,630],"li",{},"Use ",[591,624,625],{},"defineErrorCatalog(prefix, map)"," for error bundles, ",[591,628,629],{},"defineAuditCatalog(prefix, map)"," for audit bundles",[620,632,622,633,636,637,640],{},[591,634,635],{},"defineError(code, options)"," and ",[591,638,639],{},"defineAuditAction(action, opts?)"," for one-off factories that don't fit a catalog",[620,642,643,644,647,648,594,651,654],{},"Convention: UPPER_SNAKE_CASE keys, lower.dot.case prefix, wire format is ",[591,645,646],{},"${prefix}.${KEY}"," (e.g. ",[591,649,650],{},"billing.PAYMENT_DECLINED",[591,652,653],{},"billing.INVOICE_REFUND",")",[620,656,657,658,594,661,654],{},"One catalog = one bounded context = one prefix = one file (e.g. ",[591,659,660],{},"errors\u002Fbilling.ts",[591,662,663],{},"audit\u002Fbilling.ts",[620,665,666,667,670,671],{},"Throw with ",[591,668,669],{},"billingErrors.PAYMENT_DECLINED({ cause, internal })",", audit with ",[591,672,673],{},"log.audit(billingAudit.INVOICE_REFUND({ actor, target }))",[620,675,676,677,680],{},"Use templated messages (",[591,678,679],{},"message: ({ id }) => \\","User ${id} not found``) when params are dynamic and required",[620,682,683,684,687],{},"Catalog defaults for ",[591,685,686],{},"internal"," are shallow-merged with call-site values (call-site wins)",[620,689,690,691,694,695,594,698,701,702,705],{},"Add the opt-in ",[591,692,693],{},"declare module 'evlog' { interface RegisteredErrorCatalogs { billing: typeof billingErrors } }"," augmentation to surface autocomplete on ",[591,696,697],{},"createError({ code })",[591,699,700],{},"parseError(err).code",", and ",[591,703,704],{},"throwError(code)"," everywhere",[620,707,708,709,712],{},"Scale by sharding: single file → folder per domain → sub-prefixes (",[591,710,711],{},"billing.payment",") → one npm package per bounded context (each owns its prefix, no conflicts possible)",[620,714,715,716,719,720,723,724],{},"Each shared package ships its own ",[591,717,718],{},"declare module 'evlog'"," block in ",[591,721,722],{},"src\u002Findex.ts"," so the type augmentation propagates to consumers via the published ",[591,725,726],{},".d.ts",[620,728,729,730,733,734],{},"Compare on ",[591,731,732],{},"factory.code"," in tests instead of string literals so renames are TS errors, not silent breaks: ",[591,735,736],{},"expect(err.code).toBe(billingErrors.PAYMENT_DECLINED.code)",[620,738,739,740,742,743,746],{},"Never override ",[591,741,591],{}," at the call site (the catalog defines the code identity); never put ",[591,744,745],{},"declare module"," blocks in test files (they leak into the main type-checker)",[587,748,749,750],{},"Docs: ",[751,752,753],"a",{"href":753,"rel":754},"https:\u002F\u002Fwww.evlog.dev\u002Flearn\u002Fcatalogs",[755],"nofollow",[757,758,759,760,636,764,768],"tip",{},"If you haven't yet, start with ",[751,761,763],{"href":762},"\u002Flearn\u002Fstructured-errors#error-catalogs","Structured Errors → Error Catalogs",[751,765,767],{"href":766},"\u002Fuse-cases\u002Faudit\u002Frecording#defineauditcatalog","Audit → defineAuditCatalog"," for the basics. This page assumes you've used the primitives at least once.",[770,771,773],"h2",{"id":772},"conventions","Conventions",[587,775,776],{},"A single set of conventions covers both error and audit catalogs.",[778,779,780,795],"table",{},[781,782,783],"thead",{},[784,785,786,789,792],"tr",{},[787,788],"th",{},[787,790,791],{},"Convention",[787,793,794],{},"Example",[796,797,798,821,845,864],"tbody",{},[784,799,800,807,813],{},[801,802,803],"td",{},[804,805,806],"strong",{},"Catalog key",[801,808,809,812],{},[591,810,811],{},"UPPER_SNAKE_CASE"," (enum-style, scales to hundreds of entries)",[801,814,815,594,818],{},[591,816,817],{},"PAYMENT_DECLINED",[591,819,820],{},"INVOICE_REFUND",[784,822,823,828,834],{},[801,824,825],{},[804,826,827],{},"Prefix",[801,829,830,833],{},[591,831,832],{},"lower.dot.case",", can be hierarchical",[801,835,836,594,839,594,842],{},[591,837,838],{},"'billing'",[591,840,841],{},"'billing.payment'",[591,843,844],{},"'auth.session'",[784,846,847,852,857],{},[801,848,849],{},[804,850,851],{},"Wire format",[801,853,854,856],{},[591,855,646],{}," (preserved casing)",[801,858,859,594,861],{},[591,860,650],{},[591,862,863],{},"auth.INVALID_TOKEN",[784,865,866,871,874],{},[801,867,868],{},[804,869,870],{},"One catalog =",[801,872,873],{},"One bounded context, one prefix, one file",[801,875,876,594,878],{},[591,877,660],{},[591,879,663],{},[587,881,882,883,885],{},"The wire format ends up in HTTP responses, wide events, drains, and dashboards. Stick to it across services so a ",[591,884,591],{}," from one service is recognisable in another.",[770,887,889],{"id":888},"scaling-story","Scaling story",[587,891,892],{},"The same primitives cover four scales without API change.",[894,895,897],"h3",{"id":896},"_1-file-small-repo","1 file: small repo",[587,899,900,901,904,905,908],{},"One ",[591,902,903],{},"errors.ts",", one ",[591,906,907],{},"audit.ts",". Done.",[910,911,912,1158],"code-group",{},[913,914,920],"pre",{"className":915,"code":916,"filename":917,"language":918,"meta":919,"style":919},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { defineErrorCatalog } from 'evlog'\n\nexport const errors = defineErrorCatalog('app', {\n  USER_NOT_FOUND: { status: 404, message: 'User not found' },\n  FORBIDDEN: { status: 403, message: 'Forbidden' },\n  VALIDATION_FAILED: {\n    status: 400,\n    message: ({ field }: { field: string }) => `Invalid ${field}`,\n  },\n})\n","src\u002Ferrors.ts","typescript","",[591,921,922,955,962,998,1036,1068,1078,1092,1143,1149],{"__ignoreMap":919},[923,924,927,931,935,939,942,945,948,952],"span",{"class":925,"line":926},"line",1,[923,928,930],{"class":929},"s7zQu","import",[923,932,934],{"class":933},"sMK4o"," {",[923,936,938],{"class":937},"sTEyZ"," defineErrorCatalog",[923,940,941],{"class":933}," }",[923,943,944],{"class":929}," from",[923,946,947],{"class":933}," '",[923,949,951],{"class":950},"sfazB","evlog",[923,953,954],{"class":933},"'\n",[923,956,958],{"class":925,"line":957},2,[923,959,961],{"emptyLinePlaceholder":960},true,"\n",[923,963,965,968,972,975,978,981,984,987,990,992,995],{"class":925,"line":964},3,[923,966,967],{"class":929},"export",[923,969,971],{"class":970},"spNyl"," const",[923,973,974],{"class":937}," errors ",[923,976,977],{"class":933},"=",[923,979,938],{"class":980},"s2Zo4",[923,982,983],{"class":937},"(",[923,985,986],{"class":933},"'",[923,988,989],{"class":950},"app",[923,991,986],{"class":933},[923,993,994],{"class":933},",",[923,996,997],{"class":933}," {\n",[923,999,1001,1005,1008,1010,1013,1015,1019,1021,1024,1026,1028,1031,1033],{"class":925,"line":1000},4,[923,1002,1004],{"class":1003},"swJcz","  USER_NOT_FOUND",[923,1006,1007],{"class":933},":",[923,1009,934],{"class":933},[923,1011,1012],{"class":1003}," status",[923,1014,1007],{"class":933},[923,1016,1018],{"class":1017},"sbssI"," 404",[923,1020,994],{"class":933},[923,1022,1023],{"class":1003}," message",[923,1025,1007],{"class":933},[923,1027,947],{"class":933},[923,1029,1030],{"class":950},"User not found",[923,1032,986],{"class":933},[923,1034,1035],{"class":933}," },\n",[923,1037,1039,1042,1044,1046,1048,1050,1053,1055,1057,1059,1061,1064,1066],{"class":925,"line":1038},5,[923,1040,1041],{"class":1003},"  FORBIDDEN",[923,1043,1007],{"class":933},[923,1045,934],{"class":933},[923,1047,1012],{"class":1003},[923,1049,1007],{"class":933},[923,1051,1052],{"class":1017}," 403",[923,1054,994],{"class":933},[923,1056,1023],{"class":1003},[923,1058,1007],{"class":933},[923,1060,947],{"class":933},[923,1062,1063],{"class":950},"Forbidden",[923,1065,986],{"class":933},[923,1067,1035],{"class":933},[923,1069,1071,1074,1076],{"class":925,"line":1070},6,[923,1072,1073],{"class":1003},"  VALIDATION_FAILED",[923,1075,1007],{"class":933},[923,1077,997],{"class":933},[923,1079,1081,1084,1086,1089],{"class":925,"line":1080},7,[923,1082,1083],{"class":1003},"    status",[923,1085,1007],{"class":933},[923,1087,1088],{"class":1017}," 400",[923,1090,1091],{"class":933},",\n",[923,1093,1095,1098,1100,1103,1107,1110,1112,1114,1116,1120,1123,1126,1129,1132,1135,1138,1141],{"class":925,"line":1094},8,[923,1096,1097],{"class":980},"    message",[923,1099,1007],{"class":933},[923,1101,1102],{"class":933}," ({",[923,1104,1106],{"class":1105},"sHdIc"," field",[923,1108,1109],{"class":933}," }:",[923,1111,934],{"class":933},[923,1113,1106],{"class":1003},[923,1115,1007],{"class":933},[923,1117,1119],{"class":1118},"sBMFI"," string",[923,1121,1122],{"class":933}," })",[923,1124,1125],{"class":970}," =>",[923,1127,1128],{"class":933}," `",[923,1130,1131],{"class":950},"Invalid ",[923,1133,1134],{"class":933},"${",[923,1136,1137],{"class":937},"field",[923,1139,1140],{"class":933},"}`",[923,1142,1091],{"class":933},[923,1144,1146],{"class":925,"line":1145},9,[923,1147,1148],{"class":933},"  },\n",[923,1150,1152,1155],{"class":925,"line":1151},10,[923,1153,1154],{"class":933},"}",[923,1156,1157],{"class":937},")\n",[913,1159,1162],{"className":915,"code":1160,"filename":1161,"language":918,"meta":919,"style":919},"import { defineAuditCatalog } from 'evlog'\n\nexport const audit = defineAuditCatalog('app', {\n  USER_LOGIN: { target: 'user', severity: 'medium' },\n  USER_DELETE: { target: 'user', severity: 'high', requiresChanges: true, requiresReason: true },\n})\n","src\u002Faudit.ts",[591,1163,1164,1183,1187,1212,1249,1303],{"__ignoreMap":919},[923,1165,1166,1168,1170,1173,1175,1177,1179,1181],{"class":925,"line":926},[923,1167,930],{"class":929},[923,1169,934],{"class":933},[923,1171,1172],{"class":937}," defineAuditCatalog",[923,1174,941],{"class":933},[923,1176,944],{"class":929},[923,1178,947],{"class":933},[923,1180,951],{"class":950},[923,1182,954],{"class":933},[923,1184,1185],{"class":925,"line":957},[923,1186,961],{"emptyLinePlaceholder":960},[923,1188,1189,1191,1193,1196,1198,1200,1202,1204,1206,1208,1210],{"class":925,"line":964},[923,1190,967],{"class":929},[923,1192,971],{"class":970},[923,1194,1195],{"class":937}," audit ",[923,1197,977],{"class":933},[923,1199,1172],{"class":980},[923,1201,983],{"class":937},[923,1203,986],{"class":933},[923,1205,989],{"class":950},[923,1207,986],{"class":933},[923,1209,994],{"class":933},[923,1211,997],{"class":933},[923,1213,1214,1217,1219,1221,1224,1226,1228,1231,1233,1235,1238,1240,1242,1245,1247],{"class":925,"line":1000},[923,1215,1216],{"class":1003},"  USER_LOGIN",[923,1218,1007],{"class":933},[923,1220,934],{"class":933},[923,1222,1223],{"class":1003}," target",[923,1225,1007],{"class":933},[923,1227,947],{"class":933},[923,1229,1230],{"class":950},"user",[923,1232,986],{"class":933},[923,1234,994],{"class":933},[923,1236,1237],{"class":1003}," severity",[923,1239,1007],{"class":933},[923,1241,947],{"class":933},[923,1243,1244],{"class":950},"medium",[923,1246,986],{"class":933},[923,1248,1035],{"class":933},[923,1250,1251,1254,1256,1258,1260,1262,1264,1266,1268,1270,1272,1274,1276,1279,1281,1283,1286,1288,1292,1294,1297,1299,1301],{"class":925,"line":1038},[923,1252,1253],{"class":1003},"  USER_DELETE",[923,1255,1007],{"class":933},[923,1257,934],{"class":933},[923,1259,1223],{"class":1003},[923,1261,1007],{"class":933},[923,1263,947],{"class":933},[923,1265,1230],{"class":950},[923,1267,986],{"class":933},[923,1269,994],{"class":933},[923,1271,1237],{"class":1003},[923,1273,1007],{"class":933},[923,1275,947],{"class":933},[923,1277,1278],{"class":950},"high",[923,1280,986],{"class":933},[923,1282,994],{"class":933},[923,1284,1285],{"class":1003}," requiresChanges",[923,1287,1007],{"class":933},[923,1289,1291],{"class":1290},"sfNiH"," true",[923,1293,994],{"class":933},[923,1295,1296],{"class":1003}," requiresReason",[923,1298,1007],{"class":933},[923,1300,1291],{"class":1290},[923,1302,1035],{"class":933},[923,1304,1305,1307],{"class":925,"line":1070},[923,1306,1154],{"class":933},[923,1308,1157],{"class":937},[894,1310,1312],{"id":1311},"_1-folder-1-file-per-domain-medium-repo","1 folder, 1 file per domain: medium repo",[587,1314,1315,1316,636,1319,1322,1323,1326],{},"Group by bounded context. One file per domain in ",[591,1317,1318],{},"src\u002Ferrors\u002F",[591,1320,1321],{},"src\u002Faudit\u002F",". An ",[591,1324,1325],{},"index.ts"," re-exports for ergonomic imports and centralises the type augmentation.",[913,1328,1333],{"className":1329,"code":1331,"language":1332},[1330],"language-text","src\u002F\n├── errors\u002F\n│   ├── billing.ts        → billingErrors (prefix: 'billing')\n│   ├── auth.ts           → authErrors    (prefix: 'auth')\n│   ├── user.ts           → userErrors    (prefix: 'user')\n│   └── index.ts          → re-export + declare module\n├── audit\u002F\n│   ├── billing.ts        → billingAudit\n│   ├── auth.ts           → authAudit\n│   └── index.ts\n","text",[591,1334,1331],{"__ignoreMap":919},[913,1336,1339],{"className":915,"code":1337,"filename":1338,"language":918,"meta":919,"style":919},"import type { authErrors } from '.\u002Fauth'\nimport type { billingErrors } from '.\u002Fbilling'\nimport type { userErrors } from '.\u002Fuser'\n\nexport { authErrors } from '.\u002Fauth'\nexport { billingErrors } from '.\u002Fbilling'\nexport { userErrors } from '.\u002Fuser'\n\ndeclare module 'evlog' {\n  interface RegisteredErrorCatalogs {\n    auth: typeof authErrors\n    billing: typeof billingErrors\n    user: typeof userErrors\n  }\n}\n","src\u002Ferrors\u002Findex.ts",[591,1340,1341,1364,1386,1408,1412,1430,1448,1466,1470,1486,1496,1510,1523,1536,1542],{"__ignoreMap":919},[923,1342,1343,1345,1348,1350,1353,1355,1357,1359,1362],{"class":925,"line":926},[923,1344,930],{"class":929},[923,1346,1347],{"class":929}," type",[923,1349,934],{"class":933},[923,1351,1352],{"class":937}," authErrors",[923,1354,941],{"class":933},[923,1356,944],{"class":929},[923,1358,947],{"class":933},[923,1360,1361],{"class":950},".\u002Fauth",[923,1363,954],{"class":933},[923,1365,1366,1368,1370,1372,1375,1377,1379,1381,1384],{"class":925,"line":957},[923,1367,930],{"class":929},[923,1369,1347],{"class":929},[923,1371,934],{"class":933},[923,1373,1374],{"class":937}," billingErrors",[923,1376,941],{"class":933},[923,1378,944],{"class":929},[923,1380,947],{"class":933},[923,1382,1383],{"class":950},".\u002Fbilling",[923,1385,954],{"class":933},[923,1387,1388,1390,1392,1394,1397,1399,1401,1403,1406],{"class":925,"line":964},[923,1389,930],{"class":929},[923,1391,1347],{"class":929},[923,1393,934],{"class":933},[923,1395,1396],{"class":937}," userErrors",[923,1398,941],{"class":933},[923,1400,944],{"class":929},[923,1402,947],{"class":933},[923,1404,1405],{"class":950},".\u002Fuser",[923,1407,954],{"class":933},[923,1409,1410],{"class":925,"line":1000},[923,1411,961],{"emptyLinePlaceholder":960},[923,1413,1414,1416,1418,1420,1422,1424,1426,1428],{"class":925,"line":1038},[923,1415,967],{"class":929},[923,1417,934],{"class":933},[923,1419,1352],{"class":937},[923,1421,941],{"class":933},[923,1423,944],{"class":929},[923,1425,947],{"class":933},[923,1427,1361],{"class":950},[923,1429,954],{"class":933},[923,1431,1432,1434,1436,1438,1440,1442,1444,1446],{"class":925,"line":1070},[923,1433,967],{"class":929},[923,1435,934],{"class":933},[923,1437,1374],{"class":937},[923,1439,941],{"class":933},[923,1441,944],{"class":929},[923,1443,947],{"class":933},[923,1445,1383],{"class":950},[923,1447,954],{"class":933},[923,1449,1450,1452,1454,1456,1458,1460,1462,1464],{"class":925,"line":1080},[923,1451,967],{"class":929},[923,1453,934],{"class":933},[923,1455,1396],{"class":937},[923,1457,941],{"class":933},[923,1459,944],{"class":929},[923,1461,947],{"class":933},[923,1463,1405],{"class":950},[923,1465,954],{"class":933},[923,1467,1468],{"class":925,"line":1094},[923,1469,961],{"emptyLinePlaceholder":960},[923,1471,1472,1475,1478,1480,1482,1484],{"class":925,"line":1145},[923,1473,1474],{"class":970},"declare",[923,1476,1477],{"class":970}," module",[923,1479,947],{"class":933},[923,1481,951],{"class":950},[923,1483,986],{"class":933},[923,1485,997],{"class":933},[923,1487,1488,1491,1494],{"class":925,"line":1151},[923,1489,1490],{"class":970},"  interface",[923,1492,1493],{"class":1118}," RegisteredErrorCatalogs",[923,1495,997],{"class":933},[923,1497,1499,1502,1504,1507],{"class":925,"line":1498},11,[923,1500,1501],{"class":1003},"    auth",[923,1503,1007],{"class":933},[923,1505,1506],{"class":933}," typeof",[923,1508,1509],{"class":937}," authErrors\n",[923,1511,1513,1516,1518,1520],{"class":925,"line":1512},12,[923,1514,1515],{"class":1003},"    billing",[923,1517,1007],{"class":933},[923,1519,1506],{"class":933},[923,1521,1522],{"class":937}," billingErrors\n",[923,1524,1526,1529,1531,1533],{"class":925,"line":1525},13,[923,1527,1528],{"class":1003},"    user",[923,1530,1007],{"class":933},[923,1532,1506],{"class":933},[923,1534,1535],{"class":937}," userErrors\n",[923,1537,1539],{"class":925,"line":1538},14,[923,1540,1541],{"class":933},"  }\n",[923,1543,1545],{"class":925,"line":1544},15,[923,1546,1547],{"class":933},"}\n",[587,1549,1550,1551,1553,1554,1557],{},"The augmentation is purely type-level: there is no ",[591,1552,94],{}," step, no runtime registration. Importing ",[591,1555,1556],{},"~\u002Ferrors"," once anywhere in your app is enough for TypeScript to pick up the merged type.",[894,1559,1561],{"id":1560},"sub-prefixes-very-large-repo","Sub-prefixes: very large repo",[587,1563,1564,1565,594,1567,594,1570,1573],{},"Hierarchical prefixes (",[591,1566,711],{},[591,1568,1569],{},"billing.subscription",[591,1571,1572],{},"auth.session",") keep keys short while preserving namespace clarity. One catalog per sub-domain.",[913,1575,1578],{"className":1576,"code":1577,"language":1332},[1330],"src\u002Ffeatures\u002F\n├── billing\u002F\n│   └── errors\u002F\n│       ├── payment.ts        → billingPaymentErrors (prefix: 'billing.payment')\n│       ├── subscription.ts   → billingSubscriptionErrors\n│       └── invoice.ts        → billingInvoiceErrors\n├── auth\u002F\n│   └── errors\u002F\n│       ├── session.ts        → authSessionErrors (prefix: 'auth.session')\n│       ├── oauth.ts          → authOAuthErrors\n│       └── mfa.ts            → authMfaErrors\n",[591,1579,1577],{"__ignoreMap":919},[913,1581,1584],{"className":915,"code":1582,"filename":1583,"language":918,"meta":919,"style":919},"import { defineErrorCatalog } from 'evlog'\n\nexport const billingPaymentErrors = defineErrorCatalog('billing.payment', {\n  DECLINED: { status: 402, message: 'Card declined' },\n  INSUFFICIENT_FUNDS: { status: 402, message: 'Insufficient funds' },\n  EXPIRED_CARD: { status: 402, message: 'Card expired' },\n  CVV_MISMATCH: { status: 402, message: 'CVV mismatch' },\n})\n","src\u002Ffeatures\u002Fbilling\u002Ferrors\u002Fpayment.ts",[591,1585,1586,1604,1608,1633,1664,1694,1724,1754],{"__ignoreMap":919},[923,1587,1588,1590,1592,1594,1596,1598,1600,1602],{"class":925,"line":926},[923,1589,930],{"class":929},[923,1591,934],{"class":933},[923,1593,938],{"class":937},[923,1595,941],{"class":933},[923,1597,944],{"class":929},[923,1599,947],{"class":933},[923,1601,951],{"class":950},[923,1603,954],{"class":933},[923,1605,1606],{"class":925,"line":957},[923,1607,961],{"emptyLinePlaceholder":960},[923,1609,1610,1612,1614,1617,1619,1621,1623,1625,1627,1629,1631],{"class":925,"line":964},[923,1611,967],{"class":929},[923,1613,971],{"class":970},[923,1615,1616],{"class":937}," billingPaymentErrors ",[923,1618,977],{"class":933},[923,1620,938],{"class":980},[923,1622,983],{"class":937},[923,1624,986],{"class":933},[923,1626,711],{"class":950},[923,1628,986],{"class":933},[923,1630,994],{"class":933},[923,1632,997],{"class":933},[923,1634,1635,1638,1640,1642,1644,1646,1649,1651,1653,1655,1657,1660,1662],{"class":925,"line":1000},[923,1636,1637],{"class":1003},"  DECLINED",[923,1639,1007],{"class":933},[923,1641,934],{"class":933},[923,1643,1012],{"class":1003},[923,1645,1007],{"class":933},[923,1647,1648],{"class":1017}," 402",[923,1650,994],{"class":933},[923,1652,1023],{"class":1003},[923,1654,1007],{"class":933},[923,1656,947],{"class":933},[923,1658,1659],{"class":950},"Card declined",[923,1661,986],{"class":933},[923,1663,1035],{"class":933},[923,1665,1666,1669,1671,1673,1675,1677,1679,1681,1683,1685,1687,1690,1692],{"class":925,"line":1038},[923,1667,1668],{"class":1003},"  INSUFFICIENT_FUNDS",[923,1670,1007],{"class":933},[923,1672,934],{"class":933},[923,1674,1012],{"class":1003},[923,1676,1007],{"class":933},[923,1678,1648],{"class":1017},[923,1680,994],{"class":933},[923,1682,1023],{"class":1003},[923,1684,1007],{"class":933},[923,1686,947],{"class":933},[923,1688,1689],{"class":950},"Insufficient funds",[923,1691,986],{"class":933},[923,1693,1035],{"class":933},[923,1695,1696,1699,1701,1703,1705,1707,1709,1711,1713,1715,1717,1720,1722],{"class":925,"line":1070},[923,1697,1698],{"class":1003},"  EXPIRED_CARD",[923,1700,1007],{"class":933},[923,1702,934],{"class":933},[923,1704,1012],{"class":1003},[923,1706,1007],{"class":933},[923,1708,1648],{"class":1017},[923,1710,994],{"class":933},[923,1712,1023],{"class":1003},[923,1714,1007],{"class":933},[923,1716,947],{"class":933},[923,1718,1719],{"class":950},"Card expired",[923,1721,986],{"class":933},[923,1723,1035],{"class":933},[923,1725,1726,1729,1731,1733,1735,1737,1739,1741,1743,1745,1747,1750,1752],{"class":925,"line":1080},[923,1727,1728],{"class":1003},"  CVV_MISMATCH",[923,1730,1007],{"class":933},[923,1732,934],{"class":933},[923,1734,1012],{"class":1003},[923,1736,1007],{"class":933},[923,1738,1648],{"class":1017},[923,1740,994],{"class":933},[923,1742,1023],{"class":1003},[923,1744,1007],{"class":933},[923,1746,947],{"class":933},[923,1748,1749],{"class":950},"CVV mismatch",[923,1751,986],{"class":933},[923,1753,1035],{"class":933},[923,1755,1756,1758],{"class":925,"line":1094},[923,1757,1154],{"class":933},[923,1759,1157],{"class":937},[587,1761,1762,1763,594,1766,1769],{},"Wire codes become ",[591,1764,1765],{},"billing.payment.DECLINED",[591,1767,1768],{},"billing.payment.INSUFFICIENT_FUNDS",", etc. The convention scales to hundreds of entries without collisions.",[894,1771,1773],{"id":1772},"npm-packages-monorepo","npm packages: monorepo",[587,1775,1776,1777,1779,1780,1783],{},"In a monorepo, each bounded context can ship as its own npm package. Type augmentation propagates through the published ",[591,1778,726],{},", so consumers get autocomplete just by ",[591,1781,1782],{},"pnpm add @acme\u002Ferrors-billing",".",[913,1785,1788],{"className":1786,"code":1787,"language":1332},[1330],"acme-monorepo\u002F\n├── packages\u002F\n│   ├── errors-billing\u002F         → @acme\u002Ferrors-billing\n│   │   └── src\u002Findex.ts\n│   ├── errors-auth\u002F            → @acme\u002Ferrors-auth\n│   │   └── src\u002Findex.ts\n│   └── audit-billing\u002F          → @acme\u002Faudit-billing\n│       └── src\u002Findex.ts\n└── apps\u002F\n    ├── api\u002F                    → imports + re-exports the catalogs\n    └── worker\u002F\n",[591,1789,1787],{"__ignoreMap":919},[770,1791,1793],{"id":1792},"publishing-a-catalog-as-an-npm-package","Publishing a catalog as an npm package",[587,1795,1796,1797,1799,1800,1802],{},"A catalog is just regular TypeScript that depends on ",[591,1798,951],{}," as a peer dep. Here is the minimal recipe. For the logging side of shipping evlog from a package, ",[751,1801,454],{"href":455}," covers emitting without owning the configuration and attributing events to your package.",[894,1804,1806],{"id":1805},"packagejson",[591,1807,1808],{},"package.json",[913,1810,1815],{"className":1811,"code":1812,"filename":1813,"language":1814,"meta":919,"style":919},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"name\": \"@acme\u002Ferrors-billing\",\n  \"version\": \"1.0.0\",\n  \"type\": \"module\",\n  \"main\": \".\u002Fdist\u002Findex.mjs\",\n  \"types\": \".\u002Fdist\u002Findex.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": \".\u002Fdist\u002Findex.mjs\",\n      \"types\": \".\u002Fdist\u002Findex.d.ts\"\n    }\n  },\n  \"peerDependencies\": {\n    \"evlog\": \"^3.0.0\"\n  },\n  \"files\": [\"dist\"]\n}\n","packages\u002Ferrors-billing\u002Fpackage.json","json",[591,1816,1817,1822,1845,1865,1885,1905,1925,1938,1951,1970,1987,1992,1996,2009,2026,2030,2055],{"__ignoreMap":919},[923,1818,1819],{"class":925,"line":926},[923,1820,1821],{"class":933},"{\n",[923,1823,1824,1827,1830,1833,1835,1838,1841,1843],{"class":925,"line":957},[923,1825,1826],{"class":933},"  \"",[923,1828,1829],{"class":970},"name",[923,1831,1832],{"class":933},"\"",[923,1834,1007],{"class":933},[923,1836,1837],{"class":933}," \"",[923,1839,1840],{"class":950},"@acme\u002Ferrors-billing",[923,1842,1832],{"class":933},[923,1844,1091],{"class":933},[923,1846,1847,1849,1852,1854,1856,1858,1861,1863],{"class":925,"line":964},[923,1848,1826],{"class":933},[923,1850,1851],{"class":970},"version",[923,1853,1832],{"class":933},[923,1855,1007],{"class":933},[923,1857,1837],{"class":933},[923,1859,1860],{"class":950},"1.0.0",[923,1862,1832],{"class":933},[923,1864,1091],{"class":933},[923,1866,1867,1869,1872,1874,1876,1878,1881,1883],{"class":925,"line":1000},[923,1868,1826],{"class":933},[923,1870,1871],{"class":970},"type",[923,1873,1832],{"class":933},[923,1875,1007],{"class":933},[923,1877,1837],{"class":933},[923,1879,1880],{"class":950},"module",[923,1882,1832],{"class":933},[923,1884,1091],{"class":933},[923,1886,1887,1889,1892,1894,1896,1898,1901,1903],{"class":925,"line":1038},[923,1888,1826],{"class":933},[923,1890,1891],{"class":970},"main",[923,1893,1832],{"class":933},[923,1895,1007],{"class":933},[923,1897,1837],{"class":933},[923,1899,1900],{"class":950},".\u002Fdist\u002Findex.mjs",[923,1902,1832],{"class":933},[923,1904,1091],{"class":933},[923,1906,1907,1909,1912,1914,1916,1918,1921,1923],{"class":925,"line":1070},[923,1908,1826],{"class":933},[923,1910,1911],{"class":970},"types",[923,1913,1832],{"class":933},[923,1915,1007],{"class":933},[923,1917,1837],{"class":933},[923,1919,1920],{"class":950},".\u002Fdist\u002Findex.d.ts",[923,1922,1832],{"class":933},[923,1924,1091],{"class":933},[923,1926,1927,1929,1932,1934,1936],{"class":925,"line":1080},[923,1928,1826],{"class":933},[923,1930,1931],{"class":970},"exports",[923,1933,1832],{"class":933},[923,1935,1007],{"class":933},[923,1937,997],{"class":933},[923,1939,1940,1943,1945,1947,1949],{"class":925,"line":1094},[923,1941,1942],{"class":933},"    \"",[923,1944,1783],{"class":1118},[923,1946,1832],{"class":933},[923,1948,1007],{"class":933},[923,1950,997],{"class":933},[923,1952,1953,1956,1958,1960,1962,1964,1966,1968],{"class":925,"line":1145},[923,1954,1955],{"class":933},"      \"",[923,1957,930],{"class":1017},[923,1959,1832],{"class":933},[923,1961,1007],{"class":933},[923,1963,1837],{"class":933},[923,1965,1900],{"class":950},[923,1967,1832],{"class":933},[923,1969,1091],{"class":933},[923,1971,1972,1974,1976,1978,1980,1982,1984],{"class":925,"line":1151},[923,1973,1955],{"class":933},[923,1975,1911],{"class":1017},[923,1977,1832],{"class":933},[923,1979,1007],{"class":933},[923,1981,1837],{"class":933},[923,1983,1920],{"class":950},[923,1985,1986],{"class":933},"\"\n",[923,1988,1989],{"class":925,"line":1498},[923,1990,1991],{"class":933},"    }\n",[923,1993,1994],{"class":925,"line":1512},[923,1995,1148],{"class":933},[923,1997,1998,2000,2003,2005,2007],{"class":925,"line":1525},[923,1999,1826],{"class":933},[923,2001,2002],{"class":970},"peerDependencies",[923,2004,1832],{"class":933},[923,2006,1007],{"class":933},[923,2008,997],{"class":933},[923,2010,2011,2013,2015,2017,2019,2021,2024],{"class":925,"line":1538},[923,2012,1942],{"class":933},[923,2014,951],{"class":1118},[923,2016,1832],{"class":933},[923,2018,1007],{"class":933},[923,2020,1837],{"class":933},[923,2022,2023],{"class":950},"^3.0.0",[923,2025,1986],{"class":933},[923,2027,2028],{"class":925,"line":1544},[923,2029,1148],{"class":933},[923,2031,2033,2035,2038,2040,2042,2045,2047,2050,2052],{"class":925,"line":2032},16,[923,2034,1826],{"class":933},[923,2036,2037],{"class":970},"files",[923,2039,1832],{"class":933},[923,2041,1007],{"class":933},[923,2043,2044],{"class":933}," [",[923,2046,1832],{"class":933},[923,2048,2049],{"class":950},"dist",[923,2051,1832],{"class":933},[923,2053,2054],{"class":933},"]\n",[923,2056,2058],{"class":925,"line":2057},17,[923,2059,1547],{"class":933},[894,2061,2063],{"id":2062},"source-catalog-augmentation-in-the-same-file","Source: catalog + augmentation in the same file",[913,2065,2068],{"className":915,"code":2066,"filename":2067,"language":918,"meta":919,"style":919},"import { defineErrorCatalog } from 'evlog'\n\nexport const billingErrors = defineErrorCatalog('billing', {\n  PAYMENT_DECLINED: {\n    status: 402,\n    message: 'Card declined',\n    why: 'Issuer declined the charge',\n    fix: 'Try a different payment method',\n    link: 'https:\u002F\u002Fdocs.example.com\u002Ferrors\u002Fbilling.payment_declined',\n  },\n  INSUFFICIENT_FUNDS: {\n    status: 402,\n    message: ({ available, required }: { available: number, required: number }) =>\n      `Insufficient funds: $${available}\u002F$${required}`,\n  },\n  \u002F\u002F ...\n})\n\ndeclare module 'evlog' {\n  interface RegisteredErrorCatalogs {\n    billing: typeof billingErrors\n  }\n}\n","packages\u002Ferrors-billing\u002Fsrc\u002Findex.ts",[591,2069,2070,2088,2092,2118,2127,2137,2151,2167,2183,2199,2203,2211,2221,2261,2288,2292,2298,2304,2309,2324,2333,2344,2349],{"__ignoreMap":919},[923,2071,2072,2074,2076,2078,2080,2082,2084,2086],{"class":925,"line":926},[923,2073,930],{"class":929},[923,2075,934],{"class":933},[923,2077,938],{"class":937},[923,2079,941],{"class":933},[923,2081,944],{"class":929},[923,2083,947],{"class":933},[923,2085,951],{"class":950},[923,2087,954],{"class":933},[923,2089,2090],{"class":925,"line":957},[923,2091,961],{"emptyLinePlaceholder":960},[923,2093,2094,2096,2098,2101,2103,2105,2107,2109,2112,2114,2116],{"class":925,"line":964},[923,2095,967],{"class":929},[923,2097,971],{"class":970},[923,2099,2100],{"class":937}," billingErrors ",[923,2102,977],{"class":933},[923,2104,938],{"class":980},[923,2106,983],{"class":937},[923,2108,986],{"class":933},[923,2110,2111],{"class":950},"billing",[923,2113,986],{"class":933},[923,2115,994],{"class":933},[923,2117,997],{"class":933},[923,2119,2120,2123,2125],{"class":925,"line":1000},[923,2121,2122],{"class":1003},"  PAYMENT_DECLINED",[923,2124,1007],{"class":933},[923,2126,997],{"class":933},[923,2128,2129,2131,2133,2135],{"class":925,"line":1038},[923,2130,1083],{"class":1003},[923,2132,1007],{"class":933},[923,2134,1648],{"class":1017},[923,2136,1091],{"class":933},[923,2138,2139,2141,2143,2145,2147,2149],{"class":925,"line":1070},[923,2140,1097],{"class":1003},[923,2142,1007],{"class":933},[923,2144,947],{"class":933},[923,2146,1659],{"class":950},[923,2148,986],{"class":933},[923,2150,1091],{"class":933},[923,2152,2153,2156,2158,2160,2163,2165],{"class":925,"line":1080},[923,2154,2155],{"class":1003},"    why",[923,2157,1007],{"class":933},[923,2159,947],{"class":933},[923,2161,2162],{"class":950},"Issuer declined the charge",[923,2164,986],{"class":933},[923,2166,1091],{"class":933},[923,2168,2169,2172,2174,2176,2179,2181],{"class":925,"line":1094},[923,2170,2171],{"class":1003},"    fix",[923,2173,1007],{"class":933},[923,2175,947],{"class":933},[923,2177,2178],{"class":950},"Try a different payment method",[923,2180,986],{"class":933},[923,2182,1091],{"class":933},[923,2184,2185,2188,2190,2192,2195,2197],{"class":925,"line":1145},[923,2186,2187],{"class":1003},"    link",[923,2189,1007],{"class":933},[923,2191,947],{"class":933},[923,2193,2194],{"class":950},"https:\u002F\u002Fdocs.example.com\u002Ferrors\u002Fbilling.payment_declined",[923,2196,986],{"class":933},[923,2198,1091],{"class":933},[923,2200,2201],{"class":925,"line":1151},[923,2202,1148],{"class":933},[923,2204,2205,2207,2209],{"class":925,"line":1498},[923,2206,1668],{"class":1003},[923,2208,1007],{"class":933},[923,2210,997],{"class":933},[923,2212,2213,2215,2217,2219],{"class":925,"line":1512},[923,2214,1083],{"class":1003},[923,2216,1007],{"class":933},[923,2218,1648],{"class":1017},[923,2220,1091],{"class":933},[923,2222,2223,2225,2227,2229,2232,2234,2237,2239,2241,2243,2245,2248,2250,2252,2254,2256,2258],{"class":925,"line":1525},[923,2224,1097],{"class":980},[923,2226,1007],{"class":933},[923,2228,1102],{"class":933},[923,2230,2231],{"class":1105}," available",[923,2233,994],{"class":933},[923,2235,2236],{"class":1105}," required",[923,2238,1109],{"class":933},[923,2240,934],{"class":933},[923,2242,2231],{"class":1003},[923,2244,1007],{"class":933},[923,2246,2247],{"class":1118}," number",[923,2249,994],{"class":933},[923,2251,2236],{"class":1003},[923,2253,1007],{"class":933},[923,2255,2247],{"class":1118},[923,2257,1122],{"class":933},[923,2259,2260],{"class":970}," =>\n",[923,2262,2263,2266,2269,2271,2274,2276,2279,2281,2284,2286],{"class":925,"line":1538},[923,2264,2265],{"class":933},"      `",[923,2267,2268],{"class":950},"Insufficient funds: $",[923,2270,1134],{"class":933},[923,2272,2273],{"class":937},"available",[923,2275,1154],{"class":933},[923,2277,2278],{"class":950},"\u002F$",[923,2280,1134],{"class":933},[923,2282,2283],{"class":937},"required",[923,2285,1140],{"class":933},[923,2287,1091],{"class":933},[923,2289,2290],{"class":925,"line":1544},[923,2291,1148],{"class":933},[923,2293,2294],{"class":925,"line":2032},[923,2295,2297],{"class":2296},"sHwdD","  \u002F\u002F ...\n",[923,2299,2300,2302],{"class":925,"line":2057},[923,2301,1154],{"class":933},[923,2303,1157],{"class":937},[923,2305,2307],{"class":925,"line":2306},18,[923,2308,961],{"emptyLinePlaceholder":960},[923,2310,2312,2314,2316,2318,2320,2322],{"class":925,"line":2311},19,[923,2313,1474],{"class":970},[923,2315,1477],{"class":970},[923,2317,947],{"class":933},[923,2319,951],{"class":950},[923,2321,986],{"class":933},[923,2323,997],{"class":933},[923,2325,2327,2329,2331],{"class":925,"line":2326},20,[923,2328,1490],{"class":970},[923,2330,1493],{"class":1118},[923,2332,997],{"class":933},[923,2334,2336,2338,2340,2342],{"class":925,"line":2335},21,[923,2337,1515],{"class":1003},[923,2339,1007],{"class":933},[923,2341,1506],{"class":933},[923,2343,1522],{"class":937},[923,2345,2347],{"class":925,"line":2346},22,[923,2348,1541],{"class":933},[923,2350,2352],{"class":925,"line":2351},23,[923,2353,1547],{"class":933},[587,2355,2356,2357,2359,2360,2363,2364,2366],{},"The ",[591,2358,745],{}," block lives inside the source file so the bundler emits it into the ",[591,2361,2362],{},"dist\u002Findex.d.ts",". Any consumer that imports from ",[591,2365,1840],{}," gets the augmentation transitively, with no extra setup required on their side.",[894,2368,2370],{"id":2369},"consumption","Consumption",[913,2372,2375],{"className":915,"code":2373,"filename":2374,"language":918,"meta":919,"style":919},"\u002F\u002F Importing the package activates both the runtime catalog and the type augmentation.\nimport { billingErrors } from '@acme\u002Ferrors-billing'\nimport { authErrors } from '@acme\u002Ferrors-auth'\n\n\u002F\u002F Re-export from a central place so the rest of the app has one import path.\nexport { billingErrors, authErrors }\n","apps\u002Fapi\u002Fsrc\u002Finit.ts",[591,2376,2377,2382,2400,2419,2423,2428],{"__ignoreMap":919},[923,2378,2379],{"class":925,"line":926},[923,2380,2381],{"class":2296},"\u002F\u002F Importing the package activates both the runtime catalog and the type augmentation.\n",[923,2383,2384,2386,2388,2390,2392,2394,2396,2398],{"class":925,"line":957},[923,2385,930],{"class":929},[923,2387,934],{"class":933},[923,2389,1374],{"class":937},[923,2391,941],{"class":933},[923,2393,944],{"class":929},[923,2395,947],{"class":933},[923,2397,1840],{"class":950},[923,2399,954],{"class":933},[923,2401,2402,2404,2406,2408,2410,2412,2414,2417],{"class":925,"line":964},[923,2403,930],{"class":929},[923,2405,934],{"class":933},[923,2407,1352],{"class":937},[923,2409,941],{"class":933},[923,2411,944],{"class":929},[923,2413,947],{"class":933},[923,2415,2416],{"class":950},"@acme\u002Ferrors-auth",[923,2418,954],{"class":933},[923,2420,2421],{"class":925,"line":1000},[923,2422,961],{"emptyLinePlaceholder":960},[923,2424,2425],{"class":925,"line":1038},[923,2426,2427],{"class":2296},"\u002F\u002F Re-export from a central place so the rest of the app has one import path.\n",[923,2429,2430,2432,2434,2436,2438,2440],{"class":925,"line":1070},[923,2431,967],{"class":929},[923,2433,934],{"class":933},[923,2435,1374],{"class":937},[923,2437,994],{"class":933},[923,2439,1352],{"class":937},[923,2441,2442],{"class":933}," }\n",[913,2444,2447],{"className":915,"code":2445,"filename":2446,"language":918,"meta":919,"style":919},"import { billingErrors } from '~\u002Finit'\n\nthrow billingErrors.PAYMENT_DECLINED({ cause: stripeErr })\n","apps\u002Fapi\u002Fsrc\u002Froutes\u002Fcheckout.post.ts",[591,2448,2449,2468,2472],{"__ignoreMap":919},[923,2450,2451,2453,2455,2457,2459,2461,2463,2466],{"class":925,"line":926},[923,2452,930],{"class":929},[923,2454,934],{"class":933},[923,2456,1374],{"class":937},[923,2458,941],{"class":933},[923,2460,944],{"class":929},[923,2462,947],{"class":933},[923,2464,2465],{"class":950},"~\u002Finit",[923,2467,954],{"class":933},[923,2469,2470],{"class":925,"line":957},[923,2471,961],{"emptyLinePlaceholder":960},[923,2473,2474,2477,2479,2481,2483,2485,2488,2491,2493,2496,2498],{"class":925,"line":964},[923,2475,2476],{"class":929},"throw",[923,2478,1374],{"class":937},[923,2480,1783],{"class":933},[923,2482,817],{"class":980},[923,2484,983],{"class":937},[923,2486,2487],{"class":933},"{",[923,2489,2490],{"class":1003}," cause",[923,2492,1007],{"class":933},[923,2494,2495],{"class":937}," stripeErr ",[923,2497,1154],{"class":933},[923,2499,1157],{"class":937},[913,2501,2504],{"className":915,"code":2502,"filename":2503,"language":918,"meta":919,"style":919},"import { createError, parseError } from 'evlog'\n\nthrow createError({\n  code: 'billing.PAYMENT_DECLINED', \u002F\u002F ← autocomplete from the registered catalog\n  message: 'Card declined',\n  status: 402,\n})\n\nconst err = parseError(caught)\nif (err.code === 'billing.PAYMENT_DECLINED') retry()\n\u002F\u002F                ↑ TypeScript knows the union of all registered codes\n","Anywhere in the app — autocomplete works",[591,2505,2506,2530,2534,2544,2562,2577,2588,2594,2598,2613,2644],{"__ignoreMap":919},[923,2507,2508,2510,2512,2515,2517,2520,2522,2524,2526,2528],{"class":925,"line":926},[923,2509,930],{"class":929},[923,2511,934],{"class":933},[923,2513,2514],{"class":937}," createError",[923,2516,994],{"class":933},[923,2518,2519],{"class":937}," parseError",[923,2521,941],{"class":933},[923,2523,944],{"class":929},[923,2525,947],{"class":933},[923,2527,951],{"class":950},[923,2529,954],{"class":933},[923,2531,2532],{"class":925,"line":957},[923,2533,961],{"emptyLinePlaceholder":960},[923,2535,2536,2538,2540,2542],{"class":925,"line":964},[923,2537,2476],{"class":929},[923,2539,2514],{"class":980},[923,2541,983],{"class":937},[923,2543,1821],{"class":933},[923,2545,2546,2549,2551,2553,2555,2557,2559],{"class":925,"line":1000},[923,2547,2548],{"class":1003},"  code",[923,2550,1007],{"class":933},[923,2552,947],{"class":933},[923,2554,650],{"class":950},[923,2556,986],{"class":933},[923,2558,994],{"class":933},[923,2560,2561],{"class":2296}," \u002F\u002F ← autocomplete from the registered catalog\n",[923,2563,2564,2567,2569,2571,2573,2575],{"class":925,"line":1038},[923,2565,2566],{"class":1003},"  message",[923,2568,1007],{"class":933},[923,2570,947],{"class":933},[923,2572,1659],{"class":950},[923,2574,986],{"class":933},[923,2576,1091],{"class":933},[923,2578,2579,2582,2584,2586],{"class":925,"line":1070},[923,2580,2581],{"class":1003},"  status",[923,2583,1007],{"class":933},[923,2585,1648],{"class":1017},[923,2587,1091],{"class":933},[923,2589,2590,2592],{"class":925,"line":1080},[923,2591,1154],{"class":933},[923,2593,1157],{"class":937},[923,2595,2596],{"class":925,"line":1094},[923,2597,961],{"emptyLinePlaceholder":960},[923,2599,2600,2603,2606,2608,2610],{"class":925,"line":1145},[923,2601,2602],{"class":970},"const",[923,2604,2605],{"class":937}," err ",[923,2607,977],{"class":933},[923,2609,2519],{"class":980},[923,2611,2612],{"class":937},"(caught)\n",[923,2614,2615,2618,2621,2623,2626,2629,2631,2633,2635,2638,2641],{"class":925,"line":1151},[923,2616,2617],{"class":929},"if",[923,2619,2620],{"class":937}," (err",[923,2622,1783],{"class":933},[923,2624,2625],{"class":937},"code ",[923,2627,2628],{"class":933},"===",[923,2630,947],{"class":933},[923,2632,650],{"class":950},[923,2634,986],{"class":933},[923,2636,2637],{"class":937},") ",[923,2639,2640],{"class":980},"retry",[923,2642,2643],{"class":937},"()\n",[923,2645,2646],{"class":925,"line":1498},[923,2647,2648],{"class":2296},"\u002F\u002F                ↑ TypeScript knows the union of all registered codes\n",[2650,2651,2653,2656,2657,2659,2660,594,2663,2659,2665,2668],"callout",{"color":2652,"icon":457},"neutral",[804,2654,2655],{},"Each shared package owns its prefix."," ",[591,2658,1840],{}," owns ",[591,2661,2662],{},"billing.*",[591,2664,2416],{},[591,2666,2667],{},"auth.*",". Conflicts are impossible by construction. Bumping a catalog to a new minor (adding entries) propagates to consumers via the regular semver upgrade path: no codegen, no migration step.",[770,2670,2672],{"id":2671},"composition-patterns","Composition patterns",[894,2674,2676],{"id":2675},"mix-catalogs-and-standalone-factories","Mix catalogs and standalone factories",[587,2678,2679,636,2681,2683,2684,2686],{},[591,2680,593],{},[591,2682,597],{}," produce identical call-site shapes. Use catalogs for grouped errors, ",[591,2685,593],{}," for one-offs (e.g. cross-cutting concerns like rate-limiting that don't belong to a specific domain).",[913,2688,2690],{"className":915,"code":2689,"filename":1338,"language":918,"meta":919,"style":919},"import { defineError, defineErrorCatalog } from 'evlog'\n\nexport const billingErrors = defineErrorCatalog('billing', {\n  PAYMENT_DECLINED: { status: 402, message: 'Card declined' },\n})\n\nexport const rateLimited = defineError('app.RATE_LIMITED', {\n  status: 429,\n  message: ({ retryAfter }: { retryAfter: number }) =>\n    `Rate limited: retry in ${retryAfter}s`,\n})\n\n\u002F\u002F Both look identical at the call site:\nthrow billingErrors.PAYMENT_DECLINED()\nthrow rateLimited({ retryAfter: 30 })\n",[591,2691,2692,2715,2719,2743,2771,2777,2781,2807,2818,2843,2866,2872,2876,2881,2893],{"__ignoreMap":919},[923,2693,2694,2696,2698,2701,2703,2705,2707,2709,2711,2713],{"class":925,"line":926},[923,2695,930],{"class":929},[923,2697,934],{"class":933},[923,2699,2700],{"class":937}," defineError",[923,2702,994],{"class":933},[923,2704,938],{"class":937},[923,2706,941],{"class":933},[923,2708,944],{"class":929},[923,2710,947],{"class":933},[923,2712,951],{"class":950},[923,2714,954],{"class":933},[923,2716,2717],{"class":925,"line":957},[923,2718,961],{"emptyLinePlaceholder":960},[923,2720,2721,2723,2725,2727,2729,2731,2733,2735,2737,2739,2741],{"class":925,"line":964},[923,2722,967],{"class":929},[923,2724,971],{"class":970},[923,2726,2100],{"class":937},[923,2728,977],{"class":933},[923,2730,938],{"class":980},[923,2732,983],{"class":937},[923,2734,986],{"class":933},[923,2736,2111],{"class":950},[923,2738,986],{"class":933},[923,2740,994],{"class":933},[923,2742,997],{"class":933},[923,2744,2745,2747,2749,2751,2753,2755,2757,2759,2761,2763,2765,2767,2769],{"class":925,"line":1000},[923,2746,2122],{"class":1003},[923,2748,1007],{"class":933},[923,2750,934],{"class":933},[923,2752,1012],{"class":1003},[923,2754,1007],{"class":933},[923,2756,1648],{"class":1017},[923,2758,994],{"class":933},[923,2760,1023],{"class":1003},[923,2762,1007],{"class":933},[923,2764,947],{"class":933},[923,2766,1659],{"class":950},[923,2768,986],{"class":933},[923,2770,1035],{"class":933},[923,2772,2773,2775],{"class":925,"line":1038},[923,2774,1154],{"class":933},[923,2776,1157],{"class":937},[923,2778,2779],{"class":925,"line":1070},[923,2780,961],{"emptyLinePlaceholder":960},[923,2782,2783,2785,2787,2790,2792,2794,2796,2798,2801,2803,2805],{"class":925,"line":1080},[923,2784,967],{"class":929},[923,2786,971],{"class":970},[923,2788,2789],{"class":937}," rateLimited ",[923,2791,977],{"class":933},[923,2793,2700],{"class":980},[923,2795,983],{"class":937},[923,2797,986],{"class":933},[923,2799,2800],{"class":950},"app.RATE_LIMITED",[923,2802,986],{"class":933},[923,2804,994],{"class":933},[923,2806,997],{"class":933},[923,2808,2809,2811,2813,2816],{"class":925,"line":1094},[923,2810,2581],{"class":1003},[923,2812,1007],{"class":933},[923,2814,2815],{"class":1017}," 429",[923,2817,1091],{"class":933},[923,2819,2820,2822,2824,2826,2829,2831,2833,2835,2837,2839,2841],{"class":925,"line":1145},[923,2821,2566],{"class":980},[923,2823,1007],{"class":933},[923,2825,1102],{"class":933},[923,2827,2828],{"class":1105}," retryAfter",[923,2830,1109],{"class":933},[923,2832,934],{"class":933},[923,2834,2828],{"class":1003},[923,2836,1007],{"class":933},[923,2838,2247],{"class":1118},[923,2840,1122],{"class":933},[923,2842,2260],{"class":970},[923,2844,2845,2848,2851,2853,2856,2858,2861,2864],{"class":925,"line":1151},[923,2846,2847],{"class":933},"    `",[923,2849,2850],{"class":950},"Rate limited: retry in ",[923,2852,1134],{"class":933},[923,2854,2855],{"class":937},"retryAfter",[923,2857,1154],{"class":933},[923,2859,2860],{"class":950},"s",[923,2862,2863],{"class":933},"`",[923,2865,1091],{"class":933},[923,2867,2868,2870],{"class":925,"line":1498},[923,2869,1154],{"class":933},[923,2871,1157],{"class":937},[923,2873,2874],{"class":925,"line":1512},[923,2875,961],{"emptyLinePlaceholder":960},[923,2877,2878],{"class":925,"line":1525},[923,2879,2880],{"class":2296},"\u002F\u002F Both look identical at the call site:\n",[923,2882,2883,2885,2887,2889,2891],{"class":925,"line":1538},[923,2884,2476],{"class":929},[923,2886,1374],{"class":937},[923,2888,1783],{"class":933},[923,2890,817],{"class":980},[923,2892,2643],{"class":937},[923,2894,2895,2897,2900,2902,2904,2906,2908,2911,2913],{"class":925,"line":1544},[923,2896,2476],{"class":929},[923,2898,2899],{"class":980}," rateLimited",[923,2901,983],{"class":937},[923,2903,2487],{"class":933},[923,2905,2828],{"class":1003},[923,2907,1007],{"class":933},[923,2909,2910],{"class":1017}," 30",[923,2912,941],{"class":933},[923,2914,1157],{"class":937},[894,2916,2918],{"id":2917},"re-export-from-one-entry-per-domain","Re-export from one entry per domain",[587,2920,2921],{},"If a feature ships errors and audits together, give it a single re-export module so call sites only import once.",[913,2923,2926],{"className":915,"code":2924,"filename":2925,"language":918,"meta":919,"style":919},"export { billingErrors } from '.\u002Ferrors\u002Fbilling'\nexport { billingAudit } from '.\u002Faudit\u002Fbilling'\n","src\u002Ffeatures\u002Fbilling\u002Findex.ts",[591,2927,2928,2947],{"__ignoreMap":919},[923,2929,2930,2932,2934,2936,2938,2940,2942,2945],{"class":925,"line":926},[923,2931,967],{"class":929},[923,2933,934],{"class":933},[923,2935,1374],{"class":937},[923,2937,941],{"class":933},[923,2939,944],{"class":929},[923,2941,947],{"class":933},[923,2943,2944],{"class":950},".\u002Ferrors\u002Fbilling",[923,2946,954],{"class":933},[923,2948,2949,2951,2953,2956,2958,2960,2962,2965],{"class":925,"line":957},[923,2950,967],{"class":929},[923,2952,934],{"class":933},[923,2954,2955],{"class":937}," billingAudit",[923,2957,941],{"class":933},[923,2959,944],{"class":929},[923,2961,947],{"class":933},[923,2963,2964],{"class":950},".\u002Faudit\u002Fbilling",[923,2966,954],{"class":933},[913,2968,2971],{"className":915,"code":2969,"filename":2970,"language":918,"meta":919,"style":919},"import { billingErrors, billingAudit } from '~\u002Ffeatures\u002Fbilling'\n\nif (!cart.items.length) throw billingErrors.CART_EMPTY()\n\nlog.audit(billingAudit.INVOICE_REFUND({ actor, target: { id: 'inv_889' } }))\n","server\u002Fapi\u002Frefund.post.ts",[591,2972,2973,2996,3000,3034,3038],{"__ignoreMap":919},[923,2974,2975,2977,2979,2981,2983,2985,2987,2989,2991,2994],{"class":925,"line":926},[923,2976,930],{"class":929},[923,2978,934],{"class":933},[923,2980,1374],{"class":937},[923,2982,994],{"class":933},[923,2984,2955],{"class":937},[923,2986,941],{"class":933},[923,2988,944],{"class":929},[923,2990,947],{"class":933},[923,2992,2993],{"class":950},"~\u002Ffeatures\u002Fbilling",[923,2995,954],{"class":933},[923,2997,2998],{"class":925,"line":957},[923,2999,961],{"emptyLinePlaceholder":960},[923,3001,3002,3004,3007,3010,3013,3015,3018,3020,3023,3025,3027,3029,3032],{"class":925,"line":964},[923,3003,2617],{"class":929},[923,3005,3006],{"class":937}," (",[923,3008,3009],{"class":933},"!",[923,3011,3012],{"class":937},"cart",[923,3014,1783],{"class":933},[923,3016,3017],{"class":937},"items",[923,3019,1783],{"class":933},[923,3021,3022],{"class":937},"length) ",[923,3024,2476],{"class":929},[923,3026,1374],{"class":937},[923,3028,1783],{"class":933},[923,3030,3031],{"class":980},"CART_EMPTY",[923,3033,2643],{"class":937},[923,3035,3036],{"class":925,"line":1000},[923,3037,961],{"emptyLinePlaceholder":960},[923,3039,3040,3043,3045,3048,3051,3053,3055,3057,3059,3062,3064,3066,3068,3070,3073,3075,3077,3080,3082,3084,3086],{"class":925,"line":1038},[923,3041,3042],{"class":937},"log",[923,3044,1783],{"class":933},[923,3046,3047],{"class":980},"audit",[923,3049,3050],{"class":937},"(billingAudit",[923,3052,1783],{"class":933},[923,3054,820],{"class":980},[923,3056,983],{"class":937},[923,3058,2487],{"class":933},[923,3060,3061],{"class":937}," actor",[923,3063,994],{"class":933},[923,3065,1223],{"class":1003},[923,3067,1007],{"class":933},[923,3069,934],{"class":933},[923,3071,3072],{"class":1003}," id",[923,3074,1007],{"class":933},[923,3076,947],{"class":933},[923,3078,3079],{"class":950},"inv_889",[923,3081,986],{"class":933},[923,3083,941],{"class":933},[923,3085,941],{"class":933},[923,3087,3088],{"class":937},"))\n",[894,3090,3092],{"id":3091},"override-catalog-defaults-at-the-call-site","Override catalog defaults at the call site",[587,3094,3095,3096,594,3099,594,3102,594,3105,594,3108,594,3111,3113,3114,3116],{},"Every entry's defaults (",[591,3097,3098],{},"message",[591,3100,3101],{},"status",[591,3103,3104],{},"why",[591,3106,3107],{},"fix",[591,3109,3110],{},"link",[591,3112,686],{},") are overridable per call. ",[591,3115,686],{}," is shallow-merged (call-site wins on conflict).",[913,3118,3120],{"className":915,"code":3119,"language":918,"meta":919,"style":919},"\u002F\u002F Catalog default:\n\u002F\u002F message: 'Card declined'\n\u002F\u002F internal: { category: 'gateway' }\n\nthrow billingErrors.PAYMENT_DECLINED({\n  message: 'Custom message for this specific call',\n  internal: { stripeRef: 'ch_x', category: 'gateway-overridden' },\n  cause: stripeErr,\n})\n\n\u002F\u002F Resulting EvlogError:\n\u002F\u002F - message: 'Custom message for this specific call' (override)\n\u002F\u002F - status: 402 (catalog default)\n\u002F\u002F - why: 'Issuer declined the charge' (catalog default)\n\u002F\u002F - internal: { category: 'gateway-overridden', stripeRef: 'ch_x' }\n",[591,3121,3122,3127,3132,3137,3141,3155,3170,3207,3219,3225,3229,3234,3239,3244,3249],{"__ignoreMap":919},[923,3123,3124],{"class":925,"line":926},[923,3125,3126],{"class":2296},"\u002F\u002F Catalog default:\n",[923,3128,3129],{"class":925,"line":957},[923,3130,3131],{"class":2296},"\u002F\u002F message: 'Card declined'\n",[923,3133,3134],{"class":925,"line":964},[923,3135,3136],{"class":2296},"\u002F\u002F internal: { category: 'gateway' }\n",[923,3138,3139],{"class":925,"line":1000},[923,3140,961],{"emptyLinePlaceholder":960},[923,3142,3143,3145,3147,3149,3151,3153],{"class":925,"line":1038},[923,3144,2476],{"class":929},[923,3146,1374],{"class":937},[923,3148,1783],{"class":933},[923,3150,817],{"class":980},[923,3152,983],{"class":937},[923,3154,1821],{"class":933},[923,3156,3157,3159,3161,3163,3166,3168],{"class":925,"line":1070},[923,3158,2566],{"class":1003},[923,3160,1007],{"class":933},[923,3162,947],{"class":933},[923,3164,3165],{"class":950},"Custom message for this specific call",[923,3167,986],{"class":933},[923,3169,1091],{"class":933},[923,3171,3172,3175,3177,3179,3182,3184,3186,3189,3191,3193,3196,3198,3200,3203,3205],{"class":925,"line":1080},[923,3173,3174],{"class":1003},"  internal",[923,3176,1007],{"class":933},[923,3178,934],{"class":933},[923,3180,3181],{"class":1003}," stripeRef",[923,3183,1007],{"class":933},[923,3185,947],{"class":933},[923,3187,3188],{"class":950},"ch_x",[923,3190,986],{"class":933},[923,3192,994],{"class":933},[923,3194,3195],{"class":1003}," category",[923,3197,1007],{"class":933},[923,3199,947],{"class":933},[923,3201,3202],{"class":950},"gateway-overridden",[923,3204,986],{"class":933},[923,3206,1035],{"class":933},[923,3208,3209,3212,3214,3217],{"class":925,"line":1094},[923,3210,3211],{"class":1003},"  cause",[923,3213,1007],{"class":933},[923,3215,3216],{"class":937}," stripeErr",[923,3218,1091],{"class":933},[923,3220,3221,3223],{"class":925,"line":1145},[923,3222,1154],{"class":933},[923,3224,1157],{"class":937},[923,3226,3227],{"class":925,"line":1151},[923,3228,961],{"emptyLinePlaceholder":960},[923,3230,3231],{"class":925,"line":1498},[923,3232,3233],{"class":2296},"\u002F\u002F Resulting EvlogError:\n",[923,3235,3236],{"class":925,"line":1512},[923,3237,3238],{"class":2296},"\u002F\u002F - message: 'Custom message for this specific call' (override)\n",[923,3240,3241],{"class":925,"line":1525},[923,3242,3243],{"class":2296},"\u002F\u002F - status: 402 (catalog default)\n",[923,3245,3246],{"class":925,"line":1538},[923,3247,3248],{"class":2296},"\u002F\u002F - why: 'Issuer declined the charge' (catalog default)\n",[923,3250,3251],{"class":925,"line":1544},[923,3252,3253],{"class":2296},"\u002F\u002F - internal: { category: 'gateway-overridden', stripeRef: 'ch_x' }\n",[770,3255,3257],{"id":3256},"type-augmentation-deep-dive","Type augmentation: deep dive",[587,3259,3260,3261,3263,3264,594,3266,3268,3269,3272,3273,3276],{},"The opt-in ",[591,3262,718],{}," block is what surfaces autocomplete on ",[591,3265,697],{},[591,3267,700],{},", and the typed ",[591,3270,3271],{},"ErrorCode"," \u002F ",[591,3274,3275],{},"AuditAction"," exports.",[894,3278,3280],{"id":3279},"where-to-put-the-augmentation","Where to put the augmentation",[778,3282,3283,3293],{},[781,3284,3285],{},[784,3286,3287,3290],{},[787,3288,3289],{},"Repo shape",[787,3291,3292],{},"Recommended location",[796,3294,3295,3305,3319,3332],{},[784,3296,3297,3302],{},[801,3298,3299,3300,654],{},"Single file (",[591,3301,917],{},[801,3303,3304],{},"At the bottom of the same file",[784,3306,3307,3313],{},[801,3308,3309,3310,654],{},"Folder (",[591,3311,3312],{},"src\u002Ferrors\u002F*.ts",[801,3314,3315,3316,3318],{},"In ",[591,3317,1338],{}," (centralised) or each catalog file (decentralised)",[784,3320,3321,3324],{},[801,3322,3323],{},"npm package",[801,3325,3326,3327,3329,3330],{},"At the bottom of the package's main ",[591,3328,722],{}," so it ships in the published ",[591,3331,726],{},[784,3333,3334,3337],{},[801,3335,3336],{},"Monorepo",[801,3338,3339],{},"One augmentation per package, no central registry needed",[587,3341,3342,3343,3345],{},"Both centralised and decentralised work, because TypeScript merges multiple ",[591,3344,718],{}," blocks across files automatically.",[894,3347,3349],{"id":3348},"how-to-add-custom-domains","How to add custom domains",[587,3351,3352],{},"Each augmentation key is the namespace name. Multiple catalogs sharing a prefix can either be merged into one key or split:",[913,3354,3357],{"className":915,"code":3355,"filename":3356,"language":918,"meta":919,"style":919},"declare module 'evlog' {\n  interface RegisteredErrorCatalogs {\n    billing: typeof billingErrors\n  }\n}\n","Centralised — one key per package",[591,3358,3359,3373,3381,3391,3395],{"__ignoreMap":919},[923,3360,3361,3363,3365,3367,3369,3371],{"class":925,"line":926},[923,3362,1474],{"class":970},[923,3364,1477],{"class":970},[923,3366,947],{"class":933},[923,3368,951],{"class":950},[923,3370,986],{"class":933},[923,3372,997],{"class":933},[923,3374,3375,3377,3379],{"class":925,"line":957},[923,3376,1490],{"class":970},[923,3378,1493],{"class":1118},[923,3380,997],{"class":933},[923,3382,3383,3385,3387,3389],{"class":925,"line":964},[923,3384,1515],{"class":1003},[923,3386,1007],{"class":933},[923,3388,1506],{"class":933},[923,3390,1522],{"class":937},[923,3392,3393],{"class":925,"line":1000},[923,3394,1541],{"class":933},[923,3396,3397],{"class":925,"line":1038},[923,3398,1547],{"class":933},[913,3400,3403],{"className":915,"code":3401,"filename":3402,"language":918,"meta":919,"style":919},"declare module 'evlog' {\n  interface RegisteredErrorCatalogs {\n    'billing.payment': typeof billingPaymentErrors\n    'billing.subscription': typeof billingSubscriptionErrors\n    'billing.invoice': typeof billingInvoiceErrors\n  }\n}\n","Decentralised — one key per sub-domain",[591,3404,3405,3419,3427,3443,3458,3474,3478],{"__ignoreMap":919},[923,3406,3407,3409,3411,3413,3415,3417],{"class":925,"line":926},[923,3408,1474],{"class":970},[923,3410,1477],{"class":970},[923,3412,947],{"class":933},[923,3414,951],{"class":950},[923,3416,986],{"class":933},[923,3418,997],{"class":933},[923,3420,3421,3423,3425],{"class":925,"line":957},[923,3422,1490],{"class":970},[923,3424,1493],{"class":1118},[923,3426,997],{"class":933},[923,3428,3429,3432,3434,3436,3438,3440],{"class":925,"line":964},[923,3430,3431],{"class":933},"    '",[923,3433,711],{"class":950},[923,3435,986],{"class":933},[923,3437,1007],{"class":933},[923,3439,1506],{"class":933},[923,3441,3442],{"class":937}," billingPaymentErrors\n",[923,3444,3445,3447,3449,3451,3453,3455],{"class":925,"line":1000},[923,3446,3431],{"class":933},[923,3448,1569],{"class":950},[923,3450,986],{"class":933},[923,3452,1007],{"class":933},[923,3454,1506],{"class":933},[923,3456,3457],{"class":937}," billingSubscriptionErrors\n",[923,3459,3460,3462,3465,3467,3469,3471],{"class":925,"line":1038},[923,3461,3431],{"class":933},[923,3463,3464],{"class":950},"billing.invoice",[923,3466,986],{"class":933},[923,3468,1007],{"class":933},[923,3470,1506],{"class":933},[923,3472,3473],{"class":937}," billingInvoiceErrors\n",[923,3475,3476],{"class":925,"line":1070},[923,3477,1541],{"class":933},[923,3479,3480],{"class":925,"line":1080},[923,3481,1547],{"class":933},[587,3483,2356,3484,3487,3488,3490],{},[591,3485,3486],{},"_codes"," literal union is what produces the actual ",[591,3489,3271],{}," type. The keys themselves are arbitrary, choose what feels right for your structure.",[894,3492,3494],{"id":3493},"verifying-the-augmentation","Verifying the augmentation",[913,3496,3499],{"className":915,"code":3497,"filename":3498,"language":918,"meta":919,"style":919},"import type { ErrorCode, AuditAction } from 'evlog'\n\n\u002F\u002F Hover the type in your IDE — should show the union of all registered codes.\ntype AllErrorCodes = ErrorCode\ntype AllAuditActions = AuditAction\n\n\u002F\u002F Compile-time check:\nconst validCode: ErrorCode = 'billing.PAYMENT_DECLINED' \u002F\u002F OK\nconst invalidCode: ErrorCode = 'billing.NOPE' \u002F\u002F ← TS error if catalog is registered\n","Anywhere in the codebase",[591,3500,3501,3527,3531,3536,3549,3561,3565,3570,3592],{"__ignoreMap":919},[923,3502,3503,3505,3507,3509,3512,3514,3517,3519,3521,3523,3525],{"class":925,"line":926},[923,3504,930],{"class":929},[923,3506,1347],{"class":929},[923,3508,934],{"class":933},[923,3510,3511],{"class":937}," ErrorCode",[923,3513,994],{"class":933},[923,3515,3516],{"class":937}," AuditAction",[923,3518,941],{"class":933},[923,3520,944],{"class":929},[923,3522,947],{"class":933},[923,3524,951],{"class":950},[923,3526,954],{"class":933},[923,3528,3529],{"class":925,"line":957},[923,3530,961],{"emptyLinePlaceholder":960},[923,3532,3533],{"class":925,"line":964},[923,3534,3535],{"class":2296},"\u002F\u002F Hover the type in your IDE — should show the union of all registered codes.\n",[923,3537,3538,3540,3543,3546],{"class":925,"line":1000},[923,3539,1871],{"class":970},[923,3541,3542],{"class":1118}," AllErrorCodes",[923,3544,3545],{"class":933}," =",[923,3547,3548],{"class":1118}," ErrorCode\n",[923,3550,3551,3553,3556,3558],{"class":925,"line":1038},[923,3552,1871],{"class":970},[923,3554,3555],{"class":1118}," AllAuditActions",[923,3557,3545],{"class":933},[923,3559,3560],{"class":1118}," AuditAction\n",[923,3562,3563],{"class":925,"line":1070},[923,3564,961],{"emptyLinePlaceholder":960},[923,3566,3567],{"class":925,"line":1080},[923,3568,3569],{"class":2296},"\u002F\u002F Compile-time check:\n",[923,3571,3572,3574,3577,3579,3581,3583,3585,3587,3589],{"class":925,"line":1094},[923,3573,2602],{"class":970},[923,3575,3576],{"class":937}," validCode",[923,3578,1007],{"class":933},[923,3580,3511],{"class":1118},[923,3582,3545],{"class":933},[923,3584,947],{"class":933},[923,3586,650],{"class":950},[923,3588,986],{"class":933},[923,3590,3591],{"class":2296}," \u002F\u002F OK\n",[923,3593,3594,3596,3599,3601,3603,3605,3607,3610,3612],{"class":925,"line":1145},[923,3595,2602],{"class":970},[923,3597,3598],{"class":937}," invalidCode",[923,3600,1007],{"class":933},[923,3602,3511],{"class":1118},[923,3604,3545],{"class":933},[923,3606,947],{"class":933},[923,3608,3609],{"class":950},"billing.NOPE",[923,3611,986],{"class":933},[923,3613,3614],{"class":2296}," \u002F\u002F ← TS error if catalog is registered\n",[587,3616,3617,3618,3621],{},"If autocomplete is empty, either no catalog is registered yet, or the augmentation file is not in the TypeScript program (check ",[591,3619,3620],{},"tsconfig.json"," includes).",[770,3623,3625],{"id":3624},"common-pitfalls","Common pitfalls",[3627,3628,3629,3635,3636,3638,3639,1783],"warning",{},[804,3630,3631,3632,3634],{},"Don't put ",[591,3633,745],{}," blocks in test files."," Augmentations from test files leak into the type-checker for the rest of the codebase if the test files are included in the main ",[591,3637,3620],{},". Keep augmentations next to the catalog source, never inside ",[591,3640,3641],{},"*.test.ts",[3627,3643,3644,3647,3648,3651,3652,3654],{},[804,3645,3646],{},"Avoid prefix collisions across packages."," If two packages augment the same ",[591,3649,3650],{},"RegisteredErrorCatalogs"," key (say both ship a ",[591,3653,2111],{}," catalog), TypeScript merges them silently and the runtime keeps the last-registered factory. Convention: one prefix per package, no overlap.",[3627,3656,3657,3663,3664,3667,3668,3670],{},[804,3658,3659,3660,3662],{},"Never override the ",[591,3661,591],{}," at the call site."," The catalog defines the code identity, and overriding it would break dashboards, alerts, and consumer code branching on ",[591,3665,3666],{},"err.code",". The factory's call-site signature deliberately omits ",[591,3669,591],{}," from the overridable fields.",[757,3672,3673,3682],{},[587,3674,3675,3681],{},[804,3676,3677,3678,3680],{},"Prefer ",[591,3679,732],{}," over string comparisons in tests."," Both forms below are valid; the first survives renames (refactor-safe), the second doesn't.",[913,3683,3685],{"className":915,"code":3684,"language":918,"meta":919,"style":919},"expect(err.code).toBe(billingErrors.PAYMENT_DECLINED.code) \u002F\u002F ✓ refactor-safe\nexpect(err.code).toBe('billing.PAYMENT_DECLINED')          \u002F\u002F ✗ string literal\n",[591,3686,3687,3720],{"__ignoreMap":919},[923,3688,3689,3692,3695,3697,3700,3702,3705,3708,3710,3712,3714,3717],{"class":925,"line":926},[923,3690,3691],{"class":980},"expect",[923,3693,3694],{"class":937},"(err",[923,3696,1783],{"class":933},[923,3698,3699],{"class":937},"code)",[923,3701,1783],{"class":933},[923,3703,3704],{"class":980},"toBe",[923,3706,3707],{"class":937},"(billingErrors",[923,3709,1783],{"class":933},[923,3711,817],{"class":937},[923,3713,1783],{"class":933},[923,3715,3716],{"class":937},"code) ",[923,3718,3719],{"class":2296},"\u002F\u002F ✓ refactor-safe\n",[923,3721,3722,3724,3726,3728,3730,3732,3734,3736,3738,3740,3742,3745],{"class":925,"line":957},[923,3723,3691],{"class":980},[923,3725,3694],{"class":937},[923,3727,1783],{"class":933},[923,3729,3699],{"class":937},[923,3731,1783],{"class":933},[923,3733,3704],{"class":980},[923,3735,983],{"class":937},[923,3737,986],{"class":933},[923,3739,650],{"class":950},[923,3741,986],{"class":933},[923,3743,3744],{"class":937},")          ",[923,3746,3747],{"class":2296},"\u002F\u002F ✗ string literal\n",[770,3749,3751],{"id":3750},"api-reference","API reference",[778,3753,3754,3767],{},[781,3755,3756],{},[784,3757,3758,3761,3764],{},[787,3759,3760],{},"Symbol",[787,3762,3763],{},"Kind",[787,3765,3766],{},"Purpose",[796,3768,3769,3781,3792,3803,3832,3848,3862,3874,3886,3897],{},[784,3770,3771,3775,3778],{},[801,3772,3773],{},[591,3774,635],{},[801,3776,3777],{},"factory",[801,3779,3780],{},"Standalone single-error factory. No prefix derivation.",[784,3782,3783,3787,3789],{},[801,3784,3785],{},[591,3786,625],{},[801,3788,3777],{},[801,3790,3791],{},"Bundle of typed errors sharing a prefix.",[784,3793,3794,3798,3800],{},[801,3795,3796],{},[591,3797,639],{},[801,3799,3777],{},[801,3801,3802],{},"Standalone single-action audit factory.",[784,3804,3805,3809,3811],{},[801,3806,3807],{},[591,3808,629],{},[801,3810,3777],{},[801,3812,3813,3814,594,3817,594,3820,594,3823,594,3826,594,3829,1783],{},"Bundle of typed audit actions sharing a prefix. Each entry accepts ",[591,3815,3816],{},"target",[591,3818,3819],{},"description",[591,3821,3822],{},"severity",[591,3824,3825],{},"requiresChanges",[591,3827,3828],{},"requiresReason",[591,3830,3831],{},"redactPaths",[784,3833,3834,3839,3841],{},[801,3835,3836],{},[591,3837,3838],{},"AuditCatalogEntry",[801,3840,1871],{},[801,3842,3843,3844,3847],{},"Metadata shape for a single catalog entry (alias of ",[591,3845,3846],{},"AuditActionDefinition",").",[784,3849,3850,3855,3857],{},[801,3851,3852],{},[591,3853,3854],{},"AuditSeverity",[801,3856,1871],{},[801,3858,3859,1783],{},[591,3860,3861],{},"'low' | 'medium' | 'high' | 'critical'",[784,3863,3864,3868,3871],{},[801,3865,3866],{},[591,3867,3650],{},[801,3869,3870],{},"interface",[801,3872,3873],{},"Augmentable registry of error catalogs.",[784,3875,3876,3881,3883],{},[801,3877,3878],{},[591,3879,3880],{},"RegisteredAuditCatalogs",[801,3882,3870],{},[801,3884,3885],{},"Augmentable registry of audit catalogs.",[784,3887,3888,3892,3894],{},[801,3889,3890],{},[591,3891,3271],{},[801,3893,1871],{},[801,3895,3896],{},"Union of all registered error codes.",[784,3898,3899,3903,3905],{},[801,3900,3901],{},[591,3902,3275],{},[801,3904,1871],{},[801,3906,3907],{},"Union of all registered audit actions.",[587,3909,3910,3911,3913],{},"Everything ships from the main ",[591,3912,951],{}," entrypoint.",[770,3915,3917],{"id":3916},"next-steps","Next Steps",[617,3919,3920,3933,3946],{},[620,3921,3922,3924,3925,3928,3929,3932],{},[751,3923,56],{"href":57},": The full ",[591,3926,3927],{},"createError"," API and ",[591,3930,3931],{},"parseError"," reference.",[620,3934,3935,3938,3939,594,3942,3945],{},[751,3936,3937],{"href":402},"Audit → Recording",": All audit-emission APIs (",[591,3940,3941],{},"log.audit",[591,3943,3944],{},"withAudit",", etc.).",[620,3947,3948,3950],{},[751,3949,231],{"href":236},": Auto-managed per-request loggers and HTTP error serialization.",[3952,3953,3954],"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 .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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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 .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 .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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}",{"title":919,"searchDepth":957,"depth":957,"links":3956},[3957,3958,3964,3969,3974,3979,3980,3981],{"id":772,"depth":957,"text":773},{"id":888,"depth":957,"text":889,"children":3959},[3960,3961,3962,3963],{"id":896,"depth":964,"text":897},{"id":1311,"depth":964,"text":1312},{"id":1560,"depth":964,"text":1561},{"id":1772,"depth":964,"text":1773},{"id":1792,"depth":957,"text":1793,"children":3965},[3966,3967,3968],{"id":1805,"depth":964,"text":1808},{"id":2062,"depth":964,"text":2063},{"id":2369,"depth":964,"text":2370},{"id":2671,"depth":957,"text":2672,"children":3970},[3971,3972,3973],{"id":2675,"depth":964,"text":2676},{"id":2917,"depth":964,"text":2918},{"id":3091,"depth":964,"text":3092},{"id":3256,"depth":957,"text":3257,"children":3975},[3976,3977,3978],{"id":3279,"depth":964,"text":3280},{"id":3348,"depth":964,"text":3349},{"id":3493,"depth":964,"text":3494},{"id":3624,"depth":957,"text":3625},{"id":3750,"depth":957,"text":3751},{"id":3916,"depth":957,"text":3917},"Scale typed error and audit catalogs from one file to a monorepo: conventions, an npm packaging recipe, and type augmentation.","md",[3985,3987],{"label":56,"icon":59,"to":57,"color":2652,"variant":3986},"subtle",{"label":387,"icon":388,"to":393,"color":2652,"variant":3986},{},{"icon":84},{"title":81,"description":3982},"b3wuujYTVgowF6vhj6t_2NlJkSotkA_uTdr7qxS9WY4",[3993,3995],{"title":76,"path":77,"stem":78,"description":3994,"icon":79,"children":-1},"Add compile-time type safety to your wide events with TypeScript module augmentation. Prevent typos and ensure consistent field names across your codebase.",{"title":41,"path":91,"stem":92,"description":3996,"icon":49,"children":-1},"Use the evlog CLI to check logging patterns in supported source files, diagnose your setup, and control telemetry. Includes flags and exit codes.",1789074366127]