@prisma/orm-family-sql 8.0.0-rc.11-dev.42 → 8.0.0-rc.11-dev.44
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.
- package/dist/{ast-BHZ0g4iL.d.mts → ast-d2-iNoEs.d.mts} +72 -10
- package/dist/ast-d2-iNoEs.d.mts.map +1 -0
- package/dist/{ast-C8jX7HNs.mjs → ast-um6jG7BL.mjs} +129 -8
- package/dist/ast-um6jG7BL.mjs.map +1 -0
- package/dist/{authoring-type-constructors-C1ogrr_x-BeSS93gc.mjs → authoring-type-constructors-C1ogrr_x-VWDkCaSq.mjs} +2 -2
- package/dist/{authoring-type-constructors-C1ogrr_x-BeSS93gc.mjs.map → authoring-type-constructors-C1ogrr_x-VWDkCaSq.mjs.map} +1 -1
- package/dist/builder.d.mts +2 -2
- package/dist/builder__runtime.d.mts +8 -8
- package/dist/builder__types.d.mts +2 -2
- package/dist/{config-types-C-rrJ_8P.d.mts → config-types-Bd3ud-mX.d.mts} +3 -3
- package/dist/{config-types-C-rrJ_8P.d.mts.map → config-types-Bd3ud-mX.d.mts.map} +1 -1
- package/dist/{config-types-B98UYjF0.mjs → config-types-fwqTEhK6.mjs} +2 -2
- package/dist/{config-types-B98UYjF0.mjs.map → config-types-fwqTEhK6.mjs.map} +1 -1
- package/dist/{contract-builder-DV-DZX4h.d.mts → contract-builder-BHCjHphC.d.mts} +12 -5
- package/dist/{contract-builder-DV-DZX4h.d.mts.map → contract-builder-BHCjHphC.d.mts.map} +1 -1
- package/dist/{contract-builder-BCqPVNbs.mjs → contract-builder-BgWPuVYv.mjs} +2 -2
- package/dist/{contract-builder-BCqPVNbs.mjs.map → contract-builder-BgWPuVYv.mjs.map} +1 -1
- package/dist/contract-prisma7__provider.d.mts +1 -1
- package/dist/contract-prisma7__provider.mjs +118 -48
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +10 -6
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +9 -7
- package/dist/contract-psl__attribute-specs.d.mts.map +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__provider.d.mts +1 -1
- package/dist/contract-psl__provider.mjs +3 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +3 -3
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.d.mts +1 -1
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +2 -2
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +5 -5
- package/dist/contract__factories.d.mts +1 -1
- package/dist/contract__index-type-validation.d.mts +1 -1
- package/dist/contract__types.d.mts +2 -2
- package/dist/contract__validators.d.mts +1 -1
- package/dist/{control-C9oCqe39.d.mts → control-D7O180pB.d.mts} +21 -18
- package/dist/control-D7O180pB.d.mts.map +1 -0
- package/dist/{control-Cijy1SHG.mjs → control-FOipY3kl.mjs} +11 -6
- package/dist/{control-Cijy1SHG.mjs.map → control-FOipY3kl.mjs.map} +1 -1
- package/dist/{control-adapter-C99J7aEF-B2G4GA5s.d.mts → control-adapter-C99J7aEF-DwFChl8n.d.mts} +8 -8
- package/dist/{control-adapter-C99J7aEF-B2G4GA5s.d.mts.map → control-adapter-C99J7aEF-DwFChl8n.d.mts.map} +1 -1
- package/dist/control-adapter-DPWKLNdH.d.mts +1 -0
- package/dist/{db-BhQdL6Za-Dod07quT.d.mts → db-BhQdL6Za-BBgu_awF.d.mts} +8 -8
- package/dist/{db-BhQdL6Za-Dod07quT.d.mts.map → db-BhQdL6Za-BBgu_awF.d.mts.map} +1 -1
- package/dist/{ddl-types-BGdnAbXo-DKPHPUGx.mjs → ddl-types-DOgOmDOh-Cs_MY05h.mjs} +2 -2
- package/dist/{ddl-types-BGdnAbXo-DKPHPUGx.mjs.map → ddl-types-DOgOmDOh-Cs_MY05h.mjs.map} +1 -1
- package/dist/{ddl-types-Biy7miT--CSyPnOHq.d.mts → ddl-types-DrK8E0jL-ClX_UkVh.d.mts} +4 -4
- package/dist/{ddl-types-Biy7miT--CSyPnOHq.d.mts.map → ddl-types-DrK8E0jL-ClX_UkVh.d.mts.map} +1 -1
- package/dist/{derived-checks-C4BPtrnO-B9MQRh6W.mjs → derived-checks-6WZKIUxH-B3Pd6QA5.mjs} +30 -12
- package/dist/derived-checks-6WZKIUxH-B3Pd6QA5.mjs.map +1 -0
- package/dist/{derived-checks-DPdD01O0-DCKdvxNK.d.mts → derived-checks-DPdD01O0-DNBs1ZDA.d.mts} +2 -2
- package/dist/{derived-checks-DPdD01O0-DCKdvxNK.d.mts.map → derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map} +1 -1
- package/dist/{diff-CwozLSiO.d.mts → diff-C9tzE_nE.d.mts} +7 -7
- package/dist/{diff-CwozLSiO.d.mts.map → diff-C9tzE_nE.d.mts.map} +1 -1
- package/dist/{expression-CTADTPZW.d.mts → expression-CAJjmssr.d.mts} +6 -6
- package/dist/{expression-CTADTPZW.d.mts.map → expression-CAJjmssr.d.mts.map} +1 -1
- package/dist/{factories-B9PfKd5k.d.mts → factories-P3qBQhO-.d.mts} +2 -2
- package/dist/{factories-B9PfKd5k.d.mts.map → factories-P3qBQhO-.d.mts.map} +1 -1
- package/dist/family.d.mts +11 -11
- package/dist/family.mjs +2 -2
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +4 -4
- package/dist/family__control.mjs +1 -1
- package/dist/family__diff.d.mts +2 -2
- package/dist/family__ir.d.mts +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +2 -2
- package/dist/family__pack.d.mts.map +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-infer.d.mts +1 -1
- package/dist/family__psl-infer.mjs +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/{index-C6_--MKi.d.mts → index-CLAshwKN.d.mts} +3 -3
- package/dist/{index-C6_--MKi.d.mts.map → index-CLAshwKN.d.mts.map} +1 -1
- package/dist/{index-CA_WLNy1.d.mts → index-DI6YpxCw.d.mts} +10 -10
- package/dist/{index-CA_WLNy1.d.mts.map → index-DI6YpxCw.d.mts.map} +1 -1
- package/dist/{index-type-validation-BFiTwZub.d.mts → index-type-validation-CZ5L2lli.d.mts} +2 -2
- package/dist/{index-type-validation-BFiTwZub.d.mts.map → index-type-validation-CZ5L2lli.d.mts.map} +1 -1
- package/dist/{interpreter-Bf7Um__3-DC_thY44.mjs → interpreter-BIBwrA2w-DAiNN30m.mjs} +568 -181
- package/dist/interpreter-BIBwrA2w-DAiNN30m.mjs.map +1 -0
- package/dist/{ir-CodnAisu.d.mts → ir-BJ-dsbe-.d.mts} +2 -2
- package/dist/{ir-CodnAisu.d.mts.map → ir-BJ-dsbe-.d.mts.map} +1 -1
- package/dist/{middleware-0yjzaoBT-BqmCD6Dt.d.mts → middleware-CHg6zJkn-DJAKnDpd.d.mts} +3 -3
- package/dist/{middleware-0yjzaoBT-BqmCD6Dt.d.mts.map → middleware-CHg6zJkn-DJAKnDpd.d.mts.map} +1 -1
- package/dist/middleware-wyJe8dVq.d.mts +1 -0
- package/dist/{migration-CniGZoFt.d.mts → migration-BQWwBE8Q.d.mts} +3 -3
- package/dist/{migration-CniGZoFt.d.mts.map → migration-BQWwBE8Q.d.mts.map} +1 -1
- package/dist/operations.d.mts +1 -1
- package/dist/orm-client.d.mts +13 -13
- package/dist/orm-client.mjs +1 -1
- package/dist/{plan-Bs-Pdirc-BCy94--G.d.mts → plan-DVkrl9Pq-DOf_eQ84.d.mts} +4 -4
- package/dist/plan-DVkrl9Pq-DOf_eQ84.d.mts.map +1 -0
- package/dist/plan-Dzq6Nwb4.d.mts +2 -0
- package/dist/{prepared-statement-DZtymlzd-DFIuG_WK.d.mts → prepared-statement-DZtymlzd-DmbP44p0.d.mts} +15 -15
- package/dist/{prepared-statement-DZtymlzd-DFIuG_WK.d.mts.map → prepared-statement-DZtymlzd-DmbP44p0.d.mts.map} +1 -1
- package/dist/{psl-infer-6p4x9ebN.mjs → psl-infer-BAbdN_ZR.mjs} +195 -13
- package/dist/psl-infer-BAbdN_ZR.mjs.map +1 -0
- package/dist/{psl-infer-CLZsT2Hz.d.mts → psl-infer-DQCWvJtk.d.mts} +16 -3
- package/dist/psl-infer-DQCWvJtk.d.mts.map +1 -0
- package/dist/{query-lane-context-QIUURgPP-CvQ9jQRm.d.mts → query-lane-context-BUNC86DS-C_hIrqaW.d.mts} +6 -6
- package/dist/{query-lane-context-QIUURgPP-CvQ9jQRm.d.mts.map → query-lane-context-BUNC86DS-C_hIrqaW.d.mts.map} +1 -1
- package/dist/query-lane-context-CeOxBL6I.d.mts +1 -0
- package/dist/relational-core.d.mts +12 -12
- package/dist/relational-core.mjs +3 -3
- package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
- package/dist/relational-core__ast.d.mts +4 -4
- package/dist/relational-core__ast.mjs +3 -3
- package/dist/relational-core__codec-descriptor-registry.d.mts +3 -3
- package/dist/relational-core__contract-free.d.mts +3 -3
- package/dist/relational-core__contract-free.mjs +1 -1
- package/dist/relational-core__contract-free.mjs.map +1 -1
- package/dist/relational-core__expression.d.mts +1 -1
- package/dist/relational-core__middleware.d.mts +2 -2
- package/dist/relational-core__plan.d.mts +3 -3
- package/dist/relational-core__query-lane-context.d.mts +2 -2
- package/dist/relational-core__types.d.mts +2 -2
- package/dist/{runtime-gCSNgykk.d.mts → runtime-BqAUXvAl.d.mts} +3 -3
- package/dist/{runtime-gCSNgykk.d.mts.map → runtime-BqAUXvAl.d.mts.map} +1 -1
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +1 -1
- package/dist/runtime__internal__prepared-query.d.mts +1 -1
- package/dist/{schema-differ-DpG_gnur-DrAcUO68.d.mts → schema-differ-DpG_gnur-CXVM1Oed.d.mts} +4 -4
- package/dist/{schema-differ-DpG_gnur-DrAcUO68.d.mts.map → schema-differ-DpG_gnur-CXVM1Oed.d.mts.map} +1 -1
- package/dist/schema-ir.d.mts +1 -1
- package/dist/schema-ir__types.d.mts +2 -2
- package/dist/{sql-attribute-specs-DAEpjrWl-C0kmaUJt.mjs → sql-attribute-specs-BH0U6i1B-Ces5ZCvv.mjs} +37 -23
- package/dist/sql-attribute-specs-BH0U6i1B-Ces5ZCvv.mjs.map +1 -0
- package/dist/{sql-execution-plan-S3HvDKIP-8KF1nBHu.d.mts → sql-execution-plan-DBvAsaOB-LUMcfRpN.d.mts} +3 -3
- package/dist/sql-execution-plan-DBvAsaOB-LUMcfRpN.d.mts.map +1 -0
- package/dist/{types-BDUG29Df-DRoC4zw1.d.mts → types-BDUG29Df-LE85dIXP.d.mts} +2 -2
- package/dist/{types-BDUG29Df-DRoC4zw1.d.mts.map → types-BDUG29Df-LE85dIXP.d.mts.map} +1 -1
- package/dist/{types-BFPRCYGW-CvvVz-AC.d.mts → types-BFPRCYGW-CBv60DKI.d.mts} +7 -7
- package/dist/{types-BFPRCYGW-CvvVz-AC.d.mts.map → types-BFPRCYGW-CBv60DKI.d.mts.map} +1 -1
- package/dist/{types-CRU1CBUk-CR2_opbw.d.mts → types-BLVS175T-DmpY58Nx.d.mts} +9 -9
- package/dist/{types-CRU1CBUk-CR2_opbw.d.mts.map → types-BLVS175T-DmpY58Nx.d.mts.map} +1 -1
- package/dist/types-BijNazlM.d.mts +1 -0
- package/dist/{types-BmgtemBx.d.mts → types-C36_3E6_.d.mts} +2 -2
- package/dist/{types-BmgtemBx.d.mts.map → types-C36_3E6_.d.mts.map} +1 -1
- package/dist/{types-CHOgKgHg-DMlDrQz6.d.mts → types-CHOgKgHg-BxgkL3GS.d.mts} +2 -2
- package/dist/{types-CHOgKgHg-DMlDrQz6.d.mts.map → types-CHOgKgHg-BxgkL3GS.d.mts.map} +1 -1
- package/dist/types-CQ8FfvRk.d.mts +1 -0
- package/dist/{types-BXSw7th1-pL1Iggyd.d.mts → types-YGX78yVc-BBy1pp_1.d.mts} +7 -5
- package/dist/types-YGX78yVc-BBy1pp_1.d.mts.map +1 -0
- package/dist/{validators-DvtOcB04.d.mts → validators-CJSyNFS4.d.mts} +2 -2
- package/dist/{validators-DvtOcB04.d.mts.map → validators-CJSyNFS4.d.mts.map} +1 -1
- package/package.json +18 -18
- package/dist/ast-BHZ0g4iL.d.mts.map +0 -1
- package/dist/ast-C8jX7HNs.mjs.map +0 -1
- package/dist/control-C9oCqe39.d.mts.map +0 -1
- package/dist/control-adapter-Bx5ZQKj-.d.mts +0 -1
- package/dist/derived-checks-C4BPtrnO-B9MQRh6W.mjs.map +0 -1
- package/dist/interpreter-Bf7Um__3-DC_thY44.mjs.map +0 -1
- package/dist/middleware-Di3_d2T5.d.mts +0 -1
- package/dist/plan-BEJGOQ-l.d.mts +0 -2
- package/dist/plan-Bs-Pdirc-BCy94--G.d.mts.map +0 -1
- package/dist/psl-infer-6p4x9ebN.mjs.map +0 -1
- package/dist/psl-infer-CLZsT2Hz.d.mts.map +0 -1
- package/dist/query-lane-context-yy5kDAlG.d.mts +0 -1
- package/dist/sql-attribute-specs-DAEpjrWl-C0kmaUJt.mjs.map +0 -1
- package/dist/sql-execution-plan-S3HvDKIP-8KF1nBHu.d.mts.map +0 -1
- package/dist/types-BXSw7th1-pL1Iggyd.d.mts.map +0 -1
- package/dist/types-D3XRY_cO.d.mts +0 -1
- package/dist/types-RPn42d0t.d.mts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as SqlNamespaceBase, s as SqlNamespaceInput } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
|
|
2
|
-
import "./types-
|
|
2
|
+
import "./types-C36_3E6_.mjs";
|
|
3
3
|
import { ControlPolicy } 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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as validateSqlStorageConsistency, l as validateModelStorageReferences } from "./validators-y6eLjhcb.mjs";
|
|
2
2
|
import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-Di9JZ0X7.mjs";
|
|
3
|
-
import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-
|
|
4
|
-
import {
|
|
3
|
+
import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-6WZKIUxH-B3Pd6QA5.mjs";
|
|
4
|
+
import { c as resolveFieldTypeDescriptor, i as indexFkRelations, n as buildEntityTypesByDiscriminator, o as normalizeReferentialAction, r as entryForTag, s as readDataTypeDefault, t as applyBackrelationCandidates } from "./interpreter-BIBwrA2w-DAiNN30m.mjs";
|
|
5
5
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
6
6
|
import { collectScalarTypeConstructors, instantiateAuthoringEntityType } from "@prisma/orm-framework/components/authoring";
|
|
7
7
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
@@ -93,35 +93,84 @@ function lowerPrisma7Default(input) {
|
|
|
93
93
|
return {
|
|
94
94
|
storage: {
|
|
95
95
|
kind: "literal",
|
|
96
|
-
value: scalar
|
|
96
|
+
value: scalar,
|
|
97
|
+
canonical: true
|
|
97
98
|
},
|
|
98
99
|
onCreate: void 0
|
|
99
100
|
};
|
|
100
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The stored value of a written default: an enum member resolves through the enum's members, and
|
|
104
|
+
* every other value is read by the authoring entry for its syntax, cast into the column's data type
|
|
105
|
+
* and validated by the column's codec — the same path the current schema language takes.
|
|
106
|
+
*/
|
|
101
107
|
function scalarValue$1(expression, input, unknown) {
|
|
102
108
|
const span = input.attribute.span;
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
input.diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_JSON_NULL_DEFAULT_UNSUPPORTED", `Field "${input.modelName}.${input.field.name}": @default(${printSyntax(expression.syntax).trim()}) ${holds} the JSON value null, which the contract cannot tell apart from SQL NULL. Remove the @default or give it another JSON value; either changes the column default on Prisma 7's next migration.`, input.sourceId, span));
|
|
106
|
-
};
|
|
109
|
+
const enumValue = enumMemberValue(expression, input);
|
|
110
|
+
if (enumValue !== void 0) return enumValue;
|
|
107
111
|
const array = ArrayLiteralAst.cast(expression.syntax);
|
|
108
|
-
|
|
112
|
+
const elements = array === void 0 ? void 0 : [...array.elements()];
|
|
113
|
+
if (elements?.some((element) => enumMemberValue(element, input) !== void 0) === true) {
|
|
109
114
|
const values = [];
|
|
110
|
-
for (const element of
|
|
111
|
-
const value =
|
|
112
|
-
if (value === void 0) return unknown(
|
|
115
|
+
for (const element of elements) {
|
|
116
|
+
const value = enumMemberValue(element, input);
|
|
117
|
+
if (value === void 0) return unknown("lists may only hold literals or enum members.", span);
|
|
113
118
|
values.push(value);
|
|
114
119
|
}
|
|
115
|
-
if (isJson && values.includes(null)) return jsonNull("holds");
|
|
116
120
|
return values;
|
|
117
121
|
}
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
const written = writtenLiteralFor(expression, elements, input);
|
|
123
|
+
if (written === void 0) return unreadableValue(expression, input, unknown);
|
|
124
|
+
const jsonNull = jsonNullDefault(written, expression, input);
|
|
125
|
+
if (jsonNull !== void 0) return jsonNull;
|
|
126
|
+
const read = readDataTypeDefault({
|
|
127
|
+
written,
|
|
128
|
+
isList: input.field.list,
|
|
129
|
+
column: {
|
|
130
|
+
codecId: input.codecId,
|
|
131
|
+
typeParams: input.typeParams
|
|
132
|
+
},
|
|
133
|
+
codecLookup: input.codecLookup,
|
|
134
|
+
support: input.dataTypeSupport,
|
|
135
|
+
fieldPath: `${input.modelName}.${input.field.name}`
|
|
136
|
+
});
|
|
137
|
+
return read.ok ? read.value : unknown(refusalReason(read.refusal), span);
|
|
138
|
+
}
|
|
139
|
+
/** The storage value of an enum member name, when the field is typed by a Prisma 7 enum. */
|
|
140
|
+
function enumMemberValue(expression, input) {
|
|
141
|
+
const member = IdentifierAst.cast(expression.syntax)?.name();
|
|
142
|
+
return member === void 0 ? void 0 : input.enumMembers?.get(member);
|
|
143
|
+
}
|
|
144
|
+
function writtenLiteralFor(expression, elements, input) {
|
|
145
|
+
if (elements === void 0) return writtenLiteral(expression, input);
|
|
146
|
+
const written = [];
|
|
147
|
+
for (const element of elements) {
|
|
148
|
+
const elementLiteral = writtenLiteral(element, input);
|
|
149
|
+
if (elementLiteral === void 0) return void 0;
|
|
150
|
+
written.push(elementLiteral);
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
kind: "list",
|
|
154
|
+
elements: written
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The JSON value null, which the contract cannot tell apart from SQL NULL, reported before the
|
|
159
|
+
* column's codec sees the literal.
|
|
160
|
+
*/
|
|
161
|
+
function jsonNullDefault(written, expression, input) {
|
|
162
|
+
if (input.literalForm?.kind !== "json") return void 0;
|
|
163
|
+
const value = jsonDocumentOf(written, input);
|
|
164
|
+
if (value === void 0) return void 0;
|
|
165
|
+
if (!(Array.isArray(value) ? value.includes(null) : value === null)) return void 0;
|
|
166
|
+
input.diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_JSON_NULL_DEFAULT_UNSUPPORTED", `Field "${input.modelName}.${input.field.name}": @default(${printSyntax(expression.syntax).trim()}) ${written.kind === "list" ? "holds" : "is"} the JSON value null, which the contract cannot tell apart from SQL NULL. Remove the @default or give it another JSON value; either changes the column default on Prisma 7's next migration.`, input.sourceId, input.attribute.span));
|
|
167
|
+
}
|
|
168
|
+
/** A `@default(...)` this contract source cannot read as a literal at all. */
|
|
169
|
+
function unreadableValue(expression, input, unknown) {
|
|
170
|
+
const span = input.attribute.span;
|
|
123
171
|
const identifier = IdentifierAst.cast(expression.syntax)?.name();
|
|
124
172
|
if (identifier !== void 0) return unknown(input.enumMembers === void 0 ? `refers to "${identifier}", but the field is not an enum.` : `refers to "${identifier}", which is not a member of the field's enum.`, span);
|
|
173
|
+
if (ArrayLiteralAst.cast(expression.syntax) !== void 0) return unknown("lists may only hold literals or enum members.", span);
|
|
125
174
|
return unknown("holds a value this contract source does not read.", span);
|
|
126
175
|
}
|
|
127
176
|
function sqlExpressionDefault(expression, form, isList) {
|
|
@@ -141,40 +190,55 @@ function sqlExpressionDefault(expression, form, isList) {
|
|
|
141
190
|
}
|
|
142
191
|
return { expression: form.list(literals) };
|
|
143
192
|
}
|
|
144
|
-
/** The
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
193
|
+
/** The written literal a Prisma 7 expression is, or `undefined` when it is not a literal at all. */
|
|
194
|
+
function writtenLiteral(expression, input) {
|
|
195
|
+
const text = StringLiteralExprAst.cast(expression.syntax)?.value();
|
|
196
|
+
if (text !== void 0) return input.literalForm?.kind === "json" ? {
|
|
197
|
+
kind: "tag",
|
|
198
|
+
tag: "json",
|
|
199
|
+
body: text
|
|
200
|
+
} : {
|
|
201
|
+
kind: "string",
|
|
202
|
+
text
|
|
203
|
+
};
|
|
204
|
+
const number = NumberLiteralExprAst.cast(expression.syntax)?.token()?.text;
|
|
205
|
+
if (number !== void 0) return {
|
|
206
|
+
kind: "number",
|
|
207
|
+
text: number
|
|
208
|
+
};
|
|
209
|
+
const boolean = BooleanLiteralExprAst.cast(expression.syntax)?.value();
|
|
210
|
+
return boolean === void 0 ? void 0 : {
|
|
211
|
+
kind: "boolean",
|
|
212
|
+
value: boolean
|
|
213
|
+
};
|
|
157
214
|
}
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
215
|
+
/**
|
|
216
|
+
* The document a written JSON value holds, read through the same entry the interpreter uses, or
|
|
217
|
+
* `undefined` when the body is not a document.
|
|
218
|
+
*/
|
|
219
|
+
function jsonDocumentOf(written, input) {
|
|
220
|
+
const entry = entryForTag(input.dataTypeSupport, "json");
|
|
221
|
+
if (entry === void 0 || entry.entry.written.kind !== "tag") return void 0;
|
|
222
|
+
const bodies = written.kind === "list" ? written.elements.flatMap((element) => element.kind === "tag" ? [element.body] : []) : written.kind === "tag" ? [written.body] : [];
|
|
223
|
+
const parse = entry.entry.written.parse;
|
|
224
|
+
try {
|
|
225
|
+
const documents = bodies.map((body) => parse(body));
|
|
226
|
+
return written.kind === "list" ? documents : documents[0];
|
|
227
|
+
} catch {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
162
230
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
return text;
|
|
231
|
+
/** Why the column refused the value, as a phrase following `@default `. */
|
|
232
|
+
function refusalReason(refusal) {
|
|
233
|
+
const at = refusal.elementIndex === void 0 ? "" : ` at element ${refusal.elementIndex + 1}`;
|
|
234
|
+
switch (refusal.kind) {
|
|
235
|
+
case "unreadable": return `holds text${at} that this contract source does not read: ${refusal.message}`;
|
|
236
|
+
case "unknown-tag": return `holds a ${refusal.tag} literal${at}, which this stack does not register.`;
|
|
237
|
+
case "unwritable": return `holds a ${refusal.syntax} value${at}, which this target has no data type for.`;
|
|
238
|
+
case "not-a-list": return "holds a single value on a list column, which takes a list literal.";
|
|
239
|
+
case "no-cast": return `holds a ${refusal.valueType} value${at}, which ${refusal.columnType} has no cast from; ${refusal.casts.length === 0 ? "it casts from nothing" : `it casts from ${refusal.casts.join(", ")}`}.`;
|
|
240
|
+
case "undecodable": return `holds a value${at} that ${refusal.codecId} does not read: ${refusal.message}`;
|
|
176
241
|
}
|
|
177
|
-
return BooleanLiteralExprAst.cast(expression.syntax)?.value();
|
|
178
242
|
}
|
|
179
243
|
function lowerFunction(call, input, label, unknown) {
|
|
180
244
|
const fn = call.path().join(".");
|
|
@@ -1485,7 +1549,12 @@ function readField(args) {
|
|
|
1485
1549
|
field,
|
|
1486
1550
|
modelName: model.symbol.name,
|
|
1487
1551
|
codecId: resolved.descriptor.codecId,
|
|
1552
|
+
typeParams: resolved.descriptor.typeParams,
|
|
1488
1553
|
codecLookup: input.codecLookup,
|
|
1554
|
+
dataTypeSupport: {
|
|
1555
|
+
entries: input.authoringContributions?.dataTypes ?? {},
|
|
1556
|
+
lookup: input.dataTypeLookup
|
|
1557
|
+
},
|
|
1489
1558
|
literalForm: binding.literalDefaultForm(resolved.descriptor),
|
|
1490
1559
|
enumMembers: enumDeclaration === void 0 ? void 0 : new Map(enumDeclaration.members.map((member) => [member.name, member.value])),
|
|
1491
1560
|
controlMutationDefaults: input.controlMutationDefaults,
|
|
@@ -1634,6 +1703,7 @@ function prisma7Contract(schemaPath, options) {
|
|
|
1634
1703
|
controlMutationDefaults: context.controlMutationDefaults,
|
|
1635
1704
|
authoringContributions: context.authoringContributions,
|
|
1636
1705
|
codecLookup: context.codecLookup,
|
|
1706
|
+
dataTypeLookup: context.dataTypeLookup,
|
|
1637
1707
|
composedExtensions: context.composedExtensions
|
|
1638
1708
|
});
|
|
1639
1709
|
if (!interpreted.ok) return interpreted;
|