@prisma/orm-toolchain 8.0.0-rc.18-dev.32 → 8.0.0-rc.18-dev.34

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 (79) hide show
  1. package/dist/{aggregate-C0qscKli.mjs → aggregate-B9HIfbq6.mjs} +7 -7
  2. package/dist/{aggregate-C0qscKli.mjs.map → aggregate-B9HIfbq6.mjs.map} +1 -1
  3. package/dist/{caught-errors-BJYT1ZZW-CJZWDvwc.mjs → caught-errors-VVhfmaAC-B-4FGHb0.mjs} +20 -25
  4. package/dist/caught-errors-VVhfmaAC-B-4FGHb0.mjs.map +1 -0
  5. package/dist/cli-telemetry.mjs +1 -1
  6. package/dist/cli.mjs +58 -334
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/cli__control-api.d.mts +9 -5
  9. package/dist/cli__control-api.d.mts.map +1 -1
  10. package/dist/cli__control-api.mjs +2 -2
  11. package/dist/cli__control-api__testing.d.mts +1 -1
  12. package/dist/cli__migration-cli.mjs +4 -4
  13. package/dist/cli__migration-cli.mjs.map +1 -1
  14. package/dist/config-loader.mjs +1 -1
  15. package/dist/{contract-snapshot-store-DwEs5EOp-3qAvnEf3.mjs → contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs} +3 -3
  16. package/dist/{contract-snapshot-store-DwEs5EOp-3qAvnEf3.mjs.map → contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs.map} +1 -1
  17. package/dist/{db-sign-WZXfmxmZ-BVlM-YTL.d.mts → db-sign-DyugidHS-DGvMQ558.d.mts} +34 -140
  18. package/dist/db-sign-DyugidHS-DGvMQ558.d.mts.map +1 -0
  19. package/dist/{domain-type-generation-DpXuDGLd-CuADX8tA.mjs → domain-type-generation-B4m774CV-WAjyhZHw.mjs} +14 -8
  20. package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +1 -0
  21. package/dist/{domain-type-generation-BdSOXF3O-DGGiAaNs.d.mts → domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts} +9 -6
  22. package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map +1 -0
  23. package/dist/emitter.d.mts +2 -2
  24. package/dist/emitter.mjs +2 -2
  25. package/dist/emitter__domain-type-generation.d.mts +2 -2
  26. package/dist/emitter__domain-type-generation.mjs +2 -2
  27. package/dist/{errors-GnmirXRU.d.mts → errors-CLwhWJiz.d.mts} +10 -2
  28. package/dist/errors-CLwhWJiz.d.mts.map +1 -0
  29. package/dist/{errors-nnIQQvmN-oeANP4Yi.mjs → errors-DXha_4l--relAaiI4.mjs} +9 -6
  30. package/dist/errors-DXha_4l--relAaiI4.mjs.map +1 -0
  31. package/dist/{exports-BLyT8ULG-C_kH8_9c.mjs → exports-BCIlMjIW-DkUBVDzl.mjs} +5 -16
  32. package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +1 -0
  33. package/dist/{exports-DfSHy5Id.mjs → exports-BlYTE3-J.mjs} +2 -2
  34. package/dist/{exports-DfSHy5Id.mjs.map → exports-BlYTE3-J.mjs.map} +1 -1
  35. package/dist/{exports-CiTltjML.mjs → exports-CfQzEu2x.mjs} +2 -2
  36. package/dist/{exports-CiTltjML.mjs.map → exports-CfQzEu2x.mjs.map} +1 -1
  37. package/dist/{graph-membership-ul46Kb0W-B8HahKEu.mjs → graph-membership-DxpNgxfZ-BfqA-H7V.mjs} +3 -3
  38. package/dist/{graph-membership-ul46Kb0W-B8HahKEu.mjs.map → graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map} +1 -1
  39. package/dist/{index-wUUMOC5E.d.mts → index-tAySVPvZ.d.mts} +4 -4
  40. package/dist/{index-wUUMOC5E.d.mts.map → index-tAySVPvZ.d.mts.map} +1 -1
  41. package/dist/{invariants-Jgsl_-rJ-0ieZ1n7L.mjs → invariants-DrF9p5Gd-BF70vGl1.mjs} +3 -3
  42. package/dist/{invariants-Jgsl_-rJ-0ieZ1n7L.mjs.map → invariants-DrF9p5Gd-BF70vGl1.mjs.map} +1 -1
  43. package/dist/{io-QeCr3NPS-Bk-Rfef2.mjs → io-BJ-LXfIc-BDm7pWEw.mjs} +5 -5
  44. package/dist/{io-QeCr3NPS-Bk-Rfef2.mjs.map → io-BJ-LXfIc-BDm7pWEw.mjs.map} +1 -1
  45. package/dist/migration-tools.d.mts +2 -2
  46. package/dist/migration-tools.mjs +12 -12
  47. package/dist/migration-tools__aggregate.mjs +1 -1
  48. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  49. package/dist/migration-tools__errors.d.mts +2 -2
  50. package/dist/migration-tools__errors.mjs +1 -1
  51. package/dist/migration-tools__invariants.mjs +1 -1
  52. package/dist/migration-tools__io.mjs +1 -1
  53. package/dist/migration-tools__migration-graph.mjs +1 -1
  54. package/dist/migration-tools__migration.mjs +1 -1
  55. package/dist/migration-tools__ref-resolution.mjs +1 -1
  56. package/dist/migration-tools__refs.mjs +1 -1
  57. package/dist/migration-tools__spaces.mjs +2 -2
  58. package/dist/{migration-Cp6vkFMP.mjs → migration-wBxEFdXP.mjs} +3 -3
  59. package/dist/{migration-Cp6vkFMP.mjs.map → migration-wBxEFdXP.mjs.map} +1 -1
  60. package/dist/{ref-Bn3SzQ9Z-Cy3ftpv6.mjs → ref-DLqjHXyn-CsLViutC.mjs} +405 -156
  61. package/dist/ref-DLqjHXyn-CsLViutC.mjs.map +1 -0
  62. package/dist/{ref-resolution-CCIgrFwK.mjs → ref-resolution-Eo0QHp4f.mjs} +2 -2
  63. package/dist/{ref-resolution-CCIgrFwK.mjs.map → ref-resolution-Eo0QHp4f.mjs.map} +1 -1
  64. package/dist/{refs-BIzM-guE-qMvITMOL.mjs → refs-DM3q3IZC-BC6H6P0X.mjs} +3 -3
  65. package/dist/{refs-BIzM-guE-qMvITMOL.mjs.map → refs-DM3q3IZC-BC6H6P0X.mjs.map} +1 -1
  66. package/dist/{spaces-BoFEHLeH.mjs → spaces-COXaiv-z.mjs} +5 -5
  67. package/dist/{spaces-BoFEHLeH.mjs.map → spaces-COXaiv-z.mjs.map} +1 -1
  68. package/dist/{verify-contract-spaces-BFH2o5RL-CI6uhB5B.mjs → verify-contract-spaces-DkXWDLa0-R1nU6Hq1.mjs} +4 -4
  69. package/dist/{verify-contract-spaces-BFH2o5RL-CI6uhB5B.mjs.map → verify-contract-spaces-DkXWDLa0-R1nU6Hq1.mjs.map} +1 -1
  70. package/dist/vite-plugin-contract-emit.mjs +3 -3
  71. package/package.json +12 -12
  72. package/dist/caught-errors-BJYT1ZZW-CJZWDvwc.mjs.map +0 -1
  73. package/dist/db-sign-WZXfmxmZ-BVlM-YTL.d.mts.map +0 -1
  74. package/dist/domain-type-generation-BdSOXF3O-DGGiAaNs.d.mts.map +0 -1
  75. package/dist/domain-type-generation-DpXuDGLd-CuADX8tA.mjs.map +0 -1
  76. package/dist/errors-GnmirXRU.d.mts.map +0 -1
  77. package/dist/errors-nnIQQvmN-oeANP4Yi.mjs.map +0 -1
  78. package/dist/exports-BLyT8ULG-C_kH8_9c.mjs.map +0 -1
  79. package/dist/ref-Bn3SzQ9Z-Cy3ftpv6.mjs.map +0 -1
@@ -3,7 +3,7 @@ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  import { blindCast } from "@prisma/orm-framework/utils/casts";
4
4
  import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
5
5
  import { renderImports, tsStringLiteral } from "@prisma/orm-framework/ts-render";
6
- //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-DpXuDGLd.mjs
6
+ //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-B4m774CV.mjs
7
7
  function emitterError(code, message, options) {
8
8
  return structuredError(code, message, options);
9
9
  }
@@ -157,19 +157,25 @@ function generateHashTypeAliases(hashes) {
157
157
  *
158
158
  * Returns `undefined` — signalling the caller to fall back to the codec's full output type — when
159
159
  * the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value
160
- * isn't literal-expressible. A caller that needs column and field types to agree shares this so both
161
- * compute the union identically.
160
+ * isn't literal-expressible, which every value of a codec that declares `keepsWrittenForm` is. A
161
+ * caller that needs column and field types to agree shares this so both compute the union
162
+ * identically.
162
163
  */
163
164
  function renderValueSetType(values, codecId, side, codecLookup) {
164
- if (values.length === 0 || codecLookup?.renderValueLiteralFor === void 0) return void 0;
165
+ if (values.length === 0) return void 0;
165
166
  const literals = [];
166
167
  for (const value of values) {
167
- const lit = codecLookup.renderValueLiteralFor(codecId, value, side);
168
- if (lit === void 0 || !isSafeTypeExpression(lit)) return void 0;
168
+ const lit = renderValueLiteralType(value, codecId, side, codecLookup);
169
+ if (lit === void 0) return void 0;
169
170
  literals.push(lit);
170
171
  }
171
172
  return literals.join(" | ");
172
173
  }
174
+ /** The TS literal type the codec renders for one stored value, or `undefined` when it renders none or what it renders is not a safe type expression. */
175
+ function renderValueLiteralType(value, codecId, side, codecLookup) {
176
+ const lit = codecLookup?.renderValueLiteralFor?.(codecId, value, side);
177
+ return lit === void 0 || !isSafeTypeExpression(lit) ? void 0 : lit;
178
+ }
173
179
  /** The local alias for the union of the stack's parameterized output type functions. */
174
180
  const PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = "ParameterizedOutputTypeFunctions";
175
181
  /** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */
@@ -313,6 +319,6 @@ function generateFieldTypeOverridesMap(contract, codecLookup, resolveStorageValu
313
319
  }));
314
320
  }
315
321
  //#endregion
316
- export { resolveFieldTypeOverride as C, serializeObjectKey as D, serializeNamespaceId as E, serializeValue as O, renderValueSetType as S, serializeExecutionType as T, parameterizedOutputTypeFunctionsAlias as _, generateCodecTypeIntersection as a, renderTypeOverridesMap as b, generateHashTypeAliases as c, generateModelFieldsType as d, generateModelRelationsType as f, generateValueObjectsDescriptorType as g, generateValueObjectTypeAliases as h, fieldTypesMapExpression as i, generateImportLines as l, generateRootsType as m, deduplicateImports as n, generateContractFieldDescriptor as o, generateModelsType as p, emitterError as r, generateFieldTypeOverridesMap as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateModelFieldEntry as u, renderCodecTypeOverride as v, serializeCrossReference as w, renderValueSetOverride as x, renderTypeOverride as y };
322
+ export { renderValueSetType as C, serializeNamespaceId as D, serializeExecutionType as E, serializeObjectKey as O, renderValueSetOverride as S, serializeCrossReference as T, parameterizedOutputTypeFunctionsAlias as _, generateCodecTypeIntersection as a, renderTypeOverridesMap as b, generateHashTypeAliases as c, generateModelFieldsType as d, generateModelRelationsType as f, generateValueObjectsDescriptorType as g, generateValueObjectTypeAliases as h, fieldTypesMapExpression as i, serializeValue as k, generateImportLines as l, generateRootsType as m, deduplicateImports as n, generateContractFieldDescriptor as o, generateModelsType as p, emitterError as r, generateFieldTypeOverridesMap as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateModelFieldEntry as u, renderCodecTypeOverride as v, resolveFieldTypeOverride as w, renderValueLiteralType as x, renderTypeOverride as y };
317
323
 
