@prisma/orm-family-sql 8.0.0-rc.21-dev.6 → 8.0.0-rc.21-dev.7

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 (102) hide show
  1. package/dist/{attribute-specs-CM_fC-TC.d.mts → attribute-specs-DDpSUaG9.d.mts} +3 -3
  2. package/dist/{attribute-specs-CM_fC-TC.d.mts.map → attribute-specs-DDpSUaG9.d.mts.map} +1 -1
  3. package/dist/{authoring-entity-types-CgKIgWq5--Hjkn72Y.d.mts → authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts} +2 -2
  4. package/dist/{authoring-entity-types-CgKIgWq5--Hjkn72Y.d.mts.map → authoring-entity-types-CgKIgWq5-BqRjoPFF.d.mts.map} +1 -1
  5. package/dist/{config-types-BvmmK8D-.mjs → config-types-BCXwEBZH.mjs} +2 -2
  6. package/dist/{config-types-BvmmK8D-.mjs.map → config-types-BCXwEBZH.mjs.map} +1 -1
  7. package/dist/{contract-builder-Bk-Co792.mjs → contract-builder-D50r41BU.mjs} +112 -47
  8. package/dist/contract-builder-D50r41BU.mjs.map +1 -0
  9. package/dist/{contract-builder-B8oDZ4aU.d.mts → contract-builder-D6JuOGA6.d.mts} +43 -4
  10. package/dist/{contract-builder-B8oDZ4aU.d.mts.map → contract-builder-D6JuOGA6.d.mts.map} +1 -1
  11. package/dist/contract-prisma7__provider.d.mts +3 -1
  12. package/dist/contract-prisma7__provider.d.mts.map +1 -1
  13. package/dist/contract-prisma7__provider.mjs +60 -24
  14. package/dist/contract-prisma7__provider.mjs.map +1 -1
  15. package/dist/contract-psl.d.mts +1 -1
  16. package/dist/contract-psl.mjs +1 -1
  17. package/dist/contract-psl__attribute-specs.d.mts +1 -1
  18. package/dist/contract-psl__attribute-specs.mjs +1 -1
  19. package/dist/contract-psl__diagnostics.mjs +1 -1
  20. package/dist/contract-psl__provider.mjs +2 -2
  21. package/dist/contract-psl__provider.mjs.map +1 -1
  22. package/dist/contract-ts.d.mts +1 -1
  23. package/dist/contract-ts.mjs +3 -3
  24. package/dist/contract-ts__config-types.mjs +1 -1
  25. package/dist/contract-ts__contract-builder.d.mts +1 -1
  26. package/dist/contract-ts__contract-builder.mjs +2 -2
  27. package/dist/contract.d.mts +2 -2
  28. package/dist/contract.mjs +3 -3
  29. package/dist/contract__data-type.d.mts +2 -2
  30. package/dist/contract__data-type.mjs +2 -2
  31. package/dist/contract__validators.mjs +1 -1
  32. package/dist/{control-B2CeDfVO.d.mts → control-BE7gXqZF.d.mts} +3 -3
  33. package/dist/{control-B2CeDfVO.d.mts.map → control-BE7gXqZF.d.mts.map} +1 -1
  34. package/dist/{control-C1EjGUVq.mjs → control-DPCrkpMS.mjs} +10 -11
  35. package/dist/control-DPCrkpMS.mjs.map +1 -0
  36. package/dist/{control-adapter-SlQkTEwT.mjs → control-adapter-BetaUm2y.mjs} +2 -2
  37. package/dist/{control-adapter-SlQkTEwT.mjs.map → control-adapter-BetaUm2y.mjs.map} +1 -1
  38. package/dist/{data-type-CR0gi2GQ.d.mts → data-type-B-Do6RMA.d.mts} +13 -5
  39. package/dist/data-type-B-Do6RMA.d.mts.map +1 -0
  40. package/dist/{data-type-BFSpaotu.mjs → data-type-BfA5F0Qf.mjs} +2 -2
  41. package/dist/{data-type-BFSpaotu.mjs.map → data-type-BfA5F0Qf.mjs.map} +1 -1
  42. package/dist/{default-mapping-CAOONlKQ-CIg7JCfF.d.mts → default-mapping-CEISdj2g-B50Ag_F_.d.mts} +5 -11
  43. package/dist/default-mapping-CEISdj2g-B50Ag_F_.d.mts.map +1 -0
  44. package/dist/{derived-checks-BuTkSE9l-gyx0d0dX.mjs → derived-checks-D__agoFB-Boa1MHcA.mjs} +4 -4
  45. package/dist/{derived-checks-BuTkSE9l-gyx0d0dX.mjs.map → derived-checks-D__agoFB-Boa1MHcA.mjs.map} +1 -1
  46. package/dist/{diagnostics-C7jR1Jyf.mjs → diagnostics-CoM0OFuR.mjs} +40 -30
  47. package/dist/diagnostics-CoM0OFuR.mjs.map +1 -0
  48. package/dist/family.d.mts +7 -7
  49. package/dist/family.mjs +9 -9
  50. package/dist/family__control-adapter.mjs +1 -1
  51. package/dist/family__control.d.mts +1 -1
  52. package/dist/family__control.mjs +3 -3
  53. package/dist/family__diff.mjs +1 -1
  54. package/dist/family__ir.mjs +1 -1
  55. package/dist/family__pack.d.mts +1 -1
  56. package/dist/family__pack.mjs +2 -2
  57. package/dist/family__psl-build.d.mts +3 -3
  58. package/dist/family__psl-build.mjs +2 -2
  59. package/dist/family__psl-infer.d.mts +1 -1
  60. package/dist/family__runtime.d.mts +1 -1
  61. package/dist/family__runtime.mjs +1 -1
  62. package/dist/{generator-functions-Hy4pDDr9-BUHOsofo.mjs → generator-functions-Hy4pDDr9-CMfJOBtv.mjs} +2 -2
  63. package/dist/{generator-functions-Hy4pDDr9-BUHOsofo.mjs.map → generator-functions-Hy4pDDr9-CMfJOBtv.mjs.map} +1 -1
  64. package/dist/{interpreter-CrQFtK4p-CM5k_t4g.mjs → interpreter-ChvVEijY-FeJngsog.mjs} +16 -6
  65. package/dist/interpreter-ChvVEijY-FeJngsog.mjs.map +1 -0
  66. package/dist/{pack-BPbz6RVm.d.mts → pack-DKM1hv1E.d.mts} +3 -3
  67. package/dist/{pack-BPbz6RVm.d.mts.map → pack-DKM1hv1E.d.mts.map} +1 -1
  68. package/dist/psl-build-BA0Ndi1v.mjs +268 -0
  69. package/dist/psl-build-BA0Ndi1v.mjs.map +1 -0
  70. package/dist/{psl-build-CNncjpsa.d.mts → psl-build-DCZaF5g4.d.mts} +44 -15
  71. package/dist/psl-build-DCZaF5g4.d.mts.map +1 -0
  72. package/dist/{psl-column-resolution-djGEITmJ-DfEOkjPf.d.mts → psl-column-resolution-djGEITmJ-C0LSpwl4.d.mts} +2 -2
  73. package/dist/{psl-column-resolution-djGEITmJ-DfEOkjPf.d.mts.map → psl-column-resolution-djGEITmJ-C0LSpwl4.d.mts.map} +1 -1
  74. package/dist/{psl-field-resolution-Bvhx79fP-CuyYFk8z.mjs → psl-field-resolution-BW2_FOb9-DxqR43fo.mjs} +67 -37
  75. package/dist/psl-field-resolution-BW2_FOb9-DxqR43fo.mjs.map +1 -0
  76. package/dist/{psl-infer-BkkoyXmM.d.mts → psl-infer-Cr9AeccU.d.mts} +2 -2
  77. package/dist/{psl-infer-BkkoyXmM.d.mts.map → psl-infer-Cr9AeccU.d.mts.map} +1 -1
  78. package/dist/{runtime-BrBva2ta.d.mts → runtime-CSDcwOEG.d.mts} +4 -3
  79. package/dist/{runtime-BrBva2ta.d.mts.map → runtime-CSDcwOEG.d.mts.map} +1 -1
  80. package/dist/{runtime-CCzfa1mY.mjs → runtime-DkUiQi00.mjs} +12 -4
  81. package/dist/runtime-DkUiQi00.mjs.map +1 -0
  82. package/dist/{schema-verify-C3wbdviw-mlPO4NkT.mjs → schema-verify-C3wbdviw-nQ4tG9N7.mjs} +2 -2
  83. package/dist/{schema-verify-C3wbdviw-mlPO4NkT.mjs.map → schema-verify-C3wbdviw-nQ4tG9N7.mjs.map} +1 -1
  84. package/dist/{sql-contract-serializer-sMY3prTx-aQd4v3fE.mjs → sql-contract-serializer-sMY3prTx-CBHrlt9O.mjs} +2 -2
  85. package/dist/{sql-contract-serializer-sMY3prTx-aQd4v3fE.mjs.map → sql-contract-serializer-sMY3prTx-CBHrlt9O.mjs.map} +1 -1
  86. package/dist/{sql-data-type-D7M-YTTY-D2vRqDxn.mjs → sql-data-type-LVBldu1a-Bq203xWX.mjs} +13 -7
  87. package/dist/sql-data-type-LVBldu1a-Bq203xWX.mjs.map +1 -0
  88. package/dist/{validators-CnQqLEIi.mjs → validators-qcQteqs2.mjs} +2 -2
  89. package/dist/{validators-CnQqLEIi.mjs.map → validators-qcQteqs2.mjs.map} +1 -1
  90. package/package.json +18 -18
  91. package/dist/contract-builder-Bk-Co792.mjs.map +0 -1
  92. package/dist/control-C1EjGUVq.mjs.map +0 -1
  93. package/dist/data-type-CR0gi2GQ.d.mts.map +0 -1
  94. package/dist/default-mapping-CAOONlKQ-CIg7JCfF.d.mts.map +0 -1
  95. package/dist/diagnostics-C7jR1Jyf.mjs.map +0 -1
  96. package/dist/interpreter-CrQFtK4p-CM5k_t4g.mjs.map +0 -1
  97. package/dist/psl-build-CNncjpsa.d.mts.map +0 -1
  98. package/dist/psl-build-DqqYhOsa.mjs +0 -426
  99. package/dist/psl-build-DqqYhOsa.mjs.map +0 -1
  100. package/dist/psl-field-resolution-Bvhx79fP-CuyYFk8z.mjs.map +0 -1
  101. package/dist/runtime-CCzfa1mY.mjs.map +0 -1
  102. package/dist/sql-data-type-D7M-YTTY-D2vRqDxn.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { a as SqlNamespaceBase, c as SqlNamespaceInput } from "./sql-storage-B_AM6tU1-BOPQxXo7.mjs";
