@prisma/orm-family-mongo 8.0.0-rc.18-dev.42 → 8.0.0-rc.18-dev.44

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.
@@ -1,6 +1,6 @@
1
1
  import { o as MongoIndex } from "./entity-kinds-BQBtfVet-B-Px7NHp.mjs";
2
2
  import { N as validateMongoStorage, u as buildMongoStorage, w as mongoValueSetsOf } from "./dist-B8f-pfcT.mjs";
3
- import { i as pairMongoBackRelations } from "./interpreter-DsxFJSG4-CWuGbyHr.mjs";
3
+ import { i as pairMongoBackRelations } from "./interpreter-DytgJgyY-C5FooCz-.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";
@@ -1,3 +1,3 @@
1
- import { i as pairMongoBackRelations, n as interpretPslDocumentToMongoContract, r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DsxFJSG4-CWuGbyHr.mjs";
1
+ import { i as pairMongoBackRelations, n as interpretPslDocumentToMongoContract, r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DytgJgyY-C5FooCz-.mjs";
2
2
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
3
3
  export { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, interpretPslDocumentToMongoContract, mongoAttributeSpecs, pairMongoBackRelations };
@@ -1,4 +1,4 @@
1
- import { n as interpretPslDocumentToMongoContract } from "./interpreter-DsxFJSG4-CWuGbyHr.mjs";
1
+ import { n as interpretPslDocumentToMongoContract } from "./interpreter-DytgJgyY-C5FooCz-.mjs";
2
2
  import { assertDefined } from "@prisma/orm-framework/utils/assertions";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { parse } from "@prisma/orm-framework/psl-parser/syntax";
@@ -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-DsxFJSG4.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, createBinder, isPrismaNextSchema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\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\";\n//#region src/provider.ts\nfunction collectScalarTypeCodecIds(namespace) {\n\treturn new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));\n}\nfunction mongoContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\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\tseedDiagnostics: [],\n\t\t\t\t\tscalarTypeCodecIds: collectScalarTypeCodecIds(context.authoringContributions.type),\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,0BAA0B,WAAW;CAC7C,OAAO,IAAI,IAAI,CAAC,GAAG,8BAA8B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAC7G;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,WAAW,MA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,KAAK,EAAE,MAAM,WAAW,MAAM,MAAM,IAAI,CAAC;IAChE,MAAM,YAAY,OAAO,KAAK,EAAE,eAAe,QAAQ;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,SAAS,MAAM;CACvC;AACD"}
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-DytgJgyY.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, createBinder, isPrismaNextSchema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\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\";\n//#region src/provider.ts\nfunction collectScalarTypeCodecIds(namespace) {\n\treturn new Map([...collectScalarTypeConstructors(namespace)].map(([name, output]) => [name, output.codecId]));\n}\nfunction mongoContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\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\tseedDiagnostics: [],\n\t\t\t\t\tscalarTypeCodecIds: collectScalarTypeCodecIds(context.authoringContributions.type),\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,0BAA0B,WAAW;CAC7C,OAAO,IAAI,IAAI,CAAC,GAAG,8BAA8B,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YAAY,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAC7G;AACA,SAAS,cAAc,YAAY,SAAS;CAC3C,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,iBAAiB,CAAC;KAClB,oBAAoB,0BAA0B,QAAQ,uBAAuB,IAAI;KACjF,yBAAyB,QAAQ,wBAAwB;KACzD,oBAAoB,QAAQ;KAC5B,WAAW,QAAQ;KACnB,aAAa,QAAQ;KACrB,wBAAwB,QAAQ;KAChC,GAAG,UAAU,uBAAuB,SAAS,mBAAmB;KAChE,GAAG,UAAU,iBAAiB,QAAQ,aAAa;IACpD,CAAC;GACF;GACA,MAAM,KAAK,SAAS;IACnB,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAK;IAC7D,IAAI,WAAW,WAAW,GAA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,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,SAAS,MAAM;CACvC;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
2
2
  import { L as validatorRootShapesOf } from "./dist-B8f-pfcT.mjs";
3
- import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DsxFJSG4-CWuGbyHr.mjs";
3
+ import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-DytgJgyY-C5FooCz-.mjs";
4
4
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
5
5
  import { t as mongoEmission } from "./exports-BHQVApAg.mjs";
6
6
  import { et as RawUpdateManyCommand } from "./execution-CgP1Sdbr.mjs";
@@ -503,4 +503,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
503
503
  //#endregion
504
504
  export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
505
505
 
506
- //# sourceMappingURL=control-nd6TxtkU.mjs.map
506
+ //# sourceMappingURL=control-XeK2IiTX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-nd6TxtkU.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-CeQP5N4k.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-CvqTq1Za.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-Zx1rvil3.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\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\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst 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\tlabel: `${propName}: ${bsonType}${required ? \" (required)\" : \"\"}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\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\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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K,CAAC;GAC7F,OAAO;EACR;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,eAAe,SAAS;GAC7B,OAAO,kBAAkB,CAAC,CAAC,eAAe,cAAc,QAAQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;GACxB,OAAO,mBAAmB,SAAS;EACpC;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
1
+ {"version":3,"file":"control-XeK2IiTX.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-CeQP5N4k.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-CvqTq1Za.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-Zx1rvil3.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\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\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst 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\tlabel: `${propName}: ${bsonType}${required ? \" (required)\" : \"\"}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\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\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,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AAQ,QAAQ,WAAW,KAAK,MAAM,gBAAgB,aAAa,KAAK,CAAC;GAC7F,OAAO;EACR;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,eAAe,SAAS;GAC7B,OAAO,kBAAkB,CAAC,CAAC,eAAe,cAAc,QAAQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;GACxB,OAAO,mBAAmB,SAAS;EACpC;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dist-xk_0xOR-.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-DsxFJSG4.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\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 }) => {\n\t\tif (field.typeNamespaceId !== void 0 || field.typeConstructor !== 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":";;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,cAAc;EACrC,IAAI,MAAM,oBAAoB,KAAK,KAAK,MAAM,oBAAoB,KAAK,GAAG;EAC1E,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
+ {"version":3,"file":"dist-xk_0xOR-.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-DytgJgyY.mjs\";\nimport { collectScalarTypeConstructors, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\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 }) => {\n\t\tif (field.typeNamespaceId !== void 0 || field.typeConstructor !== 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":";;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,cAAc;EACrC,IAAI,MAAM,oBAAoB,KAAK,KAAK,MAAM,oBAAoB,KAAK,GAAG;EAC1E,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"}
package/dist/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-CeQP5N4k-CNOctppM.mjs";
3
3
  import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-CvqTq1Za-KBOkOZYm.mjs";
4
4
  import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs";
5
- import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-nd6TxtkU.mjs";
5
+ import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-XeK2IiTX.mjs";
6
6
  import { t as MongoContractView$1 } from "./mongo-contract-view-D5yu2LrY-DCAZYJ4q.mjs";
7
7
  import { t as MongoSchemaVerifierBase } from "./ir-DGm0HXbP.mjs";
8
8
  import { t as MongoMigration } from "./migration-DnQ7_A_B.mjs";
@@ -1,3 +1,3 @@
1
1
  import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-CeQP5N4k-CNOctppM.mjs";
2
- import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-nd6TxtkU.mjs";
2
+ import { a as mongoOperationsToPreview, i as mongoFamilyDescriptor, n as fieldRewriteOf, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-XeK2IiTX.mjs";
3
3
  export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,4 +1,4 @@
1
- import { r as mongoAttributeSpecs } from "./interpreter-DsxFJSG4-CWuGbyHr.mjs";
1
+ import { r as mongoAttributeSpecs } from "./interpreter-DytgJgyY-C5FooCz-.mjs";
2
2
  import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-CvqTq1Za-KBOkOZYm.mjs";
3
3
  //#region ../../../2-mongo-family/9-family/dist/pack.mjs
4
4
  const mongoFamilyPack = {
@@ -12,7 +12,7 @@ import { encodeEnumMembers, enumMemberProblemDiagnostic, instantiateAuthoringEnt
12
12
  import { bool, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str, typeReferenceNode } from "@prisma/orm-framework/psl-parser";
13
13
  import { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslFieldPreset, isBareTypeConstructor, reportPresetNotCalled, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
14
14
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
15
- //#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DsxFJSG4.mjs
15
+ //#region ../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DytgJgyY.mjs
16
16
  /** Storage collection name of a model that declares no `@@map`: the model name, verbatim. */
17
17
  function defaultCollectionName(modelName) {
18
18
  return modelName;
@@ -63,7 +63,8 @@ function resolveFieldPreset(input) {
63
63
  descriptor,
64
64
  diagnostics,
65
65
  source,
66
- entityLabel
66
+ entityLabel,
67
+ dataTypes: context.dataTypes
67
68
  });
68
69
  if (!instantiated) return INVALID;
69
70
  const idAttribute = getAttribute(field.attributes, "id");
@@ -1456,6 +1457,7 @@ function interpretPslDocumentToMongoContract(input) {
1456
1457
  codecLookup,
1457
1458
  dataTypeLookup: input.dataTypes.lookup
1458
1459
  },
1460
+ dataTypes: input.dataTypes,
1459
1461
  warnPresetWithoutEffect: presetWithoutEffectWarner({
1460
1462
  types: input.authoringContributions?.type,
1461
1463
  scalarTypeCodecIds,
@@ -1848,4 +1850,4 @@ function interpretPslDocumentToMongoContract(input) {
1848
1850
  //#endregion
1849
1851
  export { pairMongoBackRelations as i, interpretPslDocumentToMongoContract as n, mongoAttributeSpecs as r, describeUnsupportedMongoAttribute as t };
1850
1852
 
1851
- //# sourceMappingURL=interpreter-DsxFJSG4-CWuGbyHr.mjs.map
1853
+ //# sourceMappingURL=interpreter-DytgJgyY-C5FooCz-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpreter-DytgJgyY-C5FooCz-.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DytgJgyY.mjs"],"sourcesContent":["import { encodeEnumMembers, enumMemberProblemDiagnostic, instantiateAuthoringEntityType, isAuthoringEntityTypeDescriptor, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\nimport { buildExecutionSection, computeProfileHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { DOCUMENT_ID, MongoIndex, applyPolymorphicScopeToMongoIndex, buildMongoStorage, deriveCollectionValidators, mongoContractRefusalsOf, mongoValueSetsOf, ownStoredNameOf, unsupportedStoredNameReason } from \"@internal/mongo-contract\";\nimport { bool, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str, typeReferenceNode } from \"@internal/psl-parser\";\nimport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslFieldPreset, isBareTypeConstructor, reportPresetNotCalled, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from \"@internal/psl-parser/interpret\";\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 { notOk, ok } from \"@internal/utils/result\";\nimport { codecTypeParamsProblem } from \"@internal/mongo-contract/data-type\";\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/field-presets.ts\nconst INVALID = { kind: \"invalid\" };\nfunction unsupportedContributions(instantiated) {\n\treturn [\n\t\t...instantiated.default !== void 0 ? [\"a storage default\"] : [],\n\t\t...instantiated.id ? [\"id semantics\"] : [],\n\t\t...instantiated.unique ? [\"a unique constraint\"] : []\n\t];\n}\nfunction resolveFieldPreset(input) {\n\tconst { field, call, descriptor, ownerName, context } = input;\n\tconst { diagnostics } = context;\n\tconst source = diagnosticSource(context.sources, field.node.syntax);\n\tconst entityLabel = `Field \"${ownerName}.${field.name}\"`;\n\tconst helperPath = call.path.join(\".\");\n\tif (input.ownerKind === \"compositeType\") {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\". Field presets can only be used on model fields, not on fields of a composite type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (field.list) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_NOT_LIST\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call as a list element type. Presets cannot be list elements; remove \"[]\" or use a scalar type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (field.optional) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_NOT_OPTIONAL\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call and cannot be optional. Remove \"?\" or use a different field type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst instantiated = instantiatePslFieldPreset({\n\t\tcall,\n\t\tdescriptor,\n\t\tdiagnostics,\n\t\tsource,\n\t\tentityLabel,\n\t\tdataTypes: context.dataTypes\n\t});\n\tif (!instantiated) return INVALID;\n\tconst idAttribute = getAttribute(field.attributes, \"id\");\n\tif (idAttribute && !instantiated.id) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_AND_ID_CONFLICT\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call and cannot also declare @id. Use a preset that contributes id semantics, or drop @id.`,\n\t\t\t...source.at(idAttribute.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst unsupported = unsupportedContributions(instantiated);\n\tif (unsupported.length > 0) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\", which contributes ${unsupported.join(\" and \")}. Mongo supports presets that set a codec and execution defaults only.`,\n\t\t\t...source.at(call.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst { codecId, typeParams } = instantiated.descriptor;\n\tconst problem = typeParams === void 0 ? void 0 : codecTypeParamsProblem(codecId, typeParams, context.typeLookups);\n\tif (problem !== void 0) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\", whose type parameters are refused: ${problem.message}`,\n\t\t\t...source.at(call.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (instantiated.executionDefaults === void 0) context.warnPresetWithoutEffect({\n\t\tfield,\n\t\tentityLabel,\n\t\thelperPath,\n\t\tdescriptor,\n\t\tcodecId: instantiated.descriptor.codecId\n\t});\n\treturn {\n\t\tkind: \"preset\",\n\t\tfield: {\n\t\t\ttype: {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: instantiated.descriptor.codecId,\n\t\t\t\t...ifDefined(\"typeParams\", instantiated.descriptor.typeParams)\n\t\t\t},\n\t\t\tnullable: instantiated.nullable,\n\t\t\tmany: false\n\t\t},\n\t\t...ifDefined(\"executionDefaults\", instantiated.executionDefaults)\n\t};\n}\n//#endregion\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()) instead.\"]]);\nconst DEFAULT_NOW_HINT = \"Use @onCreate(now()) instead; MongoDB has no database defaults.\";\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: str(),\n\t\t\tdocumentation: \"The discriminator value identifying this variant.\"\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/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* Reports `PSL_PRESET_WITHOUT_EFFECT` for a preset call that fills nothing, such as `temporal.timestamp()` with no phase: it is stored exactly like the scalar type with the same codec, which the warning names.\n*/\nfunction presetWithoutEffectWarner(input) {\n\tconst { reportWarning } = input;\n\tif (reportWarning === void 0) return () => {};\n\treturn ({ field, entityLabel, helperPath, descriptor, codecId }) => {\n\t\tconst typeName = [...input.scalarTypeCodecIds].find(([name, id]) => {\n\t\t\tconst type = input.types?.[name];\n\t\t\tconst deprecated = type !== void 0 && isAuthoringTypeConstructorDescriptor(type) && type.deprecated !== void 0;\n\t\t\treturn id === codecId && !deprecated;\n\t\t})?.[0];\n\t\tif (typeName === void 0) return;\n\t\tconst phases = (descriptor.args ?? []).flatMap((arg) => arg.kind === \"option\" && arg.name !== void 0 ? [{\n\t\t\tname: arg.name,\n\t\t\tvalue: arg.values[0]\n\t\t}] : []);\n\t\tconst without = phases.length === 0 ? \"\" : ` without ${phases.map(({ name }) => name).join(\" or \")}`;\n\t\tconst pass = phases.length === 0 ? \"\" : `, or pass ${phases.map(({ name, value }) => `${name}: ${value}`).join(\" or \")}`;\n\t\tconst call = field.typeConstructor?.span;\n\t\tconst [warning] = mapPslDiagnostics([{\n\t\t\tcode: \"PSL_PRESET_WITHOUT_EFFECT\",\n\t\t\tmessage: `${entityLabel} uses ${helperPath}()${without}, so nothing fills it and it is stored exactly like ${typeName}. Write ${typeName}${pass}.`,\n\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(call ?? field.span)\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 relationNullabilityMismatchDiagnostic(modelName, field, sources) {\n\tconst source = diagnosticSource(sources, field.node.syntax);\n\tconst fieldLabel = `Relation field \"${modelName}.${field.name}\"`;\n\treturn {\n\t\tcode: \"PSL_RELATION_NULLABILITY_MISMATCH\",\n\t\tmessage: field.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.name}\" or make those fields required.`,\n\t\t...source.at(field.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}\nfunction isStringTyped(field, stringCodecId, binder) {\n\tconst scalar = contributedTypeOf(fieldTypeResolution(field, binder), binder);\n\treturn stringCodecId !== void 0 && scalar?.descriptor.kind === \"typeConstructor\" && scalar.descriptor.output.codecId === stringCodecId;\n}\nfunction collectPolymorphismDeclarations(models, specContextFor, physicalNames, sources, binder, stringCodecId, diagnostics) {\n\tconst discriminatorDeclarations = /* @__PURE__ */ new Map();\n\tconst baseDeclarations = /* @__PURE__ */ new Map();\n\tfor (const model of models) {\n\t\tconst specContext = specContextFor(model);\n\t\tconst discNode = 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) {\n\t\t\t\tconst fieldName = parsed.field;\n\t\t\t\tconst discField = model.fields[fieldName];\n\t\t\t\tif (discField && !isStringTyped(discField, stringCodecId, binder)) diagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\t\tmessage: `Discriminator field \"${fieldName}\" on model \"${model.name}\" must be of type String, but is \"${discField.typeName}\"`,\n\t\t\t\t\t...diagnosticSource(sources, discNode.syntax).at(nodePslSpan(discNode.syntax, sources))\n\t\t\t\t});\n\t\t\t\telse discriminatorDeclarations.set(model, {\n\t\t\t\t\tfieldName,\n\t\t\t\t\tsource: diagnosticSource(sources, discNode.syntax),\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sources)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst baseNode = model.attributes.find((attr) => attr.name === \"base\")?.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) {\n\t\t\t\tconst collectionName = physicalName(physicalNames, model);\n\t\t\t\tbaseDeclarations.set(model, {\n\t\t\t\t\tbase: parsed.base.declaration,\n\t\t\t\t\tvalue: parsed.value,\n\t\t\t\t\tcollectionName,\n\t\t\t\t\tsource: diagnosticSource(sources, baseNode.syntax),\n\t\t\t\t\tspan: nodePslSpan(baseNode.syntax, sources)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations\n\t};\n}\nfunction resolvePolymorphism(input) {\n\tconst { discriminatorDeclarations, baseDeclarations, physicalNames, indexSpans, modelIndexesByName, indexSources } = input;\n\tlet patched = input.models;\n\tlet roots = input.roots;\n\tlet collections = input.collections;\n\tconst diagnostics = createPslDiagnosticCollector(input.sources);\n\tfor (const [declaration, decl] of discriminatorDeclarations) {\n\t\tconst modelName = declaration.name;\n\t\tif (baseDeclarations.has(declaration)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_AND_BASE\",\n\t\t\t\tmessage: `Model \"${modelName}\" cannot have both @@discriminator and @@base`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst model = patched[modelName];\n\t\tif (!model) continue;\n\t\tif (!Object.hasOwn(model.fields, decl.fieldName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Discriminator field \"${decl.fieldName}\" is not a field on model \"${modelName}\"`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst variants = {};\n\t\tfor (const [variant, baseDecl] of baseDeclarations) {\n\t\t\tif (baseDecl.base !== declaration) continue;\n\t\t\tconst existingVariant = variants[baseDecl.value];\n\t\t\tif (existingVariant !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_DUPLICATE_DISCRIMINATOR_VALUE\",\n\t\t\t\t\tmessage: `Discriminator value \"${baseDecl.value}\" is used by both \"${existingVariant.model}\" and \"${variant.name}\" on base model \"${modelName}\"`,\n\t\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvariants[baseDecl.value] = crossRef(variant.name, input.namespaceId);\n\t\t}\n\t\tif (Object.keys(variants).length === 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_DISCRIMINATOR\",\n\t\t\t\tmessage: `Model \"${modelName}\" has @@discriminator but no variant models declare @@base(${modelName}, ...)`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpatched = {\n\t\t\t...patched,\n\t\t\t[modelName]: {\n\t\t\t\t...model,\n\t\t\t\tdiscriminator: { field: decl.fieldName },\n\t\t\t\tvariants\n\t\t\t}\n\t\t};\n\t}\n\tfor (const [variant, baseDecl] of baseDeclarations) {\n\t\tconst variantName = variant.name;\n\t\tconst baseName = baseDecl.base.name;\n\t\tif (!discriminatorDeclarations.has(baseDecl.base)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BASE\",\n\t\t\t\tmessage: `Model \"${variantName}\" declares @@base(${baseName}, ...) but \"${baseName}\" has no @@discriminator`,\n\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (discriminatorDeclarations.has(variant)) continue;\n\t\tconst baseModel = patched[baseName];\n\t\tif (getAttribute(variant.attributes, \"map\") !== void 0 && baseModel && baseDecl.collectionName !== baseModel.storage.collection) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\",\n\t\t\t\tmessage: `Mongo variant \"${variantName}\" cannot use a different collection than its base \"${baseName}\". Mongo only supports single-collection polymorphism.`,\n\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst baseCollection = baseModel?.storage.collection ?? baseDecl.collectionName;\n\t\tconst variantModel = patched[variantName];\n\t\tif (variantModel) patched = {\n\t\t\t...patched,\n\t\t\t[variantName]: {\n\t\t\t\t...variantModel,\n\t\t\t\tbase: crossRef(baseName, input.namespaceId),\n\t\t\t\tstorage: {\n\t\t\t\t\t...variantModel.storage,\n\t\t\t\t\tcollection: baseCollection\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst variantCollectionName = physicalName(physicalNames, variant);\n\t\tif (roots[variantCollectionName]?.model === variantName) if (variantCollectionName === baseCollection && baseModel) roots = {\n\t\t\t...roots,\n\t\t\t[variantCollectionName]: crossRef(baseName, input.namespaceId)\n\t\t};\n\t\telse roots = Object.fromEntries(Object.entries(roots).filter(([key]) => key !== variantCollectionName));\n\t\tconst variantOwnIndexes = modelIndexesByName.get(variantName) ?? [];\n\t\tconst baseColl = collections[baseCollection];\n\t\tconst baseModelEntry = patched[baseName];\n\t\tconst discriminatorDomainField = baseModelEntry?.discriminator?.field;\n\t\tconst discriminatorField = baseModelEntry === void 0 || discriminatorDomainField === void 0 ? void 0 : ownStoredNameOf(baseModelEntry, discriminatorDomainField);\n\t\tconst scopedVariantIndexes = [];\n\t\tif (discriminatorField) for (const idx of variantOwnIndexes) {\n\t\t\tconst result = applyPolymorphicScopeToMongoIndex(idx, {\n\t\t\t\tdiscriminatorField,\n\t\t\t\tdiscriminatorValue: baseDecl.value\n\t\t\t});\n\t\t\tif (result.kind === \"conflict\") {\n\t\t\t\tconst span = indexSpans.get(idx) ?? baseDecl.span;\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Variant \"${variantName}\" index conflicts with discriminator scope: ${result.reason}`,\n\t\t\t\t\t...(indexSources.get(idx) ?? baseDecl.source).at(span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (result.index !== idx) indexSpans.set(result.index, indexSpans.get(idx) ?? baseDecl.span);\n\t\t\tscopedVariantIndexes.push(result.index);\n\t\t}\n\t\telse scopedVariantIndexes.push(...variantOwnIndexes);\n\t\tif (variantCollectionName !== baseCollection) {\n\t\t\tconst filtered = Object.fromEntries(Object.entries(collections).filter(([key]) => key !== variantCollectionName));\n\t\t\tif (scopedVariantIndexes.length > 0 && baseColl) {\n\t\t\t\tconst baseIndexes = collectionIndexes(baseColl);\n\t\t\t\tcollections = {\n\t\t\t\t\t...filtered,\n\t\t\t\t\t[baseCollection]: {\n\t\t\t\t\t\t...baseColl,\n\t\t\t\t\t\tindexes: [...baseIndexes, ...scopedVariantIndexes]\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} else collections = filtered;\n\t\t} else if (baseColl) {\n\t\t\tconst existingIndexes = collectionIndexes(baseColl);\n\t\t\tconst variantIndexSet = new Set(variantOwnIndexes);\n\t\t\tconst withoutUnscopedVariants = existingIndexes.filter((idx) => !variantIndexSet.has(idx));\n\t\t\tconst mergedIndexes = [...withoutUnscopedVariants];\n\t\t\tfor (const idx of scopedVariantIndexes) {\n\t\t\t\tconst idxKey = canonicalJson(idx);\n\t\t\t\tif (!withoutUnscopedVariants.some((existing) => canonicalJson(existing) === idxKey)) mergedIndexes.push(idx);\n\t\t\t}\n\t\t\tif (mergedIndexes.length !== existingIndexes.length || mergedIndexes.some((idx, i) => idx !== existingIndexes[i])) {\n\t\t\t\tconst next = { ...baseColl };\n\t\t\t\tif (mergedIndexes.length > 0) next[\"indexes\"] = mergedIndexes;\n\t\t\t\telse delete next[\"indexes\"];\n\t\t\t\tcollections = {\n\t\t\t\t\t...collections,\n\t\t\t\t\t[baseCollection]: next\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tmodels: patched,\n\t\troots,\n\t\tcollections,\n\t\tdiagnostics\n\t};\n}\nfunction collectionIndexes(collection) {\n\treturn blindCast(collection[\"indexes\"] ?? []);\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nfunction normalizeIndexField(element) {\n\tif (typeof element === \"string\") return {\n\t\tkind: \"field\",\n\t\tname: element\n\t};\n\tif (element.fn === \"wildcard\") {\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}\nfunction buildCollationFromSpec(args) {\n\tconst locale = args.collationLocale;\n\tif (locale === void 0) return args.collationStrength !== void 0 || args.collationCaseLevel !== void 0 || args.collationCaseFirst !== void 0 || args.collationNumericOrdering !== void 0 || args.collationAlternate !== void 0 || args.collationMaxVariable !== void 0 || args.collationBackwards !== void 0 || args.collationNormalization !== void 0 ? null : void 0;\n\tconst collation = { locale };\n\tif (args.collationStrength !== void 0) collation.strength = args.collationStrength;\n\tif (args.collationCaseLevel !== void 0) collation.caseLevel = args.collationCaseLevel;\n\tif (args.collationCaseFirst !== void 0) collation.caseFirst = args.collationCaseFirst;\n\tif (args.collationNumericOrdering !== void 0) collation.numericOrdering = args.collationNumericOrdering;\n\tif (args.collationAlternate !== void 0) collation.alternate = args.collationAlternate;\n\tif (args.collationMaxVariable !== void 0) collation.maxVariable = args.collationMaxVariable;\n\tif (args.collationBackwards !== void 0) collation.backwards = args.collationBackwards;\n\tif (args.collationNormalization !== void 0) collation.normalization = args.collationNormalization;\n\treturn collation;\n}\nfunction resolveIndexKeys(parsedFields, defaultDirection, ctx) {\n\tconst wildcardCount = parsedFields.filter((field) => field.kind === \"wildcard\").length;\n\tif (wildcardCount > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"An index can contain at most one wildcard() field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tfor (const field of parsedFields) {\n\t\tconst fieldName = field.kind === \"wildcard\" ? field.scope : field.name;\n\t\tif (fieldName !== void 0 && !ctx.indexableFieldNames.has(fieldName)) {\n\t\t\tctx.diagnostics.push({\n\t\t\t\tcode: \"PSL_INDEX_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Index on model \"${ctx.pslModel.name}\" references unknown field \"${fieldName}\"`,\n\t\t\t\t...ctx.source.at(ctx.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t}\n\treturn {\n\t\tkeys: parsedFields.map((field) => {\n\t\t\tif (field.kind === \"wildcard\") {\n\t\t\t\tif (field.scope === void 0) return {\n\t\t\t\t\tfield: \"$**\",\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tfield: `${physicalName(ctx.physicalNames, ctx.pslModel.fields[field.scope])}.$**`,\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfield: physicalName(ctx.physicalNames, ctx.pslModel.fields[field.name]),\n\t\t\t\tdirection: field.direction ?? defaultDirection\n\t\t\t};\n\t\t}),\n\t\thasWildcard: wildcardCount === 1\n\t};\n}\nfunction buildProjection(include, exclude, hasWildcard, ctx) {\n\tif (include !== void 0 && exclude !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Cannot specify both include and exclude on the same index\",\n\t\t\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) return void 0;\n\tif (!hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn null;\n\t}\n\tif (fields.length === 0) return void 0;\n\tconst value = include === void 0 ? 0 : 1;\n\tconst projection = {};\n\tfor (const field of fields) projection[field] = value;\n\treturn projection;\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst defaultDirection = parsed.type ?? 1;\n\tconst resolved = resolveIndexKeys(parsedFields, defaultDirection, ctx);\n\tif (!resolved) return void 0;\n\tif (unique && resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Unique indexes cannot use wildcard() fields\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && typeof defaultDirection === \"string\" && [\n\t\t\"hashed\",\n\t\t\"2dsphere\",\n\t\t\"2d\"\n\t].includes(defaultDirection)) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: `wildcard() fields cannot be combined with type: ${defaultDirection}`,\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (defaultDirection === \"hashed\" && parsedFields.length > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Hashed indexes must have exactly one field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && parsed.expireAfterSeconds !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...unique && { unique: true },\n\t\t...parsed.sparse !== void 0 && { sparse: parsed.sparse },\n\t\t...parsed.expireAfterSeconds !== void 0 && { expireAfterSeconds: parsed.expireAfterSeconds },\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...wildcardProjection !== void 0 && { wildcardProjection },\n\t\t...collation !== void 0 && { collation },\n\t\t...parsed.default_language !== void 0 && { default_language: parsed.default_language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction buildTextIndex(parsed, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, \"text\", ctx);\n\tif (!resolved) return void 0;\n\tif (resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"wildcard() fields cannot be combined with type: hashed/2dsphere/2d or @@textIndex\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...collation !== void 0 && { collation },\n\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t...parsed.language !== void 0 && { default_language: parsed.language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction 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}\nfunction collectIndexes(pslModel, specContext, physicalNames, sources, binder, diagnostics, indexSpans, indexSources) {\n\tconst indexes = [];\n\tlet textIndexCount = 0;\n\tconst indexableFieldNames = /* @__PURE__ */ new Set();\n\tfor (const field of Object.values(pslModel.fields)) if (fieldTypeResolution(field, binder)?.kind !== \"model\") indexableFieldNames.add(field.name);\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\tconst fieldUniqueIndex = new MongoIndex({\n\t\t\tkeys: [{\n\t\t\t\tfield: physicalName(physicalNames, field),\n\t\t\t\tdirection: 1\n\t\t\t}],\n\t\t\tunique: true\n\t\t});\n\t\tindexes.push(fieldUniqueIndex);\n\t\tindexSpans.set(fieldUniqueIndex, nodePslSpan(uniqueNode.syntax, sources));\n\t\tindexSources.set(fieldUniqueIndex, diagnosticSource(sources, uniqueNode.syntax));\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\tpslModel,\n\t\t\tphysicalNames,\n\t\t\tindexableFieldNames,\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\ttextIndexCount++;\n\t\t\tif (textIndexCount > 1) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Only one @@textIndex is allowed per collection (model \"${pslModel.name}\")`,\n\t\t\t\t\t...source.at(attr.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tindex = buildTextIndex(parsed, ctx);\n\t\t} else {\n\t\t\tconst unique = attr.name === \"unique\";\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\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) continue;\n\t\tindexes.push(index);\n\t\tindexSpans.set(index, attr.span);\n\t\tindexSources.set(index, source);\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}\n/**\n* Keys each preset's execution defaults by collection and stored field. Rejects presets on variant fields, since a default keyed by collection applies to every document in it, and merges identical defaults that two models declare for the same collection field.\n*/\nfunction resolvePresetExecutionDefaults(input) {\n\tconst byRef = /* @__PURE__ */ new Map();\n\tconst resolved = [];\n\tfor (const preset of input.defaults) {\n\t\tconst model = input.models[preset.modelName];\n\t\tif (model === void 0) continue;\n\t\tconst collection = model.storage.collection;\n\t\tconst call = preset.field.typeConstructor;\n\t\tconst presetPath = call?.path.join(\".\") ?? preset.field.typeName;\n\t\tconst at = diagnosticSource(input.sources, preset.field.node.syntax).at(call?.span ?? preset.field.span);\n\t\tconst source = preset.fromPreset ? `Preset \"${presetPath}\"` : \"Generated value\";\n\t\tif (model.base !== void 0) {\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_PRESET_ON_VARIANT_FIELD\",\n\t\t\t\tmessage: `${source} on variant \"${preset.modelName}\" field \"${preset.field.name}\": execution defaults apply to every document in collection \"${collection}\", so declare them on the base model.`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst refKey = JSON.stringify([collection, preset.storedField]);\n\t\tconst phasesKey = canonicalJson(preset.phases);\n\t\tconst existing = byRef.get(refKey);\n\t\tif (existing === void 0) {\n\t\t\tbyRef.set(refKey, {\n\t\t\t\towner: preset,\n\t\t\t\tphasesKey\n\t\t\t});\n\t\t\tresolved.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: input.namespaceId,\n\t\t\t\t\tentry: collection,\n\t\t\t\t\tfield: preset.storedField\n\t\t\t\t},\n\t\t\t\t...preset.phases\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (existing.phasesKey !== phasesKey) input.diagnostics.push({\n\t\t\tcode: \"PSL_PRESET_CONFLICT\",\n\t\t\tmessage: `${source} on \"${preset.modelName}.${preset.field.name}\" sets different execution defaults than \"${existing.owner.modelName}.${existing.owner.field.name}\" for field \"${preset.storedField}\" of collection \"${collection}\". Generate the same values on both models.`,\n\t\t\t...at\n\t\t});\n\t}\n\treturn resolved;\n}\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generators a field's `@onCreate(fn())` and `@onUpdate(fn())` resolve to, `undefined` for a field with neither, or `'invalid'` when one is refused.\n*/\nfunction lowerGeneratorAttributes(input) {\n\tconst { field, modelName, diagnostics } = input;\n\tconst fieldLabel = `Field \"${modelName}.${field.name}\"`;\n\tconst phases = {};\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\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\treturn \"invalid\";\n\t\t}\n\t\tconst at = diagnosticSource(input.sources, field.node.syntax).at(attribute.span);\n\t\tconst argument = attribute.args.find((arg) => arg.kind === \"positional\")?.value.trim() ?? \"\";\n\t\tif (field.list) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\t\t\tmessage: `${fieldLabel} is a list and cannot use @${phase}(${argument}). Lists have no per-element generated values; remove @${phase}(...).`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tif (field.optional) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_OPTIONAL_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\t\t\tmessage: `${fieldLabel} is optional, and a generated value needs a required field in MongoDB. Remove \"?\" or remove @${phase}(...).`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tif (input.resolved.executionDefaults?.[phase] !== void 0) {\n\t\t\tconst phaseText = phase === \"onCreate\" ? \"on create\" : \"on update\";\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_PRESET_AND_DEFAULT_CONFLICT\",\n\t\t\t\tmessage: `${fieldLabel} uses a field-preset call that already generates a value ${phaseText}, so @${phase}(...) cannot set one too. Remove @${phase}(...) or use a preset without an ${phase} generator.`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tconst interpreted = interpretFieldAttribute({\n\t\t\tsymbols: input.specContext.symbols,\n\t\t\tnode: attribute.node,\n\t\t\tspec: mongoAttributeSpecs.field[phase](input.specContext),\n\t\t\tmodel: input.model,\n\t\t\tfield,\n\t\t\tsources: input.sources,\n\t\t\tbinder: input.binder,\n\t\t\tdiagnostics\n\t\t});\n\t\tif (interpreted === void 0) return \"invalid\";\n\t\tconst type = input.resolved.field.type;\n\t\tconst call = interpreted.value;\n\t\tconst resolution = type.kind === \"scalar\" ? input.generatorFunctions.resolve({\n\t\t\tname: call.fn,\n\t\t\targs: call.args\n\t\t}, {\n\t\t\tcodecId: type.codecId,\n\t\t\ttypeParams: type.typeParams,\n\t\t\tlength: void 0\n\t\t}) : void 0;\n\t\tif (resolution?.ok === true) {\n\t\t\tphases[phase] = resolution.generator;\n\t\t\tcontinue;\n\t\t}\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_GENERATOR_NOT_APPLICABLE\",\n\t\t\tmessage: resolution?.reason === \"refused\" ? `${fieldLabel}: ${resolution.message}` : `${fieldLabel}: ${call.fn}() does not apply to this field's type.`,\n\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(call.span)\n\t\t});\n\t\treturn \"invalid\";\n\t}\n\treturn phases.onCreate === void 0 && phases.onUpdate === void 0 ? void 0 : phases;\n}\nfunction resolveNonRelationField(field, owner, resolution, codecIdByEnumName, presetContext, scalarNames) {\n\tconst ownerName = owner.name;\n\tif (resolution?.kind === \"compositeType\") return { field: {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: 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 === \"model\" || resolution?.kind === \"namedType\" || resolution?.kind === \"block\" || resolution?.kind === \"crossSpace\") {\n\t\tpresetContext.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(presetContext.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(presetContext.sources, field.node.syntax);\n\tif (descriptor.kind === \"fieldPreset\") {\n\t\tif (call === void 0) {\n\t\t\treportPresetNotCalled({\n\t\t\t\tentityLabel,\n\t\t\t\tpresetPath: path.join(\".\"),\n\t\t\t\tsource,\n\t\t\t\tspan: field.span,\n\t\t\t\tdiagnostics: presetContext.diagnostics\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst preset = resolveFieldPreset({\n\t\t\tfield,\n\t\t\tcall,\n\t\t\tdescriptor,\n\t\t\townerName,\n\t\t\townerKind: owner.kind,\n\t\t\tcontext: presetContext\n\t\t});\n\t\tif (preset.kind === \"invalid\") return void 0;\n\t\treturn {\n\t\t\tfield: preset.field,\n\t\t\t...ifDefined(\"executionDefaults\", preset.executionDefaults)\n\t\t};\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: presetContext.diagnostics\n\t\t});\n\t\treturn;\n\t}\n\tif (call === void 0) scalarNames.warnDeprecated(field, descriptor);\n\treturn { field: {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: descriptor.output.codecId\n\t\t},\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n}\nfunction fieldKey(owner, fieldName) {\n\treturn JSON.stringify([owner, fieldName]);\n}\n/** The diagnostic for an enum a collection validator cannot describe, at its `@@type` or member. */\nfunction enumRefusalDiagnostic(refusal, sites) {\n\tif (refusal.kind !== \"enumBsonType\" && refusal.kind !== \"enumNotListable\" && refusal.kind !== \"enumMemberNotListable\") return;\n\tconst site = sites.get(refusal.enumName);\n\tassertDefined(site, `Built enum \"${refusal.enumName}\" has a declaration site`);\n\tconst subject = `enum \"${refusal.enumName}\"`;\n\tif (refusal.kind === \"enumBsonType\") return {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} ${refusal.refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.codecSpan\n\t};\n\tif (refusal.kind === \"enumNotListable\") return {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} @@type codec \"${refusal.codecId}\" ${refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.codecSpan\n\t};\n\treturn {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} member \"${refusal.member}\" ${refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.memberSpans[refusal.member] ?? site.codecSpan\n\t};\n}\n/** MongoDB PSL has no control policies, so every collection is managed. */\nconst MONGO_PSL_CONTROL_POLICIES = {\n\tcollections: {},\n\tdefaultControlPolicy: void 0\n};\n/** The diagnostic for a field a collection validator cannot describe, at the field. */\nfunction fieldRefusalDiagnostic(refusal, fieldSymbols, sources) {\n\tif (refusal.kind !== \"fieldBsonType\" && refusal.kind !== \"documentId\") return void 0;\n\tconst owner = refusal.kind === \"fieldBsonType\" ? refusal.owner.name : refusal.modelName;\n\tconst field = fieldSymbols.get(fieldKey(owner, refusal.fieldName));\n\tassertDefined(field, `Field \"${owner}.${refusal.fieldName}\" has a declaration`);\n\treturn {\n\t\tcode: refusal.kind === \"fieldBsonType\" ? \"PSL_UNSUPPORTED_FIELD_TYPE\" : \"PSL_MONGO_ID_INVALID\",\n\t\tmessage: `Field \"${owner}.${field.name}\" ${refusal.kind === \"fieldBsonType\" ? refusal.refusal.reason : refusal.reason}`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\nfunction processEnumDeclarations(input) {\n\tconst builtEnums = {};\n\tif (input.enumSymbols.length === 0) return builtEnums;\n\tconst enumDescriptor = input.authoringContributions?.entityTypes?.[\"enum\"] !== void 0 && isAuthoringEntityTypeDescriptor(input.authoringContributions.entityTypes[\"enum\"]) ? input.authoringContributions.entityTypes[\"enum\"] : void 0;\n\tif (!enumDescriptor) {\n\t\tfor (const 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 builtEnums;\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\tconst encoded = encodeEnumMembers(handle, input.entityContext.codecLookup);\n\t\tif (!encoded.ok) {\n\t\t\tconst site = {\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\tinput.diagnostics.pushExternal(...encoded.failure.map((problem) => enumMemberProblemDiagnostic(problem, site)));\n\t\t\tcontinue;\n\t\t}\n\t\tbuiltEnums[envelope.name] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: encoded.value\n\t\t};\n\t\tconst typeAttribute = envelope.attributes[\"type\"];\n\t\tinput.sites.set(envelope.name, {\n\t\t\tsourceId: sourceFile.filename,\n\t\t\tcodecSpan: typeAttribute?.argSpans?.[\"codecId\"] ?? typeAttribute?.span ?? envelope.span,\n\t\t\tmemberSpans: envelope.parameterSpans\n\t\t});\n\t}\n\treturn builtEnums;\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sources, scalarTypeCodecIds, codecLookup } = input;\n\tconst diagnostics = createPslDiagnosticCollector(sources);\n\tconst presetContext = {\n\t\tauthoringContributions: input.authoringContributions,\n\t\tsources,\n\t\tdiagnostics,\n\t\ttypeLookups: {\n\t\t\tcodecLookup,\n\t\t\tdataTypeLookup: input.dataTypes.lookup\n\t\t},\n\t\tdataTypes: input.dataTypes,\n\t\twarnPresetWithoutEffect: presetWithoutEffectWarner({\n\t\t\ttypes: input.authoringContributions?.type,\n\t\t\tscalarTypeCodecIds,\n\t\t\tsources,\n\t\t\treportWarning: input.reportWarning\n\t\t})\n\t};\n\tconst presetExecutionDefaults = [];\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 builtEnums = processEnumDeclarations({\n\t\tsites: enumSites,\n\t\tenumSymbols: topLevelEnumSymbols,\n\t\tparsedBlocks,\n\t\tsources,\n\t\tbinder,\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\tdataTypeLookup: input.dataTypes.lookup,\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(builtEnums).map(([name, e]) => [name, e.codecId]));\n\tconst models = {};\n\tconst collections = {};\n\tconst roots = {};\n\tconst allFkRelations = [];\n\tconst indexSpans = /* @__PURE__ */ new Map();\n\tconst indexSources = /* @__PURE__ */ new Map();\n\tconst modelIndexesByName = /* @__PURE__ */ new Map();\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tconst validatorLookups = {\n\t\tcodecLookup,\n\t\tdataTypeLookup: input.dataTypes.lookup\n\t};\n\tconst fieldSymbols = /* @__PURE__ */ new Map();\n\tfor (const pslModel of allModels) {\n\t\tconst collectionName = physicalName(physicalNames, pslModel);\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = {};\n\t\tconst storageFields = {};\n\t\tconst fieldsByStoredName = /* @__PURE__ */ new Map();\n\t\tconst relations = {};\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst resolution = fieldTypeResolution(field, binder);\n\t\t\tif (resolution?.kind === \"model\") {\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 (relation?.fields && relation?.references) {\n\t\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\t\townsReference: true\n\t\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\t\tdiagnostics.push(relationNullabilityMismatchDiagnostic(pslModel.name, field, sources));\n\t\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, target.name),\n\t\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!physicalNames.has(target)) continue;\n\t\t\t\t\trelations[field.name] = {\n\t\t\t\t\t\tto: crossRef(target.name, defaultNamespace.id),\n\t\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\t\tnullable: field.optional,\n\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tallFkRelations.push({\n\t\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\t\ttargetModel: target.name,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\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}\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, presetContext, scalarNames);\n\t\t\tif (!resolved) continue;\n\t\t\tconst mappedName = physicalName(physicalNames, field);\n\t\t\tconst unsupported = unsupportedStoredNameReason(mappedName);\n\t\t\tif (unsupported !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_STORED_NAME_UNSUPPORTED\",\n\t\t\t\t\tmessage: `Field \"${pslModel.name}.${field.name}\" ${unsupported}. Give the field another stored name with @map.`,\n\t\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst sharingField = fieldsByStoredName.get(mappedName);\n\t\t\tif (sharingField !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_DUPLICATE_STORED_NAME\",\n\t\t\t\t\tmessage: `Fields \"${pslModel.name}.${sharingField}\" and \"${pslModel.name}.${field.name}\" are both stored as \"${mappedName}\". Give each field its own stored name with @map.`,\n\t\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfieldsByStoredName.set(mappedName, field.name);\n\t\t\tfields[field.name] = resolved.field;\n\t\t\tstorageFields[field.name] = { field: mappedName };\n\t\t\tfieldSymbols.set(fieldKey(pslModel.name, field.name), field);\n\t\t\tconst generated = lowerGeneratorAttributes({\n\t\t\t\tfield,\n\t\t\t\tmodel: pslModel,\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\tif (generated === \"invalid\") continue;\n\t\t\tconst phases = resolved.executionDefaults === void 0 ? generated : {\n\t\t\t\t...resolved.executionDefaults,\n\t\t\t\t...generated\n\t\t\t};\n\t\t\tif (phases !== void 0) presetExecutionDefaults.push({\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\tfield,\n\t\t\t\tstoredField: mappedName,\n\t\t\t\tphases,\n\t\t\t\tfromPreset: resolved.executionDefaults !== void 0\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\tmodels[pslModel.name] = {\n\t\t\tfields,\n\t\t\trelations,\n\t\t\tstorage: {\n\t\t\t\tcollection: collectionName,\n\t\t\t\tfields: storageFields\n\t\t\t}\n\t\t};\n\t\tconst modelIndexes = collectIndexes(pslModel, specContext, physicalNames, sources, binder, diagnostics, indexSpans, indexSources);\n\t\tmodelIndexesByName.set(pslModel.name, modelIndexes);\n\t\tconst existingColl = collections[collectionName];\n\t\tif (existingColl && modelIndexes.length > 0) collections[collectionName] = { indexes: [...collectionIndexes(existingColl), ...modelIndexes] };\n\t\telse if (!existingColl) collections[collectionName] = modelIndexes.length > 0 ? { indexes: modelIndexes } : {};\n\t\troots[collectionName] = crossRef(pslModel.name, defaultNamespace.id);\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 fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\t\tif (fieldMap !== void 0) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_TYPE_FIELD_MAP_UNSUPPORTED\",\n\t\t\t\tmessage: `Field \"${compositeType.name}.${field.name}\" 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\t\t...diagnosticSource(sources, fieldMap.node.syntax).at(nodePslSpan(fieldMap.node.syntax, sources))\n\t\t\t});\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, presetContext, scalarNames);\n\t\t\tif (!resolved) continue;\n\t\t\tfields[field.name] = resolved.field;\n\t\t\tfieldSymbols.set(fieldKey(compositeType.name, field.name), field);\n\t\t}\n\t\tvalueObjects[compositeType.name] = { fields };\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) {\n\t\tconst modelEntry = models[modelName];\n\t\tif (modelEntry) modelEntry.relations[fieldName] = relation;\n\t}\n\tconst { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(allModels, specContextFor, physicalNames, sources, binder, scalarTypeCodecIds.get(\"String\"), diagnostics);\n\tconst polyResult = resolvePolymorphism({\n\t\tnamespaceId: defaultNamespace.id,\n\t\tsources,\n\t\tmodels,\n\t\troots,\n\t\tcollections,\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations,\n\t\tindexSpans,\n\t\tmodelIndexesByName,\n\t\tphysicalNames,\n\t\tindexSources\n\t});\n\tconst executionDefaults = resolvePresetExecutionDefaults({\n\t\tdefaults: presetExecutionDefaults,\n\t\tmodels: polyResult.models,\n\t\tsources,\n\t\tdiagnostics,\n\t\tnamespaceId: defaultNamespace.id\n\t});\n\tfor (const refusal of mongoContractRefusalsOf({\n\t\tmodels: polyResult.models,\n\t\tvalueObjects,\n\t\tenums: builtEnums,\n\t\tlookups: validatorLookups,\n\t\tcontrolPolicies: MONGO_PSL_CONTROL_POLICIES\n\t})) {\n\t\tconst enumDiagnostic = enumRefusalDiagnostic(refusal, enumSites);\n\t\tif (enumDiagnostic !== void 0) diagnostics.pushExternal(enumDiagnostic);\n\t\tconst fieldDiagnostic = fieldRefusalDiagnostic(refusal, fieldSymbols, sources);\n\t\tif (fieldDiagnostic !== void 0) diagnostics.push(fieldDiagnostic);\n\t}\n\tif (diagnostics.length > 0 || polyResult.diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [\n\t\t\t...input.seedDiagnostics ?? [],\n\t\t\t...diagnostics.toExternal(),\n\t\t\t...polyResult.diagnostics.toExternal()\n\t\t]\n\t});\n\tconst resolvedModels = polyResult.models;\n\tconst resolvedCollections = polyResult.collections;\n\tconst target = \"mongo\";\n\tconst targetFamily = \"mongo\";\n\tconst execution = buildExecutionSection({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tdefaults: executionDefaults\n\t});\n\tconst storageValueSets = mongoValueSetsOf(builtEnums);\n\tconst validators = deriveCollectionValidators({\n\t\tmodels: resolvedModels,\n\t\tlookups: validatorLookups,\n\t\tvalueObjects,\n\t\tvalueSets: storageValueSets,\n\t\tcontrolPolicies: MONGO_PSL_CONTROL_POLICIES\n\t});\n\tfor (const [collectionName, validator] of Object.entries(validators)) {\n\t\tconst coll = resolvedCollections[collectionName];\n\t\tif (coll) coll[\"validator\"] = validator;\n\t}\n\tconst collectionInputs = {};\n\tfor (const [name, coll] of Object.entries(resolvedCollections)) {\n\t\tconst raw = {};\n\t\tif (coll[\"indexes\"] != null) raw[\"indexes\"] = coll[\"indexes\"];\n\t\tif (coll[\"validator\"] != null) raw[\"validator\"] = coll[\"validator\"];\n\t\tif (coll[\"options\"] != null) raw[\"options\"] = coll[\"options\"];\n\t\tcollectionInputs[name] = blindCast(raw);\n\t}\n\tconst storage = buildMongoStorage({\n\t\tcollections: collectionInputs,\n\t\tvalueSets: storageValueSets\n\t});\n\tconst capabilities = {};\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\treturn ok({\n\t\ttargetFamily,\n\t\ttarget,\n\t\troots: polyResult.roots,\n\t\tdomain: { namespaces: { [defaultNamespace.id]: {\n\t\t\tmodels: polyResult.models,\n\t\t\t...Object.keys(valueObjects).length > 0 ? { valueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\textensions: {},\n\t\tcapabilities,\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {},\n\t\t...ifDefined(\"execution\", execution)\n\t});\n}\n//#endregion\nexport { mongoAttributeSpecs as i, pairMongoBackRelations as n, describeUnsupportedMongoAttribute as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-DytgJgyY.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,sBAAsB,WAAW;CACzC,OAAO;AACR;AACA,SAAS,aAAa,YAAY,MAAM;CACvC,OAAO,WAAW,MAAM,SAAS,KAAK,SAAS,IAAI;AACpD;AAGA,MAAM,UAAU,EAAE,MAAM,UAAU;AAClC,SAAS,yBAAyB,cAAc;CAC/C,OAAO;EACN,GAAG,aAAa,YAAY,KAAK,IAAI,CAAC,mBAAmB,IAAI,CAAC;EAC9D,GAAG,aAAa,KAAK,CAAC,cAAc,IAAI,CAAC;EACzC,GAAG,aAAa,SAAS,CAAC,qBAAqB,IAAI,CAAC;CACrD;AACD;AACA,SAAS,mBAAmB,OAAO;CAClC,MAAM,EAAE,OAAO,MAAM,YAAY,WAAW,YAAY;CACxD,MAAM,EAAE,gBAAgB;CACxB,MAAM,SAAS,iBAAiB,QAAQ,SAAS,MAAM,KAAK,MAAM;CAClE,MAAM,cAAc,UAAU,UAAU,GAAG,MAAM,KAAK;CACtD,MAAM,aAAa,KAAK,KAAK,KAAK,GAAG;CACrC,IAAI,MAAM,cAAc,iBAAiB;EACxC,YAAY,KAAK;GAChB,MAAM;GACN,SAAS,GAAG,YAAY,sBAAsB,WAAW;GACzD,GAAG,OAAO,GAAG,MAAM,IAAI;EACxB,CAAC;EACD,OAAO;CACR;CACA,IAAI,MAAM,MAAM;EACf,YAAY,KAAK;GAChB,MAAM;GACN,SAAS,GAAG,YAAY;GACxB,GAAG,OAAO,GAAG,MAAM,IAAI;EACxB,CAAC;EACD,OAAO;CACR;CACA,IAAI,MAAM,UAAU;EACnB,YAAY,KAAK;GAChB,MAAM;GACN,SAAS,GAAG,YAAY;GACxB,GAAG,OAAO,GAAG,MAAM,IAAI;EACxB,CAAC;EACD,OAAO;CACR;CACA,MAAM,eAAe,0BAA0B;EAC9C;EACA;EACA;EACA;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,CAAC;EACP,GAAG,UAAU,aAAa,SAAS;CACpC,CAAC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.18-dev.42",
3
+ "version": "8.0.0-rc.18-dev.44",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,30 +9,30 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.18-dev.42",
13
- "@prisma/orm-toolchain": "8.0.0-rc.18-dev.42",
12
+ "@prisma/orm-framework": "8.0.0-rc.18-dev.44",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.18-dev.44",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/family-mongo": "8.0.0-rc.18-dev.42",
20
- "@internal/mongo-codec": "8.0.0-rc.18-dev.42",
21
- "@internal/mongo-contract": "8.0.0-rc.18-dev.42",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.42",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.18-dev.42",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.18-dev.42",
25
- "@internal/mongo-emitter": "8.0.0-rc.18-dev.42",
26
- "@internal/mongo-lowering": "8.0.0-rc.18-dev.42",
27
- "@internal/mongo-orm": "8.0.0-rc.18-dev.42",
28
- "@internal/mongo-query-ast": "8.0.0-rc.18-dev.42",
29
- "@internal/mongo-query-builder": "8.0.0-rc.18-dev.42",
30
- "@internal/mongo-runtime": "8.0.0-rc.18-dev.42",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.18-dev.42",
32
- "@internal/mongo-value": "8.0.0-rc.18-dev.42",
33
- "@internal/mongo-wire": "8.0.0-rc.18-dev.42",
34
- "@repo/tsconfig": "8.0.0-rc.18-dev.42",
35
- "@repo/tsdown": "8.0.0-rc.18-dev.42",
19
+ "@internal/family-mongo": "8.0.0-rc.18-dev.44",
20
+ "@internal/mongo-codec": "8.0.0-rc.18-dev.44",
21
+ "@internal/mongo-contract": "8.0.0-rc.18-dev.44",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.44",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.18-dev.44",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.18-dev.44",
25
+ "@internal/mongo-emitter": "8.0.0-rc.18-dev.44",
26
+ "@internal/mongo-lowering": "8.0.0-rc.18-dev.44",
27
+ "@internal/mongo-orm": "8.0.0-rc.18-dev.44",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.18-dev.44",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.18-dev.44",
30
+ "@internal/mongo-runtime": "8.0.0-rc.18-dev.44",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.18-dev.44",
32
+ "@internal/mongo-value": "8.0.0-rc.18-dev.44",
33
+ "@internal/mongo-wire": "8.0.0-rc.18-dev.44",
34
+ "@repo/tsconfig": "8.0.0-rc.18-dev.44",
35
+ "@repo/tsdown": "8.0.0-rc.18-dev.44",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"interpreter-DsxFJSG4-CWuGbyHr.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/interpreter-DsxFJSG4.mjs"],"sourcesContent":["import { encodeEnumMembers, enumMemberProblemDiagnostic, instantiateAuthoringEntityType, isAuthoringEntityTypeDescriptor, isAuthoringTypeConstructorDescriptor } from \"@internal/framework-components/authoring\";\nimport { buildExecutionSection, computeProfileHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { DOCUMENT_ID, MongoIndex, applyPolymorphicScopeToMongoIndex, buildMongoStorage, deriveCollectionValidators, mongoContractRefusalsOf, mongoValueSetsOf, ownStoredNameOf, unsupportedStoredNameReason } from \"@internal/mongo-contract\";\nimport { bool, contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, int, interpretAttribute, interpretExtensionBlocks, json, list, mapPslDiagnostics, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str, typeReferenceNode } from \"@internal/psl-parser\";\nimport { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, instantiatePslFieldPreset, isBareTypeConstructor, reportPresetNotCalled, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from \"@internal/psl-parser/interpret\";\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 { notOk, ok } from \"@internal/utils/result\";\nimport { codecTypeParamsProblem } from \"@internal/mongo-contract/data-type\";\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/field-presets.ts\nconst INVALID = { kind: \"invalid\" };\nfunction unsupportedContributions(instantiated) {\n\treturn [\n\t\t...instantiated.default !== void 0 ? [\"a storage default\"] : [],\n\t\t...instantiated.id ? [\"id semantics\"] : [],\n\t\t...instantiated.unique ? [\"a unique constraint\"] : []\n\t];\n}\nfunction resolveFieldPreset(input) {\n\tconst { field, call, descriptor, ownerName, context } = input;\n\tconst { diagnostics } = context;\n\tconst source = diagnosticSource(context.sources, field.node.syntax);\n\tconst entityLabel = `Field \"${ownerName}.${field.name}\"`;\n\tconst helperPath = call.path.join(\".\");\n\tif (input.ownerKind === \"compositeType\") {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\". Field presets can only be used on model fields, not on fields of a composite type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (field.list) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_NOT_LIST\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call as a list element type. Presets cannot be list elements; remove \"[]\" or use a scalar type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (field.optional) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_NOT_OPTIONAL\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call and cannot be optional. Remove \"?\" or use a different field type.`,\n\t\t\t...source.at(field.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst instantiated = instantiatePslFieldPreset({\n\t\tcall,\n\t\tdescriptor,\n\t\tdiagnostics,\n\t\tsource,\n\t\tentityLabel\n\t});\n\tif (!instantiated) return INVALID;\n\tconst idAttribute = getAttribute(field.attributes, \"id\");\n\tif (idAttribute && !instantiated.id) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_PRESET_AND_ID_CONFLICT\",\n\t\t\tmessage: `${entityLabel} uses a field-preset call and cannot also declare @id. Use a preset that contributes id semantics, or drop @id.`,\n\t\t\t...source.at(idAttribute.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst unsupported = unsupportedContributions(instantiated);\n\tif (unsupported.length > 0) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_UNSUPPORTED_FIELD_TYPE\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\", which contributes ${unsupported.join(\" and \")}. Mongo supports presets that set a codec and execution defaults only.`,\n\t\t\t...source.at(call.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tconst { codecId, typeParams } = instantiated.descriptor;\n\tconst problem = typeParams === void 0 ? void 0 : codecTypeParamsProblem(codecId, typeParams, context.typeLookups);\n\tif (problem !== void 0) {\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${entityLabel} uses field preset \"${helperPath}\", whose type parameters are refused: ${problem.message}`,\n\t\t\t...source.at(call.span)\n\t\t});\n\t\treturn INVALID;\n\t}\n\tif (instantiated.executionDefaults === void 0) context.warnPresetWithoutEffect({\n\t\tfield,\n\t\tentityLabel,\n\t\thelperPath,\n\t\tdescriptor,\n\t\tcodecId: instantiated.descriptor.codecId\n\t});\n\treturn {\n\t\tkind: \"preset\",\n\t\tfield: {\n\t\t\ttype: {\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: instantiated.descriptor.codecId,\n\t\t\t\t...ifDefined(\"typeParams\", instantiated.descriptor.typeParams)\n\t\t\t},\n\t\t\tnullable: instantiated.nullable,\n\t\t\tmany: false\n\t\t},\n\t\t...ifDefined(\"executionDefaults\", instantiated.executionDefaults)\n\t};\n}\n//#endregion\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()) instead.\"]]);\nconst DEFAULT_NOW_HINT = \"Use @onCreate(now()) instead; MongoDB has no database defaults.\";\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: str(),\n\t\t\tdocumentation: \"The discriminator value identifying this variant.\"\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/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* Reports `PSL_PRESET_WITHOUT_EFFECT` for a preset call that fills nothing, such as `temporal.timestamp()` with no phase: it is stored exactly like the scalar type with the same codec, which the warning names.\n*/\nfunction presetWithoutEffectWarner(input) {\n\tconst { reportWarning } = input;\n\tif (reportWarning === void 0) return () => {};\n\treturn ({ field, entityLabel, helperPath, descriptor, codecId }) => {\n\t\tconst typeName = [...input.scalarTypeCodecIds].find(([name, id]) => {\n\t\t\tconst type = input.types?.[name];\n\t\t\tconst deprecated = type !== void 0 && isAuthoringTypeConstructorDescriptor(type) && type.deprecated !== void 0;\n\t\t\treturn id === codecId && !deprecated;\n\t\t})?.[0];\n\t\tif (typeName === void 0) return;\n\t\tconst phases = (descriptor.args ?? []).flatMap((arg) => arg.kind === \"option\" && arg.name !== void 0 ? [{\n\t\t\tname: arg.name,\n\t\t\tvalue: arg.values[0]\n\t\t}] : []);\n\t\tconst without = phases.length === 0 ? \"\" : ` without ${phases.map(({ name }) => name).join(\" or \")}`;\n\t\tconst pass = phases.length === 0 ? \"\" : `, or pass ${phases.map(({ name, value }) => `${name}: ${value}`).join(\" or \")}`;\n\t\tconst call = field.typeConstructor?.span;\n\t\tconst [warning] = mapPslDiagnostics([{\n\t\t\tcode: \"PSL_PRESET_WITHOUT_EFFECT\",\n\t\t\tmessage: `${entityLabel} uses ${helperPath}()${without}, so nothing fills it and it is stored exactly like ${typeName}. Write ${typeName}${pass}.`,\n\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(call ?? field.span)\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 relationNullabilityMismatchDiagnostic(modelName, field, sources) {\n\tconst source = diagnosticSource(sources, field.node.syntax);\n\tconst fieldLabel = `Relation field \"${modelName}.${field.name}\"`;\n\treturn {\n\t\tcode: \"PSL_RELATION_NULLABILITY_MISMATCH\",\n\t\tmessage: field.optional ? `${fieldLabel} is optional but every field in @relation(fields: [...]) is required. Make one of those fields optional with \"?\" or remove \"?\" from \"${field.name}\".` : `${fieldLabel} is required but a field in @relation(fields: [...]) is optional. Add \"?\" to \"${field.name}\" or make those fields required.`,\n\t\t...source.at(field.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}\nfunction isStringTyped(field, stringCodecId, binder) {\n\tconst scalar = contributedTypeOf(fieldTypeResolution(field, binder), binder);\n\treturn stringCodecId !== void 0 && scalar?.descriptor.kind === \"typeConstructor\" && scalar.descriptor.output.codecId === stringCodecId;\n}\nfunction collectPolymorphismDeclarations(models, specContextFor, physicalNames, sources, binder, stringCodecId, diagnostics) {\n\tconst discriminatorDeclarations = /* @__PURE__ */ new Map();\n\tconst baseDeclarations = /* @__PURE__ */ new Map();\n\tfor (const model of models) {\n\t\tconst specContext = specContextFor(model);\n\t\tconst discNode = 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) {\n\t\t\t\tconst fieldName = parsed.field;\n\t\t\t\tconst discField = model.fields[fieldName];\n\t\t\t\tif (discField && !isStringTyped(discField, stringCodecId, binder)) diagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\t\t\tmessage: `Discriminator field \"${fieldName}\" on model \"${model.name}\" must be of type String, but is \"${discField.typeName}\"`,\n\t\t\t\t\t...diagnosticSource(sources, discNode.syntax).at(nodePslSpan(discNode.syntax, sources))\n\t\t\t\t});\n\t\t\t\telse discriminatorDeclarations.set(model, {\n\t\t\t\t\tfieldName,\n\t\t\t\t\tsource: diagnosticSource(sources, discNode.syntax),\n\t\t\t\t\tspan: nodePslSpan(discNode.syntax, sources)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst baseNode = model.attributes.find((attr) => attr.name === \"base\")?.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) {\n\t\t\t\tconst collectionName = physicalName(physicalNames, model);\n\t\t\t\tbaseDeclarations.set(model, {\n\t\t\t\t\tbase: parsed.base.declaration,\n\t\t\t\t\tvalue: parsed.value,\n\t\t\t\t\tcollectionName,\n\t\t\t\t\tsource: diagnosticSource(sources, baseNode.syntax),\n\t\t\t\t\tspan: nodePslSpan(baseNode.syntax, sources)\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations\n\t};\n}\nfunction resolvePolymorphism(input) {\n\tconst { discriminatorDeclarations, baseDeclarations, physicalNames, indexSpans, modelIndexesByName, indexSources } = input;\n\tlet patched = input.models;\n\tlet roots = input.roots;\n\tlet collections = input.collections;\n\tconst diagnostics = createPslDiagnosticCollector(input.sources);\n\tfor (const [declaration, decl] of discriminatorDeclarations) {\n\t\tconst modelName = declaration.name;\n\t\tif (baseDeclarations.has(declaration)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_AND_BASE\",\n\t\t\t\tmessage: `Model \"${modelName}\" cannot have both @@discriminator and @@base`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst model = patched[modelName];\n\t\tif (!model) continue;\n\t\tif (!Object.hasOwn(model.fields, decl.fieldName)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_DISCRIMINATOR_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Discriminator field \"${decl.fieldName}\" is not a field on model \"${modelName}\"`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst variants = {};\n\t\tfor (const [variant, baseDecl] of baseDeclarations) {\n\t\t\tif (baseDecl.base !== declaration) continue;\n\t\t\tconst existingVariant = variants[baseDecl.value];\n\t\t\tif (existingVariant !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_DUPLICATE_DISCRIMINATOR_VALUE\",\n\t\t\t\t\tmessage: `Discriminator value \"${baseDecl.value}\" is used by both \"${existingVariant.model}\" and \"${variant.name}\" on base model \"${modelName}\"`,\n\t\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvariants[baseDecl.value] = crossRef(variant.name, input.namespaceId);\n\t\t}\n\t\tif (Object.keys(variants).length === 0) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_DISCRIMINATOR\",\n\t\t\t\tmessage: `Model \"${modelName}\" has @@discriminator but no variant models declare @@base(${modelName}, ...)`,\n\t\t\t\t...decl.source.at(decl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpatched = {\n\t\t\t...patched,\n\t\t\t[modelName]: {\n\t\t\t\t...model,\n\t\t\t\tdiscriminator: { field: decl.fieldName },\n\t\t\t\tvariants\n\t\t\t}\n\t\t};\n\t}\n\tfor (const [variant, baseDecl] of baseDeclarations) {\n\t\tconst variantName = variant.name;\n\t\tconst baseName = baseDecl.base.name;\n\t\tif (!discriminatorDeclarations.has(baseDecl.base)) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_ORPHANED_BASE\",\n\t\t\t\tmessage: `Model \"${variantName}\" declares @@base(${baseName}, ...) but \"${baseName}\" has no @@discriminator`,\n\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (discriminatorDeclarations.has(variant)) continue;\n\t\tconst baseModel = patched[baseName];\n\t\tif (getAttribute(variant.attributes, \"map\") !== void 0 && baseModel && baseDecl.collectionName !== baseModel.storage.collection) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_VARIANT_SEPARATE_COLLECTION\",\n\t\t\t\tmessage: `Mongo variant \"${variantName}\" cannot use a different collection than its base \"${baseName}\". Mongo only supports single-collection polymorphism.`,\n\t\t\t\t...baseDecl.source.at(baseDecl.span)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst baseCollection = baseModel?.storage.collection ?? baseDecl.collectionName;\n\t\tconst variantModel = patched[variantName];\n\t\tif (variantModel) patched = {\n\t\t\t...patched,\n\t\t\t[variantName]: {\n\t\t\t\t...variantModel,\n\t\t\t\tbase: crossRef(baseName, input.namespaceId),\n\t\t\t\tstorage: {\n\t\t\t\t\t...variantModel.storage,\n\t\t\t\t\tcollection: baseCollection\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst variantCollectionName = physicalName(physicalNames, variant);\n\t\tif (roots[variantCollectionName]?.model === variantName) if (variantCollectionName === baseCollection && baseModel) roots = {\n\t\t\t...roots,\n\t\t\t[variantCollectionName]: crossRef(baseName, input.namespaceId)\n\t\t};\n\t\telse roots = Object.fromEntries(Object.entries(roots).filter(([key]) => key !== variantCollectionName));\n\t\tconst variantOwnIndexes = modelIndexesByName.get(variantName) ?? [];\n\t\tconst baseColl = collections[baseCollection];\n\t\tconst baseModelEntry = patched[baseName];\n\t\tconst discriminatorDomainField = baseModelEntry?.discriminator?.field;\n\t\tconst discriminatorField = baseModelEntry === void 0 || discriminatorDomainField === void 0 ? void 0 : ownStoredNameOf(baseModelEntry, discriminatorDomainField);\n\t\tconst scopedVariantIndexes = [];\n\t\tif (discriminatorField) for (const idx of variantOwnIndexes) {\n\t\t\tconst result = applyPolymorphicScopeToMongoIndex(idx, {\n\t\t\t\tdiscriminatorField,\n\t\t\t\tdiscriminatorValue: baseDecl.value\n\t\t\t});\n\t\t\tif (result.kind === \"conflict\") {\n\t\t\t\tconst span = indexSpans.get(idx) ?? baseDecl.span;\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Variant \"${variantName}\" index conflicts with discriminator scope: ${result.reason}`,\n\t\t\t\t\t...(indexSources.get(idx) ?? baseDecl.source).at(span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (result.index !== idx) indexSpans.set(result.index, indexSpans.get(idx) ?? baseDecl.span);\n\t\t\tscopedVariantIndexes.push(result.index);\n\t\t}\n\t\telse scopedVariantIndexes.push(...variantOwnIndexes);\n\t\tif (variantCollectionName !== baseCollection) {\n\t\t\tconst filtered = Object.fromEntries(Object.entries(collections).filter(([key]) => key !== variantCollectionName));\n\t\t\tif (scopedVariantIndexes.length > 0 && baseColl) {\n\t\t\t\tconst baseIndexes = collectionIndexes(baseColl);\n\t\t\t\tcollections = {\n\t\t\t\t\t...filtered,\n\t\t\t\t\t[baseCollection]: {\n\t\t\t\t\t\t...baseColl,\n\t\t\t\t\t\tindexes: [...baseIndexes, ...scopedVariantIndexes]\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} else collections = filtered;\n\t\t} else if (baseColl) {\n\t\t\tconst existingIndexes = collectionIndexes(baseColl);\n\t\t\tconst variantIndexSet = new Set(variantOwnIndexes);\n\t\t\tconst withoutUnscopedVariants = existingIndexes.filter((idx) => !variantIndexSet.has(idx));\n\t\t\tconst mergedIndexes = [...withoutUnscopedVariants];\n\t\t\tfor (const idx of scopedVariantIndexes) {\n\t\t\t\tconst idxKey = canonicalJson(idx);\n\t\t\t\tif (!withoutUnscopedVariants.some((existing) => canonicalJson(existing) === idxKey)) mergedIndexes.push(idx);\n\t\t\t}\n\t\t\tif (mergedIndexes.length !== existingIndexes.length || mergedIndexes.some((idx, i) => idx !== existingIndexes[i])) {\n\t\t\t\tconst next = { ...baseColl };\n\t\t\t\tif (mergedIndexes.length > 0) next[\"indexes\"] = mergedIndexes;\n\t\t\t\telse delete next[\"indexes\"];\n\t\t\t\tcollections = {\n\t\t\t\t\t...collections,\n\t\t\t\t\t[baseCollection]: next\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\tmodels: patched,\n\t\troots,\n\t\tcollections,\n\t\tdiagnostics\n\t};\n}\nfunction collectionIndexes(collection) {\n\treturn blindCast(collection[\"indexes\"] ?? []);\n}\nfunction canonicalJson(value) {\n\tif (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nfunction normalizeIndexField(element) {\n\tif (typeof element === \"string\") return {\n\t\tkind: \"field\",\n\t\tname: element\n\t};\n\tif (element.fn === \"wildcard\") {\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}\nfunction buildCollationFromSpec(args) {\n\tconst locale = args.collationLocale;\n\tif (locale === void 0) return args.collationStrength !== void 0 || args.collationCaseLevel !== void 0 || args.collationCaseFirst !== void 0 || args.collationNumericOrdering !== void 0 || args.collationAlternate !== void 0 || args.collationMaxVariable !== void 0 || args.collationBackwards !== void 0 || args.collationNormalization !== void 0 ? null : void 0;\n\tconst collation = { locale };\n\tif (args.collationStrength !== void 0) collation.strength = args.collationStrength;\n\tif (args.collationCaseLevel !== void 0) collation.caseLevel = args.collationCaseLevel;\n\tif (args.collationCaseFirst !== void 0) collation.caseFirst = args.collationCaseFirst;\n\tif (args.collationNumericOrdering !== void 0) collation.numericOrdering = args.collationNumericOrdering;\n\tif (args.collationAlternate !== void 0) collation.alternate = args.collationAlternate;\n\tif (args.collationMaxVariable !== void 0) collation.maxVariable = args.collationMaxVariable;\n\tif (args.collationBackwards !== void 0) collation.backwards = args.collationBackwards;\n\tif (args.collationNormalization !== void 0) collation.normalization = args.collationNormalization;\n\treturn collation;\n}\nfunction resolveIndexKeys(parsedFields, defaultDirection, ctx) {\n\tconst wildcardCount = parsedFields.filter((field) => field.kind === \"wildcard\").length;\n\tif (wildcardCount > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"An index can contain at most one wildcard() field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tfor (const field of parsedFields) {\n\t\tconst fieldName = field.kind === \"wildcard\" ? field.scope : field.name;\n\t\tif (fieldName !== void 0 && !ctx.indexableFieldNames.has(fieldName)) {\n\t\t\tctx.diagnostics.push({\n\t\t\t\tcode: \"PSL_INDEX_FIELD_NOT_FOUND\",\n\t\t\t\tmessage: `Index on model \"${ctx.pslModel.name}\" references unknown field \"${fieldName}\"`,\n\t\t\t\t...ctx.source.at(ctx.span)\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t}\n\treturn {\n\t\tkeys: parsedFields.map((field) => {\n\t\t\tif (field.kind === \"wildcard\") {\n\t\t\t\tif (field.scope === void 0) return {\n\t\t\t\t\tfield: \"$**\",\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tfield: `${physicalName(ctx.physicalNames, ctx.pslModel.fields[field.scope])}.$**`,\n\t\t\t\t\tdirection: defaultDirection\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tfield: physicalName(ctx.physicalNames, ctx.pslModel.fields[field.name]),\n\t\t\t\tdirection: field.direction ?? defaultDirection\n\t\t\t};\n\t\t}),\n\t\thasWildcard: wildcardCount === 1\n\t};\n}\nfunction buildProjection(include, exclude, hasWildcard, ctx) {\n\tif (include !== void 0 && exclude !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Cannot specify both include and exclude on the same index\",\n\t\t\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) return void 0;\n\tif (!hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"include/exclude options are only valid when the index contains a wildcard() field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn null;\n\t}\n\tif (fields.length === 0) return void 0;\n\tconst value = include === void 0 ? 0 : 1;\n\tconst projection = {};\n\tfor (const field of fields) projection[field] = value;\n\treturn projection;\n}\nfunction buildNormalIndex(parsed, unique, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst defaultDirection = parsed.type ?? 1;\n\tconst resolved = resolveIndexKeys(parsedFields, defaultDirection, ctx);\n\tif (!resolved) return void 0;\n\tif (unique && resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Unique indexes cannot use wildcard() fields\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && typeof defaultDirection === \"string\" && [\n\t\t\"hashed\",\n\t\t\"2dsphere\",\n\t\t\"2d\"\n\t].includes(defaultDirection)) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: `wildcard() fields cannot be combined with type: ${defaultDirection}`,\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (defaultDirection === \"hashed\" && parsedFields.length > 1) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"Hashed indexes must have exactly one field\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tif (resolved.hasWildcard && parsed.expireAfterSeconds !== void 0) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"expireAfterSeconds cannot be combined with wildcard() fields\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst wildcardProjection = buildProjection(parsed.include, parsed.exclude, resolved.hasWildcard, ctx);\n\tif (wildcardProjection === null) return void 0;\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...unique && { unique: true },\n\t\t...parsed.sparse !== void 0 && { sparse: parsed.sparse },\n\t\t...parsed.expireAfterSeconds !== void 0 && { expireAfterSeconds: parsed.expireAfterSeconds },\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...wildcardProjection !== void 0 && { wildcardProjection },\n\t\t...collation !== void 0 && { collation },\n\t\t...parsed.default_language !== void 0 && { default_language: parsed.default_language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction buildTextIndex(parsed, ctx) {\n\tconst parsedFields = parsed.fields.map(normalizeIndexField);\n\tif (parsedFields.length === 0) return void 0;\n\tconst resolved = resolveIndexKeys(parsedFields, \"text\", ctx);\n\tif (!resolved) return void 0;\n\tif (resolved.hasWildcard) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"wildcard() fields cannot be combined with type: hashed/2dsphere/2d or @@textIndex\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst collation = buildCollationFromSpec(parsed);\n\tif (collation === null) {\n\t\tctx.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\tmessage: \"collationLocale is required when using collation options\",\n\t\t\t...ctx.source.at(ctx.span)\n\t\t});\n\t\treturn;\n\t}\n\treturn new MongoIndex({\n\t\tkeys: resolved.keys,\n\t\t...parsed.filter !== void 0 && { partialFilterExpression: parsed.filter },\n\t\t...collation !== void 0 && { collation },\n\t\t...ifDefined(\"weights\", parsed.weights),\n\t\t...parsed.language !== void 0 && { default_language: parsed.language },\n\t\t...parsed.languageOverride !== void 0 && { language_override: parsed.languageOverride }\n\t});\n}\nfunction 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}\nfunction collectIndexes(pslModel, specContext, physicalNames, sources, binder, diagnostics, indexSpans, indexSources) {\n\tconst indexes = [];\n\tlet textIndexCount = 0;\n\tconst indexableFieldNames = /* @__PURE__ */ new Set();\n\tfor (const field of Object.values(pslModel.fields)) if (fieldTypeResolution(field, binder)?.kind !== \"model\") indexableFieldNames.add(field.name);\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\tconst fieldUniqueIndex = new MongoIndex({\n\t\t\tkeys: [{\n\t\t\t\tfield: physicalName(physicalNames, field),\n\t\t\t\tdirection: 1\n\t\t\t}],\n\t\t\tunique: true\n\t\t});\n\t\tindexes.push(fieldUniqueIndex);\n\t\tindexSpans.set(fieldUniqueIndex, nodePslSpan(uniqueNode.syntax, sources));\n\t\tindexSources.set(fieldUniqueIndex, diagnosticSource(sources, uniqueNode.syntax));\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\tpslModel,\n\t\t\tphysicalNames,\n\t\t\tindexableFieldNames,\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\ttextIndexCount++;\n\t\t\tif (textIndexCount > 1) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_INVALID_INDEX\",\n\t\t\t\t\tmessage: `Only one @@textIndex is allowed per collection (model \"${pslModel.name}\")`,\n\t\t\t\t\t...source.at(attr.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tindex = buildTextIndex(parsed, ctx);\n\t\t} else {\n\t\t\tconst unique = attr.name === \"unique\";\n\t\t\tconst parsed = interpretModelAttribute({\n\t\t\t\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) continue;\n\t\tindexes.push(index);\n\t\tindexSpans.set(index, attr.span);\n\t\tindexSources.set(index, source);\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}\n/**\n* Keys each preset's execution defaults by collection and stored field. Rejects presets on variant fields, since a default keyed by collection applies to every document in it, and merges identical defaults that two models declare for the same collection field.\n*/\nfunction resolvePresetExecutionDefaults(input) {\n\tconst byRef = /* @__PURE__ */ new Map();\n\tconst resolved = [];\n\tfor (const preset of input.defaults) {\n\t\tconst model = input.models[preset.modelName];\n\t\tif (model === void 0) continue;\n\t\tconst collection = model.storage.collection;\n\t\tconst call = preset.field.typeConstructor;\n\t\tconst presetPath = call?.path.join(\".\") ?? preset.field.typeName;\n\t\tconst at = diagnosticSource(input.sources, preset.field.node.syntax).at(call?.span ?? preset.field.span);\n\t\tconst source = preset.fromPreset ? `Preset \"${presetPath}\"` : \"Generated value\";\n\t\tif (model.base !== void 0) {\n\t\t\tinput.diagnostics.push({\n\t\t\t\tcode: \"PSL_PRESET_ON_VARIANT_FIELD\",\n\t\t\t\tmessage: `${source} on variant \"${preset.modelName}\" field \"${preset.field.name}\": execution defaults apply to every document in collection \"${collection}\", so declare them on the base model.`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst refKey = JSON.stringify([collection, preset.storedField]);\n\t\tconst phasesKey = canonicalJson(preset.phases);\n\t\tconst existing = byRef.get(refKey);\n\t\tif (existing === void 0) {\n\t\t\tbyRef.set(refKey, {\n\t\t\t\towner: preset,\n\t\t\t\tphasesKey\n\t\t\t});\n\t\t\tresolved.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: input.namespaceId,\n\t\t\t\t\tentry: collection,\n\t\t\t\t\tfield: preset.storedField\n\t\t\t\t},\n\t\t\t\t...preset.phases\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (existing.phasesKey !== phasesKey) input.diagnostics.push({\n\t\t\tcode: \"PSL_PRESET_CONFLICT\",\n\t\t\tmessage: `${source} on \"${preset.modelName}.${preset.field.name}\" sets different execution defaults than \"${existing.owner.modelName}.${existing.owner.field.name}\" for field \"${preset.storedField}\" of collection \"${collection}\". Generate the same values on both models.`,\n\t\t\t...at\n\t\t});\n\t}\n\treturn resolved;\n}\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generators a field's `@onCreate(fn())` and `@onUpdate(fn())` resolve to, `undefined` for a field with neither, or `'invalid'` when one is refused.\n*/\nfunction lowerGeneratorAttributes(input) {\n\tconst { field, modelName, diagnostics } = input;\n\tconst fieldLabel = `Field \"${modelName}.${field.name}\"`;\n\tconst phases = {};\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\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\treturn \"invalid\";\n\t\t}\n\t\tconst at = diagnosticSource(input.sources, field.node.syntax).at(attribute.span);\n\t\tconst argument = attribute.args.find((arg) => arg.kind === \"positional\")?.value.trim() ?? \"\";\n\t\tif (field.list) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_LIST_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\t\t\tmessage: `${fieldLabel} is a list and cannot use @${phase}(${argument}). Lists have no per-element generated values; remove @${phase}(...).`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tif (field.optional) {\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_OPTIONAL_EXECUTION_DEFAULT_UNSUPPORTED\",\n\t\t\t\tmessage: `${fieldLabel} is optional, and a generated value needs a required field in MongoDB. Remove \"?\" or remove @${phase}(...).`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tif (input.resolved.executionDefaults?.[phase] !== void 0) {\n\t\t\tconst phaseText = phase === \"onCreate\" ? \"on create\" : \"on update\";\n\t\t\tdiagnostics.push({\n\t\t\t\tcode: \"PSL_PRESET_AND_DEFAULT_CONFLICT\",\n\t\t\t\tmessage: `${fieldLabel} uses a field-preset call that already generates a value ${phaseText}, so @${phase}(...) cannot set one too. Remove @${phase}(...) or use a preset without an ${phase} generator.`,\n\t\t\t\t...at\n\t\t\t});\n\t\t\treturn \"invalid\";\n\t\t}\n\t\tconst interpreted = interpretFieldAttribute({\n\t\t\tsymbols: input.specContext.symbols,\n\t\t\tnode: attribute.node,\n\t\t\tspec: mongoAttributeSpecs.field[phase](input.specContext),\n\t\t\tmodel: input.model,\n\t\t\tfield,\n\t\t\tsources: input.sources,\n\t\t\tbinder: input.binder,\n\t\t\tdiagnostics\n\t\t});\n\t\tif (interpreted === void 0) return \"invalid\";\n\t\tconst type = input.resolved.field.type;\n\t\tconst call = interpreted.value;\n\t\tconst resolution = type.kind === \"scalar\" ? input.generatorFunctions.resolve({\n\t\t\tname: call.fn,\n\t\t\targs: call.args\n\t\t}, {\n\t\t\tcodecId: type.codecId,\n\t\t\ttypeParams: type.typeParams,\n\t\t\tlength: void 0\n\t\t}) : void 0;\n\t\tif (resolution?.ok === true) {\n\t\t\tphases[phase] = resolution.generator;\n\t\t\tcontinue;\n\t\t}\n\t\tdiagnostics.push({\n\t\t\tcode: \"PSL_GENERATOR_NOT_APPLICABLE\",\n\t\t\tmessage: resolution?.reason === \"refused\" ? `${fieldLabel}: ${resolution.message}` : `${fieldLabel}: ${call.fn}() does not apply to this field's type.`,\n\t\t\t...diagnosticSource(input.sources, field.node.syntax).at(call.span)\n\t\t});\n\t\treturn \"invalid\";\n\t}\n\treturn phases.onCreate === void 0 && phases.onUpdate === void 0 ? void 0 : phases;\n}\nfunction resolveNonRelationField(field, owner, resolution, codecIdByEnumName, presetContext, scalarNames) {\n\tconst ownerName = owner.name;\n\tif (resolution?.kind === \"compositeType\") return { field: {\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: 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 === \"model\" || resolution?.kind === \"namedType\" || resolution?.kind === \"block\" || resolution?.kind === \"crossSpace\") {\n\t\tpresetContext.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(presetContext.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(presetContext.sources, field.node.syntax);\n\tif (descriptor.kind === \"fieldPreset\") {\n\t\tif (call === void 0) {\n\t\t\treportPresetNotCalled({\n\t\t\t\tentityLabel,\n\t\t\t\tpresetPath: path.join(\".\"),\n\t\t\t\tsource,\n\t\t\t\tspan: field.span,\n\t\t\t\tdiagnostics: presetContext.diagnostics\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst preset = resolveFieldPreset({\n\t\t\tfield,\n\t\t\tcall,\n\t\t\tdescriptor,\n\t\t\townerName,\n\t\t\townerKind: owner.kind,\n\t\t\tcontext: presetContext\n\t\t});\n\t\tif (preset.kind === \"invalid\") return void 0;\n\t\treturn {\n\t\t\tfield: preset.field,\n\t\t\t...ifDefined(\"executionDefaults\", preset.executionDefaults)\n\t\t};\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: presetContext.diagnostics\n\t\t});\n\t\treturn;\n\t}\n\tif (call === void 0) scalarNames.warnDeprecated(field, descriptor);\n\treturn { field: {\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: descriptor.output.codecId\n\t\t},\n\t\tnullable: field.optional,\n\t\tmany: field.list ? { elementNullable: field.elementOptional } : false\n\t} };\n}\nfunction fieldKey(owner, fieldName) {\n\treturn JSON.stringify([owner, fieldName]);\n}\n/** The diagnostic for an enum a collection validator cannot describe, at its `@@type` or member. */\nfunction enumRefusalDiagnostic(refusal, sites) {\n\tif (refusal.kind !== \"enumBsonType\" && refusal.kind !== \"enumNotListable\" && refusal.kind !== \"enumMemberNotListable\") return;\n\tconst site = sites.get(refusal.enumName);\n\tassertDefined(site, `Built enum \"${refusal.enumName}\" has a declaration site`);\n\tconst subject = `enum \"${refusal.enumName}\"`;\n\tif (refusal.kind === \"enumBsonType\") return {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} ${refusal.refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.codecSpan\n\t};\n\tif (refusal.kind === \"enumNotListable\") return {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} @@type codec \"${refusal.codecId}\" ${refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.codecSpan\n\t};\n\treturn {\n\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\tmessage: `${subject} member \"${refusal.member}\" ${refusal.reason}`,\n\t\tsourceId: site.sourceId,\n\t\tspan: site.memberSpans[refusal.member] ?? site.codecSpan\n\t};\n}\n/** MongoDB PSL has no control policies, so every collection is managed. */\nconst MONGO_PSL_CONTROL_POLICIES = {\n\tcollections: {},\n\tdefaultControlPolicy: void 0\n};\n/** The diagnostic for a field a collection validator cannot describe, at the field. */\nfunction fieldRefusalDiagnostic(refusal, fieldSymbols, sources) {\n\tif (refusal.kind !== \"fieldBsonType\" && refusal.kind !== \"documentId\") return void 0;\n\tconst owner = refusal.kind === \"fieldBsonType\" ? refusal.owner.name : refusal.modelName;\n\tconst field = fieldSymbols.get(fieldKey(owner, refusal.fieldName));\n\tassertDefined(field, `Field \"${owner}.${refusal.fieldName}\" has a declaration`);\n\treturn {\n\t\tcode: refusal.kind === \"fieldBsonType\" ? \"PSL_UNSUPPORTED_FIELD_TYPE\" : \"PSL_MONGO_ID_INVALID\",\n\t\tmessage: `Field \"${owner}.${field.name}\" ${refusal.kind === \"fieldBsonType\" ? refusal.refusal.reason : refusal.reason}`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\nfunction processEnumDeclarations(input) {\n\tconst builtEnums = {};\n\tif (input.enumSymbols.length === 0) return builtEnums;\n\tconst enumDescriptor = input.authoringContributions?.entityTypes?.[\"enum\"] !== void 0 && isAuthoringEntityTypeDescriptor(input.authoringContributions.entityTypes[\"enum\"]) ? input.authoringContributions.entityTypes[\"enum\"] : void 0;\n\tif (!enumDescriptor) {\n\t\tfor (const 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 builtEnums;\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\tconst encoded = encodeEnumMembers(handle, input.entityContext.codecLookup);\n\t\tif (!encoded.ok) {\n\t\t\tconst site = {\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\tinput.diagnostics.pushExternal(...encoded.failure.map((problem) => enumMemberProblemDiagnostic(problem, site)));\n\t\t\tcontinue;\n\t\t}\n\t\tbuiltEnums[envelope.name] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: encoded.value\n\t\t};\n\t\tconst typeAttribute = envelope.attributes[\"type\"];\n\t\tinput.sites.set(envelope.name, {\n\t\t\tsourceId: sourceFile.filename,\n\t\t\tcodecSpan: typeAttribute?.argSpans?.[\"codecId\"] ?? typeAttribute?.span ?? envelope.span,\n\t\t\tmemberSpans: envelope.parameterSpans\n\t\t});\n\t}\n\treturn builtEnums;\n}\nfunction interpretPslDocumentToMongoContract(input) {\n\tconst { symbolTable, sources, scalarTypeCodecIds, codecLookup } = input;\n\tconst diagnostics = createPslDiagnosticCollector(sources);\n\tconst presetContext = {\n\t\tauthoringContributions: input.authoringContributions,\n\t\tsources,\n\t\tdiagnostics,\n\t\ttypeLookups: {\n\t\t\tcodecLookup,\n\t\t\tdataTypeLookup: input.dataTypes.lookup\n\t\t},\n\t\twarnPresetWithoutEffect: presetWithoutEffectWarner({\n\t\t\ttypes: input.authoringContributions?.type,\n\t\t\tscalarTypeCodecIds,\n\t\t\tsources,\n\t\t\treportWarning: input.reportWarning\n\t\t})\n\t};\n\tconst presetExecutionDefaults = [];\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 builtEnums = processEnumDeclarations({\n\t\tsites: enumSites,\n\t\tenumSymbols: topLevelEnumSymbols,\n\t\tparsedBlocks,\n\t\tsources,\n\t\tbinder,\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\tdataTypeLookup: input.dataTypes.lookup,\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(builtEnums).map(([name, e]) => [name, e.codecId]));\n\tconst models = {};\n\tconst collections = {};\n\tconst roots = {};\n\tconst allFkRelations = [];\n\tconst indexSpans = /* @__PURE__ */ new Map();\n\tconst indexSources = /* @__PURE__ */ new Map();\n\tconst modelIndexesByName = /* @__PURE__ */ new Map();\n\tconst backrelationCandidates = [];\n\tconst invalidFkPairings = [];\n\tconst validatorLookups = {\n\t\tcodecLookup,\n\t\tdataTypeLookup: input.dataTypes.lookup\n\t};\n\tconst fieldSymbols = /* @__PURE__ */ new Map();\n\tfor (const pslModel of allModels) {\n\t\tconst collectionName = physicalName(physicalNames, pslModel);\n\t\tconst specContext = specContextFor(pslModel);\n\t\tconst fields = {};\n\t\tconst storageFields = {};\n\t\tconst fieldsByStoredName = /* @__PURE__ */ new Map();\n\t\tconst relations = {};\n\t\tfor (const field of Object.values(pslModel.fields)) {\n\t\t\tconst resolution = fieldTypeResolution(field, binder);\n\t\t\tif (resolution?.kind === \"model\") {\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 (relation?.fields && relation?.references) {\n\t\t\t\t\tif (resolveToOneRelationNullable({\n\t\t\t\t\t\tdeclaredNullable: field.optional,\n\t\t\t\t\t\tlocalFieldNullability: relation.fields.map((localFieldName) => pslModel.fields[localFieldName]?.optional === true),\n\t\t\t\t\t\townsReference: true\n\t\t\t\t\t}).contradiction !== void 0) {\n\t\t\t\t\t\tdiagnostics.push(relationNullabilityMismatchDiagnostic(pslModel.name, field, sources));\n\t\t\t\t\t\tinvalidFkPairings.push({\n\t\t\t\t\t\t\tpairKey: fkRelationPairKey(pslModel.name, target.name),\n\t\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name)\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!physicalNames.has(target)) continue;\n\t\t\t\t\trelations[field.name] = {\n\t\t\t\t\t\tto: crossRef(target.name, defaultNamespace.id),\n\t\t\t\t\t\tcardinality: \"N:1\",\n\t\t\t\t\t\tnullable: field.optional,\n\t\t\t\t\t\ton: {\n\t\t\t\t\t\t\tlocalFields: relation.fields,\n\t\t\t\t\t\t\ttargetFields: relation.references\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tallFkRelations.push({\n\t\t\t\t\t\tdeclaringModel: pslModel.name,\n\t\t\t\t\t\ttargetModel: target.name,\n\t\t\t\t\t\t...ifDefined(\"relationName\", relation.name),\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}\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, presetContext, scalarNames);\n\t\t\tif (!resolved) continue;\n\t\t\tconst mappedName = physicalName(physicalNames, field);\n\t\t\tconst unsupported = unsupportedStoredNameReason(mappedName);\n\t\t\tif (unsupported !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_STORED_NAME_UNSUPPORTED\",\n\t\t\t\t\tmessage: `Field \"${pslModel.name}.${field.name}\" ${unsupported}. Give the field another stored name with @map.`,\n\t\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst sharingField = fieldsByStoredName.get(mappedName);\n\t\t\tif (sharingField !== void 0) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\tcode: \"PSL_DUPLICATE_STORED_NAME\",\n\t\t\t\t\tmessage: `Fields \"${pslModel.name}.${sharingField}\" and \"${pslModel.name}.${field.name}\" are both stored as \"${mappedName}\". Give each field its own stored name with @map.`,\n\t\t\t\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfieldsByStoredName.set(mappedName, field.name);\n\t\t\tfields[field.name] = resolved.field;\n\t\t\tstorageFields[field.name] = { field: mappedName };\n\t\t\tfieldSymbols.set(fieldKey(pslModel.name, field.name), field);\n\t\t\tconst generated = lowerGeneratorAttributes({\n\t\t\t\tfield,\n\t\t\t\tmodel: pslModel,\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\tif (generated === \"invalid\") continue;\n\t\t\tconst phases = resolved.executionDefaults === void 0 ? generated : {\n\t\t\t\t...resolved.executionDefaults,\n\t\t\t\t...generated\n\t\t\t};\n\t\t\tif (phases !== void 0) presetExecutionDefaults.push({\n\t\t\t\tmodelName: pslModel.name,\n\t\t\t\tfield,\n\t\t\t\tstoredField: mappedName,\n\t\t\t\tphases,\n\t\t\t\tfromPreset: resolved.executionDefaults !== void 0\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\tmodels[pslModel.name] = {\n\t\t\tfields,\n\t\t\trelations,\n\t\t\tstorage: {\n\t\t\t\tcollection: collectionName,\n\t\t\t\tfields: storageFields\n\t\t\t}\n\t\t};\n\t\tconst modelIndexes = collectIndexes(pslModel, specContext, physicalNames, sources, binder, diagnostics, indexSpans, indexSources);\n\t\tmodelIndexesByName.set(pslModel.name, modelIndexes);\n\t\tconst existingColl = collections[collectionName];\n\t\tif (existingColl && modelIndexes.length > 0) collections[collectionName] = { indexes: [...collectionIndexes(existingColl), ...modelIndexes] };\n\t\telse if (!existingColl) collections[collectionName] = modelIndexes.length > 0 ? { indexes: modelIndexes } : {};\n\t\troots[collectionName] = crossRef(pslModel.name, defaultNamespace.id);\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 fieldMap = field.attributes.find((attr) => attr.name === \"map\");\n\t\t\tif (fieldMap !== void 0) diagnostics.push({\n\t\t\t\tcode: \"PSL_MONGO_TYPE_FIELD_MAP_UNSUPPORTED\",\n\t\t\t\tmessage: `Field \"${compositeType.name}.${field.name}\" 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\t\t...diagnosticSource(sources, fieldMap.node.syntax).at(nodePslSpan(fieldMap.node.syntax, sources))\n\t\t\t});\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, presetContext, scalarNames);\n\t\t\tif (!resolved) continue;\n\t\t\tfields[field.name] = resolved.field;\n\t\t\tfieldSymbols.set(fieldKey(compositeType.name, field.name), field);\n\t\t}\n\t\tvalueObjects[compositeType.name] = { fields };\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) {\n\t\tconst modelEntry = models[modelName];\n\t\tif (modelEntry) modelEntry.relations[fieldName] = relation;\n\t}\n\tconst { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(allModels, specContextFor, physicalNames, sources, binder, scalarTypeCodecIds.get(\"String\"), diagnostics);\n\tconst polyResult = resolvePolymorphism({\n\t\tnamespaceId: defaultNamespace.id,\n\t\tsources,\n\t\tmodels,\n\t\troots,\n\t\tcollections,\n\t\tdiscriminatorDeclarations,\n\t\tbaseDeclarations,\n\t\tindexSpans,\n\t\tmodelIndexesByName,\n\t\tphysicalNames,\n\t\tindexSources\n\t});\n\tconst executionDefaults = resolvePresetExecutionDefaults({\n\t\tdefaults: presetExecutionDefaults,\n\t\tmodels: polyResult.models,\n\t\tsources,\n\t\tdiagnostics,\n\t\tnamespaceId: defaultNamespace.id\n\t});\n\tfor (const refusal of mongoContractRefusalsOf({\n\t\tmodels: polyResult.models,\n\t\tvalueObjects,\n\t\tenums: builtEnums,\n\t\tlookups: validatorLookups,\n\t\tcontrolPolicies: MONGO_PSL_CONTROL_POLICIES\n\t})) {\n\t\tconst enumDiagnostic = enumRefusalDiagnostic(refusal, enumSites);\n\t\tif (enumDiagnostic !== void 0) diagnostics.pushExternal(enumDiagnostic);\n\t\tconst fieldDiagnostic = fieldRefusalDiagnostic(refusal, fieldSymbols, sources);\n\t\tif (fieldDiagnostic !== void 0) diagnostics.push(fieldDiagnostic);\n\t}\n\tif (diagnostics.length > 0 || polyResult.diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0) return notOk({\n\t\tsummary: \"PSL to Mongo contract interpretation failed\",\n\t\tdiagnostics: [\n\t\t\t...input.seedDiagnostics ?? [],\n\t\t\t...diagnostics.toExternal(),\n\t\t\t...polyResult.diagnostics.toExternal()\n\t\t]\n\t});\n\tconst resolvedModels = polyResult.models;\n\tconst resolvedCollections = polyResult.collections;\n\tconst target = \"mongo\";\n\tconst targetFamily = \"mongo\";\n\tconst execution = buildExecutionSection({\n\t\ttarget,\n\t\ttargetFamily,\n\t\tdefaults: executionDefaults\n\t});\n\tconst storageValueSets = mongoValueSetsOf(builtEnums);\n\tconst validators = deriveCollectionValidators({\n\t\tmodels: resolvedModels,\n\t\tlookups: validatorLookups,\n\t\tvalueObjects,\n\t\tvalueSets: storageValueSets,\n\t\tcontrolPolicies: MONGO_PSL_CONTROL_POLICIES\n\t});\n\tfor (const [collectionName, validator] of Object.entries(validators)) {\n\t\tconst coll = resolvedCollections[collectionName];\n\t\tif (coll) coll[\"validator\"] = validator;\n\t}\n\tconst collectionInputs = {};\n\tfor (const [name, coll] of Object.entries(resolvedCollections)) {\n\t\tconst raw = {};\n\t\tif (coll[\"indexes\"] != null) raw[\"indexes\"] = coll[\"indexes\"];\n\t\tif (coll[\"validator\"] != null) raw[\"validator\"] = coll[\"validator\"];\n\t\tif (coll[\"options\"] != null) raw[\"options\"] = coll[\"options\"];\n\t\tcollectionInputs[name] = blindCast(raw);\n\t}\n\tconst storage = buildMongoStorage({\n\t\tcollections: collectionInputs,\n\t\tvalueSets: storageValueSets\n\t});\n\tconst capabilities = {};\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\treturn ok({\n\t\ttargetFamily,\n\t\ttarget,\n\t\troots: polyResult.roots,\n\t\tdomain: { namespaces: { [defaultNamespace.id]: {\n\t\t\tmodels: polyResult.models,\n\t\t\t...Object.keys(valueObjects).length > 0 ? { valueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\textensions: {},\n\t\tcapabilities,\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget,\n\t\t\ttargetFamily,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {},\n\t\t...ifDefined(\"execution\", execution)\n\t});\n}\n//#endregion\nexport { mongoAttributeSpecs as i, pairMongoBackRelations as n, describeUnsupportedMongoAttribute as r, interpretPslDocumentToMongoContract as t };\n\n//# sourceMappingURL=interpreter-DsxFJSG4.mjs.map"],"mappings":";;;;;;;;;;;;;;;;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