318
- //# sourceMappingURL=domain-type-generation-DpXuDGLd-CuADX8tA.mjs.map
324
+ //# sourceMappingURL=domain-type-generation-B4m774CV-WAjyhZHw.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-type-generation-B4m774CV-WAjyhZHw.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-B4m774CV.mjs"],"sourcesContent":["import { isSafeTypeExpression } from \"./type-expression-safety.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { renderImports, tsStringLiteral } from \"@internal/ts-render\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/emitter-errors.ts\nfunction emitterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/domain-type-generation.ts\nfunction serializeValue(value) {\n\tif (value === null) return \"null\";\n\tif (value === void 0) return \"undefined\";\n\tif (typeof value === \"string\") return tsStringLiteral(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (Array.isArray(value)) return `readonly [${value.map((v) => serializeValue(v)).join(\", \")}]`;\n\tif (typeof value === \"object\") return `{ ${Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([k, v]) => `readonly ${serializeObjectKey(k)}: ${serializeValue(v)}`).join(\"; \")} }`;\n\treturn \"unknown\";\n}\nfunction serializeObjectKey(key) {\n\tif (/^[$A-Z_a-z][$\\w]*$/.test(key)) return key;\n\treturn serializeValue(key);\n}\nfunction serializeNamespaceId(value) {\n\treturn `${serializeValue(value)} & NamespaceId`;\n}\nfunction serializeCrossReference(ref) {\n\treturn `{ readonly namespace: ${serializeNamespaceId(String(ref.namespace))}; readonly model: ${serializeValue(ref.model)}${ref.space !== void 0 ? `; readonly space: ${serializeValue(ref.space)}` : \"\"} }`;\n}\nfunction generateRootsType(roots) {\n\tif (!roots || Object.keys(roots).length === 0) return \"Record<string, never>\";\n\treturn `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join(\"; \")} }`;\n}\nfunction contractFieldModifierSuffix(field) {\n\treturn (field.many ? `; readonly many: { readonly elementNullable: ${field.many.elementNullable} }` : \"\") + (field.dict === true ? \"; readonly dict: true\" : \"\");\n}\nfunction generateModelFieldEntry(fieldName, field) {\n\tconst mods = contractFieldModifierSuffix(field);\n\tconst { nullable, type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${mods} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;\n}\nfunction objectTypeOpenWhenEmpty(entries) {\n\treturn entries.length > 0 ? `{ ${entries.join(\"; \")} }` : \"{}\";\n}\nfunction generateModelFieldsType(fields) {\n\tconst fieldEntries = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) fieldEntries.push(generateModelFieldEntry(fieldName, field));\n\treturn objectTypeOpenWhenEmpty(fieldEntries);\n}\nfunction generateModelRelationsType(relations) {\n\tconst relationEntries = [];\n\tfor (const [relName, rel] of Object.entries(relations)) {\n\t\tif (typeof rel !== \"object\" || rel === null) continue;\n\t\tconst relObj = blindCast(rel);\n\t\tconst toRef = relObj[\"to\"];\n\t\tif (toRef !== null && typeof toRef === \"object\" && \"space\" in toRef && toRef.space !== void 0) {\n\t\t\trelationEntries.push(`readonly ${serializeObjectKey(relName)}: never`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst parts = [];\n\t\tif (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);\n\t\tif (relObj[\"cardinality\"]) parts.push(`readonly cardinality: ${serializeValue(relObj[\"cardinality\"])}`);\n\t\tif (typeof relObj[\"nullable\"] === \"boolean\") parts.push(`readonly nullable: ${relObj[\"nullable\"]}`);\n\t\tconst on = blindCast(relObj[\"on\"]);\n\t\tif (on && (!on.localFields || !on.targetFields)) throw emitterError(\"CONTRACT.RELATION_INVALID\", `Relation \"${relName}\" has an \"on\" block but is missing localFields or targetFields`, { meta: { relation: relName } });\n\t\tif (on?.localFields && on.targetFields) {\n\t\t\tconst localFields = on.localFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tconst targetFields = on.targetFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tparts.push(`readonly on: { readonly localFields: readonly [${localFields}]; readonly targetFields: readonly [${targetFields}] }`);\n\t\t}\n\t\tif (relObj[\"cardinality\"] === \"N:M\") {\n\t\t\tconst { through } = blindCast(relObj);\n\t\t\tconst table = serializeValue(through.table);\n\t\t\tconst namespaceId = serializeValue(through.namespaceId);\n\t\t\tconst parentColumns = through.parentColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst childColumns = through.childColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst targetColumns = through.targetColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tparts.push(`readonly through: { readonly table: ${table}; readonly namespaceId: ${namespaceId}; readonly parentColumns: readonly [${parentColumns}]; readonly childColumns: readonly [${childColumns}]; readonly targetColumns: readonly [${targetColumns}] }`);\n\t\t}\n\t\tif (parts.length > 0) relationEntries.push(`readonly ${serializeObjectKey(relName)}: { ${parts.join(\"; \")} }`);\n\t}\n\tif (relationEntries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${relationEntries.join(\"; \")} }`;\n}\nfunction generateModelsType(models, generateModelStorage) {\n\tif (!models || Object.keys(models).length === 0) return \"Record<string, never>\";\n\tconst modelTypes = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst fieldsType = generateModelFieldsType(model.fields);\n\t\tconst relationsType = generateModelRelationsType(model.relations);\n\t\tconst storageType = generateModelStorage(modelName, model);\n\t\tconst modelParts = [\n\t\t\t`readonly fields: ${fieldsType}`,\n\t\t\t`readonly relations: ${relationsType}`,\n\t\t\t`readonly storage: ${storageType}`\n\t\t];\n\t\tif (model.owner) modelParts.push(`readonly owner: ${serializeValue(model.owner)}`);\n\t\tif (model.discriminator) modelParts.push(`readonly discriminator: ${serializeValue(model.discriminator)}`);\n\t\tif (model.variants) {\n\t\t\tconst variantEntries = Object.entries(model.variants).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([value, ref]) => `readonly ${serializeObjectKey(value)}: ${serializeCrossReference(ref)}`);\n\t\t\tmodelParts.push(`readonly variants: { ${variantEntries.join(\"; \")} }`);\n\t\t}\n\t\tif (model.base) modelParts.push(`readonly base: ${serializeCrossReference(model.base)}`);\n\t\tmodelTypes.push(`readonly ${serializeObjectKey(modelName)}: { ${modelParts.join(\"; \")} }`);\n\t}\n\treturn `{ ${modelTypes.join(\"; \")} }`;\n}\nfunction deduplicateImports(imports) {\n\tconst seenKeys = /* @__PURE__ */ new Set();\n\tconst result = [];\n\tfor (const imp of imports) {\n\t\tconst key = `${imp.package}::${imp.named}`;\n\t\tif (!seenKeys.has(key)) {\n\t\t\tseenKeys.add(key);\n\t\t\tresult.push(imp);\n\t\t}\n\t}\n\treturn result;\n}\nfunction generateImportLines(imports, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst rendered = renderImports(imports.map((imp) => ({\n\t\tmoduleSpecifier: resolveImportSpecifier(imp.package),\n\t\tsymbol: imp.named,\n\t\talias: imp.alias,\n\t\ttypeOnly: true\n\t})));\n\treturn rendered === \"\" ? [] : rendered.split(\"\\n\");\n}\nfunction generateCodecTypeIntersection(imports, named) {\n\treturn imports.filter((imp) => imp.named === named).map((imp) => imp.alias).join(\" & \") || \"Record<string, never>\";\n}\nfunction serializeExecutionType(execution) {\n\tconst parts = [\"readonly executionHash: ExecutionHash\"];\n\tfor (const [key, value] of Object.entries(execution)) {\n\t\tif (key === \"executionHash\") continue;\n\t\tparts.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nfunction generateHashTypeAliases(hashes) {\n\tconst executionHashType = hashes.executionHash ? `ExecutionHashBase<${serializeValue(hashes.executionHash)}>` : \"ExecutionHashBase<string>\";\n\treturn [\n\t\t`export type StorageHash = StorageHashBase<${serializeValue(hashes.storageHash)}>;`,\n\t\t`export type ExecutionHash = ${executionHashType};`,\n\t\t`export type ProfileHash = ProfileHashBase<${serializeValue(hashes.profileHash)}>;`\n\t].join(\"\\n\");\n}\n/**\n* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by\n* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not\n* a generic serializer. `side`: `output` = read type, `input` = create/update type.\n*\n* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when\n* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value\n* isn't literal-expressible, which every value of a codec that declares `keepsWrittenForm` is. A\n* caller that needs column and field types to agree shares this so both compute the union\n* identically.\n*/\nfunction renderValueSetType(values, codecId, side, codecLookup) {\n\tif (values.length === 0) return void 0;\n\tconst literals = [];\n\tfor (const value of values) {\n\t\tconst lit = renderValueLiteralType(value, codecId, side, codecLookup);\n\t\tif (lit === void 0) return void 0;\n\t\tliterals.push(lit);\n\t}\n\treturn literals.join(\" | \");\n}\n/** The TS literal type the codec renders for one stored value, or `undefined` when it renders none or what it renders is not a safe type expression. */\nfunction renderValueLiteralType(value, codecId, side, codecLookup) {\n\tconst lit = codecLookup?.renderValueLiteralFor?.(codecId, value, side);\n\treturn lit === void 0 || !isSafeTypeExpression(lit) ? void 0 : lit;\n}\n/** The local alias for the union of the stack's parameterized output type functions. */\nconst PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = \"ParameterizedOutputTypeFunctions\";\n/** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */\nfunction parameterizedOutputTypeFunctionsAlias(typeFunctions) {\n\tconst aliases = [...new Set(typeFunctions.map((typeFunction) => typeFunction.alias))];\n\treturn `type ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} = ${aliases.length > 0 ? aliases.join(\" | \") : \"never\"};`;\n}\n/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides`. */\nfunction fieldTypesMapExpression(side) {\n\treturn `FieldTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}>`;\n}\nfunction generateContractFieldDescriptor(fieldName, field) {\n\tconst modStr = contractFieldModifierSuffix(field);\n\tconst { type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${modStr} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;\n}\nfunction generateValueObjectsDescriptorType(valueObjects) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"Record<string, never>\";\n\tconst voEntries = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst fieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(vo.fields)) fieldEntries.push(generateContractFieldDescriptor(fieldName, field));\n\t\tconst fieldsType = fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tvoEntries.push(`readonly ${serializeObjectKey(voName)}: { readonly fields: ${fieldsType} }`);\n\t}\n\treturn `{ ${voEntries.join(\"; \")} }`;\n}\n/**\n* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the namespace that declares it.\n*/\nfunction generateValueObjectTypeAliases(valueObjectNamespaces) {\n\tif (valueObjectNamespaces.length === 0) return \"\";\n\tconst generic = (side) => `ValueObjectTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}>`;\n\tconst aliases = [`type ValueObjectOutputTypes = ${generic(\"output\")};`, `type ValueObjectInputTypes = ${generic(\"input\")};`];\n\tfor (const [name, namespaceId] of valueObjectNamespaces) {\n\t\tconst path = `[${serializeValue(namespaceId)}][${serializeValue(name)}]`;\n\t\taliases.push(`export type ${name}Output = ValueObjectOutputTypes${path};`);\n\t\taliases.push(`export type ${name}Input = ValueObjectInputTypes${path};`);\n\t}\n\treturn aliases.join(\"\\n\");\n}\n/**\n* The type of a scalar field that its codec does not give, which the shared field type generic takes as an override: the literal union of the value set it holds, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides, and for a value object or union field, which the generic types itself.\n*/\nfunction resolveFieldTypeOverride(field, codecLookup, resolvedValueSet) {\n\tconst { type } = field;\n\tif (type.kind !== \"scalar\") return void 0;\n\tif (resolvedValueSet) {\n\t\tconst override = renderValueSetOverride(resolvedValueSet.encodedValues, resolvedValueSet.codecId, codecLookup);\n\t\tif (override !== void 0) return override;\n\t}\n\tconst typeParams = type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0;\n\treturn renderCodecTypeOverride(type.codecId, typeParams, codecLookup);\n}\n/** The literal union of a value set on each side whose values all have literal types, or `undefined` when neither side has. */\nfunction renderValueSetOverride(values, codecId, codecLookup) {\n\tconst output = renderValueSetType(values, codecId, \"output\", codecLookup);\n\tconst input = renderValueSetType(values, codecId, \"input\", codecLookup);\n\tconst override = {\n\t\t...output !== void 0 ? { output } : {},\n\t\t...input !== void 0 ? { input } : {}\n\t};\n\treturn Object.keys(override).length > 0 ? override : void 0;\n}\n/** The type text a codec renders for these type parameters, on the sides it renders one. */\nfunction renderCodecTypeOverride(codecId, typeParams, codecLookup) {\n\tif (codecLookup === void 0 || typeParams === void 0) return void 0;\n\tconst output = codecLookup.renderOutputTypeFor(codecId, typeParams);\n\tconst input = codecLookup.renderInputTypeFor?.(codecId, typeParams);\n\tconst override = {\n\t\t...output && isSafeTypeExpression(output) ? { output } : {},\n\t\t...input && isSafeTypeExpression(input) ? { input } : {}\n\t};\n\treturn Object.keys(override).length > 0 ? override : void 0;\n}\nfunction renderTypeOverride(override) {\n\treturn `{ ${[\"output\", \"input\"].flatMap((side) => {\n\t\tconst type = override[side];\n\t\treturn type === void 0 ? [] : [`readonly ${side}: ${type}`];\n\t}).join(\"; \")} }`;\n}\n/** A nested map of type overrides, one level per path segment, ordered by name at every level, leaving out every branch with no entry. */\nfunction renderTypeOverridesMap(entries) {\n\tconst root = /* @__PURE__ */ new Map();\n\tfor (const [path, type] of entries) {\n\t\tif (type === void 0) continue;\n\t\tlet node = root;\n\t\tfor (const segment of path.slice(0, -1)) {\n\t\t\tconst child = node.get(segment);\n\t\t\tconst next = child instanceof Map ? child : /* @__PURE__ */ new Map();\n\t\t\tnode.set(segment, next);\n\t\t\tnode = next;\n\t\t}\n\t\tconst leaf = path.at(-1);\n\t\tif (leaf !== void 0) node.set(leaf, type);\n\t}\n\treturn renderOverrideTree(root);\n}\nfunction renderOverrideTree(tree) {\n\treturn `{ ${[...tree].sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${value instanceof Map ? renderOverrideTree(value) : renderTypeOverride(value)}`).join(\"; \")} }`;\n}\n/**\n* The values a field's value set holds, with the field's codec. A reference to a domain enum is read from the contract's domain, for model and value object fields alike. Any other model field goes to the family's `resolveStorageValueSet`, which reads its storage. A value object field has no storage of its own.\n*/\nfunction resolveFieldValueSet(field, contract, resolveStorageValueSet) {\n\tif (field.valueSet?.plane === \"domain\") return resolveDomainValueSet(field, contract);\n\treturn resolveStorageValueSet();\n}\nfunction resolveDomainValueSet(field, contract) {\n\tconst ref = field.valueSet;\n\tif (ref === void 0 || field.type.kind !== \"scalar\" || ref.entityKind !== \"enum\") return;\n\tconst domainEnum = contract.domain.namespaces[ref.namespaceId]?.enum?.[ref.entityName];\n\tif (domainEnum === void 0) return void 0;\n\treturn {\n\t\tencodedValues: domainEnum.members.map((member) => member.value),\n\t\tcodecId: field.type.codecId\n\t};\n}\n/** `FieldTypeOverrides`: per namespace, `models` or `valueObjects`, owner and field, the type of each field its codec does not give. */\nfunction generateFieldTypeOverridesMap(contract, codecLookup, resolveStorageValueSet) {\n\treturn renderTypeOverridesMap(Object.entries(contract.domain.namespaces).flatMap(([nsId, ns]) => {\n\t\tconst modelFields = Object.entries(ns.models).flatMap(([modelName, model]) => Object.entries(model.fields).map(([fieldName, field]) => [[\n\t\t\tnsId,\n\t\t\t\"models\",\n\t\t\tmodelName,\n\t\t\tfieldName\n\t\t], resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet(field, contract, () => resolveStorageValueSet?.(modelName, fieldName, model)))]));\n\t\tconst valueObjects = blindCast(ns.valueObjects ?? {});\n\t\tconst valueObjectFields = Object.entries(valueObjects).flatMap(([valueObjectName, valueObject]) => Object.entries(valueObject.fields).map(([fieldName, field]) => [[\n\t\t\tnsId,\n\t\t\t\"valueObjects\",\n\t\t\tvalueObjectName,\n\t\t\tfieldName\n\t\t], resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet(field, contract, () => void 0))]));\n\t\treturn [...modelFields, ...valueObjectFields];\n\t}));\n}\n//#endregion\nexport { resolveFieldTypeOverride as C, serializeObjectKey as D, serializeNamespaceId as E, serializeValue as O, renderValueSetType as S, serializeExecutionType as T, renderCodecTypeOverride as _, generateContractFieldDescriptor as a, renderValueLiteralType as b, generateImportLines as c, generateModelRelationsType as d, generateModelsType as f, parameterizedOutputTypeFunctionsAlias as g, generateValueObjectsDescriptorType as h, generateCodecTypeIntersection as i, emitterError as k, generateModelFieldEntry as l, generateValueObjectTypeAliases as m, deduplicateImports as n, generateFieldTypeOverridesMap as o, generateRootsType as p, fieldTypesMapExpression as r, generateHashTypeAliases as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateModelFieldsType as u, renderTypeOverride as v, serializeCrossReference as w, renderValueSetOverride as x, renderTypeOverridesMap as y };\n\n//# sourceMappingURL=domain-type-generation-B4m774CV.mjs.map"],"mappings":";;;;;;AAMA,SAAS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AM;CAClB,IAAI,QAAQ,KAAK,KAAK,MAAM,KAAK,SAAS,YAAY,IAAI,eAAe,QAAQ;CACjF,MAAM,aAAa,SAAS,OAAO,WAAW,IAAI,YAAY,EAAE,OAAO,IAAI;CAC3E,IAAI,eAAe,KAAK,GAAG,OAAO,KAAK;CACvC,OAAO;EACN,eAAe,WAAW,QAAQ,KAAK,WAAW,OAAO,KAAK;EAC9D,SAAS,MAAM,KAAK;CACrB;AACD;;AAEA,SAAS,8BAA8B,UAAU,aAAa,wBAAwB;CACrF,OAAO,uBAAuB,OAAO,QAAQ,SAAS,OAAO,UAAU,CAAC,CAAC,SAAS,CAAC,MAAM,QAAQ;EAChG,MAAM,cAAc,OAAO,QAAQ,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,WAAW,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW,CAAC;GACvI;GACA;GACA;GACA;EACD,GAAG,yBAAyB,OAAO,aAAa,qBAAqB,OAAO,gBAAgB,yBAAyB,WAAW,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EACrJ,MAAM,eAAe,UAAU,GAAG,gBAAgB,CAAC,CAAC;EACpD,MAAM,oBAAoB,OAAO,QAAQ,YAAY,CAAC,CAAC,SAAS,CAAC,iBAAiB,iBAAiB,OAAO,QAAQ,YAAY,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW,CAAC;GAClK;GACA;GACA;GACA;EACD,GAAG,yBAAyB,OAAO,aAAa,qBAAqB,OAAO,gBAAgB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EACtG,OAAO,CAAC,GAAG,aAAa,GAAG,iBAAiB;CAC7C,CAAC,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
1
  import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