2
2
  import "./types-CXRxo_TK.mjs";
3
- import { ControlPolicy } from "@prisma/orm-framework/contract/types";
3
+ import { ControlPolicy, JsonValue } from "@prisma/orm-framework/contract/types";
4
4
  import { TargetPackRef } from "@prisma/orm-framework/components/components";
5
5
  import { ContractConfig } from "@prisma/orm-framework/config/config-types";
6
6
  //#region ../../../2-sql-family/2-authoring/contract-prisma7/dist/provider.d.mts
@@ -83,6 +83,8 @@ interface Prisma7TargetBinding {
83
83
  readonly junctionRelationFieldNames: (tableA: string, tableB: string) => readonly [string, string];
84
84
  /** How a literal `@default` on the column is read; `undefined` when the codec takes the written value. */
85
85
  readonly literalDefaultForm: (column: Prisma7ColumnType) => Prisma7LiteralDefaultForm | undefined;
86
+ /** The SQL expression of a default whose value the column's type holds but its codec cannot hold exactly, such as a timestamp with digits below a millisecond read as a JavaScript `Date`: `stored` is the value, or a list column's elements, as the type stores them. */
87
+ readonly literalDefaultExpression: (stored: JsonValue, column: Prisma7ColumnType) => string;
86
88
  }
