@prisma/orm-family-sql 8.0.0-rc.20-dev.13 → 8.0.0-rc.20-dev.15
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/{attribute-specs-DA_RwQFB.d.mts → attribute-specs-Dcd2ZUrY.d.mts} +4 -3
- package/dist/attribute-specs-Dcd2ZUrY.d.mts.map +1 -0
- package/dist/{authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts → authoring-entity-types-CgKIgWq5-CZK1F9a_.d.mts} +2 -2
- package/dist/{authoring-entity-types-CgKIgWq5-pEdfjam5.d.mts.map → authoring-entity-types-CgKIgWq5-CZK1F9a_.d.mts.map} +1 -1
- package/dist/compare-strings-BVf3BgCV-CefXnrMB.mjs +10 -0
- package/dist/compare-strings-BVf3BgCV-CefXnrMB.mjs.map +1 -0
- package/dist/{contract-builder-C_Zi57iD.d.mts → contract-builder-B-Q9T1CO.d.mts} +10 -79
- package/dist/contract-builder-B-Q9T1CO.d.mts.map +1 -0
- package/dist/{contract-builder-50lF0kz1.mjs → contract-builder-DMNe_jX9.mjs} +109 -96
- package/dist/contract-builder-DMNe_jX9.mjs.map +1 -0
- package/dist/contract-prisma7__provider.mjs +2 -2
- package/dist/contract-psl.d.mts +2 -2
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__diagnostics.d.mts +3 -4
- package/dist/contract-psl__diagnostics.d.mts.map +1 -1
- package/dist/contract-psl__diagnostics.mjs +1 -1
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +1 -1
- package/dist/contract.d.mts +2 -1
- package/dist/contract.mjs +2 -1
- package/dist/contract__generated-id-column-aliases.d.mts +2 -0
- package/dist/contract__generated-id-column-aliases.mjs +2 -0
- package/dist/{control-CffuMKgt.d.mts → control-B6W_VEZ9.d.mts} +50 -176
- package/dist/control-B6W_VEZ9.d.mts.map +1 -0
- package/dist/{control-D7N_L18S.mjs → control-D6wIw5Fi.mjs} +4 -5
- package/dist/control-D6wIw5Fi.mjs.map +1 -0
- package/dist/diagnostics-C7jR1Jyf.mjs +109 -0
- package/dist/diagnostics-C7jR1Jyf.mjs.map +1 -0
- package/dist/family.d.mts +4 -4
- package/dist/family.mjs +5 -6
- package/dist/family__control.d.mts +1 -1
- package/dist/family__control.mjs +1 -1
- package/dist/family__pack.d.mts +2 -2
- package/dist/family__pack.mjs +27 -3
- package/dist/family__pack.mjs.map +1 -0
- package/dist/family__psl-build.mjs +1 -1
- package/dist/family__runtime.d.mts +1 -1
- package/dist/family__runtime.mjs +1 -1
- package/dist/generated-id-column-aliases-DCuTuZrU.d.mts +71 -0
- package/dist/generated-id-column-aliases-DCuTuZrU.d.mts.map +1 -0
- package/dist/generated-id-column-aliases-DPUii1fN.mjs +51 -0
- package/dist/generated-id-column-aliases-DPUii1fN.mjs.map +1 -0
- package/dist/{generator-functions-Cg5QkM46-C1ByFzyT.mjs → generator-functions-Hy4pDDr9-AUCNpeg5.mjs} +49 -187
- package/dist/generator-functions-Hy4pDDr9-AUCNpeg5.mjs.map +1 -0
- package/dist/{interpreter-D5qk4B---CG0C7kdx.mjs → interpreter-CS21wD1i-G0u1x8t_.mjs} +13 -10
- package/dist/interpreter-CS21wD1i-G0u1x8t_.mjs.map +1 -0
- package/dist/orm-client.d.mts +2 -2
- package/dist/orm-client.mjs +2 -2
- package/dist/orm-client.mjs.map +1 -1
- package/dist/{pack-DA8HZ2mo.d.mts → pack-Cap3oVPy.d.mts} +69 -280
- package/dist/pack-Cap3oVPy.d.mts.map +1 -0
- package/dist/{psl-build-DFBG6vhz.mjs → psl-build-DqqYhOsa.mjs} +2 -2
- package/dist/psl-build-DqqYhOsa.mjs.map +1 -0
- package/dist/{psl-column-resolution-ChZqioOc-BREg4J7d.d.mts → psl-column-resolution-djGEITmJ-B5iMpe8H.d.mts} +4 -4
- package/dist/psl-column-resolution-djGEITmJ-B5iMpe8H.d.mts.map +1 -0
- package/dist/{psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs → psl-field-resolution-Bvhx79fP-CQqHf_L4.mjs} +20 -107
- package/dist/psl-field-resolution-Bvhx79fP-CQqHf_L4.mjs.map +1 -0
- package/dist/{runtime-6tH1yOxK.mjs → runtime-CCzfa1mY.mjs} +2 -3
- package/dist/{runtime-6tH1yOxK.mjs.map → runtime-CCzfa1mY.mjs.map} +1 -1
- package/dist/{runtime-CF6rAlE5.d.mts → runtime-JKWb27L5.d.mts} +2 -3
- package/dist/{runtime-CF6rAlE5.d.mts.map → runtime-JKWb27L5.d.mts.map} +1 -1
- package/package.json +19 -18
- package/dist/attribute-specs-DA_RwQFB.d.mts.map +0 -1
- package/dist/contract-builder-50lF0kz1.mjs.map +0 -1
- package/dist/contract-builder-C_Zi57iD.d.mts.map +0 -1
- package/dist/control-CffuMKgt.d.mts.map +0 -1
- package/dist/control-D7N_L18S.mjs.map +0 -1
- package/dist/diagnostics-RHJxoiIk.mjs +0 -23
- package/dist/diagnostics-RHJxoiIk.mjs.map +0 -1
- package/dist/generator-functions-Cg5QkM46-C1ByFzyT.mjs.map +0 -1
- package/dist/interpreter-D5qk4B---CG0C7kdx.mjs.map +0 -1
- package/dist/pack-DA8HZ2mo.d.mts.map +0 -1
- package/dist/pack-DOTaBfUC.mjs +0 -80
- package/dist/pack-DOTaBfUC.mjs.map +0 -1
- package/dist/psl-build-DFBG6vhz.mjs.map +0 -1
- package/dist/psl-column-resolution-ChZqioOc-BREg4J7d.d.mts.map +0 -1
- package/dist/psl-field-resolution-C5KQ7kzP-B0NwuRWV.mjs.map +0 -1
package/dist/{generator-functions-Cg5QkM46-C1ByFzyT.mjs → generator-functions-Hy4pDDr9-AUCNpeg5.mjs}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as generatedIdColumnAliases } from "./generated-id-column-aliases-DPUii1fN.mjs";
|
|
2
|
+
import { c as enumType } from "./contract-builder-DMNe_jX9.mjs";
|
|
2
3
|
import { c as SQL_TEXT_CODEC_ID, i as SQL_CHAR_CODEC_ID, l as SQL_VARCHAR_CODEC_ID } from "./ast-e_02t9Nt.mjs";
|
|
3
4
|
import { readEnumBlockMembers, resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
|
|
4
5
|
import { enumRefusalOf, requiredParamKeys } from "@prisma/orm-framework/components/codec";
|
|
@@ -8,7 +9,7 @@ import { singleGeneratorBinding } from "@prisma/orm-framework/components/compone
|
|
|
8
9
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
9
10
|
import { blockAttribute, dataTypeValue, enumMemberValue, leafDiagnostic, mapBlock, optional, refineArg, str } from "@prisma/orm-framework/psl-parser";
|
|
10
11
|
import { CUID_VERSION, NANOID_SIZE, UUID_VERSIONS, generatedLength } from "@prisma/orm-framework/ids";
|
|
11
|
-
//#region ../../../2-sql-family/9-family/dist/generator-functions-
|
|
12
|
+
//#region ../../../2-sql-family/9-family/dist/generator-functions-Hy4pDDr9.mjs
|
|
12
13
|
function sqlFamilyEnumSpec() {
|
|
13
14
|
return mapBlock({
|
|
14
15
|
value: {
|
|
@@ -90,202 +91,63 @@ const sqlFamilyPslBlockDescriptors = { enum: {
|
|
|
90
91
|
spec: sqlFamilyEnumSpec,
|
|
91
92
|
attributes: { type: () => enumTypeBlockAttribute }
|
|
92
93
|
} };
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID
|
|
103
|
-
* values as `character(36)` — portable across all SQL targets. For a native
|
|
104
|
-
* Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /
|
|
105
|
-
* `id.uuidv7Native` from `@internal/target-postgres`.
|
|
106
|
-
*
|
|
107
|
-
* Scalar presets that map to target-specific codecs (e.g. `text`, `int`,
|
|
108
|
-
* `boolean`, `dateTime`) are contributed by the target pack (see
|
|
109
|
-
* `postgresAuthoringFieldPresets` in `@internal/target-postgres`) so the
|
|
110
|
-
* TS callback surface and the PSL scalar surface lower to byte-identical
|
|
111
|
-
* contracts for the active target.
|
|
112
|
-
*/
|
|
113
|
-
const CHARACTER_CODEC_ID = "sql/char@1";
|
|
114
|
-
const nanoidOptionsArgument = {
|
|
115
|
-
kind: "object",
|
|
116
|
-
optional: true,
|
|
117
|
-
properties: { size: {
|
|
118
|
-
kind: "number",
|
|
119
|
-
optional: true,
|
|
120
|
-
integer: true,
|
|
121
|
-
minimum: NANOID_SIZE.min,
|
|
122
|
-
maximum: NANOID_SIZE.max
|
|
123
|
-
} }
|
|
124
|
-
};
|
|
125
|
-
const sqlFamilyAuthoringFieldPresets = {
|
|
126
|
-
uuidString: {
|
|
127
|
-
kind: "fieldPreset",
|
|
128
|
-
output: {
|
|
129
|
-
codecId: CHARACTER_CODEC_ID,
|
|
130
|
-
typeParams: { length: 36 }
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
ulid: {
|
|
134
|
-
kind: "fieldPreset",
|
|
135
|
-
output: {
|
|
136
|
-
codecId: CHARACTER_CODEC_ID,
|
|
137
|
-
typeParams: { length: 26 }
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
nanoid: {
|
|
141
|
-
kind: "fieldPreset",
|
|
142
|
-
args: [nanoidOptionsArgument],
|
|
94
|
+
const sqlFamilyAuthoringTypes = {
|
|
95
|
+
Raw: {
|
|
96
|
+
kind: "typeConstructor",
|
|
97
|
+
documentation: "A column of a type no other column type covers, written exactly as the database catalog prints it, such as Raw(sql`tsvector`). Its values are typed unknown, and its default is a sql expression.",
|
|
98
|
+
args: [{
|
|
99
|
+
kind: "value",
|
|
100
|
+
dataType: "sql/expression",
|
|
101
|
+
name: "sql"
|
|
102
|
+
}],
|
|
143
103
|
output: {
|
|
144
|
-
codecId:
|
|
145
|
-
typeParams: {
|
|
104
|
+
codecId: "sql/raw@1",
|
|
105
|
+
typeParams: { sql: {
|
|
146
106
|
kind: "arg",
|
|
147
|
-
index: 0
|
|
148
|
-
path: ["size"],
|
|
149
|
-
default: 21
|
|
107
|
+
index: 0
|
|
150
108
|
} }
|
|
151
109
|
}
|
|
152
110
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
uuidv4String: {
|
|
169
|
-
kind: "fieldPreset",
|
|
170
|
-
output: {
|
|
171
|
-
codecId: CHARACTER_CODEC_ID,
|
|
172
|
-
typeParams: { length: 36 },
|
|
173
|
-
executionDefaults: { onCreate: {
|
|
174
|
-
kind: "generator",
|
|
175
|
-
id: "uuidv4"
|
|
176
|
-
} },
|
|
177
|
-
id: true
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
uuidv7String: {
|
|
181
|
-
kind: "fieldPreset",
|
|
182
|
-
output: {
|
|
183
|
-
codecId: CHARACTER_CODEC_ID,
|
|
184
|
-
typeParams: { length: 36 },
|
|
185
|
-
executionDefaults: { onCreate: {
|
|
186
|
-
kind: "generator",
|
|
187
|
-
id: "uuidv7"
|
|
188
|
-
} },
|
|
189
|
-
id: true
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
ulid: {
|
|
193
|
-
kind: "fieldPreset",
|
|
194
|
-
output: {
|
|
195
|
-
codecId: CHARACTER_CODEC_ID,
|
|
196
|
-
typeParams: { length: 26 },
|
|
197
|
-
executionDefaults: { onCreate: {
|
|
198
|
-
kind: "generator",
|
|
199
|
-
id: "ulid"
|
|
200
|
-
} },
|
|
201
|
-
id: true
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
nanoid: {
|
|
205
|
-
kind: "fieldPreset",
|
|
206
|
-
args: [nanoidOptionsArgument],
|
|
111
|
+
sql: generatedIdColumnAliases
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The type constructors every SQL target contributes itself, because their arguments are sizes, such as a length, and only the target names the data type a size is a value of: `sizeType`, such as `pg/int4`.
|
|
115
|
+
*/
|
|
116
|
+
function sqlTargetTypeConstructors(input) {
|
|
117
|
+
return { sql: {
|
|
118
|
+
String: {
|
|
119
|
+
kind: "typeConstructor",
|
|
120
|
+
documentation: "Variable-length text with a required maximum character length.",
|
|
121
|
+
args: [{
|
|
122
|
+
kind: "value",
|
|
123
|
+
dataType: input.sizeType,
|
|
124
|
+
name: "length"
|
|
125
|
+
}],
|
|
207
126
|
output: {
|
|
208
|
-
codecId:
|
|
127
|
+
codecId: "sql/varchar@1",
|
|
209
128
|
typeParams: { length: {
|
|
210
129
|
kind: "arg",
|
|
211
|
-
index: 0
|
|
212
|
-
|
|
213
|
-
default: 21
|
|
214
|
-
} },
|
|
215
|
-
executionDefaults: { onCreate: {
|
|
216
|
-
kind: "generator",
|
|
217
|
-
id: "nanoid",
|
|
218
|
-
params: { size: {
|
|
219
|
-
kind: "arg",
|
|
220
|
-
index: 0,
|
|
221
|
-
path: ["size"]
|
|
222
|
-
} }
|
|
223
|
-
} },
|
|
224
|
-
id: true
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
cuid2: {
|
|
228
|
-
kind: "fieldPreset",
|
|
229
|
-
output: {
|
|
230
|
-
codecId: CHARACTER_CODEC_ID,
|
|
231
|
-
typeParams: { length: 24 },
|
|
232
|
-
executionDefaults: { onCreate: {
|
|
233
|
-
kind: "generator",
|
|
234
|
-
id: "cuid2"
|
|
235
|
-
} },
|
|
236
|
-
id: true
|
|
130
|
+
index: 0
|
|
131
|
+
} }
|
|
237
132
|
}
|
|
238
133
|
},
|
|
239
|
-
|
|
240
|
-
kind: "
|
|
134
|
+
Char: {
|
|
135
|
+
kind: "typeConstructor",
|
|
136
|
+
documentation: "Fixed-length text with a required character length.",
|
|
137
|
+
args: [{
|
|
138
|
+
kind: "value",
|
|
139
|
+
dataType: input.sizeType,
|
|
140
|
+
name: "length"
|
|
141
|
+
}],
|
|
241
142
|
output: {
|
|
242
|
-
codecId:
|
|
243
|
-
typeParams: { length:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
} },
|
|
248
|
-
id: true
|
|
143
|
+
codecId: "sql/char@1",
|
|
144
|
+
typeParams: { length: {
|
|
145
|
+
kind: "arg",
|
|
146
|
+
index: 0
|
|
147
|
+
} }
|
|
249
148
|
}
|
|
250
149
|
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
const sqlFamilyAuthoringTypes = { Raw: {
|
|
254
|
-
kind: "typeConstructor",
|
|
255
|
-
documentation: "A column of a type no other column type covers, written exactly as the database catalog prints it, such as Raw(sql`tsvector`). Its values are typed unknown, and its default is a sql expression.",
|
|
256
|
-
args: [{
|
|
257
|
-
kind: "value",
|
|
258
|
-
dataType: "sql/expression",
|
|
259
|
-
name: "sql"
|
|
260
|
-
}],
|
|
261
|
-
output: {
|
|
262
|
-
codecId: "sql/raw@1",
|
|
263
|
-
typeParams: { sql: {
|
|
264
|
-
kind: "arg",
|
|
265
|
-
index: 0
|
|
266
|
-
} }
|
|
267
|
-
}
|
|
268
|
-
} };
|
|
269
|
-
/**
|
|
270
|
-
* The type constructors every SQL target contributes itself, because their arguments are sizes, such as a length, and only the target names the data type a size is a value of: `sizeType`, such as `pg/int4`.
|
|
271
|
-
*/
|
|
272
|
-
function sqlTargetTypeConstructors(input) {
|
|
273
|
-
return { sql: { String: {
|
|
274
|
-
kind: "typeConstructor",
|
|
275
|
-
documentation: "Variable-length text with a required maximum character length.",
|
|
276
|
-
args: [{
|
|
277
|
-
kind: "value",
|
|
278
|
-
dataType: input.sizeType,
|
|
279
|
-
name: "length"
|
|
280
|
-
}],
|
|
281
|
-
output: {
|
|
282
|
-
codecId: "sql/varchar@1",
|
|
283
|
-
typeParams: { length: {
|
|
284
|
-
kind: "arg",
|
|
285
|
-
index: 0
|
|
286
|
-
} }
|
|
287
|
-
}
|
|
288
|
-
} } };
|
|
150
|
+
} };
|
|
289
151
|
}
|
|
290
152
|
const NANOID_DEFAULT_SIZE = 21;
|
|
291
153
|
const nowSignature = { documentation: "Writes the current time, as the column's codec represents it." };
|
|
@@ -538,6 +400,6 @@ function checkedInteger(integer, dataTypes, allowed, refusal) {
|
|
|
538
400
|
});
|
|
539
401
|
}
|
|
540
402
|
//#endregion
|
|
541
|
-
export {
|
|
403
|
+
export { sqlFamilyGeneratorFunctions as a, sqlTargetTypeConstructors as c, sqlFamilyGeneratorDescriptors as i, sqlFamilyAuthoringTypes as n, sqlFamilyPslBlockDescriptors as o, sqlFamilyEntityTypes as r, sqlIntegerArgumentGeneratorFunctions as s, idGeneratorFunctionBindings as t };
|
|
542
404
|
|
|
543
|
-
//# sourceMappingURL=generator-functions-
|
|
405
|
+
//# sourceMappingURL=generator-functions-Hy4pDDr9-AUCNpeg5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-functions-Hy4pDDr9-AUCNpeg5.mjs","names":[],"sources":["../../../../2-sql-family/9-family/dist/generator-functions-Hy4pDDr9.mjs"],"sourcesContent":["import { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { enumRefusalOf, requiredParamKeys } from \"@internal/framework-components/codec\";\nimport { blockAttribute, dataTypeValue, enumMemberValue, leafDiagnostic, mapBlock, optional, refineArg, str } from \"@internal/psl-parser\";\nimport { enumType } from \"@internal/sql-contract-ts/contract-builder\";\nimport { generatedIdColumnAliases } from \"@internal/sql-contract/generated-id-column-aliases\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { CUID_VERSION, NANOID_SIZE, UUID_VERSIONS, generatedLength } from \"@internal/ids\";\nimport { SQL_CHAR_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID } from \"@internal/sql-relational-core/ast\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/core/authoring-entity-types.ts\nfunction sqlFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: enumMemberValue(),\n\t\t\tdocumentation: \"The member's value, written as a value of the enum's data type; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst sqlFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (descriptor === void 0 || codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst enumRefusal = enumRefusalOf(descriptor);\n\t\tif (enumRefusal !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" cannot use the codec \"${codecId}\". ${enumRefusal}`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypes.lookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst [requiredParam] = requiredParamKeys(dataType);\n\t\tif (requiredParam !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_TYPE_NEEDS_PARAMETERS\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${dataType.id}\", which requires the parameter \"${requiredParam}\"; an enum block gives it none`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\treturn enumType(block.name, { codecId }, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst sqlFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: sqlFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\n//#region src/core/authoring-types.ts\nconst sqlFamilyAuthoringTypes = {\n\tRaw: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A column of a type no other column type covers, written exactly as the database catalog prints it, such as Raw(sql`tsvector`). Its values are typed unknown, and its default is a sql expression.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: \"sql/expression\",\n\t\t\tname: \"sql\"\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/raw@1\",\n\t\t\ttypeParams: { sql: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tsql: generatedIdColumnAliases\n};\n/**\n* The type constructors every SQL target contributes itself, because their arguments are sizes, such as a length, and only the target names the data type a size is a value of: `sizeType`, such as `pg/int4`.\n*/\nfunction sqlTargetTypeConstructors(input) {\n\treturn { sql: {\n\t\tString: {\n\t\t\tkind: \"typeConstructor\",\n\t\t\tdocumentation: \"Variable-length text with a required maximum character length.\",\n\t\t\targs: [{\n\t\t\t\tkind: \"value\",\n\t\t\t\tdataType: input.sizeType,\n\t\t\t\tname: \"length\"\n\t\t\t}],\n\t\t\toutput: {\n\t\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\t\ttypeParams: { length: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t} }\n\t\t\t}\n\t\t},\n\t\tChar: {\n\t\t\tkind: \"typeConstructor\",\n\t\t\tdocumentation: \"Fixed-length text with a required character length.\",\n\t\t\targs: [{\n\t\t\t\tkind: \"value\",\n\t\t\t\tdataType: input.sizeType,\n\t\t\t\tname: \"length\"\n\t\t\t}],\n\t\t\toutput: {\n\t\t\t\tcodecId: \"sql/char@1\",\n\t\t\t\ttypeParams: { length: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t} }\n\t\t\t}\n\t\t}\n\t} };\n}\n//#endregion\n//#region src/core/generator-functions.ts\nconst NANOID_DEFAULT_SIZE = 21;\nconst nowSignature = { documentation: \"Writes the current time, as the column's codec represents it.\" };\nconst ulidSignature = { documentation: \"Generates a ULID when a value is not supplied.\" };\nconst ksuidSignature = { documentation: \"Generates a KSUID when a value is not supplied.\" };\nfunction refused(message) {\n\treturn {\n\t\tok: false,\n\t\tmessage\n\t};\n}\nfunction generated(id, params) {\n\treturn {\n\t\tok: true,\n\t\tgenerator: params === void 0 ? {\n\t\t\tkind: \"generator\",\n\t\t\tid\n\t\t} : {\n\t\t\tkind: \"generator\",\n\t\t\tid,\n\t\t\tparams\n\t\t}\n\t};\n}\nfunction uuidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"uuidv4\", \"uuidv7\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst version = args[\"version\"];\n\t\t\tif (version === void 0 || version === UUID_VERSIONS.v4) return generated(\"uuidv4\");\n\t\t\tif (version === UUID_VERSIONS.v7) return generated(\"uuidv7\");\n\t\t\treturn refused(`uuid: version must be ${UUID_VERSIONS.v4} or ${UUID_VERSIONS.v7}, got ${String(version)}`);\n\t\t},\n\t\tprintArguments: (generator) => {\n\t\t\tif (generator.id === \"uuidv4\") return {\n\t\t\t\targs: {},\n\t\t\t\ttext: \"\"\n\t\t\t};\n\t\t\tif (generator.id === \"uuidv7\") return {\n\t\t\t\targs: { version: UUID_VERSIONS.v7 },\n\t\t\t\ttext: String(UUID_VERSIONS.v7)\n\t\t\t};\n\t\t}\n\t};\n}\nfunction cuidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"cuid2\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst version = args[\"version\"];\n\t\t\treturn version === CUID_VERSION ? generated(\"cuid2\") : refused(`cuid: version must be ${CUID_VERSION}, got ${String(version)}`);\n\t\t},\n\t\tprintArguments: (generator) => generator.id === \"cuid2\" ? {\n\t\t\targs: { version: CUID_VERSION },\n\t\t\ttext: String(CUID_VERSION)\n\t\t} : void 0\n\t};\n}\nfunction isNanoidSize(size) {\n\treturn typeof size === \"number\" && Number.isInteger(size) && size >= NANOID_SIZE.min && size <= NANOID_SIZE.max;\n}\n/**\n* A Nano ID has the size the call gives, or 21; the column's length never sets it. A shorter identifier in a fixed-length column is padded by the database, as Prisma 7 does.\n*/\nfunction nanoidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"nanoid\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst explicit = args[\"size\"];\n\t\t\tif (explicit !== void 0 && !isNanoidSize(explicit)) return refused(`nanoid: size must be between ${NANOID_SIZE.min} and ${NANOID_SIZE.max}, got ${String(explicit)}`);\n\t\t\treturn explicit === void 0 ? generated(\"nanoid\") : generated(\"nanoid\", { size: explicit });\n\t\t},\n\t\tprintArguments: (generator) => {\n\t\t\tif (generator.id !== \"nanoid\") return void 0;\n\t\t\tconst size = generator.params?.[\"size\"];\n\t\t\treturn typeof size === \"number\" ? {\n\t\t\t\targs: { size },\n\t\t\t\ttext: String(size)\n\t\t\t} : {\n\t\t\t\targs: {},\n\t\t\t\ttext: \"\"\n\t\t\t};\n\t\t}\n\t};\n}\n/**\n* `binding`, refusing a column whose length, in its data type's normal form, is shorter than the identifier the generator writes. The database would refuse every insert of a longer value.\n*/\nfunction fittingColumn(name, binding) {\n\treturn {\n\t\t...binding,\n\t\tresolve: (input) => {\n\t\t\tconst resolution = binding.resolve(input);\n\t\t\tconst length = input.field.length;\n\t\t\tif (!resolution.ok || length === void 0) return resolution;\n\t\t\tconst { generator } = resolution;\n\t\t\tconst written = generatedLength(blindCast(generator.id), generator.params);\n\t\t\tif (written <= length) return resolution;\n\t\t\treturn refused(`${`${name}(${binding.printArguments(generator, input.field)?.text ?? \"\"})`} writes ${written} characters, which does not fit a column of ${length} ${length === 1 ? \"character\" : \"characters\"}.`);\n\t\t}\n\t};\n}\n/** The identifier generator functions bound to a target's text codecs, and `uuid` to its uuid codecs. Each refuses a column too short for what it writes. */\nfunction idGeneratorFunctionBindings(codecs) {\n\tconst { text } = codecs;\n\treturn [\n\t\t{\n\t\t\tname: \"uuid\",\n\t\t\tbindings: [fittingColumn(\"uuid\", uuidBinding([...text, ...codecs.uuid ?? []]))]\n\t\t},\n\t\t{\n\t\t\tname: \"cuid\",\n\t\t\tbindings: [fittingColumn(\"cuid\", cuidBinding(text))]\n\t\t},\n\t\t{\n\t\t\tname: \"ulid\",\n\t\t\tbindings: [fittingColumn(\"ulid\", singleGeneratorBinding({\n\t\t\t\tcodecIds: text,\n\t\t\t\tgeneratorId: \"ulid\"\n\t\t\t}))]\n\t\t},\n\t\t{\n\t\t\tname: \"ksuid\",\n\t\t\tbindings: [fittingColumn(\"ksuid\", singleGeneratorBinding({\n\t\t\t\tcodecIds: text,\n\t\t\t\tgeneratorId: \"ksuid\"\n\t\t\t}))]\n\t\t},\n\t\t{\n\t\t\tname: \"nanoid\",\n\t\t\tbindings: [fittingColumn(\"nanoid\", nanoidBinding(text))]\n\t\t}\n\t];\n}\nconst familyIdBindings = idGeneratorFunctionBindings({ text: [\n\tSQL_CHAR_CODEC_ID,\n\tSQL_VARCHAR_CODEC_ID,\n\tSQL_TEXT_CODEC_ID\n] });\nfunction familyBindingsOf(name) {\n\treturn familyIdBindings.find((contribution) => contribution.name === name)?.bindings ?? [];\n}\n/** The generator functions the SQL family declares, with their bindings to the family's codecs. Targets bind `now` and their own codecs. */\nconst sqlFamilyGeneratorFunctions = [\n\t{\n\t\tname: \"now\",\n\t\tsignature: nowSignature,\n\t\tbindings: []\n\t},\n\t{\n\t\tname: \"uuid\",\n\t\tbindings: familyBindingsOf(\"uuid\")\n\t},\n\t{\n\t\tname: \"cuid\",\n\t\tbindings: familyBindingsOf(\"cuid\")\n\t},\n\t{\n\t\tname: \"ulid\",\n\t\tsignature: ulidSignature,\n\t\tbindings: familyBindingsOf(\"ulid\")\n\t},\n\t{\n\t\tname: \"nanoid\",\n\t\tbindings: familyBindingsOf(\"nanoid\")\n\t},\n\t{\n\t\tname: \"ksuid\",\n\t\tsignature: ksuidSignature,\n\t\tbindings: familyBindingsOf(\"ksuid\")\n\t}\n];\n/** The identifier generators the family's bindings produce, which the family registers so that a target binding them through `idGeneratorFunctionBindings` registers none. */\nconst sqlFamilyGeneratorDescriptors = [...new Set(sqlFamilyGeneratorFunctions.flatMap(({ bindings }) => bindings.flatMap(({ generatorIds }) => generatorIds)))].map((id) => ({ id }));\n/**\n* The generator functions whose arguments are integers, declared with their signatures: `uuid(version?)`, `cuid(version)` and `nanoid(size?)`. Each argument is a value of `integer`, the target's integer data type, read and cast like a default, then checked by its function. A target declares them, because only it knows its integer type; the family and the target bind them.\n*/\nfunction sqlIntegerArgumentGeneratorFunctions({ integer }) {\n\treturn [\n\t\t{\n\t\t\tname: \"uuid\",\n\t\t\tsignature: (dataTypes) => uuidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t},\n\t\t{\n\t\t\tname: \"cuid\",\n\t\t\tsignature: (dataTypes) => cuidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t},\n\t\t{\n\t\t\tname: \"nanoid\",\n\t\t\tsignature: (dataTypes) => nanoidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t}\n\t];\n}\nfunction uuidSignature(integer, dataTypes) {\n\tconst versions = [UUID_VERSIONS.v4, UUID_VERSIONS.v7];\n\treturn {\n\t\tdocumentation: \"Generates a UUID when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"version\",\n\t\t\ttype: optional(checkedInteger(integer, dataTypes, listed(versions), (version, written) => versions.some((allowed) => allowed === version) ? void 0 : `uuid: version must be ${UUID_VERSIONS.v4} or ${UUID_VERSIONS.v7}, got ${written}`)),\n\t\t\tdocumentation: `The UUID version: \\`${UUID_VERSIONS.v4}\\` or \\`${UUID_VERSIONS.v7}\\`. Defaults to \\`${UUID_VERSIONS.v4}\\`.`\n\t\t}]\n\t};\n}\nfunction cuidSignature(integer, dataTypes) {\n\treturn {\n\t\tdocumentation: \"Generates a CUID2 identifier when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"version\",\n\t\t\ttype: checkedInteger(integer, dataTypes, listed([CUID_VERSION]), (version, written) => version === CUID_VERSION ? void 0 : `cuid: version must be ${CUID_VERSION}, got ${written}`),\n\t\t\tdocumentation: `The CUID version. Only \\`${CUID_VERSION}\\` is supported.`\n\t\t}]\n\t};\n}\nfunction nanoidSignature(integer, dataTypes) {\n\treturn {\n\t\tdocumentation: \"Generates a Nano ID when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"size\",\n\t\t\ttype: optional(checkedInteger(integer, dataTypes, {\n\t\t\t\tlabel: `integer from ${NANOID_SIZE.min} to ${NANOID_SIZE.max}`,\n\t\t\t\tsuggestions: []\n\t\t\t}, (size, written) => isNanoidSize(size) ? void 0 : `nanoid: size must be between ${NANOID_SIZE.min} and ${NANOID_SIZE.max}, got ${written}`)),\n\t\t\tdocumentation: `The identifier length, from \\`${NANOID_SIZE.min}\\` through \\`${NANOID_SIZE.max}\\`. Defaults to ${NANOID_DEFAULT_SIZE}.`\n\t\t}]\n\t};\n}\n/** The completion suggestions of an argument that takes one of `values`, which its label lists. */\nfunction listed(values) {\n\treturn {\n\t\tsuggestions: values.map(String),\n\t\tlabelIsUnion: true\n\t};\n}\n/**\n* One value of the integer data type, as a number, refused at the argument with the function's message when `refusal` returns one.\n*/\nfunction checkedInteger(integer, dataTypes, allowed, refusal) {\n\treturn refineArg(dataTypeValue(integer, dataTypes, allowed), ({ value }, arg, ctx) => {\n\t\tconst stored = value.value;\n\t\tif (typeof stored !== \"number\" && typeof stored !== \"string\") throw new InternalError(`Data type \"${integer}\" stores an integer as ${typeof stored}, not a number or digit text.`);\n\t\tconst message = refusal(Number(stored), String(stored));\n\t\treturn message === void 0 ? ok(blindCast(Number(stored))) : notOk([leafDiagnostic(ctx, arg, message, \"PSL_INVALID_GENERATOR_ARGUMENT\")]);\n\t});\n}\n//#endregion\nexport { sqlFamilyAuthoringTypes as a, sqlFamilyPslBlockDescriptors as c, sqlIntegerArgumentGeneratorFunctions as i, sqlFamilyGeneratorDescriptors as n, sqlTargetTypeConstructors as o, sqlFamilyGeneratorFunctions as r, sqlFamilyEntityTypes as s, id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AAI,kBAAkB,oBAAoB;EACtI,CAAC;CACF;AACD;;AAEA,SAAS,OAAO,QAAQ;CACvB,OAAO;EACN,aAAa,OAAO,IAAI,MAAM;EAC9B,cAAc;CACf;AACD;;;;AAIA,SAAS,eAAe,SAAS,WAAW,SAAS,SAAS;CAC7D,OAAO,UAAU,cAAc,SAAS,WAAW,OAAO,IAAI,EAAE,SAAS,KAAK,QAAQ;EACrF,MAAM,SAAS,MAAM;EACrB,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,UAAU,MAAM,IAAI,cAAc,cAAc,QAAQ,yBAAyB,OAAO,OAAO,8BAA8B;EACjL,MAAM,UAAU,QAAQ,OAAO,MAAM,GAAG,OAAO,MAAM,CAAC;EACtD,OAAO,YAAY,KAAK,IAAI,GAAG,UAAU,OAAO,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,eAAe,KAAK,KAAK,SAAS,gCAAgC,CAAC,CAAC;CACxI,CAAC;AACF"}
|
|
@@ -6,8 +6,9 @@ import { p as sqlTextFromStored } from "./sql-expression-CKgKznXS.mjs";
|
|
|
6
6
|
import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-HVaxhALD.mjs";
|
|
7
7
|
import { n as buildSqlContractFromDefinition } from "./derived-checks-D5HVRvqN-BJx1gwPA.mjs";
|
|
8
8
|
import { i as mapFieldNamesToColumns, n as getAttribute, o as storageName, r as getNamedArgument, t as formatDbAttributeMigrationMessage } from "./psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs";
|
|
9
|
-
import { _ as modelSpecContext, b as sqlAttributeSpecs, d as interpretModelAttribute, f as lowerEnumDefault, g as modelCoordinateKey, h as modelAttributeSpecsFrom, l as instantiatePslTypeConstructor, m as lowerTypeGenerators, n as collectResolvedFields, o as fieldSpecContext, p as lowerTypeDefault, r as contractError, s as getAuthoringEntity, t as PSL_CHECK_ON_STI_VARIANT, u as interpretFieldAttribute, y as resolveFieldTypeDescriptor } from "./psl-field-resolution-
|
|
9
|
+
import { _ as modelSpecContext, b as sqlAttributeSpecs, d as interpretModelAttribute, f as lowerEnumDefault, g as modelCoordinateKey, h as modelAttributeSpecsFrom, l as instantiatePslTypeConstructor, m as lowerTypeGenerators, n as collectResolvedFields, o as fieldSpecContext, p as lowerTypeDefault, r as contractError, s as getAuthoringEntity, t as PSL_CHECK_ON_STI_VARIANT, u as interpretFieldAttribute, y as resolveFieldTypeDescriptor } from "./psl-field-resolution-Bvhx79fP-CQqHf_L4.mjs";
|
|
10
10
|
import { t as defaultTableName } from "./default-table-name-BfFY8qYR-CWZFDX6v.mjs";
|
|
11
|
+
import { t as compareStrings } from "./compare-strings-BVf3BgCV-CefXnrMB.mjs";
|
|
11
12
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
12
13
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
13
14
|
import { applyDiscriminatorRule, describeDiscriminatorRefusal, encodeEnumMembers, instantiateAuthoringEntityType, instantiateAuthoringTypeAlias, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringModelAttributeDescriptor, resolveTypeAliasGenerators } from "@prisma/orm-framework/components/authoring";
|
|
@@ -21,7 +22,7 @@ import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions
|
|
|
21
22
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
22
23
|
import { contributedTypeAliasOf, createPslDiagnosticCollector, diagnosticSource, findBlockDescriptor, interpretExtensionBlocks, nodePslSpan, resolveTypeAliases, typeAliasAttributeNames, typeAliasSpecContext, typeReferenceNode } from "@prisma/orm-framework/psl-parser";
|
|
23
24
|
import { claimedBlockKeywords, enumMemberAttributeDiagnostics, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
24
|
-
//#region ../../../2-sql-family/2-authoring/contract-psl/dist/interpreter-
|
|
25
|
+
//#region ../../../2-sql-family/2-authoring/contract-psl/dist/interpreter-CS21wD1i.mjs
|
|
25
26
|
function describeUnsupportedSqlAliasAttribute(attribute) {
|
|
26
27
|
return attribute.name.startsWith("db.") ? formatDbAttributeMigrationMessage(attribute) : void 0;
|
|
27
28
|
}
|
|
@@ -487,11 +488,6 @@ function buildComposedExtensionPackRefs(target, extensionIds, extensionPackRefs
|
|
|
487
488
|
version: "0.0.1"
|
|
488
489
|
}]));
|
|
489
490
|
}
|
|
490
|
-
function compareStrings(left, right) {
|
|
491
|
-
if (left < right) return -1;
|
|
492
|
-
if (left > right) return 1;
|
|
493
|
-
return 0;
|
|
494
|
-
}
|
|
495
491
|
function declarationsHoldingModels(namespace) {
|
|
496
492
|
const declarations = /* @__PURE__ */ new Set();
|
|
497
493
|
for (const model of Object.values(namespace.models)) {
|
|
@@ -726,6 +722,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
726
722
|
generatorFunctions: input.generatorFunctions,
|
|
727
723
|
dataTypes: input.dataTypes,
|
|
728
724
|
diagnostics,
|
|
725
|
+
droppedFields: input.droppedFields,
|
|
729
726
|
sources: input.sources,
|
|
730
727
|
binder: input.binder,
|
|
731
728
|
scalarColumnDescriptors: input.scalarColumnDescriptors,
|
|
@@ -1383,7 +1380,10 @@ function buildValueObjectNodes(input) {
|
|
|
1383
1380
|
codecLookup: input.codecLookup,
|
|
1384
1381
|
dataTypes: input.dataTypes
|
|
1385
1382
|
});
|
|
1386
|
-
if (!resolved.ok)
|
|
1383
|
+
if (!resolved.ok) {
|
|
1384
|
+
input.droppedFields.add(field);
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
1387
|
const { descriptor } = resolved;
|
|
1388
1388
|
if (descriptor.valueSet !== void 0) {
|
|
1389
1389
|
diagnostics.push({
|
|
@@ -2041,8 +2041,10 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2041
2041
|
const backrelationCandidates = [];
|
|
2042
2042
|
const crossSpaceRelationsByModel = /* @__PURE__ */ new Map();
|
|
2043
2043
|
const modelAttributeEntitiesByNamespace = /* @__PURE__ */ new Map();
|
|
2044
|
+
const droppedFields = /* @__PURE__ */ new Set();
|
|
2044
2045
|
const valueObjects = buildValueObjectNodes({
|
|
2045
2046
|
compositeTypes,
|
|
2047
|
+
droppedFields,
|
|
2046
2048
|
enumTypeDescriptors: allEnumTypeDescriptors,
|
|
2047
2049
|
enumHandles,
|
|
2048
2050
|
typeAliases,
|
|
@@ -2061,6 +2063,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2061
2063
|
for (const { model, namespaceId } of modelEntries) {
|
|
2062
2064
|
const result = buildModelNodeFromPsl({
|
|
2063
2065
|
model,
|
|
2066
|
+
droppedFields,
|
|
2064
2067
|
physicalNames,
|
|
2065
2068
|
namespaceId,
|
|
2066
2069
|
valueObjectTypes,
|
|
@@ -2195,7 +2198,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2195
2198
|
...modelRelations.has(symbol) ? { relations: [...modelRelations.get(symbol) ?? []].sort((left, right) => compareStrings(left.fieldName, right.fieldName)) } : {}
|
|
2196
2199
|
})), baseDeclarations, stiVariantKeys, defaultNamespaceId);
|
|
2197
2200
|
const { modelNodes: stiColumnModelNodes, stiBaseFieldsByBase } = materializeStiVariantStorageColumns(mtiLinkedModelNodes, baseDeclarations, stiVariantKeys, defaultNamespaceId);
|
|
2198
|
-
if (diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0) return notOk({
|
|
2201
|
+
if (diagnostics.length > 0 || (input.seedDiagnostics?.length ?? 0) > 0 || droppedFields.size > 0) return notOk({
|
|
2199
2202
|
summary: "PSL to SQL contract interpretation failed",
|
|
2200
2203
|
diagnostics: [...input.seedDiagnostics ?? [], ...diagnostics.toExternal()]
|
|
2201
2204
|
});
|
|
@@ -2277,4 +2280,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2277
2280
|
//#endregion
|
|
2278
2281
|
export { normalizeReferentialAction as a, interpretPslDocumentToSqlContract as i, buildEntityTypesByDiscriminator as n, indexFkRelations as r, applyBackrelationCandidates as t };
|
|
2279
2282
|
|
|
2280
|
-
//# sourceMappingURL=interpreter-
|
|
2283
|
+
//# sourceMappingURL=interpreter-CS21wD1i-G0u1x8t_.mjs.map
|