@prisma/orm-family-mongo 8.0.0-rc.18-dev.21 → 8.0.0-rc.18-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/{authoring-entity-types-C4WFd_RV-BiY2lX_e.mjs → authoring-entity-types-C4WFd_RV-Dk_MsSD8.mjs} +3 -3
  2. package/dist/{authoring-entity-types-C4WFd_RV-BiY2lX_e.mjs.map → authoring-entity-types-C4WFd_RV-Dk_MsSD8.mjs.map} +1 -1
  3. package/dist/{contract-builder-DYeV4YqF.mjs → contract-builder-BEuM9D-R.mjs} +19 -5
  4. package/dist/contract-builder-BEuM9D-R.mjs.map +1 -0
  5. package/dist/{contract-builder-CyB-7-Eq.d.mts → contract-builder-CG6eOokb.d.mts} +31 -38
  6. package/dist/{contract-builder-CyB-7-Eq.d.mts.map → contract-builder-CG6eOokb.d.mts.map} +1 -1
  7. package/dist/contract-prisma6__provider.mjs +2 -2
  8. package/dist/contract-psl.mjs +1 -1
  9. package/dist/contract-psl__provider.mjs +1 -1
  10. package/dist/contract-psl__provider.mjs.map +1 -1
  11. package/dist/contract-ts.d.mts +1 -1
  12. package/dist/contract-ts.mjs +1 -1
  13. package/dist/contract-ts__contract-builder.d.mts +1 -1
  14. package/dist/contract-ts__contract-builder.mjs +1 -1
  15. package/dist/contract.d.mts +1 -1
  16. package/dist/contract.mjs +1 -1
  17. package/dist/contract__data-type.d.mts +2 -2
  18. package/dist/contract__data-type.mjs +2 -2
  19. package/dist/{control-CFKfF3Kt.d.mts → control-1XSvTjNp.d.mts} +4 -4
  20. package/dist/{control-CFKfF3Kt.d.mts.map → control-1XSvTjNp.d.mts.map} +1 -1
  21. package/dist/control-adapter-B3N_6XRh.d.mts +1 -0
  22. package/dist/{control-adapter-Bh_ZraGM-Doy155tY.d.mts → control-adapter-Bh_ZraGM-w_4Q7QRT.d.mts} +4 -4
  23. package/dist/{control-adapter-Bh_ZraGM-Doy155tY.d.mts.map → control-adapter-Bh_ZraGM-w_4Q7QRT.d.mts.map} +1 -1
  24. package/dist/{control-Dr88-3gg.mjs → control-narTPLUn.mjs} +5 -5
  25. package/dist/{control-Dr88-3gg.mjs.map → control-narTPLUn.mjs.map} +1 -1
  26. package/dist/{control-4JTCKNgO.d.mts → control-pL1VpjCE.d.mts} +2 -2
  27. package/dist/{control-4JTCKNgO.d.mts.map → control-pL1VpjCE.d.mts.map} +1 -1
  28. package/dist/{dist-K-Zzlzm5.mjs → dist-Dc7ucQHb.mjs} +2 -2
  29. package/dist/{dist-K-Zzlzm5.mjs.map → dist-Dc7ucQHb.mjs.map} +1 -1
  30. package/dist/dist-xk_0xOR-.mjs.map +1 -1
  31. package/dist/emitter.d.mts +1 -1
  32. package/dist/emitter.d.mts.map +1 -1
  33. package/dist/emitter.mjs +1 -1
  34. package/dist/{exports-C32AbWNp.mjs → exports-W3IiuyIf.mjs} +3 -3
  35. package/dist/exports-W3IiuyIf.mjs.map +1 -0
  36. package/dist/family.d.mts +9 -9
  37. package/dist/family.mjs +6 -6
  38. package/dist/family__control-adapter.d.mts +2 -2
  39. package/dist/family__control.d.mts +1 -1
  40. package/dist/family__control.mjs +1 -1
  41. package/dist/family__ir.d.mts +2 -2
  42. package/dist/family__ir.mjs +2 -2
  43. package/dist/family__migration.d.mts +1 -1
  44. package/dist/family__migration.mjs +1 -1
  45. package/dist/family__pack.mjs +2 -2
  46. package/dist/family__runtime.d.mts +2 -2
  47. package/dist/family__runtime.mjs +1 -1
  48. package/dist/family__schema-verify.d.mts +1 -1
  49. package/dist/{field-accessor-CE4JbDIa-DCI8nD_s.d.mts → field-accessor-CE4JbDIa-BG_454s_.d.mts} +2 -2
  50. package/dist/{field-accessor-CE4JbDIa-DCI8nD_s.d.mts.map → field-accessor-CE4JbDIa-BG_454s_.d.mts.map} +1 -1
  51. package/dist/{index-p1mHGKB5.d.mts → index-C7IAOTMB.d.mts} +2 -2
  52. package/dist/{index-p1mHGKB5.d.mts.map → index-C7IAOTMB.d.mts.map} +1 -1
  53. package/dist/{index-CMd3fTIb.d.mts → index-CBGDD4sc.d.mts} +2 -2
  54. package/dist/{index-CMd3fTIb.d.mts.map → index-CBGDD4sc.d.mts.map} +1 -1
  55. package/dist/{index-B_TBqtjg.d.mts → index-Cnrg3wHv.d.mts} +2 -2
  56. package/dist/{index-B_TBqtjg.d.mts.map → index-Cnrg3wHv.d.mts.map} +1 -1
  57. package/dist/{index-B8HcPJrE.d.mts → index-Dmgz2Lt8.d.mts} +3 -3
  58. package/dist/{index-B8HcPJrE.d.mts.map → index-Dmgz2Lt8.d.mts.map} +1 -1
  59. package/dist/{index-CCF8KN1E.d.mts → index-VYRZLCL7.d.mts} +3 -3
  60. package/dist/{index-CCF8KN1E.d.mts.map → index-VYRZLCL7.d.mts.map} +1 -1
  61. package/dist/{interpreter-CHQQ4WDf-UuxfVRi6.mjs → interpreter-C0x7PZIS-CmH4DKLL.mjs} +18 -3
  62. package/dist/interpreter-C0x7PZIS-CmH4DKLL.mjs.map +1 -0
  63. package/dist/{ir-Cs8SNS0n.d.mts → ir-BvEleTIc.d.mts} +3 -3
  64. package/dist/{ir-Cs8SNS0n.d.mts.map → ir-BvEleTIc.d.mts.map} +1 -1
  65. package/dist/lowering.d.mts +1 -1
  66. package/dist/{migration-CaBC0X76.mjs → migration-C7tnv18O.mjs} +2 -2
  67. package/dist/{migration-CaBC0X76.mjs.map → migration-C7tnv18O.mjs.map} +1 -1
  68. package/dist/{migration-DMXCxDu-.d.mts → migration-Ug5cYZqn.d.mts} +4 -4
  69. package/dist/{migration-DMXCxDu-.d.mts.map → migration-Ug5cYZqn.d.mts.map} +1 -1
  70. package/dist/{mongo-contract-serializer-5OphMWx2-BlW2zlIQ.mjs → mongo-contract-serializer-5OphMWx2-DaklzH_L.mjs} +2 -2
  71. package/dist/{mongo-contract-serializer-5OphMWx2-BlW2zlIQ.mjs.map → mongo-contract-serializer-5OphMWx2-DaklzH_L.mjs.map} +1 -1
  72. package/dist/{mongo-contract-view-AnejqfrQ-CXymmojn.d.mts → mongo-contract-view-AnejqfrQ-CLI7YSeQ.d.mts} +2 -2
  73. package/dist/{mongo-contract-view-AnejqfrQ-CXymmojn.d.mts.map → mongo-contract-view-AnejqfrQ-CLI7YSeQ.d.mts.map} +1 -1
  74. package/dist/{mongo-contract-view-OSrxTeL0-C6aB-oJt.mjs → mongo-contract-view-OSrxTeL0-BYgPDLlk.mjs} +3 -3
  75. package/dist/{mongo-contract-view-OSrxTeL0-C6aB-oJt.mjs.map → mongo-contract-view-OSrxTeL0-BYgPDLlk.mjs.map} +1 -1
  76. package/dist/mongo-data-type-C4Ivv5fg-BpfTXzhC.d.mts +42 -0
  77. package/dist/mongo-data-type-C4Ivv5fg-BpfTXzhC.d.mts.map +1 -0
  78. package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs +53 -0
  79. package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs.map +1 -0
  80. package/dist/orm.d.mts +12 -57
  81. package/dist/orm.d.mts.map +1 -1
  82. package/dist/query-ast.d.mts +1 -1
  83. package/dist/query-ast__control.d.mts +1 -1
  84. package/dist/query-builder.d.mts +2 -2
  85. package/dist/query-builder__contract-free.d.mts +2 -2
  86. package/dist/{runtime-CQUQkK0P.d.mts → runtime-BdFjb2Zm.d.mts} +2 -2
  87. package/dist/runtime-BdFjb2Zm.d.mts.map +1 -0
  88. package/dist/runtime.d.mts +2 -2
  89. package/dist/schema-ir.d.mts +1 -1
  90. package/dist/{schema-verify-CCSz3rlO.d.mts → schema-verify-DmFfmivC.d.mts} +3 -3
  91. package/dist/{schema-verify-CCSz3rlO.d.mts.map → schema-verify-DmFfmivC.d.mts.map} +1 -1
  92. package/dist/wire.d.mts +1 -1
  93. package/package.json +20 -20
  94. package/dist/contract-builder-DYeV4YqF.mjs.map +0 -1
  95. package/dist/control-adapter-D7n7HrIP.d.mts +0 -1
  96. package/dist/exports-C32AbWNp.mjs.map +0 -1
  97. package/dist/interpreter-CHQQ4WDf-UuxfVRi6.mjs.map +0 -1
  98. package/dist/mongo-data-type-BMIRhoZC-COGrnC0Z.d.mts +0 -27
  99. package/dist/mongo-data-type-BMIRhoZC-COGrnC0Z.d.mts.map +0 -1
  100. package/dist/mongo-data-type-DJ7W2ota-BnUN7ydW.mjs +0 -25
  101. package/dist/mongo-data-type-DJ7W2ota-BnUN7ydW.mjs.map +0 -1
  102. package/dist/runtime-CQUQkK0P.d.mts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { c as MongoSchemaIR } from "./index-B_TBqtjg.mjs";
2
- import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-4JTCKNgO.mjs";
3
- import { i as MongoDriver, t as MongoAdapter } from "./index-B8HcPJrE.mjs";
1
+ import { c as MongoSchemaIR } from "./index-Cnrg3wHv.mjs";
2
+ import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-pL1VpjCE.mjs";
3
+ import { i as MongoDriver, t as MongoAdapter } from "./index-Dmgz2Lt8.mjs";
4
4
  import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
5
5
  import { ControlAdapterDescriptor, ControlAdapterInstance, ControlDriverInstance } from "@prisma/orm-framework/components/control";
6
6
  //#region ../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts
@@ -124,4 +124,4 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
124
124
  interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
125
125
  //#endregion
126
126
  export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
