@prisma/orm-family-sql 8.0.0-rc.18-dev.37 → 8.0.0-rc.18-dev.39
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-CKPSK8oZ.d.mts → attribute-specs-D_fUYNiw.d.mts} +15 -8
- package/dist/attribute-specs-D_fUYNiw.d.mts.map +1 -0
- package/dist/{authoring-entity-types-DUQLeBf_-DmXuN7I3.d.mts → authoring-entity-types-DUQLeBf_-BZ1zRWGY.d.mts} +2 -2
- package/dist/{authoring-entity-types-DUQLeBf_-DmXuN7I3.d.mts.map → authoring-entity-types-DUQLeBf_-BZ1zRWGY.d.mts.map} +1 -1
- package/dist/{config-types-Dc7u9onO.mjs → config-types-CUWdUm6B.mjs} +2 -2
- package/dist/{config-types-Dc7u9onO.mjs.map → config-types-CUWdUm6B.mjs.map} +1 -1
- package/dist/{contract-builder-C7X80029.d.mts → contract-builder-Di-2-fFO.d.mts} +2 -2
- package/dist/{contract-builder-C7X80029.d.mts.map → contract-builder-Di-2-fFO.d.mts.map} +1 -1
- package/dist/{contract-builder-CKfnPa4C.mjs → contract-builder-DzzgwCZd.mjs} +20 -9
- package/dist/contract-builder-DzzgwCZd.mjs.map +1 -0
- package/dist/contract-prisma7__provider.mjs +69 -44
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +2 -2
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +2 -2
- package/dist/contract-psl__attribute-specs.mjs +2 -2
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +2 -2
- package/dist/contract.mjs +4 -4
- package/dist/contract__data-type.d.mts +2 -2
- package/dist/contract__data-type.mjs +3 -3
- package/dist/contract__validators.mjs +1 -1
- package/dist/{control-B1Nyqky-.d.mts → control-LkQLqHHL.d.mts} +14 -31
- package/dist/control-LkQLqHHL.d.mts.map +1 -0
- package/dist/{control-adapter-BX5COBWO.mjs → control-adapter-DRlEXxsv.mjs} +2 -2
- package/dist/{control-adapter-BX5COBWO.mjs.map → control-adapter-DRlEXxsv.mjs.map} +1 -1
- package/dist/{control-jtTYvP_4.mjs → control-d-Dlrhh4.mjs} +38 -9
- package/dist/control-d-Dlrhh4.mjs.map +1 -0
- package/dist/{data-type-DMk-fLAZ.d.mts → data-type-BacIoCfv.d.mts} +11 -2
- package/dist/data-type-BacIoCfv.d.mts.map +1 -0
- package/dist/{data-type-HNhSslwG.mjs → data-type-CUJMZOHo.mjs} +2 -2
- package/dist/data-type-CUJMZOHo.mjs.map +1 -0
- package/dist/{derived-checks-CwbSfZ8d-B3-zWGv_.mjs → derived-checks-CwbSfZ8d-B91zqK6B.mjs} +3 -3
- package/dist/{derived-checks-CwbSfZ8d-B3-zWGv_.mjs.map → derived-checks-CwbSfZ8d-B91zqK6B.mjs.map} +1 -1
- package/dist/{diff-DDjcnhgw.d.mts → diff-CzUyZmJi.d.mts} +2 -2
- package/dist/{diff-DDjcnhgw.d.mts.map → diff-CzUyZmJi.d.mts.map} +1 -1
- package/dist/family.d.mts +7 -7
- package/dist/family.mjs +8 -8
- package/dist/family__control-adapter.mjs +1 -1
- package/dist/family__control.d.mts +3 -3
- package/dist/family__control.mjs +4 -4
- package/dist/family__diff.d.mts +1 -1
- package/dist/family__diff.mjs +1 -1
- package/dist/family__ir.mjs +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +2 -2
- package/dist/family__pack.mjs +3 -3
- package/dist/family__pack.mjs.map +1 -1
- package/dist/family__psl-build.d.mts +1 -1
- package/dist/family__psl-build.mjs +1 -1
- package/dist/{generator-functions-DIXj2u8w-B_EpEY8t.mjs → generator-functions-DErXcNG5-nKYm5qLY.mjs} +124 -67
- package/dist/generator-functions-DErXcNG5-nKYm5qLY.mjs.map +1 -0
- package/dist/{interpreter-Dq32sxoS-BcLhPY0_.mjs → interpreter-MPFufRkd-D0QvlLTq.mjs} +72 -18
- package/dist/interpreter-MPFufRkd-D0QvlLTq.mjs.map +1 -0
- package/dist/{migration-BZJFz90J.d.mts → migration-tfMTDejH.d.mts} +2 -2
- package/dist/{migration-BZJFz90J.d.mts.map → migration-tfMTDejH.d.mts.map} +1 -1
- package/dist/{pack-C4yN9ooT.d.mts → pack-74uFuOgh.d.mts} +48 -30
- package/dist/{pack-C4yN9ooT.d.mts.map → pack-74uFuOgh.d.mts.map} +1 -1
- package/dist/{psl-build-DzdzY3o1.mjs → psl-build-BSZQ8lC1.mjs} +5 -4
- package/dist/{psl-build-DzdzY3o1.mjs.map → psl-build-BSZQ8lC1.mjs.map} +1 -1
- package/dist/{psl-build-DETsH_kq.d.mts → psl-build-BkNvqSMz.d.mts} +4 -2
- package/dist/{psl-build-DETsH_kq.d.mts.map → psl-build-BkNvqSMz.d.mts.map} +1 -1
- package/dist/{psl-column-resolution-DNdqpUxt-CL8m5aC4.d.mts → psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts} +3 -3
- package/dist/{psl-column-resolution-DNdqpUxt-CL8m5aC4.d.mts.map → psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts.map} +1 -1
- package/dist/{psl-field-resolution-C8s57hFC-Bv6NiK8J.mjs → psl-field-resolution-BLtSah2i-BuuJ5H70.mjs} +21 -15
- package/dist/psl-field-resolution-BLtSah2i-BuuJ5H70.mjs.map +1 -0
- package/dist/{schema-verify-BwRdzbHb-BzdgK4xv.mjs → schema-verify-BwRdzbHb-DfFAS0EC.mjs} +2 -2
- package/dist/{schema-verify-BwRdzbHb-BzdgK4xv.mjs.map → schema-verify-BwRdzbHb-DfFAS0EC.mjs.map} +1 -1
- package/dist/{sql-contract-serializer-sMY3prTx-D-xfnqyD.mjs → sql-contract-serializer-sMY3prTx-CpZa5Nlt.mjs} +2 -2
- package/dist/{sql-contract-serializer-sMY3prTx-D-xfnqyD.mjs.map → sql-contract-serializer-sMY3prTx-CpZa5Nlt.mjs.map} +1 -1
- package/dist/{sql-data-type-D5cI3M07-DIcPP8s1.mjs → sql-data-type-D7M-YTTY-C9oWGZ3z.mjs} +16 -3
- package/dist/sql-data-type-D7M-YTTY-C9oWGZ3z.mjs.map +1 -0
- package/dist/{types-DKSRuPhK-DuxW_ceI.d.mts → types-CI5lled6-CDV4aYNB.d.mts} +2 -2
- package/dist/{types-DKSRuPhK-DuxW_ceI.d.mts.map → types-CI5lled6-CDV4aYNB.d.mts.map} +1 -1
- package/dist/{validators-BlONfdFH.mjs → validators-Cfy0jmZ2.mjs} +2 -2
- package/dist/{validators-BlONfdFH.mjs.map → validators-Cfy0jmZ2.mjs.map} +1 -1
- package/package.json +18 -18
- package/dist/attribute-specs-CKPSK8oZ.d.mts.map +0 -1
- package/dist/contract-builder-CKfnPa4C.mjs.map +0 -1
- package/dist/control-B1Nyqky-.d.mts.map +0 -1
- package/dist/control-jtTYvP_4.mjs.map +0 -1
- package/dist/data-type-DMk-fLAZ.d.mts.map +0 -1
- package/dist/data-type-HNhSslwG.mjs.map +0 -1
- package/dist/generator-functions-DIXj2u8w-B_EpEY8t.mjs.map +0 -1
- package/dist/interpreter-Dq32sxoS-BcLhPY0_.mjs.map +0 -1
- package/dist/psl-field-resolution-C8s57hFC-Bv6NiK8J.mjs.map +0 -1
- package/dist/sql-data-type-D5cI3M07-DIcPP8s1.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as SqlStorage } from "./sql-storage-tZhB8nS5-8NSWT0TW.mjs";
|
|
2
2
|
import "./types-B2Dee96w.mjs";
|
|
3
|
-
import { S as SqlPlanTargetDetails, u as SqlMigrationPlanOperation } from "./types-
|
|
3
|
+
import { S as SqlPlanTargetDetails, u as SqlMigrationPlanOperation } from "./types-CI5lled6-CDV4aYNB.mjs";
|
|
4
4
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { Migration } from "@prisma/orm-toolchain/migration-tools/migration";
|
|
6
6
|
//#region ../../../2-sql/9-family/dist/migration.d.mts
|
|
@@ -41,4 +41,4 @@ declare abstract class SqlMigration<TDetails extends SqlPlanTargetDetails, TTarg
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
export { SqlMigration as t };
|
|
44
|
-
//# sourceMappingURL=migration-
|
|
44
|
+
//# sourceMappingURL=migration-tfMTDejH.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-tfMTDejH.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/migration.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0BuB,aAAa,iBAAiB,sBAAsB,mCAAmC,cAAc,SAAS,cAAc,SAAS,aAAa,YAAY,SAAS,cAAc,SAAS,qBAAqB,UAAU,0BAA0B,kBAAkB,WAAW,OAAO;;;;;;;;;;;MAW5S"}
|
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as sqlFamilyEnumSpec } from "./authoring-entity-types-DUQLeBf_-
|
|
1
|
+
import { a as EnumMemberListDefault, i as EnumMemberDefault, n as DefaultFunctionCall, o as ParsedNullLiteral } from "./attribute-specs-D_fUYNiw.mjs";
|
|
2
|
+
import { t as sqlFamilyEnumSpec } from "./authoring-entity-types-DUQLeBf_-BZ1zRWGY.mjs";
|
|
3
|
+
import { DataTypeSupport } from "@prisma/orm-framework/components/authoring";
|
|
4
|
+
import { DataTypeId } from "@prisma/orm-framework/components/codec";
|
|
3
5
|
import { GeneratorFunctionContribution } from "@prisma/orm-framework/components/components";
|
|
6
|
+
import { ArgType, AttributeCtx } from "@prisma/orm-framework/psl-parser";
|
|
4
7
|
//#region ../../../2-sql/9-family/dist/pack.d.mts
|
|
5
8
|
//#region src/core/generator-functions.d.ts
|
|
6
|
-
/** The identifier generator functions bound to a target's text codecs, and `uuid` to its uuid codecs. */
|
|
9
|
+
/** 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. */
|
|
7
10
|
declare function idGeneratorFunctionBindings(codecs: {
|
|
8
11
|
readonly text: readonly string[];
|
|
9
12
|
readonly uuid?: readonly string[];
|
|
10
13
|
}): readonly GeneratorFunctionContribution[];
|
|
14
|
+
/**
|
|
15
|
+
* 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.
|
|
16
|
+
*/
|
|
17
|
+
declare function sqlIntegerArgumentGeneratorFunctions({ integer }: {
|
|
18
|
+
readonly integer: DataTypeId;
|
|
19
|
+
}): readonly [{
|
|
20
|
+
readonly name: "uuid";
|
|
21
|
+
readonly signature: (dataTypes: DataTypeSupport) => {
|
|
22
|
+
readonly documentation: "Generates a UUID when a value is not supplied.";
|
|
23
|
+
readonly positional: readonly [{
|
|
24
|
+
readonly key: "version";
|
|
25
|
+
readonly type: import("@prisma/orm-framework/psl-parser").OptionalArgType<4 | 7, AttributeCtx, ArgType<4 | 7, AttributeCtx>>;
|
|
26
|
+
readonly documentation: "The UUID version: `4` or `7`. Defaults to `4`.";
|
|
27
|
+
}];
|
|
28
|
+
};
|
|
29
|
+
readonly bindings: readonly [];
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "cuid";
|
|
32
|
+
readonly signature: (dataTypes: DataTypeSupport) => {
|
|
33
|
+
readonly documentation: "Generates a CUID2 identifier when a value is not supplied.";
|
|
34
|
+
readonly positional: readonly [{
|
|
35
|
+
readonly key: "version";
|
|
36
|
+
readonly type: ArgType<2, AttributeCtx>;
|
|
37
|
+
readonly documentation: "The CUID version. Only `2` is supported.";
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
readonly bindings: readonly [];
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "nanoid";
|
|
43
|
+
readonly signature: (dataTypes: DataTypeSupport) => {
|
|
44
|
+
readonly documentation: "Generates a Nano ID when a value is not supplied.";
|
|
45
|
+
readonly positional: readonly [{
|
|
46
|
+
readonly key: "size";
|
|
47
|
+
readonly type: import("@prisma/orm-framework/psl-parser").OptionalArgType<number, AttributeCtx, ArgType<number, AttributeCtx>>;
|
|
48
|
+
readonly documentation: "The identifier length, from `2` through `255`. Defaults to 21.";
|
|
49
|
+
}];
|
|
50
|
+
};
|
|
51
|
+
readonly bindings: readonly [];
|
|
52
|
+
}];
|
|
11
53
|
//#endregion
|
|
12
54
|
//#region src/exports/pack.d.ts
|
|
13
55
|
declare const sqlFamilyPack: {
|
|
@@ -297,7 +339,7 @@ declare const sqlFamilyPack: {
|
|
|
297
339
|
}, import("@prisma/orm-framework/psl-parser").ModelAttributeCtx>;
|
|
298
340
|
readonly base: (_ctx: import("@prisma/orm-framework/psl-parser").AttributeSpecContext) => import("@prisma/orm-framework/psl-parser").AttributeSpec<{
|
|
299
341
|
base: import("@prisma/orm-framework/psl-parser").ResolvedEntityReference<import("@prisma/orm-framework/psl-parser").ModelSymbol>;
|
|
300
|
-
value:
|
|
342
|
+
value: import("@prisma/orm-framework/psl-parser").ParsedWrittenScalar;
|
|
301
343
|
}, import("@prisma/orm-framework/psl-parser").ModelAttributeCtx>;
|
|
302
344
|
};
|
|
303
345
|
readonly field: {
|
|
@@ -339,25 +381,9 @@ declare const sqlFamilyPack: {
|
|
|
339
381
|
readonly bindings: readonly [];
|
|
340
382
|
}, {
|
|
341
383
|
readonly name: "uuid";
|
|
342
|
-
readonly signature: {
|
|
343
|
-
readonly documentation: "Generates a UUID when a value is not supplied.";
|
|
344
|
-
readonly positional: readonly [{
|
|
345
|
-
readonly key: "version";
|
|
346
|
-
readonly type: import("@prisma/orm-framework/psl-parser").OptionalArgType<4 | 7, import("@prisma/orm-framework/psl-parser").AttributeCtx, import("@prisma/orm-framework/psl-parser").OneOfArgType<[import("@prisma/orm-framework/psl-parser").FixedNumArgType<4, import("@prisma/orm-framework/psl-parser").AttributeCtx>, import("@prisma/orm-framework/psl-parser").FixedNumArgType<7, import("@prisma/orm-framework/psl-parser").AttributeCtx>], import("@prisma/orm-framework/psl-parser").AttributeCtx>>;
|
|
347
|
-
readonly documentation: "The UUID version: `4` or `7`. Defaults to `4`.";
|
|
348
|
-
}];
|
|
349
|
-
};
|
|
350
384
|
readonly bindings: readonly import("@prisma/orm-framework/components/components").GeneratorFunctionBinding[];
|
|
351
385
|
}, {
|
|
352
386
|
readonly name: "cuid";
|
|
353
|
-
readonly signature: {
|
|
354
|
-
readonly documentation: "Generates a CUID2 identifier when a value is not supplied.";
|
|
355
|
-
readonly positional: readonly [{
|
|
356
|
-
readonly key: "version";
|
|
357
|
-
readonly type: import("@prisma/orm-framework/psl-parser").FixedNumArgType<2, import("@prisma/orm-framework/psl-parser").AttributeCtx>;
|
|
358
|
-
readonly documentation: "The CUID version. Only `2` is supported.";
|
|
359
|
-
}];
|
|
360
|
-
};
|
|
361
387
|
readonly bindings: readonly import("@prisma/orm-framework/components/components").GeneratorFunctionBinding[];
|
|
362
388
|
}, {
|
|
363
389
|
readonly name: "ulid";
|
|
@@ -367,14 +393,6 @@ declare const sqlFamilyPack: {
|
|
|
367
393
|
readonly bindings: readonly import("@prisma/orm-framework/components/components").GeneratorFunctionBinding[];
|
|
368
394
|
}, {
|
|
369
395
|
readonly name: "nanoid";
|
|
370
|
-
readonly signature: {
|
|
371
|
-
readonly documentation: "Generates a Nano ID when a value is not supplied.";
|
|
372
|
-
readonly positional: readonly [{
|
|
373
|
-
readonly key: "size";
|
|
374
|
-
readonly type: import("@prisma/orm-framework/psl-parser").OptionalArgType<number, import("@prisma/orm-framework/psl-parser").AttributeCtx, import("@prisma/orm-framework/psl-parser").IntArgType<import("@prisma/orm-framework/psl-parser").AttributeCtx>>;
|
|
375
|
-
readonly documentation: "The identifier length, from `2` through `255`. Defaults to 21.";
|
|
376
|
-
}];
|
|
377
|
-
};
|
|
378
396
|
readonly bindings: readonly import("@prisma/orm-framework/components/components").GeneratorFunctionBinding[];
|
|
379
397
|
}, {
|
|
380
398
|
readonly name: "ksuid";
|
|
@@ -389,5 +407,5 @@ declare const sqlFamilyPack: {
|
|
|
389
407
|
};
|
|
390
408
|
};
|
|
391
409
|
//#endregion
|
|
392
|
-
export { sqlFamilyPack as n, idGeneratorFunctionBindings as t };
|
|
393
|
-
//# sourceMappingURL=pack-
|
|
410
|
+
export { sqlFamilyPack as n, sqlIntegerArgumentGeneratorFunctions as r, idGeneratorFunctionBindings as t };
|
|
411
|
+
//# sourceMappingURL=pack-74uFuOgh.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-
|
|
1
|
+
{"version":3,"file":"pack-74uFuOgh.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/pack.d.mts"],"mappings":";;;;;;;;;iBAOiB,4BAA4B;WAClC;WACA;aACE;;;;iBAII,uCAAuC;WAC7C,SAAS;;WAET;WACA,YAAY,WAAW;aACrB;aACA;eACE;eACA,qCAAqC,uBAAuB,cAAc,eAAe;eACzF;;;WAGJ;;WAEA;WACA,YAAY,WAAW;aACrB;aACA;eACE;eACA,MAAM,WAAW;eACjB;;;WAGJ;;WAEA;WACA,YAAY,WAAW;aACrB;aACA;eACE;eACA,qCAAqC,wBAAwB,cAAc,gBAAgB;eAC3F;;;WAGJ;;;;cAIG;WACH;WACA;WACA;WACA;WACA;aACE;eACE;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;;;;;eAKR;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;yBACA;;;;mBAIN;qBACE;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;6BACA;;;;;qBAKR;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;iBACA;iBACA;mBACE;mBACA;;iBAEF;mBACE;mBACA;qBACE;uBACE;uBACA;;;;;eAKR;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;;;;;aAOZ,gEAAgE;aAChE;eACE;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;UACE,2CAA2C;YACzC;4CACgC;;;;aAI/B;eACE;iBACE,MAAM,qCAAqC,wDAAwD;UAC1G;0CACgC;iBACzB,KAAK,qCAAqC,wDAAwD;UACzG;mBACS;0CACuB;iBACzB,SAAS,qCAAqC,wDAAwD;UAC7G;mBACS;0CACuB;iBACzB,QAAQ,oCAAoC,wDAAwD;UAC3G;mBACS,4CAA4C;mBAC5C,uCAAuC;mBACvC;mBACA;mBACA;mBACA;mBACA,UAAU;0CACa;iBACzB,QAAQ,oCAAoC,wDAAwD;mBAClG,2CAA2C;mBAC3C;mBACA;0CACuB;iBACzB,UAAU,qCAAqC,wDAAwD;UAC9G;0CACgC;iBACzB,gBAAgB,qCAAqC,wDAAwD;UACpH;0CACgC;iBACzB,OAAO,qCAAqC,wDAAwD;UAC3G,qCAAqC,uDAAuD;UAC5F,sCAAsC;0CACN;;eAE3B;iBACE,MAAM,qCAAqC,6DAA6D;UAC/G;0CACgC;iBACzB,KAAK,qCAAqC,6DAA6D;mBACrG;0CACuB;iBACzB,SAAS,qCAAqC,6DAA6D;mBACzG;0CACuB;iBACzB,WAAW,qCAAqC,6DAA6D;UACpH;mBACS;mBACA;mBACA;mBACA;mBACA;mBACA;0CACuB;iBACzB,UAAU,oCAAoC,6DAA6D;UAClH,sCAAsC,sBAtCnB,mDAsCiJ,iDAAiD,sBAApG,qBAA+K,sBAA0E,oBAA2E;0CACrZ;iBACzB,WAAW,oCAAoC,6DAA6D;UACnH,sCAAsC;0CACN;iBACzB,WAAW,oCAAoC,6DAA6D;UACnH,sCAAsC;0CACN;;;;WAI/B;aACE;aACA;eACE;;aAEF;;aAEA;aACA,uEAAuE;;aAEvE;aACA,uEAAuE;;aAEvE;aACA;eACE;;aAEF,uEAAuE;;aAEvE;aACA,uEAAuE;;aAEvE;aACA;eACE;;aAEF,uEAAuE;;WAEzE;aACE,yBAAyB;aACzB,gFAAgF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as isSqlDataType, o as resolveReportedSqlType } from "./sql-data-type-
|
|
2
|
-
import { r as numeralText } from "./data-type-
|
|
1
|
+
import { n as isSqlDataType, o as resolveReportedSqlType } from "./sql-data-type-D7M-YTTY-C9oWGZ3z.mjs";
|
|
2
|
+
import { r as numeralText } from "./data-type-CUJMZOHo.mjs";
|
|
3
3
|
import { r as escapePslString } from "./data-type-support-C5-XxxeB.mjs";
|
|
4
4
|
import "./sql-expression-BJCuy-WI.mjs";
|
|
5
5
|
import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
|
|
@@ -392,7 +392,8 @@ function generatorCallsFor(input) {
|
|
|
392
392
|
phase,
|
|
393
393
|
generator,
|
|
394
394
|
text: printed.text,
|
|
395
|
-
readBack: readBack.ok ? readBack.generator : void 0
|
|
395
|
+
readBack: readBack.ok ? readBack.generator : void 0,
|
|
396
|
+
refusedBecause: !readBack.ok && readBack.reason === "refused" ? readBack.message : void 0
|
|
396
397
|
}
|
|
397
398
|
};
|
|
398
399
|
calls.push({
|
|
@@ -408,4 +409,4 @@ function generatorCallsFor(input) {
|
|
|
408
409
|
//#endregion
|
|
409
410
|
export { mapDefault as a, inferredTypeConstructors as i, generatorCallsFor as n, pslTypeArgumentText as o, inferColumnTypes as r, writeDefaultLiteral as s, fewestArgumentsCall as t };
|
|
410
411
|
|
|
411
|
-
//# sourceMappingURL=psl-build-
|
|
412
|
+
//# sourceMappingURL=psl-build-BSZQ8lC1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-build-DzdzY3o1.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 { 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/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* A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.\n* 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.\n*/\nfunction pslTypeArgumentText(value) {\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value !== \"string\") return void 0;\n\treturn escapePslString(value) === value ? `\"${value}\"` : void 0;\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, 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\tif (call === void 0) return void 0;\n\tconst args = call.args.map(pslTypeArgumentText);\n\treturn args.every((arg) => arg !== void 0) ? {\n\t\tpath: call.path,\n\t\targs\n\t} : void 0;\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, 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(\"<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/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}\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/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}\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, pslTypeArgumentText, toEnumMemberName, writeDefaultLiteral };\n\n//# sourceMappingURL=psl-build.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,yBAAyB,OAAO;CACxC,MAAM,wBAAwB,IAAI,IAAI;CACtC,KAAK,MAAM,EAAE,MAAM,gBAAgB,0BAA0B,MAAM,cAAc,GAAG;EACnF,IAAI,WAAW,aAAa,MAAM;EAClC,MAAM,aAAa,MAAM,YAAY,cAAc,WAAW,OAAO,OAAO,CAAC,EAAE;EAC/E,MAAM,WAAW,eAAe,KAAK,IAAI,KAAK,IAAI,MAAM,eAAe,IAAI,UAAU;EACrF,IAAI,aAAa,KAAK,KAAK,CAAC,cAAc,QAAQ,GAAG;EACrD,MAAM,IAAI,SAAS,IAAI;GACtB;GACA;GACA;EACD,CAAC;CACF;CACA,OAAO;AACR;AACA,SAAS,aAAa,QAAQ,MAAM;CACnC,IAAI;EACH,MAAM,EAAE,eAAe,oCAAoC,OAAO,YAAY,IAAI;EAClF,MAAM,SAAS,eAAe,OAAO,UAAU,UAAU;EACzD,OAAO,iBA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G;EAC5B,OAAO,UAAU,KAAK,KAAK,SAAS,QAAQ,KAAK;CAClD,CAAC;AACF;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;GACnD;EACD;EACA,MAAM,KAAK;GACV;GACA,MAAM,QAAQ;EACf,CAAC;CACF;CACA,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"psl-build-BSZQ8lC1.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 { 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/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* A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.\n* 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.\n*/\nfunction pslTypeArgumentText(value) {\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value !== \"string\") return void 0;\n\treturn escapePslString(value) === value ? `\"${value}\"` : void 0;\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, 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\tif (call === void 0) return void 0;\n\tconst args = call.args.map(pslTypeArgumentText);\n\treturn args.every((arg) => arg !== void 0) ? {\n\t\tpath: call.path,\n\t\targs\n\t} : void 0;\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, 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(\"<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/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}\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/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, pslTypeArgumentText, toEnumMemberName, writeDefaultLiteral };\n\n//# sourceMappingURL=psl-build.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,yBAAyB,OAAO;CACxC,MAAM,wBAAwB,IAAI,IAAI;CACtC,KAAK,MAAM,EAAE,MAAM,gBAAgB,0BAA0B,MAAM,cAAc,GAAG;EACnF,IAAI,WAAW,aAAa,MAAM;EAClC,MAAM,aAAa,MAAM,YAAY,cAAc,WAAW,OAAO,OAAO,CAAC,EAAE;EAC/E,M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;CACF;CACA,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as SqlColumnIR } from "./types-DiD6BqoN-ZF53hwPp.mjs";
|
|
2
2
|
import "./types-D_nlUp-1.mjs";
|
|
3
|
-
import { i as SqlDataType, l as SqlTypeParams } from "./data-type-
|
|
3
|
+
import { i as SqlDataType, l as SqlTypeParams } from "./data-type-BacIoCfv.mjs";
|
|
4
4
|
import "./default-mapping-CP8q4TfH-CF6eJMej.mjs";
|
|
5
5
|
import { AuthoringTypeConstructorCall, AuthoringTypeConstructorDescriptor, AuthoringTypeNamespace } from "@prisma/orm-framework/components/authoring";
|
|
6
6
|
import { CodecLookupWithDescriptors, DataTypeLookup } from "@prisma/orm-framework/components/codec";
|
|
@@ -77,6 +77,8 @@ type GeneratorCallRefusal = {
|
|
|
77
77
|
readonly generator: ExecutionMutationDefaultValue;
|
|
78
78
|
readonly text: string;
|
|
79
79
|
readonly readBack: ExecutionMutationDefaultValue | undefined;
|
|
80
|
+
/** Why the call's binding refuses the column, when it does. */
|
|
81
|
+
readonly refusedBecause: string | undefined;
|
|
80
82
|
};
|
|
81
83
|
type GeneratorCallsResult = {
|
|
82
84
|
readonly ok: true;
|
|
@@ -105,4 +107,4 @@ declare function generatorCallsFor(input: {
|
|
|
105
107
|
declare function toEnumMemberName(value: string): string;
|
|
106
108
|
//#endregion
|
|
107
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 };
|
|
108
|
-
//# sourceMappingURL=psl-build-
|
|
110
|
+
//# sourceMappingURL=psl-build-BkNvqSMz.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-build-
|
|
1
|
+
{"version":3,"file":"psl-build-BkNvqSMz.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;;;;;iBAK7E,oBAAoB;;;;UAI3B;WACC;WACA;;;KAGN,gBAAgB,mBAAmB,uBAAuB;;UAErD;WACC;WACA;WACA,kBAAkB;;;;;;;;iBAQZ,iBAAiB;WACvB,iBAAiB;WACjB,cAAc;WACd,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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./contract-builder-
|
|
1
|
+
import "./contract-builder-Di-2-fFO.mjs";
|
|
2
2
|
import { AuthoringTypeConstructorDescriptor } 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
|
-
import { Binder } from "@prisma/orm-framework/psl-parser";
|
|
6
5
|
import "@prisma/orm-framework/components/control";
|
|
6
|
+
import { Binder } from "@prisma/orm-framework/psl-parser";
|
|
7
7
|
//#region ../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-DNdqpUxt.d.mts
|
|
8
8
|
//#region src/psl-column-resolution.d.ts
|
|
9
9
|
type ColumnDescriptor = {
|
|
@@ -22,4 +22,4 @@ type ColumnDescriptor = {
|
|
|
22
22
|
};
|
|
23
23
|
//#endregion
|
|
24
24
|
export { ColumnDescriptor as t };
|
|
25
|
-
//# sourceMappingURL=psl-column-resolution-DNdqpUxt-
|
|
25
|
+
//# sourceMappingURL=psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-column-resolution-DNdqpUxt-
|
|
1
|
+
{"version":3,"file":"psl-column-resolution-DNdqpUxt-DlQwgbqn.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-DNdqpUxt.d.mts"],"mappings":";;;;;;;;KASK;WACM;WACA;WACA,aAAa;;;;;;;;;WASb,WAAW"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { u as sqlCodecColumnLength } from "./sql-data-type-D7M-YTTY-C9oWGZ3z.mjs";
|
|
1
2
|
import { p as sqlTextFromStored, t as SQL_EXPRESSION_DATA_TYPE_ID } from "./sql-expression-BJCuy-WI.mjs";
|
|
2
3
|
import { d as resolvedTypeParams } from "./types-M_FeBD9w.mjs";
|
|
3
|
-
import { n as checkSqlDefaultText, o as reservedSqlDefaultText } from "./validators-
|
|
4
|
-
import { a as storedAsListColumn, i as isValueObjectMember } from "./derived-checks-CwbSfZ8d-
|
|
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
6
|
import { n as getAttribute, o as storageName, t as formatDbAttributeMigrationMessage } from "./psl-attribute-parsing-BCsFWsSp-LaNsbcrw.mjs";
|
|
6
7
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
7
8
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
@@ -12,10 +13,10 @@ import { InternalError, isInternalError } from "@prisma/orm-framework/utils/inte
|
|
|
12
13
|
import { FunctionCallAst } from "@prisma/orm-framework/psl-parser/syntax";
|
|
13
14
|
import { invariant } from "@prisma/orm-framework/utils/assertions";
|
|
14
15
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
15
|
-
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";
|
|
16
16
|
import { describeTaggedLiteralFailure as describeTaggedLiteralFailure$1 } from "@prisma/orm-framework/components/control";
|
|
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";
|
|
17
18
|
import { instantiatePslFieldPreset, isBareTypeConstructor, mapPslHelperArgs, reportPresetNotCalled, reportTypeConstructorNotCalled } from "@prisma/orm-framework/psl-parser/interpret";
|
|
18
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/psl-field-resolution-
|
|
19
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/psl-field-resolution-BLtSah2i.mjs
|
|
19
20
|
function contractError(code, message, options) {
|
|
20
21
|
return structuredError(code, message, options);
|
|
21
22
|
}
|
|
@@ -441,11 +442,12 @@ function nullLiteral() {
|
|
|
441
442
|
span: nodePslSpan(arg.syntax, ctx.sources)
|
|
442
443
|
}));
|
|
443
444
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
445
|
+
/**
|
|
446
|
+
* A call to the registered default function `name`, with its signature built from the stack's data types when it needs them. Its binding diagnostics name it as a default function.
|
|
447
|
+
*/
|
|
448
|
+
function defaultFunctionCall(name, entry, dataTypes) {
|
|
449
|
+
const signature = blindCast(entry.signature);
|
|
450
|
+
return funcCall(name, typeof signature === "function" ? signature(dataTypes) : signature, { label: `Default function "${name}"` });
|
|
449
451
|
}
|
|
450
452
|
/** The data type of the column a field declares, when its type, or the named type it is declared with, is a constructor or preset the stack knows. */
|
|
451
453
|
function receivingDataType(ctx) {
|
|
@@ -473,7 +475,10 @@ function scalarDefaultArms(isList, receiving, dataTypes, defaultFunctionRegistry
|
|
|
473
475
|
const columnTags = () => tagArms((dataType) => dataType === SQL_EXPRESSION_DATA_TYPE_ID || !isList && receives(dataTypes, receiving, dataType));
|
|
474
476
|
const literal = () => oneOf(writtenScalar(str()), writtenScalar(numLiteral()), writtenScalar(bool()), nullLiteral(), ...tagArms((dataType) => dataType !== SQL_EXPRESSION_DATA_TYPE_ID && receives(dataTypes, receiving, dataType)));
|
|
475
477
|
const listArm = () => writtenList(literal());
|
|
476
|
-
const funcArms = [...defaultFunctionRegistry.entries()].map(([name, entry]) =>
|
|
478
|
+
const funcArms = [...defaultFunctionRegistry.entries()].map(([name, entry]) => mapArg(defaultFunctionCall(name, entry, dataTypes), (call) => ({
|
|
479
|
+
kind: "default-function",
|
|
480
|
+
call
|
|
481
|
+
})));
|
|
477
482
|
return isList ? [
|
|
478
483
|
listArm(),
|
|
479
484
|
...funcArms,
|
|
@@ -713,8 +718,8 @@ function baseModelSpec() {
|
|
|
713
718
|
documentation: "The base model to inherit from."
|
|
714
719
|
}, {
|
|
715
720
|
key: "value",
|
|
716
|
-
type: str(),
|
|
717
|
-
documentation: "The discriminator value identifying this variant."
|
|
721
|
+
type: writtenScalar(str()),
|
|
722
|
+
documentation: "The discriminator value identifying this variant, a value of the discriminator column's type."
|
|
718
723
|
}]
|
|
719
724
|
});
|
|
720
725
|
}
|
|
@@ -1561,7 +1566,8 @@ function lowerGeneratorAttributesForField(input) {
|
|
|
1561
1566
|
args: call.args
|
|
1562
1567
|
}, {
|
|
1563
1568
|
codecId: input.columnDescriptor.codecId,
|
|
1564
|
-
typeParams: input.columnTypeParams
|
|
1569
|
+
typeParams: input.columnTypeParams,
|
|
1570
|
+
length: sqlCodecColumnLength(input.dataTypes, input.columnDescriptor.codecId, input.columnTypeParams)
|
|
1565
1571
|
});
|
|
1566
1572
|
if (resolution.ok) {
|
|
1567
1573
|
phases[phase] = resolution.generator;
|
|
@@ -1933,6 +1939,6 @@ function mergeExecutionDefaults(fromAttributes, fromPreset) {
|
|
|
1933
1939
|
};
|
|
1934
1940
|
}
|
|
1935
1941
|
//#endregion
|
|
1936
|
-
export {
|
|
1942
|
+
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 };
|
|
1937
1943
|
|
|
1938
|
-
//# sourceMappingURL=psl-field-resolution-
|
|
1944
|
+
//# sourceMappingURL=psl-field-resolution-BLtSah2i-BuuJ5H70.mjs.map
|