87
89
  //#endregion
88
90
  //#region src/provider.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"contract-prisma7__provider.d.mts","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-prisma7/dist/provider.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC;;WAEA;;UAED;;WAEC,SAAS,SAAS,eAAe;;;;;;WAMjC,aAAa,SAAS,eAAe;;;;UAItC;WACC;;WAEA;WACA,aAAa,SAAS;;;KAG5B;;;WAGM;;;;WAIA;WACA;;WAEA,OAAO;;WAEP,mBAAmB,iBAAiB;;;UAGrC;WACC;WACA;;;UAGD;WACC,QAAQ;WACR,kBAAkB,OAAO,sBAAsB;;WAE/C;;WAEA,SAAS;;WAET;aACE;aACA;;;WAGF,YAAY,SAAS;;WAErB;;WAEA;aACE,aAAa;aACb,aAAa,mBAAmB;;;;;;;WAOlC,6BAA6B,gBAAgB;;WAE7C,qBAAqB,QAAQ,sBAAsB;;;;UAIpD;WACC,SAAS;WACT;WACA,uBAAuB;;iBAEjB,gBAAgB,oBAAoB,SAAS,yBAAyB"}
1
+ {"version":3,"file":"contract-prisma7__provider.d.mts","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-prisma7/dist/provider.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC;;WAEA;;UAED;;WAEC,SAAS,SAAS,eAAe;;;;;;WAMjC,aAAa,SAAS,eAAe;;;;UAItC;WACC;;WAEA;WACA,aAAa,SAAS;;;KAG5B;;;WAGM;;;;WAIA;WACA;;WAEA,OAAO;;WAEP,mBAAmB,iBAAiB;;;UAGrC;WACC;WACA;;;UAGD;WACC,QAAQ;WACR,kBAAkB,OAAO,sBAAsB;;WAE/C;;WAEA,SAAS;;WAET;aACE;aACA;;;WAGF,YAAY,SAAS;;WAErB;;WAEA;aACE,aAAa;aACb,aAAa,mBAAmB;;;;;;;WAOlC,6BAA6B,gBAAgB;;WAE7C,qBAAqB,QAAQ,sBAAsB;;WAEnD,2BAA2B,QAAQ,WAAW,QAAQ;;;;UAIvD;WACC,SAAS;WACT;WACA,uBAAuB;;iBAEjB,gBAAgB,oBAAoB,SAAS,yBAAyB"}
@@ -1,18 +1,18 @@
1
1
  import { r as lowerAuthoredIndex } from "./index-naming-BOcJT1B3-D-49owHA.mjs";