127
- //# sourceMappingURL=control-adapter-Bh_ZraGM-Doy155tY.d.mts.map
127
+ //# sourceMappingURL=control-adapter-Bh_ZraGM-w_4Q7QRT.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-adapter-Bh_ZraGM-Doy155tY.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;;;;;;EAOrG,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
1
+ {"version":3,"file":"control-adapter-Bh_ZraGM-w_4Q7QRT.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;;;;;;EAOrG,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
@@ -1,11 +1,11 @@
1
1
  import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
2
- import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-CHQQ4WDf-UuxfVRi6.mjs";
2
+ import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-C0x7PZIS-CmH4DKLL.mjs";
3
3
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
4
- import { t as mongoEmission } from "./exports-C32AbWNp.mjs";
4
+ import { t as mongoEmission } from "./exports-W3IiuyIf.mjs";
5
5
  import { et as RawUpdateManyCommand } from "./execution-CgP1Sdbr.mjs";
6
6
  import { i as verifyMongoSchema } from "./verify-mongo-schema-BTj4mddD-75_ALNmN.mjs";
7
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-C4WFd_RV-BiY2lX_e.mjs";
8
- import { t as MongoContractSerializer } from "./mongo-contract-serializer-5OphMWx2-BlW2zlIQ.mjs";
7
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-C4WFd_RV-Dk_MsSD8.mjs";
8
+ import { t as MongoContractSerializer } from "./mongo-contract-serializer-5OphMWx2-DaklzH_L.mjs";
9
9
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
11
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -493,4 +493,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
493
493
  //#endregion
494
494
  export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
495
495
 
496
- //# sourceMappingURL=control-Dr88-3gg.mjs.map
496
+ //# sourceMappingURL=control-narTPLUn.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-Dr88-3gg.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-BTj4mddD.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-C4WFd_RV.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-5OphMWx2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongo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-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-BTj4mddD.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-C4WFd_RV.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-5OphMWx2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;;;;AAKA,SAAS,eAAe,WAAW;CAClC,MAAM,MAAM,QAAQ,IAAI,WAAW,KAAK;CACxC,IAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,GAAG,OAAO,KAAK;CACzD,MAAM,CAAC,QAAQ;CACf,MAAM,UAAU,OAAO,SAAS,YAAY,SAAS,OAAO,QAAQ,IAAI,MAAM,SAAS,IAAI,KAAK;CAChG,IAAI,EAAE,mBAAmB,yBAAyB,QAAQ,6BAA6B,MAAM;CAC7F,MAAM,WAAW,QAAQ,QAAQ,MAAM;CACvC,IAAI,aAAa,KAAK,KAAK,CAAC,gBAAgB,IAAI,QAAQ,GAAG,OAAO,KAAK;CACvE,MAAM,QAAQ,QAAQ,QAA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GACxB,OAAO,mBAAmB,SAAS;EACpC;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
@@ -1,6 +1,6 @@
1
1
  import { n as CreateCollectionOptions$1, r as CreateIndexesOptions, t as CollationOptions } from "./mongodb-types-B4HmhF1S.mjs";
2
2
  import { A as MongoIndexKey, j as MongoIndexKeyDirection } from "./mongo-value-set-BngSUlOh-BhDGXjM_.mjs";
3
- import "./index-p1mHGKB5.mjs";
3
+ import "./index-C7IAOTMB.mjs";
4
4
  import { B as MongoFilterExpr, D as MongoAstNode, rt as MongoQueryPlan } from "./query-plan-3fs1HokF-CrNsr-Wx.mjs";
5
5
  import { MigrationOperationClass, MigrationPlanOperation } from "@prisma/orm-framework/components/control";
6
6
  //#region ../../../2-mongo-family/4-query/query-ast/dist/exports/control.d.mts
@@ -201,4 +201,4 @@ type AnyMongoMigrationOperation = MongoMigrationPlanOperation | MongoDmlOperatio
201
201
  declare function isMongoDmlOperation(operation: AnyMongoMigrationOperation): operation is MongoDmlOperation;
202
202
  //#endregion
203
203
  export { defaultMongoIndexName as C, buildIndexOpId as S, keysToKeySpec as T, MongoInspectionCommandVisitor as _, CollModOptions as a, MongoMigrationStep as b, CreateIndexCommand as c, DropIndexCommand as d, ListCollectionsCommand as f, MongoDmlOperation as g, MongoDmlCheck as h, CollModCommand as i, CreateIndexOptions as l, MongoDdlCommandVisitor as m, AnyMongoInspectionCommand as n, CreateCollectionCommand as o, ListIndexesCommand as p, AnyMongoMigrationOperation as r, CreateCollectionOptions as s, AnyMongoDdlCommand as t, DropCollectionCommand as u, MongoMigrationCheck as v, isMongoDmlOperation as w, RenameCollectionCommand as x, MongoMigrationPlanOperation as y };
204
- //# sourceMappingURL=control-4JTCKNgO.d.mts.map
204
+ //# sourceMappingURL=control-pL1VpjCE.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-4JTCKNgO.d.mts","names":[],"sources":["../../../../2-mongo-family/4-query/query-ast/dist/exports/control.d.mts"],"mappings":";;;;;;;cAKc,2BAA2B;WAC9B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,8BAA8B,KAAK;;cAE1C,+BAA+B;WAClC;EACT;EACA,OAAO,GAAG,SAAS,8BAA8B,KAAK;;KAEnD,4BAA4B,qBAAqB;;;UAG5C,uBAAuB;EAC/B,YAAY,SAAS,qBAAqB;EAC1C,UAAU,SAAS,mBAAmB;EACtC,iBAAiB,SAAS,0BAA0B;EACpD,eAAe,SAAS,wBAAwB;EAChD,iBAAiB,SAAS,0BAA0B;EACpD,QAAQ,SAAS,iBAAiB;;UAE1B,8BAA8B;EACtC,YAAY,SAAS,qBAAqB;EAC1C,gBAAgB,SAAS,yBAAyB;;;;UAI1C;WACC;WACA;WACA;WACA,0BAA0B;WAC1B;WACA,qBAAqB;WACrB,YAAY;WACZ,UAAU;WACV;WACA;;cAEG,2BAA2B,wBAAwB;WACtD;WACA;WACA,MAAM,cAAc;WACpB;WACA;WACA;WACA,0BAA0B;WAC1B;WACA,qBAAqB;WACrB,YAAY;WACZ,UAAU;WACV;WACA;EACT,YAAY,oBAAoB,MAAM,cAAc,gBAAkB,UAAU;EAChF,OAAO,GAAG,SAAS,uBAAuB,KAAK;;cAEnC,yBAAyB;WAC5B;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,OAAO,GAAG,SAAS,uBAAuB,KAAK;;UAEvC;WACC,YAAY;WACZ;WACA;WACA;WACA;WACA;WACA;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;IACP,KAAK;IACL;IACA;;;cAGU,gCAAgC,wBAAwB;WAC3D;WACA;WACA,YAAY;WACZ;WACA;WACA;WACA;WACA;WACA;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;IACP,KAAK;IACL;IACA;;EAEF,YAAY,oBAAoB,UAAU;EAC1C,OAAO,GAAG,SAAS,uBAAuB,KAAK;;cAEnC,8BAA8B;WACjC;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,uBAAuB,KAAK;;cAEnC,gCAAgC;WACnC;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,OAAO,GAAG,SAAS,uBAAuB,KAAK;;UAEvC;WACC,YAAY;WACZ;WACA;WACA;IACP;;;cAGU,uBAAuB;WAC1B;WACA;WACA,YAAY;WACZ;WACA;WACA;IACP;;EAEF,YAAY,oBAAoB,SAAS;EACzC,OAAO,GAAG,SAAS,uBAAuB,KAAK;;KAE5C,qBAAqB,qBAAqB,mBAAmB,0BAA0B,wBAAwB,0BAA0B;;;iBAG7H,eAAe,yBAAyB,oBAAoB,MAAM,cAAc;iBAChF,sBAAsB,MAAM,cAAc;iBAC1C,cAAc,MAAM,cAAc,iBAAmB,eAAe;;;UAG3E;WACC;WACA,QAAQ;WACR,QAAQ;WACR;;UAED;WACC;WACA,SAAS;;UAEV,oCAAoC;WACnC,mBAAmB;WACnB,kBAAkB;WAClB,oBAAoB;;UAErB;WACC;WACA,QAAQ;WACR,QAAQ;WACR;;;;;;;UAOD,0BAA0B;WACzB,gBAAgB;WAChB;;;;;;WAMA;WACA,mBAAmB;WACnB,cAAc;WACd,oBAAoB;;KAE1B,6BAA6B,8BAA8B;iBAC/C,oBAAoB,WAAW,6BAA6B,aAAa"}
1
+ {"version":3,"file":"control-pL1VpjCE.d.mts","names":[],"sources":["../../../../2-mongo-family/4-query/query-ast/dist/exports/control.d.mts"],"mappings":";;;;;;;cAKc,2BAA2B;WAC9B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,8BAA8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G,SAAS,uBAAuB,KAAK;;UAEvC;WACC,YAAY;WACZ;WACA;WACA;IACP;;;cAGU,uBAAuB;WAC1B;WACA;WACA,YAAY;WACZ;WACA;WACA;IACP;;EAEF,YAAY,oBAAoB,SAAS;EACzC,OAAO,GAAG,SAAS,uBAAuB,KAAK;;KAE5C,qBAAqB,qBAAqB,mBAAmB,0BAA0B,wBAAwB,0BAA0B;;;iBAG7H,eAAe,yBAAyB,oBAAoB,MAAM,cAAc;iBAChF,sBAAsB,MAAM,cAAc;iBAC1C,cAAc,MAAM,cAAc,iBAAmB,eAAe;;;UAG3E;WACC;WACA,QAAQ;WACR,QAAQ;WACR;;UAED;WACC;WACA,SAAS;;UAEV,oCAAoC;WACnC,mBAAmB;WACnB,kBAAkB;WAClB,oBAAoB;;UAErB;WACC;WACA,QAAQ;WACR,QAAQ;WACR;;;;;;;UAOD,0BAA0B;WACzB,gBAAgB;WAChB;;;;;;WAMA;WACA,mBAAmB;WACnB,cAAc;WACd,oBAAoB;;KAE1B,6BAA6B,8BAA8B;iBAC/C,oBAAoB,WAAW,6BAA6B,aAAa"}
@@ -1,6 +1,6 @@
1
1
  import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
2
2
  import { l as MongoValidator, n as MongoCollationOptions, o as MongoIndex, p as composeMongoEntityKinds } from "./entity-kinds-RooUvcN8-B1AF_ppw.mjs";
3
- import { t as bsonTypesOfCodec } from "./mongo-data-type-DJ7W2ota-BnUN7ydW.mjs";
3
+ import { n as bsonTypesOfCodec } from "./mongo-data-type-DzyzU4LF-C1ydFXgE.mjs";
4
4
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { IRNodeBase, NamespaceBase, UNBOUND_NAMESPACE_ID, buildNamespacedEntities, buildSingleNamespaceView, freezeNode, hydrateNamespaceEntities } from "@prisma/orm-framework/components/ir";
@@ -626,4 +626,4 @@ function validatorEnumMemberRefusalOf(bsonTypes, stored) {
626
626
  //#endregion
627
627
  export { validatorEnumMemberRefusalOf as _, RelationKeys as a, buildMongoNamespace as c, defaultMongoStorageNamespaceId as d, deriveCollectionValidators as f, validateMongoStorage as g, resolveMongoToOneRelationFields as h, MongoUnboundNamespace as i, buildMongoStorage as l, mongoValueSetsOf as m, MongoIndexOptions as n, applyPolymorphicScopeToMongoIndex as o, documentIdRefusalOf as p, MongoStorage as r, buildMongoContractView as s, MongoClusteredCollectionOptions as t, defaultMongoDomainNamespaceId as u, validatorEnumRefusalOf as v };
628
628
 
629
- //# sourceMappingURL=dist-K-Zzlzm5.mjs.map
629
+ //# sourceMappingURL=dist-Dc7ucQHb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-K-Zzlzm5.mjs","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-contract/dist/index.mjs"],"sourcesContent":["import { t as mongoContractCanonicalizationHooks } from \"./canonicalization-hooks-CRVM-Kqh.mjs\";\nimport { a as MongoCollection, c as MongoCollectionOptions, d as MongoCollationOptions, f as MongoChangeStreamPreAndPostImagesOptions, g as createMongoNamespaceEnvelopeSchema, h as createMongoContractSchema, i as MongoValueSet, l as MongoTimeSeriesCollectionOptions, m as StorageValueSetSchema, n as composeMongoEntityKinds, o as MongoValidator, p as MongoContractSchema, s as MongoIndex, u as MongoIndexOptionDefaults } from \"./entity-kinds-RooUvcN8.mjs\";\nimport { t as bsonTypesOfCodec } from \"./mongo-data-type-DJ7W2ota.mjs\";\nimport { RelationKeys } from \"@internal/framework-components/runtime\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\nimport { IRNodeBase, NamespaceBase, UNBOUND_NAMESPACE_ID, buildNamespacedEntities, buildSingleNamespaceView, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { UNBOUND_DOMAIN_NAMESPACE_ID } from \"@internal/contract/default-namespace\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/ir/mongo-unbound-namespace.ts\nvar MongoUnboundNamespace = class MongoUnboundNamespace extends NamespaceBase {\n\tstatic instance = new MongoUnboundNamespace();\n\tid = UNBOUND_NAMESPACE_ID;\n\tentries = Object.freeze({ collection: Object.freeze({}) });\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-namespace\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/build-mongo-namespace.ts\nconst MONGO_NAMESPACE_KIND = \"mongo-namespace\";\nvar MongoBoundNamespace = class MongoBoundNamespace extends NamespaceBase {\n\tid;\n\tentries;\n\tstatic fromCollectionsInput(input) {\n\t\tconst collectionMap = input.entries[\"collection\"];\n\t\tconst collectionCount = collectionMap !== void 0 ? Object.keys(collectionMap).length : 0;\n\t\tconst hasUnknownKinds = Object.keys(input.entries).some((kind) => kind !== \"collection\");\n\t\tif (input.id === UNBOUND_NAMESPACE_ID && collectionCount === 0 && !hasUnknownKinds) return MongoUnboundNamespace.instance;\n\t\treturn new MongoBoundNamespace(input);\n\t}\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst rawEntries = {\n\t\t\tcollection: {},\n\t\t\t...input.entries\n\t\t};\n\t\tthis.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), \"carry\")));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: MONGO_NAMESPACE_KIND,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget collection() {\n\t\treturn this.entries.collection ?? Object.freeze({});\n\t}\n};\nfunction buildMongoNamespace(input) {\n\treturn MongoBoundNamespace.fromCollectionsInput(input);\n}\n//#endregion\n//#region src/ir/mongo-storage.ts\nvar MongoStorage = class extends IRNodeBase {\n\tstorageHash;\n\tnamespaces;\n\tconstructor(input) {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-storage\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tthis.storageHash = input.storageHash;\n\t\tthis.namespaces = Object.freeze(input.namespaces);\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/build-mongo-storage.ts\n/**\n* Builds a Mongo contract's storage: the unbound namespace holding the collections and value sets, and the storage hash that `db sign` and `db verify` compare. Every Mongo contract source calls this, so they hash storage the same way.\n*/\nfunction buildMongoStorage(input) {\n\tconst hasValueSets = Object.keys(input.valueSets).length > 0;\n\tconst namespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: input.collections,\n\t\t\t...hasValueSets ? { valueSet: input.valueSets } : {}\n\t\t}\n\t});\n\treturn new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget: \"mongo\",\n\t\t\ttargetFamily: \"mongo\",\n\t\t\tstorage: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: namespace.entries.collection,\n\t\t\t\t\t...namespace.entries.valueSet !== void 0 ? { valueSet: namespace.entries.valueSet } : {}\n\t\t\t\t}\n\t\t\t} } },\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: namespace }\n\t});\n}\n//#endregion\n//#region src/contract-view.ts\nconst MONGO_BUILTIN_KINDS = [\"collection\"];\n/**\n* Builds the Mongo view: unwraps the sole namespace's built-in `collection` kind\n* to the root, attaches the namespace-keyed `namespace` map, and layers both\n* over the deserialized contract so the result is a structural superset of the\n* contract.\n*/\nfunction buildMongoContractView(contract) {\n\tconst rootAccessors = buildSingleNamespaceView(contract.storage, MONGO_BUILTIN_KINDS);\n\tconst namespace = buildNamespacedEntities(contract.storage, MONGO_BUILTIN_KINDS);\n\treturn {\n\t\t...contract,\n\t\t...rootAccessors,\n\t\tnamespace\n\t};\n}\n//#endregion\n//#region src/default-namespace.ts\n/** Default storage namespace for Mongo-family contracts at runtime. */\nconst defaultMongoStorageNamespaceId = UNBOUND_NAMESPACE_ID;\n/** Default domain namespace for Mongo-family contracts at runtime. */\nconst defaultMongoDomainNamespaceId = UNBOUND_DOMAIN_NAMESPACE_ID;\n//#endregion\n//#region src/relation-fields.ts\nconst DOCUMENT_ID_FIELD = \"_id\";\n/**\n* The model facts behind a same-space to-one relation's nullability: which side owns the\n* foreign key, and whether each local field is nullable.\n*/\nfunction resolveMongoToOneRelationFields(model, relation) {\n\tconst fields = relation.on.localFields.map((name) => ({\n\t\tname,\n\t\tnullable: model.fields[name]?.nullable ?? true\n\t}));\n\treturn {\n\t\townsForeignKey: !(relation.cardinality === \"1:1\" && fields.every((field) => field.name === DOCUMENT_ID_FIELD)),\n\t\tfields\n\t};\n}\n/** Whether `relation` stores the related model inside the document, rather than referring to documents elsewhere. */\nfunction isEmbedRelation(relation) {\n\treturn !(\"on\" in relation) && !(\"through\" in relation);\n}\n//#endregion\n//#region src/recursive-groups.ts\nfunction typeKey(kind, name) {\n\treturn `${kind}:${name}`;\n}\nfunction referencesOf(fields) {\n\treturn Object.values(fields).flatMap((field) => field.type.kind === \"valueObject\" ? [typeKey(\"valueObject\", field.type.name)] : []);\n}\n/**\n* The recursive groups of value objects and embedded models: each set of types that can reach each other through value-object fields and embed relations (a strongly connected component of that graph), and each type that refers to itself. Maps the {@link typeKey} of every type in such a group to the group's number; a type in no recursive group is absent.\n*/\nfunction recursiveGroupsOf(valueObjects, models) {\n\tconst edges = /* @__PURE__ */ new Map();\n\tfor (const [name, valueObject] of Object.entries(valueObjects)) edges.set(typeKey(\"valueObject\", name), referencesOf(valueObject.fields));\n\tfor (const [name, model] of Object.entries(models)) {\n\t\tconst embeds = Object.values(model.relations).flatMap((relation) => isEmbedRelation(relation) ? [typeKey(\"model\", relation.to.model)] : []);\n\t\tedges.set(typeKey(\"model\", name), [...referencesOf(model.fields), ...embeds]);\n\t}\n\tconst groups = /* @__PURE__ */ new Map();\n\tconst index = /* @__PURE__ */ new Map();\n\tconst lowLink = /* @__PURE__ */ new Map();\n\tconst stack = [];\n\tconst onStack = /* @__PURE__ */ new Set();\n\tlet nextIndex = 0;\n\tlet nextGroup = 0;\n\tconst visit = (node) => {\n\t\tindex.set(node, nextIndex);\n\t\tlowLink.set(node, nextIndex);\n\t\tnextIndex++;\n\t\tstack.push(node);\n\t\tonStack.add(node);\n\t\tfor (const target of edges.get(node) ?? []) {\n\t\t\tif (!edges.has(target)) continue;\n\t\t\tif (!index.has(target)) {\n\t\t\t\tvisit(target);\n\t\t\t\tlowLink.set(node, Math.min(lowLink.get(node) ?? 0, lowLink.get(target) ?? 0));\n\t\t\t} else if (onStack.has(target)) lowLink.set(node, Math.min(lowLink.get(node) ?? 0, index.get(target) ?? 0));\n\t\t}\n\t\tif (lowLink.get(node) !== index.get(node)) return;\n\t\tconst members = [];\n\t\tlet member;\n\t\tdo {\n\t\t\tmember = stack.pop();\n\t\t\tif (member === void 0) break;\n\t\t\tonStack.delete(member);\n\t\t\tmembers.push(member);\n\t\t} while (member !== node);\n\t\tconst refersToItself = (edges.get(node) ?? []).includes(node);\n\t\tif (members.length > 1 || refersToItself) {\n\t\t\tfor (const each of members) groups.set(each, nextGroup);\n\t\t\tnextGroup++;\n\t\t}\n\t};\n\tfor (const node of edges.keys()) if (!index.has(node)) visit(node);\n\treturn groups;\n}\n//#endregion\n//#region src/derive-json-schema.ts\n/**\n* `$jsonSchema` has no references, so a type that contains itself, directly or through other types, cannot be described at every depth. The validator describes the type through which a path enters a recursive group in full, and accepts any object for each field below it that refers back into that group. So each group is written out once for each place a document enters it, and no valid document is refused.\n*/\nconst OPEN_OBJECT = { bsonType: \"object\" };\nfunction sourcesFor(input, rootKey) {\n\tconst groups = recursiveGroupsOf(input.valueObjects, input.models);\n\tconst rootGroup = groups.get(rootKey);\n\treturn {\n\t\t...input,\n\t\tgroups,\n\t\tenteredGroups: new Set(rootGroup === void 0 ? [] : [rootGroup])\n\t};\n}\nfunction objectSchemaOf(kind, name, shape, sources) {\n\tconst key = typeKey(kind, name);\n\tconst group = sources.groups.get(key);\n\tif (group !== void 0 && sources.enteredGroups.has(group)) return OPEN_OBJECT;\n\treturn deriveObjectSchema(shape, entering(key, sources));\n}\n/** `sources` with the recursive group of the type `key` entered, if it has one. */\nfunction entering(key, sources) {\n\tconst group = sources.groups.get(key);\n\tif (group === void 0 || sources.enteredGroups.has(group)) return sources;\n\treturn {\n\t\t...sources,\n\t\tenteredGroups: /* @__PURE__ */ new Set([...sources.enteredGroups, group])\n\t};\n}\nconst NO_RELATIONS = {};\nconst NOTHING_INHERITED = {\n\tfields: {},\n\trelations: NO_RELATIONS\n};\n/**\n* The `bsonType` keyword for a list of BSON type names: the name itself for one entry, the list for several.\n*/\nfunction bsonTypeKeyword(bsonTypes) {\n\tconst [only, ...rest] = bsonTypes;\n\treturn only !== void 0 && rest.length === 0 ? only : [...bsonTypes];\n}\nfunction withNull(bsonTypes) {\n\treturn bsonTypes.includes(\"null\") ? bsonTypes : [\"null\", ...bsonTypes];\n}\nfunction anyValueSchema(field) {\n\tif (\"many\" in field && field.many) return {\n\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\titems: {}\n\t};\n\treturn {};\n}\nfunction fieldToBsonSchema(field, sources) {\n\tconst { lookups, valueObjects, valueSets } = sources;\n\tif (field.type.kind === \"scalar\") {\n\t\tconst bsonTypes = bsonTypesOfCodec(field.type.codecId, lookups);\n\t\tif (bsonTypes === void 0) return void 0;\n\t\tif (bsonTypes.length === 0) return anyValueSchema(field);\n\t\tconst bsonType = bsonTypeKeyword(bsonTypes);\n\t\tconst enumValues = field.valueSet !== void 0 ? valueSets[field.valueSet.entityName]?.values ?? null : null;\n\t\tif (field.many) {\n\t\t\tconst items = { bsonType: field.many.elementNullable ? [\"null\", bsonType] : bsonType };\n\t\t\tif (enumValues) items[\"enum\"] = field.many.elementNullable ? [...enumValues, null] : enumValues;\n\t\t\treturn {\n\t\t\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\t\t\titems\n\t\t\t};\n\t\t}\n\t\tif (field.nullable) {\n\t\t\tconst s = { bsonType: bsonTypeKeyword(withNull(bsonTypes)) };\n\t\t\tif (enumValues) s[\"enum\"] = [...enumValues, null];\n\t\t\treturn s;\n\t\t}\n\t\tconst s = { bsonType };\n\t\tif (enumValues) s[\"enum\"] = enumValues;\n\t\treturn s;\n\t}\n\tif (field.type.kind === \"valueObject\") {\n\t\tconst vo = valueObjects[field.type.name];\n\t\tif (!vo) return void 0;\n\t\tconst voSchema = objectSchemaOf(\"valueObject\", field.type.name, {\n\t\t\tfields: vo.fields,\n\t\t\trelations: NO_RELATIONS\n\t\t}, sources);\n\t\tif (field.many) return {\n\t\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\t\titems: field.many.elementNullable ? { oneOf: [{ bsonType: \"null\" }, voSchema] } : voSchema\n\t\t};\n\t\tif (field.nullable) return { oneOf: [{ bsonType: \"null\" }, voSchema] };\n\t\treturn voSchema;\n\t}\n}\n/**\n* An embedded model is stored inside its owner's document as a closed object (a list of them for `1:N`). The contract does not say whether one must be present, and the ORM creates documents without them, so the property is never required.\n*/\nfunction embedToBsonSchema(relation, sources) {\n\tconst embeddedName = relation.to.model;\n\tconst embedded = sources.models[embeddedName];\n\tassertDefined(embedded, `Embedded model \"${embeddedName}\" is missing`);\n\tconst schema = objectSchemaOf(\"model\", embeddedName, embedded, sources);\n\treturn relation.cardinality === \"1:N\" ? {\n\t\tbsonType: \"array\",\n\t\titems: schema\n\t} : schema;\n}\n/**\n* The properties of `shape`, leaving out the fields and relations `inherited` already describes.\n*/\nfunction propertiesOf(shape, sources, inherited) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [fieldName, field] of Object.entries(shape.fields)) {\n\t\tif (Object.hasOwn(inherited.fields, fieldName)) continue;\n\t\tconst schema = fieldToBsonSchema(field, sources);\n\t\tif (schema) {\n\t\t\tproperties[fieldName] = schema;\n\t\t\tif (!field.nullable) required.push(fieldName);\n\t\t}\n\t}\n\tfor (const [relationName, relation] of Object.entries(shape.relations)) {\n\t\tif (Object.hasOwn(inherited.relations, relationName) || !isEmbedRelation(relation)) continue;\n\t\tproperties[relationName] = embedToBsonSchema(relation, sources);\n\t}\n\treturn {\n\t\tproperties,\n\t\trequired\n\t};\n}\nfunction deriveObjectSchema(shape, sources) {\n\tconst { properties, required } = propertiesOf(shape, sources, NOTHING_INHERITED);\n\tconst result = {\n\t\tbsonType: \"object\",\n\t\tproperties,\n\t\tadditionalProperties: false\n\t};\n\tif (required.length > 0) result[\"required\"] = required.sort();\n\treturn result;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction validatorOf(jsonSchema) {\n\treturn new MongoValidator({\n\t\tjsonSchema,\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\nfunction polymorphicSchema(base, discriminatorField, variants, sources) {\n\tconst baseSchema = deriveObjectSchema(base, sources);\n\tconst baseProperties = isRecord(baseSchema[\"properties\"]) ? baseSchema[\"properties\"] : {};\n\tconst oneOf = [];\n\tfor (const variant of variants) {\n\t\tconst { properties: variantProperties, required } = propertiesOf(variant, entering(typeKey(\"model\", variant.modelName), sources), base);\n\t\toneOf.push({\n\t\t\tproperties: {\n\t\t\t\t...baseProperties,\n\t\t\t\t[discriminatorField]: { enum: [variant.discriminatorValue] },\n\t\t\t\t...variantProperties\n\t\t\t},\n\t\t\trequired: [discriminatorField, ...required].sort(),\n\t\t\tadditionalProperties: false\n\t\t});\n\t}\n\tconst jsonSchema = { ...baseSchema };\n\tdelete jsonSchema[\"additionalProperties\"];\n\tif (oneOf.length > 0) jsonSchema[\"oneOf\"] = oneOf;\n\treturn jsonSchema;\n}\n/**\n* The validator of a root model's collection: the model's fields and embedded models, and for a model with variants one `oneOf` branch per variant.\n*/\nfunction deriveModelValidator(modelName, model, sources) {\n\tconst schemaSources = sourcesFor(sources, typeKey(\"model\", modelName));\n\tif (!model.discriminator || !model.variants) return validatorOf(deriveObjectSchema(model, schemaSources));\n\tconst variants = Object.entries(model.variants).map(([discriminatorValue, variant]) => {\n\t\tconst variantModel = sources.models[variant.model];\n\t\tassertDefined(variantModel, `Variant model \"${variant.model}\" of \"${modelName}\" is missing`);\n\t\treturn {\n\t\t\tdiscriminatorValue,\n\t\t\tmodelName: variant.model,\n\t\t\t...variantModel\n\t\t};\n\t});\n\treturn validatorOf(polymorphicSchema(model, model.discriminator.field, variants, schemaSources));\n}\n//#endregion\n//#region src/derive-collection-validators.ts\n/**\n* The validator of each collection in `roots`, keyed by collection name, derived from the collection's root model. A root model with variants gets one polymorphic validator covering every variant.\n*/\nfunction deriveCollectionValidators(input) {\n\tconst validators = {};\n\tfor (const [collectionName, root] of Object.entries(input.roots)) {\n\t\tconst model = input.models[root.model];\n\t\tassertDefined(model, `Root model \"${root.model}\" of collection \"${collectionName}\" is missing`);\n\t\tvalidators[collectionName] = deriveModelValidator(root.model, model, input);\n\t}\n\treturn validators;\n}\n//#endregion\n//#region src/document-id-refusal.ts\nconst notObjectId = {\n\tkind: \"notObjectId\",\n\treason: \"has no _id field stored as BSON type objectId. MongoDB adds an objectId _id to every document it inserts without one, so a collection validator without it rejects every insert.\"\n};\n/**\n* Why a root model with `fields` cannot be stored in a collection with a validator, or undefined when it can. The reason leaves out its subject so each authoring surface can lead with its own, as in `Model \"User\" has no _id field ...`.\n*/\nfunction documentIdRefusalOf(fields, lookups) {\n\tconst id = Object.hasOwn(fields, \"_id\") ? fields[\"_id\"] : void 0;\n\tif (id?.type.kind !== \"scalar\") return notObjectId;\n\tconst bsonTypes = bsonTypesOfCodec(id.type.codecId, lookups);\n\tif (bsonTypes === void 0) return {\n\t\tkind: \"unknownCodec\",\n\t\treason: `has an _id field whose codec \"${id.type.codecId}\" has no MongoDB data type, so its BSON type is unknown.`\n\t};\n\treturn bsonTypes.length === 1 && bsonTypes[0] === \"objectId\" ? void 0 : notObjectId;\n}\n//#endregion\n//#region src/ir/mongo-clustered-collection-options.ts\n/**\n* Clustered-collection options (the `clusteredIndex` collection-creation\n* field). Lifted from a `type =` data shape to an AST class extending\n* `IRNodeBase` per FR18.\n*\n* MongoDB requires `key` and `unique` for any clustered collection; the\n* constructor enforces presence by type signature.\n*/\nvar MongoClusteredCollectionOptions = class extends IRNodeBase {\n\tkind = \"mongo-clustered-collection-options\";\n\tkey;\n\tunique;\n\tconstructor(options) {\n\t\tsuper();\n\t\tif (options.name !== void 0) this.name = options.name;\n\t\tthis.key = options.key;\n\t\tthis.unique = options.unique;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-index-options.ts\n/**\n* Mongo Contract IR node for the per-index option vocabulary (the second\n* argument to `db.collection.createIndex(keys, options)` minus the keys\n* themselves). Lifted from a `type =` data shape to an AST class\n* extending `IRNodeBase` per FR18.\n*\n* Nested `collation` is itself an IR class (`MongoCollationOptions`); the\n* constructor accepts either a class instance or a data literal and\n* normalises to the class form so downstream walks see a uniform IR tree.\n*/\nvar MongoIndexOptions = class extends IRNodeBase {\n\tkind = \"mongo-index-options\";\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tif (options.unique !== void 0) this.unique = options.unique;\n\t\tif (options.name !== void 0) this.name = options.name;\n\t\tif (options.partialFilterExpression !== void 0) this.partialFilterExpression = options.partialFilterExpression;\n\t\tif (options.sparse !== void 0) this.sparse = options.sparse;\n\t\tif (options.expireAfterSeconds !== void 0) this.expireAfterSeconds = options.expireAfterSeconds;\n\t\tif (options.weights !== void 0) this.weights = options.weights;\n\t\tif (options.default_language !== void 0) this.default_language = options.default_language;\n\t\tif (options.language_override !== void 0) this.language_override = options.language_override;\n\t\tif (options.textIndexVersion !== void 0) this.textIndexVersion = options.textIndexVersion;\n\t\tif (options[\"2dsphereIndexVersion\"] !== void 0) this[\"2dsphereIndexVersion\"] = options[\"2dsphereIndexVersion\"];\n\t\tif (options.bits !== void 0) this.bits = options.bits;\n\t\tif (options.min !== void 0) this.min = options.min;\n\t\tif (options.max !== void 0) this.max = options.max;\n\t\tif (options.bucketSize !== void 0) this.bucketSize = options.bucketSize;\n\t\tif (options.hidden !== void 0) this.hidden = options.hidden;\n\t\tif (options.collation !== void 0) this.collation = options.collation instanceof MongoCollationOptions ? options.collation : new MongoCollationOptions(options.collation);\n\t\tif (options.wildcardProjection !== void 0) this.wildcardProjection = options.wildcardProjection;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/mongo-enum.ts\n/**\n* The storage value set of each enum: its members as the contract holds them, in the form their codec stores.\n*/\nfunction mongoValueSetsOf(enums) {\n\tconst valueSets = {};\n\tfor (const [enumName, { members }] of Object.entries(enums)) valueSets[enumName] = {\n\t\tkind: \"valueSet\",\n\t\tvalues: members.map((member) => member.value)\n\t};\n\treturn valueSets;\n}\n//#endregion\n//#region src/polymorphic-index-scope.ts\nfunction isScalarDiscriminatorValue(value) {\n\tconst t = typeof value;\n\treturn t === \"string\" || t === \"number\" || t === \"boolean\";\n}\nfunction formatValue(value) {\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (value === null) return \"null\";\n\tif (Array.isArray(value)) return JSON.stringify(value);\n\tif (typeof value === \"object\") return JSON.stringify(value);\n\treturn String(value);\n}\nfunction applyPolymorphicScopeToMongoIndex(index, scope) {\n\tif (!isScalarDiscriminatorValue(scope.discriminatorValue)) return {\n\t\tkind: \"conflict\",\n\t\treason: `Variant-scoped indexes require a scalar (string, number, or boolean) discriminator value for field \"${scope.discriminatorField}\", but received ${formatValue(scope.discriminatorValue)}.`\n\t};\n\tconst existing = index.partialFilterExpression;\n\tif (existing && Object.hasOwn(existing, scope.discriminatorField)) {\n\t\tconst existingValue = existing[scope.discriminatorField];\n\t\tif (existingValue === scope.discriminatorValue) return {\n\t\t\tkind: \"ok\",\n\t\t\tindex\n\t\t};\n\t\treturn {\n\t\t\tkind: \"conflict\",\n\t\t\treason: `Index partialFilterExpression sets \"${scope.discriminatorField}\" to ${formatValue(existingValue)}, which conflicts with the variant's discriminator value ${formatValue(scope.discriminatorValue)}.`\n\t\t};\n\t}\n\tconst merged = {\n\t\t...existing ?? {},\n\t\t[scope.discriminatorField]: scope.discriminatorValue\n\t};\n\treturn {\n\t\tkind: \"ok\",\n\t\tindex: new MongoIndex({\n\t\t\tkeys: index.keys,\n\t\t\t...index.unique !== void 0 && { unique: index.unique },\n\t\t\t...index.sparse !== void 0 && { sparse: index.sparse },\n\t\t\t...index.expireAfterSeconds !== void 0 && { expireAfterSeconds: index.expireAfterSeconds },\n\t\t\tpartialFilterExpression: merged,\n\t\t\t...index.wildcardProjection !== void 0 && { wildcardProjection: index.wildcardProjection },\n\t\t\t...index.collation !== void 0 && { collation: index.collation },\n\t\t\t...index.weights !== void 0 && { weights: index.weights },\n\t\t\t...index.default_language !== void 0 && { default_language: index.default_language },\n\t\t\t...index.language_override !== void 0 && { language_override: index.language_override }\n\t\t})\n\t};\n}\n//#endregion\n//#region src/validate-storage.ts\nfunction formatCrossRef(crossRef) {\n\treturn `${crossRef.namespace}.${crossRef.model}`;\n}\nfunction storageDeclaresCollection(storage, collectionName) {\n\tfor (const ns of Object.values(storage.namespaces)) if (Object.hasOwn(ns.entries[\"collection\"] ?? {}, collectionName)) return true;\n\treturn false;\n}\nfunction validateMongoStorage(contract) {\n\tconst errors = [];\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst models = namespace.models;\n\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\tif (model.storage.collection && !storageDeclaresCollection(contract.storage, model.storage.collection)) errors.push(`Model \"${qualifiedName}\" references collection \"${model.storage.collection}\" which is not declared under any namespace's collections map`);\n\t\t\tif (model.base) {\n\t\t\t\tconst baseModel = models[model.base.model];\n\t\t\t\tif (baseModel) {\n\t\t\t\t\tconst variantCollection = model.storage.collection;\n\t\t\t\t\tconst baseCollection = baseModel.storage.collection;\n\t\t\t\t\tif (variantCollection !== baseCollection) errors.push(`Mongo does not support multi-table inheritance; variant \"${qualifiedName}\" must share its base's collection (\"${baseCollection ?? \"(none)\"}\"), but has \"${variantCollection ?? \"(none)\"}\"`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const [relName, relation] of Object.entries(model.relations ?? {})) {\n\t\t\t\tconst targetModel = models[relation.to.model];\n\t\t\t\tconst targetLabel = formatCrossRef(relation.to);\n\t\t\t\tif (targetModel?.owner) {\n\t\t\t\t\tif (targetModel.owner !== modelName) errors.push(`Embed relation \"${relName}\" targets \"${targetLabel}\" which is owned by \"${targetModel.owner}\", not \"${qualifiedName}\"`);\n\t\t\t\t\tif (targetModel.storage.collection) errors.push(`Embed relation \"${relName}\" targets \"${targetLabel}\" which must not have a collection`);\n\t\t\t\t} else if (\"on\" in relation && relation.on) {\n\t\t\t\t\tfor (const localField of relation.on.localFields) if (!(localField in model.fields)) errors.push(`Reference relation \"${relName}\": localField \"${localField}\" is not a field on model \"${qualifiedName}\"`);\n\t\t\t\t\tif (targetModel) {\n\t\t\t\t\t\tfor (const targetField of relation.on.targetFields) if (!(targetField in targetModel.fields)) errors.push(`Reference relation \"${relName}\": targetField \"${targetField}\" is not a field on model \"${targetLabel}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tconst nullabilityError = toOneRelationNullabilityError(qualifiedName, relName, relation, model);\n\t\t\t\t\tif (nullabilityError !== void 0) errors.push(nullabilityError);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (errors.length > 0) throw structuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract storage validation failed:\\n- ${errors.join(\"\\n- \")}`);\n}\n/**\n* A same-space to-one relation that states `nullable` must agree with its local fields: nullable\n* exactly when one of them is nullable (a field that is not declared counts as nullable). A\n* relation without the flag is left to hydration, which derives it the same way.\n*/\nfunction toOneRelationNullabilityError(qualifiedName, relationName, relation, model) {\n\tif (!(\"on\" in relation && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.to.space === void 0) || relation.nullable === void 0) return void 0;\n\tconst location = `Relation \"${relationName}\" on model \"${qualifiedName}\"`;\n\tconst { ownsForeignKey, fields } = resolveMongoToOneRelationFields(model, relation);\n\tif (!ownsForeignKey) return relation.nullable ? void 0 : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related document exists`;\n\tconst anyNullable = fields.some((field) => field.nullable);\n\tif (relation.nullable === anyNullable) return void 0;\n\tconst fieldList = fields.filter((field) => field.nullable !== relation.nullable).map((field) => `\"${field.name}\"`).join(\", \");\n\treturn relation.nullable ? `${location} is nullable but every local field is required (fields ${fieldList})` : `${location} is required but a local field is nullable (fields ${fieldList})`;\n}\n//#endregion\n//#region src/validator-enum-refusal.ts\nconst STORED_JSON_TYPE_NAMES = {\n\tstring: \"a string\",\n\tnumber: \"a finite number\",\n\tboolean: \"a boolean\",\n\tobject: \"a JSON object\",\n\tarray: \"a JSON array\"\n};\n/**\n* A collection validator lists an enum's members in their stored forms, so an enum's BSON type must be one whose values JSON holds. Maps each such type to the JSON type of a member's stored form.\n*/\nconst VALIDATOR_LISTABLE_BSON_TYPES = {\n\tstring: \"string\",\n\tint: \"number\",\n\tdouble: \"number\",\n\tbool: \"boolean\",\n\tobject: \"object\",\n\tarray: \"array\"\n};\nfunction storedJsonTypeOf(stored) {\n\tif (stored === null) return \"null\";\n\tif (Array.isArray(stored)) return \"array\";\n\tif (typeof stored === \"number\" && !Number.isFinite(stored)) return \"non-finite number\";\n\treturn typeof stored;\n}\nfunction storedText(stored) {\n\treturn typeof stored === \"number\" || typeof stored === \"bigint\" ? String(stored) : JSON.stringify(stored);\n}\n/**\n* Why a collection validator cannot list the members of an enum whose codec stores `bsonTypes`, or undefined when it can. Like {@link validatorEnumMemberRefusalOf}, the reason leaves out its subject so each authoring surface can lead with its own, as in `enum \"Role\" @@type codec \"mongo/int64@1\" stores BSON type long, ...`.\n*/\nfunction validatorEnumRefusalOf(bsonTypes) {\n\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\tif (bsonType === void 0 || otherBsonTypes.length > 0) return `declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`;\n\tif (VALIDATOR_LISTABLE_BSON_TYPES[bsonType] === void 0) return `stores BSON type ${bsonType}, which a collection validator cannot list as an enum value. Use a codec whose BSON type is string, int, double, bool, object or array.`;\n}\n/**\n* Why a collection validator cannot list an enum member stored as `stored`, for an enum whose codec stores `bsonTypes`, or undefined when it can. The reason leaves out its subject, as in `enum \"Role\" member \"Admin\" is stored as ...`.\n*/\nfunction validatorEnumMemberRefusalOf(bsonTypes, stored) {\n\tconst enumRefusal = validatorEnumRefusalOf(bsonTypes);\n\tif (enumRefusal !== void 0) return enumRefusal;\n\tconst [bsonType] = bsonTypes;\n\tconst storedJsonType = bsonType === void 0 ? void 0 : VALIDATOR_LISTABLE_BSON_TYPES[bsonType];\n\tif (storedJsonType === void 0 || storedJsonTypeOf(stored) === storedJsonType) return void 0;\n\treturn `is stored as ${storedText(stored)}, which a collection validator cannot list as a ${bsonType}. A member of a ${bsonType} enum must be ${STORED_JSON_TYPE_NAMES[storedJsonType]}.`;\n}\n//#endregion\nexport { MongoChangeStreamPreAndPostImagesOptions, MongoClusteredCollectionOptions, MongoCollationOptions, MongoCollection, MongoCollectionOptions, MongoContractSchema, MongoIndex, MongoIndexOptionDefaults, MongoIndexOptions, MongoStorage, MongoTimeSeriesCollectionOptions, MongoUnboundNamespace, MongoValidator, MongoValueSet, RelationKeys, StorageValueSetSchema, applyPolymorphicScopeToMongoIndex, buildMongoContractView, buildMongoNamespace, buildMongoStorage, createMongoContractSchema, createMongoNamespaceEnvelopeSchema, defaultMongoDomainNamespaceId, defaultMongoStorageNamespaceId, deriveCollectionValidators, documentIdRefusalOf, mongoValueSetsOf, resolveMongoToOneRelationFields, validateMongoStorage, validatorEnumMemberRefusalOf, validatorEnumRefusalOf };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,wBAAwB,MAAM,8BAA8B,cAAc;CAC7E,OAAO,WAAW,IAAI,sBAAsB;CAC5C,KAAK;CACL,UAAU,OAAO,OAAO,EAAE,YAAY,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC;CACzD,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;EACD,WAAW,IAAI;CAChB;AACD;AAGA,MAAM,uBAAuB;AAC7B,IAAI,sBAAsB,MAAM,4BAA4B,cAAc;CACzE;CACA;CACA,OAAO,qBAAqB,OAAO;EAClC,MAAM,gBAAgB,MAAM,QAAQ;EACpC,MAAM,kBAAkB,kBAAkB,KAAK,IAAI,OAAO,KAAK,aAAa,CAAC,CAAC,SAAS;EACvF,MAAM,kBAAkB,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,MAAM,SAAS,SAAS,YAAY;EACvF,IAAI,MAAM,OAAO,wBAAwB,oBAAoB,KAAK,CAAC,iBAAiB,OAAO,sBAAsB;EACjH,OAAO,IAAI,oBAAoB,KAAK;CACrC;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,KAAK,MAAM;EAChB,MAAM,aAAa;GAClB,YAAY,CAAC;GACb,GAAG,MAAM;EACV;EACA,KAAK,UAAU,OAAO,OAAO,UAAU,yBAAyB,YAAY,wBAAwB,GAAG,OAAO,CAAC,CAAC;EAChH,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;EACD,WAAW,IAAI;CAChB;CACA,IAAI,aAAa;EAChB,O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/dist/index.mjs"],"sourcesContent":["import { t as mongoContractCanonicalizationHooks } from \"./canonicalization-hooks-CRVM-Kqh.mjs\";\nimport { a as MongoCollection, c as MongoCollectionOptions, d as MongoCollationOptions, f as MongoChangeStreamPreAndPostImagesOptions, g as createMongoNamespaceEnvelopeSchema, h as createMongoContractSchema, i as MongoValueSet, l as MongoTimeSeriesCollectionOptions, m as StorageValueSetSchema, n as composeMongoEntityKinds, o as MongoValidator, p as MongoContractSchema, s as MongoIndex, u as MongoIndexOptionDefaults } from \"./entity-kinds-RooUvcN8.mjs\";\nimport { n as bsonTypesOfCodec } from \"./mongo-data-type-DzyzU4LF.mjs\";\nimport { RelationKeys } from \"@internal/framework-components/runtime\";\nimport { computeStorageHash } from \"@internal/contract/hashing\";\nimport { IRNodeBase, NamespaceBase, UNBOUND_NAMESPACE_ID, buildNamespacedEntities, buildSingleNamespaceView, freezeNode, hydrateNamespaceEntities } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { UNBOUND_DOMAIN_NAMESPACE_ID } from \"@internal/contract/default-namespace\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/ir/mongo-unbound-namespace.ts\nvar MongoUnboundNamespace = class MongoUnboundNamespace extends NamespaceBase {\n\tstatic instance = new MongoUnboundNamespace();\n\tid = UNBOUND_NAMESPACE_ID;\n\tentries = Object.freeze({ collection: Object.freeze({}) });\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-namespace\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/build-mongo-namespace.ts\nconst MONGO_NAMESPACE_KIND = \"mongo-namespace\";\nvar MongoBoundNamespace = class MongoBoundNamespace extends NamespaceBase {\n\tid;\n\tentries;\n\tstatic fromCollectionsInput(input) {\n\t\tconst collectionMap = input.entries[\"collection\"];\n\t\tconst collectionCount = collectionMap !== void 0 ? Object.keys(collectionMap).length : 0;\n\t\tconst hasUnknownKinds = Object.keys(input.entries).some((kind) => kind !== \"collection\");\n\t\tif (input.id === UNBOUND_NAMESPACE_ID && collectionCount === 0 && !hasUnknownKinds) return MongoUnboundNamespace.instance;\n\t\treturn new MongoBoundNamespace(input);\n\t}\n\tconstructor(input) {\n\t\tsuper();\n\t\tthis.id = input.id;\n\t\tconst rawEntries = {\n\t\t\tcollection: {},\n\t\t\t...input.entries\n\t\t};\n\t\tthis.entries = Object.freeze(blindCast(hydrateNamespaceEntities(rawEntries, composeMongoEntityKinds(), \"carry\")));\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: MONGO_NAMESPACE_KIND,\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tfreezeNode(this);\n\t}\n\tget collection() {\n\t\treturn this.entries.collection ?? Object.freeze({});\n\t}\n};\nfunction buildMongoNamespace(input) {\n\treturn MongoBoundNamespace.fromCollectionsInput(input);\n}\n//#endregion\n//#region src/ir/mongo-storage.ts\nvar MongoStorage = class extends IRNodeBase {\n\tstorageHash;\n\tnamespaces;\n\tconstructor(input) {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-storage\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: true\n\t\t});\n\t\tthis.storageHash = input.storageHash;\n\t\tthis.namespaces = Object.freeze(input.namespaces);\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/build-mongo-storage.ts\n/**\n* Builds a Mongo contract's storage: the unbound namespace holding the collections and value sets, and the storage hash that `db sign` and `db verify` compare. Every Mongo contract source calls this, so they hash storage the same way.\n*/\nfunction buildMongoStorage(input) {\n\tconst hasValueSets = Object.keys(input.valueSets).length > 0;\n\tconst namespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: input.collections,\n\t\t\t...hasValueSets ? { valueSet: input.valueSets } : {}\n\t\t}\n\t});\n\treturn new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget: \"mongo\",\n\t\t\ttargetFamily: \"mongo\",\n\t\t\tstorage: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: namespace.entries.collection,\n\t\t\t\t\t...namespace.entries.valueSet !== void 0 ? { valueSet: namespace.entries.valueSet } : {}\n\t\t\t\t}\n\t\t\t} } },\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: namespace }\n\t});\n}\n//#endregion\n//#region src/contract-view.ts\nconst MONGO_BUILTIN_KINDS = [\"collection\"];\n/**\n* Builds the Mongo view: unwraps the sole namespace's built-in `collection` kind\n* to the root, attaches the namespace-keyed `namespace` map, and layers both\n* over the deserialized contract so the result is a structural superset of the\n* contract.\n*/\nfunction buildMongoContractView(contract) {\n\tconst rootAccessors = buildSingleNamespaceView(contract.storage, MONGO_BUILTIN_KINDS);\n\tconst namespace = buildNamespacedEntities(contract.storage, MONGO_BUILTIN_KINDS);\n\treturn {\n\t\t...contract,\n\t\t...rootAccessors,\n\t\tnamespace\n\t};\n}\n//#endregion\n//#region src/default-namespace.ts\n/** Default storage namespace for Mongo-family contracts at runtime. */\nconst defaultMongoStorageNamespaceId = UNBOUND_NAMESPACE_ID;\n/** Default domain namespace for Mongo-family contracts at runtime. */\nconst defaultMongoDomainNamespaceId = UNBOUND_DOMAIN_NAMESPACE_ID;\n//#endregion\n//#region src/relation-fields.ts\nconst DOCUMENT_ID_FIELD = \"_id\";\n/**\n* The model facts behind a same-space to-one relation's nullability: which side owns the\n* foreign key, and whether each local field is nullable.\n*/\nfunction resolveMongoToOneRelationFields(model, relation) {\n\tconst fields = relation.on.localFields.map((name) => ({\n\t\tname,\n\t\tnullable: model.fields[name]?.nullable ?? true\n\t}));\n\treturn {\n\t\townsForeignKey: !(relation.cardinality === \"1:1\" && fields.every((field) => field.name === DOCUMENT_ID_FIELD)),\n\t\tfields\n\t};\n}\n/** Whether `relation` stores the related model inside the document, rather than referring to documents elsewhere. */\nfunction isEmbedRelation(relation) {\n\treturn !(\"on\" in relation) && !(\"through\" in relation);\n}\n//#endregion\n//#region src/recursive-groups.ts\nfunction typeKey(kind, name) {\n\treturn `${kind}:${name}`;\n}\nfunction referencesOf(fields) {\n\treturn Object.values(fields).flatMap((field) => field.type.kind === \"valueObject\" ? [typeKey(\"valueObject\", field.type.name)] : []);\n}\n/**\n* The recursive groups of value objects and embedded models: each set of types that can reach each other through value-object fields and embed relations (a strongly connected component of that graph), and each type that refers to itself. Maps the {@link typeKey} of every type in such a group to the group's number; a type in no recursive group is absent.\n*/\nfunction recursiveGroupsOf(valueObjects, models) {\n\tconst edges = /* @__PURE__ */ new Map();\n\tfor (const [name, valueObject] of Object.entries(valueObjects)) edges.set(typeKey(\"valueObject\", name), referencesOf(valueObject.fields));\n\tfor (const [name, model] of Object.entries(models)) {\n\t\tconst embeds = Object.values(model.relations).flatMap((relation) => isEmbedRelation(relation) ? [typeKey(\"model\", relation.to.model)] : []);\n\t\tedges.set(typeKey(\"model\", name), [...referencesOf(model.fields), ...embeds]);\n\t}\n\tconst groups = /* @__PURE__ */ new Map();\n\tconst index = /* @__PURE__ */ new Map();\n\tconst lowLink = /* @__PURE__ */ new Map();\n\tconst stack = [];\n\tconst onStack = /* @__PURE__ */ new Set();\n\tlet nextIndex = 0;\n\tlet nextGroup = 0;\n\tconst visit = (node) => {\n\t\tindex.set(node, nextIndex);\n\t\tlowLink.set(node, nextIndex);\n\t\tnextIndex++;\n\t\tstack.push(node);\n\t\tonStack.add(node);\n\t\tfor (const target of edges.get(node) ?? []) {\n\t\t\tif (!edges.has(target)) continue;\n\t\t\tif (!index.has(target)) {\n\t\t\t\tvisit(target);\n\t\t\t\tlowLink.set(node, Math.min(lowLink.get(node) ?? 0, lowLink.get(target) ?? 0));\n\t\t\t} else if (onStack.has(target)) lowLink.set(node, Math.min(lowLink.get(node) ?? 0, index.get(target) ?? 0));\n\t\t}\n\t\tif (lowLink.get(node) !== index.get(node)) return;\n\t\tconst members = [];\n\t\tlet member;\n\t\tdo {\n\t\t\tmember = stack.pop();\n\t\t\tif (member === void 0) break;\n\t\t\tonStack.delete(member);\n\t\t\tmembers.push(member);\n\t\t} while (member !== node);\n\t\tconst refersToItself = (edges.get(node) ?? []).includes(node);\n\t\tif (members.length > 1 || refersToItself) {\n\t\t\tfor (const each of members) groups.set(each, nextGroup);\n\t\t\tnextGroup++;\n\t\t}\n\t};\n\tfor (const node of edges.keys()) if (!index.has(node)) visit(node);\n\treturn groups;\n}\n//#endregion\n//#region src/derive-json-schema.ts\n/**\n* `$jsonSchema` has no references, so a type that contains itself, directly or through other types, cannot be described at every depth. The validator describes the type through which a path enters a recursive group in full, and accepts any object for each field below it that refers back into that group. So each group is written out once for each place a document enters it, and no valid document is refused.\n*/\nconst OPEN_OBJECT = { bsonType: \"object\" };\nfunction sourcesFor(input, rootKey) {\n\tconst groups = recursiveGroupsOf(input.valueObjects, input.models);\n\tconst rootGroup = groups.get(rootKey);\n\treturn {\n\t\t...input,\n\t\tgroups,\n\t\tenteredGroups: new Set(rootGroup === void 0 ? [] : [rootGroup])\n\t};\n}\nfunction objectSchemaOf(kind, name, shape, sources) {\n\tconst key = typeKey(kind, name);\n\tconst group = sources.groups.get(key);\n\tif (group !== void 0 && sources.enteredGroups.has(group)) return OPEN_OBJECT;\n\treturn deriveObjectSchema(shape, entering(key, sources));\n}\n/** `sources` with the recursive group of the type `key` entered, if it has one. */\nfunction entering(key, sources) {\n\tconst group = sources.groups.get(key);\n\tif (group === void 0 || sources.enteredGroups.has(group)) return sources;\n\treturn {\n\t\t...sources,\n\t\tenteredGroups: /* @__PURE__ */ new Set([...sources.enteredGroups, group])\n\t};\n}\nconst NO_RELATIONS = {};\nconst NOTHING_INHERITED = {\n\tfields: {},\n\trelations: NO_RELATIONS\n};\n/**\n* The `bsonType` keyword for a list of BSON type names: the name itself for one entry, the list for several.\n*/\nfunction bsonTypeKeyword(bsonTypes) {\n\tconst [only, ...rest] = bsonTypes;\n\treturn only !== void 0 && rest.length === 0 ? only : [...bsonTypes];\n}\nfunction withNull(bsonTypes) {\n\treturn bsonTypes.includes(\"null\") ? bsonTypes : [\"null\", ...bsonTypes];\n}\nfunction anyValueSchema(field) {\n\tif (\"many\" in field && field.many) return {\n\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\titems: {}\n\t};\n\treturn {};\n}\nfunction fieldToBsonSchema(field, sources) {\n\tconst { lookups, valueObjects, valueSets } = sources;\n\tif (field.type.kind === \"scalar\") {\n\t\tconst bsonTypes = bsonTypesOfCodec(field.type.codecId, lookups);\n\t\tif (bsonTypes === void 0) return void 0;\n\t\tif (bsonTypes.length === 0) return anyValueSchema(field);\n\t\tconst bsonType = bsonTypeKeyword(bsonTypes);\n\t\tconst enumValues = field.valueSet !== void 0 ? valueSets[field.valueSet.entityName]?.values ?? null : null;\n\t\tif (field.many) {\n\t\t\tconst items = { bsonType: field.many.elementNullable ? [\"null\", bsonType] : bsonType };\n\t\t\tif (enumValues) items[\"enum\"] = field.many.elementNullable ? [...enumValues, null] : enumValues;\n\t\t\treturn {\n\t\t\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\t\t\titems\n\t\t\t};\n\t\t}\n\t\tif (field.nullable) {\n\t\t\tconst s = { bsonType: bsonTypeKeyword(withNull(bsonTypes)) };\n\t\t\tif (enumValues) s[\"enum\"] = [...enumValues, null];\n\t\t\treturn s;\n\t\t}\n\t\tconst s = { bsonType };\n\t\tif (enumValues) s[\"enum\"] = enumValues;\n\t\treturn s;\n\t}\n\tif (field.type.kind === \"valueObject\") {\n\t\tconst vo = valueObjects[field.type.name];\n\t\tif (!vo) return void 0;\n\t\tconst voSchema = objectSchemaOf(\"valueObject\", field.type.name, {\n\t\t\tfields: vo.fields,\n\t\t\trelations: NO_RELATIONS\n\t\t}, sources);\n\t\tif (field.many) return {\n\t\t\tbsonType: field.nullable ? [\"null\", \"array\"] : \"array\",\n\t\t\titems: field.many.elementNullable ? { oneOf: [{ bsonType: \"null\" }, voSchema] } : voSchema\n\t\t};\n\t\tif (field.nullable) return { oneOf: [{ bsonType: \"null\" }, voSchema] };\n\t\treturn voSchema;\n\t}\n}\n/**\n* An embedded model is stored inside its owner's document as a closed object (a list of them for `1:N`). The contract does not say whether one must be present, and the ORM creates documents without them, so the property is never required.\n*/\nfunction embedToBsonSchema(relation, sources) {\n\tconst embeddedName = relation.to.model;\n\tconst embedded = sources.models[embeddedName];\n\tassertDefined(embedded, `Embedded model \"${embeddedName}\" is missing`);\n\tconst schema = objectSchemaOf(\"model\", embeddedName, embedded, sources);\n\treturn relation.cardinality === \"1:N\" ? {\n\t\tbsonType: \"array\",\n\t\titems: schema\n\t} : schema;\n}\n/**\n* The properties of `shape`, leaving out the fields and relations `inherited` already describes.\n*/\nfunction propertiesOf(shape, sources, inherited) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [fieldName, field] of Object.entries(shape.fields)) {\n\t\tif (Object.hasOwn(inherited.fields, fieldName)) continue;\n\t\tconst schema = fieldToBsonSchema(field, sources);\n\t\tif (schema) {\n\t\t\tproperties[fieldName] = schema;\n\t\t\tif (!field.nullable) required.push(fieldName);\n\t\t}\n\t}\n\tfor (const [relationName, relation] of Object.entries(shape.relations)) {\n\t\tif (Object.hasOwn(inherited.relations, relationName) || !isEmbedRelation(relation)) continue;\n\t\tproperties[relationName] = embedToBsonSchema(relation, sources);\n\t}\n\treturn {\n\t\tproperties,\n\t\trequired\n\t};\n}\nfunction deriveObjectSchema(shape, sources) {\n\tconst { properties, required } = propertiesOf(shape, sources, NOTHING_INHERITED);\n\tconst result = {\n\t\tbsonType: \"object\",\n\t\tproperties,\n\t\tadditionalProperties: false\n\t};\n\tif (required.length > 0) result[\"required\"] = required.sort();\n\treturn result;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction validatorOf(jsonSchema) {\n\treturn new MongoValidator({\n\t\tjsonSchema,\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\nfunction polymorphicSchema(base, discriminatorField, variants, sources) {\n\tconst baseSchema = deriveObjectSchema(base, sources);\n\tconst baseProperties = isRecord(baseSchema[\"properties\"]) ? baseSchema[\"properties\"] : {};\n\tconst oneOf = [];\n\tfor (const variant of variants) {\n\t\tconst { properties: variantProperties, required } = propertiesOf(variant, entering(typeKey(\"model\", variant.modelName), sources), base);\n\t\toneOf.push({\n\t\t\tproperties: {\n\t\t\t\t...baseProperties,\n\t\t\t\t[discriminatorField]: { enum: [variant.discriminatorValue] },\n\t\t\t\t...variantProperties\n\t\t\t},\n\t\t\trequired: [discriminatorField, ...required].sort(),\n\t\t\tadditionalProperties: false\n\t\t});\n\t}\n\tconst jsonSchema = { ...baseSchema };\n\tdelete jsonSchema[\"additionalProperties\"];\n\tif (oneOf.length > 0) jsonSchema[\"oneOf\"] = oneOf;\n\treturn jsonSchema;\n}\n/**\n* The validator of a root model's collection: the model's fields and embedded models, and for a model with variants one `oneOf` branch per variant.\n*/\nfunction deriveModelValidator(modelName, model, sources) {\n\tconst schemaSources = sourcesFor(sources, typeKey(\"model\", modelName));\n\tif (!model.discriminator || !model.variants) return validatorOf(deriveObjectSchema(model, schemaSources));\n\tconst variants = Object.entries(model.variants).map(([discriminatorValue, variant]) => {\n\t\tconst variantModel = sources.models[variant.model];\n\t\tassertDefined(variantModel, `Variant model \"${variant.model}\" of \"${modelName}\" is missing`);\n\t\treturn {\n\t\t\tdiscriminatorValue,\n\t\t\tmodelName: variant.model,\n\t\t\t...variantModel\n\t\t};\n\t});\n\treturn validatorOf(polymorphicSchema(model, model.discriminator.field, variants, schemaSources));\n}\n//#endregion\n//#region src/derive-collection-validators.ts\n/**\n* The validator of each collection in `roots`, keyed by collection name, derived from the collection's root model. A root model with variants gets one polymorphic validator covering every variant.\n*/\nfunction deriveCollectionValidators(input) {\n\tconst validators = {};\n\tfor (const [collectionName, root] of Object.entries(input.roots)) {\n\t\tconst model = input.models[root.model];\n\t\tassertDefined(model, `Root model \"${root.model}\" of collection \"${collectionName}\" is missing`);\n\t\tvalidators[collectionName] = deriveModelValidator(root.model, model, input);\n\t}\n\treturn validators;\n}\n//#endregion\n//#region src/document-id-refusal.ts\nconst notObjectId = {\n\tkind: \"notObjectId\",\n\treason: \"has no _id field stored as BSON type objectId. MongoDB adds an objectId _id to every document it inserts without one, so a collection validator without it rejects every insert.\"\n};\n/**\n* Why a root model with `fields` cannot be stored in a collection with a validator, or undefined when it can. The reason leaves out its subject so each authoring surface can lead with its own, as in `Model \"User\" has no _id field ...`.\n*/\nfunction documentIdRefusalOf(fields, lookups) {\n\tconst id = Object.hasOwn(fields, \"_id\") ? fields[\"_id\"] : void 0;\n\tif (id?.type.kind !== \"scalar\") return notObjectId;\n\tconst bsonTypes = bsonTypesOfCodec(id.type.codecId, lookups);\n\tif (bsonTypes === void 0) return {\n\t\tkind: \"unknownCodec\",\n\t\treason: `has an _id field whose codec \"${id.type.codecId}\" has no MongoDB data type, so its BSON type is unknown.`\n\t};\n\treturn bsonTypes.length === 1 && bsonTypes[0] === \"objectId\" ? void 0 : notObjectId;\n}\n//#endregion\n//#region src/ir/mongo-clustered-collection-options.ts\n/**\n* Clustered-collection options (the `clusteredIndex` collection-creation\n* field). Lifted from a `type =` data shape to an AST class extending\n* `IRNodeBase` per FR18.\n*\n* MongoDB requires `key` and `unique` for any clustered collection; the\n* constructor enforces presence by type signature.\n*/\nvar MongoClusteredCollectionOptions = class extends IRNodeBase {\n\tkind = \"mongo-clustered-collection-options\";\n\tkey;\n\tunique;\n\tconstructor(options) {\n\t\tsuper();\n\t\tif (options.name !== void 0) this.name = options.name;\n\t\tthis.key = options.key;\n\t\tthis.unique = options.unique;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/ir/mongo-index-options.ts\n/**\n* Mongo Contract IR node for the per-index option vocabulary (the second\n* argument to `db.collection.createIndex(keys, options)` minus the keys\n* themselves). Lifted from a `type =` data shape to an AST class\n* extending `IRNodeBase` per FR18.\n*\n* Nested `collation` is itself an IR class (`MongoCollationOptions`); the\n* constructor accepts either a class instance or a data literal and\n* normalises to the class form so downstream walks see a uniform IR tree.\n*/\nvar MongoIndexOptions = class extends IRNodeBase {\n\tkind = \"mongo-index-options\";\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tif (options.unique !== void 0) this.unique = options.unique;\n\t\tif (options.name !== void 0) this.name = options.name;\n\t\tif (options.partialFilterExpression !== void 0) this.partialFilterExpression = options.partialFilterExpression;\n\t\tif (options.sparse !== void 0) this.sparse = options.sparse;\n\t\tif (options.expireAfterSeconds !== void 0) this.expireAfterSeconds = options.expireAfterSeconds;\n\t\tif (options.weights !== void 0) this.weights = options.weights;\n\t\tif (options.default_language !== void 0) this.default_language = options.default_language;\n\t\tif (options.language_override !== void 0) this.language_override = options.language_override;\n\t\tif (options.textIndexVersion !== void 0) this.textIndexVersion = options.textIndexVersion;\n\t\tif (options[\"2dsphereIndexVersion\"] !== void 0) this[\"2dsphereIndexVersion\"] = options[\"2dsphereIndexVersion\"];\n\t\tif (options.bits !== void 0) this.bits = options.bits;\n\t\tif (options.min !== void 0) this.min = options.min;\n\t\tif (options.max !== void 0) this.max = options.max;\n\t\tif (options.bucketSize !== void 0) this.bucketSize = options.bucketSize;\n\t\tif (options.hidden !== void 0) this.hidden = options.hidden;\n\t\tif (options.collation !== void 0) this.collation = options.collation instanceof MongoCollationOptions ? options.collation : new MongoCollationOptions(options.collation);\n\t\tif (options.wildcardProjection !== void 0) this.wildcardProjection = options.wildcardProjection;\n\t\tfreezeNode(this);\n\t}\n};\n//#endregion\n//#region src/mongo-enum.ts\n/**\n* The storage value set of each enum: its members as the contract holds them, in the form their codec stores.\n*/\nfunction mongoValueSetsOf(enums) {\n\tconst valueSets = {};\n\tfor (const [enumName, { members }] of Object.entries(enums)) valueSets[enumName] = {\n\t\tkind: \"valueSet\",\n\t\tvalues: members.map((member) => member.value)\n\t};\n\treturn valueSets;\n}\n//#endregion\n//#region src/polymorphic-index-scope.ts\nfunction isScalarDiscriminatorValue(value) {\n\tconst t = typeof value;\n\treturn t === \"string\" || t === \"number\" || t === \"boolean\";\n}\nfunction formatValue(value) {\n\tif (typeof value === \"string\") return JSON.stringify(value);\n\tif (value === null) return \"null\";\n\tif (Array.isArray(value)) return JSON.stringify(value);\n\tif (typeof value === \"object\") return JSON.stringify(value);\n\treturn String(value);\n}\nfunction applyPolymorphicScopeToMongoIndex(index, scope) {\n\tif (!isScalarDiscriminatorValue(scope.discriminatorValue)) return {\n\t\tkind: \"conflict\",\n\t\treason: `Variant-scoped indexes require a scalar (string, number, or boolean) discriminator value for field \"${scope.discriminatorField}\", but received ${formatValue(scope.discriminatorValue)}.`\n\t};\n\tconst existing = index.partialFilterExpression;\n\tif (existing && Object.hasOwn(existing, scope.discriminatorField)) {\n\t\tconst existingValue = existing[scope.discriminatorField];\n\t\tif (existingValue === scope.discriminatorValue) return {\n\t\t\tkind: \"ok\",\n\t\t\tindex\n\t\t};\n\t\treturn {\n\t\t\tkind: \"conflict\",\n\t\t\treason: `Index partialFilterExpression sets \"${scope.discriminatorField}\" to ${formatValue(existingValue)}, which conflicts with the variant's discriminator value ${formatValue(scope.discriminatorValue)}.`\n\t\t};\n\t}\n\tconst merged = {\n\t\t...existing ?? {},\n\t\t[scope.discriminatorField]: scope.discriminatorValue\n\t};\n\treturn {\n\t\tkind: \"ok\",\n\t\tindex: new MongoIndex({\n\t\t\tkeys: index.keys,\n\t\t\t...index.unique !== void 0 && { unique: index.unique },\n\t\t\t...index.sparse !== void 0 && { sparse: index.sparse },\n\t\t\t...index.expireAfterSeconds !== void 0 && { expireAfterSeconds: index.expireAfterSeconds },\n\t\t\tpartialFilterExpression: merged,\n\t\t\t...index.wildcardProjection !== void 0 && { wildcardProjection: index.wildcardProjection },\n\t\t\t...index.collation !== void 0 && { collation: index.collation },\n\t\t\t...index.weights !== void 0 && { weights: index.weights },\n\t\t\t...index.default_language !== void 0 && { default_language: index.default_language },\n\t\t\t...index.language_override !== void 0 && { language_override: index.language_override }\n\t\t})\n\t};\n}\n//#endregion\n//#region src/validate-storage.ts\nfunction formatCrossRef(crossRef) {\n\treturn `${crossRef.namespace}.${crossRef.model}`;\n}\nfunction storageDeclaresCollection(storage, collectionName) {\n\tfor (const ns of Object.values(storage.namespaces)) if (Object.hasOwn(ns.entries[\"collection\"] ?? {}, collectionName)) return true;\n\treturn false;\n}\nfunction validateMongoStorage(contract) {\n\tconst errors = [];\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst models = namespace.models;\n\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\tif (model.storage.collection && !storageDeclaresCollection(contract.storage, model.storage.collection)) errors.push(`Model \"${qualifiedName}\" references collection \"${model.storage.collection}\" which is not declared under any namespace's collections map`);\n\t\t\tif (model.base) {\n\t\t\t\tconst baseModel = models[model.base.model];\n\t\t\t\tif (baseModel) {\n\t\t\t\t\tconst variantCollection = model.storage.collection;\n\t\t\t\t\tconst baseCollection = baseModel.storage.collection;\n\t\t\t\t\tif (variantCollection !== baseCollection) errors.push(`Mongo does not support multi-table inheritance; variant \"${qualifiedName}\" must share its base's collection (\"${baseCollection ?? \"(none)\"}\"), but has \"${variantCollection ?? \"(none)\"}\"`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const [relName, relation] of Object.entries(model.relations ?? {})) {\n\t\t\t\tconst targetModel = models[relation.to.model];\n\t\t\t\tconst targetLabel = formatCrossRef(relation.to);\n\t\t\t\tif (targetModel?.owner) {\n\t\t\t\t\tif (targetModel.owner !== modelName) errors.push(`Embed relation \"${relName}\" targets \"${targetLabel}\" which is owned by \"${targetModel.owner}\", not \"${qualifiedName}\"`);\n\t\t\t\t\tif (targetModel.storage.collection) errors.push(`Embed relation \"${relName}\" targets \"${targetLabel}\" which must not have a collection`);\n\t\t\t\t} else if (\"on\" in relation && relation.on) {\n\t\t\t\t\tfor (const localField of relation.on.localFields) if (!(localField in model.fields)) errors.push(`Reference relation \"${relName}\": localField \"${localField}\" is not a field on model \"${qualifiedName}\"`);\n\t\t\t\t\tif (targetModel) {\n\t\t\t\t\t\tfor (const targetField of relation.on.targetFields) if (!(targetField in targetModel.fields)) errors.push(`Reference relation \"${relName}\": targetField \"${targetField}\" is not a field on model \"${targetLabel}\"`);\n\t\t\t\t\t}\n\t\t\t\t\tconst nullabilityError = toOneRelationNullabilityError(qualifiedName, relName, relation, model);\n\t\t\t\t\tif (nullabilityError !== void 0) errors.push(nullabilityError);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (errors.length > 0) throw structuredError(\"CONTRACT.VALIDATION_FAILED\", `Contract storage validation failed:\\n- ${errors.join(\"\\n- \")}`);\n}\n/**\n* A same-space to-one relation that states `nullable` must agree with its local fields: nullable\n* exactly when one of them is nullable (a field that is not declared counts as nullable). A\n* relation without the flag is left to hydration, which derives it the same way.\n*/\nfunction toOneRelationNullabilityError(qualifiedName, relationName, relation, model) {\n\tif (!(\"on\" in relation && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.to.space === void 0) || relation.nullable === void 0) return void 0;\n\tconst location = `Relation \"${relationName}\" on model \"${qualifiedName}\"`;\n\tconst { ownsForeignKey, fields } = resolveMongoToOneRelationFields(model, relation);\n\tif (!ownsForeignKey) return relation.nullable ? void 0 : `${location} is required but does not own the foreign key, so nothing in storage guarantees the related document exists`;\n\tconst anyNullable = fields.some((field) => field.nullable);\n\tif (relation.nullable === anyNullable) return void 0;\n\tconst fieldList = fields.filter((field) => field.nullable !== relation.nullable).map((field) => `\"${field.name}\"`).join(\", \");\n\treturn relation.nullable ? `${location} is nullable but every local field is required (fields ${fieldList})` : `${location} is required but a local field is nullable (fields ${fieldList})`;\n}\n//#endregion\n//#region src/validator-enum-refusal.ts\nconst STORED_JSON_TYPE_NAMES = {\n\tstring: \"a string\",\n\tnumber: \"a finite number\",\n\tboolean: \"a boolean\",\n\tobject: \"a JSON object\",\n\tarray: \"a JSON array\"\n};\n/**\n* A collection validator lists an enum's members in their stored forms, so an enum's BSON type must be one whose values JSON holds. Maps each such type to the JSON type of a member's stored form.\n*/\nconst VALIDATOR_LISTABLE_BSON_TYPES = {\n\tstring: \"string\",\n\tint: \"number\",\n\tdouble: \"number\",\n\tbool: \"boolean\",\n\tobject: \"object\",\n\tarray: \"array\"\n};\nfunction storedJsonTypeOf(stored) {\n\tif (stored === null) return \"null\";\n\tif (Array.isArray(stored)) return \"array\";\n\tif (typeof stored === \"number\" && !Number.isFinite(stored)) return \"non-finite number\";\n\treturn typeof stored;\n}\nfunction storedText(stored) {\n\treturn typeof stored === \"number\" || typeof stored === \"bigint\" ? String(stored) : JSON.stringify(stored);\n}\n/**\n* Why a collection validator cannot list the members of an enum whose codec stores `bsonTypes`, or undefined when it can. Like {@link validatorEnumMemberRefusalOf}, the reason leaves out its subject so each authoring surface can lead with its own, as in `enum \"Role\" @@type codec \"mongo/int64@1\" stores BSON type long, ...`.\n*/\nfunction validatorEnumRefusalOf(bsonTypes) {\n\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\tif (bsonType === void 0 || otherBsonTypes.length > 0) return `declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`;\n\tif (VALIDATOR_LISTABLE_BSON_TYPES[bsonType] === void 0) return `stores BSON type ${bsonType}, which a collection validator cannot list as an enum value. Use a codec whose BSON type is string, int, double, bool, object or array.`;\n}\n/**\n* Why a collection validator cannot list an enum member stored as `stored`, for an enum whose codec stores `bsonTypes`, or undefined when it can. The reason leaves out its subject, as in `enum \"Role\" member \"Admin\" is stored as ...`.\n*/\nfunction validatorEnumMemberRefusalOf(bsonTypes, stored) {\n\tconst enumRefusal = validatorEnumRefusalOf(bsonTypes);\n\tif (enumRefusal !== void 0) return enumRefusal;\n\tconst [bsonType] = bsonTypes;\n\tconst storedJsonType = bsonType === void 0 ? void 0 : VALIDATOR_LISTABLE_BSON_TYPES[bsonType];\n\tif (storedJsonType === void 0 || storedJsonTypeOf(stored) === storedJsonType) return void 0;\n\treturn `is stored as ${storedText(stored)}, which a collection validator cannot list as a ${bsonType}. A member of a ${bsonType} enum must be ${STORED_JSON_TYPE_NAMES[storedJsonType]}.`;\n}\n//#endregion\nexport { MongoChangeStreamPreAndPostImagesOptions, MongoClusteredCollectionOptions, MongoCollationOptions, MongoCollection, MongoCollectionOptions, MongoContractSchema, MongoIndex, MongoIndexOptionDefaults, MongoIndexOptions, MongoStorage, MongoTimeSeriesCollectionOptions, MongoUnboundNamespace, MongoValidator, MongoValueSet, RelationKeys, StorageValueSetSchema, applyPolymorphicScopeToMongoIndex, buildMongoContractView, buildMongoNamespace, buildMongoStorage, createMongoContractSchema, createMongoNamespaceEnvelopeSchema, defaultMongoDomainNamespaceId, defaultMongoStorageNamespaceId, deriveCollectionValidators, documentIdRefusalOf, mongoValueSetsOf, resolveMongoToOneRelationFields, validateMongoStorage, validatorEnumMemberRefusalOf, validatorEnumRefusalOf };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,wBAAwB,MAAM,8BAA8B,cAAc;CAC7E,OAAO,WAAW,IAAI,sBAAsB;CAC5C,KAAK;CACL,UAAU,OAAO,OAAO,EAAE,YAAY,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC;CACzD,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;EACD,WAAW,IAAI;CAChB;AACD;AAGA,MAAM,uBAAuB;AAC7B,IAAI,s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OAAO,MAAM,IAAI,KAAK,UAAU,MAAM;AACzG;;;;AAIA,SAAS,uBAAuB,WAAW;CAC1C,MAAM,CAAC,UAAU,GAAG,kBAAkB;CACtC,IAAI,aAAa,KAAK,KAAK,eAAe,SAAS,GAAG,OAAO,YAAY,UAAU,OAAO;CAC1F,IAAI,8BAA8B,cAAc,KAAK,GAAG,OAAO,oBAAoB,SAAS;AAC7F;;;;AAIA,SAAS,6BAA6B,WAAW,QAAQ;CACxD,MAAM,cAAc,uBAAuB,SAAS;CACpD,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,MAAM,CAAC,YAAY;CACnB,MAAM,iBAAiB,aAAa,KAAK,IAAI,KAAK,IAAI,8BAA8B;CACpF,IAAI,mBAAmB,KAAK,KAAK,iBAAiB,MAAM,MAAM,gBAAgB,OAAO,KAAK;CAC1F,OAAO,gBAAgB,WAAW,MAAM,EAAE,kDAAkD,SAAS,kBAAkB,SAAS,gBAAgB,uBAAuB,gBAAgB;AACxL"}
@@ -1 +1 @@
1
- {"version":3,"file":"dist-xk_0xOR-.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-CHQQ4WDf.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\n//#region src/describe-unresolved-type.ts\nconst EARLIER_MONGO_SCALAR_NAMES = {\n\tBigInt: \"Int64\",\n\tBytes: \"Binary\",\n\tDecimal: \"Decimal128\"\n};\nfunction scalarTypesSentence(types) {\n\tconst current = [...collectScalarTypeConstructors(types).keys()].filter((name) => {\n\t\tconst descriptor = types[name];\n\t\treturn !(descriptor !== void 0 && isAuthoringTypeConstructorDescriptor(descriptor) && descriptor.deprecated !== void 0);\n\t});\n\treturn current.length === 0 ? \"No Mongo scalar types are registered.\" : `The Mongo scalar types are ${current.length === 1 ? current.join(\"\") : `${current.slice(0, -1).join(\", \")} and ${current.at(-1)}`}.`;\n}\nfunction describeUnresolvedMongoType(contributions) {\n\tconst types = contributions.type;\n\tconst scalars = collectScalarTypeConstructors(types);\n\treturn ({ field, owner, written }) => {\n\t\tif (field.typeNamespaceId !== void 0 || field.typeConstructor !== void 0) return;\n\t\tconst replacement = EARLIER_MONGO_SCALAR_NAMES[written];\n\t\tif (replacement === void 0 || !scalars.has(replacement)) return `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;\n\t\treturn `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a Mongo scalar type; use \"${replacement}\".`;\n\t};\n}\n//#endregion\nexport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;AAGA,MAAM,6BAA6B;CAClC,QAAQ;CACR,OAAO;CACP,SAAS;AACV;AACA,SAAS,oBAAoB,OAAO;CACnC,MAAM,UAAU,CAAC,GAAG,8BAA8B,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAS;EACjF,MAAM,aAAa,MAAM;EACzB,OAAO,EAAE,eAAe,KAAK,KAAK,qCAAqC,UAAU,KAAK,WAAW,eAAe,KAAK;CACtH,CAAC;CACD,OAAO,QAAQ,WAAW,IAAI,0CAA0C,8BAA8B,QAAQ,WAAW,IAAI,QAAQ,KAAK,EAAE,IAAI,GAAG,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,QAAQ,GAAG,EAAE,IAAI;AAC5M;AACA,SAAS,4BAA4B,eAAe;CACnD,MAAM,QAAQ,cAAc;CAC5B,MAAM,UAAU,8BAA8B,KAAK;CACnD,QAAQ,EAAE,OAAO,OAAO,cAAc;EACrC,IAAI,MAAM,oBAAoB,KAAK,KAAK,MAAM,oBAAoB,KAAK,GAAG;EAC1E,MAAM,cAAc,2BAA2B;EAC/C,IAAI,gBAAgB,KAAK,KAAK,CAAC,QAAQ,IAAI,WAAW,GAAG,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,uEAAuE,oBAAoB,KAAK;EACzN,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,4CAA4C,YAAY;CACzH;AACD"}
1
+ {"version":3,"file":"dist-xk_0xOR-.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-C0x7PZIS.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\n//#region src/describe-unresolved-type.ts\nconst EARLIER_MONGO_SCALAR_NAMES = {\n\tBigInt: \"Int64\",\n\tBytes: \"Binary\",\n\tDecimal: \"Decimal128\"\n};\nfunction scalarTypesSentence(types) {\n\tconst current = [...collectScalarTypeConstructors(types).keys()].filter((name) => {\n\t\tconst descriptor = types[name];\n\t\treturn !(descriptor !== void 0 && isAuthoringTypeConstructorDescriptor(descriptor) && descriptor.deprecated !== void 0);\n\t});\n\treturn current.length === 0 ? \"No Mongo scalar types are registered.\" : `The Mongo scalar types are ${current.length === 1 ? current.join(\"\") : `${current.slice(0, -1).join(\", \")} and ${current.at(-1)}`}.`;\n}\nfunction describeUnresolvedMongoType(contributions) {\n\tconst types = contributions.type;\n\tconst scalars = collectScalarTypeConstructors(types);\n\treturn ({ field, owner, written }) => {\n\t\tif (field.typeNamespaceId !== void 0 || field.typeConstructor !== void 0) return;\n\t\tconst replacement = EARLIER_MONGO_SCALAR_NAMES[written];\n\t\tif (replacement === void 0 || !scalars.has(replacement)) return `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;\n\t\treturn `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a Mongo scalar type; use \"${replacement}\".`;\n\t};\n}\n//#endregion\nexport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;AAGA,MAAM,6BAA6B;CAClC,QAAQ;CACR,OAAO;CACP,SAAS;AACV;AACA,SAAS,oBAAoB,OAAO;CACnC,MAAM,UAAU,CAAC,GAAG,8BAA8B,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAS;EACjF,MAAM,aAAa,MAAM;EACzB,OAAO,EAAE,eAAe,KAAK,KAAK,qCAAqC,UAAU,KAAK,WAAW,eAAe,KAAK;CACtH,CAAC;CACD,OAAO,QAAQ,WAAW,IAAI,0CAA0C,8BAA8B,QAAQ,WAAW,IAAI,QAAQ,KAAK,EAAE,IAAI,GAAG,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,QAAQ,GAAG,EAAE,IAAI;AAC5M;AACA,SAAS,4BAA4B,eAAe;CACnD,MAAM,QAAQ,cAAc;CAC5B,MAAM,UAAU,8BAA8B,KAAK;CACnD,QAAQ,EAAE,OAAO,OAAO,cAAc;EACrC,IAAI,MAAM,oBAAoB,KAAK,KAAK,MAAM,oBAAoB,KAAK,GAAG;EAC1E,MAAM,cAAc,2BAA2B;EAC/C,IAAI,gBAAgB,KAAK,KAAK,CAAC,QAAQ,IAAI,WAAW,GAAG,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,uEAAuE,oBAAoB,KAAK;EACzN,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,4CAA4C,YAAY;CACzH;AACD"}
@@ -6,7 +6,7 @@ declare const mongoEmission: {
6
6
  id: string;
7
7
  generateStorageType(contract: Contract, storageHashTypeName: string): string;
8
8
  generateModelStorageType(_modelName: string, model: ContractModelBase): string;
9
- resolveFieldValueSet(_modelName: string, fieldName: string, model: ContractModelBase, contract: Contract): {
9
+ resolveStorageValueSet(_modelName: string, fieldName: string, model: ContractModelBase, contract: Contract): {
10
10
  readonly encodedValues: readonly JsonValue[];
11
11
  readonly codecId: string;
12
12
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"emitter.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.d.mts"],"mappings":";;;;cAGc;EACZ;EACA,oBAAoB,UAAU,UAAU;EACxC,yBAAyB,oBAAoB,OAAO;EACpD,qBAAqB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU;aACrF,wBAAwB;aACxB;;EAEX,iBAAiB,wBAAwB;EACzC;EACA;EACA,mBAAmB,0BAA0B"}
1
+ {"version":3,"file":"emitter.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.d.mts"],"mappings":";;;;cAGc;EACZ;EACA,oBAAoB,UAAU,UAAU;EACxC,yBAAyB,oBAAoB,OAAO;EACpD,uBAAuB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU;aACvF,wBAAwB;aACxB;;EAEX,iBAAiB,wBAAwB;EACzC;EACA;EACA,mBAAmB,0BAA0B"}
package/dist/emitter.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as mongoEmission } from "./exports-C32AbWNp.mjs";
1
+ import { t as mongoEmission } from "./exports-W3IiuyIf.mjs";
2
2
  export { mongoEmission };
@@ -45,11 +45,11 @@ const mongoEmission = {
45
45
  }
46
46
  return parts.length > 0 ? `{ ${parts.join("; ")} }` : "Record<string, never>";
47
47
  },
