[{"data":1,"prerenderedAt":5740},["ShallowReactive",2],{"navigation_docs":3,"-docs-recipes-ddd-aggregate":493,"-docs-recipes-ddd-aggregate-surround":5735},[4,46,135,218,257,292,355,377,420],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":45},"Getting Started","i-lucide-rocket","\u002Fdocs\u002Fgetting-started","docs\u002F01.getting-started",[10,15,20,25,30,35,40],{"title":11,"path":12,"stem":13,"icon":14},"What is Heximon?","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F01.getting-started\u002F01.introduction","i-lucide-info",{"title":16,"path":17,"stem":18,"icon":19},"Installation","\u002Fdocs\u002Fgetting-started\u002Finstallation","docs\u002F01.getting-started\u002F02.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F01.getting-started\u002F03.quick-start","i-lucide-zap",{"title":26,"path":27,"stem":28,"icon":29},"Core Concepts","\u002Fdocs\u002Fgetting-started\u002Fcore-concepts","docs\u002F01.getting-started\u002F04.core-concepts","i-lucide-shapes",{"title":31,"path":32,"stem":33,"icon":34},"Examples","\u002Fdocs\u002Fgetting-started\u002Fexamples","docs\u002F01.getting-started\u002F05.examples","i-lucide-library",{"title":36,"path":37,"stem":38,"icon":39},"Where Next?","\u002Fdocs\u002Fgetting-started\u002Fwhere-next","docs\u002F01.getting-started\u002F06.where-next","i-lucide-signpost",{"title":41,"path":42,"stem":43,"icon":44},"Troubleshooting","\u002Fdocs\u002Fgetting-started\u002Ftroubleshooting","docs\u002F01.getting-started\u002F07.troubleshooting","i-lucide-life-buoy",false,{"title":47,"icon":48,"path":49,"stem":50,"children":51,"page":45},"Essentials","i-lucide-boxes","\u002Fdocs\u002Fessentials","docs\u002F02.essentials",[52,56,61,66,71,76,81,86,91,96,101,105,110,115,120,125,130],{"title":53,"path":54,"stem":55,"icon":48},"Modules & DI","\u002Fdocs\u002Fessentials\u002Fmodules-and-di","docs\u002F02.essentials\u002F01.modules-and-di",{"title":57,"path":58,"stem":59,"icon":60},"Controllers","\u002Fdocs\u002Fessentials\u002Fcontrollers","docs\u002F02.essentials\u002F02.controllers","i-lucide-route",{"title":62,"path":63,"stem":64,"icon":65},"Validation & DTOs","\u002Fdocs\u002Fessentials\u002Fvalidation","docs\u002F02.essentials\u002F03.validation","i-lucide-shield-check",{"title":67,"path":68,"stem":69,"icon":70},"Contracts","\u002Fdocs\u002Fessentials\u002Fcontracts","docs\u002F02.essentials\u002F04.contracts","i-lucide-file-signature",{"title":72,"path":73,"stem":74,"icon":75},"REST Client","\u002Fdocs\u002Fessentials\u002Fclient","docs\u002F02.essentials\u002F05.client","i-lucide-plug",{"title":77,"path":78,"stem":79,"icon":80},"Database","\u002Fdocs\u002Fessentials\u002Fdatabase","docs\u002F02.essentials\u002F06.database","i-lucide-database",{"title":82,"path":83,"stem":84,"icon":85},"Drizzle ORM","\u002Fdocs\u002Fessentials\u002Fdrizzle","docs\u002F02.essentials\u002F07.drizzle","i-lucide-database-zap",{"title":87,"path":88,"stem":89,"icon":90},"Persistence & Transactions","\u002Fdocs\u002Fessentials\u002Fpersistence","docs\u002F02.essentials\u002F08.persistence","i-lucide-database-backup",{"title":92,"path":93,"stem":94,"icon":95},"Migrations","\u002Fdocs\u002Fessentials\u002Fmigrations","docs\u002F02.essentials\u002F09.migrations","i-lucide-git-branch",{"title":97,"path":98,"stem":99,"icon":100},"Authentication","\u002Fdocs\u002Fessentials\u002Fauthentication","docs\u002F02.essentials\u002F10.authentication","i-lucide-key-round",{"title":102,"path":103,"stem":104,"icon":65},"Permissions & scopes","\u002Fdocs\u002Fessentials\u002Fpermissions","docs\u002F02.essentials\u002F11.permissions",{"title":106,"path":107,"stem":108,"icon":109},"Error Handling","\u002Fdocs\u002Fessentials\u002Ferrors","docs\u002F02.essentials\u002F12.errors","i-lucide-triangle-alert",{"title":111,"path":112,"stem":113,"icon":114},"Testing a Heximon App","\u002Fdocs\u002Fessentials\u002Ftesting","docs\u002F02.essentials\u002F13.testing","i-lucide-flask-conical",{"title":116,"path":117,"stem":118,"icon":119},"Test app harness","\u002Fdocs\u002Fessentials\u002Fcreatetestapp","docs\u002F02.essentials\u002F14.createtestapp","i-lucide-test-tube",{"title":121,"path":122,"stem":123,"icon":124},"Logging & Observability","\u002Fdocs\u002Fessentials\u002Flogging","docs\u002F02.essentials\u002F17.logging","i-lucide-scroll-text",{"title":126,"path":127,"stem":128,"icon":129},"Context & Lifecycle","\u002Fdocs\u002Fessentials\u002Fcontext-and-lifecycle","docs\u002F02.essentials\u002F18.context-and-lifecycle","i-lucide-radio",{"title":131,"path":132,"stem":133,"icon":134},"Project Structure","\u002Fdocs\u002Fessentials\u002Fproject-structure","docs\u002F02.essentials\u002F19.project-structure","i-lucide-folder-tree",{"title":136,"icon":137,"path":138,"stem":139,"children":140,"page":45},"Capabilities","i-lucide-sparkles","\u002Fdocs\u002Fcapabilities","docs\u002F03.capabilities",[141,145,150,155,160,164,169,174,179,184,188,193,198,203,208,213],{"title":142,"path":143,"stem":144,"icon":137},"Overview","\u002Fdocs\u002Fcapabilities\u002Foverview","docs\u002F03.capabilities\u002F01.overview",{"title":146,"path":147,"stem":148,"icon":149},"Events","\u002Fdocs\u002Fcapabilities\u002Fevents","docs\u002F03.capabilities\u002F02.events","i-lucide-radio-tower",{"title":151,"path":152,"stem":153,"icon":154},"Queue","\u002Fdocs\u002Fcapabilities\u002Fbackground-jobs","docs\u002F03.capabilities\u002F03.background-jobs","i-lucide-list-ordered",{"title":156,"path":157,"stem":158,"icon":159},"Scheduled Work","\u002Fdocs\u002Fcapabilities\u002Fscheduled-jobs","docs\u002F03.capabilities\u002F04.scheduled-jobs","i-lucide-clock",{"title":161,"path":162,"stem":163,"icon":85},"Caching","\u002Fdocs\u002Fcapabilities\u002Fcaching","docs\u002F03.capabilities\u002F05.caching",{"title":165,"path":166,"stem":167,"icon":168},"Key\u002FValue Storage","\u002Fdocs\u002Fcapabilities\u002Fkey-value","docs\u002F03.capabilities\u002F06.key-value","i-lucide-hard-drive",{"title":170,"path":171,"stem":172,"icon":173},"Blob Storage","\u002Fdocs\u002Fcapabilities\u002Fblob","docs\u002F03.capabilities\u002F07.blob","i-lucide-folder-open",{"title":175,"path":176,"stem":177,"icon":178},"Health & Readiness","\u002Fdocs\u002Fcapabilities\u002Fhealth","docs\u002F03.capabilities\u002F08.health","i-lucide-heart-pulse",{"title":180,"path":181,"stem":182,"icon":183},"Notifications","\u002Fdocs\u002Fcapabilities\u002Fnotifications","docs\u002F03.capabilities\u002F09.notifications","i-lucide-mail",{"title":185,"path":186,"stem":187,"icon":65},"Idempotency","\u002Fdocs\u002Fcapabilities\u002Fidempotency","docs\u002F03.capabilities\u002F10.idempotency",{"title":189,"path":190,"stem":191,"icon":192},"Security Hardening","\u002Fdocs\u002Fcapabilities\u002Fsecurity","docs\u002F03.capabilities\u002F11.security","i-lucide-shield",{"title":194,"path":195,"stem":196,"icon":197},"Observability & Tracing","\u002Fdocs\u002Fcapabilities\u002Fobservability","docs\u002F03.capabilities\u002F12.observability","i-lucide-activity",{"title":199,"path":200,"stem":201,"icon":202},"OpenAPI","\u002Fdocs\u002Fcapabilities\u002Fopenapi","docs\u002F03.capabilities\u002F13.openapi","i-lucide-book-marked",{"title":204,"path":205,"stem":206,"icon":207},"MCP Server","\u002Fdocs\u002Fcapabilities\u002Fmcp","docs\u002F03.capabilities\u002F14.mcp","i-lucide-bot",{"title":209,"path":210,"stem":211,"icon":212},"Schema DTOs","\u002Fdocs\u002Fcapabilities\u002Fschema","docs\u002F03.capabilities\u002F15.schema","i-lucide-file-json",{"title":214,"path":215,"stem":216,"icon":217},"Branded IDs","\u002Fdocs\u002Fcapabilities\u002Fbranded-ids","docs\u002F03.capabilities\u002F16.branded-ids","i-lucide-tag",{"title":219,"icon":220,"path":221,"stem":222,"children":223,"page":45},"Architecture","i-lucide-building","\u002Fdocs\u002Farchitecture","docs\u002F04.architecture",[224,227,232,237,242,247,252],{"title":142,"path":225,"stem":226,"icon":220},"\u002Fdocs\u002Farchitecture\u002Foverview","docs\u002F04.architecture\u002F01.overview",{"title":228,"path":229,"stem":230,"icon":231},"Domain-Driven Design","\u002Fdocs\u002Farchitecture\u002Fddd","docs\u002F04.architecture\u002F02.ddd","i-lucide-hexagon",{"title":233,"path":234,"stem":235,"icon":236},"CQRS","\u002Fdocs\u002Farchitecture\u002Fcqrs","docs\u002F04.architecture\u002F03.cqrs","i-lucide-split",{"title":238,"path":239,"stem":240,"icon":241},"Repository Pattern","\u002Fdocs\u002Farchitecture\u002Frepository-pattern","docs\u002F04.architecture\u002F04.repository-pattern","i-lucide-archive",{"title":243,"path":244,"stem":245,"icon":246},"Integration Events","\u002Fdocs\u002Farchitecture\u002Fintegration-events","docs\u002F04.architecture\u002F05.integration-events","i-lucide-send-horizontal",{"title":248,"path":249,"stem":250,"icon":251},"Saga Orchestration","\u002Fdocs\u002Farchitecture\u002Fsagas","docs\u002F04.architecture\u002F06.sagas","i-lucide-hourglass",{"title":253,"path":254,"stem":255,"icon":256},"Durable Workflows","\u002Fdocs\u002Farchitecture\u002Fworkflows","docs\u002F04.architecture\u002F07.workflows","i-lucide-workflow",{"title":258,"icon":259,"path":260,"stem":261,"children":262,"page":45},"Realtime","i-lucide-cable","\u002Fdocs\u002Frealtime","docs\u002F05.realtime",[263,266,270,274,279,284,288],{"title":142,"path":264,"stem":265,"icon":259},"\u002Fdocs\u002Frealtime\u002Foverview","docs\u002F05.realtime\u002F01.overview",{"title":267,"path":268,"stem":269,"icon":129},"WebSockets","\u002Fdocs\u002Frealtime\u002Fwebsockets","docs\u002F05.realtime\u002F02.websockets",{"title":271,"path":272,"stem":273,"icon":70},"WebSocket Contracts","\u002Fdocs\u002Frealtime\u002Fwebsocket-contracts","docs\u002F05.realtime\u002F03.websocket-contracts",{"title":275,"path":276,"stem":277,"icon":278},"Server-Sent Events","\u002Fdocs\u002Frealtime\u002Fserver-sent-events","docs\u002F05.realtime\u002F04.server-sent-events","i-lucide-rss",{"title":280,"path":281,"stem":282,"icon":283},"Typed Clients","\u002Fdocs\u002Frealtime\u002Ftyped-clients","docs\u002F05.realtime\u002F05.typed-clients","i-lucide-plug-zap",{"title":285,"path":286,"stem":287,"icon":259},"AsyncAPI","\u002Fdocs\u002Frealtime\u002Fasyncapi","docs\u002F05.realtime\u002F06.asyncapi",{"title":289,"path":290,"stem":291,"icon":80},"Durable Objects","\u002Fdocs\u002Frealtime\u002Fdurable-objects","docs\u002F05.realtime\u002F07.durable-objects",{"title":293,"icon":294,"path":295,"stem":296,"children":297,"page":45},"Deploy","i-lucide-cloud-upload","\u002Fdocs\u002Fdeploy","docs\u002F06.deploy",[298,301,306,311,316,321,326,331,336,341,345,350],{"title":142,"path":299,"stem":300,"icon":6},"\u002Fdocs\u002Fdeploy\u002Foverview","docs\u002F06.deploy\u002F01.overview",{"title":302,"path":303,"stem":304,"icon":305},"Node","\u002Fdocs\u002Fdeploy\u002Fnode","docs\u002F06.deploy\u002F02.node","la:node-js",{"title":307,"path":308,"stem":309,"icon":310},"Cloudflare","\u002Fdocs\u002Fdeploy\u002Fcloudflare","docs\u002F06.deploy\u002F03.cloudflare","simple-icons:cloudflare",{"title":312,"path":313,"stem":314,"icon":315},"Vercel","\u002Fdocs\u002Fdeploy\u002Fvercel","docs\u002F06.deploy\u002F04.vercel","ri:vercel-fill",{"title":317,"path":318,"stem":319,"icon":320},"Netlify","\u002Fdocs\u002Fdeploy\u002Fnetlify","docs\u002F06.deploy\u002F05.netlify","i-simple-icons-netlify",{"title":322,"path":323,"stem":324,"icon":325},"AWS Lambda","\u002Fdocs\u002Fdeploy\u002Faws-lambda","docs\u002F06.deploy\u002F06.aws-lambda","hugeicons:aws-lambda",{"title":327,"path":328,"stem":329,"icon":330},"Deno Deploy","\u002Fdocs\u002Fdeploy\u002Fdeno-deploy","docs\u002F06.deploy\u002F07.deno-deploy","simple-icons:denodeploy",{"title":332,"path":333,"stem":334,"icon":335},"Nitro","\u002Fdocs\u002Fdeploy\u002Fnitro","docs\u002F06.deploy\u002F08.nitro","i-unjs-nitro",{"title":337,"path":338,"stem":339,"icon":340},"Nuxt","\u002Fdocs\u002Fdeploy\u002Fnuxt","docs\u002F06.deploy\u002F09.nuxt","i-devicon-nuxt",{"title":342,"path":343,"stem":344,"icon":236},"Mixed-runtime split","\u002Fdocs\u002Fdeploy\u002Fmixed-runtime-split","docs\u002F06.deploy\u002F10.mixed-runtime-split",{"title":346,"path":347,"stem":348,"icon":349},"Hosts","\u002Fdocs\u002Fdeploy\u002Fhosts","docs\u002F06.deploy\u002F11.hosts","i-lucide-map",{"title":351,"path":352,"stem":353,"icon":354},"Cross-service events","\u002Fdocs\u002Fdeploy\u002Fcross-service-events","docs\u002F06.deploy\u002F12.cross-service-events","i-lucide-network",{"title":356,"icon":357,"path":358,"stem":359,"children":360,"page":45},"CLI","i-lucide-terminal","\u002Fdocs\u002Fcli","docs\u002F07.cli",[361,365,369,373],{"title":362,"path":363,"stem":364,"icon":357},"The heximon CLI","\u002Fdocs\u002Fcli\u002Foverview","docs\u002F07.cli\u002F01.overview",{"title":366,"path":367,"stem":368,"icon":137},"Create a New App","\u002Fdocs\u002Fcli\u002Fcreate","docs\u002F07.cli\u002F02.create",{"title":370,"path":371,"stem":372,"icon":95},"Migrations from the CLI","\u002Fdocs\u002Fcli\u002Fmigrations","docs\u002F07.cli\u002F03.migrations",{"title":374,"path":375,"stem":376,"icon":6},"Deploying a Heximon app","\u002Fdocs\u002Fcli\u002Fdeploy","docs\u002F07.cli\u002F04.deploy",{"title":378,"icon":379,"path":380,"stem":381,"children":382,"page":45},"Under the Hood","i-lucide-wrench","\u002Fdocs\u002Funder-the-hood","docs\u002F08.under-the-hood",[383,388,393,397,402,407,411,415],{"title":384,"path":385,"stem":386,"icon":387},"How the Compiler Works","\u002Fdocs\u002Funder-the-hood\u002Fhow-the-compiler-works","docs\u002F08.under-the-hood\u002F01.how-the-compiler-works","i-lucide-cog",{"title":389,"path":390,"stem":391,"icon":392},"Compiler","\u002Fdocs\u002Funder-the-hood\u002Fextending-the-compiler","docs\u002F08.under-the-hood\u002F02.extending-the-compiler","i-lucide-cpu",{"title":394,"path":395,"stem":396,"icon":357},"Compiler Diagnostics","\u002Fdocs\u002Funder-the-hood\u002Fcompiler-diagnostics","docs\u002F08.under-the-hood\u002F03.compiler-diagnostics",{"title":398,"path":399,"stem":400,"icon":401},"Library Mode","\u002Fdocs\u002Funder-the-hood\u002Flibrary-mode","docs\u002F08.under-the-hood\u002F04.library-mode","i-lucide-package",{"title":403,"path":404,"stem":405,"icon":406},"Other bundlers","\u002Fdocs\u002Funder-the-hood\u002Falternate-bundlers","docs\u002F08.under-the-hood\u002F05.alternate-bundlers","i-lucide-blocks",{"title":408,"path":409,"stem":410,"icon":401},"Packages","\u002Fdocs\u002Funder-the-hood\u002Fpackages","docs\u002F08.under-the-hood\u002F06.packages",{"title":412,"path":413,"stem":414,"icon":207},"AI Skills","\u002Fdocs\u002Funder-the-hood\u002Fai-and-agents","docs\u002F08.under-the-hood\u002F07.ai-and-agents",{"title":416,"path":417,"stem":418,"icon":419},"Advanced DI","\u002Fdocs\u002Funder-the-hood\u002Fadvanced-di","docs\u002F08.under-the-hood\u002F08.advanced-di","i-lucide-git-fork",{"title":421,"icon":422,"path":423,"stem":424,"children":425,"page":45},"Recipes","i-lucide-book-open-check","\u002Fdocs\u002Frecipes","docs\u002F09.recipes",[426,431,436,440,444,448,452,456,460,465,469,474,479,484,488],{"title":427,"path":428,"stem":429,"icon":430},"Send an Email","\u002Fdocs\u002Frecipes\u002Fsend-an-email","docs\u002F09.recipes\u002F01.send-an-email","i-lucide-send",{"title":432,"path":433,"stem":434,"icon":435},"Upload a File","\u002Fdocs\u002Frecipes\u002Fupload-a-file","docs\u002F09.recipes\u002F02.upload-a-file","i-lucide-upload",{"title":437,"path":438,"stem":439,"icon":24},"Cache an Expensive Call","\u002Fdocs\u002Frecipes\u002Fcache-an-expensive-call","docs\u002F09.recipes\u002F03.cache-an-expensive-call",{"title":441,"path":442,"stem":443,"icon":154},"Paginate a List","\u002Fdocs\u002Frecipes\u002Fpaginate-a-list","docs\u002F09.recipes\u002F04.paginate-a-list",{"title":445,"path":446,"stem":447,"icon":65},"Protect Admin Routes","\u002Fdocs\u002Frecipes\u002Fprotect-admin-routes","docs\u002F09.recipes\u002F05.protect-admin-routes",{"title":449,"path":450,"stem":451,"icon":178},"Health Probes and a Nightly Job","\u002Fdocs\u002Frecipes\u002Fhealth-probes-and-a-nightly-job","docs\u002F09.recipes\u002F06.health-probes-and-a-nightly-job",{"title":453,"path":454,"stem":455,"icon":80},"Build a CRUD API","\u002Fdocs\u002Frecipes\u002Fcrud-api","docs\u002F09.recipes\u002F07.crud-api",{"title":457,"path":458,"stem":459,"icon":100},"Add Authentication","\u002Fdocs\u002Frecipes\u002Fadd-authentication","docs\u002F09.recipes\u002F08.add-authentication",{"title":461,"path":462,"stem":463,"icon":464},"Background Jobs","\u002Fdocs\u002Frecipes\u002Fbackground-jobs","docs\u002F09.recipes\u002F09.background-jobs","i-lucide-timer",{"title":466,"path":467,"stem":468,"icon":149},"Decouple Features with Events","\u002Fdocs\u002Frecipes\u002Fevent-driven-module","docs\u002F09.recipes\u002F10.event-driven-module",{"title":470,"path":471,"stem":472,"icon":473},"Build a DDD Aggregate","\u002Fdocs\u002Frecipes\u002Fddd-aggregate","docs\u002F09.recipes\u002F11.ddd-aggregate","i-lucide-box",{"title":475,"path":476,"stem":477,"icon":478},"Publish a Feature Package","\u002Fdocs\u002Frecipes\u002Ffeature-package","docs\u002F09.recipes\u002F12.feature-package","i-lucide-package-open",{"title":480,"path":481,"stem":482,"icon":483},"Reliable Integration Events","\u002Fdocs\u002Frecipes\u002Freliable-integration-events","docs\u002F09.recipes\u002F13.reliable-integration-events","i-lucide-inbox",{"title":485,"path":486,"stem":487,"icon":95},"Reactive Choreography","\u002Fdocs\u002Frecipes\u002Freactive-choreography","docs\u002F09.recipes\u002F14.reactive-choreography",{"title":489,"path":490,"stem":491,"icon":492},"Build a Production CRUD API","\u002Fdocs\u002Frecipes\u002Fproduction-crud-api","docs\u002F09.recipes\u002F15.production-crud-api","i-lucide-layers",{"id":494,"title":470,"body":495,"description":5728,"extension":5729,"links":5730,"meta":5731,"navigation":5732,"path":471,"seo":5733,"stem":472,"__hash__":5734},"docs\u002Fdocs\u002F09.recipes\u002F11.ddd-aggregate.md",{"type":496,"value":497,"toc":5714},"minimark",[498,507,526,531,550,641,700,704,738,1426,1459,1927,1946,1950,1956,2150,2153,2157,2184,3152,3169,3349,3353,3363,3574,3581,3585,3600,4598,4607,4611,4632,4823,4827,4845,4987,5127,5241,5244,5248,5261,5378,5392,5396,5457,5598,5602,5663,5667,5710],[499,500,501,502,506],"p",{},"You have a business rule that has to hold no matter who calls it — an order can't ship empty, and can't\nship twice. Scatter that check across controllers and you'll eventually miss a path. A domain-driven\naggregate makes the rule a property of the data: the only way to mutate an ",[503,504,505],"code",{},"Order"," is through methods that\nenforce the invariant, so an invalid order can't exist.",[499,508,509,510,512,513,517,518,521,522,525],{},"This recipe builds that ",[503,511,505],{}," end to end — branded ids, value objects, invariants, recorded domain\nevents — then reacts to the shipment from a ",[514,515,516],"strong",{},"separate context"," that never imports the orders module. You\nend with a ",[503,519,520],{},"POST \u002Forders\u002F:id\u002Fship"," that fans an ",[503,523,524],{},"OrderShippedDomainEvent"," out to a shipping read model,\ncoupled only through the event shape.",[527,528,530],"h2",{"id":529},"brand-the-identifiers","Brand the identifiers",[499,532,533,534,537,538,541,542,545,546,549],{},"A ",[503,535,536],{},"Branded\u003Cstring, \"OrderId\">"," is a plain ",[503,539,540],{},"string"," at runtime but a distinct type at compile time, so you\ncan never pass a ",[503,543,544],{},"ProductId"," where an ",[503,547,548],{},"OrderId"," is expected — at zero runtime cost.",[551,552,558],"pre",{"className":553,"code":554,"filename":555,"language":556,"meta":557,"style":557},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import type { Branded } from \"@heximon\u002Fprimitives\";\n\nexport type ProductId = Branded\u003Cstring, \"ProductId\">;\n","src\u002Forders\u002Forder-item.value.ts","ts","",[503,559,560,599,606],{"__ignoreMap":557},[561,562,565,569,572,576,580,583,586,589,593,596],"span",{"class":563,"line":564},"line",1,[561,566,568],{"class":567},"s7zQu","import",[561,570,571],{"class":567}," type",[561,573,575],{"class":574},"sMK4o"," {",[561,577,579],{"class":578},"sTEyZ"," Branded",[561,581,582],{"class":574}," }",[561,584,585],{"class":567}," from",[561,587,588],{"class":574}," \"",[561,590,592],{"class":591},"sfazB","@heximon\u002Fprimitives",[561,594,595],{"class":574},"\"",[561,597,598],{"class":574},";\n",[561,600,602],{"class":563,"line":601},2,[561,603,605],{"emptyLinePlaceholder":604},true,"\n",[561,607,609,612,615,619,622,624,627,629,632,634,636,638],{"class":563,"line":608},3,[561,610,611],{"class":567},"export",[561,613,571],{"class":614},"spNyl",[561,616,618],{"class":617},"sBMFI"," ProductId",[561,620,621],{"class":574}," =",[561,623,579],{"class":617},[561,625,626],{"class":574},"\u003C",[561,628,540],{"class":617},[561,630,631],{"class":574},",",[561,633,588],{"class":574},[561,635,544],{"class":591},[561,637,595],{"class":574},[561,639,640],{"class":574},">;\n",[551,642,645],{"className":553,"code":643,"filename":644,"language":556,"meta":557,"style":557},"import type { Branded } from \"@heximon\u002Fprimitives\";\n\nexport type OrderId = Branded\u003Cstring, \"OrderId\">;\n","src\u002Forders\u002Forder.entity.ts",[503,646,647,669,673],{"__ignoreMap":557},[561,648,649,651,653,655,657,659,661,663,665,667],{"class":563,"line":564},[561,650,568],{"class":567},[561,652,571],{"class":567},[561,654,575],{"class":574},[561,656,579],{"class":578},[561,658,582],{"class":574},[561,660,585],{"class":567},[561,662,588],{"class":574},[561,664,592],{"class":591},[561,666,595],{"class":574},[561,668,598],{"class":574},[561,670,671],{"class":563,"line":601},[561,672,605],{"emptyLinePlaceholder":604},[561,674,675,677,679,682,684,686,688,690,692,694,696,698],{"class":563,"line":608},[561,676,611],{"class":567},[561,678,571],{"class":614},[561,680,681],{"class":617}," OrderId",[561,683,621],{"class":574},[561,685,579],{"class":617},[561,687,626],{"class":574},[561,689,540],{"class":617},[561,691,631],{"class":574},[561,693,588],{"class":574},[561,695,548],{"class":591},[561,697,595],{"class":574},[561,699,640],{"class":574},[527,701,703],{"id":702},"model-the-value-objects","Model the value objects",[499,705,533,706,709,710,713,714,718,719,722,723,726,727,730,731,734,735,737],{},[514,707,708],{},"value object"," has no identity — it's compared by value, so two ",[503,711,712],{},"Money"," instances with the same amount\nand currency ",[715,716,717],"em",{},"are"," the same money. ",[503,720,721],{},"ValueObject\u003CMoneyValue>"," freezes the wrapped value and gives you\nstructural ",[503,724,725],{},"equals"," and ",[503,728,729],{},"toJSON","; the ",[503,732,733],{},"create"," factory holds the construction invariant, so a malformed\n",[503,736,712],{}," can never be built.",[551,739,742],{"className":553,"code":740,"filename":741,"language":556,"meta":557,"style":557},"import { ValueObject } from \"@heximon\u002Fdomain\";\n\ninterface MoneyValue {\n  readonly amountCents: number;\n  readonly currency: string;\n}\n\nexport class Money extends ValueObject\u003CMoneyValue> {\n  private static readonly currencyPattern = \u002F^[A-Z]{3}$\u002F;\n\n  public static create(amountCents: number, currency: string): Money {\n    if (!Number.isInteger(amountCents) || amountCents \u003C 0) {\n      throw new RangeError(`Invalid money amount: ${amountCents} (expected a non-negative integer)`);\n    }\n    if (!Money.currencyPattern.test(currency)) {\n      throw new TypeError(`Invalid currency: ${currency} (expected an ISO-4217 code like \"EUR\")`);\n    }\n    return new Money({ amountCents, currency });\n  }\n\n  public get amountCents(): number {\n    return this.getInternalValue().amountCents;\n  }\n\n  public get currency(): string {\n    return this.getInternalValue().currency;\n  }\n\n  public add(other: Money): Money {\n    if (other.currency !== this.currency) {\n      throw new TypeError(`Currency mismatch: ${this.currency} + ${other.currency}`);\n    }\n    return Money.create(this.amountCents + other.amountCents, this.currency);\n  }\n\n  public multiply(factor: number): Money {\n    return Money.create(this.amountCents * factor, this.currency);\n  }\n}\n","src\u002Forders\u002Fmoney.value.ts",[503,743,744,766,770,781,799,814,820,825,851,891,896,933,979,1017,1023,1054,1086,1091,1118,1124,1129,1146,1166,1171,1176,1191,1208,1213,1218,1241,1265,1308,1313,1350,1355,1360,1383,1416,1421],{"__ignoreMap":557},[561,745,746,748,750,753,755,757,759,762,764],{"class":563,"line":564},[561,747,568],{"class":567},[561,749,575],{"class":574},[561,751,752],{"class":578}," ValueObject",[561,754,582],{"class":574},[561,756,585],{"class":567},[561,758,588],{"class":574},[561,760,761],{"class":591},"@heximon\u002Fdomain",[561,763,595],{"class":574},[561,765,598],{"class":574},[561,767,768],{"class":563,"line":601},[561,769,605],{"emptyLinePlaceholder":604},[561,771,772,775,778],{"class":563,"line":608},[561,773,774],{"class":614},"interface",[561,776,777],{"class":617}," MoneyValue",[561,779,780],{"class":574}," {\n",[561,782,784,787,791,794,797],{"class":563,"line":783},4,[561,785,786],{"class":614},"  readonly",[561,788,790],{"class":789},"swJcz"," amountCents",[561,792,793],{"class":574},":",[561,795,796],{"class":617}," number",[561,798,598],{"class":574},[561,800,802,804,807,809,812],{"class":563,"line":801},5,[561,803,786],{"class":614},[561,805,806],{"class":789}," currency",[561,808,793],{"class":574},[561,810,811],{"class":617}," string",[561,813,598],{"class":574},[561,815,817],{"class":563,"line":816},6,[561,818,819],{"class":574},"}\n",[561,821,823],{"class":563,"line":822},7,[561,824,605],{"emptyLinePlaceholder":604},[561,826,828,830,833,836,839,841,843,846,849],{"class":563,"line":827},8,[561,829,611],{"class":567},[561,831,832],{"class":614}," class",[561,834,835],{"class":617}," Money",[561,837,838],{"class":614}," extends",[561,840,752],{"class":617},[561,842,626],{"class":574},[561,844,845],{"class":617},"MoneyValue",[561,847,848],{"class":574},">",[561,850,780],{"class":574},[561,852,854,857,860,863,866,868,871,874,877,880,883,886,889],{"class":563,"line":853},9,[561,855,856],{"class":614},"  private",[561,858,859],{"class":614}," static",[561,861,862],{"class":614}," readonly",[561,864,865],{"class":789}," currencyPattern",[561,867,621],{"class":574},[561,869,870],{"class":574}," \u002F",[561,872,873],{"class":567},"^",[561,875,876],{"class":574},"[",[561,878,879],{"class":591},"A-Z",[561,881,882],{"class":574},"]{3}",[561,884,885],{"class":567},"$",[561,887,888],{"class":574},"\u002F",[561,890,598],{"class":574},[561,892,894],{"class":563,"line":893},10,[561,895,605],{"emptyLinePlaceholder":604},[561,897,899,902,904,907,910,914,916,918,920,922,924,926,929,931],{"class":563,"line":898},11,[561,900,901],{"class":614},"  public",[561,903,859],{"class":614},[561,905,906],{"class":789}," create",[561,908,909],{"class":574},"(",[561,911,913],{"class":912},"sHdIc","amountCents",[561,915,793],{"class":574},[561,917,796],{"class":617},[561,919,631],{"class":574},[561,921,806],{"class":912},[561,923,793],{"class":574},[561,925,811],{"class":617},[561,927,928],{"class":574},"):",[561,930,835],{"class":617},[561,932,780],{"class":574},[561,934,936,939,942,945,948,951,955,957,959,962,965,967,970,974,976],{"class":563,"line":935},12,[561,937,938],{"class":567},"    if",[561,940,941],{"class":789}," (",[561,943,944],{"class":574},"!",[561,946,947],{"class":578},"Number",[561,949,950],{"class":574},".",[561,952,954],{"class":953},"s2Zo4","isInteger",[561,956,909],{"class":789},[561,958,913],{"class":578},[561,960,961],{"class":789},") ",[561,963,964],{"class":574},"||",[561,966,790],{"class":578},[561,968,969],{"class":574}," \u003C",[561,971,973],{"class":972},"sbssI"," 0",[561,975,961],{"class":789},[561,977,978],{"class":574},"{\n",[561,980,982,985,988,991,993,996,999,1002,1004,1007,1010,1012,1015],{"class":563,"line":981},13,[561,983,984],{"class":567},"      throw",[561,986,987],{"class":574}," new",[561,989,990],{"class":953}," RangeError",[561,992,909],{"class":789},[561,994,995],{"class":574},"`",[561,997,998],{"class":591},"Invalid money amount: ",[561,1000,1001],{"class":574},"${",[561,1003,913],{"class":578},[561,1005,1006],{"class":574},"}",[561,1008,1009],{"class":591}," (expected a non-negative integer)",[561,1011,995],{"class":574},[561,1013,1014],{"class":789},")",[561,1016,598],{"class":574},[561,1018,1020],{"class":563,"line":1019},14,[561,1021,1022],{"class":574},"    }\n",[561,1024,1026,1028,1030,1032,1034,1036,1039,1041,1044,1046,1049,1052],{"class":563,"line":1025},15,[561,1027,938],{"class":567},[561,1029,941],{"class":789},[561,1031,944],{"class":574},[561,1033,712],{"class":578},[561,1035,950],{"class":574},[561,1037,1038],{"class":578},"currencyPattern",[561,1040,950],{"class":574},[561,1042,1043],{"class":953},"test",[561,1045,909],{"class":789},[561,1047,1048],{"class":578},"currency",[561,1050,1051],{"class":789},")) ",[561,1053,978],{"class":574},[561,1055,1057,1059,1061,1064,1066,1068,1071,1073,1075,1077,1080,1082,1084],{"class":563,"line":1056},16,[561,1058,984],{"class":567},[561,1060,987],{"class":574},[561,1062,1063],{"class":953}," TypeError",[561,1065,909],{"class":789},[561,1067,995],{"class":574},[561,1069,1070],{"class":591},"Invalid currency: ",[561,1072,1001],{"class":574},[561,1074,1048],{"class":578},[561,1076,1006],{"class":574},[561,1078,1079],{"class":591}," (expected an ISO-4217 code like \"EUR\")",[561,1081,995],{"class":574},[561,1083,1014],{"class":789},[561,1085,598],{"class":574},[561,1087,1089],{"class":563,"line":1088},17,[561,1090,1022],{"class":574},[561,1092,1094,1097,1099,1101,1103,1106,1108,1110,1112,1114,1116],{"class":563,"line":1093},18,[561,1095,1096],{"class":567},"    return",[561,1098,987],{"class":574},[561,1100,835],{"class":953},[561,1102,909],{"class":789},[561,1104,1105],{"class":574},"{",[561,1107,790],{"class":578},[561,1109,631],{"class":574},[561,1111,806],{"class":578},[561,1113,582],{"class":574},[561,1115,1014],{"class":789},[561,1117,598],{"class":574},[561,1119,1121],{"class":563,"line":1120},19,[561,1122,1123],{"class":574},"  }\n",[561,1125,1127],{"class":563,"line":1126},20,[561,1128,605],{"emptyLinePlaceholder":604},[561,1130,1132,1134,1137,1139,1142,1144],{"class":563,"line":1131},21,[561,1133,901],{"class":614},[561,1135,1136],{"class":614}," get",[561,1138,790],{"class":789},[561,1140,1141],{"class":574},"():",[561,1143,796],{"class":617},[561,1145,780],{"class":574},[561,1147,1149,1151,1154,1157,1160,1162,1164],{"class":563,"line":1148},22,[561,1150,1096],{"class":567},[561,1152,1153],{"class":574}," this.",[561,1155,1156],{"class":953},"getInternalValue",[561,1158,1159],{"class":789},"()",[561,1161,950],{"class":574},[561,1163,913],{"class":578},[561,1165,598],{"class":574},[561,1167,1169],{"class":563,"line":1168},23,[561,1170,1123],{"class":574},[561,1172,1174],{"class":563,"line":1173},24,[561,1175,605],{"emptyLinePlaceholder":604},[561,1177,1179,1181,1183,1185,1187,1189],{"class":563,"line":1178},25,[561,1180,901],{"class":614},[561,1182,1136],{"class":614},[561,1184,806],{"class":789},[561,1186,1141],{"class":574},[561,1188,811],{"class":617},[561,1190,780],{"class":574},[561,1192,1194,1196,1198,1200,1202,1204,1206],{"class":563,"line":1193},26,[561,1195,1096],{"class":567},[561,1197,1153],{"class":574},[561,1199,1156],{"class":953},[561,1201,1159],{"class":789},[561,1203,950],{"class":574},[561,1205,1048],{"class":578},[561,1207,598],{"class":574},[561,1209,1211],{"class":563,"line":1210},27,[561,1212,1123],{"class":574},[561,1214,1216],{"class":563,"line":1215},28,[561,1217,605],{"emptyLinePlaceholder":604},[561,1219,1221,1223,1226,1228,1231,1233,1235,1237,1239],{"class":563,"line":1220},29,[561,1222,901],{"class":614},[561,1224,1225],{"class":789}," add",[561,1227,909],{"class":574},[561,1229,1230],{"class":912},"other",[561,1232,793],{"class":574},[561,1234,835],{"class":617},[561,1236,928],{"class":574},[561,1238,835],{"class":617},[561,1240,780],{"class":574},[561,1242,1244,1246,1248,1250,1252,1254,1257,1259,1261,1263],{"class":563,"line":1243},30,[561,1245,938],{"class":567},[561,1247,941],{"class":789},[561,1249,1230],{"class":578},[561,1251,950],{"class":574},[561,1253,1048],{"class":578},[561,1255,1256],{"class":574}," !==",[561,1258,1153],{"class":574},[561,1260,1048],{"class":578},[561,1262,961],{"class":789},[561,1264,978],{"class":574},[561,1266,1268,1270,1272,1274,1276,1278,1281,1283,1286,1288,1290,1293,1295,1297,1299,1301,1304,1306],{"class":563,"line":1267},31,[561,1269,984],{"class":567},[561,1271,987],{"class":574},[561,1273,1063],{"class":953},[561,1275,909],{"class":789},[561,1277,995],{"class":574},[561,1279,1280],{"class":591},"Currency mismatch: ",[561,1282,1001],{"class":574},[561,1284,1285],{"class":574},"this.",[561,1287,1048],{"class":578},[561,1289,1006],{"class":574},[561,1291,1292],{"class":591}," + ",[561,1294,1001],{"class":574},[561,1296,1230],{"class":578},[561,1298,950],{"class":574},[561,1300,1048],{"class":578},[561,1302,1303],{"class":574},"}`",[561,1305,1014],{"class":789},[561,1307,598],{"class":574},[561,1309,1311],{"class":563,"line":1310},32,[561,1312,1022],{"class":574},[561,1314,1316,1318,1320,1322,1324,1326,1328,1330,1333,1336,1338,1340,1342,1344,1346,1348],{"class":563,"line":1315},33,[561,1317,1096],{"class":567},[561,1319,835],{"class":578},[561,1321,950],{"class":574},[561,1323,733],{"class":953},[561,1325,909],{"class":789},[561,1327,1285],{"class":574},[561,1329,913],{"class":578},[561,1331,1332],{"class":574}," +",[561,1334,1335],{"class":578}," other",[561,1337,950],{"class":574},[561,1339,913],{"class":578},[561,1341,631],{"class":574},[561,1343,1153],{"class":574},[561,1345,1048],{"class":578},[561,1347,1014],{"class":789},[561,1349,598],{"class":574},[561,1351,1353],{"class":563,"line":1352},34,[561,1354,1123],{"class":574},[561,1356,1358],{"class":563,"line":1357},35,[561,1359,605],{"emptyLinePlaceholder":604},[561,1361,1363,1365,1368,1370,1373,1375,1377,1379,1381],{"class":563,"line":1362},36,[561,1364,901],{"class":614},[561,1366,1367],{"class":789}," multiply",[561,1369,909],{"class":574},[561,1371,1372],{"class":912},"factor",[561,1374,793],{"class":574},[561,1376,796],{"class":617},[561,1378,928],{"class":574},[561,1380,835],{"class":617},[561,1382,780],{"class":574},[561,1384,1386,1388,1390,1392,1394,1396,1398,1400,1403,1406,1408,1410,1412,1414],{"class":563,"line":1385},37,[561,1387,1096],{"class":567},[561,1389,835],{"class":578},[561,1391,950],{"class":574},[561,1393,733],{"class":953},[561,1395,909],{"class":789},[561,1397,1285],{"class":574},[561,1399,913],{"class":578},[561,1401,1402],{"class":574}," *",[561,1404,1405],{"class":578}," factor",[561,1407,631],{"class":574},[561,1409,1153],{"class":574},[561,1411,1048],{"class":578},[561,1413,1014],{"class":789},[561,1415,598],{"class":574},[561,1417,1419],{"class":563,"line":1418},38,[561,1420,1123],{"class":574},[561,1422,1424],{"class":563,"line":1423},39,[561,1425,819],{"class":574},[499,1427,1428,1429,1432,1433,1436,1437,1440,1441,1444,1445,1448,1449,1452,1453,1455,1456,1458],{},"Read the wrapped value through ",[503,1430,1431],{},"this.getInternalValue()",", never ",[503,1434,1435],{},"this.props"," — ",[503,1438,1439],{},"props"," is the ",[715,1442,1443],{},"entity","\nvocabulary, used below. An ",[503,1446,1447],{},"OrderItem"," ",[715,1450,1451],{},"nests"," a ",[503,1454,712],{}," unit price, and ",[503,1457,725],{}," recurses, so two items\ncompare structurally with no extra code.",[551,1460,1462],{"className":553,"code":1461,"filename":555,"language":556,"meta":557,"style":557},"import { ValueObject } from \"@heximon\u002Fdomain\";\nimport { Money } from \".\u002Fmoney.value\";\n\ninterface OrderItemValue {\n  readonly productId: ProductId;\n  readonly name: string;\n  readonly unitPrice: Money;\n  readonly quantity: number;\n}\n\nexport class OrderItem extends ValueObject\u003COrderItemValue> {\n  public static create(value: OrderItemValue): OrderItem {\n    if (!Number.isInteger(value.quantity) || value.quantity \u003C 1) {\n      throw new RangeError(`Invalid quantity: ${value.quantity} (expected a positive integer)`);\n    }\n    return new OrderItem(value);\n  }\n\n  public get productId(): ProductId {\n    return this.getInternalValue().productId;\n  }\n\n  public get name(): string {\n    return this.getInternalValue().name;\n  }\n\n  public get unitPrice(): Money {\n    return this.getInternalValue().unitPrice;\n  }\n\n  public get quantity(): number {\n    return this.getInternalValue().quantity;\n  }\n\n  public subtotal(): Money {\n    return this.unitPrice.multiply(this.quantity);\n  }\n}\n",[503,1463,1464,1484,1505,1509,1518,1531,1544,1557,1570,1574,1578,1600,1623,1666,1700,1704,1720,1724,1728,1742,1759,1763,1767,1781,1798,1802,1806,1820,1837,1841,1845,1859,1875,1879,1883,1896,1919,1923],{"__ignoreMap":557},[561,1465,1466,1468,1470,1472,1474,1476,1478,1480,1482],{"class":563,"line":564},[561,1467,568],{"class":567},[561,1469,575],{"class":574},[561,1471,752],{"class":578},[561,1473,582],{"class":574},[561,1475,585],{"class":567},[561,1477,588],{"class":574},[561,1479,761],{"class":591},[561,1481,595],{"class":574},[561,1483,598],{"class":574},[561,1485,1486,1488,1490,1492,1494,1496,1498,1501,1503],{"class":563,"line":601},[561,1487,568],{"class":567},[561,1489,575],{"class":574},[561,1491,835],{"class":578},[561,1493,582],{"class":574},[561,1495,585],{"class":567},[561,1497,588],{"class":574},[561,1499,1500],{"class":591},".\u002Fmoney.value",[561,1502,595],{"class":574},[561,1504,598],{"class":574},[561,1506,1507],{"class":563,"line":608},[561,1508,605],{"emptyLinePlaceholder":604},[561,1510,1511,1513,1516],{"class":563,"line":783},[561,1512,774],{"class":614},[561,1514,1515],{"class":617}," OrderItemValue",[561,1517,780],{"class":574},[561,1519,1520,1522,1525,1527,1529],{"class":563,"line":801},[561,1521,786],{"class":614},[561,1523,1524],{"class":789}," productId",[561,1526,793],{"class":574},[561,1528,618],{"class":617},[561,1530,598],{"class":574},[561,1532,1533,1535,1538,1540,1542],{"class":563,"line":816},[561,1534,786],{"class":614},[561,1536,1537],{"class":789}," name",[561,1539,793],{"class":574},[561,1541,811],{"class":617},[561,1543,598],{"class":574},[561,1545,1546,1548,1551,1553,1555],{"class":563,"line":822},[561,1547,786],{"class":614},[561,1549,1550],{"class":789}," unitPrice",[561,1552,793],{"class":574},[561,1554,835],{"class":617},[561,1556,598],{"class":574},[561,1558,1559,1561,1564,1566,1568],{"class":563,"line":827},[561,1560,786],{"class":614},[561,1562,1563],{"class":789}," quantity",[561,1565,793],{"class":574},[561,1567,796],{"class":617},[561,1569,598],{"class":574},[561,1571,1572],{"class":563,"line":853},[561,1573,819],{"class":574},[561,1575,1576],{"class":563,"line":893},[561,1577,605],{"emptyLinePlaceholder":604},[561,1579,1580,1582,1584,1587,1589,1591,1593,1596,1598],{"class":563,"line":898},[561,1581,611],{"class":567},[561,1583,832],{"class":614},[561,1585,1586],{"class":617}," OrderItem",[561,1588,838],{"class":614},[561,1590,752],{"class":617},[561,1592,626],{"class":574},[561,1594,1595],{"class":617},"OrderItemValue",[561,1597,848],{"class":574},[561,1599,780],{"class":574},[561,1601,1602,1604,1606,1608,1610,1613,1615,1617,1619,1621],{"class":563,"line":935},[561,1603,901],{"class":614},[561,1605,859],{"class":614},[561,1607,906],{"class":789},[561,1609,909],{"class":574},[561,1611,1612],{"class":912},"value",[561,1614,793],{"class":574},[561,1616,1515],{"class":617},[561,1618,928],{"class":574},[561,1620,1586],{"class":617},[561,1622,780],{"class":574},[561,1624,1625,1627,1629,1631,1633,1635,1637,1639,1641,1643,1646,1648,1650,1653,1655,1657,1659,1662,1664],{"class":563,"line":981},[561,1626,938],{"class":567},[561,1628,941],{"class":789},[561,1630,944],{"class":574},[561,1632,947],{"class":578},[561,1634,950],{"class":574},[561,1636,954],{"class":953},[561,1638,909],{"class":789},[561,1640,1612],{"class":578},[561,1642,950],{"class":574},[561,1644,1645],{"class":578},"quantity",[561,1647,961],{"class":789},[561,1649,964],{"class":574},[561,1651,1652],{"class":578}," value",[561,1654,950],{"class":574},[561,1656,1645],{"class":578},[561,1658,969],{"class":574},[561,1660,1661],{"class":972}," 1",[561,1663,961],{"class":789},[561,1665,978],{"class":574},[561,1667,1668,1670,1672,1674,1676,1678,1681,1683,1685,1687,1689,1691,1694,1696,1698],{"class":563,"line":1019},[561,1669,984],{"class":567},[561,1671,987],{"class":574},[561,1673,990],{"class":953},[561,1675,909],{"class":789},[561,1677,995],{"class":574},[561,1679,1680],{"class":591},"Invalid quantity: ",[561,1682,1001],{"class":574},[561,1684,1612],{"class":578},[561,1686,950],{"class":574},[561,1688,1645],{"class":578},[561,1690,1006],{"class":574},[561,1692,1693],{"class":591}," (expected a positive integer)",[561,1695,995],{"class":574},[561,1697,1014],{"class":789},[561,1699,598],{"class":574},[561,1701,1702],{"class":563,"line":1025},[561,1703,1022],{"class":574},[561,1705,1706,1708,1710,1712,1714,1716,1718],{"class":563,"line":1056},[561,1707,1096],{"class":567},[561,1709,987],{"class":574},[561,1711,1586],{"class":953},[561,1713,909],{"class":789},[561,1715,1612],{"class":578},[561,1717,1014],{"class":789},[561,1719,598],{"class":574},[561,1721,1722],{"class":563,"line":1088},[561,1723,1123],{"class":574},[561,1725,1726],{"class":563,"line":1093},[561,1727,605],{"emptyLinePlaceholder":604},[561,1729,1730,1732,1734,1736,1738,1740],{"class":563,"line":1120},[561,1731,901],{"class":614},[561,1733,1136],{"class":614},[561,1735,1524],{"class":789},[561,1737,1141],{"class":574},[561,1739,618],{"class":617},[561,1741,780],{"class":574},[561,1743,1744,1746,1748,1750,1752,1754,1757],{"class":563,"line":1126},[561,1745,1096],{"class":567},[561,1747,1153],{"class":574},[561,1749,1156],{"class":953},[561,1751,1159],{"class":789},[561,1753,950],{"class":574},[561,1755,1756],{"class":578},"productId",[561,1758,598],{"class":574},[561,1760,1761],{"class":563,"line":1131},[561,1762,1123],{"class":574},[561,1764,1765],{"class":563,"line":1148},[561,1766,605],{"emptyLinePlaceholder":604},[561,1768,1769,1771,1773,1775,1777,1779],{"class":563,"line":1168},[561,1770,901],{"class":614},[561,1772,1136],{"class":614},[561,1774,1537],{"class":789},[561,1776,1141],{"class":574},[561,1778,811],{"class":617},[561,1780,780],{"class":574},[561,1782,1783,1785,1787,1789,1791,1793,1796],{"class":563,"line":1173},[561,1784,1096],{"class":567},[561,1786,1153],{"class":574},[561,1788,1156],{"class":953},[561,1790,1159],{"class":789},[561,1792,950],{"class":574},[561,1794,1795],{"class":578},"name",[561,1797,598],{"class":574},[561,1799,1800],{"class":563,"line":1178},[561,1801,1123],{"class":574},[561,1803,1804],{"class":563,"line":1193},[561,1805,605],{"emptyLinePlaceholder":604},[561,1807,1808,1810,1812,1814,1816,1818],{"class":563,"line":1210},[561,1809,901],{"class":614},[561,1811,1136],{"class":614},[561,1813,1550],{"class":789},[561,1815,1141],{"class":574},[561,1817,835],{"class":617},[561,1819,780],{"class":574},[561,1821,1822,1824,1826,1828,1830,1832,1835],{"class":563,"line":1215},[561,1823,1096],{"class":567},[561,1825,1153],{"class":574},[561,1827,1156],{"class":953},[561,1829,1159],{"class":789},[561,1831,950],{"class":574},[561,1833,1834],{"class":578},"unitPrice",[561,1836,598],{"class":574},[561,1838,1839],{"class":563,"line":1220},[561,1840,1123],{"class":574},[561,1842,1843],{"class":563,"line":1243},[561,1844,605],{"emptyLinePlaceholder":604},[561,1846,1847,1849,1851,1853,1855,1857],{"class":563,"line":1267},[561,1848,901],{"class":614},[561,1850,1136],{"class":614},[561,1852,1563],{"class":789},[561,1854,1141],{"class":574},[561,1856,796],{"class":617},[561,1858,780],{"class":574},[561,1860,1861,1863,1865,1867,1869,1871,1873],{"class":563,"line":1310},[561,1862,1096],{"class":567},[561,1864,1153],{"class":574},[561,1866,1156],{"class":953},[561,1868,1159],{"class":789},[561,1870,950],{"class":574},[561,1872,1645],{"class":578},[561,1874,598],{"class":574},[561,1876,1877],{"class":563,"line":1315},[561,1878,1123],{"class":574},[561,1880,1881],{"class":563,"line":1352},[561,1882,605],{"emptyLinePlaceholder":604},[561,1884,1885,1887,1890,1892,1894],{"class":563,"line":1357},[561,1886,901],{"class":614},[561,1888,1889],{"class":789}," subtotal",[561,1891,1141],{"class":574},[561,1893,835],{"class":617},[561,1895,780],{"class":574},[561,1897,1898,1900,1902,1904,1906,1909,1911,1913,1915,1917],{"class":563,"line":1362},[561,1899,1096],{"class":567},[561,1901,1153],{"class":574},[561,1903,1834],{"class":578},[561,1905,950],{"class":574},[561,1907,1908],{"class":953},"multiply",[561,1910,909],{"class":789},[561,1912,1285],{"class":574},[561,1914,1645],{"class":578},[561,1916,1014],{"class":789},[561,1918,598],{"class":574},[561,1920,1921],{"class":563,"line":1385},[561,1922,1123],{"class":574},[561,1924,1925],{"class":563,"line":1418},[561,1926,819],{"class":574},[499,1928,1929,1930,1933,1934,1941,1942,1945],{},"A factory is one way to enforce the rule; a schema is another —\n",[503,1931,1932],{},"class BirthDate extends ValueObject(v.pipe(v.string(), v.isoDate())) {}"," runs a\n",[1935,1936,1940],"a",{"href":1937,"rel":1938},"https:\u002F\u002Fstandardschema.dev",[1939],"nofollow","Standard Schema"," on construction and renders a ",[503,1943,1944],{},"400"," on failure. Reach for it\nwhen the rule is a shape rather than logic; it must be synchronous, since construction can't await.",[527,1947,1949],{"id":1948},"declare-the-domain-events","Declare the domain events",[499,1951,533,1952,1955],{},[503,1953,1954],{},"DomainEvent"," is a plain class whose constructor parameters are its payload — no behavior, no dependency\non the bus, just a record of what happened. You record these as the aggregate mutates, then flush them\nafter saving.",[551,1957,1960],{"className":553,"code":1958,"filename":1959,"language":556,"meta":557,"style":557},"import { DomainEvent } from \"@heximon\u002Fdomain\";\nimport type { OrderId } from \"..\u002Forder.entity\";\n\nexport class OrderCreatedDomainEvent extends DomainEvent {\n  public constructor(public readonly orderId: OrderId) {\n    super();\n  }\n}\n\nexport class OrderShippedDomainEvent extends DomainEvent {\n  public constructor(\n    public readonly orderId: OrderId,\n    public readonly shippedAt: Date,\n  ) {\n    super();\n  }\n}\n","src\u002Forders\u002Fdomain-events\u002Forder.events.ts",[503,1961,1962,1983,2006,2010,2025,2050,2059,2063,2067,2071,2086,2095,2111,2127,2134,2142,2146],{"__ignoreMap":557},[561,1963,1964,1966,1968,1971,1973,1975,1977,1979,1981],{"class":563,"line":564},[561,1965,568],{"class":567},[561,1967,575],{"class":574},[561,1969,1970],{"class":578}," DomainEvent",[561,1972,582],{"class":574},[561,1974,585],{"class":567},[561,1976,588],{"class":574},[561,1978,761],{"class":591},[561,1980,595],{"class":574},[561,1982,598],{"class":574},[561,1984,1985,1987,1989,1991,1993,1995,1997,1999,2002,2004],{"class":563,"line":601},[561,1986,568],{"class":567},[561,1988,571],{"class":567},[561,1990,575],{"class":574},[561,1992,681],{"class":578},[561,1994,582],{"class":574},[561,1996,585],{"class":567},[561,1998,588],{"class":574},[561,2000,2001],{"class":591},"..\u002Forder.entity",[561,2003,595],{"class":574},[561,2005,598],{"class":574},[561,2007,2008],{"class":563,"line":608},[561,2009,605],{"emptyLinePlaceholder":604},[561,2011,2012,2014,2016,2019,2021,2023],{"class":563,"line":783},[561,2013,611],{"class":567},[561,2015,832],{"class":614},[561,2017,2018],{"class":617}," OrderCreatedDomainEvent",[561,2020,838],{"class":614},[561,2022,1970],{"class":617},[561,2024,780],{"class":574},[561,2026,2027,2029,2032,2034,2037,2039,2042,2044,2046,2048],{"class":563,"line":801},[561,2028,901],{"class":614},[561,2030,2031],{"class":614}," constructor",[561,2033,909],{"class":574},[561,2035,2036],{"class":614},"public",[561,2038,862],{"class":614},[561,2040,2041],{"class":912}," orderId",[561,2043,793],{"class":574},[561,2045,681],{"class":617},[561,2047,1014],{"class":574},[561,2049,780],{"class":574},[561,2051,2052,2055,2057],{"class":563,"line":816},[561,2053,2054],{"class":578},"    super",[561,2056,1159],{"class":789},[561,2058,598],{"class":574},[561,2060,2061],{"class":563,"line":822},[561,2062,1123],{"class":574},[561,2064,2065],{"class":563,"line":827},[561,2066,819],{"class":574},[561,2068,2069],{"class":563,"line":853},[561,2070,605],{"emptyLinePlaceholder":604},[561,2072,2073,2075,2077,2080,2082,2084],{"class":563,"line":893},[561,2074,611],{"class":567},[561,2076,832],{"class":614},[561,2078,2079],{"class":617}," OrderShippedDomainEvent",[561,2081,838],{"class":614},[561,2083,1970],{"class":617},[561,2085,780],{"class":574},[561,2087,2088,2090,2092],{"class":563,"line":898},[561,2089,901],{"class":614},[561,2091,2031],{"class":614},[561,2093,2094],{"class":574},"(\n",[561,2096,2097,2100,2102,2104,2106,2108],{"class":563,"line":935},[561,2098,2099],{"class":614},"    public",[561,2101,862],{"class":614},[561,2103,2041],{"class":912},[561,2105,793],{"class":574},[561,2107,681],{"class":617},[561,2109,2110],{"class":574},",\n",[561,2112,2113,2115,2117,2120,2122,2125],{"class":563,"line":981},[561,2114,2099],{"class":614},[561,2116,862],{"class":614},[561,2118,2119],{"class":912}," shippedAt",[561,2121,793],{"class":574},[561,2123,2124],{"class":617}," Date",[561,2126,2110],{"class":574},[561,2128,2129,2132],{"class":563,"line":1019},[561,2130,2131],{"class":574},"  )",[561,2133,780],{"class":574},[561,2135,2136,2138,2140],{"class":563,"line":1025},[561,2137,2054],{"class":578},[561,2139,1159],{"class":789},[561,2141,598],{"class":574},[561,2143,2144],{"class":563,"line":1056},[561,2145,1123],{"class":574},[561,2147,2148],{"class":563,"line":1088},[561,2149,819],{"class":574},[499,2151,2152],{},"There's no decorator and no manual registration — each event class gets a stable dispatch identity at\nbuild time, which is how a handler in another module finds it.",[527,2154,2156],{"id":2155},"build-the-aggregate-root","Build the aggregate root",[499,2158,2159,2160,2163,2164,2167,2168,2171,2172,2175,2176,2179,2180,2183],{},"The aggregate root is the consistency boundary: it owns its lines, enforces the invariants, and\n",[514,2161,2162],{},"records"," domain events as it changes. ",[503,2165,2166],{},"AggregateRoot"," is an ",[503,2169,2170],{},"Entity"," (carrying an ",[503,2173,2174],{},"id"," and a ",[503,2177,2178],{},"version",")\nthat also buffers events — ",[503,2181,2182],{},"addDomainEvent(...)"," stashes one for a caller to drain later. It never touches\nthe event bus, which keeps recording a testable side effect of a mutation, not a hidden one.",[551,2185,2187],{"className":553,"code":2186,"filename":644,"language":556,"meta":557,"style":557},"import { AggregateRoot } from \"@heximon\u002Fdomain\";\nimport { OrderCreatedDomainEvent, OrderShippedDomainEvent } from \".\u002Fdomain-events\u002Forder.events\";\nimport { Money } from \".\u002Fmoney.value\";\nimport { CannotShipEmptyOrderError, CannotShipTwiceError } from \".\u002Forder-errors\";\nimport { OrderItem } from \".\u002Forder-item.value\";\n\nexport const OrderStatus = { Draft: \"Draft\", Shipped: \"Shipped\" } as const;\nexport type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];\n\ninterface OrderProps extends Record\u003Cstring, unknown> {\n  items: OrderItem[];\n  status: OrderStatus;\n  shippedAt: Date | undefined;\n}\n\nexport class Order extends AggregateRoot\u003COrderProps, OrderId> {\n  public static create(id: OrderId, items: OrderItem[]): Order {\n    const order = new Order(id, { items: [...items], status: OrderStatus.Draft, shippedAt: undefined });\n    order.addDomainEvent(new OrderCreatedDomainEvent(id)); \u002F\u002F buffered, flushed after save\n    return order;\n  }\n\n  public get items(): OrderItem[] {\n    return [...this.props.items]; \u002F\u002F defensive copy — callers can't mutate the aggregate's array\n  }\n\n  public get status(): OrderStatus {\n    return this.props.status;\n  }\n\n  public get shippedAt(): Date | undefined {\n    return this.props.shippedAt;\n  }\n\n  public hasShipped(): boolean {\n    return this.props.status === OrderStatus.Shipped;\n  }\n\n  public total(): Money {\n    const [first, ...rest] = this.props.items;\n    if (!first) {\n      throw new CannotShipEmptyOrderError();\n    }\n    return rest.reduce((sum, item) => sum.add(item.subtotal()), first.subtotal());\n  }\n\n  public ship(): void {\n    if (this.hasShipped()) {\n      throw new CannotShipTwiceError(); \u002F\u002F invariant: ship once\n    }\n    if (this.props.items.length === 0) {\n      throw new CannotShipEmptyOrderError(); \u002F\u002F invariant: never ship empty\n    }\n\n    this.props.status = OrderStatus.Shipped;\n    this.props.shippedAt = new Date();\n    this.addDomainEvent(new OrderShippedDomainEvent(this.id, this.props.shippedAt));\n  }\n}\n",[503,2188,2189,2210,2235,2255,2282,2303,2307,2357,2387,2391,2416,2430,2441,2458,2462,2466,2492,2525,2590,2621,2629,2633,2637,2654,2676,2680,2684,2698,2713,2717,2721,2739,2754,2758,2762,2776,2799,2803,2807,2820,2852,2867,2880,2885,2949,2954,2959,2974,2991,3007,3012,3040,3056,3061,3066,3088,3109,3142,3147],{"__ignoreMap":557},[561,2190,2191,2193,2195,2198,2200,2202,2204,2206,2208],{"class":563,"line":564},[561,2192,568],{"class":567},[561,2194,575],{"class":574},[561,2196,2197],{"class":578}," AggregateRoot",[561,2199,582],{"class":574},[561,2201,585],{"class":567},[561,2203,588],{"class":574},[561,2205,761],{"class":591},[561,2207,595],{"class":574},[561,2209,598],{"class":574},[561,2211,2212,2214,2216,2218,2220,2222,2224,2226,2228,2231,2233],{"class":563,"line":601},[561,2213,568],{"class":567},[561,2215,575],{"class":574},[561,2217,2018],{"class":578},[561,2219,631],{"class":574},[561,2221,2079],{"class":578},[561,2223,582],{"class":574},[561,2225,585],{"class":567},[561,2227,588],{"class":574},[561,2229,2230],{"class":591},".\u002Fdomain-events\u002Forder.events",[561,2232,595],{"class":574},[561,2234,598],{"class":574},[561,2236,2237,2239,2241,2243,2245,2247,2249,2251,2253],{"class":563,"line":608},[561,2238,568],{"class":567},[561,2240,575],{"class":574},[561,2242,835],{"class":578},[561,2244,582],{"class":574},[561,2246,585],{"class":567},[561,2248,588],{"class":574},[561,2250,1500],{"class":591},[561,2252,595],{"class":574},[561,2254,598],{"class":574},[561,2256,2257,2259,2261,2264,2266,2269,2271,2273,2275,2278,2280],{"class":563,"line":783},[561,2258,568],{"class":567},[561,2260,575],{"class":574},[561,2262,2263],{"class":578}," CannotShipEmptyOrderError",[561,2265,631],{"class":574},[561,2267,2268],{"class":578}," CannotShipTwiceError",[561,2270,582],{"class":574},[561,2272,585],{"class":567},[561,2274,588],{"class":574},[561,2276,2277],{"class":591},".\u002Forder-errors",[561,2279,595],{"class":574},[561,2281,598],{"class":574},[561,2283,2284,2286,2288,2290,2292,2294,2296,2299,2301],{"class":563,"line":801},[561,2285,568],{"class":567},[561,2287,575],{"class":574},[561,2289,1586],{"class":578},[561,2291,582],{"class":574},[561,2293,585],{"class":567},[561,2295,588],{"class":574},[561,2297,2298],{"class":591},".\u002Forder-item.value",[561,2300,595],{"class":574},[561,2302,598],{"class":574},[561,2304,2305],{"class":563,"line":816},[561,2306,605],{"emptyLinePlaceholder":604},[561,2308,2309,2311,2314,2317,2320,2322,2325,2327,2329,2332,2334,2336,2339,2341,2343,2346,2348,2350,2353,2355],{"class":563,"line":822},[561,2310,611],{"class":567},[561,2312,2313],{"class":614}," const",[561,2315,2316],{"class":578}," OrderStatus ",[561,2318,2319],{"class":574},"=",[561,2321,575],{"class":574},[561,2323,2324],{"class":789}," Draft",[561,2326,793],{"class":574},[561,2328,588],{"class":574},[561,2330,2331],{"class":591},"Draft",[561,2333,595],{"class":574},[561,2335,631],{"class":574},[561,2337,2338],{"class":789}," Shipped",[561,2340,793],{"class":574},[561,2342,588],{"class":574},[561,2344,2345],{"class":591},"Shipped",[561,2347,595],{"class":574},[561,2349,582],{"class":574},[561,2351,2352],{"class":567}," as",[561,2354,2313],{"class":614},[561,2356,598],{"class":574},[561,2358,2359,2361,2363,2366,2368,2370,2373,2376,2379,2382,2385],{"class":563,"line":827},[561,2360,611],{"class":567},[561,2362,571],{"class":614},[561,2364,2365],{"class":617}," OrderStatus",[561,2367,621],{"class":574},[561,2369,941],{"class":578},[561,2371,2372],{"class":574},"typeof",[561,2374,2375],{"class":578}," OrderStatus)[",[561,2377,2378],{"class":574},"keyof",[561,2380,2381],{"class":574}," typeof",[561,2383,2384],{"class":578}," OrderStatus]",[561,2386,598],{"class":574},[561,2388,2389],{"class":563,"line":853},[561,2390,605],{"emptyLinePlaceholder":604},[561,2392,2393,2395,2398,2400,2403,2405,2407,2409,2412,2414],{"class":563,"line":893},[561,2394,774],{"class":614},[561,2396,2397],{"class":617}," OrderProps",[561,2399,838],{"class":614},[561,2401,2402],{"class":617}," Record",[561,2404,626],{"class":574},[561,2406,540],{"class":617},[561,2408,631],{"class":574},[561,2410,2411],{"class":617}," unknown",[561,2413,848],{"class":574},[561,2415,780],{"class":574},[561,2417,2418,2421,2423,2425,2428],{"class":563,"line":898},[561,2419,2420],{"class":789},"  items",[561,2422,793],{"class":574},[561,2424,1586],{"class":617},[561,2426,2427],{"class":578},"[]",[561,2429,598],{"class":574},[561,2431,2432,2435,2437,2439],{"class":563,"line":935},[561,2433,2434],{"class":789},"  status",[561,2436,793],{"class":574},[561,2438,2365],{"class":617},[561,2440,598],{"class":574},[561,2442,2443,2446,2448,2450,2453,2456],{"class":563,"line":981},[561,2444,2445],{"class":789},"  shippedAt",[561,2447,793],{"class":574},[561,2449,2124],{"class":617},[561,2451,2452],{"class":574}," |",[561,2454,2455],{"class":617}," undefined",[561,2457,598],{"class":574},[561,2459,2460],{"class":563,"line":1019},[561,2461,819],{"class":574},[561,2463,2464],{"class":563,"line":1025},[561,2465,605],{"emptyLinePlaceholder":604},[561,2467,2468,2470,2472,2475,2477,2479,2481,2484,2486,2488,2490],{"class":563,"line":1056},[561,2469,611],{"class":567},[561,2471,832],{"class":614},[561,2473,2474],{"class":617}," Order",[561,2476,838],{"class":614},[561,2478,2197],{"class":617},[561,2480,626],{"class":574},[561,2482,2483],{"class":617},"OrderProps",[561,2485,631],{"class":574},[561,2487,681],{"class":617},[561,2489,848],{"class":574},[561,2491,780],{"class":574},[561,2493,2494,2496,2498,2500,2502,2504,2506,2508,2510,2513,2515,2517,2519,2521,2523],{"class":563,"line":1088},[561,2495,901],{"class":614},[561,2497,859],{"class":614},[561,2499,906],{"class":789},[561,2501,909],{"class":574},[561,2503,2174],{"class":912},[561,2505,793],{"class":574},[561,2507,681],{"class":617},[561,2509,631],{"class":574},[561,2511,2512],{"class":912}," items",[561,2514,793],{"class":574},[561,2516,1586],{"class":617},[561,2518,2427],{"class":578},[561,2520,928],{"class":574},[561,2522,2474],{"class":617},[561,2524,780],{"class":574},[561,2526,2527,2530,2533,2535,2537,2539,2541,2543,2545,2547,2549,2551,2554,2557,2560,2563,2565,2568,2570,2572,2574,2576,2578,2580,2582,2584,2586,2588],{"class":563,"line":1093},[561,2528,2529],{"class":614},"    const",[561,2531,2532],{"class":578}," order",[561,2534,621],{"class":574},[561,2536,987],{"class":574},[561,2538,2474],{"class":953},[561,2540,909],{"class":789},[561,2542,2174],{"class":578},[561,2544,631],{"class":574},[561,2546,575],{"class":574},[561,2548,2512],{"class":789},[561,2550,793],{"class":574},[561,2552,2553],{"class":789}," [",[561,2555,2556],{"class":574},"...",[561,2558,2559],{"class":578},"items",[561,2561,2562],{"class":789},"]",[561,2564,631],{"class":574},[561,2566,2567],{"class":789}," status",[561,2569,793],{"class":574},[561,2571,2365],{"class":578},[561,2573,950],{"class":574},[561,2575,2331],{"class":578},[561,2577,631],{"class":574},[561,2579,2119],{"class":789},[561,2581,793],{"class":574},[561,2583,2455],{"class":574},[561,2585,582],{"class":574},[561,2587,1014],{"class":789},[561,2589,598],{"class":574},[561,2591,2592,2595,2597,2600,2602,2605,2607,2609,2611,2614,2617],{"class":563,"line":1120},[561,2593,2594],{"class":578},"    order",[561,2596,950],{"class":574},[561,2598,2599],{"class":953},"addDomainEvent",[561,2601,909],{"class":789},[561,2603,2604],{"class":574},"new",[561,2606,2018],{"class":953},[561,2608,909],{"class":789},[561,2610,2174],{"class":578},[561,2612,2613],{"class":789},"))",[561,2615,2616],{"class":574},";",[561,2618,2620],{"class":2619},"sHwdD"," \u002F\u002F buffered, flushed after save\n",[561,2622,2623,2625,2627],{"class":563,"line":1126},[561,2624,1096],{"class":567},[561,2626,2532],{"class":578},[561,2628,598],{"class":574},[561,2630,2631],{"class":563,"line":1131},[561,2632,1123],{"class":574},[561,2634,2635],{"class":563,"line":1148},[561,2636,605],{"emptyLinePlaceholder":604},[561,2638,2639,2641,2643,2645,2647,2649,2652],{"class":563,"line":1168},[561,2640,901],{"class":614},[561,2642,1136],{"class":614},[561,2644,2512],{"class":789},[561,2646,1141],{"class":574},[561,2648,1586],{"class":617},[561,2650,2651],{"class":578},"[] ",[561,2653,978],{"class":574},[561,2655,2656,2658,2660,2663,2665,2667,2669,2671,2673],{"class":563,"line":1173},[561,2657,1096],{"class":567},[561,2659,2553],{"class":789},[561,2661,2662],{"class":574},"...this.",[561,2664,1439],{"class":578},[561,2666,950],{"class":574},[561,2668,2559],{"class":578},[561,2670,2562],{"class":789},[561,2672,2616],{"class":574},[561,2674,2675],{"class":2619}," \u002F\u002F defensive copy — callers can't mutate the aggregate's array\n",[561,2677,2678],{"class":563,"line":1178},[561,2679,1123],{"class":574},[561,2681,2682],{"class":563,"line":1193},[561,2683,605],{"emptyLinePlaceholder":604},[561,2685,2686,2688,2690,2692,2694,2696],{"class":563,"line":1210},[561,2687,901],{"class":614},[561,2689,1136],{"class":614},[561,2691,2567],{"class":789},[561,2693,1141],{"class":574},[561,2695,2365],{"class":617},[561,2697,780],{"class":574},[561,2699,2700,2702,2704,2706,2708,2711],{"class":563,"line":1215},[561,2701,1096],{"class":567},[561,2703,1153],{"class":574},[561,2705,1439],{"class":578},[561,2707,950],{"class":574},[561,2709,2710],{"class":578},"status",[561,2712,598],{"class":574},[561,2714,2715],{"class":563,"line":1220},[561,2716,1123],{"class":574},[561,2718,2719],{"class":563,"line":1243},[561,2720,605],{"emptyLinePlaceholder":604},[561,2722,2723,2725,2727,2729,2731,2733,2735,2737],{"class":563,"line":1267},[561,2724,901],{"class":614},[561,2726,1136],{"class":614},[561,2728,2119],{"class":789},[561,2730,1141],{"class":574},[561,2732,2124],{"class":617},[561,2734,2452],{"class":574},[561,2736,2455],{"class":617},[561,2738,780],{"class":574},[561,2740,2741,2743,2745,2747,2749,2752],{"class":563,"line":1310},[561,2742,1096],{"class":567},[561,2744,1153],{"class":574},[561,2746,1439],{"class":578},[561,2748,950],{"class":574},[561,2750,2751],{"class":578},"shippedAt",[561,2753,598],{"class":574},[561,2755,2756],{"class":563,"line":1315},[561,2757,1123],{"class":574},[561,2759,2760],{"class":563,"line":1352},[561,2761,605],{"emptyLinePlaceholder":604},[561,2763,2764,2766,2769,2771,2774],{"class":563,"line":1357},[561,2765,901],{"class":614},[561,2767,2768],{"class":789}," hasShipped",[561,2770,1141],{"class":574},[561,2772,2773],{"class":617}," boolean",[561,2775,780],{"class":574},[561,2777,2778,2780,2782,2784,2786,2788,2791,2793,2795,2797],{"class":563,"line":1362},[561,2779,1096],{"class":567},[561,2781,1153],{"class":574},[561,2783,1439],{"class":578},[561,2785,950],{"class":574},[561,2787,2710],{"class":578},[561,2789,2790],{"class":574}," ===",[561,2792,2365],{"class":578},[561,2794,950],{"class":574},[561,2796,2345],{"class":578},[561,2798,598],{"class":574},[561,2800,2801],{"class":563,"line":1385},[561,2802,1123],{"class":574},[561,2804,2805],{"class":563,"line":1418},[561,2806,605],{"emptyLinePlaceholder":604},[561,2808,2809,2811,2814,2816,2818],{"class":563,"line":1423},[561,2810,901],{"class":614},[561,2812,2813],{"class":789}," total",[561,2815,1141],{"class":574},[561,2817,835],{"class":617},[561,2819,780],{"class":574},[561,2821,2823,2825,2827,2830,2832,2835,2838,2840,2842,2844,2846,2848,2850],{"class":563,"line":2822},40,[561,2824,2529],{"class":614},[561,2826,2553],{"class":574},[561,2828,2829],{"class":578},"first",[561,2831,631],{"class":574},[561,2833,2834],{"class":574}," ...",[561,2836,2837],{"class":578},"rest",[561,2839,2562],{"class":574},[561,2841,621],{"class":574},[561,2843,1153],{"class":574},[561,2845,1439],{"class":578},[561,2847,950],{"class":574},[561,2849,2559],{"class":578},[561,2851,598],{"class":574},[561,2853,2855,2857,2859,2861,2863,2865],{"class":563,"line":2854},41,[561,2856,938],{"class":567},[561,2858,941],{"class":789},[561,2860,944],{"class":574},[561,2862,2829],{"class":578},[561,2864,961],{"class":789},[561,2866,978],{"class":574},[561,2868,2870,2872,2874,2876,2878],{"class":563,"line":2869},42,[561,2871,984],{"class":567},[561,2873,987],{"class":574},[561,2875,2263],{"class":953},[561,2877,1159],{"class":789},[561,2879,598],{"class":574},[561,2881,2883],{"class":563,"line":2882},43,[561,2884,1022],{"class":574},[561,2886,2888,2890,2893,2895,2898,2900,2902,2905,2907,2910,2912,2915,2918,2920,2923,2925,2928,2930,2933,2936,2938,2941,2943,2945,2947],{"class":563,"line":2887},44,[561,2889,1096],{"class":567},[561,2891,2892],{"class":578}," rest",[561,2894,950],{"class":574},[561,2896,2897],{"class":953},"reduce",[561,2899,909],{"class":789},[561,2901,909],{"class":574},[561,2903,2904],{"class":912},"sum",[561,2906,631],{"class":574},[561,2908,2909],{"class":912}," item",[561,2911,1014],{"class":574},[561,2913,2914],{"class":614}," =>",[561,2916,2917],{"class":578}," sum",[561,2919,950],{"class":574},[561,2921,2922],{"class":953},"add",[561,2924,909],{"class":789},[561,2926,2927],{"class":578},"item",[561,2929,950],{"class":574},[561,2931,2932],{"class":953},"subtotal",[561,2934,2935],{"class":789},"())",[561,2937,631],{"class":574},[561,2939,2940],{"class":578}," first",[561,2942,950],{"class":574},[561,2944,2932],{"class":953},[561,2946,2935],{"class":789},[561,2948,598],{"class":574},[561,2950,2952],{"class":563,"line":2951},45,[561,2953,1123],{"class":574},[561,2955,2957],{"class":563,"line":2956},46,[561,2958,605],{"emptyLinePlaceholder":604},[561,2960,2962,2964,2967,2969,2972],{"class":563,"line":2961},47,[561,2963,901],{"class":614},[561,2965,2966],{"class":789}," ship",[561,2968,1141],{"class":574},[561,2970,2971],{"class":617}," void",[561,2973,780],{"class":574},[561,2975,2977,2979,2981,2983,2986,2989],{"class":563,"line":2976},48,[561,2978,938],{"class":567},[561,2980,941],{"class":789},[561,2982,1285],{"class":574},[561,2984,2985],{"class":953},"hasShipped",[561,2987,2988],{"class":789},"()) ",[561,2990,978],{"class":574},[561,2992,2994,2996,2998,3000,3002,3004],{"class":563,"line":2993},49,[561,2995,984],{"class":567},[561,2997,987],{"class":574},[561,2999,2268],{"class":953},[561,3001,1159],{"class":789},[561,3003,2616],{"class":574},[561,3005,3006],{"class":2619}," \u002F\u002F invariant: ship once\n",[561,3008,3010],{"class":563,"line":3009},50,[561,3011,1022],{"class":574},[561,3013,3015,3017,3019,3021,3023,3025,3027,3029,3032,3034,3036,3038],{"class":563,"line":3014},51,[561,3016,938],{"class":567},[561,3018,941],{"class":789},[561,3020,1285],{"class":574},[561,3022,1439],{"class":578},[561,3024,950],{"class":574},[561,3026,2559],{"class":578},[561,3028,950],{"class":574},[561,3030,3031],{"class":578},"length",[561,3033,2790],{"class":574},[561,3035,973],{"class":972},[561,3037,961],{"class":789},[561,3039,978],{"class":574},[561,3041,3043,3045,3047,3049,3051,3053],{"class":563,"line":3042},52,[561,3044,984],{"class":567},[561,3046,987],{"class":574},[561,3048,2263],{"class":953},[561,3050,1159],{"class":789},[561,3052,2616],{"class":574},[561,3054,3055],{"class":2619}," \u002F\u002F invariant: never ship empty\n",[561,3057,3059],{"class":563,"line":3058},53,[561,3060,1022],{"class":574},[561,3062,3064],{"class":563,"line":3063},54,[561,3065,605],{"emptyLinePlaceholder":604},[561,3067,3069,3072,3074,3076,3078,3080,3082,3084,3086],{"class":563,"line":3068},55,[561,3070,3071],{"class":574},"    this.",[561,3073,1439],{"class":578},[561,3075,950],{"class":574},[561,3077,2710],{"class":578},[561,3079,621],{"class":574},[561,3081,2365],{"class":578},[561,3083,950],{"class":574},[561,3085,2345],{"class":578},[561,3087,598],{"class":574},[561,3089,3091,3093,3095,3097,3099,3101,3103,3105,3107],{"class":563,"line":3090},56,[561,3092,3071],{"class":574},[561,3094,1439],{"class":578},[561,3096,950],{"class":574},[561,3098,2751],{"class":578},[561,3100,621],{"class":574},[561,3102,987],{"class":574},[561,3104,2124],{"class":953},[561,3106,1159],{"class":789},[561,3108,598],{"class":574},[561,3110,3112,3114,3116,3118,3120,3122,3124,3126,3128,3130,3132,3134,3136,3138,3140],{"class":563,"line":3111},57,[561,3113,3071],{"class":574},[561,3115,2599],{"class":953},[561,3117,909],{"class":789},[561,3119,2604],{"class":574},[561,3121,2079],{"class":953},[561,3123,909],{"class":789},[561,3125,1285],{"class":574},[561,3127,2174],{"class":578},[561,3129,631],{"class":574},[561,3131,1153],{"class":574},[561,3133,1439],{"class":578},[561,3135,950],{"class":574},[561,3137,2751],{"class":578},[561,3139,2613],{"class":789},[561,3141,598],{"class":574},[561,3143,3145],{"class":563,"line":3144},58,[561,3146,1123],{"class":574},[561,3148,3150],{"class":563,"line":3149},59,[561,3151,819],{"class":574},[499,3153,3154,3157,3158,3160,3161,3164,3165,3168],{},[503,3155,3156],{},"ship()"," is the only door to the ",[503,3159,2345],{}," state — the invariant lives with the data, so no controller,\ntest, or future caller can route around it. A violated invariant throws a ",[503,3162,3163],{},"DomainError",", which extends the\ncore ",[503,3166,3167],{},"HeximonError",": throwing one from a handler renders an RFC 9457 problem response with the status you\ndeclare, no try\u002Fcatch in the controller.",[551,3170,3173],{"className":553,"code":3171,"filename":3172,"language":556,"meta":557,"style":557},"import { DomainError } from \"@heximon\u002Fdomain\";\n\nexport class CannotShipEmptyOrderError extends DomainError {\n  public static override readonly statusCode = 409;\n\n  public constructor() {\n    super(\"Cannot ship an order with no items\");\n  }\n}\n\nexport class CannotShipTwiceError extends DomainError {\n  public static override readonly statusCode = 409;\n\n  public constructor() {\n    super(\"Order has already shipped\");\n  }\n}\n","src\u002Forders\u002Forder-errors.ts",[503,3174,3175,3196,3200,3214,3235,3239,3249,3266,3270,3274,3278,3292,3310,3314,3324,3341,3345],{"__ignoreMap":557},[561,3176,3177,3179,3181,3184,3186,3188,3190,3192,3194],{"class":563,"line":564},[561,3178,568],{"class":567},[561,3180,575],{"class":574},[561,3182,3183],{"class":578}," DomainError",[561,3185,582],{"class":574},[561,3187,585],{"class":567},[561,3189,588],{"class":574},[561,3191,761],{"class":591},[561,3193,595],{"class":574},[561,3195,598],{"class":574},[561,3197,3198],{"class":563,"line":601},[561,3199,605],{"emptyLinePlaceholder":604},[561,3201,3202,3204,3206,3208,3210,3212],{"class":563,"line":608},[561,3203,611],{"class":567},[561,3205,832],{"class":614},[561,3207,2263],{"class":617},[561,3209,838],{"class":614},[561,3211,3183],{"class":617},[561,3213,780],{"class":574},[561,3215,3216,3218,3220,3223,3225,3228,3230,3233],{"class":563,"line":783},[561,3217,901],{"class":614},[561,3219,859],{"class":614},[561,3221,3222],{"class":614}," override",[561,3224,862],{"class":614},[561,3226,3227],{"class":789}," statusCode",[561,3229,621],{"class":574},[561,3231,3232],{"class":972}," 409",[561,3234,598],{"class":574},[561,3236,3237],{"class":563,"line":801},[561,3238,605],{"emptyLinePlaceholder":604},[561,3240,3241,3243,3245,3247],{"class":563,"line":816},[561,3242,901],{"class":614},[561,3244,2031],{"class":614},[561,3246,1159],{"class":574},[561,3248,780],{"class":574},[561,3250,3251,3253,3255,3257,3260,3262,3264],{"class":563,"line":822},[561,3252,2054],{"class":578},[561,3254,909],{"class":789},[561,3256,595],{"class":574},[561,3258,3259],{"class":591},"Cannot ship an order with no items",[561,3261,595],{"class":574},[561,3263,1014],{"class":789},[561,3265,598],{"class":574},[561,3267,3268],{"class":563,"line":827},[561,3269,1123],{"class":574},[561,3271,3272],{"class":563,"line":853},[561,3273,819],{"class":574},[561,3275,3276],{"class":563,"line":893},[561,3277,605],{"emptyLinePlaceholder":604},[561,3279,3280,3282,3284,3286,3288,3290],{"class":563,"line":898},[561,3281,611],{"class":567},[561,3283,832],{"class":614},[561,3285,2268],{"class":617},[561,3287,838],{"class":614},[561,3289,3183],{"class":617},[561,3291,780],{"class":574},[561,3293,3294,3296,3298,3300,3302,3304,3306,3308],{"class":563,"line":935},[561,3295,901],{"class":614},[561,3297,859],{"class":614},[561,3299,3222],{"class":614},[561,3301,862],{"class":614},[561,3303,3227],{"class":789},[561,3305,621],{"class":574},[561,3307,3232],{"class":972},[561,3309,598],{"class":574},[561,3311,3312],{"class":563,"line":981},[561,3313,605],{"emptyLinePlaceholder":604},[561,3315,3316,3318,3320,3322],{"class":563,"line":1019},[561,3317,901],{"class":614},[561,3319,2031],{"class":614},[561,3321,1159],{"class":574},[561,3323,780],{"class":574},[561,3325,3326,3328,3330,3332,3335,3337,3339],{"class":563,"line":1025},[561,3327,2054],{"class":578},[561,3329,909],{"class":789},[561,3331,595],{"class":574},[561,3333,3334],{"class":591},"Order has already shipped",[561,3336,595],{"class":574},[561,3338,1014],{"class":789},[561,3340,598],{"class":574},[561,3342,3343],{"class":563,"line":1056},[561,3344,1123],{"class":574},[561,3346,3347],{"class":563,"line":1088},[561,3348,819],{"class":574},[527,3350,3352],{"id":3351},"react-from-another-context","React from another context",[499,3354,3355,3356,3359,3360,3362],{},"The shipping context wants to know when an order ships, but has no business depending on the orders\nmodule. It subscribes by event identity instead — ",[503,3357,3358],{},"implements DomainEventHandler\u003COrderShippedDomainEvent>"," —\nand reads only the flat data the event carries, never the ",[503,3361,505],{}," aggregate, so the two contexts share a\nshape and nothing else.",[551,3364,3367],{"className":553,"code":3365,"filename":3366,"language":556,"meta":557,"style":557},"import type { DomainEventHandler } from \"@heximon\u002Fdomain\";\nimport { OrderShippedDomainEvent } from \"..\u002Forders\u002Fdomain-events\u002Forder.events\";\nimport { ShipmentTracker } from \".\u002Fshipment-tracker.service\";\n\nexport class RecordShipmentHandler implements DomainEventHandler\u003COrderShippedDomainEvent> {\n  public constructor(private readonly tracker: ShipmentTracker) {}\n\n  public handle(event: OrderShippedDomainEvent): void {\n    this.tracker.record({ orderId: event.orderId, shippedAt: event.shippedAt.toISOString() });\n  }\n}\n","src\u002Fshipping\u002Frecord-shipment.handler.ts",[503,3368,3369,3392,3413,3435,3439,3461,3486,3490,3512,3566,3570],{"__ignoreMap":557},[561,3370,3371,3373,3375,3377,3380,3382,3384,3386,3388,3390],{"class":563,"line":564},[561,3372,568],{"class":567},[561,3374,571],{"class":567},[561,3376,575],{"class":574},[561,3378,3379],{"class":578}," DomainEventHandler",[561,3381,582],{"class":574},[561,3383,585],{"class":567},[561,3385,588],{"class":574},[561,3387,761],{"class":591},[561,3389,595],{"class":574},[561,3391,598],{"class":574},[561,3393,3394,3396,3398,3400,3402,3404,3406,3409,3411],{"class":563,"line":601},[561,3395,568],{"class":567},[561,3397,575],{"class":574},[561,3399,2079],{"class":578},[561,3401,582],{"class":574},[561,3403,585],{"class":567},[561,3405,588],{"class":574},[561,3407,3408],{"class":591},"..\u002Forders\u002Fdomain-events\u002Forder.events",[561,3410,595],{"class":574},[561,3412,598],{"class":574},[561,3414,3415,3417,3419,3422,3424,3426,3428,3431,3433],{"class":563,"line":608},[561,3416,568],{"class":567},[561,3418,575],{"class":574},[561,3420,3421],{"class":578}," ShipmentTracker",[561,3423,582],{"class":574},[561,3425,585],{"class":567},[561,3427,588],{"class":574},[561,3429,3430],{"class":591},".\u002Fshipment-tracker.service",[561,3432,595],{"class":574},[561,3434,598],{"class":574},[561,3436,3437],{"class":563,"line":783},[561,3438,605],{"emptyLinePlaceholder":604},[561,3440,3441,3443,3445,3448,3451,3453,3455,3457,3459],{"class":563,"line":801},[561,3442,611],{"class":567},[561,3444,832],{"class":614},[561,3446,3447],{"class":617}," RecordShipmentHandler",[561,3449,3450],{"class":614}," implements",[561,3452,3379],{"class":617},[561,3454,626],{"class":574},[561,3456,524],{"class":617},[561,3458,848],{"class":574},[561,3460,780],{"class":574},[561,3462,3463,3465,3467,3469,3472,3474,3477,3479,3481,3483],{"class":563,"line":816},[561,3464,901],{"class":614},[561,3466,2031],{"class":614},[561,3468,909],{"class":574},[561,3470,3471],{"class":614},"private",[561,3473,862],{"class":614},[561,3475,3476],{"class":912}," tracker",[561,3478,793],{"class":574},[561,3480,3421],{"class":617},[561,3482,1014],{"class":574},[561,3484,3485],{"class":574}," {}\n",[561,3487,3488],{"class":563,"line":822},[561,3489,605],{"emptyLinePlaceholder":604},[561,3491,3492,3494,3497,3499,3502,3504,3506,3508,3510],{"class":563,"line":827},[561,3493,901],{"class":614},[561,3495,3496],{"class":789}," handle",[561,3498,909],{"class":574},[561,3500,3501],{"class":912},"event",[561,3503,793],{"class":574},[561,3505,2079],{"class":617},[561,3507,928],{"class":574},[561,3509,2971],{"class":617},[561,3511,780],{"class":574},[561,3513,3514,3516,3519,3521,3524,3526,3528,3530,3532,3535,3537,3540,3542,3544,3546,3548,3550,3552,3554,3557,3560,3562,3564],{"class":563,"line":853},[561,3515,3071],{"class":574},[561,3517,3518],{"class":578},"tracker",[561,3520,950],{"class":574},[561,3522,3523],{"class":953},"record",[561,3525,909],{"class":789},[561,3527,1105],{"class":574},[561,3529,2041],{"class":789},[561,3531,793],{"class":574},[561,3533,3534],{"class":578}," event",[561,3536,950],{"class":574},[561,3538,3539],{"class":578},"orderId",[561,3541,631],{"class":574},[561,3543,2119],{"class":789},[561,3545,793],{"class":574},[561,3547,3534],{"class":578},[561,3549,950],{"class":574},[561,3551,2751],{"class":578},[561,3553,950],{"class":574},[561,3555,3556],{"class":953},"toISOString",[561,3558,3559],{"class":789},"() ",[561,3561,1006],{"class":574},[561,3563,1014],{"class":789},[561,3565,598],{"class":574},[561,3567,3568],{"class":563,"line":893},[561,3569,1123],{"class":574},[561,3571,3572],{"class":563,"line":898},[561,3573,819],{"class":574},[499,3575,3576,3577,3580],{},"Dispatch is in-process and serial, so a throw here propagates back to the caller that flushed the event —\nif recording the shipment fails, the whole operation fails together. The ",[503,3578,3579],{},"ShipmentTracker"," is a plain\nprovider, injected by its constructor type with no token.",[527,3582,3584],{"id":3583},"flush-events-after-saving","Flush events after saving",[499,3586,3587,3588,3591,3592,3595,3596,3599],{},"The aggregate buffers events but dispatches nothing on its own — there's no implicit unit of work, so you\ncontrol ",[715,3589,3590],{},"when"," side effects fire: persist first, then flush. The controller injects the repository and the\n",[503,3593,3594],{},"DomainEvents"," facade (a core provider you never declare), and calls ",[503,3597,3598],{},"emitFrom(order)"," after the save to\ndrain the buffer.",[551,3601,3604],{"className":553,"code":3602,"filename":3603,"language":556,"meta":557,"style":557},"import { NotFoundError } from \"@heximon\u002Fruntime\u002Ferrors\";\nimport { DomainEvents } from \"@heximon\u002Fdomain\";\nimport type { Controller, Post } from \"@heximon\u002Fhttp\";\nimport { Money } from \".\u002Fmoney.value\";\nimport { Order, type OrderId } from \".\u002Forder.entity\";\nimport { OrderItem, type ProductId } from \".\u002Forder-item.value\";\nimport { OrderRepository } from \".\u002Forder.repository\";\n\ninterface CreateOrderBody {\n  readonly items: ReadonlyArray\u003C{\n    readonly productId: string;\n    readonly name: string;\n    readonly unitPriceCents: number;\n    readonly currency: string;\n    readonly quantity: number;\n  }>;\n}\n\nexport class OrdersController implements Controller\u003C\"\u002Forders\"> {\n  public constructor(\n    private readonly repository: OrderRepository,\n    private readonly domainEvents: DomainEvents,\n  ) {}\n\n  public async create(action: Post\u003C\"\u002F\">): Promise\u003C{ id: string; status: string }> {\n    const body = (await action.request.readBody()) as CreateOrderBody;\n\n    const items = body.items.map((line) =>\n      OrderItem.create({\n        productId: line.productId as ProductId,\n        name: line.name,\n        unitPrice: Money.create(line.unitPriceCents, line.currency), \u002F\u002F validates on construction\n        quantity: line.quantity,\n      }),\n    );\n\n    const order = Order.create(crypto.randomUUID() as OrderId, items);\n    this.repository.save(order);\n    await this.domainEvents.emitFrom(order); \u002F\u002F drains the buffer; dispatches serially, in order\n\n    action.response.status = 201;\n    return { id: order.id, status: order.status };\n  }\n\n  public async ship(action: Post\u003C\"\u002F:id\u002Fship\">): Promise\u003C{ id: string; status: string }> {\n    const order = this.repository.findById(action.request.pathParams.id as OrderId);\n    if (!order) {\n      throw new NotFoundError(`Order ${action.request.pathParams.id} not found`);\n    }\n\n    order.ship(); \u002F\u002F enforces the invariants; a forbidden transition throws a 409\n    this.repository.save(order);\n    await this.domainEvents.emitFrom(order); \u002F\u002F RecordShipmentHandler runs here\n\n    return { id: order.id, status: order.status };\n  }\n}\n","src\u002Forders\u002Forders.controller.ts",[503,3605,3606,3628,3649,3678,3698,3725,3751,3773,3777,3786,3800,3813,3825,3838,3850,3862,3867,3871,3875,3901,3909,3925,3940,3946,3950,4005,4041,4045,4075,4088,4108,4123,4160,4175,4184,4191,4195,4233,4254,4280,4284,4305,4336,4340,4344,4393,4435,4449,4491,4495,4499,4515,4533,4556,4560,4590,4594],{"__ignoreMap":557},[561,3607,3608,3610,3612,3615,3617,3619,3621,3624,3626],{"class":563,"line":564},[561,3609,568],{"class":567},[561,3611,575],{"class":574},[561,3613,3614],{"class":578}," NotFoundError",[561,3616,582],{"class":574},[561,3618,585],{"class":567},[561,3620,588],{"class":574},[561,3622,3623],{"class":591},"@heximon\u002Fruntime\u002Ferrors",[561,3625,595],{"class":574},[561,3627,598],{"class":574},[561,3629,3630,3632,3634,3637,3639,3641,3643,3645,3647],{"class":563,"line":601},[561,3631,568],{"class":567},[561,3633,575],{"class":574},[561,3635,3636],{"class":578}," DomainEvents",[561,3638,582],{"class":574},[561,3640,585],{"class":567},[561,3642,588],{"class":574},[561,3644,761],{"class":591},[561,3646,595],{"class":574},[561,3648,598],{"class":574},[561,3650,3651,3653,3655,3657,3660,3662,3665,3667,3669,3671,3674,3676],{"class":563,"line":608},[561,3652,568],{"class":567},[561,3654,571],{"class":567},[561,3656,575],{"class":574},[561,3658,3659],{"class":578}," Controller",[561,3661,631],{"class":574},[561,3663,3664],{"class":578}," Post",[561,3666,582],{"class":574},[561,3668,585],{"class":567},[561,3670,588],{"class":574},[561,3672,3673],{"class":591},"@heximon\u002Fhttp",[561,3675,595],{"class":574},[561,3677,598],{"class":574},[561,3679,3680,3682,3684,3686,3688,3690,3692,3694,3696],{"class":563,"line":783},[561,3681,568],{"class":567},[561,3683,575],{"class":574},[561,3685,835],{"class":578},[561,3687,582],{"class":574},[561,3689,585],{"class":567},[561,3691,588],{"class":574},[561,3693,1500],{"class":591},[561,3695,595],{"class":574},[561,3697,598],{"class":574},[561,3699,3700,3702,3704,3706,3708,3710,3712,3714,3716,3718,3721,3723],{"class":563,"line":801},[561,3701,568],{"class":567},[561,3703,575],{"class":574},[561,3705,2474],{"class":578},[561,3707,631],{"class":574},[561,3709,571],{"class":567},[561,3711,681],{"class":578},[561,3713,582],{"class":574},[561,3715,585],{"class":567},[561,3717,588],{"class":574},[561,3719,3720],{"class":591},".\u002Forder.entity",[561,3722,595],{"class":574},[561,3724,598],{"class":574},[561,3726,3727,3729,3731,3733,3735,3737,3739,3741,3743,3745,3747,3749],{"class":563,"line":816},[561,3728,568],{"class":567},[561,3730,575],{"class":574},[561,3732,1586],{"class":578},[561,3734,631],{"class":574},[561,3736,571],{"class":567},[561,3738,618],{"class":578},[561,3740,582],{"class":574},[561,3742,585],{"class":567},[561,3744,588],{"class":574},[561,3746,2298],{"class":591},[561,3748,595],{"class":574},[561,3750,598],{"class":574},[561,3752,3753,3755,3757,3760,3762,3764,3766,3769,3771],{"class":563,"line":822},[561,3754,568],{"class":567},[561,3756,575],{"class":574},[561,3758,3759],{"class":578}," OrderRepository",[561,3761,582],{"class":574},[561,3763,585],{"class":567},[561,3765,588],{"class":574},[561,3767,3768],{"class":591},".\u002Forder.repository",[561,3770,595],{"class":574},[561,3772,598],{"class":574},[561,3774,3775],{"class":563,"line":827},[561,3776,605],{"emptyLinePlaceholder":604},[561,3778,3779,3781,3784],{"class":563,"line":853},[561,3780,774],{"class":614},[561,3782,3783],{"class":617}," CreateOrderBody",[561,3785,780],{"class":574},[561,3787,3788,3790,3792,3794,3797],{"class":563,"line":893},[561,3789,786],{"class":614},[561,3791,2512],{"class":789},[561,3793,793],{"class":574},[561,3795,3796],{"class":617}," ReadonlyArray",[561,3798,3799],{"class":574},"\u003C{\n",[561,3801,3802,3805,3807,3809,3811],{"class":563,"line":898},[561,3803,3804],{"class":614},"    readonly",[561,3806,1524],{"class":789},[561,3808,793],{"class":574},[561,3810,811],{"class":617},[561,3812,598],{"class":574},[561,3814,3815,3817,3819,3821,3823],{"class":563,"line":935},[561,3816,3804],{"class":614},[561,3818,1537],{"class":789},[561,3820,793],{"class":574},[561,3822,811],{"class":617},[561,3824,598],{"class":574},[561,3826,3827,3829,3832,3834,3836],{"class":563,"line":981},[561,3828,3804],{"class":614},[561,3830,3831],{"class":789}," unitPriceCents",[561,3833,793],{"class":574},[561,3835,796],{"class":617},[561,3837,598],{"class":574},[561,3839,3840,3842,3844,3846,3848],{"class":563,"line":1019},[561,3841,3804],{"class":614},[561,3843,806],{"class":789},[561,3845,793],{"class":574},[561,3847,811],{"class":617},[561,3849,598],{"class":574},[561,3851,3852,3854,3856,3858,3860],{"class":563,"line":1025},[561,3853,3804],{"class":614},[561,3855,1563],{"class":789},[561,3857,793],{"class":574},[561,3859,796],{"class":617},[561,3861,598],{"class":574},[561,3863,3864],{"class":563,"line":1056},[561,3865,3866],{"class":574},"  }>;\n",[561,3868,3869],{"class":563,"line":1088},[561,3870,819],{"class":574},[561,3872,3873],{"class":563,"line":1093},[561,3874,605],{"emptyLinePlaceholder":604},[561,3876,3877,3879,3881,3884,3886,3888,3890,3892,3895,3897,3899],{"class":563,"line":1120},[561,3878,611],{"class":567},[561,3880,832],{"class":614},[561,3882,3883],{"class":617}," OrdersController",[561,3885,3450],{"class":614},[561,3887,3659],{"class":617},[561,3889,626],{"class":574},[561,3891,595],{"class":574},[561,3893,3894],{"class":591},"\u002Forders",[561,3896,595],{"class":574},[561,3898,848],{"class":574},[561,3900,780],{"class":574},[561,3902,3903,3905,3907],{"class":563,"line":1126},[561,3904,901],{"class":614},[561,3906,2031],{"class":614},[561,3908,2094],{"class":574},[561,3910,3911,3914,3916,3919,3921,3923],{"class":563,"line":1131},[561,3912,3913],{"class":614},"    private",[561,3915,862],{"class":614},[561,3917,3918],{"class":912}," repository",[561,3920,793],{"class":574},[561,3922,3759],{"class":617},[561,3924,2110],{"class":574},[561,3926,3927,3929,3931,3934,3936,3938],{"class":563,"line":1148},[561,3928,3913],{"class":614},[561,3930,862],{"class":614},[561,3932,3933],{"class":912}," domainEvents",[561,3935,793],{"class":574},[561,3937,3636],{"class":617},[561,3939,2110],{"class":574},[561,3941,3942,3944],{"class":563,"line":1168},[561,3943,2131],{"class":574},[561,3945,3485],{"class":574},[561,3947,3948],{"class":563,"line":1173},[561,3949,605],{"emptyLinePlaceholder":604},[561,3951,3952,3954,3957,3959,3961,3964,3966,3968,3970,3972,3974,3976,3979,3982,3985,3988,3990,3992,3994,3996,3998,4000,4003],{"class":563,"line":1178},[561,3953,901],{"class":614},[561,3955,3956],{"class":614}," async",[561,3958,906],{"class":789},[561,3960,909],{"class":574},[561,3962,3963],{"class":912},"action",[561,3965,793],{"class":574},[561,3967,3664],{"class":617},[561,3969,626],{"class":574},[561,3971,595],{"class":574},[561,3973,888],{"class":591},[561,3975,595],{"class":574},[561,3977,3978],{"class":574},">):",[561,3980,3981],{"class":617}," Promise",[561,3983,3984],{"class":574},"\u003C{",[561,3986,3987],{"class":789}," id",[561,3989,793],{"class":574},[561,3991,811],{"class":617},[561,3993,2616],{"class":574},[561,3995,2567],{"class":789},[561,3997,793],{"class":574},[561,3999,811],{"class":617},[561,4001,4002],{"class":574}," }>",[561,4004,780],{"class":574},[561,4006,4007,4009,4012,4014,4016,4019,4022,4024,4027,4029,4032,4034,4037,4039],{"class":563,"line":1193},[561,4008,2529],{"class":614},[561,4010,4011],{"class":578}," body",[561,4013,621],{"class":574},[561,4015,941],{"class":789},[561,4017,4018],{"class":567},"await",[561,4020,4021],{"class":578}," action",[561,4023,950],{"class":574},[561,4025,4026],{"class":578},"request",[561,4028,950],{"class":574},[561,4030,4031],{"class":953},"readBody",[561,4033,2988],{"class":789},[561,4035,4036],{"class":567},"as",[561,4038,3783],{"class":617},[561,4040,598],{"class":574},[561,4042,4043],{"class":563,"line":1210},[561,4044,605],{"emptyLinePlaceholder":604},[561,4046,4047,4049,4051,4053,4055,4057,4059,4061,4064,4066,4068,4070,4072],{"class":563,"line":1215},[561,4048,2529],{"class":614},[561,4050,2512],{"class":578},[561,4052,621],{"class":574},[561,4054,4011],{"class":578},[561,4056,950],{"class":574},[561,4058,2559],{"class":578},[561,4060,950],{"class":574},[561,4062,4063],{"class":953},"map",[561,4065,909],{"class":789},[561,4067,909],{"class":574},[561,4069,563],{"class":912},[561,4071,1014],{"class":574},[561,4073,4074],{"class":614}," =>\n",[561,4076,4077,4080,4082,4084,4086],{"class":563,"line":1220},[561,4078,4079],{"class":578},"      OrderItem",[561,4081,950],{"class":574},[561,4083,733],{"class":953},[561,4085,909],{"class":789},[561,4087,978],{"class":574},[561,4089,4090,4093,4095,4098,4100,4102,4104,4106],{"class":563,"line":1243},[561,4091,4092],{"class":789},"        productId",[561,4094,793],{"class":574},[561,4096,4097],{"class":578}," line",[561,4099,950],{"class":574},[561,4101,1756],{"class":578},[561,4103,2352],{"class":567},[561,4105,618],{"class":617},[561,4107,2110],{"class":574},[561,4109,4110,4113,4115,4117,4119,4121],{"class":563,"line":1267},[561,4111,4112],{"class":789},"        name",[561,4114,793],{"class":574},[561,4116,4097],{"class":578},[561,4118,950],{"class":574},[561,4120,1795],{"class":578},[561,4122,2110],{"class":574},[561,4124,4125,4128,4130,4132,4134,4136,4138,4140,4142,4145,4147,4149,4151,4153,4155,4157],{"class":563,"line":1310},[561,4126,4127],{"class":789},"        unitPrice",[561,4129,793],{"class":574},[561,4131,835],{"class":578},[561,4133,950],{"class":574},[561,4135,733],{"class":953},[561,4137,909],{"class":789},[561,4139,563],{"class":578},[561,4141,950],{"class":574},[561,4143,4144],{"class":578},"unitPriceCents",[561,4146,631],{"class":574},[561,4148,4097],{"class":578},[561,4150,950],{"class":574},[561,4152,1048],{"class":578},[561,4154,1014],{"class":789},[561,4156,631],{"class":574},[561,4158,4159],{"class":2619}," \u002F\u002F validates on construction\n",[561,4161,4162,4165,4167,4169,4171,4173],{"class":563,"line":1315},[561,4163,4164],{"class":789},"        quantity",[561,4166,793],{"class":574},[561,4168,4097],{"class":578},[561,4170,950],{"class":574},[561,4172,1645],{"class":578},[561,4174,2110],{"class":574},[561,4176,4177,4180,4182],{"class":563,"line":1352},[561,4178,4179],{"class":574},"      }",[561,4181,1014],{"class":789},[561,4183,2110],{"class":574},[561,4185,4186,4189],{"class":563,"line":1357},[561,4187,4188],{"class":789},"    )",[561,4190,598],{"class":574},[561,4192,4193],{"class":563,"line":1362},[561,4194,605],{"emptyLinePlaceholder":604},[561,4196,4197,4199,4201,4203,4205,4207,4209,4211,4214,4216,4219,4221,4223,4225,4227,4229,4231],{"class":563,"line":1385},[561,4198,2529],{"class":614},[561,4200,2532],{"class":578},[561,4202,621],{"class":574},[561,4204,2474],{"class":578},[561,4206,950],{"class":574},[561,4208,733],{"class":953},[561,4210,909],{"class":789},[561,4212,4213],{"class":578},"crypto",[561,4215,950],{"class":574},[561,4217,4218],{"class":953},"randomUUID",[561,4220,3559],{"class":789},[561,4222,4036],{"class":567},[561,4224,681],{"class":617},[561,4226,631],{"class":574},[561,4228,2512],{"class":578},[561,4230,1014],{"class":789},[561,4232,598],{"class":574},[561,4234,4235,4237,4240,4242,4245,4247,4250,4252],{"class":563,"line":1418},[561,4236,3071],{"class":574},[561,4238,4239],{"class":578},"repository",[561,4241,950],{"class":574},[561,4243,4244],{"class":953},"save",[561,4246,909],{"class":789},[561,4248,4249],{"class":578},"order",[561,4251,1014],{"class":789},[561,4253,598],{"class":574},[561,4255,4256,4259,4261,4264,4266,4269,4271,4273,4275,4277],{"class":563,"line":1423},[561,4257,4258],{"class":567},"    await",[561,4260,1153],{"class":574},[561,4262,4263],{"class":578},"domainEvents",[561,4265,950],{"class":574},[561,4267,4268],{"class":953},"emitFrom",[561,4270,909],{"class":789},[561,4272,4249],{"class":578},[561,4274,1014],{"class":789},[561,4276,2616],{"class":574},[561,4278,4279],{"class":2619}," \u002F\u002F drains the buffer; dispatches serially, in order\n",[561,4281,4282],{"class":563,"line":2822},[561,4283,605],{"emptyLinePlaceholder":604},[561,4285,4286,4289,4291,4294,4296,4298,4300,4303],{"class":563,"line":2854},[561,4287,4288],{"class":578},"    action",[561,4290,950],{"class":574},[561,4292,4293],{"class":578},"response",[561,4295,950],{"class":574},[561,4297,2710],{"class":578},[561,4299,621],{"class":574},[561,4301,4302],{"class":972}," 201",[561,4304,598],{"class":574},[561,4306,4307,4309,4311,4313,4315,4317,4319,4321,4323,4325,4327,4329,4331,4333],{"class":563,"line":2869},[561,4308,1096],{"class":567},[561,4310,575],{"class":574},[561,4312,3987],{"class":789},[561,4314,793],{"class":574},[561,4316,2532],{"class":578},[561,4318,950],{"class":574},[561,4320,2174],{"class":578},[561,4322,631],{"class":574},[561,4324,2567],{"class":789},[561,4326,793],{"class":574},[561,4328,2532],{"class":578},[561,4330,950],{"class":574},[561,4332,2710],{"class":578},[561,4334,4335],{"class":574}," };\n",[561,4337,4338],{"class":563,"line":2882},[561,4339,1123],{"class":574},[561,4341,4342],{"class":563,"line":2887},[561,4343,605],{"emptyLinePlaceholder":604},[561,4345,4346,4348,4350,4352,4354,4356,4358,4360,4362,4364,4367,4369,4371,4373,4375,4377,4379,4381,4383,4385,4387,4389,4391],{"class":563,"line":2951},[561,4347,901],{"class":614},[561,4349,3956],{"class":614},[561,4351,2966],{"class":789},[561,4353,909],{"class":574},[561,4355,3963],{"class":912},[561,4357,793],{"class":574},[561,4359,3664],{"class":617},[561,4361,626],{"class":574},[561,4363,595],{"class":574},[561,4365,4366],{"class":591},"\u002F:id\u002Fship",[561,4368,595],{"class":574},[561,4370,3978],{"class":574},[561,4372,3981],{"class":617},[561,4374,3984],{"class":574},[561,4376,3987],{"class":789},[561,4378,793],{"class":574},[561,4380,811],{"class":617},[561,4382,2616],{"class":574},[561,4384,2567],{"class":789},[561,4386,793],{"class":574},[561,4388,811],{"class":617},[561,4390,4002],{"class":574},[561,4392,780],{"class":574},[561,4394,4395,4397,4399,4401,4403,4405,4407,4410,4412,4414,4416,4418,4420,4423,4425,4427,4429,4431,4433],{"class":563,"line":2956},[561,4396,2529],{"class":614},[561,4398,2532],{"class":578},[561,4400,621],{"class":574},[561,4402,1153],{"class":574},[561,4404,4239],{"class":578},[561,4406,950],{"class":574},[561,4408,4409],{"class":953},"findById",[561,4411,909],{"class":789},[561,4413,3963],{"class":578},[561,4415,950],{"class":574},[561,4417,4026],{"class":578},[561,4419,950],{"class":574},[561,4421,4422],{"class":578},"pathParams",[561,4424,950],{"class":574},[561,4426,2174],{"class":578},[561,4428,2352],{"class":567},[561,4430,681],{"class":617},[561,4432,1014],{"class":789},[561,4434,598],{"class":574},[561,4436,4437,4439,4441,4443,4445,4447],{"class":563,"line":2961},[561,4438,938],{"class":567},[561,4440,941],{"class":789},[561,4442,944],{"class":574},[561,4444,4249],{"class":578},[561,4446,961],{"class":789},[561,4448,978],{"class":574},[561,4450,4451,4453,4455,4457,4459,4461,4464,4466,4468,4470,4472,4474,4476,4478,4480,4482,4485,4487,4489],{"class":563,"line":2976},[561,4452,984],{"class":567},[561,4454,987],{"class":574},[561,4456,3614],{"class":953},[561,4458,909],{"class":789},[561,4460,995],{"class":574},[561,4462,4463],{"class":591},"Order ",[561,4465,1001],{"class":574},[561,4467,3963],{"class":578},[561,4469,950],{"class":574},[561,4471,4026],{"class":578},[561,4473,950],{"class":574},[561,4475,4422],{"class":578},[561,4477,950],{"class":574},[561,4479,2174],{"class":578},[561,4481,1006],{"class":574},[561,4483,4484],{"class":591}," not found",[561,4486,995],{"class":574},[561,4488,1014],{"class":789},[561,4490,598],{"class":574},[561,4492,4493],{"class":563,"line":2993},[561,4494,1022],{"class":574},[561,4496,4497],{"class":563,"line":3009},[561,4498,605],{"emptyLinePlaceholder":604},[561,4500,4501,4503,4505,4508,4510,4512],{"class":563,"line":3014},[561,4502,2594],{"class":578},[561,4504,950],{"class":574},[561,4506,4507],{"class":953},"ship",[561,4509,1159],{"class":789},[561,4511,2616],{"class":574},[561,4513,4514],{"class":2619}," \u002F\u002F enforces the invariants; a forbidden transition throws a 409\n",[561,4516,4517,4519,4521,4523,4525,4527,4529,4531],{"class":563,"line":3042},[561,4518,3071],{"class":574},[561,4520,4239],{"class":578},[561,4522,950],{"class":574},[561,4524,4244],{"class":953},[561,4526,909],{"class":789},[561,4528,4249],{"class":578},[561,4530,1014],{"class":789},[561,4532,598],{"class":574},[561,4534,4535,4537,4539,4541,4543,4545,4547,4549,4551,4553],{"class":563,"line":3058},[561,4536,4258],{"class":567},[561,4538,1153],{"class":574},[561,4540,4263],{"class":578},[561,4542,950],{"class":574},[561,4544,4268],{"class":953},[561,4546,909],{"class":789},[561,4548,4249],{"class":578},[561,4550,1014],{"class":789},[561,4552,2616],{"class":574},[561,4554,4555],{"class":2619}," \u002F\u002F RecordShipmentHandler runs here\n",[561,4557,4558],{"class":563,"line":3063},[561,4559,605],{"emptyLinePlaceholder":604},[561,4561,4562,4564,4566,4568,4570,4572,4574,4576,4578,4580,4582,4584,4586,4588],{"class":563,"line":3068},[561,4563,1096],{"class":567},[561,4565,575],{"class":574},[561,4567,3987],{"class":789},[561,4569,793],{"class":574},[561,4571,2532],{"class":578},[561,4573,950],{"class":574},[561,4575,2174],{"class":578},[561,4577,631],{"class":574},[561,4579,2567],{"class":789},[561,4581,793],{"class":574},[561,4583,2532],{"class":578},[561,4585,950],{"class":574},[561,4587,2710],{"class":578},[561,4589,4335],{"class":574},[561,4591,4592],{"class":563,"line":3090},[561,4593,1123],{"class":574},[561,4595,4596],{"class":563,"line":3111},[561,4597,819],{"class":574},[499,4599,4600,4602,4603,4606],{},[503,4601,3598],{}," is the seam where the two contexts meet: it runs every matching ",[503,4604,4605],{},"DomainEventHandler"," in\norder, so the shipping read model updates as part of shipping the order. A second flush is a no-op.",[527,4608,4610],{"id":4609},"persist-with-optimistic-concurrency","Persist with optimistic concurrency",[499,4612,4613,4614,4617,4618,4621,4622,4624,4625,4627,4628,4631],{},"The repository is the aggregate's persistence boundary — an in-memory ",[503,4615,4616],{},"Map"," here, a ",[503,4619,4620],{},"DrizzleEntityRepository","\nin production, with no change to the aggregate. Either way the ",[503,4623,2178],{}," the ",[503,4626,2170],{}," base carries gives you\noptimistic concurrency: each save checks and bumps the stored version, so two concurrent writes can't\nsilently clobber each other — the loser gets a ",[503,4629,4630],{},"ConcurrencyError"," to retry.",[551,4633,4636],{"className":553,"code":4634,"filename":4635,"language":556,"meta":557,"style":557},"import type { Order, OrderId } from \".\u002Forder.entity\";\n\nexport class OrderRepository {\n  private readonly orders = new Map\u003COrderId, Order>();\n\n  public save(order: Order): void {\n    this.orders.set(order.id, order);\n  }\n\n  public findById(id: OrderId): Order | undefined {\n    return this.orders.get(id);\n  }\n}\n","src\u002Forders\u002Forder.repository.ts",[503,4637,4638,4664,4668,4678,4708,4712,4733,4761,4765,4769,4794,4815,4819],{"__ignoreMap":557},[561,4639,4640,4642,4644,4646,4648,4650,4652,4654,4656,4658,4660,4662],{"class":563,"line":564},[561,4641,568],{"class":567},[561,4643,571],{"class":567},[561,4645,575],{"class":574},[561,4647,2474],{"class":578},[561,4649,631],{"class":574},[561,4651,681],{"class":578},[561,4653,582],{"class":574},[561,4655,585],{"class":567},[561,4657,588],{"class":574},[561,4659,3720],{"class":591},[561,4661,595],{"class":574},[561,4663,598],{"class":574},[561,4665,4666],{"class":563,"line":601},[561,4667,605],{"emptyLinePlaceholder":604},[561,4669,4670,4672,4674,4676],{"class":563,"line":608},[561,4671,611],{"class":567},[561,4673,832],{"class":614},[561,4675,3759],{"class":617},[561,4677,780],{"class":574},[561,4679,4680,4682,4684,4687,4689,4691,4694,4696,4698,4700,4702,4704,4706],{"class":563,"line":783},[561,4681,856],{"class":614},[561,4683,862],{"class":614},[561,4685,4686],{"class":789}," orders",[561,4688,621],{"class":574},[561,4690,987],{"class":574},[561,4692,4693],{"class":789}," Map",[561,4695,626],{"class":574},[561,4697,548],{"class":617},[561,4699,631],{"class":574},[561,4701,2474],{"class":617},[561,4703,848],{"class":574},[561,4705,1159],{"class":578},[561,4707,598],{"class":574},[561,4709,4710],{"class":563,"line":801},[561,4711,605],{"emptyLinePlaceholder":604},[561,4713,4714,4716,4719,4721,4723,4725,4727,4729,4731],{"class":563,"line":816},[561,4715,901],{"class":614},[561,4717,4718],{"class":789}," save",[561,4720,909],{"class":574},[561,4722,4249],{"class":912},[561,4724,793],{"class":574},[561,4726,2474],{"class":617},[561,4728,928],{"class":574},[561,4730,2971],{"class":617},[561,4732,780],{"class":574},[561,4734,4735,4737,4740,4742,4745,4747,4749,4751,4753,4755,4757,4759],{"class":563,"line":822},[561,4736,3071],{"class":574},[561,4738,4739],{"class":578},"orders",[561,4741,950],{"class":574},[561,4743,4744],{"class":953},"set",[561,4746,909],{"class":789},[561,4748,4249],{"class":578},[561,4750,950],{"class":574},[561,4752,2174],{"class":578},[561,4754,631],{"class":574},[561,4756,2532],{"class":578},[561,4758,1014],{"class":789},[561,4760,598],{"class":574},[561,4762,4763],{"class":563,"line":827},[561,4764,1123],{"class":574},[561,4766,4767],{"class":563,"line":853},[561,4768,605],{"emptyLinePlaceholder":604},[561,4770,4771,4773,4776,4778,4780,4782,4784,4786,4788,4790,4792],{"class":563,"line":893},[561,4772,901],{"class":614},[561,4774,4775],{"class":789}," findById",[561,4777,909],{"class":574},[561,4779,2174],{"class":912},[561,4781,793],{"class":574},[561,4783,681],{"class":617},[561,4785,928],{"class":574},[561,4787,2474],{"class":617},[561,4789,2452],{"class":574},[561,4791,2455],{"class":617},[561,4793,780],{"class":574},[561,4795,4796,4798,4800,4802,4804,4807,4809,4811,4813],{"class":563,"line":898},[561,4797,1096],{"class":567},[561,4799,1153],{"class":574},[561,4801,4739],{"class":578},[561,4803,950],{"class":574},[561,4805,4806],{"class":953},"get",[561,4808,909],{"class":789},[561,4810,2174],{"class":578},[561,4812,1014],{"class":789},[561,4814,598],{"class":574},[561,4816,4817],{"class":563,"line":935},[561,4818,1123],{"class":574},[561,4820,4821],{"class":563,"line":981},[561,4822,819],{"class":574},[527,4824,4826],{"id":4825},"wire-the-two-contexts","Wire the two contexts",[499,4828,4829,4830,4833,4834,4837,4838,4841,4842,4844],{},"Each context is its own module, and they never name each other. The orders module declares its repository\nand HTTP surface; the shipping module declares its handler under the ",[503,4831,4832],{},"domain"," namespace's\n",[503,4835,4836],{},"eventHandlers"," key — never in ",[503,4839,4840],{},"providers",", since that key is how the compiler knows to dispatch the\nhandler rather than just construct it. The ",[503,4843,3594],{}," facade is contributed app-wide, so no module\ndeclares it.",[551,4846,4849],{"className":553,"code":4847,"filename":4848,"language":556,"meta":557,"style":557},"import { Module } from \"@heximon\u002Fruntime\";\nimport { OrderRepository } from \".\u002Forder.repository\";\nimport { OrdersController } from \".\u002Forders.controller\";\n\nexport class OrdersModule extends Module({\n  providers: [OrderRepository],\n  http: { controllers: [OrdersController] },\n  exports: [OrderRepository],\n}) {}\n","src\u002Forders\u002Forders.module.ts",[503,4850,4851,4873,4893,4914,4918,4935,4947,4967,4978],{"__ignoreMap":557},[561,4852,4853,4855,4857,4860,4862,4864,4866,4869,4871],{"class":563,"line":564},[561,4854,568],{"class":567},[561,4856,575],{"class":574},[561,4858,4859],{"class":578}," Module",[561,4861,582],{"class":574},[561,4863,585],{"class":567},[561,4865,588],{"class":574},[561,4867,4868],{"class":591},"@heximon\u002Fruntime",[561,4870,595],{"class":574},[561,4872,598],{"class":574},[561,4874,4875,4877,4879,4881,4883,4885,4887,4889,4891],{"class":563,"line":601},[561,4876,568],{"class":567},[561,4878,575],{"class":574},[561,4880,3759],{"class":578},[561,4882,582],{"class":574},[561,4884,585],{"class":567},[561,4886,588],{"class":574},[561,4888,3768],{"class":591},[561,4890,595],{"class":574},[561,4892,598],{"class":574},[561,4894,4895,4897,4899,4901,4903,4905,4907,4910,4912],{"class":563,"line":608},[561,4896,568],{"class":567},[561,4898,575],{"class":574},[561,4900,3883],{"class":578},[561,4902,582],{"class":574},[561,4904,585],{"class":567},[561,4906,588],{"class":574},[561,4908,4909],{"class":591},".\u002Forders.controller",[561,4911,595],{"class":574},[561,4913,598],{"class":574},[561,4915,4916],{"class":563,"line":783},[561,4917,605],{"emptyLinePlaceholder":604},[561,4919,4920,4922,4924,4927,4929,4931,4933],{"class":563,"line":801},[561,4921,611],{"class":567},[561,4923,832],{"class":614},[561,4925,4926],{"class":617}," OrdersModule",[561,4928,838],{"class":614},[561,4930,4859],{"class":953},[561,4932,909],{"class":578},[561,4934,978],{"class":574},[561,4936,4937,4940,4942,4945],{"class":563,"line":816},[561,4938,4939],{"class":789},"  providers",[561,4941,793],{"class":574},[561,4943,4944],{"class":578}," [OrderRepository]",[561,4946,2110],{"class":574},[561,4948,4949,4952,4954,4956,4959,4961,4964],{"class":563,"line":822},[561,4950,4951],{"class":789},"  http",[561,4953,793],{"class":574},[561,4955,575],{"class":574},[561,4957,4958],{"class":789}," controllers",[561,4960,793],{"class":574},[561,4962,4963],{"class":578}," [OrdersController] ",[561,4965,4966],{"class":574},"},\n",[561,4968,4969,4972,4974,4976],{"class":563,"line":827},[561,4970,4971],{"class":789},"  exports",[561,4973,793],{"class":574},[561,4975,4944],{"class":578},[561,4977,2110],{"class":574},[561,4979,4980,4982,4984],{"class":563,"line":853},[561,4981,1006],{"class":574},[561,4983,961],{"class":578},[561,4985,4986],{"class":574},"{}\n",[551,4988,4991],{"className":553,"code":4989,"filename":4990,"language":556,"meta":557,"style":557},"import { Module } from \"@heximon\u002Fruntime\";\nimport { RecordShipmentHandler } from \".\u002Frecord-shipment.handler\";\nimport { ShipmentTracker } from \".\u002Fshipment-tracker.service\";\n\nexport class ShippingModule extends Module({\n  providers: [ShipmentTracker],\n  domain: { eventHandlers: [RecordShipmentHandler] }, \u002F\u002F the in-process domain-event tier\n  exports: [ShipmentTracker],\n}) {}\n","src\u002Fshipping\u002Fshipping.module.ts",[503,4992,4993,5013,5034,5054,5058,5075,5086,5109,5119],{"__ignoreMap":557},[561,4994,4995,4997,4999,5001,5003,5005,5007,5009,5011],{"class":563,"line":564},[561,4996,568],{"class":567},[561,4998,575],{"class":574},[561,5000,4859],{"class":578},[561,5002,582],{"class":574},[561,5004,585],{"class":567},[561,5006,588],{"class":574},[561,5008,4868],{"class":591},[561,5010,595],{"class":574},[561,5012,598],{"class":574},[561,5014,5015,5017,5019,5021,5023,5025,5027,5030,5032],{"class":563,"line":601},[561,5016,568],{"class":567},[561,5018,575],{"class":574},[561,5020,3447],{"class":578},[561,5022,582],{"class":574},[561,5024,585],{"class":567},[561,5026,588],{"class":574},[561,5028,5029],{"class":591},".\u002Frecord-shipment.handler",[561,5031,595],{"class":574},[561,5033,598],{"class":574},[561,5035,5036,5038,5040,5042,5044,5046,5048,5050,5052],{"class":563,"line":608},[561,5037,568],{"class":567},[561,5039,575],{"class":574},[561,5041,3421],{"class":578},[561,5043,582],{"class":574},[561,5045,585],{"class":567},[561,5047,588],{"class":574},[561,5049,3430],{"class":591},[561,5051,595],{"class":574},[561,5053,598],{"class":574},[561,5055,5056],{"class":563,"line":783},[561,5057,605],{"emptyLinePlaceholder":604},[561,5059,5060,5062,5064,5067,5069,5071,5073],{"class":563,"line":801},[561,5061,611],{"class":567},[561,5063,832],{"class":614},[561,5065,5066],{"class":617}," ShippingModule",[561,5068,838],{"class":614},[561,5070,4859],{"class":953},[561,5072,909],{"class":578},[561,5074,978],{"class":574},[561,5076,5077,5079,5081,5084],{"class":563,"line":816},[561,5078,4939],{"class":789},[561,5080,793],{"class":574},[561,5082,5083],{"class":578}," [ShipmentTracker]",[561,5085,2110],{"class":574},[561,5087,5088,5091,5093,5095,5098,5100,5103,5106],{"class":563,"line":822},[561,5089,5090],{"class":789},"  domain",[561,5092,793],{"class":574},[561,5094,575],{"class":574},[561,5096,5097],{"class":789}," eventHandlers",[561,5099,793],{"class":574},[561,5101,5102],{"class":578}," [RecordShipmentHandler] ",[561,5104,5105],{"class":574},"},",[561,5107,5108],{"class":2619}," \u002F\u002F the in-process domain-event tier\n",[561,5110,5111,5113,5115,5117],{"class":563,"line":827},[561,5112,4971],{"class":789},[561,5114,793],{"class":574},[561,5116,5083],{"class":578},[561,5118,2110],{"class":574},[561,5120,5121,5123,5125],{"class":563,"line":853},[561,5122,1006],{"class":574},[561,5124,961],{"class":578},[561,5126,4986],{"class":574},[551,5128,5131],{"className":553,"code":5129,"filename":5130,"language":556,"meta":557,"style":557},"import { Module } from \"@heximon\u002Fruntime\";\nimport { OrdersModule } from \".\u002Forders\u002Forders.module\";\nimport { ShippingModule } from \".\u002Fshipping\u002Fshipping.module\";\n\nexport class AppModule extends Module({\n  imports: [OrdersModule, ShippingModule],\n}) {}\n","src\u002Fapp.module.ts",[503,5132,5133,5153,5174,5195,5199,5216,5233],{"__ignoreMap":557},[561,5134,5135,5137,5139,5141,5143,5145,5147,5149,5151],{"class":563,"line":564},[561,5136,568],{"class":567},[561,5138,575],{"class":574},[561,5140,4859],{"class":578},[561,5142,582],{"class":574},[561,5144,585],{"class":567},[561,5146,588],{"class":574},[561,5148,4868],{"class":591},[561,5150,595],{"class":574},[561,5152,598],{"class":574},[561,5154,5155,5157,5159,5161,5163,5165,5167,5170,5172],{"class":563,"line":601},[561,5156,568],{"class":567},[561,5158,575],{"class":574},[561,5160,4926],{"class":578},[561,5162,582],{"class":574},[561,5164,585],{"class":567},[561,5166,588],{"class":574},[561,5168,5169],{"class":591},".\u002Forders\u002Forders.module",[561,5171,595],{"class":574},[561,5173,598],{"class":574},[561,5175,5176,5178,5180,5182,5184,5186,5188,5191,5193],{"class":563,"line":608},[561,5177,568],{"class":567},[561,5179,575],{"class":574},[561,5181,5066],{"class":578},[561,5183,582],{"class":574},[561,5185,585],{"class":567},[561,5187,588],{"class":574},[561,5189,5190],{"class":591},".\u002Fshipping\u002Fshipping.module",[561,5192,595],{"class":574},[561,5194,598],{"class":574},[561,5196,5197],{"class":563,"line":783},[561,5198,605],{"emptyLinePlaceholder":604},[561,5200,5201,5203,5205,5208,5210,5212,5214],{"class":563,"line":801},[561,5202,611],{"class":567},[561,5204,832],{"class":614},[561,5206,5207],{"class":617}," AppModule",[561,5209,838],{"class":614},[561,5211,4859],{"class":953},[561,5213,909],{"class":578},[561,5215,978],{"class":574},[561,5217,5218,5221,5223,5226,5228,5231],{"class":563,"line":816},[561,5219,5220],{"class":789},"  imports",[561,5222,793],{"class":574},[561,5224,5225],{"class":578}," [OrdersModule",[561,5227,631],{"class":574},[561,5229,5230],{"class":578}," ShippingModule]",[561,5232,2110],{"class":574},[561,5234,5235,5237,5239],{"class":563,"line":822},[561,5236,1006],{"class":574},[561,5238,961],{"class":578},[561,5240,4986],{"class":574},[499,5242,5243],{},"A typo'd sub-key is a TypeScript error, caught before you run.",[527,5245,5247],{"id":5246},"register-the-plugins","Register the plugins",[499,5249,5250,5251,5254,5255,5257,5258,5260],{},"Add ",[503,5252,5253],{},"DomainEventsPlugin"," alongside the HTTP plugin. It contributes the ",[503,5256,3594],{}," facade, wires\ndomain-event dispatch, and pulls in the event bus tier ",[503,5259,4605],{}," rides on for you.",[551,5262,5265],{"className":553,"code":5263,"filename":5264,"language":556,"meta":557,"style":557},"import { defineHeximonConfig } from \"@heximon\u002Fbuild\";\nimport { DomainEventsPlugin } from \"@heximon\u002Fdomain\u002Fcompiler\";\nimport { HttpPlugin } from \"@heximon\u002Fhttp\u002Fcompiler\";\n\nexport default defineHeximonConfig({ plugins: [new HttpPlugin(), new DomainEventsPlugin()] });\n","heximon.config.ts",[503,5266,5267,5289,5311,5333,5337],{"__ignoreMap":557},[561,5268,5269,5271,5273,5276,5278,5280,5282,5285,5287],{"class":563,"line":564},[561,5270,568],{"class":567},[561,5272,575],{"class":574},[561,5274,5275],{"class":578}," defineHeximonConfig",[561,5277,582],{"class":574},[561,5279,585],{"class":567},[561,5281,588],{"class":574},[561,5283,5284],{"class":591},"@heximon\u002Fbuild",[561,5286,595],{"class":574},[561,5288,598],{"class":574},[561,5290,5291,5293,5295,5298,5300,5302,5304,5307,5309],{"class":563,"line":601},[561,5292,568],{"class":567},[561,5294,575],{"class":574},[561,5296,5297],{"class":578}," DomainEventsPlugin",[561,5299,582],{"class":574},[561,5301,585],{"class":567},[561,5303,588],{"class":574},[561,5305,5306],{"class":591},"@heximon\u002Fdomain\u002Fcompiler",[561,5308,595],{"class":574},[561,5310,598],{"class":574},[561,5312,5313,5315,5317,5320,5322,5324,5326,5329,5331],{"class":563,"line":608},[561,5314,568],{"class":567},[561,5316,575],{"class":574},[561,5318,5319],{"class":578}," HttpPlugin",[561,5321,582],{"class":574},[561,5323,585],{"class":567},[561,5325,588],{"class":574},[561,5327,5328],{"class":591},"@heximon\u002Fhttp\u002Fcompiler",[561,5330,595],{"class":574},[561,5332,598],{"class":574},[561,5334,5335],{"class":563,"line":783},[561,5336,605],{"emptyLinePlaceholder":604},[561,5338,5339,5341,5344,5346,5348,5350,5353,5355,5357,5359,5361,5363,5365,5367,5369,5372,5374,5376],{"class":563,"line":801},[561,5340,611],{"class":567},[561,5342,5343],{"class":567}," default",[561,5345,5275],{"class":953},[561,5347,909],{"class":578},[561,5349,1105],{"class":574},[561,5351,5352],{"class":789}," plugins",[561,5354,793],{"class":574},[561,5356,2553],{"class":578},[561,5358,2604],{"class":574},[561,5360,5319],{"class":953},[561,5362,1159],{"class":578},[561,5364,631],{"class":574},[561,5366,987],{"class":574},[561,5368,5297],{"class":953},[561,5370,5371],{"class":578},"()] ",[561,5373,1006],{"class":574},[561,5375,1014],{"class":578},[561,5377,598],{"class":574},[499,5379,5380,5381,5384,5385,5388,5389,5391],{},"The ",[503,5382,5383],{},"heximon()"," plugin in ",[503,5386,5387],{},"vite.config.ts"," takes no arguments — it reads ",[503,5390,5264],{}," itself.",[527,5393,5395],{"id":5394},"run-it","Run it",[5397,5398,5399,5414,5429,5443],"code-group",{},[551,5400,5405],{"className":5401,"code":5402,"filename":5403,"language":5404,"meta":557,"style":557},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm dev\n","pnpm","bash",[503,5406,5407],{"__ignoreMap":557},[561,5408,5409,5411],{"class":563,"line":564},[561,5410,5403],{"class":617},[561,5412,5413],{"class":591}," dev\n",[551,5415,5418],{"className":5401,"code":5416,"filename":5417,"language":5404,"meta":557,"style":557},"npm run dev\n","npm",[503,5419,5420],{"__ignoreMap":557},[561,5421,5422,5424,5427],{"class":563,"line":564},[561,5423,5417],{"class":617},[561,5425,5426],{"class":591}," run",[561,5428,5413],{"class":591},[551,5430,5433],{"className":5401,"code":5431,"filename":5432,"language":5404,"meta":557,"style":557},"yarn run dev\n","yarn",[503,5434,5435],{"__ignoreMap":557},[561,5436,5437,5439,5441],{"class":563,"line":564},[561,5438,5432],{"class":617},[561,5440,5426],{"class":591},[561,5442,5413],{"class":591},[551,5444,5447],{"className":5401,"code":5445,"filename":5446,"language":5404,"meta":557,"style":557},"bun run dev\n","bun",[503,5448,5449],{"__ignoreMap":557},[561,5450,5451,5453,5455],{"class":563,"line":564},[561,5452,5446],{"class":617},[561,5454,5426],{"class":591},[561,5456,5413],{"class":591},[551,5458,5461],{"className":5401,"code":5459,"filename":5460,"language":5404,"meta":557,"style":557},"# create a draft order from one line\ncurl -s -X POST localhost:3000\u002Forders \\\n  -H 'content-type: application\u002Fjson' \\\n  -d '{\"items\":[{\"productId\":\"p1\",\"name\":\"Widget\",\"unitPriceCents\":500,\"currency\":\"EUR\",\"quantity\":2}]}'\n# → 201 { \"id\": \"...\", \"status\": \"Draft\" }\n\n# ship it → records OrderShippedDomainEvent → RecordShipmentHandler runs → shows up at GET \u002Fshipments\ncurl -s -X POST localhost:3000\u002Forders\u002F\u003Cid>\u002Fship\n# → 200 { \"id\": \"...\", \"status\": \"Shipped\" }\n\n# ship it again → CannotShipTwiceError → RFC 9457 problem response\ncurl -s -X POST localhost:3000\u002Forders\u002F\u003Cid>\u002Fship\n# → 409 application\u002Fproblem+json\n","terminal",[503,5462,5463,5468,5488,5504,5517,5522,5526,5531,5557,5562,5566,5571,5593],{"__ignoreMap":557},[561,5464,5465],{"class":563,"line":564},[561,5466,5467],{"class":2619},"# create a draft order from one line\n",[561,5469,5470,5473,5476,5479,5482,5485],{"class":563,"line":601},[561,5471,5472],{"class":617},"curl",[561,5474,5475],{"class":591}," -s",[561,5477,5478],{"class":591}," -X",[561,5480,5481],{"class":591}," POST",[561,5483,5484],{"class":591}," localhost:3000\u002Forders",[561,5486,5487],{"class":578}," \\\n",[561,5489,5490,5493,5496,5499,5502],{"class":563,"line":608},[561,5491,5492],{"class":591},"  -H",[561,5494,5495],{"class":574}," '",[561,5497,5498],{"class":591},"content-type: application\u002Fjson",[561,5500,5501],{"class":574},"'",[561,5503,5487],{"class":578},[561,5505,5506,5509,5511,5514],{"class":563,"line":783},[561,5507,5508],{"class":591},"  -d",[561,5510,5495],{"class":574},[561,5512,5513],{"class":591},"{\"items\":[{\"productId\":\"p1\",\"name\":\"Widget\",\"unitPriceCents\":500,\"currency\":\"EUR\",\"quantity\":2}]}",[561,5515,5516],{"class":574},"'\n",[561,5518,5519],{"class":563,"line":801},[561,5520,5521],{"class":2619},"# → 201 { \"id\": \"...\", \"status\": \"Draft\" }\n",[561,5523,5524],{"class":563,"line":816},[561,5525,605],{"emptyLinePlaceholder":604},[561,5527,5528],{"class":563,"line":822},[561,5529,5530],{"class":2619},"# ship it → records OrderShippedDomainEvent → RecordShipmentHandler runs → shows up at GET \u002Fshipments\n",[561,5532,5533,5535,5537,5539,5541,5544,5546,5549,5552,5554],{"class":563,"line":827},[561,5534,5472],{"class":617},[561,5536,5475],{"class":591},[561,5538,5478],{"class":591},[561,5540,5481],{"class":591},[561,5542,5543],{"class":591}," localhost:3000\u002Forders\u002F",[561,5545,626],{"class":574},[561,5547,5548],{"class":591},"i",[561,5550,5551],{"class":578},"d",[561,5553,848],{"class":574},[561,5555,5556],{"class":591},"\u002Fship\n",[561,5558,5559],{"class":563,"line":853},[561,5560,5561],{"class":2619},"# → 200 { \"id\": \"...\", \"status\": \"Shipped\" }\n",[561,5563,5564],{"class":563,"line":893},[561,5565,605],{"emptyLinePlaceholder":604},[561,5567,5568],{"class":563,"line":898},[561,5569,5570],{"class":2619},"# ship it again → CannotShipTwiceError → RFC 9457 problem response\n",[561,5572,5573,5575,5577,5579,5581,5583,5585,5587,5589,5591],{"class":563,"line":935},[561,5574,5472],{"class":617},[561,5576,5475],{"class":591},[561,5578,5478],{"class":591},[561,5580,5481],{"class":591},[561,5582,5543],{"class":591},[561,5584,626],{"class":574},[561,5586,5548],{"class":591},[561,5588,5551],{"class":578},[561,5590,848],{"class":574},[561,5592,5556],{"class":591},[561,5594,5595],{"class":563,"line":981},[561,5596,5597],{"class":2619},"# → 409 application\u002Fproblem+json\n",[527,5599,5601],{"id":5600},"pitfalls","Pitfalls",[5603,5604,5605,5625,5645,5654],"ul",{},[5606,5607,5608,5614,5615,5617,5618,5621,5622,5624],"li",{},[514,5609,5610,5611,5613],{},"Mutate ",[503,5612,1439],{}," directly — don't reassign the bag."," Dirty tracking diffs the live ",[503,5616,1439],{}," fields\nagainst a snapshot, so ",[503,5619,5620],{},"this.props.status = \"Shipped\""," is exactly right; replacing the whole ",[503,5623,1439],{},"\nobject defeats the diff.",[5606,5626,5627,5630,5631,726,5634,5637,5638,5641,5642,950],{},[514,5628,5629],{},"Always flush after saving."," Forget ",[503,5632,5633],{},"await domainEvents.emitFrom(order)",[503,5635,5636],{},"RecordShipmentHandler","\nnever runs and ",[503,5639,5640],{},"GET \u002Fshipments"," stays empty, with no error to tell you why. Make it the line right after\n",[503,5643,5644],{},"repository.save",[5606,5646,5647,1448,5650,5653],{},[514,5648,5649],{},"Read value objects through their accessors, never raw.",[503,5651,5652],{},"order.total().amountCents",", not the frozen\ninternal object — the internal value is an implementation detail; the accessor is the contract.",[5606,5655,5656,5659,5660,5662],{},[514,5657,5658],{},"Keep the contexts coupled only by the event."," A ",[503,5661,4605],{}," should depend on the event's\nflat payload, not the originating aggregate. Reach into the other context's providers and you've traded\nthe decoupling away.",[527,5664,5666],{"id":5665},"see-also","See also",[5603,5668,5669,5674,5680,5685,5690],{},[5606,5670,5671,5673],{},[1935,5672,228],{"href":229}," — the full set of DDD primitives behind this recipe: entities,\nvalue objects, aggregates, and the two event tiers.",[5606,5675,5676,5679],{},[1935,5677,5678],{"href":467},"Event-Driven Module"," — the three event tiers compared, including when to\nreach past domain events for a queue-backed integration event across a service boundary.",[5606,5681,5682,5684],{},[1935,5683,238],{"href":239}," — how a repository loads and saves an aggregate\nwhile keeping the domain persistence-agnostic.",[5606,5686,5687,5689],{},[1935,5688,453],{"href":454}," — map this aggregate to a Drizzle table and drive it through a\ntyped controller with real optimistic-concurrency saves.",[5606,5691,5692,5699,5700,5703,5704,5706,5707,5709],{},[1935,5693,5696],{"href":5694,"rel":5695},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fladder\u002FL06-ddd",[1939],[514,5697,5698],{},"the ladder's L06 — DDD","\n— the same aggregate-root + domain-event pattern this recipe builds (a ",[503,5701,5702],{},"User"," aggregate instead of\n",[503,5705,505],{},"), with an end-to-end test that creates a user, proves the decoupled onboarding context's\ncross-context fan-out, and asserts the optimistic-concurrency ",[503,5708,4630],{}," on a stale save.",[5711,5712,5713],"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 .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 .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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":557,"searchDepth":601,"depth":601,"links":5715},[5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727],{"id":529,"depth":601,"text":530},{"id":702,"depth":601,"text":703},{"id":1948,"depth":601,"text":1949},{"id":2155,"depth":601,"text":2156},{"id":3351,"depth":601,"text":3352},{"id":3583,"depth":601,"text":3584},{"id":4609,"depth":601,"text":4610},{"id":4825,"depth":601,"text":4826},{"id":5246,"depth":601,"text":5247},{"id":5394,"depth":601,"text":5395},{"id":5600,"depth":601,"text":5601},{"id":5665,"depth":601,"text":5666},"Model an Order aggregate root with branded ids, value objects, invariants, DomainEvent recording, DomainEvents.emitFrom flushing, and a cross-context DomainEventHandler.","md",null,{},{"icon":473},{"title":470,"description":5728},"m3NA9R3wsMSpHbaBdHJpuPwwwuA8zoNyr-2dacoLjbU",[5736,5738],{"title":466,"path":467,"stem":468,"description":5737,"icon":149,"children":-1},"Wire an event-driven module with EventBus, EventHandler and NotificationHandler, the events namespace, DomainEvents, and IntegrationEventHandler across the in-process, domain, and integration tiers.",{"title":475,"path":476,"stem":477,"description":5739,"icon":478,"children":-1},"Ship a feature as a precompiled, publishable Heximon module — build the factory and manifest with heximonLibrary(), require host tokens, then consume it in one import.",1783300761903]