@prisma/orm-family-mongo 8.0.0-rc.23-dev.13 → 8.0.0-rc.24-dev.1

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/{contract-builder-BsGubaBl.d.mts → contract-builder-CnON_Yzr.d.mts} +2 -2
  2. package/dist/{contract-builder-BsGubaBl.d.mts.map → contract-builder-CnON_Yzr.d.mts.map} +1 -1
  3. package/dist/{contract-builder-ClNv0uzB.mjs → contract-builder-DMWgsRpK.mjs} +3 -3
  4. package/dist/{contract-builder-ClNv0uzB.mjs.map → contract-builder-DMWgsRpK.mjs.map} +1 -1
  5. package/dist/contract-prisma6__provider.mjs +3 -3
  6. package/dist/contract-psl.mjs +1 -1
  7. package/dist/contract-psl__provider.mjs +1 -1
  8. package/dist/contract-ts.d.mts +1 -1
  9. package/dist/contract-ts.mjs +1 -1
  10. package/dist/contract-ts__contract-builder.d.mts +1 -1
  11. package/dist/contract-ts__contract-builder.mjs +1 -1
  12. package/dist/contract.d.mts +2 -2
  13. package/dist/contract.mjs +2 -2
  14. package/dist/contract__data-type.d.mts +14 -1
  15. package/dist/contract__data-type.d.mts.map +1 -1
  16. package/dist/contract__data-type.mjs +2 -2
  17. package/dist/{control-BsOZ6I-N.d.mts → control-BNH5e5av.d.mts} +31 -4
  18. package/dist/{control-BsOZ6I-N.d.mts.map → control-BNH5e5av.d.mts.map} +1 -1
  19. package/dist/{control-CKsiMx4D.d.mts → control-Cxe4huYd.d.mts} +10 -9
  20. package/dist/{control-CKsiMx4D.d.mts.map → control-Cxe4huYd.d.mts.map} +1 -1
  21. package/dist/{control-ywVRqK1i.mjs → control-DJf8Ct2M.mjs} +6 -2
  22. package/dist/{control-ywVRqK1i.mjs.map → control-DJf8Ct2M.mjs.map} +1 -1
  23. package/dist/{control-c3gViWlG.mjs → control-DaEtLx5a.mjs} +20 -11
  24. package/dist/control-DaEtLx5a.mjs.map +1 -0
  25. package/dist/{control-adapter-BheElqfe-38zaUL-r.d.mts → control-adapter-BheElqfe-Z1rEl51r.d.mts} +4 -4
  26. package/dist/{control-adapter-BheElqfe-38zaUL-r.d.mts.map → control-adapter-BheElqfe-Z1rEl51r.d.mts.map} +1 -1
  27. package/dist/control-adapter-Cj8JmiQV.d.mts +1 -0
  28. package/dist/{dist-By5gbTEW.mjs → dist-DTFnQk-s.mjs} +171 -4
  29. package/dist/dist-DTFnQk-s.mjs.map +1 -0
  30. package/dist/{dist-DJzrbVGM.mjs → dist-Dyj5B2n7.mjs} +2 -2
  31. package/dist/{dist-DJzrbVGM.mjs.map → dist-Dyj5B2n7.mjs.map} +1 -1
  32. package/dist/{execution-CuluvtwX.d.mts → execution-CD6EeX3b.d.mts} +2 -2
  33. package/dist/{execution-CuluvtwX.d.mts.map → execution-CD6EeX3b.d.mts.map} +1 -1
  34. package/dist/family.d.mts +9 -9
  35. package/dist/family.mjs +7 -7
  36. package/dist/family__control-adapter.d.mts +2 -2
  37. package/dist/family__control.d.mts +1 -1
  38. package/dist/family__control.mjs +2 -2
  39. package/dist/family__ir.d.mts +2 -2
  40. package/dist/family__ir.mjs +3 -3
  41. package/dist/family__migration.d.mts +1 -1
  42. package/dist/family__migration.mjs +1 -1
  43. package/dist/family__pack.mjs +1 -1
  44. package/dist/family__runtime.d.mts +2 -2
  45. package/dist/family__runtime.mjs +1 -1
  46. package/dist/family__schema-verify.d.mts +1 -1
  47. package/dist/family__schema-verify.mjs +1 -1
  48. package/dist/{field-accessor-DJzCZm0f-zDz2llV-.d.mts → field-accessor-DJzCZm0f-ZGjGQy0_.d.mts} +3 -3
  49. package/dist/{field-accessor-DJzCZm0f-zDz2llV-.d.mts.map → field-accessor-DJzCZm0f-ZGjGQy0_.d.mts.map} +1 -1
  50. package/dist/{index-fnk4bdbx.d.mts → index-B2yjvk4C.d.mts} +3 -3
  51. package/dist/{index-fnk4bdbx.d.mts.map → index-B2yjvk4C.d.mts.map} +1 -1
  52. package/dist/{index-hugPlQ5w.d.mts → index-BHEoA-q8.d.mts} +77 -2
  53. package/dist/{index-hugPlQ5w.d.mts.map → index-BHEoA-q8.d.mts.map} +1 -1
  54. package/dist/{index-CZ-tX2cL.d.mts → index-Bw1gxp0Q.d.mts} +2 -2
  55. package/dist/{index-CZ-tX2cL.d.mts.map → index-Bw1gxp0Q.d.mts.map} +1 -1
  56. package/dist/{index-CgKJfbIP.d.mts → index-By9G6gWh.d.mts} +4 -4
  57. package/dist/{index-CgKJfbIP.d.mts.map → index-By9G6gWh.d.mts.map} +1 -1
  58. package/dist/{interpreter-v8GWMscU-DmijqboH.mjs → interpreter-v8GWMscU-BFP58so-.mjs} +3 -3
  59. package/dist/{interpreter-v8GWMscU-DmijqboH.mjs.map → interpreter-v8GWMscU-BFP58so-.mjs.map} +1 -1
  60. package/dist/{ir-B_tAgqIO.d.mts → ir-CeQg097e.d.mts} +3 -3
  61. package/dist/{ir-B_tAgqIO.d.mts.map → ir-CeQg097e.d.mts.map} +1 -1
  62. package/dist/{ir-Bm8xm1eu.mjs → ir-DvWO1xE7.mjs} +2 -2
  63. package/dist/{ir-Bm8xm1eu.mjs.map → ir-DvWO1xE7.mjs.map} +1 -1
  64. package/dist/lowering.d.mts +1 -1
  65. package/dist/{migration-LHRzvIrb.mjs → migration-8enuY81P.mjs} +2 -2
  66. package/dist/{migration-LHRzvIrb.mjs.map → migration-8enuY81P.mjs.map} +1 -1
  67. package/dist/{migration-C8VlQx5N.d.mts → migration-B7PcbeNg.d.mts} +4 -4
  68. package/dist/{migration-C8VlQx5N.d.mts.map → migration-B7PcbeNg.d.mts.map} +1 -1
  69. package/dist/{mongo-contract-serializer-BBknnHWy-DAzm09wB.mjs → mongo-contract-serializer-BBknnHWy-UNgq5T2h.mjs} +2 -2
  70. package/dist/{mongo-contract-serializer-BBknnHWy-DAzm09wB.mjs.map → mongo-contract-serializer-BBknnHWy-UNgq5T2h.mjs.map} +1 -1
  71. package/dist/{mongo-contract-view-AnejqfrQ-DmXEDnxi.d.mts → mongo-contract-view-AnejqfrQ-DLviCLRM.d.mts} +2 -2
  72. package/dist/{mongo-contract-view-AnejqfrQ-DmXEDnxi.d.mts.map → mongo-contract-view-AnejqfrQ-DLviCLRM.d.mts.map} +1 -1
  73. package/dist/{mongo-contract-view-CF5trX6R-BIF8ciuY.mjs → mongo-contract-view-CF5trX6R-_k8QTG5C.mjs} +3 -3
  74. package/dist/{mongo-contract-view-CF5trX6R-BIF8ciuY.mjs.map → mongo-contract-view-CF5trX6R-_k8QTG5C.mjs.map} +1 -1
  75. package/dist/{mongo-data-type-Bv8Bd0zu-cnTiyyP0.mjs → mongo-data-type-DPJy_m2a-CROT8T5j.mjs} +14 -5
  76. package/dist/mongo-data-type-DPJy_m2a-CROT8T5j.mjs.map +1 -0
  77. package/dist/orm.d.mts +2 -2
  78. package/dist/orm.mjs +2 -2
  79. package/dist/query-ast.d.mts +3 -3
  80. package/dist/query-ast.mjs +2 -2
  81. package/dist/query-ast__control.d.mts +2 -2
  82. package/dist/query-ast__control.mjs +2 -2
  83. package/dist/query-ast__execution.d.mts +1 -1
  84. package/dist/query-builder.d.mts +3 -3
  85. package/dist/query-builder.mjs +1 -1
  86. package/dist/query-builder__contract-free.d.mts +3 -3
  87. package/dist/query-builder__contract-free.mjs +1 -1
  88. package/dist/{runtime-Cx_Sw9eY.d.mts → runtime-C2G5v1Bk.d.mts} +2 -2
  89. package/dist/runtime-C2G5v1Bk.d.mts.map +1 -0
  90. package/dist/runtime.d.mts +4 -4
  91. package/dist/schema-ir.d.mts +1 -1
  92. package/dist/{schema-verify-BMTEmTLS.d.mts → schema-verify-DJyHpYGy.d.mts} +3 -3
  93. package/dist/{schema-verify-BMTEmTLS.d.mts.map → schema-verify-DJyHpYGy.d.mts.map} +1 -1
  94. package/dist/{verify-mongo-schema-D8rznxzZ-CjYf39zu.mjs → verify-mongo-schema-D8rznxzZ-Dg51Lhnp.mjs} +2 -2
  95. package/dist/{verify-mongo-schema-D8rznxzZ-CjYf39zu.mjs.map → verify-mongo-schema-D8rznxzZ-Dg51Lhnp.mjs.map} +1 -1
  96. package/dist/wire.d.mts +2 -2
  97. package/package.json +20 -20
  98. package/dist/control-adapter-CPwhJ0SM.d.mts +0 -1
  99. package/dist/control-c3gViWlG.mjs.map +0 -1
  100. package/dist/dist-By5gbTEW.mjs.map +0 -1
  101. package/dist/mongo-data-type-Bv8Bd0zu-cnTiyyP0.mjs.map +0 -1
  102. package/dist/runtime-Cx_Sw9eY.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"verify-mongo-schema-D8rznxzZ-CjYf39zu.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-D8rznxzZ.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { canonicalize, collectionControlPoliciesOf, collectionControlPolicyOf, indexLookupKey } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tname: index.name,\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([], { fromDatabase: false });\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections, { fromDatabase: false });\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(indexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(indexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) {\n\t\tconst liveIdx = liveLookup.get(key);\n\t\tif (liveIdx === void 0 || liveIdx.name !== idx.name) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, `index:${idx.name}`],\n\t\t\texpected: idx,\n\t\t\t...ifDefined(\"actual\", liveIdx)\n\t\t}, \"fail\", failures, warnings);\n\t}\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${idx.name}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\n/**\n* Canonicalizes a live (introspected) `MongoSchemaIR` against the expected\n* (contract-built) IR before diffing. MongoDB applies server-side defaults\n* to several option/index families that are absent from authored contracts,\n* which would otherwise cause `verifyMongoSchema` to report false-positive\n* drift on a fresh `migrate` run.\n*\n* The normalization is contract-aware where it has to be: server defaults\n* are stripped from the live IR for fields the contract did not specify, so\n* a contract that *does* specify a value still gets compared faithfully.\n*\n* Symmetric defaults — like `changeStreamPreAndPostImages: { enabled: false }`,\n* which is equivalent to \"absent\" on both sides — are stripped from both IRs\n* so either authoring style verifies.\n*/\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive, { fromDatabase: live.fromDatabase }),\n\t\texpected: new MongoSchemaIR(canonicalExpected, { fromDatabase: expected.fromDatabase })\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\n/** A text index's weights as MongoDB lists them once some are written: every text field, 1 when not written. */\nfunction completeTextWeights(keys, weights) {\n\tif (weights === void 0) return void 0;\n\tconst textFields = keys.filter((k) => k.direction === \"text\").map((k) => k.field);\n\treturn Object.fromEntries(textFields.sort().map((field) => [field, weights[field] ?? 1]));\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tname: index.name,\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", completeTextWeights(index.keys, index.weights)),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t});\n}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tname: liveIndex.name,\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We match by the *projected*\n* (contract-shaped) key list — so a live `_fts/_ftsx` index resolves to a\n* contract `{title: 'text', body: 'text'}` index. Of several contract indexes\n* on those keys, the one with the live index's name wins; without one, the\n* first. With no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeys = keyPatternOf(projectTextIndexKeys(liveIndex));\n\tconst sameKeys = expectedIndexes.filter((expected) => keyPatternOf(expected.keys) === liveKeys);\n\treturn sameKeys.find((expected) => expected.name === liveIndex.name) ?? sameKeys[0];\n}\nfunction keyPatternOf(keys) {\n\treturn canonicalize(sortTextKeys(keys).map((k) => [k.field, k.direction]));\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst policies = collectionControlPoliciesOf(contract);\n\treturn (collectionName) => collectionControlPolicyOf(collectionName, policies);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-D8rznxzZ.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,aAAa,OAAO;CAC5B,OAAO,IAAI,iBAAiB;EAC3B,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,oBAAoB,MAAM;EAC1B,yBAAyB,MAAM;EAC/B,oBAAoB,MAAM;EAC1B,WAAW,MAAM;EACjB,SAAS,MAAM;EACf,kBAAkB,MAAM;EACxB,mBAAmB,MAAM;CAC1B,CAAC;AACF;AACA,SAAS,iBAAiB,GAAG;CAC5B,OAAO,IAAI,qBAAqB;EAC/B,YAAY,EAAE;EACd,iBAAiB,EAAE;EACnB,kBAAkB,EAAE;CACrB,CAAC;AACF;AACA,SAAS,eAAe,GAAG;CAC1B,OAAO,IAAI,6BAA6B;EACvC,GAAG,UAAU,UAAU,EAAE,WAAW,KAAK,IAAI;GAC5C,MAAM,EAAE,OAAO;GACf,GAAG,UAAU,OAAO,EAAE,OAAO,GAAG;EACjC,IAAI,KAAK,CAAC;EACV,GAAG,EAAE,eAAe,KAAK,IAAI,EAAE,YAAY;GAC1C,WAAW,EAAE,WAAW;GACxB,GAAG,UAAU,aAAa,EAAE,WAAW,SAAS;GAChD,GAAG,UAAU,eAAe,EAAE,WAAW,WAAW;EACrD,EAAE,IAAI,CAAC;EACP,GAAG,EAAE,cAAc,KAAK,IAAI,EAAE,WAAW;GACxC,QAAQ,EAAE,UAAU;GACpB,GAAG,UAAU,aAAa,EAAE,UAAU,SAAS;GAC/C,GAAG,UAAU,aAAa,EAAE,UAAU,SAAS;GAC/C,GAAG,UAAU,YAAY,EAAE,UAAU,QAAQ;GAC7C,GAAG,UAAU,mBAAmB,EAAE,UAAU,eAAe;GAC3D,GAAG,UAAU,aAAa,EAAE,UAAU,SAAS;GAC/C,GAAG,UAAU,eAAe,EAAE,U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AC9E"}