2
- import { CodecLookup } from "@prisma/orm-framework/components/codec";
3
2
  import { Contract, ContractField, ContractModelBase, ContractValueObject, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
4
- //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-BdSOXF3O.d.mts
3
+ import { CodecLookup } from "@prisma/orm-framework/components/codec";
4
+ //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-DZjtzrbE.d.mts
5
5
  //#region src/domain-type-generation.d.ts
6
6
  declare function serializeValue(value: unknown): string;
7
7
  declare function serializeObjectKey(key: string): string;
@@ -36,10 +36,13 @@ type StorageValueSetResolver = (modelName: string, fieldName: string, model: Con
36
36
  *
37
37
  * Returns `undefined` — signalling the caller to fall back to the codec's full output type — when
38
38
  * the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value
39
- * isn't literal-expressible. A caller that needs column and field types to agree shares this so both
40
- * compute the union identically.
39
+ * isn't literal-expressible, which every value of a codec that declares `keepsWrittenForm` is. A
40
+ * caller that needs column and field types to agree shares this so both compute the union
41
+ * identically.
41
42
  */
42
43
  declare function renderValueSetType(values: readonly JsonValue[], codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
44
+ /** The TS literal type the codec renders for one stored value, or `undefined` when it renders none or what it renders is not a safe type expression. */
45
+ declare function renderValueLiteralType(value: JsonValue, codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
43
46
  /** The local alias for the union of the stack's parameterized output type functions. */
44
47
  declare const PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = "ParameterizedOutputTypeFunctions";
45
48
  /** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */
@@ -71,5 +74,5 @@ declare function renderTypeOverridesMap(entries: ReadonlyArray<readonly [path: r
71
74
  /** `FieldTypeOverrides`: per namespace, `models` or `valueObjects`, owner and field, the type of each field its codec does not give. */
72
75
  declare function generateFieldTypeOverridesMap(contract: Pick<Contract, 'domain'>, codecLookup: CodecLookup | undefined, resolveStorageValueSet: StorageValueSetResolver | undefined): string;
73
76
  //#endregion
74
- export { serializeValue as A, renderValueSetOverride as C, serializeExecutionType as D, serializeCrossReference as E, serializeNamespaceId as O, renderTypeOverridesMap as S, resolveFieldTypeOverride as T, generateValueObjectTypeAliases as _, deduplicateImports as a, renderCodecTypeOverride as b, generateContractFieldDescriptor as c, generateImportLines as d, generateModelFieldEntry as f, generateRootsType as g, generateModelsType as h, TypeOverride as i, serializeObjectKey as k, generateFieldTypeOverridesMap as l, generateModelRelationsType as m, ResolvedFieldValueSet as n, fieldTypesMapExpression as o, generateModelFieldsType as p, StorageValueSetResolver as r, generateCodecTypeIntersection as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateHashTypeAliases as u, generateValueObjectsDescriptorType as v, renderValueSetType as w, renderTypeOverride as x, parameterizedOutputTypeFunctionsAlias as y };
75
- //# sourceMappingURL=domain-type-generation-BdSOXF3O-DGGiAaNs.d.mts.map
77
+ export { serializeObjectKey as A, renderValueLiteralType as C, serializeCrossReference as D, resolveFieldTypeOverride as E, serializeExecutionType as O, renderTypeOverridesMap as S, renderValueSetType as T, generateValueObjectTypeAliases as _, deduplicateImports as a, renderCodecTypeOverride as b, generateContractFieldDescriptor as c, generateImportLines as d, generateModelFieldEntry as f, generateRootsType as g, generateModelsType as h, TypeOverride as i, serializeValue as j, serializeNamespaceId as k, generateFieldTypeOverridesMap as l, generateModelRelationsType as m, ResolvedFieldValueSet as n, fieldTypesMapExpression as o, generateModelFieldsType as p, StorageValueSetResolver as r, generateCodecTypeIntersection as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateHashTypeAliases as u, generateValueObjectsDescriptorType as v, renderValueSetOverride as w, renderTypeOverride as x, parameterizedOutputTypeFunctionsAlias as y };
78
+ //# sourceMappingURL=domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-DZjtzrbE.d.mts"],"mappings":";;;;;iBAIiB,eAAe;iBACf,mBAAmB;iBACnB,qBAAqB;iBACrB,wBAAwB,KAAK;iBAC7B,kBAAkB,OAAO,eAAe;iBACxC,wBAAwB,mBAAmB,OAAO;iBAClD,wBAAwB,QAAQ,eAAe;iBAC/C,2BAA2B,WAAW;iBACtC,mBAAmB,QAAQ,eAAe,oBAAoB,uBAAuB,mBAAmB,OAAO;iBAC/G,mBAAmB,SAAS,oBAAoB;iBAChD,oBAAoB,SAAS,mBAAmB,yBAAyB;iBACzE,8BAA8B,SAAS,cAAc,kBAAkB;iBACvE,uBAAuB,WAAW;iBAClC,wBAAwB;WAC9B;WACA;WACA;;;;;KAKN;WACM,wBAAwB;WACxB;;KAEN,2BAA2B,mBAAmB,mBAAmB,OAAO,sBAAsB;;;;;;;;;;;;iBAYlF,mBAAmB,iBAAiB,aAAa,iBAAiB,0BAA0B,aAAa;;iBAEzG,uBAAuB,OAAO,WAAW,iBAAiB,0BAA0B,aAAa;;cAEpG;;iBAEG,sCAAsC,eAAe,cAAc;;iBAEnE,wBAAwB;iBACxB,gCAAgC,mBAAmB,OAAO;iBAC1D,mCAAmC,cAAc,eAAe;;;;iBAIhE,+BAA+B,uBAAuB,wBAAwB,cAAc;;KAExG;WACM;WACA;;;;;iBAKM,yBAAyB,OAAO,eAAe,aAAa,yBAAyB,kBAAkB,oCAAoC;;iBAE3I,uBAAuB,iBAAiB,aAAa,iBAAiB,aAAa,0BAA0B;;iBAE7G,wBAAwB,iBAAiB,YAAY,qCAAqC,aAAa,0BAA0B;iBACjI,mBAAmB,UAAU;;iBAE7B,uBAAuB,SAAS,wBAAwB,yBAAyB,MAAM;;iBAEvF,8BAA8B,UAAU,KAAK,qBAAqB,aAAa,yBAAyB,wBAAwB"}
@@ -1,3 +1,3 @@
1
- import { A as serializeValue, a as deduplicateImports, d as generateImportLines, g as generateRootsType, k as serializeObjectKey, m as generateModelRelationsType, s as generateCodecTypeIntersection, u as generateHashTypeAliases } from "./domain-type-generation-BdSOXF3O-DGGiAaNs.mjs";
2
- import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-wUUMOC5E.mjs";
1
+ import { A as serializeObjectKey, a as deduplicateImports, d as generateImportLines, g as generateRootsType, j as serializeValue, m as generateModelRelationsType, s as generateCodecTypeIntersection, u as generateHashTypeAliases } from "./domain-type-generation-DZjtzrbE-BpOOD3YV.mjs";
2
+ import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-tAySVPvZ.mjs";
3
3
  export { type EmitOptions, type EmitResult, type EmitStackInput, type EmittedArtifactPaths, deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
package/dist/emitter.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { D as serializeObjectKey, O as serializeValue, a as generateCodecTypeIntersection, c as generateHashTypeAliases, f as generateModelRelationsType, l as generateImportLines, m as generateRootsType, n as deduplicateImports } from "./domain-type-generation-DpXuDGLd-CuADX8tA.mjs";
2
- import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-BLyT8ULG-C_kH8_9c.mjs";
1
+ import { O as serializeObjectKey, a as generateCodecTypeIntersection, c as generateHashTypeAliases, f as generateModelRelationsType, k as serializeValue, l as generateImportLines, m as generateRootsType, n as deduplicateImports } from "./domain-type-generation-B4m774CV-WAjyhZHw.mjs";
2
+ import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-BCIlMjIW-DkUBVDzl.mjs";
3
3
  export { deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
@@ -1,2 +1,2 @@
1
- import { A as serializeValue, C as renderValueSetOverride, D as serializeExecutionType, E as serializeCrossReference, O as serializeNamespaceId, S as renderTypeOverridesMap, T as resolveFieldTypeOverride, _ as generateValueObjectTypeAliases, a as deduplicateImports, b as renderCodecTypeOverride, c as generateContractFieldDescriptor, d as generateImportLines, f as generateModelFieldEntry, g as generateRootsType, h as generateModelsType, i as TypeOverride, k as serializeObjectKey, l as generateFieldTypeOverridesMap, m as generateModelRelationsType, n as ResolvedFieldValueSet, o as fieldTypesMapExpression, p as generateModelFieldsType, r as StorageValueSetResolver, s as generateCodecTypeIntersection, t as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, u as generateHashTypeAliases, v as generateValueObjectsDescriptorType, w as renderValueSetType, x as renderTypeOverride, y as parameterizedOutputTypeFunctionsAlias } from "./domain-type-generation-BdSOXF3O-DGGiAaNs.mjs";
2
- export { PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, ResolvedFieldValueSet, StorageValueSetResolver, TypeOverride, deduplicateImports, fieldTypesMapExpression, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldTypeOverridesMap, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueSetOverride, renderValueSetType, resolveFieldTypeOverride, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
1
+ import { A as serializeObjectKey, C as renderValueLiteralType, D as serializeCrossReference, E as resolveFieldTypeOverride, O as serializeExecutionType, S as renderTypeOverridesMap, T as renderValueSetType, _ as generateValueObjectTypeAliases, a as deduplicateImports, b as renderCodecTypeOverride, c as generateContractFieldDescriptor, d as generateImportLines, f as generateModelFieldEntry, g as generateRootsType, h as generateModelsType, i as TypeOverride, j as serializeValue, k as serializeNamespaceId, l as generateFieldTypeOverridesMap, m as generateModelRelationsType, n as ResolvedFieldValueSet, o as fieldTypesMapExpression, p as generateModelFieldsType, r as StorageValueSetResolver, s as generateCodecTypeIntersection, t as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, u as generateHashTypeAliases, v as generateValueObjectsDescriptorType, w as renderValueSetOverride, x as renderTypeOverride, y as parameterizedOutputTypeFunctionsAlias } from "./domain-type-generation-DZjtzrbE-BpOOD3YV.mjs";
2
+ export { PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, ResolvedFieldValueSet, StorageValueSetResolver, TypeOverride, deduplicateImports, fieldTypesMapExpression, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldTypeOverridesMap, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueLiteralType, renderValueSetOverride, renderValueSetType, resolveFieldTypeOverride, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
@@ -1,2 +1,2 @@
1
- import { C as resolveFieldTypeOverride, D as serializeObjectKey, E as serializeNamespaceId, O as serializeValue, S as renderValueSetType, T as serializeExecutionType, _ as parameterizedOutputTypeFunctionsAlias, a as generateCodecTypeIntersection, b as renderTypeOverridesMap, c as generateHashTypeAliases, d as generateModelFieldsType, f as generateModelRelationsType, g as generateValueObjectsDescriptorType, h as generateValueObjectTypeAliases, i as fieldTypesMapExpression, l as generateImportLines, m as generateRootsType, n as deduplicateImports, o as generateContractFieldDescriptor, p as generateModelsType, s as generateFieldTypeOverridesMap, t as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, u as generateModelFieldEntry, v as renderCodecTypeOverride, w as serializeCrossReference, x as renderValueSetOverride, y as renderTypeOverride } from "./domain-type-generation-DpXuDGLd-CuADX8tA.mjs";
2
- export { PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, deduplicateImports, fieldTypesMapExpression, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldTypeOverridesMap, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueSetOverride, renderValueSetType, resolveFieldTypeOverride, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
1
+ import { C as renderValueSetType, D as serializeNamespaceId, E as serializeExecutionType, O as serializeObjectKey, S as renderValueSetOverride, T as serializeCrossReference, _ as parameterizedOutputTypeFunctionsAlias, a as generateCodecTypeIntersection, b as renderTypeOverridesMap, c as generateHashTypeAliases, d as generateModelFieldsType, f as generateModelRelationsType, g as generateValueObjectsDescriptorType, h as generateValueObjectTypeAliases, i as fieldTypesMapExpression, k as serializeValue, l as generateImportLines, m as generateRootsType, n as deduplicateImports, o as generateContractFieldDescriptor, p as generateModelsType, s as generateFieldTypeOverridesMap, t as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, u as generateModelFieldEntry, v as renderCodecTypeOverride, w as resolveFieldTypeOverride, x as renderValueLiteralType, y as renderTypeOverride } from "./domain-type-generation-B4m774CV-WAjyhZHw.mjs";
2
+ export { PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, deduplicateImports, fieldTypesMapExpression, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldTypeOverridesMap, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueLiteralType, renderValueSetOverride, renderValueSetType, resolveFieldTypeOverride, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
@@ -57,11 +57,19 @@ interface NoInvariantPathStructuralEdge {
57
57
  readonly to: string;
58
58
  readonly invariants: readonly string[];
59
59
  }
60
+ /** The extension space a `NO_INVARIANT_PATH` is about, and the advice for it, which only the caller can write. */
61
+ interface NoInvariantPathExtensionSpace {
62
+ readonly spaceId: string;
63
+ readonly why: string;
64
+ readonly fix: string;
65
+ readonly nextActions: readonly NextAction[];
66
+ }
60
67
  declare function errorNoInvariantPath(args: {
61
68
  readonly refName?: string;
62
69
  readonly required: readonly string[];
63
70
  readonly missing: readonly string[];
64
71
  readonly structuralPath: readonly NoInvariantPathStructuralEdge[];
72
+ readonly extensionSpace?: NoInvariantPathExtensionSpace;
65
73
  }): MigrationToolsError;
66
74
  declare function errorUnknownInvariant(args: {
67
75
  readonly refName?: string;
@@ -77,5 +85,5 @@ declare function errorContractDeserializationFailed(filePath: string, message: s
77
85
  declare function errorContractSnapshotMissing(storageHash: string, expectedPath: string): MigrationToolsError;
78
86
  declare function errorContractSnapshotHashMismatch(storageHash: string, actualHash: string, dir: string): MigrationToolsError;
79
87
  //#endregion
80
- export { errorContractSnapshotMissing as a, errorInvalidRefName as c, errorContractSnapshotHashMismatch as i, errorNoInvariantPath as l, NoInvariantPathStructuralEdge as n, errorDescriptorHeadHashMismatch as o, errorContractDeserializationFailed as r, errorInvalidJson as s, MigrationToolsError as t, errorUnknownInvariant as u };
81
- //# sourceMappingURL=errors-GnmirXRU.d.mts.map
88
+ export { errorContractSnapshotHashMismatch as a, errorInvalidJson as c, errorUnknownInvariant as d, errorContractDeserializationFailed as i, errorInvalidRefName as l, NoInvariantPathExtensionSpace as n, errorContractSnapshotMissing as o, NoInvariantPathStructuralEdge as r, errorDescriptorHeadHashMismatch as s, MigrationToolsError as t, errorNoInvariantPath as u };
89
+ //# sourceMappingURL=errors-CLwhWJiz.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CLwhWJiz.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/errors.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;cAmBc,4BAA4B;WAC/B;WACA;WACA;WACA;EACT,YAAY,6BAA6B,iBAAiB;aAC/C;aACA;aACA,uBAAuB;aACvB,OAAO;aACP;;SAEJ,GAAG,iBAAiB,SAAS;;iBAErB,iBAAiB,kBAAkB,qBAAqB;iBACxD,gCAAgC;WACtC;WACA;WACA;IACP;iBACa,oBAAoB,kBAAkB;;;;;;;;;;;;UAY7C;WACC;WACA;WACA;WACA;WACA;;;UAGD;WACC;WACA;WACA;WACA,sBAAsB;;iBAEhB,qBAAqB;WAC3B;WACA;WACA;WACA,yBAAyB;WACzB,iBAAiB;IACxB;iBACa,sBAAsB;WAC5B;WACA;WACA;IACP;;;;iBAIa,mCAAmC,kBAAkB,iBAAiB;WAC5E;IACP;iBACa,6BAA6B,qBAAqB,uBAAuB;iBACzE,kCAAkC,qBAAqB,oBAAoB,cAAc"}
@@ -2,7 +2,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
2
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
3
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
4
4
  import { dirname, relative } from "pathe";
5
- //#region ../../../1-framework/3-tooling/migration/dist/errors-nnIQQvmN.mjs
5
+ //#region ../../../1-framework/3-tooling/migration/dist/errors-DXha_4l-.mjs
6
6
  /**
7
7
  * Build the canonical "re-emit this package" remediation hint.
8
8
  *
@@ -228,13 +228,16 @@ function errorProvidedInvariantsMismatch(filePath, stored, derived) {
228
228
  });
229
229
  }
230
230
  function errorNoInvariantPath(args) {
231
- const { refName, required, missing, structuralPath } = args;
231
+ const { refName, required, missing, structuralPath, extensionSpace } = args;
232
232
  const refClause = refName ? `Ref "${refName}"` : "Target";
233
233
  const missingList = missing.map((id) => JSON.stringify(id)).join(", ");
234
- return new MigrationToolsError("MIGRATION.NO_INVARIANT_PATH", "No path covers the required invariants", {
235
- why: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(", ")}], missing=[${missingList}].`,
236
- fix: "Add a migration on the path that runs `dataTransform({ invariantId: \"<id>\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.",
234
+ const requiredList = required.map((id) => JSON.stringify(id)).join(", ");
235
+ return new MigrationToolsError("MIGRATION.NO_INVARIANT_PATH", extensionSpace === void 0 ? "No path covers the required invariants" : `No path covers the required invariants of extension space "${extensionSpace.spaceId}"`, {
236
+ why: extensionSpace?.why ?? `${refClause} requires invariants the reachable path doesn't cover. required=[${requiredList}], missing=[${missingList}].`,
237
+ fix: extensionSpace?.fix ?? "Add a migration on the path that runs `dataTransform({ invariantId: \"<id>\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.",
238
+ ...ifDefined("nextActions", extensionSpace?.nextActions),
237
239
  meta: {
240
+ ...ifDefined("spaceId", extensionSpace?.spaceId),
238
241
  required,
239
242
  missing,
240
243
  structuralPath,
@@ -408,4 +411,4 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
408
411
  //#endregion
409
412
  export { errorRefNotResolvable as A, errorInvalidSpaceId as C, errorNoInvariantPath as D, errorMissingFile as E, errorUnknownInvariant as M, errorOperationsNotArray as O, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractSnapshotContentMismatch as i, errorSpaceHeadRefMissing as j, errorProvidedInvariantsMismatch as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorBundleNotFoundForGraphNode as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorContractDeserializationFailed as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };
410
413
 
411
- //# sourceMappingURL=errors-nnIQQvmN-oeANP4Yi.mjs.map
414
+ //# sourceMappingURL=errors-DXha_4l--relAaiI4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-DXha_4l--relAaiI4.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/errors-DXha_4l-.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, relative } from \"pathe\";\n//#region src/errors.ts\n/**\n* Build the canonical \"re-emit this package\" remediation hint.\n*\n* Every on-disk migration package ships its own `migration.ts` author-time\n* file. Running it regenerates `migration.json` and `ops.json` with the\n* correct hash + metadata, so it is the right primitive whenever a single\n* package's on-disk artifacts are missing, malformed, or otherwise corrupt.\n* Pointing users at `migration plan` would emit a *new* package rather than\n* heal the broken one.\n*/\nfunction reemitHint(dir, fallback) {\n\tconst reemit = `Re-emit the package by running \\`node \"${relative(process.cwd(), dir)}/migration.ts\"\\`, adding the \\`--config <path>\\` you gave this command, if any`;\n\treturn fallback ? `${reemit}, ${fallback}` : `${reemit}.`;\n}\n/**\n* Structured error for migration tooling operations.\n*\n* Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under\n* the MIGRATION namespace. These are tooling-time errors (file I/O, hash\n* verification, migration history reconstruction), distinct from the runtime\n* MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,\n* etc.).\n*\n* Fields:\n* - code: Stable machine-readable code (MIGRATION.SUBCODE)\n* - category: Always 'MIGRATION'\n* - why: Explains the cause in plain language\n* - fix: Actionable remediation step\n* - meta: Machine-readable structured data for agents\n*/\nvar MigrationToolsError = class extends CliStructuredError {\n\tcategory;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.category = \"MIGRATION\";\n\t}\n\tstatic is(error) {\n\t\treturn CliStructuredError.is(error) && \"category\" in error && error.category === \"MIGRATION\" && error.code.startsWith(\"MIGRATION.\");\n\t}\n};\nfunction errorDirectoryExists(dir) {\n\treturn new MigrationToolsError(\"MIGRATION.DIR_EXISTS\", \"Migration directory already exists\", {\n\t\twhy: `The directory \"${dir}\" already exists. Each migration must have a unique directory.`,\n\t\tfix: \"Use --name to pick a different name, or delete the existing directory and re-run.\",\n\t\tmeta: { dir }\n\t});\n}\nfunction errorMissingFile(file, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.FILE_MISSING\", `Missing ${file}`, {\n\t\twhy: `Expected \"${file}\" in \"${dir}\" but the file does not exist.`,\n\t\tfix: reemitHint(dir, \"or delete the directory if the migration is unwanted and the source TypeScript is gone.\"),\n\t\tmeta: {\n\t\t\tfile,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorInvalidJson(filePath, parseError) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_JSON\", \"Invalid JSON in migration file\", {\n\t\twhy: `Failed to parse \"${filePath}\": ${parseError}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tparseError\n\t\t}\n\t});\n}\nfunction errorInvalidManifest(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_MANIFEST\", \"Invalid migration manifest\", {\n\t\twhy: `Migration manifest at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorDescribeMissingEndContract() {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", \"Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.\", {\n\t\twhy: \"Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.\",\n\t\tfix: \"Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.\",\n\t\tmeta: { reason: \"missing-end-contract\" }\n\t});\n}\nfunction errorDescribeInvalidMetadata(summary) {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", `describe() returned invalid metadata: ${summary}`, {\n\t\twhy: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,\n\t\tfix: \"Ensure describe() returns { from: string | null, to: string } with valid contract hashes.\",\n\t\tmeta: {\n\t\t\treason: \"invalid-metadata\",\n\t\t\tsummary\n\t\t}\n\t});\n}\nfunction errorOperationsNotArray() {\n\treturn new MigrationToolsError(\"MIGRATION.PLAN_NOT_ARRAY\", \"operations must be an array\", {\n\t\twhy: \"The migration instance's `operations` getter returned a non-array value.\",\n\t\tfix: \"Ensure the `operations` getter returns an array of migration operations.\",\n\t\tmeta: {}\n\t});\n}\nfunction errorSpaceHeadRefMissing(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.CHECK_HEAD_REF_MISSING\", `Contract space \"${spaceId}\" has no head ref; its contract cannot be resolved from the snapshot store without one.`, {\n\t\twhy: `Contract space \"${spaceId}\" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,\n\t\tfix: \"Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorInvalidOperationEntry(index, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Migration operation entry is malformed\", {\n\t\twhy: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,\n\t\tfix: \"Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').\",\n\t\tmeta: {\n\t\t\tindex,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidSlug(slug) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_NAME\", \"Invalid migration name\", {\n\t\twhy: `The slug \"${slug}\" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,\n\t\tfix: \"Provide a name with at least one alphanumeric character, e.g. --name add_users.\",\n\t\tmeta: { slug }\n\t});\n}\nfunction errorInvalidDestName(destName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_DEST_NAME\", \"Invalid copy destination name\", {\n\t\twhy: `The destination name \"${destName}\" must be a single path segment (no \"..\" or directory separators).`,\n\t\tfix: \"Use a simple file name such as \\\"contract.json\\\" for each destination in the copy list.\",\n\t\tmeta: { destName }\n\t});\n}\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_SPACE_ID\", \"Invalid contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" does not match the required pattern /^[a-z][a-z0-9_-]{0,63}$/. Space ids are used as filesystem directory names under \\`migrations/\\`, so the pattern is conservative on purpose.`,\n\t\tfix: \"Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorDescriptorHeadHashMismatch(args) {\n\tconst { extensionId, recomputedHash, headRefHash } = args;\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH\", \"Extension descriptor's headRef.hash does not match its contractJson\", {\n\t\twhy: `Extension \"${extensionId}\" publishes a \\`contractSpace\\` whose \\`headRef.hash\\` (${headRefHash}) does not match the canonical hash recomputed from \\`contractSpace.contractJson\\` (${recomputedHash}). This means the extension descriptor was published with stale \\`headRef.hash\\` — typically because the contract was bumped without rerunning the extension's emit pipeline.`,\n\t\tfix: \"Re-run the extension authoring pipeline so `contractJson.storage.storageHash` and `headRef.hash` agree, then republish the extension. If you are the extension author and you intentionally bumped `contractJson`, recompute and update `headRef.hash` (and refresh any on-disk migration metadata that derives from it).\",\n\t\tmeta: {\n\t\t\textensionId,\n\t\t\trecomputedHash,\n\t\t\theadRefHash\n\t\t}\n\t});\n}\nfunction errorDuplicateSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_SPACE_ID\", \"Duplicate contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" appears more than once in the per-space planner input. Each space id must be unique across the inputs (the per-space planner emits one output entry per id).`,\n\t\tfix: \"Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorInvalidRefFile(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_FILE\", \"Invalid ref file\", {\n\t\twhy: `Ref file at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: \"Ensure the ref file contains valid JSON with { \\\"hash\\\": \\\"<64 hex chars>\\\", \\\"invariants\\\": [\\\"...\\\"] }.\",\n\t\tmeta: {\n\t\t\tpath: filePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidRefName(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_NAME\", \"Invalid ref name\", {\n\t\twhy: `Ref name \"${refName}\" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no \".\" or \"..\" segments).`,\n\t\tfix: `Use a valid ref name (e.g., \"staging\", \"envs/production\").`,\n\t\tmeta: { refName }\n\t});\n}\nfunction errorInvalidRefValue(value) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_VALUE\", \"Invalid ref value\", {\n\t\twhy: `Ref value \"${value}\" is not a valid contract hash. Values must be a 64-character hex digest or \"empty\".`,\n\t\tfix: \"Use a valid storage hash from `{bin} contract emit` output or an existing migration.\",\n\t\tnextActions: [{\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: \"Emit the contract to obtain a valid storage hash\",\n\t\t\tcommand: \"{bin} contract emit\"\n\t\t}, {\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: \"List existing migrations to reuse one of their hashes\",\n\t\t\tcommand: \"{bin} migration list\"\n\t\t}],\n\t\tmeta: { value }\n\t});\n}\nfunction errorInvalidInvariantId(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_INVARIANT_ID\", \"Invalid invariantId\", {\n\t\twhy: `invariantId ${JSON.stringify(invariantId)} is invalid. Ids must be non-empty and contain no whitespace or control characters (including Unicode whitespace like NBSP); other content (kebab-case, camelCase, namespaced, Unicode letters) is allowed.`,\n\t\tfix: \"Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \\\"backfill-user-phone\\\", \\\"users/backfill-phone\\\", or \\\"BackfillUserPhone\\\".\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorDuplicateInvariantInEdge(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_INVARIANT_IN_EDGE\", \"Duplicate invariantId on a single migration\", {\n\t\twhy: `invariantId \"${invariantId}\" is declared by more than one dataTransform on the same migration. The marker stores invariants as a set and the routing layer treats them as edge-level, so two ops cannot share a routing identity.`,\n\t\tfix: \"Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorProvidedInvariantsMismatch(filePath, stored, derived) {\n\tconst storedSet = new Set(stored);\n\tconst derivedSet = new Set(derived);\n\tconst missing = [...derivedSet].filter((id) => !storedSet.has(id));\n\tconst extra = [...storedSet].filter((id) => !derivedSet.has(id));\n\treturn new MigrationToolsError(\"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\", \"providedInvariants on migration.json disagrees with ops.json\", {\n\t\twhy: missing.length === 0 && extra.length === 0 ? `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the canonical value derived from ops.json is ${JSON.stringify(derived)} — same ids, different order. Canonical providedInvariants is sorted ascending.` : `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the value derived from ops.json is ${JSON.stringify(derived)}. The manifest copy was likely hand-edited without re-emitting.`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tstored,\n\t\t\tderived,\n\t\t\tdifference: {\n\t\t\t\tmissing,\n\t\t\t\textra\n\t\t\t}\n\t\t}\n\t});\n}\nfunction errorNoInvariantPath(args) {\n\tconst { refName, required, missing, structuralPath, extensionSpace } = args;\n\tconst refClause = refName ? `Ref \"${refName}\"` : \"Target\";\n\tconst missingList = missing.map((id) => JSON.stringify(id)).join(\", \");\n\tconst requiredList = required.map((id) => JSON.stringify(id)).join(\", \");\n\treturn new MigrationToolsError(\"MIGRATION.NO_INVARIANT_PATH\", extensionSpace === void 0 ? \"No path covers the required invariants\" : `No path covers the required invariants of extension space \"${extensionSpace.spaceId}\"`, {\n\t\twhy: extensionSpace?.why ?? `${refClause} requires invariants the reachable path doesn't cover. required=[${requiredList}], missing=[${missingList}].`,\n\t\tfix: extensionSpace?.fix ?? \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\t...ifDefined(\"nextActions\", extensionSpace?.nextActions),\n\t\tmeta: {\n\t\t\t...ifDefined(\"spaceId\", extensionSpace?.spaceId),\n\t\t\trequired,\n\t\t\tmissing,\n\t\t\tstructuralPath,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorUnknownInvariant(args) {\n\tconst { refName, unknown, declared } = args;\n\treturn new MigrationToolsError(\"MIGRATION.UNKNOWN_INVARIANT\", \"Ref declares invariants no migration in the graph provides\", {\n\t\twhy: `${refName ? `Ref \"${refName}\" declares` : \"Declares\"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(\", \")}].`,\n\t\tfix: \"Either the ref has a typo, or the declaring migration has not been authored/attested yet. Re-check the ref file and the migrations directory.\",\n\t\tmeta: {\n\t\t\tunknown,\n\t\t\tdeclared,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorMigrationHashMismatch(dir, storedHash, computedHash) {\n\treturn new MigrationToolsError(\"MIGRATION.HASH_MISMATCH\", \"Migration package is corrupt\", {\n\t\twhy: `Stored migrationHash \"${storedHash}\" does not match the recomputed hash \"${computedHash}\" for \"${relative(process.cwd(), dir)}\". The migration.json or ops.json has been edited or partially written since emit.`,\n\t\tfix: reemitHint(dir, \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tdir,\n\t\t\tstoredHash,\n\t\t\tcomputedHash\n\t\t}\n\t});\n}\n/**\n* A ref name that resolves to nothing: no pointer file named `refName`\n* exists, and the hash being resolved (the `contractAt` argument, used as a\n* fallback when the pointer is absent) is not a node in the migration graph\n* either. There is no contract to materialize.\n*/\nfunction errorRefNotResolvable(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.REF_NOT_RESOLVABLE\", `Ref \"${refName}\" is not resolvable`, {\n\t\twhy: `Ref \"${refName}\" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,\n\t\tfix: `Create the ref with \"{bin} migration ref set ${refName} <hash>\" (or advance it via \"{bin} db update --advance-ref ${refName}\"), or pass a hash that is a node in the migration graph.`,\n\t\tnextActions: [\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: `Create the ref \"${refName}\"`,\n\t\t\t\tcommand: `{bin} migration ref set ${refName} <hash>`\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: `Advance the ref \"${refName}\" as part of an update`,\n\t\t\t\tcommand: `{bin} db update --advance-ref ${refName}`\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"Pass a hash that is already a node in the migration graph\"\n\t\t\t}\n\t\t],\n\t\tmeta: {\n\t\t\trefName,\n\t\t\tidentifier: refName\n\t\t}\n\t});\n}\nfunction errorBundleNotFoundForGraphNode(hash, explicitLabel) {\n\treturn new MigrationToolsError(\"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\", explicitLabel ? `No migration bundle found for reference \"${explicitLabel}\" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {\n\t\twhy: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\\`to\\`) hash matching it.`,\n\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `{bin} migration list` to see available migrations.\",\n\t\tmeta: {\n\t\t\thash,\n\t\t\t...explicitLabel ? { explicitLabel } : {}\n\t\t}\n\t});\n}\n/**\n* A contract at `filePath` that failed to load. When the family refused it for its contents, such as defaults its column types do not hold, the refusal's meta (`refusedDefaults`) is kept beside the file path.\n*/\nfunction errorContractDeserializationFailed(filePath, message, options) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract failed to deserialize\", {\n\t\twhy: `Contract at \"${filePath}\" failed to deserialize: ${message}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\t...refusalMetaOf(options?.cause),\n\t\t\tfilePath,\n\t\t\tmessage\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\nfunction refusalMetaOf(cause) {\n\treturn isStructuredError(cause) && cause.code === \"CONTRACT.VALIDATION_FAILED\" ? cause.meta : void 0;\n}\nfunction errorHashNotInGraph(hash, graph) {\n\tconst reachableHashes = [...graph.nodes].sort();\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none)\";\n\treturn new MigrationToolsError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Hash \"${hash}\" is not a node in the migration graph`, {\n\t\twhy: `The migration graph contains nodes ${reachableList}; \"${hash}\" isn't one of them.`,\n\t\tfix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run \"{bin} migration plan\" to introduce it.`,\n\t\tnextActions: [{\n\t\t\tkind: \"user-choice\",\n\t\t\tlabel: \"Pass a hash that is the from-or-to of an on-disk migration bundle, or use --from with a graph-node hash\",\n\t\t\treason: `Graph nodes: ${reachableList}.`\n\t\t}, {\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: `Introduce \"${hash}\" by planning a migration for it`,\n\t\t\tcommand: \"{bin} migration plan\"\n\t\t}],\n\t\tmeta: {\n\t\t\thash,\n\t\t\treachableHashes\n\t\t}\n\t});\n}\nfunction errorContractSnapshotMissing(storageHash, expectedPath) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_MISSING\", \"Contract snapshot is missing\", {\n\t\twhy: `Expected a contract snapshot for ${storageHash} at \"${expectedPath}\" but the file does not exist.`,\n\t\tfix: \"Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`{bin} migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.\",\n\t\tnextActions: [\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: \"Re-emit the snapshot for an app-space migration\",\n\t\t\t\tcommand: \"{bin} migration plan\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"For an extension space, re-run that extension's contract-space build instead\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"Restore migrations/snapshots/ from version control\"\n\t\t\t}\n\t\t],\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\texpectedPath\n\t\t}\n\t});\n}\nfunction errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH\", \"Contract snapshot hash mismatch\", {\n\t\twhy: `The contract JSON's inner storage.storageHash (\"${actualHash}\") does not match the requested storage hash (\"${storageHash}\") for snapshot directory \"${dir}\".`,\n\t\tfix: \"Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\tactualHash,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorContractSnapshotContentMismatch(args) {\n\tconst { storageHash, computedHash, jsonPath } = args;\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH\", \"Contract snapshot content does not match its hash\", {\n\t\twhy: `The contract snapshot at \"${jsonPath}\" is addressed by storage hash ${storageHash}, but its content recomputes to ${computedHash}. The file has been edited (or corrupted) since it was written.`,\n\t\tfix: \"Restore migrations/snapshots/ from version control, or re-run the command that authored the migration referencing this hash to regenerate the snapshot.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\tcomputedHash,\n\t\t\tjsonPath\n\t\t}\n\t});\n}\nfunction errorMigrationContractViewMissing(className, accessor, jsonField) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_VIEW_MISSING\", `${className}.${accessor} requires ${jsonField}`, {\n\t\twhy: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,\n\t\tfix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,\n\t\tmeta: {\n\t\t\tclassName,\n\t\t\taccessor,\n\t\t\tjsonField\n\t\t}\n\t});\n}\n//#endregion\nexport { errorRefNotResolvable as A, errorInvalidSpaceId as C, errorNoInvariantPath as D, errorMissingFile as E, errorUnknownInvariant as M, errorOperationsNotArray as O, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractSnapshotContentMismatch as i, errorSpaceHeadRefMissing as j, errorProvidedInvariantsMismatch as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorBundleNotFoundForGraphNode as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorContractDeserializationFailed as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };\n\n//# sourceMappingURL=errors-DXha_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WAAW,iDAAiD,YAAY,6BAA6B,IAAI;EACjK,KAAK;EACL,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,qCAAqC,MAAM;CACnD,MAAM,EAAE,aAAa,cAAc,aAAa;CAChD,OAAO,IAAI,oBAAoB,gDAAgD,qDAAqD;EACnI,KAAK,6BAA6B,SAAS,iCAAiC,YAAY,kCAAkC,aAAa;EACvI,KAAK;EACL,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,kCAAkC,WAAW,UAAU,WAAW;CAC1E,OAAO,IAAI,oBAAoB,mCAAmC,GAAG,UAAU,GAAG,SAAS,YAAY,aAAa;EACnH,KAAK,GAAG,UAAU,GAAG,SAAS,sCAAsC,UAAU;EAC9E,KAAK,OAAO,UAAU,gEAAgE,SAAS;EAC/F,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF"}
@@ -1,14 +1,13 @@
1
- import { D as serializeObjectKey, O as serializeValue, T as serializeExecutionType, _ as parameterizedOutputTypeFunctionsAlias, a as generateCodecTypeIntersection, c as generateHashTypeAliases, g as generateValueObjectsDescriptorType, h as generateValueObjectTypeAliases, i as fieldTypesMapExpression, l as generateImportLines, m as generateRootsType, n as deduplicateImports, p as generateModelsType, r as emitterError, s as generateFieldTypeOverridesMap } from "./domain-type-generation-DpXuDGLd-CuADX8tA.mjs";
1
+ import { E as serializeExecutionType, O as serializeObjectKey, _ as parameterizedOutputTypeFunctionsAlias, a as generateCodecTypeIntersection, c as generateHashTypeAliases, g as generateValueObjectsDescriptorType, h as generateValueObjectTypeAliases, i as fieldTypesMapExpression, k as serializeValue, l as generateImportLines, m as generateRootsType, n as deduplicateImports, p as generateModelsType, r as emitterError, s as generateFieldTypeOverridesMap, x as renderValueLiteralType } from "./domain-type-generation-B4m774CV-WAjyhZHw.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
5
  import { canonicalizeContractToObject } from "@prisma/orm-framework/contract/hashing";
6
6
  import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
7
7
  import { format } from "prettier";
8
- import { readContractValue } from "@prisma/orm-framework/components/codec";
9
8
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
10
9
  import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl-ast";
11
- //#region ../../../1-framework/3-tooling/emitter/dist/exports-BLyT8ULG.mjs
10
+ //#region ../../../1-framework/3-tooling/emitter/dist/exports-BCIlMjIW.mjs
12
11
  const JSON_EXTENSION = ".json";
13
12
  function getEmittedArtifactPaths(outputJsonPath) {
14
13
  if (!outputJsonPath.endsWith(JSON_EXTENSION)) throw emitterError("CONFIG.VALIDATION_FAILED", "Contract output path must end with .json", { meta: {
@@ -233,27 +232,17 @@ function generateEnumBlockType(enums) {
233
232
  }).join("; ")} }`;
234
233
  }
235
234
  /**
236
- * Types each enum member as the value a query returns for it: the literal its codec reads from the stored form, or the codec's output type when that value has no literal type or the lookup has no codec.
235
+ * Types each enum member as the value a query returns for it: the literal its codec renders for the stored form, or the codec's output type when the codec renders none.
237
236
  */
238
237
  function generateEnumMemberTypesBlock(enums, codecLookup) {
239
238
  return `{ ${Object.entries(enums).map(([name, entry]) => {
240
- const codec = codecLookup?.get(entry.codecId);
241
239
  const memberTupleItems = entry.members.map((m) => {
242
- const valueType = (codec === void 0 ? void 0 : literalType(readContractValue(codec, m.value, void 0))) ?? `CodecTypes[${serializeValue(entry.codecId)}]["output"]`;
240
+ const valueType = renderValueLiteralType(m.value, entry.codecId, "output", codecLookup) ?? `CodecTypes[${serializeValue(entry.codecId)}]["output"]`;
243
241
  return `{ readonly name: ${serializeValue(m.name)}; readonly value: ${valueType} }`;
244
242
  });
245
243
  return `readonly ${serializeObjectKey(name)}: readonly [${memberTupleItems.join(", ")}]`;
246
244
  }).join("; ")} }`;
247
245
  }
248
- function literalType(value) {
249
- switch (typeof value) {
250
- case "string":
251
- case "boolean":
252
- case "bigint": return serializeValue(value);
253
- case "number": return Number.isFinite(value) ? serializeValue(value) : void 0;
254
- default: return;
255
- }
256
- }
257
246
  function generateContractDts(contract, emitter, codecTypeImports, hashes, options, codecLookup, resolveImportSpecifier = keepInternalSpecifiers) {
258
247
  const allImports = [...codecTypeImports];
259
248
  if (options?.queryOperationTypeImports) allImports.push(...options.queryOperationTypeImports);
@@ -429,4 +418,4 @@ async function emit(contract, stack, targetFamily, options) {
429
418
  //#endregion
430
419
  export { generateContractDts as n, getEmittedArtifactPaths as r, emit as t };
431
420
 
432
- //# sourceMappingURL=exports-BLyT8ULG-C_kH8_9c.mjs.map
421
+ //# sourceMappingURL=exports-BCIlMjIW-DkUBVDzl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports-BCIlMjIW-DkUBVDzl.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/exports-BCIlMjIW.mjs"],"sourcesContent":["import { D as serializeObjectKey, O as serializeValue, T as serializeExecutionType, b as renderValueLiteralType, c as generateImportLines, f as generateModelsType, g as parameterizedOutputTypeFunctionsAlias, h as generateValueObjectsDescriptorType, i as generateCodecTypeIntersection, k as emitterError, m as generateValueObjectTypeAliases, n as deduplicateImports, o as generateFieldTypeOverridesMap, p as generateRootsType, r as fieldTypesMapExpression, s as generateHashTypeAliases } from \"./domain-type-generation-B4m774CV.mjs\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { canonicalizeContractToObject } from \"@internal/contract/hashing\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { format } from \"prettier\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { UNBOUND_PSL_NAMESPACE_NAME } from \"@internal/framework-components/psl-ast\";\n//#region src/artifact-paths.ts\nconst JSON_EXTENSION = \".json\";\nfunction getEmittedArtifactPaths(outputJsonPath) {\n\tif (!outputJsonPath.endsWith(JSON_EXTENSION)) throw emitterError(\"CONFIG.VALIDATION_FAILED\", \"Contract output path must end with .json\", { meta: {\n\t\tfield: \"contract.output\",\n\t\toutputJsonPath\n\t} });\n\treturn {\n\t\tjsonPath: outputJsonPath,\n\t\tdtsPath: `${outputJsonPath.slice(0, -5)}.d.ts`\n\t};\n}\n//#endregion\n//#region src/model-types-emission.ts\nconst TYPESCRIPT_IDENTIFIER = /^[$A-Z_a-z][$\\w]*$/;\nfunction namespacedMemberName(namespaceId, modelName) {\n\treturn `${namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_PSL_NAMESPACE_NAME : namespaceId}_${modelName}`;\n}\nfunction bareMemberName(_namespaceId, modelName) {\n\treturn modelName;\n}\nfunction claimMemberName(claims, memberName, source) {\n\tif (!TYPESCRIPT_IDENTIFIER.test(memberName)) throw emitterError(\"CONTRACT.MODEL_TYPE_NAME_INVALID\", `Emitted model type name \"${memberName}\" (from ${source}) is not a TypeScript identifier`, {\n\t\twhy: \"Every entry in the emitted Models namespace is declared as `export type <name>`, so the name must be a TypeScript identifier.\",\n\t\tfix: \"Rename the namespace or model so that <namespace>_<Model> contains only letters, digits, `$`, and `_`, and does not start with a digit.\",\n\t\tmeta: {\n\t\t\tmemberName,\n\t\t\tsource\n\t\t}\n\t});\n\tconst existing = claims.get(memberName);\n\tif (existing !== void 0) throw emitterError(\"CONTRACT.MODEL_TYPE_NAME_COLLISION\", `Emitted model type name \"${memberName}\" is produced by both ${existing} and ${source}`, {\n\t\twhy: \"Every entry in the emitted Models namespace needs a distinct name, formed as <namespace>_<Model>.\",\n\t\tfix: \"Rename one of the models or namespaces so the two names differ.\",\n\t\tmeta: {\n\t\t\tmemberName,\n\t\t\tsources: [existing, source]\n\t\t}\n\t});\n\tclaims.set(memberName, source);\n}\nfunction isPolymorphicBase(model) {\n\treturn model.discriminator !== void 0 && model.variants !== void 0;\n}\nfunction findModel(namespaces, ref) {\n\treturn namespaces.find((ns) => ns.namespaceId === ref.namespace)?.models.find((m) => m.modelName === ref.model);\n}\nfunction requireRelationTarget(namespaces, owner, relationName, ref) {\n\tconst target = findModel(namespaces, ref);\n\tif (target !== void 0) return target;\n\tconst ownerSource = `${owner.namespaceId}.${owner.modelName}`;\n\tthrow emitterError(\"CONTRACT.MODEL_RELATION_TARGET_MISSING\", `Relation \"${relationName}\" on ${ownerSource} targets ${ref.namespace}.${ref.model}, which is not in the contract`, {\n\t\twhy: \"A same-space relation must point at a model the contract declares; only cross-space relations may reference models outside it.\",\n\t\tfix: \"Declare the target model in the contract, or mark the relation as cross-space by giving its target a `space`.\",\n\t\tmeta: {\n\t\t\towner: ownerSource,\n\t\t\trelationName,\n\t\t\ttarget: {\n\t\t\t\tnamespaceId: ref.namespace,\n\t\t\t\tmodelName: ref.model\n\t\t\t}\n\t\t}\n\t});\n}\nfunction requireBase(namespaces, variant, base) {\n\tconst found = findModel(namespaces, base);\n\tif (found !== void 0) return found;\n\tconst variantSource = `${variant.namespaceId}.${variant.modelName}`;\n\tconst baseSource = `${base.namespace}.${base.model}`;\n\tthrow emitterError(\"CONTRACT.MODEL_BASE_MISSING\", `Model ${variantSource} names base ${baseSource}, which is not in the contract`, {\n\t\twhy: \"A variant's type is its base's fields plus its own, so the base must be a model the contract declares.\",\n\t\tfix: \"Declare the base model in the contract, or remove `base` from the variant.\",\n\t\tmeta: {\n\t\t\tvariant: variantSource,\n\t\t\tbase: baseSource\n\t\t}\n\t});\n}\nfunction requireVariant(namespaces, base, variantRef) {\n\tconst variant = findModel(namespaces, variantRef);\n\tif (variant !== void 0) return variant;\n\tconst baseSource = `${base.namespaceId}.${base.modelName}`;\n\tconst variantSource = `${variantRef.namespace}.${variantRef.model}`;\n\tthrow emitterError(\"CONTRACT.MODEL_VARIANT_MISSING\", `Polymorphic base ${baseSource} names variant ${variantSource}, which is not in the contract`, {\n\t\twhy: \"The Any<Base> union is the union of the variant model types, so every variant a base declares must be a model in the contract.\",\n\t\tfix: \"Declare the variant model, or remove it from the base's variants.\",\n\t\tmeta: {\n\t\t\tbase: baseSource,\n\t\t\tvariant: variantSource\n\t\t}\n\t});\n}\nfunction collectFieldLines(ref, discriminatorType) {\n\tconst lines = /* @__PURE__ */ new Map();\n\tfor (const fieldName of Object.keys(ref.model.fields)) {\n\t\tconst type = discriminatorType !== void 0 && fieldName === discriminatorType.field ? discriminatorType.type : `FieldOutputTypes[${serializeValue(ref.namespaceId)}][${serializeValue(ref.modelName)}][${serializeValue(fieldName)}]`;\n\t\tlines.set(fieldName, `${serializeObjectKey(fieldName)}: ${type};`);\n\t}\n\treturn lines;\n}\nfunction hasJoin(relation) {\n\treturn \"on\" in relation && relation.on !== void 0;\n}\nfunction relationLine(owner, relationName, relation, index) {\n\tif (relation.to.space !== void 0) return void 0;\n\tconst target = requireRelationTarget(index.namespaces, owner, relationName, relation.to);\n\tconst targetMember = index.memberNameOf(target.namespaceId, isPolymorphicBase(target.model) ? `Any${target.modelName}` : target.modelName);\n\tconst key = serializeObjectKey(relationName);\n\tif (!hasJoin(relation)) return {\n\t\tline: `${key}: ${relation.cardinality === \"1:N\" ? `${targetMember}[]` : targetMember};`,\n\t\thasJoin: false\n\t};\n\tif (relation.cardinality === \"1:N\" || relation.cardinality === \"N:M\") return {\n\t\tline: `${key}: ${targetMember}[];`,\n\t\thasJoin: true\n\t};\n\treturn {\n\t\tline: `${key}: ${relation.nullable ? `${targetMember} | null` : targetMember};`,\n\t\thasJoin: true\n\t};\n}\nfunction collectRelationLines(ref, index) {\n\tconst lines = /* @__PURE__ */ new Map();\n\tfor (const [relationName, relation] of Object.entries(ref.model.relations)) {\n\t\tconst rendered = relationLine(ref, relationName, relation, index);\n\t\tif (rendered !== void 0) lines.set(relationName, rendered);\n\t}\n\treturn lines;\n}\nfunction discriminatorUnion(base) {\n\tconst values = Object.keys(base.variants ?? {}).map((value) => serializeValue(value));\n\treturn values.length > 0 ? values.join(\" | \") : \"never\";\n}\nfunction memberLines(ref, index) {\n\tconst base = ref.model.base !== void 0 ? requireBase(index.namespaces, ref, ref.model.base) : void 0;\n\tif (base !== void 0 && isPolymorphicBase(base.model)) {\n\t\tconst discriminatorField = base.model.discriminator?.field ?? \"\";\n\t\tconst variantValue = Object.entries(base.model.variants ?? {}).find(([, variant]) => variant.namespace === ref.namespaceId && variant.model === ref.modelName)?.[0];\n\t\tconst discriminatorType = {\n\t\t\tfield: discriminatorField,\n\t\t\ttype: variantValue !== void 0 ? serializeValue(variantValue) : discriminatorUnion(base.model)\n\t\t};\n\t\treturn {\n\t\t\tfieldsByName: new Map([...collectFieldLines(base, discriminatorType), ...collectFieldLines(ref, void 0)]),\n\t\t\trelationsByName: new Map([...collectRelationLines(base, index), ...collectRelationLines(ref, index)])\n\t\t};\n\t}\n\treturn {\n\t\tfieldsByName: collectFieldLines(ref, isPolymorphicBase(ref.model) ? {\n\t\t\tfield: ref.model.discriminator?.field ?? \"\",\n\t\t\ttype: discriminatorUnion(ref.model)\n\t\t} : void 0),\n\t\trelationsByName: collectRelationLines(ref, index)\n\t};\n}\nfunction renderMember(memberName, lines, hasOwner) {\n\tconst entries = [...lines.relationsByName];\n\tconst joinlessLines = entries.filter(([, r]) => !r.hasJoin).map(([, r]) => r.line);\n\tconst joinedLines = entries.filter(([, r]) => r.hasJoin).map(([, r]) => r.line);\n\tconst relationNames = entries.filter(([, r]) => r.hasJoin).map(([name]) => name);\n\tconst phantom = relationNames.length > 0 ? relationNames.map((name) => serializeValue(name)).join(\" | \") : \"never\";\n\treturn ` export type ${memberName} = {\\n${[\n\t\t...lines.fieldsByName.values(),\n\t\t...joinlessLines,\n\t\t...joinedLines,\n\t\t...hasOwner ? [] : [`readonly [RelationKeys]?: ${phantom};`]\n\t].map((line) => ` ${line}`).join(\"\\n\")}\\n };`;\n}\nfunction namespaceModelsOf(contract) {\n\treturn Object.entries(contract.domain.namespaces).map(([namespaceId, ns]) => ({\n\t\tnamespaceId,\n\t\tmodels: Object.entries(ns.models).map(([modelName, model]) => ({\n\t\t\tnamespaceId,\n\t\t\tmodelName,\n\t\t\tmodel\n\t\t}))\n\t}));\n}\nfunction generateModelTypesBlock(contract, supportsNamespaces) {\n\tconst memberNameOf = supportsNamespaces ? namespacedMemberName : bareMemberName;\n\tconst namespaces = namespaceModelsOf(contract);\n\tconst index = {\n\t\tnamespaces,\n\t\tmemberNameOf\n\t};\n\tconst claims = /* @__PURE__ */ new Map();\n\tfor (const ns of namespaces) for (const ref of ns.models) claimMemberName(claims, memberNameOf(ns.namespaceId, ref.modelName), `${ns.namespaceId}.${ref.modelName}`);\n\tfor (const ns of namespaces) for (const ref of ns.models) {\n\t\tif (!isPolymorphicBase(ref.model)) continue;\n\t\tclaimMemberName(claims, memberNameOf(ns.namespaceId, `Any${ref.modelName}`), `${ns.namespaceId}.Any<${ref.modelName}>`);\n\t}\n\tconst members = [];\n\tconst constantEntries = [];\n\tfor (const ns of namespaces) {\n\t\tconst keys = [];\n\t\tfor (const ref of ns.models) {\n\t\t\tconst memberName = memberNameOf(ns.namespaceId, ref.modelName);\n\t\t\tmembers.push(renderMember(memberName, memberLines(ref, index), ref.model.owner !== void 0));\n\t\t\tkeys.push(`${serializeObjectKey(ref.modelName)}: Models.${memberName};`);\n\t\t}\n\t\tfor (const ref of ns.models) {\n\t\t\tif (!isPolymorphicBase(ref.model)) continue;\n\t\t\tconst unionName = memberNameOf(ns.namespaceId, `Any${ref.modelName}`);\n\t\t\tconst variantMembers = Object.values(ref.model.variants ?? {}).map((variantRef) => {\n\t\t\t\tconst variant = requireVariant(namespaces, ref, variantRef);\n\t\t\t\treturn memberNameOf(variant.namespaceId, variant.modelName);\n\t\t\t});\n\t\t\tmembers.push(` export type ${unionName} = ${variantMembers.length > 0 ? variantMembers.join(\" | \") : \"never\"};`);\n\t\t\tkeys.push(`${serializeObjectKey(`Any${ref.modelName}`)}: Models.${unionName};`);\n\t\t}\n\t\tif (!supportsNamespaces) {\n\t\t\tconstantEntries.push(...keys.map((key) => ` ${key}`));\n\t\t\tcontinue;\n\t\t}\n\t\tconst nsKey = serializeObjectKey(ns.namespaceId);\n\t\tconst nested = keys.map((key) => ` ${key}`).join(\"\\n\");\n\t\tconstantEntries.push(keys.length > 0 ? ` ${nsKey}: {\\n${nested}\\n };` : ` ${nsKey}: {};`);\n\t}\n\treturn `${members.length > 0 ? `export namespace Models {\\n${members.join(\"\\n\")}\\n}` : \"export namespace Models {}\"}\\n\\n${`export declare const models: {\\n${constantEntries.join(\"\\n\")}\\n};`}`;\n}\n//#endregion\n//#region src/generate-contract-dts.ts\nfunction generateEnumBlockType(enums) {\n\treturn `{ ${Object.entries(enums).map(([name, entry]) => {\n\t\tconst membersType = `readonly [${entry.members.map((m) => `{ readonly name: ${serializeValue(m.name)}; readonly value: ${serializeValue(m.value)} }`).join(\", \")}]`;\n\t\treturn `readonly ${serializeObjectKey(name)}: { readonly codecId: ${serializeValue(entry.codecId)}; readonly members: ${membersType} }`;\n\t}).join(\"; \")} }`;\n}\n/**\n* Types each enum member as the value a query returns for it: the literal its codec renders for the stored form, or the codec's output type when the codec renders none.\n*/\nfunction generateEnumMemberTypesBlock(enums, codecLookup) {\n\treturn `{ ${Object.entries(enums).map(([name, entry]) => {\n\t\tconst memberTupleItems = entry.members.map((m) => {\n\t\t\tconst valueType = renderValueLiteralType(m.value, entry.codecId, \"output\", codecLookup) ?? `CodecTypes[${serializeValue(entry.codecId)}][\"output\"]`;\n\t\t\treturn `{ readonly name: ${serializeValue(m.name)}; readonly value: ${valueType} }`;\n\t\t});\n\t\treturn `readonly ${serializeObjectKey(name)}: readonly [${memberTupleItems.join(\", \")}]`;\n\t}).join(\"; \")} }`;\n}\nfunction generateContractDts(contract, emitter, codecTypeImports, hashes, options, codecLookup, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst allImports = [...codecTypeImports];\n\tif (options?.queryOperationTypeImports) allImports.push(...options.queryOperationTypeImports);\n\tif (options?.parameterizedOutputTypeImports) allImports.push(...options.parameterizedOutputTypeImports);\n\tconst uniqueImports = deduplicateImports(allImports);\n\tconst familyImportLines = emitter.getFamilyImports(resolveImportSpecifier);\n\tconst hashAliases = generateHashTypeAliases(hashes);\n\tconst codecTypes = generateCodecTypeIntersection(codecTypeImports, \"CodecTypes\");\n\tconst familyTypeAliases = emitter.getFamilyTypeAliases(options);\n\tconst typeMapsExpr = emitter.getTypeMapsExpression();\n\tconst storageType = emitter.generateStorageType(contract, \"StorageHash\");\n\tconst namespaceEntries = Object.entries(contract.domain.namespaces);\n\tif (namespaceEntries.length === 0) throw emitterError(\"CONTRACT.NAMESPACE_INVALID\", \"domain has no namespaces\", { meta: { reason: \"no-domain-namespaces\" } });\n\tfor (const [nsId, ns] of namespaceEntries) if (ns === void 0) throw new InternalError(`domain namespace \"${nsId}\" is not present on the contract`);\n\tconst rootsType = generateRootsType(contract.roots);\n\tconst flatValueObjects = {};\n\tconst valueObjectNamespaces = [];\n\tfor (const [nsId, ns] of namespaceEntries) for (const [voName, vo] of Object.entries(blindCast(ns.valueObjects ?? {}))) if (!(voName in flatValueObjects)) {\n\t\tflatValueObjects[voName] = vo;\n\t\tvalueObjectNamespaces.push([voName, nsId]);\n\t}\n\tconst valueObjects = Object.keys(flatValueObjects).length > 0 ? flatValueObjects : void 0;\n\tconst valueObjectTypeAliases = generateValueObjectTypeAliases(valueObjectNamespaces);\n\tconst valueObjectsDescriptor = generateValueObjectsDescriptorType(valueObjects);\n\tconst domainNamespacesType = namespaceEntries.map(([nsId, ns]) => {\n\t\tconst nsModels = ns.models;\n\t\tconst nsModelsType = generateModelsType(nsModels, (name, model) => emitter.generateModelStorageType(name, model));\n\t\tconst nsValueObjects = blindCast(ns.valueObjects);\n\t\tconst nsValueObjectsDescriptor = nsValueObjects !== void 0 && Object.keys(nsValueObjects).length > 0 ? generateValueObjectsDescriptorType(nsValueObjects) : void 0;\n\t\tconst nsEnums = blindCast(ns.enum);\n\t\tconst hasEnums = nsEnums !== void 0 && Object.keys(nsEnums).length > 0;\n\t\treturn [\n\t\t\tnsId,\n\t\t\tnsModelsType,\n\t\t\tnsValueObjectsDescriptor,\n\t\t\thasEnums ? generateEnumBlockType(nsEnums) : void 0,\n\t\t\thasEnums ? generateEnumMemberTypesBlock(nsEnums, codecLookup) : void 0\n\t\t];\n\t}).map(([nsId, nsModelsType, nsValueObjectsDescriptor, nsEnumBlock, nsEnumMemberTypesBlock]) => {\n\t\tconst voLine = nsValueObjectsDescriptor !== void 0 ? `\\n readonly valueObjects: ${nsValueObjectsDescriptor};` : \"\";\n\t\tconst enumLine = nsEnumBlock !== void 0 ? `\\n readonly enum: ${nsEnumBlock};` : \"\";\n\t\tconst enumMemberTypesLine = nsEnumMemberTypesBlock !== void 0 ? `\\n readonly enumMemberTypes?: ${nsEnumMemberTypesBlock};` : \"\";\n\t\treturn ` readonly ${serializeObjectKey(nsId)}: {\\n readonly models: ${nsModelsType};${voLine}${enumLine}${enumMemberTypesLine}\\n }`;\n\t}).join(\";\\n\");\n\tconst executionClause = contract.execution !== void 0 ? `\\n readonly execution: ${serializeExecutionType(contract.execution)};` : \"\";\n\tconst fieldTypeOverrides = generateFieldTypeOverridesMap(contract, codecLookup, emitter.resolveStorageValueSet ? (modelName, fieldName, model) => emitter.resolveStorageValueSet?.(modelName, fieldName, model, contract) : void 0);\n\tconst extraTypeExports = emitter.getStorageTypeExports?.(contract, codecLookup);\n\tconst contractWrapper = emitter.getContractWrapper(\"ContractBase\", \"TypeMaps\");\n\tconst modelTypesBlock = generateModelTypesBlock(contract, options?.supportsNamespaces ?? true);\n\tconst body = `${hashAliases}\n\nexport type CodecTypes = ${codecTypes};\n${familyTypeAliases}\n${parameterizedOutputTypeFunctionsAlias(options?.parameterizedOutputTypeImports ?? [])}\n${valueObjectTypeAliases}\ntype FieldTypeOverrides = ${fieldTypeOverrides};\nexport type FieldOutputTypes = ${fieldTypesMapExpression(\"output\")};\nexport type FieldInputTypes = ${fieldTypesMapExpression(\"input\")};\n${extraTypeExports ? `${extraTypeExports}\\n` : \"\"}\n${modelTypesBlock}\n\nexport type TypeMaps = ${typeMapsExpr};\n\ntype ContractBase = Omit<\n ContractType<${storageType}>,\n 'roots' | 'domain'\n> & {\n readonly target: ${serializeValue(contract.target)};\n readonly targetFamily: ${serializeValue(contract.targetFamily)};\n readonly roots: ${rootsType};\n readonly domain: {\n readonly namespaces: {\n${domainNamespacesType};\n };\n };\n readonly capabilities: ${serializeValue(contract.capabilities)};\n readonly extensions: ${serializeValue(contract.extensions)};${executionClause}\n readonly meta: ${serializeValue(contract.meta)};\n ${valueObjects ? `readonly valueObjects: ${valueObjectsDescriptor};` : \"\"}\n readonly profileHash: ProfileHash;\n};\n\n${contractWrapper}\n`;\n\treturn `// ⚠️ GENERATED FILE - DO NOT EDIT\n// This file is automatically generated by 'prisma contract emit'.\n// To regenerate, run: prisma contract emit\n${generateImportLines(uniqueImports.filter((spec) => mentions(body, spec.alias)), resolveImportSpecifier).join(\"\\n\")}\n\n${familyImportLines.join(\"\\n\")}\nimport type {\n Contract as ContractType,\n ExecutionHashBase,\n FieldTypesFromDomain,\n NamespaceId,\n ProfileHashBase,\n StorageHashBase,${valueObjects ? \"\\n ValueObjectTypesFromDomain,\" : \"\"}\n} from '${resolveImportSpecifier(\"@internal/contract/types\")}';\n\n${body}`;\n}\n/** Whether `text` uses `identifier` as a whole identifier, not as part of a longer one. */\nfunction mentions(text, identifier) {\n\tconst escaped = identifier.replace(/[$]/g, \"\\\\$\");\n\treturn new RegExp(`(?<![\\\\w$])${escaped}(?![\\\\w$])`).test(text);\n}\n//#endregion\n//#region src/require-relation-nullability.ts\n/**\n* The emitter only ever consumes a freshly authored contract, so every same-space to-one relation\n* must already state whether it is nullable. Hydration of an on-disk contract derives a missing\n* flag instead; that path never reaches here.\n*/\nfunction requireToOneRelationNullability(contract) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) for (const [modelName, model] of Object.entries(namespace.models)) for (const [relationName, relation] of Object.entries(model.relations ?? {})) {\n\t\tif (!(\"on\" in relation && (relation.cardinality === \"1:1\" || relation.cardinality === \"N:1\") && relation.to.space === void 0) || typeof relation.nullable === \"boolean\") continue;\n\t\tthrow emitterError(\"CONTRACT.RELATION_INVALID\", `Relation \"${relationName}\" on model \"${namespaceId}:${modelName}\" is a ${relation.cardinality} relation and must carry a boolean \"nullable\"`, {\n\t\t\twhy: \"contract.d.ts types a to-one relation as nullable or required from this flag, and the authoring surfaces always set it.\",\n\t\t\tfix: \"Author the contract through PSL or the contract builder, which derive the flag from the local fields the relation joins on.\",\n\t\t\tmeta: {\n\t\t\t\tmodelName,\n\t\t\t\trelationName,\n\t\t\t\treason: \"to-one-nullability-missing\"\n\t\t\t}\n\t\t});\n\t}\n}\n//#endregion\n//#region src/emit.ts\nconst SCHEMA_VERSION = \"1\";\nasync function emit(contract, stack, targetFamily, options) {\n\tif (options.outputJsonPath !== void 0) getEmittedArtifactPaths(options.outputJsonPath);\n\trequireToOneRelationNullability(contract);\n\tconst { codecTypeImports, queryOperationTypeImports, parameterizedOutputTypeImports, aggregateDescriptors, codecDescriptors } = stack;\n\tconst { storageHash } = contract.storage;\n\tconst executionHash = contract.execution?.executionHash;\n\tconst { profileHash } = contract;\n\tconst canonicalized = canonicalizeContractToObject(contract, {\n\t\tschemaVersion: SCHEMA_VERSION,\n\t\tserializeContract: options.serializeContract,\n\t\t...ifDefined(\"shouldPreserveEmpty\", options.shouldPreserveEmpty),\n\t\t...ifDefined(\"sortStorage\", options.sortStorage)\n\t});\n\tconst contractJsonString = JSON.stringify({\n\t\t...canonicalized,\n\t\t_generated: {\n\t\t\twarning: \"⚠️ GENERATED FILE - DO NOT EDIT\",\n\t\t\tmessage: \"This file is automatically generated by \\\"prisma contract emit\\\".\",\n\t\t\tregenerate: \"To regenerate, run: prisma contract emit\"\n\t\t}\n\t}, null, 2);\n\tconst generateOptions = {\n\t\t...ifDefined(\"queryOperationTypeImports\", queryOperationTypeImports),\n\t\t...ifDefined(\"parameterizedOutputTypeImports\", parameterizedOutputTypeImports),\n\t\t...ifDefined(\"aggregateDescriptors\", aggregateDescriptors),\n\t\t...ifDefined(\"codecDescriptors\", codecDescriptors),\n\t\t...ifDefined(\"supportsNamespaces\", options.supportsNamespaces)\n\t};\n\tconst contractTypeHashes = {\n\t\tstorageHash,\n\t\t...ifDefined(\"executionHash\", executionHash),\n\t\tprofileHash\n\t};\n\treturn {\n\t\tcontractJson: contractJsonString,\n\t\tcontractDts: await format(generateContractDts(options.deserializeContract(canonicalized), targetFamily, codecTypeImports ?? [], contractTypeHashes, generateOptions, stack.codecLookup, options.resolveImportSpecifier ?? keepInternalSpecifiers), {\n\t\t\tparser: \"typescript\",\n\t\t\tsingleQuote: true,\n\t\t\tsemi: true,\n\t\t\tprintWidth: 100\n\t\t}),\n\t\tstorageHash,\n\t\t...ifDefined(\"executionHash\", executionHash),\n\t\tprofileHash\n\t};\n}\n//#endregion\nexport { generateContractDts as n, getEmittedArtifactPaths as r, emit as t };\n\n//# sourceMappingURL=exports-BCIlMjIW.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,iBAAiB;AACvB,SAAS,wBAAwB,gBAAgB;CAChD,IAAI,CAAC,eAAe,SAAS,cAAc,GAAG,MAAM,aAAa,4BAA4B,4CAA4C,EAAE,MAAM;EAChJ,OAAO;EACP;CACD,EAAE,CAAC;CACH,OAAO;EACN,UAAU;EACV,SAAS,GAAG,eAAe,MAAM,GAAG,EAAE,EAAE;CACzC;AACD;AAGA,MAAM,wBAAwB;AAC9B,SAAS,qBAAqB,aAAa,WAAW;CACrD,OAAO,GAAG,gBAAgB,uBAAuB,6BAA6B,YAAY,GAAG;AAC9F;AACA,SAAS,eAAe,cAAc,WAAW;CAChD,OAAO;AACR;AACA,SAAS,gBAAgB,QAAQ,YAAY,QAAQ;CACpD,IAAI,CAAC,sBAAsB,KAAK,UAAU,GAAG,MAAM,aAAa,oCAAoC,4BAA4B,WAAW,UAAU,OAAO,mCAAmC;EAC9L,KAAK;EACL,KAAK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AAG,UAAU,kCAAkC,8BAA8B;EAC7E,GAAG,UAAU,wBAAwB,oBAAoB;EACzD,GAAG,UAAU,oBAAoB,gBAAgB;EACjD,GAAG,UAAU,sBAAsB,QAAQ,kBAAkB;CAC9D;CACA,MAAM,qBAAqB;EAC1B;EACA,GAAG,UAAU,iBAAiB,aAAa;EAC3C;CACD;CACA,OAAO;EACN,cAAc;EACd,aAAa,MAAM,OAAO,oBAAoB,QAAQ,oBAAoB,aAAa,GAAG,cAAc,oBAAoB,CAAC,GAAG,oBAAoB,iBAAiB,MAAM,aAAa,QAAQ,0BAA0B,sBAAsB,GAAG;GAClP,QAAQ;GACR,aAAa;GACb,MAAM;GACN,YAAY;EACb,CAAC;EACD;EACA,GAAG,UAAU,iBAAiB,aAAa;EAC3C;CACD;AACD"}
@@ -1,4 +1,4 @@
1
- import { r as getEmittedArtifactPaths } from "./exports-BLyT8ULG-C_kH8_9c.mjs";
1
+ import { r as getEmittedArtifactPaths } from "./exports-BCIlMjIW-DkUBVDzl.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
4
  import { CliStructuredError, errorConfigEvaluationFailed, errorConfigFileNotFound, errorConfigValidation, errorConfigVersionMarkerMissing } from "@prisma/orm-framework/errors/control";
@@ -536,4 +536,4 @@ async function loadConfigForFile(filePath) {
536
536
  //#endregion
537
537
  export { validateOrmSection as _, expandContractInputs as a, globContractInputMatching as c, loadConfigFiles as d, loadConfigForFile as f, requireConfigSections as g, ormConfigSection as h, evaluateConfigModule as i, isConfigSection as l, ormConfigSchema as m, ORM_CONFIG_SECTION_NAME as n, exports_exports as o, loadConfigForSections as p, buildLoadedConfig as r, findNearestConfigPathForFile as s, CONFIG_FILENAME as t, loadConfig as u };
538
538
 
539
- //# sourceMappingURL=exports-DfSHy5Id.mjs.map
539
+ //# sourceMappingURL=exports-BlYTE3-J.mjs.map