@prisma/orm-family-mongo 8.0.0-rc.9-dev.3 → 8.0.0-rc.9-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/{control-D5x9n_lZ.mjs → control-CS0_f6FM.mjs} +2 -2
- package/dist/{control-D5x9n_lZ.mjs.map → control-CS0_f6FM.mjs.map} +1 -1
- package/dist/family.mjs +1 -1
- package/dist/family__control.mjs +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/{interpreter-BCt8cG3P-DJ8yDc_N.mjs → interpreter-Bth09A-v-B7H01r40.mjs} +6 -6
- package/dist/interpreter-Bth09A-v-B7H01r40.mjs.map +1 -0
- package/package.json +19 -19
- package/dist/interpreter-BCt8cG3P-DJ8yDc_N.mjs.map +0 -1
package/dist/contract-psl.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as mongoAttributeSpecs, n as derivePolymorphicJsonSchema, r as interpretPslDocumentToMongoContract, t as deriveJsonSchema } from "./interpreter-
|
|
1
|
+
import { i as mongoAttributeSpecs, n as derivePolymorphicJsonSchema, r as interpretPslDocumentToMongoContract, t as deriveJsonSchema } from "./interpreter-Bth09A-v-B7H01r40.mjs";
|
|
2
2
|
export { deriveJsonSchema, derivePolymorphicJsonSchema, interpretPslDocumentToMongoContract, mongoAttributeSpecs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as interpretPslDocumentToMongoContract } from "./interpreter-
|
|
1
|
+
import { r as interpretPslDocumentToMongoContract } from "./interpreter-Bth09A-v-B7H01r40.mjs";
|
|
2
2
|
import { collectScalarTypeConstructors } from "@prisma/orm-framework/components/authoring";
|
|
3
3
|
import { buildSymbolTable, rangeToPslSpan } from "@prisma/orm-framework/psl-parser";
|
|
4
4
|
import { withSeedDiagnostics } from "@prisma/orm-framework/psl-parser/interpret";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-
|
|
1
|
+
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-Bth09A-v.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, rangeToPslSpan } from \"@internal/psl-parser\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/provider.ts\nfunction collectScalarTypeCodecIds(namespace) {\n\treturn new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));\n}\nfunction mapParseDiagnostics(diagnostics, sourceFile, sourceId) {\n\treturn diagnostics.map((diagnostic) => ({\n\t\tcode: diagnostic.code,\n\t\tmessage: diagnostic.message,\n\t\tsourceId,\n\t\tspan: rangeToPslSpan(diagnostic.range, sourceFile)\n\t}));\n}\nfunction mongoContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsourceFile: input.sourceFile,\n\t\t\t\t\tsourceId: input.sourceId,\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tscalarTypeCodecIds: collectScalarTypeCodecIds(context.authoringContributions.type),\n\t\t\t\t\tcontrolMutationDefaults: context.controlMutationDefaults.defaultFunctionRegistry,\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options?.enumInferenceCodecs)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst [absoluteSchemaPath] = context.resolvedInputs;\n\t\t\t\tif (absoluteSchemaPath === void 0) throw new InternalError(\"mongoContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tlet schema;\n\t\t\t\ttry {\n\t\t\t\t\tschema = await readFile(absoluteSchemaPath, \"utf-8\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error);\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: `Failed to read Prisma schema at \"${schemaPath}\"`,\n\t\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}],\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tschemaPath,\n\t\t\t\t\t\t\tabsoluteSchemaPath,\n\t\t\t\t\t\t\tcause: message\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst { document, sourceFile, diagnostics: parseDiagnostics } = parse(schema);\n\t\t\t\tconst { table: symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tpslBlockDescriptors: context.authoringContributions.pslBlockDescriptors\n\t\t\t\t});\n\t\t\t\tconst seedDiagnostics = [...mapParseDiagnostics(parseDiagnostics, sourceFile, schemaPath), ...mapParseDiagnostics(symbolTableDiagnostics, sourceFile, schemaPath)];\n\t\t\t\treturn withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t}, context), seedDiagnostics);\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options?.output)\n\t};\n}\n//#endregion\nexport { mongoContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,0BAA0B,WAAW;CAC7C,OAAO,IAAI,IAAI,CAAC,GAAG,8BAA8B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAC7G;AACA,SAAS,oBAAoB,aAAa,YAAY,UAAU;CAC/D,OAAO,YAAY,KAAK,gBAAgB;EACvC,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB;EACA,MAAM,eAAe,WAAW,OAAO,UAAU;CAClD,EAAE;AACH;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,aAAa,MAAM;KACnB,YAAY,MAAM;KAClB,UAAU,MAAM;KAChB,iBAAiB,CAAC;KAClB,oBAAoB,0BAA0B,QAAQ,uBAAuB,IAAI;KACjF,yBAAyB,QAAQ,wBAAwB;KACzD,aAAa,QAAQ;KACrB,wBAAwB,QAAQ;KAChC,GAAG,UAAU,uBAAuB,SAAS,mBAAmB;IACjE,CAAC;GACF;GACA,MAAM,KAAK,SAAS;IACnB,MAAM,CAAC,sBAAsB,QAAQ;IACrC,IAAI,uBAAuB,KAAK,GAAG,MAAM,IAAI,cAAc,iIAAiI;IAC5L,IAAI;IACJ,IAAI;KACH,SAAS,MAAM,SAAS,oBAAoB,OAAO;IACpD,SAAS,OAAO;KACf,MAAM,UAAU,OAAO,KAAK;KAC5B,OAAO,MAAM;MACZ,SAAS,oCAAoC,WAAW;MACxD,aAAa,CAAC;OACb,MAAM;OACN;OACA,UAAU;MACX,CAAC;MACD,MAAM;OACL;OACA;OACA,OAAO;MACR;KACD,CAAC;IACF;IACA,MAAM,EAAE,UAAU,YAAY,aAAa,qBAAqB,MAAM,MAAM;IAC5E,MAAM,EAAE,OAAO,aAAa,aAAa,2BAA2B,iBAAiB;KACpF;KACA;KACA,qBAAqB,QAAQ,uBAAuB;IACrD,CAAC;IACD,MAAM,kBAAkB,CAAC,GAAG,oBAAoB,kBAAkB,YAAY,UAAU,GAAG,GAAG,oBAAoB,wBAAwB,YAAY,UAAU,CAAC;IACjK,OAAO,oBAAoB,KAAK,UAAU;KACzC;KACA;KACA;KACA,UAAU;IACX,GAAG,OAAO,GAAG,eAAe;GAC7B;EACD;EACA,GAAG,UAAU,UAAU,SAAS,MAAM;CACvC;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-DF3Z6sjO.mjs";
|
|
2
|
-
import { i as mongoAttributeSpecs } from "./interpreter-
|
|
2
|
+
import { i as mongoAttributeSpecs } from "./interpreter-Bth09A-v-B7H01r40.mjs";
|
|
3
3
|
import { t as mongoEmission } from "./exports-BSUZo1ZX.mjs";
|
|
4
4
|
import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-DSZhsvrk.mjs";
|
|
5
5
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-B7H9J2_9-DCHLPzmA.mjs";
|
|
@@ -398,4 +398,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
|
|
|
398
398
|
//#endregion
|
|
399
399
|
export { mongoOperationsToPreview as i, formatMongoOperations as n, mongoFamilyDescriptor as r, createMongoFamilyInstance as t };
|
|
400
400
|
|
|
401
|
-
//# sourceMappingURL=control-
|
|
401
|
+
//# sourceMappingURL=control-CS0_f6FM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-D5x9n_lZ.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-B7H9J2_9.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { 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 } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { InternalError } from \"@internal/utils/internal-error\";\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}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${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 `db.${cmd.collection}.drop()`;\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 formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\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/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 = 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\"] ?? \"unknown\";\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 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 = 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 = 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(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\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn 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 sign(options) {\n\t\t\tconst { driver, contract: rawContract, 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 controlAdapter = getControlAdapter();\n\t\t\tconst mongoDriver = asMongoDriver(driver);\n\t\t\tconst existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst storageHashMatches = existingMarker.storageHash === contractStorageHash;\n\t\t\t\tconst profileHashMatches = existingMarker.profileHash === contractProfileHash;\n\t\t\t\tif (!storageHashMatches || !profileHashMatches) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingMarker.storageHash,\n\t\t\t\t\t\tprofileHash: existingMarker.profileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(mongoDriver, APP_SPACE_ID, existingMarker.storageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw structuredError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\");\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contract.target,\n\t\t\t\t\tactual: contract.target\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...ifDefined(\"previous\", previousHashes)\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t\t},\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t};\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\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};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\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\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,cAAc,MAAM;CAC5B,OAAO,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,UAAU,EAAE,KAAK,EAAE,IAAI,KAAK,UAAU,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;AACtG;AACA,MAAM,oCAAoC,IAAI,I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xE;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,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"control-CS0_f6FM.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-B7H9J2_9.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { 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 } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { InternalError } from \"@internal/utils/internal-error\";\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}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${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 `db.${cmd.collection}.drop()`;\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 formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\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/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 = 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\"] ?? \"unknown\";\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 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 = 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 = 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(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\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn 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 sign(options) {\n\t\t\tconst { driver, contract: rawContract, 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 controlAdapter = getControlAdapter();\n\t\t\tconst mongoDriver = asMongoDriver(driver);\n\t\t\tconst existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst storageHashMatches = existingMarker.storageHash === contractStorageHash;\n\t\t\t\tconst profileHashMatches = existingMarker.profileHash === contractProfileHash;\n\t\t\t\tif (!storageHashMatches || !profileHashMatches) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingMarker.storageHash,\n\t\t\t\t\t\tprofileHash: existingMarker.profileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(mongoDriver, APP_SPACE_ID, existingMarker.storageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw structuredError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\");\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contract.target,\n\t\t\t\t\tactual: contract.target\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...ifDefined(\"previous\", previousHashes)\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t\t},\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t};\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\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};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\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\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,cAAc,MAAM;CAC5B,OAAO,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,UAAU,EAAE,KAAK,EAAE,IAAI,KAAK,UAAU,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;AACtG;AACA,MAAM,oCAAoC,IAAI,IAAI;CACjD;CACA;CACA;AACD,CAAC;AACD,SAAS,oBAAoB,KAAK;CACjC,MAAM,QAAQ,OAAO,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC,kBAAkB,IAAI,GAAG,KAAK,UAAU,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,IAAI,KAAK,UAAU,KAAK,GAAG;CACpK,IAAI,MAAM,WAAW,GAAG,OAAO,KAAK;CACpC,OAAO,KAAK,MAAM,KAAK,IAAI,EAAE;AAC9B;AACA,SAAS,cAAc,KAAK;CAC3B,OAAO,oBAAoB,GAAG;AAC/B;AACA,SAAS,8BAA8B,KAAK;CAC3C,OAAO,oBAAoB,GAAG;AAC/B;AACA,IAAI,2BAA2B,MAAM;CACpC,YAAY,KAAK;EAChB,MAAM,UAAU,cAAc,IAAI,IAAI;EACtC,MAAM,OAAO,cAAc,GAAG;EAC9B,OAAO,OAAO,MAAM,IAAI,WAAW,eAAe,QAAQ,IAAI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u as defaultMongoStorageNamespaceId
|
|
|
2
2
|
import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-DSZhsvrk.mjs";
|
|
3
3
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-B7H9J2_9-DCHLPzmA.mjs";
|
|
4
4
|
import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-D13m_FBX.mjs";
|
|
5
|
-
import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-
|
|
5
|
+
import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-CS0_f6FM.mjs";
|
|
6
6
|
import { t as MongoContractView$1 } from "./mongo-contract-view-JZOa0Ry--BZsUrVN_.mjs";
|
|
7
7
|
import { t as MongoSchemaVerifierBase } from "./ir-Ch2aPr7a.mjs";
|
|
8
8
|
import { t as MongoMigration } from "./migration-c8VhrzyG.mjs";
|
package/dist/family__control.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-DSZhsvrk.mjs";
|
|
2
|
-
import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-
|
|
2
|
+
import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-CS0_f6FM.mjs";
|
|
3
3
|
export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
|
package/dist/family__pack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as mongoAttributeSpecs } from "./interpreter-
|
|
1
|
+
import { i as mongoAttributeSpecs } from "./interpreter-Bth09A-v-B7H01r40.mjs";
|
|
2
2
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-B7H9J2_9-DCHLPzmA.mjs";
|
|
3
3
|
//#region ../../../2-mongo-family/9-family/dist/pack.mjs
|
|
4
4
|
const mongoFamilyPack = {
|
|
@@ -13,7 +13,7 @@ import { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelatio
|
|
|
13
13
|
import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
14
14
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
15
15
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
16
|
-
//#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-
|
|
16
|
+
//#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-Bth09A-v.mjs
|
|
17
17
|
function resolveBsonType(codecId, codecLookup) {
|
|
18
18
|
return codecLookup?.targetTypesFor(codecId)?.[0];
|
|
19
19
|
}
|
|
@@ -181,11 +181,11 @@ const relationFieldSpec = fieldAttribute("relation", {
|
|
|
181
181
|
named: {
|
|
182
182
|
name: optional(str()),
|
|
183
183
|
fields: optional(list(fieldRef(), {
|
|
184
|
-
|
|
184
|
+
allowEmpty: false,
|
|
185
185
|
unique: true
|
|
186
186
|
})),
|
|
187
187
|
references: optional(list(referencedFieldRef(), {
|
|
188
|
-
|
|
188
|
+
allowEmpty: false,
|
|
189
189
|
unique: true
|
|
190
190
|
}))
|
|
191
191
|
}
|
|
@@ -227,7 +227,7 @@ function buildIndexModelSpec(name, fieldElement) {
|
|
|
227
227
|
return modelAttribute(name, {
|
|
228
228
|
positional: [{
|
|
229
229
|
key: "fields",
|
|
230
|
-
type: list(fieldElement, {
|
|
230
|
+
type: list(fieldElement, { allowEmpty: false })
|
|
231
231
|
}],
|
|
232
232
|
named: {
|
|
233
233
|
type: optional(oneOf(num(1), num(-1), str("text"), str("2dsphere"), str("2d"), str("hashed"))),
|
|
@@ -246,7 +246,7 @@ function buildTextIndexModelSpec(fieldElement) {
|
|
|
246
246
|
return modelAttribute("textIndex", {
|
|
247
247
|
positional: [{
|
|
248
248
|
key: "fields",
|
|
249
|
-
type: list(fieldElement, {
|
|
249
|
+
type: list(fieldElement, { allowEmpty: false })
|
|
250
250
|
}],
|
|
251
251
|
named: {
|
|
252
252
|
filter: optional(json()),
|
|
@@ -1345,4 +1345,4 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1345
1345
|
//#endregion
|
|
1346
1346
|
export { mongoAttributeSpecs as i, derivePolymorphicJsonSchema as n, interpretPslDocumentToMongoContract as r, deriveJsonSchema as t };
|
|
1347
1347
|
|
|
1348
|
-
//# sourceMappingURL=interpreter-
|
|
1348
|
+
//# sourceMappingURL=interpreter-Bth09A-v-B7H01r40.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpreter-Bth09A-v-B7H01r40.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-Bth09A-v.mjs"],"sourcesContent":["import { MongoIndex, MongoStorage, MongoValidator, applyPolymorphicScopeToMongoIndex, buildMongoNamespace } from \"@internal/mongo-contract\";\nimport { computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { errorEnumCodecNotInPackStack } from \"@internal/errors/control\";\nimport { instantiateAuthoringEntityType, isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, int, interpretAttribute, json, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str } from \"@internal/psl-parser\";\nimport { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic } from \"@internal/psl-parser/interpret\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/derive-json-schema.ts\nfunction resolveBsonType(codecId, codecLookup) {\n\treturn codecLookup?.targetTypesFor(codecId)?.[0];\n}\nfunction fieldToBsonSchema(field, valueObjects, codecLookup, valueSets) {\n\tif (field.type.kind === \"scalar\") {\n\t\tconst bsonType = resolveBsonType(field.type.codecId, codecLookup);\n\t\tif (!bsonType) return void 0;\n\t\tconst enumValues = field.valueSet !== void 0 ? valueSets?.[field.valueSet.entityName]?.values ?? null : null;\n\t\tif (\"many\" in field && field.many) {\n\t\t\tconst items = { bsonType };\n\t\t\tif (enumValues) items[\"enum\"] = enumValues;\n\t\t\treturn {\n\t\t\t\tbsonType: \"array\",\n\t\t\t\titems\n\t\t\t};\n\t\t}\n\t\tif (field.nullable) {\n\t\t\tconst s = { bsonType: [\"null\", bsonType] };\n\t\t\tif (enumValues) s[\"enum\"] = [...enumValues, null];\n\t\t\treturn s;\n\t\t}\n\t\tconst s = { bsonType };\n\t\tif (enumValues) s[\"enum\"] = enumValues;\n\t\treturn s;\n\t}\n\tif (field.type.kind === \"valueObject\") {\n\t\tconst vo = valueObjects?.[field.type.name];\n\t\tif (!vo) return void 0;\n\t\tconst voSchema = deriveObjectSchema(vo.fields, valueObjects, codecLookup, valueSets);\n\t\tif (\"many\" in field && field.many) return {\n\t\t\tbsonType: \"array\",\n\t\t\titems: voSchema\n\t\t};\n\t\tif (field.nullable) return { oneOf: [{ bsonType: \"null\" }, voSchema] };\n\t\treturn voSchema;\n\t}\n}\nfunction deriveObjectSchema(fields, valueObjects, codecLookup, valueSets) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) {\n\t\tconst schema = fieldToBsonSchema(field, valueObjects, codecLookup, valueSets);\n\t\tif (schema) {\n\t\t\tproperties[fieldName] = schema;\n\t\t\tif (!field.nullable) required.push(fieldName);\n\t\t}\n\t}\n\tconst result = {\n\t\tbsonType: \"object\",\n\t\tproperties,\n\t\tadditionalProperties: false\n\t};\n\tif (required.length > 0) result[\"required\"] = required.sort();\n\treturn result;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction deriveJsonSchema(fields, valueObjects, codecLookup, valueSets) {\n\treturn new MongoValidator({\n\t\tjsonSchema: deriveObjectSchema(fields, valueObjects, codecLookup, valueSets),\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\nfunction derivePolymorphicJsonSchema(baseFields, discriminatorField, variants, valueObjects, codecLookup, valueSets) {\n\tconst baseSchema = deriveObjectSchema(baseFields, valueObjects, codecLookup, valueSets);\n\tconst baseProperties = isRecord(baseSchema[\"properties\"]) ? baseSchema[\"properties\"] : {};\n\tconst oneOf = [];\n\tfor (const variant of variants) {\n\t\tconst variantOnlyFields = {};\n\t\tfor (const [name, field] of Object.entries(variant.fields)) if (!(name in baseFields)) variantOnlyFields[name] = field;\n\t\tconst variantProperties = {};\n\t\tconst variantRequired = [discriminatorField];\n\t\tfor (const [name, field] of Object.entries(variantOnlyFields)) {\n\t\t\tconst schema = fieldToBsonSchema(field, valueObjects, codecLookup, valueSets);\n\t\t\tif (schema) {\n\t\t\t\tvariantProperties[name] = schema;\n\t\t\t\tif (!field.nullable) variantRequired.push(name);\n\t\t\t}\n\t\t}\n\t\tconst entry = {\n\t\t\tproperties: {\n\t\t\t\t...baseProperties,\n\t\t\t\t[discriminatorField]: { enum: [variant.discriminatorValue] },\n\t\t\t\t...variantProperties\n\t\t\t},\n\t\t\trequired: variantRequired.sort(),\n\t\t\tadditionalProperties: false\n\t\t};\n\t\toneOf.push(entry);\n\t}\n\tconst jsonSchema = { ...baseSchema };\n\tdelete jsonSchema[\"additionalProperties\"];\n\tif (oneOf.length > 0) jsonSchema[\"oneOf\"] = oneOf;\n\treturn new MongoValidator({\n\t\tjsonSchema,\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\n//#endregion\n//#region src/mongo-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst mapFieldSpec = fieldAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst idFieldSpec = fieldAttribute(\"id\", {});\nconst uniqueFieldSpec = fieldAttribute(\"unique\", {});\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str())\n\t}],\n\tnamed: {\n\t\tname: optional(str()),\n\t\tfields: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\treferences: optional(list(referencedFieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}))\n\t}\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", { positional: [{\n\tkey: \"field\",\n\ttype: fieldRef()\n}] });\nconst baseModelSpec = modelAttribute(\"base\", { positional: [{\n\tkey: \"base\",\n\ttype: entityRef()\n}, {\n\tkey: \"value\",\n\ttype: str()\n}] });\nconst sortSig = { named: { sort: oneOf(identifier(\"Asc\"), identifier(\"Desc\")) } };\nfunction indexFieldElement(fieldNames) {\n\treturn oneOf(...[\n\t\tfieldRef(),\n\t\tfuncCall(\"wildcard\", { positional: [{\n\t\t\tkey: \"scope\",\n\t\t\ttype: optional(entityRef())\n\t\t}] }),\n\t\t...fieldNames.map((name) => funcCall(name, sortSig))\n\t]);\n}\nconst collationNamedArgs = {\n\tcollationLocale: optional(str()),\n\tcollationStrength: optional(oneOf(num(1), num(2), num(3), num(4), num(5))),\n\tcollationCaseLevel: optional(bool()),\n\tcollationCaseFirst: optional(oneOf(str(\"upper\"), str(\"lower\"), str(\"off\"))),\n\tcollationNumericOrdering: optional(bool()),\n\tcollationAlternate: optional(oneOf(str(\"non-ignorable\"), str(\"shifted\"))),\n\tcollationMaxVariable: optional(oneOf(str(\"punct\"), str(\"space\"))),\n\tcollationBackwards: optional(bool()),\n\tcollationNormalization: optional(bool())\n};\nfunction buildIndexModelSpec(name, fieldElement) {\n\treturn modelAttribute(name, {\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(fieldElement, { allowEmpty: false })\n\t\t}],\n\t\tnamed: {\n\t\t\ttype: optional(oneOf(num(1), num(-1), str(\"text\"), str(\"2dsphere\"), str(\"2d\"), str(\"hashed\"))),\n\t\t\tsparse: optional(bool()),\n\t\t\texpireAfterSeconds: optional(int()),\n\t\t\tfilter: optional(json()),\n\t\t\tinclude: optional(list(str())),\n\t\t\texclude: optional(list(str())),\n\t\t\tdefault_language: optional(str()),\n\t\t\tlanguageOverride: optional(str()),\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction buildTextIndexModelSpec(fieldElement) {\n\treturn modelAttribute(\"textIndex\", {\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(fieldElement, { allowEmpty: false })\n\t\t}],\n\t\tnamed: {\n\t\t\tfilter: optional(json()),\n\t\t\tweights: optional(record(int({\n\t\t\t\tmin: 1,\n\t\t\t\tmax: 99999\n\t\t\t}))),\n\t\t\tlanguage: optional(str()),\n\t\t\tlanguageOverride: optional(str()),\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction modelFieldElement(ctx) {\n\treturn indexFieldElement(Object.keys(ctx.model.fields));\n}\nfunction staticModelSpec(spec) {\n\treturn () => spec;\n}\nfunction staticFieldSpec(spec) {\n\treturn () => spec;\n}\nconst mongoAttributeSpecs = {\n\tmodel: {\n\t\tmap: staticModelSpec(mapModelSpec),\n\t\tdiscriminator: staticModelSpec(discriminatorModelSpec),\n\t\tbase: staticModelSpec(baseModelSpec),\n\t\tindex: (ctx) => buildIndexModelSpec(\"index\", modelFieldElement(ctx)),\n\t\tunique: (ctx) => buildIndexModelSpec(\"unique\", modelFieldElement(ctx)),\n\t\ttextIndex: (ctx) => buildTextIndexModelSpec(modelFieldElement(ctx))\n\t},\n\tfield: {\n\t\tid: staticFieldSpec(idFieldSpec),\n\t\tunique: staticFieldSpec(uniqueFieldSpec),\n\t\tmap: staticFieldSpec(mapFieldSpec),\n\t\trelation: staticFieldSpec(relationFieldSpec)\n\t}\n};\n//#endregion\n//#region src/psl-helpers.ts\nfunction lowerFirst(value) {\n\tif (value.length === 0) return value;\n\treturn value[0]?.toLowerCase() + value.slice(1);\n}\nfunction getAttribute(attributes, name) {\n\treturn attributes.find((attr) => attr.name === name);\n}\n//#endregion\n//#region src/interpreter.ts\n/**\n* Encode an authored enum value to its codec-encoded JSON form via the codec resolved by id from the\n* contract's codec lookup, so a non-identity `encodeJson` (permitted by the `mongoCodec` factory) is\n* respected. Matches the TS builder's `encodeEnumValue`: the lookup is always threaded in production,\n* and a codecId the lookup cannot resolve is a hard error — the enum uses a codec that is not part of\n* the contract's pack stack.\n*/\nfunction encodeEnumValue(value, codecId, codecLookup) {\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw errorEnumCodecNotInPackStack({ codecId });\n\treturn codec.encodeJson(value);\n}\n/**\n* Mongo's PSL surface binds the database from the connection string, so every\n* explicit namespace block is invalid, including `namespace unbound { … }`.\n*/\nfunction validateNamespaceBlocksForMongoTarget(input) {\n\tfor (const namespace of input.namespaces) input.diagnostics.push({\n\t\tcode: \"PSL_UNSUPPORTED_NAMESPACE_BLOCK\",\n\t\tmessage: `Mongo does not support \\`namespace ${namespace.name} { … }\\` blocks (the database is bound by the connection string; declare models at the document top level instead).`,\n\t\tsourceId: input.sourceId,\n\t\tspan: nodePslSpan(namespace.node.syntax, input.sourceFile)\n\t});\n}\nconst UNLOWERED_FIELD_ATTRIBUTE_HINTS = /* @__PURE__ */ new Map([[\"updatedAt\", \"Mongo lowers no automatic timestamp updates; delete the attribute and set the timestamp in application code.\"]]);\nfunction unsupportedFieldAttributeMessage(ownerName, fieldName, attributeName) {\n\tconst base = `Field \"${ownerName}.${fieldName}\" uses unsupported attribute \"@${attributeName}\"`;\n\tconst hint = UNLOWERED_FIELD_ATTRIBUTE_HINTS.get(attributeName);\n\treturn hint === void 0 ? base : `${base}. ${hint}`;\n}\nfunction reportUnknownAttributes(input) {\n\tconst { sourceId, diagnostics } = input;\n\tfor (const model of input.models) for (const attribute of model.attributes) {\n\t\tif (Object.hasOwn(mongoAttributeSpecs.model, attribute.name)) continue;\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_MODEL_ATTRIBUTE\",\n\t\t\tmessage: `Model \"${model.name}\" uses unsupported attribute \"@@${attribute.name}\"`,\n\t\t\tsourceId,\n\t\t\tspan: attribute.span\n\t\t});\n\t}\n\tfor (const owner of [...input.models, ...input.compositeTypes]) for (const field of Object.values(owner.fields)) for (const attribute of field.attributes) {\n\t\tif (Object.hasOwn(mongoAttributeSpecs.field, attribute.name)) continue;\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_ATTRIBUTE\",\n\t\t\tmessage: unsupportedFieldAttributeMessage(owner.name, field.name, attribute.name),\n\t\t\tsourceId,\n\t\t\tspan: attribute.span\n\t\t});\n\t}\n}\nfunction relationNullabilityMismatchDiagnostic(modelName, field, sourceId) {\n\tconst fieldLabel = `Relation field \"${modelName}.${field.name}\"`;\n\treturn {\n\t\tcode: \"PSL_RELATION_NULLABILITY_MISMATCH\",\n\t\tmessage: field.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.name}\" or make those fields required.`,\n\t\tsourceId,\n\t\tspan: field.span\n\t};\n}\nfunction resolveFieldMappings(input) {\n\tconst { model, specContext, sourceFile, sourceId, diagnostics } = input;\n\tconst pslNameToMapped = /* @__PURE__ */ new Map();\n\tfor (const field of Object.values(model.fields)) {\n\t\tconst mapNode = findFieldAttributeNode(field, \"map\");\n\t\tconst mapped = (mapNode ? interpretFieldAttribute({\n\t\t\tnode: mapNode,\n\t\t\tspec: mongoAttributeSpecs.field.map({\n\t\t\t\t...specContext,\n\t\t\t\tfield\n\t\t\t}),\n\t\t\tmodel,\n\t\t\tfield,\n\t\t\tsourceFile,\n\t\t\tsourceId,\n\t\t\tdiagnostics\n\t\t})?.name : void 0) ?? field.name;\n\t\tpslNameToMapped.set(field.name, mapped);\n\t}\n\treturn { pslNameToMapped };\n}\nfunction resolveCollectionName(input) {\n\tconst { model, specContext, sourceFile, sourceId, diagnostics } = input;\n\tconst mapNode = findModelAttributeNode(model, \"map\");\n\treturn (mapNode ? interpretModelAttribute({\n\t\tnode: mapNode,\n\t\tspec: mongoAttributeSpecs.model.map(specContext),\n\t\tmodel,\n\t\tsourceFile,\n\t\tsourceId,\n\t\tdiagnostics\n\t})?.name : void 0) ?? lowerFirst(model.name);\n}\nfunction mongoCrossRef(modelName) {\n\treturn crossRef(modelName, UNBOUND_NAMESPACE_ID);\n}\nfunction collectPolymorphismDeclarations(models, specContextFor, modelMetadataByName, sourceFile, sourceId, diagnostics) {\n\tconst discriminatorDeclarations = /* @__PURE__ */ new Map();\n\tconst baseDeclarations = /* @__PURE__ */ new Map();\n\tfor (const model of models) {\n\t\tconst specContext = specContextFor(model);\n\t\tconst discNode = findModelAttributeNode(model, \"discriminator\");\n\t\tif (discNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode: discNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.discriminator(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) {\n\t\t\t\tconst fieldName = parsed.field;\n\t\t\t\tconst discField = model.fields[fieldName];\n\t\t\t\tif (discField && discField.typeName !== \"String\") diagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\t\tmessage: `Discriminator field \"${fieldName}\" on model \"${model.name}\" must be of type String, but is \"${discField.typeName}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t\telse discriminatorDeclarations.set(model.name, {\n\t\t\t\t\tfieldName,\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst baseNode = findModelAttributeNode(model, \"base\");\n\t\tif (baseNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode: baseNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.base(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) {\n\t\t\t\tconst collectionName = modelMetadataByName.get(model.name)?.collectionName ?? lowerFirst(model.name);\n\t\t\t\tbaseDeclarations.set(model.name, {\n\t\t\t\t\tbaseName: parsed.base,\n\t\t\t\t\tvalue: parsed.value,\n\t\t\t\t\tcollectionName,\n\t\t\t\t\tspan: nodePslSpan(baseNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations\n\t};\n}\nfunction resolvePolymorphism(input) {\n\tconst { discriminatorDeclarations, baseDeclarations, modelNames, modelMetadataByName, sourceId, allModels: allModelViews, indexSpans, modelIndexesByName } = input;\n\tlet patched = input.models;\n\tlet roots = input.roots;\n\tlet collections = input.collections;\n\tconst diagnostics = [];\n\tfor (const [modelName, decl] of discriminatorDeclarations) {\n\t\tif (baseDeclarations.has(modelName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_AND_BASE\",\n\t\t\t\tmessage: `Model \"${modelName}\" cannot have both @@discriminator and @@base`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst model = patched[modelName];\n\t\tif (!model) continue;\n\t\tconst mappedDiscriminatorField = modelMetadataByName.get(modelName)?.fieldMappings.pslNameToMapped.get(decl.fieldName) ?? decl.fieldName;\n\t\tif (!Object.hasOwn(model.fields, mappedDiscriminatorField)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Discriminator field \"${decl.fieldName}\" is not a field on model \"${modelName}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst variants = {};\n\t\tfor (const [variantName, baseDecl] of baseDeclarations) {\n\t\t\tif (baseDecl.baseName !== modelName) continue;\n\t\t\tvariants[variantName] = { value: baseDecl.value };\n\t\t}\n\t\tif (Object.keys(variants).length === 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_DISCRIMINATOR\",\n\t\t\t\tmessage: `Model \"${modelName}\" has @@discriminator but no variant models declare @@base(${modelName}, ...)`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpatched = {\n\t\t\t...patched,\n\t\t\t[modelName]: {\n\t\t\t\t...model,\n\t\t\t\tdiscriminator: { field: mappedDiscriminatorField },\n\t\t\t\tvariants\n\t\t\t}\n\t\t};\n\t}\n\tfor (const [variantName, baseDecl] of baseDeclarations) {\n\t\tif (!modelNames.has(baseDecl.baseName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_BASE_TARGET_NOT_FOUND\",\n\t\t\t\tmessage: `Model \"${variantName}\" @@base references non-existent model \"${baseDecl.baseName}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!discriminatorDeclarations.has(baseDecl.baseName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BASE\",\n\t\t\t\tmessage: `Model \"${variantName}\" declares @@base(${baseDecl.baseName}, ...) but \"${baseDecl.baseName}\" has no @@discriminator`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (discriminatorDeclarations.has(variantName)) continue;\n\t\tconst baseModel = patched[baseDecl.baseName];\n\t\tconst variantModelView = allModelViews.find((m) => m.name === variantName);\n\t\tif (!variantModelView) continue;\n\t\tif (getAttribute(variantModelView.attributes, \"map\") !== void 0 && baseModel && baseDecl.collectionName !== baseModel.storage.collection) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\",\n\t\t\t\tmessage: `Mongo variant \"${variantName}\" cannot use a different collection than its base \"${baseDecl.baseName}\". Mongo only supports single-collection polymorphism.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst baseCollection = baseModel?.storage.collection ?? baseDecl.collectionName;\n\t\tconst variantModel = patched[variantName];\n\t\tif (variantModel) patched = {\n\t\t\t...patched,\n\t\t\t[variantName]: {\n\t\t\t\t...variantModel,\n\t\t\t\tbase: mongoCrossRef(baseDecl.baseName),\n\t\t\t\tstorage: { collection: baseCollection }\n\t\t\t}\n\t\t};\n\t\tconst variantCollectionName = modelMetadataByName.get(variantName)?.collectionName ?? lowerFirst(variantName);\n\t\tif (roots[variantCollectionName]?.model === variantName) if (variantCollectionName === baseCollection && baseModel) roots = {\n\t\t\t...roots,\n\t\t\t[variantCollectionName]: mongoCrossRef(baseDecl.baseName)\n\t\t};\n\t\telse roots = Object.fromEntries(Object.entries(roots).filter(([key]) => key !== variantCollectionName));\n\t\tconst variantOwnIndexes = modelIndexesByName.get(variantName) ?? [];\n\t\tconst baseColl = collections[baseCollection];\n\t\tconst discriminatorField = patched[baseDecl.baseName]?.discriminator?.field;\n\t\tconst scopedVariantIndexes = [];\n\t\tif (discriminatorField) for (const idx of variantOwnIndexes) {\n\t\t\tconst result = applyPolymorphicScopeToMongoIndex(idx, {\n\t\t\t\tdiscriminatorField,\n\t\t\t\tdiscriminatorValue: baseDecl.value\n\t\t\t});\n\t\t\tif (result.kind === \"conflict\") {\n\t\t\t\tconst span = indexSpans.get(idx) ?? baseDecl.span;\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Variant \"${variantName}\" index conflicts with discriminator scope: ${result.reason}`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (result.index !== idx) indexSpans.set(result.index, indexSpans.get(idx) ?? baseDecl.span);\n\t\t\tscopedVariantIndexes.push(result.index);\n\t\t}\n\t\telse scopedVariantIndexes.push(...variantOwnIndexes);\n\t\tif (variantCollectionName !== baseCollection) {\n\t\t\tconst filtered = Object.fromEntries(Object.entries(collections).filter(([key]) => key !== variantCollectionName));\n\t\t\tif (scopedVariantIndexes.length > 0 && baseColl) {\n\t\t\t\tconst baseIndexes = collectionIndexes(baseColl);\n\t\t\t\tcollections = {\n\t\t\t\t\t...filtered,\n\t\t\t\t\t[baseCollection]: {\n\t\t\t\t\t\t...baseColl,\n\t\t\t\t\t\tindexes: [...baseIndexes, ...scopedVariantIndexes]\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} else collections = filtered;\n\t\t} else if (baseColl) {\n\t\t\tconst existingIndexes = collectionIndexes(baseColl);\n\t\t\tconst variantIndexSet = new Set(variantOwnIndexes);\n\t\t\tconst withoutUnscopedVariants = existingIndexes.filter((idx) => !variantIndexSet.has(idx));\n\t\t\tconst mergedIndexes = [...withoutUnscopedVariants];\n\t\t\tfor (const idx of scopedVariantIndexes) {\n\t\t\t\tconst idxKey = canonicalJson(idx);\n\t\t\t\tif (!withoutUnscopedVariants.some((existing) => canonicalJson(existing) === idxKey)) mergedIndexes.push(idx);\n\t\t\t}\n\t\t\tif (mergedIndexes.length !== existingIndexes.length || mergedIndexes.some((idx, i) => idx !== existingIndexes[i])) {\n\t\t\t\tconst next = { ...baseColl };\n\t\t\t\tif (mergedIndexes.length > 0) next[\"indexes\"] = mergedIndexes;\n\t\t\t\telse delete next[\"indexes\"];\n\t\t\t\tcollections = {\n\t\t\t\t\t...collections,\n\t\t\t\t\t[baseCollection]: next\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tmodels: patched,\n\t\troots,\n\t\tcollections,\n\t\tdiagnostics\n\t};\n}\nfunction collectionIndexes(collection) {\n\treturn blindCast(collection[\"indexes\"] ?? []);\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nfunction normalizeIndexField(element) {\n\tif (typeof element === \"string\") return {\n\t\tkind: \"field\",\n\t\tname: element\n\t};\n\tif (element.fn === \"wildcard\" && element.args[\"sort\"] === void 0) {\n\t\tconst scope = element.args[\"scope\"];\n\t\treturn typeof scope === \"string\" ? {\n\t\t\tkind: \"wildcard\",\n\t\t\tscope\n\t\t} : { kind: \"wildcard\" };\n\t}\n\tconst sort = element.args[\"sort\"];\n\treturn {\n\t\tkind: \"field\",\n\t\tname: element.fn,\n\t\tdirection: sort === \"Desc\" ? -1 : 1\n\t};\n}\nfunction buildCollationFromSpec(args) {\n\tconst locale = args.collationLocale;\n\tif (locale === void 0) return args.collationStrength !== void 0 || args.collationCaseLevel !== void 0 || args.collationCaseFirst !== void 0 || args.collationNumericOrdering !== void 0 || args.collationAlternate !== void 0 || args.collationMaxVariable !== void 0 || args.collationBackwards !== void 0 || args.collationNormalization !== void 0 ? null : void 0;\n\tconst collation = { locale };\n\tif (args.collationStrength !== void 0) collation.strength = args.collationStrength;\n\tif (args.collationCaseLevel !== void 0) collation.caseLevel = args.collationCaseLevel;\n\tif (args.collationCaseFirst !== void 0) collation.caseFirst = args.collationCaseFirst;\n\tif (args.collationNumericOrdering !== void 0) collation.numericOrdering = args.collationNumericOrdering;\n\tif (args.collationAlternate !== void 0) collation.alternate = args.collationAlternate;\n\tif (args.collationMaxVariable !== void 0) collation.maxVariable = args.collationMaxVariable;\n\tif (args.collationBackwards !== void 0) collation.backwards = args.collationBackwards;\n\tif (args.collationNormalization !== void 0) collation.normalization = args.collationNormalization;\n\treturn collation;\n}\nfunction resolveIndexKeys(parsedFields, defaultDirection, ctx) {\n\tconst wildcardCount = parsedFields.filter((field) => field.kind === \"wildcard\").length;\n\tif (wildcardCount > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"An index can contain at most one wildcard() field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tfor (const field of parsedFields) {\n\t\tconst fieldName = field.kind === \"wildcard\" ? field.scope : field.name;\n\t\tif (fieldName !== void 0 && !ctx.indexableFieldNames.has(fieldName)) {\n\t\t\tctx.diagnostics.push({\n\t\t\t\tcode: \"PSL_INDEX_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Index on model \"${ctx.pslModel.name}\" references unknown field \"${fieldName}\"`,\n\t\t\t\tsourceId: ctx.sourceId,\n\t\t\t\tspan: ctx.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t}\n\treturn {\n\t\tkeys: parsedFields.map((field) => {\n\t\t\tif (field.kind === \"wildcard\") {\n\t\t\t\tif (field.scope === void 0) return {\n\t\t\t\t\tfield: \"$**\",\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tfield: `${ctx.fieldMappings.pslNameToMapped.get(field.scope) ?? field.scope}.$**`,\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfield: ctx.fieldMappings.pslNameToMapped.get(field.name) ?? field.name,\n\t\t\t\tdirection: field.direction ?? defaultDirection\n\t\t\t};\n\t\t}),\n\t\thasWildcard: wildcardCount === 1\n\t};\n}\nfunction buildProjection(include, exclude, hasWildcard, ctx) {\n\tif (include !== void 0 && exclude !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Cannot specify both include and exclude on the same index\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn null;\n\t}\n\tconst fields = include ?? exclude;\n\tif (fields === void 0) return void 0;\n\tif (!hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn null;\n\t}\n\tif (fields.length === 0) return void 0;\n\tconst value = include === void 0 ? 0 : 1;\n\tconst projection = {};\n\tfor (const field of fields) projection[field] = value;\n\treturn projection;\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst defaultDirection = parsed.type ?? 1;\n\tconst resolved = resolveIndexKeys(parsedFields, defaultDirection, ctx);\n\tif (!resolved) return void 0;\n\tif (unique && resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Unique indexes cannot use wildcard() fields\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && typeof defaultDirection === \"string\" && [\n\t\t\"hashed\",\n\t\t\"2dsphere\",\n\t\t\"2d\"\n\t].includes(defaultDirection)) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: `wildcard() fields cannot be combined with type: ${defaultDirection}`,\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (defaultDirection === \"hashed\" && parsedFields.length > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Hashed indexes must have exactly one field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && parsed.expireAfterSeconds !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...unique && { unique: true },\n\t\t...parsed.sparse !== void 0 && { sparse: parsed.sparse },\n\t\t...parsed.expireAfterSeconds !== void 0 && { expireAfterSeconds: parsed.expireAfterSeconds },\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...wildcardProjection !== void 0 && { wildcardProjection },\n\t\t...collation !== void 0 && { collation },\n\t\t...parsed.default_language !== void 0 && { default_language: parsed.default_language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction buildTextIndex(parsed, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, \"text\", ctx);\n\tif (!resolved) return void 0;\n\tif (resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"wildcard() fields cannot be combined with type: hashed/2dsphere/2d or @@textIndex\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...collation !== void 0 && { collation },\n\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t...parsed.language !== void 0 && { default_language: parsed.language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction collectIndexes(pslModel, specContext, fieldMappings, modelNames, sourceId, sourceFile, diagnostics, indexSpans) {\n\tconst indexes = [];\n\tlet textIndexCount = 0;\n\tconst indexableFieldNames = /* @__PURE__ */ new Set();\n\tfor (const field of Object.values(pslModel.fields)) if (!modelNames.has(field.typeName)) indexableFieldNames.add(field.name);\n\tfor (const field of Object.values(pslModel.fields)) {\n\t\tif (modelNames.has(field.typeName)) continue;\n\t\tconst uniqueNode = findFieldAttributeNode(field, \"unique\");\n\t\tif (!uniqueNode) continue;\n\t\tif (interpretFieldAttribute({\n\t\t\tnode: uniqueNode,\n\t\t\tspec: mongoAttributeSpecs.field.unique({\n\t\t\t\t...specContext,\n\t\t\t\tfield\n\t\t\t}),\n\t\t\tmodel: pslModel,\n\t\t\tfield,\n\t\t\tsourceFile,\n\t\t\tsourceId,\n\t\t\tdiagnostics\n\t\t}) === void 0) continue;\n\t\tconst fieldUniqueIndex = new MongoIndex({\n\t\t\tkeys: [{\n\t\t\t\tfield: fieldMappings.pslNameToMapped.get(field.name) ?? field.name,\n\t\t\t\tdirection: 1\n\t\t\t}],\n\t\t\tunique: true\n\t\t});\n\t\tindexes.push(fieldUniqueIndex);\n\t\tindexSpans.set(fieldUniqueIndex, nodePslSpan(uniqueNode.syntax, sourceFile));\n\t}\n\tconst attributeNodes = Array.from(pslModel.node.attributes());\n\tfor (const [attrIndex, attr] of pslModel.attributes.entries()) {\n\t\tif (attr.name !== \"index\" && attr.name !== \"unique\" && attr.name !== \"textIndex\") continue;\n\t\tconst node = attributeNodes[attrIndex];\n\t\tif (!node) continue;\n\t\tconst ctx = {\n\t\t\tpslModel,\n\t\t\tfieldMappings,\n\t\t\tindexableFieldNames,\n\t\t\tsourceId,\n\t\t\tspan: attr.span,\n\t\t\tdiagnostics\n\t\t};\n\t\tlet index;\n\t\tif (attr.name === \"textIndex\") {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode,\n\t\t\t\tspec: mongoAttributeSpecs.model.textIndex(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed || parsed.fields.length === 0) continue;\n\t\t\ttextIndexCount++;\n\t\t\tif (textIndexCount > 1) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Only one @@textIndex is allowed per collection (model \"${pslModel.name}\")`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: attr.span\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tindex = buildTextIndex(parsed, ctx);\n\t\t} else {\n\t\t\tconst unique = attr.name === \"unique\";\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode,\n\t\t\t\tspec: unique ? mongoAttributeSpecs.model.unique(specContext) : mongoAttributeSpecs.model.index(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed) continue;\n\t\t\tindex = buildNormalIndex(parsed, unique, ctx);\n\t\t}\n\t\tif (!index) continue;\n\t\tindexes.push(index);\n\t\tindexSpans.set(index, attr.span);\n\t}\n\treturn indexes;\n}\nfunction isRelationField(field, modelNames) {\n\treturn modelNames.has(field.typeName);\n}\nconst MONGO_OBJECT_ID_PSL_TYPE = \"ObjectId\";\nfunction resolveFieldCodecId(field, scalarTypeCodecIds) {\n\treturn scalarTypeCodecIds.get(field.typeName);\n}\nfunction resolveNonRelationField(field, ownerName, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics) {\n\tif (compositeTypeNames.has(field.typeName)) {\n\t\tconst result = {\n\t\t\ttype: {\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: field.typeName\n\t\t\t},\n\t\t\tnullable: field.optional\n\t\t};\n\t\treturn field.list ? {\n\t\t\t...result,\n\t\t\tmany: true\n\t\t} : result;\n\t}\n\tconst enumCodecId = codecIdByEnumName.get(field.typeName);\n\tif (enumCodecId !== void 0) {\n\t\tconst valueSet = {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\tentityName: field.typeName\n\t\t};\n\t\tconst result = {\n\t\t\ttype: {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: enumCodecId\n\t\t\t},\n\t\t\tnullable: field.optional,\n\t\t\tvalueSet\n\t\t};\n\t\treturn field.list ? {\n\t\t\t...result,\n\t\t\tmany: true\n\t\t} : result;\n\t}\n\tif (field.malformedType) return;\n\tconst codecId = resolveFieldCodecId(field, scalarTypeCodecIds);\n\tif (!codecId) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `Field \"${ownerName}.${field.name}\" type \"${field.typeName}\" is not supported in Mongo PSL interpreter`,\n\t\t\tsourceId,\n\t\t\tspan: field.span\n\t\t});\n\t\treturn;\n\t}\n\tconst result = {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId\n\t\t},\n\t\tnullable: field.optional\n\t};\n\treturn field.list ? {\n\t\t...result,\n\t\tmany: true\n\t} : result;\n}\nfunction processEnumDeclarations(input) {\n\tconst builtEnums = {};\n\tif (input.enumBlocks.length === 0) return builtEnums;\n\tconst enumDescriptor = input.authoringContributions?.entityTypes?.[\"enum\"] !== void 0 && isAuthoringEntityTypeDescriptor(input.authoringContributions.entityTypes[\"enum\"]) ? input.authoringContributions.entityTypes[\"enum\"] : void 0;\n\tif (!enumDescriptor) {\n\t\tfor (const decl of input.enumBlocks) input.diagnostics.push({\n\t\t\tcode: \"PSL_ENUM_MISSING_FACTORY\",\n\t\t\tmessage: `enum \"${decl.name}\" requires an \"enum\" entityType factory in the active authoring contributions`,\n\t\t\tsourceId: input.sourceId,\n\t\t\tspan: decl.span\n\t\t});\n\t\treturn builtEnums;\n\t}\n\tfor (const decl of input.enumBlocks) {\n\t\tconst handle = instantiateAuthoringEntityType(\"enum\", enumDescriptor, [decl], input.entityContext);\n\t\tif (handle === void 0 || handle === null) continue;\n\t\tbuiltEnums[decl.name] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: blindCast(m.value)\n\t\t\t}))\n\t\t};\n\t}\n\treturn builtEnums;\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sourceFile, scalarTypeCodecIds, codecLookup } = input;\n\tconst sourceId = input.sourceId;\n\tconst diagnostics = [...input.seedDiagnostics ?? []];\n\tconst topLevel = symbolTable.topLevel;\n\tvalidateNamespaceBlocksForMongoTarget({\n\t\tnamespaces: Object.values(topLevel.namespaces),\n\t\tsourceId,\n\t\tsourceFile,\n\t\tdiagnostics\n\t});\n\tconst allModels = Object.values(topLevel.models);\n\tconst allCompositeTypes = Object.values(topLevel.compositeTypes);\n\tconst modelNames = new Set(allModels.map((m) => m.name));\n\tconst compositeTypeNames = new Set(allCompositeTypes.map((ct) => ct.name));\n\treportUnknownAttributes({\n\t\tmodels: allModels,\n\t\tcompositeTypes: allCompositeTypes,\n\t\tsourceId,\n\t\tdiagnostics\n\t});\n\tconst specContextFor = (model) => ({\n\t\tsymbols: symbolTable,\n\t\tmodel,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t});\n\tconst modelMetadataByName = /* @__PURE__ */ new Map();\n\tfor (const model of allModels) {\n\t\tconst specContext = specContextFor(model);\n\t\tmodelMetadataByName.set(model.name, {\n\t\t\tcollectionName: resolveCollectionName({\n\t\t\t\tmodel,\n\t\t\t\tspecContext,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t}),\n\t\t\tfieldMappings: resolveFieldMappings({\n\t\t\t\tmodel,\n\t\t\t\tspecContext,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t})\n\t\t});\n\t}\n\tconst builtEnums = processEnumDeclarations({\n\t\tenumBlocks: Object.values(topLevel.blocks).filter((b) => b.keyword === \"enum\").map((b) => b.block),\n\t\tsourceId,\n\t\tauthoringContributions: input.authoringContributions,\n\t\tentityContext: {\n\t\t\tfamily: \"mongo\",\n\t\t\ttarget: \"mongo\",\n\t\t\t...ifDefined(\"enumInferenceCodecs\", input.enumInferenceCodecs),\n\t\t\t...ifDefined(\"codecLookup\", codecLookup),\n\t\t\tsourceId,\n\t\t\tdiagnostics: { push: (d) => {\n\t\t\t\tdiagnostics.push(blindCast(d));\n\t\t\t} }\n\t\t},\n\t\tdiagnostics\n\t});\n\tconst codecIdByEnumName = new Map(Object.entries(builtEnums).map(([name, e]) => [name, e.codecId]));\n\tconst models = {};\n\tconst collections = {};\n\tconst roots = {};\n\tconst allFkRelations = [];\n\tconst indexSpans = /* @__PURE__ */ new Map();\n\tconst modelIndexesByName = /* @__PURE__ */ new Map();\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tfor (const pslModel of allModels) {\n\t\tconst metadata = modelMetadataByName.get(pslModel.name);\n\t\tif (!metadata) continue;\n\t\tconst { collectionName, fieldMappings } = metadata;\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = {};\n\t\tconst relations = {};\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tif (isRelationField(field, modelNames)) {\n\t\t\t\tconst relationNode = findFieldAttributeNode(field, \"relation\");\n\t\t\t\tconst relation = relationNode ? interpretFieldAttribute({\n\t\t\t\t\tnode: relationNode,\n\t\t\t\t\tspec: mongoAttributeSpecs.field.relation({\n\t\t\t\t\t\t...specContext,\n\t\t\t\t\t\tfield\n\t\t\t\t\t}),\n\t\t\t\t\tmodel: pslModel,\n\t\t\t\t\tfield,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tdiagnostics,\n\t\t\t\t\tresolveReferencedModel: () => allModels.find((m) => m.name === field.typeName)\n\t\t\t\t}) : void 0;\n\t\t\t\tif (field.list || !(relation?.fields && relation?.references)) {\n\t\t\t\t\tbackrelationCandidates.push({\n\t\t\t\t\t\tmodelName: pslModel.name,\n\t\t\t\t\t\tfieldName: field.name,\n\t\t\t\t\t\ttargetModelName: field.typeName,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation?.name),\n\t\t\t\t\t\tcardinality: field.list ? \"1:N\" : \"1:1\",\n\t\t\t\t\t\tfield\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (relation?.fields && relation?.references) {\n\t\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\t\townsReference: true\n\t\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\t\tdiagnostics.push(relationNullabilityMismatchDiagnostic(pslModel.name, field, sourceId));\n\t\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, field.typeName),\n\t\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst localMapped = relation.fields.map((f) => fieldMappings.pslNameToMapped.get(f) ?? f);\n\t\t\t\t\tconst targetFieldMappings = modelMetadataByName.get(field.typeName)?.fieldMappings;\n\t\t\t\t\tconst targetMapped = relation.references.map((f) => targetFieldMappings?.pslNameToMapped.get(f) ?? f);\n\t\t\t\t\trelations[field.name] = {\n\t\t\t\t\t\tto: mongoCrossRef(field.typeName),\n\t\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\t\tnullable: field.optional,\n\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\tlocalFields: localMapped,\n\t\t\t\t\t\t\ttargetFields: targetMapped\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tallFkRelations.push({\n\t\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\t\tfieldName: field.name,\n\t\t\t\t\t\ttargetModel: field.typeName,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\n\t\t\t\t\t\tlocalFields: localMapped,\n\t\t\t\t\t\ttargetFields: targetMapped\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = resolveNonRelationField(field, pslModel.name, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics);\n\t\t\tif (!resolved) continue;\n\t\t\tconst mappedName = fieldMappings.pslNameToMapped.get(field.name) ?? field.name;\n\t\t\tfields[mappedName] = resolved;\n\t\t}\n\t\tconst isVariantModel = pslModel.attributes.some((attr) => attr.name === \"base\");\n\t\tconst hasIdField = Object.values(pslModel.fields).filter((field) => {\n\t\t\tconst idNode = findFieldAttributeNode(field, \"id\");\n\t\t\tif (!idNode) return false;\n\t\t\treturn interpretFieldAttribute({\n\t\t\t\tnode: idNode,\n\t\t\t\tspec: mongoAttributeSpecs.field.id({\n\t\t\t\t\t...specContext,\n\t\t\t\t\tfield\n\t\t\t\t}),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tfield,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t}) !== void 0;\n\t\t}).length > 0;\n\t\tif (!isVariantModel) if (!hasIdField) diagnostics.push({\n\t\t\tcode: \"PSL_MISSING_ID_FIELD\",\n\t\t\tmessage: `Model \"${pslModel.name}\" has no field with @id attribute. Every model must have exactly one @id field.`,\n\t\t\tsourceId\n\t\t});\n\t\telse {\n\t\t\tconst objectIdCodecId = scalarTypeCodecIds.get(MONGO_OBJECT_ID_PSL_TYPE);\n\t\t\tconst idField = fields[\"_id\"];\n\t\t\tif (!(idField !== void 0 && idField.type.kind === \"scalar\" && objectIdCodecId !== void 0 && idField.type.codecId === objectIdCodecId)) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_ID_REQUIRED\",\n\t\t\t\tmessage: `Model \"${pslModel.name}\" must declare an _id field of type ObjectId (e.g. \\`id ObjectId @id @map(\"_id\")\\`).`,\n\t\t\t\tsourceId\n\t\t\t});\n\t\t}\n\t\tmodels[pslModel.name] = {\n\t\t\tfields,\n\t\t\trelations,\n\t\t\tstorage: { collection: collectionName }\n\t\t};\n\t\tconst modelIndexes = collectIndexes(pslModel, specContext, fieldMappings, modelNames, sourceId, sourceFile, diagnostics, indexSpans);\n\t\tmodelIndexesByName.set(pslModel.name, modelIndexes);\n\t\tconst existingColl = collections[collectionName];\n\t\tif (existingColl && modelIndexes.length > 0) collections[collectionName] = { indexes: [...collectionIndexes(existingColl), ...modelIndexes] };\n\t\telse if (!existingColl) collections[collectionName] = modelIndexes.length > 0 ? { indexes: modelIndexes } : {};\n\t\troots[collectionName] = mongoCrossRef(pslModel.name);\n\t}\n\tconst valueObjects = {};\n\tfor (const compositeType of allCompositeTypes) {\n\t\tconst fields = {};\n\t\tfor (const field of Object.values(compositeType.fields)) {\n\t\t\tconst resolved = resolveNonRelationField(field, compositeType.name, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics);\n\t\t\tif (!resolved) continue;\n\t\t\tfields[field.name] = resolved;\n\t\t}\n\t\tvalueObjects[compositeType.name] = { fields };\n\t}\n\tconst fkRelationsByPair = /* @__PURE__ */ new Map();\n\tfor (const fk of allFkRelations) {\n\t\tconst key = fkRelationPairKey(fk.declaringModel, fk.targetModel);\n\t\tconst existing = fkRelationsByPair.get(key);\n\t\tif (existing) existing.push(fk);\n\t\telse fkRelationsByPair.set(key, [fk]);\n\t}\n\tfor (const candidate of backrelationCandidates) {\n\t\tconst pairKey = fkRelationPairKey(candidate.targetModelName, candidate.modelName);\n\t\tconst pairMatches = fkRelationsByPair.get(pairKey) ?? [];\n\t\tconst matches = candidate.relationName ? pairMatches.filter((r) => r.relationName === candidate.relationName) : [...pairMatches];\n\t\tif (matches.length === 0) {\n\t\t\tif (consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings)) continue;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${candidate.modelName}.${candidate.fieldName}\" has no matching FK-side relation on model \"${candidate.targetModelName}\". Add @relation(fields: [...], references: [...]) on the FK-side relation or use an explicit join model for many-to-many.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: candidate.field.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (matches.length > 1) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_AMBIGUOUS_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${candidate.modelName}.${candidate.fieldName}\" matches multiple FK-side relations on model \"${candidate.targetModelName}\". Add @relation(\"...\") to both sides to disambiguate.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: candidate.field.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst fk = matches[0];\n\t\tif (!fk) continue;\n\t\tconst modelEntry = models[candidate.modelName];\n\t\tif (!modelEntry) continue;\n\t\tif (candidate.cardinality === \"1:1\" && !candidate.field.optional) diagnostics.push(requiredOneToOneBackrelationDiagnostic({\n\t\t\tmodelName: candidate.modelName,\n\t\t\tfield: candidate.field,\n\t\t\ttargetModelName: candidate.targetModelName,\n\t\t\tsourceId,\n\t\t\trecordNoun: \"document\"\n\t\t}));\n\t\tmodelEntry.relations[candidate.fieldName] = {\n\t\t\tto: mongoCrossRef(candidate.targetModelName),\n\t\t\t...candidate.cardinality === \"1:N\" ? { cardinality: \"1:N\" } : {\n\t\t\t\tcardinality: \"1:1\",\n\t\t\t\tnullable: true\n\t\t\t},\n\t\t\ton: {\n\t\t\t\tlocalFields: fk.targetFields,\n\t\t\t\ttargetFields: fk.localFields\n\t\t\t}\n\t\t};\n\t}\n\tconst { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(allModels, specContextFor, modelMetadataByName, sourceFile, sourceId, diagnostics);\n\tconst polyResult = resolvePolymorphism({\n\t\tmodels,\n\t\troots,\n\t\tcollections,\n\t\tallModels,\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations,\n\t\tmodelNames,\n\t\tindexSpans,\n\t\tmodelIndexesByName,\n\t\tmodelMetadataByName,\n\t\tsourceId\n\t});\n\tif (diagnostics.length > 0 || polyResult.diagnostics.length > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [...diagnostics, ...polyResult.diagnostics]\n\t});\n\tconst resolvedModels = polyResult.models;\n\tconst resolvedCollections = polyResult.collections;\n\tconst storageValueSets = {};\n\tconst enumEntries = Object.entries(builtEnums);\n\tif (enumEntries.length > 0) {\n\t\tassertDefined(codecLookup, \"Mongo PSL interpretation requires a codec lookup to encode enum values\");\n\t\tfor (const [enumName, builtEnum] of enumEntries) storageValueSets[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: builtEnum.members.map((m) => encodeEnumValue(m.value, builtEnum.codecId, codecLookup))\n\t\t};\n\t}\n\tfor (const [, modelEntry] of Object.entries(resolvedModels)) {\n\t\tif (modelEntry.base) continue;\n\t\tconst coll = resolvedCollections[modelEntry.storage.collection];\n\t\tif (!coll) continue;\n\t\tif (modelEntry.discriminator && modelEntry.variants) {\n\t\t\tconst variantEntries = Object.entries(modelEntry.variants).map(([variantName, { value }]) => ({\n\t\t\t\tdiscriminatorValue: value,\n\t\t\t\tfields: resolvedModels[variantName]?.fields ?? {}\n\t\t\t}));\n\t\t\tcoll[\"validator\"] = derivePolymorphicJsonSchema(modelEntry.fields, modelEntry.discriminator.field, variantEntries, valueObjects, codecLookup, storageValueSets);\n\t\t} else coll[\"validator\"] = deriveJsonSchema(modelEntry.fields, valueObjects, codecLookup, storageValueSets);\n\t}\n\tconst target = \"mongo\";\n\tconst targetFamily = \"mongo\";\n\tconst collectionInputs = {};\n\tfor (const [name, coll] of Object.entries(resolvedCollections)) {\n\t\tconst raw = {};\n\t\tif (coll[\"indexes\"] != null) raw[\"indexes\"] = coll[\"indexes\"];\n\t\tif (coll[\"validator\"] != null) raw[\"validator\"] = coll[\"validator\"];\n\t\tif (coll[\"options\"] != null) raw[\"options\"] = coll[\"options\"];\n\t\tcollectionInputs[name] = blindCast(raw);\n\t}\n\tconst unboundNamespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: collectionInputs,\n\t\t\t...Object.keys(storageValueSets).length > 0 ? { valueSet: storageValueSets } : {}\n\t\t}\n\t});\n\tconst storage = blindCast(new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tstorage: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: unboundNamespace.entries.collection,\n\t\t\t\t\t...unboundNamespace.entries.valueSet !== void 0 ? { valueSet: unboundNamespace.entries.valueSet } : {}\n\t\t\t\t}\n\t\t\t} } },\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: unboundNamespace }\n\t}));\n\tconst capabilities = {};\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\treturn ok({\n\t\ttargetFamily,\n\t\ttarget,\n\t\troots: polyResult.roots,\n\t\tdomain: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\tmodels: polyResult.models,\n\t\t\t...Object.keys(valueObjects).length > 0 ? { valueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\textensions: {},\n\t\tcapabilities,\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {}\n\t});\n}\n//#endregion\nexport { derivePolymorphicJsonSchema as i, mongoAttributeSpecs as n, deriveJsonSchema as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-Bth09A-v.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,gBAAgB,SAAS,aAAa;CAC9C,OAAO,aAAa,eAAe,OAAO,CAAC,GAAG;AAC/C;AACA,SAAS,kBAAkB,OAAO,cAAc,aAAa,WAAW;CACvE,IAAI,MAAM,KAAK,SAAS,UAAU;EACjC,MAAM,WAAW,gBAAgB,MAAM,KAAK,SAAS,WAAW;EAChE,IAAI,CAAC,UAAU,OAAO,KAAK;EAC3B,MAAM,aAAa,MAA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AAY,iBAAiB,QAAQ;KACrC,GAAG,iBAAiB,QAAQ,aAAa,KAAK,IAAI,EAAE,UAAU,iBAAiB,QAAQ,SAAS,IAAI,CAAC;IACtG;GACD,EAAE,EAAE;GACJ,GAAG;EACJ,CAAC;EACD,YAAY,GAAG,uBAAuB,iBAAiB;CACxD,CAAC,CAAC;CACF,MAAM,eAAe,CAAC;CACtB,MAAM,WAAW,OAAO,KAAK,UAAU,CAAC,CAAC,SAAS;CAClD,OAAO,GAAG;EACT;EACA;EACA,OAAO,WAAW;EAClB,QAAQ,EAAE,YAAY,GAAG,uBAAuB;GAC/C,QAAQ,WAAW;GACnB,GAAG,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,IAAI,EAAE,aAAa,IAAI,CAAC;GAC9D,GAAG,WAAW,EAAE,MAAM,WAAW,IAAI,CAAC;EACvC,EAAE,EAAE;EACJ;EACA,YAAY,CAAC;EACb;EACA,aAAa,mBAAmB;GAC/B;GACA;GACA;EACD,CAAC;EACD,MAAM,CAAC;CACR,CAAC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-family-mongo",
|
|
3
|
-
"version": "8.0.0-rc.9-dev.
|
|
3
|
+
"version": "8.0.0-rc.9-dev.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,29 +9,29 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.9-dev.
|
|
13
|
-
"@prisma/orm-toolchain": "8.0.0-rc.9-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.9-dev.5",
|
|
13
|
+
"@prisma/orm-toolchain": "8.0.0-rc.9-dev.5",
|
|
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.9-dev.
|
|
20
|
-
"@internal/mongo-codec": "8.0.0-rc.9-dev.
|
|
21
|
-
"@internal/mongo-contract": "8.0.0-rc.9-dev.
|
|
22
|
-
"@internal/mongo-contract-psl": "8.0.0-rc.9-dev.
|
|
23
|
-
"@internal/mongo-contract-ts": "8.0.0-rc.9-dev.
|
|
24
|
-
"@internal/mongo-emitter": "8.0.0-rc.9-dev.
|
|
25
|
-
"@internal/mongo-lowering": "8.0.0-rc.9-dev.
|
|
26
|
-
"@internal/mongo-orm": "8.0.0-rc.9-dev.
|
|
27
|
-
"@internal/mongo-query-ast": "8.0.0-rc.9-dev.
|
|
28
|
-
"@internal/mongo-query-builder": "8.0.0-rc.9-dev.
|
|
29
|
-
"@internal/mongo-runtime": "8.0.0-rc.9-dev.
|
|
30
|
-
"@internal/mongo-schema-ir": "8.0.0-rc.9-dev.
|
|
31
|
-
"@internal/mongo-value": "8.0.0-rc.9-dev.
|
|
32
|
-
"@internal/mongo-wire": "8.0.0-rc.9-dev.
|
|
33
|
-
"@repo/tsconfig": "8.0.0-rc.9-dev.
|
|
34
|
-
"@repo/tsdown": "8.0.0-rc.9-dev.
|
|
19
|
+
"@internal/family-mongo": "8.0.0-rc.9-dev.5",
|
|
20
|
+
"@internal/mongo-codec": "8.0.0-rc.9-dev.5",
|
|
21
|
+
"@internal/mongo-contract": "8.0.0-rc.9-dev.5",
|
|
22
|
+
"@internal/mongo-contract-psl": "8.0.0-rc.9-dev.5",
|
|
23
|
+
"@internal/mongo-contract-ts": "8.0.0-rc.9-dev.5",
|
|
24
|
+
"@internal/mongo-emitter": "8.0.0-rc.9-dev.5",
|
|
25
|
+
"@internal/mongo-lowering": "8.0.0-rc.9-dev.5",
|
|
26
|
+
"@internal/mongo-orm": "8.0.0-rc.9-dev.5",
|
|
27
|
+
"@internal/mongo-query-ast": "8.0.0-rc.9-dev.5",
|
|
28
|
+
"@internal/mongo-query-builder": "8.0.0-rc.9-dev.5",
|
|
29
|
+
"@internal/mongo-runtime": "8.0.0-rc.9-dev.5",
|
|
30
|
+
"@internal/mongo-schema-ir": "8.0.0-rc.9-dev.5",
|
|
31
|
+
"@internal/mongo-value": "8.0.0-rc.9-dev.5",
|
|
32
|
+
"@internal/mongo-wire": "8.0.0-rc.9-dev.5",
|
|
33
|
+
"@repo/tsconfig": "8.0.0-rc.9-dev.5",
|
|
34
|
+
"@repo/tsdown": "8.0.0-rc.9-dev.5",
|
|
35
35
|
"tsdown": "0.22.14",
|
|
36
36
|
"typescript": "5.9.3"
|
|
37
37
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpreter-BCt8cG3P-DJ8yDc_N.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-BCt8cG3P.mjs"],"sourcesContent":["import { MongoIndex, MongoStorage, MongoValidator, applyPolymorphicScopeToMongoIndex, buildMongoNamespace } from \"@internal/mongo-contract\";\nimport { computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { errorEnumCodecNotInPackStack } from \"@internal/errors/control\";\nimport { instantiateAuthoringEntityType, isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, int, interpretAttribute, json, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str } from \"@internal/psl-parser\";\nimport { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic } from \"@internal/psl-parser/interpret\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/derive-json-schema.ts\nfunction resolveBsonType(codecId, codecLookup) {\n\treturn codecLookup?.targetTypesFor(codecId)?.[0];\n}\nfunction fieldToBsonSchema(field, valueObjects, codecLookup, valueSets) {\n\tif (field.type.kind === \"scalar\") {\n\t\tconst bsonType = resolveBsonType(field.type.codecId, codecLookup);\n\t\tif (!bsonType) return void 0;\n\t\tconst enumValues = field.valueSet !== void 0 ? valueSets?.[field.valueSet.entityName]?.values ?? null : null;\n\t\tif (\"many\" in field && field.many) {\n\t\t\tconst items = { bsonType };\n\t\t\tif (enumValues) items[\"enum\"] = enumValues;\n\t\t\treturn {\n\t\t\t\tbsonType: \"array\",\n\t\t\t\titems\n\t\t\t};\n\t\t}\n\t\tif (field.nullable) {\n\t\t\tconst s = { bsonType: [\"null\", bsonType] };\n\t\t\tif (enumValues) s[\"enum\"] = [...enumValues, null];\n\t\t\treturn s;\n\t\t}\n\t\tconst s = { bsonType };\n\t\tif (enumValues) s[\"enum\"] = enumValues;\n\t\treturn s;\n\t}\n\tif (field.type.kind === \"valueObject\") {\n\t\tconst vo = valueObjects?.[field.type.name];\n\t\tif (!vo) return void 0;\n\t\tconst voSchema = deriveObjectSchema(vo.fields, valueObjects, codecLookup, valueSets);\n\t\tif (\"many\" in field && field.many) return {\n\t\t\tbsonType: \"array\",\n\t\t\titems: voSchema\n\t\t};\n\t\tif (field.nullable) return { oneOf: [{ bsonType: \"null\" }, voSchema] };\n\t\treturn voSchema;\n\t}\n}\nfunction deriveObjectSchema(fields, valueObjects, codecLookup, valueSets) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) {\n\t\tconst schema = fieldToBsonSchema(field, valueObjects, codecLookup, valueSets);\n\t\tif (schema) {\n\t\t\tproperties[fieldName] = schema;\n\t\t\tif (!field.nullable) required.push(fieldName);\n\t\t}\n\t}\n\tconst result = {\n\t\tbsonType: \"object\",\n\t\tproperties,\n\t\tadditionalProperties: false\n\t};\n\tif (required.length > 0) result[\"required\"] = required.sort();\n\treturn result;\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction deriveJsonSchema(fields, valueObjects, codecLookup, valueSets) {\n\treturn new MongoValidator({\n\t\tjsonSchema: deriveObjectSchema(fields, valueObjects, codecLookup, valueSets),\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\nfunction derivePolymorphicJsonSchema(baseFields, discriminatorField, variants, valueObjects, codecLookup, valueSets) {\n\tconst baseSchema = deriveObjectSchema(baseFields, valueObjects, codecLookup, valueSets);\n\tconst baseProperties = isRecord(baseSchema[\"properties\"]) ? baseSchema[\"properties\"] : {};\n\tconst oneOf = [];\n\tfor (const variant of variants) {\n\t\tconst variantOnlyFields = {};\n\t\tfor (const [name, field] of Object.entries(variant.fields)) if (!(name in baseFields)) variantOnlyFields[name] = field;\n\t\tconst variantProperties = {};\n\t\tconst variantRequired = [discriminatorField];\n\t\tfor (const [name, field] of Object.entries(variantOnlyFields)) {\n\t\t\tconst schema = fieldToBsonSchema(field, valueObjects, codecLookup, valueSets);\n\t\t\tif (schema) {\n\t\t\t\tvariantProperties[name] = schema;\n\t\t\t\tif (!field.nullable) variantRequired.push(name);\n\t\t\t}\n\t\t}\n\t\tconst entry = {\n\t\t\tproperties: {\n\t\t\t\t...baseProperties,\n\t\t\t\t[discriminatorField]: { enum: [variant.discriminatorValue] },\n\t\t\t\t...variantProperties\n\t\t\t},\n\t\t\trequired: variantRequired.sort(),\n\t\t\tadditionalProperties: false\n\t\t};\n\t\toneOf.push(entry);\n\t}\n\tconst jsonSchema = { ...baseSchema };\n\tdelete jsonSchema[\"additionalProperties\"];\n\tif (oneOf.length > 0) jsonSchema[\"oneOf\"] = oneOf;\n\treturn new MongoValidator({\n\t\tjsonSchema,\n\t\tvalidationLevel: \"strict\",\n\t\tvalidationAction: \"error\"\n\t});\n}\n//#endregion\n//#region src/mongo-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst mapFieldSpec = fieldAttribute(\"map\", { positional: [{\n\tkey: \"name\",\n\ttype: str()\n}] });\nconst idFieldSpec = fieldAttribute(\"id\", {});\nconst uniqueFieldSpec = fieldAttribute(\"unique\", {});\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str())\n\t}],\n\tnamed: {\n\t\tname: optional(str()),\n\t\tfields: optional(list(fieldRef(), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t})),\n\t\treferences: optional(list(referencedFieldRef(), {\n\t\t\tnonEmpty: true,\n\t\t\tunique: true\n\t\t}))\n\t}\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", { positional: [{\n\tkey: \"field\",\n\ttype: fieldRef()\n}] });\nconst baseModelSpec = modelAttribute(\"base\", { positional: [{\n\tkey: \"base\",\n\ttype: entityRef()\n}, {\n\tkey: \"value\",\n\ttype: str()\n}] });\nconst sortSig = { named: { sort: oneOf(identifier(\"Asc\"), identifier(\"Desc\")) } };\nfunction indexFieldElement(fieldNames) {\n\treturn oneOf(...[\n\t\tfieldRef(),\n\t\tfuncCall(\"wildcard\", { positional: [{\n\t\t\tkey: \"scope\",\n\t\t\ttype: optional(entityRef())\n\t\t}] }),\n\t\t...fieldNames.map((name) => funcCall(name, sortSig))\n\t]);\n}\nconst collationNamedArgs = {\n\tcollationLocale: optional(str()),\n\tcollationStrength: optional(oneOf(num(1), num(2), num(3), num(4), num(5))),\n\tcollationCaseLevel: optional(bool()),\n\tcollationCaseFirst: optional(oneOf(str(\"upper\"), str(\"lower\"), str(\"off\"))),\n\tcollationNumericOrdering: optional(bool()),\n\tcollationAlternate: optional(oneOf(str(\"non-ignorable\"), str(\"shifted\"))),\n\tcollationMaxVariable: optional(oneOf(str(\"punct\"), str(\"space\"))),\n\tcollationBackwards: optional(bool()),\n\tcollationNormalization: optional(bool())\n};\nfunction buildIndexModelSpec(name, fieldElement) {\n\treturn modelAttribute(name, {\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(fieldElement, { nonEmpty: true })\n\t\t}],\n\t\tnamed: {\n\t\t\ttype: optional(oneOf(num(1), num(-1), str(\"text\"), str(\"2dsphere\"), str(\"2d\"), str(\"hashed\"))),\n\t\t\tsparse: optional(bool()),\n\t\t\texpireAfterSeconds: optional(int()),\n\t\t\tfilter: optional(json()),\n\t\t\tinclude: optional(list(str())),\n\t\t\texclude: optional(list(str())),\n\t\t\tdefault_language: optional(str()),\n\t\t\tlanguageOverride: optional(str()),\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction buildTextIndexModelSpec(fieldElement) {\n\treturn modelAttribute(\"textIndex\", {\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(fieldElement, { nonEmpty: true })\n\t\t}],\n\t\tnamed: {\n\t\t\tfilter: optional(json()),\n\t\t\tweights: optional(record(int({\n\t\t\t\tmin: 1,\n\t\t\t\tmax: 99999\n\t\t\t}))),\n\t\t\tlanguage: optional(str()),\n\t\t\tlanguageOverride: optional(str()),\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction modelFieldElement(ctx) {\n\treturn indexFieldElement(Object.keys(ctx.model.fields));\n}\nfunction staticModelSpec(spec) {\n\treturn () => spec;\n}\nfunction staticFieldSpec(spec) {\n\treturn () => spec;\n}\nconst mongoAttributeSpecs = {\n\tmodel: {\n\t\tmap: staticModelSpec(mapModelSpec),\n\t\tdiscriminator: staticModelSpec(discriminatorModelSpec),\n\t\tbase: staticModelSpec(baseModelSpec),\n\t\tindex: (ctx) => buildIndexModelSpec(\"index\", modelFieldElement(ctx)),\n\t\tunique: (ctx) => buildIndexModelSpec(\"unique\", modelFieldElement(ctx)),\n\t\ttextIndex: (ctx) => buildTextIndexModelSpec(modelFieldElement(ctx))\n\t},\n\tfield: {\n\t\tid: staticFieldSpec(idFieldSpec),\n\t\tunique: staticFieldSpec(uniqueFieldSpec),\n\t\tmap: staticFieldSpec(mapFieldSpec),\n\t\trelation: staticFieldSpec(relationFieldSpec)\n\t}\n};\n//#endregion\n//#region src/psl-helpers.ts\nfunction lowerFirst(value) {\n\tif (value.length === 0) return value;\n\treturn value[0]?.toLowerCase() + value.slice(1);\n}\nfunction getAttribute(attributes, name) {\n\treturn attributes.find((attr) => attr.name === name);\n}\n//#endregion\n//#region src/interpreter.ts\n/**\n* Encode an authored enum value to its codec-encoded JSON form via the codec resolved by id from the\n* contract's codec lookup, so a non-identity `encodeJson` (permitted by the `mongoCodec` factory) is\n* respected. Matches the TS builder's `encodeEnumValue`: the lookup is always threaded in production,\n* and a codecId the lookup cannot resolve is a hard error — the enum uses a codec that is not part of\n* the contract's pack stack.\n*/\nfunction encodeEnumValue(value, codecId, codecLookup) {\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw errorEnumCodecNotInPackStack({ codecId });\n\treturn codec.encodeJson(value);\n}\n/**\n* Mongo's PSL surface binds the database from the connection string, so every\n* explicit namespace block is invalid, including `namespace unbound { … }`.\n*/\nfunction validateNamespaceBlocksForMongoTarget(input) {\n\tfor (const namespace of input.namespaces) input.diagnostics.push({\n\t\tcode: \"PSL_UNSUPPORTED_NAMESPACE_BLOCK\",\n\t\tmessage: `Mongo does not support \\`namespace ${namespace.name} { … }\\` blocks (the database is bound by the connection string; declare models at the document top level instead).`,\n\t\tsourceId: input.sourceId,\n\t\tspan: nodePslSpan(namespace.node.syntax, input.sourceFile)\n\t});\n}\nconst UNLOWERED_FIELD_ATTRIBUTE_HINTS = /* @__PURE__ */ new Map([[\"updatedAt\", \"Mongo lowers no automatic timestamp updates; delete the attribute and set the timestamp in application code.\"]]);\nfunction unsupportedFieldAttributeMessage(ownerName, fieldName, attributeName) {\n\tconst base = `Field \"${ownerName}.${fieldName}\" uses unsupported attribute \"@${attributeName}\"`;\n\tconst hint = UNLOWERED_FIELD_ATTRIBUTE_HINTS.get(attributeName);\n\treturn hint === void 0 ? base : `${base}. ${hint}`;\n}\nfunction reportUnknownAttributes(input) {\n\tconst { sourceId, diagnostics } = input;\n\tfor (const model of input.models) for (const attribute of model.attributes) {\n\t\tif (Object.hasOwn(mongoAttributeSpecs.model, attribute.name)) continue;\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_MODEL_ATTRIBUTE\",\n\t\t\tmessage: `Model \"${model.name}\" uses unsupported attribute \"@@${attribute.name}\"`,\n\t\t\tsourceId,\n\t\t\tspan: attribute.span\n\t\t});\n\t}\n\tfor (const owner of [...input.models, ...input.compositeTypes]) for (const field of Object.values(owner.fields)) for (const attribute of field.attributes) {\n\t\tif (Object.hasOwn(mongoAttributeSpecs.field, attribute.name)) continue;\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_ATTRIBUTE\",\n\t\t\tmessage: unsupportedFieldAttributeMessage(owner.name, field.name, attribute.name),\n\t\t\tsourceId,\n\t\t\tspan: attribute.span\n\t\t});\n\t}\n}\nfunction relationNullabilityMismatchDiagnostic(modelName, field, sourceId) {\n\tconst fieldLabel = `Relation field \"${modelName}.${field.name}\"`;\n\treturn {\n\t\tcode: \"PSL_RELATION_NULLABILITY_MISMATCH\",\n\t\tmessage: field.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.name}\" or make those fields required.`,\n\t\tsourceId,\n\t\tspan: field.span\n\t};\n}\nfunction resolveFieldMappings(input) {\n\tconst { model, specContext, sourceFile, sourceId, diagnostics } = input;\n\tconst pslNameToMapped = /* @__PURE__ */ new Map();\n\tfor (const field of Object.values(model.fields)) {\n\t\tconst mapNode = findFieldAttributeNode(field, \"map\");\n\t\tconst mapped = (mapNode ? interpretFieldAttribute({\n\t\t\tnode: mapNode,\n\t\t\tspec: mongoAttributeSpecs.field.map({\n\t\t\t\t...specContext,\n\t\t\t\tfield\n\t\t\t}),\n\t\t\tmodel,\n\t\t\tfield,\n\t\t\tsourceFile,\n\t\t\tsourceId,\n\t\t\tdiagnostics\n\t\t})?.name : void 0) ?? field.name;\n\t\tpslNameToMapped.set(field.name, mapped);\n\t}\n\treturn { pslNameToMapped };\n}\nfunction resolveCollectionName(input) {\n\tconst { model, specContext, sourceFile, sourceId, diagnostics } = input;\n\tconst mapNode = findModelAttributeNode(model, \"map\");\n\treturn (mapNode ? interpretModelAttribute({\n\t\tnode: mapNode,\n\t\tspec: mongoAttributeSpecs.model.map(specContext),\n\t\tmodel,\n\t\tsourceFile,\n\t\tsourceId,\n\t\tdiagnostics\n\t})?.name : void 0) ?? lowerFirst(model.name);\n}\nfunction mongoCrossRef(modelName) {\n\treturn crossRef(modelName, UNBOUND_NAMESPACE_ID);\n}\nfunction collectPolymorphismDeclarations(models, specContextFor, modelMetadataByName, sourceFile, sourceId, diagnostics) {\n\tconst discriminatorDeclarations = /* @__PURE__ */ new Map();\n\tconst baseDeclarations = /* @__PURE__ */ new Map();\n\tfor (const model of models) {\n\t\tconst specContext = specContextFor(model);\n\t\tconst discNode = findModelAttributeNode(model, \"discriminator\");\n\t\tif (discNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode: discNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.discriminator(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) {\n\t\t\t\tconst fieldName = parsed.field;\n\t\t\t\tconst discField = model.fields[fieldName];\n\t\t\t\tif (discField && discField.typeName !== \"String\") diagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\t\tmessage: `Discriminator field \"${fieldName}\" on model \"${model.name}\" must be of type String, but is \"${discField.typeName}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t\telse discriminatorDeclarations.set(model.name, {\n\t\t\t\t\tfieldName,\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst baseNode = findModelAttributeNode(model, \"base\");\n\t\tif (baseNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode: baseNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.base(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) {\n\t\t\t\tconst collectionName = modelMetadataByName.get(model.name)?.collectionName ?? lowerFirst(model.name);\n\t\t\t\tbaseDeclarations.set(model.name, {\n\t\t\t\t\tbaseName: parsed.base,\n\t\t\t\t\tvalue: parsed.value,\n\t\t\t\t\tcollectionName,\n\t\t\t\t\tspan: nodePslSpan(baseNode.syntax, sourceFile)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations\n\t};\n}\nfunction resolvePolymorphism(input) {\n\tconst { discriminatorDeclarations, baseDeclarations, modelNames, modelMetadataByName, sourceId, allModels: allModelViews, indexSpans, modelIndexesByName } = input;\n\tlet patched = input.models;\n\tlet roots = input.roots;\n\tlet collections = input.collections;\n\tconst diagnostics = [];\n\tfor (const [modelName, decl] of discriminatorDeclarations) {\n\t\tif (baseDeclarations.has(modelName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_AND_BASE\",\n\t\t\t\tmessage: `Model \"${modelName}\" cannot have both @@discriminator and @@base`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst model = patched[modelName];\n\t\tif (!model) continue;\n\t\tconst mappedDiscriminatorField = modelMetadataByName.get(modelName)?.fieldMappings.pslNameToMapped.get(decl.fieldName) ?? decl.fieldName;\n\t\tif (!Object.hasOwn(model.fields, mappedDiscriminatorField)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Discriminator field \"${decl.fieldName}\" is not a field on model \"${modelName}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst variants = {};\n\t\tfor (const [variantName, baseDecl] of baseDeclarations) {\n\t\t\tif (baseDecl.baseName !== modelName) continue;\n\t\t\tvariants[variantName] = { value: baseDecl.value };\n\t\t}\n\t\tif (Object.keys(variants).length === 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_DISCRIMINATOR\",\n\t\t\t\tmessage: `Model \"${modelName}\" has @@discriminator but no variant models declare @@base(${modelName}, ...)`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: decl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpatched = {\n\t\t\t...patched,\n\t\t\t[modelName]: {\n\t\t\t\t...model,\n\t\t\t\tdiscriminator: { field: mappedDiscriminatorField },\n\t\t\t\tvariants\n\t\t\t}\n\t\t};\n\t}\n\tfor (const [variantName, baseDecl] of baseDeclarations) {\n\t\tif (!modelNames.has(baseDecl.baseName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_BASE_TARGET_NOT_FOUND\",\n\t\t\t\tmessage: `Model \"${variantName}\" @@base references non-existent model \"${baseDecl.baseName}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!discriminatorDeclarations.has(baseDecl.baseName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BASE\",\n\t\t\t\tmessage: `Model \"${variantName}\" declares @@base(${baseDecl.baseName}, ...) but \"${baseDecl.baseName}\" has no @@discriminator`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (discriminatorDeclarations.has(variantName)) continue;\n\t\tconst baseModel = patched[baseDecl.baseName];\n\t\tconst variantModelView = allModelViews.find((m) => m.name === variantName);\n\t\tif (!variantModelView) continue;\n\t\tif (getAttribute(variantModelView.attributes, \"map\") !== void 0 && baseModel && baseDecl.collectionName !== baseModel.storage.collection) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\",\n\t\t\t\tmessage: `Mongo variant \"${variantName}\" cannot use a different collection than its base \"${baseDecl.baseName}\". Mongo only supports single-collection polymorphism.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: baseDecl.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst baseCollection = baseModel?.storage.collection ?? baseDecl.collectionName;\n\t\tconst variantModel = patched[variantName];\n\t\tif (variantModel) patched = {\n\t\t\t...patched,\n\t\t\t[variantName]: {\n\t\t\t\t...variantModel,\n\t\t\t\tbase: mongoCrossRef(baseDecl.baseName),\n\t\t\t\tstorage: { collection: baseCollection }\n\t\t\t}\n\t\t};\n\t\tconst variantCollectionName = modelMetadataByName.get(variantName)?.collectionName ?? lowerFirst(variantName);\n\t\tif (roots[variantCollectionName]?.model === variantName) if (variantCollectionName === baseCollection && baseModel) roots = {\n\t\t\t...roots,\n\t\t\t[variantCollectionName]: mongoCrossRef(baseDecl.baseName)\n\t\t};\n\t\telse roots = Object.fromEntries(Object.entries(roots).filter(([key]) => key !== variantCollectionName));\n\t\tconst variantOwnIndexes = modelIndexesByName.get(variantName) ?? [];\n\t\tconst baseColl = collections[baseCollection];\n\t\tconst discriminatorField = patched[baseDecl.baseName]?.discriminator?.field;\n\t\tconst scopedVariantIndexes = [];\n\t\tif (discriminatorField) for (const idx of variantOwnIndexes) {\n\t\t\tconst result = applyPolymorphicScopeToMongoIndex(idx, {\n\t\t\t\tdiscriminatorField,\n\t\t\t\tdiscriminatorValue: baseDecl.value\n\t\t\t});\n\t\t\tif (result.kind === \"conflict\") {\n\t\t\t\tconst span = indexSpans.get(idx) ?? baseDecl.span;\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Variant \"${variantName}\" index conflicts with discriminator scope: ${result.reason}`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (result.index !== idx) indexSpans.set(result.index, indexSpans.get(idx) ?? baseDecl.span);\n\t\t\tscopedVariantIndexes.push(result.index);\n\t\t}\n\t\telse scopedVariantIndexes.push(...variantOwnIndexes);\n\t\tif (variantCollectionName !== baseCollection) {\n\t\t\tconst filtered = Object.fromEntries(Object.entries(collections).filter(([key]) => key !== variantCollectionName));\n\t\t\tif (scopedVariantIndexes.length > 0 && baseColl) {\n\t\t\t\tconst baseIndexes = collectionIndexes(baseColl);\n\t\t\t\tcollections = {\n\t\t\t\t\t...filtered,\n\t\t\t\t\t[baseCollection]: {\n\t\t\t\t\t\t...baseColl,\n\t\t\t\t\t\tindexes: [...baseIndexes, ...scopedVariantIndexes]\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} else collections = filtered;\n\t\t} else if (baseColl) {\n\t\t\tconst existingIndexes = collectionIndexes(baseColl);\n\t\t\tconst variantIndexSet = new Set(variantOwnIndexes);\n\t\t\tconst withoutUnscopedVariants = existingIndexes.filter((idx) => !variantIndexSet.has(idx));\n\t\t\tconst mergedIndexes = [...withoutUnscopedVariants];\n\t\t\tfor (const idx of scopedVariantIndexes) {\n\t\t\t\tconst idxKey = canonicalJson(idx);\n\t\t\t\tif (!withoutUnscopedVariants.some((existing) => canonicalJson(existing) === idxKey)) mergedIndexes.push(idx);\n\t\t\t}\n\t\t\tif (mergedIndexes.length !== existingIndexes.length || mergedIndexes.some((idx, i) => idx !== existingIndexes[i])) {\n\t\t\t\tconst next = { ...baseColl };\n\t\t\t\tif (mergedIndexes.length > 0) next[\"indexes\"] = mergedIndexes;\n\t\t\t\telse delete next[\"indexes\"];\n\t\t\t\tcollections = {\n\t\t\t\t\t...collections,\n\t\t\t\t\t[baseCollection]: next\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tmodels: patched,\n\t\troots,\n\t\tcollections,\n\t\tdiagnostics\n\t};\n}\nfunction collectionIndexes(collection) {\n\treturn blindCast(collection[\"indexes\"] ?? []);\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nfunction normalizeIndexField(element) {\n\tif (typeof element === \"string\") return {\n\t\tkind: \"field\",\n\t\tname: element\n\t};\n\tif (element.fn === \"wildcard\" && element.args[\"sort\"] === void 0) {\n\t\tconst scope = element.args[\"scope\"];\n\t\treturn typeof scope === \"string\" ? {\n\t\t\tkind: \"wildcard\",\n\t\t\tscope\n\t\t} : { kind: \"wildcard\" };\n\t}\n\tconst sort = element.args[\"sort\"];\n\treturn {\n\t\tkind: \"field\",\n\t\tname: element.fn,\n\t\tdirection: sort === \"Desc\" ? -1 : 1\n\t};\n}\nfunction buildCollationFromSpec(args) {\n\tconst locale = args.collationLocale;\n\tif (locale === void 0) return args.collationStrength !== void 0 || args.collationCaseLevel !== void 0 || args.collationCaseFirst !== void 0 || args.collationNumericOrdering !== void 0 || args.collationAlternate !== void 0 || args.collationMaxVariable !== void 0 || args.collationBackwards !== void 0 || args.collationNormalization !== void 0 ? null : void 0;\n\tconst collation = { locale };\n\tif (args.collationStrength !== void 0) collation.strength = args.collationStrength;\n\tif (args.collationCaseLevel !== void 0) collation.caseLevel = args.collationCaseLevel;\n\tif (args.collationCaseFirst !== void 0) collation.caseFirst = args.collationCaseFirst;\n\tif (args.collationNumericOrdering !== void 0) collation.numericOrdering = args.collationNumericOrdering;\n\tif (args.collationAlternate !== void 0) collation.alternate = args.collationAlternate;\n\tif (args.collationMaxVariable !== void 0) collation.maxVariable = args.collationMaxVariable;\n\tif (args.collationBackwards !== void 0) collation.backwards = args.collationBackwards;\n\tif (args.collationNormalization !== void 0) collation.normalization = args.collationNormalization;\n\treturn collation;\n}\nfunction resolveIndexKeys(parsedFields, defaultDirection, ctx) {\n\tconst wildcardCount = parsedFields.filter((field) => field.kind === \"wildcard\").length;\n\tif (wildcardCount > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"An index can contain at most one wildcard() field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tfor (const field of parsedFields) {\n\t\tconst fieldName = field.kind === \"wildcard\" ? field.scope : field.name;\n\t\tif (fieldName !== void 0 && !ctx.indexableFieldNames.has(fieldName)) {\n\t\t\tctx.diagnostics.push({\n\t\t\t\tcode: \"PSL_INDEX_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Index on model \"${ctx.pslModel.name}\" references unknown field \"${fieldName}\"`,\n\t\t\t\tsourceId: ctx.sourceId,\n\t\t\t\tspan: ctx.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t}\n\treturn {\n\t\tkeys: parsedFields.map((field) => {\n\t\t\tif (field.kind === \"wildcard\") {\n\t\t\t\tif (field.scope === void 0) return {\n\t\t\t\t\tfield: \"$**\",\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tfield: `${ctx.fieldMappings.pslNameToMapped.get(field.scope) ?? field.scope}.$**`,\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfield: ctx.fieldMappings.pslNameToMapped.get(field.name) ?? field.name,\n\t\t\t\tdirection: field.direction ?? defaultDirection\n\t\t\t};\n\t\t}),\n\t\thasWildcard: wildcardCount === 1\n\t};\n}\nfunction buildProjection(include, exclude, hasWildcard, ctx) {\n\tif (include !== void 0 && exclude !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Cannot specify both include and exclude on the same index\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn null;\n\t}\n\tconst fields = include ?? exclude;\n\tif (fields === void 0) return void 0;\n\tif (!hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn null;\n\t}\n\tif (fields.length === 0) return void 0;\n\tconst value = include === void 0 ? 0 : 1;\n\tconst projection = {};\n\tfor (const field of fields) projection[field] = value;\n\treturn projection;\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst defaultDirection = parsed.type ?? 1;\n\tconst resolved = resolveIndexKeys(parsedFields, defaultDirection, ctx);\n\tif (!resolved) return void 0;\n\tif (unique && resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Unique indexes cannot use wildcard() fields\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && typeof defaultDirection === \"string\" && [\n\t\t\"hashed\",\n\t\t\"2dsphere\",\n\t\t\"2d\"\n\t].includes(defaultDirection)) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: `wildcard() fields cannot be combined with type: ${defaultDirection}`,\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (defaultDirection === \"hashed\" && parsedFields.length > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Hashed indexes must have exactly one field\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && parsed.expireAfterSeconds !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...unique && { unique: true },\n\t\t...parsed.sparse !== void 0 && { sparse: parsed.sparse },\n\t\t...parsed.expireAfterSeconds !== void 0 && { expireAfterSeconds: parsed.expireAfterSeconds },\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...wildcardProjection !== void 0 && { wildcardProjection },\n\t\t...collation !== void 0 && { collation },\n\t\t...parsed.default_language !== void 0 && { default_language: parsed.default_language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction buildTextIndex(parsed, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, \"text\", ctx);\n\tif (!resolved) return void 0;\n\tif (resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"wildcard() fields cannot be combined with type: hashed/2dsphere/2d or @@textIndex\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\tsourceId: ctx.sourceId,\n\t\t\tspan: ctx.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...collation !== void 0 && { collation },\n\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t...parsed.language !== void 0 && { default_language: parsed.language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction collectIndexes(pslModel, specContext, fieldMappings, modelNames, sourceId, sourceFile, diagnostics, indexSpans) {\n\tconst indexes = [];\n\tlet textIndexCount = 0;\n\tconst indexableFieldNames = /* @__PURE__ */ new Set();\n\tfor (const field of Object.values(pslModel.fields)) if (!modelNames.has(field.typeName)) indexableFieldNames.add(field.name);\n\tfor (const field of Object.values(pslModel.fields)) {\n\t\tif (modelNames.has(field.typeName)) continue;\n\t\tconst uniqueNode = findFieldAttributeNode(field, \"unique\");\n\t\tif (!uniqueNode) continue;\n\t\tif (interpretFieldAttribute({\n\t\t\tnode: uniqueNode,\n\t\t\tspec: mongoAttributeSpecs.field.unique({\n\t\t\t\t...specContext,\n\t\t\t\tfield\n\t\t\t}),\n\t\t\tmodel: pslModel,\n\t\t\tfield,\n\t\t\tsourceFile,\n\t\t\tsourceId,\n\t\t\tdiagnostics\n\t\t}) === void 0) continue;\n\t\tconst fieldUniqueIndex = new MongoIndex({\n\t\t\tkeys: [{\n\t\t\t\tfield: fieldMappings.pslNameToMapped.get(field.name) ?? field.name,\n\t\t\t\tdirection: 1\n\t\t\t}],\n\t\t\tunique: true\n\t\t});\n\t\tindexes.push(fieldUniqueIndex);\n\t\tindexSpans.set(fieldUniqueIndex, nodePslSpan(uniqueNode.syntax, sourceFile));\n\t}\n\tconst attributeNodes = Array.from(pslModel.node.attributes());\n\tfor (const [attrIndex, attr] of pslModel.attributes.entries()) {\n\t\tif (attr.name !== \"index\" && attr.name !== \"unique\" && attr.name !== \"textIndex\") continue;\n\t\tconst node = attributeNodes[attrIndex];\n\t\tif (!node) continue;\n\t\tconst ctx = {\n\t\t\tpslModel,\n\t\t\tfieldMappings,\n\t\t\tindexableFieldNames,\n\t\t\tsourceId,\n\t\t\tspan: attr.span,\n\t\t\tdiagnostics\n\t\t};\n\t\tlet index;\n\t\tif (attr.name === \"textIndex\") {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode,\n\t\t\t\tspec: mongoAttributeSpecs.model.textIndex(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed || parsed.fields.length === 0) continue;\n\t\t\ttextIndexCount++;\n\t\t\tif (textIndexCount > 1) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Only one @@textIndex is allowed per collection (model \"${pslModel.name}\")`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan: attr.span\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tindex = buildTextIndex(parsed, ctx);\n\t\t} else {\n\t\t\tconst unique = attr.name === \"unique\";\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tnode,\n\t\t\t\tspec: unique ? mongoAttributeSpecs.model.unique(specContext) : mongoAttributeSpecs.model.index(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed) continue;\n\t\t\tindex = buildNormalIndex(parsed, unique, ctx);\n\t\t}\n\t\tif (!index) continue;\n\t\tindexes.push(index);\n\t\tindexSpans.set(index, attr.span);\n\t}\n\treturn indexes;\n}\nfunction isRelationField(field, modelNames) {\n\treturn modelNames.has(field.typeName);\n}\nconst MONGO_OBJECT_ID_PSL_TYPE = \"ObjectId\";\nfunction resolveFieldCodecId(field, scalarTypeCodecIds) {\n\treturn scalarTypeCodecIds.get(field.typeName);\n}\nfunction resolveNonRelationField(field, ownerName, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics) {\n\tif (compositeTypeNames.has(field.typeName)) {\n\t\tconst result = {\n\t\t\ttype: {\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: field.typeName\n\t\t\t},\n\t\t\tnullable: field.optional\n\t\t};\n\t\treturn field.list ? {\n\t\t\t...result,\n\t\t\tmany: true\n\t\t} : result;\n\t}\n\tconst enumCodecId = codecIdByEnumName.get(field.typeName);\n\tif (enumCodecId !== void 0) {\n\t\tconst valueSet = {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\tentityName: field.typeName\n\t\t};\n\t\tconst result = {\n\t\t\ttype: {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: enumCodecId\n\t\t\t},\n\t\t\tnullable: field.optional,\n\t\t\tvalueSet\n\t\t};\n\t\treturn field.list ? {\n\t\t\t...result,\n\t\t\tmany: true\n\t\t} : result;\n\t}\n\tif (field.malformedType) return;\n\tconst codecId = resolveFieldCodecId(field, scalarTypeCodecIds);\n\tif (!codecId) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `Field \"${ownerName}.${field.name}\" type \"${field.typeName}\" is not supported in Mongo PSL interpreter`,\n\t\t\tsourceId,\n\t\t\tspan: field.span\n\t\t});\n\t\treturn;\n\t}\n\tconst result = {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId\n\t\t},\n\t\tnullable: field.optional\n\t};\n\treturn field.list ? {\n\t\t...result,\n\t\tmany: true\n\t} : result;\n}\nfunction processEnumDeclarations(input) {\n\tconst builtEnums = {};\n\tif (input.enumBlocks.length === 0) return builtEnums;\n\tconst enumDescriptor = input.authoringContributions?.entityTypes?.[\"enum\"] !== void 0 && isAuthoringEntityTypeDescriptor(input.authoringContributions.entityTypes[\"enum\"]) ? input.authoringContributions.entityTypes[\"enum\"] : void 0;\n\tif (!enumDescriptor) {\n\t\tfor (const decl of input.enumBlocks) input.diagnostics.push({\n\t\t\tcode: \"PSL_ENUM_MISSING_FACTORY\",\n\t\t\tmessage: `enum \"${decl.name}\" requires an \"enum\" entityType factory in the active authoring contributions`,\n\t\t\tsourceId: input.sourceId,\n\t\t\tspan: decl.span\n\t\t});\n\t\treturn builtEnums;\n\t}\n\tfor (const decl of input.enumBlocks) {\n\t\tconst handle = instantiateAuthoringEntityType(\"enum\", enumDescriptor, [decl], input.entityContext);\n\t\tif (handle === void 0 || handle === null) continue;\n\t\tbuiltEnums[decl.name] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: blindCast(m.value)\n\t\t\t}))\n\t\t};\n\t}\n\treturn builtEnums;\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sourceFile, scalarTypeCodecIds, codecLookup } = input;\n\tconst sourceId = input.sourceId;\n\tconst diagnostics = [...input.seedDiagnostics ?? []];\n\tconst topLevel = symbolTable.topLevel;\n\tvalidateNamespaceBlocksForMongoTarget({\n\t\tnamespaces: Object.values(topLevel.namespaces),\n\t\tsourceId,\n\t\tsourceFile,\n\t\tdiagnostics\n\t});\n\tconst allModels = Object.values(topLevel.models);\n\tconst allCompositeTypes = Object.values(topLevel.compositeTypes);\n\tconst modelNames = new Set(allModels.map((m) => m.name));\n\tconst compositeTypeNames = new Set(allCompositeTypes.map((ct) => ct.name));\n\treportUnknownAttributes({\n\t\tmodels: allModels,\n\t\tcompositeTypes: allCompositeTypes,\n\t\tsourceId,\n\t\tdiagnostics\n\t});\n\tconst specContextFor = (model) => ({\n\t\tsymbols: symbolTable,\n\t\tmodel,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t});\n\tconst modelMetadataByName = /* @__PURE__ */ new Map();\n\tfor (const model of allModels) {\n\t\tconst specContext = specContextFor(model);\n\t\tmodelMetadataByName.set(model.name, {\n\t\t\tcollectionName: resolveCollectionName({\n\t\t\t\tmodel,\n\t\t\t\tspecContext,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t}),\n\t\t\tfieldMappings: resolveFieldMappings({\n\t\t\t\tmodel,\n\t\t\t\tspecContext,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t})\n\t\t});\n\t}\n\tconst builtEnums = processEnumDeclarations({\n\t\tenumBlocks: Object.values(topLevel.blocks).filter((b) => b.keyword === \"enum\").map((b) => b.block),\n\t\tsourceId,\n\t\tauthoringContributions: input.authoringContributions,\n\t\tentityContext: {\n\t\t\tfamily: \"mongo\",\n\t\t\ttarget: \"mongo\",\n\t\t\t...ifDefined(\"enumInferenceCodecs\", input.enumInferenceCodecs),\n\t\t\t...ifDefined(\"codecLookup\", codecLookup),\n\t\t\tsourceId,\n\t\t\tdiagnostics: { push: (d) => {\n\t\t\t\tdiagnostics.push(blindCast(d));\n\t\t\t} }\n\t\t},\n\t\tdiagnostics\n\t});\n\tconst codecIdByEnumName = new Map(Object.entries(builtEnums).map(([name, e]) => [name, e.codecId]));\n\tconst models = {};\n\tconst collections = {};\n\tconst roots = {};\n\tconst allFkRelations = [];\n\tconst indexSpans = /* @__PURE__ */ new Map();\n\tconst modelIndexesByName = /* @__PURE__ */ new Map();\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tfor (const pslModel of allModels) {\n\t\tconst metadata = modelMetadataByName.get(pslModel.name);\n\t\tif (!metadata) continue;\n\t\tconst { collectionName, fieldMappings } = metadata;\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = {};\n\t\tconst relations = {};\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tif (isRelationField(field, modelNames)) {\n\t\t\t\tconst relationNode = findFieldAttributeNode(field, \"relation\");\n\t\t\t\tconst relation = relationNode ? interpretFieldAttribute({\n\t\t\t\t\tnode: relationNode,\n\t\t\t\t\tspec: mongoAttributeSpecs.field.relation({\n\t\t\t\t\t\t...specContext,\n\t\t\t\t\t\tfield\n\t\t\t\t\t}),\n\t\t\t\t\tmodel: pslModel,\n\t\t\t\t\tfield,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tdiagnostics,\n\t\t\t\t\tresolveReferencedModel: () => allModels.find((m) => m.name === field.typeName)\n\t\t\t\t}) : void 0;\n\t\t\t\tif (field.list || !(relation?.fields && relation?.references)) {\n\t\t\t\t\tbackrelationCandidates.push({\n\t\t\t\t\t\tmodelName: pslModel.name,\n\t\t\t\t\t\tfieldName: field.name,\n\t\t\t\t\t\ttargetModelName: field.typeName,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation?.name),\n\t\t\t\t\t\tcardinality: field.list ? \"1:N\" : \"1:1\",\n\t\t\t\t\t\tfield\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (relation?.fields && relation?.references) {\n\t\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\t\townsReference: true\n\t\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\t\tdiagnostics.push(relationNullabilityMismatchDiagnostic(pslModel.name, field, sourceId));\n\t\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, field.typeName),\n\t\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst localMapped = relation.fields.map((f) => fieldMappings.pslNameToMapped.get(f) ?? f);\n\t\t\t\t\tconst targetFieldMappings = modelMetadataByName.get(field.typeName)?.fieldMappings;\n\t\t\t\t\tconst targetMapped = relation.references.map((f) => targetFieldMappings?.pslNameToMapped.get(f) ?? f);\n\t\t\t\t\trelations[field.name] = {\n\t\t\t\t\t\tto: mongoCrossRef(field.typeName),\n\t\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\t\tnullable: field.optional,\n\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\tlocalFields: localMapped,\n\t\t\t\t\t\t\ttargetFields: targetMapped\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tallFkRelations.push({\n\t\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\t\tfieldName: field.name,\n\t\t\t\t\t\ttargetModel: field.typeName,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\n\t\t\t\t\t\tlocalFields: localMapped,\n\t\t\t\t\t\ttargetFields: targetMapped\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = resolveNonRelationField(field, pslModel.name, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics);\n\t\t\tif (!resolved) continue;\n\t\t\tconst mappedName = fieldMappings.pslNameToMapped.get(field.name) ?? field.name;\n\t\t\tfields[mappedName] = resolved;\n\t\t}\n\t\tconst isVariantModel = pslModel.attributes.some((attr) => attr.name === \"base\");\n\t\tconst hasIdField = Object.values(pslModel.fields).filter((field) => {\n\t\t\tconst idNode = findFieldAttributeNode(field, \"id\");\n\t\t\tif (!idNode) return false;\n\t\t\treturn interpretFieldAttribute({\n\t\t\t\tnode: idNode,\n\t\t\t\tspec: mongoAttributeSpecs.field.id({\n\t\t\t\t\t...specContext,\n\t\t\t\t\tfield\n\t\t\t\t}),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tfield,\n\t\t\t\tsourceFile,\n\t\t\t\tsourceId,\n\t\t\t\tdiagnostics\n\t\t\t}) !== void 0;\n\t\t}).length > 0;\n\t\tif (!isVariantModel) if (!hasIdField) diagnostics.push({\n\t\t\tcode: \"PSL_MISSING_ID_FIELD\",\n\t\t\tmessage: `Model \"${pslModel.name}\" has no field with @id attribute. Every model must have exactly one @id field.`,\n\t\t\tsourceId\n\t\t});\n\t\telse {\n\t\t\tconst objectIdCodecId = scalarTypeCodecIds.get(MONGO_OBJECT_ID_PSL_TYPE);\n\t\t\tconst idField = fields[\"_id\"];\n\t\t\tif (!(idField !== void 0 && idField.type.kind === \"scalar\" && objectIdCodecId !== void 0 && idField.type.codecId === objectIdCodecId)) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_ID_REQUIRED\",\n\t\t\t\tmessage: `Model \"${pslModel.name}\" must declare an _id field of type ObjectId (e.g. \\`id ObjectId @id @map(\"_id\")\\`).`,\n\t\t\t\tsourceId\n\t\t\t});\n\t\t}\n\t\tmodels[pslModel.name] = {\n\t\t\tfields,\n\t\t\trelations,\n\t\t\tstorage: { collection: collectionName }\n\t\t};\n\t\tconst modelIndexes = collectIndexes(pslModel, specContext, fieldMappings, modelNames, sourceId, sourceFile, diagnostics, indexSpans);\n\t\tmodelIndexesByName.set(pslModel.name, modelIndexes);\n\t\tconst existingColl = collections[collectionName];\n\t\tif (existingColl && modelIndexes.length > 0) collections[collectionName] = { indexes: [...collectionIndexes(existingColl), ...modelIndexes] };\n\t\telse if (!existingColl) collections[collectionName] = modelIndexes.length > 0 ? { indexes: modelIndexes } : {};\n\t\troots[collectionName] = mongoCrossRef(pslModel.name);\n\t}\n\tconst valueObjects = {};\n\tfor (const compositeType of allCompositeTypes) {\n\t\tconst fields = {};\n\t\tfor (const field of Object.values(compositeType.fields)) {\n\t\t\tconst resolved = resolveNonRelationField(field, compositeType.name, compositeTypeNames, scalarTypeCodecIds, codecIdByEnumName, sourceId, diagnostics);\n\t\t\tif (!resolved) continue;\n\t\t\tfields[field.name] = resolved;\n\t\t}\n\t\tvalueObjects[compositeType.name] = { fields };\n\t}\n\tconst fkRelationsByPair = /* @__PURE__ */ new Map();\n\tfor (const fk of allFkRelations) {\n\t\tconst key = fkRelationPairKey(fk.declaringModel, fk.targetModel);\n\t\tconst existing = fkRelationsByPair.get(key);\n\t\tif (existing) existing.push(fk);\n\t\telse fkRelationsByPair.set(key, [fk]);\n\t}\n\tfor (const candidate of backrelationCandidates) {\n\t\tconst pairKey = fkRelationPairKey(candidate.targetModelName, candidate.modelName);\n\t\tconst pairMatches = fkRelationsByPair.get(pairKey) ?? [];\n\t\tconst matches = candidate.relationName ? pairMatches.filter((r) => r.relationName === candidate.relationName) : [...pairMatches];\n\t\tif (matches.length === 0) {\n\t\t\tif (consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings)) continue;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${candidate.modelName}.${candidate.fieldName}\" has no matching FK-side relation on model \"${candidate.targetModelName}\". Add @relation(fields: [...], references: [...]) on the FK-side relation or use an explicit join model for many-to-many.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: candidate.field.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (matches.length > 1) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_AMBIGUOUS_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${candidate.modelName}.${candidate.fieldName}\" matches multiple FK-side relations on model \"${candidate.targetModelName}\". Add @relation(\"...\") to both sides to disambiguate.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: candidate.field.span\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst fk = matches[0];\n\t\tif (!fk) continue;\n\t\tconst modelEntry = models[candidate.modelName];\n\t\tif (!modelEntry) continue;\n\t\tif (candidate.cardinality === \"1:1\" && !candidate.field.optional) diagnostics.push(requiredOneToOneBackrelationDiagnostic({\n\t\t\tmodelName: candidate.modelName,\n\t\t\tfield: candidate.field,\n\t\t\ttargetModelName: candidate.targetModelName,\n\t\t\tsourceId,\n\t\t\trecordNoun: \"document\"\n\t\t}));\n\t\tmodelEntry.relations[candidate.fieldName] = {\n\t\t\tto: mongoCrossRef(candidate.targetModelName),\n\t\t\t...candidate.cardinality === \"1:N\" ? { cardinality: \"1:N\" } : {\n\t\t\t\tcardinality: \"1:1\",\n\t\t\t\tnullable: true\n\t\t\t},\n\t\t\ton: {\n\t\t\t\tlocalFields: fk.targetFields,\n\t\t\t\ttargetFields: fk.localFields\n\t\t\t}\n\t\t};\n\t}\n\tconst { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(allModels, specContextFor, modelMetadataByName, sourceFile, sourceId, diagnostics);\n\tconst polyResult = resolvePolymorphism({\n\t\tmodels,\n\t\troots,\n\t\tcollections,\n\t\tallModels,\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations,\n\t\tmodelNames,\n\t\tindexSpans,\n\t\tmodelIndexesByName,\n\t\tmodelMetadataByName,\n\t\tsourceId\n\t});\n\tif (diagnostics.length > 0 || polyResult.diagnostics.length > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [...diagnostics, ...polyResult.diagnostics]\n\t});\n\tconst resolvedModels = polyResult.models;\n\tconst resolvedCollections = polyResult.collections;\n\tconst storageValueSets = {};\n\tconst enumEntries = Object.entries(builtEnums);\n\tif (enumEntries.length > 0) {\n\t\tassertDefined(codecLookup, \"Mongo PSL interpretation requires a codec lookup to encode enum values\");\n\t\tfor (const [enumName, builtEnum] of enumEntries) storageValueSets[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: builtEnum.members.map((m) => encodeEnumValue(m.value, builtEnum.codecId, codecLookup))\n\t\t};\n\t}\n\tfor (const [, modelEntry] of Object.entries(resolvedModels)) {\n\t\tif (modelEntry.base) continue;\n\t\tconst coll = resolvedCollections[modelEntry.storage.collection];\n\t\tif (!coll) continue;\n\t\tif (modelEntry.discriminator && modelEntry.variants) {\n\t\t\tconst variantEntries = Object.entries(modelEntry.variants).map(([variantName, { value }]) => ({\n\t\t\t\tdiscriminatorValue: value,\n\t\t\t\tfields: resolvedModels[variantName]?.fields ?? {}\n\t\t\t}));\n\t\t\tcoll[\"validator\"] = derivePolymorphicJsonSchema(modelEntry.fields, modelEntry.discriminator.field, variantEntries, valueObjects, codecLookup, storageValueSets);\n\t\t} else coll[\"validator\"] = deriveJsonSchema(modelEntry.fields, valueObjects, codecLookup, storageValueSets);\n\t}\n\tconst target = \"mongo\";\n\tconst targetFamily = \"mongo\";\n\tconst collectionInputs = {};\n\tfor (const [name, coll] of Object.entries(resolvedCollections)) {\n\t\tconst raw = {};\n\t\tif (coll[\"indexes\"] != null) raw[\"indexes\"] = coll[\"indexes\"];\n\t\tif (coll[\"validator\"] != null) raw[\"validator\"] = coll[\"validator\"];\n\t\tif (coll[\"options\"] != null) raw[\"options\"] = coll[\"options\"];\n\t\tcollectionInputs[name] = blindCast(raw);\n\t}\n\tconst unboundNamespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: collectionInputs,\n\t\t\t...Object.keys(storageValueSets).length > 0 ? { valueSet: storageValueSets } : {}\n\t\t}\n\t});\n\tconst storage = blindCast(new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tstorage: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\t\tid: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentries: {\n\t\t\t\t\tcollection: unboundNamespace.entries.collection,\n\t\t\t\t\t...unboundNamespace.entries.valueSet !== void 0 ? { valueSet: unboundNamespace.entries.valueSet } : {}\n\t\t\t\t}\n\t\t\t} } },\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: unboundNamespace }\n\t}));\n\tconst capabilities = {};\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\treturn ok({\n\t\ttargetFamily,\n\t\ttarget,\n\t\troots: polyResult.roots,\n\t\tdomain: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\tmodels: polyResult.models,\n\t\t\t...Object.keys(valueObjects).length > 0 ? { valueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\textensions: {},\n\t\tcapabilities,\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {}\n\t});\n}\n//#endregion\nexport { derivePolymorphicJsonSchema as i, mongoAttributeSpecs as n, deriveJsonSchema as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-BCt8cG3P.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,gBAAgB,SAAS,aAAa;CAC9C,OAAO,aAAa,eAAe,OAAO,CAAC,GAAG;AAC/C;AACA,SAAS,kBAAkB,OAAO,cAAc,aAAa,WAAW;CACvE,IAAI,MAAM,KAAK,SAAS,UAAU;EACjC,MAAM,WAAW,gBAAgB,MAAM,KAAK,SAAS,WAAW;EAChE,IAAI,CAAC,UAAU,OAAO,KAAK;EAC3B,MAAM,aAAa,MAAM,aAAa,KAAK,IAAI,YAAY,MAAM,SAAS,WAAW,EAAE,UAAU,OAAO;EACxG,IAAI,UAAU,SAAS,MAAM,MAAM;GAClC,MAAM,QAAQ,EAAE,SAAS;GACzB,IAAI,YAAY,MAAM,UAAU;GAChC,O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