@prisma/orm-family-mongo 8.0.0-rc.22-dev.12 → 8.0.0-rc.22-dev.13

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 (122) hide show
  1. package/dist/{authoring-entity-types-J_patbMZ-C509nMfw.mjs → authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs} +3 -2
  2. package/dist/authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs.map +1 -0
  3. package/dist/config-types-D4SnQaTy.mjs.map +1 -1
  4. package/dist/{contract-builder-Cr65NhJk.mjs → contract-builder-BUa0Oz34.mjs} +105 -10
  5. package/dist/contract-builder-BUa0Oz34.mjs.map +1 -0
  6. package/dist/{contract-builder-DurxXsaj.d.mts → contract-builder-x1bl1wIr.d.mts} +20 -5
  7. package/dist/contract-builder-x1bl1wIr.d.mts.map +1 -0
  8. package/dist/contract-prisma6__provider.mjs +83 -8
  9. package/dist/contract-prisma6__provider.mjs.map +1 -1
  10. package/dist/contract-psl.d.mts +6 -1
  11. package/dist/contract-psl.d.mts.map +1 -1
  12. package/dist/contract-psl.mjs +1 -1
  13. package/dist/contract-psl__provider.mjs +1 -1
  14. package/dist/contract-psl__provider.mjs.map +1 -1
  15. package/dist/contract-ts.d.mts +2 -2
  16. package/dist/contract-ts.mjs +2 -2
  17. package/dist/contract-ts__contract-builder.d.mts +2 -2
  18. package/dist/contract-ts__contract-builder.mjs +2 -2
  19. package/dist/contract.d.mts +3 -3
  20. package/dist/contract.mjs +3 -3
  21. package/dist/contract__entity-kinds.d.mts +1 -1
  22. package/dist/contract__entity-kinds.mjs +1 -1
  23. package/dist/{control-0YmjHGNw.d.mts → control-CJLG6g2G.d.mts} +5 -6
  24. package/dist/{control-0YmjHGNw.d.mts.map → control-CJLG6g2G.d.mts.map} +1 -1
  25. package/dist/{control-DMkn0GMN.d.mts → control-CvUovwse.d.mts} +6 -6
  26. package/dist/{control-DMkn0GMN.d.mts.map → control-CvUovwse.d.mts.map} +1 -1
  27. package/dist/{control-DzA3bjX-.mjs → control-P83KyI0L.mjs} +8 -7
  28. package/dist/control-P83KyI0L.mjs.map +1 -0
  29. package/dist/{control-adapter-BheElqfe-iFCyJUfP.d.mts → control-adapter-BheElqfe-DxUxWoeq.d.mts} +4 -4
  30. package/dist/{control-adapter-BheElqfe-iFCyJUfP.d.mts.map → control-adapter-BheElqfe-DxUxWoeq.d.mts.map} +1 -1
  31. package/dist/control-adapter-DfRH_2nl.d.mts +1 -0
  32. package/dist/{control-BQMBG11d.mjs → control-ywVRqK1i.mjs} +4 -7
  33. package/dist/{control-BQMBG11d.mjs.map → control-ywVRqK1i.mjs.map} +1 -1
  34. package/dist/{dist-BbJV26vR.mjs → dist-BXMjjRsI.mjs} +2 -2
  35. package/dist/{dist-BbJV26vR.mjs.map → dist-BXMjjRsI.mjs.map} +1 -1
  36. package/dist/dist-BhDqnAiz.mjs.map +1 -1
  37. package/dist/{dist-B-Ml8wpa.mjs → dist-By5gbTEW.mjs} +10 -5
  38. package/dist/dist-By5gbTEW.mjs.map +1 -0
  39. package/dist/{entity-kinds-BI-PWX8L-DRxc2Flr.mjs → entity-kinds-D5mTQzuZ-BY1vGgFk.mjs} +6 -2
  40. package/dist/entity-kinds-D5mTQzuZ-BY1vGgFk.mjs.map +1 -0
  41. package/dist/{execution-CGierEKK.d.mts → execution-B3Fogex9.d.mts} +3 -3
  42. package/dist/{execution-CGierEKK.d.mts.map → execution-B3Fogex9.d.mts.map} +1 -1
  43. package/dist/{exports-B2tu3O-g.mjs → exports-BRIh38XT.mjs} +9 -3
  44. package/dist/exports-BRIh38XT.mjs.map +1 -0
  45. package/dist/family.d.mts +9 -9
  46. package/dist/family.mjs +8 -8
  47. package/dist/family__control-adapter.d.mts +2 -2
  48. package/dist/family__control.d.mts +1 -1
  49. package/dist/family__control.mjs +2 -2
  50. package/dist/family__ir.d.mts +2 -2
  51. package/dist/family__ir.mjs +3 -3
  52. package/dist/family__migration.d.mts +1 -1
  53. package/dist/family__migration.mjs +1 -1
  54. package/dist/family__pack.mjs +2 -2
  55. package/dist/family__pack.mjs.map +1 -1
  56. package/dist/family__runtime.d.mts +2 -2
  57. package/dist/family__runtime.mjs +1 -1
  58. package/dist/family__schema-verify.d.mts +1 -1
  59. package/dist/family__schema-verify.mjs +1 -1
  60. package/dist/{field-accessor-CqKt9hxI-AngsT5mI.d.mts → field-accessor-CqKt9hxI-CI_pUKZN.d.mts} +4 -4
  61. package/dist/{field-accessor-CqKt9hxI-AngsT5mI.d.mts.map → field-accessor-CqKt9hxI-CI_pUKZN.d.mts.map} +1 -1
  62. package/dist/{index-DXhwK4nr.d.mts → index-BK3HyX9U.d.mts} +4 -4
  63. package/dist/{index-DXhwK4nr.d.mts.map → index-BK3HyX9U.d.mts.map} +1 -1
  64. package/dist/{index-TNRD-MRI.d.mts → index-BrDXnKtf.d.mts} +4 -4
  65. package/dist/{index-TNRD-MRI.d.mts.map → index-BrDXnKtf.d.mts.map} +1 -1
  66. package/dist/{index-D21Pb9vL.d.mts → index-D6MtleDl.d.mts} +11 -4
  67. package/dist/index-D6MtleDl.d.mts.map +1 -0
  68. package/dist/{index-DcQFfwkK.d.mts → index-JpsaTpKi.d.mts} +9 -5
  69. package/dist/{index-DcQFfwkK.d.mts.map → index-JpsaTpKi.d.mts.map} +1 -1
  70. package/dist/{interpreter-BX0gy2Yu-Byy8LdrE.mjs → interpreter-DpW_wEiP-Clp24cvz.mjs} +70 -17
  71. package/dist/interpreter-DpW_wEiP-Clp24cvz.mjs.map +1 -0
  72. package/dist/{ir-BGD9W6Cu.mjs → ir-Bm8xm1eu.mjs} +2 -2
  73. package/dist/{ir-BGD9W6Cu.mjs.map → ir-Bm8xm1eu.mjs.map} +1 -1
  74. package/dist/{ir-DH1ciHWj.d.mts → ir-BzKq60Lv.d.mts} +4 -4
  75. package/dist/{ir-DH1ciHWj.d.mts.map → ir-BzKq60Lv.d.mts.map} +1 -1
  76. package/dist/lowering.d.mts +1 -1
  77. package/dist/{migration-DDXXsPCK.mjs → migration-LHRzvIrb.mjs} +2 -2
  78. package/dist/{migration-DDXXsPCK.mjs.map → migration-LHRzvIrb.mjs.map} +1 -1
  79. package/dist/{migration-fjq98toS.d.mts → migration-VHZaMXZ5.d.mts} +5 -5
  80. package/dist/{migration-fjq98toS.d.mts.map → migration-VHZaMXZ5.d.mts.map} +1 -1
  81. package/dist/{mongo-contract-serializer-BBknnHWy-BYVYfFCj.mjs → mongo-contract-serializer-BBknnHWy-DAzm09wB.mjs} +3 -3
  82. package/dist/{mongo-contract-serializer-BBknnHWy-BYVYfFCj.mjs.map → mongo-contract-serializer-BBknnHWy-DAzm09wB.mjs.map} +1 -1
  83. package/dist/{mongo-contract-view-AnejqfrQ-CPjNHMFu.d.mts → mongo-contract-view-AnejqfrQ-CIb7qlMp.d.mts} +3 -3
  84. package/dist/{mongo-contract-view-AnejqfrQ-CPjNHMFu.d.mts.map → mongo-contract-view-AnejqfrQ-CIb7qlMp.d.mts.map} +1 -1
  85. package/dist/{mongo-contract-view-CF5trX6R-D-7KBBF2.mjs → mongo-contract-view-CF5trX6R-BIF8ciuY.mjs} +3 -3
  86. package/dist/{mongo-contract-view-CF5trX6R-D-7KBBF2.mjs.map → mongo-contract-view-CF5trX6R-BIF8ciuY.mjs.map} +1 -1
  87. package/dist/{mongo-value-set-DAGBOegv-B0Vel8d-.d.mts → mongo-value-set-bK4eBlxO-BCGb8sSL.d.mts} +5 -2
  88. package/dist/{mongo-value-set-DAGBOegv-B0Vel8d-.d.mts.map → mongo-value-set-bK4eBlxO-BCGb8sSL.d.mts.map} +1 -1
  89. package/dist/orm.d.mts +3 -3
  90. package/dist/orm.mjs +2 -2
  91. package/dist/query-ast.d.mts +4 -4
  92. package/dist/query-ast.mjs +2 -2
  93. package/dist/query-ast__control.d.mts +3 -3
  94. package/dist/query-ast__control.mjs +2 -2
  95. package/dist/query-ast__execution.d.mts +1 -1
  96. package/dist/query-builder.d.mts +4 -4
  97. package/dist/query-builder.mjs +1 -1
  98. package/dist/query-builder__contract-free.d.mts +4 -4
  99. package/dist/query-builder__contract-free.mjs +1 -1
  100. package/dist/{runtime-ZGXLjqEe.d.mts → runtime-Bf-SFBMj.d.mts} +2 -2
  101. package/dist/runtime-Bf-SFBMj.d.mts.map +1 -0
  102. package/dist/runtime.d.mts +5 -5
  103. package/dist/schema-ir.d.mts +1 -1
  104. package/dist/schema-ir.mjs +1 -1
  105. package/dist/{schema-verify-CpWcSHyM.d.mts → schema-verify-BJAMkVFt.d.mts} +4 -4
  106. package/dist/{schema-verify-CpWcSHyM.d.mts.map → schema-verify-BJAMkVFt.d.mts.map} +1 -1
  107. package/dist/{verify-mongo-schema-CyvUewwP-DwSUNc5f.mjs → verify-mongo-schema-D8rznxzZ-CjYf39zu.mjs} +34 -23
  108. package/dist/verify-mongo-schema-D8rznxzZ-CjYf39zu.mjs.map +1 -0
  109. package/dist/wire.d.mts +2 -2
  110. package/package.json +20 -20
  111. package/dist/authoring-entity-types-J_patbMZ-C509nMfw.mjs.map +0 -1
  112. package/dist/contract-builder-Cr65NhJk.mjs.map +0 -1
  113. package/dist/contract-builder-DurxXsaj.d.mts.map +0 -1
  114. package/dist/control-DzA3bjX-.mjs.map +0 -1
  115. package/dist/control-adapter-lmZYICe8.d.mts +0 -1
  116. package/dist/dist-B-Ml8wpa.mjs.map +0 -1
  117. package/dist/entity-kinds-BI-PWX8L-DRxc2Flr.mjs.map +0 -1
  118. package/dist/exports-B2tu3O-g.mjs.map +0 -1
  119. package/dist/index-D21Pb9vL.d.mts.map +0 -1
  120. package/dist/interpreter-BX0gy2Yu-Byy8LdrE.mjs.map +0 -1
  121. package/dist/runtime-ZGXLjqEe.d.mts.map +0 -1
  122. package/dist/verify-mongo-schema-CyvUewwP-DwSUNc5f.mjs.map +0 -1
@@ -5,6 +5,7 @@ import { enumRefusalOf } from "@prisma/orm-framework/components/codec";
5
5
  import "@prisma/orm-framework/components/ir";
6
6
  import "@prisma/orm-framework/contract/types";
7
7
  import "@prisma/orm-framework/contract/hashing";
8
+ import "@prisma/orm-framework/utils/internal-error";
8
9
  import "@prisma/orm-framework/utils/assertions";
9
10
  import "@prisma/orm-framework/utils/result";
10
11
  import { enumType } from "@prisma/orm-framework/contract-authoring";
@@ -13,7 +14,7 @@ import "@prisma/orm-framework/components/components";
13
14
  import "@prisma/orm-framework/utils/canonical-stringify";
14
15
  import "@prisma/orm-framework/components/control";
15
16
  import { blockAttribute, enumMemberValue, mapBlock, str } from "@prisma/orm-framework/psl-parser";
