@prisma/orm-family-sql 8.0.0-rc.18-dev.41 → 8.0.0-rc.18-dev.43

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/{attribute-specs-D_fUYNiw.d.mts → attribute-specs-cHzMPvMl.d.mts} +3 -3
  2. package/dist/{attribute-specs-D_fUYNiw.d.mts.map → attribute-specs-cHzMPvMl.d.mts.map} +1 -1
  3. package/dist/{authoring-entity-types-DUQLeBf_-BZ1zRWGY.d.mts → authoring-entity-types-DUQLeBf_-nuhFC6jJ.d.mts} +2 -2
  4. package/dist/{authoring-entity-types-DUQLeBf_-BZ1zRWGY.d.mts.map → authoring-entity-types-DUQLeBf_-nuhFC6jJ.d.mts.map} +1 -1
  5. package/dist/{config-types-CUWdUm6B.mjs → config-types-DY37pCIx.mjs} +2 -2
  6. package/dist/{config-types-CUWdUm6B.mjs.map → config-types-DY37pCIx.mjs.map} +1 -1
  7. package/dist/{contract-builder-DzzgwCZd.mjs → contract-builder-DT689tII.mjs} +61 -12
  8. package/dist/contract-builder-DT689tII.mjs.map +1 -0
  9. package/dist/{contract-builder-Di-2-fFO.d.mts → contract-builder-DZSUqbp0.d.mts} +21 -18
  10. package/dist/contract-builder-DZSUqbp0.d.mts.map +1 -0
  11. package/dist/contract-prisma7__provider.d.mts +4 -2
  12. package/dist/contract-prisma7__provider.d.mts.map +1 -1
  13. package/dist/contract-prisma7__provider.mjs +74 -73
  14. package/dist/contract-prisma7__provider.mjs.map +1 -1
  15. package/dist/contract-psl.d.mts +2 -2
  16. package/dist/contract-psl.d.mts.map +1 -1
  17. package/dist/contract-psl.mjs +1 -1
  18. package/dist/contract-psl__attribute-specs.d.mts +1 -1
  19. package/dist/contract-psl__attribute-specs.mjs +1 -1
  20. package/dist/contract-psl__diagnostics.mjs +1 -1
  21. package/dist/contract-psl__provider.mjs +2 -2
  22. package/dist/contract-psl__provider.mjs.map +1 -1
  23. package/dist/contract-ts.d.mts +1 -1
  24. package/dist/contract-ts.mjs +3 -3
  25. package/dist/contract-ts__config-types.mjs +1 -1
  26. package/dist/contract-ts__contract-builder.d.mts +1 -1
  27. package/dist/contract-ts__contract-builder.mjs +2 -2
  28. package/dist/{control-d-Dlrhh4.mjs → control-CF-KJYTH.mjs} +6 -58
  29. package/dist/control-CF-KJYTH.mjs.map +1 -0
  30. package/dist/{control-LkQLqHHL.d.mts → control-YFLg-7Gn.d.mts} +8 -128
  31. package/dist/control-YFLg-7Gn.d.mts.map +1 -0
  32. package/dist/{default-mapping-CP8q4TfH-CF6eJMej.d.mts → default-mapping-CAOONlKQ-v7GTIkjE.d.mts} +9 -5
  33. package/dist/default-mapping-CAOONlKQ-v7GTIkjE.d.mts.map +1 -0
  34. package/dist/{derived-checks-CwbSfZ8d-B91zqK6B.mjs → derived-checks-CXW9ytkb-B_zxX1-8.mjs} +2 -2
  35. package/dist/{derived-checks-CwbSfZ8d-B91zqK6B.mjs.map → derived-checks-CXW9ytkb-B_zxX1-8.mjs.map} +1 -1
  36. package/dist/{diagnostics-xqFRhSin.mjs → diagnostics-IM48vCjC.mjs} +4 -2
  37. package/dist/diagnostics-IM48vCjC.mjs.map +1 -0
  38. package/dist/family.d.mts +6 -6
  39. package/dist/family.mjs +5 -4
  40. package/dist/family__control.d.mts +2 -2
  41. package/dist/family__control.mjs +2 -2
  42. package/dist/family__pack.d.mts +2 -2
  43. package/dist/family__pack.mjs +3 -25
  44. package/dist/family__psl-build.d.mts +3 -3
  45. package/dist/family__psl-build.mjs +2 -2
  46. package/dist/family__psl-infer.d.mts +1 -1
  47. package/dist/{generator-functions-DErXcNG5-nKYm5qLY.mjs → generator-functions-DuDZSQHE-BbKhsXck.mjs} +30 -26
  48. package/dist/generator-functions-DuDZSQHE-BbKhsXck.mjs.map +1 -0
  49. package/dist/{interpreter-MPFufRkd-D0QvlLTq.mjs → interpreter-DTwRm0sl-DHX1SdeJ.mjs} +11 -7
  50. package/dist/interpreter-DTwRm0sl-DHX1SdeJ.mjs.map +1 -0
  51. package/dist/{pack-74uFuOgh.d.mts → pack-AyeYizq-.d.mts} +152 -28
  52. package/dist/pack-AyeYizq-.d.mts.map +1 -0
  53. package/dist/pack-NM8AYiUp.mjs +80 -0
  54. package/dist/pack-NM8AYiUp.mjs.map +1 -0
  55. package/dist/{psl-build-BkNvqSMz.d.mts → psl-build-C4ia2uM6.d.mts} +10 -8
  56. package/dist/psl-build-C4ia2uM6.d.mts.map +1 -0
  57. package/dist/{psl-build-BSZQ8lC1.mjs → psl-build-D5VG40ej.mjs} +122 -107
  58. package/dist/psl-build-D5VG40ej.mjs.map +1 -0
  59. package/dist/{psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts → psl-column-resolution-BgThghdu-BWaFlWYV.d.mts} +4 -4
  60. package/dist/psl-column-resolution-BgThghdu-BWaFlWYV.d.mts.map +1 -0
  61. package/dist/{psl-field-resolution-BLtSah2i-BuuJ5H70.mjs → psl-field-resolution-DpGsATq3-BREG9FbU.mjs} +11 -7
  62. package/dist/psl-field-resolution-DpGsATq3-BREG9FbU.mjs.map +1 -0
  63. package/dist/{psl-infer-C-RcAyUr.d.mts → psl-infer-B_n-rSCj.d.mts} +2 -2
  64. package/dist/{psl-infer-C-RcAyUr.d.mts.map → psl-infer-B_n-rSCj.d.mts.map} +1 -1
  65. package/package.json +18 -18
  66. package/dist/contract-builder-Di-2-fFO.d.mts.map +0 -1
  67. package/dist/contract-builder-DzzgwCZd.mjs.map +0 -1
  68. package/dist/control-LkQLqHHL.d.mts.map +0 -1
  69. package/dist/control-d-Dlrhh4.mjs.map +0 -1
  70. package/dist/default-mapping-CP8q4TfH-CF6eJMej.d.mts.map +0 -1
  71. package/dist/diagnostics-xqFRhSin.mjs.map +0 -1
  72. package/dist/family__pack.mjs.map +0 -1
  73. package/dist/generator-functions-DErXcNG5-nKYm5qLY.mjs.map +0 -1
  74. package/dist/interpreter-MPFufRkd-D0QvlLTq.mjs.map +0 -1
  75. package/dist/pack-74uFuOgh.d.mts.map +0 -1
  76. package/dist/psl-build-BSZQ8lC1.mjs.map +0 -1
  77. package/dist/psl-build-BkNvqSMz.d.mts.map +0 -1
  78. package/dist/psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts.map +0 -1
  79. package/dist/psl-field-resolution-BLtSah2i-BuuJ5H70.mjs.map +0 -1
