@prisma/orm-family-mongo 8.0.0-rc.18-dev.13 → 8.0.0-rc.18-dev.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{control-SoPc-6DA.d.mts → control-CFKfF3Kt.d.mts} +3 -3
  2. package/dist/{control-SoPc-6DA.d.mts.map → control-CFKfF3Kt.d.mts.map} +1 -1
  3. package/dist/{control-Yu_IYcIP.mjs → control-Dx9KcAk2.mjs} +2 -2
  4. package/dist/{control-Yu_IYcIP.mjs.map → control-Dx9KcAk2.mjs.map} +1 -1
  5. package/dist/{control-adapter-Bh_ZraGM-D3xSqwxa.d.mts → control-adapter-Bh_ZraGM-Doy155tY.d.mts} +2 -2
  6. package/dist/{control-adapter-Bh_ZraGM-D3xSqwxa.d.mts.map → control-adapter-Bh_ZraGM-Doy155tY.d.mts.map} +1 -1
  7. package/dist/control-adapter-D7n7HrIP.d.mts +1 -0
  8. package/dist/{exports-Bx-hlnZ3.mjs → exports-BAimNKOs.mjs} +31 -21
  9. package/dist/exports-BAimNKOs.mjs.map +1 -0
  10. package/dist/family.d.mts +4 -4
  11. package/dist/family.mjs +2 -2
  12. package/dist/family__control-adapter.d.mts +2 -2
  13. package/dist/family__control.d.mts +1 -1
  14. package/dist/family__control.mjs +2 -2
  15. package/dist/family__schema-verify.d.mts +1 -1
  16. package/dist/family__schema-verify.mjs +1 -1
  17. package/dist/{index-BFhyIsHU.d.mts → index-B_TBqtjg.d.mts} +7 -3
  18. package/dist/{index-BFhyIsHU.d.mts.map → index-B_TBqtjg.d.mts.map} +1 -1
  19. package/dist/schema-ir.d.mts +2 -2
  20. package/dist/schema-ir.mjs +2 -2
  21. package/dist/{schema-verify-Bzmg6whi.d.mts → schema-verify-CCSz3rlO.d.mts} +2 -2
  22. package/dist/{schema-verify-Bzmg6whi.d.mts.map → schema-verify-CCSz3rlO.d.mts.map} +1 -1
  23. package/dist/{verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs → verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs} +5 -20
  24. package/dist/verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs.map +1 -0
  25. package/package.json +20 -20
  26. package/dist/control-adapter-DriGOlGH.d.mts +0 -1
  27. package/dist/exports-Bx-hlnZ3.mjs.map +0 -1
  28. package/dist/verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { C as MongoContract, W as MongoStorageShape } from "./mongo-value-set-BngSUlOh-BhDGXjM_.mjs";
2
2
  import "./index-p1mHGKB5.mjs";
3
- import { o as MongoSchemaIR } from "./index-BFhyIsHU.mjs";
3
+ import { c as MongoSchemaIR } from "./index-B_TBqtjg.mjs";
4
4
  import { At as RawUpdateManyCommand } from "./query-plan-3fs1HokF-CrNsr-Wx.mjs";
5
5
  import "./execution-tPmN5pge.mjs";
6
- import { i as MongoRunnerDependencies } from "./control-adapter-Bh_ZraGM-D3xSqwxa.mjs";
6
+ import { i as MongoRunnerDependencies } from "./control-adapter-Bh_ZraGM-Doy155tY.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-SoPc-6DA.d.mts.map
124
+ //# sourceMappingURL=control-CFKfF3Kt.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-SoPc-6DA.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
+ {"version":3,"file":"control-CFKfF3Kt.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"}
@@ -3,7 +3,7 @@ import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from
3
3
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
4
4
  import { t as mongoEmission } from "./exports-C32AbWNp.mjs";
5
5
  import { et as RawUpdateManyCommand } from "./execution-CgP1Sdbr.mjs";
6
- import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
6
+ import { i as verifyMongoSchema } from "./verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs";
7
7
  import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-ooM-r2td-r5JwBDd-.mjs";
8
8
  import { t as MongoContractSerializer } from "./mongo-contract-serializer-5OphMWx2-DkWnm3kW.mjs";
9
9
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
@@ -493,4 +493,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
493
493
  //#endregion
494
494
  export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
495
495
 
496
- //# sourceMappingURL=control-Yu_IYcIP.mjs.map
496
+ //# sourceMappingURL=control-Dx9KcAk2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-Yu_IYcIP.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-B0bMHQW0.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-ooM-r2td.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-5OphMWx2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;;;;AAKA,SAAS,eAAe,WAAW;CAClC,MAAM,MAAM,QAAQ,IAAI,WAAW,KAAK;CACxC,IAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,GAAG,OAAO,KAAK;CACzD,MAAM,CAAC,QAAQ;CACf,MAAM,UAAU,OAAO,SAAS,YAAY,SAAS,OAAO,QAAQ,IAAI,MA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AC;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
+ {"version":3,"file":"control-Dx9KcAk2.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-BTj4mddD.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-ooM-r2td.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-5OphMWx2.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,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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,4 +1,4 @@
1
- import { o as MongoSchemaIR } from "./index-BFhyIsHU.mjs";
1
+ import { c as MongoSchemaIR } from "./index-B_TBqtjg.mjs";
2
2
  import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-4JTCKNgO.mjs";
3
3
  import { i as MongoDriver, t as MongoAdapter } from "./index-B8HcPJrE.mjs";
4
4
  import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
@@ -124,4 +124,4 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
124
124
  interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
125
125
  //#endregion
126
126
  export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
127
- //# sourceMappingURL=control-adapter-Bh_ZraGM-D3xSqwxa.d.mts.map
127
+ //# sourceMappingURL=control-adapter-Bh_ZraGM-Doy155tY.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-adapter-Bh_ZraGM-D3xSqwxa.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;;;;;;EAOrG,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,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B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
@@ -0,0 +1 @@
1
+ import "./control-adapter-Bh_ZraGM-Doy155tY.mjs";
@@ -38,25 +38,35 @@ function deepEqual(a, b) {
38
38
  }
39
39
  return false;
40
40
  }
