@prisma/orm-family-mongo 8.0.0-rc.14-dev.29 → 8.0.0-rc.14-dev.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/{authoring-entity-types-D1gQKIyI-DKDypFsk.mjs → authoring-entity-types-BOMOzrka-CgmQMnNa.mjs} +21 -6
  2. package/dist/authoring-entity-types-BOMOzrka-CgmQMnNa.mjs.map +1 -0
  3. package/dist/codec.d.mts +1 -1
  4. package/dist/{contract-builder-6fLDRNek.mjs → contract-builder-BPLIHO77.mjs} +5 -2
  5. package/dist/contract-builder-BPLIHO77.mjs.map +1 -0
  6. package/dist/contract-prisma6__provider.mjs +4 -2
  7. package/dist/contract-prisma6__provider.mjs.map +1 -1
  8. package/dist/contract-psl.d.mts +7 -5
  9. package/dist/contract-psl.d.mts.map +1 -1
  10. package/dist/contract-psl.mjs +2 -2
  11. package/dist/contract-psl__provider.mjs +2 -1
  12. package/dist/contract-psl__provider.mjs.map +1 -1
  13. package/dist/contract-ts.mjs +1 -1
  14. package/dist/contract-ts__contract-builder.mjs +1 -1
  15. package/dist/contract__data-type.d.mts +2 -0
  16. package/dist/contract__data-type.mjs +2 -0
  17. package/dist/{control-CDcoUUxZ.mjs → control-JuPlJeiS.mjs} +4 -4
  18. package/dist/{control-CDcoUUxZ.mjs.map → control-JuPlJeiS.mjs.map} +1 -1
  19. package/dist/{control-adapter-Bh_ZraGM-DRffYg2K.d.mts → control-adapter-Bh_ZraGM-jP5nqgUQ.d.mts} +2 -2
  20. package/dist/{control-adapter-Bh_ZraGM-DRffYg2K.d.mts.map → control-adapter-Bh_ZraGM-jP5nqgUQ.d.mts.map} +1 -1
  21. package/dist/control-adapter-D7th_Prd.d.mts +1 -0
  22. package/dist/{control-g1InHCpj.d.mts → control-jfkr6y8H.d.mts} +2 -2
  23. package/dist/{control-g1InHCpj.d.mts.map → control-jfkr6y8H.d.mts.map} +1 -1
  24. package/dist/data-type-Cl0vtmfh.mjs +25 -0
  25. package/dist/data-type-Cl0vtmfh.mjs.map +1 -0
  26. package/dist/data-type-DuiFEJxB.d.mts +27 -0
  27. package/dist/data-type-DuiFEJxB.d.mts.map +1 -0
  28. package/dist/{dist-CqgZZxRy.mjs → dist-xk_0xOR-.mjs} +3 -4
  29. package/dist/dist-xk_0xOR-.mjs.map +1 -0
  30. package/dist/family.d.mts +3 -3
  31. package/dist/family.mjs +2 -2
  32. package/dist/family__control-adapter.d.mts +2 -2
  33. package/dist/family__control.d.mts +1 -1
  34. package/dist/family__control.mjs +1 -1
  35. package/dist/family__pack.mjs +2 -2
  36. package/dist/family__pack.mjs.map +1 -1
  37. package/dist/{index-CUkTUMkQ.d.mts → index-DQD6JW4d.d.mts} +3 -3
  38. package/dist/{index-CUkTUMkQ.d.mts.map → index-DQD6JW4d.d.mts.map} +1 -1
  39. package/dist/{index-Cf2LlAyQ.d.mts → index-DewnUTbg.d.mts} +2 -2
  40. package/dist/{index-Cf2LlAyQ.d.mts.map → index-DewnUTbg.d.mts.map} +1 -1
  41. package/dist/{interpreter-DOhkU5y3-XhgQiAGq.mjs → interpreter-D3cYmZTX-TygWz2iq.mjs} +24 -16
  42. package/dist/interpreter-D3cYmZTX-TygWz2iq.mjs.map +1 -0
  43. package/dist/lowering.d.mts +1 -1
  44. package/dist/runtime.d.mts +2 -2
  45. package/package.json +21 -20
  46. package/dist/authoring-entity-types-D1gQKIyI-DKDypFsk.mjs.map +0 -1
  47. package/dist/contract-builder-6fLDRNek.mjs.map +0 -1
  48. package/dist/control-adapter-B23h6f2Y.d.mts +0 -1
  49. package/dist/dist-CqgZZxRy.mjs.map +0 -1
  50. package/dist/interpreter-DOhkU5y3-XhgQiAGq.mjs.map +0 -1
@@ -1,15 +1,18 @@
1
+ import { n as isMongoDataType } from "./data-type-Cl0vtmfh.mjs";
1
2
  import "@prisma/orm-framework/components/ir";
2
3
  import "@prisma/orm-framework/contract/types";
3
4
  import "@prisma/orm-framework/contract/hashing";
4
5
  import "@prisma/orm-framework/errors/control";
5
6
  import "@prisma/orm-framework/utils/casts";
7
+ import "@prisma/orm-framework/components/codec";
8
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
6
9
  import { enumType } from "@prisma/orm-framework/contract-authoring";