2
- import { p as sqlDataTypeOfCodec, u as sqlCodecColumnLength } from "./sql-data-type-D7M-YTTY-D2vRqDxn.mjs";
2
+ import { p as sqlDataTypeOfCodec, u as sqlCodecColumnLength } from "./sql-data-type-LVBldu1a-Bq203xWX.mjs";
3
3
  import { n as declaredBackingObjectName, r as declaredIndexesServeForeignKey } from "./foreign-key-materialization-CCHAR789.mjs";
4
4
  import { h as storedSqlText } from "./sql-expression-CKgKznXS.mjs";
5
- import { p as validateSqlStorageConsistency, u as validateModelStorageReferences } from "./validators-CnQqLEIi.mjs";
5
+ import { p as validateSqlStorageConsistency, u as validateModelStorageReferences } from "./validators-qcQteqs2.mjs";
6
6
  import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-HVaxhALD.mjs";
7
- import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-BuTkSE9l-gyx0d0dX.mjs";
8
- import { c as instantiateFieldTypeConstructor, i as defaultFunctionCall, v as readDataTypeDefault } from "./psl-field-resolution-Bvhx79fP-CuyYFk8z.mjs";
9
- import { a as normalizeReferentialAction, n as buildEntityTypesByDiscriminator, r as indexFkRelations, t as applyBackrelationCandidates } from "./interpreter-CrQFtK4p-CM5k_t4g.mjs";
7
+ import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-D__agoFB-Boa1MHcA.mjs";
8
+ import { c as instantiateFieldTypeConstructor, i as defaultFunctionCall, v as readDataTypeDefault } from "./psl-field-resolution-BW2_FOb9-DxqR43fo.mjs";
9
+ import { a as normalizeReferentialAction, n as buildEntityTypesByDiscriminator, r as indexFkRelations, t as applyBackrelationCandidates } from "./interpreter-ChvVEijY-FeJngsog.mjs";
10
10
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
11
11
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
12
- import { entryForTag, getAuthoringTypeConstructor, instantiateAuthoringEntityType, instantiateAuthoringTypeConstructorFromValues } from "@prisma/orm-framework/components/authoring";
12
+ import { entryForTag, getAuthoringTypeChoice, getAuthoringTypeConstructor, instantiateAuthoringEntityType, instantiateAuthoringTypeConstructorFromValues, resolveAuthoringTypeChoice } from "@prisma/orm-framework/components/authoring";
13
13
  import { clipToUtf8Bytes, utf8ByteLength } from "@prisma/orm-framework/utils/text";