41
- function indexesEquivalent(a, b) {
42
- if (a.keys.length !== b.keys.length) return false;
43
- for (let i = 0; i < a.keys.length; i++) {
44
- const aKey = a.keys[i];
45
- const bKey = b.keys[i];
46
- if (!aKey || !bKey) return false;
47
- if (aKey.field !== bKey.field) return false;
48
- if (aKey.direction !== bKey.direction) return false;
49
- }
50
- if (a.unique !== b.unique) return false;
51
- if (a.sparse !== b.sparse) return false;
52
- if (a.expireAfterSeconds !== b.expireAfterSeconds) return false;
53
- if (canonicalize(a.partialFilterExpression) !== canonicalize(b.partialFilterExpression)) return false;
54
- if (canonicalize(a.wildcardProjection) !== canonicalize(b.wildcardProjection)) return false;
55
- if (canonicalize(a.collation) !== canonicalize(b.collation)) return false;
56
- if (canonicalize(a.weights) !== canonicalize(b.weights)) return false;
57
- if (a.default_language !== b.default_language) return false;
58
- if (a.language_override !== b.language_override) return false;
59
- return true;
41
+ /**
42
+ * Returns a function that accepts a list of options only when it names every member of `Option`;
43
+ * a list missing one fails to compile, naming the missing option.
44
+ */
45
+ function listsEveryOption() {
46
+ return (options) => options;
47
+ }
48
+ /** The index options that tell two indexes on the same keys apart: every option of an index. */
49
+ const MONGO_INDEX_OPTION_KEYS = listsEveryOption()([
50
+ "unique",
51
+ "sparse",
52
+ "expireAfterSeconds",
53
+ "partialFilterExpression",
54
+ "wildcardProjection",
55
+ "collation",
56
+ "weights",
57
+ "default_language",
58
+ "language_override"
59
+ ]);
60
+ function keysOf(index) {
61
+ return index.keys.map((k) => `${k.field}:${k.direction}`).join(",");
62
+ }
63
+ /** Identifies an index by its keys and the options it sets; an option set to `false` counts as unset. */
64
+ function indexLookupKey(index) {
65
+ const options = MONGO_INDEX_OPTION_KEYS.flatMap((option) => {
66
+ const value = index[option];
67
+ return value === void 0 || value === null || value === false ? [] : [`${option}:${canonicalize(value)}`];
68
+ });
69
+ return options.length > 0 ? `${keysOf(index)}|${options.join(";")}` : keysOf(index);
60
70
  }
61
71
  /**
62
72
  * Every concrete Mongo schema-IR node also implements the framework's
@@ -204,6 +214,6 @@ var MongoSchemaValidator = class extends MongoSchemaIRNode {
204
214
  }
205
215
  };
206
216
  //#endregion
207
- export { MongoSchemaIndex as a, deepEqual as c, MongoSchemaIRNode as i, indexesEquivalent as l, MongoSchemaCollectionOptions as n, MongoSchemaValidator as o, MongoSchemaIR as r, canonicalize as s, MongoSchemaCollection as t };
217
+ export { MongoSchemaIRNode as a, canonicalize as c, MongoSchemaIR as i, deepEqual as l, MongoSchemaCollection as n, MongoSchemaIndex as o, MongoSchemaCollectionOptions as r, MongoSchemaValidator as s, MONGO_INDEX_OPTION_KEYS as t, indexLookupKey as u };
208
218
 
209
- //# sourceMappingURL=exports-Bx-hlnZ3.mjs.map
219
+ //# sourceMappingURL=exports-BAimNKOs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-BAimNKOs.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/mongo-schema-ir/dist/exports/index.mjs"],"sourcesContent":["import { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\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/index-equivalence.ts\n/**\n* Key-order-sensitive structural comparison. For key-order-independent\n* comparison (e.g. lookup key construction), use {@link canonicalize}.\n*/\nfunction deepEqual(a, b) {\n\tif (a === b) return true;\n\tif (a === null || b === null) return false;\n\tif (a === void 0 || b === void 0) return false;\n\tif (typeof a !== typeof b) return false;\n\tif (Array.isArray(a)) {\n\t\tif (!Array.isArray(b)) return false;\n\t\tif (a.length !== b.length) return false;\n\t\tfor (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i])) return false;\n\t\treturn true;\n\t}\n\tif (typeof a === \"object\" && typeof b === \"object\") {\n\t\tconst aObj = a;\n\t\tconst bObj = b;\n\t\tconst aKeys = Object.keys(aObj);\n\t\tconst bKeys = Object.keys(bObj);\n\t\tif (aKeys.length !== bKeys.length) return false;\n\t\tfor (let i = 0; i < aKeys.length; i++) {\n\t\t\tif (aKeys[i] !== bKeys[i]) return false;\n\t\t\tconst key = aKeys[i];\n\t\t\tif (!deepEqual(aObj[key], bObj[key])) return false;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\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]);\nfunction keysOf(index) {\n\treturn index.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n}\n/** Identifies an index by its keys and the options it sets; an option set to `false` counts as unset. */\nfunction indexLookupKey(index) {\n\tconst options = MONGO_INDEX_OPTION_KEYS.flatMap((option) => {\n\t\tconst value = index[option];\n\t\treturn value === void 0 || value === null || value === false ? [] : [`${option}:${canonicalize(value)}`];\n\t});\n\treturn options.length > 0 ? `${keysOf(index)}|${options.join(\";\")}` : keysOf(index);\n}\n//#endregion\n//#region src/schema-node.ts\n/**\n* Every concrete Mongo schema-IR node also implements the framework's\n* `DiffableNode` interface, so a node can be carried as the `expected`/\n* `actual` payload of a `SchemaDiffIssue`. Mongo's own diff (`diffMongoSchemas`)\n* still hand-rolls its comparisons and never calls `isEqualTo`/`children` —\n* this conformance exists so an issue can carry the real collection/index/\n* validator/options node it concerns, not a coordinate string.\n*\n* Follow-up: `isEqualTo`/`children` are dead weight on every Mongo node\n* (nothing calls them). The honest fix is splitting `DiffableNode` into a\n* narrower \"issue payload\" bound (just `id`) that this class implements,\n* separate from the full walkable `DiffableNode` (`id` + `isEqualTo` +\n* `children`) the generic differ actually pairs and recurses over.\n*/\nvar MongoSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/schema-collection.ts\nvar MongoSchemaCollection = class extends MongoSchemaIRNode {\n\tnodeKind = \"collection\";\n\tid;\n\tname;\n\tindexes;\n\tvalidator;\n\toptions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.name;\n\t\tthis.name = options.name;\n\t\tthis.indexes = options.indexes ?? [];\n\t\tthis.validator = options.validator;\n\t\tthis.options = options.options;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collection(this);\n\t}\n};\n//#endregion\n//#region src/schema-collection-options.ts\nvar MongoSchemaCollectionOptions = class extends MongoSchemaIRNode {\n\tnodeKind = \"collectionOptions\";\n\t/** Fixed sentinel: at most one options node exists per collection. */\n\tid = \"options\";\n\tcapped;\n\ttimeseries;\n\tcollation;\n\tchangeStreamPreAndPostImages;\n\tclusteredIndex;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.capped = options.capped;\n\t\tthis.timeseries = options.timeseries;\n\t\tthis.collation = options.collation;\n\t\tthis.changeStreamPreAndPostImages = options.changeStreamPreAndPostImages;\n\t\tthis.clusteredIndex = options.clusteredIndex;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collectionOptions(this);\n\t}\n};\n//#endregion\n//#region src/schema-index.ts\nvar MongoSchemaIndex = class extends MongoSchemaIRNode {\n\tnodeKind = \"index\";\n\tid;\n\tkeys;\n\tunique;\n\tsparse;\n\texpireAfterSeconds;\n\tpartialFilterExpression;\n\twildcardProjection;\n\tcollation;\n\tweights;\n\tdefault_language;\n\tlanguage_override;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\t\tthis.keys = options.keys;\n\t\tthis.unique = options.unique ?? false;\n\t\tthis.sparse = options.sparse;\n\t\tthis.expireAfterSeconds = options.expireAfterSeconds;\n\t\tthis.partialFilterExpression = options.partialFilterExpression;\n\t\tthis.wildcardProjection = options.wildcardProjection;\n\t\tthis.collation = options.collation;\n\t\tthis.weights = options.weights;\n\t\tthis.default_language = options.default_language;\n\t\tthis.language_override = options.language_override;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.index(this);\n\t}\n};\n//#endregion\n//#region src/schema-ir.ts\nvar MongoSchemaIR = class extends MongoSchemaIRNode {\n\tnodeKind = \"schema\";\n\t/** Fixed sentinel: the schema is always the diff tree's single root. */\n\tid = \"schema\";\n\tcollections;\n\tcollectionNames;\n\t_byName;\n\tconstructor(collections) {\n\t\tsuper();\n\t\tconst sorted = [...collections].sort((a, b) => a.name.localeCompare(b.name));\n\t\tthis.collections = sorted;\n\t\tthis._byName = new Map(sorted.map((c) => [c.name, c]));\n\t\tthis.collectionNames = sorted.map((c) => c.name);\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.schema(this);\n\t}\n\tcollection(name) {\n\t\treturn this._byName.get(name);\n\t}\n};\n//#endregion\n//#region src/schema-validator.ts\nvar MongoSchemaValidator = class extends MongoSchemaIRNode {\n\tnodeKind = \"validator\";\n\t/** Fixed sentinel: at most one validator exists per collection. */\n\tid = \"validator\";\n\tjsonSchema;\n\tvalidationLevel;\n\tvalidationAction;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.jsonSchema = options.jsonSchema;\n\t\tthis.validationLevel = options.validationLevel;\n\t\tthis.validationAction = options.validationAction;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.validator(this);\n\t}\n};\n//#endregion\nexport { MONGO_INDEX_OPTION_KEYS, MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexLookupKey };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;AAEA,SAAS,aAAa,KAAK;CAC1B,IAAI,QAAQ,MAAM,OAAO;CACzB,IAAI,QAAQ,KAAK,GAAG,OAAO;CAC3B,IAAI,OAAO,QAAQ,UAAU,OAAO,KAAK,UAAU,GAAG;CACtD,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE;CACnE,MAAM,SAAS;CACf,OAAO,IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,aAAa,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;AAC/G;;;;;AAOA,SAAS,UAAU,GAAG,GAAG;CACxB,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO;CACrC,IAAI,MAAM,KAAK,KAAK,MAAM,KAAK,GAAG,OAAO;CACzC,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAClC,IAAI,MAAM,QAAQ,CAAC,GAAG;EACrB,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO;EAC9B,IAAI,EAAE,WAAW,EAAE,QAAQ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,YAAY,QAAQ;EACzB,KAAK,UAAU,QAAQ;EACvB,KAAK,mBAAmB,QAAQ;EAChC,KAAK,oBAAoB,QAAQ;EACjC,WAAW,IAAI;CAChB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,MAAM,IAAI;CAC1B;AACD;AAGA,IAAI,gBAAgB,cAAc,kBAAkB;CACnD,WAAW;;CAEX,KAAK;CACL;CACA;CACA;CACA,YAAY,aAAa;EACxB,MAAM;EACN,MAAM,SAAS,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;EAC3E,KAAK,cAAc;EACnB,KAAK,UAAU,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACrD,KAAK,kBAAkB,OAAO,KAAK,MAAM,EAAE,IAAI;EAC/C,WAAW,IAAI;CAChB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,OAAO,IAAI;CAC3B;CACA,WAAW,MAAM;EAChB,OAAO,KAAK,QAAQ,IAAI,IAAI;CAC7B;AACD;AAGA,IAAI,uBAAuB,cAAc,kBAAkB;CAC1D,WAAW;;CAEX,KAAK;CACL;CACA;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,aAAa,QAAQ;EAC1B,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,mBAAmB,QAAQ;EAChC,WAAW,IAAI;CAChB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD"}
package/dist/family.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { D as defaultMongoDomainNamespaceId, O as defaultMongoStorageNamespaceId } from "./index-p1mHGKB5.mjs";
2
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-D3xSqwxa.mjs";
3
- import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-SoPc-6DA.mjs";
4
- import "./control-adapter-DriGOlGH.mjs";
2
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-Doy155tY.mjs";
3
+ import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-CFKfF3Kt.mjs";
4
+ import "./control-adapter-D7n7HrIP.mjs";
5
5
  import { t as MongoContractView$1 } from "./mongo-contract-view-AnejqfrQ-CXymmojn.mjs";
