@prisma/orm-family-mongo 8.0.0-rc.21-dev.6 → 8.0.0-rc.21-dev.7
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-prisma6__provider.mjs +1 -1
- package/dist/contract-psl.mjs +2 -2
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/{control-CICsBj2-.mjs → control-DyvmmPnk.mjs} +3 -3
- package/dist/{control-CICsBj2-.mjs.map → control-DyvmmPnk.mjs.map} +1 -1
- package/dist/{dist-CjOZcYWO.mjs → dist-BhDqnAiz.mjs} +2 -2
- package/dist/dist-BhDqnAiz.mjs.map +1 -0
- package/dist/family.mjs +1 -1
- package/dist/family__control.mjs +1 -1
- package/dist/family__pack.mjs +1 -1
- package/dist/{interpreter-_2zXFvs1-DQ0uxLuK.mjs → interpreter-DqVj74Rn-DgfRcygL.mjs} +58 -14
- package/dist/interpreter-DqVj74Rn-DgfRcygL.mjs.map +1 -0
- package/package.json +20 -20
- package/dist/dist-CjOZcYWO.mjs.map +0 -1
- package/dist/interpreter-_2zXFvs1-DQ0uxLuK.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { N as validateMongoStorage } from "./dist-CroOs9BN.mjs";
|
|
2
2
|
import { r as buildMongoContractFromDefinition } from "./contract-builder-DzeVnjsm.mjs";
|
|
3
|
-
import { i as pairMongoBackRelations } from "./interpreter-
|
|
3
|
+
import { i as pairMongoBackRelations } from "./interpreter-DqVj74Rn-DgfRcygL.mjs";
|
|
4
4
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
6
|
import { crossRef } from "@prisma/orm-framework/contract/types";
|
package/dist/contract-psl.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as pairMongoBackRelations, n as interpretPslDocumentToMongoContract, r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-
|
|
2
|
-
import { t as describeUnresolvedMongoType } from "./dist-
|
|
1
|
+
import { i as pairMongoBackRelations, n as interpretPslDocumentToMongoContract, r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DqVj74Rn-DgfRcygL.mjs";
|
|
2
|
+
import { t as describeUnresolvedMongoType } from "./dist-BhDqnAiz.mjs";
|
|
3
3
|
export { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as interpretPslDocumentToMongoContract } from "./interpreter-
|
|
1
|
+
import { n as interpretPslDocumentToMongoContract } from "./interpreter-DqVj74Rn-DgfRcygL.mjs";
|
|
2
2
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
3
3
|
import { assertDefined } from "@prisma/orm-framework/utils/assertions";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -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-DqVj74Rn.mjs\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { buildSymbolTable, createBinder, isPrismaNextSchema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/provider.ts\nfunction hasTarget(options) {\n\treturn options?.target !== void 0;\n}\nfunction mongoContract(schemaPath, options) {\n\tif (!hasTarget(options)) throw structuredError(\"CONTRACT.ARGUMENT_INVALID\", `mongoContract(\"${schemaPath}\") needs the MongoDB target pack, which the contract records.`, {\n\t\tfix: \"Pass { target: mongoTargetPack }, with mongoTargetPack imported from '@prisma/orm-mongo/target/pack', or name the schema in defineConfig({ contract }) from '@prisma/orm-mongo/config', which passes it for you.\",\n\t\tmeta: {\n\t\t\tschemaPath,\n\t\t\treason: \"target-pack-missing\"\n\t\t}\n\t});\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\tdocuments: input.documents,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tbinder: input.binder,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\t...ifDefined(\"extensionPacks\", options.extensionPacks),\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tdefaultFunctionRegistry: context.controlMutationDefaults.defaultFunctionRegistry,\n\t\t\t\t\tgeneratorFunctions: context.generatorFunctions,\n\t\t\t\t\tdataTypes: context.dataTypes,\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\t...ifDefined(\"reportWarning\", context.reportWarning)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst candidates = [...new Set(context.resolvedInputs)].sort();\n\t\t\t\tif (candidates.length === 0) return notOk({\n\t\t\t\t\tsummary: \"No schema files matched the configured contract source\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PSL_NO_SCHEMA_FILES_MATCHED\",\n\t\t\t\t\t\tmessage: `No files matched the configured pattern \"${schemaPath}\"`,\n\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t\tconst readDiagnostics = [];\n\t\t\t\tconst members = [];\n\t\t\t\tconst undirected = [];\n\t\t\t\tfor (const path of candidates) {\n\t\t\t\t\tlet text;\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttext = await readFile(path, \"utf-8\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = String(error);\n\t\t\t\t\t\treadDiagnostics.push({\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: path\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\tif (isPrismaNextSchema(text)) members.push({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttext\n\t\t\t\t\t});\n\t\t\t\t\telse undirected.push(path);\n\t\t\t\t}\n\t\t\t\tif (members.length === 0) {\n\t\t\t\t\tif (undirected.length === 0) return notOk({\n\t\t\t\t\t\tsummary: \"Failed to read Prisma schema files\",\n\t\t\t\t\t\tdiagnostics: readDiagnostics\n\t\t\t\t\t});\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: \"No schema file carries the \\\"// use prisma-8\\\" directive\",\n\t\t\t\t\t\tdiagnostics: [...readDiagnostics, {\n\t\t\t\t\t\t\tcode: \"PSL_NO_OPTED_IN_SCHEMA_FILES\",\n\t\t\t\t\t\t\tmessage: `None of the matched files carry the \"// use prisma-8\" directive: ${undirected.join(\", \")}`,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst parsed = members.map(({ path, text }) => parse(text, path));\n\t\t\t\tconst documents = parsed.map(({ document }) => document);\n\t\t\t\tconst [firstSources, ...restSources] = parsed.map(({ sources }) => sources);\n\t\t\t\tassertDefined(firstSources, \"mongoContract requires at least one parsed schema file\");\n\t\t\t\tconst sources = firstSources.merge(...restSources);\n\t\t\t\tconst seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics(parsed.flatMap(({ diagnostics }) => diagnostics), sources)];\n\t\t\t\tconst { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tdefaultNamespaceId: context.defaultNamespaceId\n\t\t\t\t});\n\t\t\t\tconst { binder, diagnostics: binderDiagnostics } = createBinder({\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsources,\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\treturn withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tbinder\n\t\t\t\t}, context), [...seedDiagnostics, ...mapPslDiagnostics([...symbolTableDiagnostics, ...binderDiagnostics], sources)]);\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,UAAU,SAAS;CAC3B,OAAO,SAAS,WAAW,KAAK;AACjC;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,IAAI,CAAC,UAAU,OAAO,GAAG,MAAM,gBAAgB,6BAA6B,kBAAkB,WAAW,gEAAgE;EACxK,KAAK;EACL,MAAM;GACL;GACA,QAAQ;EACT;CACD,CAAC;CACD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,WAAW,MAAM;KACjB,aAAa,MAAM;KACnB,SAAS,MAAM;KACf,QAAQ,MAAM;KACd,QAAQ,QAAQ;KAChB,GAAG,UAAU,kBAAkB,QAAQ,c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AQ;IACvD,MAAM,CAAC,cAAc,GAAG,eAAe,OAAO,KAAK,EAAE,cAAc,OAAO;IAC1E,cAAc,cAAc,wDAAwD;IACpF,MAAM,UAAU,aAAa,MAAM,GAAG,WAAW;IACjD,MAAM,kBAAkB,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,OAAO,SAAS,EAAE,kBAAkB,WAAW,GAAG,OAAO,CAAC;IAC5H,MAAM,EAAE,aAAa,aAAa,2BAA2B,iBAAiB;KAC7E;KACA;KACA,oBAAoB,QAAQ;IAC7B,CAAC;IACD,MAAM,EAAE,QAAQ,aAAa,sBAAsB,aAAa;KAC/D;KACA;KACA;IACD,CAAC;IACD,OAAO,oBAAoB,KAAK,UAAU;KACzC;KACA;KACA;KACA;IACD,GAAG,OAAO,GAAG,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC;GACpH;EACD;EACA,GAAG,UAAU,UAAU,QAAQ,MAAM;CACtC;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
|
|
2
2
|
import { L as validatorRootShapesOf } from "./dist-CroOs9BN.mjs";
|
|
3
|
-
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-
|
|
4
|
-
import { t as describeUnresolvedMongoType } from "./dist-
|
|
3
|
+
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DqVj74Rn-DgfRcygL.mjs";
|
|
4
|
+
import { t as describeUnresolvedMongoType } from "./dist-BhDqnAiz.mjs";
|
|
5
5
|
import { t as mongoEmission } from "./exports-DNAGDetn.mjs";
|
|
6
6
|
import { et as RawUpdateManyCommand } from "./execution-CgP1Sdbr.mjs";
|
|
7
7
|
import { i as verifyMongoSchema } from "./verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs";
|
|
@@ -564,4 +564,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
|
|
|
564
564
|
//#endregion
|
|
565
565
|
export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
|
|
566
566
|
|
|
567
|
-
//# sourceMappingURL=control-
|
|
567
|
+
//# sourceMappingURL=control-DyvmmPnk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-CICsBj2-.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-nsnAhPm8.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-J_patbMZ.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-BBknnHWy.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabelParts: [{\n\t\t\ttext: \"database\",\n\t\t\trole: \"title\"\n\t\t}],\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: prefix,\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" (\" },\n\t\t\t\t{\n\t\t\t\t\ttext: keysSummary,\n\t\t\t\t\trole: \"name\"\n\t\t\t\t},\n\t\t\t\t{ text: \")\" },\n\t\t\t\t...options.length > 0 ? [{ text: \" \" }, {\n\t\t\t\t\ttext: `(${options.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\",\");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabelParts: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: propName,\n\t\t\t\t\t\trole: \"name\"\n\t\t\t\t\t},\n\t\t\t\t\t{ text: \": \" },\n\t\t\t\t\t{ text: bsonType },\n\t\t\t\t\t...required ? [{ text: \" \" }, {\n\t\t\t\t\t\ttext: \"(required)\",\n\t\t\t\t\t\trole: \"detail\"\n\t\t\t\t\t}] : []\n\t\t\t\t]\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"validator\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"options\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(${optLabels.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabelParts: [\n\t\t\t{\n\t\t\t\ttext: \"collection\",\n\t\t\t\trole: \"keyword\"\n\t\t\t},\n\t\t\t{ text: \" \" },\n\t\t\t{\n\t\t\t\ttext: name,\n\t\t\t\trole: \"name\"\n\t\t\t}\n\t\t],\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tget markerLocation() {\n\t\t\treturn getControlAdapter().markerLocation;\n\t\t},\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KA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Ac,QAAQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;GACxB,OAAO,mBAAmB,SAAS;EACpC;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"control-DyvmmPnk.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-nsnAhPm8.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-J_patbMZ.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-BBknnHWy.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabelParts: [{\n\t\t\ttext: \"database\",\n\t\t\trole: \"title\"\n\t\t}],\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: prefix,\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" (\" },\n\t\t\t\t{\n\t\t\t\t\ttext: keysSummary,\n\t\t\t\t\trole: \"name\"\n\t\t\t\t},\n\t\t\t\t{ text: \")\" },\n\t\t\t\t...options.length > 0 ? [{ text: \" \" }, {\n\t\t\t\t\ttext: `(${options.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\",\");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabelParts: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: propName,\n\t\t\t\t\t\trole: \"name\"\n\t\t\t\t\t},\n\t\t\t\t\t{ text: \": \" },\n\t\t\t\t\t{ text: bsonType },\n\t\t\t\t\t...required ? [{ text: \" \" }, {\n\t\t\t\t\t\ttext: \"(required)\",\n\t\t\t\t\t\trole: \"detail\"\n\t\t\t\t\t}] : []\n\t\t\t\t]\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"validator\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"options\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(${optLabels.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabelParts: [\n\t\t\t{\n\t\t\t\ttext: \"collection\",\n\t\t\t\trole: \"keyword\"\n\t\t\t},\n\t\t\t{ text: \" \" },\n\t\t\t{\n\t\t\t\ttext: name,\n\t\t\t\trole: \"name\"\n\t\t\t}\n\t\t],\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tget markerLocation() {\n\t\t\treturn getControlAdapter().markerLocation;\n\t\t},\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;;;;AAKA,SAAS,eAAe,WAAW;CAClC,MAAM,MAAM,QAAQ,IAAI,WAAW,KAAK;CACxC,IAAI,CAAC,MAAM,QAAQ,GAAG,KAAK,IAAI,WAAW,GAAG,OAAO,KAAK;CACzD,MAAM,CAAC,QAAQ;CACf,MAAM,UAAU,OAAO,SAAS,YAAY,SAAS,OAAO,QAAQ,IAAI,MAAM,SAAS,IAAI,KAAK;CAChG,IAAI,EAAE,mBAAmB,yBAAyB,QAAQ,6BAA6B,MAAM;CAC7F,MAAM,WAAW,QAAQ,QAAQ,MAAM;CACvC,IAAI,aAAa,KAAK,KAAK,CAAC,gBAAgB,IAAI,QAAQ,GAAG,OAAO,KAAK;CACvE,MAAM,QAAQ,QAAQ,QAAQ,IAAI,QAAQ,QAAQ,QAAQ,CAAC;CAC3D,OAAO,UAAU,KAAK,IAAI,KAAK,IAAI;EAClC,YAAY,QAAQ;EACpB;EACA;CACD;AACD;AAGA,SAAS,cAAc,MAAM;CAC5B,OAA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A,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
|
@@ -24,7 +24,7 @@ function describeUnresolvedMongoType(contributions) {
|
|
|
24
24
|
const types = contributions.type;
|
|
25
25
|
const scalars = collectScalarTypeConstructors(types);
|
|
26
26
|
return ({ field, owner, written, isDeclared }) => {
|
|
27
|
-
if (field.typeConstructor !== void 0) return describeRemovedFieldPreset(removedMongoFieldPresets, field
|
|
27
|
+
if (field.typeConstructor !== void 0) return describeRemovedFieldPreset(removedMongoFieldPresets, field, types, isDeclared);
|
|
28
28
|
if (field.typeNamespaceId !== void 0) return;
|
|
29
29
|
const replacement = EARLIER_MONGO_SCALAR_NAMES[written];
|
|
30
30
|
if (replacement === void 0 || !scalars.has(replacement)) return `Field "${owner.name}.${field.name}" has type "${written}", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;
|
|
@@ -34,4 +34,4 @@ function describeUnresolvedMongoType(contributions) {
|
|
|
34
34
|
//#endregion
|
|
35
35
|
export { describeUnresolvedMongoType as t };
|
|
36
36
|
|
|
37
|
-
//# sourceMappingURL=dist-
|
|
37
|
+
//# sourceMappingURL=dist-BhDqnAiz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-BhDqnAiz.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-DqVj74Rn.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\nimport { describeRemovedFieldPreset, removedPresetWithPhases, removedPresetWrittenAs } from \"@internal/psl-parser/interpret\";\n//#region src/removed-field-presets.ts\nconst MONGO_DATE_CODEC_ID = \"mongo/date@1\";\n/** The MongoDB family's removed field presets; each applies only where its rewrite's type stores a Mongo date. */\nconst removedMongoFieldPresets = {\n\t\"temporal.createdAt\": removedPresetWrittenAs(\"temporal.CreatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.updatedAt\": removedPresetWrittenAs(\"temporal.UpdatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.timestamp\": removedPresetWithPhases(\"Date\", MONGO_DATE_CODEC_ID, false)\n};\n//#endregion\n//#region src/describe-unresolved-type.ts\nconst EARLIER_MONGO_SCALAR_NAMES = {\n\tBigInt: \"Int64\",\n\tBytes: \"Binary\",\n\tDecimal: \"Decimal128\"\n};\nfunction scalarTypesSentence(types) {\n\tconst current = [...collectScalarTypeConstructors(types).keys()].filter((name) => {\n\t\tconst descriptor = types[name];\n\t\treturn !(descriptor !== void 0 && isAuthoringTypeConstructorDescriptor(descriptor) && descriptor.deprecated !== void 0);\n\t});\n\treturn current.length === 0 ? \"No Mongo scalar types are registered.\" : `The Mongo scalar types are ${current.length === 1 ? current.join(\"\") : `${current.slice(0, -1).join(\", \")} and ${current.at(-1)}`}.`;\n}\nfunction describeUnresolvedMongoType(contributions) {\n\tconst types = contributions.type;\n\tconst scalars = collectScalarTypeConstructors(types);\n\treturn ({ field, owner, written, isDeclared }) => {\n\t\tif (field.typeConstructor !== void 0) return describeRemovedFieldPreset(removedMongoFieldPresets, field, types, isDeclared);\n\t\tif (field.typeNamespaceId !== void 0) return;\n\t\tconst replacement = EARLIER_MONGO_SCALAR_NAMES[written];\n\t\tif (replacement === void 0 || !scalars.has(replacement)) return `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;\n\t\treturn `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a Mongo scalar type; use \"${replacement}\".`;\n\t};\n}\n//#endregion\nexport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongo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/family.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { h as defaultMongoStorageNamespaceId, m as defaultMongoDomainNamespaceId
|
|
|
2
2
|
import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-nsnAhPm8-DvsVH5bL.mjs";
|
|
3
3
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-J_patbMZ-CADuWYyG.mjs";
|
|
4
4
|
import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-BBknnHWy-yE74wFbz.mjs";
|
|
5
|
-
import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-
|
|
5
|
+
import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-DyvmmPnk.mjs";
|
|
6
6
|
import { t as MongoContractView$1 } from "./mongo-contract-view-CF5trX6R-D_Bus9dt.mjs";
|
|
7
7
|
import { t as MongoSchemaVerifierBase } from "./ir-FZi5ql4K.mjs";
|
|
8
8
|
import { t as MongoMigration } from "./migration-KD7yy64Y.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-nsnAhPm8-DvsVH5bL.mjs";
|
|
2
|
-
import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-
|
|
2
|
+
import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-DyvmmPnk.mjs";
|
|
3
3
|
export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
|
package/dist/family__pack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as mongoAttributeSpecs } from "./interpreter-
|
|
1
|
+
import { r as mongoAttributeSpecs } from "./interpreter-DqVj74Rn-DgfRcygL.mjs";
|
|
2
2
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-J_patbMZ-CADuWYyG.mjs";
|
|
3
3
|
//#region ../../../2-mongo-family/9-family/dist/pack.mjs
|
|
4
4
|
const mongoFamilyPack = {
|
|
@@ -8,10 +8,10 @@ import { ArrayLiteralAst, FunctionCallAst, PathExprAst } from "@prisma/orm-frame
|
|
|
8
8
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
9
9
|
import { resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
|
|
10
10
|
import { describeDiscriminatorRefusal, enumMemberProblemDiagnostic, instantiateAuthoringEntityType, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, resolveTypeAliasGenerators } from "@prisma/orm-framework/components/authoring";
|
|
11
|
-
import { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, isBareTypeConstructor, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
11
|
+
import { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslTypeChoice, isBareTypeConstructor, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
12
12
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
13
|
-
import { bool, contributedTypeAliasOf, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, refuseRepeatedTypeAliasAttributes, resolveTypeAliases, str, typeAliasSpecContext, typeAttributeSpecContextOfField, typeAttributeSubjectLabel, typeGeneratorAttributeSpec, typeReferenceNode, writtenScalar } from "@prisma/orm-framework/psl-parser";
|
|
14
|
-
//#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-
|
|
13
|
+
import { bool, contributedTypeAliasOf, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, isContributedTypeChoice, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, refuseRepeatedTypeAliasAttributes, resolveTypeAliases, str, typeAliasSpecContext, typeAttributeSpecContextOfField, typeAttributeSubjectLabel, typeGeneratorAttributeSpec, typeReferenceNode, writtenScalar } from "@prisma/orm-framework/psl-parser";
|
|
14
|
+
//#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DqVj74Rn.mjs
|
|
15
15
|
function buildModelAttributeCtx(input) {
|
|
16
16
|
return {
|
|
17
17
|
sources: input.sources,
|
|
@@ -639,6 +639,15 @@ function differenceWording(difference) {
|
|
|
639
639
|
case "many": return "list shape";
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
+
/** The field type a use of a type choice gives: the column of the constructor its call chooses, read and refused as a SQL column's is. `undefined`, with a diagnostic pushed, when the call is refused. */
|
|
643
|
+
function scalarTypeOfChoice(input) {
|
|
644
|
+
const output = instantiatePslTypeChoice(input);
|
|
645
|
+
return output === void 0 ? void 0 : {
|
|
646
|
+
kind: "scalar",
|
|
647
|
+
codecId: output.codecId,
|
|
648
|
+
...ifDefined("typeParams", output.typeParams)
|
|
649
|
+
};
|
|
650
|
+
}
|
|
642
651
|
/** The field type a type constructor gives, keeping a bare constructor's fixed type params. */
|
|
643
652
|
function scalarTypeOfConstructor(descriptor, call) {
|
|
644
653
|
if (call !== void 0) return {
|
|
@@ -697,6 +706,22 @@ function aliasType(alias, input) {
|
|
|
697
706
|
type: scalarTypeOfConstructor(base.descriptor, base.call),
|
|
698
707
|
valueSet: void 0
|
|
699
708
|
};
|
|
709
|
+
if (base.kind === "typeChoice") {
|
|
710
|
+
const type = scalarTypeOfChoice({
|
|
711
|
+
symbol: base.symbol,
|
|
712
|
+
call: base.call,
|
|
713
|
+
span: symbol.span,
|
|
714
|
+
codecLookup: input.codecLookup,
|
|
715
|
+
diagnostics: input.diagnostics,
|
|
716
|
+
source: diagnosticSource(input.sources, symbol.node.syntax),
|
|
717
|
+
entityLabel: `Type alias "${symbol.name}"`,
|
|
718
|
+
dataTypes: input.dataTypes
|
|
719
|
+
});
|
|
720
|
+
return type === void 0 ? void 0 : {
|
|
721
|
+
type,
|
|
722
|
+
valueSet: void 0
|
|
723
|
+
};
|
|
724
|
+
}
|
|
700
725
|
if (base.symbol.keyword !== "enum") {
|
|
701
726
|
input.diagnostics.push({
|
|
702
727
|
code: "PSL_UNSUPPORTED_NAMED_TYPE_BASE",
|
|
@@ -853,7 +878,7 @@ function resolvePhysicalNames(input) {
|
|
|
853
878
|
...specContext,
|
|
854
879
|
field,
|
|
855
880
|
typeResolution: fieldTypeResolution(field, binder),
|
|
856
|
-
|
|
881
|
+
contributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)
|
|
857
882
|
}),
|
|
858
883
|
model,
|
|
859
884
|
field,
|
|
@@ -1092,7 +1117,7 @@ function collectIndexes(pslModel, specContext, sources, binder, diagnostics) {
|
|
|
1092
1117
|
...specContext,
|
|
1093
1118
|
field,
|
|
1094
1119
|
typeResolution: fieldTypeResolution(field, binder),
|
|
1095
|
-
|
|
1120
|
+
contributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)
|
|
1096
1121
|
}),
|
|
1097
1122
|
model: pslModel,
|
|
1098
1123
|
field,
|
|
@@ -1237,7 +1262,7 @@ function acceptsTypeAlias(input) {
|
|
|
1237
1262
|
diagnostics: input.diagnostics
|
|
1238
1263
|
});
|
|
1239
1264
|
}
|
|
1240
|
-
function resolveNonRelationField(field, owner, resolution, codecIdByEnumName, context, scalarNames, typeAliases) {
|
|
1265
|
+
function resolveNonRelationField(field, owner, resolution, codecIdByEnumName, context, scalarNames, typeAliases, codecLookup) {
|
|
1241
1266
|
const ownerName = owner.name;
|
|
1242
1267
|
if (resolution?.kind === "compositeType") return { field: {
|
|
1243
1268
|
type: {
|
|
@@ -1290,10 +1315,27 @@ function resolveNonRelationField(field, owner, resolution, codecIdByEnumName, co
|
|
|
1290
1315
|
return;
|
|
1291
1316
|
}
|
|
1292
1317
|
if (resolution?.kind !== "contributedType") return;
|
|
1293
|
-
const { descriptor, path } = resolution.symbol;
|
|
1294
1318
|
const call = field.typeConstructor;
|
|
1295
1319
|
const entityLabel = `Field "${ownerName}.${field.name}"`;
|
|
1296
1320
|
const source = diagnosticSource(context.sources, field.node.syntax);
|
|
1321
|
+
if (isContributedTypeChoice(resolution.symbol)) {
|
|
1322
|
+
const type = scalarTypeOfChoice({
|
|
1323
|
+
symbol: resolution.symbol,
|
|
1324
|
+
call,
|
|
1325
|
+
span: field.span,
|
|
1326
|
+
codecLookup,
|
|
1327
|
+
diagnostics: context.diagnostics,
|
|
1328
|
+
source,
|
|
1329
|
+
entityLabel,
|
|
1330
|
+
dataTypes: context.dataTypes
|
|
1331
|
+
});
|
|
1332
|
+
return type === void 0 ? void 0 : { field: {
|
|
1333
|
+
type,
|
|
1334
|
+
nullable: field.optional,
|
|
1335
|
+
many: field.list ? { elementNullable: field.elementOptional } : false
|
|
1336
|
+
} };
|
|
1337
|
+
}
|
|
1338
|
+
const { descriptor, path } = resolution.symbol;
|
|
1297
1339
|
if (descriptor.kind === "typeAlias") {
|
|
1298
1340
|
if (call !== void 0) {
|
|
1299
1341
|
context.diagnostics.push({
|
|
@@ -1408,7 +1450,8 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1408
1450
|
const diagnostics = createPslDiagnosticCollector(sources);
|
|
1409
1451
|
const fieldResolution = {
|
|
1410
1452
|
sources,
|
|
1411
|
-
diagnostics
|
|
1453
|
+
diagnostics,
|
|
1454
|
+
dataTypes: input.dataTypes
|
|
1412
1455
|
};
|
|
1413
1456
|
const scalarNames = { warnDeprecated: deprecatedScalarWarner({
|
|
1414
1457
|
sources,
|
|
@@ -1482,6 +1525,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1482
1525
|
defaultFunctionRegistry: input.defaultFunctionRegistry,
|
|
1483
1526
|
generatorFunctions,
|
|
1484
1527
|
dataTypes: input.dataTypes,
|
|
1528
|
+
codecLookup: input.codecLookup,
|
|
1485
1529
|
authoringTypes: input.authoringContributions?.type
|
|
1486
1530
|
});
|
|
1487
1531
|
const polymorphism = collectPolymorphismDeclarations({
|
|
@@ -1524,7 +1568,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1524
1568
|
...specContext,
|
|
1525
1569
|
field,
|
|
1526
1570
|
typeResolution: fieldTypeResolution(field, binder),
|
|
1527
|
-
|
|
1571
|
+
contributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)
|
|
1528
1572
|
}),
|
|
1529
1573
|
model: pslModel,
|
|
1530
1574
|
field,
|
|
@@ -1577,7 +1621,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1577
1621
|
const resolved = resolveNonRelationField(field, {
|
|
1578
1622
|
name: pslModel.name,
|
|
1579
1623
|
kind: "model"
|
|
1580
|
-
}, resolution, codecIdByEnumName, fieldResolution, scalarNames, typeAliases);
|
|
1624
|
+
}, resolution, codecIdByEnumName, fieldResolution, scalarNames, typeAliases, codecLookup);
|
|
1581
1625
|
if (resolved === void 0 || resolved.typeAlias !== void 0 && !acceptsTypeAlias({
|
|
1582
1626
|
field,
|
|
1583
1627
|
modelName: pslModel.name,
|
|
@@ -1597,7 +1641,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1597
1641
|
...specContext,
|
|
1598
1642
|
field,
|
|
1599
1643
|
typeResolution: resolution,
|
|
1600
|
-
|
|
1644
|
+
contributedType: contributedTypeOf(resolution, binder, field.typeConstructor)
|
|
1601
1645
|
},
|
|
1602
1646
|
generatorFunctions,
|
|
1603
1647
|
sources,
|
|
@@ -1624,7 +1668,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1624
1668
|
...specContext,
|
|
1625
1669
|
field,
|
|
1626
1670
|
typeResolution: fieldTypeResolution(field, binder),
|
|
1627
|
-
|
|
1671
|
+
contributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)
|
|
1628
1672
|
}),
|
|
1629
1673
|
model: pslModel,
|
|
1630
1674
|
field,
|
|
@@ -1679,7 +1723,7 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1679
1723
|
const resolved = resolveNonRelationField(field, {
|
|
1680
1724
|
name: compositeType.name,
|
|
1681
1725
|
kind: "compositeType"
|
|
1682
|
-
}, fieldTypeResolution(field, binder), codecIdByEnumName, fieldResolution, scalarNames, typeAliases);
|
|
1726
|
+
}, fieldTypeResolution(field, binder), codecIdByEnumName, fieldResolution, scalarNames, typeAliases, codecLookup);
|
|
1683
1727
|
if (resolved === void 0) {
|
|
1684
1728
|
droppedFields.add(siteKey);
|
|
1685
1729
|
continue;
|
|
@@ -1748,4 +1792,4 @@ function interpretPslDocumentToMongoContract(input) {
|
|
|
1748
1792
|
//#endregion
|
|
1749
1793
|
export { pairMongoBackRelations as i, interpretPslDocumentToMongoContract as n, mongoAttributeSpecs as r, describeUnsupportedMongoAttribute as t };
|
|
1750
1794
|
|
|
1751
|
-
//# sourceMappingURL=interpreter-
|
|
1795
|
+
//# sourceMappingURL=interpreter-DqVj74Rn-DgfRcygL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpreter-DqVj74Rn-DgfRcygL.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DqVj74Rn.mjs"],"sourcesContent":["import { describeDiscriminatorRefusal, enumMemberProblemDiagnostic, instantiateAuthoringEntityType, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, resolveTypeAliasGenerators } from \"@internal/framework-components/authoring\";\nimport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslTypeChoice, isBareTypeConstructor, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from \"@internal/psl-parser/interpret\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { DOCUMENT_ID } from \"@internal/mongo-contract\";\nimport { buildMongoContractFromDefinition } from \"@internal/mongo-contract-ts/contract-builder\";\nimport { bool, contributedTypeAliasOf, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, isContributedTypeChoice, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, refuseRepeatedTypeAliasAttributes, resolveTypeAliases, str, typeAliasSpecContext, typeAttributeSpecContextOfField, typeAttributeSubjectLabel, typeGeneratorAttributeSpec, typeReferenceNode, writtenScalar } from \"@internal/psl-parser\";\nimport { ArrayLiteralAst, FunctionCallAst, PathExprAst } from \"@internal/psl-parser/syntax\";\nimport { assertDefined, invariant } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { crossRef } from \"@internal/contract/types\";\n//#region src/mongo-attribute-specs.ts\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tfield: input.field,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nconst UNLOWERED_FIELD_ATTRIBUTE_HINTS = /* @__PURE__ */ new Map([[\"updatedAt\", \"Use @onCreate(now()) @onUpdate(now()), or type the field temporal.UpdatedAt.\"]]);\nconst DEFAULT_NOW_HINT = \"Use @onCreate(now()) instead; MongoDB has no database defaults.\";\n/** The hint for an attribute MongoDB PSL does not lower, naming what to write instead. */\nfunction unloweredAttributeHint(attribute) {\n\tif (attribute.name === \"default\" && attribute.args[0]?.value.replace(/\\s/g, \"\") === \"now()\") return DEFAULT_NOW_HINT;\n\treturn UNLOWERED_FIELD_ATTRIBUTE_HINTS.get(attribute.name);\n}\nfunction describeUnsupportedMongoAttribute(sources) {\n\treturn ({ attribute, level, owner, field }) => {\n\t\tif (level === \"model\") return {\n\t\t\tcode: \"PSL_UNSUPPORTED_MODEL_ATTRIBUTE\",\n\t\t\tmessage: `${owner.kind === \"mixin\" ? \"Mixin\" : \"Model\"} \"${owner.name}\" uses unsupported attribute \"@@${attribute.name}\"`,\n\t\t\t...diagnosticSource(sources, owner.node.syntax).at(attribute.span)\n\t\t};\n\t\tif (field === void 0) return void 0;\n\t\tconst base = `Field \"${owner.name}.${field.name}\" uses unsupported attribute \"@${attribute.name}\"`;\n\t\tconst hint = unloweredAttributeHint(attribute);\n\t\treturn {\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_ATTRIBUTE\",\n\t\t\tmessage: hint === void 0 ? base : `${base}. ${hint}`,\n\t\t\t...diagnosticSource(sources, field.node.syntax).at(attribute.span)\n\t\t};\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.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\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", {\n\tdocumentation: \"Maps this model to a MongoDB collection name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The collection name stored in MongoDB.\"\n\t}]\n});\nconst mapFieldSpec = fieldAttribute(\"map\", {\n\tdocumentation: \"Maps this field to a stored document key.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The key stored in MongoDB documents.\"\n\t}]\n});\nconst idFieldSpec = fieldAttribute(\"id\", { documentation: \"Marks the field stored as `_id`, the document’s id. The field must be stored as `_id`: name it `_id` or add `@map(\\\"_id\\\")`. A model may leave `@id` out; its documents still get an ObjectId `_id`.\" });\nconst uniqueFieldSpec = fieldAttribute(\"unique\", { documentation: \"Requires values in this field to be unique across the collection.\" });\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tdocumentation: \"Names a relation and associates local fields with fields on the referenced model.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The relation name used to pair both sides. May also be supplied by name.\"\n\t}],\n\tnamed: {\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The relation name used to pair both sides. Cannot also be supplied positionally.\"\n\t\t},\n\t\tfields: {\n\t\t\ttype: optional(list(fieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The ordered local fields holding references to related documents.\"\n\t\t},\n\t\treferences: {\n\t\t\ttype: optional(list(referencedFieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The corresponding fields on the referenced model.\"\n\t\t}\n\t}\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", {\n\tdocumentation: \"Selects the field that distinguishes inheritance variants in this collection.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The discriminator field on this model.\"\n\t}]\n});\nfunction baseModelSpec() {\n\treturn modelAttribute(\"base\", {\n\t\tdocumentation: \"Declares this model as a variant of a base model.\",\n\t\tpositional: [{\n\t\t\tkey: \"base\",\n\t\t\ttype: entityRef({ kind: \"model\" }),\n\t\t\tdocumentation: \"The base model to inherit from.\"\n\t\t}, {\n\t\t\tkey: \"value\",\n\t\t\ttype: writtenScalar(str()),\n\t\t\tdocumentation: \"The discriminator value identifying this variant, a value of the discriminator field's type.\"\n\t\t}]\n\t});\n}\nconst indexFieldElement = oneOf(fieldRef(), funcCall(\"wildcard\", {\n\tdocumentation: \"Indexes document fields using a MongoDB wildcard index.\",\n\tpositional: [{\n\t\tkey: \"scope\",\n\t\ttype: optional(identifier()),\n\t\tdocumentation: \"The field path to index recursively. Omit to index all document fields.\"\n\t}]\n}), funcCall(\"sort\", {\n\tdocumentation: \"Selects an index field with an explicit sort direction.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The model field to index.\"\n\t}, {\n\t\tkey: \"direction\",\n\t\ttype: oneOf(identifier(\"Asc\", { documentation: \"Sort ascending.\" }), identifier(\"Desc\", { documentation: \"Sort descending.\" })),\n\t\tdocumentation: \"The index order for this field: `Asc` or `Desc`.\"\n\t}]\n}));\nconst collationNamedArgs = {\n\tcollationLocale: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The ICU locale used for string comparison, or `simple` for binary comparison.\"\n\t},\n\tcollationStrength: {\n\t\ttype: optional(oneOf(num(1), num(2), num(3), num(4), num(5))),\n\t\tdocumentation: \"The collation comparison level, from `1` (primary differences) through `5` (identical).\"\n\t},\n\tcollationCaseLevel: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether case differences are compared at strength `1` or `2`.\"\n\t},\n\tcollationCaseFirst: {\n\t\ttype: optional(oneOf(str(\"upper\"), str(\"lower\"), str(\"off\"))),\n\t\tdocumentation: \"Whether uppercase or lowercase sorts first, or `off` for the locale default.\"\n\t},\n\tcollationNumericOrdering: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether numeric strings are compared as numbers rather than lexicographically.\"\n\t},\n\tcollationAlternate: {\n\t\ttype: optional(oneOf(str(\"non-ignorable\"), str(\"shifted\"))),\n\t\tdocumentation: \"Whether punctuation and whitespace are significant or shifted to a later comparison level.\"\n\t},\n\tcollationMaxVariable: {\n\t\ttype: optional(oneOf(str(\"punct\"), str(\"space\"))),\n\t\tdocumentation: \"Which characters are ignored when alternate handling is `shifted`: punctuation or spaces.\"\n\t},\n\tcollationBackwards: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether secondary differences, such as accents, are compared in reverse order.\"\n\t},\n\tcollationNormalization: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether strings are checked and normalized before comparison.\"\n\t}\n};\nfunction buildIndexModelSpec(name) {\n\treturn modelAttribute(name, {\n\t\tdocumentation: name === \"unique\" ? \"Declares a unique MongoDB index over the selected fields.\" : \"Declares a MongoDB index over the selected fields.\",\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(indexFieldElement, { allowEmpty: false }),\n\t\t\tdocumentation: name === \"unique\" ? \"The nonempty list of indexed fields, optionally with sort directions. Wildcard scopes are not supported.\" : \"The nonempty list of indexed fields, optionally with sort directions or a wildcard scope.\"\n\t\t}],\n\t\tnamed: {\n\t\t\ttype: {\n\t\t\t\ttype: optional(oneOf(num(1), num(-1), str(\"text\"), str(\"2dsphere\"), str(\"2d\"), str(\"hashed\"))),\n\t\t\t\tdocumentation: \"The MongoDB index key type: ascending `1`, descending `-1`, text, geospatial, or hashed.\"\n\t\t\t},\n\t\t\tsparse: {\n\t\t\t\ttype: optional(bool()),\n\t\t\t\tdocumentation: \"Whether documents missing indexed fields are omitted from the index.\"\n\t\t\t},\n\t\t\texpireAfterSeconds: {\n\t\t\t\ttype: optional(int()),\n\t\t\t\tdocumentation: \"The expiration interval in seconds for a TTL index.\"\n\t\t\t},\n\t\t\tfilter: {\n\t\t\t\ttype: optional(json()),\n\t\t\t\tdocumentation: \"A JSON partial-filter expression limiting which documents are indexed.\"\n\t\t\t},\n\t\t\tinclude: {\n\t\t\t\ttype: optional(list(str())),\n\t\t\t\tdocumentation: \"Document paths included in the wildcard index projection.\"\n\t\t\t},\n\t\t\texclude: {\n\t\t\t\ttype: optional(list(str())),\n\t\t\t\tdocumentation: \"Document paths excluded from the wildcard index projection.\"\n\t\t\t},\n\t\t\tdefault_language: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The default language for text-index tokenization and stemming.\"\n\t\t\t},\n\t\t\tlanguageOverride: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The document field that overrides the text-index language.\"\n\t\t\t},\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction buildTextIndexModelSpec() {\n\treturn modelAttribute(\"textIndex\", {\n\t\tdocumentation: \"Declares a MongoDB text index with optional field weights and language settings.\",\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(indexFieldElement, { allowEmpty: false }),\n\t\t\tdocumentation: \"The nonempty list of fields whose text is indexed.\"\n\t\t}],\n\t\tnamed: {\n\t\t\tfilter: {\n\t\t\t\ttype: optional(json()),\n\t\t\t\tdocumentation: \"A JSON partial-filter expression limiting which documents are indexed.\"\n\t\t\t},\n\t\t\tweights: {\n\t\t\t\ttype: optional(record(int({\n\t\t\t\t\tmin: 1,\n\t\t\t\t\tmax: 99999\n\t\t\t\t}))),\n\t\t\t\tdocumentation: \"Relative text-search weights by field, each from `1` through `99999`.\"\n\t\t\t},\n\t\t\tlanguage: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The default language for tokenization and stemming.\"\n\t\t\t},\n\t\t\tlanguageOverride: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The document field that overrides the text-index language.\"\n\t\t\t},\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\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: baseModelSpec,\n\t\tindex: staticModelSpec(buildIndexModelSpec(\"index\")),\n\t\tunique: staticModelSpec(buildIndexModelSpec(\"unique\")),\n\t\ttextIndex: staticModelSpec(buildTextIndexModelSpec())\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\tonCreate: generatorAttributeSpec(\"onCreate\"),\n\t\tonUpdate: generatorAttributeSpec(\"onUpdate\")\n\t}\n};\n//#endregion\n//#region src/pair-back-relations.ts\n/**\n* Matches each back-relation with the foreign key on the other model: same model pair, and the same relation name when the back-relation has one. A back-relation with no match is orphaned unless its foreign key was already reported (`invalidFkPairings`); one with several matches is ambiguous.\n*/\nfunction pairMongoBackRelations(input) {\n\tconst foreignKeysByPair = /* @__PURE__ */ new Map();\n\tfor (const fk of input.foreignKeys) {\n\t\tconst key = fkRelationPairKey(fk.declaringModel, fk.targetModel);\n\t\tconst existing = foreignKeysByPair.get(key);\n\t\tif (existing) existing.push(fk);\n\t\telse foreignKeysByPair.set(key, [fk]);\n\t}\n\tconst relations = [];\n\tconst diagnostics = [];\n\tfor (const candidate of input.candidates) {\n\t\tconst { field, modelName, targetModelName } = candidate;\n\t\tconst source = diagnosticSource(candidate.sources, field.node.syntax);\n\t\tconst pairKey = fkRelationPairKey(targetModelName, modelName);\n\t\tconst pairMatches = foreignKeysByPair.get(pairKey) ?? [];\n\t\tconst matches = candidate.relationName ? pairMatches.filter((fk) => fk.relationName === candidate.relationName) : pairMatches;\n\t\tif (matches.length === 0) {\n\t\t\tif (consumeInvalidFkPairing(candidate, pairKey, input.invalidFkPairings)) continue;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${modelName}.${field.name}\" has no matching FK-side relation on model \"${targetModelName}\". Add @relation(fields: [...], references: [...]) on the FK-side relation or use an explicit join model for many-to-many.`,\n\t\t\t\t...source.at(field.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst [fk] = matches;\n\t\tif (fk === void 0 || matches.length > 1) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_AMBIGUOUS_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${modelName}.${field.name}\" matches multiple FK-side relations on model \"${targetModelName}\". Add @relation(\"...\") to both sides to disambiguate.`,\n\t\t\t\t...source.at(field.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (candidate.cardinality === \"1:1\" && !field.optional) diagnostics.push(requiredOneToOneBackrelationDiagnostic({\n\t\t\tmodelName,\n\t\t\tfield,\n\t\t\ttargetModelName,\n\t\t\tsources: candidate.sources,\n\t\t\trecordNoun: \"document\"\n\t\t}));\n\t\trelations.push({\n\t\t\tmodelName,\n\t\t\tfieldName: field.name,\n\t\t\trelation: {\n\t\t\t\tto: crossRef(targetModelName, input.namespaceId),\n\t\t\t\t...candidate.cardinality === \"1:N\" ? { cardinality: \"1:N\" } : {\n\t\t\t\t\tcardinality: \"1:1\",\n\t\t\t\t\tnullable: true\n\t\t\t\t},\n\t\t\t\ton: {\n\t\t\t\t\tlocalFields: fk.targetFields,\n\t\t\t\t\ttargetFields: fk.localFields\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\trelations,\n\t\tdiagnostics\n\t};\n}\n//#endregion\n//#region src/psl-helpers.ts\n/** Storage collection name of a model that declares no `@@map`: the model name, verbatim. */\nfunction defaultCollectionName(modelName) {\n\treturn modelName;\n}\nfunction getAttribute(attributes, name) {\n\treturn attributes.find((attr) => attr.name === name);\n}\n//#endregion\n//#region src/refusal-diagnostics.ts\nfunction fieldSiteKey(owner, fieldName) {\n\treturn JSON.stringify([owner, fieldName]);\n}\nfunction fieldSiteOf(sites, key) {\n\tconst site = sites.fields.get(fieldSiteKey(key.owner.name, key.field));\n\tif (site === void 0) throw new InternalError(`A refused field \"${key.owner.name}.${key.field}\" has a site.`);\n\treturn site;\n}\nfunction modelSitesOf(sites, model) {\n\tconst modelSites = sites.models.get(model);\n\tif (modelSites === void 0) throw new InternalError(`A refused model \"${model}\" has sites.`);\n\treturn modelSites;\n}\nfunction at(site, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...site.source.at(site.span)\n\t};\n}\nfunction atField(field, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...field.source.at(field.symbol.span)\n\t};\n}\nfunction atFieldCall(field, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...field.source.at(field.symbol.typeConstructor?.span ?? field.symbol.span)\n\t};\n}\nfunction generatedListDiagnostic(field, label) {\n\tconst perElement = \"Lists have no per-element generated values;\";\n\tconst phase = field.generatorAttributes.onCreate !== void 0 ? \"onCreate\" : \"onUpdate\";\n\tconst attribute = field.generatorAttributes[phase];\n\tif (attribute !== void 0) return {\n\t\tcode: \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\tmessage: `${label} is a list and cannot use @${phase}(${attribute.argument}). ${perElement} remove @${phase}(...).`,\n\t\t...field.source.at(attribute.span)\n\t};\n\treturn atField(field, \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\", `${label} is a list, and its type alias \"${field.typeAlias?.name}\" generates a value. ${perElement} remove \"[]\" or type the field without the alias.`);\n}\nfunction generatedOnValueObjectDiagnostic(field, owner) {\n\tconst fieldName = field.symbol.name;\n\treturn atField(field, \"PSL_UNSUPPORTED_FIELD_TYPE\", `Member \"${fieldName}\" of composite type \"${owner}\" is typed by the type alias \"${field.typeAlias?.name}\", which generates a value; a composite type member has no generated values.`);\n}\nfunction relationNullabilityDiagnostic(field, model, ownsForeignKey) {\n\tconst fieldLabel = `Relation field \"${model}.${field.symbol.name}\"`;\n\tif (!ownsForeignKey) return atField(field, \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\", `${fieldLabel} is required, but the other model holds the relation fields, so nothing in storage guarantees the related document exists. Make it optional with \"?\".`);\n\treturn atField(field, \"PSL_RELATION_NULLABILITY_MISMATCH\", field.symbol.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.symbol.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.symbol.name}\" or make those fields required.`);\n}\nconst INDEX_SHAPE_MESSAGES = {\n\t\"unique-wildcard\": () => \"Unique indexes cannot use wildcard() fields\",\n\t\"hashed-several-fields\": () => \"Hashed indexes must have exactly one field\",\n\t\"ttl-with-wildcard\": () => \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\"projection-without-wildcard\": () => \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\"collation-without-locale\": () => \"collationLocale is required when using collation options\",\n\t\"second-text-index\": (model) => `Only one @@textIndex is allowed per collection (model \"${model}\")`\n};\nfunction validatorDiagnostic(refusal, sites) {\n\tswitch (refusal.kind) {\n\t\tcase \"enumBsonType\":\n\t\tcase \"enumNotListable\":\n\t\tcase \"enumMemberNotListable\": {\n\t\t\tconst site = sites.enums.get(refusal.enumName);\n\t\t\tif (site === void 0) throw new InternalError(`Enum \"${refusal.enumName}\" has a site.`);\n\t\t\tconst subject = `enum \"${refusal.enumName}\"`;\n\t\t\tconst base = {\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tsourceId: site.block.sourceId\n\t\t\t};\n\t\t\tif (refusal.kind === \"enumBsonType\") return {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} ${refusal.refusal.reason}`,\n\t\t\t\tspan: site.codecSpan\n\t\t\t};\n\t\t\tif (refusal.kind === \"enumNotListable\") return {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} @@type codec \"${refusal.codecId}\" ${refusal.reason}`,\n\t\t\t\tspan: site.codecSpan\n\t\t\t};\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} member \"${refusal.member}\" ${refusal.reason}`,\n\t\t\t\tspan: site.block.memberSpans[refusal.member] ?? site.codecSpan\n\t\t\t};\n\t\t}\n\t\tcase \"fieldBsonType\":\n\t\tcase \"documentId\": {\n\t\t\tconst owner = refusal.kind === \"fieldBsonType\" ? refusal.owner.name : refusal.modelName;\n\t\t\tconst field = fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: owner\n\t\t\t\t},\n\t\t\t\tfield: refusal.fieldName\n\t\t\t});\n\t\t\treturn atField(field, refusal.kind === \"fieldBsonType\" ? \"PSL_UNSUPPORTED_FIELD_TYPE\" : \"PSL_MONGO_ID_INVALID\", `Field \"${owner}.${field.symbol.name}\" ${refusal.kind === \"fieldBsonType\" ? refusal.refusal.reason : refusal.reason}`);\n\t\t}\n\t\tcase \"embeddedModelHasVariants\": throw new InternalError(\"A PSL schema writes no embed relations.\");\n\t}\n}\n/**\n* The diagnostic for one refusal of the builder, at the place in the schema it is about, worded as PSL words it. A source position comes from the refusal's key.\n*/\nfunction refusalDiagnostic(refusal, sites) {\n\tswitch (refusal.kind) {\n\t\tcase \"storedNameUnsupported\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_STORED_NAME_UNSUPPORTED\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" ${refusal.reason}. Give the field another stored name with @map.`);\n\t\tcase \"storedNameDuplicate\": {\n\t\t\tconst model = refusal.key.owner.name;\n\t\t\treturn atField(fieldSiteOf(sites, refusal.key), \"PSL_DUPLICATE_STORED_NAME\", `Fields \"${model}.${refusal.firstField}\" and \"${model}.${refusal.key.field}\" are both stored as \"${refusal.storedName}\". Give each field its own stored name with @map.`);\n\t\t}\n\t\tcase \"restatedBaseFieldDiffers\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_VARIANT_FIELD_DIFFERS_FROM_BASE\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" restates field \"${refusal.key.field}\" of base model \"${refusal.baseModel}\" with a different ${refusal.differences.map(differenceWording).join(\" and \")}. A variant's documents are checked against the base's field, so declare it exactly as the base does, or remove it from the variant.`);\n\t\tcase \"storedNameSharedWithBase\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_DUPLICATE_STORED_NAME\", `Fields \"${refusal.baseModel}.${refusal.baseField}\" and \"${refusal.key.owner.name}.${refusal.key.field}\" are both stored as \"${refusal.storedName}\", and a variant's documents hold its base's fields too. Give each field its own stored name with @map.`);\n\t\tcase \"valueObjectFieldStoredName\": {\n\t\t\tconst field = fieldSiteOf(sites, refusal.key);\n\t\t\treturn at(field.map ?? {\n\t\t\t\tsource: field.source,\n\t\t\t\tspan: field.symbol.span\n\t\t\t}, \"PSL_MONGO_TYPE_FIELD_MAP_UNSUPPORTED\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" has @map, but a field of a composite type is stored under its own name. Remove @map, or rename the field to the name it is stored under.`);\n\t\t}\n\t\tcase \"relationLocalFieldUnknown\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\treturn atField(fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: model\n\t\t\t\t},\n\t\t\t\tfield: relation\n\t\t\t}), \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", `Relation field \"${model}.${relation}\" joins on field \"${refusal.fieldName}\", which model \"${model}\" does not declare`);\n\t\t}\n\t\tcase \"relationNullability\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\treturn relationNullabilityDiagnostic(fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: model\n\t\t\t\t},\n\t\t\t\tfield: relation\n\t\t\t}), model, refusal.ownsForeignKey);\n\t\t}\n\t\tcase \"variantCollectionDiffers\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.model).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\", `Mongo variant \"${refusal.key.model}\" cannot use a different collection than its base \"${refusal.baseModel}\". Mongo only supports single-collection polymorphism.`);\n\t\t}\n\t\tcase \"indexFieldUnknown\":\n\t\tcase \"indexShape\":\n\t\tcase \"indexScopeConflict\":\n\t\tcase \"indexDuplicate\": {\n\t\t\tconst { model, position } = refusal.key;\n\t\t\tconst site = modelSitesOf(sites, model).indexes[position];\n\t\t\tif (site === void 0) throw new InternalError(`Index ${position} of \"${model}\" has a site.`);\n\t\t\tswitch (refusal.kind) {\n\t\t\t\tcase \"indexFieldUnknown\": return at(site, \"PSL_INDEX_FIELD_NOT_FOUND\", `Index on model \"${model}\" references unknown field \"${refusal.fieldName}\"`);\n\t\t\t\tcase \"indexShape\": return at(site, \"PSL_INVALID_INDEX\", refusal.rule === \"wildcard-with-type\" ? `wildcard() fields cannot be combined with type: ${wildcardTypeOf(site.index)}` : INDEX_SHAPE_MESSAGES[refusal.rule](model));\n\t\t\t\tcase \"indexScopeConflict\": return at(site, \"PSL_INVALID_INDEX\", `Variant \"${model}\" index conflicts with discriminator scope: ${refusal.reason}`);\n\t\t\t\tcase \"indexDuplicate\": return at(site, \"PSL_INVALID_INDEX\", refusal.firstModel === model ? `Model \"${model}\" declares this index twice. Remove one of them.` : `Collection \"${refusal.collection}\" already has this index, declared on model \"${refusal.firstModel}\". Remove one of them from model \"${model}\" or \"${refusal.firstModel}\".`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"generatedOnValueObject\": return generatedOnValueObjectDiagnostic(fieldSiteOf(sites, refusal.key), refusal.key.owner.name);\n\t\tcase \"generatorPhaseSetTwice\": throw new InternalError(`Field \"${refusal.key.owner.name}.${refusal.key.field}\" sets a phase twice, which PSL refuses as a repeated type alias attribute before building.`);\n\t\tcase \"generatedList\": return generatedListDiagnostic(fieldSiteOf(sites, refusal.key), `Field \"${refusal.key.owner.name}.${refusal.key.field}\"`);\n\t\tcase \"generatedOnVariant\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_GENERATOR_ON_VARIANT_FIELD\", `Generated value on variant \"${refusal.key.owner.name}\" field \"${refusal.key.field}\": execution defaults apply to every document in collection \"${refusal.collection}\", so declare them on the base model.`);\n\t\tcase \"generatedConflict\": {\n\t\t\tconst field = fieldSiteOf(sites, refusal.key);\n\t\t\treturn atField(field, \"PSL_GENERATOR_CONFLICT\", `Generated value on \"${refusal.key.owner.name}.${refusal.key.field}\" sets different execution defaults than \"${refusal.otherModel}.${refusal.otherField}\" for field \"${field.storedName}\" of collection \"${refusal.collection}\". Generate the same values on both models.`);\n\t\t}\n\t\tcase \"typeParamsInvalid\": return atFieldCall(fieldSiteOf(sites, refusal.key), \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", `${`Field \"${refusal.key.owner.name}.${refusal.key.field}\"`} has type parameters its type refuses: ${refusal.problem.message}`);\n\t\tcase \"enumMemberProblem\": {\n\t\t\tconst site = sites.enums.get(refusal.enumName);\n\t\t\tif (site === void 0) throw new InternalError(`Enum \"${refusal.enumName}\" has a site.`);\n\t\t\treturn enumMemberProblemDiagnostic(refusal.problem, site.block);\n\t\t}\n\t\tcase \"enumUnknown\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_UNRESOLVED_REFERENCE\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" is typed by enum \"${refusal.enumName}\", which the schema does not declare`);\n\t\tcase \"discriminatorValueDuplicate\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_DUPLICATE_DISCRIMINATOR_VALUE\", `Discriminator value \"${refusal.value}\" is used by both \"${refusal.firstVariant}\" and \"${refusal.key.variant}\" on base model \"${refusal.baseModel}\"`);\n\t\t}\n\t\tcase \"discriminatorFieldUnknown\":\n\t\tcase \"discriminatorField\":\n\t\tcase \"discriminatorAndBase\":\n\t\tcase \"discriminatorWithoutVariants\": {\n\t\t\tconst model = refusal.key.model;\n\t\t\tconst site = modelSitesOf(sites, model).discriminator;\n\t\t\tif (site === void 0) throw new InternalError(\"A base has a @@discriminator site.\");\n\t\t\tswitch (refusal.kind) {\n\t\t\t\tcase \"discriminatorFieldUnknown\": return at(site, \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\", `Discriminator field \"${refusal.fieldName}\" is not a field on model \"${model}\"`);\n\t\t\t\tcase \"discriminatorField\": return at(site, \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", describeDiscriminatorRefusal(refusal.refusal, {\n\t\t\t\t\tmodelName: model,\n\t\t\t\t\tfieldName: refusal.fieldName,\n\t\t\t\t\ttypeName: discriminatorTypeName(sites, model, refusal.fieldName),\n\t\t\t\t\tenumName: void 0,\n\t\t\t\t\tvariantName: () => model\n\t\t\t\t}));\n\t\t\t\tcase \"discriminatorAndBase\": return at(site, \"PSL_DISCRIMINATOR_AND_BASE\", `Model \"${model}\" cannot have both @@discriminator and @@base`);\n\t\t\t\tcase \"discriminatorWithoutVariants\": return at(site, \"PSL_ORPHANED_DISCRIMINATOR\", `Model \"${model}\" has @@discriminator but no variant models declare @@base(${model}, ...)`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"discriminatorValue\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\tconst valueSite = {\n\t\t\t\tsource: base.source,\n\t\t\t\tspan: base.valueSpan\n\t\t\t};\n\t\t\tif (refusal.refusal.kind === \"unreadable\") return {\n\t\t\t\t...refusal.refusal.refusal,\n\t\t\t\t...valueSite.source.at(valueSite.span)\n\t\t\t};\n\t\t\treturn at(valueSite, \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", describeDiscriminatorRefusal(refusal.refusal, {\n\t\t\t\tmodelName: refusal.baseModel,\n\t\t\t\tfieldName: refusal.fieldName,\n\t\t\t\ttypeName: discriminatorTypeName(sites, refusal.baseModel, refusal.fieldName),\n\t\t\t\tenumName: refusal.enumName,\n\t\t\t\tvariantName: (variant) => variant\n\t\t\t}));\n\t\t}\n\t\tcase \"baseWithoutDiscriminator\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_ORPHANED_BASE\", `Model \"${refusal.key.variant}\" declares @@base(${refusal.baseModel}, ...) but \"${refusal.baseModel}\" has no @@discriminator`);\n\t\t}\n\t\tcase \"validator\": return validatorDiagnostic(refusal.refusal, sites);\n\t\tcase \"duplicateModel\":\n\t\tcase \"duplicateValueObject\":\n\t\tcase \"collectionSettingWithoutCollection\":\n\t\tcase \"collectionSettingTwice\":\n\t\tcase \"generatorUnknown\":\n\t\tcase \"generatorNotApplicable\":\n\t\tcase \"generatedWithoutCollection\":\n\t\tcase \"enumKeyMismatch\":\n\t\tcase \"listedVariantMissing\":\n\t\tcase \"baseUnknown\":\n\t\tcase \"variantWithoutValue\": throw new InternalError(`A PSL definition cannot be refused with \"${refusal.kind}\".`);\n\t}\n}\n/** The key type a wildcard index combines with. */\nfunction wildcardTypeOf(index) {\n\treturn (Object.values(index.fields).find((direction) => direction === \"hashed\" || direction === \"2d\" || direction === \"2dsphere\") ?? \"hashed\").toString();\n}\nfunction discriminatorTypeName(sites, model, fieldName) {\n\treturn sites.fields.get(fieldSiteKey(model, fieldName))?.symbol.typeName ?? fieldName;\n}\nfunction differenceWording(difference) {\n\tswitch (difference) {\n\t\tcase \"storedName\": return \"@map\";\n\t\tcase \"type\": return \"type\";\n\t\tcase \"nullable\": return \"optionality\";\n\t\tcase \"many\": return \"list shape\";\n\t}\n}\n//#endregion\n//#region src/type-aliases.ts\n/** The field type a use of a type choice gives: the column of the constructor its call chooses, read and refused as a SQL column's is. `undefined`, with a diagnostic pushed, when the call is refused. */\nfunction scalarTypeOfChoice(input) {\n\tconst output = instantiatePslTypeChoice(input);\n\treturn output === void 0 ? void 0 : {\n\t\tkind: \"scalar\",\n\t\tcodecId: output.codecId,\n\t\t...ifDefined(\"typeParams\", output.typeParams)\n\t};\n}\n/** The field type a type constructor gives, keeping a bare constructor's fixed type params. */\nfunction scalarTypeOfConstructor(descriptor, call) {\n\tif (call !== void 0) return {\n\t\tkind: \"scalar\",\n\t\tcodecId: descriptor.output.codecId\n\t};\n\tconst { codecId, typeParams } = instantiateAuthoringTypeConstructor(descriptor, []);\n\treturn {\n\t\tkind: \"scalar\",\n\t\tcodecId,\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t};\n}\nconst GENERATOR_PHASES$1 = [\"onCreate\", \"onUpdate\"];\nconst MONGO_TYPE_ALIAS_ATTRIBUTE_NAMES = new Set(GENERATOR_PHASES$1);\nfunction describeUnsupportedMongoAliasAttribute(attribute, declaration) {\n\tif (attribute.name !== \"default\") return void 0;\n\tconst base = `Type alias \"${declaration.name}\" uses unsupported attribute \"@default\"`;\n\tconst hint = unloweredAttributeHint(attribute);\n\treturn hint === void 0 ? base : `${base}. ${hint}`;\n}\n/**\n* The generator a field's or type alias's `@onCreate(fn())` or `@onUpdate(fn())` resolves to for its type, or `undefined` once the attribute is diagnosed.\n*/\nfunction lowerGeneratorAttribute(input) {\n\tconst interpreted = interpretAttribute(input.attribute.node, typeGeneratorAttributeSpec(input.phase, input.specContext), {\n\t\tsources: input.sources,\n\t\tsymbols: input.symbols,\n\t\tbinder: input.binder\n\t});\n\tif (!interpreted.ok) {\n\t\tinput.diagnostics.push(...interpreted.failure);\n\t\treturn;\n\t}\n\tconst call = interpreted.value.value;\n\tconst { type } = input;\n\tconst resolution = type.kind === \"scalar\" ? input.generatorFunctions.resolve({\n\t\tname: call.fn,\n\t\targs: call.args\n\t}, {\n\t\tcodecId: type.codecId,\n\t\ttypeParams: type.typeParams,\n\t\tlength: void 0\n\t}) : void 0;\n\tif (resolution?.ok === true) return resolution.generator;\n\tconst label = typeAttributeSubjectLabel(input.specContext.subject);\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_GENERATOR_NOT_APPLICABLE\",\n\t\tmessage: resolution?.reason === \"refused\" ? `${label}: ${resolution.message}` : `${label}: ${call.fn}() does not apply to this field's type.`,\n\t\t...diagnosticSource(input.sources, input.attribute.node.syntax).at(call.span)\n\t});\n}\nfunction aliasType(alias, input) {\n\tconst { base, symbol } = alias;\n\tif (base.kind === \"typeConstructor\") return {\n\t\ttype: scalarTypeOfConstructor(base.descriptor, base.call),\n\t\tvalueSet: void 0\n\t};\n\tif (base.kind === \"typeChoice\") {\n\t\tconst type = scalarTypeOfChoice({\n\t\t\tsymbol: base.symbol,\n\t\t\tcall: base.call,\n\t\t\tspan: symbol.span,\n\t\t\tcodecLookup: input.codecLookup,\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: diagnosticSource(input.sources, symbol.node.syntax),\n\t\t\tentityLabel: `Type alias \"${symbol.name}\"`,\n\t\t\tdataTypes: input.dataTypes\n\t\t});\n\t\treturn type === void 0 ? void 0 : {\n\t\t\ttype,\n\t\t\tvalueSet: void 0\n\t\t};\n\t}\n\tif (base.symbol.keyword !== \"enum\") {\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_NAMED_TYPE_BASE\",\n\t\t\tmessage: `Type alias \"${symbol.name}\" references unsupported base type \"${alias.baseName}\"`,\n\t\t\t...diagnosticSource(input.sources, symbol.node.syntax).at(symbol.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst codecId = input.codecIdByEnumName.get(base.symbol.name);\n\tif (codecId === void 0 || alias.baseResolution.kind !== \"block\") return void 0;\n\treturn {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId\n\t\t},\n\t\tvalueSet: {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: alias.baseResolution.namespace.id,\n\t\t\tentityName: base.symbol.name\n\t\t}\n\t};\n}\nfunction lowerAliasGenerators(alias, type, input) {\n\tconst specContext = typeAliasSpecContext(alias, input);\n\tconst phases = {};\n\tfor (const phase of GENERATOR_PHASES$1) {\n\t\tconst [attribute, duplicate] = alias.attributes.filter(({ name }) => name === phase);\n\t\tif (attribute === void 0) continue;\n\t\tif (duplicate !== void 0) {\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_ATTRIBUTE\",\n\t\t\t\tmessage: `\\`@${phase}\\` declared more than once on type alias \"${alias.symbol.name}\".`,\n\t\t\t\t...diagnosticSource(input.sources, duplicate.node.syntax).at(duplicate.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst generator = lowerGeneratorAttribute({\n\t\t\t...input,\n\t\t\tphase,\n\t\t\tattribute,\n\t\t\tspecContext,\n\t\t\ttype\n\t\t});\n\t\tif (generator !== void 0) phases[phase] = generator;\n\t}\n\treturn phases.onCreate === void 0 && phases.onUpdate === void 0 ? void 0 : phases;\n}\nfunction resolveContributedTypeAlias(alias, generatorFunctions) {\n\tconst { type } = instantiateAuthoringTypeAlias(alias.descriptor);\n\treturn {\n\t\talias,\n\t\tname: alias.name,\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: type.codecId,\n\t\t\t...ifDefined(\"typeParams\", type.typeParams)\n\t\t},\n\t\tvalueSet: void 0,\n\t\texecutionDefaults: resolveTypeAliasGenerators({\n\t\t\tpath: alias.name,\n\t\t\tdescriptor: alias.descriptor,\n\t\t\tgeneratorFunctions,\n\t\t\tlength: void 0\n\t\t})\n\t};\n}\n/**\n* Resolves each `types {}` alias once: its field type and the values its `@onCreate` and `@onUpdate` generate. MongoDB has no database defaults, so an alias's `@default` is refused here, once, not at each field typed by it.\n*/\nfunction resolveMongoTypeAliases(input) {\n\tconst declared = /* @__PURE__ */ new Map();\n\tconst aliases = resolveTypeAliases({\n\t\tdeclarations: input.declarations,\n\t\tbinder: input.binder,\n\t\tsources: input.sources,\n\t\tdiagnostics: input.diagnostics,\n\t\tauthoringTypes: input.authoringTypes,\n\t\tacceptedAttributes: MONGO_TYPE_ALIAS_ATTRIBUTE_NAMES,\n\t\tdescribeUnsupportedAttribute: describeUnsupportedMongoAliasAttribute\n\t});\n\tfor (const alias of aliases.values()) {\n\t\tconst resolved = aliasType(alias, input);\n\t\tif (resolved === void 0) continue;\n\t\tdeclared.set(alias.symbol, {\n\t\t\talias,\n\t\t\tname: alias.symbol.name,\n\t\t\t...resolved,\n\t\t\texecutionDefaults: lowerAliasGenerators(alias, resolved.type, input)\n\t\t});\n\t}\n\tconst contributed = /* @__PURE__ */ new Map();\n\treturn { ofResolution(resolution) {\n\t\tif (resolution?.kind === \"namedType\") return declared.get(resolution.symbol);\n\t\tconst alias = contributedTypeAliasOf(resolution);\n\t\tif (alias === void 0) return void 0;\n\t\tconst existing = contributed.get(alias.descriptor);\n\t\tif (existing !== void 0) return existing;\n\t\tconst resolved = resolveContributedTypeAlias(alias, input.generatorFunctions);\n\t\tcontributed.set(alias.descriptor, resolved);\n\t\treturn resolved;\n\t} };\n}\n//#endregion\n//#region src/interpreter.ts\n/**\n* Reports `PSL_DEPRECATED_SCALAR_NAME` at the type of a field whose scalar name is a deprecated alias, naming the replacement. The alias resolves to the same codec, so the contract does not change.\n*/\nfunction deprecatedScalarWarner(input) {\n\tconst { reportWarning } = input;\n\tif (reportWarning === void 0) return () => {};\n\treturn (field, descriptor) => {\n\t\tif (descriptor.deprecated === void 0) return;\n\t\tconst typeNode = field.node.typeAnnotation()?.name()?.syntax ?? field.node.syntax;\n\t\tconst [warning] = mapPslDiagnostics([{\n\t\t\tcode: \"PSL_DEPRECATED_SCALAR_NAME\",\n\t\t\tmessage: `Scalar type \"${field.typeName}\" is deprecated and will be removed; use \"${descriptor.deprecated.replacement}\".`,\n\t\t\t...diagnosticSource(input.sources, typeNode).at()\n\t\t}], input.sources);\n\t\tif (warning !== void 0) reportWarning({\n\t\t\t...warning,\n\t\t\tseverity: \"warning\"\n\t\t});\n\t};\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) for (const { node, span } of namespace.declarations) input.diagnostics.push({\n\t\tcode: \"PSL_UNSUPPORTED_NAMESPACE_BLOCK\",\n\t\tmessage: `Mongo does not support \\`namespace ${node.name()?.name() ?? namespace.name} { … }\\` blocks (the database is bound by the connection string; declare models at the document top level instead).`,\n\t\t...diagnosticSource(input.sources, node.syntax).at(span)\n\t});\n}\nfunction resolvePhysicalNames(input) {\n\tconst { model, physicalNames, specContext, sources, binder, diagnostics } = input;\n\tconst modelMap = model.attributes.find((attr) => attr.name === \"map\");\n\tconst collectionName = modelMap ? interpretModelAttribute({\n\t\tsymbols: specContext.symbols,\n\t\tnode: modelMap.node,\n\t\tspec: mongoAttributeSpecs.model.map(specContext),\n\t\tmodel,\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t})?.name : void 0;\n\tphysicalNames.set(model, collectionName ?? defaultCollectionName(model.name));\n\tfor (const field of Object.values(model.fields)) {\n\t\tconst fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\tconst mapped = fieldMap ? interpretFieldAttribute({\n\t\t\tsymbols: specContext.symbols,\n\t\t\tnode: fieldMap.node,\n\t\t\tspec: mongoAttributeSpecs.field.map({\n\t\t\t\t...specContext,\n\t\t\t\tfield,\n\t\t\t\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\tcontributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)\n\t\t\t}),\n\t\t\tmodel,\n\t\t\tfield,\n\t\t\tsources,\n\t\t\tbinder,\n\t\t\tdiagnostics\n\t\t})?.name : void 0;\n\t\tphysicalNames.set(field, mapped ?? field.name);\n\t}\n}\nfunction physicalName(physicalNames, symbol) {\n\tassertDefined(symbol, \"Physical names require a bound declaration\");\n\tconst name = physicalNames.get(symbol);\n\tassertDefined(name, \"Physical names must be populated before lowering\");\n\treturn name;\n}\n/** A `@@base` value as it is written; the grammar reads only a quoted string there. */\nfunction writtenBaseValue(written) {\n\tif (written.written === void 0) throw new InternalError(\"A @@base value is a quoted string, never a tagged literal.\");\n\treturn written.written;\n}\nfunction collectPolymorphismDeclarations(input) {\n\tconst { sources, binder, diagnostics } = input;\n\tconst discriminators = /* @__PURE__ */ new Map();\n\tconst bases = /* @__PURE__ */ new Map();\n\tconst reported = {\n\t\tdiscriminators: /* @__PURE__ */ new Set(),\n\t\tbaseTargets: /* @__PURE__ */ new Set()\n\t};\n\tfor (const model of input.models) {\n\t\tconst specContext = input.specContextFor(model);\n\t\tconst discNode = model.attributes.find((attr) => attr.name === \"discriminator\")?.node;\n\t\tif (discNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode: discNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.discriminator(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) discriminators.set(model, {\n\t\t\t\tfieldName: parsed.field,\n\t\t\t\tsource: diagnosticSource(sources, discNode.syntax),\n\t\t\t\tspan: nodePslSpan(discNode.syntax, sources)\n\t\t\t});\n\t\t\telse reported.discriminators.add(model.name);\n\t\t}\n\t\tconst baseAttribute = model.attributes.find((attr) => attr.name === \"base\");\n\t\tconst baseNode = baseAttribute?.node;\n\t\tif (baseNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode: baseNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.base(),\n\t\t\t\tmodel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) bases.set(model, {\n\t\t\t\tbase: parsed.base.declaration,\n\t\t\t\twritten: writtenBaseValue(parsed.value),\n\t\t\t\tvalueSpan: parsed.value.span,\n\t\t\t\tsource: diagnosticSource(sources, baseNode.syntax),\n\t\t\t\tspan: nodePslSpan(baseNode.syntax, sources)\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst target = baseAttribute?.args[0]?.value;\n\t\t\t\tif (target !== void 0) reported.baseTargets.add(target);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminators,\n\t\tbases,\n\t\treported\n\t};\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\") {\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 field = element.args[\"field\"];\n\tinvariant(typeof field === \"string\", \"The sort function spec requires a field reference\");\n\treturn {\n\t\tkind: \"field\",\n\t\tname: field,\n\t\tdirection: element.args[\"direction\"] === \"Desc\" ? -1 : 1\n\t};\n}\n/** The collation the index arguments name, or undefined when they name none. A collation without `collationLocale` is passed on for the builder to refuse. */\nfunction buildCollationFromSpec(args) {\n\tconst collation = {\n\t\t...ifDefined(\"locale\", args.collationLocale),\n\t\t...ifDefined(\"strength\", args.collationStrength),\n\t\t...ifDefined(\"caseLevel\", args.collationCaseLevel),\n\t\t...ifDefined(\"caseFirst\", args.collationCaseFirst),\n\t\t...ifDefined(\"numericOrdering\", args.collationNumericOrdering),\n\t\t...ifDefined(\"alternate\", args.collationAlternate),\n\t\t...ifDefined(\"maxVariable\", args.collationMaxVariable),\n\t\t...ifDefined(\"backwards\", args.collationBackwards),\n\t\t...ifDefined(\"normalization\", args.collationNormalization)\n\t};\n\treturn Object.keys(collation).length === 0 ? void 0 : collation;\n}\n/** The index keys by field name, as the builder takes them: a wildcard is `$**` or `<field>.$**`. */\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst fields = {};\n\tfor (const field of parsedFields) if (field.kind === \"wildcard\") fields[field.scope === void 0 ? \"$**\" : `${field.scope}.$**`] = defaultDirection;\n\telse fields[field.name] = field.direction ?? defaultDirection;\n\treturn {\n\t\tfields,\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn null;\n\t}\n\tconst fields = include ?? exclude;\n\tif (fields === void 0 || fields.length === 0 && hasWildcard) 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}\n/** Index options as the attribute specs read them, which are the values MongoDB takes. */\nfunction indexOptions(options) {\n\treturn blindCast(options);\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, parsed.type ?? 1, ctx);\n\tif (!resolved) return void 0;\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\treturn {\n\t\tfields: resolved.fields,\n\t\toptions: indexOptions({\n\t\t\t...unique && { unique: true },\n\t\t\t...ifDefined(\"sparse\", parsed.sparse),\n\t\t\t...ifDefined(\"expireAfterSeconds\", parsed.expireAfterSeconds),\n\t\t\t...ifDefined(\"partialFilterExpression\", parsed.filter),\n\t\t\t...ifDefined(\"wildcardProjection\", wildcardProjection),\n\t\t\t...ifDefined(\"collation\", collation),\n\t\t\t...ifDefined(\"default_language\", parsed.default_language),\n\t\t\t...ifDefined(\"language_override\", parsed.languageOverride)\n\t\t})\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\treturn {\n\t\tfields: resolved.fields,\n\t\toptions: indexOptions({\n\t\t\t...ifDefined(\"partialFilterExpression\", parsed.filter),\n\t\t\t...ifDefined(\"collation\", collation),\n\t\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t\t...ifDefined(\"default_language\", parsed.language),\n\t\t\t...ifDefined(\"language_override\", parsed.languageOverride)\n\t\t})\n\t};\n}\nfunction nestedIndexPath(node) {\n\tfor (const arg of node.argList()?.args() ?? []) {\n\t\tconst name = arg.name()?.name();\n\t\tconst list = arg.value();\n\t\tif (name !== void 0 && name !== \"fields\" || !(list instanceof ArrayLiteralAst)) continue;\n\t\tfor (const element of list.elements()) {\n\t\t\tconst field = element instanceof FunctionCallAst && element.name()?.identifier()?.token()?.text === \"sort\" ? [...element.args()][0]?.value() : element;\n\t\t\tconst path = field instanceof PathExprAst ? field.path() : [];\n\t\t\tif (field instanceof PathExprAst && path.length > 1) return {\n\t\t\t\tpath,\n\t\t\t\tsyntax: field.syntax\n\t\t\t};\n\t\t}\n\t}\n}\nfunction nestedIndexPathMessage(path, pslModel, binder) {\n\tconst [root = \"\"] = path;\n\tconst label = `Index field \"${path.join(\".\")}\" on model \"${pslModel.name}\"`;\n\tconst rootField = Object.hasOwn(pslModel.fields, root) ? pslModel.fields[root] : void 0;\n\treturn rootField !== void 0 && fieldTypeResolution(rootField, binder)?.kind === \"compositeType\" ? `${label} is a path into a composite type; indexes on fields of a composite type are not supported yet. Index a top-level field of \"${pslModel.name}\" or remove the index.` : `${label} is a dotted path, but \"${root}\" is not a field of \"${pslModel.name}\" whose type is a composite type, so the path names no field. List fields of \"${pslModel.name}\" by name.`;\n}\n/**\n* A model's indexes as the schema writes them, with where each is written: a field's `@unique` first, then `@@index`, `@@unique` and `@@textIndex` in the order the model lists them.\n*/\nfunction collectIndexes(pslModel, specContext, sources, binder, diagnostics) {\n\tconst indexes = [];\n\tfor (const field of Object.values(pslModel.fields)) {\n\t\tif (fieldTypeResolution(field, binder)?.kind === \"model\") continue;\n\t\tconst uniqueNode = field.attributes.find((attr) => attr.name === \"unique\")?.node;\n\t\tif (!uniqueNode) continue;\n\t\tif (interpretFieldAttribute({\n\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\tcontributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)\n\t\t\t}),\n\t\t\tmodel: pslModel,\n\t\t\tfield,\n\t\t\tsources,\n\t\t\tbinder,\n\t\t\tdiagnostics\n\t\t}) === void 0) continue;\n\t\tindexes.push({\n\t\t\tindex: {\n\t\t\t\tfields: { [field.name]: 1 },\n\t\t\t\toptions: { unique: true }\n\t\t\t},\n\t\t\tsource: diagnosticSource(sources, uniqueNode.syntax),\n\t\t\tspan: nodePslSpan(uniqueNode.syntax, sources)\n\t\t});\n\t}\n\tfor (const attr of pslModel.attributes) {\n\t\tif (attr.name !== \"index\" && attr.name !== \"unique\" && attr.name !== \"textIndex\") continue;\n\t\tconst node = attr.node;\n\t\tconst source = diagnosticSource(sources, node.syntax);\n\t\tconst ctx = {\n\t\t\tsource,\n\t\t\tspan: attr.span,\n\t\t\tdiagnostics\n\t\t};\n\t\tconst nested = nestedIndexPath(node);\n\t\tif (nested !== void 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\tmessage: nestedIndexPathMessage(nested.path, pslModel, binder),\n\t\t\t\t...source.at(nodePslSpan(nested.syntax, sources))\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tlet index;\n\t\tif (attr.name === \"textIndex\") {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode,\n\t\t\t\tspec: mongoAttributeSpecs.model.textIndex(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed || parsed.fields.length === 0) continue;\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\tsymbols: specContext.symbols,\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\tsources,\n\t\t\t\tbinder,\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 !== void 0) indexes.push({\n\t\t\tindex,\n\t\t\tsource,\n\t\t\tspan: attr.span\n\t\t});\n\t}\n\treturn indexes;\n}\nfunction fieldTypeResolution(field, binder) {\n\tconst node = typeReferenceNode(field);\n\treturn node === void 0 ? void 0 : binder.symbolForNode(node);\n}\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generators a field's `@onCreate(fn())` and `@onUpdate(fn())` resolve to, and where each attribute is written. An attribute written twice, or one whose call is refused, is reported here.\n*/\nfunction lowerGeneratorAttributes(input) {\n\tconst { field, modelName, diagnostics } = input;\n\tconst phases = {};\n\tconst sites = {};\n\tlet refused = false;\n\tfor (const phase of GENERATOR_PHASES) {\n\t\tconst [attribute, duplicate] = field.attributes.filter(({ name }) => name === phase);\n\t\tif (attribute === void 0) continue;\n\t\tsites[phase] = {\n\t\t\tspan: attribute.span,\n\t\t\targument: attribute.args.find((arg) => arg.kind === \"positional\")?.value.trim() ?? \"\"\n\t\t};\n\t\tif (duplicate !== void 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_ATTRIBUTE\",\n\t\t\t\tmessage: `\\`@${phase}\\` declared more than once on field \"${modelName}.${field.name}\".`,\n\t\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(duplicate.span)\n\t\t\t});\n\t\t\trefused = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst generator = lowerGeneratorAttribute({\n\t\t\tphase,\n\t\t\tattribute,\n\t\t\tspecContext: typeAttributeSpecContextOfField(input.specContext),\n\t\t\ttype: input.resolved.field.type,\n\t\t\tsymbols: input.specContext.symbols,\n\t\t\tbinder: input.binder,\n\t\t\tsources: input.sources,\n\t\t\tgeneratorFunctions: input.generatorFunctions,\n\t\t\tdiagnostics\n\t\t});\n\t\tif (generator === void 0) {\n\t\t\trefused = true;\n\t\t\tcontinue;\n\t\t}\n\t\tphases[phase] = generator;\n\t}\n\tconst none = phases.onCreate === void 0 && phases.onUpdate === void 0;\n\treturn {\n\t\tvalues: refused || none ? void 0 : phases,\n\t\tsites\n\t};\n}\nfunction fieldOfTypeAlias(field, typeAlias) {\n\treturn {\n\t\tfield: {\n\t\t\ttype: typeAlias.type,\n\t\t\tnullable: field.optional,\n\t\t\tmany: field.list ? { elementNullable: field.elementOptional } : false,\n\t\t\t...ifDefined(\"valueSet\", typeAlias.valueSet)\n\t\t},\n\t\ttypeAlias\n\t};\n}\n/**\n* Whether a field may take what its type alias carries: it repeats none of the alias's attributes. Reports each refusal at the field.\n*/\nfunction acceptsTypeAlias(input) {\n\treturn !refuseRepeatedTypeAliasAttributes({\n\t\tfield: input.field,\n\t\tfieldPath: `${input.modelName}.${input.field.name}`,\n\t\talias: input.typeAlias.alias,\n\t\tsources: input.sources,\n\t\tdiagnostics: input.diagnostics\n\t});\n}\nfunction resolveNonRelationField(field, owner, resolution, codecIdByEnumName, context, scalarNames, typeAliases, codecLookup) {\n\tconst ownerName = owner.name;\n\tif (resolution?.kind === \"compositeType\") return { field: {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tplane: \"storage\",\n\t\t\tnamespaceId: resolution.namespace.id,\n\t\t\tentityKind: \"valueObject\",\n\t\t\tentityName: resolution.symbol.name\n\t\t},\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n\tif (resolution?.kind === \"block\" && resolution.symbol.keyword === \"enum\") {\n\t\tconst enumCodecId = codecIdByEnumName.get(resolution.symbol.name);\n\t\tif (enumCodecId === void 0) return void 0;\n\t\tconst valueSet = {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: resolution.namespace.id,\n\t\t\tentityName: resolution.symbol.name\n\t\t};\n\t\treturn { field: {\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\tmany: field.list ? { elementNullable: field.elementOptional } : false,\n\t\t\tvalueSet\n\t\t} };\n\t}\n\tif (resolution?.kind === \"namedType\") {\n\t\tif (field.typeConstructor !== void 0) {\n\t\t\tcontext.diagnostics.push({\n\t\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\t\tmessage: `Field \"${ownerName}.${field.name}\" calls \"${field.typeConstructor.path.join(\".\")}\", which is a type alias, not a type constructor. Remove the arguments.`,\n\t\t\t\t...diagnosticSource(context.sources, field.node.syntax).at(field.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst typeAlias = typeAliases.ofResolution(resolution);\n\t\treturn typeAlias === void 0 ? void 0 : fieldOfTypeAlias(field, typeAlias);\n\t}\n\tif (resolution?.kind === \"model\" || resolution?.kind === \"block\" || resolution?.kind === \"crossSpace\") {\n\t\tcontext.diagnostics.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\t...diagnosticSource(context.sources, field.node.syntax).at(field.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolution?.kind !== \"contributedType\") return;\n\tconst call = field.typeConstructor;\n\tconst entityLabel = `Field \"${ownerName}.${field.name}\"`;\n\tconst source = diagnosticSource(context.sources, field.node.syntax);\n\tif (isContributedTypeChoice(resolution.symbol)) {\n\t\tconst type = scalarTypeOfChoice({\n\t\t\tsymbol: resolution.symbol,\n\t\t\tcall,\n\t\t\tspan: field.span,\n\t\t\tcodecLookup,\n\t\t\tdiagnostics: context.diagnostics,\n\t\t\tsource,\n\t\t\tentityLabel,\n\t\t\tdataTypes: context.dataTypes\n\t\t});\n\t\treturn type === void 0 ? void 0 : { field: {\n\t\t\ttype,\n\t\t\tnullable: field.optional,\n\t\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t\t} };\n\t}\n\tconst { descriptor, path } = resolution.symbol;\n\tif (descriptor.kind === \"typeAlias\") {\n\t\tif (call !== void 0) {\n\t\t\tcontext.diagnostics.push({\n\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\tmessage: `${path.join(\".\")} is a type alias and takes no arguments.`,\n\t\t\t\t...source.at(call.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst typeAlias = typeAliases.ofResolution(resolution);\n\t\tinvariant(typeAlias !== void 0, \"A contributed type alias always resolves\");\n\t\treturn fieldOfTypeAlias(field, typeAlias);\n\t}\n\tif (call === void 0 && !isBareTypeConstructor(descriptor)) {\n\t\treportTypeConstructorNotCalled({\n\t\t\tentityLabel,\n\t\t\tpath: path.join(\".\"),\n\t\t\tdescriptor,\n\t\t\tsource,\n\t\t\tspan: field.span,\n\t\t\tdiagnostics: context.diagnostics\n\t\t});\n\t\treturn;\n\t}\n\tif (call === void 0) scalarNames.warnDeprecated(field, descriptor);\n\treturn { field: {\n\t\ttype: scalarTypeOfConstructor(descriptor, call),\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n}\nfunction processEnumDeclarations(input) {\n\tconst handles = {};\n\tif (input.enumSymbols.length === 0) return handles;\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 enumSymbol of input.enumSymbols) {\n\t\t\tconst source = diagnosticSource(input.sources, enumSymbol.node.syntax);\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_FACTORY\",\n\t\t\t\tmessage: `enum \"${enumSymbol.name}\" requires an \"enum\" entityType factory in the active authoring contributions`,\n\t\t\t\t...source.at(enumSymbol.span)\n\t\t\t});\n\t\t}\n\t\treturn handles;\n\t}\n\tfor (const enumSymbol of input.enumSymbols) {\n\t\tconst sourceFile = input.sources.sourceFileFor(enumSymbol.node.syntax);\n\t\tconst envelope = input.parsedBlocks.get(enumSymbol);\n\t\tinput.diagnostics.push(...enumMemberAttributeDiagnostics(enumSymbol, input.sources));\n\t\tif (envelope === void 0) continue;\n\t\tconst handle = instantiateAuthoringEntityType(\"enum\", enumDescriptor, [envelope], {\n\t\t\t...input.entityContext,\n\t\t\tsourceId: sourceFile.filename\n\t\t});\n\t\tif (handle === void 0 || handle === null) continue;\n\t\thandles[envelope.name] = handle;\n\t\tconst typeAttribute = envelope.attributes[\"type\"];\n\t\tinput.sites.set(envelope.name, {\n\t\t\tblock: {\n\t\t\t\tenumName: envelope.name,\n\t\t\t\tcodecId: handle.codecId,\n\t\t\t\tsourceId: sourceFile.filename,\n\t\t\t\tspan: envelope.span,\n\t\t\t\tmemberSpans: envelope.parameterSpans\n\t\t\t},\n\t\t\tcodecSpan: typeAttribute?.argSpans?.[\"codecId\"] ?? typeAttribute?.span ?? envelope.span\n\t\t});\n\t}\n\treturn handles;\n}\n/** Whether PSL already reported the cause of a refusal, so the builder's refusal would repeat it. */\nfunction alreadyReported(refusal, dropped, reported) {\n\tswitch (refusal.kind) {\n\t\tcase \"indexFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"relationLocalFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"discriminatorFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"discriminatorWithoutVariants\": return reported.baseTargets.has(refusal.key.model);\n\t\tcase \"baseWithoutDiscriminator\": return reported.discriminators.has(refusal.baseModel);\n\t\tdefault: return false;\n\t}\n}\nfunction enumNameOf(field) {\n\treturn field.valueSet?.entityKind === \"enum\" ? field.valueSet.entityName : void 0;\n}\nfunction fieldNodeOf(fieldName, storedName, resolved, generatedValues) {\n\tconst { field } = resolved;\n\tconst executionDefaults = resolved.typeAlias?.executionDefaults;\n\treturn {\n\t\tfieldName,\n\t\t...storedName === fieldName ? {} : { storedName },\n\t\ttype: field.type,\n\t\tnullable: field.nullable,\n\t\tmany: field.many ?? false,\n\t\t...ifDefined(\"enumName\", enumNameOf(field)),\n\t\t...ifDefined(\"executionDefaults\", executionDefaults),\n\t\t...ifDefined(\"generatedValues\", generatedValues)\n\t};\n}\nfunction relationNodeOf(fieldName, relation) {\n\tif (relation.cardinality === \"N:M\") throw new InternalError(\"A paired MongoDB back-relation is one-to-one or one-to-many.\");\n\treturn {\n\t\trelationName: fieldName,\n\t\ttoModel: relation.to.model,\n\t\tcardinality: relation.cardinality,\n\t\ton: relation.on,\n\t\tnullable: \"nullable\" in relation ? relation.nullable : void 0\n\t};\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sources, codecLookup } = input;\n\tconst diagnostics = createPslDiagnosticCollector(sources);\n\tconst fieldResolution = {\n\t\tsources,\n\t\tdiagnostics,\n\t\tdataTypes: input.dataTypes\n\t};\n\tconst scalarNames = { warnDeprecated: deprecatedScalarWarner({\n\t\tsources,\n\t\treportWarning: input.reportWarning\n\t}) };\n\tconst { binder } = input;\n\tconst { parsedBlocks, diagnostics: blockDiagnostics } = interpretExtensionBlocks({\n\t\tsymbolTable,\n\t\tsources,\n\t\tpslBlockDescriptors: input.authoringContributions?.pslBlockDescriptors ?? {},\n\t\tbinder,\n\t\tdataTypes: input.dataTypes\n\t});\n\tdiagnostics.push(...blockDiagnostics);\n\tconst { defaultNamespace } = symbolTable;\n\tvalidateNamespaceBlocksForMongoTarget({\n\t\tnamespaces: Object.values(symbolTable.namespaces),\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst allModels = Object.values(defaultNamespace.models);\n\tconst allCompositeTypes = Object.values(defaultNamespace.compositeTypes);\n\tconst { generatorFunctions } = input;\n\tconst specContextFor = (model) => ({\n\t\tsymbols: symbolTable,\n\t\tmodel,\n\t\tdefaultFunctionRegistry: input.defaultFunctionRegistry,\n\t\tgeneratorFunctions,\n\t\tdataTypes: input.dataTypes\n\t});\n\tconst physicalNames = /* @__PURE__ */ new Map();\n\tfor (const model of allModels) resolvePhysicalNames({\n\t\tmodel,\n\t\tphysicalNames,\n\t\tspecContext: specContextFor(model),\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst blockKeywords = /* @__PURE__ */ new Set([\"enum\", ...claimedBlockKeywords(input.authoringContributions?.pslBlockDescriptors)]);\n\tfor (const block of Object.values(defaultNamespace.blocks)) if (!blockKeywords.has(block.keyword)) diagnostics.push(unsupportedBlockDiagnostic(block, sources));\n\tconst topLevelEnumSymbols = Object.values(defaultNamespace.blocks).filter((b) => b.keyword === \"enum\");\n\tconst enumSites = /* @__PURE__ */ new Map();\n\tconst enumHandles = processEnumDeclarations({\n\t\tsites: enumSites,\n\t\tenumSymbols: topLevelEnumSymbols,\n\t\tparsedBlocks,\n\t\tsources,\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\tcodecLookup,\n\t\t\tdataTypes: input.dataTypes,\n\t\t\tdiagnostics: { push: (d) => {\n\t\t\t\tdiagnostics.pushExternal(blindCast(d));\n\t\t\t} }\n\t\t},\n\t\tdiagnostics\n\t});\n\tconst codecIdByEnumName = new Map(Object.entries(enumHandles).map(([name, handle]) => [name, handle.codecId]));\n\tconst typeAliases = resolveMongoTypeAliases({\n\t\tdeclarations: Object.values(symbolTable.namedTypes),\n\t\tsymbols: symbolTable,\n\t\tbinder,\n\t\tsources,\n\t\tdiagnostics,\n\t\tcodecIdByEnumName,\n\t\tdefaultFunctionRegistry: input.defaultFunctionRegistry,\n\t\tgeneratorFunctions,\n\t\tdataTypes: input.dataTypes,\n\t\tcodecLookup: input.codecLookup,\n\t\tauthoringTypes: input.authoringContributions?.type\n\t});\n\tconst polymorphism = collectPolymorphismDeclarations({\n\t\tmodels: allModels,\n\t\tspecContextFor,\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst allFkRelations = [];\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tconst fieldSites = /* @__PURE__ */ new Map();\n\tconst modelSites = /* @__PURE__ */ new Map();\n\tconst droppedFields = /* @__PURE__ */ new Set();\n\tconst relationsByModel = /* @__PURE__ */ new Map();\n\tconst modelDrafts = [];\n\tfor (const pslModel of allModels) {\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = [];\n\t\tconst relations = [];\n\t\trelationsByModel.set(pslModel.name, relations);\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst source = diagnosticSource(sources, field.node.syntax);\n\t\t\tconst siteKey = fieldSiteKey(pslModel.name, field.name);\n\t\t\tconst resolution = fieldTypeResolution(field, binder);\n\t\t\tif (resolution?.kind === \"model\") {\n\t\t\t\tfieldSites.set(siteKey, {\n\t\t\t\t\tsymbol: field,\n\t\t\t\t\tsource,\n\t\t\t\t\tgeneratorAttributes: {},\n\t\t\t\t\tstoredName: field.name\n\t\t\t\t});\n\t\t\t\tconst target = resolution.symbol;\n\t\t\t\tconst relationNode = field.attributes.find((attr) => attr.name === \"relation\")?.node;\n\t\t\t\tconst relation = relationNode ? interpretFieldAttribute({\n\t\t\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\t\t\tcontributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)\n\t\t\t\t\t}),\n\t\t\t\t\tmodel: pslModel,\n\t\t\t\t\tfield,\n\t\t\t\t\tsources,\n\t\t\t\t\tbinder,\n\t\t\t\t\tdiagnostics\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\ttargetModelName: target.name,\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\tsources\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (!physicalNames.has(target)) continue;\n\t\t\t\trelations.push({\n\t\t\t\t\trelationName: field.name,\n\t\t\t\t\ttoModel: target.name,\n\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\ton: {\n\t\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t\t},\n\t\t\t\t\tnullable: field.optional\n\t\t\t\t});\n\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\townsReference: true\n\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, target.name),\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tallFkRelations.push({\n\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\ttargetModel: target.name,\n\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\n\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = resolveNonRelationField(field, {\n\t\t\t\tname: pslModel.name,\n\t\t\t\tkind: \"model\"\n\t\t\t}, resolution, codecIdByEnumName, fieldResolution, scalarNames, typeAliases, codecLookup);\n\t\t\tif (resolved === void 0 || resolved.typeAlias !== void 0 && !acceptsTypeAlias({\n\t\t\t\tfield,\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\ttypeAlias: resolved.typeAlias,\n\t\t\t\tsources,\n\t\t\t\tdiagnostics\n\t\t\t})) {\n\t\t\t\tdroppedFields.add(siteKey);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storedName = physicalName(physicalNames, field);\n\t\t\tconst generated = lowerGeneratorAttributes({\n\t\t\t\tfield,\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\tresolved,\n\t\t\t\tspecContext: {\n\t\t\t\t\t...specContext,\n\t\t\t\t\tfield,\n\t\t\t\t\ttypeResolution: resolution,\n\t\t\t\t\tcontributedType: contributedTypeOf(resolution, binder, field.typeConstructor)\n\t\t\t\t},\n\t\t\t\tgeneratorFunctions,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tfields.push(fieldNodeOf(field.name, storedName, resolved, generated.values));\n\t\t\tfieldSites.set(siteKey, {\n\t\t\t\tsymbol: field,\n\t\t\t\tsource,\n\t\t\t\t...ifDefined(\"typeAlias\", resolved.typeAlias),\n\t\t\t\tgeneratorAttributes: generated.sites,\n\t\t\t\tstoredName\n\t\t\t});\n\t\t}\n\t\tconst idFields = [];\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst idNode = field.attributes.find((attr) => attr.name === \"id\")?.node;\n\t\t\tif (!idNode) continue;\n\t\t\tif (interpretFieldAttribute({\n\t\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\t\tcontributedType: contributedTypeOf(fieldTypeResolution(field, binder), binder, field.typeConstructor)\n\t\t\t\t}),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tfield,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t}) === void 0) continue;\n\t\t\tidFields.push(field);\n\t\t\tconst storedName = physicalName(physicalNames, field);\n\t\t\tif (storedName !== DOCUMENT_ID) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_ID_ATTRIBUTE_INVALID\",\n\t\t\t\tmessage: `Field \"${pslModel.name}.${field.name}\" has @id but is stored as \"${storedName}\". In MongoDB, @id marks the field stored as _id, the document id: add @map(\"_id\") to it, or remove @id.`,\n\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t});\n\t\t}\n\t\tconst [, secondIdField] = idFields;\n\t\tif (secondIdField !== void 0) diagnostics.push({\n\t\t\tcode: \"PSL_MONGO_ID_ATTRIBUTE_INVALID\",\n\t\t\tmessage: `Model \"${pslModel.name}\" has @id on ${idFields.length} fields, ${idFields.map((field) => `\"${field.name}\"`).join(\" and \")}. A document has one id: keep @id only on the field stored as _id.`,\n\t\t\t...diagnosticSource(sources, secondIdField.node.syntax).at(secondIdField.span)\n\t\t});\n\t\tconst indexes = collectIndexes(pslModel, specContext, sources, binder, diagnostics);\n\t\tconst discriminator = polymorphism.discriminators.get(pslModel);\n\t\tconst base = polymorphism.bases.get(pslModel);\n\t\tmodelSites.set(pslModel.name, {\n\t\t\tindexes,\n\t\t\t...ifDefined(\"discriminator\", discriminator),\n\t\t\t...ifDefined(\"base\", base)\n\t\t});\n\t\tconst inheritsCollection = base !== void 0 && getAttribute(pslModel.attributes, \"map\") === void 0;\n\t\tmodelDrafts.push({\n\t\t\tsymbol: pslModel,\n\t\t\tnode: {\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\t...inheritsCollection ? {} : { collection: physicalName(physicalNames, pslModel) },\n\t\t\t\tfields,\n\t\t\t\tindexes: indexes.map(({ index }) => index),\n\t\t\t\t...discriminator === void 0 ? {} : { discriminator: { field: discriminator.fieldName } },\n\t\t\t\t...base === void 0 ? {} : { base: {\n\t\t\t\t\tmodel: base.base.name,\n\t\t\t\t\tvalue: base.written\n\t\t\t\t} }\n\t\t\t}\n\t\t});\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 siteKey = fieldSiteKey(compositeType.name, field.name);\n\t\t\tconst fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\t\tconst resolved = resolveNonRelationField(field, {\n\t\t\t\tname: compositeType.name,\n\t\t\t\tkind: \"compositeType\"\n\t\t\t}, fieldTypeResolution(field, binder), codecIdByEnumName, fieldResolution, scalarNames, typeAliases, codecLookup);\n\t\t\tif (resolved === void 0) {\n\t\t\t\tdroppedFields.add(siteKey);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storedName = fieldMap?.args[0]?.value.replace(/^\"|\"$/g, \"\") ?? field.name;\n\t\t\tfields.push({\n\t\t\t\t...fieldNodeOf(field.name, field.name, resolved, void 0),\n\t\t\t\t...fieldMap === void 0 ? {} : { storedName }\n\t\t\t});\n\t\t\tfieldSites.set(siteKey, {\n\t\t\t\tsymbol: field,\n\t\t\t\tsource: diagnosticSource(sources, field.node.syntax),\n\t\t\t\t...ifDefined(\"typeAlias\", resolved.typeAlias),\n\t\t\t\tgeneratorAttributes: {},\n\t\t\t\t...fieldMap === void 0 ? {} : { map: {\n\t\t\t\t\tsource: diagnosticSource(sources, fieldMap.node.syntax),\n\t\t\t\t\tspan: nodePslSpan(fieldMap.node.syntax, sources)\n\t\t\t\t} },\n\t\t\t\tstoredName\n\t\t\t});\n\t\t}\n\t\tvalueObjects.push({\n\t\t\tname: compositeType.name,\n\t\t\tfields\n\t\t});\n\t}\n\tconst paired = pairMongoBackRelations({\n\t\tforeignKeys: allFkRelations,\n\t\tcandidates: backrelationCandidates,\n\t\tinvalidFkPairings,\n\t\tnamespaceId: defaultNamespace.id\n\t});\n\tdiagnostics.push(...paired.diagnostics);\n\tfor (const { modelName, fieldName, relation } of paired.relations) relationsByModel.get(modelName)?.push(relationNodeOf(fieldName, relation));\n\tconst modelNodes = modelDrafts.map(({ node }) => ({\n\t\t...node,\n\t\trelations: relationsByModel.get(node.modelName) ?? []\n\t}));\n\tconst definition = {\n\t\ttarget: input.target,\n\t\t...ifDefined(\"extensions\", input.extensionPacks),\n\t\tmodels: [...modelNodes.filter((model) => model.base === void 0), ...modelNodes.filter((model) => model.base !== void 0)],\n\t\tvalueObjects,\n\t\tenums: enumHandles,\n\t\twritesCollectionValidators: true,\n\t\twarnings: void 0\n\t};\n\tconst sites = {\n\t\tmodels: modelSites,\n\t\tfields: fieldSites,\n\t\tenums: enumSites\n\t};\n\tconst built = buildMongoContractFromDefinition(definition, codecLookup, input.dataTypes);\n\tfor (const refusal of built.ok ? [] : built.failure.refusals) {\n\t\tif (alreadyReported(refusal, droppedFields, polymorphism.reported)) continue;\n\t\tconst diagnostic = refusalDiagnostic(refusal, sites);\n\t\tif (\"range\" in diagnostic) diagnostics.push(diagnostic);\n\t\telse diagnostics.pushExternal(diagnostic);\n\t}\n\tif (!built.ok || diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [...input.seedDiagnostics ?? [], ...diagnostics.toExternal()]\n\t});\n\treturn ok(built.value.contract);\n}\n//#endregion\nexport { mongoAttributeSpecs as i, pairMongoBackRelations as n, describeUnsupportedMongoAttribute as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-DqVj74Rn.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,QAAQ,MAAM;EACd,SAAS,MAAM;CAChB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,SAAS,MAAM;CAChB;AACD;AACA,MAAM,kDAAkD,IAAI,IAAI,CAAC,CAAC,aAAa,8EAA8E,CAAC,CAAC;AAC/J,MAAM,mBAAmB;;AAEzB,SAAS,uBAAuB,WAAW;CAC1C,IAAI,UAAU,SAAS,aAAa,UAAU,KAAK,EAAE,EAAE,MAAM,QAAQ,OAAO,EAAE,MAAM,SAAS,OAAO;CACpG,OAAO,gCAAgC,IAAI,UAAU,IAAI;AAC1D;AACA,SAAS,kCAAkC,SAAS;CACnD,QAAQ,EAAE,WAAW,OAAO,OAAO,YAAY;EAC9C,IAAI,UAAU,SAAS,OAAO;GAC7B,MAAM;GACN,SAAS,GAAG,MAAM,SAAS,UAAU,UAAU,QAAQ,IAAI,MAAM,KAAK,kCAAkC,UAAU,KAAK;GACvH,GAAG,iBAAiB,SAAS,MAAM,KAAK,MAAM,CAAC,CAAC,GAAG,UAAU,IAAI;EAClE;EACA,IAAI,UAAU,KAAK,GAAG,OAAO,KAAK;EAClC,MAAM,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,iCAAiC,UAAU,KAAK;EAChG,MAAM,OAAO,uBAAuB,SAAS;EAC7C,OAAO;GACN,MAAM;GACN,SAAS,SAAS,KAAK,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prisma/orm-family-mongo",
|
|
3
|
-
"version": "8.0.0-rc.21-dev.
|
|
3
|
+
"version": "8.0.0-rc.21-dev.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,30 +9,30 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.21-dev.
|
|
13
|
-
"@prisma/orm-toolchain": "8.0.0-rc.21-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.21-dev.7",
|
|
13
|
+
"@prisma/orm-toolchain": "8.0.0-rc.21-dev.7",
|
|
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.21-dev.
|
|
20
|
-
"@internal/mongo-codec": "8.0.0-rc.21-dev.
|
|
21
|
-
"@internal/mongo-contract": "8.0.0-rc.21-dev.
|
|
22
|
-
"@internal/mongo-contract-prisma6": "8.0.0-rc.21-dev.
|
|
23
|
-
"@internal/mongo-contract-psl": "8.0.0-rc.21-dev.
|
|
24
|
-
"@internal/mongo-contract-ts": "8.0.0-rc.21-dev.
|
|
25
|
-
"@internal/mongo-emitter": "8.0.0-rc.21-dev.
|
|
26
|
-
"@internal/mongo-lowering": "8.0.0-rc.21-dev.
|
|
27
|
-
"@internal/mongo-orm": "8.0.0-rc.21-dev.
|
|
28
|
-
"@internal/mongo-query-ast": "8.0.0-rc.21-dev.
|
|
29
|
-
"@internal/mongo-query-builder": "8.0.0-rc.21-dev.
|
|
30
|
-
"@internal/mongo-runtime": "8.0.0-rc.21-dev.
|
|
31
|
-
"@internal/mongo-schema-ir": "8.0.0-rc.21-dev.
|
|
32
|
-
"@internal/mongo-value": "8.0.0-rc.21-dev.
|
|
33
|
-
"@internal/mongo-wire": "8.0.0-rc.21-dev.
|
|
34
|
-
"@repo/tsconfig": "8.0.0-rc.21-dev.
|
|
35
|
-
"@repo/tsdown": "8.0.0-rc.21-dev.
|
|
19
|
+
"@internal/family-mongo": "8.0.0-rc.21-dev.7",
|
|
20
|
+
"@internal/mongo-codec": "8.0.0-rc.21-dev.7",
|
|
21
|
+
"@internal/mongo-contract": "8.0.0-rc.21-dev.7",
|
|
22
|
+
"@internal/mongo-contract-prisma6": "8.0.0-rc.21-dev.7",
|
|
23
|
+
"@internal/mongo-contract-psl": "8.0.0-rc.21-dev.7",
|
|
24
|
+
"@internal/mongo-contract-ts": "8.0.0-rc.21-dev.7",
|
|
25
|
+
"@internal/mongo-emitter": "8.0.0-rc.21-dev.7",
|
|
26
|
+
"@internal/mongo-lowering": "8.0.0-rc.21-dev.7",
|
|
27
|
+
"@internal/mongo-orm": "8.0.0-rc.21-dev.7",
|
|
28
|
+
"@internal/mongo-query-ast": "8.0.0-rc.21-dev.7",
|
|
29
|
+
"@internal/mongo-query-builder": "8.0.0-rc.21-dev.7",
|
|
30
|
+
"@internal/mongo-runtime": "8.0.0-rc.21-dev.7",
|
|
31
|
+
"@internal/mongo-schema-ir": "8.0.0-rc.21-dev.7",
|
|
32
|
+
"@internal/mongo-value": "8.0.0-rc.21-dev.7",
|
|
33
|
+
"@internal/mongo-wire": "8.0.0-rc.21-dev.7",
|
|
34
|
+
"@repo/tsconfig": "8.0.0-rc.21-dev.7",
|
|
35
|
+
"@repo/tsdown": "8.0.0-rc.21-dev.7",
|
|
36
36
|
"tsdown": "0.22.14",
|
|
37
37
|
"typescript": "5.9.3"
|
|
38
38
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist-CjOZcYWO.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/index.mjs"],"sourcesContent":["import { i as mongoAttributeSpecs, n as pairMongoBackRelations, r as describeUnsupportedMongoAttribute, t as interpretPslDocumentToMongoContract } from \"./interpreter-_2zXFvs1.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\nimport { describeRemovedFieldPreset, removedPresetWithPhases, removedPresetWrittenAs } from \"@internal/psl-parser/interpret\";\n//#region src/removed-field-presets.ts\nconst MONGO_DATE_CODEC_ID = \"mongo/date@1\";\n/** The MongoDB family's removed field presets; each applies only where its rewrite's type stores a Mongo date. */\nconst removedMongoFieldPresets = {\n\t\"temporal.createdAt\": removedPresetWrittenAs(\"temporal.CreatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.updatedAt\": removedPresetWrittenAs(\"temporal.UpdatedAt\", MONGO_DATE_CODEC_ID),\n\t\"temporal.timestamp\": removedPresetWithPhases(\"Date\", MONGO_DATE_CODEC_ID, false)\n};\n//#endregion\n//#region src/describe-unresolved-type.ts\nconst EARLIER_MONGO_SCALAR_NAMES = {\n\tBigInt: \"Int64\",\n\tBytes: \"Binary\",\n\tDecimal: \"Decimal128\"\n};\nfunction scalarTypesSentence(types) {\n\tconst current = [...collectScalarTypeConstructors(types).keys()].filter((name) => {\n\t\tconst descriptor = types[name];\n\t\treturn !(descriptor !== void 0 && isAuthoringTypeConstructorDescriptor(descriptor) && descriptor.deprecated !== void 0);\n\t});\n\treturn current.length === 0 ? \"No Mongo scalar types are registered.\" : `The Mongo scalar types are ${current.length === 1 ? current.join(\"\") : `${current.slice(0, -1).join(\", \")} and ${current.at(-1)}`}.`;\n}\nfunction describeUnresolvedMongoType(contributions) {\n\tconst types = contributions.type;\n\tconst scalars = collectScalarTypeConstructors(types);\n\treturn ({ field, owner, written, isDeclared }) => {\n\t\tif (field.typeConstructor !== void 0) return describeRemovedFieldPreset(removedMongoFieldPresets, field.typeConstructor, types, isDeclared);\n\t\tif (field.typeNamespaceId !== void 0) return;\n\t\tconst replacement = EARLIER_MONGO_SCALAR_NAMES[written];\n\t\tif (replacement === void 0 || !scalars.has(replacement)) return `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a scalar type, an enum, a composite type or a model. ${scalarTypesSentence(types)}`;\n\t\treturn `Field \"${owner.name}.${field.name}\" has type \"${written}\", which is not a Mongo scalar type; use \"${replacement}\".`;\n\t};\n}\n//#endregion\nexport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAIA,MAAM,sBAAsB;;AAE5B,MAAM,2BAA2B;CAChC,sBAAsB,uBAAuB,sBAAsB,mBAAmB;CACtF,sBAAsB,uBAAuB,sBAAsB,mBAAmB;CACtF,sBAAsB,wBAAwB,QAAQ,qBAAqB,KAAK;AACjF;AAGA,MAAM,6BAA6B;CAClC,QAAQ;CACR,OAAO;CACP,SAAS;AACV;AACA,SAAS,oBAAoB,OAAO;CACnC,MAAM,UAAU,CAAC,GAAG,8BAA8B,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,SAAS;EACjF,MAAM,aAAa,MAAM;EACzB,OAAO,EAAE,eAAe,KAAK,KAAK,qCAAqC,UAAU,KAAK,WAAW,eAAe,KAAK;CACtH,CAAC;CACD,OAAO,QAAQ,WAAW,IAAI,0CAA0C,8BAA8B,QAAQ,WAAW,IAAI,QAAQ,KAAK,EAAE,IAAI,GAAG,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,QAAQ,GAAG,EAAE,IAAI;AAC5M;AACA,SAAS,4BAA4B,eAAe;CACnD,MAAM,QAAQ,cAAc;CAC5B,MAAM,UAAU,8BAA8B,KAAK;CACnD,QAAQ,EAAE,OAAO,OAAO,SAAS,iBAAiB;EACjD,IAAI,MAAM,oBAAoB,KAAK,GAAG,OAAO,2BAA2B,0BAA0B,MAAM,iBAAiB,OAAO,UAAU;EAC1I,IAAI,MAAM,oBAAoB,KAAK,GAAG;EACtC,MAAM,cAAc,2BAA2B;EAC/C,IAAI,gBAAgB,KAAK,KAAK,CAAC,QAAQ,IAAI,WAAW,GAAG,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,uEAAuE,oBAAoB,KAAK;EACzN,OAAO,UAAU,MAAM,KAAK,GAAG,MAAM,KAAK,cAAc,QAAQ,4CAA4C,YAAY;CACzH;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interpreter-_2zXFvs1-DQ0uxLuK.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-_2zXFvs1.mjs"],"sourcesContent":["import { describeDiscriminatorRefusal, enumMemberProblemDiagnostic, instantiateAuthoringEntityType, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, resolveTypeAliasGenerators } from \"@internal/framework-components/authoring\";\nimport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, isBareTypeConstructor, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from \"@internal/psl-parser/interpret\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { DOCUMENT_ID } from \"@internal/mongo-contract\";\nimport { buildMongoContractFromDefinition } from \"@internal/mongo-contract-ts/contract-builder\";\nimport { bool, contributedTypeAliasOf, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, refuseRepeatedTypeAliasAttributes, resolveTypeAliases, str, typeAliasSpecContext, typeAttributeSpecContextOfField, typeAttributeSubjectLabel, typeGeneratorAttributeSpec, typeReferenceNode, writtenScalar } from \"@internal/psl-parser\";\nimport { ArrayLiteralAst, FunctionCallAst, PathExprAst } from \"@internal/psl-parser/syntax\";\nimport { assertDefined, invariant } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { crossRef } from \"@internal/contract/types\";\n//#region src/mongo-attribute-specs.ts\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsources: input.sources,\n\t\tselfModel: input.selfModel,\n\t\tfield: input.field,\n\t\tbinder: input.binder,\n\t\tsymbols: input.symbols\n\t};\n}\nconst UNLOWERED_FIELD_ATTRIBUTE_HINTS = /* @__PURE__ */ new Map([[\"updatedAt\", \"Use @onCreate(now()) @onUpdate(now()), or type the field temporal.UpdatedAt.\"]]);\nconst DEFAULT_NOW_HINT = \"Use @onCreate(now()) instead; MongoDB has no database defaults.\";\n/** The hint for an attribute MongoDB PSL does not lower, naming what to write instead. */\nfunction unloweredAttributeHint(attribute) {\n\tif (attribute.name === \"default\" && attribute.args[0]?.value.replace(/\\s/g, \"\") === \"now()\") return DEFAULT_NOW_HINT;\n\treturn UNLOWERED_FIELD_ATTRIBUTE_HINTS.get(attribute.name);\n}\nfunction describeUnsupportedMongoAttribute(sources) {\n\treturn ({ attribute, level, owner, field }) => {\n\t\tif (level === \"model\") return {\n\t\t\tcode: \"PSL_UNSUPPORTED_MODEL_ATTRIBUTE\",\n\t\t\tmessage: `${owner.kind === \"mixin\" ? \"Mixin\" : \"Model\"} \"${owner.name}\" uses unsupported attribute \"@@${attribute.name}\"`,\n\t\t\t...diagnosticSource(sources, owner.node.syntax).at(attribute.span)\n\t\t};\n\t\tif (field === void 0) return void 0;\n\t\tconst base = `Field \"${owner.name}.${field.name}\" uses unsupported attribute \"@${attribute.name}\"`;\n\t\tconst hint = unloweredAttributeHint(attribute);\n\t\treturn {\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_ATTRIBUTE\",\n\t\t\tmessage: hint === void 0 ? base : `${base}. ${hint}`,\n\t\t\t...diagnosticSource(sources, field.node.syntax).at(attribute.span)\n\t\t};\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.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\tsymbols: input.symbols,\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsources: input.sources,\n\t\tbinder: input.binder\n\t}));\n\tif (!result.ok) {\n\t\tinput.diagnostics.push(...result.failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nconst mapModelSpec = modelAttribute(\"map\", {\n\tdocumentation: \"Maps this model to a MongoDB collection name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The collection name stored in MongoDB.\"\n\t}]\n});\nconst mapFieldSpec = fieldAttribute(\"map\", {\n\tdocumentation: \"Maps this field to a stored document key.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The key stored in MongoDB documents.\"\n\t}]\n});\nconst idFieldSpec = fieldAttribute(\"id\", { documentation: \"Marks the field stored as `_id`, the document’s id. The field must be stored as `_id`: name it `_id` or add `@map(\\\"_id\\\")`. A model may leave `@id` out; its documents still get an ObjectId `_id`.\" });\nconst uniqueFieldSpec = fieldAttribute(\"unique\", { documentation: \"Requires values in this field to be unique across the collection.\" });\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tdocumentation: \"Names a relation and associates local fields with fields on the referenced model.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The relation name used to pair both sides. May also be supplied by name.\"\n\t}],\n\tnamed: {\n\t\tname: {\n\t\t\ttype: optional(str()),\n\t\t\tdocumentation: \"The relation name used to pair both sides. Cannot also be supplied positionally.\"\n\t\t},\n\t\tfields: {\n\t\t\ttype: optional(list(fieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The ordered local fields holding references to related documents.\"\n\t\t},\n\t\treferences: {\n\t\t\ttype: optional(list(referencedFieldRef(), {\n\t\t\t\tallowEmpty: false,\n\t\t\t\tunique: true\n\t\t\t})),\n\t\t\tdocumentation: \"The corresponding fields on the referenced model.\"\n\t\t}\n\t}\n});\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", {\n\tdocumentation: \"Selects the field that distinguishes inheritance variants in this collection.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The discriminator field on this model.\"\n\t}]\n});\nfunction baseModelSpec() {\n\treturn modelAttribute(\"base\", {\n\t\tdocumentation: \"Declares this model as a variant of a base model.\",\n\t\tpositional: [{\n\t\t\tkey: \"base\",\n\t\t\ttype: entityRef({ kind: \"model\" }),\n\t\t\tdocumentation: \"The base model to inherit from.\"\n\t\t}, {\n\t\t\tkey: \"value\",\n\t\t\ttype: writtenScalar(str()),\n\t\t\tdocumentation: \"The discriminator value identifying this variant, a value of the discriminator field's type.\"\n\t\t}]\n\t});\n}\nconst indexFieldElement = oneOf(fieldRef(), funcCall(\"wildcard\", {\n\tdocumentation: \"Indexes document fields using a MongoDB wildcard index.\",\n\tpositional: [{\n\t\tkey: \"scope\",\n\t\ttype: optional(identifier()),\n\t\tdocumentation: \"The field path to index recursively. Omit to index all document fields.\"\n\t}]\n}), funcCall(\"sort\", {\n\tdocumentation: \"Selects an index field with an explicit sort direction.\",\n\tpositional: [{\n\t\tkey: \"field\",\n\t\ttype: fieldRef(),\n\t\tdocumentation: \"The model field to index.\"\n\t}, {\n\t\tkey: \"direction\",\n\t\ttype: oneOf(identifier(\"Asc\", { documentation: \"Sort ascending.\" }), identifier(\"Desc\", { documentation: \"Sort descending.\" })),\n\t\tdocumentation: \"The index order for this field: `Asc` or `Desc`.\"\n\t}]\n}));\nconst collationNamedArgs = {\n\tcollationLocale: {\n\t\ttype: optional(str()),\n\t\tdocumentation: \"The ICU locale used for string comparison, or `simple` for binary comparison.\"\n\t},\n\tcollationStrength: {\n\t\ttype: optional(oneOf(num(1), num(2), num(3), num(4), num(5))),\n\t\tdocumentation: \"The collation comparison level, from `1` (primary differences) through `5` (identical).\"\n\t},\n\tcollationCaseLevel: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether case differences are compared at strength `1` or `2`.\"\n\t},\n\tcollationCaseFirst: {\n\t\ttype: optional(oneOf(str(\"upper\"), str(\"lower\"), str(\"off\"))),\n\t\tdocumentation: \"Whether uppercase or lowercase sorts first, or `off` for the locale default.\"\n\t},\n\tcollationNumericOrdering: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether numeric strings are compared as numbers rather than lexicographically.\"\n\t},\n\tcollationAlternate: {\n\t\ttype: optional(oneOf(str(\"non-ignorable\"), str(\"shifted\"))),\n\t\tdocumentation: \"Whether punctuation and whitespace are significant or shifted to a later comparison level.\"\n\t},\n\tcollationMaxVariable: {\n\t\ttype: optional(oneOf(str(\"punct\"), str(\"space\"))),\n\t\tdocumentation: \"Which characters are ignored when alternate handling is `shifted`: punctuation or spaces.\"\n\t},\n\tcollationBackwards: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether secondary differences, such as accents, are compared in reverse order.\"\n\t},\n\tcollationNormalization: {\n\t\ttype: optional(bool()),\n\t\tdocumentation: \"Whether strings are checked and normalized before comparison.\"\n\t}\n};\nfunction buildIndexModelSpec(name) {\n\treturn modelAttribute(name, {\n\t\tdocumentation: name === \"unique\" ? \"Declares a unique MongoDB index over the selected fields.\" : \"Declares a MongoDB index over the selected fields.\",\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(indexFieldElement, { allowEmpty: false }),\n\t\t\tdocumentation: name === \"unique\" ? \"The nonempty list of indexed fields, optionally with sort directions. Wildcard scopes are not supported.\" : \"The nonempty list of indexed fields, optionally with sort directions or a wildcard scope.\"\n\t\t}],\n\t\tnamed: {\n\t\t\ttype: {\n\t\t\t\ttype: optional(oneOf(num(1), num(-1), str(\"text\"), str(\"2dsphere\"), str(\"2d\"), str(\"hashed\"))),\n\t\t\t\tdocumentation: \"The MongoDB index key type: ascending `1`, descending `-1`, text, geospatial, or hashed.\"\n\t\t\t},\n\t\t\tsparse: {\n\t\t\t\ttype: optional(bool()),\n\t\t\t\tdocumentation: \"Whether documents missing indexed fields are omitted from the index.\"\n\t\t\t},\n\t\t\texpireAfterSeconds: {\n\t\t\t\ttype: optional(int()),\n\t\t\t\tdocumentation: \"The expiration interval in seconds for a TTL index.\"\n\t\t\t},\n\t\t\tfilter: {\n\t\t\t\ttype: optional(json()),\n\t\t\t\tdocumentation: \"A JSON partial-filter expression limiting which documents are indexed.\"\n\t\t\t},\n\t\t\tinclude: {\n\t\t\t\ttype: optional(list(str())),\n\t\t\t\tdocumentation: \"Document paths included in the wildcard index projection.\"\n\t\t\t},\n\t\t\texclude: {\n\t\t\t\ttype: optional(list(str())),\n\t\t\t\tdocumentation: \"Document paths excluded from the wildcard index projection.\"\n\t\t\t},\n\t\t\tdefault_language: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The default language for text-index tokenization and stemming.\"\n\t\t\t},\n\t\t\tlanguageOverride: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The document field that overrides the text-index language.\"\n\t\t\t},\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\n}\nfunction buildTextIndexModelSpec() {\n\treturn modelAttribute(\"textIndex\", {\n\t\tdocumentation: \"Declares a MongoDB text index with optional field weights and language settings.\",\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: list(indexFieldElement, { allowEmpty: false }),\n\t\t\tdocumentation: \"The nonempty list of fields whose text is indexed.\"\n\t\t}],\n\t\tnamed: {\n\t\t\tfilter: {\n\t\t\t\ttype: optional(json()),\n\t\t\t\tdocumentation: \"A JSON partial-filter expression limiting which documents are indexed.\"\n\t\t\t},\n\t\t\tweights: {\n\t\t\t\ttype: optional(record(int({\n\t\t\t\t\tmin: 1,\n\t\t\t\t\tmax: 99999\n\t\t\t\t}))),\n\t\t\t\tdocumentation: \"Relative text-search weights by field, each from `1` through `99999`.\"\n\t\t\t},\n\t\t\tlanguage: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The default language for tokenization and stemming.\"\n\t\t\t},\n\t\t\tlanguageOverride: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The document field that overrides the text-index language.\"\n\t\t\t},\n\t\t\t...collationNamedArgs\n\t\t}\n\t});\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: baseModelSpec,\n\t\tindex: staticModelSpec(buildIndexModelSpec(\"index\")),\n\t\tunique: staticModelSpec(buildIndexModelSpec(\"unique\")),\n\t\ttextIndex: staticModelSpec(buildTextIndexModelSpec())\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\tonCreate: generatorAttributeSpec(\"onCreate\"),\n\t\tonUpdate: generatorAttributeSpec(\"onUpdate\")\n\t}\n};\n//#endregion\n//#region src/pair-back-relations.ts\n/**\n* Matches each back-relation with the foreign key on the other model: same model pair, and the same relation name when the back-relation has one. A back-relation with no match is orphaned unless its foreign key was already reported (`invalidFkPairings`); one with several matches is ambiguous.\n*/\nfunction pairMongoBackRelations(input) {\n\tconst foreignKeysByPair = /* @__PURE__ */ new Map();\n\tfor (const fk of input.foreignKeys) {\n\t\tconst key = fkRelationPairKey(fk.declaringModel, fk.targetModel);\n\t\tconst existing = foreignKeysByPair.get(key);\n\t\tif (existing) existing.push(fk);\n\t\telse foreignKeysByPair.set(key, [fk]);\n\t}\n\tconst relations = [];\n\tconst diagnostics = [];\n\tfor (const candidate of input.candidates) {\n\t\tconst { field, modelName, targetModelName } = candidate;\n\t\tconst source = diagnosticSource(candidate.sources, field.node.syntax);\n\t\tconst pairKey = fkRelationPairKey(targetModelName, modelName);\n\t\tconst pairMatches = foreignKeysByPair.get(pairKey) ?? [];\n\t\tconst matches = candidate.relationName ? pairMatches.filter((fk) => fk.relationName === candidate.relationName) : pairMatches;\n\t\tif (matches.length === 0) {\n\t\t\tif (consumeInvalidFkPairing(candidate, pairKey, input.invalidFkPairings)) continue;\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${modelName}.${field.name}\" has no matching FK-side relation on model \"${targetModelName}\". Add @relation(fields: [...], references: [...]) on the FK-side relation or use an explicit join model for many-to-many.`,\n\t\t\t\t...source.at(field.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst [fk] = matches;\n\t\tif (fk === void 0 || matches.length > 1) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_AMBIGUOUS_BACKRELATION\",\n\t\t\t\tmessage: `Backrelation list field \"${modelName}.${field.name}\" matches multiple FK-side relations on model \"${targetModelName}\". Add @relation(\"...\") to both sides to disambiguate.`,\n\t\t\t\t...source.at(field.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (candidate.cardinality === \"1:1\" && !field.optional) diagnostics.push(requiredOneToOneBackrelationDiagnostic({\n\t\t\tmodelName,\n\t\t\tfield,\n\t\t\ttargetModelName,\n\t\t\tsources: candidate.sources,\n\t\t\trecordNoun: \"document\"\n\t\t}));\n\t\trelations.push({\n\t\t\tmodelName,\n\t\t\tfieldName: field.name,\n\t\t\trelation: {\n\t\t\t\tto: crossRef(targetModelName, input.namespaceId),\n\t\t\t\t...candidate.cardinality === \"1:N\" ? { cardinality: \"1:N\" } : {\n\t\t\t\t\tcardinality: \"1:1\",\n\t\t\t\t\tnullable: true\n\t\t\t\t},\n\t\t\t\ton: {\n\t\t\t\t\tlocalFields: fk.targetFields,\n\t\t\t\t\ttargetFields: fk.localFields\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\trelations,\n\t\tdiagnostics\n\t};\n}\n//#endregion\n//#region src/psl-helpers.ts\n/** Storage collection name of a model that declares no `@@map`: the model name, verbatim. */\nfunction defaultCollectionName(modelName) {\n\treturn modelName;\n}\nfunction getAttribute(attributes, name) {\n\treturn attributes.find((attr) => attr.name === name);\n}\n//#endregion\n//#region src/refusal-diagnostics.ts\nfunction fieldSiteKey(owner, fieldName) {\n\treturn JSON.stringify([owner, fieldName]);\n}\nfunction fieldSiteOf(sites, key) {\n\tconst site = sites.fields.get(fieldSiteKey(key.owner.name, key.field));\n\tif (site === void 0) throw new InternalError(`A refused field \"${key.owner.name}.${key.field}\" has a site.`);\n\treturn site;\n}\nfunction modelSitesOf(sites, model) {\n\tconst modelSites = sites.models.get(model);\n\tif (modelSites === void 0) throw new InternalError(`A refused model \"${model}\" has sites.`);\n\treturn modelSites;\n}\nfunction at(site, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...site.source.at(site.span)\n\t};\n}\nfunction atField(field, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...field.source.at(field.symbol.span)\n\t};\n}\nfunction atFieldCall(field, code, message) {\n\treturn {\n\t\tcode,\n\t\tmessage,\n\t\t...field.source.at(field.symbol.typeConstructor?.span ?? field.symbol.span)\n\t};\n}\nfunction generatedListDiagnostic(field, label) {\n\tconst perElement = \"Lists have no per-element generated values;\";\n\tconst phase = field.generatorAttributes.onCreate !== void 0 ? \"onCreate\" : \"onUpdate\";\n\tconst attribute = field.generatorAttributes[phase];\n\tif (attribute !== void 0) return {\n\t\tcode: \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\tmessage: `${label} is a list and cannot use @${phase}(${attribute.argument}). ${perElement} remove @${phase}(...).`,\n\t\t...field.source.at(attribute.span)\n\t};\n\treturn atField(field, \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\", `${label} is a list, and its type alias \"${field.typeAlias?.name}\" generates a value. ${perElement} remove \"[]\" or type the field without the alias.`);\n}\nfunction generatedOnValueObjectDiagnostic(field, owner) {\n\tconst fieldName = field.symbol.name;\n\treturn atField(field, \"PSL_UNSUPPORTED_FIELD_TYPE\", `Member \"${fieldName}\" of composite type \"${owner}\" is typed by the type alias \"${field.typeAlias?.name}\", which generates a value; a composite type member has no generated values.`);\n}\nfunction relationNullabilityDiagnostic(field, model, ownsForeignKey) {\n\tconst fieldLabel = `Relation field \"${model}.${field.symbol.name}\"`;\n\tif (!ownsForeignKey) return atField(field, \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\", `${fieldLabel} is required, but the other model holds the relation fields, so nothing in storage guarantees the related document exists. Make it optional with \"?\".`);\n\treturn atField(field, \"PSL_RELATION_NULLABILITY_MISMATCH\", field.symbol.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.symbol.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.symbol.name}\" or make those fields required.`);\n}\nconst INDEX_SHAPE_MESSAGES = {\n\t\"unique-wildcard\": () => \"Unique indexes cannot use wildcard() fields\",\n\t\"hashed-several-fields\": () => \"Hashed indexes must have exactly one field\",\n\t\"ttl-with-wildcard\": () => \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\"projection-without-wildcard\": () => \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\"collation-without-locale\": () => \"collationLocale is required when using collation options\",\n\t\"second-text-index\": (model) => `Only one @@textIndex is allowed per collection (model \"${model}\")`\n};\nfunction validatorDiagnostic(refusal, sites) {\n\tswitch (refusal.kind) {\n\t\tcase \"enumBsonType\":\n\t\tcase \"enumNotListable\":\n\t\tcase \"enumMemberNotListable\": {\n\t\t\tconst site = sites.enums.get(refusal.enumName);\n\t\t\tif (site === void 0) throw new InternalError(`Enum \"${refusal.enumName}\" has a site.`);\n\t\t\tconst subject = `enum \"${refusal.enumName}\"`;\n\t\t\tconst base = {\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tsourceId: site.block.sourceId\n\t\t\t};\n\t\t\tif (refusal.kind === \"enumBsonType\") return {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} ${refusal.refusal.reason}`,\n\t\t\t\tspan: site.codecSpan\n\t\t\t};\n\t\t\tif (refusal.kind === \"enumNotListable\") return {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} @@type codec \"${refusal.codecId}\" ${refusal.reason}`,\n\t\t\t\tspan: site.codecSpan\n\t\t\t};\n\t\t\treturn {\n\t\t\t\t...base,\n\t\t\t\tmessage: `${subject} member \"${refusal.member}\" ${refusal.reason}`,\n\t\t\t\tspan: site.block.memberSpans[refusal.member] ?? site.codecSpan\n\t\t\t};\n\t\t}\n\t\tcase \"fieldBsonType\":\n\t\tcase \"documentId\": {\n\t\t\tconst owner = refusal.kind === \"fieldBsonType\" ? refusal.owner.name : refusal.modelName;\n\t\t\tconst field = fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: owner\n\t\t\t\t},\n\t\t\t\tfield: refusal.fieldName\n\t\t\t});\n\t\t\treturn atField(field, refusal.kind === \"fieldBsonType\" ? \"PSL_UNSUPPORTED_FIELD_TYPE\" : \"PSL_MONGO_ID_INVALID\", `Field \"${owner}.${field.symbol.name}\" ${refusal.kind === \"fieldBsonType\" ? refusal.refusal.reason : refusal.reason}`);\n\t\t}\n\t\tcase \"embeddedModelHasVariants\": throw new InternalError(\"A PSL schema writes no embed relations.\");\n\t}\n}\n/**\n* The diagnostic for one refusal of the builder, at the place in the schema it is about, worded as PSL words it. A source position comes from the refusal's key.\n*/\nfunction refusalDiagnostic(refusal, sites) {\n\tswitch (refusal.kind) {\n\t\tcase \"storedNameUnsupported\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_STORED_NAME_UNSUPPORTED\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" ${refusal.reason}. Give the field another stored name with @map.`);\n\t\tcase \"storedNameDuplicate\": {\n\t\t\tconst model = refusal.key.owner.name;\n\t\t\treturn atField(fieldSiteOf(sites, refusal.key), \"PSL_DUPLICATE_STORED_NAME\", `Fields \"${model}.${refusal.firstField}\" and \"${model}.${refusal.key.field}\" are both stored as \"${refusal.storedName}\". Give each field its own stored name with @map.`);\n\t\t}\n\t\tcase \"restatedBaseFieldDiffers\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_VARIANT_FIELD_DIFFERS_FROM_BASE\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" restates field \"${refusal.key.field}\" of base model \"${refusal.baseModel}\" with a different ${refusal.differences.map(differenceWording).join(\" and \")}. A variant's documents are checked against the base's field, so declare it exactly as the base does, or remove it from the variant.`);\n\t\tcase \"storedNameSharedWithBase\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_DUPLICATE_STORED_NAME\", `Fields \"${refusal.baseModel}.${refusal.baseField}\" and \"${refusal.key.owner.name}.${refusal.key.field}\" are both stored as \"${refusal.storedName}\", and a variant's documents hold its base's fields too. Give each field its own stored name with @map.`);\n\t\tcase \"valueObjectFieldStoredName\": {\n\t\t\tconst field = fieldSiteOf(sites, refusal.key);\n\t\t\treturn at(field.map ?? {\n\t\t\t\tsource: field.source,\n\t\t\t\tspan: field.symbol.span\n\t\t\t}, \"PSL_MONGO_TYPE_FIELD_MAP_UNSUPPORTED\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" has @map, but a field of a composite type is stored under its own name. Remove @map, or rename the field to the name it is stored under.`);\n\t\t}\n\t\tcase \"relationLocalFieldUnknown\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\treturn atField(fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: model\n\t\t\t\t},\n\t\t\t\tfield: relation\n\t\t\t}), \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", `Relation field \"${model}.${relation}\" joins on field \"${refusal.fieldName}\", which model \"${model}\" does not declare`);\n\t\t}\n\t\tcase \"relationNullability\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\treturn relationNullabilityDiagnostic(fieldSiteOf(sites, {\n\t\t\t\tkind: \"field\",\n\t\t\t\towner: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tname: model\n\t\t\t\t},\n\t\t\t\tfield: relation\n\t\t\t}), model, refusal.ownsForeignKey);\n\t\t}\n\t\tcase \"variantCollectionDiffers\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.model).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\", `Mongo variant \"${refusal.key.model}\" cannot use a different collection than its base \"${refusal.baseModel}\". Mongo only supports single-collection polymorphism.`);\n\t\t}\n\t\tcase \"indexFieldUnknown\":\n\t\tcase \"indexShape\":\n\t\tcase \"indexScopeConflict\":\n\t\tcase \"indexDuplicate\": {\n\t\t\tconst { model, position } = refusal.key;\n\t\t\tconst site = modelSitesOf(sites, model).indexes[position];\n\t\t\tif (site === void 0) throw new InternalError(`Index ${position} of \"${model}\" has a site.`);\n\t\t\tswitch (refusal.kind) {\n\t\t\t\tcase \"indexFieldUnknown\": return at(site, \"PSL_INDEX_FIELD_NOT_FOUND\", `Index on model \"${model}\" references unknown field \"${refusal.fieldName}\"`);\n\t\t\t\tcase \"indexShape\": return at(site, \"PSL_INVALID_INDEX\", refusal.rule === \"wildcard-with-type\" ? `wildcard() fields cannot be combined with type: ${wildcardTypeOf(site.index)}` : INDEX_SHAPE_MESSAGES[refusal.rule](model));\n\t\t\t\tcase \"indexScopeConflict\": return at(site, \"PSL_INVALID_INDEX\", `Variant \"${model}\" index conflicts with discriminator scope: ${refusal.reason}`);\n\t\t\t\tcase \"indexDuplicate\": return at(site, \"PSL_INVALID_INDEX\", refusal.firstModel === model ? `Model \"${model}\" declares this index twice. Remove one of them.` : `Collection \"${refusal.collection}\" already has this index, declared on model \"${refusal.firstModel}\". Remove one of them from model \"${model}\" or \"${refusal.firstModel}\".`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"generatedOnValueObject\": return generatedOnValueObjectDiagnostic(fieldSiteOf(sites, refusal.key), refusal.key.owner.name);\n\t\tcase \"generatorPhaseSetTwice\": throw new InternalError(`Field \"${refusal.key.owner.name}.${refusal.key.field}\" sets a phase twice, which PSL refuses as a repeated type alias attribute before building.`);\n\t\tcase \"generatedList\": return generatedListDiagnostic(fieldSiteOf(sites, refusal.key), `Field \"${refusal.key.owner.name}.${refusal.key.field}\"`);\n\t\tcase \"generatedOnVariant\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_GENERATOR_ON_VARIANT_FIELD\", `Generated value on variant \"${refusal.key.owner.name}\" field \"${refusal.key.field}\": execution defaults apply to every document in collection \"${refusal.collection}\", so declare them on the base model.`);\n\t\tcase \"generatedConflict\": {\n\t\t\tconst field = fieldSiteOf(sites, refusal.key);\n\t\t\treturn atField(field, \"PSL_GENERATOR_CONFLICT\", `Generated value on \"${refusal.key.owner.name}.${refusal.key.field}\" sets different execution defaults than \"${refusal.otherModel}.${refusal.otherField}\" for field \"${field.storedName}\" of collection \"${refusal.collection}\". Generate the same values on both models.`);\n\t\t}\n\t\tcase \"typeParamsInvalid\": return atFieldCall(fieldSiteOf(sites, refusal.key), \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", `${`Field \"${refusal.key.owner.name}.${refusal.key.field}\"`} has type parameters its type refuses: ${refusal.problem.message}`);\n\t\tcase \"enumMemberProblem\": {\n\t\t\tconst site = sites.enums.get(refusal.enumName);\n\t\t\tif (site === void 0) throw new InternalError(`Enum \"${refusal.enumName}\" has a site.`);\n\t\t\treturn enumMemberProblemDiagnostic(refusal.problem, site.block);\n\t\t}\n\t\tcase \"enumUnknown\": return atField(fieldSiteOf(sites, refusal.key), \"PSL_UNRESOLVED_REFERENCE\", `Field \"${refusal.key.owner.name}.${refusal.key.field}\" is typed by enum \"${refusal.enumName}\", which the schema does not declare`);\n\t\tcase \"discriminatorValueDuplicate\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_DUPLICATE_DISCRIMINATOR_VALUE\", `Discriminator value \"${refusal.value}\" is used by both \"${refusal.firstVariant}\" and \"${refusal.key.variant}\" on base model \"${refusal.baseModel}\"`);\n\t\t}\n\t\tcase \"discriminatorFieldUnknown\":\n\t\tcase \"discriminatorField\":\n\t\tcase \"discriminatorAndBase\":\n\t\tcase \"discriminatorWithoutVariants\": {\n\t\t\tconst model = refusal.key.model;\n\t\t\tconst site = modelSitesOf(sites, model).discriminator;\n\t\t\tif (site === void 0) throw new InternalError(\"A base has a @@discriminator site.\");\n\t\t\tswitch (refusal.kind) {\n\t\t\t\tcase \"discriminatorFieldUnknown\": return at(site, \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\", `Discriminator field \"${refusal.fieldName}\" is not a field on model \"${model}\"`);\n\t\t\t\tcase \"discriminatorField\": return at(site, \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", describeDiscriminatorRefusal(refusal.refusal, {\n\t\t\t\t\tmodelName: model,\n\t\t\t\t\tfieldName: refusal.fieldName,\n\t\t\t\t\ttypeName: discriminatorTypeName(sites, model, refusal.fieldName),\n\t\t\t\t\tenumName: void 0,\n\t\t\t\t\tvariantName: () => model\n\t\t\t\t}));\n\t\t\t\tcase \"discriminatorAndBase\": return at(site, \"PSL_DISCRIMINATOR_AND_BASE\", `Model \"${model}\" cannot have both @@discriminator and @@base`);\n\t\t\t\tcase \"discriminatorWithoutVariants\": return at(site, \"PSL_ORPHANED_DISCRIMINATOR\", `Model \"${model}\" has @@discriminator but no variant models declare @@base(${model}, ...)`);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"discriminatorValue\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\tconst valueSite = {\n\t\t\t\tsource: base.source,\n\t\t\t\tspan: base.valueSpan\n\t\t\t};\n\t\t\tif (refusal.refusal.kind === \"unreadable\") return {\n\t\t\t\t...refusal.refusal.refusal,\n\t\t\t\t...valueSite.source.at(valueSite.span)\n\t\t\t};\n\t\t\treturn at(valueSite, \"PSL_INVALID_ATTRIBUTE_ARGUMENT\", describeDiscriminatorRefusal(refusal.refusal, {\n\t\t\t\tmodelName: refusal.baseModel,\n\t\t\t\tfieldName: refusal.fieldName,\n\t\t\t\ttypeName: discriminatorTypeName(sites, refusal.baseModel, refusal.fieldName),\n\t\t\t\tenumName: refusal.enumName,\n\t\t\t\tvariantName: (variant) => variant\n\t\t\t}));\n\t\t}\n\t\tcase \"baseWithoutDiscriminator\": {\n\t\t\tconst base = modelSitesOf(sites, refusal.key.variant).base;\n\t\t\tif (base === void 0) throw new InternalError(\"A variant has a @@base site.\");\n\t\t\treturn at(base, \"PSL_ORPHANED_BASE\", `Model \"${refusal.key.variant}\" declares @@base(${refusal.baseModel}, ...) but \"${refusal.baseModel}\" has no @@discriminator`);\n\t\t}\n\t\tcase \"validator\": return validatorDiagnostic(refusal.refusal, sites);\n\t\tcase \"duplicateModel\":\n\t\tcase \"duplicateValueObject\":\n\t\tcase \"collectionSettingWithoutCollection\":\n\t\tcase \"collectionSettingTwice\":\n\t\tcase \"generatorUnknown\":\n\t\tcase \"generatorNotApplicable\":\n\t\tcase \"generatedWithoutCollection\":\n\t\tcase \"enumKeyMismatch\":\n\t\tcase \"listedVariantMissing\":\n\t\tcase \"baseUnknown\":\n\t\tcase \"variantWithoutValue\": throw new InternalError(`A PSL definition cannot be refused with \"${refusal.kind}\".`);\n\t}\n}\n/** The key type a wildcard index combines with. */\nfunction wildcardTypeOf(index) {\n\treturn (Object.values(index.fields).find((direction) => direction === \"hashed\" || direction === \"2d\" || direction === \"2dsphere\") ?? \"hashed\").toString();\n}\nfunction discriminatorTypeName(sites, model, fieldName) {\n\treturn sites.fields.get(fieldSiteKey(model, fieldName))?.symbol.typeName ?? fieldName;\n}\nfunction differenceWording(difference) {\n\tswitch (difference) {\n\t\tcase \"storedName\": return \"@map\";\n\t\tcase \"type\": return \"type\";\n\t\tcase \"nullable\": return \"optionality\";\n\t\tcase \"many\": return \"list shape\";\n\t}\n}\n//#endregion\n//#region src/type-aliases.ts\n/** The field type a type constructor gives, keeping a bare constructor's fixed type params. */\nfunction scalarTypeOfConstructor(descriptor, call) {\n\tif (call !== void 0) return {\n\t\tkind: \"scalar\",\n\t\tcodecId: descriptor.output.codecId\n\t};\n\tconst { codecId, typeParams } = instantiateAuthoringTypeConstructor(descriptor, []);\n\treturn {\n\t\tkind: \"scalar\",\n\t\tcodecId,\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t};\n}\nconst GENERATOR_PHASES$1 = [\"onCreate\", \"onUpdate\"];\nconst MONGO_TYPE_ALIAS_ATTRIBUTE_NAMES = new Set(GENERATOR_PHASES$1);\nfunction describeUnsupportedMongoAliasAttribute(attribute, declaration) {\n\tif (attribute.name !== \"default\") return void 0;\n\tconst base = `Type alias \"${declaration.name}\" uses unsupported attribute \"@default\"`;\n\tconst hint = unloweredAttributeHint(attribute);\n\treturn hint === void 0 ? base : `${base}. ${hint}`;\n}\n/**\n* The generator a field's or type alias's `@onCreate(fn())` or `@onUpdate(fn())` resolves to for its type, or `undefined` once the attribute is diagnosed.\n*/\nfunction lowerGeneratorAttribute(input) {\n\tconst interpreted = interpretAttribute(input.attribute.node, typeGeneratorAttributeSpec(input.phase, input.specContext), {\n\t\tsources: input.sources,\n\t\tsymbols: input.symbols,\n\t\tbinder: input.binder\n\t});\n\tif (!interpreted.ok) {\n\t\tinput.diagnostics.push(...interpreted.failure);\n\t\treturn;\n\t}\n\tconst call = interpreted.value.value;\n\tconst { type } = input;\n\tconst resolution = type.kind === \"scalar\" ? input.generatorFunctions.resolve({\n\t\tname: call.fn,\n\t\targs: call.args\n\t}, {\n\t\tcodecId: type.codecId,\n\t\ttypeParams: type.typeParams,\n\t\tlength: void 0\n\t}) : void 0;\n\tif (resolution?.ok === true) return resolution.generator;\n\tconst label = typeAttributeSubjectLabel(input.specContext.subject);\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_GENERATOR_NOT_APPLICABLE\",\n\t\tmessage: resolution?.reason === \"refused\" ? `${label}: ${resolution.message}` : `${label}: ${call.fn}() does not apply to this field's type.`,\n\t\t...diagnosticSource(input.sources, input.attribute.node.syntax).at(call.span)\n\t});\n}\nfunction aliasType(alias, input) {\n\tconst { base, symbol } = alias;\n\tif (base.kind === \"typeConstructor\") return {\n\t\ttype: scalarTypeOfConstructor(base.descriptor, base.call),\n\t\tvalueSet: void 0\n\t};\n\tif (base.symbol.keyword !== \"enum\") {\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_NAMED_TYPE_BASE\",\n\t\t\tmessage: `Type alias \"${symbol.name}\" references unsupported base type \"${alias.baseName}\"`,\n\t\t\t...diagnosticSource(input.sources, symbol.node.syntax).at(symbol.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst codecId = input.codecIdByEnumName.get(base.symbol.name);\n\tif (codecId === void 0 || alias.baseResolution.kind !== \"block\") return void 0;\n\treturn {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId\n\t\t},\n\t\tvalueSet: {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: alias.baseResolution.namespace.id,\n\t\t\tentityName: base.symbol.name\n\t\t}\n\t};\n}\nfunction lowerAliasGenerators(alias, type, input) {\n\tconst specContext = typeAliasSpecContext(alias, input);\n\tconst phases = {};\n\tfor (const phase of GENERATOR_PHASES$1) {\n\t\tconst [attribute, duplicate] = alias.attributes.filter(({ name }) => name === phase);\n\t\tif (attribute === void 0) continue;\n\t\tif (duplicate !== void 0) {\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_ATTRIBUTE\",\n\t\t\t\tmessage: `\\`@${phase}\\` declared more than once on type alias \"${alias.symbol.name}\".`,\n\t\t\t\t...diagnosticSource(input.sources, duplicate.node.syntax).at(duplicate.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst generator = lowerGeneratorAttribute({\n\t\t\t...input,\n\t\t\tphase,\n\t\t\tattribute,\n\t\t\tspecContext,\n\t\t\ttype\n\t\t});\n\t\tif (generator !== void 0) phases[phase] = generator;\n\t}\n\treturn phases.onCreate === void 0 && phases.onUpdate === void 0 ? void 0 : phases;\n}\nfunction resolveContributedTypeAlias(alias, generatorFunctions) {\n\tconst { type } = instantiateAuthoringTypeAlias(alias.descriptor);\n\treturn {\n\t\talias,\n\t\tname: alias.name,\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: type.codecId,\n\t\t\t...ifDefined(\"typeParams\", type.typeParams)\n\t\t},\n\t\tvalueSet: void 0,\n\t\texecutionDefaults: resolveTypeAliasGenerators({\n\t\t\tpath: alias.name,\n\t\t\tdescriptor: alias.descriptor,\n\t\t\tgeneratorFunctions,\n\t\t\tlength: void 0\n\t\t})\n\t};\n}\n/**\n* Resolves each `types {}` alias once: its field type and the values its `@onCreate` and `@onUpdate` generate. MongoDB has no database defaults, so an alias's `@default` is refused here, once, not at each field typed by it.\n*/\nfunction resolveMongoTypeAliases(input) {\n\tconst declared = /* @__PURE__ */ new Map();\n\tconst aliases = resolveTypeAliases({\n\t\tdeclarations: input.declarations,\n\t\tbinder: input.binder,\n\t\tsources: input.sources,\n\t\tdiagnostics: input.diagnostics,\n\t\tauthoringTypes: input.authoringTypes,\n\t\tacceptedAttributes: MONGO_TYPE_ALIAS_ATTRIBUTE_NAMES,\n\t\tdescribeUnsupportedAttribute: describeUnsupportedMongoAliasAttribute\n\t});\n\tfor (const alias of aliases.values()) {\n\t\tconst resolved = aliasType(alias, input);\n\t\tif (resolved === void 0) continue;\n\t\tdeclared.set(alias.symbol, {\n\t\t\talias,\n\t\t\tname: alias.symbol.name,\n\t\t\t...resolved,\n\t\t\texecutionDefaults: lowerAliasGenerators(alias, resolved.type, input)\n\t\t});\n\t}\n\tconst contributed = /* @__PURE__ */ new Map();\n\treturn { ofResolution(resolution) {\n\t\tif (resolution?.kind === \"namedType\") return declared.get(resolution.symbol);\n\t\tconst alias = contributedTypeAliasOf(resolution);\n\t\tif (alias === void 0) return void 0;\n\t\tconst existing = contributed.get(alias.descriptor);\n\t\tif (existing !== void 0) return existing;\n\t\tconst resolved = resolveContributedTypeAlias(alias, input.generatorFunctions);\n\t\tcontributed.set(alias.descriptor, resolved);\n\t\treturn resolved;\n\t} };\n}\n//#endregion\n//#region src/interpreter.ts\n/**\n* Reports `PSL_DEPRECATED_SCALAR_NAME` at the type of a field whose scalar name is a deprecated alias, naming the replacement. The alias resolves to the same codec, so the contract does not change.\n*/\nfunction deprecatedScalarWarner(input) {\n\tconst { reportWarning } = input;\n\tif (reportWarning === void 0) return () => {};\n\treturn (field, descriptor) => {\n\t\tif (descriptor.deprecated === void 0) return;\n\t\tconst typeNode = field.node.typeAnnotation()?.name()?.syntax ?? field.node.syntax;\n\t\tconst [warning] = mapPslDiagnostics([{\n\t\t\tcode: \"PSL_DEPRECATED_SCALAR_NAME\",\n\t\t\tmessage: `Scalar type \"${field.typeName}\" is deprecated and will be removed; use \"${descriptor.deprecated.replacement}\".`,\n\t\t\t...diagnosticSource(input.sources, typeNode).at()\n\t\t}], input.sources);\n\t\tif (warning !== void 0) reportWarning({\n\t\t\t...warning,\n\t\t\tseverity: \"warning\"\n\t\t});\n\t};\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) for (const { node, span } of namespace.declarations) input.diagnostics.push({\n\t\tcode: \"PSL_UNSUPPORTED_NAMESPACE_BLOCK\",\n\t\tmessage: `Mongo does not support \\`namespace ${node.name()?.name() ?? namespace.name} { … }\\` blocks (the database is bound by the connection string; declare models at the document top level instead).`,\n\t\t...diagnosticSource(input.sources, node.syntax).at(span)\n\t});\n}\nfunction resolvePhysicalNames(input) {\n\tconst { model, physicalNames, specContext, sources, binder, diagnostics } = input;\n\tconst modelMap = model.attributes.find((attr) => attr.name === \"map\");\n\tconst collectionName = modelMap ? interpretModelAttribute({\n\t\tsymbols: specContext.symbols,\n\t\tnode: modelMap.node,\n\t\tspec: mongoAttributeSpecs.model.map(specContext),\n\t\tmodel,\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t})?.name : void 0;\n\tphysicalNames.set(model, collectionName ?? defaultCollectionName(model.name));\n\tfor (const field of Object.values(model.fields)) {\n\t\tconst fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\tconst mapped = fieldMap ? interpretFieldAttribute({\n\t\t\tsymbols: specContext.symbols,\n\t\t\tnode: fieldMap.node,\n\t\t\tspec: mongoAttributeSpecs.field.map({\n\t\t\t\t...specContext,\n\t\t\t\tfield,\n\t\t\t\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\ttypeConstructor: contributedTypeOf(fieldTypeResolution(field, binder), binder)\n\t\t\t}),\n\t\t\tmodel,\n\t\t\tfield,\n\t\t\tsources,\n\t\t\tbinder,\n\t\t\tdiagnostics\n\t\t})?.name : void 0;\n\t\tphysicalNames.set(field, mapped ?? field.name);\n\t}\n}\nfunction physicalName(physicalNames, symbol) {\n\tassertDefined(symbol, \"Physical names require a bound declaration\");\n\tconst name = physicalNames.get(symbol);\n\tassertDefined(name, \"Physical names must be populated before lowering\");\n\treturn name;\n}\n/** A `@@base` value as it is written; the grammar reads only a quoted string there. */\nfunction writtenBaseValue(written) {\n\tif (written.written === void 0) throw new InternalError(\"A @@base value is a quoted string, never a tagged literal.\");\n\treturn written.written;\n}\nfunction collectPolymorphismDeclarations(input) {\n\tconst { sources, binder, diagnostics } = input;\n\tconst discriminators = /* @__PURE__ */ new Map();\n\tconst bases = /* @__PURE__ */ new Map();\n\tconst reported = {\n\t\tdiscriminators: /* @__PURE__ */ new Set(),\n\t\tbaseTargets: /* @__PURE__ */ new Set()\n\t};\n\tfor (const model of input.models) {\n\t\tconst specContext = input.specContextFor(model);\n\t\tconst discNode = model.attributes.find((attr) => attr.name === \"discriminator\")?.node;\n\t\tif (discNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode: discNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.discriminator(specContext),\n\t\t\t\tmodel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) discriminators.set(model, {\n\t\t\t\tfieldName: parsed.field,\n\t\t\t\tsource: diagnosticSource(sources, discNode.syntax),\n\t\t\t\tspan: nodePslSpan(discNode.syntax, sources)\n\t\t\t});\n\t\t\telse reported.discriminators.add(model.name);\n\t\t}\n\t\tconst baseAttribute = model.attributes.find((attr) => attr.name === \"base\");\n\t\tconst baseNode = baseAttribute?.node;\n\t\tif (baseNode) {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode: baseNode,\n\t\t\t\tspec: mongoAttributeSpecs.model.base(),\n\t\t\t\tmodel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (parsed) bases.set(model, {\n\t\t\t\tbase: parsed.base.declaration,\n\t\t\t\twritten: writtenBaseValue(parsed.value),\n\t\t\t\tvalueSpan: parsed.value.span,\n\t\t\t\tsource: diagnosticSource(sources, baseNode.syntax),\n\t\t\t\tspan: nodePslSpan(baseNode.syntax, sources)\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst target = baseAttribute?.args[0]?.value;\n\t\t\t\tif (target !== void 0) reported.baseTargets.add(target);\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminators,\n\t\tbases,\n\t\treported\n\t};\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\") {\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 field = element.args[\"field\"];\n\tinvariant(typeof field === \"string\", \"The sort function spec requires a field reference\");\n\treturn {\n\t\tkind: \"field\",\n\t\tname: field,\n\t\tdirection: element.args[\"direction\"] === \"Desc\" ? -1 : 1\n\t};\n}\n/** The collation the index arguments name, or undefined when they name none. A collation without `collationLocale` is passed on for the builder to refuse. */\nfunction buildCollationFromSpec(args) {\n\tconst collation = {\n\t\t...ifDefined(\"locale\", args.collationLocale),\n\t\t...ifDefined(\"strength\", args.collationStrength),\n\t\t...ifDefined(\"caseLevel\", args.collationCaseLevel),\n\t\t...ifDefined(\"caseFirst\", args.collationCaseFirst),\n\t\t...ifDefined(\"numericOrdering\", args.collationNumericOrdering),\n\t\t...ifDefined(\"alternate\", args.collationAlternate),\n\t\t...ifDefined(\"maxVariable\", args.collationMaxVariable),\n\t\t...ifDefined(\"backwards\", args.collationBackwards),\n\t\t...ifDefined(\"normalization\", args.collationNormalization)\n\t};\n\treturn Object.keys(collation).length === 0 ? void 0 : collation;\n}\n/** The index keys by field name, as the builder takes them: a wildcard is `$**` or `<field>.$**`. */\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst fields = {};\n\tfor (const field of parsedFields) if (field.kind === \"wildcard\") fields[field.scope === void 0 ? \"$**\" : `${field.scope}.$**`] = defaultDirection;\n\telse fields[field.name] = field.direction ?? defaultDirection;\n\treturn {\n\t\tfields,\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn null;\n\t}\n\tconst fields = include ?? exclude;\n\tif (fields === void 0 || fields.length === 0 && hasWildcard) 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}\n/** Index options as the attribute specs read them, which are the values MongoDB takes. */\nfunction indexOptions(options) {\n\treturn blindCast(options);\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, parsed.type ?? 1, ctx);\n\tif (!resolved) return void 0;\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\treturn {\n\t\tfields: resolved.fields,\n\t\toptions: indexOptions({\n\t\t\t...unique && { unique: true },\n\t\t\t...ifDefined(\"sparse\", parsed.sparse),\n\t\t\t...ifDefined(\"expireAfterSeconds\", parsed.expireAfterSeconds),\n\t\t\t...ifDefined(\"partialFilterExpression\", parsed.filter),\n\t\t\t...ifDefined(\"wildcardProjection\", wildcardProjection),\n\t\t\t...ifDefined(\"collation\", collation),\n\t\t\t...ifDefined(\"default_language\", parsed.default_language),\n\t\t\t...ifDefined(\"language_override\", parsed.languageOverride)\n\t\t})\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\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\treturn {\n\t\tfields: resolved.fields,\n\t\toptions: indexOptions({\n\t\t\t...ifDefined(\"partialFilterExpression\", parsed.filter),\n\t\t\t...ifDefined(\"collation\", collation),\n\t\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t\t...ifDefined(\"default_language\", parsed.language),\n\t\t\t...ifDefined(\"language_override\", parsed.languageOverride)\n\t\t})\n\t};\n}\nfunction nestedIndexPath(node) {\n\tfor (const arg of node.argList()?.args() ?? []) {\n\t\tconst name = arg.name()?.name();\n\t\tconst list = arg.value();\n\t\tif (name !== void 0 && name !== \"fields\" || !(list instanceof ArrayLiteralAst)) continue;\n\t\tfor (const element of list.elements()) {\n\t\t\tconst field = element instanceof FunctionCallAst && element.name()?.identifier()?.token()?.text === \"sort\" ? [...element.args()][0]?.value() : element;\n\t\t\tconst path = field instanceof PathExprAst ? field.path() : [];\n\t\t\tif (field instanceof PathExprAst && path.length > 1) return {\n\t\t\t\tpath,\n\t\t\t\tsyntax: field.syntax\n\t\t\t};\n\t\t}\n\t}\n}\nfunction nestedIndexPathMessage(path, pslModel, binder) {\n\tconst [root = \"\"] = path;\n\tconst label = `Index field \"${path.join(\".\")}\" on model \"${pslModel.name}\"`;\n\tconst rootField = Object.hasOwn(pslModel.fields, root) ? pslModel.fields[root] : void 0;\n\treturn rootField !== void 0 && fieldTypeResolution(rootField, binder)?.kind === \"compositeType\" ? `${label} is a path into a composite type; indexes on fields of a composite type are not supported yet. Index a top-level field of \"${pslModel.name}\" or remove the index.` : `${label} is a dotted path, but \"${root}\" is not a field of \"${pslModel.name}\" whose type is a composite type, so the path names no field. List fields of \"${pslModel.name}\" by name.`;\n}\n/**\n* A model's indexes as the schema writes them, with where each is written: a field's `@unique` first, then `@@index`, `@@unique` and `@@textIndex` in the order the model lists them.\n*/\nfunction collectIndexes(pslModel, specContext, sources, binder, diagnostics) {\n\tconst indexes = [];\n\tfor (const field of Object.values(pslModel.fields)) {\n\t\tif (fieldTypeResolution(field, binder)?.kind === \"model\") continue;\n\t\tconst uniqueNode = field.attributes.find((attr) => attr.name === \"unique\")?.node;\n\t\tif (!uniqueNode) continue;\n\t\tif (interpretFieldAttribute({\n\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\ttypeConstructor: contributedTypeOf(fieldTypeResolution(field, binder), binder)\n\t\t\t}),\n\t\t\tmodel: pslModel,\n\t\t\tfield,\n\t\t\tsources,\n\t\t\tbinder,\n\t\t\tdiagnostics\n\t\t}) === void 0) continue;\n\t\tindexes.push({\n\t\t\tindex: {\n\t\t\t\tfields: { [field.name]: 1 },\n\t\t\t\toptions: { unique: true }\n\t\t\t},\n\t\t\tsource: diagnosticSource(sources, uniqueNode.syntax),\n\t\t\tspan: nodePslSpan(uniqueNode.syntax, sources)\n\t\t});\n\t}\n\tfor (const attr of pslModel.attributes) {\n\t\tif (attr.name !== \"index\" && attr.name !== \"unique\" && attr.name !== \"textIndex\") continue;\n\t\tconst node = attr.node;\n\t\tconst source = diagnosticSource(sources, node.syntax);\n\t\tconst ctx = {\n\t\t\tsource,\n\t\t\tspan: attr.span,\n\t\t\tdiagnostics\n\t\t};\n\t\tconst nested = nestedIndexPath(node);\n\t\tif (nested !== void 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\tmessage: nestedIndexPathMessage(nested.path, pslModel, binder),\n\t\t\t\t...source.at(nodePslSpan(nested.syntax, sources))\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tlet index;\n\t\tif (attr.name === \"textIndex\") {\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\tsymbols: specContext.symbols,\n\t\t\t\tnode,\n\t\t\t\tspec: mongoAttributeSpecs.model.textIndex(specContext),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tif (!parsed || parsed.fields.length === 0) continue;\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\tsymbols: specContext.symbols,\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\tsources,\n\t\t\t\tbinder,\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 !== void 0) indexes.push({\n\t\t\tindex,\n\t\t\tsource,\n\t\t\tspan: attr.span\n\t\t});\n\t}\n\treturn indexes;\n}\nfunction fieldTypeResolution(field, binder) {\n\tconst node = typeReferenceNode(field);\n\treturn node === void 0 ? void 0 : binder.symbolForNode(node);\n}\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generators a field's `@onCreate(fn())` and `@onUpdate(fn())` resolve to, and where each attribute is written. An attribute written twice, or one whose call is refused, is reported here.\n*/\nfunction lowerGeneratorAttributes(input) {\n\tconst { field, modelName, diagnostics } = input;\n\tconst phases = {};\n\tconst sites = {};\n\tlet refused = false;\n\tfor (const phase of GENERATOR_PHASES) {\n\t\tconst [attribute, duplicate] = field.attributes.filter(({ name }) => name === phase);\n\t\tif (attribute === void 0) continue;\n\t\tsites[phase] = {\n\t\t\tspan: attribute.span,\n\t\t\targument: attribute.args.find((arg) => arg.kind === \"positional\")?.value.trim() ?? \"\"\n\t\t};\n\t\tif (duplicate !== void 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DUPLICATE_ATTRIBUTE\",\n\t\t\t\tmessage: `\\`@${phase}\\` declared more than once on field \"${modelName}.${field.name}\".`,\n\t\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(duplicate.span)\n\t\t\t});\n\t\t\trefused = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst generator = lowerGeneratorAttribute({\n\t\t\tphase,\n\t\t\tattribute,\n\t\t\tspecContext: typeAttributeSpecContextOfField(input.specContext),\n\t\t\ttype: input.resolved.field.type,\n\t\t\tsymbols: input.specContext.symbols,\n\t\t\tbinder: input.binder,\n\t\t\tsources: input.sources,\n\t\t\tgeneratorFunctions: input.generatorFunctions,\n\t\t\tdiagnostics\n\t\t});\n\t\tif (generator === void 0) {\n\t\t\trefused = true;\n\t\t\tcontinue;\n\t\t}\n\t\tphases[phase] = generator;\n\t}\n\tconst none = phases.onCreate === void 0 && phases.onUpdate === void 0;\n\treturn {\n\t\tvalues: refused || none ? void 0 : phases,\n\t\tsites\n\t};\n}\nfunction fieldOfTypeAlias(field, typeAlias) {\n\treturn {\n\t\tfield: {\n\t\t\ttype: typeAlias.type,\n\t\t\tnullable: field.optional,\n\t\t\tmany: field.list ? { elementNullable: field.elementOptional } : false,\n\t\t\t...ifDefined(\"valueSet\", typeAlias.valueSet)\n\t\t},\n\t\ttypeAlias\n\t};\n}\n/**\n* Whether a field may take what its type alias carries: it repeats none of the alias's attributes. Reports each refusal at the field.\n*/\nfunction acceptsTypeAlias(input) {\n\treturn !refuseRepeatedTypeAliasAttributes({\n\t\tfield: input.field,\n\t\tfieldPath: `${input.modelName}.${input.field.name}`,\n\t\talias: input.typeAlias.alias,\n\t\tsources: input.sources,\n\t\tdiagnostics: input.diagnostics\n\t});\n}\nfunction resolveNonRelationField(field, owner, resolution, codecIdByEnumName, context, scalarNames, typeAliases) {\n\tconst ownerName = owner.name;\n\tif (resolution?.kind === \"compositeType\") return { field: {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tplane: \"storage\",\n\t\t\tnamespaceId: resolution.namespace.id,\n\t\t\tentityKind: \"valueObject\",\n\t\t\tentityName: resolution.symbol.name\n\t\t},\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n\tif (resolution?.kind === \"block\" && resolution.symbol.keyword === \"enum\") {\n\t\tconst enumCodecId = codecIdByEnumName.get(resolution.symbol.name);\n\t\tif (enumCodecId === void 0) return void 0;\n\t\tconst valueSet = {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId: resolution.namespace.id,\n\t\t\tentityName: resolution.symbol.name\n\t\t};\n\t\treturn { field: {\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\tmany: field.list ? { elementNullable: field.elementOptional } : false,\n\t\t\tvalueSet\n\t\t} };\n\t}\n\tif (resolution?.kind === \"namedType\") {\n\t\tif (field.typeConstructor !== void 0) {\n\t\t\tcontext.diagnostics.push({\n\t\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\t\tmessage: `Field \"${ownerName}.${field.name}\" calls \"${field.typeConstructor.path.join(\".\")}\", which is a type alias, not a type constructor. Remove the arguments.`,\n\t\t\t\t...diagnosticSource(context.sources, field.node.syntax).at(field.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst typeAlias = typeAliases.ofResolution(resolution);\n\t\treturn typeAlias === void 0 ? void 0 : fieldOfTypeAlias(field, typeAlias);\n\t}\n\tif (resolution?.kind === \"model\" || resolution?.kind === \"block\" || resolution?.kind === \"crossSpace\") {\n\t\tcontext.diagnostics.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\t...diagnosticSource(context.sources, field.node.syntax).at(field.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolution?.kind !== \"contributedType\") return;\n\tconst { descriptor, path } = resolution.symbol;\n\tconst call = field.typeConstructor;\n\tconst entityLabel = `Field \"${ownerName}.${field.name}\"`;\n\tconst source = diagnosticSource(context.sources, field.node.syntax);\n\tif (descriptor.kind === \"typeAlias\") {\n\t\tif (call !== void 0) {\n\t\t\tcontext.diagnostics.push({\n\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\tmessage: `${path.join(\".\")} is a type alias and takes no arguments.`,\n\t\t\t\t...source.at(call.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst typeAlias = typeAliases.ofResolution(resolution);\n\t\tinvariant(typeAlias !== void 0, \"A contributed type alias always resolves\");\n\t\treturn fieldOfTypeAlias(field, typeAlias);\n\t}\n\tif (call === void 0 && !isBareTypeConstructor(descriptor)) {\n\t\treportTypeConstructorNotCalled({\n\t\t\tentityLabel,\n\t\t\tpath: path.join(\".\"),\n\t\t\tdescriptor,\n\t\t\tsource,\n\t\t\tspan: field.span,\n\t\t\tdiagnostics: context.diagnostics\n\t\t});\n\t\treturn;\n\t}\n\tif (call === void 0) scalarNames.warnDeprecated(field, descriptor);\n\treturn { field: {\n\t\ttype: scalarTypeOfConstructor(descriptor, call),\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n}\nfunction processEnumDeclarations(input) {\n\tconst handles = {};\n\tif (input.enumSymbols.length === 0) return handles;\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 enumSymbol of input.enumSymbols) {\n\t\t\tconst source = diagnosticSource(input.sources, enumSymbol.node.syntax);\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_FACTORY\",\n\t\t\t\tmessage: `enum \"${enumSymbol.name}\" requires an \"enum\" entityType factory in the active authoring contributions`,\n\t\t\t\t...source.at(enumSymbol.span)\n\t\t\t});\n\t\t}\n\t\treturn handles;\n\t}\n\tfor (const enumSymbol of input.enumSymbols) {\n\t\tconst sourceFile = input.sources.sourceFileFor(enumSymbol.node.syntax);\n\t\tconst envelope = input.parsedBlocks.get(enumSymbol);\n\t\tinput.diagnostics.push(...enumMemberAttributeDiagnostics(enumSymbol, input.sources));\n\t\tif (envelope === void 0) continue;\n\t\tconst handle = instantiateAuthoringEntityType(\"enum\", enumDescriptor, [envelope], {\n\t\t\t...input.entityContext,\n\t\t\tsourceId: sourceFile.filename\n\t\t});\n\t\tif (handle === void 0 || handle === null) continue;\n\t\thandles[envelope.name] = handle;\n\t\tconst typeAttribute = envelope.attributes[\"type\"];\n\t\tinput.sites.set(envelope.name, {\n\t\t\tblock: {\n\t\t\t\tenumName: envelope.name,\n\t\t\t\tcodecId: handle.codecId,\n\t\t\t\tsourceId: sourceFile.filename,\n\t\t\t\tspan: envelope.span,\n\t\t\t\tmemberSpans: envelope.parameterSpans\n\t\t\t},\n\t\t\tcodecSpan: typeAttribute?.argSpans?.[\"codecId\"] ?? typeAttribute?.span ?? envelope.span\n\t\t});\n\t}\n\treturn handles;\n}\n/** Whether PSL already reported the cause of a refusal, so the builder's refusal would repeat it. */\nfunction alreadyReported(refusal, dropped, reported) {\n\tswitch (refusal.kind) {\n\t\tcase \"indexFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"relationLocalFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"discriminatorFieldUnknown\": return dropped.has(fieldSiteKey(refusal.key.model, refusal.fieldName));\n\t\tcase \"discriminatorWithoutVariants\": return reported.baseTargets.has(refusal.key.model);\n\t\tcase \"baseWithoutDiscriminator\": return reported.discriminators.has(refusal.baseModel);\n\t\tdefault: return false;\n\t}\n}\nfunction enumNameOf(field) {\n\treturn field.valueSet?.entityKind === \"enum\" ? field.valueSet.entityName : void 0;\n}\nfunction fieldNodeOf(fieldName, storedName, resolved, generatedValues) {\n\tconst { field } = resolved;\n\tconst executionDefaults = resolved.typeAlias?.executionDefaults;\n\treturn {\n\t\tfieldName,\n\t\t...storedName === fieldName ? {} : { storedName },\n\t\ttype: field.type,\n\t\tnullable: field.nullable,\n\t\tmany: field.many ?? false,\n\t\t...ifDefined(\"enumName\", enumNameOf(field)),\n\t\t...ifDefined(\"executionDefaults\", executionDefaults),\n\t\t...ifDefined(\"generatedValues\", generatedValues)\n\t};\n}\nfunction relationNodeOf(fieldName, relation) {\n\tif (relation.cardinality === \"N:M\") throw new InternalError(\"A paired MongoDB back-relation is one-to-one or one-to-many.\");\n\treturn {\n\t\trelationName: fieldName,\n\t\ttoModel: relation.to.model,\n\t\tcardinality: relation.cardinality,\n\t\ton: relation.on,\n\t\tnullable: \"nullable\" in relation ? relation.nullable : void 0\n\t};\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sources, codecLookup } = input;\n\tconst diagnostics = createPslDiagnosticCollector(sources);\n\tconst fieldResolution = {\n\t\tsources,\n\t\tdiagnostics\n\t};\n\tconst scalarNames = { warnDeprecated: deprecatedScalarWarner({\n\t\tsources,\n\t\treportWarning: input.reportWarning\n\t}) };\n\tconst { binder } = input;\n\tconst { parsedBlocks, diagnostics: blockDiagnostics } = interpretExtensionBlocks({\n\t\tsymbolTable,\n\t\tsources,\n\t\tpslBlockDescriptors: input.authoringContributions?.pslBlockDescriptors ?? {},\n\t\tbinder,\n\t\tdataTypes: input.dataTypes\n\t});\n\tdiagnostics.push(...blockDiagnostics);\n\tconst { defaultNamespace } = symbolTable;\n\tvalidateNamespaceBlocksForMongoTarget({\n\t\tnamespaces: Object.values(symbolTable.namespaces),\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst allModels = Object.values(defaultNamespace.models);\n\tconst allCompositeTypes = Object.values(defaultNamespace.compositeTypes);\n\tconst { generatorFunctions } = input;\n\tconst specContextFor = (model) => ({\n\t\tsymbols: symbolTable,\n\t\tmodel,\n\t\tdefaultFunctionRegistry: input.defaultFunctionRegistry,\n\t\tgeneratorFunctions,\n\t\tdataTypes: input.dataTypes\n\t});\n\tconst physicalNames = /* @__PURE__ */ new Map();\n\tfor (const model of allModels) resolvePhysicalNames({\n\t\tmodel,\n\t\tphysicalNames,\n\t\tspecContext: specContextFor(model),\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst blockKeywords = /* @__PURE__ */ new Set([\"enum\", ...claimedBlockKeywords(input.authoringContributions?.pslBlockDescriptors)]);\n\tfor (const block of Object.values(defaultNamespace.blocks)) if (!blockKeywords.has(block.keyword)) diagnostics.push(unsupportedBlockDiagnostic(block, sources));\n\tconst topLevelEnumSymbols = Object.values(defaultNamespace.blocks).filter((b) => b.keyword === \"enum\");\n\tconst enumSites = /* @__PURE__ */ new Map();\n\tconst enumHandles = processEnumDeclarations({\n\t\tsites: enumSites,\n\t\tenumSymbols: topLevelEnumSymbols,\n\t\tparsedBlocks,\n\t\tsources,\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\tcodecLookup,\n\t\t\tdataTypes: input.dataTypes,\n\t\t\tdiagnostics: { push: (d) => {\n\t\t\t\tdiagnostics.pushExternal(blindCast(d));\n\t\t\t} }\n\t\t},\n\t\tdiagnostics\n\t});\n\tconst codecIdByEnumName = new Map(Object.entries(enumHandles).map(([name, handle]) => [name, handle.codecId]));\n\tconst typeAliases = resolveMongoTypeAliases({\n\t\tdeclarations: Object.values(symbolTable.namedTypes),\n\t\tsymbols: symbolTable,\n\t\tbinder,\n\t\tsources,\n\t\tdiagnostics,\n\t\tcodecIdByEnumName,\n\t\tdefaultFunctionRegistry: input.defaultFunctionRegistry,\n\t\tgeneratorFunctions,\n\t\tdataTypes: input.dataTypes,\n\t\tauthoringTypes: input.authoringContributions?.type\n\t});\n\tconst polymorphism = collectPolymorphismDeclarations({\n\t\tmodels: allModels,\n\t\tspecContextFor,\n\t\tsources,\n\t\tbinder,\n\t\tdiagnostics\n\t});\n\tconst allFkRelations = [];\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tconst fieldSites = /* @__PURE__ */ new Map();\n\tconst modelSites = /* @__PURE__ */ new Map();\n\tconst droppedFields = /* @__PURE__ */ new Set();\n\tconst relationsByModel = /* @__PURE__ */ new Map();\n\tconst modelDrafts = [];\n\tfor (const pslModel of allModels) {\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = [];\n\t\tconst relations = [];\n\t\trelationsByModel.set(pslModel.name, relations);\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst source = diagnosticSource(sources, field.node.syntax);\n\t\t\tconst siteKey = fieldSiteKey(pslModel.name, field.name);\n\t\t\tconst resolution = fieldTypeResolution(field, binder);\n\t\t\tif (resolution?.kind === \"model\") {\n\t\t\t\tfieldSites.set(siteKey, {\n\t\t\t\t\tsymbol: field,\n\t\t\t\t\tsource,\n\t\t\t\t\tgeneratorAttributes: {},\n\t\t\t\t\tstoredName: field.name\n\t\t\t\t});\n\t\t\t\tconst target = resolution.symbol;\n\t\t\t\tconst relationNode = field.attributes.find((attr) => attr.name === \"relation\")?.node;\n\t\t\t\tconst relation = relationNode ? interpretFieldAttribute({\n\t\t\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\t\t\ttypeConstructor: contributedTypeOf(fieldTypeResolution(field, binder), binder)\n\t\t\t\t\t}),\n\t\t\t\t\tmodel: pslModel,\n\t\t\t\t\tfield,\n\t\t\t\t\tsources,\n\t\t\t\t\tbinder,\n\t\t\t\t\tdiagnostics\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\ttargetModelName: target.name,\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\tsources\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (!physicalNames.has(target)) continue;\n\t\t\t\trelations.push({\n\t\t\t\t\trelationName: field.name,\n\t\t\t\t\ttoModel: target.name,\n\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\ton: {\n\t\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t\t},\n\t\t\t\t\tnullable: field.optional\n\t\t\t\t});\n\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\townsReference: true\n\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, target.name),\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tallFkRelations.push({\n\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\ttargetModel: target.name,\n\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\n\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst resolved = resolveNonRelationField(field, {\n\t\t\t\tname: pslModel.name,\n\t\t\t\tkind: \"model\"\n\t\t\t}, resolution, codecIdByEnumName, fieldResolution, scalarNames, typeAliases);\n\t\t\tif (resolved === void 0 || resolved.typeAlias !== void 0 && !acceptsTypeAlias({\n\t\t\t\tfield,\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\ttypeAlias: resolved.typeAlias,\n\t\t\t\tsources,\n\t\t\t\tdiagnostics\n\t\t\t})) {\n\t\t\t\tdroppedFields.add(siteKey);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storedName = physicalName(physicalNames, field);\n\t\t\tconst generated = lowerGeneratorAttributes({\n\t\t\t\tfield,\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\tresolved,\n\t\t\t\tspecContext: {\n\t\t\t\t\t...specContext,\n\t\t\t\t\tfield,\n\t\t\t\t\ttypeResolution: resolution,\n\t\t\t\t\ttypeConstructor: contributedTypeOf(resolution, binder)\n\t\t\t\t},\n\t\t\t\tgeneratorFunctions,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t});\n\t\t\tfields.push(fieldNodeOf(field.name, storedName, resolved, generated.values));\n\t\t\tfieldSites.set(siteKey, {\n\t\t\t\tsymbol: field,\n\t\t\t\tsource,\n\t\t\t\t...ifDefined(\"typeAlias\", resolved.typeAlias),\n\t\t\t\tgeneratorAttributes: generated.sites,\n\t\t\t\tstoredName\n\t\t\t});\n\t\t}\n\t\tconst idFields = [];\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst idNode = field.attributes.find((attr) => attr.name === \"id\")?.node;\n\t\t\tif (!idNode) continue;\n\t\t\tif (interpretFieldAttribute({\n\t\t\t\tsymbols: specContext.symbols,\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\ttypeResolution: fieldTypeResolution(field, binder),\n\t\t\t\t\ttypeConstructor: contributedTypeOf(fieldTypeResolution(field, binder), binder)\n\t\t\t\t}),\n\t\t\t\tmodel: pslModel,\n\t\t\t\tfield,\n\t\t\t\tsources,\n\t\t\t\tbinder,\n\t\t\t\tdiagnostics\n\t\t\t}) === void 0) continue;\n\t\t\tidFields.push(field);\n\t\t\tconst storedName = physicalName(physicalNames, field);\n\t\t\tif (storedName !== DOCUMENT_ID) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_ID_ATTRIBUTE_INVALID\",\n\t\t\t\tmessage: `Field \"${pslModel.name}.${field.name}\" has @id but is stored as \"${storedName}\". In MongoDB, @id marks the field stored as _id, the document id: add @map(\"_id\") to it, or remove @id.`,\n\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t});\n\t\t}\n\t\tconst [, secondIdField] = idFields;\n\t\tif (secondIdField !== void 0) diagnostics.push({\n\t\t\tcode: \"PSL_MONGO_ID_ATTRIBUTE_INVALID\",\n\t\t\tmessage: `Model \"${pslModel.name}\" has @id on ${idFields.length} fields, ${idFields.map((field) => `\"${field.name}\"`).join(\" and \")}. A document has one id: keep @id only on the field stored as _id.`,\n\t\t\t...diagnosticSource(sources, secondIdField.node.syntax).at(secondIdField.span)\n\t\t});\n\t\tconst indexes = collectIndexes(pslModel, specContext, sources, binder, diagnostics);\n\t\tconst discriminator = polymorphism.discriminators.get(pslModel);\n\t\tconst base = polymorphism.bases.get(pslModel);\n\t\tmodelSites.set(pslModel.name, {\n\t\t\tindexes,\n\t\t\t...ifDefined(\"discriminator\", discriminator),\n\t\t\t...ifDefined(\"base\", base)\n\t\t});\n\t\tconst inheritsCollection = base !== void 0 && getAttribute(pslModel.attributes, \"map\") === void 0;\n\t\tmodelDrafts.push({\n\t\t\tsymbol: pslModel,\n\t\t\tnode: {\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\t...inheritsCollection ? {} : { collection: physicalName(physicalNames, pslModel) },\n\t\t\t\tfields,\n\t\t\t\tindexes: indexes.map(({ index }) => index),\n\t\t\t\t...discriminator === void 0 ? {} : { discriminator: { field: discriminator.fieldName } },\n\t\t\t\t...base === void 0 ? {} : { base: {\n\t\t\t\t\tmodel: base.base.name,\n\t\t\t\t\tvalue: base.written\n\t\t\t\t} }\n\t\t\t}\n\t\t});\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 siteKey = fieldSiteKey(compositeType.name, field.name);\n\t\t\tconst fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\t\tconst resolved = resolveNonRelationField(field, {\n\t\t\t\tname: compositeType.name,\n\t\t\t\tkind: \"compositeType\"\n\t\t\t}, fieldTypeResolution(field, binder), codecIdByEnumName, fieldResolution, scalarNames, typeAliases);\n\t\t\tif (resolved === void 0) {\n\t\t\t\tdroppedFields.add(siteKey);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storedName = fieldMap?.args[0]?.value.replace(/^\"|\"$/g, \"\") ?? field.name;\n\t\t\tfields.push({\n\t\t\t\t...fieldNodeOf(field.name, field.name, resolved, void 0),\n\t\t\t\t...fieldMap === void 0 ? {} : { storedName }\n\t\t\t});\n\t\t\tfieldSites.set(siteKey, {\n\t\t\t\tsymbol: field,\n\t\t\t\tsource: diagnosticSource(sources, field.node.syntax),\n\t\t\t\t...ifDefined(\"typeAlias\", resolved.typeAlias),\n\t\t\t\tgeneratorAttributes: {},\n\t\t\t\t...fieldMap === void 0 ? {} : { map: {\n\t\t\t\t\tsource: diagnosticSource(sources, fieldMap.node.syntax),\n\t\t\t\t\tspan: nodePslSpan(fieldMap.node.syntax, sources)\n\t\t\t\t} },\n\t\t\t\tstoredName\n\t\t\t});\n\t\t}\n\t\tvalueObjects.push({\n\t\t\tname: compositeType.name,\n\t\t\tfields\n\t\t});\n\t}\n\tconst paired = pairMongoBackRelations({\n\t\tforeignKeys: allFkRelations,\n\t\tcandidates: backrelationCandidates,\n\t\tinvalidFkPairings,\n\t\tnamespaceId: defaultNamespace.id\n\t});\n\tdiagnostics.push(...paired.diagnostics);\n\tfor (const { modelName, fieldName, relation } of paired.relations) relationsByModel.get(modelName)?.push(relationNodeOf(fieldName, relation));\n\tconst modelNodes = modelDrafts.map(({ node }) => ({\n\t\t...node,\n\t\trelations: relationsByModel.get(node.modelName) ?? []\n\t}));\n\tconst definition = {\n\t\ttarget: input.target,\n\t\t...ifDefined(\"extensions\", input.extensionPacks),\n\t\tmodels: [...modelNodes.filter((model) => model.base === void 0), ...modelNodes.filter((model) => model.base !== void 0)],\n\t\tvalueObjects,\n\t\tenums: enumHandles,\n\t\twritesCollectionValidators: true,\n\t\twarnings: void 0\n\t};\n\tconst sites = {\n\t\tmodels: modelSites,\n\t\tfields: fieldSites,\n\t\tenums: enumSites\n\t};\n\tconst built = buildMongoContractFromDefinition(definition, codecLookup, input.dataTypes);\n\tfor (const refusal of built.ok ? [] : built.failure.refusals) {\n\t\tif (alreadyReported(refusal, droppedFields, polymorphism.reported)) continue;\n\t\tconst diagnostic = refusalDiagnostic(refusal, sites);\n\t\tif (\"range\" in diagnostic) diagnostics.push(diagnostic);\n\t\telse diagnostics.pushExternal(diagnostic);\n\t}\n\tif (!built.ok || diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [...input.seedDiagnostics ?? [], ...diagnostics.toExternal()]\n\t});\n\treturn ok(built.value.contract);\n}\n//#endregion\nexport { mongoAttributeSpecs as i, pairMongoBackRelations as n, describeUnsupportedMongoAttribute as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-_2zXFvs1.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,QAAQ,MAAM;EACd,SAAS,MAAM;CAChB;AACD;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,SAAS,MAAM;CAChB;AACD;AACA,MAAM,kDAAkD,IAAI,IAAI,CAAC,CAAC,aAAa,8EAA8E,CAAC,CAAC;AAC/J,MAAM,mBAAmB;;AAEzB,SAAS,uBAAuB,WAAW;CAC1C,IAAI,UAAU,SAAS,aAAa,UAAU,KAAK,EAAE,EAAE,MAAM,QAAQ,OAAO,EAAE,MAAM,SAAS,OAAO;CACpG,OAAO,gCAAgC,IAAI,UAAU,IAAI;AAC1D;AACA,SAAS,kCAAkC,SAAS;CACnD,QAAQ,EAAE,WAAW,OAAO,OAAO,YAAY;EA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