[{"data":1,"prerenderedAt":8372},["ShallowReactive",2],{"navigation_docs":3,"-docs-essentials-drizzle":493,"-docs-essentials-drizzle-surround":8367},[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":82,"body":495,"description":8360,"extension":8361,"links":8362,"meta":8363,"navigation":8364,"path":83,"seo":8365,"stem":84,"__hash__":8366},"docs\u002Fdocs\u002F02.essentials\u002F07.drizzle.md",{"type":496,"value":497,"toc":8339},"minimark",[498,526,561,749,763,768,771,1027,1031,1041,1164,1175,1338,1381,1398,1546,1569,1915,1956,1984,2002,2006,2025,2046,2073,2288,2302,2320,2337,2350,2367,2501,2528,2532,2558,3004,3034,3038,3044,4160,4169,4205,4209,4215,4418,4421,4430,4613,4628,4733,4737,4767,5157,5168,5194,5200,5375,5379,5388,5993,6005,6009,6019,6086,6097,6101,6120,6147,6155,6159,6166,6207,6223,6295,6306,6590,6600,6738,6742,6748,6827,6846,6912,6916,6923,7099,7114,7123,7127,7143,7153,7303,7308,7350,7356,7365,7369,7383,7648,7660,7800,7808,7878,7887,7891,7899,8076,8089,8092,8114,8118,8132,8214,8218,8335],[499,500,501,502,505,506,510,511,514,515,518,519,514,522,525],"p",{},"Storing plain rows with a hand-written repository? Start at ",[503,504,77],"a",{"href":78}," —\nthis page is the deep end. Persist a modeled domain to a real database without writing a row mapper.\nDeclare which columns a ",[507,508,509],"code",{},"User"," maps to, extend a repository base, and you get ",[507,512,513],{},"save"," \u002F ",[507,516,517],{},"getById"," \u002F\n",[507,520,521],{},"getAll",[507,523,524],{},"delete"," — value objects packed into columns and back, optimistic concurrency guarding every\nupdate.",[499,527,528,529,534,535,539,540,539,543,546,547,550,551,539,554,546,557,560],{},"It runs on ",[503,530,82],{"href":531,"rel":532},"https:\u002F\u002Form.drizzle.team",[533],"nofollow",", one repository contract across seven dialects — four\nSQLite drivers (",[536,537,538],"strong",{},"libsql",", ",[536,541,542],{},"better-sqlite3",[536,544,545],{},"Cloudflare D1",", and ",[536,548,549],{},"Durable Object SQLite",") plus\n",[536,552,553],{},"node-postgres\u002FPostgreSQL",[536,555,556],{},"mysql2\u002FMySQL",[536,558,559],{},"mysql2 over Cloudflare Hyperdrive"," (a real-atomicity\nMySQL write path on Cloudflare Workers).",[562,563,569],"pre",{"className":564,"code":565,"filename":566,"language":567,"meta":568,"style":568},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { DrizzleLibSQLDatabase, DrizzleLibSQLEntityRepository } from \"@heximon\u002Fdrizzle\u002Flibsql\";\nimport { User } from \".\u002Fuser.entity\";\n\nexport class UserRepository extends DrizzleLibSQLEntityRepository\u003CDrizzleLibSQLDatabase, User> {\n  public constructor(database: DrizzleLibSQLDatabase) {\n    super(database, \"Users\", User); \u002F\u002F the database is the only injected dependency\n  }\n}\n","src\u002Fusers\u002Fuser.repository.ts","ts","",[507,570,571,613,636,643,678,704,737,743],{"__ignoreMap":568},[572,573,576,580,584,588,591,594,597,600,603,607,610],"span",{"class":574,"line":575},"line",1,[572,577,579],{"class":578},"s7zQu","import",[572,581,583],{"class":582},"sMK4o"," {",[572,585,587],{"class":586},"sTEyZ"," DrizzleLibSQLDatabase",[572,589,590],{"class":582},",",[572,592,593],{"class":586}," DrizzleLibSQLEntityRepository",[572,595,596],{"class":582}," }",[572,598,599],{"class":578}," from",[572,601,602],{"class":582}," \"",[572,604,606],{"class":605},"sfazB","@heximon\u002Fdrizzle\u002Flibsql",[572,608,609],{"class":582},"\"",[572,611,612],{"class":582},";\n",[572,614,616,618,620,623,625,627,629,632,634],{"class":574,"line":615},2,[572,617,579],{"class":578},[572,619,583],{"class":582},[572,621,622],{"class":586}," User",[572,624,596],{"class":582},[572,626,599],{"class":578},[572,628,602],{"class":582},[572,630,631],{"class":605},".\u002Fuser.entity",[572,633,609],{"class":582},[572,635,612],{"class":582},[572,637,639],{"class":574,"line":638},3,[572,640,642],{"emptyLinePlaceholder":641},true,"\n",[572,644,646,649,653,657,660,662,665,668,670,672,675],{"class":574,"line":645},4,[572,647,648],{"class":578},"export",[572,650,652],{"class":651},"spNyl"," class",[572,654,656],{"class":655},"sBMFI"," UserRepository",[572,658,659],{"class":651}," extends",[572,661,593],{"class":655},[572,663,664],{"class":582},"\u003C",[572,666,667],{"class":655},"DrizzleLibSQLDatabase",[572,669,590],{"class":582},[572,671,622],{"class":655},[572,673,674],{"class":582},">",[572,676,677],{"class":582}," {\n",[572,679,681,684,687,690,694,697,699,702],{"class":574,"line":680},5,[572,682,683],{"class":651},"  public",[572,685,686],{"class":651}," constructor",[572,688,689],{"class":582},"(",[572,691,693],{"class":692},"sHdIc","database",[572,695,696],{"class":582},":",[572,698,587],{"class":655},[572,700,701],{"class":582},")",[572,703,677],{"class":582},[572,705,707,710,713,715,717,719,722,724,726,728,730,733],{"class":574,"line":706},6,[572,708,709],{"class":586},"    super",[572,711,689],{"class":712},"swJcz",[572,714,693],{"class":586},[572,716,590],{"class":582},[572,718,602],{"class":582},[572,720,721],{"class":605},"Users",[572,723,609],{"class":582},[572,725,590],{"class":582},[572,727,622],{"class":586},[572,729,701],{"class":712},[572,731,732],{"class":582},";",[572,734,736],{"class":735},"sHwdD"," \u002F\u002F the database is the only injected dependency\n",[572,738,740],{"class":574,"line":739},7,[572,741,742],{"class":582},"  }\n",[572,744,746],{"class":574,"line":745},8,[572,747,748],{"class":582},"}\n",[499,750,751,752,754,755,758,759,762],{},"A ",[507,753,77],{}," is an ordinary ",[507,756,757],{},"useFactory"," provider and a repository is found by the base it ",[507,760,761],{},"extends"," — no\ncompiler plugin, no decorator.",[764,765,767],"h2",{"id":766},"install-the-dialect","Install the dialect",[499,769,770],{},"Add the package, Drizzle, and the driver for your dialect. The drivers are optional peers, so you pull in\nonly the one you need.",[772,773,774,870,949],"code-group",{},[562,775,780],{"className":776,"code":777,"filename":778,"language":779,"meta":568,"style":568},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add @heximon\u002Fdrizzle drizzle-orm\npnpm add @libsql\u002Fclient            # libsql \u002F SQLite (Node, Turso)\npnpm add better-sqlite3            # synchronous native Node SQLite\npnpm add @cloudflare\u002Fworkers-types # Cloudflare D1 + Durable Object SQLite (types only)\npnpm add pg                        # PostgreSQL\npnpm add mysql2                    # MySQL (Node) + Cloudflare Hyperdrive\npnpm add -D drizzle-kit            # typed config + migration generation\n","pnpm","bash",[507,781,782,795,807,819,831,843,855],{"__ignoreMap":568},[572,783,784,786,789,792],{"class":574,"line":575},[572,785,778],{"class":655},[572,787,788],{"class":605}," add",[572,790,791],{"class":605}," @heximon\u002Fdrizzle",[572,793,794],{"class":605}," drizzle-orm\n",[572,796,797,799,801,804],{"class":574,"line":615},[572,798,778],{"class":655},[572,800,788],{"class":605},[572,802,803],{"class":605}," @libsql\u002Fclient",[572,805,806],{"class":735},"            # libsql \u002F SQLite (Node, Turso)\n",[572,808,809,811,813,816],{"class":574,"line":638},[572,810,778],{"class":655},[572,812,788],{"class":605},[572,814,815],{"class":605}," better-sqlite3",[572,817,818],{"class":735},"            # synchronous native Node SQLite\n",[572,820,821,823,825,828],{"class":574,"line":645},[572,822,778],{"class":655},[572,824,788],{"class":605},[572,826,827],{"class":605}," @cloudflare\u002Fworkers-types",[572,829,830],{"class":735}," # Cloudflare D1 + Durable Object SQLite (types only)\n",[572,832,833,835,837,840],{"class":574,"line":680},[572,834,778],{"class":655},[572,836,788],{"class":605},[572,838,839],{"class":605}," pg",[572,841,842],{"class":735},"                        # PostgreSQL\n",[572,844,845,847,849,852],{"class":574,"line":706},[572,846,778],{"class":655},[572,848,788],{"class":605},[572,850,851],{"class":605}," mysql2",[572,853,854],{"class":735},"                    # MySQL (Node) + Cloudflare Hyperdrive\n",[572,856,857,859,861,864,867],{"class":574,"line":739},[572,858,778],{"class":655},[572,860,788],{"class":605},[572,862,863],{"class":605}," -D",[572,865,866],{"class":605}," drizzle-kit",[572,868,869],{"class":735},"            # typed config + migration generation\n",[562,871,874],{"className":776,"code":872,"filename":873,"language":779,"meta":568,"style":568},"npm install @heximon\u002Fdrizzle drizzle-orm\nnpm install @libsql\u002Fclient            # libsql \u002F SQLite (Node, Turso)\nnpm install better-sqlite3            # synchronous native Node SQLite\nnpm install @cloudflare\u002Fworkers-types # Cloudflare D1 + Durable Object SQLite (types only)\nnpm install pg                        # PostgreSQL\nnpm install mysql2                    # MySQL (Node) + Cloudflare Hyperdrive\nnpm install -D drizzle-kit            # typed config + migration generation\n","npm",[507,875,876,887,897,907,917,927,937],{"__ignoreMap":568},[572,877,878,880,883,885],{"class":574,"line":575},[572,879,873],{"class":655},[572,881,882],{"class":605}," install",[572,884,791],{"class":605},[572,886,794],{"class":605},[572,888,889,891,893,895],{"class":574,"line":615},[572,890,873],{"class":655},[572,892,882],{"class":605},[572,894,803],{"class":605},[572,896,806],{"class":735},[572,898,899,901,903,905],{"class":574,"line":638},[572,900,873],{"class":655},[572,902,882],{"class":605},[572,904,815],{"class":605},[572,906,818],{"class":735},[572,908,909,911,913,915],{"class":574,"line":645},[572,910,873],{"class":655},[572,912,882],{"class":605},[572,914,827],{"class":605},[572,916,830],{"class":735},[572,918,919,921,923,925],{"class":574,"line":680},[572,920,873],{"class":655},[572,922,882],{"class":605},[572,924,839],{"class":605},[572,926,842],{"class":735},[572,928,929,931,933,935],{"class":574,"line":706},[572,930,873],{"class":655},[572,932,882],{"class":605},[572,934,851],{"class":605},[572,936,854],{"class":735},[572,938,939,941,943,945,947],{"class":574,"line":739},[572,940,873],{"class":655},[572,942,882],{"class":605},[572,944,863],{"class":605},[572,946,866],{"class":605},[572,948,869],{"class":735},[562,950,953],{"className":776,"code":951,"filename":952,"language":779,"meta":568,"style":568},"bun add @heximon\u002Fdrizzle drizzle-orm\nbun add @libsql\u002Fclient            # libsql \u002F SQLite (Node, Turso)\nbun add better-sqlite3            # synchronous native Node SQLite\nbun add @cloudflare\u002Fworkers-types # Cloudflare D1 + Durable Object SQLite (types only)\nbun add pg                        # PostgreSQL\nbun add mysql2                    # MySQL (Node) + Cloudflare Hyperdrive\nbun add -D drizzle-kit            # typed config + migration generation\n","bun",[507,954,955,965,975,985,995,1005,1015],{"__ignoreMap":568},[572,956,957,959,961,963],{"class":574,"line":575},[572,958,952],{"class":655},[572,960,788],{"class":605},[572,962,791],{"class":605},[572,964,794],{"class":605},[572,966,967,969,971,973],{"class":574,"line":615},[572,968,952],{"class":655},[572,970,788],{"class":605},[572,972,803],{"class":605},[572,974,806],{"class":735},[572,976,977,979,981,983],{"class":574,"line":638},[572,978,952],{"class":655},[572,980,788],{"class":605},[572,982,815],{"class":605},[572,984,818],{"class":735},[572,986,987,989,991,993],{"class":574,"line":645},[572,988,952],{"class":655},[572,990,788],{"class":605},[572,992,827],{"class":605},[572,994,830],{"class":735},[572,996,997,999,1001,1003],{"class":574,"line":680},[572,998,952],{"class":655},[572,1000,788],{"class":605},[572,1002,839],{"class":605},[572,1004,842],{"class":735},[572,1006,1007,1009,1011,1013],{"class":574,"line":706},[572,1008,952],{"class":655},[572,1010,788],{"class":605},[572,1012,851],{"class":605},[572,1014,854],{"class":735},[572,1016,1017,1019,1021,1023,1025],{"class":574,"line":739},[572,1018,952],{"class":655},[572,1020,788],{"class":605},[572,1022,863],{"class":605},[572,1024,866],{"class":605},[572,1026,869],{"class":735},[764,1028,1030],{"id":1029},"choose-a-sqlite-driver","Choose a SQLite driver",[499,1032,1033,1034,1037,1038,1040],{},"Four drivers share the same ",[507,1035,1036],{},"sqlite-core"," schema DSL, repository base, and codecs — they differ only in how\nthe ",[507,1039,77],{}," connects and whether it has real transactions:",[1042,1043,1044,1064],"table",{},[1045,1046,1047],"thead",{},[1048,1049,1050,1054,1058,1061],"tr",{},[1051,1052,1053],"th",{},"Subpath",[1051,1055,1056,652],{},[507,1057,77],{},[1051,1059,1060],{},"Connection",[1051,1062,1063],{},"Transactions",[1065,1066,1067,1097,1122,1142],"tbody",{},[1048,1068,1069,1074,1078,1091],{},[1070,1071,1072],"td",{},[507,1073,606],{},[1070,1075,1076],{},[507,1077,667],{},[1070,1079,1080,1083,1084,514,1087,1090],{},[507,1081,1082],{},"url"," (",[507,1085,1086],{},"file:",[507,1088,1089],{},":memory:"," \u002F Turso)",[1070,1092,1093,1094],{},"real ",[507,1095,1096],{},"SAVEPOINT",[1048,1098,1099,1104,1109,1118],{},[1070,1100,1101],{},[507,1102,1103],{},"@heximon\u002Fdrizzle\u002Fbetter-sqlite3",[1070,1105,1106],{},[507,1107,1108],{},"DrizzleBetterSQLite3Database",[1070,1110,1111,1114,1115,1117],{},[507,1112,1113],{},"filename"," (path \u002F ",[507,1116,1089],{},"), synchronous",[1070,1119,1093,1120],{},[507,1121,1096],{},[1048,1123,1124,1129,1134,1137],{},[1070,1125,1126],{},[507,1127,1128],{},"@heximon\u002Fdrizzle\u002Fd1",[1070,1130,1131],{},[507,1132,1133],{},"DrizzleD1Database",[1070,1135,1136],{},"Cloudflare D1 binding",[1070,1138,1139],{},[536,1140,1141],{},"non-atomic",[1048,1143,1144,1149,1154,1160],{},[1070,1145,1146],{},[507,1147,1148],{},"@heximon\u002Fdrizzle\u002Fdurable-sqlite",[1070,1150,1151],{},[507,1152,1153],{},"DrizzleDurableSQLiteDatabase",[1070,1155,1156,1157],{},"Durable Object ",[507,1158,1159],{},"ctx.storage",[1070,1161,1162],{},[536,1163,1141],{},[499,1165,1166,1168,1169,1171,1172,1174],{},[507,1167,538],{}," and ",[507,1170,542],{}," are URL\u002Ffile connections — wire them exactly like the rest of this guide, just\nwith their own config (the better-sqlite3 connection field is ",[507,1173,1113],{},"):",[562,1176,1179],{"className":564,"code":1177,"filename":1178,"language":567,"meta":568,"style":568},"import { DrizzleBetterSQLite3Config } from \"@heximon\u002Fdrizzle\u002Fbetter-sqlite3\u002Fconfig\";\nimport { relations, schema } from \".\u002Fschema\";\n\nexport const databaseConfig = new DrizzleBetterSQLite3Config(schema, relations, {\n  dialect: \"sqlite\",\n  schema: \".\u002Fsrc\u002Fdatabase\u002Fschema.ts\",\n  out: \".\u002Fmigrations\",\n  filename: \":memory:\",\n});\n","src\u002Fdatabase\u002Fdatabase.config.ts",[507,1180,1181,1203,1230,1234,1264,1281,1297,1313,1328],{"__ignoreMap":568},[572,1182,1183,1185,1187,1190,1192,1194,1196,1199,1201],{"class":574,"line":575},[572,1184,579],{"class":578},[572,1186,583],{"class":582},[572,1188,1189],{"class":586}," DrizzleBetterSQLite3Config",[572,1191,596],{"class":582},[572,1193,599],{"class":578},[572,1195,602],{"class":582},[572,1197,1198],{"class":605},"@heximon\u002Fdrizzle\u002Fbetter-sqlite3\u002Fconfig",[572,1200,609],{"class":582},[572,1202,612],{"class":582},[572,1204,1205,1207,1209,1212,1214,1217,1219,1221,1223,1226,1228],{"class":574,"line":615},[572,1206,579],{"class":578},[572,1208,583],{"class":582},[572,1210,1211],{"class":586}," relations",[572,1213,590],{"class":582},[572,1215,1216],{"class":586}," schema",[572,1218,596],{"class":582},[572,1220,599],{"class":578},[572,1222,602],{"class":582},[572,1224,1225],{"class":605},".\u002Fschema",[572,1227,609],{"class":582},[572,1229,612],{"class":582},[572,1231,1232],{"class":574,"line":638},[572,1233,642],{"emptyLinePlaceholder":641},[572,1235,1236,1238,1241,1244,1247,1250,1253,1256,1258,1260,1262],{"class":574,"line":645},[572,1237,648],{"class":578},[572,1239,1240],{"class":651}," const",[572,1242,1243],{"class":586}," databaseConfig ",[572,1245,1246],{"class":582},"=",[572,1248,1249],{"class":582}," new",[572,1251,1189],{"class":1252},"s2Zo4",[572,1254,1255],{"class":586},"(schema",[572,1257,590],{"class":582},[572,1259,1211],{"class":586},[572,1261,590],{"class":582},[572,1263,677],{"class":582},[572,1265,1266,1269,1271,1273,1276,1278],{"class":574,"line":680},[572,1267,1268],{"class":712},"  dialect",[572,1270,696],{"class":582},[572,1272,602],{"class":582},[572,1274,1275],{"class":605},"sqlite",[572,1277,609],{"class":582},[572,1279,1280],{"class":582},",\n",[572,1282,1283,1286,1288,1290,1293,1295],{"class":574,"line":706},[572,1284,1285],{"class":712},"  schema",[572,1287,696],{"class":582},[572,1289,602],{"class":582},[572,1291,1292],{"class":605},".\u002Fsrc\u002Fdatabase\u002Fschema.ts",[572,1294,609],{"class":582},[572,1296,1280],{"class":582},[572,1298,1299,1302,1304,1306,1309,1311],{"class":574,"line":739},[572,1300,1301],{"class":712},"  out",[572,1303,696],{"class":582},[572,1305,602],{"class":582},[572,1307,1308],{"class":605},".\u002Fmigrations",[572,1310,609],{"class":582},[572,1312,1280],{"class":582},[572,1314,1315,1318,1320,1322,1324,1326],{"class":574,"line":745},[572,1316,1317],{"class":712},"  filename",[572,1319,696],{"class":582},[572,1321,602],{"class":582},[572,1323,1089],{"class":605},[572,1325,609],{"class":582},[572,1327,1280],{"class":582},[572,1329,1331,1334,1336],{"class":574,"line":1330},9,[572,1332,1333],{"class":582},"}",[572,1335,701],{"class":586},[572,1337,612],{"class":582},[1339,1340,1342,1345,1346,514,1348,1350,1351,1083,1354,1357,1358,1361,1362,1365,1366,1368,1369,1372,1373,1376,1377,1380],"callout",{"type":1341},"info",[536,1343,1344],{},"Local SQLite handles background pollers out of the box."," A single-file SQLite database has one writer, so\ntwo top-level transactions opened at once on the same connection would collide. The engine knows a local\n",[507,1347,538],{},[507,1349,542],{}," database is ",[536,1352,1353],{},"single-writer",[507,1355,1356],{},"database.isSingleWriter()",") and serializes its\ntop-level transactions automatically — so the durable tiers' background poll loops (the ",[507,1359,1360],{},"@heximon\u002Fsaga","\ntimers, the ",[507,1363,1364],{},"@heximon\u002Fqueue"," consumer, the transactional outbox relay) coexist with foreground request writes\nwith no app config and no \"stop the poller in tests\" workaround. ",[507,1367,542],{}," also opens the file in ",[536,1370,1371],{},"WAL","\nmode by default (readers run concurrently with the writer), and both drivers accept a ",[507,1374,1375],{},"busyTimeoutMs"," for\ncross-process lock contention. For multi-",[536,1378,1379],{},"process"," write concurrency, reach for Turso (remote libsql),\nPostgres, or MySQL — there the database server arbitrates and the in-process serialization is a no-op.",[499,1382,1383,1384,1386,1387,1390,1391,1394,1395,696],{},"The two ",[536,1385,307],{}," drivers connect by a platform binding, not a URL. ",[536,1388,1389],{},"D1"," carries the binding name in\nits config; the database resolves it lazily per request via ",[507,1392,1393],{},"Platform.binding",", so a singleton built at boot\nstill sees the per-request ",[507,1396,1397],{},"env",[562,1399,1401],{"className":564,"code":1400,"filename":1178,"language":567,"meta":568,"style":568},"import { DrizzleD1Config } from \"@heximon\u002Fdrizzle\u002Fd1\u002Fconfig\";\nimport { relations, schema } from \".\u002Fschema\";\n\nexport const databaseConfig = new DrizzleD1Config(schema, relations, {\n  dialect: \"sqlite\",\n  schema: \".\u002Fsrc\u002Fdatabase\u002Fschema.ts\",\n  out: \".\u002Fmigrations\",\n  binding: \"DB\", \u002F\u002F the D1 binding name, resolved at runtime via Platform.binding(\"DB\")\n});\n",[507,1402,1403,1425,1449,1453,1477,1491,1505,1519,1538],{"__ignoreMap":568},[572,1404,1405,1407,1409,1412,1414,1416,1418,1421,1423],{"class":574,"line":575},[572,1406,579],{"class":578},[572,1408,583],{"class":582},[572,1410,1411],{"class":586}," DrizzleD1Config",[572,1413,596],{"class":582},[572,1415,599],{"class":578},[572,1417,602],{"class":582},[572,1419,1420],{"class":605},"@heximon\u002Fdrizzle\u002Fd1\u002Fconfig",[572,1422,609],{"class":582},[572,1424,612],{"class":582},[572,1426,1427,1429,1431,1433,1435,1437,1439,1441,1443,1445,1447],{"class":574,"line":615},[572,1428,579],{"class":578},[572,1430,583],{"class":582},[572,1432,1211],{"class":586},[572,1434,590],{"class":582},[572,1436,1216],{"class":586},[572,1438,596],{"class":582},[572,1440,599],{"class":578},[572,1442,602],{"class":582},[572,1444,1225],{"class":605},[572,1446,609],{"class":582},[572,1448,612],{"class":582},[572,1450,1451],{"class":574,"line":638},[572,1452,642],{"emptyLinePlaceholder":641},[572,1454,1455,1457,1459,1461,1463,1465,1467,1469,1471,1473,1475],{"class":574,"line":645},[572,1456,648],{"class":578},[572,1458,1240],{"class":651},[572,1460,1243],{"class":586},[572,1462,1246],{"class":582},[572,1464,1249],{"class":582},[572,1466,1411],{"class":1252},[572,1468,1255],{"class":586},[572,1470,590],{"class":582},[572,1472,1211],{"class":586},[572,1474,590],{"class":582},[572,1476,677],{"class":582},[572,1478,1479,1481,1483,1485,1487,1489],{"class":574,"line":680},[572,1480,1268],{"class":712},[572,1482,696],{"class":582},[572,1484,602],{"class":582},[572,1486,1275],{"class":605},[572,1488,609],{"class":582},[572,1490,1280],{"class":582},[572,1492,1493,1495,1497,1499,1501,1503],{"class":574,"line":706},[572,1494,1285],{"class":712},[572,1496,696],{"class":582},[572,1498,602],{"class":582},[572,1500,1292],{"class":605},[572,1502,609],{"class":582},[572,1504,1280],{"class":582},[572,1506,1507,1509,1511,1513,1515,1517],{"class":574,"line":739},[572,1508,1301],{"class":712},[572,1510,696],{"class":582},[572,1512,602],{"class":582},[572,1514,1308],{"class":605},[572,1516,609],{"class":582},[572,1518,1280],{"class":582},[572,1520,1521,1524,1526,1528,1531,1533,1535],{"class":574,"line":745},[572,1522,1523],{"class":712},"  binding",[572,1525,696],{"class":582},[572,1527,602],{"class":582},[572,1529,1530],{"class":605},"DB",[572,1532,609],{"class":582},[572,1534,590],{"class":582},[572,1536,1537],{"class":735}," \u002F\u002F the D1 binding name, resolved at runtime via Platform.binding(\"DB\")\n",[572,1539,1540,1542,1544],{"class":574,"line":1330},[572,1541,1333],{"class":582},[572,1543,701],{"class":586},[572,1545,612],{"class":582},[499,1547,1548,1550,1551,1553,1554,1557,1558,1561,1562,1564,1565,1568],{},[536,1549,549],{}," is built from the DO's own ",[507,1552,1159],{},", injected as ",[507,1555,1556],{},"DurableContext",". The cast to\nthe Cloudflare ",[507,1559,1560],{},"DurableObjectStorage"," lives in a small helper, not inline in the ",[507,1563,757],{}," — the compiler\nemits a factory body ",[536,1566,1567],{},"verbatim"," into the generated JS wiring, so the body must hold no TypeScript-only\nsyntax (a type assertion would become invalid JavaScript there):",[562,1570,1573],{"className":564,"code":1571,"filename":1572,"language":567,"meta":568,"style":568},"import { type Context, Module } from \"@heximon\u002Fruntime\";\nimport type { DurableContext } from \"@heximon\u002Fdurable\";\nimport type { DurableObjectStorage } from \"@cloudflare\u002Fworkers-types\";\nimport { AppDatabase } from \".\u002Fapp-database\";\nimport { relations, schema } from \".\u002Fdatabase.config\";\n\n\u002F\u002F Defined outside the Module() config, so it is compiled as ordinary source (not inlined verbatim):\nfunction resolveStorage(durable: DurableContext): DurableObjectStorage {\n  return durable.storage as unknown as DurableObjectStorage;\n}\n\nexport class DatabaseModule extends Module({\n  providers: [\n    {\n      provide: AppDatabase,\n      useFactory: (durable: DurableContext, context: Context) =>\n        new AppDatabase(resolveStorage(durable), context, schema, relations),\n    },\n  ],\n  exports: [AppDatabase],\n}) {}\n","src\u002Fdatabase\u002Fdatabase.module.ts",[507,1574,1575,1605,1629,1653,1675,1700,1704,1709,1732,1758,1763,1768,1787,1798,1804,1816,1846,1877,1883,1891,1904],{"__ignoreMap":568},[572,1576,1577,1579,1581,1584,1587,1589,1592,1594,1596,1598,1601,1603],{"class":574,"line":575},[572,1578,579],{"class":578},[572,1580,583],{"class":582},[572,1582,1583],{"class":578}," type",[572,1585,1586],{"class":586}," Context",[572,1588,590],{"class":582},[572,1590,1591],{"class":586}," Module",[572,1593,596],{"class":582},[572,1595,599],{"class":578},[572,1597,602],{"class":582},[572,1599,1600],{"class":605},"@heximon\u002Fruntime",[572,1602,609],{"class":582},[572,1604,612],{"class":582},[572,1606,1607,1609,1611,1613,1616,1618,1620,1622,1625,1627],{"class":574,"line":615},[572,1608,579],{"class":578},[572,1610,1583],{"class":578},[572,1612,583],{"class":582},[572,1614,1615],{"class":586}," DurableContext",[572,1617,596],{"class":582},[572,1619,599],{"class":578},[572,1621,602],{"class":582},[572,1623,1624],{"class":605},"@heximon\u002Fdurable",[572,1626,609],{"class":582},[572,1628,612],{"class":582},[572,1630,1631,1633,1635,1637,1640,1642,1644,1646,1649,1651],{"class":574,"line":638},[572,1632,579],{"class":578},[572,1634,1583],{"class":578},[572,1636,583],{"class":582},[572,1638,1639],{"class":586}," DurableObjectStorage",[572,1641,596],{"class":582},[572,1643,599],{"class":578},[572,1645,602],{"class":582},[572,1647,1648],{"class":605},"@cloudflare\u002Fworkers-types",[572,1650,609],{"class":582},[572,1652,612],{"class":582},[572,1654,1655,1657,1659,1662,1664,1666,1668,1671,1673],{"class":574,"line":645},[572,1656,579],{"class":578},[572,1658,583],{"class":582},[572,1660,1661],{"class":586}," AppDatabase",[572,1663,596],{"class":582},[572,1665,599],{"class":578},[572,1667,602],{"class":582},[572,1669,1670],{"class":605},".\u002Fapp-database",[572,1672,609],{"class":582},[572,1674,612],{"class":582},[572,1676,1677,1679,1681,1683,1685,1687,1689,1691,1693,1696,1698],{"class":574,"line":680},[572,1678,579],{"class":578},[572,1680,583],{"class":582},[572,1682,1211],{"class":586},[572,1684,590],{"class":582},[572,1686,1216],{"class":586},[572,1688,596],{"class":582},[572,1690,599],{"class":578},[572,1692,602],{"class":582},[572,1694,1695],{"class":605},".\u002Fdatabase.config",[572,1697,609],{"class":582},[572,1699,612],{"class":582},[572,1701,1702],{"class":574,"line":706},[572,1703,642],{"emptyLinePlaceholder":641},[572,1705,1706],{"class":574,"line":739},[572,1707,1708],{"class":735},"\u002F\u002F Defined outside the Module() config, so it is compiled as ordinary source (not inlined verbatim):\n",[572,1710,1711,1714,1717,1719,1722,1724,1726,1728,1730],{"class":574,"line":745},[572,1712,1713],{"class":651},"function",[572,1715,1716],{"class":1252}," resolveStorage",[572,1718,689],{"class":582},[572,1720,1721],{"class":692},"durable",[572,1723,696],{"class":582},[572,1725,1615],{"class":655},[572,1727,1174],{"class":582},[572,1729,1639],{"class":655},[572,1731,677],{"class":582},[572,1733,1734,1737,1740,1743,1746,1749,1752,1754,1756],{"class":574,"line":1330},[572,1735,1736],{"class":578},"  return",[572,1738,1739],{"class":586}," durable",[572,1741,1742],{"class":582},".",[572,1744,1745],{"class":586},"storage",[572,1747,1748],{"class":578}," as",[572,1750,1751],{"class":655}," unknown",[572,1753,1748],{"class":578},[572,1755,1639],{"class":655},[572,1757,612],{"class":582},[572,1759,1761],{"class":574,"line":1760},10,[572,1762,748],{"class":582},[572,1764,1766],{"class":574,"line":1765},11,[572,1767,642],{"emptyLinePlaceholder":641},[572,1769,1771,1773,1775,1778,1780,1782,1784],{"class":574,"line":1770},12,[572,1772,648],{"class":578},[572,1774,652],{"class":651},[572,1776,1777],{"class":655}," DatabaseModule",[572,1779,659],{"class":651},[572,1781,1591],{"class":1252},[572,1783,689],{"class":586},[572,1785,1786],{"class":582},"{\n",[572,1788,1790,1793,1795],{"class":574,"line":1789},13,[572,1791,1792],{"class":712},"  providers",[572,1794,696],{"class":582},[572,1796,1797],{"class":586}," [\n",[572,1799,1801],{"class":574,"line":1800},14,[572,1802,1803],{"class":582},"    {\n",[572,1805,1807,1810,1812,1814],{"class":574,"line":1806},15,[572,1808,1809],{"class":712},"      provide",[572,1811,696],{"class":582},[572,1813,1661],{"class":586},[572,1815,1280],{"class":582},[572,1817,1819,1822,1824,1826,1828,1830,1832,1834,1837,1839,1841,1843],{"class":574,"line":1818},16,[572,1820,1821],{"class":1252},"      useFactory",[572,1823,696],{"class":582},[572,1825,1083],{"class":582},[572,1827,1721],{"class":692},[572,1829,696],{"class":582},[572,1831,1615],{"class":655},[572,1833,590],{"class":582},[572,1835,1836],{"class":692}," context",[572,1838,696],{"class":582},[572,1840,1586],{"class":655},[572,1842,701],{"class":582},[572,1844,1845],{"class":651}," =>\n",[572,1847,1849,1852,1854,1856,1859,1862,1864,1866,1868,1870,1872,1875],{"class":574,"line":1848},17,[572,1850,1851],{"class":582},"        new",[572,1853,1661],{"class":1252},[572,1855,689],{"class":586},[572,1857,1858],{"class":1252},"resolveStorage",[572,1860,1861],{"class":586},"(durable)",[572,1863,590],{"class":582},[572,1865,1836],{"class":586},[572,1867,590],{"class":582},[572,1869,1216],{"class":586},[572,1871,590],{"class":582},[572,1873,1874],{"class":586}," relations)",[572,1876,1280],{"class":582},[572,1878,1880],{"class":574,"line":1879},18,[572,1881,1882],{"class":582},"    },\n",[572,1884,1886,1889],{"class":574,"line":1885},19,[572,1887,1888],{"class":586},"  ]",[572,1890,1280],{"class":582},[572,1892,1894,1897,1899,1902],{"class":574,"line":1893},20,[572,1895,1896],{"class":712},"  exports",[572,1898,696],{"class":582},[572,1900,1901],{"class":586}," [AppDatabase]",[572,1903,1280],{"class":582},[572,1905,1907,1909,1912],{"class":574,"line":1906},21,[572,1908,1333],{"class":582},[572,1910,1911],{"class":586},") ",[572,1913,1914],{"class":582},"{}\n",[1339,1916,1918,1921,1922,1925,1926,1929,1930,1932,1933,1936,1937,1940,1941,1944,1945,1929,1948,1951,1952,1955],{"type":1917},"warning",[536,1919,1920],{},"D1 and Durable Object SQLite have no interactive transaction."," The D1 driver does not support\n",[507,1923,1924],{},".transaction()",", and the DO storage API forbids ",[507,1927,1928],{},"BEGIN","\u002F",[507,1931,1096],{}," (its only ",[507,1934,1935],{},"transactionSync"," is\nsynchronous and cannot wrap async work). So on these two drivers ",[507,1938,1939],{},"runInTransaction"," is ",[536,1942,1943],{},"best-effort and\nnon-atomic"," — every statement runs immediately on the bare connection, ",[507,1946,1947],{},"commit",[507,1949,1950],{},"rollback"," are no-ops, and a\nmid-flight failure leaves already-issued writes in place (the in-memory ",[507,1953,1954],{},"onRollback"," hooks still fire). Reach\nfor libsql or better-sqlite3 when you need real atomicity in SQLite.",[499,1957,1958,1959,1964,1965,1967,1968,1971,1972,1975,1976,1979,1980,1983],{},"The ",[503,1960,1963],{"href":1961,"rel":1962},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fflagship\u002Fapps\u002Fcloudflare",[533],"flagship Cloudflare app","\nruns its whole domain on the ",[536,1966,1389],{}," dialect and hosts its real-time layer on a Durable Object; the\n",[507,1969,1970],{},"durable-sqlite"," ",[536,1973,1974],{},"dialect"," itself is exercised by ",[507,1977,1978],{},"@heximon\u002Fdrizzle","'s own tests\n(",[507,1981,1982],{},"durable-sqlite-database.test.ts",") rather than a standalone example.",[499,1985,1986,1987,1994,1995,2001],{},"The libsql driver is the ladder's\n",[503,1988,1991],{"href":1989,"rel":1990},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fladder\u002FL04-database",[533],[507,1992,1993],{},"L04 — Database","; the flagship\nmonolith runs its whole domain on the ",[503,1996,1999],{"href":1997,"rel":1998},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fflagship\u002Fapps\u002Fmonolith",[533],[507,2000,542],{}," dialect.",[764,2003,2005],{"id":2004},"real-mysql-on-cloudflare-hyperdrive","Real MySQL on Cloudflare — Hyperdrive",[499,2007,2008,2011,2012,2020,2021,2024],{},[507,2009,2010],{},"@heximon\u002Fdrizzle\u002Fhyperdrive"," runs ",[536,2013,2014,2015],{},"mysql2 over ",[503,2016,2019],{"href":2017,"rel":2018},"https:\u002F\u002Fdevelopers.cloudflare.com\u002Fhyperdrive\u002F",[533],"Cloudflare Hyperdrive","\non Cloudflare Workers — a ",[536,2022,2023],{},"real-atomicity MySQL"," write path on the edge, unlike D1 and Durable Object SQLite,\nwhich are non-atomic.",[499,2026,2027,2030,2031,2034,2035,514,2037,514,2040,1168,2043,2045],{},[507,2028,2029],{},"DrizzleHyperdriveDatabase"," is a thin subclass of the Node ",[507,2032,2033],{},"DrizzleMySQL2Database",": it\ninherits the transaction\u002Fsavepoint engine, the pool-route override, and connection retry unchanged, so real\ninteractive ",[507,2036,1928],{},[507,2038,2039],{},"COMMIT",[507,2041,2042],{},"ROLLBACK",[507,2044,1096],{}," nesting work.",[499,2047,2048,2049,2052,2053,2056,2057,2060,2061,2064,2065,2068,2069,2072],{},"Three deltas make it edge-safe: a\nsmall ",[507,2050,2051],{},"mysql2"," pool is opened ",[536,2054,2055],{},"per request"," (stored on the request ",[507,2058,2059],{},"Context"," and torn down at request end via\n",[507,2062,2063],{},"waitUntil",", so one request can run queries in parallel); every statement uses the ",[536,2066,2067],{},"text protocol"," (Hyperdrive\nrejects binary prepared statements); and ",[507,2070,2071],{},"disableEval: true"," (workerd blocks mysql2's eval-based row parser).",[562,2074,2076],{"className":564,"code":2075,"filename":1178,"language":567,"meta":568,"style":568},"import { Platform } from \"@heximon\u002Fruntime\";\nimport { DrizzleHyperdriveConfig } from \"@heximon\u002Fdrizzle\u002Fhyperdrive\u002Fconfig\";\nimport { relations, schema } from \".\u002Fschema\";\n\nexport const databaseConfig = new DrizzleHyperdriveConfig(schema, relations, {\n  dialect: \"mysql\",\n  schema: \".\u002Fsrc\u002Fdatabase\u002Fschema.ts\",\n  out: \".\u002Fmigrations\",\n  binding: \"HYPERDRIVE\", \u002F\u002F the CF Hyperdrive binding, resolved at runtime via Platform.binding(\"HYPERDRIVE\")\n  localConnectionString: Platform.get(\"DATABASE_URL\"), \u002F\u002F dev \u002F CI \u002F migrations — used in preference to the binding\n  connectionLimit: 5, \u002F\u002F per-request pool size (default 5), bounding per-request query parallelism\n});\n",[507,2077,2078,2099,2121,2145,2149,2173,2188,2202,2216,2234,2264,2280],{"__ignoreMap":568},[572,2079,2080,2082,2084,2087,2089,2091,2093,2095,2097],{"class":574,"line":575},[572,2081,579],{"class":578},[572,2083,583],{"class":582},[572,2085,2086],{"class":586}," Platform",[572,2088,596],{"class":582},[572,2090,599],{"class":578},[572,2092,602],{"class":582},[572,2094,1600],{"class":605},[572,2096,609],{"class":582},[572,2098,612],{"class":582},[572,2100,2101,2103,2105,2108,2110,2112,2114,2117,2119],{"class":574,"line":615},[572,2102,579],{"class":578},[572,2104,583],{"class":582},[572,2106,2107],{"class":586}," DrizzleHyperdriveConfig",[572,2109,596],{"class":582},[572,2111,599],{"class":578},[572,2113,602],{"class":582},[572,2115,2116],{"class":605},"@heximon\u002Fdrizzle\u002Fhyperdrive\u002Fconfig",[572,2118,609],{"class":582},[572,2120,612],{"class":582},[572,2122,2123,2125,2127,2129,2131,2133,2135,2137,2139,2141,2143],{"class":574,"line":638},[572,2124,579],{"class":578},[572,2126,583],{"class":582},[572,2128,1211],{"class":586},[572,2130,590],{"class":582},[572,2132,1216],{"class":586},[572,2134,596],{"class":582},[572,2136,599],{"class":578},[572,2138,602],{"class":582},[572,2140,1225],{"class":605},[572,2142,609],{"class":582},[572,2144,612],{"class":582},[572,2146,2147],{"class":574,"line":645},[572,2148,642],{"emptyLinePlaceholder":641},[572,2150,2151,2153,2155,2157,2159,2161,2163,2165,2167,2169,2171],{"class":574,"line":680},[572,2152,648],{"class":578},[572,2154,1240],{"class":651},[572,2156,1243],{"class":586},[572,2158,1246],{"class":582},[572,2160,1249],{"class":582},[572,2162,2107],{"class":1252},[572,2164,1255],{"class":586},[572,2166,590],{"class":582},[572,2168,1211],{"class":586},[572,2170,590],{"class":582},[572,2172,677],{"class":582},[572,2174,2175,2177,2179,2181,2184,2186],{"class":574,"line":706},[572,2176,1268],{"class":712},[572,2178,696],{"class":582},[572,2180,602],{"class":582},[572,2182,2183],{"class":605},"mysql",[572,2185,609],{"class":582},[572,2187,1280],{"class":582},[572,2189,2190,2192,2194,2196,2198,2200],{"class":574,"line":739},[572,2191,1285],{"class":712},[572,2193,696],{"class":582},[572,2195,602],{"class":582},[572,2197,1292],{"class":605},[572,2199,609],{"class":582},[572,2201,1280],{"class":582},[572,2203,2204,2206,2208,2210,2212,2214],{"class":574,"line":745},[572,2205,1301],{"class":712},[572,2207,696],{"class":582},[572,2209,602],{"class":582},[572,2211,1308],{"class":605},[572,2213,609],{"class":582},[572,2215,1280],{"class":582},[572,2217,2218,2220,2222,2224,2227,2229,2231],{"class":574,"line":1330},[572,2219,1523],{"class":712},[572,2221,696],{"class":582},[572,2223,602],{"class":582},[572,2225,2226],{"class":605},"HYPERDRIVE",[572,2228,609],{"class":582},[572,2230,590],{"class":582},[572,2232,2233],{"class":735}," \u002F\u002F the CF Hyperdrive binding, resolved at runtime via Platform.binding(\"HYPERDRIVE\")\n",[572,2235,2236,2239,2241,2243,2245,2248,2250,2252,2255,2257,2259,2261],{"class":574,"line":1760},[572,2237,2238],{"class":712},"  localConnectionString",[572,2240,696],{"class":582},[572,2242,2086],{"class":586},[572,2244,1742],{"class":582},[572,2246,2247],{"class":1252},"get",[572,2249,689],{"class":586},[572,2251,609],{"class":582},[572,2253,2254],{"class":605},"DATABASE_URL",[572,2256,609],{"class":582},[572,2258,701],{"class":586},[572,2260,590],{"class":582},[572,2262,2263],{"class":735}," \u002F\u002F dev \u002F CI \u002F migrations — used in preference to the binding\n",[572,2265,2266,2269,2271,2275,2277],{"class":574,"line":1765},[572,2267,2268],{"class":712},"  connectionLimit",[572,2270,696],{"class":582},[572,2272,2274],{"class":2273},"sbssI"," 5",[572,2276,590],{"class":582},[572,2278,2279],{"class":735}," \u002F\u002F per-request pool size (default 5), bounding per-request query parallelism\n",[572,2281,2282,2284,2286],{"class":574,"line":1770},[572,2283,1333],{"class":582},[572,2285,701],{"class":586},[572,2287,612],{"class":582},[499,2289,2290,2293,2294,2297,2298,2301],{},[507,2291,2292],{},"binding"," names the Cloudflare Hyperdrive binding, resolved lazily via ",[507,2295,2296],{},"Platform.binding(\"HYPERDRIVE\")"," at\nrequest time. ",[507,2299,2300],{},"localConnectionString"," is the direct database URL used in preference to the binding when set — on\nNode (CI, migrations, an in-process test) the dialect connects through it directly, since Node has no Hyperdrive\nbinding to fall back to.",[499,2303,2304,2307,2308,2311,2312,2315,2316,2319],{},[507,2305,2306],{},"vp dev"," runs a ",[507,2309,2310],{},"CloudflareWorkersStrategy"," app in real workerd, not Node, so this\n",[507,2313,2314],{},"Platform.get(\"DATABASE_URL\")"," read evaluates to ",[507,2317,2318],{},"undefined"," there and the dialect falls back to the binding.",[499,2321,2322,2323,2326,2327,2330,2331,2333,2334,2336],{},"Dev reaches the database instead through ",[507,2324,2325],{},"heximon.config.ts","'s ",[507,2328,2329],{},"cloudflare.hyperdrive[].localConnectionString","\n(a separate field, on the Cloudflare config, not the dialect config), which makes ",[507,2332,2306],{}," provision the\n",[507,2335,2226],{}," binding against that database directly.",[499,2338,2339,2342,2343,2346,2347,2349],{},[507,2340,2341],{},"DrizzleHyperdriveMigrationRunner"," is Node\u002FCI-only and runs\nmigrations ",[536,2344,2345],{},"direct"," off the dialect's ",[507,2348,2300],{}," (Hyperdrive is a pooler, so DDL goes direct); it\nnever runs at edge boot, where Workers have no filesystem.",[499,2351,2352,2353,2356,2357,1280,2360,2363,2364,696],{},"The schema, value objects, repository, and codecs are the ",[536,2354,2355],{},"MySQL"," ones (",[507,2358,2359],{},"DrizzleMySQLEntity.define",[507,2361,2362],{},"@heximon\u002Fdrizzle\u002Fmysql-core",") — Hyperdrive carries only the connection difference. A repository extends the\nre-typed ",[507,2365,2366],{},"DrizzleHyperdriveEntityRepository",[562,2368,2371],{"className":564,"code":2369,"filename":2370,"language":567,"meta":568,"style":568},"import { DrizzleHyperdriveDatabase, DrizzleHyperdriveEntityRepository } from \"@heximon\u002Fdrizzle\u002Fhyperdrive\";\nimport { Task } from \".\u002Ftask.entity\";\n\nexport class TaskRepository extends DrizzleHyperdriveEntityRepository\u003CDrizzleHyperdriveDatabase, Task> {\n  public constructor(database: DrizzleHyperdriveDatabase) {\n    super(database, \"Tasks\", Task);\n  }\n}\n","src\u002Ftasks\u002Ftask.repository.ts",[507,2372,2373,2399,2421,2425,2450,2468,2493,2497],{"__ignoreMap":568},[572,2374,2375,2377,2379,2382,2384,2387,2389,2391,2393,2395,2397],{"class":574,"line":575},[572,2376,579],{"class":578},[572,2378,583],{"class":582},[572,2380,2381],{"class":586}," DrizzleHyperdriveDatabase",[572,2383,590],{"class":582},[572,2385,2386],{"class":586}," DrizzleHyperdriveEntityRepository",[572,2388,596],{"class":582},[572,2390,599],{"class":578},[572,2392,602],{"class":582},[572,2394,2010],{"class":605},[572,2396,609],{"class":582},[572,2398,612],{"class":582},[572,2400,2401,2403,2405,2408,2410,2412,2414,2417,2419],{"class":574,"line":615},[572,2402,579],{"class":578},[572,2404,583],{"class":582},[572,2406,2407],{"class":586}," Task",[572,2409,596],{"class":582},[572,2411,599],{"class":578},[572,2413,602],{"class":582},[572,2415,2416],{"class":605},".\u002Ftask.entity",[572,2418,609],{"class":582},[572,2420,612],{"class":582},[572,2422,2423],{"class":574,"line":638},[572,2424,642],{"emptyLinePlaceholder":641},[572,2426,2427,2429,2431,2434,2436,2438,2440,2442,2444,2446,2448],{"class":574,"line":645},[572,2428,648],{"class":578},[572,2430,652],{"class":651},[572,2432,2433],{"class":655}," TaskRepository",[572,2435,659],{"class":651},[572,2437,2386],{"class":655},[572,2439,664],{"class":582},[572,2441,2029],{"class":655},[572,2443,590],{"class":582},[572,2445,2407],{"class":655},[572,2447,674],{"class":582},[572,2449,677],{"class":582},[572,2451,2452,2454,2456,2458,2460,2462,2464,2466],{"class":574,"line":680},[572,2453,683],{"class":651},[572,2455,686],{"class":651},[572,2457,689],{"class":582},[572,2459,693],{"class":692},[572,2461,696],{"class":582},[572,2463,2381],{"class":655},[572,2465,701],{"class":582},[572,2467,677],{"class":582},[572,2469,2470,2472,2474,2476,2478,2480,2483,2485,2487,2489,2491],{"class":574,"line":706},[572,2471,709],{"class":586},[572,2473,689],{"class":712},[572,2475,693],{"class":586},[572,2477,590],{"class":582},[572,2479,602],{"class":582},[572,2481,2482],{"class":605},"Tasks",[572,2484,609],{"class":582},[572,2486,590],{"class":582},[572,2488,2407],{"class":586},[572,2490,701],{"class":712},[572,2492,612],{"class":582},[572,2494,2495],{"class":574,"line":739},[572,2496,742],{"class":582},[572,2498,2499],{"class":574,"line":745},[572,2500,748],{"class":582},[499,2502,2503,2505,2506,2509,2510,2513,2514,2517,2518,2521,2522,2527],{},[507,2504,2325],{}," declares the binding and its Hyperdrive configuration id so ",[507,2507,2508],{},"CloudflarePlugin"," emits the\n",[507,2511,2512],{},"hyperdrive"," stanza into ",[507,2515,2516],{},"wrangler.json","; the Worker also needs ",[507,2519,2520],{},"compatibility_flags: [\"nodejs_compat\"]",". The\nrunnable example is the ",[503,2523,2526],{"href":2524,"rel":2525},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fflagship\u002Fapps\u002Fcloudflare-mysql",[533],"flagship cloudflare-mysql app",",\nwhich runs its whole domain on the Hyperdrive\u002FMySQL dialect.",[764,2529,2531],{"id":2530},"start-from-a-domain-entity","Start from a domain entity",[499,2533,2534,2535,2537,2538,2541,2542,539,2545,539,2548,2551,2552,2555,2556,1742],{},"A schema needs an entity first. A ",[507,2536,509],{}," extends ",[507,2539,2540],{},"AggregateRoot",", which gives it framework-owned identity\nand metadata — ",[507,2543,2544],{},"id",[507,2546,2547],{},"createdAt",[507,2549,2550],{},"updatedAt",", the ",[507,2553,2554],{},"version"," counter — plus the dirty tracking the\nrepository reads at ",[507,2557,513],{},[562,2559,2562],{"className":564,"code":2560,"filename":2561,"language":567,"meta":568,"style":568},"import type { Branded } from \"@heximon\u002Fprimitives\";\nimport { AggregateRoot } from \"@heximon\u002Fdomain\";\nimport { Email } from \".\u002Femail.value\";\n\nexport type UserId = Branded\u003Cstring, \"UserId\">;\n\ninterface UserProps extends Record\u003Cstring, unknown> {\n  name: string;\n  email: Email; \u002F\u002F a value object at the domain edge, not a raw string\n}\n\nexport class User extends AggregateRoot\u003CUserProps, UserId> {\n  public static create(id: UserId, props: { name: string; email: string }): User {\n    return new User(id, { name: props.name, email: Email.create(props.email) });\n  }\n\n  public get name(): string {\n    return this.props.name;\n  }\n\n  public get email(): Email {\n    return this.props.email;\n  }\n\n  public rename(name: string): void {\n    this.props.name = name; \u002F\u002F mutating props is what flips the entity dirty\n  }\n}\n","src\u002Fusers\u002Fuser.entity.ts",[507,2563,2564,2588,2610,2632,2636,2667,2671,2696,2708,2722,2726,2730,2755,2805,2864,2868,2872,2888,2903,2907,2911,2925,2940,2945,2950,2973,2994,2999],{"__ignoreMap":568},[572,2565,2566,2568,2570,2572,2575,2577,2579,2581,2584,2586],{"class":574,"line":575},[572,2567,579],{"class":578},[572,2569,1583],{"class":578},[572,2571,583],{"class":582},[572,2573,2574],{"class":586}," Branded",[572,2576,596],{"class":582},[572,2578,599],{"class":578},[572,2580,602],{"class":582},[572,2582,2583],{"class":605},"@heximon\u002Fprimitives",[572,2585,609],{"class":582},[572,2587,612],{"class":582},[572,2589,2590,2592,2594,2597,2599,2601,2603,2606,2608],{"class":574,"line":615},[572,2591,579],{"class":578},[572,2593,583],{"class":582},[572,2595,2596],{"class":586}," AggregateRoot",[572,2598,596],{"class":582},[572,2600,599],{"class":578},[572,2602,602],{"class":582},[572,2604,2605],{"class":605},"@heximon\u002Fdomain",[572,2607,609],{"class":582},[572,2609,612],{"class":582},[572,2611,2612,2614,2616,2619,2621,2623,2625,2628,2630],{"class":574,"line":638},[572,2613,579],{"class":578},[572,2615,583],{"class":582},[572,2617,2618],{"class":586}," Email",[572,2620,596],{"class":582},[572,2622,599],{"class":578},[572,2624,602],{"class":582},[572,2626,2627],{"class":605},".\u002Femail.value",[572,2629,609],{"class":582},[572,2631,612],{"class":582},[572,2633,2634],{"class":574,"line":645},[572,2635,642],{"emptyLinePlaceholder":641},[572,2637,2638,2640,2642,2645,2648,2650,2652,2655,2657,2659,2662,2664],{"class":574,"line":680},[572,2639,648],{"class":578},[572,2641,1583],{"class":651},[572,2643,2644],{"class":655}," UserId",[572,2646,2647],{"class":582}," =",[572,2649,2574],{"class":655},[572,2651,664],{"class":582},[572,2653,2654],{"class":655},"string",[572,2656,590],{"class":582},[572,2658,602],{"class":582},[572,2660,2661],{"class":605},"UserId",[572,2663,609],{"class":582},[572,2665,2666],{"class":582},">;\n",[572,2668,2669],{"class":574,"line":706},[572,2670,642],{"emptyLinePlaceholder":641},[572,2672,2673,2676,2679,2681,2684,2686,2688,2690,2692,2694],{"class":574,"line":739},[572,2674,2675],{"class":651},"interface",[572,2677,2678],{"class":655}," UserProps",[572,2680,659],{"class":651},[572,2682,2683],{"class":655}," Record",[572,2685,664],{"class":582},[572,2687,2654],{"class":655},[572,2689,590],{"class":582},[572,2691,1751],{"class":655},[572,2693,674],{"class":582},[572,2695,677],{"class":582},[572,2697,2698,2701,2703,2706],{"class":574,"line":745},[572,2699,2700],{"class":712},"  name",[572,2702,696],{"class":582},[572,2704,2705],{"class":655}," string",[572,2707,612],{"class":582},[572,2709,2710,2713,2715,2717,2719],{"class":574,"line":1330},[572,2711,2712],{"class":712},"  email",[572,2714,696],{"class":582},[572,2716,2618],{"class":655},[572,2718,732],{"class":582},[572,2720,2721],{"class":735}," \u002F\u002F a value object at the domain edge, not a raw string\n",[572,2723,2724],{"class":574,"line":1760},[572,2725,748],{"class":582},[572,2727,2728],{"class":574,"line":1765},[572,2729,642],{"emptyLinePlaceholder":641},[572,2731,2732,2734,2736,2738,2740,2742,2744,2747,2749,2751,2753],{"class":574,"line":1770},[572,2733,648],{"class":578},[572,2735,652],{"class":651},[572,2737,622],{"class":655},[572,2739,659],{"class":651},[572,2741,2596],{"class":655},[572,2743,664],{"class":582},[572,2745,2746],{"class":655},"UserProps",[572,2748,590],{"class":582},[572,2750,2644],{"class":655},[572,2752,674],{"class":582},[572,2754,677],{"class":582},[572,2756,2757,2759,2762,2765,2767,2769,2771,2773,2775,2778,2780,2782,2785,2787,2789,2791,2794,2796,2798,2801,2803],{"class":574,"line":1789},[572,2758,683],{"class":651},[572,2760,2761],{"class":651}," static",[572,2763,2764],{"class":712}," create",[572,2766,689],{"class":582},[572,2768,2544],{"class":692},[572,2770,696],{"class":582},[572,2772,2644],{"class":655},[572,2774,590],{"class":582},[572,2776,2777],{"class":692}," props",[572,2779,696],{"class":582},[572,2781,583],{"class":582},[572,2783,2784],{"class":712}," name",[572,2786,696],{"class":582},[572,2788,2705],{"class":655},[572,2790,732],{"class":582},[572,2792,2793],{"class":712}," email",[572,2795,696],{"class":582},[572,2797,2705],{"class":655},[572,2799,2800],{"class":582}," }):",[572,2802,622],{"class":655},[572,2804,677],{"class":582},[572,2806,2807,2810,2812,2814,2816,2818,2820,2822,2824,2826,2828,2830,2833,2835,2837,2839,2841,2843,2846,2848,2851,2853,2856,2858,2860,2862],{"class":574,"line":1800},[572,2808,2809],{"class":578},"    return",[572,2811,1249],{"class":582},[572,2813,622],{"class":1252},[572,2815,689],{"class":712},[572,2817,2544],{"class":586},[572,2819,590],{"class":582},[572,2821,583],{"class":582},[572,2823,2784],{"class":712},[572,2825,696],{"class":582},[572,2827,2777],{"class":586},[572,2829,1742],{"class":582},[572,2831,2832],{"class":586},"name",[572,2834,590],{"class":582},[572,2836,2793],{"class":712},[572,2838,696],{"class":582},[572,2840,2618],{"class":586},[572,2842,1742],{"class":582},[572,2844,2845],{"class":1252},"create",[572,2847,689],{"class":712},[572,2849,2850],{"class":586},"props",[572,2852,1742],{"class":582},[572,2854,2855],{"class":586},"email",[572,2857,1911],{"class":712},[572,2859,1333],{"class":582},[572,2861,701],{"class":712},[572,2863,612],{"class":582},[572,2865,2866],{"class":574,"line":1806},[572,2867,742],{"class":582},[572,2869,2870],{"class":574,"line":1818},[572,2871,642],{"emptyLinePlaceholder":641},[572,2873,2874,2876,2879,2881,2884,2886],{"class":574,"line":1848},[572,2875,683],{"class":651},[572,2877,2878],{"class":651}," get",[572,2880,2784],{"class":712},[572,2882,2883],{"class":582},"():",[572,2885,2705],{"class":655},[572,2887,677],{"class":582},[572,2889,2890,2892,2895,2897,2899,2901],{"class":574,"line":1879},[572,2891,2809],{"class":578},[572,2893,2894],{"class":582}," this.",[572,2896,2850],{"class":586},[572,2898,1742],{"class":582},[572,2900,2832],{"class":586},[572,2902,612],{"class":582},[572,2904,2905],{"class":574,"line":1885},[572,2906,742],{"class":582},[572,2908,2909],{"class":574,"line":1893},[572,2910,642],{"emptyLinePlaceholder":641},[572,2912,2913,2915,2917,2919,2921,2923],{"class":574,"line":1906},[572,2914,683],{"class":651},[572,2916,2878],{"class":651},[572,2918,2793],{"class":712},[572,2920,2883],{"class":582},[572,2922,2618],{"class":655},[572,2924,677],{"class":582},[572,2926,2928,2930,2932,2934,2936,2938],{"class":574,"line":2927},22,[572,2929,2809],{"class":578},[572,2931,2894],{"class":582},[572,2933,2850],{"class":586},[572,2935,1742],{"class":582},[572,2937,2855],{"class":586},[572,2939,612],{"class":582},[572,2941,2943],{"class":574,"line":2942},23,[572,2944,742],{"class":582},[572,2946,2948],{"class":574,"line":2947},24,[572,2949,642],{"emptyLinePlaceholder":641},[572,2951,2953,2955,2958,2960,2962,2964,2966,2968,2971],{"class":574,"line":2952},25,[572,2954,683],{"class":651},[572,2956,2957],{"class":712}," rename",[572,2959,689],{"class":582},[572,2961,2832],{"class":692},[572,2963,696],{"class":582},[572,2965,2705],{"class":655},[572,2967,1174],{"class":582},[572,2969,2970],{"class":655}," void",[572,2972,677],{"class":582},[572,2974,2976,2979,2981,2983,2985,2987,2989,2991],{"class":574,"line":2975},26,[572,2977,2978],{"class":582},"    this.",[572,2980,2850],{"class":586},[572,2982,1742],{"class":582},[572,2984,2832],{"class":586},[572,2986,2647],{"class":582},[572,2988,2784],{"class":586},[572,2990,732],{"class":582},[572,2992,2993],{"class":735}," \u002F\u002F mutating props is what flips the entity dirty\n",[572,2995,2997],{"class":574,"line":2996},27,[572,2998,742],{"class":582},[572,3000,3002],{"class":574,"line":3001},28,[572,3003,748],{"class":582},[499,3005,3006,3007,3010,3011,3013,3014,3017,3018,3021,3022,3024,3025,539,3028,546,3030,3033],{},"Mutating ",[507,3008,3009],{},"this.props"," flips the entity dirty; the next ",[507,3012,513],{}," diffs live props against the load-time\nsnapshot, marks a real change for ",[507,3015,3016],{},"UPDATE",", and you never call ",[507,3019,3020],{},"markModified()",". The\n",[503,3023,228],{"href":229}," page covers ",[507,3026,3027],{},"Entity",[507,3029,2540],{},[507,3031,3032],{},"ValueObject"," in full.",[764,3035,3037],{"id":3036},"define-the-table","Define the table",[499,3039,3040,3043],{},[507,3041,3042],{},"Drizzle\u003CDialect>Entity.define(EntityClass, \"tableName\", columns)"," bridges a domain class to a real Drizzle\ntable, with no codegen and no hand-written mapper. Pick the static for your dialect:",[772,3045,3046,3426,3780],{},[562,3047,3050],{"className":564,"code":3048,"filename":3049,"language":567,"meta":568,"style":568},"import { dateObject, DrizzleSQLiteEntity, valueObject } from \"@heximon\u002Fdrizzle\u002Fsqlite-core\";\nimport { integer, text } from \"drizzle-orm\u002Fsqlite-core\";\nimport { Email } from \".\u002Femail.value\";\nimport { User, type UserId } from \".\u002Fuser.entity\";\n\nexport const Users = DrizzleSQLiteEntity.define(User, \"users\", {\n  id: text(\"id\").notNull().primaryKey().$type\u003CUserId>(),\n  createdAt: dateObject(\"created_at\").notNull(),\n  updatedAt: dateObject(\"updated_at\").notNull(),\n  version: integer(\"version\").notNull().default(1),\n  name: text(\"name\").notNull(),\n  email: valueObject(Email, { address: text(\"email_address\").notNull().unique() }),\n});\n","SQLite \u002F libsql",[507,3051,3052,3084,3111,3131,3157,3161,3195,3244,3272,3300,3339,3365,3418],{"__ignoreMap":568},[572,3053,3054,3056,3058,3061,3063,3066,3068,3071,3073,3075,3077,3080,3082],{"class":574,"line":575},[572,3055,579],{"class":578},[572,3057,583],{"class":582},[572,3059,3060],{"class":586}," dateObject",[572,3062,590],{"class":582},[572,3064,3065],{"class":586}," DrizzleSQLiteEntity",[572,3067,590],{"class":582},[572,3069,3070],{"class":586}," valueObject",[572,3072,596],{"class":582},[572,3074,599],{"class":578},[572,3076,602],{"class":582},[572,3078,3079],{"class":605},"@heximon\u002Fdrizzle\u002Fsqlite-core",[572,3081,609],{"class":582},[572,3083,612],{"class":582},[572,3085,3086,3088,3090,3093,3095,3098,3100,3102,3104,3107,3109],{"class":574,"line":615},[572,3087,579],{"class":578},[572,3089,583],{"class":582},[572,3091,3092],{"class":586}," integer",[572,3094,590],{"class":582},[572,3096,3097],{"class":586}," text",[572,3099,596],{"class":582},[572,3101,599],{"class":578},[572,3103,602],{"class":582},[572,3105,3106],{"class":605},"drizzle-orm\u002Fsqlite-core",[572,3108,609],{"class":582},[572,3110,612],{"class":582},[572,3112,3113,3115,3117,3119,3121,3123,3125,3127,3129],{"class":574,"line":638},[572,3114,579],{"class":578},[572,3116,583],{"class":582},[572,3118,2618],{"class":586},[572,3120,596],{"class":582},[572,3122,599],{"class":578},[572,3124,602],{"class":582},[572,3126,2627],{"class":605},[572,3128,609],{"class":582},[572,3130,612],{"class":582},[572,3132,3133,3135,3137,3139,3141,3143,3145,3147,3149,3151,3153,3155],{"class":574,"line":645},[572,3134,579],{"class":578},[572,3136,583],{"class":582},[572,3138,622],{"class":586},[572,3140,590],{"class":582},[572,3142,1583],{"class":578},[572,3144,2644],{"class":586},[572,3146,596],{"class":582},[572,3148,599],{"class":578},[572,3150,602],{"class":582},[572,3152,631],{"class":605},[572,3154,609],{"class":582},[572,3156,612],{"class":582},[572,3158,3159],{"class":574,"line":680},[572,3160,642],{"emptyLinePlaceholder":641},[572,3162,3163,3165,3167,3170,3172,3174,3176,3179,3182,3184,3186,3189,3191,3193],{"class":574,"line":706},[572,3164,648],{"class":578},[572,3166,1240],{"class":651},[572,3168,3169],{"class":586}," Users ",[572,3171,1246],{"class":582},[572,3173,3065],{"class":586},[572,3175,1742],{"class":582},[572,3177,3178],{"class":1252},"define",[572,3180,3181],{"class":586},"(User",[572,3183,590],{"class":582},[572,3185,602],{"class":582},[572,3187,3188],{"class":605},"users",[572,3190,609],{"class":582},[572,3192,590],{"class":582},[572,3194,677],{"class":582},[572,3196,3197,3200,3202,3204,3206,3208,3210,3212,3214,3216,3219,3222,3224,3227,3229,3231,3234,3236,3238,3240,3242],{"class":574,"line":739},[572,3198,3199],{"class":712},"  id",[572,3201,696],{"class":582},[572,3203,3097],{"class":1252},[572,3205,689],{"class":586},[572,3207,609],{"class":582},[572,3209,2544],{"class":605},[572,3211,609],{"class":582},[572,3213,701],{"class":586},[572,3215,1742],{"class":582},[572,3217,3218],{"class":1252},"notNull",[572,3220,3221],{"class":586},"()",[572,3223,1742],{"class":582},[572,3225,3226],{"class":1252},"primaryKey",[572,3228,3221],{"class":586},[572,3230,1742],{"class":582},[572,3232,3233],{"class":1252},"$type",[572,3235,664],{"class":582},[572,3237,2661],{"class":655},[572,3239,674],{"class":582},[572,3241,3221],{"class":586},[572,3243,1280],{"class":582},[572,3245,3246,3249,3251,3253,3255,3257,3260,3262,3264,3266,3268,3270],{"class":574,"line":745},[572,3247,3248],{"class":712},"  createdAt",[572,3250,696],{"class":582},[572,3252,3060],{"class":1252},[572,3254,689],{"class":586},[572,3256,609],{"class":582},[572,3258,3259],{"class":605},"created_at",[572,3261,609],{"class":582},[572,3263,701],{"class":586},[572,3265,1742],{"class":582},[572,3267,3218],{"class":1252},[572,3269,3221],{"class":586},[572,3271,1280],{"class":582},[572,3273,3274,3277,3279,3281,3283,3285,3288,3290,3292,3294,3296,3298],{"class":574,"line":1330},[572,3275,3276],{"class":712},"  updatedAt",[572,3278,696],{"class":582},[572,3280,3060],{"class":1252},[572,3282,689],{"class":586},[572,3284,609],{"class":582},[572,3286,3287],{"class":605},"updated_at",[572,3289,609],{"class":582},[572,3291,701],{"class":586},[572,3293,1742],{"class":582},[572,3295,3218],{"class":1252},[572,3297,3221],{"class":586},[572,3299,1280],{"class":582},[572,3301,3302,3305,3307,3309,3311,3313,3315,3317,3319,3321,3323,3325,3327,3330,3332,3335,3337],{"class":574,"line":1760},[572,3303,3304],{"class":712},"  version",[572,3306,696],{"class":582},[572,3308,3092],{"class":1252},[572,3310,689],{"class":586},[572,3312,609],{"class":582},[572,3314,2554],{"class":605},[572,3316,609],{"class":582},[572,3318,701],{"class":586},[572,3320,1742],{"class":582},[572,3322,3218],{"class":1252},[572,3324,3221],{"class":586},[572,3326,1742],{"class":582},[572,3328,3329],{"class":1252},"default",[572,3331,689],{"class":586},[572,3333,3334],{"class":2273},"1",[572,3336,701],{"class":586},[572,3338,1280],{"class":582},[572,3340,3341,3343,3345,3347,3349,3351,3353,3355,3357,3359,3361,3363],{"class":574,"line":1765},[572,3342,2700],{"class":712},[572,3344,696],{"class":582},[572,3346,3097],{"class":1252},[572,3348,689],{"class":586},[572,3350,609],{"class":582},[572,3352,2832],{"class":605},[572,3354,609],{"class":582},[572,3356,701],{"class":586},[572,3358,1742],{"class":582},[572,3360,3218],{"class":1252},[572,3362,3221],{"class":586},[572,3364,1280],{"class":582},[572,3366,3367,3369,3371,3373,3376,3378,3380,3383,3385,3387,3389,3391,3394,3396,3398,3400,3402,3404,3406,3409,3412,3414,3416],{"class":574,"line":1770},[572,3368,2712],{"class":712},[572,3370,696],{"class":582},[572,3372,3070],{"class":1252},[572,3374,3375],{"class":586},"(Email",[572,3377,590],{"class":582},[572,3379,583],{"class":582},[572,3381,3382],{"class":712}," address",[572,3384,696],{"class":582},[572,3386,3097],{"class":1252},[572,3388,689],{"class":586},[572,3390,609],{"class":582},[572,3392,3393],{"class":605},"email_address",[572,3395,609],{"class":582},[572,3397,701],{"class":586},[572,3399,1742],{"class":582},[572,3401,3218],{"class":1252},[572,3403,3221],{"class":586},[572,3405,1742],{"class":582},[572,3407,3408],{"class":1252},"unique",[572,3410,3411],{"class":586},"() ",[572,3413,1333],{"class":582},[572,3415,701],{"class":586},[572,3417,1280],{"class":582},[572,3419,3420,3422,3424],{"class":574,"line":1789},[572,3421,1333],{"class":582},[572,3423,701],{"class":586},[572,3425,612],{"class":582},[562,3427,3430],{"className":564,"code":3428,"filename":3429,"language":567,"meta":568,"style":568},"import { dateObject, DrizzlePgEntity, uuid, valueObject } from \"@heximon\u002Fdrizzle\u002Fpg-core\";\nimport { integer, text } from \"drizzle-orm\u002Fpg-core\";\nimport { Email } from \".\u002Femail.value\";\nimport { User, type UserId } from \".\u002Fuser.entity\";\n\nexport const Users = DrizzlePgEntity.define(User, \"users\", {\n  id: uuid(\"id\").primaryKey().$type\u003CUserId>(),\n  createdAt: dateObject(\"created_at\").notNull(),\n  updatedAt: dateObject(\"updated_at\").notNull(),\n  version: integer(\"version\").notNull().default(1),\n  name: text(\"name\").notNull(),\n  email: valueObject(Email, { address: text(\"email_address\").notNull().unique() }),\n});\n","PostgreSQL",[507,3431,3432,3467,3492,3512,3538,3542,3572,3610,3636,3662,3698,3724,3772],{"__ignoreMap":568},[572,3433,3434,3436,3438,3440,3442,3445,3447,3450,3452,3454,3456,3458,3460,3463,3465],{"class":574,"line":575},[572,3435,579],{"class":578},[572,3437,583],{"class":582},[572,3439,3060],{"class":586},[572,3441,590],{"class":582},[572,3443,3444],{"class":586}," DrizzlePgEntity",[572,3446,590],{"class":582},[572,3448,3449],{"class":586}," uuid",[572,3451,590],{"class":582},[572,3453,3070],{"class":586},[572,3455,596],{"class":582},[572,3457,599],{"class":578},[572,3459,602],{"class":582},[572,3461,3462],{"class":605},"@heximon\u002Fdrizzle\u002Fpg-core",[572,3464,609],{"class":582},[572,3466,612],{"class":582},[572,3468,3469,3471,3473,3475,3477,3479,3481,3483,3485,3488,3490],{"class":574,"line":615},[572,3470,579],{"class":578},[572,3472,583],{"class":582},[572,3474,3092],{"class":586},[572,3476,590],{"class":582},[572,3478,3097],{"class":586},[572,3480,596],{"class":582},[572,3482,599],{"class":578},[572,3484,602],{"class":582},[572,3486,3487],{"class":605},"drizzle-orm\u002Fpg-core",[572,3489,609],{"class":582},[572,3491,612],{"class":582},[572,3493,3494,3496,3498,3500,3502,3504,3506,3508,3510],{"class":574,"line":638},[572,3495,579],{"class":578},[572,3497,583],{"class":582},[572,3499,2618],{"class":586},[572,3501,596],{"class":582},[572,3503,599],{"class":578},[572,3505,602],{"class":582},[572,3507,2627],{"class":605},[572,3509,609],{"class":582},[572,3511,612],{"class":582},[572,3513,3514,3516,3518,3520,3522,3524,3526,3528,3530,3532,3534,3536],{"class":574,"line":645},[572,3515,579],{"class":578},[572,3517,583],{"class":582},[572,3519,622],{"class":586},[572,3521,590],{"class":582},[572,3523,1583],{"class":578},[572,3525,2644],{"class":586},[572,3527,596],{"class":582},[572,3529,599],{"class":578},[572,3531,602],{"class":582},[572,3533,631],{"class":605},[572,3535,609],{"class":582},[572,3537,612],{"class":582},[572,3539,3540],{"class":574,"line":680},[572,3541,642],{"emptyLinePlaceholder":641},[572,3543,3544,3546,3548,3550,3552,3554,3556,3558,3560,3562,3564,3566,3568,3570],{"class":574,"line":706},[572,3545,648],{"class":578},[572,3547,1240],{"class":651},[572,3549,3169],{"class":586},[572,3551,1246],{"class":582},[572,3553,3444],{"class":586},[572,3555,1742],{"class":582},[572,3557,3178],{"class":1252},[572,3559,3181],{"class":586},[572,3561,590],{"class":582},[572,3563,602],{"class":582},[572,3565,3188],{"class":605},[572,3567,609],{"class":582},[572,3569,590],{"class":582},[572,3571,677],{"class":582},[572,3573,3574,3576,3578,3580,3582,3584,3586,3588,3590,3592,3594,3596,3598,3600,3602,3604,3606,3608],{"class":574,"line":739},[572,3575,3199],{"class":712},[572,3577,696],{"class":582},[572,3579,3449],{"class":1252},[572,3581,689],{"class":586},[572,3583,609],{"class":582},[572,3585,2544],{"class":605},[572,3587,609],{"class":582},[572,3589,701],{"class":586},[572,3591,1742],{"class":582},[572,3593,3226],{"class":1252},[572,3595,3221],{"class":586},[572,3597,1742],{"class":582},[572,3599,3233],{"class":1252},[572,3601,664],{"class":582},[572,3603,2661],{"class":655},[572,3605,674],{"class":582},[572,3607,3221],{"class":586},[572,3609,1280],{"class":582},[572,3611,3612,3614,3616,3618,3620,3622,3624,3626,3628,3630,3632,3634],{"class":574,"line":745},[572,3613,3248],{"class":712},[572,3615,696],{"class":582},[572,3617,3060],{"class":1252},[572,3619,689],{"class":586},[572,3621,609],{"class":582},[572,3623,3259],{"class":605},[572,3625,609],{"class":582},[572,3627,701],{"class":586},[572,3629,1742],{"class":582},[572,3631,3218],{"class":1252},[572,3633,3221],{"class":586},[572,3635,1280],{"class":582},[572,3637,3638,3640,3642,3644,3646,3648,3650,3652,3654,3656,3658,3660],{"class":574,"line":1330},[572,3639,3276],{"class":712},[572,3641,696],{"class":582},[572,3643,3060],{"class":1252},[572,3645,689],{"class":586},[572,3647,609],{"class":582},[572,3649,3287],{"class":605},[572,3651,609],{"class":582},[572,3653,701],{"class":586},[572,3655,1742],{"class":582},[572,3657,3218],{"class":1252},[572,3659,3221],{"class":586},[572,3661,1280],{"class":582},[572,3663,3664,3666,3668,3670,3672,3674,3676,3678,3680,3682,3684,3686,3688,3690,3692,3694,3696],{"class":574,"line":1760},[572,3665,3304],{"class":712},[572,3667,696],{"class":582},[572,3669,3092],{"class":1252},[572,3671,689],{"class":586},[572,3673,609],{"class":582},[572,3675,2554],{"class":605},[572,3677,609],{"class":582},[572,3679,701],{"class":586},[572,3681,1742],{"class":582},[572,3683,3218],{"class":1252},[572,3685,3221],{"class":586},[572,3687,1742],{"class":582},[572,3689,3329],{"class":1252},[572,3691,689],{"class":586},[572,3693,3334],{"class":2273},[572,3695,701],{"class":586},[572,3697,1280],{"class":582},[572,3699,3700,3702,3704,3706,3708,3710,3712,3714,3716,3718,3720,3722],{"class":574,"line":1765},[572,3701,2700],{"class":712},[572,3703,696],{"class":582},[572,3705,3097],{"class":1252},[572,3707,689],{"class":586},[572,3709,609],{"class":582},[572,3711,2832],{"class":605},[572,3713,609],{"class":582},[572,3715,701],{"class":586},[572,3717,1742],{"class":582},[572,3719,3218],{"class":1252},[572,3721,3221],{"class":586},[572,3723,1280],{"class":582},[572,3725,3726,3728,3730,3732,3734,3736,3738,3740,3742,3744,3746,3748,3750,3752,3754,3756,3758,3760,3762,3764,3766,3768,3770],{"class":574,"line":1770},[572,3727,2712],{"class":712},[572,3729,696],{"class":582},[572,3731,3070],{"class":1252},[572,3733,3375],{"class":586},[572,3735,590],{"class":582},[572,3737,583],{"class":582},[572,3739,3382],{"class":712},[572,3741,696],{"class":582},[572,3743,3097],{"class":1252},[572,3745,689],{"class":586},[572,3747,609],{"class":582},[572,3749,3393],{"class":605},[572,3751,609],{"class":582},[572,3753,701],{"class":586},[572,3755,1742],{"class":582},[572,3757,3218],{"class":1252},[572,3759,3221],{"class":586},[572,3761,1742],{"class":582},[572,3763,3408],{"class":1252},[572,3765,3411],{"class":586},[572,3767,1333],{"class":582},[572,3769,701],{"class":586},[572,3771,1280],{"class":582},[572,3773,3774,3776,3778],{"class":574,"line":1789},[572,3775,1333],{"class":582},[572,3777,701],{"class":586},[572,3779,612],{"class":582},[562,3781,3783],{"className":564,"code":3782,"filename":2355,"language":567,"meta":568,"style":568},"import { binaryUuid, dateObject, DrizzleMySQLEntity, valueObject } from \"@heximon\u002Fdrizzle\u002Fmysql-core\";\nimport { int, varchar } from \"drizzle-orm\u002Fmysql-core\";\nimport { Email } from \".\u002Femail.value\";\nimport { User, type UserId } from \".\u002Fuser.entity\";\n\nexport const Users = DrizzleMySQLEntity.define(User, \"users\", {\n  id: binaryUuid(\"id\").primaryKey().$type\u003CUserId>(),\n  createdAt: dateObject(\"created_at\").notNull(),\n  updatedAt: dateObject(\"updated_at\").notNull(),\n  version: int(\"version\").notNull().default(1),\n  name: varchar(\"name\", { length: 255 }).notNull(),\n  email: valueObject(Email, { address: varchar(\"email_address\", { length: 255 }).notNull().unique() }),\n});\n",[507,3784,3785,3819,3846,3866,3892,3896,3926,3964,3990,4016,4052,4092,4152],{"__ignoreMap":568},[572,3786,3787,3789,3791,3794,3796,3798,3800,3803,3805,3807,3809,3811,3813,3815,3817],{"class":574,"line":575},[572,3788,579],{"class":578},[572,3790,583],{"class":582},[572,3792,3793],{"class":586}," binaryUuid",[572,3795,590],{"class":582},[572,3797,3060],{"class":586},[572,3799,590],{"class":582},[572,3801,3802],{"class":586}," DrizzleMySQLEntity",[572,3804,590],{"class":582},[572,3806,3070],{"class":586},[572,3808,596],{"class":582},[572,3810,599],{"class":578},[572,3812,602],{"class":582},[572,3814,2362],{"class":605},[572,3816,609],{"class":582},[572,3818,612],{"class":582},[572,3820,3821,3823,3825,3828,3830,3833,3835,3837,3839,3842,3844],{"class":574,"line":615},[572,3822,579],{"class":578},[572,3824,583],{"class":582},[572,3826,3827],{"class":586}," int",[572,3829,590],{"class":582},[572,3831,3832],{"class":586}," varchar",[572,3834,596],{"class":582},[572,3836,599],{"class":578},[572,3838,602],{"class":582},[572,3840,3841],{"class":605},"drizzle-orm\u002Fmysql-core",[572,3843,609],{"class":582},[572,3845,612],{"class":582},[572,3847,3848,3850,3852,3854,3856,3858,3860,3862,3864],{"class":574,"line":638},[572,3849,579],{"class":578},[572,3851,583],{"class":582},[572,3853,2618],{"class":586},[572,3855,596],{"class":582},[572,3857,599],{"class":578},[572,3859,602],{"class":582},[572,3861,2627],{"class":605},[572,3863,609],{"class":582},[572,3865,612],{"class":582},[572,3867,3868,3870,3872,3874,3876,3878,3880,3882,3884,3886,3888,3890],{"class":574,"line":645},[572,3869,579],{"class":578},[572,3871,583],{"class":582},[572,3873,622],{"class":586},[572,3875,590],{"class":582},[572,3877,1583],{"class":578},[572,3879,2644],{"class":586},[572,3881,596],{"class":582},[572,3883,599],{"class":578},[572,3885,602],{"class":582},[572,3887,631],{"class":605},[572,3889,609],{"class":582},[572,3891,612],{"class":582},[572,3893,3894],{"class":574,"line":680},[572,3895,642],{"emptyLinePlaceholder":641},[572,3897,3898,3900,3902,3904,3906,3908,3910,3912,3914,3916,3918,3920,3922,3924],{"class":574,"line":706},[572,3899,648],{"class":578},[572,3901,1240],{"class":651},[572,3903,3169],{"class":586},[572,3905,1246],{"class":582},[572,3907,3802],{"class":586},[572,3909,1742],{"class":582},[572,3911,3178],{"class":1252},[572,3913,3181],{"class":586},[572,3915,590],{"class":582},[572,3917,602],{"class":582},[572,3919,3188],{"class":605},[572,3921,609],{"class":582},[572,3923,590],{"class":582},[572,3925,677],{"class":582},[572,3927,3928,3930,3932,3934,3936,3938,3940,3942,3944,3946,3948,3950,3952,3954,3956,3958,3960,3962],{"class":574,"line":739},[572,3929,3199],{"class":712},[572,3931,696],{"class":582},[572,3933,3793],{"class":1252},[572,3935,689],{"class":586},[572,3937,609],{"class":582},[572,3939,2544],{"class":605},[572,3941,609],{"class":582},[572,3943,701],{"class":586},[572,3945,1742],{"class":582},[572,3947,3226],{"class":1252},[572,3949,3221],{"class":586},[572,3951,1742],{"class":582},[572,3953,3233],{"class":1252},[572,3955,664],{"class":582},[572,3957,2661],{"class":655},[572,3959,674],{"class":582},[572,3961,3221],{"class":586},[572,3963,1280],{"class":582},[572,3965,3966,3968,3970,3972,3974,3976,3978,3980,3982,3984,3986,3988],{"class":574,"line":745},[572,3967,3248],{"class":712},[572,3969,696],{"class":582},[572,3971,3060],{"class":1252},[572,3973,689],{"class":586},[572,3975,609],{"class":582},[572,3977,3259],{"class":605},[572,3979,609],{"class":582},[572,3981,701],{"class":586},[572,3983,1742],{"class":582},[572,3985,3218],{"class":1252},[572,3987,3221],{"class":586},[572,3989,1280],{"class":582},[572,3991,3992,3994,3996,3998,4000,4002,4004,4006,4008,4010,4012,4014],{"class":574,"line":1330},[572,3993,3276],{"class":712},[572,3995,696],{"class":582},[572,3997,3060],{"class":1252},[572,3999,689],{"class":586},[572,4001,609],{"class":582},[572,4003,3287],{"class":605},[572,4005,609],{"class":582},[572,4007,701],{"class":586},[572,4009,1742],{"class":582},[572,4011,3218],{"class":1252},[572,4013,3221],{"class":586},[572,4015,1280],{"class":582},[572,4017,4018,4020,4022,4024,4026,4028,4030,4032,4034,4036,4038,4040,4042,4044,4046,4048,4050],{"class":574,"line":1760},[572,4019,3304],{"class":712},[572,4021,696],{"class":582},[572,4023,3827],{"class":1252},[572,4025,689],{"class":586},[572,4027,609],{"class":582},[572,4029,2554],{"class":605},[572,4031,609],{"class":582},[572,4033,701],{"class":586},[572,4035,1742],{"class":582},[572,4037,3218],{"class":1252},[572,4039,3221],{"class":586},[572,4041,1742],{"class":582},[572,4043,3329],{"class":1252},[572,4045,689],{"class":586},[572,4047,3334],{"class":2273},[572,4049,701],{"class":586},[572,4051,1280],{"class":582},[572,4053,4054,4056,4058,4060,4062,4064,4066,4068,4070,4072,4075,4077,4080,4082,4084,4086,4088,4090],{"class":574,"line":1765},[572,4055,2700],{"class":712},[572,4057,696],{"class":582},[572,4059,3832],{"class":1252},[572,4061,689],{"class":586},[572,4063,609],{"class":582},[572,4065,2832],{"class":605},[572,4067,609],{"class":582},[572,4069,590],{"class":582},[572,4071,583],{"class":582},[572,4073,4074],{"class":712}," length",[572,4076,696],{"class":582},[572,4078,4079],{"class":2273}," 255",[572,4081,596],{"class":582},[572,4083,701],{"class":586},[572,4085,1742],{"class":582},[572,4087,3218],{"class":1252},[572,4089,3221],{"class":586},[572,4091,1280],{"class":582},[572,4093,4094,4096,4098,4100,4102,4104,4106,4108,4110,4112,4114,4116,4118,4120,4122,4124,4126,4128,4130,4132,4134,4136,4138,4140,4142,4144,4146,4148,4150],{"class":574,"line":1770},[572,4095,2712],{"class":712},[572,4097,696],{"class":582},[572,4099,3070],{"class":1252},[572,4101,3375],{"class":586},[572,4103,590],{"class":582},[572,4105,583],{"class":582},[572,4107,3382],{"class":712},[572,4109,696],{"class":582},[572,4111,3832],{"class":1252},[572,4113,689],{"class":586},[572,4115,609],{"class":582},[572,4117,3393],{"class":605},[572,4119,609],{"class":582},[572,4121,590],{"class":582},[572,4123,583],{"class":582},[572,4125,4074],{"class":712},[572,4127,696],{"class":582},[572,4129,4079],{"class":2273},[572,4131,596],{"class":582},[572,4133,701],{"class":586},[572,4135,1742],{"class":582},[572,4137,3218],{"class":1252},[572,4139,3221],{"class":586},[572,4141,1742],{"class":582},[572,4143,3408],{"class":1252},[572,4145,3411],{"class":586},[572,4147,1333],{"class":582},[572,4149,701],{"class":586},[572,4151,1280],{"class":582},[572,4153,4154,4156,4158],{"class":574,"line":1789},[572,4155,1333],{"class":582},[572,4157,701],{"class":586},[572,4159,612],{"class":582},[499,4161,4162,4163,4165,4166,4168],{},"Three columns carry weight. ",[507,4164,3178],{}," requires ",[507,4167,2554],{}," at the type level — it's the optimistic-concurrency\ncounter, and without it concurrency control would be silently off.",[499,4170,4171,4174,4175,4177,4178,4180,4181,4183,4184,4187,4188,4191,4192,539,4195,539,4198,4201,4202,1742],{},[507,4172,4173],{},".$type\u003CUserId>()"," types a row's ",[507,4176,2544],{}," as the branded ",[507,4179,2661],{},", not a bare ",[507,4182,2654],{},". And ",[507,4185,4186],{},"dateObject"," is a\nHeximon codec (one per dialect) that round-trips a JS ",[507,4189,4190],{},"Date"," to its native column type; the plain helpers\n(",[507,4193,4194],{},"text",[507,4196,4197],{},"integer",[507,4199,4200],{},"varchar",") come straight from ",[507,4203,4204],{},"drizzle-orm\u002F\u003Cdialect>-core",[764,4206,4208],{"id":4207},"pack-a-value-object-into-columns","Pack a value object into columns",[499,4210,4211,4212,696],{},"A value object isn't a scalar, so the schema has to say how it lands in the table. Given an ",[507,4213,4214],{},"Email",[562,4216,4219],{"className":564,"code":4217,"filename":4218,"language":567,"meta":568,"style":568},"import { ValueObject } from \"@heximon\u002Fdomain\";\n\ninterface EmailValue extends Record\u003Cstring, unknown> {\n  readonly address: string;\n}\n\nexport class Email extends ValueObject\u003CEmailValue> {\n  public static create(address: string): Email {\n    return new Email({ address: address.trim().toLowerCase() });\n  }\n\n  public get address(): string {\n    return this.value.address;\n  }\n}\n","src\u002Fusers\u002Femail.value.ts",[507,4220,4221,4242,4246,4269,4282,4286,4290,4311,4334,4373,4377,4381,4395,4410,4414],{"__ignoreMap":568},[572,4222,4223,4225,4227,4230,4232,4234,4236,4238,4240],{"class":574,"line":575},[572,4224,579],{"class":578},[572,4226,583],{"class":582},[572,4228,4229],{"class":586}," ValueObject",[572,4231,596],{"class":582},[572,4233,599],{"class":578},[572,4235,602],{"class":582},[572,4237,2605],{"class":605},[572,4239,609],{"class":582},[572,4241,612],{"class":582},[572,4243,4244],{"class":574,"line":615},[572,4245,642],{"emptyLinePlaceholder":641},[572,4247,4248,4250,4253,4255,4257,4259,4261,4263,4265,4267],{"class":574,"line":638},[572,4249,2675],{"class":651},[572,4251,4252],{"class":655}," EmailValue",[572,4254,659],{"class":651},[572,4256,2683],{"class":655},[572,4258,664],{"class":582},[572,4260,2654],{"class":655},[572,4262,590],{"class":582},[572,4264,1751],{"class":655},[572,4266,674],{"class":582},[572,4268,677],{"class":582},[572,4270,4271,4274,4276,4278,4280],{"class":574,"line":645},[572,4272,4273],{"class":651},"  readonly",[572,4275,3382],{"class":712},[572,4277,696],{"class":582},[572,4279,2705],{"class":655},[572,4281,612],{"class":582},[572,4283,4284],{"class":574,"line":680},[572,4285,748],{"class":582},[572,4287,4288],{"class":574,"line":706},[572,4289,642],{"emptyLinePlaceholder":641},[572,4291,4292,4294,4296,4298,4300,4302,4304,4307,4309],{"class":574,"line":739},[572,4293,648],{"class":578},[572,4295,652],{"class":651},[572,4297,2618],{"class":655},[572,4299,659],{"class":651},[572,4301,4229],{"class":655},[572,4303,664],{"class":582},[572,4305,4306],{"class":655},"EmailValue",[572,4308,674],{"class":582},[572,4310,677],{"class":582},[572,4312,4313,4315,4317,4319,4321,4324,4326,4328,4330,4332],{"class":574,"line":745},[572,4314,683],{"class":651},[572,4316,2761],{"class":651},[572,4318,2764],{"class":712},[572,4320,689],{"class":582},[572,4322,4323],{"class":692},"address",[572,4325,696],{"class":582},[572,4327,2705],{"class":655},[572,4329,1174],{"class":582},[572,4331,2618],{"class":655},[572,4333,677],{"class":582},[572,4335,4336,4338,4340,4342,4344,4347,4349,4351,4353,4355,4358,4360,4362,4365,4367,4369,4371],{"class":574,"line":1330},[572,4337,2809],{"class":578},[572,4339,1249],{"class":582},[572,4341,2618],{"class":1252},[572,4343,689],{"class":712},[572,4345,4346],{"class":582},"{",[572,4348,3382],{"class":712},[572,4350,696],{"class":582},[572,4352,3382],{"class":586},[572,4354,1742],{"class":582},[572,4356,4357],{"class":1252},"trim",[572,4359,3221],{"class":712},[572,4361,1742],{"class":582},[572,4363,4364],{"class":1252},"toLowerCase",[572,4366,3411],{"class":712},[572,4368,1333],{"class":582},[572,4370,701],{"class":712},[572,4372,612],{"class":582},[572,4374,4375],{"class":574,"line":1760},[572,4376,742],{"class":582},[572,4378,4379],{"class":574,"line":1765},[572,4380,642],{"emptyLinePlaceholder":641},[572,4382,4383,4385,4387,4389,4391,4393],{"class":574,"line":1770},[572,4384,683],{"class":651},[572,4386,2878],{"class":651},[572,4388,3382],{"class":712},[572,4390,2883],{"class":582},[572,4392,2705],{"class":655},[572,4394,677],{"class":582},[572,4396,4397,4399,4401,4404,4406,4408],{"class":574,"line":1789},[572,4398,2809],{"class":578},[572,4400,2894],{"class":582},[572,4402,4403],{"class":586},"value",[572,4405,1742],{"class":582},[572,4407,4323],{"class":586},[572,4409,612],{"class":582},[572,4411,4412],{"class":574,"line":1800},[572,4413,742],{"class":582},[572,4415,4416],{"class":574,"line":1806},[572,4417,748],{"class":582},[499,4419,4420],{},"The choice between two strategies comes down to whether you ever query on the value's fields.",[499,4422,4423,4429],{},[536,4424,4425,4426,1742],{},"Flattened — ",[507,4427,4428],{},"valueObject()"," Each field spreads across its own (prefixed) column, so you can filter,\nindex, and constrain on it — reach for this when the inner fields matter to queries.",[562,4431,4434],{"className":564,"code":4432,"filename":4433,"language":567,"meta":568,"style":568},"import { valueObject } from \"@heximon\u002Fdrizzle\u002Fsqlite-core\";\nimport { text } from \"drizzle-orm\u002Fsqlite-core\";\nimport { Address } from \".\u002Faddress.value\";\n\nconst addressColumns = valueObject(Address, {\n  street: text(\"street\").notNull(),\n  city: text(\"city\").notNull(),\n  zip: text(\"zip\").notNull(),\n});\n","flattened",[507,4435,4436,4456,4476,4498,4502,4521,4549,4577,4605],{"__ignoreMap":568},[572,4437,4438,4440,4442,4444,4446,4448,4450,4452,4454],{"class":574,"line":575},[572,4439,579],{"class":578},[572,4441,583],{"class":582},[572,4443,3070],{"class":586},[572,4445,596],{"class":582},[572,4447,599],{"class":578},[572,4449,602],{"class":582},[572,4451,3079],{"class":605},[572,4453,609],{"class":582},[572,4455,612],{"class":582},[572,4457,4458,4460,4462,4464,4466,4468,4470,4472,4474],{"class":574,"line":615},[572,4459,579],{"class":578},[572,4461,583],{"class":582},[572,4463,3097],{"class":586},[572,4465,596],{"class":582},[572,4467,599],{"class":578},[572,4469,602],{"class":582},[572,4471,3106],{"class":605},[572,4473,609],{"class":582},[572,4475,612],{"class":582},[572,4477,4478,4480,4482,4485,4487,4489,4491,4494,4496],{"class":574,"line":638},[572,4479,579],{"class":578},[572,4481,583],{"class":582},[572,4483,4484],{"class":586}," Address",[572,4486,596],{"class":582},[572,4488,599],{"class":578},[572,4490,602],{"class":582},[572,4492,4493],{"class":605},".\u002Faddress.value",[572,4495,609],{"class":582},[572,4497,612],{"class":582},[572,4499,4500],{"class":574,"line":645},[572,4501,642],{"emptyLinePlaceholder":641},[572,4503,4504,4507,4510,4512,4514,4517,4519],{"class":574,"line":680},[572,4505,4506],{"class":651},"const",[572,4508,4509],{"class":586}," addressColumns ",[572,4511,1246],{"class":582},[572,4513,3070],{"class":1252},[572,4515,4516],{"class":586},"(Address",[572,4518,590],{"class":582},[572,4520,677],{"class":582},[572,4522,4523,4526,4528,4530,4532,4534,4537,4539,4541,4543,4545,4547],{"class":574,"line":706},[572,4524,4525],{"class":712},"  street",[572,4527,696],{"class":582},[572,4529,3097],{"class":1252},[572,4531,689],{"class":586},[572,4533,609],{"class":582},[572,4535,4536],{"class":605},"street",[572,4538,609],{"class":582},[572,4540,701],{"class":586},[572,4542,1742],{"class":582},[572,4544,3218],{"class":1252},[572,4546,3221],{"class":586},[572,4548,1280],{"class":582},[572,4550,4551,4554,4556,4558,4560,4562,4565,4567,4569,4571,4573,4575],{"class":574,"line":739},[572,4552,4553],{"class":712},"  city",[572,4555,696],{"class":582},[572,4557,3097],{"class":1252},[572,4559,689],{"class":586},[572,4561,609],{"class":582},[572,4563,4564],{"class":605},"city",[572,4566,609],{"class":582},[572,4568,701],{"class":586},[572,4570,1742],{"class":582},[572,4572,3218],{"class":1252},[572,4574,3221],{"class":586},[572,4576,1280],{"class":582},[572,4578,4579,4582,4584,4586,4588,4590,4593,4595,4597,4599,4601,4603],{"class":574,"line":745},[572,4580,4581],{"class":712},"  zip",[572,4583,696],{"class":582},[572,4585,3097],{"class":1252},[572,4587,689],{"class":586},[572,4589,609],{"class":582},[572,4591,4592],{"class":605},"zip",[572,4594,609],{"class":582},[572,4596,701],{"class":586},[572,4598,1742],{"class":582},[572,4600,3218],{"class":1252},[572,4602,3221],{"class":586},[572,4604,1280],{"class":582},[572,4606,4607,4609,4611],{"class":574,"line":1330},[572,4608,1333],{"class":582},[572,4610,701],{"class":586},[572,4612,612],{"class":582},[499,4614,4615,4621,4622,4625,4626,1742],{},[536,4616,4617,4618,1742],{},"Serialized — ",[507,4619,4620],{},"serializedValueObject()"," The whole value object goes into one column — simpler, but you\ncan't filter on individual fields. Pass ",[507,4623,4624],{},"customTypes"," codecs to round-trip non-primitive fields like a ",[507,4627,4190],{},[562,4629,4632],{"className":564,"code":4630,"filename":4631,"language":567,"meta":568,"style":568},"import { serializedValueObject } from \"@heximon\u002Fdrizzle\u002Fsqlite-core\";\nimport { text } from \"drizzle-orm\u002Fsqlite-core\";\nimport { Metadata } from \".\u002Fmetadata.value\";\n\nconst metadataColumn = serializedValueObject(Metadata, text(\"metadata\"));\n","serialized",[507,4633,4634,4655,4675,4697,4701],{"__ignoreMap":568},[572,4635,4636,4638,4640,4643,4645,4647,4649,4651,4653],{"class":574,"line":575},[572,4637,579],{"class":578},[572,4639,583],{"class":582},[572,4641,4642],{"class":586}," serializedValueObject",[572,4644,596],{"class":582},[572,4646,599],{"class":578},[572,4648,602],{"class":582},[572,4650,3079],{"class":605},[572,4652,609],{"class":582},[572,4654,612],{"class":582},[572,4656,4657,4659,4661,4663,4665,4667,4669,4671,4673],{"class":574,"line":615},[572,4658,579],{"class":578},[572,4660,583],{"class":582},[572,4662,3097],{"class":586},[572,4664,596],{"class":582},[572,4666,599],{"class":578},[572,4668,602],{"class":582},[572,4670,3106],{"class":605},[572,4672,609],{"class":582},[572,4674,612],{"class":582},[572,4676,4677,4679,4681,4684,4686,4688,4690,4693,4695],{"class":574,"line":638},[572,4678,579],{"class":578},[572,4680,583],{"class":582},[572,4682,4683],{"class":586}," Metadata",[572,4685,596],{"class":582},[572,4687,599],{"class":578},[572,4689,602],{"class":582},[572,4691,4692],{"class":605},".\u002Fmetadata.value",[572,4694,609],{"class":582},[572,4696,612],{"class":582},[572,4698,4699],{"class":574,"line":645},[572,4700,642],{"emptyLinePlaceholder":641},[572,4702,4703,4705,4708,4710,4712,4715,4717,4719,4721,4723,4726,4728,4731],{"class":574,"line":680},[572,4704,4506],{"class":651},[572,4706,4707],{"class":586}," metadataColumn ",[572,4709,1246],{"class":582},[572,4711,4642],{"class":1252},[572,4713,4714],{"class":586},"(Metadata",[572,4716,590],{"class":582},[572,4718,3097],{"class":1252},[572,4720,689],{"class":586},[572,4722,609],{"class":582},[572,4724,4725],{"class":605},"metadata",[572,4727,609],{"class":582},[572,4729,4730],{"class":586},"))",[572,4732,612],{"class":582},[764,4734,4736],{"id":4735},"define-a-repository","Define a repository",[499,4738,4739,4740,4743,4744,4747,4748,539,4750,539,4753,1280,4756,539,4759,539,4761,539,4763,4766],{},"A repository extends ",[507,4741,4742],{},"Drizzle\u003CDialect>EntityRepository\u003CTDatabase, TEntity>"," (a subclass of the DDD\n",[507,4745,4746],{},"Repository"," contract). The base ships the whole CRUD surface — ",[507,4749,517],{},[507,4751,4752],{},"getAll(query?)",[507,4754,4755],{},"getMany(ids)",[507,4757,4758],{},"count(query?)",[507,4760,513],{},[507,4762,524],{},[507,4764,4765],{},"transaction"," — so a concrete repository is often just a constructor:",[772,4768,4769,4896,5027],{},[562,4770,4772],{"className":564,"code":4771,"filename":3049,"language":567,"meta":568,"style":568},"import { DrizzleLibSQLDatabase, DrizzleLibSQLEntityRepository } from \"@heximon\u002Fdrizzle\u002Flibsql\";\nimport { User } from \".\u002Fuser.entity\";\n\nexport class UserRepository extends DrizzleLibSQLEntityRepository\u003CDrizzleLibSQLDatabase, User> {\n  public constructor(database: DrizzleLibSQLDatabase) {\n    super(database, \"Users\", User);\n  }\n}\n",[507,4773,4774,4798,4818,4822,4846,4864,4888,4892],{"__ignoreMap":568},[572,4775,4776,4778,4780,4782,4784,4786,4788,4790,4792,4794,4796],{"class":574,"line":575},[572,4777,579],{"class":578},[572,4779,583],{"class":582},[572,4781,587],{"class":586},[572,4783,590],{"class":582},[572,4785,593],{"class":586},[572,4787,596],{"class":582},[572,4789,599],{"class":578},[572,4791,602],{"class":582},[572,4793,606],{"class":605},[572,4795,609],{"class":582},[572,4797,612],{"class":582},[572,4799,4800,4802,4804,4806,4808,4810,4812,4814,4816],{"class":574,"line":615},[572,4801,579],{"class":578},[572,4803,583],{"class":582},[572,4805,622],{"class":586},[572,4807,596],{"class":582},[572,4809,599],{"class":578},[572,4811,602],{"class":582},[572,4813,631],{"class":605},[572,4815,609],{"class":582},[572,4817,612],{"class":582},[572,4819,4820],{"class":574,"line":638},[572,4821,642],{"emptyLinePlaceholder":641},[572,4823,4824,4826,4828,4830,4832,4834,4836,4838,4840,4842,4844],{"class":574,"line":645},[572,4825,648],{"class":578},[572,4827,652],{"class":651},[572,4829,656],{"class":655},[572,4831,659],{"class":651},[572,4833,593],{"class":655},[572,4835,664],{"class":582},[572,4837,667],{"class":655},[572,4839,590],{"class":582},[572,4841,622],{"class":655},[572,4843,674],{"class":582},[572,4845,677],{"class":582},[572,4847,4848,4850,4852,4854,4856,4858,4860,4862],{"class":574,"line":680},[572,4849,683],{"class":651},[572,4851,686],{"class":651},[572,4853,689],{"class":582},[572,4855,693],{"class":692},[572,4857,696],{"class":582},[572,4859,587],{"class":655},[572,4861,701],{"class":582},[572,4863,677],{"class":582},[572,4865,4866,4868,4870,4872,4874,4876,4878,4880,4882,4884,4886],{"class":574,"line":706},[572,4867,709],{"class":586},[572,4869,689],{"class":712},[572,4871,693],{"class":586},[572,4873,590],{"class":582},[572,4875,602],{"class":582},[572,4877,721],{"class":605},[572,4879,609],{"class":582},[572,4881,590],{"class":582},[572,4883,622],{"class":586},[572,4885,701],{"class":712},[572,4887,612],{"class":582},[572,4889,4890],{"class":574,"line":739},[572,4891,742],{"class":582},[572,4893,4894],{"class":574,"line":745},[572,4895,748],{"class":582},[562,4897,4899],{"className":564,"code":4898,"filename":3429,"language":567,"meta":568,"style":568},"import { DrizzlePgDatabase, DrizzlePgEntityRepository } from \"@heximon\u002Fdrizzle\u002Fpg\";\nimport { User } from \".\u002Fuser.entity\";\n\nexport class UserRepository extends DrizzlePgEntityRepository\u003CDrizzlePgDatabase, User> {\n  public constructor(database: DrizzlePgDatabase) {\n    super(database, \"Users\", User);\n  }\n}\n",[507,4900,4901,4928,4948,4952,4977,4995,5019,5023],{"__ignoreMap":568},[572,4902,4903,4905,4907,4910,4912,4915,4917,4919,4921,4924,4926],{"class":574,"line":575},[572,4904,579],{"class":578},[572,4906,583],{"class":582},[572,4908,4909],{"class":586}," DrizzlePgDatabase",[572,4911,590],{"class":582},[572,4913,4914],{"class":586}," DrizzlePgEntityRepository",[572,4916,596],{"class":582},[572,4918,599],{"class":578},[572,4920,602],{"class":582},[572,4922,4923],{"class":605},"@heximon\u002Fdrizzle\u002Fpg",[572,4925,609],{"class":582},[572,4927,612],{"class":582},[572,4929,4930,4932,4934,4936,4938,4940,4942,4944,4946],{"class":574,"line":615},[572,4931,579],{"class":578},[572,4933,583],{"class":582},[572,4935,622],{"class":586},[572,4937,596],{"class":582},[572,4939,599],{"class":578},[572,4941,602],{"class":582},[572,4943,631],{"class":605},[572,4945,609],{"class":582},[572,4947,612],{"class":582},[572,4949,4950],{"class":574,"line":638},[572,4951,642],{"emptyLinePlaceholder":641},[572,4953,4954,4956,4958,4960,4962,4964,4966,4969,4971,4973,4975],{"class":574,"line":645},[572,4955,648],{"class":578},[572,4957,652],{"class":651},[572,4959,656],{"class":655},[572,4961,659],{"class":651},[572,4963,4914],{"class":655},[572,4965,664],{"class":582},[572,4967,4968],{"class":655},"DrizzlePgDatabase",[572,4970,590],{"class":582},[572,4972,622],{"class":655},[572,4974,674],{"class":582},[572,4976,677],{"class":582},[572,4978,4979,4981,4983,4985,4987,4989,4991,4993],{"class":574,"line":680},[572,4980,683],{"class":651},[572,4982,686],{"class":651},[572,4984,689],{"class":582},[572,4986,693],{"class":692},[572,4988,696],{"class":582},[572,4990,4909],{"class":655},[572,4992,701],{"class":582},[572,4994,677],{"class":582},[572,4996,4997,4999,5001,5003,5005,5007,5009,5011,5013,5015,5017],{"class":574,"line":706},[572,4998,709],{"class":586},[572,5000,689],{"class":712},[572,5002,693],{"class":586},[572,5004,590],{"class":582},[572,5006,602],{"class":582},[572,5008,721],{"class":605},[572,5010,609],{"class":582},[572,5012,590],{"class":582},[572,5014,622],{"class":586},[572,5016,701],{"class":712},[572,5018,612],{"class":582},[572,5020,5021],{"class":574,"line":739},[572,5022,742],{"class":582},[572,5024,5025],{"class":574,"line":745},[572,5026,748],{"class":582},[562,5028,5030],{"className":564,"code":5029,"filename":2355,"language":567,"meta":568,"style":568},"import { DrizzleMySQL2Database, DrizzleMySQL2EntityRepository } from \"@heximon\u002Fdrizzle\u002Fmysql2\";\nimport { User } from \".\u002Fuser.entity\";\n\nexport class UserRepository extends DrizzleMySQL2EntityRepository\u003CDrizzleMySQL2Database, User> {\n  public constructor(database: DrizzleMySQL2Database) {\n    super(database, \"Users\", User);\n  }\n}\n",[507,5031,5032,5059,5079,5083,5107,5125,5149,5153],{"__ignoreMap":568},[572,5033,5034,5036,5038,5041,5043,5046,5048,5050,5052,5055,5057],{"class":574,"line":575},[572,5035,579],{"class":578},[572,5037,583],{"class":582},[572,5039,5040],{"class":586}," DrizzleMySQL2Database",[572,5042,590],{"class":582},[572,5044,5045],{"class":586}," DrizzleMySQL2EntityRepository",[572,5047,596],{"class":582},[572,5049,599],{"class":578},[572,5051,602],{"class":582},[572,5053,5054],{"class":605},"@heximon\u002Fdrizzle\u002Fmysql2",[572,5056,609],{"class":582},[572,5058,612],{"class":582},[572,5060,5061,5063,5065,5067,5069,5071,5073,5075,5077],{"class":574,"line":615},[572,5062,579],{"class":578},[572,5064,583],{"class":582},[572,5066,622],{"class":586},[572,5068,596],{"class":582},[572,5070,599],{"class":578},[572,5072,602],{"class":582},[572,5074,631],{"class":605},[572,5076,609],{"class":582},[572,5078,612],{"class":582},[572,5080,5081],{"class":574,"line":638},[572,5082,642],{"emptyLinePlaceholder":641},[572,5084,5085,5087,5089,5091,5093,5095,5097,5099,5101,5103,5105],{"class":574,"line":645},[572,5086,648],{"class":578},[572,5088,652],{"class":651},[572,5090,656],{"class":655},[572,5092,659],{"class":651},[572,5094,5045],{"class":655},[572,5096,664],{"class":582},[572,5098,2033],{"class":655},[572,5100,590],{"class":582},[572,5102,622],{"class":655},[572,5104,674],{"class":582},[572,5106,677],{"class":582},[572,5108,5109,5111,5113,5115,5117,5119,5121,5123],{"class":574,"line":680},[572,5110,683],{"class":651},[572,5112,686],{"class":651},[572,5114,689],{"class":582},[572,5116,693],{"class":692},[572,5118,696],{"class":582},[572,5120,5040],{"class":655},[572,5122,701],{"class":582},[572,5124,677],{"class":582},[572,5126,5127,5129,5131,5133,5135,5137,5139,5141,5143,5145,5147],{"class":574,"line":706},[572,5128,709],{"class":586},[572,5130,689],{"class":712},[572,5132,693],{"class":586},[572,5134,590],{"class":582},[572,5136,602],{"class":582},[572,5138,721],{"class":605},[572,5140,609],{"class":582},[572,5142,590],{"class":582},[572,5144,622],{"class":586},[572,5146,701],{"class":712},[572,5148,612],{"class":582},[572,5150,5151],{"class":574,"line":739},[572,5152,742],{"class":582},[572,5154,5155],{"class":574,"line":745},[572,5156,748],{"class":582},[499,5158,5159,5160,5163,5164,5167],{},"The database is the ",[536,5161,5162],{},"only"," DI-resolved constructor parameter — the compiler reads its type as the\ndependency, since class identity is the only token. The schema key and entity constructor are plain\n",[507,5165,5166],{},"super(...)"," arguments.",[1339,5169,5170,5176,5177,5180,5181,5184,5185,5187,5188,5191,5192,1742],{"type":1917},[536,5171,5172,5175],{},[507,5173,5174],{},"\"Users\""," is the schema key, not the SQL table name."," The base resolves the Drizzle table by this key,\nand that key is the export identifier of ",[507,5178,5179],{},"export const Users = …"," — not the ",[507,5182,5183],{},"\"users\""," you passed to\n",[507,5186,3178],{},". Get it wrong and the repository fails to construct with ",[507,5189,5190],{},"Table \"Wrong\" not found in the database schema",". Use the export name; the SQL table name lives only inside ",[507,5193,3178],{},[499,5195,5196,5197,696],{},"Register the repository in the feature module's ",[507,5198,5199],{},"providers",[562,5201,5204],{"className":564,"code":5202,"filename":5203,"language":567,"meta":568,"style":568},"import { Module } from \"@heximon\u002Fruntime\";\nimport { DatabaseModule } from \"..\u002Fdatabase\u002Fdatabase.module\";\nimport { UserController } from \".\u002Fuser.controller\";\nimport { UserRepository } from \".\u002Fuser.repository\";\n\nexport class UserModule extends Module({\n  imports: [DatabaseModule], \u002F\u002F brings the exported Database token into scope\n  providers: [UserRepository],\n  http: { controllers: [UserController] },\n  exports: [UserRepository],\n}) {}\n","src\u002Fusers\u002Fuser.module.ts",[507,5205,5206,5226,5247,5269,5290,5294,5311,5326,5337,5357,5367],{"__ignoreMap":568},[572,5207,5208,5210,5212,5214,5216,5218,5220,5222,5224],{"class":574,"line":575},[572,5209,579],{"class":578},[572,5211,583],{"class":582},[572,5213,1591],{"class":586},[572,5215,596],{"class":582},[572,5217,599],{"class":578},[572,5219,602],{"class":582},[572,5221,1600],{"class":605},[572,5223,609],{"class":582},[572,5225,612],{"class":582},[572,5227,5228,5230,5232,5234,5236,5238,5240,5243,5245],{"class":574,"line":615},[572,5229,579],{"class":578},[572,5231,583],{"class":582},[572,5233,1777],{"class":586},[572,5235,596],{"class":582},[572,5237,599],{"class":578},[572,5239,602],{"class":582},[572,5241,5242],{"class":605},"..\u002Fdatabase\u002Fdatabase.module",[572,5244,609],{"class":582},[572,5246,612],{"class":582},[572,5248,5249,5251,5253,5256,5258,5260,5262,5265,5267],{"class":574,"line":638},[572,5250,579],{"class":578},[572,5252,583],{"class":582},[572,5254,5255],{"class":586}," UserController",[572,5257,596],{"class":582},[572,5259,599],{"class":578},[572,5261,602],{"class":582},[572,5263,5264],{"class":605},".\u002Fuser.controller",[572,5266,609],{"class":582},[572,5268,612],{"class":582},[572,5270,5271,5273,5275,5277,5279,5281,5283,5286,5288],{"class":574,"line":645},[572,5272,579],{"class":578},[572,5274,583],{"class":582},[572,5276,656],{"class":586},[572,5278,596],{"class":582},[572,5280,599],{"class":578},[572,5282,602],{"class":582},[572,5284,5285],{"class":605},".\u002Fuser.repository",[572,5287,609],{"class":582},[572,5289,612],{"class":582},[572,5291,5292],{"class":574,"line":680},[572,5293,642],{"emptyLinePlaceholder":641},[572,5295,5296,5298,5300,5303,5305,5307,5309],{"class":574,"line":706},[572,5297,648],{"class":578},[572,5299,652],{"class":651},[572,5301,5302],{"class":655}," UserModule",[572,5304,659],{"class":651},[572,5306,1591],{"class":1252},[572,5308,689],{"class":586},[572,5310,1786],{"class":582},[572,5312,5313,5316,5318,5321,5323],{"class":574,"line":739},[572,5314,5315],{"class":712},"  imports",[572,5317,696],{"class":582},[572,5319,5320],{"class":586}," [DatabaseModule]",[572,5322,590],{"class":582},[572,5324,5325],{"class":735}," \u002F\u002F brings the exported Database token into scope\n",[572,5327,5328,5330,5332,5335],{"class":574,"line":745},[572,5329,1792],{"class":712},[572,5331,696],{"class":582},[572,5333,5334],{"class":586}," [UserRepository]",[572,5336,1280],{"class":582},[572,5338,5339,5342,5344,5346,5349,5351,5354],{"class":574,"line":1330},[572,5340,5341],{"class":712},"  http",[572,5343,696],{"class":582},[572,5345,583],{"class":582},[572,5347,5348],{"class":712}," controllers",[572,5350,696],{"class":582},[572,5352,5353],{"class":586}," [UserController] ",[572,5355,5356],{"class":582},"},\n",[572,5358,5359,5361,5363,5365],{"class":574,"line":1760},[572,5360,1896],{"class":712},[572,5362,696],{"class":582},[572,5364,5334],{"class":586},[572,5366,1280],{"class":582},[572,5368,5369,5371,5373],{"class":574,"line":1765},[572,5370,1333],{"class":582},[572,5372,1911],{"class":586},[572,5374,1914],{"class":582},[764,5376,5378],{"id":5377},"save-and-load-from-a-controller","Save and load from a controller",[499,5380,5381,5382,5384,5385,5387],{},"A controller injects the repository and works in domain terms — create the aggregate, ",[507,5383,513],{}," it, read it\nback with ",[507,5386,517],{},". The mapper handles row translation in both directions.",[562,5389,5392],{"className":564,"code":5390,"filename":5391,"language":567,"meta":568,"style":568},"import { uuid } from \"@heximon\u002Fruntime\";\nimport type { Controller, Get, Post, TypedResponse } from \"@heximon\u002Fhttp\";\nimport { createUserSchema, type UserResponse } from \".\u002Fuser.schema\";\nimport { User, type UserId } from \".\u002Fuser.entity\";\nimport { UserRepository } from \".\u002Fuser.repository\";\n\nexport class UserController implements Controller\u003C\"\u002Fusers\"> {\n  public constructor(private readonly users: UserRepository) {}\n\n  public async list(_action: Get\u003C\"\u002F\">): Promise\u003CUserResponse[]> {\n    const users = await this.users.getAll();\n    return users.map((user) => UserController.toResponse(user));\n  }\n\n  public async create(action: Post\u003C\"\u002F\", { body: typeof createUserSchema }>): Promise\u003CTypedResponse> {\n    const body = await action.request.readValidatedBody(); \u002F\u002F invalid → 400 problem+json\n    const user = User.create(uuid.v7\u003CUserId>(), body); \u002F\u002F mint the id up front\n    await this.users.save(user);\n    return action.respond(201, UserController.toResponse(user));\n  }\n\n  \u002F\u002F `version` is protected on the entity — read it through the public getter when projecting a response.\n  private static toResponse(user: User): UserResponse {\n    return { id: user.id, name: user.name, email: user.email.address, version: user.getVersion() };\n  }\n}\n","src\u002Fusers\u002Fuser.controller.ts",[507,5393,5394,5414,5453,5482,5508,5528,5532,5558,5584,5588,5633,5657,5695,5699,5703,5757,5787,5831,5852,5884,5888,5892,5897,5921,5985,5989],{"__ignoreMap":568},[572,5395,5396,5398,5400,5402,5404,5406,5408,5410,5412],{"class":574,"line":575},[572,5397,579],{"class":578},[572,5399,583],{"class":582},[572,5401,3449],{"class":586},[572,5403,596],{"class":582},[572,5405,599],{"class":578},[572,5407,602],{"class":582},[572,5409,1600],{"class":605},[572,5411,609],{"class":582},[572,5413,612],{"class":582},[572,5415,5416,5418,5420,5422,5425,5427,5430,5432,5435,5437,5440,5442,5444,5446,5449,5451],{"class":574,"line":615},[572,5417,579],{"class":578},[572,5419,1583],{"class":578},[572,5421,583],{"class":582},[572,5423,5424],{"class":586}," Controller",[572,5426,590],{"class":582},[572,5428,5429],{"class":586}," Get",[572,5431,590],{"class":582},[572,5433,5434],{"class":586}," Post",[572,5436,590],{"class":582},[572,5438,5439],{"class":586}," TypedResponse",[572,5441,596],{"class":582},[572,5443,599],{"class":578},[572,5445,602],{"class":582},[572,5447,5448],{"class":605},"@heximon\u002Fhttp",[572,5450,609],{"class":582},[572,5452,612],{"class":582},[572,5454,5455,5457,5459,5462,5464,5466,5469,5471,5473,5475,5478,5480],{"class":574,"line":638},[572,5456,579],{"class":578},[572,5458,583],{"class":582},[572,5460,5461],{"class":586}," createUserSchema",[572,5463,590],{"class":582},[572,5465,1583],{"class":578},[572,5467,5468],{"class":586}," UserResponse",[572,5470,596],{"class":582},[572,5472,599],{"class":578},[572,5474,602],{"class":582},[572,5476,5477],{"class":605},".\u002Fuser.schema",[572,5479,609],{"class":582},[572,5481,612],{"class":582},[572,5483,5484,5486,5488,5490,5492,5494,5496,5498,5500,5502,5504,5506],{"class":574,"line":645},[572,5485,579],{"class":578},[572,5487,583],{"class":582},[572,5489,622],{"class":586},[572,5491,590],{"class":582},[572,5493,1583],{"class":578},[572,5495,2644],{"class":586},[572,5497,596],{"class":582},[572,5499,599],{"class":578},[572,5501,602],{"class":582},[572,5503,631],{"class":605},[572,5505,609],{"class":582},[572,5507,612],{"class":582},[572,5509,5510,5512,5514,5516,5518,5520,5522,5524,5526],{"class":574,"line":680},[572,5511,579],{"class":578},[572,5513,583],{"class":582},[572,5515,656],{"class":586},[572,5517,596],{"class":582},[572,5519,599],{"class":578},[572,5521,602],{"class":582},[572,5523,5285],{"class":605},[572,5525,609],{"class":582},[572,5527,612],{"class":582},[572,5529,5530],{"class":574,"line":706},[572,5531,642],{"emptyLinePlaceholder":641},[572,5533,5534,5536,5538,5540,5543,5545,5547,5549,5552,5554,5556],{"class":574,"line":739},[572,5535,648],{"class":578},[572,5537,652],{"class":651},[572,5539,5255],{"class":655},[572,5541,5542],{"class":651}," implements",[572,5544,5424],{"class":655},[572,5546,664],{"class":582},[572,5548,609],{"class":582},[572,5550,5551],{"class":605},"\u002Fusers",[572,5553,609],{"class":582},[572,5555,674],{"class":582},[572,5557,677],{"class":582},[572,5559,5560,5562,5564,5566,5569,5572,5575,5577,5579,5581],{"class":574,"line":745},[572,5561,683],{"class":651},[572,5563,686],{"class":651},[572,5565,689],{"class":582},[572,5567,5568],{"class":651},"private",[572,5570,5571],{"class":651}," readonly",[572,5573,5574],{"class":692}," users",[572,5576,696],{"class":582},[572,5578,656],{"class":655},[572,5580,701],{"class":582},[572,5582,5583],{"class":582}," {}\n",[572,5585,5586],{"class":574,"line":1330},[572,5587,642],{"emptyLinePlaceholder":641},[572,5589,5590,5592,5595,5598,5600,5603,5605,5607,5609,5611,5613,5615,5618,5621,5623,5626,5629,5631],{"class":574,"line":1760},[572,5591,683],{"class":651},[572,5593,5594],{"class":651}," async",[572,5596,5597],{"class":712}," list",[572,5599,689],{"class":582},[572,5601,5602],{"class":692},"_action",[572,5604,696],{"class":582},[572,5606,5429],{"class":655},[572,5608,664],{"class":582},[572,5610,609],{"class":582},[572,5612,1929],{"class":605},[572,5614,609],{"class":582},[572,5616,5617],{"class":582},">):",[572,5619,5620],{"class":655}," Promise",[572,5622,664],{"class":582},[572,5624,5625],{"class":655},"UserResponse",[572,5627,5628],{"class":586},"[]",[572,5630,674],{"class":582},[572,5632,677],{"class":582},[572,5634,5635,5638,5640,5642,5645,5647,5649,5651,5653,5655],{"class":574,"line":1765},[572,5636,5637],{"class":651},"    const",[572,5639,5574],{"class":586},[572,5641,2647],{"class":582},[572,5643,5644],{"class":578}," await",[572,5646,2894],{"class":582},[572,5648,3188],{"class":586},[572,5650,1742],{"class":582},[572,5652,521],{"class":1252},[572,5654,3221],{"class":712},[572,5656,612],{"class":582},[572,5658,5659,5661,5663,5665,5668,5670,5672,5675,5677,5680,5682,5684,5687,5689,5691,5693],{"class":574,"line":1770},[572,5660,2809],{"class":578},[572,5662,5574],{"class":586},[572,5664,1742],{"class":582},[572,5666,5667],{"class":1252},"map",[572,5669,689],{"class":712},[572,5671,689],{"class":582},[572,5673,5674],{"class":692},"user",[572,5676,701],{"class":582},[572,5678,5679],{"class":651}," =>",[572,5681,5255],{"class":586},[572,5683,1742],{"class":582},[572,5685,5686],{"class":1252},"toResponse",[572,5688,689],{"class":712},[572,5690,5674],{"class":586},[572,5692,4730],{"class":712},[572,5694,612],{"class":582},[572,5696,5697],{"class":574,"line":1789},[572,5698,742],{"class":582},[572,5700,5701],{"class":574,"line":1800},[572,5702,642],{"emptyLinePlaceholder":641},[572,5704,5705,5707,5709,5711,5713,5716,5718,5720,5722,5724,5726,5728,5730,5732,5735,5737,5740,5743,5746,5748,5750,5753,5755],{"class":574,"line":1806},[572,5706,683],{"class":651},[572,5708,5594],{"class":651},[572,5710,2764],{"class":712},[572,5712,689],{"class":582},[572,5714,5715],{"class":692},"action",[572,5717,696],{"class":582},[572,5719,5434],{"class":655},[572,5721,664],{"class":582},[572,5723,609],{"class":582},[572,5725,1929],{"class":605},[572,5727,609],{"class":582},[572,5729,590],{"class":582},[572,5731,583],{"class":582},[572,5733,5734],{"class":712}," body",[572,5736,696],{"class":582},[572,5738,5739],{"class":582}," typeof",[572,5741,5742],{"class":586}," createUserSchema ",[572,5744,5745],{"class":582},"}>):",[572,5747,5620],{"class":655},[572,5749,664],{"class":582},[572,5751,5752],{"class":655},"TypedResponse",[572,5754,674],{"class":582},[572,5756,677],{"class":582},[572,5758,5759,5761,5763,5765,5767,5770,5772,5775,5777,5780,5782,5784],{"class":574,"line":1818},[572,5760,5637],{"class":651},[572,5762,5734],{"class":586},[572,5764,2647],{"class":582},[572,5766,5644],{"class":578},[572,5768,5769],{"class":586}," action",[572,5771,1742],{"class":582},[572,5773,5774],{"class":586},"request",[572,5776,1742],{"class":582},[572,5778,5779],{"class":1252},"readValidatedBody",[572,5781,3221],{"class":712},[572,5783,732],{"class":582},[572,5785,5786],{"class":735}," \u002F\u002F invalid → 400 problem+json\n",[572,5788,5789,5791,5794,5796,5798,5800,5802,5804,5807,5809,5812,5814,5816,5818,5820,5822,5824,5826,5828],{"class":574,"line":1848},[572,5790,5637],{"class":651},[572,5792,5793],{"class":586}," user",[572,5795,2647],{"class":582},[572,5797,622],{"class":586},[572,5799,1742],{"class":582},[572,5801,2845],{"class":1252},[572,5803,689],{"class":712},[572,5805,5806],{"class":586},"uuid",[572,5808,1742],{"class":582},[572,5810,5811],{"class":1252},"v7",[572,5813,664],{"class":582},[572,5815,2661],{"class":655},[572,5817,674],{"class":582},[572,5819,3221],{"class":712},[572,5821,590],{"class":582},[572,5823,5734],{"class":586},[572,5825,701],{"class":712},[572,5827,732],{"class":582},[572,5829,5830],{"class":735}," \u002F\u002F mint the id up front\n",[572,5832,5833,5836,5838,5840,5842,5844,5846,5848,5850],{"class":574,"line":1879},[572,5834,5835],{"class":578},"    await",[572,5837,2894],{"class":582},[572,5839,3188],{"class":586},[572,5841,1742],{"class":582},[572,5843,513],{"class":1252},[572,5845,689],{"class":712},[572,5847,5674],{"class":586},[572,5849,701],{"class":712},[572,5851,612],{"class":582},[572,5853,5854,5856,5858,5860,5863,5865,5868,5870,5872,5874,5876,5878,5880,5882],{"class":574,"line":1885},[572,5855,2809],{"class":578},[572,5857,5769],{"class":586},[572,5859,1742],{"class":582},[572,5861,5862],{"class":1252},"respond",[572,5864,689],{"class":712},[572,5866,5867],{"class":2273},"201",[572,5869,590],{"class":582},[572,5871,5255],{"class":586},[572,5873,1742],{"class":582},[572,5875,5686],{"class":1252},[572,5877,689],{"class":712},[572,5879,5674],{"class":586},[572,5881,4730],{"class":712},[572,5883,612],{"class":582},[572,5885,5886],{"class":574,"line":1893},[572,5887,742],{"class":582},[572,5889,5890],{"class":574,"line":1906},[572,5891,642],{"emptyLinePlaceholder":641},[572,5893,5894],{"class":574,"line":2927},[572,5895,5896],{"class":735},"  \u002F\u002F `version` is protected on the entity — read it through the public getter when projecting a response.\n",[572,5898,5899,5902,5904,5907,5909,5911,5913,5915,5917,5919],{"class":574,"line":2942},[572,5900,5901],{"class":651},"  private",[572,5903,2761],{"class":651},[572,5905,5906],{"class":712}," toResponse",[572,5908,689],{"class":582},[572,5910,5674],{"class":692},[572,5912,696],{"class":582},[572,5914,622],{"class":655},[572,5916,1174],{"class":582},[572,5918,5468],{"class":655},[572,5920,677],{"class":582},[572,5922,5923,5925,5927,5930,5932,5934,5936,5938,5940,5942,5944,5946,5948,5950,5952,5954,5956,5958,5960,5962,5964,5966,5968,5971,5973,5975,5977,5980,5982],{"class":574,"line":2947},[572,5924,2809],{"class":578},[572,5926,583],{"class":582},[572,5928,5929],{"class":712}," id",[572,5931,696],{"class":582},[572,5933,5793],{"class":586},[572,5935,1742],{"class":582},[572,5937,2544],{"class":586},[572,5939,590],{"class":582},[572,5941,2784],{"class":712},[572,5943,696],{"class":582},[572,5945,5793],{"class":586},[572,5947,1742],{"class":582},[572,5949,2832],{"class":586},[572,5951,590],{"class":582},[572,5953,2793],{"class":712},[572,5955,696],{"class":582},[572,5957,5793],{"class":586},[572,5959,1742],{"class":582},[572,5961,2855],{"class":586},[572,5963,1742],{"class":582},[572,5965,4323],{"class":586},[572,5967,590],{"class":582},[572,5969,5970],{"class":712}," version",[572,5972,696],{"class":582},[572,5974,5793],{"class":586},[572,5976,1742],{"class":582},[572,5978,5979],{"class":1252},"getVersion",[572,5981,3411],{"class":712},[572,5983,5984],{"class":582},"};\n",[572,5986,5987],{"class":574,"line":2952},[572,5988,742],{"class":582},[572,5990,5991],{"class":574,"line":2975},[572,5992,748],{"class":582},[499,5994,5995,5996,6001,6002,6004],{},"The body is validated against any ",[503,5997,6000],{"href":5998,"rel":5999},"https:\u002F\u002Fstandardschema.dev",[533],"Standard Schema"," before your handler runs,\nand ",[507,6003,4214],{}," re-validates the address when the aggregate is built — a malformed address can't reach the row.",[764,6006,6008],{"id":6007},"how-save-decides-insert-vs-update","How save decides INSERT vs. UPDATE",[499,6010,6011,6012,6014,6015,6018],{},"You never tell ",[507,6013,513],{}," to insert or update — it reads a ",[507,6016,6017],{},"DirtyState"," the entity carries:",[1042,6020,6021,6038],{},[1045,6022,6023],{},[1048,6024,6025,6029,6032],{},[1051,6026,6028],{"align":6027},"left","State",[1051,6030,6031],{"align":6027},"How it got there",[1051,6033,6034,6035,6037],{"align":6027},"What ",[507,6036,513],{}," does",[1065,6039,6040,6058,6071],{},[1048,6041,6042,6047,6053],{},[1070,6043,6044],{"align":6027},[507,6045,6046],{},"Detached",[1070,6048,6049,6050,701],{"align":6027},"Just created (",[507,6051,6052],{},"User.create(...)",[1070,6054,6055],{"align":6027},[507,6056,6057],{},"INSERT",[1048,6059,6060,6065,6068],{},[1070,6061,6062],{"align":6027},[507,6063,6064],{},"Persistent",[1070,6066,6067],{"align":6027},"Loaded from the database, untouched",[1070,6069,6070],{"align":6027},"Nothing — no change to write",[1048,6072,6073,6078,6081],{},[1070,6074,6075],{"align":6027},[507,6076,6077],{},"Transient",[1070,6079,6080],{"align":6027},"A loaded entity whose props were mutated",[1070,6082,6083,6084],{"align":6027},"Version-guarded partial ",[507,6085,3016],{},[499,6087,6088,6090,6091,6093,6094,6096],{},[507,6089,513],{}," snapshot-diffs at save time, and loading a row sets it ",[507,6092,6064],{}," (restoring its ",[507,6095,2554],{},") —\nall automatically. Multi-row inserts are chunked to stay inside each dialect's bound-parameter limit.",[764,6098,6100],{"id":6099},"guard-concurrent-writes","Guard concurrent writes",[499,6102,1958,6103,6105,6106,6108,6109,6112,6113,6115,6116,6119],{},[507,6104,2554],{}," column stops two requests overwriting each other. The base emits its ",[507,6107,3016],{}," guarded by\n",[507,6110,6111],{},"WHERE version = ?",": if another worker bumped the row's version since you loaded it, zero rows match, ",[507,6114,513],{},"\nthrows ",[507,6117,6118],{},"ConcurrencyError",", and the in-memory entity's version and dirty-state roll back.",[562,6121,6123],{"className":564,"code":6122,"language":567,"meta":568,"style":568},"import { ConcurrencyError } from \"@heximon\u002Fruntime\u002Ferrors\";\n",[507,6124,6125],{"__ignoreMap":568},[572,6126,6127,6129,6131,6134,6136,6138,6140,6143,6145],{"class":574,"line":575},[572,6128,579],{"class":578},[572,6130,583],{"class":582},[572,6132,6133],{"class":586}," ConcurrencyError",[572,6135,596],{"class":582},[572,6137,599],{"class":578},[572,6139,602],{"class":582},[572,6141,6142],{"class":605},"@heximon\u002Fruntime\u002Ferrors",[572,6144,609],{"class":582},[572,6146,612],{"class":582},[499,6148,6149,6150,6154],{},"You rarely catch it yourself. Pair it with ",[503,6151,6153],{"href":6152},"\u002Fdocs\u002Farchitecture\u002Fcqrs#automatic-concurrencyerror-retry","CQRS automatic retry","\nand the losing command re-runs against fresh state, so the handler never sees the conflict.",[764,6156,6158],{"id":6157},"compose-relations-across-features","Compose relations across features",[499,6160,6161,6162,6165],{},"Each feature owns its own tables; at the app level you stitch them together so cross-feature relations\nresolve against the merged schema. First aggregate the tables into one namespace — the map both the runtime\nORM and ",[507,6163,6164],{},"drizzle-kit"," read:",[562,6167,6170],{"className":564,"code":6168,"filename":6169,"language":567,"meta":568,"style":568},"export * from \"..\u002Fusers\u002Fuser.schema\";\nexport * from \"..\u002Forders\u002Forder.schema\";\n","src\u002Fdatabase\u002Fschema.ts",[507,6171,6172,6190],{"__ignoreMap":568},[572,6173,6174,6176,6179,6181,6183,6186,6188],{"class":574,"line":575},[572,6175,648],{"class":578},[572,6177,6178],{"class":582}," *",[572,6180,599],{"class":578},[572,6182,602],{"class":582},[572,6184,6185],{"class":605},"..\u002Fusers\u002Fuser.schema",[572,6187,609],{"class":582},[572,6189,612],{"class":582},[572,6191,6192,6194,6196,6198,6200,6203,6205],{"class":574,"line":615},[572,6193,648],{"class":578},[572,6195,6178],{"class":582},[572,6197,599],{"class":578},[572,6199,602],{"class":582},[572,6201,6202],{"class":605},"..\u002Forders\u002Forder.schema",[572,6204,609],{"class":582},[572,6206,612],{"class":582},[499,6208,6209,6210,6213,6214,518,6216,6218,6219,6222],{},"Then declare the relations. Even with no foreign keys the config is ",[536,6211,6212],{},"required",", because ",[507,6215,517],{},[507,6217,521],{}," only resolve tables that appear in it. For a flat schema, ",[507,6220,6221],{},"defineRelations(schema)"," registers every\ntable with no relations:",[562,6224,6227],{"className":564,"code":6225,"filename":6226,"language":567,"meta":568,"style":568},"import { defineRelations } from \"drizzle-orm\";\nimport * as schema from \".\u002Fschema\";\n\nexport const relations = defineRelations(schema);\n","src\u002Fdatabase\u002Frelations.ts",[507,6228,6229,6251,6273,6277],{"__ignoreMap":568},[572,6230,6231,6233,6235,6238,6240,6242,6244,6247,6249],{"class":574,"line":575},[572,6232,579],{"class":578},[572,6234,583],{"class":582},[572,6236,6237],{"class":586}," defineRelations",[572,6239,596],{"class":582},[572,6241,599],{"class":578},[572,6243,602],{"class":582},[572,6245,6246],{"class":605},"drizzle-orm",[572,6248,609],{"class":582},[572,6250,612],{"class":582},[572,6252,6253,6255,6257,6259,6262,6265,6267,6269,6271],{"class":574,"line":615},[572,6254,579],{"class":578},[572,6256,6178],{"class":582},[572,6258,1748],{"class":578},[572,6260,6261],{"class":586}," schema ",[572,6263,6264],{"class":578},"from",[572,6266,602],{"class":582},[572,6268,1225],{"class":605},[572,6270,609],{"class":582},[572,6272,612],{"class":582},[572,6274,6275],{"class":574,"line":638},[572,6276,642],{"emptyLinePlaceholder":641},[572,6278,6279,6281,6283,6286,6288,6290,6293],{"class":574,"line":645},[572,6280,648],{"class":578},[572,6282,1240],{"class":651},[572,6284,6285],{"class":586}," relations ",[572,6287,1246],{"class":582},[572,6289,6237],{"class":1252},[572,6291,6292],{"class":586},"(schema)",[572,6294,612],{"class":582},[499,6296,6297,6298,6301,6302,6305],{},"As foreign keys appear, write per-feature relation builders and merge them. Because ",[507,6299,6300],{},"schema"," already holds\nevery table, an ",[507,6303,6304],{},"Order → User"," relation resolves without the domain modules importing each other:",[562,6307,6309],{"className":564,"code":6308,"filename":6226,"language":567,"meta":568,"style":568},"import { DrizzleRelations } from \"@heximon\u002Fdrizzle\u002Fcore\";\nimport * as schema from \".\u002Fschema\";\n\nconst usersRelations = (r) => ({\n  Users: { orders: r.many.Orders({ from: r.Users.id, to: r.Orders.userId }) },\n});\n\nconst ordersRelations = (r) => ({\n  Orders: { user: r.one.Users({ from: r.Orders.userId, to: r.Users.id }) },\n});\n\nexport const relations = DrizzleRelations.mergeRelations(schema, [usersRelations, ordersRelations]);\n",[507,6310,6311,6333,6353,6357,6379,6448,6456,6460,6481,6547,6555,6559],{"__ignoreMap":568},[572,6312,6313,6315,6317,6320,6322,6324,6326,6329,6331],{"class":574,"line":575},[572,6314,579],{"class":578},[572,6316,583],{"class":582},[572,6318,6319],{"class":586}," DrizzleRelations",[572,6321,596],{"class":582},[572,6323,599],{"class":578},[572,6325,602],{"class":582},[572,6327,6328],{"class":605},"@heximon\u002Fdrizzle\u002Fcore",[572,6330,609],{"class":582},[572,6332,612],{"class":582},[572,6334,6335,6337,6339,6341,6343,6345,6347,6349,6351],{"class":574,"line":615},[572,6336,579],{"class":578},[572,6338,6178],{"class":582},[572,6340,1748],{"class":578},[572,6342,6261],{"class":586},[572,6344,6264],{"class":578},[572,6346,602],{"class":582},[572,6348,1225],{"class":605},[572,6350,609],{"class":582},[572,6352,612],{"class":582},[572,6354,6355],{"class":574,"line":638},[572,6356,642],{"emptyLinePlaceholder":641},[572,6358,6359,6361,6364,6366,6368,6371,6373,6375,6377],{"class":574,"line":645},[572,6360,4506],{"class":651},[572,6362,6363],{"class":586}," usersRelations ",[572,6365,1246],{"class":582},[572,6367,1083],{"class":582},[572,6369,6370],{"class":692},"r",[572,6372,701],{"class":582},[572,6374,5679],{"class":651},[572,6376,1083],{"class":586},[572,6378,1786],{"class":582},[572,6380,6381,6384,6386,6388,6391,6393,6396,6398,6401,6403,6406,6408,6410,6412,6414,6416,6418,6420,6422,6424,6426,6429,6431,6433,6435,6437,6439,6442,6444,6446],{"class":574,"line":680},[572,6382,6383],{"class":712},"  Users",[572,6385,696],{"class":582},[572,6387,583],{"class":582},[572,6389,6390],{"class":712}," orders",[572,6392,696],{"class":582},[572,6394,6395],{"class":586}," r",[572,6397,1742],{"class":582},[572,6399,6400],{"class":586},"many",[572,6402,1742],{"class":582},[572,6404,6405],{"class":1252},"Orders",[572,6407,689],{"class":586},[572,6409,4346],{"class":582},[572,6411,599],{"class":712},[572,6413,696],{"class":582},[572,6415,6395],{"class":586},[572,6417,1742],{"class":582},[572,6419,721],{"class":586},[572,6421,1742],{"class":582},[572,6423,2544],{"class":586},[572,6425,590],{"class":582},[572,6427,6428],{"class":712}," to",[572,6430,696],{"class":582},[572,6432,6395],{"class":586},[572,6434,1742],{"class":582},[572,6436,6405],{"class":586},[572,6438,1742],{"class":582},[572,6440,6441],{"class":586},"userId ",[572,6443,1333],{"class":582},[572,6445,1911],{"class":586},[572,6447,5356],{"class":582},[572,6449,6450,6452,6454],{"class":574,"line":706},[572,6451,1333],{"class":582},[572,6453,701],{"class":586},[572,6455,612],{"class":582},[572,6457,6458],{"class":574,"line":739},[572,6459,642],{"emptyLinePlaceholder":641},[572,6461,6462,6464,6467,6469,6471,6473,6475,6477,6479],{"class":574,"line":745},[572,6463,4506],{"class":651},[572,6465,6466],{"class":586}," ordersRelations ",[572,6468,1246],{"class":582},[572,6470,1083],{"class":582},[572,6472,6370],{"class":692},[572,6474,701],{"class":582},[572,6476,5679],{"class":651},[572,6478,1083],{"class":586},[572,6480,1786],{"class":582},[572,6482,6483,6486,6488,6490,6492,6494,6496,6498,6501,6503,6505,6507,6509,6511,6513,6515,6517,6519,6521,6524,6526,6528,6530,6532,6534,6536,6538,6541,6543,6545],{"class":574,"line":1330},[572,6484,6485],{"class":712},"  Orders",[572,6487,696],{"class":582},[572,6489,583],{"class":582},[572,6491,5793],{"class":712},[572,6493,696],{"class":582},[572,6495,6395],{"class":586},[572,6497,1742],{"class":582},[572,6499,6500],{"class":586},"one",[572,6502,1742],{"class":582},[572,6504,721],{"class":1252},[572,6506,689],{"class":586},[572,6508,4346],{"class":582},[572,6510,599],{"class":712},[572,6512,696],{"class":582},[572,6514,6395],{"class":586},[572,6516,1742],{"class":582},[572,6518,6405],{"class":586},[572,6520,1742],{"class":582},[572,6522,6523],{"class":586},"userId",[572,6525,590],{"class":582},[572,6527,6428],{"class":712},[572,6529,696],{"class":582},[572,6531,6395],{"class":586},[572,6533,1742],{"class":582},[572,6535,721],{"class":586},[572,6537,1742],{"class":582},[572,6539,6540],{"class":586},"id ",[572,6542,1333],{"class":582},[572,6544,1911],{"class":586},[572,6546,5356],{"class":582},[572,6548,6549,6551,6553],{"class":574,"line":1760},[572,6550,1333],{"class":582},[572,6552,701],{"class":586},[572,6554,612],{"class":582},[572,6556,6557],{"class":574,"line":1765},[572,6558,642],{"emptyLinePlaceholder":641},[572,6560,6561,6563,6565,6567,6569,6571,6573,6576,6578,6580,6583,6585,6588],{"class":574,"line":1770},[572,6562,648],{"class":578},[572,6564,1240],{"class":651},[572,6566,6285],{"class":586},[572,6568,1246],{"class":582},[572,6570,6319],{"class":586},[572,6572,1742],{"class":582},[572,6574,6575],{"class":1252},"mergeRelations",[572,6577,1255],{"class":586},[572,6579,590],{"class":582},[572,6581,6582],{"class":586}," [usersRelations",[572,6584,590],{"class":582},[572,6586,6587],{"class":586}," ordersRelations])",[572,6589,612],{"class":582},[499,6591,6592,6593,6596,6597,6599],{},"To hydrate related rows on every query instead of writing manual ",[507,6594,6595],{},"with(...)"," clauses, pass an eager graph as\nthe final ",[507,6598,5166],{}," argument:",[562,6601,6604],{"className":564,"code":6602,"filename":6603,"language":567,"meta":568,"style":568},"export class OrderRepository extends DrizzleLibSQLEntityRepository\u003CDrizzleLibSQLDatabase, Order> {\n  public constructor(database: DrizzleLibSQLDatabase) {\n    super(database, \"Orders\", Order, {\n      user: true, \u002F\u002F include the order's user\n      items: { with: { product: true } }, \u002F\u002F include each item and its product\n    });\n  }\n}\n","eager loading",[507,6605,6606,6632,6650,6674,6690,6721,6730,6734],{"__ignoreMap":568},[572,6607,6608,6610,6612,6615,6617,6619,6621,6623,6625,6628,6630],{"class":574,"line":575},[572,6609,648],{"class":578},[572,6611,652],{"class":651},[572,6613,6614],{"class":655}," OrderRepository",[572,6616,659],{"class":651},[572,6618,593],{"class":655},[572,6620,664],{"class":582},[572,6622,667],{"class":655},[572,6624,590],{"class":582},[572,6626,6627],{"class":655}," Order",[572,6629,674],{"class":582},[572,6631,677],{"class":582},[572,6633,6634,6636,6638,6640,6642,6644,6646,6648],{"class":574,"line":615},[572,6635,683],{"class":651},[572,6637,686],{"class":651},[572,6639,689],{"class":582},[572,6641,693],{"class":692},[572,6643,696],{"class":582},[572,6645,587],{"class":655},[572,6647,701],{"class":582},[572,6649,677],{"class":582},[572,6651,6652,6654,6656,6658,6660,6662,6664,6666,6668,6670,6672],{"class":574,"line":638},[572,6653,709],{"class":586},[572,6655,689],{"class":712},[572,6657,693],{"class":586},[572,6659,590],{"class":582},[572,6661,602],{"class":582},[572,6663,6405],{"class":605},[572,6665,609],{"class":582},[572,6667,590],{"class":582},[572,6669,6627],{"class":586},[572,6671,590],{"class":582},[572,6673,677],{"class":582},[572,6675,6676,6679,6681,6685,6687],{"class":574,"line":645},[572,6677,6678],{"class":712},"      user",[572,6680,696],{"class":582},[572,6682,6684],{"class":6683},"sfNiH"," true",[572,6686,590],{"class":582},[572,6688,6689],{"class":735}," \u002F\u002F include the order's user\n",[572,6691,6692,6695,6697,6699,6702,6704,6706,6709,6711,6713,6715,6718],{"class":574,"line":680},[572,6693,6694],{"class":712},"      items",[572,6696,696],{"class":582},[572,6698,583],{"class":582},[572,6700,6701],{"class":712}," with",[572,6703,696],{"class":582},[572,6705,583],{"class":582},[572,6707,6708],{"class":712}," product",[572,6710,696],{"class":582},[572,6712,6684],{"class":6683},[572,6714,596],{"class":582},[572,6716,6717],{"class":582}," },",[572,6719,6720],{"class":735}," \u002F\u002F include each item and its product\n",[572,6722,6723,6726,6728],{"class":574,"line":706},[572,6724,6725],{"class":582},"    }",[572,6727,701],{"class":712},[572,6729,612],{"class":582},[572,6731,6732],{"class":574,"line":739},[572,6733,742],{"class":582},[572,6735,6736],{"class":574,"line":745},[572,6737,748],{"class":582},[764,6739,6741],{"id":6740},"run-multiple-writes-in-one-transaction","Run multiple writes in one transaction",[499,6743,6744,6745,696],{},"When two writes must both succeed or both roll back, wrap them in ",[507,6746,6747],{},"runInTransaction(handler)",[562,6749,6751],{"className":564,"code":6750,"filename":4765,"language":567,"meta":568,"style":568},"await userRepository.runInTransaction(async () => {\n  await userRepository.save(user); \u002F\u002F both writes join the same active transaction\n  await orderRepository.save(order);\n});\n",[507,6752,6753,6777,6799,6819],{"__ignoreMap":568},[572,6754,6755,6758,6761,6763,6765,6767,6770,6773,6775],{"class":574,"line":575},[572,6756,6757],{"class":578},"await",[572,6759,6760],{"class":586}," userRepository",[572,6762,1742],{"class":582},[572,6764,1939],{"class":1252},[572,6766,689],{"class":586},[572,6768,6769],{"class":651},"async",[572,6771,6772],{"class":582}," ()",[572,6774,5679],{"class":651},[572,6776,677],{"class":582},[572,6778,6779,6782,6784,6786,6788,6790,6792,6794,6796],{"class":574,"line":615},[572,6780,6781],{"class":578},"  await",[572,6783,6760],{"class":586},[572,6785,1742],{"class":582},[572,6787,513],{"class":1252},[572,6789,689],{"class":712},[572,6791,5674],{"class":586},[572,6793,701],{"class":712},[572,6795,732],{"class":582},[572,6797,6798],{"class":735}," \u002F\u002F both writes join the same active transaction\n",[572,6800,6801,6803,6806,6808,6810,6812,6815,6817],{"class":574,"line":638},[572,6802,6781],{"class":578},[572,6804,6805],{"class":586}," orderRepository",[572,6807,1742],{"class":582},[572,6809,513],{"class":1252},[572,6811,689],{"class":712},[572,6813,6814],{"class":586},"order",[572,6816,701],{"class":712},[572,6818,612],{"class":582},[572,6820,6821,6823,6825],{"class":574,"line":645},[572,6822,1333],{"class":582},[572,6824,701],{"class":586},[572,6826,612],{"class":582},[499,6828,6829,6830,6833,6834,1168,6836,6838,6839,6841,6842,6845],{},"Propagation is ",[536,6831,6832],{},"ambient"," — ",[507,6835,513],{},[507,6837,524],{}," find the active transaction on the request ",[507,6840,2059],{},", so\nneither takes a handle. Transactions nest: a transactional service that calls another opens a ",[536,6843,6844],{},"savepoint","\nin the outer transaction instead of deadlocking, committing or rolling back to that point on its own.",[1339,6847,6848,6860],{"type":1341},[499,6849,6850,6855,6856,6859],{},[536,6851,6852,6853,1742],{},"Repository calls outside an HTTP request need a ",[507,6854,2059],{}," The framework opens one per request, but a\ntest, script, or CLI must do it explicitly — without a context the call throws ",[507,6857,6858],{},"No active context — open one with Context.run()",". Wrap the call:",[562,6861,6863],{"className":564,"code":6862,"language":567,"meta":568,"style":568},"await context.run(async () => {\n  await userRepository.save(user);\n});\n",[507,6864,6865,6886,6904],{"__ignoreMap":568},[572,6866,6867,6869,6871,6873,6876,6878,6880,6882,6884],{"class":574,"line":575},[572,6868,6757],{"class":578},[572,6870,1836],{"class":586},[572,6872,1742],{"class":582},[572,6874,6875],{"class":1252},"run",[572,6877,689],{"class":586},[572,6879,6769],{"class":651},[572,6881,6772],{"class":582},[572,6883,5679],{"class":651},[572,6885,677],{"class":582},[572,6887,6888,6890,6892,6894,6896,6898,6900,6902],{"class":574,"line":615},[572,6889,6781],{"class":578},[572,6891,6760],{"class":586},[572,6893,1742],{"class":582},[572,6895,513],{"class":1252},[572,6897,689],{"class":712},[572,6899,5674],{"class":586},[572,6901,701],{"class":712},[572,6903,612],{"class":582},[572,6905,6906,6908,6910],{"class":574,"line":638},[572,6907,1333],{"class":582},[572,6909,701],{"class":586},[572,6911,612],{"class":582},[764,6913,6915],{"id":6914},"transaction-lifecycle-hooks","Transaction lifecycle hooks",[499,6917,6918,6919,6922],{},"The Drizzle database exposes three hooks you register on the ",[536,6920,6921],{},"currently active"," transaction. All three\nare scoped per transaction handle and are no-ops when no transaction is active.",[562,6924,6926],{"className":564,"code":6925,"language":567,"meta":568,"style":568},"\u002F\u002F onBeforeCommit — run INSIDE the transaction just before the outermost commit.\n\u002F\u002F A throw aborts the commit and rolls the whole transaction back.\ndatabase.onBeforeCommit(async () => {\n  await outboxStore.flush(); \u002F\u002F append outbox rows atomically with the aggregate write\n});\n\n\u002F\u002F onCommit — run once the outermost transaction has durably committed.\n\u002F\u002F The commit is already permanent; a throwing hook is logged and absorbed (never re-thrown).\ndatabase.onCommit(async () => {\n  await relay.scheduleNextDrain(); \u002F\u002F dispatch integration events after the durable write\n});\n\n\u002F\u002F onRollback — run when the active transaction rolls back.\n\u002F\u002F Used internally by the repository to restore in-memory aggregate state.\ndatabase.onRollback(() => {\n  entity.restoreFromSavepoint(); \u002F\u002F keep in-memory entity state consistent with the rolled-back row\n});\n",[507,6927,6928,6933,6938,6957,6976,6984,6988,6993,6998,7017,7036,7044,7048,7053,7058,7074,7091],{"__ignoreMap":568},[572,6929,6930],{"class":574,"line":575},[572,6931,6932],{"class":735},"\u002F\u002F onBeforeCommit — run INSIDE the transaction just before the outermost commit.\n",[572,6934,6935],{"class":574,"line":615},[572,6936,6937],{"class":735},"\u002F\u002F A throw aborts the commit and rolls the whole transaction back.\n",[572,6939,6940,6942,6944,6947,6949,6951,6953,6955],{"class":574,"line":638},[572,6941,693],{"class":586},[572,6943,1742],{"class":582},[572,6945,6946],{"class":1252},"onBeforeCommit",[572,6948,689],{"class":586},[572,6950,6769],{"class":651},[572,6952,6772],{"class":582},[572,6954,5679],{"class":651},[572,6956,677],{"class":582},[572,6958,6959,6961,6964,6966,6969,6971,6973],{"class":574,"line":645},[572,6960,6781],{"class":578},[572,6962,6963],{"class":586}," outboxStore",[572,6965,1742],{"class":582},[572,6967,6968],{"class":1252},"flush",[572,6970,3221],{"class":712},[572,6972,732],{"class":582},[572,6974,6975],{"class":735}," \u002F\u002F append outbox rows atomically with the aggregate write\n",[572,6977,6978,6980,6982],{"class":574,"line":680},[572,6979,1333],{"class":582},[572,6981,701],{"class":586},[572,6983,612],{"class":582},[572,6985,6986],{"class":574,"line":706},[572,6987,642],{"emptyLinePlaceholder":641},[572,6989,6990],{"class":574,"line":739},[572,6991,6992],{"class":735},"\u002F\u002F onCommit — run once the outermost transaction has durably committed.\n",[572,6994,6995],{"class":574,"line":745},[572,6996,6997],{"class":735},"\u002F\u002F The commit is already permanent; a throwing hook is logged and absorbed (never re-thrown).\n",[572,6999,7000,7002,7004,7007,7009,7011,7013,7015],{"class":574,"line":1330},[572,7001,693],{"class":586},[572,7003,1742],{"class":582},[572,7005,7006],{"class":1252},"onCommit",[572,7008,689],{"class":586},[572,7010,6769],{"class":651},[572,7012,6772],{"class":582},[572,7014,5679],{"class":651},[572,7016,677],{"class":582},[572,7018,7019,7021,7024,7026,7029,7031,7033],{"class":574,"line":1760},[572,7020,6781],{"class":578},[572,7022,7023],{"class":586}," relay",[572,7025,1742],{"class":582},[572,7027,7028],{"class":1252},"scheduleNextDrain",[572,7030,3221],{"class":712},[572,7032,732],{"class":582},[572,7034,7035],{"class":735}," \u002F\u002F dispatch integration events after the durable write\n",[572,7037,7038,7040,7042],{"class":574,"line":1765},[572,7039,1333],{"class":582},[572,7041,701],{"class":586},[572,7043,612],{"class":582},[572,7045,7046],{"class":574,"line":1770},[572,7047,642],{"emptyLinePlaceholder":641},[572,7049,7050],{"class":574,"line":1789},[572,7051,7052],{"class":735},"\u002F\u002F onRollback — run when the active transaction rolls back.\n",[572,7054,7055],{"class":574,"line":1800},[572,7056,7057],{"class":735},"\u002F\u002F Used internally by the repository to restore in-memory aggregate state.\n",[572,7059,7060,7062,7064,7066,7068,7070,7072],{"class":574,"line":1806},[572,7061,693],{"class":586},[572,7063,1742],{"class":582},[572,7065,1954],{"class":1252},[572,7067,689],{"class":586},[572,7069,3221],{"class":582},[572,7071,5679],{"class":651},[572,7073,677],{"class":582},[572,7075,7076,7079,7081,7084,7086,7088],{"class":574,"line":1818},[572,7077,7078],{"class":586},"  entity",[572,7080,1742],{"class":582},[572,7082,7083],{"class":1252},"restoreFromSavepoint",[572,7085,3221],{"class":712},[572,7087,732],{"class":582},[572,7089,7090],{"class":735}," \u002F\u002F keep in-memory entity state consistent with the rolled-back row\n",[572,7092,7093,7095,7097],{"class":574,"line":1848},[572,7094,1333],{"class":582},[572,7096,701],{"class":586},[572,7098,612],{"class":582},[499,7100,7101,7102,1168,7104,7106,7107,7110,7111,7113],{},"Both ",[507,7103,6946],{},[507,7105,7006],{}," hooks ",[536,7108,7109],{},"bubble to the outermost transaction",": a hook registered\ninside a nested savepoint is moved to the parent when the savepoint commits, and fires only when the\noutermost transaction commits. A rolled-back transaction never fires its commit hooks. ",[507,7112,1954],{}," hooks\nwork the inverse way — they fire for the innermost failing scope (the savepoint that rolled back), not the\nparent.",[499,7115,7116,7117,7119,7120,7122],{},"These hooks are what make the drizzle transactional outbox reliable: the producer registers an\n",[507,7118,6946],{}," hook that appends the outbox rows to the same transaction the aggregate write runs in,\nthen an ",[507,7121,7006],{}," hook that schedules the relay drain after the durable commit.",[764,7124,7126],{"id":7125},"deep-aggregate-persistence","Deep aggregate persistence",[499,7128,7129,1940,7131,7134,7135,7138,7139,7142],{},[507,7130,513],{},[536,7132,7133],{},"deep",": it persists the aggregate root ",[536,7136,7137],{},"and"," its eager-loaded children in one transaction.\nOrphan removal runs automatically — a child that was loaded and then removed from a collection is\n",[507,7140,7141],{},"DELETE","d when the root is saved.",[499,7144,7145,7146,7148,7149,7152],{},"For ",[507,7147,513],{}," to reach a child entity you must declare it in the repository's ",[507,7150,7151],{},"relatedEntities"," graph (the\nsame graph that configures eager loading on reads):",[562,7154,7157],{"className":564,"code":7155,"filename":7156,"language":567,"meta":568,"style":568},"import { DrizzleLibSQLDatabase, DrizzleLibSQLEntityRepository } from \"@heximon\u002Fdrizzle\u002Flibsql\";\nimport { Order } from \".\u002Forder.entity\";\n\nexport class OrderRepository extends DrizzleLibSQLEntityRepository\u003CDrizzleLibSQLDatabase, Order> {\n  public constructor(database: DrizzleLibSQLDatabase) {\n    super(database, \"Orders\", Order, {\n      items: true, \u002F\u002F load and deep-save the order's items\n    });\n  }\n}\n","src\u002Forders\u002Forder.repository.ts",[507,7158,7159,7183,7204,7208,7232,7250,7274,7287,7295,7299],{"__ignoreMap":568},[572,7160,7161,7163,7165,7167,7169,7171,7173,7175,7177,7179,7181],{"class":574,"line":575},[572,7162,579],{"class":578},[572,7164,583],{"class":582},[572,7166,587],{"class":586},[572,7168,590],{"class":582},[572,7170,593],{"class":586},[572,7172,596],{"class":582},[572,7174,599],{"class":578},[572,7176,602],{"class":582},[572,7178,606],{"class":605},[572,7180,609],{"class":582},[572,7182,612],{"class":582},[572,7184,7185,7187,7189,7191,7193,7195,7197,7200,7202],{"class":574,"line":615},[572,7186,579],{"class":578},[572,7188,583],{"class":582},[572,7190,6627],{"class":586},[572,7192,596],{"class":582},[572,7194,599],{"class":578},[572,7196,602],{"class":582},[572,7198,7199],{"class":605},".\u002Forder.entity",[572,7201,609],{"class":582},[572,7203,612],{"class":582},[572,7205,7206],{"class":574,"line":638},[572,7207,642],{"emptyLinePlaceholder":641},[572,7209,7210,7212,7214,7216,7218,7220,7222,7224,7226,7228,7230],{"class":574,"line":645},[572,7211,648],{"class":578},[572,7213,652],{"class":651},[572,7215,6614],{"class":655},[572,7217,659],{"class":651},[572,7219,593],{"class":655},[572,7221,664],{"class":582},[572,7223,667],{"class":655},[572,7225,590],{"class":582},[572,7227,6627],{"class":655},[572,7229,674],{"class":582},[572,7231,677],{"class":582},[572,7233,7234,7236,7238,7240,7242,7244,7246,7248],{"class":574,"line":680},[572,7235,683],{"class":651},[572,7237,686],{"class":651},[572,7239,689],{"class":582},[572,7241,693],{"class":692},[572,7243,696],{"class":582},[572,7245,587],{"class":655},[572,7247,701],{"class":582},[572,7249,677],{"class":582},[572,7251,7252,7254,7256,7258,7260,7262,7264,7266,7268,7270,7272],{"class":574,"line":706},[572,7253,709],{"class":586},[572,7255,689],{"class":712},[572,7257,693],{"class":586},[572,7259,590],{"class":582},[572,7261,602],{"class":582},[572,7263,6405],{"class":605},[572,7265,609],{"class":582},[572,7267,590],{"class":582},[572,7269,6627],{"class":586},[572,7271,590],{"class":582},[572,7273,677],{"class":582},[572,7275,7276,7278,7280,7282,7284],{"class":574,"line":739},[572,7277,6694],{"class":712},[572,7279,696],{"class":582},[572,7281,6684],{"class":6683},[572,7283,590],{"class":582},[572,7285,7286],{"class":735}," \u002F\u002F load and deep-save the order's items\n",[572,7288,7289,7291,7293],{"class":574,"line":745},[572,7290,6725],{"class":582},[572,7292,701],{"class":712},[572,7294,612],{"class":582},[572,7296,7297],{"class":574,"line":1330},[572,7298,742],{"class":582},[572,7300,7301],{"class":574,"line":1760},[572,7302,748],{"class":582},[499,7304,7305,7306,696],{},"The deep write runs in three phases per ",[507,7307,513],{},[7309,7310,7311,7318,7341],"ol",{},[7312,7313,7314,7317],"li",{},[536,7315,7316],{},"Snapshot orphan pre-image."," The child primary keys present at the last load (the entity's snapshot)\nare captured before any mutation — these are the \"known children\" the diff runs against.",[7312,7319,7320,7323,7324,7327,7328,7330,7331,539,7333,7335,7336,1280,7338,7340],{},[536,7321,7322],{},"Cascade save."," Each child entity's dirty state is settled (",[507,7325,7326],{},"commitChanges","), then routed:\n",[507,7329,6046],{}," → batched ",[507,7332,6057],{},[507,7334,6077],{}," (mutated since load) → version-guarded ",[507,7337,3016],{},[507,7339,6064],{}," (unchanged) → no query. Optimistic concurrency is enforced at every level.",[7312,7342,7343,7346,7347,7349],{},[536,7344,7345],{},"Orphan removal."," The current child keys are compared against the pre-image; any key that was loaded\nbut is no longer present in the collection gets a cascade ",[507,7348,7141],{}," (deepest relation first, so foreign\nkeys hold).",[499,7351,7352,7353,7355],{},"An in-memory savepoint is captured before the write and restored on rollback (via an ",[507,7354,1954],{}," hook),\nso the aggregate's dirty state, version, and snapshot all revert with the SQL rows if the transaction fails.",[1339,7357,7358,7361,7362,7364],{"type":1917},[536,7359,7360],{},"Orphan removal only reaches children in the eager-load graph."," A child collection that was NOT declared\nin ",[507,7363,7151],{}," is never loaded and therefore never diffed — removing an item from the collection\nwithout first loading the aggregate leaves orphaned rows in the database.",[764,7366,7368],{"id":7367},"sql-outbox-store","SQL outbox store",[499,7370,7371,7374,7375,7378,7379,7382],{},[507,7372,7373],{},"DrizzleOutboxStore"," is the drizzle implementation of the DDD ",[507,7376,7377],{},"OutboxStore"," port. It stores outbox rows in\na table you declare in your schema by spreading the dialect-core ",[507,7380,7381],{},"outboxColumns()"," helper:",[772,7384,7385,7476,7562],{},[562,7386,7388],{"className":564,"code":7387,"filename":3049,"language":567,"meta":568,"style":568},"import { outboxColumns } from \"@heximon\u002Fdrizzle\u002Fsqlite-core\";\nimport { sqliteTable } from \"drizzle-orm\u002Fsqlite-core\";\n\nexport const outbox = sqliteTable(\"outbox\", { ...outboxColumns() });\n",[507,7389,7390,7411,7432,7436],{"__ignoreMap":568},[572,7391,7392,7394,7396,7399,7401,7403,7405,7407,7409],{"class":574,"line":575},[572,7393,579],{"class":578},[572,7395,583],{"class":582},[572,7397,7398],{"class":586}," outboxColumns",[572,7400,596],{"class":582},[572,7402,599],{"class":578},[572,7404,602],{"class":582},[572,7406,3079],{"class":605},[572,7408,609],{"class":582},[572,7410,612],{"class":582},[572,7412,7413,7415,7417,7420,7422,7424,7426,7428,7430],{"class":574,"line":615},[572,7414,579],{"class":578},[572,7416,583],{"class":582},[572,7418,7419],{"class":586}," sqliteTable",[572,7421,596],{"class":582},[572,7423,599],{"class":578},[572,7425,602],{"class":582},[572,7427,3106],{"class":605},[572,7429,609],{"class":582},[572,7431,612],{"class":582},[572,7433,7434],{"class":574,"line":638},[572,7435,642],{"emptyLinePlaceholder":641},[572,7437,7438,7440,7442,7445,7447,7449,7451,7453,7456,7458,7460,7462,7465,7468,7470,7472,7474],{"class":574,"line":645},[572,7439,648],{"class":578},[572,7441,1240],{"class":651},[572,7443,7444],{"class":586}," outbox ",[572,7446,1246],{"class":582},[572,7448,7419],{"class":1252},[572,7450,689],{"class":586},[572,7452,609],{"class":582},[572,7454,7455],{"class":605},"outbox",[572,7457,609],{"class":582},[572,7459,590],{"class":582},[572,7461,583],{"class":582},[572,7463,7464],{"class":582}," ...",[572,7466,7467],{"class":1252},"outboxColumns",[572,7469,3411],{"class":586},[572,7471,1333],{"class":582},[572,7473,701],{"class":586},[572,7475,612],{"class":582},[562,7477,7479],{"className":564,"code":7478,"filename":3429,"language":567,"meta":568,"style":568},"import { outboxColumns } from \"@heximon\u002Fdrizzle\u002Fpg-core\";\nimport { pgTable } from \"drizzle-orm\u002Fpg-core\";\n\nexport const outbox = pgTable(\"outbox\", { ...outboxColumns() });\n",[507,7480,7481,7501,7522,7526],{"__ignoreMap":568},[572,7482,7483,7485,7487,7489,7491,7493,7495,7497,7499],{"class":574,"line":575},[572,7484,579],{"class":578},[572,7486,583],{"class":582},[572,7488,7398],{"class":586},[572,7490,596],{"class":582},[572,7492,599],{"class":578},[572,7494,602],{"class":582},[572,7496,3462],{"class":605},[572,7498,609],{"class":582},[572,7500,612],{"class":582},[572,7502,7503,7505,7507,7510,7512,7514,7516,7518,7520],{"class":574,"line":615},[572,7504,579],{"class":578},[572,7506,583],{"class":582},[572,7508,7509],{"class":586}," pgTable",[572,7511,596],{"class":582},[572,7513,599],{"class":578},[572,7515,602],{"class":582},[572,7517,3487],{"class":605},[572,7519,609],{"class":582},[572,7521,612],{"class":582},[572,7523,7524],{"class":574,"line":638},[572,7525,642],{"emptyLinePlaceholder":641},[572,7527,7528,7530,7532,7534,7536,7538,7540,7542,7544,7546,7548,7550,7552,7554,7556,7558,7560],{"class":574,"line":645},[572,7529,648],{"class":578},[572,7531,1240],{"class":651},[572,7533,7444],{"class":586},[572,7535,1246],{"class":582},[572,7537,7509],{"class":1252},[572,7539,689],{"class":586},[572,7541,609],{"class":582},[572,7543,7455],{"class":605},[572,7545,609],{"class":582},[572,7547,590],{"class":582},[572,7549,583],{"class":582},[572,7551,7464],{"class":582},[572,7553,7467],{"class":1252},[572,7555,3411],{"class":586},[572,7557,1333],{"class":582},[572,7559,701],{"class":586},[572,7561,612],{"class":582},[562,7563,7565],{"className":564,"code":7564,"filename":2355,"language":567,"meta":568,"style":568},"import { outboxColumns } from \"@heximon\u002Fdrizzle\u002Fmysql-core\";\nimport { mysqlTable } from \"drizzle-orm\u002Fmysql-core\";\n\nexport const outbox = mysqlTable(\"outbox\", { ...outboxColumns() });\n",[507,7566,7567,7587,7608,7612],{"__ignoreMap":568},[572,7568,7569,7571,7573,7575,7577,7579,7581,7583,7585],{"class":574,"line":575},[572,7570,579],{"class":578},[572,7572,583],{"class":582},[572,7574,7398],{"class":586},[572,7576,596],{"class":582},[572,7578,599],{"class":578},[572,7580,602],{"class":582},[572,7582,2362],{"class":605},[572,7584,609],{"class":582},[572,7586,612],{"class":582},[572,7588,7589,7591,7593,7596,7598,7600,7602,7604,7606],{"class":574,"line":615},[572,7590,579],{"class":578},[572,7592,583],{"class":582},[572,7594,7595],{"class":586}," mysqlTable",[572,7597,596],{"class":582},[572,7599,599],{"class":578},[572,7601,602],{"class":582},[572,7603,3841],{"class":605},[572,7605,609],{"class":582},[572,7607,612],{"class":582},[572,7609,7610],{"class":574,"line":638},[572,7611,642],{"emptyLinePlaceholder":641},[572,7613,7614,7616,7618,7620,7622,7624,7626,7628,7630,7632,7634,7636,7638,7640,7642,7644,7646],{"class":574,"line":645},[572,7615,648],{"class":578},[572,7617,1240],{"class":651},[572,7619,7444],{"class":586},[572,7621,1246],{"class":582},[572,7623,7595],{"class":1252},[572,7625,689],{"class":586},[572,7627,609],{"class":582},[572,7629,7455],{"class":605},[572,7631,609],{"class":582},[572,7633,590],{"class":582},[572,7635,583],{"class":582},[572,7637,7464],{"class":582},[572,7639,7467],{"class":1252},[572,7641,3411],{"class":586},[572,7643,1333],{"class":582},[572,7645,701],{"class":586},[572,7647,612],{"class":582},[499,7649,7650,7651,7653,7654,7656,7657,7659],{},"Then bind ",[507,7652,7377],{}," to a ",[507,7655,7373],{}," constructed over your database and the table, with a\n",[507,7658,757],{}," provider — the same shape every other DI-can't-express construction takes:",[562,7661,7664],{"className":564,"code":7662,"filename":7663,"language":567,"meta":568,"style":568},"import { OutboxStore } from \"@heximon\u002Fintegration\";\nimport { DrizzleOutboxStore } from \"@heximon\u002Fdrizzle\u002Fcore\";\nimport { outbox } from \".\u002Forder.schema\";\n\n\u002F\u002F inside the module's providers:\n{\n  provide: OutboxStore,\n  useFactory: (database: OrderSqliteDatabase): OutboxStore =>\n    new DrizzleOutboxStore(database, outbox),\n}\n","src\u002Forders\u002Forder.module.ts",[507,7665,7666,7688,7709,7731,7735,7740,7744,7755,7777,7796],{"__ignoreMap":568},[572,7667,7668,7670,7672,7675,7677,7679,7681,7684,7686],{"class":574,"line":575},[572,7669,579],{"class":578},[572,7671,583],{"class":582},[572,7673,7674],{"class":586}," OutboxStore",[572,7676,596],{"class":582},[572,7678,599],{"class":578},[572,7680,602],{"class":582},[572,7682,7683],{"class":605},"@heximon\u002Fintegration",[572,7685,609],{"class":582},[572,7687,612],{"class":582},[572,7689,7690,7692,7694,7697,7699,7701,7703,7705,7707],{"class":574,"line":615},[572,7691,579],{"class":578},[572,7693,583],{"class":582},[572,7695,7696],{"class":586}," DrizzleOutboxStore",[572,7698,596],{"class":582},[572,7700,599],{"class":578},[572,7702,602],{"class":582},[572,7704,6328],{"class":605},[572,7706,609],{"class":582},[572,7708,612],{"class":582},[572,7710,7711,7713,7715,7718,7720,7722,7724,7727,7729],{"class":574,"line":638},[572,7712,579],{"class":578},[572,7714,583],{"class":582},[572,7716,7717],{"class":586}," outbox",[572,7719,596],{"class":582},[572,7721,599],{"class":578},[572,7723,602],{"class":582},[572,7725,7726],{"class":605},".\u002Forder.schema",[572,7728,609],{"class":582},[572,7730,612],{"class":582},[572,7732,7733],{"class":574,"line":645},[572,7734,642],{"emptyLinePlaceholder":641},[572,7736,7737],{"class":574,"line":680},[572,7738,7739],{"class":735},"\u002F\u002F inside the module's providers:\n",[572,7741,7742],{"class":574,"line":706},[572,7743,1786],{"class":582},[572,7745,7746,7749,7751,7753],{"class":574,"line":739},[572,7747,7748],{"class":655},"  provide",[572,7750,696],{"class":582},[572,7752,7674],{"class":586},[572,7754,1280],{"class":582},[572,7756,7757,7760,7762,7764,7766,7768,7771,7773,7775],{"class":574,"line":745},[572,7758,7759],{"class":655},"  useFactory",[572,7761,696],{"class":582},[572,7763,1083],{"class":582},[572,7765,693],{"class":692},[572,7767,696],{"class":582},[572,7769,7770],{"class":655}," OrderSqliteDatabase",[572,7772,1174],{"class":582},[572,7774,7674],{"class":655},[572,7776,1845],{"class":651},[572,7778,7779,7782,7784,7786,7788,7790,7792,7794],{"class":574,"line":1330},[572,7780,7781],{"class":582},"    new",[572,7783,7696],{"class":1252},[572,7785,689],{"class":712},[572,7787,693],{"class":586},[572,7789,590],{"class":582},[572,7791,7717],{"class":586},[572,7793,701],{"class":712},[572,7795,1280],{"class":582},[572,7797,7798],{"class":574,"line":1760},[572,7799,748],{"class":582},[499,7801,7802,7804,7805,7807],{},[507,7803,7373],{}," implements the full ",[507,7806,7377],{}," protocol:",[1042,7809,7810,7820],{},[1045,7811,7812],{},[1048,7813,7814,7817],{},[1051,7815,7816],{"align":6027},"Method",[1051,7818,7819],{"align":6027},"What it does",[1065,7821,7822,7836,7854,7864],{},[1048,7823,7824,7829],{},[1070,7825,7826],{"align":6027},[507,7827,7828],{},"append(records)",[1070,7830,7831,7832,7835],{"align":6027},"INSERTs rows through ",[507,7833,7834],{},"executeStatement"," — routes into the active transaction, so rows commit atomically with the aggregate write",[1048,7837,7838,7843],{},[1070,7839,7840],{"align":6027},[507,7841,7842],{},"claimPending(limit)",[1070,7844,7845,7846,7849,7850,7853],{"align":6027},"Opens its own fresh transaction, claims up to ",[507,7847,7848],{},"limit"," pending rows in id order with per-dialect locking (pg\u002Fmysql ",[507,7851,7852],{},"FOR UPDATE SKIP LOCKED","; SQLite serializes via the write transaction itself), marks them claimed",[1048,7855,7856,7861],{},[1070,7857,7858],{"align":6027},[507,7859,7860],{},"markProcessed(ids)",[1070,7862,7863],{"align":6027},"DELETEs the delivered rows",[1048,7865,7866,7871],{},[1070,7867,7868],{"align":6027},[507,7869,7870],{},"markFailed(id, attempt)",[1070,7872,7873,7874,7877],{"align":6027},"Persists the bumped attempt count and clears the claim; dead-letters the row once ",[507,7875,7876],{},"attempt"," reaches the threshold (default 5)",[499,7879,7880,7881,7886],{},"The full reliable tier — outbox store + producer + relay — is wired as three providers in the feature\nmodule; see ",[503,7882,7885],{"href":7883,"rel":7884},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fflagship",[533],"Flagship — transactional outbox","\nfor the complete wiring.",[764,7888,7890],{"id":7889},"wire-the-database-once","Wire the database once",[499,7892,751,7893,7895,7896,7898],{},[507,7894,77],{}," is one instance per app, bound as a ",[507,7897,757],{}," provider so every repository shares it and\nthe ambient transaction stays request-wide. The factory's parameter type is its dependency — no token:",[562,7900,7902],{"className":564,"code":7901,"filename":1572,"language":567,"meta":568,"style":568},"import { Context, Module } from \"@heximon\u002Fruntime\";\nimport { DrizzleLibSQLDatabase } from \"@heximon\u002Fdrizzle\u002Flibsql\";\nimport { databaseConfig } from \".\u002Fdatabase.config\";\n\nexport class DatabaseModule extends Module({\n  providers: [\n    {\n      provide: DrizzleLibSQLDatabase,\n      useFactory: (context: Context) => new DrizzleLibSQLDatabase(databaseConfig, context),\n    },\n  ],\n  exports: [DrizzleLibSQLDatabase], \u002F\u002F feature modules import this to inject the database\n}) {}\n",[507,7903,7904,7928,7948,7969,7973,7989,7997,8001,8011,8044,8048,8054,8068],{"__ignoreMap":568},[572,7905,7906,7908,7910,7912,7914,7916,7918,7920,7922,7924,7926],{"class":574,"line":575},[572,7907,579],{"class":578},[572,7909,583],{"class":582},[572,7911,1586],{"class":586},[572,7913,590],{"class":582},[572,7915,1591],{"class":586},[572,7917,596],{"class":582},[572,7919,599],{"class":578},[572,7921,602],{"class":582},[572,7923,1600],{"class":605},[572,7925,609],{"class":582},[572,7927,612],{"class":582},[572,7929,7930,7932,7934,7936,7938,7940,7942,7944,7946],{"class":574,"line":615},[572,7931,579],{"class":578},[572,7933,583],{"class":582},[572,7935,587],{"class":586},[572,7937,596],{"class":582},[572,7939,599],{"class":578},[572,7941,602],{"class":582},[572,7943,606],{"class":605},[572,7945,609],{"class":582},[572,7947,612],{"class":582},[572,7949,7950,7952,7954,7957,7959,7961,7963,7965,7967],{"class":574,"line":638},[572,7951,579],{"class":578},[572,7953,583],{"class":582},[572,7955,7956],{"class":586}," databaseConfig",[572,7958,596],{"class":582},[572,7960,599],{"class":578},[572,7962,602],{"class":582},[572,7964,1695],{"class":605},[572,7966,609],{"class":582},[572,7968,612],{"class":582},[572,7970,7971],{"class":574,"line":645},[572,7972,642],{"emptyLinePlaceholder":641},[572,7974,7975,7977,7979,7981,7983,7985,7987],{"class":574,"line":680},[572,7976,648],{"class":578},[572,7978,652],{"class":651},[572,7980,1777],{"class":655},[572,7982,659],{"class":651},[572,7984,1591],{"class":1252},[572,7986,689],{"class":586},[572,7988,1786],{"class":582},[572,7990,7991,7993,7995],{"class":574,"line":706},[572,7992,1792],{"class":712},[572,7994,696],{"class":582},[572,7996,1797],{"class":586},[572,7998,7999],{"class":574,"line":739},[572,8000,1803],{"class":582},[572,8002,8003,8005,8007,8009],{"class":574,"line":745},[572,8004,1809],{"class":712},[572,8006,696],{"class":582},[572,8008,587],{"class":586},[572,8010,1280],{"class":582},[572,8012,8013,8015,8017,8019,8022,8024,8026,8028,8030,8032,8034,8037,8039,8042],{"class":574,"line":1330},[572,8014,1821],{"class":1252},[572,8016,696],{"class":582},[572,8018,1083],{"class":582},[572,8020,8021],{"class":692},"context",[572,8023,696],{"class":582},[572,8025,1586],{"class":655},[572,8027,701],{"class":582},[572,8029,5679],{"class":651},[572,8031,1249],{"class":582},[572,8033,587],{"class":1252},[572,8035,8036],{"class":586},"(databaseConfig",[572,8038,590],{"class":582},[572,8040,8041],{"class":586}," context)",[572,8043,1280],{"class":582},[572,8045,8046],{"class":574,"line":1760},[572,8047,1882],{"class":582},[572,8049,8050,8052],{"class":574,"line":1765},[572,8051,1888],{"class":586},[572,8053,1280],{"class":582},[572,8055,8056,8058,8060,8063,8065],{"class":574,"line":1770},[572,8057,1896],{"class":712},[572,8059,696],{"class":582},[572,8061,8062],{"class":586}," [DrizzleLibSQLDatabase]",[572,8064,590],{"class":582},[572,8066,8067],{"class":735}," \u002F\u002F feature modules import this to inject the database\n",[572,8069,8070,8072,8074],{"class":574,"line":1789},[572,8071,1333],{"class":582},[572,8073,1911],{"class":586},[572,8075,1914],{"class":582},[499,8077,1958,8078,8081,8082,8084,8085,8088],{},[507,8079,8080],{},"databaseConfig"," is authored once and consumed twice — by the runtime factory and by ",[507,8083,6164],{}," for\nmigration generation. The ",[503,8086,8087],{"href":88},"Database wiring"," page walks through the unified config and\nlifecycle.",[764,8090,92],{"id":8091},"migrations",[499,8093,8094,8095,8098,8099,8102,8103,8106,8107,8110,8111,8113],{},"Heximon ships the migration ",[536,8096,8097],{},"runner",", not a schema-diff CLI: you author ",[507,8100,8101],{},".sql"," with stock ",[507,8104,8105],{},"drizzle-kit generate"," (it reads the same config), and the runner applies an already-generated folder at boot.\nApplication is idempotent and forward-only, since Drizzle emits no ",[507,8108,8109],{},"down"," SQL. The\n",[503,8112,92],{"href":93}," page covers generating and applying them end-to-end.",[764,8115,8117],{"id":8116},"custom-column-codecs","Custom column codecs",[499,8119,8120,8121,8124,8125,8128,8129,8131],{},"Each dialect ships codecs that round-trip non-trivial values. Import them from the dialect's ",[507,8122,8123],{},"*-core","\nsubpath — ",[536,8126,8127],{},"not"," the root barrel, where the differently-typed ",[507,8130,4186],{},"s would collide:",[1042,8133,8134,8146],{},[1045,8135,8136],{},[1048,8137,8138,8141,8143],{},[1051,8139,8140],{"align":6027},"Dialect",[1051,8142,1053],{"align":6027},[1051,8144,8145],{"align":6027},"Codecs",[1065,8147,8148,8167,8188],{},[1048,8149,8150,8152,8156],{},[1070,8151,3049],{"align":6027},[1070,8153,8154],{"align":6027},[507,8155,3079],{},[1070,8157,8158,8160,8161,8163,8164],{"align":6027},[507,8159,4186],{}," (ISO text ⇄ ",[507,8162,4190],{},"), ",[507,8165,8166],{},"noCaseText",[1048,8168,8169,8171,8175],{},[1070,8170,3429],{"align":6027},[1070,8172,8173],{"align":6027},[507,8174,3462],{},[1070,8176,8177,8179,8180,8163,8183,8185,8186,701],{"align":6027},[507,8178,4186],{}," (→ ",[507,8181,8182],{},"TIMESTAMPTZ(3)",[507,8184,5806],{}," (→ native ",[507,8187,5806],{},[1048,8189,8190,8192,8196],{},[1070,8191,2355],{"align":6027},[1070,8193,8194],{"align":6027},[507,8195,2362],{},[1070,8197,8198,8179,8200,8163,8203,8179,8205,8163,8208,8179,8211,701],{"align":6027},[507,8199,4186],{},[507,8201,8202],{},"DATETIME(3)",[507,8204,5806],{},[507,8206,8207],{},"CHAR(36)",[507,8209,8210],{},"binaryUuid",[507,8212,8213],{},"BINARY(16)",[764,8215,8217],{"id":8216},"see-also","See also",[8219,8220,8221,8232,8240,8255,8266,8273,8295,8307,8320],"ul",{},[7312,8222,8223,8225,8226,8228,8229,8231],{},[503,8224,8087],{"href":88}," — the ",[507,8227,757],{}," provider, the unified config, and the per-app\n",[507,8230,77],{}," lifecycle.",[7312,8233,8234,8236,8237,8239],{},[503,8235,92],{"href":93}," — generate with ",[507,8238,6164],{},", apply on boot with the migration runner.",[7312,8241,8242,8245,8246,514,8248,8250,8251,8254],{},[503,8243,8244],{"href":88},"Persistence contracts"," — the dialect-agnostic ",[507,8247,77],{},[507,8249,1939],{},"\n\u002F ",[507,8252,8253],{},"MigrationRunner"," surface Drizzle implements.",[7312,8256,8257,8225,8259,514,8261,514,8263,8265],{},[503,8258,228],{"href":229},[507,8260,3027],{},[507,8262,2540],{},[507,8264,3032],{}," bases these\nschemas persist.",[7312,8267,8268,8225,8270,8272],{},[503,8269,238],{"href":239},[507,8271,4746],{}," contract behind the Drizzle\nbase, and the optimistic concurrency that feeds CQRS retry.",[7312,8274,8275,8282,8283,8285,8286,8288,8289,8291,8292,8294],{},[503,8276,8279],{"href":8277,"rel":8278},"https:\u002F\u002Fgithub.com\u002Fheximon\u002Fheximon\u002Ftree\u002Fmain\u002Fexamples\u002Fladder\u002FL06-ddd",[533],[536,8280,8281],{},"Example L06 — DDD","\n— a ",[507,8284,509],{}," aggregate over libsql with a flattened ",[507,8287,4214],{}," column, plus a test that compiles the app,\ndrives the ",[507,8290,5551],{}," endpoints, and proves the ",[507,8293,6118],{}," on a stale concurrent save.",[7312,8296,8297,8303,8304,8306],{},[503,8298,8300],{"href":1989,"rel":8299},[533],[536,8301,8302],{},"Example L04 — database","\n— the minimal database wiring without the DDD layer, for a feel of the bare ",[507,8305,77],{}," + repository setup.",[7312,8308,8309,8315,8316,8319],{},[503,8310,8312],{"href":8277,"rel":8311},[533],[536,8313,8314],{},"L06 — DDD","\n— an ",[507,8317,8318],{},"Order"," aggregate with value objects and domain events, the pattern these repositories persist.",[7312,8321,8322,8327,8328,8330,8331,8334],{},[503,8323,8325],{"href":7883,"rel":8324},[533],[536,8326,7885],{},"\n— the full outbox tier: ",[507,8329,7373],{}," + ",[507,8332,8333],{},"OutboxIntegrationEventTransport"," producer + relay, wired so\nintegration events are published reliably after commit.",[8336,8337,8338],"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 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 .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":568,"searchDepth":615,"depth":615,"links":8340},[8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357,8358,8359],{"id":766,"depth":615,"text":767},{"id":1029,"depth":615,"text":1030},{"id":2004,"depth":615,"text":2005},{"id":2530,"depth":615,"text":2531},{"id":3036,"depth":615,"text":3037},{"id":4207,"depth":615,"text":4208},{"id":4735,"depth":615,"text":4736},{"id":5377,"depth":615,"text":5378},{"id":6007,"depth":615,"text":6008},{"id":6099,"depth":615,"text":6100},{"id":6157,"depth":615,"text":6158},{"id":6740,"depth":615,"text":6741},{"id":6914,"depth":615,"text":6915},{"id":7125,"depth":615,"text":7126},{"id":7367,"depth":615,"text":7368},{"id":7889,"depth":615,"text":7890},{"id":8091,"depth":615,"text":92},{"id":8116,"depth":615,"text":8117},{"id":8216,"depth":615,"text":8217},"Map domain entities to Drizzle tables — value-object columns, DDD repositories, optimistic concurrency, relations, nested transactions, and seven dialects (libsql, better-sqlite3, Cloudflare D1, Durable Object SQLite, Postgres, MySQL, Cloudflare Hyperdrive MySQL).","md",null,{},{"icon":85},{"title":82,"description":8360},"wkMMjigjaJfhIvO9H-IMkeeTJxGSxyCePrSAFllFocY",[8368,8370],{"title":77,"path":78,"stem":79,"description":8369,"icon":80,"children":-1},"Wire a real SQLite database into a CRUD API with no install and no compiler plugin — the unified DrizzleLibSQLConfig, a named database DI token, a repository over getOrm(), and boot-time table creation.",{"title":87,"path":88,"stem":89,"description":8371,"icon":90,"children":-1},"A dialect-agnostic persistence boundary — the abstract Database surface, runInTransaction transactions, optimistic concurrency with ConcurrencyConflictError, MigrationRunner contracts, and how a concrete dialect plugs in via a useFactory provider.",1783300761903]