1
+ {"version":3,"file":"verify-mongo-schema-D8rznxzZ-Dg51Lhnp.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-D8rznxzZ.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { canonicalize, collectionControlPoliciesOf, collectionControlPolicyOf, indexLookupKey } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tname: index.name,\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([], { fromDatabase: false });\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections, { fromDatabase: false });\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(indexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(indexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) {\n\t\tconst liveIdx = liveLookup.get(key);\n\t\tif (liveIdx === void 0 || liveIdx.name !== idx.name) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, `index:${idx.name}`],\n\t\t\texpected: idx,\n\t\t\t...ifDefined(\"actual\", liveIdx)\n\t\t}, \"fail\", failures, warnings);\n\t}\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${idx.name}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\n/**\n* Canonicalizes a live (introspected) `MongoSchemaIR` against the expected\n* (contract-built) IR before diffing. MongoDB applies server-side defaults\n* to several option/index families that are absent from authored contracts,\n* which would otherwise cause `verifyMongoSchema` to report false-positive\n* drift on a fresh `migrate` run.\n*\n* The normalization is contract-aware where it has to be: server defaults\n* are stripped from the live IR for fields the contract did not specify, so\n* a contract that *does* specify a value still gets compared faithfully.\n*\n* Symmetric defaults — like `changeStreamPreAndPostImages: { enabled: false }`,\n* which is equivalent to \"absent\" on both sides — are stripped from both IRs\n* so either authoring style verifies.\n*/\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive, { fromDatabase: live.fromDatabase }),\n\t\texpected: new MongoSchemaIR(canonicalExpected, { fromDatabase: expected.fromDatabase })\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\n/** A text index's weights as MongoDB lists them once some are written: every text field, 1 when not written. */\nfunction completeTextWeights(keys, weights) {\n\tif (weights === void 0) return void 0;\n\tconst textFields = keys.filter((k) => k.direction === \"text\").map((k) => k.field);\n\treturn Object.fromEntries(textFields.sort().map((field) => [field, weights[field] ?? 1]));\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tname: index.name,\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", completeTextWeights(index.keys, index.weights)),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t});\n}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tname: liveIndex.name,\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We match by the *projected*\n* (contract-shaped) key list — so a live `_fts/_ftsx` index resolves to a\n* contract `{title: 'text', body: 'text'}` index. Of several contract indexes\n* on those keys, the one with the live index's name wins; without one, the\n* first. With no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeys = keyPatternOf(projectTextIndexKeys(liveIndex));\n\tconst sameKeys = expectedIndexes.filter((expected) => keyPatternOf(expected.keys) === liveKeys);\n\treturn sameKeys.find((expected) => expected.name === liveIndex.name) ?? sameKeys[0];\n}\nfunction keyPatternOf(keys) {\n\treturn canonicalize(sortTextKeys(keys).map((k) => [k.field, k.direction]));\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst policies = collectionControlPoliciesOf(contract);\n\treturn (collectionName) => collectionControlPolicyOf(collectionName, policies);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-D8rznxzZ.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,aAAa,OAAO;CAC5B,OAAO,IAAI,iBAAiB;EAC3B,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,oBAAoB,MAAM;EAC1B,yBAAyB,MAAM;EAC/B,oBAAoB,M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;AACR;AAGA,SAAS,kBAAkB,SAAS;CACnC,MAAM,EAAE,UAAU,QAAQ,QAAQ,YAAY;CAC9C,MAAM,YAAY,KAAK,IAAI;CAC3B,MAAM,EAAE,MAAM,eAAe,UAAU,sBAAsB,mCAAmC,QAAQ,wBAAwB,QAAQ,CAAC;CACzI,MAAM,EAAE,UAAU,aAAa,iBAAiB,eAAe,mBAAmB,QAAQ,oCAAoC,QAAQ,CAAC;CACvI,MAAM,KAAK,SAAS,WAAW;CAC/B,MAAM,cAAc,OAAO,SAAS,gBAAgB,WAAW,SAAS,cAAc;CACtF,OAAO;EACN;EACA,GAAG,UAAU,QAAQ,KAAK,KAAK,IAAI,0BAA0B;EAC7D,SAAS,KAAK,4BAA4B,6BAA6B,SAAS,OAAO;EACvF,UAAU;GACT,aAAa,SAAS,QAAQ;GAC9B,GAAG,cAAc,EAAE,YAAY,IAAI,CAAC;EACrC;EACA,QAAQ,EAAE,UAAU,SAAS,OAAO;EACpC,QAAQ;GACP,QAAQ;GACR,UAAU,EAAE,QAAQ,SAAS;EAC9B;EACA,MAAM;GACL;GACA,GAAG,UAAU,gBAAgB,SAAS,YAAY;GAClD,GAAG,UAAU,cAAc,SAAS,UAAU;EAC/C;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD;AACA,SAAS,oCAAoC,UAAU;CACtD,MAAM,WAAW,4BAA4B,QAAQ;CACrD,QAAQ,mBAAmB,0BAA0B,gBAAgB,QAAQ;AAC9E"}
package/dist/wire.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as InsertOneResult, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, t as DeleteManyResult, u as UpdateOneResult } from "./execution-CuluvtwX.mjs";
2
- import { _ as UpdateManyWireCommand, a as CollModWireCommand, c as DeleteManyWireCommand, d as DropIndexWireCommand, f as FindOneAndDeleteWireCommand, g as RenameCollectionWireCommand, h as InsertOneWireCommand, i as AnyMongoWireCommand, l as DeleteOneWireCommand, m as InsertManyWireCommand, n as AnyMongoDdlWireCommand, o as CreateCollectionWireCommand, p as FindOneAndUpdateWireCommand, r as AnyMongoDmlWireCommand, s as CreateIndexWireCommand, t as AggregateWireCommand, u as DropCollectionWireCommand, v as UpdateOneWireCommand, y as isDdlWireCommand } from "./index-fnk4bdbx.mjs";
1
+ import { a as InsertOneResult, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, t as DeleteManyResult, u as UpdateOneResult } from "./execution-CD6EeX3b.mjs";
2
+ import { _ as UpdateManyWireCommand, a as CollModWireCommand, c as DeleteManyWireCommand, d as DropIndexWireCommand, f as FindOneAndDeleteWireCommand, g as RenameCollectionWireCommand, h as InsertOneWireCommand, i as AnyMongoWireCommand, l as DeleteOneWireCommand, m as InsertManyWireCommand, n as AnyMongoDdlWireCommand, o as CreateCollectionWireCommand, p as FindOneAndUpdateWireCommand, r as AnyMongoDmlWireCommand, s as CreateIndexWireCommand, t as AggregateWireCommand, u as DropCollectionWireCommand, v as UpdateOneWireCommand, y as isDdlWireCommand } from "./index-B2yjvk4C.mjs";
3
3
  export { AggregateWireCommand, type AnyMongoDdlWireCommand, type AnyMongoDmlWireCommand, type AnyMongoWireCommand, CollModWireCommand, CreateCollectionWireCommand, CreateIndexWireCommand, type DeleteManyResult, DeleteManyWireCommand, type DeleteOneResult, DeleteOneWireCommand, DropCollectionWireCommand, DropIndexWireCommand, FindOneAndDeleteWireCommand, FindOneAndUpdateWireCommand, type InsertManyResult, InsertManyWireCommand, type InsertOneResult, InsertOneWireCommand, RenameCollectionWireCommand, type UpdateManyResult, UpdateManyWireCommand, type UpdateOneResult, UpdateOneWireCommand, isDdlWireCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.23-dev.13",
3
+ "version": "8.0.0-rc.24-dev.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,31 +9,31 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.23-dev.13",
13
- "@prisma/orm-toolchain": "8.0.0-rc.23-dev.13",
12
+ "@prisma/orm-framework": "8.0.0-rc.24-dev.1",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.24-dev.1",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3",
17
17
  "temporal-spec": "1.0.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@internal/family-mongo": "8.0.0-rc.23-dev.13",
21
- "@internal/mongo-codec": "8.0.0-rc.23-dev.13",
22
- "@internal/mongo-contract": "8.0.0-rc.23-dev.13",
23
- "@internal/mongo-contract-prisma6": "8.0.0-rc.23-dev.13",
24
- "@internal/mongo-contract-psl": "8.0.0-rc.23-dev.13",
25
- "@internal/mongo-contract-ts": "8.0.0-rc.23-dev.13",
26
- "@internal/mongo-emitter": "8.0.0-rc.23-dev.13",
27
- "@internal/mongo-lowering": "8.0.0-rc.23-dev.13",
28
- "@internal/mongo-orm": "8.0.0-rc.23-dev.13",
29
- "@internal/mongo-query-ast": "8.0.0-rc.23-dev.13",
30
- "@internal/mongo-query-builder": "8.0.0-rc.23-dev.13",
31
- "@internal/mongo-runtime": "8.0.0-rc.23-dev.13",
32
- "@internal/mongo-schema-ir": "8.0.0-rc.23-dev.13",
33
- "@internal/mongo-value": "8.0.0-rc.23-dev.13",
34
- "@internal/mongo-wire": "8.0.0-rc.23-dev.13",
35
- "@repo/tsconfig": "8.0.0-rc.23-dev.13",
36
- "@repo/tsdown": "8.0.0-rc.23-dev.13",
20
+ "@internal/family-mongo": "8.0.0-rc.24-dev.1",
21
+ "@internal/mongo-codec": "8.0.0-rc.24-dev.1",
22
+ "@internal/mongo-contract": "8.0.0-rc.24-dev.1",
23
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.24-dev.1",
24
+ "@internal/mongo-contract-psl": "8.0.0-rc.24-dev.1",
25
+ "@internal/mongo-contract-ts": "8.0.0-rc.24-dev.1",
26
+ "@internal/mongo-emitter": "8.0.0-rc.24-dev.1",
27
+ "@internal/mongo-lowering": "8.0.0-rc.24-dev.1",
28
+ "@internal/mongo-orm": "8.0.0-rc.24-dev.1",
29
+ "@internal/mongo-query-ast": "8.0.0-rc.24-dev.1",
30
+ "@internal/mongo-query-builder": "8.0.0-rc.24-dev.1",
31
+ "@internal/mongo-runtime": "8.0.0-rc.24-dev.1",
32
+ "@internal/mongo-schema-ir": "8.0.0-rc.24-dev.1",
33
+ "@internal/mongo-value": "8.0.0-rc.24-dev.1",
34
+ "@internal/mongo-wire": "8.0.0-rc.24-dev.1",
35
+ "@repo/tsconfig": "8.0.0-rc.24-dev.1",
36
+ "@repo/tsdown": "8.0.0-rc.24-dev.1",
37
37
  "tsdown": "0.22.14",
38
38
  "typescript": "5.9.3"
39
39
  },