7
10
  import { readEnumBlockMembers, resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
8
11
  import { blockAttribute, jsonValue, mapBlock, str } from "@prisma/orm-framework/psl-parser";
9
12
  import "@prisma/orm-framework/utils/defined";
10
13
  import "@prisma/orm-framework/components/control";
11
14
  import "@prisma/orm-framework/utils/canonical-stringify";
12
- //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-D1gQKIyI.mjs
15
+ //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-BOMOzrka.mjs
13
16
  function mongoFamilyEnumSpec() {
14
17
  return mapBlock({
15
18
  value: {
@@ -28,8 +31,8 @@ const mongoFamilyEntityTypes = { enum: {
28
31
  const resolved = resolveEnumCodecId(block, ctx);
29
32
  if (resolved === void 0) return;
30
33
  const { codecId, codecSpan } = resolved;
31
- const bsonTypes = ctx.codecLookup?.targetTypesFor(codecId);
32
- if (bsonTypes === void 0) {
34
+ const descriptor = ctx.codecLookup.descriptorFor(codecId);
35
+ if (descriptor === void 0) {
33
36
  diagnostics?.push({
34
37
  code: "PSL_EXTENSION_INVALID_VALUE",
35
38
  message: `enum "${block.name}" @@type references unknown codec "${codecId}"`,
@@ -38,6 +41,18 @@ const mongoFamilyEntityTypes = { enum: {
38
41
  });
39
42
  return;
40
43
  }
44
+ const dataType = ctx.dataTypeLookup.get(descriptor.dataType);
45
+ if (dataType === void 0) {
46
+ diagnostics?.push({
47
+ code: "PSL_EXTENSION_INVALID_VALUE",
48
+ message: `enum "${block.name}" @@type codec "${codecId}" represents data type "${descriptor.dataType}", which no component registers`,
49
+ sourceId,
50
+ span: codecSpan
51
+ });
52
+ return;
53
+ }
54
+ if (!isMongoDataType(dataType)) throw new InternalError(`Data type ${dataType.id} is not a Mongo data type.`);
55
+ const { bsonTypes } = dataType.mongo;
41
56
  const [bsonType, ...otherBsonTypes] = bsonTypes;
42
57
  if (bsonType === void 0 || otherBsonTypes.length > 0) {
43
58
  diagnostics?.push({
@@ -48,11 +63,11 @@ const mongoFamilyEntityTypes = { enum: {
48
63
  });
49
64
  return;
50
65
  }
51
- const codec = ctx.codecLookup?.get(codecId);
66
+ const codec = ctx.codecLookup.get(codecId);
52
67
  if (codec === void 0) {
53
68
  diagnostics?.push({
54
69
  code: "PSL_EXTENSION_INVALID_VALUE",
55
- message: `enum "${block.name}" @@type codec "${codecId}" resolves in targetTypesFor but is absent from codecLookup.get`,
70
+ message: `enum "${block.name}" @@type codec "${codecId}" is registered but codecLookup.get has no codec for it`,
56
71
  sourceId,
57
72
  span: codecSpan
58
73
  });
@@ -86,4 +101,4 @@ const mongoFamilyPslBlockDescriptors = { enum: {
86
101
  //#endregion
87
102
  export { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };
88
103
 
89
- //# sourceMappingURL=authoring-entity-types-D1gQKIyI-DKDypFsk.mjs.map
104
+ //# sourceMappingURL=authoring-entity-types-BOMOzrka-CgmQMnNa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-entity-types-BOMOzrka-CgmQMnNa.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-BOMOzrka.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { isMongoDataType } from \"@internal/mongo-contract/data-type\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\nimport \"@internal/framework-components/codec\";\nimport \"@internal/framework-components/control\";\nimport \"@internal/framework-components/ir\";\nimport \"@internal/mongo-contract\";\nimport \"@internal/mongo-contract/canonicalization-hooks\";\nimport \"@internal/utils/canonical-stringify\";\nimport \"@internal/utils/casts\";\nimport { blockAttribute, jsonValue, mapBlock, str } from \"@internal/psl-parser\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/authoring-entity-types.ts\nfunction mongoFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: jsonValue(),\n\t\t\tdocumentation: \"The stored member value; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst mongoFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tif (descriptor === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypeLookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!isMongoDataType(dataType)) throw new InternalError(`Data type ${dataType.id} is not a Mongo data type.`);\n\t\tconst { bsonTypes } = dataType.mongo;\n\t\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\t\tif (bsonType === void 0 || otherBsonTypes.length > 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" is registered but codecLookup.get has no codec for it`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType: bsonType\n\t\t}, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst mongoFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: mongoFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\nexport { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };\n\n//# sourceMappingURL=authoring-entity-types-BOMOzrka.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB;CAC9B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,UAAU;GAChB,e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AAS,OAAO,GAAG;EAC/D,IAAI,YAAY,KAAK,GAAG,OAAO,KAAK;EACpC,OAAO,SAAS,MAAM,MAAM;GAC3B;GACA,YAAY;EACb,GAAG,GAAG,OAAO;CACd,EAAE;AACH,EAAE;AACF,MAAM,yBAAyB,eAAe,QAAQ;CACrD,eAAe;CACf,YAAY,CAAC;EACZ,KAAK;EACL,MAAM,IAAI;EACV,eAAe;CAChB,CAAC;AACF,CAAC;AACD,MAAM,iCAAiC,EAAE,MAAM;CAC9C,MAAM;CACN,SAAS;CACT,eAAe;CACf,eAAe;CACf,MAAM,EAAE,UAAU,KAAK;CACvB,MAAM;CACN,YAAY,EAAE,YAAY,uBAAuB;AAClD,EAAE"}
package/dist/codec.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as mongoCodec, i as MongoCodecTrait, n as MongoCodecInput, o as newMongoCodecRegistry, r as MongoCodecRegistry, t as MongoCodec } from "./index-CUkTUMkQ.mjs";
1
+ import { a as mongoCodec, i as MongoCodecTrait, n as MongoCodecInput, o as newMongoCodecRegistry, r as MongoCodecRegistry, t as MongoCodec } from "./index-DQD6JW4d.mjs";
2
2
  export { type MongoCodec, type MongoCodecInput, type MongoCodecRegistry, type MongoCodecTrait, mongoCodec, newMongoCodecRegistry };
@@ -7,6 +7,7 @@ import { crossRef } from "@prisma/orm-framework/contract/types";
7
7
  import { buildExecutionSection, computeProfileHash, computeStorageHash } from "@prisma/orm-framework/contract/hashing";
8
8
  import { errorEnumCodecNotInPackStack } from "@prisma/orm-framework/errors/control";
9
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
10
+ import { assembleDataTypes } from "@prisma/orm-framework/components/codec";
10
11
  import { bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, createFieldHelpersFromNamespace, enumType as enumType$1, isEnumTypeHandle, member, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
11
12
  import { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
12
13
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -90,7 +91,9 @@ function composeMongoAuthoringHelpers(family, target, extensions) {
90
91
  return blindCast({
91
92
  ...createEntityHelpersFromNamespace(entityNamespace, { ctx: {
92
93
  family: family.familyId,
93
- target: target.targetId
94
+ target: target.targetId,
95
+ codecLookup: extractCodecLookup(components),
96
+ dataTypeLookup: assembleDataTypes(components).lookup
94
97
  } }),
95
98
  field: composeMongoFieldHelpers(fieldNamespace),
96
99
  index,
@@ -770,4 +773,4 @@ function defineContract(definition, factory) {
770
773
  //#endregion
771
774
  export { field as a, member as c, valueObject as d, enumType$1 as i, model as l, buildBoundContract as n, index as o, defineContract as r, isEnumTypeHandle as s, bindEnumType as t, rel as u };
772
775
 
773
- //# sourceMappingURL=contract-builder-6fLDRNek.mjs.map
776
+ //# sourceMappingURL=contract-builder-BPLIHO77.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-builder-BPLIHO77.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/contract-builder.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { buildExecutionSection, computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, createFieldHelpersFromNamespace, enumType, isEnumTypeHandle, member, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { errorEnumCodecNotInPackStack } from \"@internal/errors/control\";\nimport { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, validateAuthoringHelperArguments } from \"@internal/framework-components/authoring\";\nimport { assembleDataTypes } from \"@internal/framework-components/codec\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { MongoCollectionOptions, MongoIndex, MongoStorage, applyPolymorphicScopeToMongoIndex, buildMongoNamespace } from \"@internal/mongo-contract\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/contract-builder.ts\n/**\n* Encode an authored enum value to its codec-encoded JSON form, mirroring SQL's `build-contract`.\n*\n* The codec is resolved by id from the lookup built from the contract's target pack, so a\n* non-identity `encodeJson` (permitted by the `mongoCodec` factory) is respected. A codecId the\n* lookup cannot resolve is a hard error: the enum uses a codec that is not part of the contract's\n* pack stack.\n*/\nfunction encodeEnumValue(value, codecId, codecLookup) {\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw errorEnumCodecNotInPackStack({ codecId });\n\treturn codec.encodeJson(value);\n}\nfunction stableStringify(value) {\n\tif (Array.isArray(value)) return `[${value.map(stableStringify).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${stableStringify(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nconst MONGO_RESERVED_HELPER_KEYS = [\n\t\"field\",\n\t\"index\",\n\t\"model\",\n\t\"rel\",\n\t\"valueObject\"\n];\nfunction buildFieldPreset(helperPath, descriptor, args) {\n\tvalidateAuthoringHelperArguments(helperPath, descriptor.args, args);\n\tconst preset = instantiateAuthoringFieldPreset(descriptor, args);\n\tconst unsupported = [\n\t\t...preset.default !== void 0 ? [\"default\"] : [],\n\t\t...preset.id ? [\"id\"] : [],\n\t\t...preset.unique ? [\"unique\"] : []\n\t];\n\tif (unsupported.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Field preset \"${helperPath}\" contributes ${unsupported.join(\", \")}, which Mongo does not support. Mongo supports presets that set a codec and execution defaults only.`, { meta: {\n\t\thelperPath,\n\t\treason: \"preset-contribution-unsupported\",\n\t\tcontribution: unsupported\n\t} });\n\treturn createFieldBuilder({\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: preset.descriptor.codecId,\n\t\t\t...normalizeOptionalTypeParams(preset.descriptor.typeParams)\n\t\t},\n\t\tnullable: preset.nullable,\n\t\tmany: false\n\t}, void 0, preset.executionDefaults);\n}\nfunction composeMongoFieldHelpers(fieldNamespace) {\n\tconst presetHelpers = createFieldHelpersFromNamespace(fieldNamespace, ({ helperPath, descriptor }) => (...args) => buildFieldPreset(helperPath, descriptor, args));\n\tconst collisions = Object.keys(presetHelpers).filter((name) => Object.hasOwn(field, name));\n\tif (collisions.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack-contributed field preset(s) ${collisions.map((c) => `\"${c}\"`).join(\", \")} collide with the built-in Mongo field helper(s) of the same name.`, { meta: {\n\t\treason: \"core-field-helper-collision\",\n\t\tcontribution: collisions\n\t} });\n\treturn {\n\t\t...field,\n\t\t...presetHelpers\n\t};\n}\nfunction composeMongoAuthoringHelpers(family, target, extensions) {\n\tconst components = [\n\t\tfamily,\n\t\ttarget,\n\t\t...Object.values(extensions ?? {})\n\t];\n\tconst entityNamespace = composePackAuthoringNamespace(components, \"entityTypes\");\n\tconst fieldNamespace = composePackAuthoringNamespace(components, \"field\");\n\tassertNoCrossRegistryCollisions({}, fieldNamespace, entityNamespace);\n\tconst collisions = Object.keys(entityNamespace).filter((name) => MONGO_RESERVED_HELPER_KEYS.includes(name));\n\tif (collisions.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack-contributed entity type(s) ${collisions.map((c) => `\"${c}\"`).join(\", \")} collide with the reserved built-in helper key(s) on the Mongo composed helpers surface. Reserved keys: ${MONGO_RESERVED_HELPER_KEYS.map((k) => `\"${k}\"`).join(\", \")}.`, { meta: {\n\t\treason: \"reserved-helper-key-collision\",\n\t\tcontribution: collisions\n\t} });\n\treturn blindCast({\n\t\t...createEntityHelpersFromNamespace(entityNamespace, { ctx: {\n\t\t\tfamily: family.familyId,\n\t\t\ttarget: target.targetId,\n\t\t\tcodecLookup: extractCodecLookup(components),\n\t\t\tdataTypeLookup: assembleDataTypes(components).lookup\n\t\t} }),\n\t\tfield: composeMongoFieldHelpers(fieldNamespace),\n\t\tindex,\n\t\tmodel,\n\t\trel,\n\t\tvalueObject\n\t});\n}\nfunction createFieldBuilder(spec, enumHandle, executionDefaults) {\n\tfunction many(options) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: spec.type,\n\t\t\tnullable: spec.nullable,\n\t\t\tmany: { elementNullable: options?.elementsNullable ?? false }\n\t\t}, enumHandle, executionDefaults);\n\t}\n\treturn {\n\t\t__kind: \"field\",\n\t\t...ifDefined(\"__executionDefaults\", executionDefaults),\n\t\t__type: spec.type,\n\t\t__nullable: spec.nullable,\n\t\t__many: spec.many,\n\t\t__enumHandle: blindCast(enumHandle),\n\t\toptional: blindCast(() => createFieldBuilder({\n\t\t\ttype: spec.type,\n\t\t\tnullable: true,\n\t\t\tmany: spec.many\n\t\t}, enumHandle, executionDefaults)),\n\t\tmany: blindCast(many)\n\t};\n}\nfunction normalizeOptionalTypeParams(typeParams) {\n\tif (!typeParams) return {};\n\treturn { typeParams };\n}\nfunction createScalarFieldBuilder(codecId, options) {\n\treturn createFieldBuilder({\n\t\ttype: blindCast({\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId,\n\t\t\t...normalizeOptionalTypeParams(options?.typeParams)\n\t\t}),\n\t\tnullable: false,\n\t\tmany: false\n\t});\n}\nconst field = {\n\tscalar: createScalarFieldBuilder,\n\tobjectId() {\n\t\treturn createScalarFieldBuilder(\"mongo/objectId@1\");\n\t},\n\tstring() {\n\t\treturn createScalarFieldBuilder(\"mongo/string@1\");\n\t},\n\tdouble() {\n\t\treturn createScalarFieldBuilder(\"mongo/double@1\");\n\t},\n\tint32() {\n\t\treturn createScalarFieldBuilder(\"mongo/int32@1\");\n\t},\n\tbool() {\n\t\treturn createScalarFieldBuilder(\"mongo/bool@1\");\n\t},\n\tdate() {\n\t\treturn createScalarFieldBuilder(\"mongo/date@1\");\n\t},\n\tint64() {\n\t\treturn createScalarFieldBuilder(\"mongo/int64@1\");\n\t},\n\tint64Number() {\n\t\treturn createScalarFieldBuilder(\"mongo/int64Number@1\");\n\t},\n\tdecimal128() {\n\t\treturn createScalarFieldBuilder(\"mongo/decimal128@1\");\n\t},\n\tbinary() {\n\t\treturn createScalarFieldBuilder(\"mongo/binary@1\");\n\t},\n\tjson() {\n\t\treturn createScalarFieldBuilder(\"mongo/json@1\");\n\t},\n\tbson() {\n\t\treturn createScalarFieldBuilder(\"mongo/bson@1\");\n\t},\n\tvector(options) {\n\t\treturn createScalarFieldBuilder(\"mongo/vector@1\", options);\n\t},\n\tvalueObject(valueObjectName) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: blindCast({\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: resolveValueObjectName(valueObjectName)\n\t\t\t}),\n\t\t\tnullable: false,\n\t\t\tmany: false\n\t\t});\n\t},\n\tnamedType(handle) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: blindCast({\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: handle.codecId\n\t\t\t}),\n\t\t\tnullable: false,\n\t\t\tmany: false\n\t\t}, handle);\n\t}\n};\nfunction index(fields, options) {\n\treturn {\n\t\tfields,\n\t\t...options ? { options } : {}\n\t};\n}\nfunction createFieldReference(modelName, fieldName) {\n\treturn {\n\t\t__kind: \"fieldRef\",\n\t\tmodelName,\n\t\tfieldName\n\t};\n}\nfunction isFieldReference(value) {\n\treturn typeof value === \"object\" && value !== null && \"__kind\" in value && value.__kind === \"fieldRef\";\n}\nfunction resolveModelName(value) {\n\treturn typeof value === \"string\" ? value : value.__name;\n}\nfunction resolveValueObjectName(value) {\n\treturn typeof value === \"string\" ? value : value.__name;\n}\nfunction normalizeStringList(value) {\n\treturn typeof value === \"string\" ? [value] : [...value];\n}\nfunction normalizeTargetField(targetModelName, value) {\n\tif (!isFieldReference(value)) return value;\n\tif (value.modelName !== targetModelName) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation target \"${targetModelName}\" cannot reference field \"${value.modelName}.${value.fieldName}\".`, { meta: {\n\t\tmodelName: targetModelName,\n\t\treason: \"cross-model-field-reference\",\n\t\treferencedModel: value.modelName,\n\t\treferencedField: value.fieldName\n\t} });\n\treturn value.fieldName;\n}\nfunction normalizeTargetFields(targetModelName, value) {\n\tif (typeof value === \"string\") return [value];\n\tif (isFieldReference(value)) return [normalizeTargetField(targetModelName, value)];\n\treturn value.map((entry) => normalizeTargetField(targetModelName, entry));\n}\nfunction createRelationBuilder(spec) {\n\treturn {\n\t\t__kind: \"relation\",\n\t\t__to: spec.to,\n\t\t__cardinality: spec.cardinality,\n\t\t__on: spec.on,\n\t\t__nullable: spec.nullable\n\t};\n}\nfunction createReferenceRelationBuilder(target, cardinality, options, nullable) {\n\tconst targetModelName = resolveModelName(target);\n\treturn createRelationBuilder({\n\t\tto: blindCast(targetModelName),\n\t\tcardinality,\n\t\ton: {\n\t\t\tlocalFields: blindCast(normalizeStringList(options.from)),\n\t\t\ttargetFields: blindCast(normalizeTargetFields(targetModelName, options.to))\n\t\t},\n\t\tnullable\n\t});\n}\nfunction createEmbedRelationBuilder(target, cardinality) {\n\treturn createRelationBuilder({\n\t\tto: blindCast(resolveModelName(target)),\n\t\tcardinality,\n\t\ton: void 0,\n\t\tnullable: void 0\n\t});\n}\nfunction hasOne(target, options) {\n\tif (!options) return createEmbedRelationBuilder(target, \"1:1\");\n\treturn createReferenceRelationBuilder(target, \"1:1\", options, true);\n}\nfunction hasMany(target, options) {\n\tif (!options) return createEmbedRelationBuilder(target, \"1:N\");\n\treturn createReferenceRelationBuilder(target, \"1:N\", options, void 0);\n}\nfunction belongsTo(target, options) {\n\treturn createReferenceRelationBuilder(target, \"N:1\", options, options.optional);\n}\nconst rel = {\n\tbelongsTo,\n\thasMany,\n\thasOne\n};\nfunction valueObject(name, input) {\n\treturn {\n\t\t__kind: \"valueObject\",\n\t\t__name: name,\n\t\t__fields: input.fields\n\t};\n}\nfunction model(name, input) {\n\treturn {\n\t\t__kind: \"model\",\n\t\t__name: name,\n\t\t__fields: input.fields,\n\t\t__relations: blindCast(input.relations ?? {}),\n\t\t__indexes: input.indexes,\n\t\t__collectionOptions: input.collectionOptions,\n\t\t__controlPolicy: input.controlPolicy,\n\t\t__collection: blindCast(input.collection),\n\t\t__owner: blindCast(input.owner ? resolveModelName(input.owner) : void 0),\n\t\t__base: blindCast(input.base ? resolveModelName(input.base) : void 0),\n\t\t__storageRelations: blindCast(input.storageRelations),\n\t\t__discriminator: blindCast(input.discriminator ? { field: input.discriminator.field } : void 0),\n\t\t__variants: blindCast(input.discriminator?.variants),\n\t\tref(fieldName) {\n\t\t\treturn createFieldReference(name, fieldName);\n\t\t}\n\t};\n}\nfunction validateTargetPackRef(family, target) {\n\tif (family.familyId !== \"mongo\") throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `defineContract only accepts Mongo family packs. Received family \"${family.familyId}\".`, { meta: {\n\t\tpackId: family.id,\n\t\tpackFamilyId: family.familyId,\n\t\tcontractFamilyId: \"mongo\"\n\t} });\n\tif (target.familyId !== family.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `target pack \"${target.id}\" targets family \"${target.familyId}\" but contract family is \"${family.familyId}\".`, { meta: {\n\t\tpackId: target.id,\n\t\tpackFamilyId: target.familyId,\n\t\tcontractFamilyId: family.familyId\n\t} });\n}\nfunction validateExtensionPackRefs(target, extensions) {\n\tif (!extensions) return;\n\tfor (const packRef of Object.values(extensions)) {\n\t\tif (packRef.kind !== \"extension\") throw contractError(\"CONTRACT.PACK_REF_INVALID\", `defineContract only accepts extension pack refs in extensions. Received kind \"${packRef.kind}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tkind: packRef.kind\n\t\t} });\n\t\tif (packRef.familyId !== target.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `extension pack \"${packRef.id}\" targets family \"${packRef.familyId}\" but contract target family is \"${target.familyId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackFamilyId: packRef.familyId,\n\t\t\tcontractFamilyId: target.familyId\n\t\t} });\n\t\tif (packRef.targetId && packRef.targetId !== target.targetId) throw contractError(\"CONTRACT.PACK_TARGET_MISMATCH\", `extension pack \"${packRef.id}\" targets \"${packRef.targetId}\" but contract target is \"${target.targetId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackTargetId: packRef.targetId,\n\t\t\tcontractTargetId: target.targetId\n\t\t} });\n\t}\n}\nfunction isContractScaffold(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn \"family\" in value && \"target\" in value;\n}\nfunction buildContractField(builder) {\n\tconst valueSet = builder.__enumHandle ? {\n\t\tplane: \"domain\",\n\t\tentityKind: \"enum\",\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityName: builder.__enumHandle.enumName\n\t} : void 0;\n\treturn {\n\t\ttype: builder.__type,\n\t\tnullable: builder.__nullable,\n\t\tmany: builder.__many,\n\t\t...ifDefined(\"valueSet\", valueSet)\n\t};\n}\nfunction buildFields(fields) {\n\tconst builtFields = {};\n\tfor (const [fieldName, fieldBuilder] of Object.entries(fields)) builtFields[fieldName] = buildContractField(fieldBuilder);\n\treturn builtFields;\n}\nfunction toOneRelationNullable(modelName, relationName, relationBuilder, on, fields) {\n\tconst location = `Relation \"${modelName}.${relationName}\"`;\n\tconst ownsForeignKey = relationBuilder.__cardinality !== \"1:1\";\n\tconst localFields = ownsForeignKey ? on.localFields.map((fieldName) => {\n\t\tconst localField = fields[fieldName];\n\t\tif (localField === void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", `${location} joins on local field \"${fieldName}\", which model \"${modelName}\" does not declare`, { meta: {\n\t\t\tmodelName,\n\t\t\trelationName,\n\t\t\tfieldName,\n\t\t\treason: \"local-field-unknown\"\n\t\t} });\n\t\treturn localField;\n\t}) : [];\n\tconst { nullable, contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relationBuilder.__nullable,\n\t\tlocalFieldNullability: localFields.map((localField) => localField.__nullable === true),\n\t\townsReference: ownsForeignKey\n\t});\n\tif (contradiction !== void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", !ownsForeignKey ? `${location} is required but does not own the foreign key, so nothing in storage guarantees the related document exists` : contradiction === \"declared-optional\" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`, { meta: {\n\t\tmodelName,\n\t\trelationName,\n\t\treason: \"to-one-nullability-mismatch\"\n\t} });\n\treturn nullable;\n}\nfunction buildRelation(modelName, relationName, relationBuilder, fields) {\n\tconst to = crossRef(relationBuilder.__to, UNBOUND_NAMESPACE_ID);\n\tconst on = relationBuilder.__on;\n\tif (on === void 0) return {\n\t\tto,\n\t\tcardinality: relationBuilder.__cardinality\n\t};\n\tif (relationBuilder.__cardinality === \"1:N\") return {\n\t\tto,\n\t\tcardinality: \"1:N\",\n\t\ton\n\t};\n\treturn {\n\t\tto,\n\t\tcardinality: relationBuilder.__cardinality,\n\t\tnullable: toOneRelationNullable(modelName, relationName, relationBuilder, on, fields),\n\t\ton\n\t};\n}\nfunction buildRelations(modelName, relations, fields) {\n\tconst builtRelations = {};\n\tfor (const [relationName, relationBuilder] of Object.entries(relations)) builtRelations[relationName] = buildRelation(modelName, relationName, relationBuilder, fields);\n\treturn builtRelations;\n}\nfunction buildValueObjects(valueObjects) {\n\tconst builtValueObjects = {};\n\tfor (const valueObjectBuilder of Object.values(valueObjects ?? {})) {\n\t\tif (valueObjectBuilder.__name in builtValueObjects) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate value object name \"${valueObjectBuilder.__name}\" in defineContract().`, { meta: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: valueObjectBuilder.__name\n\t\t} });\n\t\tbuiltValueObjects[valueObjectBuilder.__name] = { fields: buildFields(valueObjectBuilder.__fields) };\n\t}\n\treturn builtValueObjects;\n}\nfunction buildModels(models) {\n\tconst builtModels = {};\n\tfor (const modelBuilder of Object.values(models ?? {})) {\n\t\tif (modelBuilder.__name in builtModels) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate model name \"${modelBuilder.__name}\" in defineContract().`, { meta: {\n\t\t\tkind: \"model\",\n\t\t\tname: modelBuilder.__name\n\t\t} });\n\t\tconst storage = {\n\t\t\t...modelBuilder.__collection ? { collection: modelBuilder.__collection } : {},\n\t\t\t...modelBuilder.__storageRelations ? { relations: modelBuilder.__storageRelations } : {}\n\t\t};\n\t\tbuiltModels[modelBuilder.__name] = {\n\t\t\tfields: buildFields(modelBuilder.__fields),\n\t\t\trelations: buildRelations(modelBuilder.__name, modelBuilder.__relations, modelBuilder.__fields),\n\t\t\tstorage,\n\t\t\t...modelBuilder.__owner ? { owner: modelBuilder.__owner } : {},\n\t\t\t...modelBuilder.__base ? { base: crossRef(modelBuilder.__base, UNBOUND_NAMESPACE_ID) } : {},\n\t\t\t...modelBuilder.__discriminator ? { discriminator: modelBuilder.__discriminator } : {},\n\t\t\t...modelBuilder.__variants ? { variants: modelBuilder.__variants } : {}\n\t\t};\n\t}\n\treturn builtModels;\n}\nfunction deriveRoots(models) {\n\tconst roots = {};\n\tfor (const modelBuilder of Object.values(models ?? {})) {\n\t\tif (!modelBuilder.__collection || modelBuilder.__owner || modelBuilder.__base) continue;\n\t\troots[modelBuilder.__collection] = crossRef(modelBuilder.__name, UNBOUND_NAMESPACE_ID);\n\t}\n\treturn roots;\n}\nfunction normalizeRoots(roots) {\n\tconst normalizedRoots = {};\n\tfor (const [rootName, rootValue] of Object.entries(roots ?? {})) normalizedRoots[rootName] = crossRef(resolveModelName(rootValue), UNBOUND_NAMESPACE_ID);\n\treturn normalizedRoots;\n}\nfunction toStorageIndex(index) {\n\tconst input = { keys: Object.entries(index.fields).map(([field, direction]) => ({\n\t\tfield,\n\t\tdirection\n\t})) };\n\tif (index.options) {\n\t\tfor (const [key, value] of Object.entries(index.options)) if (value !== void 0) input[key] = value;\n\t}\n\treturn new MongoIndex(blindCast(input));\n}\nfunction toStorageCollectionOptions(opts) {\n\treturn new MongoCollectionOptions({\n\t\t...opts.capped ? { capped: {\n\t\t\tsize: opts.size ?? 0,\n\t\t\t...opts.max != null && { max: opts.max }\n\t\t} } : {},\n\t\t...ifDefined(\"storageEngine\", opts.storageEngine),\n\t\t...ifDefined(\"indexOptionDefaults\", opts.indexOptionDefaults),\n\t\t...ifDefined(\"collation\", opts.collation),\n\t\t...ifDefined(\"timeseries\", opts.timeseries),\n\t\t...opts.clusteredIndex !== void 0 && { clusteredIndex: opts.clusteredIndex.name !== void 0 ? { name: opts.clusteredIndex.name } : {} },\n\t\t...ifDefined(\"expireAfterSeconds\", opts.expireAfterSeconds),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages)\n\t});\n}\nfunction findMissingIndexField(index, modelFields) {\n\tfor (const fieldName of Object.keys(index.fields)) {\n\t\tconst wildcardMatch = fieldName.match(/^(.+)\\.\\$\\*\\*$/);\n\t\tconst lookupName = wildcardMatch ? wildcardMatch[1] : fieldName;\n\t\tif (lookupName === void 0 || lookupName.length === 0) continue;\n\t\tif (lookupName === \"$**\") continue;\n\t\tif (!Object.hasOwn(modelFields, lookupName)) return lookupName;\n\t}\n}\nfunction resolveVariantScope(modelBuilder, modelsByName) {\n\tif (!modelBuilder.__base) return void 0;\n\tconst baseBuilder = modelsByName[modelBuilder.__base];\n\tif (!baseBuilder) return void 0;\n\tconst discriminatorField = baseBuilder.__discriminator?.field;\n\tconst variantValue = baseBuilder.__variants?.[modelBuilder.__name]?.value;\n\tif (!discriminatorField || variantValue === void 0) return void 0;\n\treturn {\n\t\tdiscriminatorField,\n\t\tdiscriminatorValue: variantValue\n\t};\n}\nfunction scopeVariantIndex(storageIndex, scope, variantName, authoredIndex) {\n\tconst result = applyPolymorphicScopeToMongoIndex(storageIndex, scope);\n\tif (result.kind === \"conflict\") {\n\t\tconst indexLabel = authoredIndex ? canonicalStringify(authoredIndex) : \"<unknown>\";\n\t\tthrow contractError(\"CONTRACT.INDEX_INVALID\", `Variant model \"${variantName}\" index ${indexLabel} conflicts with discriminator scope: ${result.reason}`, { meta: {\n\t\t\tvariantName,\n\t\t\tindexLabel,\n\t\t\treason: result.reason\n\t\t} });\n\t}\n\treturn result.index;\n}\nfunction buildCollections(models) {\n\tconst intermediate = {};\n\tconst declaredIndexOwners = /* @__PURE__ */ new Map();\n\tconst modelMap = models ?? {};\n\tconst modelsByName = {};\n\tfor (const builder of Object.values(modelMap)) modelsByName[builder.__name] = builder;\n\tfor (const modelBuilder of Object.values(modelMap)) {\n\t\tif (!modelBuilder.__collection) {\n\t\t\tif (modelBuilder.__indexes && modelBuilder.__indexes.length > 0) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines indexes but has no collection to attach them to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"indexes-without-collection\"\n\t\t\t} });\n\t\t\tif (modelBuilder.__collectionOptions) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines collectionOptions but has no collection to attach them to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"collectionOptions-without-collection\"\n\t\t\t} });\n\t\t\tif (modelBuilder.__controlPolicy) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines controlPolicy but has no collection to attach it to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"controlPolicy-without-collection\"\n\t\t\t} });\n\t\t\tcontinue;\n\t\t}\n\t\tconst existingCollection = intermediate[modelBuilder.__collection] ?? {};\n\t\tconst existingIndexes = existingCollection.indexes ?? [];\n\t\tif (existingCollection.options && modelBuilder.__collectionOptions) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Collection \"${modelBuilder.__collection}\" has collectionOptions declared by multiple models. Author collectionOptions on a single model per collection.`, { meta: {\n\t\t\tmodelName: modelBuilder.__name,\n\t\t\tcollection: modelBuilder.__collection,\n\t\t\treason: \"collectionOptions-declared-by-multiple-models\"\n\t\t} });\n\t\tif (existingCollection.control !== void 0 && modelBuilder.__controlPolicy) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Collection \"${modelBuilder.__collection}\" has controlPolicy declared by multiple models. Author controlPolicy on a single model per collection.`, { meta: {\n\t\t\tmodelName: modelBuilder.__name,\n\t\t\tcollection: modelBuilder.__collection,\n\t\t\treason: \"controlPolicy-declared-by-multiple-models\"\n\t\t} });\n\t\tfor (const collectionIndex of modelBuilder.__indexes ?? []) {\n\t\t\tconst missingField = findMissingIndexField(collectionIndex, modelBuilder.__fields);\n\t\t\tif (missingField !== void 0) {\n\t\t\t\tconst indexSignature = canonicalStringify(collectionIndex);\n\t\t\t\tthrow contractError(\"CONTRACT.FIELD_UNKNOWN\", `Model \"${modelBuilder.__name}\" index ${indexSignature} references unknown field \"${missingField}\".`, { meta: {\n\t\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\t\tfieldName: missingField,\n\t\t\t\t\tindexSignature\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tconst polymorphicScope = resolveVariantScope(modelBuilder, modelsByName);\n\t\tconst rawStorageIndexes = (modelBuilder.__indexes ?? []).map(toStorageIndex);\n\t\tconst storageIndexes = polymorphicScope ? rawStorageIndexes.map((idx, i) => scopeVariantIndex(idx, polymorphicScope, modelBuilder.__name, modelBuilder.__indexes?.[i])) : rawStorageIndexes;\n\t\tfor (let i = 0; i < storageIndexes.length; i++) {\n\t\t\tconst storageIndex = storageIndexes[i];\n\t\t\tif (storageIndex === void 0) continue;\n\t\t\tconst indexSignature = stableStringify(storageIndex);\n\t\t\tconst collectionIndexKey = `${modelBuilder.__collection}:${indexSignature}`;\n\t\t\tconst firstOwner = declaredIndexOwners.get(collectionIndexKey);\n\t\t\tif (firstOwner) {\n\t\t\t\tconst authoredIndex = modelBuilder.__indexes?.[i];\n\t\t\t\tconst reportedSignature = authoredIndex ? canonicalStringify(authoredIndex) : indexSignature;\n\t\t\t\tthrow contractError(\"CONTRACT.NAME_DUPLICATE\", `Collection \"${modelBuilder.__collection}\" defines duplicate index ${reportedSignature}. First declared on model \"${firstOwner}\" and duplicated on model \"${modelBuilder.__name}\".`, { meta: {\n\t\t\t\t\tkind: \"index\",\n\t\t\t\t\tname: reportedSignature,\n\t\t\t\t\tcollection: modelBuilder.__collection,\n\t\t\t\t\tfirst: firstOwner,\n\t\t\t\t\tsecond: modelBuilder.__name\n\t\t\t\t} });\n\t\t\t}\n\t\t\tdeclaredIndexOwners.set(collectionIndexKey, modelBuilder.__name);\n\t\t}\n\t\tconst storageOptions = modelBuilder.__collectionOptions ? toStorageCollectionOptions(modelBuilder.__collectionOptions) : void 0;\n\t\tconst controlPatch = modelBuilder.__controlPolicy !== void 0 ? { control: modelBuilder.__controlPolicy } : {};\n\t\tintermediate[modelBuilder.__collection] = storageIndexes.length > 0 ? {\n\t\t\t...existingCollection,\n\t\t\tindexes: [...existingIndexes, ...storageIndexes],\n\t\t\t...storageOptions ? { options: storageOptions } : {},\n\t\t\t...controlPatch\n\t\t} : storageOptions ? {\n\t\t\t...existingCollection,\n\t\t\toptions: storageOptions,\n\t\t\t...controlPatch\n\t\t} : Object.keys(controlPatch).length > 0 ? {\n\t\t\t...existingCollection,\n\t\t\t...controlPatch\n\t\t} : existingCollection;\n\t}\n\treturn intermediate;\n}\nfunction executionDefaultError(modelName, fieldName, reason, message) {\n\treturn contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${modelName}.${fieldName}\" ${message}`, { meta: {\n\t\tmodelName,\n\t\tfieldName,\n\t\treason\n\t} });\n}\nfunction hasExecutionDefaults(fieldBuilder) {\n\tconst phases = fieldBuilder.__executionDefaults;\n\treturn phases?.onCreate !== void 0 || phases?.onUpdate !== void 0;\n}\nfunction assertNoValueObjectExecutionDefaults(valueObjects) {\n\tfor (const valueObjectBuilder of Object.values(valueObjects ?? {})) for (const [fieldName, fieldBuilder] of Object.entries(valueObjectBuilder.__fields)) if (hasExecutionDefaults(fieldBuilder)) throw executionDefaultError(valueObjectBuilder.__name, fieldName, \"executionDefaults-on-value-object\", \"has executionDefaults, but it belongs to a value object. Generated values are only supported on model fields.\");\n}\nfunction buildExecutionDefaults(models) {\n\tconst modelBuilders = Object.values(models ?? {});\n\tconst collectionByModelName = new Map(modelBuilders.map((modelBuilder) => [modelBuilder.__name, modelBuilder.__collection]));\n\tconst byRef = /* @__PURE__ */ new Map();\n\tconst defaults = [];\n\tfor (const modelBuilder of modelBuilders) for (const [fieldName, fieldBuilder] of Object.entries(modelBuilder.__fields)) {\n\t\tconst phases = fieldBuilder.__executionDefaults;\n\t\tif (!phases || !hasExecutionDefaults(fieldBuilder)) continue;\n\t\tconst modelName = modelBuilder.__name;\n\t\tif (fieldBuilder.__nullable) throw executionDefaultError(modelName, fieldName, \"nullable-with-executionDefaults\", \"is filled on write by a preset such as temporal.createdAt(), so it cannot be optional; remove .optional().\");\n\t\tif (fieldBuilder.__many) throw executionDefaultError(modelName, fieldName, \"many-with-executionDefaults\", \"is filled on write by a preset such as temporal.createdAt(), so it cannot be a list; remove .many().\");\n\t\tif (modelBuilder.__base !== void 0) {\n\t\t\tconst collection = modelBuilder.__collection ?? collectionByModelName.get(modelBuilder.__base);\n\t\t\tthrow executionDefaultError(modelName, fieldName, \"executionDefaults-on-variant\", `has executionDefaults, but \"${modelName}\" is a variant of \"${modelBuilder.__base}\". Execution defaults apply to every document in collection \"${collection}\", so declare them on the base model.`);\n\t\t}\n\t\tconst entry = modelBuilder.__collection;\n\t\tif (entry === void 0) throw executionDefaultError(modelName, fieldName, \"executionDefaults-without-collection\", \"has executionDefaults, but its model has no collection. Generated values are only supported on fields of a model stored in a collection.\");\n\t\tconst refKey = JSON.stringify([entry, fieldName]);\n\t\tconst phasesKey = canonicalStringify(phases);\n\t\tconst existing = byRef.get(refKey);\n\t\tif (existing !== void 0) {\n\t\t\tif (existing.phasesKey !== phasesKey) throw executionDefaultError(modelName, fieldName, \"executionDefaults-conflict\", `has different executionDefaults than \"${existing.modelName}.${fieldName}\", which is stored in the same collection \"${entry}\". Use the same executionDefaults on both models.`);\n\t\t\tcontinue;\n\t\t}\n\t\tbyRef.set(refKey, {\n\t\t\tmodelName,\n\t\t\tphasesKey\n\t\t});\n\t\tdefaults.push({\n\t\t\tref: {\n\t\t\t\tnamespace: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentry,\n\t\t\t\tfield: fieldName\n\t\t\t},\n\t\t\t...phases\n\t\t});\n\t}\n\treturn defaults;\n}\nfunction buildContractFromDefinition(definition) {\n\tvalidateTargetPackRef(definition.family, definition.target);\n\tvalidateExtensionPackRefs(definition.target, definition.extensions);\n\tconst builtModels = buildModels(definition.models);\n\tconst builtValueObjects = buildValueObjects(definition.valueObjects);\n\tconst roots = definition.roots ? normalizeRoots(definition.roots) : deriveRoots(definition.models);\n\tconst capabilities = {};\n\tconst collections = buildCollections(definition.models);\n\tassertNoValueObjectExecutionDefaults(definition.valueObjects);\n\tconst execution = buildExecutionSection({\n\t\ttarget: definition.target.targetId,\n\t\ttargetFamily: definition.family.familyId,\n\t\tdefaults: buildExecutionDefaults(definition.models)\n\t});\n\tconst codecLookup = extractCodecLookup([definition.target]);\n\tconst storageValueSets = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) storageValueSets[enumName] = {\n\t\tkind: \"valueSet\",\n\t\tvalues: handle.values.map((v) => encodeEnumValue(v, handle.codecId, codecLookup))\n\t};\n\tconst unboundNamespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: collections,\n\t\t\t...ifDefined(\"valueSet\", Object.keys(storageValueSets).length > 0 ? storageValueSets : void 0)\n\t\t}\n\t});\n\tconst storageBody = { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tcollections: unboundNamespace.entries.collection,\n\t\t...ifDefined(\"valueSet\", unboundNamespace.entries.valueSet)\n\t} } };\n\tconst storage = new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget: definition.target.targetId,\n\t\t\ttargetFamily: definition.family.familyId,\n\t\t\tstorage: storageBody,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: unboundNamespace }\n\t});\n\tconst builtEnums = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tif (enumName !== handle.enumName) throw contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${enumName}\" must match enumType name \"${handle.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tdeclaredKey: enumName,\n\t\t\treason: \"declaration-key-mismatch\"\n\t\t} });\n\t\tbuiltEnums[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: encodeEnumValue(m.value, handle.codecId, codecLookup)\n\t\t\t}))\n\t\t};\n\t}\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\tfor (const [modelName, modelBuilder] of Object.entries(definition.models ?? {})) for (const [fieldName, fieldBuilder] of Object.entries(modelBuilder.__fields)) {\n\t\tconst handle = fieldBuilder.__enumHandle;\n\t\tif (handle && !(handle.enumName in builtEnums)) throw contractError(\"CONTRACT.ENUM_UNKNOWN\", `Model \"${modelName}\" field \"${fieldName}\" references enum \"${handle.enumName}\" which is not declared in defineContract({ enums: { ... } }).`, { meta: {\n\t\t\tmodelName,\n\t\t\tfieldName,\n\t\t\tenumName: handle.enumName\n\t\t} });\n\t}\n\treturn blindCast({\n\t\ttarget: definition.target.targetId,\n\t\ttargetFamily: definition.family.familyId,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\troots,\n\t\tdomain: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\tmodels: builtModels,\n\t\t\t...Object.keys(builtValueObjects).length > 0 ? { valueObjects: builtValueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\tcapabilities,\n\t\textensions: definition.extensions ?? {},\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget: definition.target.targetId,\n\t\t\ttargetFamily: definition.family.familyId,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {},\n\t\t...ifDefined(\"execution\", execution)\n\t});\n}\n/** Implementation. */\nfunction buildBoundContract(family, target, definition, factory) {\n\tconst full = {\n\t\t...definition,\n\t\tfamily,\n\t\ttarget\n\t};\n\tif (factory !== void 0) {\n\t\tconst built = factory(composeMongoAuthoringHelpers(family, target, definition.extensions));\n\t\treturn buildContractFromDefinition({\n\t\t\t...full,\n\t\t\t...ifDefined(\"models\", built.models),\n\t\t\t...ifDefined(\"valueObjects\", built.valueObjects),\n\t\t\t...ifDefined(\"roots\", built.roots)\n\t\t});\n\t}\n\treturn buildContractFromDefinition(full);\n}\nfunction defineContract(definition, factory) {\n\tif (!isContractScaffold(definition)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"defineContract expects a contract definition object. Define your contract with defineContract({ family, target, models, ... }).\");\n\tif (factory !== void 0) return buildBoundContract(definition.family, definition.target, definition, factory);\n\treturn buildBoundContract(definition.family, definition.target, definition);\n}\n//#endregion\nexport { bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,gBAAgB,OAAO,SAAS,aAAa;CACrD,MAAM,QAAQ,YAAY,IAAI,OAAO;CACrC,IAAI,CAAC,OAAO,MAAM,6BAA6B,EAAE,QAAQ,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AAC3E"}
@@ -1,6 +1,6 @@
1
1
  import { o as MongoIndex } from "./entity-kinds-BALdQ2VF-CBK7BhPo.mjs";
2
2
  import { f as encodeMongoValueSets, l as buildMongoStorage, m as validateMongoStorage } from "./dist-D3mFP5N3.mjs";
3
- import { o as pairMongoBackRelations } from "./interpreter-DOhkU5y3-XhgQiAGq.mjs";
3
+ import { o as pairMongoBackRelations } from "./interpreter-D3cYmZTX-TygWz2iq.mjs";
4
4
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
5
5
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
6
6
  import { crossRef } from "@prisma/orm-framework/contract/types";
@@ -385,6 +385,7 @@ function buildEnum(located, input, diagnostics) {
385
385
  family: input.binding.target.familyId,
386
386
  target: input.binding.target.targetId,
387
387
  codecLookup: input.codecLookup,
388
+ dataTypeLookup: input.dataTypeLookup,
388
389
  sourceId,
389
390
  enumInferenceCodecs: {
390
391
  text: input.binding.scalarCodecIds.String,
@@ -1131,7 +1132,8 @@ function prisma6Contract(schemaPath, options) {
1131
1132
  seedDiagnostics,
1132
1133
  binding: options.binding,
1133
1134
  authoringContributions: context.authoringContributions,
1134
- codecLookup: context.codecLookup
1135
+ codecLookup: context.codecLookup,
1136
+ dataTypeLookup: context.dataTypeLookup
1135
1137
  });
1136
1138
  if (!interpreted.ok) return interpreted;
1137
1139
  contract = applySpecifierDefaultControlPolicy(interpreted.value, options.defaultControlPolicy);