6
6
  import { n as MongoContractSerializerBase, r as MongoSchemaVerifierBase, t as MongoContractSerializer } from "./ir-Cs8SNS0n.mjs";
7
7
  import { t as MongoMigration } from "./migration-DMXCxDu-.mjs";
8
8
  import { r as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./pack-CgZhQ0_G.mjs";
9
9
  import { t as timestampNowRuntimeGenerator } from "./runtime-CQUQkK0P.mjs";
10
- import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-Bzmg6whi.mjs";
10
+ import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-CCSz3rlO.mjs";
11
11
  export { type FieldRewrite, type MarkerOperations, MongoMigration as Migration, MongoContractSerializer, MongoContractSerializerBase, MongoContractView$1 as MongoContractView, type MongoControlAdapter, type MongoControlAdapterDescriptor, type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, type MongoRunnerDependencies, MongoSchemaVerifierBase, type VerifyMongoSchemaOptions, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, defaultMongoDomainNamespaceId, defaultMongoStorageNamespaceId, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoFamilyEntityTypes, mongoFamilyPslBlockDescriptors, mongoOperationsToPreview, timestampNowRuntimeGenerator, verifyMongoSchema };
package/dist/family.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { d as defaultMongoStorageNamespaceId, u as defaultMongoDomainNamespaceId } from "./dist-BbfUvuqQ.mjs";
2
- import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
2
+ import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs";
3
3
  import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-ooM-r2td-r5JwBDd-.mjs";
4
4
  import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-5OphMWx2-DkWnm3kW.mjs";
5
- import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-Yu_IYcIP.mjs";
5
+ import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-Dx9KcAk2.mjs";
6
6
  import { t as MongoContractView$1 } from "./mongo-contract-view-OSrxTeL0-IBirxnYy.mjs";
7
7
  import { t as MongoSchemaVerifierBase } from "./ir-vZWjElPY.mjs";
8
8
  import { t as MongoMigration } from "./migration-Bd8GWTeP.mjs";
@@ -1,3 +1,3 @@
1
- import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-D3xSqwxa.mjs";
2
- import "./control-adapter-DriGOlGH.mjs";
1
+ import { i as MongoRunnerDependencies, n as MongoControlAdapter, r as MongoControlAdapterDescriptor, t as MarkerOperations } from "./control-adapter-Bh_ZraGM-Doy155tY.mjs";
2
+ import "./control-adapter-D7n7HrIP.mjs";
3
3
  export type { MarkerOperations, MongoControlAdapter, MongoControlAdapterDescriptor, MongoRunnerDependencies };
@@ -1,2 +1,2 @@
1
- import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-SoPc-6DA.mjs";
1
+ import { a as canonicalizeSchemasForVerification, c as diffMongoSchemas, d as mongoFamilyDescriptor, f as mongoOperationsToPreview, i as MongoControlTargetDescriptor, l as fieldRewriteOf, n as MongoControlExtensionDescriptor, o as contractToMongoSchemaIR, r as MongoControlFamilyInstance, s as createMongoFamilyInstance, t as FieldRewrite, u as formatMongoOperations } from "./control-CFKfF3Kt.mjs";
2
2
  export { type FieldRewrite, type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,3 +1,3 @@
1
- import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
2
- import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-Yu_IYcIP.mjs";
1
+ import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs";
2
+ import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-Dx9KcAk2.mjs";
3
3
  export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,2 +1,2 @@
1
- import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-Bzmg6whi.mjs";
1
+ import { n as verifyMongoSchema, t as VerifyMongoSchemaOptions } from "./schema-verify-CCSz3rlO.mjs";
2
2
  export { type VerifyMongoSchemaOptions, verifyMongoSchema };
@@ -1,2 +1,2 @@
1
- import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
1
+ import { i as verifyMongoSchema } from "./verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs";
2
2
  export { verifyMongoSchema };
@@ -169,10 +169,14 @@ declare class MongoSchemaIndex extends MongoSchemaIRNode {
169
169
  * comparison (e.g. lookup key construction), use {@link canonicalize}.
170
170
  */
171
171
  declare function deepEqual(a: unknown, b: unknown): boolean;
172
- declare function indexesEquivalent(a: MongoSchemaIndex, b: MongoSchemaIndex): boolean;
172
+ /** The index options that tell two indexes on the same keys apart: every option of an index. */
173
+ declare const MONGO_INDEX_OPTION_KEYS: readonly ["unique", "sparse", "expireAfterSeconds", "partialFilterExpression", "wildcardProjection", "collation", "weights", "default_language", "language_override"];
174
+ type MongoIndexOptionKey = (typeof MONGO_INDEX_OPTION_KEYS)[number];
175
+ /** Identifies an index by its keys and the options it sets; an option set to `false` counts as unset. */
176
+ declare function indexLookupKey(index: MongoSchemaIndex): string;
173
177
  //#endregion
174
178
  //#region src/types.d.ts
175
179
  type AnyMongoSchemaNode = MongoSchemaIR | MongoSchemaCollection | MongoSchemaCollectionOptions | MongoSchemaIndex | MongoSchemaValidator;
176
180
  //#endregion
177
- export { MongoSchemaCollectionOptionsInput as a, MongoSchemaIndex as c, MongoSchemaValidatorOptions as d, MongoSchemaVisitor as f, indexesEquivalent as h, MongoSchemaCollectionOptions as i, MongoSchemaIndexOptions as l, deepEqual as m, MongoSchemaCollection as n, MongoSchemaIR as o, canonicalize as p, MongoSchemaCollectionCtorOptions as r, MongoSchemaIRNode as s, AnyMongoSchemaNode as t, MongoSchemaValidator as u };
178
- //# sourceMappingURL=index-BFhyIsHU.d.mts.map
181
+ export { indexLookupKey as _, MongoSchemaCollectionCtorOptions as a, MongoSchemaIR as c, MongoSchemaIndexOptions as d, MongoSchemaValidator as f, deepEqual as g, canonicalize as h, MongoSchemaCollection as i, MongoSchemaIRNode as l, MongoSchemaVisitor as m, MONGO_INDEX_OPTION_KEYS as n, MongoSchemaCollectionOptions as o, MongoSchemaValidatorOptions as p, MongoIndexOptionKey as r, MongoSchemaCollectionOptionsInput as s, AnyMongoSchemaNode as t, MongoSchemaIndex as u };
182
+ //# sourceMappingURL=index-B_TBqtjg.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BFhyIsHU.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/mongo-schema-ir/dist/exports/index.d.mts"],"mappings":";;;;;;;iBAKiB,aAAa;;;UAGpB;WACC;IACP;IACA;;WAEO;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;IACP;;;cAGU,qCAAqC;WACxC;;WAEA;WACA;IACP;IACA;;WAEO;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;IACP;;EAEF,YAAY,SAAS;EACrB,OAAO,GAAG,SAAS,mBAAmB,KAAK;;;;UAInC;WACC,YAAY;WACZ;WACA;;cAEG,6BAA6B;WAChC;;WAEA;WACA,YAAY;WACZ;WACA;EACT,YAAY,SAAS;EACrB,OAAO,GAAG,SAAS,mBAAmB,KAAK;;;;UAInC;WACC;WACA,UAAU,cAAc;WACxB,YAAY;WACZ,UAAU;;cAEP,8BAA8B;WACjC;WACA;WACA;WACA,SAAS,cAAc;WACvB,YAAY;WACZ,UAAU;EACnB,YAAY,SAAS;EACrB,OAAO,GAAG,SAAS,mBAAmB,KAAK;;;;cAI/B,sBAAsB;WACzB;;WAEA;WACA,aAAa,cAAc;WAC3B,iBAAiB;mBACT;EACjB,YAAY,aAAa,cAAc;EACvC,OAAO,GAAG,SAAS,mBAAmB,KAAK;EAC3C,WAAW,eAAe;;;;UAIlB,mBAAmB;EAC3B,OAAO,MAAM,gBAAgB;EAC7B,WAAW,MAAM,wBAAwB;EACzC,MAAM,MAAM,mBAAmB;EAC/B,UAAU,MAAM,uBAAuB;EACvC,kBAAkB,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;uBAkBlC,0BAA0B,sBAAsB;WAC5D;oBACS;;oBAEA;WACT,OAAO,GAAG,SAAS,mBAAmB,KAAK;EACpD;EACA,UAAU,OAAO;EACjB,qBAAqB;;;;UAIb;WACC,MAAM,cAAc;WACpB;WACA;WACA;WACA,0BAA0B;WAC1B,qBAAqB;WACrB,YAAY;WACZ,UAAU;WACV;WACA;;cAEG,yBAAyB;WAC5B;WACA;WACA,MAAM,cAAc;WACpB;WACA;WACA;WACA,0BAA0B;WAC1B,qBAAqB;WACrB,YAAY;WACZ,UAAU;WACV;WACA;EACT,YAAY,SAAS;EACrB,OAAO,GAAG,SAAS,mBAAmB,KAAK;;;;;;;;iBAQ5B,UAAU,YAAY;iBACtB,kBAAkB,GAAG,kBAAkB,GAAG;;;KAGtD,qBAAqB,gBAAgB,wBAAwB,+BAA+B,mBAAmB"}
1
+ {"version":3,"file":"index-B_TBqtjg.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/mongo-schema-ir/dist/exports/index.d.mts"],"mappings":";;;;;;;iBAKiB,aAAa;;;UAGpB;WACC;IACP;IACA;;WAEO;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;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BAQ5B,UAAU,YAAY;;cAEzB;KACT,8BAA8B;;iBAElB,eAAe,OAAO;;;KAGlC,qBAAqB,gBAAgB,wBAAwB,+BAA+B,mBAAmB"}
@@ -1,2 +1,2 @@
1
- import { a as MongoSchemaCollectionOptionsInput, c as MongoSchemaIndex, d as MongoSchemaValidatorOptions, f as MongoSchemaVisitor, h as indexesEquivalent, i as MongoSchemaCollectionOptions, l as MongoSchemaIndexOptions, m as deepEqual, n as MongoSchemaCollection, o as MongoSchemaIR, p as canonicalize, r as MongoSchemaCollectionCtorOptions, s as MongoSchemaIRNode, t as AnyMongoSchemaNode, u as MongoSchemaValidator } from "./index-BFhyIsHU.mjs";
2
- export { type AnyMongoSchemaNode, MongoSchemaCollection, type MongoSchemaCollectionCtorOptions, MongoSchemaCollectionOptions, type MongoSchemaCollectionOptionsInput, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, type MongoSchemaIndexOptions, MongoSchemaValidator, type MongoSchemaValidatorOptions, type MongoSchemaVisitor, canonicalize, deepEqual, indexesEquivalent };
1
+ import { _ as indexLookupKey, a as MongoSchemaCollectionCtorOptions, c as MongoSchemaIR, d as MongoSchemaIndexOptions, f as MongoSchemaValidator, g as deepEqual, h as canonicalize, i as MongoSchemaCollection, l as MongoSchemaIRNode, m as MongoSchemaVisitor, n as MONGO_INDEX_OPTION_KEYS, o as MongoSchemaCollectionOptions, p as MongoSchemaValidatorOptions, r as MongoIndexOptionKey, s as MongoSchemaCollectionOptionsInput, t as AnyMongoSchemaNode, u as MongoSchemaIndex } from "./index-B_TBqtjg.mjs";
2
+ export { type AnyMongoSchemaNode, MONGO_INDEX_OPTION_KEYS, type MongoIndexOptionKey, MongoSchemaCollection, type MongoSchemaCollectionCtorOptions, MongoSchemaCollectionOptions, type MongoSchemaCollectionOptionsInput, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, type MongoSchemaIndexOptions, MongoSchemaValidator, type MongoSchemaValidatorOptions, type MongoSchemaVisitor, canonicalize, deepEqual, indexLookupKey };
@@ -1,2 +1,2 @@
1
- import { a as MongoSchemaIndex, c as deepEqual, i as MongoSchemaIRNode, l as indexesEquivalent, n as MongoSchemaCollectionOptions, o as MongoSchemaValidator, r as MongoSchemaIR, s as canonicalize, t as MongoSchemaCollection } from "./exports-Bx-hlnZ3.mjs";
2
- export { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexesEquivalent };
1
+ import { a as MongoSchemaIRNode, c as canonicalize, i as MongoSchemaIR, l as deepEqual, n as MongoSchemaCollection, o as MongoSchemaIndex, r as MongoSchemaCollectionOptions, s as MongoSchemaValidator, t as MONGO_INDEX_OPTION_KEYS, u as indexLookupKey } from "./exports-BAimNKOs.mjs";
2
+ export { MONGO_INDEX_OPTION_KEYS, MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexLookupKey };
@@ -1,6 +1,6 @@
1
1
  import { C as MongoContract } from "./mongo-value-set-BngSUlOh-BhDGXjM_.mjs";
2
2
  import "./index-p1mHGKB5.mjs";
3
- import { o as MongoSchemaIR } from "./index-BFhyIsHU.mjs";
3
+ import { c as MongoSchemaIR } from "./index-B_TBqtjg.mjs";
4
4
  import { OperationContext, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
5
5
  import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
6
6
  //#region ../../../2-mongo-family/9-family/dist/schema-verify.d.mts
@@ -20,4 +20,4 @@ interface VerifyMongoSchemaOptions {
20
20
  declare function verifyMongoSchema(options: VerifyMongoSchemaOptions): VerifyDatabaseSchemaResult;
21
21
  //#endregion
22
22
  export { verifyMongoSchema as n, VerifyMongoSchemaOptions as t };
23
- //# sourceMappingURL=schema-verify-Bzmg6whi.d.mts.map
23
+ //# sourceMappingURL=schema-verify-CCSz3rlO.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-verify-Bzmg6whi.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/schema-verify.d.mts"],"mappings":";;;;;;;UAKU;WACC,UAAU;WACV,QAAQ;WACR;WACA,UAAU;;;;;;WAMV,qBAAqB,cAAc;;iBAE7B,kBAAkB,SAAS,2BAA2B"}
1
+ {"version":3,"file":"schema-verify-CCSz3rlO.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/schema-verify.d.mts"],"mappings":";;;;;;;UAKU;WACC,UAAU;WACV,QAAQ;WACR;WACA,UAAU;;;;;;WAMV,qBAAqB,cAAc;;iBAE7B,kBAAkB,SAAS,2BAA2B"}
@@ -1,11 +1,11 @@
1
- import { a as MongoSchemaIndex, c as deepEqual, n as MongoSchemaCollectionOptions, o as MongoSchemaValidator, r as MongoSchemaIR, s as canonicalize, t as MongoSchemaCollection } from "./exports-Bx-hlnZ3.mjs";
1
+ import { c as canonicalize, i as MongoSchemaIR, l as deepEqual, n as MongoSchemaCollection, o as MongoSchemaIndex, r as MongoSchemaCollectionOptions, s as MongoSchemaValidator, u as indexLookupKey } from "./exports-BAimNKOs.mjs";
2
2
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
3
3
  import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
5
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
7
  import { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from "@prisma/orm-framework/components/control";
8
- //#region ../../../2-mongo-family/9-family/dist/verify-mongo-schema-B0bMHQW0.mjs
8
+ //#region ../../../2-mongo-family/9-family/dist/verify-mongo-schema-BTj4mddD.mjs
9
9
  function convertIndex(index) {
10
10
  return new MongoSchemaIndex({
11
11
  keys: index.keys,
@@ -147,29 +147,14 @@ function diffMongoSchemas(live, expected, strict, collectionControlPolicy) {
147
147
  warnings
148
148
  };
149
149
  }
150
- function buildIndexLookupKey(index) {
151
- const keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(",");
152
- const opts = [
153
- index.unique ? "unique" : "",
154
- index.sparse ? "sparse" : "",
155
- index.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : "",
156
- index.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : "",
157
- index.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : "",
158
- index.collation ? `col:${canonicalize(index.collation)}` : "",
159
- index.weights ? `wt:${canonicalize(index.weights)}` : "",
160
- index.default_language ? `dl:${index.default_language}` : "",
161
- index.language_override ? `lo:${index.language_override}` : ""
162
- ].filter(Boolean).join(";");
163
- return opts ? `${keys}|${opts}` : keys;
164
- }
165
150
  function formatIndexName(index) {
166
151
  return index.keys.map((k) => `${k.field}:${k.direction}`).join(", ");
167
152
  }
168
153
  function diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {
169
154
  const liveLookup = /* @__PURE__ */ new Map();
170
- for (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);
155
+ for (const idx of live.indexes) liveLookup.set(indexLookupKey(idx), idx);
171
156
  const expectedLookup = /* @__PURE__ */ new Map();
172
- for (const idx of expected.indexes) expectedLookup.set(buildIndexLookupKey(idx), idx);
157
+ for (const idx of expected.indexes) expectedLookup.set(indexLookupKey(idx), idx);
173
158
  for (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
174
159
  path: [collName, `index:${formatIndexName(idx)}`],
175
160
  expected: idx
@@ -444,4 +429,4 @@ function resolveMongoCollectionControlPolicy(contract) {
444
429
  //#endregion
445
430
  export { verifyMongoSchema as i, contractToMongoSchemaIR as n, diffMongoSchemas as r, canonicalizeSchemasForVerification as t };
446
431
 
447
- //# sourceMappingURL=verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs.map
432
+ //# sourceMappingURL=verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-mongo-schema-BTj4mddD-C6v0IjFl.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-BTj4mddD.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexLookupKey } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([]);\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections);\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction formatIndexName(index) {\n\treturn index.keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(indexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(indexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\texpected: idx\n\t}, \"fail\", failures, warnings);\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive),\n\t\texpected: new MongoSchemaIR(canonicalExpected)\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", index.weights),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t});\n}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We deliberately match by the\n* *projected* (contract-shaped) key list — so a live `_fts/_ftsx` index\n* resolves to a contract `{title: 'text', body: 'text'}` index — and pick\n* the first match. Contracts very rarely contain duplicate-key indexes; if\n* we have no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeySig = sortTextKeys(projectTextIndexKeys(liveIndex)).map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tfor (const expected of expectedIndexes) if (sortTextKeys(expected.keys).map((k) => `${k.field}:${k.direction}`).join(\",\") === liveKeySig) return expected;\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst collections = contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.collection ?? {};\n\tconst defaultControlPolicy = contract.defaultControlPolicy;\n\treturn (collectionName) => effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-BTj4mddD.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,OAAO;CAC5B,OAAO,IAAI,iBAAiB;EAC3B,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,oBAAoB,MAAM;EAC1B,yBAAyB,MAAM;EAC/B,oBAAoB,MAAM;EAC1B,WAAW,MAAM;EACjB,SAAS,MAAM;EACf,kBAAkB,MAAM;EACxB,mBAAmB,MAAM;CAC1B,CAAC;AACF;AACA,SAAS,iBAAiB,GAAG;CAC5B,OAAO,IAAI,qBAAqB;EAC/B,YAAY,EAAE;EACd,iBAAiB,EAAE;EACnB,kBAAkB,EAAE;CACrB,CAAC;AACF;AACA,SAAS,eAAe,GAAG;CAC1B,OAAO,IAAI,6BAA6B;EACvC,GAAG,UAAU,UAAU,EAAE,WAAW,KAAK,IAAI;GAC5C,MAAM,EAAE,OAAO;GACf,GAAG,UAAU,OAAO,EAAE,OAAO,GAAG;EACjC,IAAI,KAAK,CAAC;EACV,GAAG,EAAE,eAAe,KAAK,IAAI,EAAE,YAAY;GAC1C,WAAW,EAAE,WAAW;GACxB,GAAG,UAAU,aAAa,EAAE,WAAW,SAAS;GAChD,GAAG,UAAU,eAAe,EAAE,WAAW,WAAW;EACrD,E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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.18-dev.13",
3
+ "version": "8.0.0-rc.18-dev.15",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,30 +9,30 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.18-dev.13",
13
- "@prisma/orm-toolchain": "8.0.0-rc.18-dev.13",
12
+ "@prisma/orm-framework": "8.0.0-rc.18-dev.15",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.18-dev.15",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/family-mongo": "8.0.0-rc.18-dev.13",
20
- "@internal/mongo-codec": "8.0.0-rc.18-dev.13",
21
- "@internal/mongo-contract": "8.0.0-rc.18-dev.13",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.13",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.18-dev.13",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.18-dev.13",
25
- "@internal/mongo-emitter": "8.0.0-rc.18-dev.13",
26
- "@internal/mongo-lowering": "8.0.0-rc.18-dev.13",
27
- "@internal/mongo-orm": "8.0.0-rc.18-dev.13",
28
- "@internal/mongo-query-ast": "8.0.0-rc.18-dev.13",
29
- "@internal/mongo-query-builder": "8.0.0-rc.18-dev.13",
30
- "@internal/mongo-runtime": "8.0.0-rc.18-dev.13",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.18-dev.13",
32
- "@internal/mongo-value": "8.0.0-rc.18-dev.13",
33
- "@internal/mongo-wire": "8.0.0-rc.18-dev.13",
34
- "@repo/tsconfig": "8.0.0-rc.18-dev.13",
35
- "@repo/tsdown": "8.0.0-rc.18-dev.13",
19
+ "@internal/family-mongo": "8.0.0-rc.18-dev.15",
20
+ "@internal/mongo-codec": "8.0.0-rc.18-dev.15",
21
+ "@internal/mongo-contract": "8.0.0-rc.18-dev.15",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.15",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.18-dev.15",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.18-dev.15",
25
+ "@internal/mongo-emitter": "8.0.0-rc.18-dev.15",
26
+ "@internal/mongo-lowering": "8.0.0-rc.18-dev.15",
27
+ "@internal/mongo-orm": "8.0.0-rc.18-dev.15",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.18-dev.15",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.18-dev.15",
30
+ "@internal/mongo-runtime": "8.0.0-rc.18-dev.15",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.18-dev.15",
32
+ "@internal/mongo-value": "8.0.0-rc.18-dev.15",
33
+ "@internal/mongo-wire": "8.0.0-rc.18-dev.15",
34
+ "@repo/tsconfig": "8.0.0-rc.18-dev.15",
35
+ "@repo/tsdown": "8.0.0-rc.18-dev.15",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- import "./control-adapter-Bh_ZraGM-D3xSqwxa.mjs";
@@ -1 +0,0 @@
1
- {"version":3,"file":"exports-Bx-hlnZ3.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/mongo-schema-ir/dist/exports/index.mjs"],"sourcesContent":["import { IRNodeBase, freezeNode } from \"@internal/framework-components/ir\";\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/index-equivalence.ts\n/**\n* Key-order-sensitive structural comparison. For key-order-independent\n* comparison (e.g. lookup key construction), use {@link canonicalize}.\n*/\nfunction deepEqual(a, b) {\n\tif (a === b) return true;\n\tif (a === null || b === null) return false;\n\tif (a === void 0 || b === void 0) return false;\n\tif (typeof a !== typeof b) return false;\n\tif (Array.isArray(a)) {\n\t\tif (!Array.isArray(b)) return false;\n\t\tif (a.length !== b.length) return false;\n\t\tfor (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i])) return false;\n\t\treturn true;\n\t}\n\tif (typeof a === \"object\" && typeof b === \"object\") {\n\t\tconst aObj = a;\n\t\tconst bObj = b;\n\t\tconst aKeys = Object.keys(aObj);\n\t\tconst bKeys = Object.keys(bObj);\n\t\tif (aKeys.length !== bKeys.length) return false;\n\t\tfor (let i = 0; i < aKeys.length; i++) {\n\t\t\tif (aKeys[i] !== bKeys[i]) return false;\n\t\t\tconst key = aKeys[i];\n\t\t\tif (!deepEqual(aObj[key], bObj[key])) return false;\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n}\nfunction indexesEquivalent(a, b) {\n\tif (a.keys.length !== b.keys.length) return false;\n\tfor (let i = 0; i < a.keys.length; i++) {\n\t\tconst aKey = a.keys[i];\n\t\tconst bKey = b.keys[i];\n\t\tif (!aKey || !bKey) return false;\n\t\tif (aKey.field !== bKey.field) return false;\n\t\tif (aKey.direction !== bKey.direction) return false;\n\t}\n\tif (a.unique !== b.unique) return false;\n\tif (a.sparse !== b.sparse) return false;\n\tif (a.expireAfterSeconds !== b.expireAfterSeconds) return false;\n\tif (canonicalize(a.partialFilterExpression) !== canonicalize(b.partialFilterExpression)) return false;\n\tif (canonicalize(a.wildcardProjection) !== canonicalize(b.wildcardProjection)) return false;\n\tif (canonicalize(a.collation) !== canonicalize(b.collation)) return false;\n\tif (canonicalize(a.weights) !== canonicalize(b.weights)) return false;\n\tif (a.default_language !== b.default_language) return false;\n\tif (a.language_override !== b.language_override) return false;\n\treturn true;\n}\n//#endregion\n//#region src/schema-node.ts\n/**\n* Every concrete Mongo schema-IR node also implements the framework's\n* `DiffableNode` interface, so a node can be carried as the `expected`/\n* `actual` payload of a `SchemaDiffIssue`. Mongo's own diff (`diffMongoSchemas`)\n* still hand-rolls its comparisons and never calls `isEqualTo`/`children` —\n* this conformance exists so an issue can carry the real collection/index/\n* validator/options node it concerns, not a coordinate string.\n*\n* Follow-up: `isEqualTo`/`children` are dead weight on every Mongo node\n* (nothing calls them). The honest fix is splitting `DiffableNode` into a\n* narrower \"issue payload\" bound (just `id`) that this class implements,\n* separate from the full walkable `DiffableNode` (`id` + `isEqualTo` +\n* `children`) the generic differ actually pairs and recurses over.\n*/\nvar MongoSchemaIRNode = class extends IRNodeBase {\n\tconstructor() {\n\t\tsuper();\n\t\tObject.defineProperty(this, \"kind\", {\n\t\t\tvalue: \"mongo-schema-ir\",\n\t\t\twritable: false,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false\n\t\t});\n\t}\n\tisEqualTo(other) {\n\t\treturn this.id === other.id;\n\t}\n\tchildren() {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/schema-collection.ts\nvar MongoSchemaCollection = class extends MongoSchemaIRNode {\n\tnodeKind = \"collection\";\n\tid;\n\tname;\n\tindexes;\n\tvalidator;\n\toptions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.name;\n\t\tthis.name = options.name;\n\t\tthis.indexes = options.indexes ?? [];\n\t\tthis.validator = options.validator;\n\t\tthis.options = options.options;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collection(this);\n\t}\n};\n//#endregion\n//#region src/schema-collection-options.ts\nvar MongoSchemaCollectionOptions = class extends MongoSchemaIRNode {\n\tnodeKind = \"collectionOptions\";\n\t/** Fixed sentinel: at most one options node exists per collection. */\n\tid = \"options\";\n\tcapped;\n\ttimeseries;\n\tcollation;\n\tchangeStreamPreAndPostImages;\n\tclusteredIndex;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.capped = options.capped;\n\t\tthis.timeseries = options.timeseries;\n\t\tthis.collation = options.collation;\n\t\tthis.changeStreamPreAndPostImages = options.changeStreamPreAndPostImages;\n\t\tthis.clusteredIndex = options.clusteredIndex;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.collectionOptions(this);\n\t}\n};\n//#endregion\n//#region src/schema-index.ts\nvar MongoSchemaIndex = class extends MongoSchemaIRNode {\n\tnodeKind = \"index\";\n\tid;\n\tkeys;\n\tunique;\n\tsparse;\n\texpireAfterSeconds;\n\tpartialFilterExpression;\n\twildcardProjection;\n\tcollation;\n\tweights;\n\tdefault_language;\n\tlanguage_override;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.id = options.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\t\tthis.keys = options.keys;\n\t\tthis.unique = options.unique ?? false;\n\t\tthis.sparse = options.sparse;\n\t\tthis.expireAfterSeconds = options.expireAfterSeconds;\n\t\tthis.partialFilterExpression = options.partialFilterExpression;\n\t\tthis.wildcardProjection = options.wildcardProjection;\n\t\tthis.collation = options.collation;\n\t\tthis.weights = options.weights;\n\t\tthis.default_language = options.default_language;\n\t\tthis.language_override = options.language_override;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.index(this);\n\t}\n};\n//#endregion\n//#region src/schema-ir.ts\nvar MongoSchemaIR = class extends MongoSchemaIRNode {\n\tnodeKind = \"schema\";\n\t/** Fixed sentinel: the schema is always the diff tree's single root. */\n\tid = \"schema\";\n\tcollections;\n\tcollectionNames;\n\t_byName;\n\tconstructor(collections) {\n\t\tsuper();\n\t\tconst sorted = [...collections].sort((a, b) => a.name.localeCompare(b.name));\n\t\tthis.collections = sorted;\n\t\tthis._byName = new Map(sorted.map((c) => [c.name, c]));\n\t\tthis.collectionNames = sorted.map((c) => c.name);\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.schema(this);\n\t}\n\tcollection(name) {\n\t\treturn this._byName.get(name);\n\t}\n};\n//#endregion\n//#region src/schema-validator.ts\nvar MongoSchemaValidator = class extends MongoSchemaIRNode {\n\tnodeKind = \"validator\";\n\t/** Fixed sentinel: at most one validator exists per collection. */\n\tid = \"validator\";\n\tjsonSchema;\n\tvalidationLevel;\n\tvalidationAction;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.jsonSchema = options.jsonSchema;\n\t\tthis.validationLevel = options.validationLevel;\n\t\tthis.validationAction = options.validationAction;\n\t\tfreezeNode(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.validator(this);\n\t}\n};\n//#endregion\nexport { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual, indexesEquivalent };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;AAEA,SAAS,aAAa,KAAK;CAC1B,IAAI,QAAQ,MAAM,OAAO;CACzB,IAAI,QAAQ,KAAK,GAAG,OAAO;CAC3B,IAAI,OAAO,QAAQ,UAAU,OAAO,KAAK,UAAU,GAAG;CACtD,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,IAAI,IAAI,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE;CACnE,MAAM,SAAS;CACf,OAAO,IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,MAAM,GAAG,KAAK,UAAU,CAAC,EAAE,GAAG,aAAa,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;AAC/G;;;;;AAOA,SAAS,UAAU,GAAG,GAAG;CACxB,IAAI,MAAM,GAAG,OAAO;CACpB,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO;CACrC,IAAI,MAAM,KAAK,KAAK,MAAM,KAAK,GAAG,OAAO;CACzC,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAClC,IAAI,MAAM,QAAQ,CAAC,GAAG;EACrB,IAA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I;CAChB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-B0bMHQW0.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([]);\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections);\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction buildIndexLookupKey(index) {\n\tconst keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tconst opts = [\n\t\tindex.unique ? \"unique\" : \"\",\n\t\tindex.sparse ? \"sparse\" : \"\",\n\t\tindex.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : \"\",\n\t\tindex.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : \"\",\n\t\tindex.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : \"\",\n\t\tindex.collation ? `col:${canonicalize(index.collation)}` : \"\",\n\t\tindex.weights ? `wt:${canonicalize(index.weights)}` : \"\",\n\t\tindex.default_language ? `dl:${index.default_language}` : \"\",\n\t\tindex.language_override ? `lo:${index.language_override}` : \"\"\n\t].filter(Boolean).join(\";\");\n\treturn opts ? `${keys}|${opts}` : keys;\n}\nfunction formatIndexName(index) {\n\treturn index.keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(buildIndexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\texpected: idx\n\t}, \"fail\", failures, warnings);\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive),\n\t\texpected: new MongoSchemaIR(canonicalExpected)\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", index.weights),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t});\n}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We deliberately match by the\n* *projected* (contract-shaped) key list — so a live `_fts/_ftsx` index\n* resolves to a contract `{title: 'text', body: 'text'}` index — and pick\n* the first match. Contracts very rarely contain duplicate-key indexes; if\n* we have no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeySig = sortTextKeys(projectTextIndexKeys(liveIndex)).map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tfor (const expected of expectedIndexes) if (sortTextKeys(expected.keys).map((k) => `${k.field}:${k.direction}`).join(\",\") === liveKeySig) return expected;\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst collections = contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.collection ?? {};\n\tconst defaultControlPolicy = contract.defaultControlPolicy;\n\treturn (collectionName) => effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-B0bMHQW0.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,OAAO;CAC5B,OAAO,IAAI,iBAAiB;EAC3B,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,oBAAoB,MAAM;EAC1B,yBAAyB,MAAM;EAC/B,oBAAoB,MAAM;EAC1B,WAAW,MAAM;EACjB,SAAS,MAAM;EACf,k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