@@ -1 +0,0 @@
1
- import "./control-adapter-BheElqfe-38zaUL-r.mjs";
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-c3gViWlG.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-D8rznxzZ.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-qeRu8r5L.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-BBknnHWy.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 { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-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 { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\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\tlabelParts: [{\n\t\t\ttext: \"database\",\n\t\t\trole: \"title\"\n\t\t}],\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\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: prefix,\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" (\" },\n\t\t\t\t{\n\t\t\t\t\ttext: keysSummary,\n\t\t\t\t\trole: \"name\"\n\t\t\t\t},\n\t\t\t\t{ text: \")\" },\n\t\t\t\t...options.length > 0 ? [{ text: \" \" }, {\n\t\t\t\t\ttext: `(${options.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tname: index.name,\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 roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\",\");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\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\tlabelParts: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: propName,\n\t\t\t\t\t\trole: \"name\"\n\t\t\t\t\t},\n\t\t\t\t\t{ text: \": \" },\n\t\t\t\t\t{ text: bsonType },\n\t\t\t\t\t...required ? [{ text: \" \" }, {\n\t\t\t\t\t\ttext: \"(required)\",\n\t\t\t\t\t\trole: \"detail\"\n\t\t\t\t\t}] : []\n\t\t\t\t]\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\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"validator\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\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\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"options\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(${optLabels.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\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\tlabelParts: [\n\t\t\t{\n\t\t\t\ttext: \"collection\",\n\t\t\t\trole: \"keyword\"\n\t\t\t},\n\t\t\t{ text: \" \" },\n\t\t\t{\n\t\t\t\ttext: name,\n\t\t\t\trole: \"name\"\n\t\t\t}\n\t\t],\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\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\tget markerLocation() {\n\t\t\treturn getControlAdapter().markerLocation;\n\t\t},\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, createMongo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KAAK,MAAM,SAAS,QAAQ,QAAQ,WAAW,KAAK,MAAM,gBAAgB,aAAa,KAAK,CAAC;GAC7F,OAAO;EACR;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,eAAe,SAAS;GAC7B,OAAO,kBAAkB,CAAC,CAAC,eAAe,cAAc,QAAQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;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 +0,0 @@
1
- {"version":3,"file":"dist-By5gbTEW.mjs","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-contract/dist/index.mjs"],"sourcesContent":["import { t as mongoContractCanonicalizationHooks } from \"./canonicalization-hooks-4XyGmYqQ.mjs\";\nimport { _ as createMongoContractSchema, a as MongoValueSet, c as MongoValidator, d as MongoTimeSeriesCollectionOptions, f as MongoIndexOptionDefaults, g as StorageValueSetSchema, h as MongoContractSchema, l as MongoIndex, m as MongoChangeStreamPreAndPostImagesOptions, n as composeMongoEntityKinds, o as MongoValueObject, p as MongoCollationOptions, s as MongoCollection, u as MongoCollectionOptions, v as createMongoNamespaceEnvelopeSchema } from \"./entity-kinds-D5mTQzuZ.mjs\";\nimport { t as bsonTypesOfCodec } from \"./mongo-data-type-Bv8Bd0zu.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 { governingControlPolicy, valueObjectAt, valueObjectsWithCoordinates } from \"@internal/contract/types\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { UNBOUND_DOMAIN_NAMESPACE_ID } from \"@internal/contract/default-namespace\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { validateStorageValueObjects } from \"@internal/contract/validate-storage\";\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 namespace `namespaceId` holding the collections, value sets and value objects, 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 valueObjects = input.valueObjects ?? {};\n\tconst namespace = buildMongoNamespace({\n\t\tid: input.namespaceId,\n\t\tentries: {\n\t\t\tcollection: input.collections,\n\t\t\t...hasValueSets ? { valueSet: input.valueSets } : {},\n\t\t\t...Object.keys(valueObjects).length > 0 ? { valueObject: valueObjects } : {}\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: { [input.namespaceId]: {\n\t\t\t\tid: input.namespaceId,\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\t...namespace.entries.valueObject !== void 0 ? { valueObject: namespace.entries.valueObject } : {}\n\t\t\t\t}\n\t\t\t} } },\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [input.namespaceId]: namespace }\n\t});\n}\n//#endregion\n//#region src/canonicalize.ts\nfunction canonicalize(obj) {\n\tif (obj === null) return \"null\";\n\tif (obj === void 0) return \"undefined\";\n\tif (typeof obj !== \"object\") return JSON.stringify(obj);\n\tif (Array.isArray(obj)) return `[${obj.map(canonicalize).join(\",\")}]`;\n\tconst record = obj;\n\treturn `{${Object.keys(record).sort().map((k) => `${JSON.stringify(k)}:${canonicalize(record[k])}`).join(\",\")}}`;\n}\n//#endregion\n//#region src/collection-control-policies.ts\n/** The control policies a built contract declares for its collections. */\nfunction collectionControlPoliciesOf(contract) {\n\treturn {\n\t\tcollections: Object.fromEntries(Object.values(contract.storage.namespaces).flatMap((namespace) => Object.entries(namespace.entries.collection ?? {}).map(([name, collection]) => [name, collection.control]))),\n\t\tdefaultControlPolicy: contract.defaultControlPolicy\n\t};\n}\n/** The control policy that governs `collection`, with the `external` default as a floor, as the planner, the validator derivation and the verifier all read it. */\nfunction collectionControlPolicyOf(collection, policies) {\n\treturn governingControlPolicy({ explicitNodeControlPolicy: policies.collections[collection] }, policies.defaultControlPolicy);\n}\n/** Whether `collection` is managed, so it gets a validator. */\nfunction isManaged(collection, policies) {\n\treturn collectionControlPolicyOf(collection, policies) === \"managed\";\n}\n//#endregion\n//#region src/collection-root-models.ts\n/**\n* The root models of each collection, keyed by collection name: every model stored in the collection that is neither a variant nor embedded, sorted by name.\n*/\nfunction collectionRootModelsOf(models) {\n\tconst roots = {};\n\tfor (const [name, model] of Object.entries(models)) {\n\t\tconst collection = model.storage[\"collection\"];\n\t\tif (typeof collection !== \"string\" || model.base !== void 0 || model.owner !== void 0) continue;\n\t\troots[collection] = [...roots[collection] ?? [], name];\n\t}\n\tfor (const names of Object.values(roots)) names.sort();\n\treturn roots;\n}\n//#endregion\n//#region src/document-id-refusal.ts\n/** The BSON types an `_id` cannot have: MongoDB refuses an array, a regular expression and undefined, and every document has an `_id`. */\nconst FORBIDDEN_DOCUMENT_ID_BSON_TYPES = /* @__PURE__ */ new Set([\n\t\"array\",\n\t\"regex\",\n\t\"undefined\",\n\t\"null\"\n]);\n/**\n* Why an `_id` stored by `codecId` cannot hold `forbidden`, the BSON types it can hold that an `_id` cannot have; an empty list means it can hold any BSON type. The subject is left out, so each caller leads with its own.\n*/\nfunction documentIdRefusalReason(codecId, forbidden) {\n\treturn `can hold ${forbidden.length === 0 ? \"any BSON type\" : `BSON type ${forbidden.join(\" or \")}`} (codec \"${codecId}\"). An _id cannot be an array, a regular expression, undefined or null: MongoDB refuses the first three, and every document has an _id.`;\n}\n/**\n* The refusal of an `_id` that can hold `bsonTypes`, or undefined when an `_id` can. An empty list means any BSON type, which includes all of them.\n*/\nfunction documentIdRefusalOf(codecId, bsonTypes) {\n\tif (bsonTypes.length === 0) return {\n\t\tforbidden: [...FORBIDDEN_DOCUMENT_ID_BSON_TYPES],\n\t\treason: documentIdRefusalReason(codecId, [])\n\t};\n\tconst forbidden = bsonTypes.filter((bsonType) => FORBIDDEN_DOCUMENT_ID_BSON_TYPES.has(bsonType));\n\treturn forbidden.length === 0 ? void 0 : {\n\t\tforbidden,\n\t\treason: documentIdRefusalReason(codecId, forbidden)\n\t};\n}\n/**\n* The BSON types a field stored as `_id` can hold: its codec's, an array for a list, and null for a nullable field. Undefined for a value object, which is stored as an object, and for a codec whose BSON types are unknown, which the field rule refuses.\n*/\nfunction documentIdBsonTypesOf(field, lookups) {\n\tif (field.type.kind !== \"scalar\") return void 0;\n\tconst codecTypes = bsonTypesOfCodec(field.type.codecId, lookups);\n\tif (codecTypes === void 0) return void 0;\n\tconst stored = field.many ? [\"array\"] : codecTypes;\n\treturn field.nullable ? [...stored, \"null\"] : stored;\n}\n//#endregion\n//#region src/field-bson-type-refusal.ts\nconst CANNOT_GIVE = \"so its BSON type is unknown and the contract cannot describe the field.\";\n/**\n* Why a field of codec `codecId` cannot be described, or undefined when its BSON type is known. The reason leaves out its subject so each authoring surface can lead with its own, as in `Field \"Place.location\" uses codec ...`.\n*/\nfunction fieldBsonTypeRefusalOf(codecId, lookups) {\n\tif (bsonTypesOfCodec(codecId, lookups) !== void 0) return void 0;\n\tconst descriptor = lookups.codecLookup.descriptorFor(codecId);\n\tif (descriptor === void 0) return {\n\t\tkind: \"unknownCodec\",\n\t\treason: `uses codec \"${codecId}\", which no pack in the contract provides, ${CANNOT_GIVE}`\n\t};\n\treturn {\n\t\tkind: \"notMongoDataType\",\n\t\tdataType: descriptor.dataType,\n\t\treason: `uses codec \"${codecId}\", whose data type \"${descriptor.dataType}\" is not a MongoDB data type of any pack in the contract, ${CANNOT_GIVE}`\n\t};\n}\n//#endregion\n//#region src/mongo-models.ts\n/** The models of namespace `namespaceId` of a validated MongoDB contract, whose storage records the stored name of every field. */\nfunction mongoModelsOf(domain, namespaceId) {\n\treturn blindCast(domain.namespaces[namespaceId]?.models ?? {});\n}\n/** Model `modelName` followed by its base models, nearest first; empty when the model is not in `models`. */\nfunction modelAndBasesOf(models, modelName) {\n\tconst chain = [];\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (let name = modelName; name !== void 0 && !seen.has(name);) {\n\t\tseen.add(name);\n\t\tconst model = models[name];\n\t\tif (model === void 0) break;\n\t\tchain.push(model);\n\t\tname = model.base?.model;\n\t}\n\treturn chain;\n}\n//#endregion\n//#region src/stored-names.ts\n/** The name MongoDB stores a document's id under. */\nconst DOCUMENT_ID = \"_id\";\n/** Why a field or embed relation cannot be stored as `storedName`, if it cannot; the subject is the field or relation. */\nfunction unsupportedStoredNameReason(storedName) {\n\treturn storedName === \"__proto__\" ? \"is stored as \\\"__proto__\\\", which JavaScript reads as the prototype of an object rather than as a key\" : void 0;\n}\n/** The stored name of each of `model`'s own fields, keyed by field name. */\nfunction ownStoredNamesOf(model) {\n\tconst storageFields = model.storage.fields;\n\treturn Object.fromEntries(Object.keys(model.fields).map((name) => {\n\t\tconst entry = Object.hasOwn(storageFields, name) ? storageFields[name] : void 0;\n\t\tif (entry === void 0) throw new InternalError(`Field \"${name}\" has no entry in its model's storage.fields`);\n\t\treturn [name, entry.field];\n\t}));\n}\n/** The stored name of each field of a value object: its own name, since a value object has no storage block. */\nfunction valueObjectStoredNamesOf(valueObject) {\n\treturn Object.fromEntries(Object.keys(valueObject.fields).map((name) => [name, name]));\n}\n/** The stored name of `fieldName`, one of `model`'s own fields. */\nfunction ownStoredNameOf(model, fieldName) {\n\tconst storedNames = ownStoredNamesOf(model);\n\tconst storedName = Object.hasOwn(storedNames, fieldName) ? storedNames[fieldName] : void 0;\n\tif (storedName === void 0) throw new InternalError(`Model has no field \"${fieldName}\"`);\n\treturn storedName;\n}\n/** The own field of `model` stored under `storedName`, or undefined when no own field is. */\nfunction ownFieldStoredAs(model, storedName) {\n\treturn Object.entries(ownStoredNamesOf(model)).find(([, stored]) => stored === storedName)?.[0];\n}\n/** Whether one of `model`'s own fields is stored under `storedName`. */\nfunction hasOwnFieldStoredAs(model, storedName) {\n\treturn ownFieldStoredAs(model, storedName) !== void 0;\n}\n/** The own field of `model` stored as `_id`, with its name, or undefined when none of its own fields is. */\nfunction ownDocumentIdFieldOf(model) {\n\tconst name = ownFieldStoredAs(model, \"_id\");\n\tconst field = name === void 0 ? void 0 : model.fields[name];\n\treturn name === void 0 || field === void 0 ? void 0 : {\n\t\tname,\n\t\tfield\n\t};\n}\n/**\n* The stored name of each of `model`'s own embed relations, keyed by relation name: its `storage.relations` entry, or the relation's own name when it has none.\n*/\nfunction ownEmbedStoredNamesOf(model) {\n\treturn Object.fromEntries(Object.entries(model.relations).filter(([, relation]) => !(\"on\" in relation) && !(\"through\" in relation)).map(([name]) => [name, model.storage.relations?.[name]?.field ?? name]));\n}\n/** The stored name of each field of model `modelName`, its own and those it inherits from its base models, keyed by field name. */\nfunction storedNamesOf(models, modelName) {\n\tconst chain = [...modelAndBasesOf(models, modelName)].reverse();\n\treturn Object.assign({}, ...chain.map((model) => ownStoredNamesOf(model)));\n}\n//#endregion\n//#region src/relation-fields.ts\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) => Object.hasOwn(model.fields, field.name) && ownStoredNameOf(model, field.name) === \"_id\")),\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/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\n//#region src/contract-refusals.ts\n/** Why an embed relation cannot target `embeddedModel`, a model with variants; the subject is the relation. */\nfunction embeddedVariantsReason(embeddedModel) {\n\treturn `embeds model \"${embeddedModel}\", which has variants. The ORM reads and writes only the base fields of an embedded model, so an embedded model cannot have variants.`;\n}\n/**\n* The parts of a MongoDB contract its validators cannot describe that can be decided without codec lookups: an embed relation to a model with variants. `mongoContractRefusalsOf` includes them, and `validateMongoStorage` applies them to a contract read back from `contract.json`.\n*/\nfunction lookupFreeRefusalsOf(models) {\n\treturn Object.entries(models).flatMap(([modelName, model]) => Object.entries(model.relations).flatMap(([relationName, relation]) => isEmbedRelation(relation) && models[relation.to.model]?.variants !== void 0 ? [{\n\t\tkind: \"embeddedModelHasVariants\",\n\t\tmodelName,\n\t\trelationName,\n\t\tembeddedModel: relation.to.model,\n\t\treason: embeddedVariantsReason(relation.to.model)\n\t}] : []));\n}\n/**\n* The enums a collection validator lists: those stored by a model in a managed collection, by one of its variants or embedded models, or by a value object any of them holds. A model field refers to its domain enum and a value object member to the enum's storage value set; both carry the enum's name.\n*/\nfunction validatedEnumNames(input) {\n\tconst { models, valueObjects, controlPolicies } = input;\n\tconst visitedModels = new Set(Object.entries(collectionRootModelsOf(models)).flatMap(([collection, names]) => isManaged(collection, controlPolicies) ? names : []));\n\tconst visitedValueObjects = /* @__PURE__ */ new Set();\n\tconst enums = /* @__PURE__ */ new Set();\n\tconst visitFields = (fields) => {\n\t\tfor (const field of Object.values(fields)) {\n\t\t\tif (field.valueSet !== void 0) enums.add(field.valueSet.entityName);\n\t\t\tif (field.type.kind === \"valueObject\" && !visitedValueObjects.has(field.type.entityName)) {\n\t\t\t\tvisitedValueObjects.add(field.type.entityName);\n\t\t\t\tvisitFields(valueObjects[field.type.entityName]?.fields ?? {});\n\t\t\t}\n\t\t}\n\t};\n\tconst pending = [...visitedModels];\n\tconst reach = (name) => {\n\t\tif (visitedModels.has(name)) return;\n\t\tvisitedModels.add(name);\n\t\tpending.push(name);\n\t};\n\tfor (let name = pending.pop(); name !== void 0; name = pending.pop()) {\n\t\tconst model = models[name];\n\t\tif (model === void 0) continue;\n\t\tvisitFields(model.fields);\n\t\tfor (const relation of Object.values(model.relations)) if (isEmbedRelation(relation)) reach(relation.to.model);\n\t\tfor (const [variant, candidate] of Object.entries(models)) if (candidate.base?.model === name) reach(variant);\n\t}\n\treturn enums;\n}\nfunction enumRefusals(input) {\n\tconst { enums, lookups } = input;\n\tconst validated = validatedEnumNames(input);\n\treturn Object.entries(enums).flatMap(([enumName, { codecId, members }]) => {\n\t\tconst refusal = fieldBsonTypeRefusalOf(codecId, lookups);\n\t\tif (refusal !== void 0) return [{\n\t\t\tkind: \"enumBsonType\",\n\t\t\tenumName,\n\t\t\tcodecId,\n\t\t\trefusal\n\t\t}];\n\t\tif (!validated.has(enumName)) return [];\n\t\tconst bsonTypes = bsonTypesOfCodec(codecId, lookups) ?? [];\n\t\tconst reason = validatorEnumRefusalOf(bsonTypes);\n\t\tif (reason !== void 0) return [{\n\t\t\tkind: \"enumNotListable\",\n\t\t\tenumName,\n\t\t\tcodecId,\n\t\t\treason\n\t\t}];\n\t\treturn members.flatMap((member) => {\n\t\t\tconst memberReason = validatorEnumMemberRefusalOf(bsonTypes, member.value);\n\t\t\treturn memberReason === void 0 ? [] : [{\n\t\t\t\tkind: \"enumMemberNotListable\",\n\t\t\t\tenumName,\n\t\t\t\tmember: member.name,\n\t\t\t\tcodecId,\n\t\t\t\treason: memberReason\n\t\t\t}];\n\t\t});\n\t});\n}\nfunction fieldRefusals(owner, fields, lookups) {\n\treturn Object.entries(fields).flatMap(([fieldName, field]) => {\n\t\tif (field.type.kind !== \"scalar\") return [];\n\t\tconst refusal = fieldBsonTypeRefusalOf(field.type.codecId, lookups);\n\t\treturn refusal === void 0 ? [] : [{\n\t\t\tkind: \"fieldBsonType\",\n\t\t\towner,\n\t\t\tfieldName,\n\t\t\tcodecId: field.type.codecId,\n\t\t\trefusal\n\t\t}];\n\t});\n}\nfunction documentIdRefusals(models, lookups) {\n\treturn Object.entries(collectionRootModelsOf(models)).flatMap(([collection, modelNames]) => modelNames.flatMap((modelName) => {\n\t\tconst model = models[modelName];\n\t\tconst id = model === void 0 ? void 0 : ownDocumentIdFieldOf(model);\n\t\tif (id === void 0 || id.field.type.kind !== \"scalar\") return [];\n\t\tconst bsonTypes = documentIdBsonTypesOf(id.field, lookups);\n\t\tconst codecId = id.field.type.codecId;\n\t\tconst refusal = bsonTypes === void 0 ? void 0 : documentIdRefusalOf(codecId, bsonTypes);\n\t\treturn refusal === void 0 ? [] : [{\n\t\t\tkind: \"documentId\",\n\t\t\tmodelName,\n\t\t\tfieldName: id.name,\n\t\t\tcollection,\n\t\t\tcodecId,\n\t\t\t...refusal\n\t\t}];\n\t}));\n}\n/**\n* Every part of a built MongoDB contract that its collection validators cannot describe: an embed relation to a model with variants, an enum a validator of a managed collection cannot list, a field whose codec has no MongoDB data type, and a root model's field stored as `_id` that can hold a BSON type an `_id` cannot have. Both authoring surfaces call it on what they built, so the rules are decided in one place.\n*/\nfunction mongoContractRefusalsOf(input) {\n\tconst { models, valueObjects, lookups } = input;\n\treturn [\n\t\t...lookupFreeRefusalsOf(models),\n\t\t...enumRefusals(input),\n\t\t...Object.entries(models).flatMap(([name, model]) => fieldRefusals({\n\t\t\tkind: \"model\",\n\t\t\tname\n\t\t}, model.fields, lookups)),\n\t\t...Object.entries(valueObjects).flatMap(([name, valueObject]) => fieldRefusals({\n\t\t\tkind: \"valueObject\",\n\t\t\tname\n\t\t}, valueObject.fields, lookups)),\n\t\t...documentIdRefusals(models, lookups)\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-index-name.ts\n/** The name MongoDB gives an index created without one: each key's field and direction, joined by `_`, such as `email_1` or `title_text`. */\nfunction defaultMongoIndexName(keys) {\n\treturn keys.map((k) => `${k.field}_${k.direction}`).join(\"_\");\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/recursive-groups.ts\nfunction modelKey(name) {\n\treturn `model:${name}`;\n}\n/** The key of a value object, by its storage coordinate, so value objects of one name in two namespaces stay apart. */\nfunction valueObjectKey(reference) {\n\treturn `valueObject:${JSON.stringify([reference.namespaceId, reference.entityName])}`;\n}\nfunction referencesOf(fields) {\n\treturn Object.values(fields).flatMap((field) => field.type.kind === \"valueObject\" ? [valueObjectKey(field.type)] : []);\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 valueObjectKey} or {@link modelKey} of every type in such a group to the group's number; a type in no recursive group is absent.\n*/\nfunction recursiveGroupsOf(storage, models) {\n\tconst edges = /* @__PURE__ */ new Map();\n\tfor (const { coordinate, valueObject } of valueObjectsWithCoordinates(storage)) edges.set(valueObjectKey(coordinate), referencesOf(valueObject.fields));\n\tfor (const [name, model] of Object.entries(models)) {\n\t\tconst embeds = Object.values(model.relations).flatMap((relation) => isEmbedRelation(relation) ? [modelKey(relation.to.model)] : []);\n\t\tedges.set(modelKey(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.storage, 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(key, shape, sources) {\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}\nfunction modelShape(model) {\n\treturn {\n\t\tfields: model.fields,\n\t\trelations: model.relations,\n\t\tstoredNames: ownStoredNamesOf(model),\n\t\tembedStoredNames: ownEmbedStoredNamesOf(model)\n\t};\n}\nfunction valueObjectShape(valueObject) {\n\treturn {\n\t\tfields: valueObject.fields,\n\t\trelations: {},\n\t\tstoredNames: valueObjectStoredNamesOf(valueObject),\n\t\tembedStoredNames: {}\n\t};\n}\nconst NOTHING_INHERITED = {\n\tfields: {},\n\trelations: {},\n\tstoredNames: {},\n\tembedStoredNames: {}\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, storage, valueSets } = sources;\n\tif (field.type.kind === \"scalar\") {\n\t\tconst bsonTypes = bsonTypesOfCodec(field.type.codecId, lookups);\n\t\tassertDefined(bsonTypes, `Field codec \"${field.type.codecId}\" has no MongoDB data type; the authoring surface refuses such a field before it derives the validator`);\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 = valueObjectAt(storage, field.type);\n\t\tif (!vo) return void 0;\n\t\tconst voSchema = objectSchemaOf(valueObjectKey(field.type), valueObjectShape(vo), 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(modelKey(embeddedName), modelShape(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\tconst storedName = shape.storedNames[fieldName];\n\t\t\tassertDefined(storedName, `Field \"${fieldName}\" has a stored name`);\n\t\t\tproperties[storedName] = schema;\n\t\t\tif (!field.nullable) required.push(storedName);\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\tconst storedName = shape.embedStoredNames[relationName];\n\t\tassertDefined(storedName, `Embed relation \"${relationName}\" has a stored name`);\n\t\tproperties[storedName] = embedToBsonSchema(relation, sources);\n\t}\n\treturn {\n\t\tproperties,\n\t\trequired\n\t};\n}\nconst OBJECT_ID_SCHEMA = { bsonType: \"objectId\" };\nfunction deriveObjectSchema(shape, sources, { isDocument } = { isDocument: false }) {\n\tconst own = propertiesOf(shape, sources, NOTHING_INHERITED);\n\tconst addsDocumentId = isDocument && !Object.values(shape.storedNames).includes(\"_id\");\n\tconst properties = addsDocumentId ? {\n\t\t[\"_id\"]: OBJECT_ID_SCHEMA,\n\t\t...own.properties\n\t} : own.properties;\n\tconst required = addsDocumentId ? [\"_id\", ...own.required] : own.required;\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$1(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, { isDocument: true });\n\tconst baseProperties = isRecord$1(baseSchema[\"properties\"]) ? baseSchema[\"properties\"] : {};\n\tconst oneOf = [];\n\tfor (const variant of variants) {\n\t\tconst { properties: variantProperties, required } = propertiesOf(variant, entering(modelKey(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 `$jsonSchema` of a root model's documents: the model's fields and embedded models, and for a model with variants one `oneOf` branch per variant.\n*/\nfunction deriveModelJsonSchema(modelName, model, sources) {\n\tconst schemaSources = sourcesFor(sources, modelKey(modelName));\n\tif (!model.discriminator || !model.variants) return deriveObjectSchema(modelShape(model), schemaSources, { isDocument: true });\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...modelShape(variantModel)\n\t\t};\n\t});\n\treturn polymorphicSchema(modelShape(model), ownStoredNameOf(model, model.discriminator.field), variants, schemaSources);\n}\n//#endregion\n//#region src/derive-collection-validators.ts\n/**\n* The validator of each managed collection that stores a root model, keyed by collection name. A collection under another control policy holds documents Prisma does not own the shape of, so it gets none. A root model with variants gets one polymorphic schema covering every variant. A collection that stores several root models accepts a document of any of them: its schema has one `anyOf` branch per root model.\n*/\nfunction deriveCollectionValidators(input) {\n\tconst validators = {};\n\tfor (const [collectionName, modelNames] of Object.entries(collectionRootModelsOf(input.models))) {\n\t\tif (!isManaged(collectionName, input.controlPolicies)) continue;\n\t\tconst schemas = modelNames.map((modelName) => {\n\t\t\tconst model = input.models[modelName];\n\t\t\tassertDefined(model, `Root model \"${modelName}\" of collection \"${collectionName}\" is missing`);\n\t\t\treturn deriveModelJsonSchema(modelName, model, input);\n\t\t});\n\t\tconst [only, ...others] = schemas;\n\t\tassertDefined(only, `Collection \"${collectionName}\" has no root model`);\n\t\tvalidators[collectionName] = validatorOf(others.length === 0 ? only : {\n\t\t\tbsonType: \"object\",\n\t\t\tanyOf: schemas\n\t\t});\n\t}\n\treturn validators;\n}\n//#endregion\n//#region src/index-lookup-key.ts\n/**\n* Returns a function that accepts a list of options only when it names every member of `Option`;\n* a list missing one fails to compile, naming the missing option.\n*/\nfunction listsEveryOption() {\n\treturn (options) => options;\n}\n/** The index options that tell two indexes on the same keys apart: every option of an index. The name is not an option. */\nconst MONGO_INDEX_OPTION_KEYS = listsEveryOption()([\n\t\"unique\",\n\t\"sparse\",\n\t\"expireAfterSeconds\",\n\t\"partialFilterExpression\",\n\t\"wildcardProjection\",\n\t\"collation\",\n\t\"weights\",\n\t\"default_language\",\n\t\"language_override\"\n]);\n/** Identifies an index by its keys and the options it sets, not by its name; an option set to `false` counts as unset. No field name or option value can make two different indexes share a key. */\nfunction indexLookupKey(index) {\n\tconst options = Object.fromEntries(MONGO_INDEX_OPTION_KEYS.flatMap((option) => {\n\t\tconst value = index[option];\n\t\treturn value === void 0 || value === null || value === false ? [] : [[option, value]];\n\t}));\n\treturn canonicalize({\n\t\tkeys: index.keys.map((k) => [k.field, k.direction]),\n\t\toptions\n\t});\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\tname: index.name,\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/validator-shapes.ts\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction records(value) {\n\treturn Array.isArray(value) ? value.filter(isRecord) : [];\n}\nfunction shapeOf(schema) {\n\tconst properties = schema[\"properties\"];\n\tconst required = schema[\"required\"];\n\treturn {\n\t\tproperties: isRecord(properties) ? properties : {},\n\t\trequired: Array.isArray(required) ? required.filter((name) => typeof name === \"string\") : []\n\t};\n}\n/**\n* The root model shapes a collection validator's `$jsonSchema` describes, as `deriveCollectionValidators` writes it: one per `anyOf` branch when the collection stores several root models, otherwise the schema itself, each with its variants' `oneOf` branches.\n*/\nfunction validatorRootShapesOf(jsonSchema) {\n\tif (!isRecord(jsonSchema)) return [];\n\treturn (Array.isArray(jsonSchema[\"anyOf\"]) ? records(jsonSchema[\"anyOf\"]) : [jsonSchema]).map((root) => ({\n\t\t...shapeOf(root),\n\t\tvariants: records(root[\"oneOf\"]).map(shapeOf)\n\t}));\n}\n/** Every field name a collection validator declares, for a root model or for a variant. */\nfunction validatorFieldNamesOf(jsonSchema) {\n\treturn new Set(validatorRootShapesOf(jsonSchema).flatMap((root) => [...Object.keys(root.properties), ...root.variants.flatMap((variant) => Object.keys(variant.properties))]));\n}\n//#endregion\n//#region src/validate-storage.ts\nfunction bsonTypesOf(schema) {\n\tif (!(\"bsonType\" in schema)) return [];\n\tconst { bsonType } = schema;\n\treturn (Array.isArray(bsonType) ? bsonType : [bsonType]).filter((type) => typeof type === \"string\");\n}\nfunction idSchemaOf(shape) {\n\tconst id = shape.properties[\"_id\"];\n\treturn shape.required.includes(\"_id\") && typeof id === \"object\" && id !== null ? id : void 0;\n}\n/**\n* What a collection validator gets wrong about `_id`: a root model's branch that does not require it, or an `_id` that can hold a BSON type an `_id` cannot have, refused with the reason the build gives.\n*/\nfunction documentIdErrors(contract) {\n\tconst models = Object.assign({}, ...Object.keys(contract.domain.namespaces).map((namespaceId) => mongoModelsOf(contract.domain, namespaceId)));\n\tconst rootModels = collectionRootModelsOf(models);\n\treturn Object.values(contract.storage.namespaces).flatMap((namespace) => Object.entries(namespace.entries[\"collection\"] ?? {}).flatMap(([name, collection]) => {\n\t\tif (collection.validator === void 0) return [];\n\t\tconst shapes = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst idSchemas = shapes.map(idSchemaOf);\n\t\tif (shapes.length === 0 || idSchemas.includes(void 0)) return [`Collection \"${name}\": its validator must require _id, for every model the collection stores, since every document has an _id`];\n\t\tconst names = rootModels[name] ?? [];\n\t\treturn idSchemas.flatMap((idSchema, index) => {\n\t\t\tconst modelName = names.length === shapes.length ? names[index] : void 0;\n\t\t\tconst model = modelName === void 0 ? void 0 : models[modelName];\n\t\t\tconst id = model === void 0 ? void 0 : ownDocumentIdFieldOf(model);\n\t\t\tconst codecId = id?.field.type.kind === \"scalar\" ? id.field.type.codecId : \"unknown\";\n\t\t\tconst refusal = idSchema === void 0 ? void 0 : documentIdRefusalOf(codecId, bsonTypesOf(idSchema));\n\t\t\tif (refusal === void 0) return [];\n\t\t\treturn [id === void 0 ? `Collection \"${name}\": its validator's _id ${refusal.reason}` : `Model \"${modelName}\" field \"${id.name}\" ${refusal.reason}`];\n\t\t});\n\t}));\n}\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 fieldStorageErrors(qualifiedName, modelName, model, models) {\n\tconst errors = [];\n\tconst storageFields = model.storage.fields;\n\tfor (const fieldName of Object.keys(model.fields)) if (!Object.hasOwn(storageFields, fieldName)) errors.push(`Model \"${qualifiedName}\" field \"${fieldName}\" has no entry in storage.fields`);\n\tfor (const fieldName of Object.keys(storageFields)) if (!Object.hasOwn(model.fields, fieldName)) errors.push(`Model \"${qualifiedName}\" storage.fields names \"${fieldName}\", which is not a field of the model`);\n\terrors.push(...unsupportedStoredNameErrors(qualifiedName, model));\n\tif (errors.length > 0) return errors;\n\tconst chain = [...modelAndBasesOf(models, modelName)].reverse();\n\tif (!chain.every(hasCompleteFieldStorage)) return errors;\n\tconst membersByStoredName = /* @__PURE__ */ new Map();\n\tconst members = chain.flatMap((each) => [...Object.entries(ownStoredNamesOf(each)).map(([name, storedName]) => [`field \"${name}\"`, storedName]), ...Object.entries(ownEmbedStoredNamesOf(each)).map(([name, storedName]) => [`embed relation \"${name}\"`, storedName])]);\n\tfor (const [member, storedName] of members) {\n\t\tconst other = membersByStoredName.get(storedName);\n\t\tif (other !== void 0 && other !== member) errors.push(bothStoredAs(qualifiedName, other, member, storedName));\n\t\tmembersByStoredName.set(storedName, member);\n\t}\n\treturn errors;\n}\nfunction unsupportedStoredNameErrors(qualifiedName, model) {\n\treturn [...Object.entries(model.storage.fields).map(([name, { field }]) => [`field \"${name}\"`, field]), ...Object.entries(model.storage.relations ?? {}).map(([name, { field }]) => [`embed relation \"${name}\"`, field])].flatMap(([member, storedName]) => {\n\t\tconst reason = unsupportedStoredNameReason(storedName);\n\t\treturn reason === void 0 ? [] : [`Model \"${qualifiedName}\" ${member} ${reason}`];\n\t});\n}\nfunction hasCompleteFieldStorage(model) {\n\treturn Object.keys(model.fields).every((name) => Object.hasOwn(model.storage.fields, name));\n}\nfunction bothStoredAs(qualifiedName, first, second, storedName) {\n\tconst fieldPrefix = \"field \\\"\";\n\tif (first.startsWith(fieldPrefix) && second.startsWith(fieldPrefix)) {\n\t\tconst [a, b] = [first, second].map((member) => member.slice(7, -1)).sort();\n\t\treturn `Model \"${qualifiedName}\" fields \"${a}\" and \"${b}\" are both stored as \"${storedName}\"`;\n\t}\n\treturn `Model \"${qualifiedName}\" ${first} and ${second} are both stored as \"${storedName}\"`;\n}\nfunction validateMongoStorage(contract) {\n\tvalidateStorageValueObjects(contract.storage);\n\tconst errors = [];\n\tlet fieldStorageComplete = true;\n\tfor (const namespaceId of Object.keys(contract.domain.namespaces)) {\n\t\tconst models = mongoModelsOf(contract.domain, namespaceId);\n\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\tconst fieldErrors = fieldStorageErrors(qualifiedName, modelName, model, models);\n\t\t\tif (fieldErrors.length > 0) fieldStorageComplete = false;\n\t\t\terrors.push(...fieldErrors);\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 = fieldErrors.length > 0 ? void 0 : 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\tfor (const namespace of Object.values(contract.domain.namespaces)) for (const refusal of lookupFreeRefusalsOf(namespace.models)) if (refusal.kind === \"embeddedModelHasVariants\") errors.push(`Relation \"${refusal.modelName}.${refusal.relationName}\" ${refusal.reason}`);\n\tif (fieldStorageComplete) errors.push(...documentIdErrors(contract));\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\nexport { DOCUMENT_ID, MONGO_INDEX_OPTION_KEYS, MongoChangeStreamPreAndPostImagesOptions, MongoClusteredCollectionOptions, MongoCollationOptions, MongoCollection, MongoCollectionOptions, MongoContractSchema, MongoIndex, MongoIndexOptionDefaults, MongoIndexOptions, MongoStorage, MongoTimeSeriesCollectionOptions, MongoUnboundNamespace, MongoValidator, MongoValueObject, MongoValueSet, RelationKeys, StorageValueSetSchema, applyPolymorphicScopeToMongoIndex, buildMongoContractView, buildMongoNamespace, buildMongoStorage, canonicalize, collectionControlPoliciesOf, collectionControlPolicyOf, collectionRootModelsOf, createMongoContractSchema, createMongoNamespaceEnvelopeSchema, defaultMongoDomainNamespaceId, defaultMongoIndexName, defaultMongoStorageNamespaceId, deriveCollectionValidators, documentIdRefusalReason, fieldBsonTypeRefusalOf, hasOwnFieldStoredAs, indexLookupKey, isEmbedRelation, modelAndBasesOf, mongoContractRefusalsOf, mongoModelsOf, mongoValueSetsOf, ownDocumentIdFieldOf, ownEmbedStoredNamesOf, ownFieldStoredAs, ownStoredNameOf, ownStoredNamesOf, resolveMongoToOneRelationFields, storedNamesOf, unsupportedStoredNameReason, validateMongoStorage, validatorEnumMemberRefusalOf, validatorEnumRefusalOf, validatorFieldNamesOf, validatorRootSh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Content":["import { dataType, dataTypeParamsProblem } from \"@internal/framework-components/codec\";\n//#region src/mongo-data-type.ts\nfunction mongoDataType(id, spec) {\n\tconst { bsonTypes, ...frameworkSpec } = spec;\n\treturn {\n\t\t...dataType(id, frameworkSpec),\n\t\tmongo: { bsonTypes: [...bsonTypes] }\n\t};\n}\nfunction isMongoDataType(type) {\n\treturn \"mongo\" in type;\n}\n/**\n* The BSON types a value of the codec `codecId` is stored as, read from the data type the codec\n* represents; undefined when the stack registers no such codec or Mongo data type.\n*/\nfunction bsonTypesOfCodec(codecId, lookups) {\n\tconst type = dataTypeOfCodec(codecId, lookups);\n\treturn type !== void 0 && isMongoDataType(type) ? type.mongo.bsonTypes : void 0;\n}\n/** What is wrong with the type parameters `typeParams` for the data type the codec `codecId` represents, or undefined when it accepts them or the stack registers no such codec or data type. The Mongo contract builder checks each field with it: the type parameters a field carries reach only the TypeScript types and the emitted `contract.d.ts`, so nothing later checks them. */\nfunction codecTypeParamsProblem(codecId, typeParams, lookups) {\n\tconst type = dataTypeOfCodec(codecId, lookups);\n\treturn type === void 0 ? void 0 : dataTypeParamsProblem(type, typeParams);\n}\nfunction dataTypeOfCodec(codecId, lookups) {\n\tconst descriptor = lookups.codecLookup.descriptorFor(codecId);\n\treturn descriptor === void 0 ? void 0 : lookups.dataTypeLookup.get(descriptor.dataType);\n}\n//#endregion\nexport { mongoDataType as i, codecTypeParamsProblem as n, isMongoDataType as r, bsonTypesOfCodec as t };\n\n//# sourceMappingURL=mongo-data-type-Bv8Bd0zu.mjs.map"],"mappings":";;AAEA,SAAS,cAAc,IAAI,MAAM;CAChC,MAAM,EAAE,WAAW,GAAG,kBAAkB;CACxC,OAAO;EACN,GAAG,SAAS,IAAI,aAAa;EAC7B,OAAO,EAAE,WAAW,CAAC,GAAG,SAAS,EAAE;CACpC;AACD;AACA,SAAS,gBAAgB,MAAM;CAC9B,OAAO,WAAW;AACnB;;;;;AAKA,SAAS,iBAAiB,SAAS,SAAS;CAC3C,MAAM,OAAO,gBAAgB,SAAS,OAAO;CAC7C,OAAO,SAAS,KAAK,KAAK,gBAAgB,IAAI,IAAI,KAAK,MAAM,YAAY,KAAK;AAC/E;;AAEA,SAAS,uBAAuB,SAAS,YAAY,SAAS;CAC7D,MAAM,OAAO,gBAAgB,SAAS,OAAO;CAC7C,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,sBAAsB,MAAM,UAAU;AACzE;AACA,SAAS,gBAAgB,SAAS,SAAS;CAC1C,MAAM,aAAa,QAAQ,YAAY,cAAc,OAAO;CAC5D,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI,QAAQ,eAAe,IAAI,WAAW,QAAQ;AACvF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-Cx_Sw9eY.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/runtime.d.mts"],"mappings":";;;;;;;iBAMiB,gCAAgC"}