@prisma/orm-family-sql 8.0.0-rc.24-dev.34 → 8.0.0-rc.24-dev.36

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 (44) hide show
  1. package/dist/{config-types-CGDhWE3o.mjs → config-types-CFByuvww.mjs} +2 -2
  2. package/dist/{config-types-CGDhWE3o.mjs.map → config-types-CFByuvww.mjs.map} +1 -1
  3. package/dist/{contract-builder-BqswyknO.mjs → contract-builder-DIb0oV8O.mjs} +70 -25
  4. package/dist/contract-builder-DIb0oV8O.mjs.map +1 -0
  5. package/dist/contract-prisma7__provider.mjs +4 -4
  6. package/dist/contract-psl.mjs +1 -1
  7. package/dist/contract-psl__attribute-specs.mjs +1 -1
  8. package/dist/contract-psl__provider.mjs +2 -2
  9. package/dist/contract-ts.mjs +3 -3
  10. package/dist/contract-ts__config-types.mjs +1 -1
  11. package/dist/contract-ts__contract-builder.mjs +2 -2
  12. package/dist/{control-DUbuxp4j.mjs → control-BdGTPj7m.mjs} +3 -3
  13. package/dist/{control-DUbuxp4j.mjs.map → control-BdGTPj7m.mjs.map} +1 -1
  14. package/dist/{control-BwL5tCj4.d.mts → control-DakmWBdU.d.mts} +2 -2
  15. package/dist/{control-BwL5tCj4.d.mts.map → control-DakmWBdU.d.mts.map} +1 -1
  16. package/dist/{derived-checks-BoHNzt-a-4Vi-QMdx.mjs → derived-checks-9Ku2scaj-0iT0uU_6.mjs} +265 -113
  17. package/dist/derived-checks-9Ku2scaj-0iT0uU_6.mjs.map +1 -0
  18. package/dist/{exports-kqOXg2OT-D3lo7jnX.mjs → exports-BLvDBaFs-DZPo5Hei.mjs} +38 -21
  19. package/dist/exports-BLvDBaFs-DZPo5Hei.mjs.map +1 -0
  20. package/dist/family.d.mts +2 -2
  21. package/dist/family.mjs +2 -2
  22. package/dist/family__control.d.mts +1 -1
  23. package/dist/family__control.mjs +1 -1
  24. package/dist/family__pack.d.mts +1 -1
  25. package/dist/family__pack.mjs +2 -2
  26. package/dist/{generator-functions-Bze9nVHL-Bg9PVsti.mjs → generator-functions-Bze9nVHL-BK4YIqLK.mjs} +2 -2
  27. package/dist/{generator-functions-Bze9nVHL-Bg9PVsti.mjs.map → generator-functions-Bze9nVHL-BK4YIqLK.mjs.map} +1 -1
  28. package/dist/{index-nW0rAUTr.d.mts → index-CI6diFcZ.d.mts} +6 -5
  29. package/dist/{index-nW0rAUTr.d.mts.map → index-CI6diFcZ.d.mts.map} +1 -1
  30. package/dist/{interpreter-DoQwVOyS-BMiOIZcg.mjs → interpreter-DoQwVOyS-jsuDJlaX.mjs} +4 -4
  31. package/dist/{interpreter-DoQwVOyS-BMiOIZcg.mjs.map → interpreter-DoQwVOyS-jsuDJlaX.mjs.map} +1 -1
  32. package/dist/orm-client.d.mts +1 -1
  33. package/dist/orm-client.mjs +2 -2
  34. package/dist/orm-client.mjs.map +1 -1
  35. package/dist/{pack-CbYm5Bfz.d.mts → pack-Curj5k6u.d.mts} +2 -2
  36. package/dist/{pack-CbYm5Bfz.d.mts.map → pack-Curj5k6u.d.mts.map} +1 -1
  37. package/dist/{psl-field-resolution-CpxUePg1-tvt3yqqs.mjs → psl-field-resolution-CpxUePg1-DIrhHYx0.mjs} +2 -2
  38. package/dist/{psl-field-resolution-CpxUePg1-tvt3yqqs.mjs.map → psl-field-resolution-CpxUePg1-DIrhHYx0.mjs.map} +1 -1
  39. package/dist/runtime.d.mts +1 -1
  40. package/dist/runtime.mjs +1 -1
  41. package/package.json +18 -18
  42. package/dist/contract-builder-BqswyknO.mjs.map +0 -1
  43. package/dist/derived-checks-BoHNzt-a-4Vi-QMdx.mjs.map +0 -1
  44. package/dist/exports-kqOXg2OT-D3lo7jnX.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { i as contractError, n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-BoHNzt-a-4Vi-QMdx.mjs";
1
+ import { a as contractError, r as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-9Ku2scaj-0iT0uU_6.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { createDataTypeLookup, emptyCodecLookup } from "@prisma/orm-framework/components/codec";
4
4
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -144,4 +144,4 @@ function typescriptContractFromPath(contractPath, output, options) {
144
144
  //#endregion
145
145
  export { typescriptContractFromPath as i, refuseOtherTargetOnLoad as n, typescriptContract as r, emptyContract as t };
146
146
 
147
- //# sourceMappingURL=config-types-CGDhWE3o.mjs.map
147
+ //# sourceMappingURL=config-types-CFByuvww.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-types-CGDhWE3o.mjs","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { l as contractError, n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from \"./derived-checks-BoHNzt-a.mjs\";\nimport { createDataTypeLookup, emptyCodecLookup } from \"@internal/framework-components/codec\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { pathToFileURL } from \"node:url\";\nimport { ok } from \"@internal/utils/result\";\nimport { extname } from \"pathe\";\n//#region src/config-types.ts\n/**\n* Derives the emit output path from the TS contract input so artefacts land\n* colocated with the source (e.g. `prisma/contract.ts` →\n* `prisma/contract.json`). Mirrors the same default-derivation logic in\n* `@internal/sql-contract-psl/provider`.\n*/\nfunction defaultOutputFromContractPath(contractPath) {\n\tconst ext = extname(contractPath);\n\tif (ext.length === 0) return `${contractPath}.json`;\n\treturn `${contractPath.slice(0, -ext.length)}.json`;\n}\nfunction describeContract({ format, inputs }) {\n\tconst kind = format === \"typescript\" ? \"The TypeScript contract\" : \"The contract\";\n\tconst path = inputs?.[0];\n\treturn path === void 0 ? `${kind} in the config` : `${kind} \"${path}\"`;\n}\nfunction otherTargetGuidance({ format, inputs }, actual, expected) {\n\tif (format === \"psl\") return {\n\t\twhy: `The contract config read the schema for target \"${actual}\".`,\n\t\tfix: `Pass the schema's path as \\`contract\\`, so the config reads it for target \"${expected.target.targetId}\".`\n\t};\n\tif (inputs?.[0] === void 0) return {\n\t\twhy: `The contract was built for target \"${actual}\".`,\n\t\tfix: `Pass a contract built with defineContract imported from ${expected.contractBuilderModule}.`\n\t};\n\treturn {\n\t\twhy: `The contract file imports defineContract from the package for target \"${actual}\".`,\n\t\tfix: `Import defineContract from ${expected.contractBuilderModule}.`\n\t};\n}\nfunction refuseOtherTarget(origin, loaded, expected) {\n\tconst actual = loaded[\"target\"];\n\tconst configured = expected.target.targetId;\n\tif (typeof actual !== \"string\" || actual === configured) return;\n\tthrow contractError(\"CONTRACT.TARGET_MISMATCH\", `${describeContract(origin)} was built for target \"${actual}\", but the config is for target \"${configured}\".`, {\n\t\t...otherTargetGuidance(origin, actual, expected),\n\t\tmeta: {\n\t\t\t...ifDefined(\"contract\", origin.inputs?.[0]),\n\t\t\texpected: configured,\n\t\t\tactual\n\t\t}\n\t});\n}\n/** A ready contract config whose loaded contract is refused when it was built for another target than the config's. Any other result passes through unchanged. */\nfunction refuseOtherTargetOnLoad(config, expected) {\n\tconst { source } = config;\n\treturn {\n\t\t...config,\n\t\tsource: {\n\t\t\t...source,\n\t\t\tload: async (context) => {\n\t\t\t\tconst result = await source.load(context);\n\t\t\t\tconst loaded = isRecord(result) && result.ok === true ? result.value : void 0;\n\t\t\t\tif (isRecord(loaded)) refuseOtherTarget(source, loaded, expected);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t};\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nconst isNonEmptyString = (value) => typeof value === \"string\" && value.length > 0;\nfunction isContractOfAnyFamily(value) {\n\tif (!isRecord(value)) return false;\n\tconst storage = value[\"storage\"];\n\treturn isNonEmptyString(value[\"targetFamily\"]) && isNonEmptyString(value[\"target\"]) && isRecord(storage) && isRecord(storage[\"namespaces\"]);\n}\nfunction isSqlContract(value) {\n\treturn isContractOfAnyFamily(value) && value[\"targetFamily\"] === \"sql\";\n}\nfunction emptyContract(options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => {\n\t\t\t\treturn ok(applySqlSpecifierControlPolicy(buildSqlContractFromDefinition({\n\t\t\t\t\twarnings: void 0,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tmodels: []\n\t\t\t\t}, {\n\t\t\t\t\t...emptyCodecLookup,\n\t\t\t\t\tdescriptorFor: () => void 0\n\t\t\t\t}, createDataTypeLookup([])), options.defaultControlPolicy, options.createNamespace));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options.output)\n\t};\n}\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(options === void 0 ? contract : applySqlSpecifierControlPolicy(contract, options.defaultControlPolicy, options.createNamespace))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n/** A contract loaded from the TypeScript module at `contractPath`, refused when it was built for another target than the config's. */\nfunction typescriptContractFromPath(contractPath, output, options) {\n\tconst policy = options.defaultControlPolicy === void 0 ? void 0 : 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\tif (mod.default === void 0 && mod.contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `The contract file \"${contractPath}\" has no default export or named export \\`contract\\`.`, {\n\t\t\t\t\tfix: \"Export the contract that defineContract returns as the default export or as `export const contract`.\",\n\t\t\t\t\tmeta: { path: absolutePath }\n\t\t\t\t});\n\t\t\t\tconst exported = mod.default ?? mod.contract;\n\t\t\t\tconst origin = {\n\t\t\t\t\tformat: \"typescript\",\n\t\t\t\t\tinputs: [contractPath]\n\t\t\t\t};\n\t\t\t\tif (isContractOfAnyFamily(exported)) refuseOtherTarget(origin, exported, options);\n\t\t\t\tif (!isSqlContract(exported)) throw contractError(\"CONTRACT.EXPORT_INVALID\", `The TypeScript contract \"${contractPath}\" exports a value that is not a SQL contract.`, {\n\t\t\t\t\twhy: \"A contract file must export the contract that defineContract returns, and this export is something else.\",\n\t\t\t\t\tfix: `Import defineContract from ${options.contractBuilderModule} and export the contract it returns as the default export or as \\`export const contract\\`.`,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tpath: absolutePath,\n\t\t\t\t\t\treason: \"not-a-contract\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconst contract = exported;\n\t\t\t\treturn ok(policy === void 0 ? contract : applySqlSpecifierControlPolicy(contract, policy.defaultControlPolicy, policy.createNamespace));\n\t\t\t}\n\t\t},\n\t\toutput: output ?? defaultOutputFromContractPath(contractPath)\n\t};\n}\n//#endregion\nexport { emptyContract, refuseOtherTargetOnLoad, typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,8BAA8B,cAAc;CACpD,MAAM,MAAM,QAAQ,YAAY;CAChC,IAAI,IAAI,WAAW,GAAG,OAAO,GAAG,aAAa;CAC7C,OAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,MAAM,EAAE;AAC9C;AACA,SAAS,iBAAiB,EAAE,QAAQ,UAAU;CAC7C,MAAM,OAAO,WAAW,eAAe,4BAA4B;CACnE,MAAM,OAAO,SAAS;CACtB,OAAO,SAAS,KAAK,IAAI,GAAG,KAAK,kBAAkB,GAAG,KAAK,IAAI,KAAK;AACrE;AACA,SAAS,oBAAoB,EAAE,QAAQ,UAAU,QAAQ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K;KACL,MAAM,EAAE,MAAM,aAAa;IAC5B,CAAC;IACD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,MAAM,SAAS;KACd,QAAQ;KACR,QAAQ,CAAC,YAAY;IACtB;IACA,IAAI,sBAAsB,QAAQ,GAAG,kBAAkB,QAAQ,UAAU,OAAO;IAChF,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,cAAc,2BAA2B,4BAA4B,aAAa,gDAAgD;KACrK,KAAK;KACL,KAAK,8BAA8B,QAAQ,sBAAsB;KACjE,MAAM;MACL,MAAM;MACN,QAAQ;KACT;IACD,CAAC;IACD,MAAM,WAAW;IACjB,OAAO,GAAG,WAAW,KAAK,IAAI,WAAW,+BAA+B,UAAU,OAAO,sBAAsB,OAAO,eAAe,CAAC;GACvI;EACD;EACA,QAAQ,UAAU,8BAA8B,YAAY;CAC7D;AACD"}
1
+ {"version":3,"file":"config-types-CFByuvww.mjs","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-ts/dist/config-types.mjs"],"sourcesContent":["import { m as contractError, n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from \"./derived-checks-9Ku2scaj.mjs\";\nimport { createDataTypeLookup, emptyCodecLookup } from \"@internal/framework-components/codec\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { pathToFileURL } from \"node:url\";\nimport { ok } from \"@internal/utils/result\";\nimport { extname } from \"pathe\";\n//#region src/config-types.ts\n/**\n* Derives the emit output path from the TS contract input so artefacts land\n* colocated with the source (e.g. `prisma/contract.ts` →\n* `prisma/contract.json`). Mirrors the same default-derivation logic in\n* `@internal/sql-contract-psl/provider`.\n*/\nfunction defaultOutputFromContractPath(contractPath) {\n\tconst ext = extname(contractPath);\n\tif (ext.length === 0) return `${contractPath}.json`;\n\treturn `${contractPath.slice(0, -ext.length)}.json`;\n}\nfunction describeContract({ format, inputs }) {\n\tconst kind = format === \"typescript\" ? \"The TypeScript contract\" : \"The contract\";\n\tconst path = inputs?.[0];\n\treturn path === void 0 ? `${kind} in the config` : `${kind} \"${path}\"`;\n}\nfunction otherTargetGuidance({ format, inputs }, actual, expected) {\n\tif (format === \"psl\") return {\n\t\twhy: `The contract config read the schema for target \"${actual}\".`,\n\t\tfix: `Pass the schema's path as \\`contract\\`, so the config reads it for target \"${expected.target.targetId}\".`\n\t};\n\tif (inputs?.[0] === void 0) return {\n\t\twhy: `The contract was built for target \"${actual}\".`,\n\t\tfix: `Pass a contract built with defineContract imported from ${expected.contractBuilderModule}.`\n\t};\n\treturn {\n\t\twhy: `The contract file imports defineContract from the package for target \"${actual}\".`,\n\t\tfix: `Import defineContract from ${expected.contractBuilderModule}.`\n\t};\n}\nfunction refuseOtherTarget(origin, loaded, expected) {\n\tconst actual = loaded[\"target\"];\n\tconst configured = expected.target.targetId;\n\tif (typeof actual !== \"string\" || actual === configured) return;\n\tthrow contractError(\"CONTRACT.TARGET_MISMATCH\", `${describeContract(origin)} was built for target \"${actual}\", but the config is for target \"${configured}\".`, {\n\t\t...otherTargetGuidance(origin, actual, expected),\n\t\tmeta: {\n\t\t\t...ifDefined(\"contract\", origin.inputs?.[0]),\n\t\t\texpected: configured,\n\t\t\tactual\n\t\t}\n\t});\n}\n/** A ready contract config whose loaded contract is refused when it was built for another target than the config's. Any other result passes through unchanged. */\nfunction refuseOtherTargetOnLoad(config, expected) {\n\tconst { source } = config;\n\treturn {\n\t\t...config,\n\t\tsource: {\n\t\t\t...source,\n\t\t\tload: async (context) => {\n\t\t\t\tconst result = await source.load(context);\n\t\t\t\tconst loaded = isRecord(result) && result.ok === true ? result.value : void 0;\n\t\t\t\tif (isRecord(loaded)) refuseOtherTarget(source, loaded, expected);\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t};\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nconst isNonEmptyString = (value) => typeof value === \"string\" && value.length > 0;\nfunction isContractOfAnyFamily(value) {\n\tif (!isRecord(value)) return false;\n\tconst storage = value[\"storage\"];\n\treturn isNonEmptyString(value[\"targetFamily\"]) && isNonEmptyString(value[\"target\"]) && isRecord(storage) && isRecord(storage[\"namespaces\"]);\n}\nfunction isSqlContract(value) {\n\treturn isContractOfAnyFamily(value) && value[\"targetFamily\"] === \"sql\";\n}\nfunction emptyContract(options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => {\n\t\t\t\treturn ok(applySqlSpecifierControlPolicy(buildSqlContractFromDefinition({\n\t\t\t\t\twarnings: void 0,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tmodels: []\n\t\t\t\t}, {\n\t\t\t\t\t...emptyCodecLookup,\n\t\t\t\t\tdescriptorFor: () => void 0\n\t\t\t\t}, createDataTypeLookup([])), options.defaultControlPolicy, options.createNamespace));\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options.output)\n\t};\n}\nfunction typescriptContract(contract, output, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"typescript\",\n\t\t\tload: async () => ok(options === void 0 ? contract : applySqlSpecifierControlPolicy(contract, options.defaultControlPolicy, options.createNamespace))\n\t\t},\n\t\t...ifDefined(\"output\", output)\n\t};\n}\n/** A contract loaded from the TypeScript module at `contractPath`, refused when it was built for another target than the config's. */\nfunction typescriptContractFromPath(contractPath, output, options) {\n\tconst policy = options.defaultControlPolicy === void 0 ? void 0 : 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\tif (mod.default === void 0 && mod.contract === void 0) throw contractError(\"CONTRACT.MODULE_EXPORT_MISSING\", `The contract file \"${contractPath}\" has no default export or named export \\`contract\\`.`, {\n\t\t\t\t\tfix: \"Export the contract that defineContract returns as the default export or as `export const contract`.\",\n\t\t\t\t\tmeta: { path: absolutePath }\n\t\t\t\t});\n\t\t\t\tconst exported = mod.default ?? mod.contract;\n\t\t\t\tconst origin = {\n\t\t\t\t\tformat: \"typescript\",\n\t\t\t\t\tinputs: [contractPath]\n\t\t\t\t};\n\t\t\t\tif (isContractOfAnyFamily(exported)) refuseOtherTarget(origin, exported, options);\n\t\t\t\tif (!isSqlContract(exported)) throw contractError(\"CONTRACT.EXPORT_INVALID\", `The TypeScript contract \"${contractPath}\" exports a value that is not a SQL contract.`, {\n\t\t\t\t\twhy: \"A contract file must export the contract that defineContract returns, and this export is something else.\",\n\t\t\t\t\tfix: `Import defineContract from ${options.contractBuilderModule} and export the contract it returns as the default export or as \\`export const contract\\`.`,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\tpath: absolutePath,\n\t\t\t\t\t\treason: \"not-a-contract\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconst contract = exported;\n\t\t\t\treturn ok(policy === void 0 ? contract : applySqlSpecifierControlPolicy(contract, policy.defaultControlPolicy, policy.createNamespace));\n\t\t\t}\n\t\t},\n\t\toutput: output ?? defaultOutputFromContractPath(contractPath)\n\t};\n}\n//#endregion\nexport { emptyContract, refuseOtherTargetOnLoad, typescriptContract, typescriptContractFromPath };\n\n//# sourceMappingURL=config-types.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,8BAA8B,cAAc;CACpD,MAAM,MAAM,QAAQ,YAAY;CAChC,IAAI,IAAI,WAAW,GAAG,OAAO,GAAG,aAAa;CAC7C,OAAO,GAAG,aAAa,MAAM,GAAG,CAAC,IAAI,MAAM,EAAE;AAC9C;AACA,SAAS,iBAAiB,EAAE,QAAQ,UAAU;CAC7C,MAAM,OAAO,WAAW,eAAe,4BAA4B;CACnE,MAAM,OAAO,SA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AY,CAAC,CAAC;IACrD,IAAI,IAAI,YAAY,KAAK,KAAK,IAAI,aAAa,KAAK,GAAG,MAAM,cAAc,kCAAkC,sBAAsB,aAAa,wDAAwD;KACvM,KAAK;KACL,MAAM,EAAE,MAAM,aAAa;IAC5B,CAAC;IACD,MAAM,WAAW,IAAI,WAAW,IAAI;IACpC,MAAM,SAAS;KACd,QAAQ;KACR,QAAQ,CAAC,YAAY;IACtB;IACA,IAAI,sBAAsB,QAAQ,GAAG,kBAAkB,QAAQ,UAAU,OAAO;IAChF,IAAI,CAAC,cAAc,QAAQ,GAAG,MAAM,cAAc,2BAA2B,4BAA4B,aAAa,gDAAgD;KACrK,KAAK;KACL,KAAK,8BAA8B,QAAQ,sBAAsB;KACjE,MAAM;MACL,MAAM;MACN,QAAQ;KACT;IACD,CAAC;IACD,MAAM,WAAW;IACjB,OAAO,GAAG,WAAW,KAAK,IAAI,WAAW,+BAA+B,UAAU,OAAO,sBAAsB,OAAO,eAAe,CAAC;GACvI;EACD;EACA,QAAQ,UAAU,8BAA8B,YAAY;CAC7D;AACD"}
@@ -4,7 +4,7 @@ import { n as generatedIdColumnAliases, t as GENERATED_ID_COLUMN_ALIAS_NAMESPACE
4
4
  import { a as isSqlExpression, c as requireSqlExpression, r as SqlExpression, s as readSqlExpression } from "./sql-expression-CKgKznXS.mjs";
5
5
  import { t as CODEC_INSTANCE_KIND } from "./types-CISwoRED.mjs";
6
6
  import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-CcR6gGf_.mjs";
7
- import { i as contractError, l as toOneNullabilityContradictionMessage, n as buildSqlContractFromDefinition, s as refuseTypesKey } from "./derived-checks-BoHNzt-a-4Vi-QMdx.mjs";
7
+ import { a as contractError, d as refuseTypesKey, l as namedEntriesFrom, m as writeNamedEntry, n as assertPlainNamedEntries, o as ensureNamedEntries, p as toOneNullabilityContradictionMessage, r as buildSqlContractFromDefinition, u as readNamedEntry } from "./derived-checks-9Ku2scaj-0iT0uU_6.mjs";
8
8
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
9
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
10
10
  import { assembleDataTypeSupport, assertNoCrossRegistryCollisions, assertTypeAliasesValid, assertTypeChoicesValid, describeAdmittedForms, instantiateAuthoringTypeAlias, instantiateAuthoringTypeCall, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringTypeAliasDescriptor, isAuthoringTypeChoiceDescriptor, isAuthoringTypeConstructorDescriptor, isAuthoringTypeDescriptor, readWrittenValueAs, resolveAuthoringTypeChoice, typeChoiceArgumentsFromObject, typeConstructorLookup, validateAuthoringHelperArguments, validateAuthoringTypeChoiceParams, validateAuthoringTypeParams } from "@prisma/orm-framework/components/authoring";
@@ -412,19 +412,25 @@ function check(input) {
412
412
  ...input.map !== void 0 ? { map: input.map } : {}
413
413
  };
414
414
  }
415
- function createFieldRefs(fields) {
415
+ function fieldNameSite(modelName) {
416
+ return {
417
+ kind: "field",
418
+ modelName
419
+ };
420
+ }
421
+ function createFieldRefs(fields, modelName) {
416
422
  const refs = {};
417
- for (const fieldName of Object.keys(fields)) refs[fieldName] = {
423
+ for (const fieldName of Object.keys(fields)) writeNamedEntry(refs, fieldName, {
418
424
  kind: "columnRef",
419
425
  fieldName
420
- };
426
+ }, fieldNameSite(modelName));
421
427
  return refs;
422
428
  }
423
429
  function createModelTokenRefs(modelName, fields, crossSpaceCoordinate) {
424
430
  const refs = {};
425
431
  for (const [fieldName, fieldBuilder] of Object.entries(fields)) {
426
432
  const physicalColumn = crossSpaceCoordinate !== void 0 ? fieldBuilder.physicalColumnName : void 0;
427
- refs[fieldName] = {
433
+ writeNamedEntry(refs, fieldName, {
428
434
  kind: "targetFieldRef",
429
435
  source: "token",
430
436
  modelName,
@@ -435,7 +441,7 @@ function createModelTokenRefs(modelName, fields, crossSpaceCoordinate) {
435
441
  ...crossSpaceCoordinate.tableName !== void 0 ? { tableName: crossSpaceCoordinate.tableName } : {},
436
442
  ...physicalColumn !== void 0 ? { columnName: physicalColumn } : {}
437
443
  } : {}
438
- };
444
+ }, fieldNameSite(modelName));
439
445
  }
440
446
  return refs;
441
447
  }
@@ -458,8 +464,8 @@ function createSqlConstraintsDsl() {
458
464
  ref: constraints.ref
459
465
  };
460
466
  }
461
- function createColumnRefs(fields) {
462
- return createFieldRefs(fields);
467
+ function createColumnRefs(fields, modelName) {
468
+ return createFieldRefs(fields, modelName);
463
469
  }
464
470
  function findDuplicateRelationName(existingRelations, nextRelations) {
465
471
  return Object.keys(nextRelations).find((relationName) => Object.hasOwn(existingRelations, relationName));
@@ -477,6 +483,14 @@ var ContractModelBuilder = class ContractModelBuilder {
477
483
  this.sqlFactory = sqlFactory;
478
484
  this.spaceId = spaceId;
479
485
  this.tableName = tableName;
486
+ assertPlainNamedEntries(stageOne.fields, {
487
+ kind: "field",
488
+ modelName: stageOne.modelName
489
+ });
490
+ assertPlainNamedEntries(stageOne.relations, {
491
+ kind: "relation",
492
+ modelName: stageOne.modelName
493
+ });
480
494
  const crossSpaceCoordinate = spaceId !== void 0 ? {
481
495
  spaceId,
482
496
  ...stageOne.namespace !== void 0 ? { namespaceId: stageOne.namespace } : {},
@@ -495,6 +509,10 @@ var ContractModelBuilder = class ContractModelBuilder {
495
509
  };
496
510
  }
497
511
  relations(relations) {
512
+ assertPlainNamedEntries(relations, {
513
+ kind: "relation",
514
+ modelName: this.stageOne.modelName
515
+ });
498
516
  const duplicateRelationName = findDuplicateRelationName(this.stageOne.relations, relations);
499
517
  if (duplicateRelationName) throw contractError("CONTRACT.NAME_DUPLICATE", `Model "${this.stageOne.modelName ?? "<anonymous>"}" already defines relation "${duplicateRelationName}".`, { meta: {
500
518
  kind: "relation",
@@ -519,14 +537,14 @@ var ContractModelBuilder = class ContractModelBuilder {
519
537
  buildAttributesSpec() {
520
538
  if (!this.attributesFactory) return;
521
539
  return buildStageSpec(this.attributesFactory, {
522
- fields: createFieldRefs(this.stageOne.fields),
540
+ fields: createFieldRefs(this.stageOne.fields, this.stageOne.modelName),
523
541
  constraints: createAttributeConstraintsDsl()
524
542
  });
525
543
  }
526
544
  buildSqlSpec() {
527
545
  if (!this.sqlFactory) return;
528
546
  return buildStageSpec(this.sqlFactory, {
529
- cols: createColumnRefs(this.stageOne.fields),
547
+ cols: createColumnRefs(this.stageOne.fields, this.stageOne.modelName),
530
548
  constraints: createSqlConstraintsDsl()
531
549
  });
532
550
  }
@@ -895,7 +913,7 @@ function composedExtensionPackRefs(target, extensionIds, knownPackRefs = []) {
895
913
  }]));
896
914
  }
897
915
  function hasNamedModelToken(models, modelName) {
898
- return models[modelName]?.stageOne.modelName === modelName;
916
+ return readNamedEntry(models, modelName)?.stageOne.modelName === modelName;
899
917
  }
900
918
  function formatFieldSelection(fieldNames) {
901
919
  if (fieldNames.length === 1) return `'${fieldNames[0]}'`;
@@ -990,7 +1008,7 @@ function resolveFieldDescriptor(modelName, fieldName, fieldState) {
990
1008
  }
991
1009
  function mapFieldNamesToColumnNames(modelName, fieldNames, fieldToColumn) {
992
1010
  return fieldNames.map((fieldName) => {
993
- const columnName = fieldToColumn[fieldName];
1011
+ const columnName = readNamedEntry(fieldToColumn, fieldName);
994
1012
  if (!columnName) throw contractError("CONTRACT.FIELD_UNKNOWN", `Unknown field "${modelName}.${fieldName}" in contract definition`, { meta: {
995
1013
  modelName,
996
1014
  fieldName
@@ -1135,7 +1153,7 @@ function resolveRelationAnchorFields(spec) {
1135
1153
  function belongsToNullable(relationName, declaredNullable, spec, fieldNames) {
1136
1154
  const { nullable, contradiction } = resolveToOneRelationNullable({
1137
1155
  declaredNullable,
1138
- localFieldNullability: fieldNames.map((fieldName) => spec.fieldBuilders[fieldName]?.build().nullable === true),
1156
+ localFieldNullability: fieldNames.map((fieldName) => readNamedEntry(spec.fieldBuilders, fieldName)?.build().nullable === true),
1139
1157
  ownsReference: true
1140
1158
  });
1141
1159
  if (contradiction !== void 0) throw contractError("CONTRACT.RELATION_INVALID", toOneNullabilityContradictionMessage(`Relation "${spec.modelName}.${relationName}"`, contradiction), { meta: {
@@ -1364,7 +1382,7 @@ function resolveDeferredColumns(spec, fieldNames, fieldCodecIds) {
1364
1382
  const columnNames = mapFieldNamesToColumnNames(spec.modelName, fieldNames, spec.fieldToColumn);
1365
1383
  return fieldNames.map((fieldName, position) => {
1366
1384
  const name = columnNames[position];
1367
- const codecId = fieldCodecIds[fieldName];
1385
+ const codecId = readNamedEntry(fieldCodecIds, fieldName);
1368
1386
  if (name === void 0 || codecId === void 0) throw new InternalError(`Deferred index expression on "${spec.modelName}" resolved no column for field "${fieldName}"`);
1369
1387
  return {
1370
1388
  name,
@@ -1461,9 +1479,12 @@ function resolveModelNode(spec, allSpecs, generatorFunctions, columnLength, exte
1461
1479
  for (const [fieldName, fieldBuilder] of Object.entries(spec.fieldBuilders)) {
1462
1480
  const fieldState = fieldBuilder.build();
1463
1481
  const descriptor = resolveFieldDescriptor(spec.modelName, fieldName, fieldState);
1464
- const columnName = spec.fieldToColumn[fieldName];
1482
+ const columnName = readNamedEntry(spec.fieldToColumn, fieldName);
1465
1483
  if (!columnName) throw new InternalError(`Column name resolution failed for "${spec.modelName}.${fieldName}"`);
1466
- fieldCodecIds[fieldName] = descriptor.codecId;
1484
+ writeNamedEntry(fieldCodecIds, fieldName, descriptor.codecId, {
1485
+ kind: "field",
1486
+ modelName: spec.modelName
1487
+ });
1467
1488
  const enumHandle = "enumHandle" in fieldState && isEnumTypeHandle(fieldState.enumHandle) ? fieldState.enumHandle : void 0;
1468
1489
  const executionDefaults = resolveGeneratorCalls({
1469
1490
  modelName: spec.modelName,
@@ -1544,8 +1565,11 @@ function columnLengthOf(definition) {
1544
1565
  };
1545
1566
  }
1546
1567
  function collectRuntimeModelSpecs(definition) {
1547
- const databaseTypes = { ...definition.databaseTypes };
1548
- const models = { ...definition.models ?? {} };
1568
+ const databaseTypes = namedEntriesFrom(Object.entries(definition.databaseTypes ?? {}), { kind: "databaseType" });
1569
+ const models = namedEntriesFrom(Object.entries(definition.models ?? {}), {
1570
+ kind: "model",
1571
+ namespaceId: void 0
1572
+ });
1549
1573
  const modelSpecs = /* @__PURE__ */ new Map();
1550
1574
  const tableOwners = /* @__PURE__ */ new Map();
1551
1575
  for (const [modelName, modelDefinition] of Object.entries(models)) {
@@ -1579,7 +1603,10 @@ function collectRuntimeModelSpecs(definition) {
1579
1603
  second: fieldName
1580
1604
  } });
1581
1605
  columnOwners.set(columnName, fieldName);
1582
- fieldToColumn[fieldName] = columnName;
1606
+ writeNamedEntry(fieldToColumn, fieldName, columnName, {
1607
+ kind: "field",
1608
+ modelName
1609
+ });
1583
1610
  }
1584
1611
  const fieldBuilders = modelDefinition.stageOne.fields;
1585
1612
  const idConstraint = resolveModelIdConstraint({
@@ -1711,17 +1738,26 @@ function lowerPackEntityHandles(definition, modelSpecs) {
1711
1738
  handles,
1712
1739
  defaultNamespaceId
1713
1740
  })) {
1714
- const forNamespace = pack[row.namespaceId] ?? {};
1715
- pack[row.namespaceId] = forNamespace;
1716
- const forKind = forNamespace[row.entityKind] ?? {};
1741
+ const forNamespace = ensureNamedEntries(pack, row.namespaceId, {
1742
+ kind: "namespace",
1743
+ modelName: void 0,
1744
+ tableName: void 0,
1745
+ entityKind: row.entityKind,
1746
+ entityName: row.key
1747
+ });
1748
+ const forKind = readNamedEntry(forNamespace, row.entityKind) ?? {};
1717
1749
  forNamespace[row.entityKind] = forKind;
1718
- const existing = forKind[row.key];
1750
+ const existing = readNamedEntry(forKind, row.key);
1719
1751
  if (existing !== void 0 && existing !== row.entity) throw contractError("CONTRACT.NAME_DUPLICATE", `defineContract: two different "${row.entityKind}" entities named "${row.key}" in namespace "${row.namespaceId}" — pack-entity names must be unique per namespace.`, { meta: {
1720
1752
  kind: row.entityKind,
1721
1753
  name: row.key,
1722
1754
  namespaceId: row.namespaceId
1723
1755
  } });
1724
- forKind[row.key] = row.entity;
1756
+ writeNamedEntry(forKind, row.key, row.entity, {
1757
+ kind: "entity",
1758
+ entityKind: row.entityKind,
1759
+ namespaceId: row.namespaceId
1760
+ });
1725
1761
  }
1726
1762
  }
1727
1763
  return pack;
@@ -1892,9 +1928,17 @@ function buildContractFromDsl(definition) {
1892
1928
  validatePerModelNamespaces(definition.target, definition.namespaces, definition.models ?? {});
1893
1929
  return blindCast(buildSqlContractFromDefinition(buildContractDefinition(definition), definition.codecLookup, definition.dataTypeLookup));
1894
1930
  }
1931
+ /** Refuses a record of the contract keyed by name that is not a plain object. */
1932
+ function assertPlainContractRecords(records) {
1933
+ if (records.models !== void 0) assertPlainNamedEntries(records.models, { kind: "model" });
1934
+ if (records.enums !== void 0) assertPlainNamedEntries(records.enums, { kind: "enum" });
1935
+ if (records.databaseTypes !== void 0) assertPlainNamedEntries(records.databaseTypes, { kind: "databaseType" });
1936
+ if (records.extensions !== void 0) assertPlainNamedEntries(records.extensions, { kind: "extensionPack" });
1937
+ }
1895
1938
  /** Implementation. */
1896
1939
  function buildBoundContract(family, target, definition, factory) {
1897
1940
  refuseTypesKey(definition, "defineContract");
1941
+ assertPlainContractRecords(definition);
1898
1942
  const full = {
1899
1943
  ...definition,
1900
1944
  family,
@@ -1908,6 +1952,7 @@ function buildBoundContract(family, target, definition, factory) {
1908
1952
  codecLookup: definition.codecLookup
1909
1953
  }));
1910
1954
  refuseTypesKey(built, "defineContract");
1955
+ assertPlainContractRecords(built);
1911
1956
  const mergedEnums = {
1912
1957
  ...definition.enums ?? {},
1913
1958
  ...built.enums
@@ -1947,4 +1992,4 @@ const unbound = Symbol.for("prisma.namespace.unbound");
1947
1992
  //#endregion
1948
1993
  export { check as a, defineContract as c, field as d, member as f, unbound as g, rel as h, buildContractDefinition as i, enumType as l, now as m, bindEnumType as n, composedExtensionPackRefs as o, model as p, buildBoundContract as r, createComposedAuthoringHelpers as s, autoincrement as t, extensionModel as u };
1949
1994
 
1950
- //# sourceMappingURL=contract-builder-BqswyknO.mjs.map
1995
+ //# sourceMappingURL=contract-builder-DIb0oV8O.mjs.map