@prisma/orm-framework 8.0.0-rc.20-dev.14 → 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/{authoring-C9wgJCNs.d.mts → authoring-C2UAuRfN.d.mts} +4 -14
- package/dist/{authoring-C9wgJCNs.d.mts.map → authoring-C2UAuRfN.d.mts.map} +1 -1
- package/dist/{authoring-BNzxszPO.mjs → authoring-CuGQP7_1.mjs} +4 -26
- package/dist/authoring-CuGQP7_1.mjs.map +1 -0
- package/dist/{binder-DJRPMfsD-D7PEvJOJ.d.mts → binder-BszqDG1t-icu83_4f.d.mts} +16 -12
- package/dist/{binder-DJRPMfsD-D7PEvJOJ.d.mts.map → binder-BszqDG1t-icu83_4f.d.mts.map} +1 -1
- package/dist/{components-Cl5lB_Iw.d.mts → components-BenCVFk4.d.mts} +3 -3
- package/dist/{components-Cl5lB_Iw.d.mts.map → components-BenCVFk4.d.mts.map} +1 -1
- package/dist/components.d.mts +10 -10
- package/dist/components.mjs +4 -4
- package/dist/components__authoring.d.mts +4 -4
- package/dist/components__authoring.mjs +3 -3
- package/dist/components__components.d.mts +3 -3
- package/dist/components__control.d.mts +3 -3
- package/dist/components__control.mjs +2 -2
- package/dist/components__execution.d.mts +1 -1
- package/dist/components__psl-ast.d.mts +3 -3
- package/dist/{config-types-j3Elycru.d.mts → config-types-BJ79TZCl.d.mts} +5 -5
- package/dist/{config-types-j3Elycru.d.mts.map → config-types-BJ79TZCl.d.mts.map} +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config__config-types.d.mts +1 -1
- package/dist/contract-authoring.d.mts +19 -54
- package/dist/contract-authoring.d.mts.map +1 -1
- package/dist/contract-authoring.mjs +15 -28
- package/dist/contract-authoring.mjs.map +1 -1
- package/dist/control-B3OS8JEw.d.mts +1 -0
- package/dist/{control-BeXOxtXA-DRX60Yu3.d.mts → control-BeXOxtXA-BU8y-LiK.d.mts} +2 -2
- package/dist/{control-BeXOxtXA-DRX60Yu3.d.mts.map → control-BeXOxtXA-BU8y-LiK.d.mts.map} +1 -1
- package/dist/{control-Df-HE5e4.d.mts → control-CS1uqJj_.d.mts} +8 -9
- package/dist/{control-Df-HE5e4.d.mts.map → control-CS1uqJj_.d.mts.map} +1 -1
- package/dist/{control-DKOWXGUq.mjs → control-Dn1CMH6R.mjs} +8 -16
- package/dist/control-Dn1CMH6R.mjs.map +1 -0
- package/dist/{control-MllEQmML-tXi_WAy3.mjs → control-MllEQmML-BdhmgQVr.mjs} +2 -2
- package/dist/{control-MllEQmML-tXi_WAy3.mjs.map → control-MllEQmML-BdhmgQVr.mjs.map} +1 -1
- package/dist/{declarations-BgUAq1RG-Dz_-EI1Q.mjs → declarations-BgUAq1RG-DPNkVezv.mjs} +2 -2
- package/dist/{declarations-BgUAq1RG-Dz_-EI1Q.mjs.map → declarations-BgUAq1RG-DPNkVezv.mjs.map} +1 -1
- package/dist/errors.d.mts +4 -4
- package/dist/errors.mjs +3 -3
- package/dist/errors__control.d.mts +2 -2
- package/dist/errors__control.mjs +1 -1
- package/dist/errors__execution.d.mts +1 -1
- package/dist/errors__execution.mjs +1 -1
- package/dist/errors__migration.d.mts +1 -1
- package/dist/errors__migration.mjs +1 -1
- package/dist/{execution-D5tvAHf4.d.mts → execution-BPJbNttJ.d.mts} +2 -2
- package/dist/{execution-D5tvAHf4.d.mts.map → execution-BPJbNttJ.d.mts.map} +1 -1
- package/dist/{execution-CgR7dFMU.d.mts → execution-BWR_z8XI.d.mts} +2 -2
- package/dist/{execution-CgR7dFMU.d.mts.map → execution-BWR_z8XI.d.mts.map} +1 -1
- package/dist/{execution-DMsDYKSr.mjs → execution-GInmnTZ9.mjs} +2 -2
- package/dist/{execution-DMsDYKSr.mjs.map → execution-GInmnTZ9.mjs.map} +1 -1
- package/dist/{expressions-CMQzbnHk-BL2zN0Iv.mjs → expressions-CMQzbnHk-FYhlr1aG.mjs} +2 -2
- package/dist/{expressions-CMQzbnHk-BL2zN0Iv.mjs.map → expressions-CMQzbnHk-FYhlr1aG.mjs.map} +1 -1
- package/dist/{framework-authoring-DSqNuI8w-BMQDwpgF.d.mts → framework-authoring-ebqZ8M_M-DIDpVcUB.d.mts} +17 -97
- package/dist/framework-authoring-ebqZ8M_M-DIDpVcUB.d.mts.map +1 -0
- package/dist/{framework-components-BhbsOiJc-BpDfGsqn.d.mts → framework-components-BqHA1V92-D9j8uXa-.d.mts} +3 -3
- package/dist/{framework-components-BhbsOiJc-BpDfGsqn.d.mts.map → framework-components-BqHA1V92-D9j8uXa-.d.mts.map} +1 -1
- package/dist/ids.d.mts +3 -98
- package/dist/ids.d.mts.map +1 -1
- package/dist/ids.mjs +12 -52
- package/dist/ids.mjs.map +1 -1
- package/dist/{migration-DpdvEAEC.mjs → migration-D57w8Uxv.mjs} +2 -2
- package/dist/{migration-DpdvEAEC.mjs.map → migration-D57w8Uxv.mjs.map} +1 -1
- package/dist/{migration-Ox7HWa_t.d.mts → migration-Dk1sYIvs.d.mts} +2 -2
- package/dist/{migration-Ox7HWa_t.d.mts.map → migration-Dk1sYIvs.d.mts.map} +1 -1
- package/dist/{parse-bZgfjovA-BNgYhylT.mjs → parse-bZgfjovA-gD3hVy3X.mjs} +3 -3
- package/dist/{parse-bZgfjovA-BNgYhylT.mjs.map → parse-bZgfjovA-gD3hVy3X.mjs.map} +1 -1
- package/dist/{parse-djL5wker-sY18Mt5K.d.mts → parse-djL5wker-DnMlKOii.d.mts} +6 -6
- package/dist/{parse-djL5wker-sY18Mt5K.d.mts.map → parse-djL5wker-DnMlKOii.d.mts.map} +1 -1
- package/dist/{psl-ast-C8W7AM1f-DYtFq1nP.d.mts → psl-ast-0oMzInxd-Nx9cHmcc.d.mts} +3 -3
- package/dist/{psl-ast-C8W7AM1f-DYtFq1nP.d.mts.map → psl-ast-0oMzInxd-Nx9cHmcc.d.mts.map} +1 -1
- package/dist/psl-ast-CFQfCJeM.d.mts +2 -0
- package/dist/psl-parser.d.mts +12 -12
- package/dist/psl-parser.mjs +17 -55
- package/dist/psl-parser.mjs.map +1 -1
- package/dist/psl-parser__format.d.mts +1 -1
- package/dist/psl-parser__format.mjs +3 -3
- package/dist/psl-parser__interpret.d.mts +30 -30
- package/dist/psl-parser__interpret.d.mts.map +1 -1
- package/dist/psl-parser__interpret.mjs +110 -298
- package/dist/psl-parser__interpret.mjs.map +1 -1
- package/dist/psl-parser__syntax.d.mts +1 -1
- package/dist/psl-parser__syntax.mjs +3 -3
- package/dist/psl-printer.d.mts +4 -4
- package/dist/psl-printer.mjs +1 -1
- package/dist/temporal-type-aliases-BIiamFSH-BrpK13hf.d.mts +133 -0
- package/dist/temporal-type-aliases-BIiamFSH-BrpK13hf.d.mts.map +1 -0
- package/dist/{temporal-presets-5TK1pTYJ-DmhrnMP1.mjs → temporal-type-aliases-D98ei6Fj-DEtfAQYL.mjs} +29 -281
- package/dist/temporal-type-aliases-D98ei6Fj-DEtfAQYL.mjs.map +1 -0
- package/dist/{type-constructor-calls-BLf-HsFy-CHiXyVEH.mjs → type-constructor-calls-CNd1Xlw2-DjyX5mKn.mjs} +52 -7
- package/dist/type-constructor-calls-CNd1Xlw2-DjyX5mKn.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/authoring-BNzxszPO.mjs.map +0 -1
- package/dist/control-CV9doMHb.d.mts +0 -1
- package/dist/control-DKOWXGUq.mjs.map +0 -1
- package/dist/framework-authoring-DSqNuI8w-BMQDwpgF.d.mts.map +0 -1
- package/dist/psl-ast-sZ1tAYRc.d.mts +0 -2
- package/dist/temporal-presets-5TK1pTYJ-DmhrnMP1.mjs.map +0 -1
- package/dist/temporal-presets-De4oKG36-DlGYQgF1.d.mts +0 -258
- package/dist/temporal-presets-De4oKG36-DlGYQgF1.d.mts.map +0 -1
- package/dist/type-constructor-calls-BLf-HsFy-CHiXyVEH.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as PslParserOptions } from "./config-types-
|
|
1
|
+
import { h as PslParserOptions } from "./config-types-BJ79TZCl.mjs";
|
|
2
2
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/format.d.mts
|
|
3
3
|
//#region src/format/options.d.ts
|
|
4
4
|
interface FormatOptions {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { o as structuredError } from "./structured-error-BXbihKQ-.mjs";
|
|
2
2
|
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
3
|
-
import { f as SyntaxNode } from "./expressions-CMQzbnHk-
|
|
4
|
-
import { a as FieldDeclarationAst, c as MixinDeclarationAst, d as ModelDeclarationAst, f as NamedTypeDeclarationAst, h as TypesBlockAst, l as MixinInclusionAst, n as CompositeTypeDeclarationAst, o as GenericBlockDeclarationAst, p as NamespaceDeclarationAst, s as KeyValuePairAst, u as ModelAttributeAst } from "./declarations-BgUAq1RG-
|
|
5
|
-
import { o as parse } from "./parse-bZgfjovA-
|
|
3
|
+
import { f as SyntaxNode } from "./expressions-CMQzbnHk-FYhlr1aG.mjs";
|
|
4
|
+
import { a as FieldDeclarationAst, c as MixinDeclarationAst, d as ModelDeclarationAst, f as NamedTypeDeclarationAst, h as TypesBlockAst, l as MixinInclusionAst, n as CompositeTypeDeclarationAst, o as GenericBlockDeclarationAst, p as NamespaceDeclarationAst, s as KeyValuePairAst, u as ModelAttributeAst } from "./declarations-BgUAq1RG-DPNkVezv.mjs";
|
|
5
|
+
import { o as parse } from "./parse-bZgfjovA-gD3hVy3X.mjs";
|
|
6
6
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/format.mjs
|
|
7
7
|
function emitDocument(document, indentUnit, newline) {
|
|
8
8
|
const writer = new LineWriter(indentUnit, newline);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as Contract } from "./contract-types-DEIEpzU_-DvAVuBr5.mjs";
|
|
2
2
|
import { r as Result } from "./result-BYCOANWy.mjs";
|
|
3
|
-
import { E as
|
|
4
|
-
import "./authoring-
|
|
5
|
-
import "./psl-ast-
|
|
6
|
-
import { c as ContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, p as PslContractSourceProvider, r as ContractSourceDiagnostic } from "./config-types-
|
|
7
|
-
import { B as PslDiagnosticCollector, V as PslSources, d as DiagnosticSource, f as DocumentAst, z as PslDiagnostic } from "./parse-djL5wker-
|
|
8
|
-
import { Ct as ResolvedAttributeArg, Et as ResolvedTypeConstructorCall, L as FieldSymbol, kt as SymbolTable, l as Binder, p as BlockSymbol } from "./binder-
|
|
3
|
+
import { E as AuthoringTypeConstructorDescriptor, dt as PslSpan, i as AuthoringArgumentDescriptor, x as AuthoringPslBlockDescriptorNamespace, z as DataTypeSupport } from "./framework-authoring-ebqZ8M_M-DIDpVcUB.mjs";
|
|
4
|
+
import "./authoring-C2UAuRfN.mjs";
|
|
5
|
+
import "./psl-ast-CFQfCJeM.mjs";
|
|
6
|
+
import { c as ContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, p as PslContractSourceProvider, r as ContractSourceDiagnostic } from "./config-types-BJ79TZCl.mjs";
|
|
7
|
+
import { B as PslDiagnosticCollector, V as PslSources, d as DiagnosticSource, f as DocumentAst, z as PslDiagnostic } from "./parse-djL5wker-DnMlKOii.mjs";
|
|
8
|
+
import { C as ContributedTypeNamespace, Ct as ResolvedAttributeArg, Et as ResolvedTypeConstructorCall, L as FieldSymbol, kt as SymbolTable, l as Binder, p as BlockSymbol } from "./binder-BszqDG1t-icu83_4f.mjs";
|
|
9
9
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts
|
|
10
10
|
//#region src/authoring-arguments.d.ts
|
|
11
11
|
interface MapPslHelperArgsInput {
|
|
@@ -20,35 +20,13 @@ interface MapPslHelperArgsInput {
|
|
|
20
20
|
readonly dataTypes: DataTypeSupport;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* The arguments of a type constructor
|
|
23
|
+
* The arguments of a type constructor call, positional and named, each read as its descriptor says. `undefined`, with a diagnostic pushed, when one cannot be read or does not match a descriptor.
|
|
24
24
|
*/
|
|
25
25
|
declare function mapPslHelperArgs(input: MapPslHelperArgsInput): readonly unknown[] | undefined;
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/enum-member-attributes.d.ts
|
|
28
28
|
declare function enumMemberAttributeDiagnostics(enumBlock: BlockSymbol, sources: PslSources): PslDiagnostic[];
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region src/field-presets.d.ts
|
|
31
|
-
declare function reportPresetNotCalled(input: {
|
|
32
|
-
readonly entityLabel: string;
|
|
33
|
-
readonly presetPath: string;
|
|
34
|
-
readonly source: DiagnosticSource;
|
|
35
|
-
readonly span: PslSpan;
|
|
36
|
-
readonly diagnostics: PslDiagnosticCollector;
|
|
37
|
-
}): void;
|
|
38
|
-
/**
|
|
39
|
-
* Instantiates a field-preset call against its descriptor, coercing PSL AST arguments into the descriptor's typed argument shape and returning the preset's full set of contract contributions.
|
|
40
|
-
*
|
|
41
|
-
* PSL → typed-args coercion happens here (via `mapPslHelperArgs`) so that `instantiateAuthoringFieldPreset` itself stays typed-input-only and TS keeps its zero-runtime-validation cost.
|
|
42
|
-
*/
|
|
43
|
-
declare function instantiatePslFieldPreset(input: {
|
|
44
|
-
readonly call: ResolvedTypeConstructorCall;
|
|
45
|
-
readonly descriptor: AuthoringFieldPresetDescriptor;
|
|
46
|
-
readonly diagnostics: PslDiagnosticCollector;
|
|
47
|
-
readonly source: DiagnosticSource;
|
|
48
|
-
readonly entityLabel: string;
|
|
49
|
-
readonly dataTypes: DataTypeSupport;
|
|
50
|
-
}): ReturnType<typeof instantiateAuthoringFieldPreset> | undefined;
|
|
51
|
-
//#endregion
|
|
52
30
|
//#region src/interpret.d.ts
|
|
53
31
|
/**
|
|
54
32
|
* Lets editor tooling that already parses incrementally (e.g. the language
|
|
@@ -107,6 +85,28 @@ declare function requiredOneToOneBackrelationDiagnostic(input: {
|
|
|
107
85
|
readonly recordNoun: 'row' | 'document';
|
|
108
86
|
}): PslDiagnostic;
|
|
109
87
|
//#endregion
|
|
88
|
+
//#region src/removed-field-presets.d.ts
|
|
89
|
+
/**
|
|
90
|
+
* A field preset Prisma 8 removed, and how to write what it stored. The preset is named only where `type` resolves, and to `codecId` when one is given, so a row does not fire on a target the preset never existed on.
|
|
91
|
+
*/
|
|
92
|
+
interface RemovedFieldPreset {
|
|
93
|
+
readonly type: readonly string[];
|
|
94
|
+
readonly codecId?: string;
|
|
95
|
+
readonly rewrite: (call: ResolvedTypeConstructorCall) => string;
|
|
96
|
+
}
|
|
97
|
+
/** A family's removed field presets, keyed by the path a schema called: the rows of each, of which the first that applies names the rewrite, such as a target's own type before the family's. */
|
|
98
|
+
type RemovedFieldPresets = Readonly<Record<string, readonly RemovedFieldPreset[]>>;
|
|
99
|
+
/** The row of a preset whose rewrite is always `written`, such as `Ulid @id @onCreate(ulid())`; its type is the first word of `written`. */
|
|
100
|
+
declare function removedPresetWrittenAs(written: string, codecId?: string): readonly RemovedFieldPreset[];
|
|
101
|
+
/**
|
|
102
|
+
* The row of a preset that took `onCreate: now` and `onUpdate: now`, and a precision first when `takesPrecision`. Its rewrite writes `type`, with the precision as its argument and `@onCreate(now())` and `@onUpdate(now())` for the phases the call set.
|
|
103
|
+
*/
|
|
104
|
+
declare function removedPresetWithPhases(type: string, codecId: string, takesPrecision: boolean): readonly RemovedFieldPreset[];
|
|
105
|
+
/**
|
|
106
|
+
* The refusal of a call to a field preset Prisma 8 removed, naming what to write instead, or `undefined` when `presets` has no row for the call that applies to a stack whose types `types` holds. A row is skipped when `isDeclared` says the schema declares the first name of its type, because the rewrite would then name the schema's declaration.
|
|
107
|
+
*/
|
|
108
|
+
declare function describeRemovedFieldPreset(presets: RemovedFieldPresets, call: ResolvedTypeConstructorCall, types: ContributedTypeNamespace, isDeclared: (name: string) => boolean): string | undefined;
|
|
109
|
+
//#endregion
|
|
110
110
|
//#region src/type-constructor-calls.d.ts
|
|
111
111
|
declare function isBareTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor): boolean;
|
|
112
112
|
declare function reportTypeConstructorNotCalled(input: {
|
|
@@ -123,5 +123,5 @@ declare function reportTypeConstructorNotCalled(input: {
|
|
|
123
123
|
declare function claimedBlockKeywords(descriptors: AuthoringPslBlockDescriptorNamespace | undefined): ReadonlySet<string>;
|
|
124
124
|
declare function unsupportedBlockDiagnostic(block: BlockSymbol, sources: PslSources): PslDiagnostic;
|
|
125
125
|
//#endregion
|
|
126
|
-
export { type InvalidFkPairing, type PslInterpretCapable, type PslInterpretInput, claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter,
|
|
126
|
+
export { type InvalidFkPairing, type PslInterpretCapable, type PslInterpretInput, type RemovedFieldPreset, type RemovedFieldPresets, claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, isBareTypeConstructor, mapPslHelperArgs, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };
|
|
127
127
|
//# sourceMappingURL=psl-parser__interpret.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;UAQU;WACC,eAAe;WACf,sBAAsB;WACtB;WACA,MAAM;WACN,aAAa;WACb,QAAQ;WACR;;WAEA,WAAW;;;;;iBAKL,iBAAiB,OAAO;;;iBAGxB,+BAA+B,WAAW,aAAa,SAAS,aAAa
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;UAQU;WACC,eAAe;WACf,sBAAsB;WACtB;WACA,MAAM;WACN,aAAa;WACb,QAAQ;WACR;;WAEA,WAAW;;;;;iBAKL,iBAAiB,OAAO;;;iBAGxB,+BAA+B,WAAW,aAAa,SAAS,aAAa;;;;;;;;UAQpF;WACC,oBAAoB;WACpB,SAAS;WACT,aAAa;WACb,QAAQ;;;;;;;;UAQT,4BAA4B;EACpC,UAAU,OAAO,mBAAmB,SAAS,wBAAwB,OAAO,UAAU;;;;;;;;iBAQvE,oBAAoB,QAAQ,OAAO,UAAU,4BAA4B,0BAA0B,6BAA6B,OAAO,UAAU;;iBAEjJ,kBAAkB,QAAQ,yBAAyB,UAAU;;;;;;;;KAQzE;WACM;WACA;;iBAEM,kBAAkB,4BAA4B;;;;;;iBAM9C,wBAAwB;WAC9B;GACR,iBAAiB,mBAAmB;iBACtB,uCAAuC;WAC7C;WACA,OAAO;WACP;WACA,SAAS;WACT;IACP;;;;;;UAMM;WACC;WACA;WACA,UAAU,MAAM;;;KAGtB,sBAAsB,SAAS,wBAAwB;;iBAE3C,uBAAuB,iBAAiB,4BAA4B;;;;iBAIpE,wBAAwB,cAAc,iBAAiB,mCAAmC;;;;iBAI1F,2BAA2B,SAAS,qBAAqB,MAAM,6BAA6B,OAAO,0BAA0B,aAAa;;;iBAG1I,sBAAsB,YAAY;iBAClC,+BAA+B;WACrC;WACA;WACA,YAAY;WACZ,QAAQ;WACR,MAAM;WACN,aAAa;;;;;iBAKP,qBAAqB,aAAa,mDAAmD;iBACrF,2BAA2B,OAAO,aAAa,SAAS,aAAa"}
|
|
@@ -1,205 +1,62 @@
|
|
|
1
1
|
import { t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
2
|
-
import { n as notOk } from "./result-8OXF26MN.mjs";
|
|
2
|
+
import { n as notOk, r as ok } from "./result-8OXF26MN.mjs";
|
|
3
3
|
import { u as dataTypeId } from "./data-type-V6mcDhcG-DVQAPOQT.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { T as isAuthoringPslBlockDescriptor } from "./temporal-type-aliases-D98ei6Fj-DEtfAQYL.mjs";
|
|
5
|
+
import { a as contributedTypeCodecId, f as nodePslSpan, i as contributedTypeAt, l as diagnosticSource, n as readExpressionAs, r as reportTypeConstructorNotCalled, t as isBareTypeConstructor, u as keywordPslSpan } from "./type-constructor-calls-CNd1Xlw2-DjyX5mKn.mjs";
|
|
6
6
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
return match[2] ?? "";
|
|
7
|
+
/** The call as the schema writes it, with its arguments separated by `, `. */
|
|
8
|
+
function printTypeConstructorCall(call) {
|
|
9
|
+
const args = call.args.map((arg) => arg.kind === "named" ? `${arg.name}: ${arg.value}` : arg.value);
|
|
10
|
+
return `${call.path.join(".")}(${args.join(", ")})`;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
result += character;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
const escaped = value[index];
|
|
49
|
-
index += 1;
|
|
50
|
-
if (escaped === void 0) return INVALID_AUTHORING_ARGUMENT;
|
|
51
|
-
switch (escaped) {
|
|
52
|
-
case "'":
|
|
53
|
-
case "\"":
|
|
54
|
-
case "\\":
|
|
55
|
-
case "/":
|
|
56
|
-
result += escaped;
|
|
57
|
-
break;
|
|
58
|
-
case "b":
|
|
59
|
-
result += "\b";
|
|
60
|
-
break;
|
|
61
|
-
case "f":
|
|
62
|
-
result += "\f";
|
|
63
|
-
break;
|
|
64
|
-
case "n":
|
|
65
|
-
result += "\n";
|
|
66
|
-
break;
|
|
67
|
-
case "r":
|
|
68
|
-
result += "\r";
|
|
69
|
-
break;
|
|
70
|
-
case "t":
|
|
71
|
-
result += " ";
|
|
72
|
-
break;
|
|
73
|
-
case "u": {
|
|
74
|
-
const hex = value.slice(index, index + 4);
|
|
75
|
-
if (!/^[0-9A-Fa-f]{4}$/.test(hex)) return INVALID_AUTHORING_ARGUMENT;
|
|
76
|
-
result += String.fromCharCode(Number.parseInt(hex, 16));
|
|
77
|
-
index += 4;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
default: return INVALID_AUTHORING_ARGUMENT;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
84
|
-
}
|
|
85
|
-
function parseNumber() {
|
|
86
|
-
const raw = value.slice(index).match(/^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/)?.[0];
|
|
87
|
-
if (!raw) return INVALID_AUTHORING_ARGUMENT;
|
|
88
|
-
const parsed = Number(raw);
|
|
89
|
-
if (!Number.isFinite(parsed)) return INVALID_AUTHORING_ARGUMENT;
|
|
90
|
-
index += raw.length;
|
|
91
|
-
return parsed;
|
|
92
|
-
}
|
|
93
|
-
function parseArray() {
|
|
94
|
-
if (value[index] !== "[") return INVALID_AUTHORING_ARGUMENT;
|
|
95
|
-
index += 1;
|
|
96
|
-
const result = [];
|
|
97
|
-
skipWhitespace();
|
|
98
|
-
if (value[index] === "]") {
|
|
99
|
-
index += 1;
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
while (index < value.length) {
|
|
103
|
-
const entry = parseValue();
|
|
104
|
-
if (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
105
|
-
result.push(entry);
|
|
106
|
-
skipWhitespace();
|
|
107
|
-
if (value[index] === ",") {
|
|
108
|
-
index += 1;
|
|
109
|
-
skipWhitespace();
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
if (value[index] === "]") {
|
|
113
|
-
index += 1;
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
117
|
-
}
|
|
118
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
119
|
-
}
|
|
120
|
-
function parseObject() {
|
|
121
|
-
if (value[index] !== "{") return INVALID_AUTHORING_ARGUMENT;
|
|
122
|
-
index += 1;
|
|
123
|
-
const result = {};
|
|
124
|
-
skipWhitespace();
|
|
125
|
-
if (value[index] === "}") {
|
|
126
|
-
index += 1;
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
while (index < value.length) {
|
|
130
|
-
skipWhitespace();
|
|
131
|
-
const key = value[index] === "\"" || value[index] === "'" ? parseString() : parseIdentifier();
|
|
132
|
-
if (key === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
133
|
-
skipWhitespace();
|
|
134
|
-
if (value[index] !== ":") return INVALID_AUTHORING_ARGUMENT;
|
|
135
|
-
index += 1;
|
|
136
|
-
const entry = parseValue();
|
|
137
|
-
if (entry === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
138
|
-
result[key] = entry;
|
|
139
|
-
skipWhitespace();
|
|
140
|
-
if (value[index] === ",") {
|
|
141
|
-
index += 1;
|
|
142
|
-
skipWhitespace();
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (value[index] === "}") {
|
|
146
|
-
index += 1;
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
150
|
-
}
|
|
151
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
152
|
-
}
|
|
153
|
-
function parseValue() {
|
|
154
|
-
skipWhitespace();
|
|
155
|
-
const character = value[index];
|
|
156
|
-
if (character === "{") return parseObject();
|
|
157
|
-
if (character === "[") return parseArray();
|
|
158
|
-
if (character === "\"" || character === "'") return parseString();
|
|
159
|
-
if (character === "-" || character === "+" || /\d/.test(character ?? "")) return parseNumber();
|
|
160
|
-
const identifier = parseIdentifier();
|
|
161
|
-
if (identifier === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
162
|
-
if (identifier === "true") return true;
|
|
163
|
-
if (identifier === "false") return false;
|
|
164
|
-
if (identifier === "null") return null;
|
|
165
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
166
|
-
}
|
|
167
|
-
skipWhitespace();
|
|
168
|
-
const parsed = parseValue();
|
|
169
|
-
if (parsed === INVALID_AUTHORING_ARGUMENT) return parsed;
|
|
170
|
-
skipWhitespace();
|
|
171
|
-
return index === value.length ? parsed : INVALID_AUTHORING_ARGUMENT;
|
|
172
|
-
}
|
|
173
|
-
function isPlainObject(value) {
|
|
174
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
175
|
-
}
|
|
176
|
-
function parsePslObjectLiteral(value) {
|
|
177
|
-
const trimmed = value.trim();
|
|
178
|
-
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) return INVALID_AUTHORING_ARGUMENT;
|
|
179
|
-
let parsed;
|
|
180
|
-
try {
|
|
181
|
-
parsed = JSON.parse(trimmed);
|
|
182
|
-
} catch {
|
|
183
|
-
parsed = parseJsLikeLiteral(trimmed);
|
|
184
|
-
if (parsed === INVALID_AUTHORING_ARGUMENT) return INVALID_AUTHORING_ARGUMENT;
|
|
12
|
+
/**
|
|
13
|
+
* Binds a call's arguments to its parameters, as PSL reads every call: the positional arguments fill the parameters in order, wherever named ones sit among them, and a named argument fills the parameter it names, which no other argument may fill. The bound arguments come positional ones first, then named ones, each in the order written.
|
|
14
|
+
*/
|
|
15
|
+
function bindCallArguments(args, parameters) {
|
|
16
|
+
const positional = args.filter((arg) => arg.kind === "positional");
|
|
17
|
+
if (positional.length > parameters.length) return notOk({
|
|
18
|
+
kind: "tooManyPositional",
|
|
19
|
+
received: positional.length,
|
|
20
|
+
bound: []
|
|
21
|
+
});
|
|
22
|
+
const bound = positional.map((argument, index) => ({
|
|
23
|
+
argument,
|
|
24
|
+
index
|
|
25
|
+
}));
|
|
26
|
+
const filled = new Set(bound.map(({ index }) => index));
|
|
27
|
+
for (const argument of args.filter((arg) => arg.kind === "named")) {
|
|
28
|
+
const index = argument.name === void 0 ? -1 : parameters.indexOf(argument.name);
|
|
29
|
+
if (index < 0) return notOk({
|
|
30
|
+
kind: "unknownName",
|
|
31
|
+
argument,
|
|
32
|
+
bound
|
|
33
|
+
});
|
|
34
|
+
if (filled.has(index)) return notOk({
|
|
35
|
+
kind: "filledTwice",
|
|
36
|
+
argument,
|
|
37
|
+
bound
|
|
38
|
+
});
|
|
39
|
+
filled.add(index);
|
|
40
|
+
bound.push({
|
|
41
|
+
argument,
|
|
42
|
+
index
|
|
43
|
+
});
|
|
185
44
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const trimmed = rawValue.trim();
|
|
198
|
-
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(trimmed) ? trimmed : INVALID_AUTHORING_ARGUMENT;
|
|
199
|
-
}
|
|
200
|
-
default: return INVALID_AUTHORING_ARGUMENT;
|
|
45
|
+
return ok(bound);
|
|
46
|
+
}
|
|
47
|
+
/** Each argument's value, keyed by the parameter it fills, as {@link bindCallArguments} binds them; `undefined` when they do not bind. */
|
|
48
|
+
function argumentsByParameter(args, parameters) {
|
|
49
|
+
const bound = bindCallArguments(args, parameters);
|
|
50
|
+
if (!bound.ok) return void 0;
|
|
51
|
+
const values = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const { argument, index } of bound.value) {
|
|
53
|
+
const parameter = parameters[index];
|
|
54
|
+
if (parameter === void 0) return void 0;
|
|
55
|
+
values.set(parameter, argument.value);
|
|
201
56
|
}
|
|
57
|
+
return values;
|
|
202
58
|
}
|
|
59
|
+
const INVALID_AUTHORING_ARGUMENT = Symbol("invalidAuthoringArgument");
|
|
203
60
|
function pushInvalidPslHelperArgument(input) {
|
|
204
61
|
input.diagnostics.push({
|
|
205
62
|
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
@@ -208,24 +65,9 @@ function pushInvalidPslHelperArgument(input) {
|
|
|
208
65
|
});
|
|
209
66
|
}
|
|
210
67
|
/**
|
|
211
|
-
* The value of one argument as
|
|
68
|
+
* The value of one argument as a value of its descriptor's data type, read from its expression as attribute arguments are. A refusal is pushed as a diagnostic at the argument.
|
|
212
69
|
*/
|
|
213
70
|
function readPslHelperArgument(input, descriptor, argument, argumentLabel) {
|
|
214
|
-
const invalid = () => {
|
|
215
|
-
pushInvalidPslHelperArgument({
|
|
216
|
-
diagnostics: input.diagnostics,
|
|
217
|
-
source: input.source,
|
|
218
|
-
span: argument.span,
|
|
219
|
-
entityLabel: input.entityLabel,
|
|
220
|
-
helperLabel: input.helperLabel,
|
|
221
|
-
message: `cannot parse ${argumentLabel} for descriptor kind "${descriptor.kind}".`
|
|
222
|
-
});
|
|
223
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
224
|
-
};
|
|
225
|
-
if (descriptor.kind !== "value") {
|
|
226
|
-
const value = parsePslAuthoringArgumentText(descriptor, argument.value);
|
|
227
|
-
return value === INVALID_AUTHORING_ARGUMENT ? invalid() : value;
|
|
228
|
-
}
|
|
229
71
|
const { expression } = argument;
|
|
230
72
|
if (expression === void 0 && argument.node !== void 0) {
|
|
231
73
|
pushInvalidPslHelperArgument({
|
|
@@ -249,66 +91,33 @@ function readPslHelperArgument(input, descriptor, argument, argumentLabel) {
|
|
|
249
91
|
return INVALID_AUTHORING_ARGUMENT;
|
|
250
92
|
}
|
|
251
93
|
/**
|
|
252
|
-
* The arguments of a type constructor
|
|
94
|
+
* The arguments of a type constructor call, positional and named, each read as its descriptor says. `undefined`, with a diagnostic pushed, when one cannot be read or does not match a descriptor.
|
|
253
95
|
*/
|
|
254
96
|
function mapPslHelperArgs(input) {
|
|
255
|
-
const
|
|
256
|
-
const positionalArgs = input.args.filter((arg) => arg.kind === "positional");
|
|
257
|
-
const namedArgs = input.args.filter((arg) => arg.kind === "named");
|
|
258
|
-
if (positionalArgs.length > input.descriptors.length) return pushInvalidPslHelperArgument({
|
|
97
|
+
const refuse = (span, message) => pushInvalidPslHelperArgument({
|
|
259
98
|
diagnostics: input.diagnostics,
|
|
260
99
|
source: input.source,
|
|
261
|
-
span
|
|
100
|
+
span,
|
|
262
101
|
entityLabel: input.entityLabel,
|
|
263
102
|
helperLabel: input.helperLabel,
|
|
264
|
-
message
|
|
103
|
+
message
|
|
265
104
|
});
|
|
266
|
-
|
|
105
|
+
const bound = bindCallArguments(input.args, input.descriptors.map((descriptor) => descriptor?.name));
|
|
106
|
+
const mappedArgs = input.descriptors.map(() => void 0);
|
|
107
|
+
for (const { argument, index } of bound.ok ? bound.value : bound.failure.bound) {
|
|
267
108
|
const descriptor = input.descriptors[index];
|
|
268
|
-
if (!descriptor) return
|
|
269
|
-
|
|
270
|
-
source: input.source,
|
|
271
|
-
span: argument.span,
|
|
272
|
-
entityLabel: input.entityLabel,
|
|
273
|
-
helperLabel: input.helperLabel,
|
|
274
|
-
message: `does not define positional argument #${index + 1}.`
|
|
275
|
-
});
|
|
276
|
-
const value = readPslHelperArgument(input, descriptor, argument, `argument #${index + 1}`);
|
|
109
|
+
if (!descriptor) return refuse(argument.span, `does not define positional argument #${index + 1}.`);
|
|
110
|
+
const value = readPslHelperArgument(input, descriptor, argument, argument.kind === "named" ? `named argument "${argument.name}"` : `argument #${index + 1}`);
|
|
277
111
|
if (value === INVALID_AUTHORING_ARGUMENT) return void 0;
|
|
278
112
|
mappedArgs[index] = value;
|
|
279
113
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
entityLabel: input.entityLabel,
|
|
287
|
-
helperLabel: input.helperLabel,
|
|
288
|
-
message: `received unknown named argument "${argument.name}".`
|
|
289
|
-
});
|
|
290
|
-
if (mappedArgs[descriptorIndex] !== void 0) return pushInvalidPslHelperArgument({
|
|
291
|
-
diagnostics: input.diagnostics,
|
|
292
|
-
source: input.source,
|
|
293
|
-
span: argument.span,
|
|
294
|
-
entityLabel: input.entityLabel,
|
|
295
|
-
helperLabel: input.helperLabel,
|
|
296
|
-
message: `received duplicate value for argument "${argument.name}".`
|
|
297
|
-
});
|
|
298
|
-
const descriptor = input.descriptors[descriptorIndex];
|
|
299
|
-
if (!descriptor) return pushInvalidPslHelperArgument({
|
|
300
|
-
diagnostics: input.diagnostics,
|
|
301
|
-
source: input.source,
|
|
302
|
-
span: argument.span,
|
|
303
|
-
entityLabel: input.entityLabel,
|
|
304
|
-
helperLabel: input.helperLabel,
|
|
305
|
-
message: `does not define named argument "${argument.name}".`
|
|
306
|
-
});
|
|
307
|
-
const value = readPslHelperArgument(input, descriptor, argument, `named argument "${argument.name}"`);
|
|
308
|
-
if (value === INVALID_AUTHORING_ARGUMENT) return void 0;
|
|
309
|
-
mappedArgs[descriptorIndex] = value;
|
|
114
|
+
if (bound.ok) return mappedArgs;
|
|
115
|
+
const failure = bound.failure;
|
|
116
|
+
switch (failure.kind) {
|
|
117
|
+
case "tooManyPositional": return refuse(input.span, `accepts at most ${input.descriptors.length} argument(s), received ${failure.received}.`);
|
|
118
|
+
case "unknownName": return refuse(failure.argument.span, `received unknown named argument "${failure.argument.name}".`);
|
|
119
|
+
case "filledTwice": return refuse(failure.argument.span, `received duplicate value for argument "${failure.argument.name}".`);
|
|
310
120
|
}
|
|
311
|
-
return mappedArgs;
|
|
312
121
|
}
|
|
313
122
|
function enumMemberAttributeDiagnostics(enumBlock, sources) {
|
|
314
123
|
const source = diagnosticSource(sources, enumBlock.node.syntax);
|
|
@@ -318,44 +127,6 @@ function enumMemberAttributeDiagnostics(enumBlock, sources) {
|
|
|
318
127
|
...source.at(nodePslSpan(attribute.syntax, sources))
|
|
319
128
|
})));
|
|
320
129
|
}
|
|
321
|
-
function reportPresetNotCalled(input) {
|
|
322
|
-
input.diagnostics.push({
|
|
323
|
-
code: "PSL_PRESET_NOT_CALLED",
|
|
324
|
-
message: `${input.entityLabel} uses field preset "${input.presetPath}" without calling it. Write ${input.presetPath}().`,
|
|
325
|
-
...input.source.at(input.span)
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Instantiates a field-preset call against its descriptor, coercing PSL AST arguments into the descriptor's typed argument shape and returning the preset's full set of contract contributions.
|
|
330
|
-
*
|
|
331
|
-
* PSL → typed-args coercion happens here (via `mapPslHelperArgs`) so that `instantiateAuthoringFieldPreset` itself stays typed-input-only and TS keeps its zero-runtime-validation cost.
|
|
332
|
-
*/
|
|
333
|
-
function instantiatePslFieldPreset(input) {
|
|
334
|
-
const helperPath = input.call.path.join(".");
|
|
335
|
-
const args = mapPslHelperArgs({
|
|
336
|
-
args: input.call.args,
|
|
337
|
-
descriptors: input.descriptor.args ?? [],
|
|
338
|
-
helperLabel: `preset "${helperPath}"`,
|
|
339
|
-
span: input.call.span,
|
|
340
|
-
diagnostics: input.diagnostics,
|
|
341
|
-
source: input.source,
|
|
342
|
-
entityLabel: input.entityLabel,
|
|
343
|
-
dataTypes: input.dataTypes
|
|
344
|
-
});
|
|
345
|
-
if (!args) return;
|
|
346
|
-
try {
|
|
347
|
-
validateAuthoringHelperArguments(helperPath, input.descriptor.args, args);
|
|
348
|
-
return instantiateAuthoringFieldPreset(input.descriptor, args);
|
|
349
|
-
} catch (error) {
|
|
350
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
351
|
-
input.diagnostics.push({
|
|
352
|
-
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
353
|
-
message: `${input.entityLabel}: ${message}`,
|
|
354
|
-
...input.source.at(input.call.span)
|
|
355
|
-
});
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
130
|
/**
|
|
360
131
|
* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an
|
|
361
132
|
* interpretation result. The authored headline is deliberately uniform — it
|
|
@@ -397,6 +168,47 @@ function requiredOneToOneBackrelationDiagnostic(input) {
|
|
|
397
168
|
...diagnosticSource(sources, field.node.syntax).at(field.span)
|
|
398
169
|
};
|
|
399
170
|
}
|
|
171
|
+
const PHASES = ["onCreate", "onUpdate"];
|
|
172
|
+
/** The row of a preset whose rewrite is always `written`, such as `Ulid @id @onCreate(ulid())`; its type is the first word of `written`. */
|
|
173
|
+
function removedPresetWrittenAs(written, codecId) {
|
|
174
|
+
const [type = written] = written.split(/[ (]/);
|
|
175
|
+
return [{
|
|
176
|
+
type: type.split("."),
|
|
177
|
+
...codecId === void 0 ? {} : { codecId },
|
|
178
|
+
rewrite: () => `Write ${written}.`
|
|
179
|
+
}];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The row of a preset that took `onCreate: now` and `onUpdate: now`, and a precision first when `takesPrecision`. Its rewrite writes `type`, with the precision as its argument and `@onCreate(now())` and `@onUpdate(now())` for the phases the call set.
|
|
183
|
+
*/
|
|
184
|
+
function removedPresetWithPhases(type, codecId, takesPrecision) {
|
|
185
|
+
const parameters = takesPrecision ? ["precision", ...PHASES] : [...PHASES];
|
|
186
|
+
const fallback = `Write ${type}${takesPrecision ? "(...)" : ""} with @onCreate(now()) and @onUpdate(now()) for the phases the preset set.`;
|
|
187
|
+
return [{
|
|
188
|
+
type: [type],
|
|
189
|
+
codecId,
|
|
190
|
+
rewrite: (call) => {
|
|
191
|
+
const args = argumentsByParameter(call.args, parameters);
|
|
192
|
+
const precision = args?.get("precision");
|
|
193
|
+
if (args === void 0 || precision !== void 0 && !/^\d+$/.test(precision) || PHASES.some((phase) => args.has(phase) && args.get(phase) !== "now")) return fallback;
|
|
194
|
+
const attributes = PHASES.filter((phase) => args.has(phase)).map((phase) => ` @${phase}(now())`);
|
|
195
|
+
return `Write ${type}${precision === void 0 ? "" : `(${precision})`}${attributes.join("")}.`;
|
|
196
|
+
}
|
|
197
|
+
}];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The refusal of a call to a field preset Prisma 8 removed, naming what to write instead, or `undefined` when `presets` has no row for the call that applies to a stack whose types `types` holds. A row is skipped when `isDeclared` says the schema declares the first name of its type, because the rewrite would then name the schema's declaration.
|
|
201
|
+
*/
|
|
202
|
+
function describeRemovedFieldPreset(presets, call, types, isDeclared) {
|
|
203
|
+
const path = call.path.join(".");
|
|
204
|
+
const preset = (Object.hasOwn(presets, path) ? presets[path] : void 0)?.find((row) => {
|
|
205
|
+
const [name] = row.type;
|
|
206
|
+
const replacement = contributedTypeAt(types, row.type);
|
|
207
|
+
return replacement !== void 0 && (name === void 0 || !isDeclared(name)) && (row.codecId === void 0 || contributedTypeCodecId(replacement) === row.codecId);
|
|
208
|
+
});
|
|
209
|
+
if (preset === void 0) return void 0;
|
|
210
|
+
return `${printTypeConstructorCall(call)} was a field preset, and Prisma 8 removed field presets. ${preset.rewrite(call)}`;
|
|
211
|
+
}
|
|
400
212
|
/** A generic block is read only when a composed descriptor claims its keyword. */
|
|
401
213
|
function claimedBlockKeywords(descriptors) {
|
|
402
214
|
const keywords = /* @__PURE__ */ new Set();
|
|
@@ -411,6 +223,6 @@ function unsupportedBlockDiagnostic(block, sources) {
|
|
|
411
223
|
};
|
|
412
224
|
}
|
|
413
225
|
//#endregion
|
|
414
|
-
export { claimedBlockKeywords, consumeInvalidFkPairing, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter,
|
|
226
|
+
export { claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, isBareTypeConstructor, mapPslHelperArgs, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };
|
|
415
227
|
|
|
416
228
|
//# sourceMappingURL=psl-parser__interpret.mjs.map
|