@@ -0,0 +1,80 @@
1
+ import { f as sqlExpressionRegistration } from "./sql-expression-BJCuy-WI.mjs";
2
+ import { b as sqlAttributeSpecs } from "./psl-field-resolution-DpGsATq3-BREG9FbU.mjs";
3
+ import { a as sqlFamilyGeneratorDescriptors, i as sqlFamilyEntityTypes, n as sqlFamilyAuthoringFieldPresets, o as sqlFamilyGeneratorFunctions, r as sqlFamilyAuthoringTypes, s as sqlFamilyPslBlockDescriptors } from "./generator-functions-DuDZSQHE-BbKhsXck.mjs";
4
+ import { TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG, TIMESTAMP_NOW_GENERATOR_ID, temporalAuthoringPresets, temporalPhaseTemplate, temporalPhaseTemplateWithParams } from "@prisma/orm-framework/components/authoring";
5
+ //#region ../../../2-sql/9-family/dist/pack.mjs
6
+ function temporalStringAuthoringPresets(input) {
7
+ const presets = temporalAuthoringPresets(input);
8
+ return {
9
+ createdAtString: presets.createdAt,
10
+ updatedAtString: presets.updatedAt
11
+ };
12
+ }
13
+ const PRECISION_PARAMS = { precision: {
14
+ kind: "arg",
15
+ index: 0
16
+ } };
17
+ /**
18
+ * Builds a `temporal.<codec>` field preset for a codec that takes a precision
19
+ * parameter (`pg/timestamp-temporal@1`, `pg/timestamptz-temporal@1`). Arguments change field
20
+ * properties only — never the codec, which the caller fixes here.
21
+ *
22
+ * All three arguments are optional: omitting `precision` omits `typeParams`
23
+ * entirely, and omitting a phase omits that phase (both omitted omits
24
+ * `executionDefaults`). With `nowTakesPrecision`, the generator a `now` selects
25
+ * also receives the precision as its `precision` param, so it can write a value
26
+ * the column stores without rounding.
27
+ */
28
+ /* @__NO_SIDE_EFFECTS__ */
29
+ function temporalCodecPresetWithPrecision(input) {
30
+ const generatorId = input.generatorId ?? TIMESTAMP_NOW_GENERATOR_ID;
31
+ const phase = (index) => input.nowTakesPrecision === true ? temporalPhaseTemplateWithParams(index, generatorId, PRECISION_PARAMS) : temporalPhaseTemplate(index, generatorId);
32
+ return {
33
+ kind: "fieldPreset",
34
+ args: [
35
+ {
36
+ name: "precision",
37
+ kind: "value",
38
+ dataType: input.sizeType,
39
+ optional: true
40
+ },
41
+ TEMPORAL_ON_CREATE_ARG,
42
+ TEMPORAL_ON_UPDATE_ARG
43
+ ],
44
+ output: {
45
+ codecId: input.codecId,
46
+ typeParams: { precision: {
47
+ kind: "arg",
48
+ index: 0
49
+ } },
50
+ executionDefaults: {
51
+ onCreate: phase(1),
52
+ onUpdate: phase(2)
53
+ }
54
+ }
55
+ };
56
+ }
57
+ const sqlFamilyPack = {
58
+ kind: "family",
59
+ id: "sql",
60
+ familyId: "sql",
61
+ version: "0.0.1",
62
+ dataTypes: sqlExpressionRegistration.dataTypes,
63
+ authoring: {
64
+ field: sqlFamilyAuthoringFieldPresets,
65
+ type: sqlFamilyAuthoringTypes,
66
+ dataTypes: sqlExpressionRegistration.authoring.dataTypes,
67
+ entityTypes: sqlFamilyEntityTypes,
68
+ pslBlockDescriptors: sqlFamilyPslBlockDescriptors,
69
+ attributeSpecs: sqlAttributeSpecs
70
+ },
71
+ generatorFunctions: sqlFamilyGeneratorFunctions,
72
+ controlMutationDefaults: {
73
+ defaultFunctionRegistry: /* @__PURE__ */ new Map(),
74
+ generatorDescriptors: sqlFamilyGeneratorDescriptors
75
+ }
76
+ };
77
+ //#endregion
78
+ export { temporalCodecPresetWithPrecision as n, temporalStringAuthoringPresets as r, sqlFamilyPack as t };
79
+
80
+ //# sourceMappingURL=pack-NM8AYiUp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-NM8AYiUp.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/pack.mjs"],"sourcesContent":["import { a as sqlFamilyAuthoringTypes, c as sqlFamilyEntityTypes, i as sqlIntegerArgumentGeneratorFunctions, l as sqlFamilyPslBlockDescriptors, n as sqlFamilyGeneratorDescriptors, o as sqlTargetTypeConstructors, r as sqlFamilyGeneratorFunctions, s as sqlFamilyAuthoringFieldPresets, t as idGeneratorFunctionBindings } from \"./generator-functions-DuDZSQHE.mjs\";\nimport { sqlExpressionRegistration } from \"@internal/sql-contract/sql-expression\";\nimport { sqlAttributeSpecs } from \"@internal/sql-contract-psl/attribute-specs\";\nimport { TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG, TIMESTAMP_NOW_GENERATOR_ID, temporalAuthoringPresets, temporalPhaseTemplate, temporalPhaseTemplateWithParams } from \"@internal/framework-components/authoring\";\n//#region src/core/timestamp-now-generator.ts\nfunction temporalStringAuthoringPresets(input) {\n\tconst presets = temporalAuthoringPresets(input);\n\treturn {\n\t\tcreatedAtString: presets.createdAt,\n\t\tupdatedAtString: presets.updatedAt\n\t};\n}\nconst PRECISION_PARAMS = { precision: {\n\tkind: \"arg\",\n\tindex: 0\n} };\n/**\n* Builds a `temporal.<codec>` field preset for a codec that takes a precision\n* parameter (`pg/timestamp-temporal@1`, `pg/timestamptz-temporal@1`). Arguments change field\n* properties only — never the codec, which the caller fixes here.\n*\n* All three arguments are optional: omitting `precision` omits `typeParams`\n* entirely, and omitting a phase omits that phase (both omitted omits\n* `executionDefaults`). With `nowTakesPrecision`, the generator a `now` selects\n* also receives the precision as its `precision` param, so it can write a value\n* the column stores without rounding.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction temporalCodecPresetWithPrecision(input) {\n\tconst generatorId = input.generatorId ?? TIMESTAMP_NOW_GENERATOR_ID;\n\tconst phase = (index) => input.nowTakesPrecision === true ? temporalPhaseTemplateWithParams(index, generatorId, PRECISION_PARAMS) : temporalPhaseTemplate(index, generatorId);\n\treturn {\n\t\tkind: \"fieldPreset\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tname: \"precision\",\n\t\t\t\tkind: \"value\",\n\t\t\t\tdataType: input.sizeType,\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tTEMPORAL_ON_CREATE_ARG,\n\t\t\tTEMPORAL_ON_UPDATE_ARG\n\t\t],\n\t\toutput: {\n\t\t\tcodecId: input.codecId,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} },\n\t\t\texecutionDefaults: {\n\t\t\t\tonCreate: phase(1),\n\t\t\t\tonUpdate: phase(2)\n\t\t\t}\n\t\t}\n\t};\n}\n//#endregion\n//#region src/exports/pack.ts\nconst sqlFamilyPack = {\n\tkind: \"family\",\n\tid: \"sql\",\n\tfamilyId: \"sql\",\n\tversion: \"0.0.1\",\n\tdataTypes: sqlExpressionRegistration.dataTypes,\n\tauthoring: {\n\t\tfield: sqlFamilyAuthoringFieldPresets,\n\t\ttype: sqlFamilyAuthoringTypes,\n\t\tdataTypes: sqlExpressionRegistration.authoring.dataTypes,\n\t\tentityTypes: sqlFamilyEntityTypes,\n\t\tpslBlockDescriptors: sqlFamilyPslBlockDescriptors,\n\t\tattributeSpecs: sqlAttributeSpecs\n\t},\n\tgeneratorFunctions: sqlFamilyGeneratorFunctions,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: sqlFamilyGeneratorDescriptors\n\t}\n};\n//#endregion\nexport { sqlFamilyPack as default, idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets };\n\n//# sourceMappingURL=pack.mjs.map"],"mappings":";;;;;AAKA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,UAAU,yBAAyB,KAAK;CAC9C,OAAO;EACN,iBAAiB,QAAQ;EACzB,iBAAiB,QAAQ;CAC1B;AACD;AACA,MAAM,mBAAmB,EAAE,WAAW;CACrC,MAAM;CACN,OAAO;AACR,EAAE;;;;;;;;;;;;;AAaF,SAAS,iCAAiC,OAAO;CAChD,MAAM,cAAc,MAAM,eAAe;CACzC,MAAM,SAAS,UAAU,MAAM,sBAAsB,OAAO,gCAAgC,OAAO,aAAa,gBAAgB,IAAI,sBAAsB,OAAO,WAAW;CAC5K,OAAO;EACN,MAAM;EACN,MAAM;GACL;IACC,MAAM;IACN,MAAM;IACN,UAAU,MAAM;IAChB,UAAU;GACX;GACA;GACA;EACD;EACA,QAAQ;GACP,SAAS,MAAM;GACf,YAAY,EAAE,WAAW;IACxB,MAAM;IACN,OAAO;GACR,EAAE;GACF,mBAAmB;IAClB,UAAU,MAAM,CAAC;IACjB,UAAU,MAAM,CAAC;GAClB;EACD;CACD;AACD;AAGA,MAAM,gBAAgB;CACrB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW,0BAA0B;CACrC,WAAW;EACV,OAAO;EACP,MAAM;EACN,WAAW,0BAA0B,UAAU;EAC/C,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,oBAAoB;CACpB,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB;CACvB;AACD"}
@@ -1,8 +1,8 @@
1
1
  import { u as SqlColumnIR } from "./types-DiD6BqoN-ZF53hwPp.mjs";