48
- resolveFieldValueSet(_modelName, fieldName, model, contract) {
48
+ resolveStorageValueSet(_modelName, fieldName, model, contract) {
49
49
  const field = model.fields[fieldName];
50
50
  if (field === void 0 || field.type.kind !== "scalar") return void 0;
51
51
  const ref = field.valueSet;
52
- if (ref === void 0) return void 0;
52
+ if (ref?.plane !== "storage") return void 0;
53
53
  const valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];
54
54
  if (valueSet === void 0) return void 0;
55
55
  return {
@@ -80,4 +80,4 @@ const mongoEmission = {
80
80
  //#endregion
81
81
  export { mongoEmission as t };
82
82
 
83
- //# sourceMappingURL=exports-C32AbWNp.mjs.map
83
+ //# sourceMappingURL=exports-W3IiuyIf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-W3IiuyIf.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs"],"sourcesContent":["import { serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/index.ts\nconst MONGO_NAMESPACE_KIND_FALLBACK = \"mongo-namespace\";\nfunction mongoNamespaceSerializedKind(ns) {\n\tconst kind = ns.kind;\n\tif (typeof kind === \"string\") return `readonly kind: ${serializeValue(kind)}`;\n\treturn `readonly kind: \"${MONGO_NAMESPACE_KIND_FALLBACK}\"`;\n}\nfunction generateMongoCollectionEntryType(coll) {\n\tif (Object.entries(coll).filter(([key, v]) => v !== void 0 && key !== \"kind\").length === 0) return \"MongoCollection\";\n\treturn serializeValue(coll);\n}\nfunction generateMongoNamespaceCollectionsType(collections) {\n\tconst entries = [];\n\tfor (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => a.localeCompare(b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);\n\tif (entries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${entries.join(\"; \")} }`;\n}\nfunction generateMongoNamespacesType(namespaces) {\n\tconst sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\tif (sorted.length === 0) return \"Record<string, never>\";\n\tconst parts = [];\n\tfor (const [name, ns] of sorted) {\n\t\tconst collectionsType = generateMongoNamespaceCollectionsType(ns.entries.collection ?? {});\n\t\tparts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}; ${mongoNamespaceSerializedKind(ns)}; readonly entries: { readonly collection: ${collectionsType} } }`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nconst mongoEmission = {\n\tid: \"mongo\",\n\tgenerateStorageType(contract, storageHashTypeName) {\n\t\tconst storage = contract.storage;\n\t\treturn `{ readonly namespaces: ${generateMongoNamespacesType(storage.namespaces)}; readonly storageHash: ${storageHashTypeName} }`;\n\t},\n\tgenerateModelStorageType(_modelName, model) {\n\t\tconst parts = [];\n\t\tconst collection = model.storage[\"collection\"];\n\t\tif (collection) parts.push(`readonly collection: ${serializeValue(collection)}`);\n\t\tconst storageRelations = model.storage[\"relations\"];\n\t\tif (storageRelations && Object.keys(storageRelations).length > 0) {\n\t\t\tconst relEntries = [];\n\t\t\tfor (const [relName, relVal] of Object.entries(storageRelations)) relEntries.push(`readonly ${serializeObjectKey(relName)}: ${serializeValue(relVal)}`);\n\t\t\tparts.push(`readonly relations: { ${relEntries.join(\"; \")} }`);\n\t\t}\n\t\treturn parts.length > 0 ? `{ ${parts.join(\"; \")} }` : \"Record<string, never>\";\n\t},\n\tresolveStorageValueSet(_modelName, fieldName, model, contract) {\n\t\tconst field = model.fields[fieldName];\n\t\tif (field === void 0 || field.type.kind !== \"scalar\") return void 0;\n\t\tconst ref = field.valueSet;\n\t\tif (ref?.plane !== \"storage\") return void 0;\n\t\tconst valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];\n\t\tif (valueSet === void 0) return void 0;\n\t\treturn {\n\t\t\tencodedValues: valueSet.values,\n\t\t\tcodecId: field.type.codecId\n\t\t};\n\t},\n\tgetFamilyImports(resolveImportSpecifier) {\n\t\treturn [\n\t\t\t\"import type {\",\n\t\t\t\" MongoCollection,\",\n\t\t\t\" MongoContractWithTypeMaps,\",\n\t\t\t\" MongoTypeMaps,\",\n\t\t\t\" RelationKeys,\",\n\t\t\t`} from '${resolveImportSpecifier(\"@internal/mongo-contract\")}';`\n\t\t];\n\t},\n\tgetFamilyTypeAliases() {\n\t\treturn \"\";\n\t},\n\tgetTypeMapsExpression() {\n\t\treturn \"MongoTypeMaps<CodecTypes, FieldOutputTypes, FieldInputTypes>\";\n\t},\n\tgetContractWrapper(contractBaseName, typeMapsName) {\n\t\treturn `export type Contract = MongoContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`;\n\t}\n};\n//#endregion\nexport { mongoEmission };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAGA,MAAM,gCAAgC;AACtC,SAAS,6BAA6B,IAAI;CACzC,MAAM,OAAO,GAAG;CAChB,IAAI,OAAO,SAAS,UAAU,OAAO,kBAAkB,eAAe,IAAI;CAC1E,OAAO,mBAAmB,8BAA8B;AACzD;AACA,SAAS,iCAAiC,MAAM;CAC/C,IAAI,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,OAAO,MAAM,KAAK,KAAK,QAAQ,MAAM,CAAC,CAAC,WAAW,GAAG,OAAO;CACnG,OAAO,eAAe,IAAI;AAC3B;AACA,SAAS,sCAAsC,aAAa;CAC3D,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,UAAU,SAAS,OAAO,QAAQ,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,GAAG,QAAQ,KAAK,YAAY,mBAAmB,QAAQ,EAAE,IAAI,iCAAiC,IAAI,GAAG;CACrM,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,OAAO,KAAK,QAAQ,KAAK,IAAI,EAAE;AAChC;AACA,SAAS,4BAA4B,YAAY;CAChD,MAAM,SAAS,OAAO,QAAQ,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;CACrF,IAAI,OAA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AAU,SAAS,OAAO,CAAC,CAAC,WAAW,IAAI,YAAY,EAAE,QAAQ,WAAW,IAAI;EACjG,IAAI,aAAa,KAAK,GAAG,OAAO,KAAK;EACrC,OAAO;GACN,eAAe,SAAS;GACxB,SAAS,MAAM,KAAK;EACrB;CACD;CACA,iBAAiB,wBAAwB;EACxC,OAAO;GACN;GACA;GACA;GACA;GACA;GACA,WAAW,uBAAuB,0BAA0B,EAAE;EAC/D;CACD;CACA,uBAAuB;EACtB,OAAO;CACR;CACA,wBAAwB;EACvB,OAAO;CACR;CACA,mBAAmB,kBAAkB,cAAc;EAClD,OAAO,oDAAoD,iBAAiB,IAAI,aAAa;CAC9F;AACD"}
package/dist/family.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import { D as defaultMongoDomainNamespaceId, O as defaultMongoStorageNamespaceId } from "./index-p1mHGKB5.mjs";
2
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-Doy155tY.mjs";
3
- import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-CFKfF3Kt.mjs";
4
- import "./control-adapter-D7n7HrIP.mjs";
5
- import { t as MongoContractView$1 } from "./mongo-contract-view-AnejqfrQ-CXymmojn.mjs";
6
- import { n as MongoContractSerializerBase, r as MongoSchemaVerifierBase, t as MongoContractSerializer } from "./ir-Cs8SNS0n.mjs";
7
- import { t as MongoMigration } from "./migration-DMXCxDu-.mjs";
1
+ import { D as defaultMongoDomainNamespaceId, O as defaultMongoStorageNamespaceId } from "./index-C7IAOTMB.mjs";
2
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-w_4Q7QRT.mjs";
3
+ import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-1XSvTjNp.mjs";
4
+ import "./control-adapter-B3N_6XRh.mjs";
5
+ import { t as MongoContractView$1 } from "./mongo-contract-view-AnejqfrQ-CLI7YSeQ.mjs";
6
+ import { n as MongoContractSerializerBase, r as MongoSchemaVerifierBase, t as MongoContractSerializer } from "./ir-BvEleTIc.mjs";
7
+ import { t as MongoMigration } from "./migration-Ug5cYZqn.mjs";
8
8
  import { r as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./pack-CgZhQ0_G.mjs";
9
- import { t as timestampNowRuntimeGenerator } from "./runtime-CQUQkK0P.mjs";
10
- import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-CCSz3rlO.mjs";
9
+ import { t as timestampNowRuntimeGenerator } from "./runtime-BdFjb2Zm.mjs";
10
+ import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-DmFfmivC.mjs";
11
11
  export { type FieldRewrite, type MarkerOperations, MongoMigration as Migration, MongoContractSerializer, MongoContractSerializerBase, MongoContractView$1 as MongoContractView, type MongoControlAdapter, type MongoControlAdapterDescriptor, type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, type MongoRunnerDependencies, MongoSchemaVerifierBase, type VerifyMongoSchemaOptions, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, defaultMongoDomainNamespaceId, defaultMongoStorageNamespaceId, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoFamilyEntityTypes, mongoFamilyPslBlockDescriptors, mongoOperationsToPreview, timestampNowRuntimeGenerator, verifyMongoSchema };