14
14
  import { blindCast } from "@prisma/orm-framework/utils/casts";
15
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
15
+ import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
16
16
  import { EMPTY_GENERATOR_FUNCTIONS } from "@prisma/orm-framework/components/components";
17
17
  import { validateContractDomain } from "@prisma/orm-framework/contract/validate-domain";
18
18
  import { readFile, readdir, stat } from "node:fs/promises";
@@ -202,26 +202,33 @@ function lowerPrisma7Default(input) {
202
202
  const call = FunctionCallAst.cast(expression.syntax);
203
203
  if (input.onlyDbgenerated && call?.path().join(".") !== "dbgenerated") return unknown("on a field of type Unsupported(...) must be dbgenerated(\"...\"). Prisma 7 refuses this schema too: \"Only @default(dbgenerated(\"...\")) can be used for Unsupported types.\" Write the default as @default(dbgenerated(\"<sql expression>\")), or remove it.", attribute.span);
204
204
  if (call !== void 0) return lowerFunction(call, expression, input, label, unknown);
205
- const scalar = scalarValue$1(expression, input, unknown);
206
- if (scalar === void 0) return void 0;
207
- return {
208
- storage: {
209
- kind: "literal",
210
- value: scalar,
211
- inStoredForm: true
212
- },
205
+ const storage = scalarValue$1(expression, input, unknown);
206
+ return storage === void 0 ? void 0 : {
207
+ storage,
213
208
  onCreate: void 0
214
209
  };
215
210
  }
216
211
  /**
217
- * The stored value of a written default: an enum member resolves through the enum's members, and
212
+ * The stored default of a written value: an enum member resolves through the enum's members, and
218
213
  * every other value is read by the authoring entry for its syntax, cast into the column's data type
219
- * and validated by the column's codec — the same path the current schema language takes.
214
+ * and validated by the column's codec — the same path the current schema language takes. A value
215
+ * the column's type holds but its codec cannot hold exactly, such as a timestamp with digits below
216
+ * a millisecond on a column read as a JavaScript `Date`, is kept as the SQL expression the target
217
+ * writes for it.
220
218
  */
221
219
  function scalarValue$1(expression, input, unknown) {
220
+ const literal = scalarLiteral(expression, input, unknown);
221
+ if (literal === void 0 || "expression" in literal) return literal;
222
+ return {
223
+ kind: "literal",
224
+ value: literal.value,
225
+ inStoredForm: true
226
+ };
227
+ }
228
+ function scalarLiteral(expression, input, unknown) {
222
229
  const span = input.attribute.span;
223
230
  const enumValue = enumMemberValue$1(expression, input);
224
- if (enumValue !== void 0) return enumValue;
231
+ if (enumValue !== void 0) return { value: enumValue };
225
232
  const array = ArrayLiteralAst.cast(expression.syntax);
226
233
  const elements = array === void 0 ? void 0 : [...array.elements()];
227
234
  if (elements?.some((element) => enumMemberValue$1(element, input) !== void 0) === true) {
@@ -231,14 +238,14 @@ function scalarValue$1(expression, input, unknown) {
231
238
  if (value === void 0) return unknown("lists may only hold literals or enum members.", span);
232
239
  values.push(value);
233
240
  }
234
- return values;
241
+ return { value: values };
235
242
  }
236
243
  const finer = finerThanColumn(elements ?? [expression], elements !== void 0, input);
237
244
  if (finer !== void 0) return unknown(finer, span);
238
245
  const written = writtenLiteralFor(expression, elements, input);
239
246
  if (written === void 0) return unreadableValue(expression, input, unknown);
240
247
  const jsonNull = jsonNullDefault(written, expression, input);
241
- if (jsonNull !== void 0) return jsonNull;
248
+ if (jsonNull !== void 0) return { value: jsonNull };
242
249
  const read = readDataTypeDefault({
243
250
  written,
244
251
  isList: input.field.list,
@@ -250,7 +257,13 @@ function scalarValue$1(expression, input, unknown) {
250
257
  dataTypes: input.dataTypes,
251
258
  fieldPath: `${input.modelName}.${input.field.name}`
252
259
  });
253
- return read.ok ? read.value : unknown(refusalReason(read.refusal), span);
260
+ if (read.ok) return { value: read.value };
261
+ const { refusal } = read;
262
+ if (refusal.kind === "refused-by-codec") return {
263
+ kind: "function",
264
+ expression: input.literalDefaultExpression(refusal.stored)
265
+ };
266
+ return unknown(refusalReason(refusal), span);
254
267
  }
255
268
  /**
256
269
  * Why a written date and time is refused when it has more fraction digits than the column holds:
@@ -367,7 +380,8 @@ function refusalReason(refusal) {
367
380
  case "no-cast": return `holds a ${refusal.valueType} value${at}, which ${refusal.receivingType} has no cast from; ${describeCasts(refusal.casts)}.`;
368
381
  case "no-list-cast": return `holds a list, which ${refusal.receivingType} has no cast from; ${describeCasts(refusal.casts)}.`;
369
382
  case "no-element-cast": return `holds a ${refusal.valueType} value${at}, which the list cast of ${refusal.receivingType} does not take; it takes ${refusal.elementTypes.join(", ")}.`;
370
- case "refused-by-column": return `holds a value${at} that ${refusal.codecId} does not read: ${refusal.message}`;
383
+ case "refused-by-column":
384
+ case "refused-by-codec": return `holds a value${at} that ${refusal.codecId} does not read: ${refusal.message}`;
371
385
  }
372
386
  }
373
387
  function describeCasts(casts) {
@@ -1641,6 +1655,20 @@ function lowerNativeEnums(enums, input, diagnostics) {
1641
1655
  }
1642
1656
  /** The SQL family's type constructor for a column of a type no data type claims (ADR 273). */
1643
1657
  const RAW_TYPE_CONSTRUCTOR = ["Raw"];
1658
+ /** The constructor the values a binding maps a Prisma 7 type to choose from the type choice it names; a refusal is the binding's mistake. */
1659
+ function chooseBindingType(label, path, typeChoice, values) {
1660
+ try {
1661
+ return resolveAuthoringTypeChoice({
1662
+ helperPath: path.join("."),
1663
+ descriptor: typeChoice.descriptor,
1664
+ args: values,
1665
+ constructorNamed: typeChoice.constructorNamed
1666
+ });
1667
+ } catch (error) {
1668
+ if (isInternalError(error) || !(error instanceof Error)) throw error;
1669
+ throw new InternalError(`The Prisma 7 target binding maps ${label} to type choice "${path.join(".")}" with values it refuses: ${error.message}`);
1670
+ }
1671
+ }
1644
1672
  /** Prisma 7's `Unsupported("...")`, which this source reads as ``Raw(sql`...`)``. */
1645
1673
  function isUnsupportedType(call) {
1646
1674
  return call?.path.length === 1 && call.path[0] === "Unsupported";
@@ -1802,7 +1830,10 @@ function readField(args) {
1802
1830
  };
1803
1831
  }
1804
1832
  const constructorPath = fieldType.kind === "written" ? fieldType.call.path : fieldType.path;
1805
- const typeConstructor = getAuthoringTypeConstructor(input.authoringContributions, constructorPath);
1833
+ const typeChoice = fieldType.kind === "values" ? getAuthoringTypeChoice(input.authoringContributions, constructorPath) : void 0;
1834
+ const chosen = typeChoice === void 0 || fieldType.kind !== "values" ? void 0 : chooseBindingType(label, constructorPath, typeChoice, fieldType.values);
1835
+ const typeConstructor = chosen?.descriptor ?? getAuthoringTypeConstructor(input.authoringContributions, constructorPath);
1836
+ const typeValues = chosen?.args ?? (fieldType.kind === "values" ? fieldType.values : []);
1806
1837
  if (typeConstructor === void 0) {
1807
1838
  diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_UNSUPPORTED_TYPE", `${label} type "${field.typeName}" could not be resolved against target "${binding.target.targetId}".`, sourceId, field.span));
1808
1839
  return;
@@ -1823,7 +1854,7 @@ function readField(args) {
1823
1854
  });
1824
1855
  diagnostics.push(...typeDiagnostics.toExternal());
1825
1856
  } else {
1826
- const instantiated = instantiateAuthoringTypeConstructorFromValues(typeConstructor, fieldType.values, input.codecLookup.descriptorFor(typeConstructor.output.codecId)?.paramsSchema);
1857
+ const instantiated = instantiateAuthoringTypeConstructorFromValues(typeConstructor, typeValues, input.codecLookup.descriptorFor(typeConstructor.output.codecId)?.paramsSchema);
1827
1858
  if (!instantiated.ok && unsupportedArgument !== void 0) {
1828
1859
  diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_UNSUPPORTED_TYPE", `${label}: Unsupported(${unsupportedArgument.written.value}) is not one type name: ${instantiated.failure.message}`, sourceId, unsupportedArgument.written.span));
1829
1860
  return;
@@ -1860,6 +1891,11 @@ function readField(args) {
1860
1891
  dataType: sqlDataTypeOfCodec(resolved.descriptor.codecId, typeLookups).id,
1861
1892
  typeParams: resolved.descriptor.typeParams
1862
1893
  }),
1894
+ literalDefaultExpression: (stored) => binding.literalDefaultExpression(stored, {
1895
+ codecId: resolved.descriptor.codecId,
1896
+ dataType: sqlDataTypeOfCodec(resolved.descriptor.codecId, typeLookups).id,
1897
+ typeParams: resolved.descriptor.typeParams
1898
+ }),
1863
1899
  enumMembers: enumDeclaration === void 0 ? void 0 : new Map(enumDeclaration.members.map((member) => [member.name, member.value])),
1864
1900
  controlMutationDefaults: input.controlMutationDefaults,
1865
1901
  argumentContext: model.argumentContext,