16
- //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-J_patbMZ.mjs
17
+ //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-qeRu8r5L.mjs
17
18
  function mongoFamilyEnumSpec() {
18
19
  return mapBlock({
19
20
  value: {
@@ -87,4 +88,4 @@ const mongoFamilyPslBlockDescriptors = { enum: {
87
88
  //#endregion
88
89
  export { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };
89
90
 
90
- //# sourceMappingURL=authoring-entity-types-J_patbMZ-C509nMfw.mjs.map
91
+ //# sourceMappingURL=authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-qeRu8r5L.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { enumRefusalOf } from \"@internal/framework-components/codec\";\nimport \"@internal/utils/structured-error\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/framework-components/components\";\nimport \"@internal/mongo-contract\";\nimport \"@internal/utils/result\";\nimport \"@internal/utils/canonical-stringify\";\nimport \"@internal/utils/casts\";\nimport \"@internal/utils/internal-error\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/mongo-contract/data-type\";\nimport \"@internal/framework-components/control\";\nimport \"@internal/framework-components/ir\";\nimport \"@internal/utils/assertions\";\nimport { blockAttribute, enumMemberValue, mapBlock, str } from \"@internal/psl-parser\";\n//#region src/core/authoring-entity-types.ts\nfunction mongoFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: enumMemberValue(),\n\t\t\tdocumentation: \"The member's value, written as a value of the enum's data type; 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 enumRefusal = enumRefusalOf(descriptor);\n\t\tif (enumRefusal !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" cannot use the codec \"${codecId}\". ${enumRefusal}`,\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, { codecId }, ...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-qeRu8r5L.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAS,sBAAsB;CAC9B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,gBAAgB;GACtB,eAAe;EAChB;EACA,WAAW;CACZ,CAAC;AACF;AACA,MAAM,yBAAyB,EAAE,MAAM;CACtC,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,UAAU,OAAO,QAAQ;EAClC,MAAM,WAAW,IAAI,YAAY;EACjC,MAAM,cAAc,IAAI;EACxB,MAAM,WAAW,mBAAmB,OAAO,GAAG;EAC9C,IAAI,aAAa,KAAK,GAAG;EACzB,MAAM,EAAE,SAAS,cAAc;EAC/B,MAAM,aAAa,IAAI,YAAY,cAAc,OAAO;EACxD,IAAI,eAAe,KAAK,GAAG;GAC1B,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,qCAAqC,QAAQ;IAC1E;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,cAAc,cAAc,UAAU;EAC5C,IAAI,gBAAgB,KAAK,GAAG;GAC3B,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,0BAA0B,QAAQ,KAAK;IACpE;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,QAAQ,IAAI,YAAY,IAAI,OAAO;EACzC,IAAI,UAAU,KAAK,GAAG;GACrB,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,kBAAkB,QAAQ;IACvD;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,UAAU,qBAAqB,OAAO,SAAS,OAAO,GAAG;EAC/D,IAAI,YAAY,KAAK,GAAG,OAAO,KAAK;EACpC,OAAO,SAAS,MAAM,MAAM,EAAE,QAAQ,GAAG,GAAG,OAAO;CACpD,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"config-types-D4SnQaTy.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\nimport { pathToFileURL } from \"node:url\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/config-types.ts\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it from source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n//#endregion\nexport { typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,mBAAmB,UAAU,QAAQ,SAAS;CACtD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;EACjG;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,2BAA2B,cAAc,QAAQ,SAAS;CAClE,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAK,GAAG,MAAM,IAAI,cAAc,2HAA2H;IAChL,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,0CAA0C,aAAa,2CAA2C,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,CAAC;IACjN,OAAO,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;GACtF;EACD;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD"}
1
+ {"version":3,"file":"config-types-D4SnQaTy.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { pathToFileURL } from \"node:url\";\nimport { applySpecifierDefaultControlPolicy } from \"@internal/contract/apply-specifier-default-control-policy\";\n//#region src/config-types.ts\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\nfunction typescriptContractFromPath(contractPath, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tinputs: [contractPath],\n\t\t\tload: async (context) => {\n\t\t\t\tconst [absolutePath] = context.resolvedInputs;\n\t\t\t\tif (absolutePath === void 0) throw new InternalError(\"typescriptContractFromPath: context.resolvedInputs is empty. The CLI config loader should populate it from source.inputs.\");\n\t\t\t\tconst mod = await import(pathToFileURL(absolutePath).href);\n\t\t\t\tconst contract = mod.default ?? mod.contract;\n\t\t\t\tif (contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `typescriptContractFromPath: module at \"${absolutePath}\" has no \"default\" or \"contract\" export.`, { meta: { path: absolutePath } });\n\t\t\t\treturn ok(applySpecifierDefaultControlPolicy(contract, options?.defaultControlPolicy));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n//#endregion\nexport { typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,mBAAmB,UAAU,QAAQ,SAAS;CACtD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,MAAM,YAAY,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;EACjG;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD;AACA,SAAS,2BAA2B,cAAc,QAAQ,SAAS;CAClE,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,YAAY;GACrB,MAAM,OAAO,YAAY;IACxB,MAAM,CAAC,gBAAgB,QAAQ;IAC/B,IAAI,iBAAiB,KAAK,GAAG,MAAM,IAAI,cAAc,2HAA2H;IAChL,MAAM,MAAM,MAAM,OAAO,cAAc,YAAY,CAAC,CAAC;IACrD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,0CAA0C,aAAa,2CAA2C,EAAE,MAAM,EAAE,MAAM,aAAa,EAAE,CAAC;IACjN,OAAO,GAAG,mCAAmC,UAAU,SAAS,oBAAoB,CAAC;GACtF;EACD;EACA,GAAG,UAAU,UAAU,MAAM;CAC9B;AACD"}
@@ -1,6 +1,6 @@
1
- import { i as MongoCollectionOptions, o as MongoIndex } from "./entity-kinds-BI-PWX8L-DRxc2Flr.mjs";
1
+ import { i as MongoCollectionOptions, o as MongoIndex } from "./entity-kinds-D5mTQzuZ-BY1vGgFk.mjs";
2
2
  import { n as codecTypeParamsProblem } from "./mongo-data-type-Bv8Bd0zu-cnTiyyP0.mjs";
3
- import { D as mongoValueSetsOf, F as unsupportedStoredNameReason, S as indexLookupKey, T as mongoContractRefusalsOf, c as applyPolymorphicScopeToMongoIndex, d as buildMongoStorage, v as deriveCollectionValidators } from "./dist-B-Ml8wpa.mjs";
3
+ import { C as indexLookupKey, E as mongoContractRefusalsOf, I as unsupportedStoredNameReason, O as mongoValueSetsOf, _ as defaultMongoIndexName, c as applyPolymorphicScopeToMongoIndex, d as buildMongoStorage, y as deriveCollectionValidators } from "./dist-By5gbTEW.mjs";
4
4
  import { t as contractError } from "./contract-errors-BCN6RVI5-kMurtAbI.mjs";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -8,6 +8,7 @@ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
8
8
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
9
9
  import { crossRef } from "@prisma/orm-framework/contract/types";
10
10
  import { buildExecutionSection, computeProfileHash } from "@prisma/orm-framework/contract/hashing";
11
+ import { InternalError } from "@prisma/orm-framework/utils/internal-error";
11
12
  import { assertDefined } from "@prisma/orm-framework/utils/assertions";
12
13
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
13
14
  import { answerMissingPropertyReads, bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, enumMemberError, enumType as enumType$1, isEnumTypeHandle, member, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
@@ -296,12 +297,31 @@ function buildRoots(definition, models, namespaceId) {
296
297
  }
297
298
  return roots;
298
299
  }
300
+ /** The stored form of an index key: the field's stored name, with a wildcard scope kept. */
299
301
  function storedIndexKey(fields, key) {
300
302
  const scope = key.match(/^(.+)\.\$\*\*$/)?.[1];
301
303
  if (scope !== void 0) return `${storedFieldNameIn(fields, scope)}.$**`;
302
304
  return key === "$**" ? key : storedFieldNameIn(fields, key);
303
305
  }
306
+ /** The name MongoDB gives the index when it is created without one, from its stored keys. */
307
+ function defaultIndexNameOf(index, fields) {
308
+ return defaultMongoIndexName(Object.entries(index.fields).map(([field, direction]) => ({
309
+ field: storedIndexKey(fields, field),
310
+ direction
311
+ })));
312
+ }
313
+ /** The index as its refusals show it: as written, without a name that is only the default. */
314
+ function indexSignature(index, fields) {
315
+ const name = index.options?.name;
316
+ if (name === void 0 || name !== defaultIndexNameOf(index, fields)) return canonicalStringify(index);
317
+ const { name: _, ...options } = index.options ?? {};
318
+ return canonicalStringify(Object.keys(options).length === 0 ? { fields: index.fields } : {
319
+ ...index,
320
+ options
321
+ });
322
+ }
304
323
  function toStorageIndex(index, fields) {
324
+ if (index.options?.name === void 0) throw new InternalError(`An index on ${Object.keys(index.fields).join(", ")} reached the MongoDB contract builder without a name. Call nameIndexes on the definition before building it.`);
305
325
  const input = { keys: Object.entries(index.fields).map(([field, direction]) => ({
306
326
  field: storedIndexKey(fields, field),
307
327
  direction
@@ -387,7 +407,7 @@ function checkModelIndexes(model, modelsByName, variantValues) {
387
407
  model: model.modelName,
388
408
  position
389
409
  };
390
- const signature = canonicalStringify(written);
410
+ const signature = indexSignature(written, model.fields);
391
411
  const missingField = findMissingIndexField(written, model.fields);
392
412
  if (missingField !== void 0) return {
393
413
  kind: "refused",
@@ -451,6 +471,7 @@ function buildCollections(input) {
451
471
  const { models, variantValues, refusals } = input;
452
472
  const intermediate = {};
453
473
  const indexOwnersByCollection = /* @__PURE__ */ new Map();
474
+ const indexNameOwnersByCollection = /* @__PURE__ */ new Map();
454
475
  const textIndexCollections = /* @__PURE__ */ new Set();
455
476
  const modelsByName = new Map(models.map((model) => [model.modelName, model]));
456
477
  for (const model of models) {
@@ -467,6 +488,8 @@ function buildCollections(input) {
467
488
  const existingIndexes = existingCollection.indexes ?? [];
468
489
  const indexOwners = indexOwnersByCollection.get(collection) ?? /* @__PURE__ */ new Map();
469
490
  indexOwnersByCollection.set(collection, indexOwners);
491
+ const nameOwners = indexNameOwnersByCollection.get(collection) ?? /* @__PURE__ */ new Map();
492
+ indexNameOwnersByCollection.set(collection, nameOwners);
470
493
  if (existingCollection.options && model.collectionOptions) refusals.push({
471
494
  kind: "collectionSettingTwice",
472
495
  key: collectionKey,
@@ -490,7 +513,7 @@ function buildCollections(input) {
490
513
  model: modelName,
491
514
  position
492
515
  };
493
- const signature = canonicalStringify(checked.written);
516
+ const signature = indexSignature(checked.written, model.fields);
494
517
  if (isTextIndex(checked.written)) {
495
518
  if (textIndexCollections.has(collection)) {
496
519
  refusals.push({
@@ -516,7 +539,20 @@ function buildCollections(input) {
516
539
  });
517
540
  return;
518
541
  }
542
+ const firstNamed = nameOwners.get(checked.index.name);
543
+ if (firstNamed !== void 0) {
544
+ refusals.push({
545
+ kind: "indexNameDuplicate",
546
+ key,
547
+ collection,
548
+ name: checked.index.name,
549
+ firstModel: firstNamed.model,
550
+ firstPosition: firstNamed.position
551
+ });
552
+ return;
553
+ }
519
554
  indexOwners.set(lookupKey, key);
555
+ nameOwners.set(checked.index.name, key);
520
556
  storageIndexes.push(checked.index);
521
557
  });
522
558
  const storageOptions = model.collectionOptions ? toStorageCollectionOptions(model.collectionOptions) : void 0;
@@ -1146,7 +1182,7 @@ function positionKey({ model, position }) {
1146
1182
  return JSON.stringify([model, position]);
1147
1183
  }
1148
1184
  /**
1149
- * Removes each identical or redundant index in a collection, for the Prisma 8 authoring sources to call before the builder. Two indexes match when their storage indexes, variant scope applied, have the same `indexLookupKey` with `unique` left out. Of a matching pair the first is kept, unless only the later one is unique; then the later one is kept and the earlier removed. Indexes the builder refuses are left for it to refuse. A source that reports the builder's refusals by index position maps them back through `removedIndexes`.
1185
+ * Removes each identical or redundant index in a collection, for the Prisma 8 authoring sources to call after `nameIndexes` and before the builder. Two indexes match when they have the same name and their storage indexes, variant scope applied, have the same `indexLookupKey` with `unique` left out. Indexes with different names are both kept: the user named them apart, and the builder refuses two identical ones. Of a matching pair the first is kept, unless only the later one is unique; then the later one is kept and the earlier removed. Indexes the builder refuses are left for it to refuse. A source that reports the builder's refusals by index position maps them back through `removedIndexes`.
1150
1186
  */
1151
1187
  function mergeRedundantIndexes(definition, codecLookup, dataTypes) {
1152
1188
  const refusalsLeftToTheBuilder = [];
@@ -1175,9 +1211,10 @@ function mergeRedundantIndexes(definition, codecLookup, dataTypes) {
1175
1211
  ...checked.index,
1176
1212
  unique: void 0
1177
1213
  }),
1214
+ name: checked.index.name,
1178
1215
  unique: checked.index.unique === true
1179
1216
  };
1180
- const matchingAt = held.findIndex((candidate) => candidate.lookupKey === index.lookupKey);
1217
+ const matchingAt = held.findIndex((candidate) => candidate.lookupKey === index.lookupKey && candidate.name === index.name);
1181
1218
  const match = held[matchingAt];
1182
1219
  if (match !== void 0) {
1183
1220
  if (match.unique || !index.unique) {
@@ -1216,6 +1253,55 @@ function mergeRedundantIndexes(definition, codecLookup, dataTypes) {
1216
1253
  removedIndexes
1217
1254
  };
1218
1255
  }
1256
+ /** The position a model wrote an index at, from its position in the model's indexes after the merge. */
1257
+ function writtenIndexPosition(removedIndexes, model, mergedPosition) {
1258
+ const removed = removedIndexes.filter((index) => index.model === model).map((index) => index.position).sort((a, b) => a - b);
1259
+ let position = mergedPosition;
1260
+ for (const removedPosition of removed) if (removedPosition <= position) position++;
1261
+ return position;
1262
+ }
1263
+ /** The refusal with its index positions counted as the source wrote them, before the merge. */
1264
+ function refusalAtWrittenPositions(refusal, removedIndexes) {
1265
+ if (refusal.key.kind !== "index" || removedIndexes.length === 0) return refusal;
1266
+ const key = {
1267
+ ...refusal.key,
1268
+ position: writtenIndexPosition(removedIndexes, refusal.key.model, refusal.key.position)
1269
+ };
1270
+ switch (refusal.kind) {
1271
+ case "indexDuplicate":
1272
+ case "indexNameDuplicate": return {
1273
+ ...refusal,
1274
+ key,
1275
+ firstPosition: writtenIndexPosition(removedIndexes, refusal.firstModel, refusal.firstPosition)
1276
+ };
1277
+ default: return blindCast({
1278
+ ...refusal,
1279
+ key
1280
+ });
1281
+ }
1282
+ }
1283
+ function namedIndex(index, model) {
1284
+ if (index.options?.name !== void 0) return index;
1285
+ return {
1286
+ ...index,
1287
+ options: {
1288
+ ...index.options,
1289
+ name: defaultIndexNameOf(index, model.fields)
1290
+ }
1291
+ };
1292
+ }
1293
+ /**
1294
+ * Names each index the definition writes without a name as MongoDB names an index created without one: its stored keys and directions, such as `email_1`. The Prisma 8 authoring sources call it before `mergeRedundantIndexes` and the builder. Two indexes of one collection that get one name are left for the builder to refuse.
1295
+ */
1296
+ function nameIndexes(definition) {
1297
+ return {
1298
+ ...definition,
1299
+ models: definition.models.map((model) => model.indexes === void 0 ? model : {
1300
+ ...model,
1301
+ indexes: model.indexes.map((index) => namedIndex(index, model))
1302
+ })
1303
+ };
1304
+ }
1219
1305
  const LIST_THE_CODEC_PACK = "List the pack that provides the codec in `extensions` in defineContract.";
1220
1306
  function codecRefusalError(subject, meta, codecId, refusal) {
1221
1307
  if (refusal.kind === "unknownCodec") return contractError("CONTRACT.CODEC_DESCRIPTOR_MISSING", `${subject} ${refusal.reason}`, {
@@ -1427,6 +1513,14 @@ function refusalError(refusal) {
1427
1513
  first: refusal.firstModel,
1428
1514
  second: refusal.key.model
1429
1515
  } });
1516
+ case "indexNameDuplicate": return contractError("CONTRACT.NAME_DUPLICATE", `Collection "${refusal.collection}" has two indexes named "${refusal.name}": index ${refusal.firstPosition} of model "${refusal.firstModel}" and index ${refusal.key.position} of model "${refusal.key.model}". An index without a name is named after its keys and directions. Give one of them another name with the index option name.`, { meta: {
1517
+ kind: "index",
1518
+ name: refusal.name,
1519
+ collection: refusal.collection,
1520
+ first: refusal.firstModel,
1521
+ second: refusal.key.model,
1522
+ reason: "index-name-duplicate"
1523
+ } });
1430
1524
  case "generatedOnValueObject": return defaultError(refusal.key, "executionDefaults-on-value-object", "has executionDefaults, but it belongs to a value object. Generated values are only supported on model fields.");
1431
1525
  case "generatorUnknown": {
1432
1526
  const { owner, field } = refusal.key;
@@ -1852,12 +1946,13 @@ function buildContractFromDsl(input, lookups) {
1852
1946
  input.target,
1853
1947
  ...Object.values(input.extensions ?? {})
1854
1948
  ]);
1855
- const built = buildMongoContractFromDefinition(mergeRedundantIndexes(definition, codecLookup, dataTypes).definition, codecLookup, dataTypes);
1949
+ const merged = mergeRedundantIndexes(nameIndexes(definition), codecLookup, dataTypes);
1950
+ const built = buildMongoContractFromDefinition(merged.definition, codecLookup, dataTypes);
1856
1951
  flushAuthoringWarnings((built.ok ? built.value.warnings : built.failure.warnings).map(authoringWarningOf));
1857
1952
  if (!built.ok) {
1858
1953
  const [first] = built.failure.refusals;
1859
1954
  assertDefined(first, "a refused build has at least one refusal");
1860
- throw refusalError(first);
1955
+ throw refusalError(refusalAtWrittenPositions(first, merged.removedIndexes));
1861
1956
  }
1862
1957
  return blindCast(built.value.contract);
1863
1958
  }
@@ -1890,6 +1985,6 @@ function defineContract(definition, factory) {
1890
1985
  return buildBoundContract(definition.family, definition.target, definition);
1891
1986
  }
1892
1987
  //#endregion
1893
- export { enumType$1 as a, isEnumTypeHandle as c, model as d, rel as f, defineContract as i, member as l, buildBoundContract as n, field as o, valueObject as p, buildMongoContractFromDefinition as r, index as s, bindEnumType as t, mergeRedundantIndexes as u };
1988
+ export { enumType$1 as a, isEnumTypeHandle as c, model as d, nameIndexes as f, defineContract as i, member as l, valueObject as m, buildBoundContract as n, field as o, rel as p, buildMongoContractFromDefinition as r, index as s, bindEnumType as t, mergeRedundantIndexes as u };
1894
1989
 
1895
- //# sourceMappingURL=contract-builder-Cr65NhJk.mjs.map
1990
+ //# sourceMappingURL=contract-builder-BUa0Oz34.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-builder-BUa0Oz34.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 } from \"@internal/contract/hashing\";\nimport { assembleGeneratorFunctions, createGeneratorHelpers } from \"@internal/framework-components/components\";\nimport { MongoCollectionOptions, MongoIndex, applyPolymorphicScopeToMongoIndex, buildMongoStorage, defaultMongoIndexName, deriveCollectionValidators, indexLookupKey, mongoContractRefusalsOf, mongoValueSetsOf, unsupportedStoredNameReason } from \"@internal/mongo-contract\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { answerMissingPropertyReads, bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, enumMemberError, enumType, isEnumTypeHandle, member, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { applyDiscriminatorRule, assembleDataTypeSupport, assertNoCrossRegistryCollisions, assertTypeAliasesValid, encodeEnumMembers, flushAuthoringWarnings } from \"@internal/framework-components/authoring\";\nimport { codecTypeParamsProblem } from \"@internal/mongo-contract/data-type\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/build-refusals.ts\nfunction modelFieldKey(model, field) {\n\treturn {\n\t\tkind: \"field\",\n\t\towner: {\n\t\t\tkind: \"model\",\n\t\t\tname: model\n\t\t},\n\t\tfield\n\t};\n}\nfunction valueObjectFieldKey(valueObject, field) {\n\treturn {\n\t\tkind: \"field\",\n\t\towner: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: valueObject\n\t\t},\n\t\tfield\n\t};\n}\n/** The key of a validator refusal: the part of the definition its subject names. */\nfunction validatorRefusalKey(refusal) {\n\tswitch (refusal.kind) {\n\t\tcase \"embeddedModelHasVariants\": return {\n\t\t\tkind: \"relation\",\n\t\t\tmodel: refusal.modelName,\n\t\t\trelation: refusal.relationName\n\t\t};\n\t\tcase \"enumBsonType\":\n\t\tcase \"enumNotListable\": return {\n\t\t\tkind: \"enum\",\n\t\t\tenumName: refusal.enumName\n\t\t};\n\t\tcase \"enumMemberNotListable\": return {\n\t\t\tkind: \"enumMember\",\n\t\t\tenumName: refusal.enumName,\n\t\t\tmember: refusal.member\n\t\t};\n\t\tcase \"fieldBsonType\": return {\n\t\t\tkind: \"field\",\n\t\t\towner: refusal.owner,\n\t\t\tfield: refusal.fieldName\n\t\t};\n\t\tcase \"documentId\": return modelFieldKey(refusal.modelName, refusal.fieldName);\n\t}\n}\n//#endregion\n//#region src/build-models.ts\nfunction storedNameOf(field) {\n\treturn field.storedName ?? field.fieldName;\n}\n/** The name documents store `fieldName` under, or `fieldName` itself when the fields do not declare it. */\nfunction storedFieldNameIn(fields, fieldName) {\n\tconst field = fields.find((candidate) => candidate.fieldName === fieldName);\n\treturn field === void 0 ? fieldName : storedNameOf(field);\n}\nfunction fieldWithoutValueSet(field) {\n\treturn {\n\t\ttype: field.type,\n\t\tnullable: field.nullable,\n\t\tmany: field.many\n\t};\n}\n/** A model's fields. A field an enum types refers to the domain enum. */\nfunction buildFields(fields, namespaceId) {\n\treturn Object.fromEntries(fields.map((field) => [field.fieldName, {\n\t\t...fieldWithoutValueSet(field),\n\t\t...ifDefined(\"valueSet\", field.enumName === void 0 ? void 0 : {\n\t\t\tplane: \"domain\",\n\t\t\tentityKind: \"enum\",\n\t\t\tnamespaceId,\n\t\t\tentityName: field.enumName\n\t\t})\n\t}]));\n}\n/** A value object's members. A value object is a storage entity, and storage never refers to the domain plane, so a member an enum types refers to the enum's storage value set. */\nfunction buildValueObjectMembers(fields, namespaceId) {\n\treturn Object.fromEntries(fields.map((field) => [field.fieldName, {\n\t\t...fieldWithoutValueSet(field),\n\t\t...ifDefined(\"valueSet\", field.enumName === void 0 ? void 0 : {\n\t\t\tplane: \"storage\",\n\t\t\tentityKind: \"valueSet\",\n\t\t\tnamespaceId,\n\t\t\tentityName: field.enumName\n\t\t})\n\t}]));\n}\nfunction buildStorageFields(modelName, fields, refusals) {\n\tconst storageFields = {};\n\tconst fieldsByStoredName = /* @__PURE__ */ new Map();\n\tfor (const field of fields) {\n\t\tconst { fieldName } = field;\n\t\tconst key = modelFieldKey(modelName, fieldName);\n\t\tconst storedName = storedNameOf(field);\n\t\tconst unsupported = unsupportedStoredNameReason(storedName);\n\t\tif (unsupported !== void 0) refusals.push({\n\t\t\tkind: \"storedNameUnsupported\",\n\t\t\tkey,\n\t\t\treason: unsupported\n\t\t});\n\t\tconst firstField = fieldsByStoredName.get(storedName);\n\t\tif (firstField !== void 0) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"storedNameDuplicate\",\n\t\t\t\tkey,\n\t\t\t\tstoredName,\n\t\t\t\tfirstField\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tfieldsByStoredName.set(storedName, fieldName);\n\t\tstorageFields[fieldName] = { field: storedName };\n\t}\n\treturn storageFields;\n}\nfunction toOneRelationNullable(key, relation, fields, refusals) {\n\tconst ownsForeignKey = relation.cardinality !== \"1:1\";\n\tconst localFields = [];\n\tif (ownsForeignKey) for (const fieldName of relation.on.localFields) {\n\t\tconst localField = fields.find((field) => field.fieldName === fieldName);\n\t\tif (localField === void 0) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"relationLocalFieldUnknown\",\n\t\t\t\tkey,\n\t\t\t\tfieldName\n\t\t\t});\n\t\t\treturn relation.nullable ?? false;\n\t\t}\n\t\tlocalFields.push(localField);\n\t}\n\tconst { nullable, contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relation.nullable,\n\t\tlocalFieldNullability: localFields.map((localField) => localField.nullable === true),\n\t\townsReference: ownsForeignKey\n\t});\n\tif (contradiction !== void 0) refusals.push({\n\t\tkind: \"relationNullability\",\n\t\tkey,\n\t\townsForeignKey,\n\t\tcontradiction\n\t});\n\treturn nullable;\n}\nfunction buildRelation(model, relation, namespaceId, refusals) {\n\tconst to = crossRef(relation.toModel, namespaceId);\n\tif (relation.on === void 0) return {\n\t\tto,\n\t\tcardinality: relation.cardinality\n\t};\n\tif (relation.cardinality === \"1:N\") return {\n\t\tto,\n\t\tcardinality: \"1:N\",\n\t\ton: relation.on\n\t};\n\tconst key = {\n\t\tkind: \"relation\",\n\t\tmodel: model.modelName,\n\t\trelation: relation.relationName\n\t};\n\treturn {\n\t\tto,\n\t\tcardinality: relation.cardinality,\n\t\tnullable: toOneRelationNullable(key, relation, model.fields, refusals),\n\t\ton: relation.on\n\t};\n}\nfunction buildValueObjects(valueObjects, namespaceId, refusals) {\n\tconst builtValueObjects = {};\n\tfor (const valueObject of valueObjects ?? []) {\n\t\tif (valueObject.name in builtValueObjects) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"duplicateValueObject\",\n\t\t\t\tkey: {\n\t\t\t\t\tkind: \"valueObject\",\n\t\t\t\t\tvalueObject: valueObject.name\n\t\t\t\t}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const field of valueObject.fields) if (field.storedName !== void 0) refusals.push({\n\t\t\tkind: \"valueObjectFieldStoredName\",\n\t\t\tkey: valueObjectFieldKey(valueObject.name, field.fieldName)\n\t\t});\n\t\tbuiltValueObjects[valueObject.name] = { fields: buildValueObjectMembers(valueObject.fields, namespaceId) };\n\t}\n\treturn builtValueObjects;\n}\n/**\n* Refuses a variant field stored under a name another field of its base is stored under. A variant's documents hold its base's fields too, so the two would overwrite each other, the discriminator included. A variant that restates a base field under the same name restates that field.\n*/\nfunction restatementDifferences(variantField, baseField) {\n\tconst differences = [];\n\tif (storedNameOf(variantField) !== storedNameOf(baseField)) differences.push(\"storedName\");\n\tif (canonicalStringify([variantField.type, variantField.enumName]) !== canonicalStringify([baseField.type, baseField.enumName])) differences.push(\"type\");\n\tif (variantField.nullable !== baseField.nullable) differences.push(\"nullable\");\n\tif (canonicalStringify(variantField.many) !== canonicalStringify(baseField.many)) differences.push(\"many\");\n\treturn differences;\n}\n/**\n* A variant's documents hold its base's fields too, and its collection's validator is written from the base. A variant field may restate a base field only exactly, and may not take a stored name a different base field uses.\n*/\nfunction checkFieldsAgainstBase(variant, models, refusals) {\n\tif (variant.base === void 0) return;\n\tconst baseName = variant.base.model;\n\tconst base = models.find((model) => model.modelName === baseName);\n\tif (base === void 0) return;\n\tconst baseFieldsByName = new Map(base.fields.map((field) => [field.fieldName, field]));\n\tconst baseFieldsByStoredName = new Map(base.fields.map((field) => [storedNameOf(field), field]));\n\tfor (const field of variant.fields) {\n\t\tconst key = modelFieldKey(variant.modelName, field.fieldName);\n\t\tconst restated = baseFieldsByName.get(field.fieldName);\n\t\tif (restated !== void 0) {\n\t\t\tconst differences = restatementDifferences(field, restated);\n\t\t\tif (differences.length > 0) refusals.push({\n\t\t\t\tkind: \"restatedBaseFieldDiffers\",\n\t\t\t\tkey,\n\t\t\t\tbaseModel: baseName,\n\t\t\t\tdifferences\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst storedName = storedNameOf(field);\n\t\tconst baseField = baseFieldsByStoredName.get(storedName);\n\t\tif (baseField === void 0) continue;\n\t\trefusals.push({\n\t\t\tkind: \"storedNameSharedWithBase\",\n\t\t\tkey,\n\t\t\tstoredName,\n\t\t\tbaseModel: baseName,\n\t\t\tbaseField: baseField.fieldName\n\t\t});\n\t}\n}\n/**\n* Each model of the contract. `variantValues` holds each accepted variant's discriminator value as its base's field stores it; a base lists those variants.\n*/\nfunction buildModels(input) {\n\tconst { models, variantValues, namespaceId, refusals } = input;\n\tconst builtModels = {};\n\tfor (const model of models) {\n\t\tconst { modelName } = model;\n\t\tif (modelName in builtModels) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"duplicateModel\",\n\t\t\t\tkey: {\n\t\t\t\t\tkind: \"model\",\n\t\t\t\t\tmodel: modelName\n\t\t\t\t}\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tcheckFieldsAgainstBase(model, models, refusals);\n\t\tconst storage = {\n\t\t\t...model.collection ? { collection: model.collection } : {},\n\t\t\tfields: buildStorageFields(modelName, model.fields, refusals),\n\t\t\t...model.storageRelations ? { relations: model.storageRelations } : {}\n\t\t};\n\t\tconst variants = model.discriminator === void 0 ? void 0 : models.flatMap((variant) => {\n\t\t\tconst value = variantValues.get(variant.modelName);\n\t\t\treturn variant.base?.model === modelName && value !== void 0 ? [[value, crossRef(variant.modelName, namespaceId)]] : [];\n\t\t});\n\t\tbuiltModels[modelName] = {\n\t\t\tfields: buildFields(model.fields, namespaceId),\n\t\t\trelations: Object.fromEntries((model.relations ?? []).map((relation) => [relation.relationName, buildRelation(model, relation, namespaceId, refusals)])),\n\t\t\tstorage,\n\t\t\t...model.owner ? { owner: model.owner } : {},\n\t\t\t...model.base ? { base: crossRef(model.base.model, namespaceId) } : {},\n\t\t\t...model.discriminator ? { discriminator: { field: model.discriminator.field } } : {},\n\t\t\t...variants === void 0 ? {} : { variants: Object.fromEntries(variants) }\n\t\t};\n\t}\n\treturn builtModels;\n}\nfunction buildRoots(definition, models, namespaceId) {\n\tif (definition.roots !== void 0) return Object.fromEntries(Object.entries(definition.roots).map(([rootName, modelName]) => [rootName, crossRef(modelName, namespaceId)]));\n\tconst roots = {};\n\tfor (const model of models) {\n\t\tif (!model.collection || model.owner || model.base) continue;\n\t\troots[model.collection] = crossRef(model.modelName, namespaceId);\n\t}\n\treturn roots;\n}\n//#endregion\n//#region src/build-collections.ts\n/** The stored form of an index key: the field's stored name, with a wildcard scope kept. */\nfunction storedIndexKey(fields, key) {\n\tconst scope = key.match(/^(.+)\\.\\$\\*\\*$/)?.[1];\n\tif (scope !== void 0) return `${storedFieldNameIn(fields, scope)}.$**`;\n\treturn key === \"$**\" ? key : storedFieldNameIn(fields, key);\n}\n/** The name MongoDB gives the index when it is created without one, from its stored keys. */\nfunction defaultIndexNameOf(index, fields) {\n\treturn defaultMongoIndexName(Object.entries(index.fields).map(([field, direction]) => ({\n\t\tfield: storedIndexKey(fields, field),\n\t\tdirection\n\t})));\n}\n/** The index as its refusals show it: as written, without a name that is only the default. */\nfunction indexSignature(index, fields) {\n\tconst name = index.options?.name;\n\tif (name === void 0 || name !== defaultIndexNameOf(index, fields)) return canonicalStringify(index);\n\tconst { name: _, ...options } = index.options ?? {};\n\treturn canonicalStringify(Object.keys(options).length === 0 ? { fields: index.fields } : {\n\t\t...index,\n\t\toptions\n\t});\n}\nfunction toStorageIndex(index, fields) {\n\tif (index.options?.name === void 0) throw new InternalError(`An index on ${Object.keys(index.fields).join(\", \")} reached the MongoDB contract builder without a name. Call nameIndexes on the definition before building it.`);\n\tconst input = { keys: Object.entries(index.fields).map(([field, direction]) => ({\n\t\tfield: storedIndexKey(fields, field),\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 scopedStorageIndex(written, fields, polymorphicScope) {\n\tconst storageIndex = toStorageIndex(written, fields);\n\treturn polymorphicScope === void 0 ? {\n\t\tkind: \"ok\",\n\t\tindex: storageIndex\n\t} : applyPolymorphicScopeToMongoIndex(storageIndex, polymorphicScope);\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, fields) {\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 (!fields.some((field) => field.fieldName === lookupName)) return lookupName;\n\t}\n}\nfunction isWildcardKey(key) {\n\treturn key === \"$**\" || key.endsWith(\".$**\");\n}\nfunction isTextIndex(index) {\n\treturn Object.values(index.fields).includes(\"text\");\n}\n/** The first shape rule an index breaks, of those MongoDB enforces when it creates the index. */\nfunction indexShapeProblem(index) {\n\tconst keys = Object.entries(index.fields);\n\tconst hasWildcard = keys.some(([key]) => isWildcardKey(key));\n\tconst directions = keys.map(([, direction]) => direction);\n\tconst options = index.options ?? {};\n\tif (hasWildcard && options.unique) return \"unique-wildcard\";\n\tif (hasWildcard && directions.some((direction) => [\n\t\t\"hashed\",\n\t\t\"2d\",\n\t\t\"2dsphere\"\n\t].includes(String(direction)))) return \"wildcard-with-type\";\n\tif (directions.includes(\"hashed\") && keys.length > 1) return \"hashed-several-fields\";\n\tif (hasWildcard && options.expireAfterSeconds !== void 0) return \"ttl-with-wildcard\";\n\tif (!hasWildcard && options.wildcardProjection !== void 0) return \"projection-without-wildcard\";\n\tif (options.collation !== void 0 && !options.collation.locale) return \"collation-without-locale\";\n}\nfunction resolveVariantScope(model, modelsByName, variantValues) {\n\tif (!model.base) return void 0;\n\tconst base = modelsByName.get(model.base.model);\n\tconst discriminatorField = base?.discriminator?.field;\n\tconst discriminatorValue = variantValues.get(model.modelName);\n\tif (base === void 0 || !discriminatorField || discriminatorValue === void 0) return;\n\treturn {\n\t\tdiscriminatorField: storedFieldNameIn(base.fields, discriminatorField),\n\t\tdiscriminatorValue\n\t};\n}\n/**\n* Each index the model writes, in order: the storage index, with a variant's discriminator scope applied, or the builder's refusal of it for an unknown field, a shape MongoDB refuses or a scope conflict.\n*/\nfunction checkModelIndexes(model, modelsByName, variantValues) {\n\tconst polymorphicScope = resolveVariantScope(model, modelsByName, variantValues);\n\treturn (model.indexes ?? []).map((written, position) => {\n\t\tconst key = {\n\t\t\tkind: \"index\",\n\t\t\tmodel: model.modelName,\n\t\t\tposition\n\t\t};\n\t\tconst signature = indexSignature(written, model.fields);\n\t\tconst missingField = findMissingIndexField(written, model.fields);\n\t\tif (missingField !== void 0) return {\n\t\t\tkind: \"refused\",\n\t\t\trefusal: {\n\t\t\t\tkind: \"indexFieldUnknown\",\n\t\t\t\tkey,\n\t\t\t\tfieldName: missingField,\n\t\t\t\tsignature\n\t\t\t}\n\t\t};\n\t\tconst shapeProblem = indexShapeProblem(written);\n\t\tif (shapeProblem !== void 0) return {\n\t\t\tkind: \"refused\",\n\t\t\trefusal: {\n\t\t\t\tkind: \"indexShape\",\n\t\t\t\tkey,\n\t\t\t\trule: shapeProblem,\n\t\t\t\tsignature\n\t\t\t}\n\t\t};\n\t\tconst scoped = scopedStorageIndex(written, model.fields, polymorphicScope);\n\t\tif (scoped.kind === \"conflict\") return {\n\t\t\tkind: \"refused\",\n\t\t\trefusal: {\n\t\t\t\tkind: \"indexScopeConflict\",\n\t\t\t\tkey,\n\t\t\t\treason: scoped.reason,\n\t\t\t\tsignature\n\t\t\t}\n\t\t};\n\t\treturn {\n\t\t\tkind: \"accepted\",\n\t\t\twritten,\n\t\t\tindex: scoped.index\n\t\t};\n\t});\n}\nfunction checkNoCollectionSettings(model, refusals) {\n\tconst key = {\n\t\tkind: \"collectionSettings\",\n\t\tmodel: model.modelName\n\t};\n\tif (model.indexes && model.indexes.length > 0) refusals.push({\n\t\tkind: \"collectionSettingWithoutCollection\",\n\t\tkey,\n\t\tsetting: \"indexes\"\n\t});\n\tif (model.collectionOptions) refusals.push({\n\t\tkind: \"collectionSettingWithoutCollection\",\n\t\tkey,\n\t\tsetting: \"collectionOptions\"\n\t});\n\tif (model.controlPolicy) refusals.push({\n\t\tkind: \"collectionSettingWithoutCollection\",\n\t\tkey,\n\t\tsetting: \"controlPolicy\"\n\t});\n}\n/** Each collection the models are stored in, with its indexes, options and control policy. Validators are added later. */\nfunction buildCollections(input) {\n\tconst { models, variantValues, refusals } = input;\n\tconst intermediate = {};\n\tconst indexOwnersByCollection = /* @__PURE__ */ new Map();\n\tconst indexNameOwnersByCollection = /* @__PURE__ */ new Map();\n\tconst textIndexCollections = /* @__PURE__ */ new Set();\n\tconst modelsByName = new Map(models.map((model) => [model.modelName, model]));\n\tfor (const model of models) {\n\t\tconst { modelName, collection } = model;\n\t\tif (!collection) {\n\t\t\tcheckNoCollectionSettings(model, refusals);\n\t\t\tcontinue;\n\t\t}\n\t\tconst collectionKey = {\n\t\t\tkind: \"collectionSettings\",\n\t\t\tmodel: modelName\n\t\t};\n\t\tconst existingCollection = intermediate[collection] ?? {};\n\t\tconst existingIndexes = existingCollection.indexes ?? [];\n\t\tconst indexOwners = indexOwnersByCollection.get(collection) ?? /* @__PURE__ */ new Map();\n\t\tindexOwnersByCollection.set(collection, indexOwners);\n\t\tconst nameOwners = indexNameOwnersByCollection.get(collection) ?? /* @__PURE__ */ new Map();\n\t\tindexNameOwnersByCollection.set(collection, nameOwners);\n\t\tif (existingCollection.options && model.collectionOptions) refusals.push({\n\t\t\tkind: \"collectionSettingTwice\",\n\t\t\tkey: collectionKey,\n\t\t\tsetting: \"collectionOptions\",\n\t\t\tcollection\n\t\t});\n\t\tif (existingCollection.control !== void 0 && model.controlPolicy) refusals.push({\n\t\t\tkind: \"collectionSettingTwice\",\n\t\t\tkey: collectionKey,\n\t\t\tsetting: \"controlPolicy\",\n\t\t\tcollection\n\t\t});\n\t\tconst storageIndexes = [];\n\t\tcheckModelIndexes(model, modelsByName, variantValues).forEach((checked, position) => {\n\t\t\tif (checked.kind === \"refused\") {\n\t\t\t\trefusals.push(checked.refusal);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst key = {\n\t\t\t\tkind: \"index\",\n\t\t\t\tmodel: modelName,\n\t\t\t\tposition\n\t\t\t};\n\t\t\tconst signature = indexSignature(checked.written, model.fields);\n\t\t\tif (isTextIndex(checked.written)) {\n\t\t\t\tif (textIndexCollections.has(collection)) {\n\t\t\t\t\trefusals.push({\n\t\t\t\t\t\tkind: \"indexShape\",\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\trule: \"second-text-index\",\n\t\t\t\t\t\tsignature\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttextIndexCollections.add(collection);\n\t\t\t}\n\t\t\tconst lookupKey = indexLookupKey(checked.index);\n\t\t\tconst first = indexOwners.get(lookupKey);\n\t\t\tif (first !== void 0) {\n\t\t\t\trefusals.push({\n\t\t\t\t\tkind: \"indexDuplicate\",\n\t\t\t\t\tkey,\n\t\t\t\t\tcollection,\n\t\t\t\t\tfirstModel: first.model,\n\t\t\t\t\tfirstPosition: first.position,\n\t\t\t\t\tsignature\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst firstNamed = nameOwners.get(checked.index.name);\n\t\t\tif (firstNamed !== void 0) {\n\t\t\t\trefusals.push({\n\t\t\t\t\tkind: \"indexNameDuplicate\",\n\t\t\t\t\tkey,\n\t\t\t\t\tcollection,\n\t\t\t\t\tname: checked.index.name,\n\t\t\t\t\tfirstModel: firstNamed.model,\n\t\t\t\t\tfirstPosition: firstNamed.position\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindexOwners.set(lookupKey, key);\n\t\t\tnameOwners.set(checked.index.name, key);\n\t\t\tstorageIndexes.push(checked.index);\n\t\t});\n\t\tconst storageOptions = model.collectionOptions ? toStorageCollectionOptions(model.collectionOptions) : void 0;\n\t\tintermediate[collection] = {\n\t\t\t...existingCollection,\n\t\t\t...storageIndexes.length > 0 ? { indexes: [...existingIndexes, ...storageIndexes] } : {},\n\t\t\t...ifDefined(\"options\", storageOptions),\n\t\t\t...ifDefined(\"control\", model.controlPolicy)\n\t\t};\n\t}\n\treturn intermediate;\n}\n//#endregion\n//#region src/build-enums.ts\n/** Each enum with its members as its codec stores them. An enum the builder refuses is left out. */\nfunction buildEnums(definition, codecLookup, refusals) {\n\tconst builtEnums = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tconst encoded = encodeEnumMembers(handle, codecLookup);\n\t\tif (!encoded.ok) {\n\t\t\tfor (const problem of encoded.failure) refusals.push({\n\t\t\t\tkind: \"enumMemberProblem\",\n\t\t\t\tkey: \"member\" in problem ? {\n\t\t\t\t\tkind: \"enumMember\",\n\t\t\t\t\tenumName,\n\t\t\t\t\tmember: problem.member\n\t\t\t\t} : {\n\t\t\t\t\tkind: \"enum\",\n\t\t\t\t\tenumName\n\t\t\t\t},\n\t\t\t\tenumName: handle.enumName,\n\t\t\t\tcodecId: handle.codecId,\n\t\t\t\tproblem\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tbuiltEnums[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: encoded.value\n\t\t};\n\t}\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) if (enumName !== handle.enumName) refusals.push({\n\t\tkind: \"enumKeyMismatch\",\n\t\tkey: {\n\t\t\tkind: \"enum\",\n\t\t\tenumName\n\t\t},\n\t\tenumName: handle.enumName\n\t});\n\treturn builtEnums;\n}\n//#endregion\n//#region src/build-execution-defaults.ts\nconst PHASES = [\"onCreate\", \"onUpdate\"];\nfunction hasExecutionDefaults(field) {\n\tconst phases = field.executionDefaults;\n\tconst calls = field.generatorCalls;\n\tconst values = field.generatedValues;\n\treturn phases?.onCreate !== void 0 || phases?.onUpdate !== void 0 || values?.onCreate !== void 0 || values?.onUpdate !== void 0 || calls?.onCreate !== void 0 || calls?.onUpdate !== void 0;\n}\n/**\n* The phases a field generates: its resolved execution defaults, with the generators its calls resolve to for its codec. Undefined when a call is refused.\n*/\nfunction executionDefaultsOf(field, key, generatorFunctions, refusals) {\n\tconst typeGiven = field.executionDefaults;\n\tlet refused = false;\n\tfor (const phase of PHASES) if (typeGiven?.[phase] !== void 0 && field.generatedValues?.[phase] !== void 0) {\n\t\trefusals.push({\n\t\t\tkind: \"generatorPhaseSetTwice\",\n\t\t\tkey,\n\t\t\tphase\n\t\t});\n\t\trefused = true;\n\t}\n\tconst written = {\n\t\t...typeGiven,\n\t\t...field.generatedValues\n\t};\n\tconst calls = field.generatorCalls;\n\tif (calls === void 0) return refused ? void 0 : written;\n\tconst type = field.type;\n\tconst codecId = type.kind === \"scalar\" ? type.codecId : void 0;\n\tconst phases = written;\n\tfor (const phase of PHASES) {\n\t\tconst call = calls[phase];\n\t\tif (call === void 0) continue;\n\t\tif (written[phase] !== void 0) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"generatorPhaseSetTwice\",\n\t\t\t\tkey,\n\t\t\t\tphase\n\t\t\t});\n\t\t\trefused = true;\n\t\t\tcontinue;\n\t\t}\n\t\tconst resolution = type.kind === \"scalar\" ? generatorFunctions.resolve(call, {\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\trefused = true;\n\t\trefusals.push(resolution?.reason === \"unknown-function\" ? {\n\t\t\tkind: \"generatorUnknown\",\n\t\t\tkey,\n\t\t\tphase,\n\t\t\tfunctionName: call.name,\n\t\t\tcodecId\n\t\t} : {\n\t\t\tkind: \"generatorNotApplicable\",\n\t\t\tkey,\n\t\t\tphase,\n\t\t\tfunctionName: call.name,\n\t\t\tcodecId,\n\t\t\tmessage: resolution?.reason === \"refused\" ? resolution.message : void 0\n\t\t});\n\t}\n\treturn refused ? void 0 : phases;\n}\nfunction checkValueObjectExecutionDefaults(valueObjects, refusals) {\n\tfor (const valueObject of valueObjects ?? []) for (const field of valueObject.fields) if (hasExecutionDefaults(field)) refusals.push({\n\t\tkind: \"generatedOnValueObject\",\n\t\tkey: valueObjectFieldKey(valueObject.name, field.fieldName)\n\t});\n}\nfunction buildExecutionDefaults(input) {\n\tconst { models, generatorFunctions, namespaceId, refusals } = input;\n\tconst collectionByModelName = new Map(models.map((model) => [model.modelName, model.collection]));\n\tconst byRef = /* @__PURE__ */ new Map();\n\tconst defaults = [];\n\tfor (const model of models) {\n\t\tconst { modelName } = model;\n\t\tfor (const field of model.fields) {\n\t\t\tif (!hasExecutionDefaults(field)) continue;\n\t\t\tconst { fieldName } = field;\n\t\t\tconst key = modelFieldKey(modelName, fieldName);\n\t\t\tconst phases = executionDefaultsOf(field, key, generatorFunctions, refusals);\n\t\t\tif (phases === void 0) continue;\n\t\t\tif (field.many) {\n\t\t\t\trefusals.push({\n\t\t\t\t\tkind: \"generatedList\",\n\t\t\t\t\tkey\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (model.base !== void 0) {\n\t\t\t\trefusals.push({\n\t\t\t\t\tkind: \"generatedOnVariant\",\n\t\t\t\t\tkey,\n\t\t\t\t\tbaseModel: model.base.model,\n\t\t\t\t\tcollection: model.collection ?? collectionByModelName.get(model.base.model)\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst entry = model.collection;\n\t\t\tif (entry === void 0) {\n\t\t\t\trefusals.push({\n\t\t\t\t\tkind: \"generatedWithoutCollection\",\n\t\t\t\t\tkey\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storedName = storedNameOf(field);\n\t\t\tconst refKey = JSON.stringify([entry, storedName]);\n\t\t\tconst phasesKey = canonicalStringify(phases);\n\t\t\tconst existing = byRef.get(refKey);\n\t\t\tif (existing !== void 0) {\n\t\t\t\tif (existing.phasesKey !== phasesKey) refusals.push({\n\t\t\t\t\tkind: \"generatedConflict\",\n\t\t\t\t\tkey,\n\t\t\t\t\totherModel: existing.modelName,\n\t\t\t\t\totherField: existing.fieldName,\n\t\t\t\t\tcollection: entry\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbyRef.set(refKey, {\n\t\t\t\tmodelName,\n\t\t\t\tfieldName,\n\t\t\t\tphasesKey\n\t\t\t});\n\t\t\tdefaults.push({\n\t\t\t\tref: {\n\t\t\t\t\tnamespace: namespaceId,\n\t\t\t\t\tentry,\n\t\t\t\t\tfield: storedName\n\t\t\t\t},\n\t\t\t\t...phases\n\t\t\t});\n\t\t}\n\t}\n\treturn defaults;\n}\n//#endregion\n//#region src/build-fields.ts\nfunction checkField(field, key, input) {\n\tconst { type } = field;\n\tif (field.enumName !== void 0 && !input.declaredEnums.has(field.enumName)) input.refusals.push({\n\t\tkind: \"enumUnknown\",\n\t\tkey,\n\t\tenumName: field.enumName\n\t});\n\tif (type.kind === \"scalar\" && type.typeParams !== void 0) {\n\t\tconst problem = codecTypeParamsProblem(type.codecId, type.typeParams, input.lookups);\n\t\tif (problem !== void 0) input.refusals.push({\n\t\t\tkind: \"typeParamsInvalid\",\n\t\t\tkey,\n\t\t\tproblem\n\t\t});\n\t}\n}\n/**\n* Checks each field of the models and value objects on its own: its enum is declared, and its data type accepts its type parameters.\n*/\nfunction checkFields(input) {\n\tfor (const model of input.models) for (const field of model.fields) checkField(field, modelFieldKey(model.modelName, field.fieldName), input);\n\tfor (const valueObject of input.valueObjects ?? []) for (const field of valueObject.fields) checkField(field, valueObjectFieldKey(valueObject.name, field.fieldName), input);\n}\n//#endregion\n//#region src/build-polymorphism.ts\n/**\n* The models with each variant stored in its base's collection: a variant that names no collection takes its base's, and one that names another is refused.\n*/\nfunction inheritVariantCollections(models, refusals) {\n\tconst modelsByName = new Map(models.map((model) => [model.modelName, model]));\n\treturn models.map((model) => {\n\t\tif (model.base === void 0) return model;\n\t\tconst baseCollection = modelsByName.get(model.base.model)?.collection;\n\t\tif (baseCollection === void 0) return model;\n\t\tif (model.collection === void 0) return {\n\t\t\t...model,\n\t\t\tcollection: baseCollection\n\t\t};\n\t\tif (model.collection !== baseCollection) refusals.push({\n\t\t\tkind: \"variantCollectionDiffers\",\n\t\t\tkey: {\n\t\t\t\tkind: \"collectionSettings\",\n\t\t\t\tmodel: model.modelName\n\t\t\t},\n\t\t\tcollection: model.collection,\n\t\t\tbaseModel: model.base.model,\n\t\t\tbaseCollection\n\t\t});\n\t\treturn model;\n\t});\n}\nfunction checkVariantShape(model, modelsByName, refusals) {\n\tif (model.base === void 0) return;\n\tconst key = {\n\t\tkind: \"base\",\n\t\tvariant: model.modelName\n\t};\n\tconst baseModel = model.base.model;\n\tif (model.discriminator !== void 0) refusals.push({\n\t\tkind: \"discriminatorAndBase\",\n\t\tkey: {\n\t\t\tkind: \"discriminator\",\n\t\t\tmodel: model.modelName\n\t\t}\n\t});\n\tconst base = modelsByName.get(baseModel);\n\tif (base === void 0) {\n\t\trefusals.push({\n\t\t\tkind: \"baseUnknown\",\n\t\t\tkey,\n\t\t\tbaseModel\n\t\t});\n\t\treturn;\n\t}\n\tif (base.discriminator === void 0) {\n\t\trefusals.push({\n\t\t\tkind: \"baseWithoutDiscriminator\",\n\t\t\tkey,\n\t\t\tbaseModel\n\t\t});\n\t\treturn;\n\t}\n\tif (model.base.value === void 0) refusals.push({\n\t\tkind: \"variantWithoutValue\",\n\t\tkey,\n\t\tbaseModel\n\t});\n}\n/** Each variant of `base` with the value its source wrote, in the order of the models. */\nfunction writtenVariantsOf(base, models) {\n\treturn models.flatMap((model) => model.base?.model === base.modelName && model.base.value !== void 0 ? [{\n\t\tkey: model.modelName,\n\t\twritten: model.base.value\n\t}] : []);\n}\nfunction decideDiscriminator(input) {\n\tconst { base, models, refusals } = input;\n\tconst discriminator = base.discriminator;\n\tif (discriminator === void 0 || base.base !== void 0) return /* @__PURE__ */ new Map();\n\tconst key = {\n\t\tkind: \"discriminator\",\n\t\tmodel: base.modelName\n\t};\n\tconst variantNames = new Set(models.filter((model) => model.base?.model === base.modelName).map((model) => model.modelName));\n\tfor (const listed of discriminator.listedVariants ?? []) if (!variantNames.has(listed)) refusals.push({\n\t\tkind: \"listedVariantMissing\",\n\t\tkey,\n\t\tvariant: listed\n\t});\n\tif (variantNames.size === 0) refusals.push({\n\t\tkind: \"discriminatorWithoutVariants\",\n\t\tkey\n\t});\n\tconst fieldName = discriminator.field;\n\tconst field = base.fields.find((candidate) => candidate.fieldName === fieldName);\n\tif (field === void 0) {\n\t\trefusals.push({\n\t\t\tkind: \"discriminatorFieldUnknown\",\n\t\t\tkey,\n\t\t\tfieldName\n\t\t});\n\t\treturn /* @__PURE__ */ new Map();\n\t}\n\tconst { type } = field;\n\tconst enumMembers = field.enumName === void 0 ? void 0 : input.enums[field.enumName]?.members.map((member) => member.value);\n\tconst decision = applyDiscriminatorRule({\n\t\tfield: {\n\t\t\tref: type.kind === \"scalar\" ? {\n\t\t\t\tcodecId: type.codecId,\n\t\t\t\t...type.typeParams ? { typeParams: blindCast(type.typeParams) } : {}\n\t\t\t} : void 0,\n\t\t\tnullable: field.nullable,\n\t\t\tmany: field.many !== false,\n\t\t\tenumMembers\n\t\t},\n\t\tvariants: writtenVariantsOf(base, models),\n\t\tsubject: `Field \"${base.modelName}.${fieldName}\"`,\n\t\tcodecLookup: input.codecLookup,\n\t\tdataTypes: input.dataTypes\n\t});\n\tfor (const refusal of decision.fieldRefusals) refusals.push({\n\t\tkind: \"discriminatorField\",\n\t\tkey,\n\t\tfieldName,\n\t\trefusal\n\t});\n\tfor (const refusal of decision.variantRefusals) refusals.push({\n\t\tkind: \"discriminatorValue\",\n\t\tkey: {\n\t\t\tkind: \"base\",\n\t\t\tvariant: refusal.key\n\t\t},\n\t\tbaseModel: base.modelName,\n\t\tfieldName,\n\t\tenumName: field.enumName,\n\t\trefusal\n\t});\n\tconst variantsByValue = /* @__PURE__ */ new Map();\n\tfor (const [variant, value] of decision.values) {\n\t\tconst firstVariant = variantsByValue.get(value);\n\t\tif (firstVariant !== void 0) {\n\t\t\trefusals.push({\n\t\t\t\tkind: \"discriminatorValueDuplicate\",\n\t\t\t\tkey: {\n\t\t\t\t\tkind: \"base\",\n\t\t\t\t\tvariant\n\t\t\t\t},\n\t\t\t\tbaseModel: base.modelName,\n\t\t\t\tvalue,\n\t\t\t\tfirstVariant\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tvariantsByValue.set(value, variant);\n\t}\n\treturn decision.values;\n}\n/**\n* Checks each base and variant, and decides each variant's discriminator value with the framework's discriminator rule. Returns each accepted variant's value as its base's discriminator field stores it.\n*/\nfunction decidePolymorphism(input) {\n\tconst { models, refusals } = input;\n\tconst modelsByName = new Map(models.map((model) => [model.modelName, model]));\n\tconst values = /* @__PURE__ */ new Map();\n\tfor (const model of models) {\n\t\tcheckVariantShape(model, modelsByName, refusals);\n\t\tfor (const [variant, value] of decideDiscriminator({\n\t\t\t...input,\n\t\t\tbase: model\n\t\t})) values.set(variant, value);\n\t}\n\treturn values;\n}\n//#endregion\n//#region src/build-contract.ts\n/** Whether a refusal is about listing an enum in a collection validator, which matters only when collections get validators. */\nfunction isAboutEnumListing(refusal) {\n\treturn refusal.kind === \"enumBsonType\" || refusal.kind === \"enumNotListable\" || refusal.kind === \"enumMemberNotListable\";\n}\n/**\n* Builds a MongoDB contract from its plain-data definition, with the stack's codecs and data types. Every MongoDB family rule is checked here, and each refusal comes back as data keyed by the part of the definition it is about, for the source to report in its own terms.\n*/\nfunction buildMongoContractFromDefinition(definition, codecLookup, dataTypes) {\n\tconst refusals = [];\n\tconst warnings = (definition.warnings ?? []).map((warning) => ({\n\t\tkind: \"source\",\n\t\twarning\n\t}));\n\tconst namespaceId = definition.target.defaultNamespaceId;\n\tconst lookups = {\n\t\tcodecLookup,\n\t\tdataTypeLookup: dataTypes.lookup\n\t};\n\tconst generatorFunctions = assembleGeneratorFunctions([definition.target, ...Object.values(definition.extensions ?? {})]);\n\tconst models = inheritVariantCollections(definition.models, refusals);\n\tconst builtEnums = buildEnums(definition, codecLookup, refusals);\n\tconst variantValues = decidePolymorphism({\n\t\tmodels,\n\t\tenums: builtEnums,\n\t\tcodecLookup,\n\t\tdataTypes,\n\t\trefusals\n\t});\n\tconst builtModels = buildModels({\n\t\tmodels,\n\t\tvariantValues,\n\t\tnamespaceId,\n\t\trefusals\n\t});\n\tconst builtValueObjects = buildValueObjects(definition.valueObjects, namespaceId, refusals);\n\tcheckFields({\n\t\tmodels,\n\t\tvalueObjects: definition.valueObjects,\n\t\tdeclaredEnums: new Set(Object.keys(definition.enums ?? {})),\n\t\tlookups,\n\t\trefusals,\n\t\twarnings\n\t});\n\tconst collections = buildCollections({\n\t\tmodels,\n\t\tvariantValues,\n\t\trefusals\n\t});\n\tcheckValueObjectExecutionDefaults(definition.valueObjects, refusals);\n\tconst executionDefaults = buildExecutionDefaults({\n\t\tmodels,\n\t\tgeneratorFunctions,\n\t\tnamespaceId,\n\t\trefusals\n\t});\n\tif (refusals.length > 0) return notOk({\n\t\trefusals,\n\t\twarnings\n\t});\n\tconst controlPolicies = {\n\t\tcollections: Object.fromEntries(Object.entries(collections).map(([name, collection]) => [name, collection.control])),\n\t\tdefaultControlPolicy: definition.defaultControlPolicy\n\t};\n\tconst validatorRefusals = mongoContractRefusalsOf({\n\t\tmodels: builtModels,\n\t\tvalueObjects: builtValueObjects,\n\t\tenums: builtEnums,\n\t\tlookups,\n\t\tcontrolPolicies\n\t}).filter((refusal) => definition.writesCollectionValidators || !isAboutEnumListing(refusal));\n\tif (validatorRefusals.length > 0) return notOk({\n\t\trefusals: validatorRefusals.map((refusal) => ({\n\t\t\tkind: \"validator\",\n\t\t\tkey: validatorRefusalKey(refusal),\n\t\t\trefusal\n\t\t})),\n\t\twarnings\n\t});\n\tconst storageValueSets = mongoValueSetsOf(builtEnums);\n\tconst validators = definition.writesCollectionValidators ? deriveCollectionValidators({\n\t\tmodels: builtModels,\n\t\tlookups,\n\t\tstorage: { namespaces: { [namespaceId]: {\n\t\t\tid: namespaceId,\n\t\t\tentries: { valueObject: builtValueObjects }\n\t\t} } },\n\t\tvalueSets: storageValueSets,\n\t\tcontrolPolicies\n\t}) : {};\n\tconst storage = buildMongoStorage({\n\t\tnamespaceId,\n\t\tcollections: Object.fromEntries(Object.entries(collections).map(([name, collection]) => [name, {\n\t\t\t...collection,\n\t\t\t...ifDefined(\"validator\", validators[name])\n\t\t}])),\n\t\tvalueSets: storageValueSets,\n\t\tvalueObjects: builtValueObjects\n\t});\n\tconst capabilities = {};\n\tconst execution = buildExecutionSection({\n\t\ttarget: definition.target.targetId,\n\t\ttargetFamily: definition.target.familyId,\n\t\tdefaults: executionDefaults\n\t});\n\treturn ok({\n\t\tcontract: {\n\t\t\ttarget: definition.target.targetId,\n\t\t\ttargetFamily: definition.target.familyId,\n\t\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\t\troots: buildRoots(definition, models, namespaceId),\n\t\t\tdomain: { namespaces: { [namespaceId]: {\n\t\t\t\tmodels: builtModels,\n\t\t\t\t...Object.keys(builtEnums).length > 0 ? { enum: builtEnums } : {}\n\t\t\t} } },\n\t\t\tstorage,\n\t\t\tcapabilities,\n\t\t\textensions: definition.extensions ?? {},\n\t\t\tprofileHash: computeProfileHash({\n\t\t\t\ttarget: definition.target.targetId,\n\t\t\t\ttargetFamily: definition.target.familyId,\n\t\t\t\tcapabilities\n\t\t\t}),\n\t\t\tmeta: {},\n\t\t\t...ifDefined(\"execution\", execution)\n\t\t},\n\t\twarnings\n\t});\n}\n//#endregion\n//#region src/contract-dsl.ts\nfunction resolveModelName(value) {\n\treturn typeof value === \"string\" ? value : value.__name;\n}\n//#endregion\n//#region src/contract-lowering.ts\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\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 fieldNodes(fields) {\n\treturn Object.entries(fields).map(([fieldName, builder]) => ({\n\t\tfieldName,\n\t\t...ifDefined(\"storedName\", builder.__storedName),\n\t\ttype: builder.__type,\n\t\tnullable: builder.__nullable,\n\t\tmany: builder.__many,\n\t\t...ifDefined(\"enumName\", builder.__enumHandle?.enumName),\n\t\t...ifDefined(\"executionDefaults\", builder.__executionDefaults),\n\t\t...ifDefined(\"generatorCalls\", builder.__generatorCalls)\n\t}));\n}\nfunction relationNodes(builder) {\n\treturn Object.entries(builder.__relations).map(([relationName, relation]) => {\n\t\tconst common = {\n\t\t\trelationName,\n\t\t\ttoModel: relation.__to,\n\t\t\tnullable: relation.__nullable\n\t\t};\n\t\treturn relation.__on === void 0 ? {\n\t\t\t...common,\n\t\t\tcardinality: relation.__cardinality\n\t\t} : {\n\t\t\t...common,\n\t\t\tcardinality: relation.__cardinality,\n\t\t\ton: relation.__on\n\t\t};\n\t});\n}\nfunction modelNode(builder, buildersByName) {\n\tconst base = builder.__base;\n\tconst variantValue = base === void 0 ? void 0 : buildersByName.get(base)?.__variants?.[builder.__name]?.value;\n\treturn {\n\t\tmodelName: builder.__name,\n\t\t...ifDefined(\"collection\", builder.__collection),\n\t\t...ifDefined(\"owner\", builder.__owner),\n\t\t...ifDefined(\"storageRelations\", builder.__storageRelations),\n\t\t...ifDefined(\"controlPolicy\", builder.__controlPolicy),\n\t\t...ifDefined(\"collectionOptions\", builder.__collectionOptions),\n\t\t...ifDefined(\"indexes\", builder.__indexes),\n\t\tfields: fieldNodes(builder.__fields),\n\t\trelations: relationNodes(builder),\n\t\t...builder.__discriminator === void 0 ? {} : { discriminator: {\n\t\t\tfield: builder.__discriminator.field,\n\t\t\tlistedVariants: Object.keys(builder.__variants ?? {})\n\t\t} },\n\t\t...base === void 0 ? {} : { base: {\n\t\t\tmodel: base,\n\t\t\tvalue: variantValue === void 0 ? void 0 : {\n\t\t\t\tkind: \"string\",\n\t\t\t\ttext: variantValue\n\t\t\t}\n\t\t} }\n\t};\n}\nfunction valueObjectNode(builder) {\n\treturn {\n\t\tname: builder.__name,\n\t\tfields: fieldNodes(builder.__fields)\n\t};\n}\n/** Turns `defineContract`'s builder objects into the plain-data definition the contract is built from. */\nfunction buildContractDefinition(input) {\n\tconst { target } = input;\n\tvalidateTargetPackRef(input.family, target);\n\tvalidateExtensionPackRefs(target, input.extensions);\n\tconst builders = Object.values(input.models ?? {});\n\tconst buildersByName = /* @__PURE__ */ new Map();\n\tfor (const builder of builders) if (!buildersByName.has(builder.__name)) buildersByName.set(builder.__name, builder);\n\treturn {\n\t\ttarget,\n\t\t...ifDefined(\"extensions\", input.extensions),\n\t\t...ifDefined(\"defaultControlPolicy\", input.defaultControlPolicy),\n\t\tmodels: builders.map((builder) => modelNode(builder, buildersByName)),\n\t\tvalueObjects: Object.values(input.valueObjects ?? {}).map(valueObjectNode),\n\t\t...ifDefined(\"enums\", input.enums),\n\t\t...ifDefined(\"roots\", input.roots === void 0 ? void 0 : Object.fromEntries(Object.entries(input.roots).map(([rootName, model]) => [rootName, resolveModelName(model)]))),\n\t\twritesCollectionValidators: true,\n\t\twarnings: void 0\n\t};\n}\n//#endregion\n//#region src/merge-redundant-indexes.ts\nfunction positionKey({ model, position }) {\n\treturn JSON.stringify([model, position]);\n}\n/**\n* Removes each identical or redundant index in a collection, for the Prisma 8 authoring sources to call after `nameIndexes` and before the builder. Two indexes match when they have the same name and their storage indexes, variant scope applied, have the same `indexLookupKey` with `unique` left out. Indexes with different names are both kept: the user named them apart, and the builder refuses two identical ones. Of a matching pair the first is kept, unless only the later one is unique; then the later one is kept and the earlier removed. Indexes the builder refuses are left for it to refuse. A source that reports the builder's refusals by index position maps them back through `removedIndexes`.\n*/\nfunction mergeRedundantIndexes(definition, codecLookup, dataTypes) {\n\tconst refusalsLeftToTheBuilder = [];\n\tconst models = inheritVariantCollections(definition.models, refusalsLeftToTheBuilder);\n\tconst variantValues = decidePolymorphism({\n\t\tmodels,\n\t\tenums: buildEnums(definition, codecLookup, refusalsLeftToTheBuilder),\n\t\tcodecLookup,\n\t\tdataTypes,\n\t\trefusals: refusalsLeftToTheBuilder\n\t});\n\tconst modelsByName = new Map(models.map((model) => [model.modelName, model]));\n\tconst heldByCollection = /* @__PURE__ */ new Map();\n\tconst removedIndexes = [];\n\tfor (const model of models) {\n\t\tconst { collection } = model;\n\t\tif (!collection) continue;\n\t\tconst held = heldByCollection.get(collection) ?? [];\n\t\theldByCollection.set(collection, held);\n\t\tcheckModelIndexes(model, modelsByName, variantValues).forEach((checked, position) => {\n\t\t\tif (checked.kind === \"refused\") return;\n\t\t\tconst index = {\n\t\t\t\tmodel: model.modelName,\n\t\t\t\tposition,\n\t\t\t\tlookupKey: indexLookupKey({\n\t\t\t\t\t...checked.index,\n\t\t\t\t\tunique: void 0\n\t\t\t\t}),\n\t\t\t\tname: checked.index.name,\n\t\t\t\tunique: checked.index.unique === true\n\t\t\t};\n\t\t\tconst matchingAt = held.findIndex((candidate) => candidate.lookupKey === index.lookupKey && candidate.name === index.name);\n\t\t\tconst match = held[matchingAt];\n\t\t\tif (match !== void 0) {\n\t\t\t\tif (match.unique || !index.unique) {\n\t\t\t\t\tremovedIndexes.push({\n\t\t\t\t\t\tmodel: index.model,\n\t\t\t\t\t\tposition: index.position\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tremovedIndexes.push({\n\t\t\t\t\tmodel: match.model,\n\t\t\t\t\tposition: match.position\n\t\t\t\t});\n\t\t\t\theld.splice(matchingAt, 1);\n\t\t\t}\n\t\t\theld.push(index);\n\t\t});\n\t}\n\tif (removedIndexes.length === 0) return {\n\t\tdefinition,\n\t\tremovedIndexes\n\t};\n\tconst removed = new Set(removedIndexes.map(positionKey));\n\tconst withoutRemoved = (model) => model.indexes === void 0 ? model : {\n\t\t...model,\n\t\tindexes: model.indexes.filter((_, position) => !removed.has(positionKey({\n\t\t\tmodel: model.modelName,\n\t\t\tposition\n\t\t})))\n\t};\n\treturn {\n\t\tdefinition: {\n\t\t\t...definition,\n\t\t\tmodels: definition.models.map(withoutRemoved)\n\t\t},\n\t\tremovedIndexes\n\t};\n}\n/** The position a model wrote an index at, from its position in the model's indexes after the merge. */\nfunction writtenIndexPosition(removedIndexes, model, mergedPosition) {\n\tconst removed = removedIndexes.filter((index) => index.model === model).map((index) => index.position).sort((a, b) => a - b);\n\tlet position = mergedPosition;\n\tfor (const removedPosition of removed) if (removedPosition <= position) position++;\n\treturn position;\n}\n/** The refusal with its index positions counted as the source wrote them, before the merge. */\nfunction refusalAtWrittenPositions(refusal, removedIndexes) {\n\tif (refusal.key.kind !== \"index\" || removedIndexes.length === 0) return refusal;\n\tconst key = {\n\t\t...refusal.key,\n\t\tposition: writtenIndexPosition(removedIndexes, refusal.key.model, refusal.key.position)\n\t};\n\tswitch (refusal.kind) {\n\t\tcase \"indexDuplicate\":\n\t\tcase \"indexNameDuplicate\": return {\n\t\t\t...refusal,\n\t\t\tkey,\n\t\t\tfirstPosition: writtenIndexPosition(removedIndexes, refusal.firstModel, refusal.firstPosition)\n\t\t};\n\t\tdefault: return blindCast({\n\t\t\t...refusal,\n\t\t\tkey\n\t\t});\n\t}\n}\n//#endregion\n//#region src/name-indexes.ts\nfunction namedIndex(index, model) {\n\tif (index.options?.name !== void 0) return index;\n\treturn {\n\t\t...index,\n\t\toptions: {\n\t\t\t...index.options,\n\t\t\tname: defaultIndexNameOf(index, model.fields)\n\t\t}\n\t};\n}\n/**\n* Names each index the definition writes without a name as MongoDB names an index created without one: its stored keys and directions, such as `email_1`. The Prisma 8 authoring sources call it before `mergeRedundantIndexes` and the builder. Two indexes of one collection that get one name are left for the builder to refuse.\n*/\nfunction nameIndexes(definition) {\n\treturn {\n\t\t...definition,\n\t\tmodels: definition.models.map((model) => model.indexes === void 0 ? model : {\n\t\t\t...model,\n\t\t\tindexes: model.indexes.map((index) => namedIndex(index, model))\n\t\t})\n\t};\n}\n//#endregion\n//#region src/refusal-errors.ts\nconst LIST_THE_CODEC_PACK = \"List the pack that provides the codec in `extensions` in defineContract.\";\nfunction codecRefusalError(subject, meta, codecId, refusal) {\n\tif (refusal.kind === \"unknownCodec\") return contractError(\"CONTRACT.CODEC_DESCRIPTOR_MISSING\", `${subject} ${refusal.reason}`, {\n\t\tfix: LIST_THE_CODEC_PACK,\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tcodecId\n\t\t}\n\t});\n\treturn contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `${subject} ${refusal.reason}`, {\n\t\tfix: \"Use a codec whose data type is a MongoDB data type, declared with mongoDataType.\",\n\t\tmeta: {\n\t\t\t...meta,\n\t\t\tcodecId,\n\t\t\tdataType: refusal.dataType,\n\t\t\treason: \"data-type-not-mongo\"\n\t\t}\n\t});\n}\nfunction validatorRefusalError(refusal) {\n\tswitch (refusal.kind) {\n\t\tcase \"embeddedModelHasVariants\": return contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${refusal.modelName}.${refusal.relationName}\" ${refusal.reason}`, { meta: {\n\t\t\tmodelName: refusal.modelName,\n\t\t\trelationName: refusal.relationName,\n\t\t\treason: \"embedded-model-has-variants\"\n\t\t} });\n\t\tcase \"enumBsonType\": return codecRefusalError(`enumType(\"${refusal.enumName}\")`, { enumName: refusal.enumName }, refusal.codecId, refusal.refusal);\n\t\tcase \"enumNotListable\": return contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${refusal.enumName}\") codec \"${refusal.codecId}\" ${refusal.reason}`, { meta: {\n\t\t\tenumName: refusal.enumName,\n\t\t\tcodecId: refusal.codecId,\n\t\t\treason: \"not-listable-by-validator\"\n\t\t} });\n\t\tcase \"enumMemberNotListable\": return contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${refusal.enumName}\") member \"${refusal.member}\" ${refusal.reason}`, { meta: {\n\t\t\tenumName: refusal.enumName,\n\t\t\tmember: refusal.member,\n\t\t\tcodecId: refusal.codecId,\n\t\t\treason: \"member-not-listable-by-validator\"\n\t\t} });\n\t\tcase \"fieldBsonType\": {\n\t\t\tconst { owner } = refusal;\n\t\t\tconst label = owner.kind === \"model\" ? \"Model\" : \"Value object\";\n\t\t\tconst ownerMeta = owner.kind === \"model\" ? { modelName: owner.name } : { valueObjectName: owner.name };\n\t\t\treturn codecRefusalError(`${label} \"${owner.name}\" field \"${refusal.fieldName}\"`, {\n\t\t\t\t...ownerMeta,\n\t\t\t\tfieldName: refusal.fieldName\n\t\t\t}, refusal.codecId, refusal.refusal);\n\t\t}\n\t\tcase \"documentId\": return contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${refusal.modelName}\" field \"${refusal.fieldName}\" ${refusal.reason}`, { meta: {\n\t\t\tmodelName: refusal.modelName,\n\t\t\tfieldName: refusal.fieldName,\n\t\t\tcollection: refusal.collection,\n\t\t\tcodecId: refusal.codecId,\n\t\t\tbsonTypes: refusal.forbidden,\n\t\t\treason: \"document-id-bson-type\"\n\t\t} });\n\t}\n}\nfunction defaultError(key, reason, message) {\n\treturn contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${`${key.owner.name}.${key.field}`}\" ${message}`, { meta: {\n\t\tmodelName: key.owner.name,\n\t\tfieldName: key.field,\n\t\treason\n\t} });\n}\nfunction ownerMetaOf(key) {\n\treturn key.owner.kind === \"model\" ? {\n\t\tmodelName: key.owner.name,\n\t\tfieldName: key.field\n\t} : {\n\t\tvalueObjectName: key.owner.name,\n\t\tfieldName: key.field\n\t};\n}\nfunction ownerLabelOf(key) {\n\treturn `${key.owner.kind === \"model\" ? \"Model\" : \"Value object\"} \"${key.owner.name}\" field \"${key.field}\"`;\n}\nconst INDEX_SHAPE_MESSAGES = {\n\t\"unique-wildcard\": \"is unique and has a wildcard key; a unique index cannot use a wildcard.\",\n\t\"wildcard-with-type\": \"combines a wildcard key with a hashed, 2d or 2dsphere key, which MongoDB does not allow.\",\n\t\"hashed-several-fields\": \"is hashed on several fields; a hashed index has exactly one field.\",\n\t\"ttl-with-wildcard\": \"sets expireAfterSeconds on a wildcard index, which MongoDB does not allow.\",\n\t\"projection-without-wildcard\": \"sets wildcardProjection but has no wildcard key; a wildcard projection needs a wildcard index.\",\n\t\"collation-without-locale\": \"sets a collation without a locale; a collation needs a locale.\",\n\t\"second-text-index\": \"is a second text index in its collection; MongoDB allows one text index per collection.\"\n};\nfunction discriminatorFieldError(refusal) {\n\tconst field = `Discriminator field \"${refusal.key.model}.${refusal.fieldName}\"`;\n\tconst meta = {\n\t\tmodelName: refusal.key.model,\n\t\tfieldName: refusal.fieldName\n\t};\n\tswitch (refusal.refusal.kind) {\n\t\tcase \"optional\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `${field} must be required, but it is optional. Remove .optional().`, { meta: {\n\t\t\t...meta,\n\t\t\treason: \"discriminator-optional\"\n\t\t} });\n\t\tcase \"list\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `${field} must hold one value, but it is a list. Remove .many().`, { meta: {\n\t\t\t...meta,\n\t\t\treason: \"discriminator-list\"\n\t\t} });\n\t\tcase \"not-text\": {\n\t\t\tconst { dataType } = refusal.refusal;\n\t\t\treturn contractError(\"CONTRACT.ARGUMENT_INVALID\", `${field} must be text, such as field.string(), but its data type is ${dataType === void 0 ? \"not a scalar\" : `\"${dataType}\"`}.`, { meta: {\n\t\t\t\t...meta,\n\t\t\t\tdataType,\n\t\t\t\treason: \"discriminator-not-text\"\n\t\t\t} });\n\t\t}\n\t}\n}\n/** The error `defineContract` throws for a refusal of the builder. */\nfunction refusalError(refusal) {\n\tswitch (refusal.kind) {\n\t\tcase \"duplicateModel\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate model name \"${refusal.key.model}\" in defineContract().`, { meta: {\n\t\t\tkind: \"model\",\n\t\t\tname: refusal.key.model\n\t\t} });\n\t\tcase \"duplicateValueObject\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate value object name \"${refusal.key.valueObject}\" in defineContract().`, { meta: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: refusal.key.valueObject\n\t\t} });\n\t\tcase \"storedNameUnsupported\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.owner.name}\" field \"${refusal.key.field}\" ${refusal.reason}. Give it another stored name.`, { meta: {\n\t\t\tmodelName: refusal.key.owner.name,\n\t\t\tfieldName: refusal.key.field,\n\t\t\treason: \"stored-name-unsupported\"\n\t\t} });\n\t\tcase \"storedNameDuplicate\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Model \"${refusal.key.owner.name}\" stores both \"${refusal.firstField}\" and \"${refusal.key.field}\" as \"${refusal.storedName}\".`, { meta: {\n\t\t\tkind: \"field\",\n\t\t\tname: refusal.storedName,\n\t\t\tfirst: refusal.firstField,\n\t\t\tsecond: refusal.key.field\n\t\t} });\n\t\tcase \"restatedBaseFieldDiffers\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Variant model \"${refusal.key.owner.name}\" restates field \"${refusal.key.field}\" of its base \"${refusal.baseModel}\" with a different ${refusal.differences.map(differenceWording).join(\" and \")}. A variant's documents are checked against the base's field, so restate it exactly or remove it from the variant.`, { meta: {\n\t\t\tmodelName: refusal.key.owner.name,\n\t\t\tfieldName: refusal.key.field,\n\t\t\tbaseModel: refusal.baseModel,\n\t\t\tdifferences: refusal.differences,\n\t\t\treason: \"restated-base-field-differs\"\n\t\t} });\n\t\tcase \"storedNameSharedWithBase\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Variant model \"${refusal.key.owner.name}\" field \"${refusal.key.field}\" is stored as \"${refusal.storedName}\", which its base \"${refusal.baseModel}\" stores field \"${refusal.baseField}\" under. A variant's documents hold its base's fields too, so give the field another stored name.`, { meta: {\n\t\t\tkind: \"field\",\n\t\t\tname: refusal.storedName,\n\t\t\tfirst: `${refusal.baseModel}.${refusal.baseField}`,\n\t\t\tsecond: `${refusal.key.owner.name}.${refusal.key.field}`,\n\t\t\treason: \"stored-name-shared-with-base\"\n\t\t} });\n\t\tcase \"valueObjectFieldStoredName\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Value object \"${refusal.key.owner.name}\" field \"${refusal.key.field}\" sets .mongo({ field }), but a field of a value object is stored under its own name.`, { meta: {\n\t\t\tvalueObjectName: refusal.key.owner.name,\n\t\t\tfieldName: refusal.key.field,\n\t\t\treason: \"value-object-field-stored-name\"\n\t\t} });\n\t\tcase \"relationLocalFieldUnknown\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\treturn contractError(\"CONTRACT.RELATION_INVALID\", `Relation \"${model}.${relation}\" joins on local field \"${refusal.fieldName}\", which model \"${model}\" does not declare`, { meta: {\n\t\t\t\tmodelName: model,\n\t\t\t\trelationName: relation,\n\t\t\t\tfieldName: refusal.fieldName,\n\t\t\t\treason: \"local-field-unknown\"\n\t\t\t} });\n\t\t}\n\t\tcase \"relationNullability\": {\n\t\t\tconst { model, relation } = refusal.key;\n\t\t\tconst location = `Relation \"${model}.${relation}\"`;\n\t\t\treturn contractError(\"CONTRACT.RELATION_INVALID\", !refusal.ownsForeignKey ? `${location} is required but does not own the foreign key, so nothing in storage guarantees the related document exists` : refusal.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\t\t\tmodelName: model,\n\t\t\t\trelationName: relation,\n\t\t\t\treason: \"to-one-nullability-mismatch\"\n\t\t\t} });\n\t\t}\n\t\tcase \"collectionSettingWithoutCollection\": {\n\t\t\tconst modelName = refusal.key.model;\n\t\t\tconst what = refusal.setting === \"controlPolicy\" ? \"it\" : \"them\";\n\t\t\treturn contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelName}\" defines ${refusal.setting} but has no collection to attach ${what} to.`, { meta: {\n\t\t\t\tmodelName,\n\t\t\t\treason: `${refusal.setting}-without-collection`\n\t\t\t} });\n\t\t}\n\t\tcase \"collectionSettingTwice\": return contractError(\"CONTRACT.COLLECTION_INVALID\", `Collection \"${refusal.collection}\" has ${refusal.setting} declared by multiple models. Author ${refusal.setting} on a single model per collection.`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tcollection: refusal.collection,\n\t\t\treason: `${refusal.setting}-declared-by-multiple-models`\n\t\t} });\n\t\tcase \"variantCollectionDiffers\": return contractError(\"CONTRACT.COLLECTION_INVALID\", `Variant model \"${refusal.key.model}\" is stored in collection \"${refusal.collection}\", but its base \"${refusal.baseModel}\" is stored in \"${refusal.baseCollection}\". A variant is stored in its base's collection; leave its collection out.`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tcollection: refusal.collection,\n\t\t\tbaseModel: refusal.baseModel,\n\t\t\tbaseCollection: refusal.baseCollection,\n\t\t\treason: \"variant-collection-differs\"\n\t\t} });\n\t\tcase \"indexFieldUnknown\": return contractError(\"CONTRACT.FIELD_UNKNOWN\", `Model \"${refusal.key.model}\" index ${refusal.signature} references unknown field \"${refusal.fieldName}\".`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tfieldName: refusal.fieldName,\n\t\t\tindexSignature: refusal.signature\n\t\t} });\n\t\tcase \"indexShape\": return contractError(\"CONTRACT.INDEX_INVALID\", `Model \"${refusal.key.model}\" index ${refusal.signature} ${INDEX_SHAPE_MESSAGES[refusal.rule]}`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tindexSignature: refusal.signature,\n\t\t\treason: refusal.rule\n\t\t} });\n\t\tcase \"indexScopeConflict\": return contractError(\"CONTRACT.INDEX_INVALID\", `Variant model \"${refusal.key.model}\" index ${refusal.signature} conflicts with discriminator scope: ${refusal.reason}`, { meta: {\n\t\t\tvariantName: refusal.key.model,\n\t\t\tindexLabel: refusal.signature,\n\t\t\treason: refusal.reason\n\t\t} });\n\t\tcase \"indexDuplicate\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Collection \"${refusal.collection}\" defines duplicate index ${refusal.signature}. First declared on model \"${refusal.firstModel}\" and duplicated on model \"${refusal.key.model}\".`, { meta: {\n\t\t\tkind: \"index\",\n\t\t\tname: refusal.signature,\n\t\t\tcollection: refusal.collection,\n\t\t\tfirst: refusal.firstModel,\n\t\t\tsecond: refusal.key.model\n\t\t} });\n\t\tcase \"indexNameDuplicate\": return contractError(\"CONTRACT.NAME_DUPLICATE\", `Collection \"${refusal.collection}\" has two indexes named \"${refusal.name}\": index ${refusal.firstPosition} of model \"${refusal.firstModel}\" and index ${refusal.key.position} of model \"${refusal.key.model}\". An index without a name is named after its keys and directions. Give one of them another name with the index option name.`, { meta: {\n\t\t\tkind: \"index\",\n\t\t\tname: refusal.name,\n\t\t\tcollection: refusal.collection,\n\t\t\tfirst: refusal.firstModel,\n\t\t\tsecond: refusal.key.model,\n\t\t\treason: \"index-name-duplicate\"\n\t\t} });\n\t\tcase \"generatedOnValueObject\": return defaultError(refusal.key, \"executionDefaults-on-value-object\", \"has executionDefaults, but it belongs to a value object. Generated values are only supported on model fields.\");\n\t\tcase \"generatorUnknown\": {\n\t\t\tconst { owner, field } = refusal.key;\n\t\t\treturn contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${owner.name}.${field}\": no pack in the contract declares the generator function \"${refusal.functionName}\".`, { meta: {\n\t\t\t\tmodelName: owner.name,\n\t\t\t\tfieldName: field,\n\t\t\t\tcodecId: refusal.codecId,\n\t\t\t\tfunction: refusal.functionName,\n\t\t\t\treason: \"generator-unknown\"\n\t\t\t} });\n\t\t}\n\t\tcase \"generatorNotApplicable\": {\n\t\t\tconst { owner, field } = refusal.key;\n\t\t\tconst subject = `Field \"${owner.name}.${field}\"`;\n\t\t\treturn contractError(\"CONTRACT.DEFAULT_INVALID\", refusal.message !== void 0 ? `${subject}: ${refusal.message}` : `${subject}: ${refusal.functionName}() does not apply to ${refusal.codecId === void 0 ? \"the field's type\" : `codec \"${refusal.codecId}\"`}.`, { meta: {\n\t\t\t\tmodelName: owner.name,\n\t\t\t\tfieldName: field,\n\t\t\t\tcodecId: refusal.codecId,\n\t\t\t\tfunction: refusal.functionName,\n\t\t\t\treason: \"generator-not-applicable\"\n\t\t\t} });\n\t\t}\n\t\tcase \"generatorPhaseSetTwice\": return contractError(\"CONTRACT.DEFAULT_INVALID\", `.${refusal.phase}() is called on a field that already generates a value ${refusal.phase === \"onCreate\" ? \"on create\" : \"on update\"}. Set each phase once, and do not combine .${refusal.phase}() with a type alias or alias constant that sets it.`, { meta: {\n\t\t\tmodelName: refusal.key.owner.name,\n\t\t\tfieldName: refusal.key.field,\n\t\t\treason: \"generator-phase-set-twice\",\n\t\t\tphase: refusal.phase\n\t\t} });\n\t\tcase \"generatedList\": return defaultError(refusal.key, \"many-with-executionDefaults\", \"generates a value on write, so it cannot be a list; remove .many().\");\n\t\tcase \"generatedOnVariant\": return defaultError(refusal.key, \"executionDefaults-on-variant\", `has executionDefaults, but \"${refusal.key.owner.name}\" is a variant of \"${refusal.baseModel}\". Execution defaults apply to every document in collection \"${refusal.collection}\", so declare them on the base model.`);\n\t\tcase \"generatedWithoutCollection\": return defaultError(refusal.key, \"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\tcase \"generatedConflict\": return defaultError(refusal.key, \"executionDefaults-conflict\", `has different executionDefaults than \"${refusal.otherModel}.${refusal.otherField}\", which is stored in the same collection \"${refusal.collection}\". Use the same executionDefaults on both models.`);\n\t\tcase \"typeParamsInvalid\": return structuredError(\"CONTRACT.TYPE_PARAMS_INVALID\", refusal.problem.message, { meta: {\n\t\t\tdataType: refusal.problem.dataType,\n\t\t\tparameters: refusal.problem.parameters,\n\t\t\t...ownerMetaOf(refusal.key)\n\t\t} });\n\t\tcase \"enumKeyMismatch\": return contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${refusal.key.enumName}\" must match enumType name \"${refusal.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: refusal.enumName,\n\t\t\tdeclaredKey: refusal.key.enumName,\n\t\t\treason: \"declaration-key-mismatch\"\n\t\t} });\n\t\tcase \"enumMemberProblem\": return enumMemberError({\n\t\t\tenumName: refusal.enumName,\n\t\t\tcodecId: refusal.codecId\n\t\t}, refusal.problem, \"the field\");\n\t\tcase \"enumUnknown\": return contractError(\"CONTRACT.ENUM_UNKNOWN\", `${ownerLabelOf(refusal.key)} references enum \"${refusal.enumName}\" which is not declared in defineContract({ enums: { ... } }).`, { meta: {\n\t\t\t...ownerMetaOf(refusal.key),\n\t\t\tenumName: refusal.enumName\n\t\t} });\n\t\tcase \"discriminatorValueDuplicate\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Discriminator value \"${refusal.value}\" is used by both \"${refusal.firstVariant}\" and \"${refusal.key.variant}\" on base model \"${refusal.baseModel}\".`, { meta: {\n\t\t\tmodelName: refusal.baseModel,\n\t\t\tvalue: refusal.value,\n\t\t\tvariants: [refusal.firstVariant, refusal.key.variant],\n\t\t\treason: \"duplicate-discriminator-value\"\n\t\t} });\n\t\tcase \"discriminatorFieldUnknown\": return contractError(\"CONTRACT.FIELD_UNKNOWN\", `Model \"${refusal.key.model}\" names \"${refusal.fieldName}\" as its discriminator, but declares no field \"${refusal.fieldName}\".`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tfieldName: refusal.fieldName,\n\t\t\treason: \"discriminator-field-unknown\"\n\t\t} });\n\t\tcase \"discriminatorField\": return discriminatorFieldError(refusal);\n\t\tcase \"discriminatorValue\": {\n\t\t\tconst variant = refusal.key.variant;\n\t\t\tconst meta = {\n\t\t\t\tmodelName: variant,\n\t\t\t\tbaseModel: refusal.baseModel,\n\t\t\t\tfieldName: refusal.fieldName\n\t\t\t};\n\t\t\tif (refusal.refusal.kind === \"unreadable\") return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Variant model \"${variant}\" has a discriminator value that discriminator field \"${refusal.baseModel}.${refusal.fieldName}\" cannot hold: ${refusal.refusal.refusal.message}`, { meta: {\n\t\t\t\t...meta,\n\t\t\t\treason: \"discriminator-value-unreadable\"\n\t\t\t} });\n\t\t\treturn contractError(\"CONTRACT.ARGUMENT_INVALID\", `Variant model \"${variant}\" has discriminator value ${JSON.stringify(refusal.refusal.stored)}, which is not a member of enum \"${refusal.enumName}\", the type of discriminator field \"${refusal.baseModel}.${refusal.fieldName}\". Use one of: ${refusal.refusal.members.map((member) => JSON.stringify(member)).join(\", \")}.`, { meta: {\n\t\t\t\t...meta,\n\t\t\t\treason: \"discriminator-value-not-a-member\"\n\t\t\t} });\n\t\t}\n\t\tcase \"discriminatorAndBase\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.model}\" has both a discriminator and a base. A model is either a base with variants or a variant of one base.`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\treason: \"discriminator-and-base\"\n\t\t} });\n\t\tcase \"discriminatorWithoutVariants\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.model}\" has a discriminator, but no model names it as its base.`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\treason: \"discriminator-without-variants\"\n\t\t} });\n\t\tcase \"listedVariantMissing\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.model}\" lists variant \"${refusal.variant}\", but no model \"${refusal.variant}\" names \"${refusal.key.model}\" as its base.`, { meta: {\n\t\t\tmodelName: refusal.key.model,\n\t\t\tvariant: refusal.variant,\n\t\t\treason: \"listed-variant-missing\"\n\t\t} });\n\t\tcase \"baseWithoutDiscriminator\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.variant}\" names \"${refusal.baseModel}\" as its base, but \"${refusal.baseModel}\" has no discriminator.`, { meta: {\n\t\t\tmodelName: refusal.key.variant,\n\t\t\tbaseModel: refusal.baseModel,\n\t\t\treason: \"base-without-discriminator\"\n\t\t} });\n\t\tcase \"baseUnknown\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.variant}\" names \"${refusal.baseModel}\" as its base, but the contract has no model \"${refusal.baseModel}\".`, { meta: {\n\t\t\tmodelName: refusal.key.variant,\n\t\t\tbaseModel: refusal.baseModel,\n\t\t\treason: \"base-unknown\"\n\t\t} });\n\t\tcase \"variantWithoutValue\": return contractError(\"CONTRACT.ARGUMENT_INVALID\", `Model \"${refusal.key.variant}\" names \"${refusal.baseModel}\" as its base, but \"${refusal.baseModel}\" lists no discriminator value for it.`, { meta: {\n\t\t\tmodelName: refusal.key.variant,\n\t\t\tbaseModel: refusal.baseModel,\n\t\t\treason: \"variant-without-value\"\n\t\t} });\n\t\tcase \"validator\": return validatorRefusalError(refusal.refusal);\n\t}\n}\n/** A builder warning as `defineContract` reports it. */\nfunction authoringWarningOf(warning) {\n\treturn warning.warning;\n}\nfunction differenceWording(difference) {\n\tswitch (difference) {\n\t\tcase \"storedName\": return \"stored name\";\n\t\tcase \"type\": return \"type\";\n\t\tcase \"nullable\": return \"nullability\";\n\t\tcase \"many\": return \"list shape\";\n\t}\n}\n//#endregion\n//#region src/removed-field-presets.ts\nconst GUIDE = \"The upgrade guide \\\"Field presets are removed\\\" lists every rewrite.\";\nconst TEMPORAL_REWRITES = {\n\tcreatedAt: \"field.date().onCreate(gen.now())\",\n\tupdatedAt: \"field.date().onCreate(gen.now()).onUpdate(gen.now())\",\n\ttimestamp: \"field.date(), with .onCreate(gen.now()) and .onUpdate(gen.now()) for the phases the preset set\"\n};\nfunction refuse(preset) {\n\tconst helper = `field.temporal.${preset}`;\n\tthrow contractError(\"CONTRACT.FIELD_HELPER_UNKNOWN\", `${helper} was a field preset, and Prisma 8 removed field presets. Write ${TEMPORAL_REWRITES[preset]}. ${GUIDE}`, { meta: { helper } });\n}\n/**\n* The MongoDB `field` helpers, where `field.temporal`, which held the removed field presets, gives an object whose read of a preset throws `CONTRACT.FIELD_HELPER_UNKNOWN` with its rewrite, so a JavaScript caller, or a contract emitted before it is type-checked, learns what to write instead. Every other read behaves as on `helpers`.\n*/\nfunction refusingRemovedFieldPresets(helpers) {\n\treturn answerMissingPropertyReads(helpers, /* @__PURE__ */ new Set([\"temporal\"]), () => answerMissingPropertyReads({}, new Set(Object.keys(TEMPORAL_REWRITES)), refuse));\n}\n//#endregion\n//#region src/contract-builder.ts\nconst MONGO_RESERVED_HELPER_KEYS = [\n\t\"field\",\n\t\"gen\",\n\t\"index\",\n\t\"model\",\n\t\"rel\",\n\t\"valueObject\"\n];\nfunction stackLookupsOf(components) {\n\tconst codecLookup = extractCodecLookup(components);\n\tassertTypeAliasesValid(composePackAuthoringNamespace(components, \"type\"), {\n\t\tgeneratorFunctions: assembleGeneratorFunctions(components),\n\t\tparamsSchemaOf: (codecId) => codecLookup.descriptorFor(codecId)?.paramsSchema,\n\t\tfieldLength: () => void 0\n\t});\n\tconst { support } = assembleDataTypeSupport(components, (codecId) => codecLookup.descriptorFor(codecId)?.dataType);\n\treturn {\n\t\tcodecLookup,\n\t\tdataTypes: support\n\t};\n}\nfunction composeMongoAuthoringHelpers(family, target, extensions, lookups) {\n\tconst components = [\n\t\tfamily,\n\t\ttarget,\n\t\t...Object.values(extensions ?? {})\n\t];\n\tconst entityNamespace = composePackAuthoringNamespace(components, \"entityTypes\");\n\tassertNoCrossRegistryCollisions(composePackAuthoringNamespace(components, \"type\"), 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: lookups.codecLookup,\n\t\t\tdataTypes: lookups.dataTypes\n\t\t} }),\n\t\tfield,\n\t\tgen: createGeneratorHelpers(components),\n\t\tindex,\n\t\tmodel,\n\t\trel,\n\t\tvalueObject\n\t});\n}\nfunction createFieldBuilder(spec, enumHandle, executionDefaults, storedName, generatorCalls) {\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, storedName, generatorCalls);\n\t}\n\tfunction withGeneratorCall(phase, call) {\n\t\tif (generatorCalls?.[phase] !== void 0 || executionDefaults?.[phase] !== void 0) throw contractError(\"CONTRACT.DEFAULT_INVALID\", `.${phase}() is called on a field that already generates a value ${phase === \"onCreate\" ? \"on create\" : \"on update\"}. Set each phase once, and do not combine .${phase}() with a type alias or alias constant that sets it.`, { meta: {\n\t\t\treason: \"generator-phase-set-twice\",\n\t\t\tphase\n\t\t} });\n\t\treturn createFieldBuilder(spec, enumHandle, blindCast(executionDefaults), storedName, {\n\t\t\t...generatorCalls,\n\t\t\t[phase]: call\n\t\t});\n\t}\n\treturn {\n\t\t__kind: \"field\",\n\t\t...ifDefined(\"__executionDefaults\", executionDefaults),\n\t\t...ifDefined(\"__generatorCalls\", generatorCalls),\n\t\tonCreate: (call) => withGeneratorCall(\"onCreate\", call),\n\t\tonUpdate: (call) => withGeneratorCall(\"onUpdate\", call),\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\t__storedName: blindCast(storedName),\n\t\toptional: () => createFieldBuilder({\n\t\t\ttype: spec.type,\n\t\t\tnullable: true,\n\t\t\tmany: spec.many\n\t\t}, enumHandle, executionDefaults, storedName, generatorCalls),\n\t\tmany: blindCast(many),\n\t\tmongo: ({ field }) => createFieldBuilder(spec, enumHandle, executionDefaults, field, generatorCalls)\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}\nfunction vectorField(options) {\n\treturn createScalarFieldBuilder(\"mongo/vector@1\", options);\n}\nconst field = refusingRemovedFieldPresets({\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: vectorField,\n\tvalueObject(valueObjectName) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: blindCast({\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tplane: \"storage\",\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentityKind: \"valueObject\",\n\t\t\t\tentityName: 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 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 isContractScaffold(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn \"family\" in value && \"target\" in value;\n}\nfunction buildContractFromDsl(input, lookups) {\n\tconst definition = buildContractDefinition(input);\n\tconst { codecLookup, dataTypes } = lookups ?? stackLookupsOf([\n\t\tinput.family,\n\t\tinput.target,\n\t\t...Object.values(input.extensions ?? {})\n\t]);\n\tconst merged = mergeRedundantIndexes(nameIndexes(definition), codecLookup, dataTypes);\n\tconst built = buildMongoContractFromDefinition(merged.definition, codecLookup, dataTypes);\n\tflushAuthoringWarnings((built.ok ? built.value.warnings : built.failure.warnings).map(authoringWarningOf));\n\tif (!built.ok) {\n\t\tconst [first] = built.failure.refusals;\n\t\tassertDefined(first, \"a refused build has at least one refusal\");\n\t\tthrow refusalError(refusalAtWrittenPositions(first, merged.removedIndexes));\n\t}\n\treturn blindCast(built.value.contract);\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 lookups = stackLookupsOf([\n\t\t\tfamily,\n\t\t\ttarget,\n\t\t\t...Object.values(definition.extensions ?? {})\n\t\t]);\n\t\tconst built = factory(composeMongoAuthoringHelpers(family, target, definition.extensions, lookups));\n\t\treturn buildContractFromDsl({\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}, lookups);\n\t}\n\treturn buildContractFromDsl(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, buildMongoContractFromDefinition, defineContract, enumType, field, index, isEnumTypeHandle, member, mergeRedundantIndexes, model, nameIndexes, rel, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAS,cAAc,OAAO,OAAO;CACpC,OAAO;EACN,MAAM;EACN,OAAO;GACN,MAAM;GACN,MAAM;EACP;EACA;CACD;AACD;AACA,SAAS,oBAAoB,aAAa,OAAO;CAChD,OAAO;EACN,MAAM;EACN,OAAO;GACN,MAAM;GACN,MAAM;EACP;EACA;CACD;AACD;;AAEA,SAAS,oBAAoB,SAAS;CACrC,QAAQ,QAAQ,MAAhB;EACC,KAAK,4BAA4B,OAAO;GACvC,MAAM;GACN,OAAO,QAAQ;GACf,UAAU,QAAQ;EACnB;EACA,KAAK;EACL,KAAK,mBAAmB,OAAO;GAC9B,MAAM;GACN,UAAU,QAAQ;EACnB;EACA,KAAK,yBAAyB,OAAO;GACpC,MAAM;GACN,UAAU,QAAQ;GAClB,QAAQ,QAAQ;EACjB;EACA,KAAK,iBAAiB,OAAO;GAC5B,MAAM;GACN,OAAO,QAAQ;GACf,OAAO,QAAQ;EAChB;EACA,KAAK,cAAc,OAAO,cAAc,QAAQ,WAAW,QAAQ,SAAS;CAC7E;AACD;AAGA,SAAS,aAAa,OAAO;C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