@prisma/orm-family-mongo 8.0.0-rc.21-dev.19 → 8.0.0-rc.21-dev.21
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.
- package/dist/{contract-builder-Bhh9_UPS.d.mts → contract-builder-CKAOYSpC.d.mts} +2 -8
- package/dist/contract-builder-CKAOYSpC.d.mts.map +1 -0
- package/dist/{contract-builder-DzeVnjsm.mjs → contract-builder-bpLBqNm-.mjs} +33 -47
- package/dist/contract-builder-bpLBqNm-.mjs.map +1 -0
- package/dist/contract-prisma6__provider.mjs +6 -14
- package/dist/contract-prisma6__provider.mjs.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +1 -1
- package/dist/contract.d.mts +2 -2
- package/dist/contract.mjs +2 -2
- package/dist/{control-D_aaZj4g.mjs → control-CVeZGRjw.mjs} +5 -5
- package/dist/{control-D_aaZj4g.mjs.map → control-CVeZGRjw.mjs.map} +1 -1
- package/dist/{control-7qLrKCcY.d.mts → control-Cpgdr11Q.d.mts} +5 -5
- package/dist/{control-7qLrKCcY.d.mts.map → control-Cpgdr11Q.d.mts.map} +1 -1
- package/dist/{control-BdNzdZKQ.d.mts → control-DVHcBUoh.d.mts} +2 -2
- package/dist/{control-BdNzdZKQ.d.mts.map → control-DVHcBUoh.d.mts.map} +1 -1
- package/dist/{control-adapter-CLIE-kQU-Bp01Cd9h.d.mts → control-adapter-BheElqfe-BVp5aOMr.d.mts} +6 -6
- package/dist/{control-adapter-CLIE-kQU-Bp01Cd9h.d.mts.map → control-adapter-BheElqfe-BVp5aOMr.d.mts.map} +1 -1
- package/dist/control-adapter-CGIKt9Hq.d.mts +1 -0
- package/dist/{dist-CroOs9BN.mjs → dist-BPlVwyAb.mjs} +40 -2
- package/dist/dist-BPlVwyAb.mjs.map +1 -0
- package/dist/dist-BhDqnAiz.mjs.map +1 -1
- package/dist/{dist-B1afy6LD.mjs → dist-BwYedu6-.mjs} +2 -2
- package/dist/{dist-B1afy6LD.mjs.map → dist-BwYedu6-.mjs.map} +1 -1
- package/dist/{execution-BCgTPyx1.d.mts → execution-CZhOXkot.d.mts} +2 -2
- package/dist/{execution-BCgTPyx1.d.mts.map → execution-CZhOXkot.d.mts.map} +1 -1
- package/dist/{exports-BAimNKOs.mjs → exports-B2tu3O-g.mjs} +3 -41
- package/dist/exports-B2tu3O-g.mjs.map +1 -0
- package/dist/family.d.mts +9 -9
- package/dist/family.mjs +7 -7
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +1 -1
- package/dist/family__control.mjs +2 -2
- package/dist/family__ir.d.mts +2 -2
- package/dist/family__ir.mjs +3 -3
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__migration.mjs +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/family__runtime.d.mts +2 -2
- package/dist/family__runtime.mjs +1 -1
- package/dist/family__schema-verify.d.mts +1 -1
- package/dist/family__schema-verify.mjs +1 -1
- package/dist/{field-accessor-CqKt9hxI-BmcdFwrk.d.mts → field-accessor-CqKt9hxI-Co64FQ3V.d.mts} +3 -3
- package/dist/{field-accessor-CqKt9hxI-BmcdFwrk.d.mts.map → field-accessor-CqKt9hxI-Co64FQ3V.d.mts.map} +1 -1
- package/dist/{index-CgvlbMOw.d.mts → index-B3o8NFNH.d.mts} +17 -3
- package/dist/index-B3o8NFNH.d.mts.map +1 -0
- package/dist/{index-BvhsteM2.d.mts → index-Bh6a8q-2.d.mts} +10 -7
- package/dist/{index-BvhsteM2.d.mts.map → index-Bh6a8q-2.d.mts.map} +1 -1
- package/dist/{index-LvXZZ_jC.d.mts → index-BonKbeyU.d.mts} +102 -110
- package/dist/index-BonKbeyU.d.mts.map +1 -0
- package/dist/{index-BmMMEdyQ.d.mts → index-D9TThYU9.d.mts} +3 -3
- package/dist/{index-BmMMEdyQ.d.mts.map → index-D9TThYU9.d.mts.map} +1 -1
- package/dist/{interpreter-DqVj74Rn-DgfRcygL.mjs → interpreter-K6G8SumZ-DVZw4CFe.mjs} +5 -7
- package/dist/interpreter-K6G8SumZ-DVZw4CFe.mjs.map +1 -0
- package/dist/{ir-FZi5ql4K.mjs → ir-C7oVYJg2.mjs} +2 -2
- package/dist/{ir-FZi5ql4K.mjs.map → ir-C7oVYJg2.mjs.map} +1 -1
- package/dist/{ir-MBl4vT_o.d.mts → ir-ZONNL1YV.d.mts} +3 -3
- package/dist/{ir-MBl4vT_o.d.mts.map → ir-ZONNL1YV.d.mts.map} +1 -1
- package/dist/lowering.d.mts +2 -2
- package/dist/{migration-KD7yy64Y.mjs → migration-C0N4Uamo.mjs} +2 -2
- package/dist/{migration-KD7yy64Y.mjs.map → migration-C0N4Uamo.mjs.map} +1 -1
- package/dist/{migration-xxic7RBq.d.mts → migration-RzYuoweU.d.mts} +4 -4
- package/dist/{migration-xxic7RBq.d.mts.map → migration-RzYuoweU.d.mts.map} +1 -1
- package/dist/{mongo-contract-serializer-BBknnHWy-yE74wFbz.mjs → mongo-contract-serializer-BBknnHWy-CZOnQGdR.mjs} +2 -2
- package/dist/{mongo-contract-serializer-BBknnHWy-yE74wFbz.mjs.map → mongo-contract-serializer-BBknnHWy-CZOnQGdR.mjs.map} +1 -1
- package/dist/{mongo-contract-view-AnejqfrQ-DJ2JKgA-.d.mts → mongo-contract-view-AnejqfrQ-k0FbFieN.d.mts} +2 -2
- package/dist/{mongo-contract-view-AnejqfrQ-DJ2JKgA-.d.mts.map → mongo-contract-view-AnejqfrQ-k0FbFieN.d.mts.map} +1 -1
- package/dist/{mongo-contract-view-CF5trX6R-D_Bus9dt.mjs → mongo-contract-view-CF5trX6R-BCPkEgiL.mjs} +3 -3
- package/dist/{mongo-contract-view-CF5trX6R-D_Bus9dt.mjs.map → mongo-contract-view-CF5trX6R-BCPkEgiL.mjs.map} +1 -1
- package/dist/orm.d.mts +2 -2
- package/dist/orm.mjs +2 -2
- package/dist/query-ast.d.mts +2 -2
- package/dist/query-ast__control.d.mts +1 -1
- package/dist/query-ast__execution.d.mts +1 -1
- package/dist/query-builder.d.mts +3 -3
- package/dist/query-builder.mjs +1 -1
- package/dist/query-builder__contract-free.d.mts +3 -3
- package/dist/{runtime-CXoFcIme.d.mts → runtime-D_E5N6Ii.d.mts} +2 -2
- package/dist/runtime-D_E5N6Ii.d.mts.map +1 -0
- package/dist/runtime.d.mts +21 -10
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +19 -3
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-ir.d.mts +2 -2
- package/dist/schema-ir.mjs +2 -2
- package/dist/{schema-verify-DldhIjOX.d.mts → schema-verify-BTRGeQWE.d.mts} +3 -3
- package/dist/{schema-verify-DldhIjOX.d.mts.map → schema-verify-BTRGeQWE.d.mts.map} +1 -1
- package/dist/{verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs → verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs} +24 -6
- package/dist/verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs.map +1 -0
- package/dist/wire.d.mts +2 -2
- package/package.json +20 -20
- package/dist/contract-builder-Bhh9_UPS.d.mts.map +0 -1
- package/dist/contract-builder-DzeVnjsm.mjs.map +0 -1
- package/dist/control-adapter-DoykpdEX.d.mts +0 -1
- package/dist/dist-CroOs9BN.mjs.map +0 -1
- package/dist/exports-BAimNKOs.mjs.map +0 -1
- package/dist/index-CgvlbMOw.d.mts.map +0 -1
- package/dist/index-LvXZZ_jC.d.mts.map +0 -1
- package/dist/interpreter-DqVj74Rn-DgfRcygL.mjs.map +0 -1
- package/dist/runtime-CXoFcIme.d.mts.map +0 -1
- package/dist/verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-
|
|
2
|
+
import { B as validatorRootShapesOf } from "./dist-BPlVwyAb.mjs";
|
|
3
|
+
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-K6G8SumZ-DVZw4CFe.mjs";
|
|
4
4
|
import { t as describeUnresolvedMongoType } from "./dist-BhDqnAiz.mjs";
|
|
5
5
|
import { t as mongoEmission } from "./exports-DNAGDetn.mjs";
|
|
6
6
|
import { et as RawUpdateManyCommand } from "./execution-BoVPgPvR.mjs";
|
|
7
|
-
import { i as verifyMongoSchema } from "./verify-mongo-schema-
|
|
7
|
+
import { i as verifyMongoSchema } from "./verify-mongo-schema-CyvUewwP-Dl3QC2wh.mjs";
|
|
8
8
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-J_patbMZ-CADuWYyG.mjs";
|
|
9
|
-
import { t as MongoContractSerializer } from "./mongo-contract-serializer-BBknnHWy-
|
|
9
|
+
import { t as MongoContractSerializer } from "./mongo-contract-serializer-BBknnHWy-CZOnQGdR.mjs";
|
|
10
10
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
11
11
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
12
12
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -564,4 +564,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
|
|
|
564
564
|
//#endregion
|
|
565
565
|
export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
|
|
566
566
|
|
|
567
|
-
//# sourceMappingURL=control-
|
|
567
|
+
//# sourceMappingURL=control-CVeZGRjw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-D_aaZj4g.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-nsnAhPm8.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-J_patbMZ.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 { 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 { InternalError } from \"@internal/utils/internal-error\";\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.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\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\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, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;;;;AAKA,SAAS,eAAe,WAAW;CAClC,MAAM,MAAM,QAAQ,IAAI,WAAW,KAAK;CACxC,IAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,GAAG,OAAO,KAAK;CACzD,MAAM,CAAC,QAAQ;CACf,MAAM,UAAU,OAAO,SAAS,YAAY,SAAS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AyB,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
|
+
{"version":3,"file":"control-CVeZGRjw.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-CyvUewwP.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-J_patbMZ.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 { 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 { InternalError } from \"@internal/utils/internal-error\";\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.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\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\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, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperations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M,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,9 +1,9 @@
|
|
|
1
1
|
import { C as MongoContract, W as MongoStorageShape } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
2
|
-
import "./index-
|
|
3
|
-
import {
|
|
2
|
+
import "./index-B3o8NFNH.mjs";
|
|
3
|
+
import { o as MongoSchemaIR } from "./index-BonKbeyU.mjs";
|
|
4
4
|
import { At as RawUpdateManyCommand } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
|
|
5
|
-
import "./execution-
|
|
6
|
-
import { i as MongoRunnerDependencies } from "./control-adapter-
|
|
5
|
+
import "./execution-CZhOXkot.mjs";
|
|
6
|
+
import { i as MongoRunnerDependencies } from "./control-adapter-BheElqfe-BVp5aOMr.mjs";
|
|
7
7
|
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
8
8
|
import { ContractSerializer, ContractSpace, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma/orm-framework/components/control";
|
|
9
9
|
//#region ../../../2-mongo-family/9-family/dist/control.d.mts
|
|
@@ -121,4 +121,4 @@ interface CanonicalizedSchemas {
|
|
|
121
121
|
declare function canonicalizeSchemasForVerification(live: MongoSchemaIR, expected: MongoSchemaIR): CanonicalizedSchemas;
|
|
122
122
|
//#endregion
|
|
123
123
|
export { canonicalizeSchemasForVerification as a, diffMongoSchemas as c, mongoFamilyDescriptor as d, mongoOperationsToPreview as f, MongoControlTargetDescriptor as i, fieldRewriteOf as l, MongoControlExtensionDescriptor as n, contractToMongoSchemaIR as o, MongoControlFamilyInstance as r, createMongoFamilyInstance as s, FieldRewrite as t, formatMongoOperations as u };
|
|
124
|
-
//# sourceMappingURL=control-
|
|
124
|
+
//# sourceMappingURL=control-Cpgdr11Q.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-
|
|
1
|
+
{"version":3,"file":"control-Cpgdr11Q.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.d.mts"],"mappings":";;;;;;;;;;iBAOiB,wBAAwB,UAAU,uBAAuB;;;UAGhE,mCAAmC,+BAA+B,gBAAgB,kBAAkB,gBAAgB;;;;;;;;;;;EAW5H,oBAAoB,wBAAwB;;;;EAI5C,yBAAyB;aACd,QAAQ;MACf;;iBAEW,0BAA0B,cAAc,eAAe;;;cAG1D,uBAAuB,iCAAiC;;;;;;;;;;;;;;;UAe5D,6BAA6B,kBAAkB,gBAAgB,uBAAuB,6CAA6C;WAClI,oBAAoB,mBAAmB;WACvC,gBAAgB,eAAe,WAAW;;;;;;;;;;;;;;;;;;;UAmB3C,wCAAwC;WACvC,gBAAgB,cAAc,cAAc;;;;;UAK7C;WACC;;WAEA;WACA,SAAS;;;;;;iBAMH,eAAe,WAAW,yBAAyB;;;iBAGnD,sBAAsB,qBAAqB;;;;;;iBAM3C,yBAAyB,qBAAqB,2BAA2B;;;;;;;;;;;;;UAahF;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,iBAAiB,MAAM,eAAe,UAAU,eAAe,iBAAiB,0BAA0B,2BAA2B,gBAAgB;;;UAG5J;WACC,MAAM;WACN,UAAU;;iBAEJ,mCAAmC,MAAM,eAAe,UAAU,gBAAgB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as CreateCollectionOptions$1, r as CreateIndexesOptions, t as CollationOptions } from "./mongodb-types-B4HmhF1S.mjs";
|
|
2
2
|
import { A as MongoIndexKey, j as MongoIndexKeyDirection } from "./mongo-value-set-DAGBOegv-B0Vel8d-.mjs";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-B3o8NFNH.mjs";
|
|
4
4
|
import { B as MongoFilterExpr, D as MongoAstNode, rt as MongoQueryPlan } from "./query-plan-C7sSU3Al-wzsJKtml.mjs";
|
|
5
5
|
import { MigrationOperationClass, MigrationPlanOperation } from "@prisma/orm-framework/components/control";
|
|
6
6
|
//#region ../../../2-mongo-family/4-query/query-ast/dist/exports/control.d.mts
|
|
@@ -203,4 +203,4 @@ type AnyMongoMigrationOperation = MongoMigrationPlanOperation | MongoDmlOperatio
|
|
|
203
203
|
declare function isMongoDmlOperation(operation: AnyMongoMigrationOperation): operation is MongoDmlOperation;
|
|
204
204
|
//#endregion
|
|
205
205
|
export { defaultMongoIndexName as C, buildIndexOpId as S, keysToKeySpec as T, MongoInspectionCommandVisitor as _, CollModOptions as a, MongoMigrationStep as b, CreateIndexCommand as c, DropIndexCommand as d, ListCollectionsCommand as f, MongoDmlOperation as g, MongoDmlCheck as h, CollModCommand as i, CreateIndexOptions as l, MongoDdlCommandVisitor as m, AnyMongoInspectionCommand as n, CreateCollectionCommand as o, ListIndexesCommand as p, AnyMongoMigrationOperation as r, CreateCollectionOptions as s, AnyMongoDdlCommand as t, DropCollectionCommand as u, MongoMigrationCheck as v, isMongoDmlOperation as w, RenameCollectionCommand as x, MongoMigrationPlanOperation as y };
|
|
206
|
-
//# sourceMappingURL=control-
|
|
206
|
+
//# sourceMappingURL=control-DVHcBUoh.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-
|
|
1
|
+
{"version":3,"file":"control-DVHcBUoh.d.mts","names":[],"sources":["../../../../2-mongo-family/4-query/query-ast/dist/exports/control.d.mts"],"mappings":";;;;;;;cAKc,2BAA2B;WAC9B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,8BAA8B,KAAK;;cAE1C,+BAA+B;WAClC;EACT;EACA,OAAO,GAAG,SAAS,8BAA8B,KAAK;;KAEnD,4BAA4B,qBAAqB;;;UAG5C,uBAAuB;EAC/B,YAAY,SAAS,qBAAqB;EAC1C,UAAU,SAAS,mBAAmB;EACtC,iBAAiB,SAAS,0BAA0B;EACpD,eAAe,SAAS,wBAAwB;EAChD,iBAAiB,SAAS,0BAA0B;EACpD,QAAQ,SAAS,iBAAiB;;UAE1B,8BAA8B;EACtC,YAAY,SAAS,qBAAqB;EAC1C,gBAAgB,SAAS,yBAAyB;;;;UAI1C;WACC;WACA;WACA;WACA,0BAA0B;WAC1B;WACA,qBAAqB;WACrB,YAAY;WACZ,U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UAEV,oCAAoC;WACnC,mBAAmB;WACnB,kBAAkB;WAClB,oBAAoB;;UAErB;WACC;WACA,QAAQ;WACR,QAAQ;WACR;;;;;;;UAOD,0BAA0B;WACzB,gBAAgB;WAChB;;;;;;WAMA;WACA,mBAAmB;WACnB,cAAc;WACd,oBAAoB;;KAE1B,6BAA6B,8BAA8B;iBAC/C,oBAAoB,WAAW,6BAA6B,aAAa"}
|
package/dist/{control-adapter-CLIE-kQU-Bp01Cd9h.d.mts → control-adapter-BheElqfe-BVp5aOMr.d.mts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-
|
|
3
|
-
import {
|
|
1
|
+
import { o as MongoSchemaIR } from "./index-BonKbeyU.mjs";
|
|
2
|
+
import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-DVHcBUoh.mjs";
|
|
3
|
+
import { o as MongoQueryable, t as MongoAdapter } from "./index-Bh6a8q-2.mjs";
|
|
4
4
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { ControlAdapterDescriptor, ControlAdapterInstance, ControlDriverInstance } from "@prisma/orm-framework/components/control";
|
|
6
|
-
//#region ../../../2-mongo-family/9-family/dist/control-adapter-
|
|
6
|
+
//#region ../../../2-mongo-family/9-family/dist/control-adapter-BheElqfe.d.mts
|
|
7
7
|
//#region src/core/control-adapter.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Marker / ledger operations the Mongo runner depends on. Every method
|
|
@@ -38,7 +38,7 @@ interface MarkerOperations {
|
|
|
38
38
|
interface MongoRunnerDependencies {
|
|
39
39
|
readonly inspectionExecutor: MongoInspectionCommandVisitor<Promise<Record<string, unknown>[]>>;
|
|
40
40
|
readonly adapter: MongoAdapter;
|
|
41
|
-
readonly driver:
|
|
41
|
+
readonly driver: MongoQueryable;
|
|
42
42
|
readonly executeDdl: (command: AnyMongoDdlCommand) => Promise<void>;
|
|
43
43
|
readonly markerOps: MarkerOperations;
|
|
44
44
|
readonly introspectSchema: () => Promise<MongoSchemaIR>;
|
|
@@ -126,4 +126,4 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
|
|
|
126
126
|
interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
|
|
127
127
|
//#endregion
|
|
128
128
|
export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
|
|
129
|
-
//# sourceMappingURL=control-adapter-
|
|
129
|
+
//# sourceMappingURL=control-adapter-BheElqfe-BVp5aOMr.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-adapter-
|
|
1
|
+
{"version":3,"file":"control-adapter-BheElqfe-BVp5aOMr.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-BheElqfe.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;WAE5F;;;;;;;EAOT,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./control-adapter-BheElqfe-BVp5aOMr.mjs";
|
|
@@ -108,6 +108,14 @@ function buildMongoStorage(input) {
|
|
|
108
108
|
namespaces: { [input.namespaceId]: namespace }
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
+
function canonicalize(obj) {
|
|
112
|
+
if (obj === null) return "null";
|
|
113
|
+
if (obj === void 0) return "undefined";
|
|
114
|
+
if (typeof obj !== "object") return JSON.stringify(obj);
|
|
115
|
+
if (Array.isArray(obj)) return `[${obj.map(canonicalize).join(",")}]`;
|
|
116
|
+
const record = obj;
|
|
117
|
+
return `{${Object.keys(record).sort().map((k) => `${JSON.stringify(k)}:${canonicalize(record[k])}`).join(",")}}`;
|
|
118
|
+
}
|
|
111
119
|
/** The control policies a built contract declares for its collections. */
|
|
112
120
|
function collectionControlPoliciesOf(contract) {
|
|
113
121
|
return {
|
|
@@ -763,6 +771,36 @@ function deriveCollectionValidators(input) {
|
|
|
763
771
|
return validators;
|
|
764
772
|
}
|
|
765
773
|
/**
|
|
774
|
+
* Returns a function that accepts a list of options only when it names every member of `Option`;
|
|
775
|
+
* a list missing one fails to compile, naming the missing option.
|
|
776
|
+
*/
|
|
777
|
+
function listsEveryOption() {
|
|
778
|
+
return (options) => options;
|
|
779
|
+
}
|
|
780
|
+
/** The index options that tell two indexes on the same keys apart: every option of an index. */
|
|
781
|
+
const MONGO_INDEX_OPTION_KEYS = listsEveryOption()([
|
|
782
|
+
"unique",
|
|
783
|
+
"sparse",
|
|
784
|
+
"expireAfterSeconds",
|
|
785
|
+
"partialFilterExpression",
|
|
786
|
+
"wildcardProjection",
|
|
787
|
+
"collation",
|
|
788
|
+
"weights",
|
|
789
|
+
"default_language",
|
|
790
|
+
"language_override"
|
|
791
|
+
]);
|
|
792
|
+
/** Identifies an index by its keys and the options it sets; an option set to `false` counts as unset. No field name or option value can make two different indexes share a key. */
|
|
793
|
+
function indexLookupKey(index) {
|
|
794
|
+
const options = Object.fromEntries(MONGO_INDEX_OPTION_KEYS.flatMap((option) => {
|
|
795
|
+
const value = index[option];
|
|
796
|
+
return value === void 0 || value === null || value === false ? [] : [[option, value]];
|
|
797
|
+
}));
|
|
798
|
+
return canonicalize({
|
|
799
|
+
keys: index.keys.map((k) => [k.field, k.direction]),
|
|
800
|
+
options
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
766
804
|
* Clustered-collection options (the `clusteredIndex` collection-creation
|
|
767
805
|
* field). Lifted from a `type =` data shape to an AST class extending
|
|
768
806
|
* `IRNodeBase` per FR18.
|
|
@@ -1034,6 +1072,6 @@ function toOneRelationNullabilityError(qualifiedName, relationName, relation, mo
|
|
|
1034
1072
|
return relation.nullable ? `${location} is nullable but every local field is required (fields ${fieldList})` : `${location} is required but a local field is nullable (fields ${fieldList})`;
|
|
1035
1073
|
}
|
|
1036
1074
|
//#endregion
|
|
1037
|
-
export {
|
|
1075
|
+
export { ownFieldStoredAs as A, validatorRootShapesOf as B, isEmbedRelation as C, mongoValueSetsOf as D, mongoModelsOf as E, unsupportedStoredNameReason as F, validateMongoStorage as I, validatorEnumMemberRefusalOf as L, ownStoredNamesOf as M, resolveMongoToOneRelationFields as N, ownDocumentIdFieldOf as O, storedNamesOf as P, validatorEnumRefusalOf as R, indexLookupKey as S, mongoContractRefusalsOf as T, valueObjectStoredNamesOf as V, defaultMongoStorageNamespaceId as _, MongoStorage as a, fieldBsonTypeRefusalOf as b, applyPolymorphicScopeToMongoIndex as c, buildMongoStorage as d, canonicalize as f, defaultMongoDomainNamespaceId as g, collectionRootModelsOf as h, MongoIndexOptions as i, ownStoredNameOf as j, ownEmbedStoredNamesOf as k, buildMongoContractView as l, collectionControlPolicyOf as m, MONGO_INDEX_OPTION_KEYS as n, MongoUnboundNamespace as o, collectionControlPoliciesOf as p, MongoClusteredCollectionOptions as r, RelationKeys as s, DOCUMENT_ID as t, buildMongoNamespace as u, deriveCollectionValidators as v, modelAndBasesOf as w, hasOwnFieldStoredAs as x, documentIdRefusalReason as y, validatorFieldNamesOf as z };
|
|
1038
1076
|
|
|
1039
|
-
//# sourceMappingURL=dist-
|
|
1077
|
+
//# sourceMappingURL=dist-BPlVwyAb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-BPlVwyAb.mjs","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-contract/dist/index.mjs"],"sourcesContent":["import { t as mongoContractCanonicalizationHooks } from \"./canonicalization-hooks-CRVM-Kqh.mjs\";\nimport { _ 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-CoJfiouk.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-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. */\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; 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\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, defaultMongoStorageNamespaceId, deriveCollectionValidators, documentIdRefusalReason, fieldBsonTypeRefusalOf, hasOwnFieldStoredAs, indexLookupKey, isEmbedRelation, modelAndBasesOf, mongoContractRefusalsOf, mongoModelsOf, mongoValueSetsOf, ownDocumentIdFieldOf, ownEmbedStoredNamesOf, ownFieldStoredAs, ownStoredNameOf, ownStoredNamesOf, resolveMongoToOneRelationFields, storedNamesOf, unsupportedStoredNameReason, validateMongoStorage, validatorEnumMemberRefusalOf, validatorEnumRefusalOf, validatorFieldNamesOf, validatorRootShapesOf, valueObjectStoredNamesOf };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,wBAAwB,MAAM,8BAA8B,cAAc;CAC7E,OAAO,WAAW,IAAI,sBAAsB;CAC5C,KAAK;CACL,UAAU,OAAO,OAAO,EAAE,YAAY,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC;CACzD,cAAc;EACb,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GACnC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EACf,CAAC;EACD,WAAW,IAAI;CAChB;AACD;AAGA,MAAM,uBAAuB;AAC7B,IAAI,sBAAsB,MAAM,4BAA4B,cAAc;CACzE;CACA;CACA,OAAO,qBAAqB,OAAO;EAClC,MAAM,gBAAgB,MAAM,QAAQ;EACpC,MAAM,kBAAkB,kBAAkB,KAAK,IAAI,OAAO,KAAK,aAAa,CAAC,CAAC,SAAS;EACvF,MAAM,kBAAkB,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,MAAM,SAAS,SAAS,YAAY;EACvF,IAAI,MAAM,OAAO,wBAAwB,oBAAoB,KAAK,CAAC,iBAAiB,OAAO,sBAAsB;EACjH,OAAO,IAAI,oBAAoB,KAAK;CACrC;CACA,YAAY,OAAO;EAClB,MAAM;EACN,KAAK,KAAK,MAA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C,CAAC,KAAK,IAAI;CAC5H,OAAO,SAAS,WAAW,GAAG,SAAS,yDAAyD,UAAU,KAAK,GAAG,SAAS,qDAAqD,UAAU;AAC3L"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-BhDqnAiz.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-
|
|
1
|
+
{"version":3,"file":"dist-BhDqnAiz.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-K6G8SumZ.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\nimport { describeRemovedFieldPreset, removedPresetWithPhases, removedPresetWrittenAs } from \"@internal/psl-parser/interpret\";\n//#region src/removed-field-presets.ts\nconst MONGO_DATE_CODEC_ID = \"mongo/date@1\";\n/** The MongoDB family's removed field presets; each applies only where its rewrite's type stores a Mongo date. */\nconst removedMongoFieldPresets = {\n\t\"temporal.createdAt\": removedPresetWrittenAs(\"temporal.CreatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.updatedAt\": removedPresetWrittenAs(\"temporal.UpdatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.timestamp\": removedPresetWithPhases(\"Date\", MONGO_DATE_CODEC_ID, false)\n};\n//#endregion\n//#region src/describe-unresolved-type.ts\nconst EARLIER_MONGO_SCALAR_NAMES = {\n\tBigInt: \"Int64\",\n\tBytes: \"Binary\",\n\tDecimal: \"Decimal128\"\n};\nfunction scalarTypesSentence(types) {\n\tconst current = [...collectScalarTypeConstructors(types).keys()].filter((name) => {\n\t\tconst descriptor = types[name];\n\t\treturn !(descriptor !== void 0 && isAuthoringTypeConstructorDescriptor(descriptor) && descriptor.deprecated !== void 0);\n\t});\n\treturn current.length === 0 ? \"No Mongo scalar types are registered.\" : `The Mongo scalar types are ${current.length === 1 ? current.join(\"\") : `${current.slice(0, -1).join(\", \")} and ${current.at(-1)}`}.`;\n}\nfunction describeUnresolvedMongoType(contributions) {\n\tconst types = contributions.type;\n\tconst scalars = collectScalarTypeConstructors(types);\n\treturn ({ field, owner, written, isDeclared }) => {\n\t\tif (field.typeConstructor !== void 0) return describeRemovedFieldPreset(removedMongoFieldPresets, field, types, isDeclared);\n\t\tif (field.typeNamespaceId !== void 0) return;\n\t\tconst replacement = EARLIER_MONGO_SCALAR_NAMES[written];\n\t\tif (replacement === void 0 || !scalars.has(replacement)) return `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;\n\t\treturn `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a Mongo scalar type; use \"${replacement}\".`;\n\t};\n}\n//#endregion\nexport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAIA,MAAM,sBAAsB;;AAE5B,MAAM,2BAA2B;CAChC,sBAAsB,uBAAuB,sBAAsB,mBAAmB;CACtF,sBAAsB,uBAAuB,sBAAsB,mBAAmB;CACtF,sBAAsB,wBAAwB,QAAQ,qBAAqB,KAAK;AACjF;AAGA,MAAM,6BAA6B;CAClC,QAAQ;CACR,OAAO;CACP,SAAS;AACV;AACA,SAAS,oBAAoB,OAAO;CACnC,MAAM,UAAU,CAAC,GAAG,8BAA8B,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAS;EACjF,MAAM,aAAa,MAAM;EACzB,OAAO,EAAE,eAAe,KAAK,KAAK,qCAAqC,UAAU,KAAK,WAAW,eAAe,KAAK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