2
2
  import "./types-D_nlUp-1.mjs";
3
3
  import { i as SqlDataType, l as SqlTypeParams } from "./data-type-BacIoCfv.mjs";
4
- import "./default-mapping-CP8q4TfH-CF6eJMej.mjs";
5
- import { AuthoringTypeConstructorCall, AuthoringTypeConstructorDescriptor, AuthoringTypeNamespace } from "@prisma/orm-framework/components/authoring";
4
+ import "./default-mapping-CAOONlKQ-v7GTIkjE.mjs";
5
+ import { AuthoringTypeConstructorCall, AuthoringTypeConstructorDescriptor, AuthoringTypeNamespace, DataTypeSupport } from "@prisma/orm-framework/components/authoring";
6
6
  import { CodecLookupWithDescriptors, DataTypeLookup } from "@prisma/orm-framework/components/codec";
7
7
  import { ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma/orm-framework/contract/types";
8
8
  import { GeneratorFunctionField, GeneratorFunctionRegistry, GeneratorPhase } from "@prisma/orm-framework/components/components";
@@ -30,16 +30,16 @@ declare function inferredTypeConstructors(input: {
30
30
  */
31
31
  declare function fewestArgumentsCall(marked: InferredTypeConstructor, params: SqlTypeParams): AuthoringTypeConstructorCall | undefined;
32
32
  /**
33
- * A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.
34
- * Undefined for any other value, such as an array or an object, and for a string PSL cannot carry, because a quote, backslash or line break in it would read back differently.
33
+ * Each argument of a call to `descriptor` as PSL writes it: a value argument as a literal of its data type that reads back as the same value. `undefined` when an argument is not a value argument or no literal reads back as it.
35
34
  */
36
- declare function pslTypeArgumentText(value: unknown): string | undefined;
35
+ declare function writtenTypeArguments(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[], dataTypes: DataTypeSupport): readonly string[] | undefined;
37
36
  //#endregion
38
37
  //#region src/core/psl-build/column-types.d.ts
39
- /** A call to a type constructor as PSL writes it: the constructor's path and its arguments' text. */
38
+ /** A call to a type constructor as PSL writes it: the constructor's path, its arguments' text, and the value each argument gives the constructor. */
40
39
  interface PslTypeCall {
41
40
  readonly path: readonly string[];
42
41
  readonly args: readonly string[];
42
+ readonly values: readonly unknown[];
43
43
  }
44
44
  /** The PSL type `contract infer` writes for a column that is not an enum, by table and column name. */
45
45
  type ColumnTypeOf = (tableName: string, columnName: string) => PslTypeCall;
@@ -58,6 +58,8 @@ interface IntrospectedTable {
58
58
  declare function inferColumnTypes(input: {
59
59
  readonly tables: readonly IntrospectedTable[];
60
60
  readonly constructors: InferredTypeConstructors;
61
+ /** The stack's data types, whose literals write each argument. */
62
+ readonly dataTypes: DataTypeSupport;
61
63
  readonly isEnumColumn: (column: SqlColumnIR) => boolean;
62
64
  }): ColumnTypeOf;
63
65
  //#endregion
@@ -106,5 +108,5 @@ declare function generatorCallsFor(input: {
106
108
  */
107
109
  declare function toEnumMemberName(value: string): string;
108
110
  //#endregion
109
- export { InferredTypeConstructors as a, PslTypeCall as c, inferColumnTypes as d, inferredTypeConstructors as f, InferredTypeConstructor as i, fewestArgumentsCall as l, toEnumMemberName as m, GeneratorCallRefusal as n, IntrospectedTable as o, pslTypeArgumentText as p, GeneratorCallsResult as r, PhaseCallText as s, ColumnTypeOf as t, generatorCallsFor as u };
110
- //# sourceMappingURL=psl-build-BkNvqSMz.d.mts.map
111
+ export { InferredTypeConstructors as a, PslTypeCall as c, inferColumnTypes as d, inferredTypeConstructors as f, InferredTypeConstructor as i, fewestArgumentsCall as l, writtenTypeArguments as m, GeneratorCallRefusal as n, IntrospectedTable as o, toEnumMemberName as p, GeneratorCallsResult as r, PhaseCallText as s, ColumnTypeOf as t, generatorCallsFor as u };
112
+ //# sourceMappingURL=psl-build-C4ia2uM6.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-build-C4ia2uM6.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/psl-build.d.mts"],"mappings":";;;;;;;;;;;UASU;WACC;WACA,YAAY;WACZ,UAAU;;;KAGhB,2BAA2B,oBAAoB;;iBAEnC,yBAAyB;WAC/B,gBAAgB;WAChB,aAAa,KAAK;WAClB,gBAAgB;IACvB;;;;;;;iBAOa,oBAAoB,QAAQ,yBAAyB,QAAQ,gBAAgB;;;;iBAI7E,qBAAqB,YAAY,oCAAoC,0BAA0B,WAAW;;;;UAIjH;WACC;WACA;WACA;;;KAGN,gBAAgB,mBAAmB,uBAAuB;;UAErD;WACC;WACA;WACA,kBAAkB;;;;;;;;iBAQZ,iBAAiB;WACvB,iBAAiB;WACjB,cAAc;;WAEd,WAAW;WACX,eAAe,QAAQ;IAC9B;;;;UAIM;WACC,OAAO;WACP;;KAEN;WACM;WACA,OAAO;WACP,WAAW;;WAEX;WACA,OAAO;WACP,WAAW;WACX;WACA,UAAU;;WAEV;;KAEN;WACM;WACA,gBAAgB;;WAEhB;WACA,SAAS;;;;;iBAKH,kBAAkB;WACxB,kBAAkB;WAClB,OAAO;WACP;WACA,oBAAoB;IAC3B;;;;;;;;;iBASa,iBAAiB"}
@@ -6,113 +6,9 @@ import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
6
6
  import { authoringTypeConstructorArguments, authoringTypeConstructors, castTypedValue, instantiateAuthoringTypeConstructor, printTaggedLiteral, readWrittenValue } from "@prisma/orm-framework/components/authoring";
7
7
  import { dataTypeId, dataTypeParams } from "@prisma/orm-framework/components/codec";
8
8
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
9
+ import { blindCast } from "@prisma/orm-framework/utils/casts";
9
10
  import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
10
11
  //#region ../../../2-sql/9-family/dist/psl-build.mjs
11
- /** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */
12
- function inferredTypeConstructors(input) {
13
- const found = /* @__PURE__ */ new Map();
14
- for (const { path, descriptor } of authoringTypeConstructors(input.authoringTypes)) {
15
- if (descriptor.inferred !== true) continue;
16
- const dataTypeId = input.codecLookup.descriptorFor(descriptor.output.codecId)?.dataType;
17
- const dataType = dataTypeId === void 0 ? void 0 : input.dataTypeLookup.get(dataTypeId);
18
- if (dataType === void 0 || !isSqlDataType(dataType)) continue;
19
- found.set(dataType.id, {
20
- path,
21
- descriptor,
22
- dataType
23
- });
24
- }
25
- return found;
26
- }
27
- function normalParams(marked, args) {
28
- try {
29
- const { typeParams } = instantiateAuthoringTypeConstructor(marked.descriptor, args);
30
- const params = dataTypeParams(marked.dataType, typeParams);
31
- return canonicalizeJson(marked.dataType.sql.normalize(params));
32
- } catch (error) {
33
- if (isInternalError(error)) throw error;
34
- return;
35
- }
36
- }
37
- /**
38
- * The call to `marked` with the fewest arguments that produces `params`, the normal form of a
39
- * column's data type parameters: arguments are dropped from the end while the normal form of what
40
- * the call produces stays `params`. Undefined when the constructor cannot produce them, such as one
41
- * whose argument names another entity.
42
- */
43
- function fewestArgumentsCall(marked, params) {
44
- const all = authoringTypeConstructorArguments(marked.descriptor, {
45
- codecId: marked.descriptor.output.codecId,
46
- typeParams: params
47
- });
48
- if (all === void 0) return void 0;
49
- const wanted = canonicalizeJson(params);
50
- const args = [...all];
51
- while (args.length > 0 && normalParams(marked, args.slice(0, -1)) === wanted) args.pop();
52
- return {
53
- path: marked.path,
54
- args
55
- };
56
- }
57
- /**
58
- * A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.
59
- * Undefined for any other value, such as an array or an object, and for a string PSL cannot carry, because a quote, backslash or line break in it would read back differently.
60
- */
61
- function pslTypeArgumentText(value) {
62
- if (typeof value === "number" || typeof value === "boolean") return String(value);
63
- if (typeof value !== "string") return void 0;
64
- return escapePslString(value) === value ? `"${value}"` : void 0;
65
- }
66
- /** The type the database reported for `column`, which introspection always records. */
67
- function reportedTypeOf(column, tableName) {
68
- if (column.reportedType === void 0) throw new InternalError(`contract infer read column "${tableName}"."${column.name}" without the type the database reported for it.`);
69
- return column.reportedType;
70
- }
71
- function writtenCall(constructors, dataTypes, reported) {
72
- const resolved = resolveReportedSqlType(reported, dataTypes);
73
- const marked = resolved && constructors.get(resolved.dataType.id);
74
- const call = resolved && marked && fewestArgumentsCall(marked, resolved.typeParams);
75
- if (call === void 0) return void 0;
76
- const args = call.args.map(pslTypeArgumentText);
77
- return args.every((arg) => arg !== void 0) ? {
78
- path: call.path,
79
- args
80
- } : void 0;
81
- }
82
- /**
83
- * The type of every column of `tables` that `isEnumColumn` does not claim: the call, with the
84
- * fewest arguments, to the constructor marked `inferred` for the data type that claims the
85
- * column's reported type. When any column has no such call, throws
86
- * `CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED` listing every one of them.
87
- */
88
- function inferColumnTypes(input) {
89
- const dataTypes = [...input.constructors.values()].map((marked) => marked.dataType);
90
- const types = /* @__PURE__ */ new Map();
91
- const unclaimed = [];
92
- for (const { schemaName, tableName, columns } of input.tables) for (const column of columns) {
93
- if (input.isEnumColumn(column)) continue;
94
- const reported = reportedTypeOf(column, tableName);
95
- const call = writtenCall(input.constructors, dataTypes, reported);
96
- if (call === void 0) {
97
- unclaimed.push(`${schemaName}.${tableName}.${column.name}: ${reported.text}${column.many === true ? "[]" : ""}`);
98
- continue;
99
- }
100
- types.set(JSON.stringify([tableName, column.name]), call);
101
- }
102
- if (unclaimed.length > 0) {
103
- const columns = unclaimed.sort();
104
- throw sqlFamilyError("CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED", ["contract infer: Prisma 8 cannot write these column types with the configured stack:", ...columns.map((line) => ` ${line}`)].join("\n"), {
105
- why: "Prisma 8 reads a column type only through a data type that the target or an extension pack declares.",
106
- fix: `No configured pack has a type for these columns. If a type comes from a database extension that has a Prisma 8 pack, add the pack to extensions in prisma.config.ts. Otherwise, to keep such a column, write the schema by hand and declare its field as Raw("<type>") with the type as listed, or change the column's type or remove the column from the database.`,
107
- meta: { columns }
108
- });
109
- }
110
- return (tableName, columnName) => {
111
- const type = types.get(JSON.stringify([tableName, columnName]));
112
- if (type === void 0) throw new InternalError(`contract infer resolved no type for "${tableName}"."${columnName}".`);
113
- return type;
114
- };
115
- }
116
12
  const DEFAULT_FUNCTION_ATTRIBUTES = {
117
13
  "autoincrement()": "@default(autoincrement())",
118
14
  "now()": "@default(now())"
@@ -270,6 +166,15 @@ function writeScalar(value, column, surface) {
270
166
  return literalText(entry, text);
271
167
  }
272
168
  }
169
+ /**
170
+ * `value`, a value of `dataType` as `contract.json` stores it, written as the literal of a type that `dataType` takes, proven to read back as `value`: `255` for `pg/int4`, ``sql`"MyType"[]` `` for `sql/expression`. `undefined` when no literal reads back as it.
171
+ */
172
+ function writeDataTypeValue(value, dataType, support) {
173
+ return writeScalar(value, {
174
+ id: dataType,
175
+ params: {}
176
+ }, writingSurface(support));
177
+ }
273
178
  const DECIMAL_WITH_FRACTION = /^-?\d+\.\d+$/;
274
179
  function withoutTrailingFractionZeros(value) {
275
180
  if (typeof value !== "string" || !DECIMAL_WITH_FRACTION.test(value)) return void 0;
@@ -357,6 +262,116 @@ function sameForm(left, right) {
357
262
  return other !== void 0 && sameForm(member, other);
358
263
  });
359
264
  }
265
+ /** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */
266
+ function inferredTypeConstructors(input) {
267
+ const found = /* @__PURE__ */ new Map();
268
+ for (const { path, descriptor } of authoringTypeConstructors(input.authoringTypes)) {
269
+ if (descriptor.inferred !== true) continue;
270
+ const dataTypeId = input.codecLookup.descriptorFor(descriptor.output.codecId)?.dataType;
271
+ const dataType = dataTypeId === void 0 ? void 0 : input.dataTypeLookup.get(dataTypeId);
272
+ if (dataType === void 0 || !isSqlDataType(dataType)) continue;
273
+ found.set(dataType.id, {
274
+ path,
275
+ descriptor,
276
+ dataType
277
+ });
278
+ }
279
+ return found;
280
+ }
281
+ function normalParams(marked, args) {
282
+ try {
283
+ const { typeParams } = instantiateAuthoringTypeConstructor(marked.descriptor, args);
284
+ const params = dataTypeParams(marked.dataType, typeParams);
285
+ return canonicalizeJson(marked.dataType.sql.normalize(params));
286
+ } catch (error) {
287
+ if (isInternalError(error)) throw error;
288
+ return;
289
+ }
290
+ }
291
+ /**
292
+ * The call to `marked` with the fewest arguments that produces `params`, the normal form of a
293
+ * column's data type parameters: arguments are dropped from the end while the normal form of what
294
+ * the call produces stays `params`. Undefined when the constructor cannot produce them, such as one
295
+ * whose argument names another entity.
296
+ */
297
+ function fewestArgumentsCall(marked, params) {
298
+ const all = authoringTypeConstructorArguments(marked.descriptor, {
299
+ codecId: marked.descriptor.output.codecId,
300
+ typeParams: params
301
+ });
302
+ if (all === void 0) return void 0;
303
+ const wanted = canonicalizeJson(params);
304
+ const args = [...all];
305
+ while (args.length > 0 && normalParams(marked, args.slice(0, -1)) === wanted) args.pop();
306
+ return {
307
+ path: marked.path,
308
+ args
309
+ };
310
+ }
311
+ /**
312
+ * Each argument of a call to `descriptor` as PSL writes it: a value argument as a literal of its data type that reads back as the same value. `undefined` when an argument is not a value argument or no literal reads back as it.
313
+ */
314
+ function writtenTypeArguments(descriptor, args, dataTypes) {
315
+ const written = [];
316
+ for (const [index, value] of args.entries()) {
317
+ const argument = descriptor.args?.[index];
318
+ if (argument?.kind !== "value") return void 0;
319
+ const text = writeDataTypeValue(blindCast(value), dataTypeId(argument.dataType), dataTypes);
320
+ if (text === void 0) return void 0;
321
+ written.push(text);
322
+ }
323
+ return written;
324
+ }
325
+ /** The type the database reported for `column`, which introspection always records. */
326
+ function reportedTypeOf(column, tableName) {
327
+ if (column.reportedType === void 0) throw new InternalError(`contract infer read column "${tableName}"."${column.name}" without the type the database reported for it.`);
328
+ return column.reportedType;
329
+ }
330
+ function writtenCall(constructors, dataTypes, support, reported) {
331
+ const resolved = resolveReportedSqlType(reported, dataTypes);
332
+ const marked = resolved && constructors.get(resolved.dataType.id);
333
+ const call = resolved && marked && fewestArgumentsCall(marked, resolved.typeParams);
334
+ const args = call && marked && writtenTypeArguments(marked.descriptor, call.args, support);
335
+ return call && args && {
336
+ path: call.path,
337
+ args,
338
+ values: call.args
339
+ };
340
+ }
341
+ /**
342
+ * The type of every column of `tables` that `isEnumColumn` does not claim: the call, with the
343
+ * fewest arguments, to the constructor marked `inferred` for the data type that claims the
344
+ * column's reported type. When any column has no such call, throws
345
+ * `CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED` listing every one of them.
346
+ */
347
+ function inferColumnTypes(input) {
348
+ const dataTypes = [...input.constructors.values()].map((marked) => marked.dataType);
349
+ const types = /* @__PURE__ */ new Map();
350
+ const unclaimed = [];
351
+ for (const { schemaName, tableName, columns } of input.tables) for (const column of columns) {
352
+ if (input.isEnumColumn(column)) continue;
353
+ const reported = reportedTypeOf(column, tableName);
354
+ const call = writtenCall(input.constructors, dataTypes, input.dataTypes, reported);
355
+ if (call === void 0) {
356
+ unclaimed.push(`${schemaName}.${tableName}.${column.name}: ${reported.text}${column.many === true ? "[]" : ""}`);
357
+ continue;
358
+ }
359
+ types.set(JSON.stringify([tableName, column.name]), call);
360
+ }
361
+ if (unclaimed.length > 0) {
362
+ const columns = unclaimed.sort();
363
+ throw sqlFamilyError("CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED", ["contract infer: Prisma 8 cannot write these column types with the configured stack:", ...columns.map((line) => ` ${line}`)].join("\n"), {
364
+ why: "Prisma 8 reads a column type only through a data type that the target or an extension pack declares.",
365
+ fix: `No configured pack has a type for these columns. If a type comes from a database extension that has a Prisma 8 pack, add the pack to extensions in prisma.config.ts. Otherwise, to keep such a column, write the schema by hand and declare its field as Raw(sql\`<type>\`) with the type as listed, or change the column's type or remove the column from the database.`,
366
+ meta: { columns }
367
+ });
368
+ }
369
+ return (tableName, columnName) => {
370
+ const type = types.get(JSON.stringify([tableName, columnName]));
371
+ if (type === void 0) throw new InternalError(`contract infer resolved no type for "${tableName}"."${columnName}".`);
372
+ return type;
373
+ };
374
+ }
360
375
  const GENERATOR_PHASES = ["onCreate", "onUpdate"];
361
376
  /**
362
377
  * The generator function call that writes each phase of a column's generators, as `@onCreate(...)` and `@onUpdate(...)` take it. A call must resolve back to the stored generator, so a list column, a generator no function writes for the codec, and a call that reads back differently are refused.
@@ -407,6 +422,6 @@ function generatorCallsFor(input) {
407
422
  };
408
423
  }
409
424
  //#endregion
410
- export { mapDefault as a, inferredTypeConstructors as i, generatorCallsFor as n, pslTypeArgumentText as o, inferColumnTypes as r, writeDefaultLiteral as s, fewestArgumentsCall as t };
425
+ export { mapDefault as a, writtenTypeArguments as c, inferredTypeConstructors as i, generatorCallsFor as n, writeDataTypeValue as o, inferColumnTypes as r, writeDefaultLiteral as s, fewestArgumentsCall as t };
411
426
 
412
- //# sourceMappingURL=psl-build-BSZQ8lC1.mjs.map
427
+ //# sourceMappingURL=psl-build-D5VG40ej.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-build-D5VG40ej.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-build.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { s as toEnumMemberName } from \"./psl-names-C3cwe0rg.mjs\";\nimport { SQL_EXPRESSION_TAG } from \"@internal/sql-contract/sql-expression\";\nimport { authoringTypeConstructorArguments, authoringTypeConstructors, castTypedValue, instantiateAuthoringTypeConstructor, printTaggedLiteral, readWrittenValue } from \"@internal/framework-components/authoring\";\nimport { dataTypeId, dataTypeParams } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { isSqlDataType, numeralText, resolveReportedSqlType } from \"@internal/sql-contract/data-type\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { escapePslString } from \"@internal/sql-contract/data-type-support\";\n//#region src/core/psl-build/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\n/**\n* The attribute a stored default prints as: a named function, a literal the column takes, or any\n* other expression as a `sql` literal. `undefined` when a literal has no written form. An expression\n* prints even when the literal would read back as different text: default expressions are compared\n* with case and whitespace ignored (`SqlColumnDefaultIR.isEqualTo`), and canonicalization changes only\n* whitespace (ADR 129).\n*/\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": {\n\t\t\tconst text = writeDefaultLiteral(columnDefault.value, options);\n\t\t\treturn text === void 0 ? void 0 : { attribute: `@default(${text})` };\n\t\t}\n\t\tcase \"function\": return { attribute: options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? `@default(${printTaggedLiteral(SQL_EXPRESSION_TAG, columnDefault.expression)})` };\n\t}\n}\nfunction writingSurface(support) {\n\tconst entryOf = /* @__PURE__ */ new Map();\n\tconst tagTypes = [];\n\tfor (const [key, entry] of Object.entries(support.entries)) {\n\t\tconst written = entry.written;\n\t\tif (written.kind === \"tag\") {\n\t\t\tconst type = dataTypeId(key);\n\t\t\tif (!entryOf.has(type)) entryOf.set(type, entry);\n\t\t\ttagTypes.push(type);\n\t\t\tcontinue;\n\t\t}\n\t\tif (written.syntax === \"number\") {\n\t\t\tfor (const type of written.types) entryOf.set(type, entry);\n\t\t\tcontinue;\n\t\t}\n\t\tentryOf.set(key, entry);\n\t}\n\treturn {\n\t\tsupport,\n\t\tentryOf,\n\t\ttagTypes\n\t};\n}\nfunction readValue(surface, written) {\n\tconst read = readWrittenValue(surface.support, written);\n\treturn read.ok ? read.value : void 0;\n}\n/** The value of a tag's type that a stored document is, constructed by that type. */\nfunction tagValue(surface, type, value) {\n\ttry {\n\t\treturn surface.support.lookup.get(type)?.valueFrom(value, {});\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/**\n* Every value the stored form could be, in the order a written value would be read: a number or\n* numeral text through the number entry first, then the plain syntax that matches the shape, then\n* each tag, whose stored form is a whole document, which may itself be a number or a boolean.\n*/\nfunction classifications(value, surface) {\n\tconst found = [];\n\tif (typeof value === \"number\") found.push(readValue(surface, {\n\t\tkind: \"number\",\n\t\ttext: numeralText(value)\n\t}));\n\telse if (typeof value === \"boolean\") found.push(readValue(surface, {\n\t\tkind: \"boolean\",\n\t\tvalue\n\t}));\n\telse if (typeof value === \"string\") {\n\t\tfound.push(readValue(surface, {\n\t\t\tkind: \"number\",\n\t\t\ttext: value\n\t\t}));\n\t\tfound.push(readValue(surface, {\n\t\t\tkind: \"string\",\n\t\t\ttext: value\n\t\t}));\n\t}\n\tfor (const type of surface.tagTypes) found.push(tagValue(surface, type, value));\n\treturn found.filter((candidate) => candidate !== void 0);\n}\n/** What the column's type stores for `json` under the column's parameters, or `undefined` when it holds no such value. */\nfunction storedUnder(json, column, lookup) {\n\tconst type = lookup.get(column.id);\n\tif (type === void 0) return void 0;\n\ttry {\n\t\treturn type.toContract(type.valueFrom(json, column.params));\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/** The stored form the column takes this value as, spelled as its parameters give it, or `undefined` when its type takes no such value. */\nfunction admitted(candidate, column, surface) {\n\tconst cast = castTypedValue(surface.support, column.id, column.params, candidate);\n\treturn cast.ok ? cast.value.value : void 0;\n}\n/** The text of the literal: what the entry prints, before the syntax that fences it. */\nfunction printedText(entry, value) {\n\ttry {\n\t\treturn entry.print(value);\n\t} catch {\n\t\treturn;\n\t}\n}\n/** The printed text as the entry's syntax writes it, for reading back. */\nfunction writtenAs(entry, text) {\n\tconst written = entry.written;\n\tif (written.kind === \"tag\") return {\n\t\tkind: \"tag\",\n\t\ttag: written.tag,\n\t\ttext\n\t};\n\tif (written.syntax !== \"boolean\") return {\n\t\tkind: written.syntax,\n\t\ttext\n\t};\n\treturn text === \"true\" || text === \"false\" ? {\n\t\tkind: \"boolean\",\n\t\tvalue: text === \"true\"\n\t} : void 0;\n}\n/** What the printed text reads back as, through the same read a written value takes. */\nfunction readBack(surface, entry, text) {\n\tconst written = writtenAs(entry, text);\n\treturn written === void 0 ? void 0 : readValue(surface, written);\n}\nfunction literalText(entry, text) {\n\tconst written = entry.written;\n\tif (written.kind === \"tag\") return printTaggedLiteral(written.tag, text);\n\treturn written.syntax === \"string\" ? `\"${escapePslString(text)}\"` : text;\n}\n/**\n* The value written as the literal of one of its types, proven by reading the text straight back:\n* the same read, the same cast, and the stored form again. A number is tried first without the\n* trailing fraction zeros the column's scale spells it with.\n*/\nfunction writeScalar(value, column, surface) {\n\tconst shortest = withoutTrailingFractionZeros(value);\n\tconst candidates = [...shortest === void 0 ? [] : classifications(shortest, surface), ...classifications(value, surface)];\n\tfor (const candidate of candidates) {\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst stored = admitted(candidate, column, surface);\n\t\tif (stored === void 0 || !sameForm(stored, value)) continue;\n\t\tconst text = printedText(entry, candidate.value);\n\t\tif (text === void 0) continue;\n\t\tconst reread = readBack(surface, entry, text);\n\t\tif (reread === void 0) continue;\n\t\tconst restored = admitted(reread, column, surface);\n\t\tif (restored === void 0 || !sameForm(restored, value)) continue;\n\t\treturn literalText(entry, text);\n\t}\n}\n/**\n* `value`, a value of `dataType` as `contract.json` stores it, written as the literal of a type that `dataType` takes, proven to read back as `value`: `255` for `pg/int4`, ``sql`\"MyType\"[]` `` for `sql/expression`. `undefined` when no literal reads back as it.\n*/\nfunction writeDataTypeValue(value, dataType, support) {\n\treturn writeScalar(value, {\n\t\tid: dataType,\n\t\tparams: {}\n\t}, writingSurface(support));\n}\nconst DECIMAL_WITH_FRACTION = /^-?\\d+\\.\\d+$/;\nfunction withoutTrailingFractionZeros(value) {\n\tif (typeof value !== \"string\" || !DECIMAL_WITH_FRACTION.test(value)) return void 0;\n\tconst shortened = value.replace(/0+$/, \"\").replace(/\\.$/, \"\");\n\treturn shortened === value ? void 0 : shortened;\n}\n/** One written element of a list, printed as a value of any type, with no column type to admit it. */\nfunction writeElement(value, of, surface) {\n\tfor (const candidate of classifications(value, surface)) {\n\t\tif (!of.includes(candidate.type)) continue;\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst text = printedText(entry, candidate.value);\n\t\tif (text === void 0) continue;\n\t\tconst reread = readBack(surface, entry, text);\n\t\tif (reread === void 0 || !of.includes(reread.type)) continue;\n\t\treturn {\n\t\t\ttext: literalText(entry, text),\n\t\t\tvalue: reread.value\n\t\t};\n\t}\n}\n/**\n* A written list on a scalar column, which the column type's list cast turns into its one value,\n* constructed by the column's type. Each element is classified on its own and must be of a type the\n* cast takes.\n*/\nfunction writeListCast(value, column, surface) {\n\tconst listCast = surface.support.lookup.get(column.id)?.listCast;\n\tif (listCast === void 0) return void 0;\n\tconst parts = [];\n\tconst elements = [];\n\tfor (const element of value) {\n\t\tconst written = writeElement(element, listCast.of, surface);\n\t\tif (written === void 0) return void 0;\n\t\tparts.push(written.text);\n\t\telements.push(written.value);\n\t}\n\tlet cast;\n\ttry {\n\t\tcast = listCast.cast(elements);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n\tconst stored = storedUnder(cast, column, surface.support.lookup);\n\treturn stored !== void 0 && sameForm(stored, value) ? `[${parts.join(\", \")}]` : void 0;\n}\n/** The PSL literal a stored value is written as for the column `options` describe, or `undefined` when it has no written form that reads back as that value. */\nfunction writeDefaultLiteral(value, options) {\n\tif (value instanceof Date) return void 0;\n\tconst { dataTypes, columnCodec } = options ?? {};\n\tif (dataTypes === void 0 || columnCodec === void 0) return void 0;\n\tconst { lookup } = dataTypes;\n\tconst columnDataType = columnCodec.dataType;\n\tconst columnType = lookup.get(columnDataType);\n\tconst column = {\n\t\tid: columnDataType,\n\t\tparams: columnType === void 0 ? {} : dataTypeParams(columnType, options?.typeParams)\n\t};\n\tconst surface = writingSurface(dataTypes);\n\tif (options?.list === true) {\n\t\tif (!Array.isArray(value)) return void 0;\n\t\tconst parts = [];\n\t\tfor (const element of value) {\n\t\t\tconst written = writeScalar(element, column, surface);\n\t\t\tif (written === void 0) return void 0;\n\t\t\tparts.push(written);\n\t\t}\n\t\treturn `[${parts.join(\", \")}]`;\n\t}\n\tconst written = writeScalar(value, column, surface);\n\tif (written !== void 0) return written;\n\treturn Array.isArray(value) ? writeListCast(value, column, surface) : void 0;\n}\n/** Whether two stored forms are the same JSON value, member by member and element by element. */\nfunction sameForm(left, right) {\n\tif (left === right) return true;\n\tif (Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (typeof left !== \"object\" || typeof right !== \"object\" || left === null || right === null) return false;\n\tconst members = Object.entries(left);\n\tconst others = new Map(Object.entries(right));\n\treturn members.length === others.size && members.every(([key, member]) => {\n\t\tconst other = others.get(key);\n\t\treturn other !== void 0 && sameForm(member, other);\n\t});\n}\n//#endregion\n//#region src/core/psl-build/inferred-type-constructors.ts\n/** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */\nfunction inferredTypeConstructors(input) {\n\tconst found = /* @__PURE__ */ new Map();\n\tfor (const { path, descriptor } of authoringTypeConstructors(input.authoringTypes)) {\n\t\tif (descriptor.inferred !== true) continue;\n\t\tconst dataTypeId = input.codecLookup.descriptorFor(descriptor.output.codecId)?.dataType;\n\t\tconst dataType = dataTypeId === void 0 ? void 0 : input.dataTypeLookup.get(dataTypeId);\n\t\tif (dataType === void 0 || !isSqlDataType(dataType)) continue;\n\t\tfound.set(dataType.id, {\n\t\t\tpath,\n\t\t\tdescriptor,\n\t\t\tdataType\n\t\t});\n\t}\n\treturn found;\n}\nfunction normalParams(marked, args) {\n\ttry {\n\t\tconst { typeParams } = instantiateAuthoringTypeConstructor(marked.descriptor, args);\n\t\tconst params = dataTypeParams(marked.dataType, typeParams);\n\t\treturn canonicalizeJson(marked.dataType.sql.normalize(params));\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/**\n* The call to `marked` with the fewest arguments that produces `params`, the normal form of a\n* column's data type parameters: arguments are dropped from the end while the normal form of what\n* the call produces stays `params`. Undefined when the constructor cannot produce them, such as one\n* whose argument names another entity.\n*/\nfunction fewestArgumentsCall(marked, params) {\n\tconst all = authoringTypeConstructorArguments(marked.descriptor, {\n\t\tcodecId: marked.descriptor.output.codecId,\n\t\ttypeParams: params\n\t});\n\tif (all === void 0) return void 0;\n\tconst wanted = canonicalizeJson(params);\n\tconst args = [...all];\n\twhile (args.length > 0 && normalParams(marked, args.slice(0, -1)) === wanted) args.pop();\n\treturn {\n\t\tpath: marked.path,\n\t\targs\n\t};\n}\n/**\n* Each argument of a call to `descriptor` as PSL writes it: a value argument as a literal of its data type that reads back as the same value. `undefined` when an argument is not a value argument or no literal reads back as it.\n*/\nfunction writtenTypeArguments(descriptor, args, dataTypes) {\n\tconst written = [];\n\tfor (const [index, value] of args.entries()) {\n\t\tconst argument = descriptor.args?.[index];\n\t\tif (argument?.kind !== \"value\") return void 0;\n\t\tconst text = writeDataTypeValue(blindCast(value), dataTypeId(argument.dataType), dataTypes);\n\t\tif (text === void 0) return void 0;\n\t\twritten.push(text);\n\t}\n\treturn written;\n}\n//#endregion\n//#region src/core/psl-build/column-types.ts\n/** The type the database reported for `column`, which introspection always records. */\nfunction reportedTypeOf(column, tableName) {\n\tif (column.reportedType === void 0) throw new InternalError(`contract infer read column \"${tableName}\".\"${column.name}\" without the type the database reported for it.`);\n\treturn column.reportedType;\n}\nfunction writtenCall(constructors, dataTypes, support, reported) {\n\tconst resolved = resolveReportedSqlType(reported, dataTypes);\n\tconst marked = resolved && constructors.get(resolved.dataType.id);\n\tconst call = resolved && marked && fewestArgumentsCall(marked, resolved.typeParams);\n\tconst args = call && marked && writtenTypeArguments(marked.descriptor, call.args, support);\n\treturn call && args && {\n\t\tpath: call.path,\n\t\targs,\n\t\tvalues: call.args\n\t};\n}\n/**\n* The type of every column of `tables` that `isEnumColumn` does not claim: the call, with the\n* fewest arguments, to the constructor marked `inferred` for the data type that claims the\n* column's reported type. When any column has no such call, throws\n* `CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED` listing every one of them.\n*/\nfunction inferColumnTypes(input) {\n\tconst dataTypes = [...input.constructors.values()].map((marked) => marked.dataType);\n\tconst types = /* @__PURE__ */ new Map();\n\tconst unclaimed = [];\n\tfor (const { schemaName, tableName, columns } of input.tables) for (const column of columns) {\n\t\tif (input.isEnumColumn(column)) continue;\n\t\tconst reported = reportedTypeOf(column, tableName);\n\t\tconst call = writtenCall(input.constructors, dataTypes, input.dataTypes, reported);\n\t\tif (call === void 0) {\n\t\t\tunclaimed.push(`${schemaName}.${tableName}.${column.name}: ${reported.text}${column.many === true ? \"[]\" : \"\"}`);\n\t\t\tcontinue;\n\t\t}\n\t\ttypes.set(JSON.stringify([tableName, column.name]), call);\n\t}\n\tif (unclaimed.length > 0) {\n\t\tconst columns = unclaimed.sort();\n\t\tthrow sqlFamilyError(\"CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED\", [\"contract infer: Prisma 8 cannot write these column types with the configured stack:\", ...columns.map((line) => ` ${line}`)].join(\"\\n\"), {\n\t\t\twhy: \"Prisma 8 reads a column type only through a data type that the target or an extension pack declares.\",\n\t\t\tfix: `No configured pack has a type for these columns. If a type comes from a database extension that has a Prisma 8 pack, add the pack to extensions in prisma.config.ts. Otherwise, to keep such a column, write the schema by hand and declare its field as Raw(sql\\`<type>\\`) with the type as listed, or change the column's type or remove the column from the database.`,\n\t\t\tmeta: { columns }\n\t\t});\n\t}\n\treturn (tableName, columnName) => {\n\t\tconst type = types.get(JSON.stringify([tableName, columnName]));\n\t\tif (type === void 0) throw new InternalError(`contract infer resolved no type for \"${tableName}\".\"${columnName}\".`);\n\t\treturn type;\n\t};\n}\n//#endregion\n//#region src/core/psl-build/generator-calls.ts\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generator function call that writes each phase of a column's generators, as `@onCreate(...)` and `@onUpdate(...)` take it. A call must resolve back to the stored generator, so a list column, a generator no function writes for the codec, and a call that reads back differently are refused.\n*/\nfunction generatorCallsFor(input) {\n\tconst { executionDefault, field, list, generatorFunctions } = input;\n\tconst calls = [];\n\tfor (const phase of GENERATOR_PHASES) {\n\t\tconst generator = executionDefault[phase];\n\t\tif (generator === void 0) continue;\n\t\tif (list) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"on-list\",\n\t\t\t\tphase,\n\t\t\t\tgenerator\n\t\t\t}\n\t\t};\n\t\tconst printed = generatorFunctions.callFor(generator, field);\n\t\tif (printed === void 0) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"no-function\",\n\t\t\t\tphase,\n\t\t\t\tgenerator\n\t\t\t}\n\t\t};\n\t\tconst readBack = generatorFunctions.resolve(printed.call, field);\n\t\tif (!readBack.ok || canonicalizeJson(readBack.generator) !== canonicalizeJson(generator)) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"reads-back-differently\",\n\t\t\t\tphase,\n\t\t\t\tgenerator,\n\t\t\t\ttext: printed.text,\n\t\t\t\treadBack: readBack.ok ? readBack.generator : void 0,\n\t\t\t\trefusedBecause: !readBack.ok && readBack.reason === \"refused\" ? readBack.message : void 0\n\t\t\t}\n\t\t};\n\t\tcalls.push({\n\t\t\tphase,\n\t\t\ttext: printed.text\n\t\t});\n\t}\n\treturn {\n\t\tok: true,\n\t\tcalls\n\t};\n}\n//#endregion\nexport { fewestArgumentsCall, generatorCallsFor, inferColumnTypes, inferredTypeConstructors, mapDefault, toEnumMemberName, writeDataTypeValue, writeDefaultLiteral, writtenTypeArguments };\n\n//# sourceMappingURL=psl-build.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,8BAA8B;CACnC,mBAAmB;CACnB,SAAS;AACV;;;;;;;;AAQA,SAAS,WAAW,eAAe,SAAS;CAC3C,QAAQ,cAAc,MAAtB;EACC,KAAK,WAAW;GACf,MAAM,OAAO,oBAAoB,cAAc,OAAO,OAAO;GAC7D,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,EAAE,WAAW,YAAY,KAAK,GAAG;EACpE;EACA,KAAK,YAAY,OAAO,EAAE,WAAW,SAAS,qBAAqB,cAAc,eAAe,4BAA4B,cAAc,eAAe,YAAY,mBAAA,OAAuC,cAAc,UAAU,EAAE,GAAG;CAC1O;AACD;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,0BAA0B,IAAI,IAAI;CACxC,MAAM,WAAW,CAAC;CAClB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,OAAO,GAAG;EAC3D,MAAM,UAAU,MAAM;EACtB,IAAI,QAAQ,SAAS,OAAO;GAC3B,MAAM,OAAO,WAAW,GAAG;GAC3B,IAAI,CAAC,QAAQ,IAAI,IAAI,GAAG,QAAQ,IAAI,MAAM,KAAK;GAC/C,SAAS,KAAK,IAAI;GAClB;EACD;EACA,IAAI,QAAQ,WAAW,UAAU;GAChC,KAAK,MAAM,QAAQ,QAAQ,OAAO,QAAQ,IAAI,MAAM,K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,GAAG,MAAM,IAAI,cAAc,wCAAwC,UAAU,KAAK,WAAW,GAAG;EAClH,OAAO;CACR;AACD;AAGA,MAAM,mBAAmB,CAAC,YAAY,UAAU;;;;AAIhD,SAAS,kBAAkB,OAAO;CACjC,MAAM,EAAE,kBAAkB,OAAO,MAAM,uBAAuB;CAC9D,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,SAAS,kBAAkB;EACrC,MAAM,YAAY,iBAAiB;EACnC,IAAI,cAAc,KAAK,GAAG;EAC1B,IAAI,MAAM,OAAO;GAChB,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;GACD;EACD;EACA,MAAM,UAAU,mBAAmB,QAAQ,WAAW,KAAK;EAC3D,IAAI,YAAY,KAAK,GAAG,OAAO;GAC9B,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;GACD;EACD;EACA,MAAM,WAAW,mBAAmB,QAAQ,QAAQ,MAAM,KAAK;EAC/D,IAAI,CAAC,SAAS,MAAM,iBAAiB,SAAS,SAAS,MAAM,iBAAiB,SAAS,GAAG,OAAO;GAChG,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;IACA,MAAM,QAAQ;IACd,UAAU,SAAS,KAAK,SAAS,YAAY,KAAK;IAClD,gBAAgB,CAAC,SAAS,MAAM,SAAS,WAAW,YAAY,SAAS,UAAU,KAAK;GACzF;EACD;EACA,MAAM,KAAK;GACV;GACA,MAAM,QAAQ;EACf,CAAC;CACF;CACA,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
@@ -1,10 +1,10 @@
1
- import "./contract-builder-Di-2-fFO.mjs";
2
- import { AuthoringTypeConstructorDescriptor } from "@prisma/orm-framework/components/authoring";
1
+ import "./contract-builder-DZSUqbp0.mjs";
2
+ import { AuthoringTypeConstructorDescriptor, DataTypeSupport } from "@prisma/orm-framework/components/authoring";
3
3
  import { CodecLookupWithDescriptors } from "@prisma/orm-framework/components/codec";
4
4
  import { ColumnDefault, ExecutionMutationDefaultPhases, ValueSetRef } from "@prisma/orm-framework/contract/types";
5
5
  import "@prisma/orm-framework/components/control";
6
6
  import { Binder } from "@prisma/orm-framework/psl-parser";
7
- //#region ../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-DNdqpUxt.d.mts
7
+ //#region ../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-BgThghdu.d.mts
8
8
  //#region src/psl-column-resolution.d.ts
9
9
  type ColumnDescriptor = {
10
10
  readonly codecId: string;
@@ -22,4 +22,4 @@ type ColumnDescriptor = {
22
22
  };
23
23
  //#endregion
24
24
  export { ColumnDescriptor as t };
25
- //# sourceMappingURL=psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts.map
25
+ //# sourceMappingURL=psl-column-resolution-BgThghdu-BWaFlWYV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-column-resolution-BgThghdu-BWaFlWYV.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-BgThghdu.d.mts"],"mappings":";;;;;;;;KASK;WACM;WACA;WACA,aAAa;;;;;;;;;WASb,WAAW"}
@@ -2,7 +2,7 @@ import { u as sqlCodecColumnLength } from "./sql-data-type-D7M-YTTY-C9oWGZ3z.mjs
2
2
  import { p as sqlTextFromStored, t as SQL_EXPRESSION_DATA_TYPE_ID } from "./sql-expression-BJCuy-WI.mjs";
3
3
  import { d as resolvedTypeParams } from "./types-M_FeBD9w.mjs";
4
4
  import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-Cfy0jmZ2.mjs";
5
- import { a as storedAsListColumn, i as isValueObjectMember } from "./derived-checks-CwbSfZ8d-B91zqK6B.mjs";
5
+ import { a as storedAsListColumn, i as isValueObjectMember } from "./derived-checks-CXW9ytkb-B_zxX1-8.mjs";
6
6
  import { n as getAttribute, o as storageName, t as formatDbAttributeMigrationMessage } from "./psl-attribute-parsing-BCsFWsSp-LaNsbcrw.mjs";
7
7
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
8
8
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -16,7 +16,7 @@ import { notOk, ok } from "@prisma/orm-framework/utils/result";
16
16
  import { describeTaggedLiteralFailure as describeTaggedLiteralFailure$1 } from "@prisma/orm-framework/components/control";
17
17
  import { bool, contributedTypeOf, dataTypeValue, diagnosticSource, entityRef, fieldAttribute, fieldRef, funcCall, generatorAttributeSpec, identifier, interpretAttribute, leafDiagnostic, list, mapArg, modelAttribute, nodePslSpan, nodeSourceText, numLiteral, oneOf, optional, record, referencedFieldRef, str, taggedLiteral, typeReferenceNode, writtenList, writtenScalar } from "@prisma/orm-framework/psl-parser";
18
18
  import { instantiatePslFieldPreset, isBareTypeConstructor, mapPslHelperArgs, reportPresetNotCalled, reportTypeConstructorNotCalled } from "@prisma/orm-framework/psl-parser/interpret";
19
- //#region ../../../2-sql/2-authoring/contract-psl/dist/psl-field-resolution-BLtSah2i.mjs
19
+ //#region ../../../2-sql/2-authoring/contract-psl/dist/psl-field-resolution-DpGsATq3.mjs
20
20
  function contractError(code, message, options) {
21
21
  return structuredError(code, message, options);
22
22
  }
@@ -1028,7 +1028,8 @@ function instantiatePslTypeConstructor(input) {
1028
1028
  span: input.call.span,
1029
1029
  diagnostics: input.diagnostics,
1030
1030
  source: input.source,
1031
- entityLabel: input.entityLabel
1031
+ entityLabel: input.entityLabel,
1032
+ dataTypes: input.dataTypes
1032
1033
  });
1033
1034
  if (!args) return;
1034
1035
  let output;
@@ -1157,7 +1158,8 @@ function instantiateFieldTypeConstructor(input) {
1157
1158
  codecLookup: input.codecLookup,
1158
1159
  diagnostics: input.diagnostics,
1159
1160
  source: input.source,
1160
- entityLabel: input.entityLabel
1161
+ entityLabel: input.entityLabel,
1162
+ dataTypes: input.dataTypes
1161
1163
  });
1162
1164
  return instantiated === void 0 ? NOT_RESOLVED : {
1163
1165
  ok: true,
@@ -1242,7 +1244,8 @@ function resolveFieldTypeDescriptor(input) {
1242
1244
  codecLookup: input.codecLookup,
1243
1245
  diagnostics,
1244
1246
  source,
1245
- entityLabel
1247
+ entityLabel,
1248
+ dataTypes: input.dataTypes
1246
1249
  });
1247
1250
  }
1248
1251
  if (call !== void 0) return instantiateFieldTypeConstructor({
@@ -1731,7 +1734,8 @@ function collectResolvedFields(input) {
1731
1734
  ...ifDefined("namespaceId", namespaceId),
1732
1735
  ...ifDefined("namespaceExtensionEntities", namespaceExtensionEntities),
1733
1736
  binder,
1734
- codecLookup
1737
+ codecLookup,
1738
+ dataTypes
1735
1739
  };
1736
1740
  if (isValueObjectField) {
1737
1741
  if (valueObjectStorageTypeName === void 0) {
@@ -1941,4 +1945,4 @@ function mergeExecutionDefaults(fromAttributes, fromPreset) {
1941
1945
  //#endregion
1942
1946
  export { readDataTypeDefault as _, defaultFunctionCall as a, sqlAttributeSpecs as b, getAuthoringEntity as c, interpretFieldAttribute as d, interpretModelAttribute as f, modelSpecContext as g, modelCoordinateKey as h, contractError as i, instantiateFieldTypeConstructor as l, modelAttributeSpecsFrom as m, bareTypeConstructorOf as n, describeUnsupportedSqlAttribute as o, lowerDataTypeDefault as p, collectResolvedFields as r, fieldSpecContext as s, PSL_CHECK_ON_STI_VARIANT as t, instantiatePslTypeConstructor as u, readWrittenValueForCodec as v, toNamedTypeFieldDescriptor as x, resolveFieldTypeDescriptor as y };
1943
1947
 
1944
- //# sourceMappingURL=psl-field-resolution-BLtSah2i-BuuJ5H70.mjs.map
1948
+ //# sourceMappingURL=psl-field-resolution-DpGsATq3-BREG9FbU.mjs.map