@prisma/orm-framework 8.0.0-rc.21-dev.6 → 8.0.0-rc.21-dev.7
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-D75oR8Nt.d.mts → authoring-BKOoGNxH.d.mts} +56 -4
- package/dist/authoring-BKOoGNxH.d.mts.map +1 -0
- package/dist/{authoring-4wc_1ETR.mjs → authoring-CcfXu8Dz.mjs} +377 -31
- package/dist/authoring-CcfXu8Dz.mjs.map +1 -0
- package/dist/{framework-authoring-ebqZ8M_M-Bdi8MutX.d.mts → authoring-type-choice-CHcRX0RP-CkG1L8a9.d.mts} +111 -27
- package/dist/authoring-type-choice-CHcRX0RP-CkG1L8a9.d.mts.map +1 -0
- package/dist/{binder-BszqDG1t-pSH-fXt5.d.mts → binder-CMy3WM5A-DRrDzBAq.d.mts} +35 -17
- package/dist/{binder-BszqDG1t-pSH-fXt5.d.mts.map → binder-CMy3WM5A-DRrDzBAq.d.mts.map} +1 -1
- package/dist/{components-CHWGZJ5q.d.mts → components-BvnVHOK3.d.mts} +3 -3
- package/dist/{components-CHWGZJ5q.d.mts.map → components-BvnVHOK3.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-B0JjhuaX.d.mts → config-types-De3gHQOy.d.mts} +5 -5
- package/dist/{config-types-B0JjhuaX.d.mts.map → config-types-De3gHQOy.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 +2 -2
- package/dist/contract-authoring.mjs +3 -3
- package/dist/{control-DLpQIwer.mjs → control-BE0sjzPI.mjs} +6 -2
- package/dist/control-BE0sjzPI.mjs.map +1 -0
- package/dist/{control-BeXOxtXA-DyPvQsqJ.d.mts → control-BeXOxtXA-DOfRFBDx.d.mts} +2 -2
- package/dist/{control-BeXOxtXA-DyPvQsqJ.d.mts.map → control-BeXOxtXA-DOfRFBDx.d.mts.map} +1 -1
- package/dist/{control-BrO2h8ed.d.mts → control-DanUY6NX.d.mts} +5 -5
- package/dist/{control-BrO2h8ed.d.mts.map → control-DanUY6NX.d.mts.map} +1 -1
- package/dist/{control-MllEQmML-yjvIIvnf.mjs → control-MllEQmML-BgM0TgK3.mjs} +2 -2
- package/dist/{control-MllEQmML-yjvIIvnf.mjs.map → control-MllEQmML-BgM0TgK3.mjs.map} +1 -1
- package/dist/control-QJnHVB3m.d.mts +1 -0
- package/dist/{declarations-BgUAq1RG-D99LhVXe.mjs → declarations-BgUAq1RG-DvmyJ8LS.mjs} +2 -2
- package/dist/{declarations-BgUAq1RG-D99LhVXe.mjs.map → declarations-BgUAq1RG-DvmyJ8LS.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-CXXKXfwB.mjs → execution-BkFLjpfc.mjs} +2 -2
- package/dist/{execution-CXXKXfwB.mjs.map → execution-BkFLjpfc.mjs.map} +1 -1
- package/dist/{execution-Cgkrs6UV.d.mts → execution-C_12rfIR.d.mts} +2 -2
- package/dist/{execution-Cgkrs6UV.d.mts.map → execution-C_12rfIR.d.mts.map} +1 -1
- package/dist/{execution-BhFeCTkt.d.mts → execution-CyddhERj.d.mts} +2 -2
- package/dist/{execution-BhFeCTkt.d.mts.map → execution-CyddhERj.d.mts.map} +1 -1
- package/dist/{expressions-CMQzbnHk-Db8YJA0B.mjs → expressions-CMQzbnHk-B7zBWJ0c.mjs} +2 -2
- package/dist/{expressions-CMQzbnHk-Db8YJA0B.mjs.map → expressions-CMQzbnHk-B7zBWJ0c.mjs.map} +1 -1
- package/dist/{framework-components-BqHA1V92-D_nUDFf9.d.mts → framework-components-GBAmsfWO-DUJQpMpU.d.mts} +3 -3
- package/dist/{framework-components-BqHA1V92-D_nUDFf9.d.mts.map → framework-components-GBAmsfWO-DUJQpMpU.d.mts.map} +1 -1
- package/dist/{migration-CMMT3vcR.d.mts → migration-B7ur91Et.d.mts} +2 -2
- package/dist/{migration-CMMT3vcR.d.mts.map → migration-B7ur91Et.d.mts.map} +1 -1
- package/dist/{migration-B1TEF2ij.mjs → migration-CQufZA_7.mjs} +2 -2
- package/dist/{migration-B1TEF2ij.mjs.map → migration-CQufZA_7.mjs.map} +1 -1
- package/dist/{parse-bZgfjovA-CaBuZnet.mjs → parse-bZgfjovA-Vk8LMIu5.mjs} +3 -3
- package/dist/{parse-bZgfjovA-CaBuZnet.mjs.map → parse-bZgfjovA-Vk8LMIu5.mjs.map} +1 -1
- package/dist/{parse-djL5wker-Bf4uawTE.d.mts → parse-djL5wker-4_2Cqwev.d.mts} +6 -6
- package/dist/{parse-djL5wker-Bf4uawTE.d.mts.map → parse-djL5wker-4_2Cqwev.d.mts.map} +1 -1
- package/dist/{psl-ast-0oMzInxd-BjKbrwNk.d.mts → psl-ast-B4ZxpQdr-DT9LRqBC.d.mts} +3 -3
- package/dist/{psl-ast-0oMzInxd-BjKbrwNk.d.mts.map → psl-ast-B4ZxpQdr-DT9LRqBC.d.mts.map} +1 -1
- package/dist/psl-ast-Dsf1-QLK.d.mts +2 -0
- package/dist/psl-parser.d.mts +22 -13
- package/dist/psl-parser.d.mts.map +1 -1
- package/dist/psl-parser.mjs +29 -43
- 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 +64 -22
- package/dist/psl-parser__interpret.d.mts.map +1 -1
- package/dist/psl-parser__interpret.mjs +135 -140
- 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-C9tIy4rv-Dsun86cY.mjs → temporal-type-aliases-BI3SL5iB-DIP8j4Gv.mjs} +383 -172
- package/dist/temporal-type-aliases-BI3SL5iB-DIP8j4Gv.mjs.map +1 -0
- package/dist/{temporal-type-aliases-BIiamFSH-DLxWO37e.d.mts → temporal-type-aliases-D5QWPhYa-BNKiNvmd.d.mts} +3 -3
- package/dist/{temporal-type-aliases-BIiamFSH-DLxWO37e.d.mts.map → temporal-type-aliases-D5QWPhYa-BNKiNvmd.d.mts.map} +1 -1
- package/dist/type-constructor-calls-Bfg5ojed-DYHnzC9z.mjs +538 -0
- package/dist/type-constructor-calls-Bfg5ojed-DYHnzC9z.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/authoring-4wc_1ETR.mjs.map +0 -1
- package/dist/authoring-D75oR8Nt.d.mts.map +0 -1
- package/dist/control-COPuZO7V.d.mts +0 -1
- package/dist/control-DLpQIwer.mjs.map +0 -1
- package/dist/framework-authoring-ebqZ8M_M-Bdi8MutX.d.mts.map +0 -1
- package/dist/psl-ast-DjTRQDW7.d.mts +0 -2
- package/dist/temporal-type-aliases-C9tIy4rv-Dsun86cY.mjs.map +0 -1
- package/dist/type-constructor-calls-CNd1Xlw2-CfYTYNSm.mjs +0 -306
- package/dist/type-constructor-calls-CNd1Xlw2-CfYTYNSm.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as PslParserOptions } from "./config-types-
|
|
1
|
+
import { h as PslParserOptions } from "./config-types-De3gHQOy.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-B7zBWJ0c.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-DvmyJ8LS.mjs";
|
|
5
|
+
import { o as parse } from "./parse-bZgfjovA-Vk8LMIu5.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,26 +1,32 @@
|
|
|
1
1
|
import { t as Contract } from "./contract-types-ib-VnKHG-l9vE5Vd-.mjs";
|
|
2
|
+
import { p as CodecLookupWithDescriptors } from "./codec-types-B4wPvO-K-BIPFT7EP.mjs";
|
|
2
3
|
import { r as Result } from "./result-BYCOANWy.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import "./authoring-
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { G as DataTypeSupport, O as AuthoringTypeChoiceOption, St as ScalarTypeConstructorOutput, _t as PslSpan, i as AuthoringArgumentDescriptor, j as AuthoringTypeConstructorDescriptor, x as AuthoringPslBlockDescriptorNamespace } from "./authoring-type-choice-CHcRX0RP-CkG1L8a9.mjs";
|
|
5
|
+
import "./authoring-BKOoGNxH.mjs";
|
|
6
|
+
import "./codec-h0kvF5B8.mjs";
|
|
7
|
+
import "./psl-ast-Dsf1-QLK.mjs";
|
|
8
|
+
import { c as ContractSourceProvider, n as ContractSourceContext, o as ContractSourceDiagnostics, p as PslContractSourceProvider, r as ContractSourceDiagnostic } from "./config-types-De3gHQOy.mjs";
|
|
9
|
+
import { B as PslDiagnosticCollector, V as PslSources, d as DiagnosticSource, f as DocumentAst, z as PslDiagnostic } from "./parse-djL5wker-4_2Cqwev.mjs";
|
|
10
|
+
import { Ot as ResolvedTypeConstructorCall, S as ContributedTypeChoiceSymbol, Tt as ResolvedAttributeArg, jt as SymbolTable, l as Binder, p as BlockSymbol, w as ContributedTypeNamespace, z as FieldSymbol } from "./binder-CMy3WM5A-DRrDzBAq.mjs";
|
|
9
11
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts
|
|
10
12
|
//#region src/authoring-arguments.d.ts
|
|
11
|
-
|
|
13
|
+
/** An argument of a type constructor, or of a type choice, whose options are written as bare names. */
|
|
14
|
+
type CallArgumentDescriptor = AuthoringArgumentDescriptor | AuthoringTypeChoiceOption;
|
|
15
|
+
interface ReadPslHelperArgsInput {
|
|
12
16
|
readonly args: readonly ResolvedAttributeArg[];
|
|
13
|
-
readonly descriptors: readonly
|
|
17
|
+
readonly descriptors: readonly CallArgumentDescriptor[];
|
|
18
|
+
/** The stack's data types, which a `value` argument is read as. ADR 254. */
|
|
19
|
+
readonly dataTypes: DataTypeSupport;
|
|
20
|
+
}
|
|
21
|
+
interface MapPslHelperArgsInput extends ReadPslHelperArgsInput {
|
|
14
22
|
readonly helperLabel: string;
|
|
15
23
|
readonly span: PslSpan;
|
|
16
24
|
readonly diagnostics: PslDiagnosticCollector;
|
|
17
25
|
readonly source: DiagnosticSource;
|
|
18
26
|
readonly entityLabel: string;
|
|
19
|
-
/** The stack's data types, which a `value` argument is read as. ADR 254. */
|
|
20
|
-
readonly dataTypes: DataTypeSupport;
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
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.
|
|
29
|
+
* The arguments of a type constructor or type choice 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
30
|
*/
|
|
25
31
|
declare function mapPslHelperArgs(input: MapPslHelperArgsInput): readonly unknown[] | undefined;
|
|
26
32
|
//#endregion
|
|
@@ -86,26 +92,62 @@ declare function requiredOneToOneBackrelationDiagnostic(input: {
|
|
|
86
92
|
}): PslDiagnostic;
|
|
87
93
|
//#endregion
|
|
88
94
|
//#region src/removed-field-presets.d.ts
|
|
95
|
+
/** A type as a removed preset's rewrite writes it: its path, and the options it is called with, each written as a bare name, such as `as: temporal`. */
|
|
96
|
+
interface RemovedPresetType {
|
|
97
|
+
readonly path: readonly string[];
|
|
98
|
+
readonly options: Readonly<Record<string, string>>;
|
|
99
|
+
}
|
|
100
|
+
/** The type at the dotted `path`, called with `options`. */
|
|
101
|
+
declare function presetType(path: string, options?: Readonly<Record<string, string>>): RemovedPresetType;
|
|
102
|
+
/** The type as PSL writes it, with `extra` after its options, such as `precision: 3`. */
|
|
103
|
+
declare function writtenPresetType(type: RemovedPresetType, extra?: string): string;
|
|
89
104
|
/**
|
|
90
|
-
* A field preset Prisma 8 removed, and how to write what it stored. The preset is named only where `type` resolves
|
|
105
|
+
* A field preset Prisma 8 removed, and how to write what it stored. The preset is named only where `type` resolves to `codecId`, the codec the preset stored, so a row does not fire on a target the preset never existed on, or name a type that stores something else.
|
|
91
106
|
*/
|
|
92
107
|
interface RemovedFieldPreset {
|
|
93
|
-
readonly type:
|
|
94
|
-
readonly codecId
|
|
95
|
-
|
|
108
|
+
readonly type: RemovedPresetType;
|
|
109
|
+
readonly codecId: string;
|
|
110
|
+
/** The rewrite of `call`, with `modifier`, the field's `?` or `[]`, written right after the type. */
|
|
111
|
+
readonly rewrite: (call: ResolvedTypeConstructorCall, modifier: string) => string;
|
|
96
112
|
}
|
|
97
113
|
/** 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
114
|
type RemovedFieldPresets = Readonly<Record<string, readonly RemovedFieldPreset[]>>;
|
|
99
|
-
/** The row of a preset whose rewrite
|
|
100
|
-
declare function removedPresetWrittenAs(
|
|
115
|
+
/** The row of a preset whose rewrite always writes `type`, then `attributes` when given, such as `Ulid @id @onCreate(ulid())`. */
|
|
116
|
+
declare function removedPresetWrittenAs(type: RemovedPresetType | string, codecId: string, attributes?: string): readonly RemovedFieldPreset[];
|
|
117
|
+
/** A convenience type that gives a row's explicit type for every written precision, and the precision it gives when none is written. */
|
|
118
|
+
interface RemovedPresetPrecisionType {
|
|
119
|
+
readonly type: RemovedPresetType;
|
|
120
|
+
readonly defaultPrecision: string;
|
|
121
|
+
}
|
|
101
122
|
/**
|
|
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.
|
|
123
|
+
* 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 `precision` argument and `@onCreate(now())` and `@onUpdate(now())` for the phases the call set. When the call writes a precision and `withPrecision` is given, it writes `withPrecision.type` instead, leaving out a precision equal to its default.
|
|
103
124
|
*/
|
|
104
|
-
declare function removedPresetWithPhases(type: string, codecId: string, takesPrecision: boolean): readonly RemovedFieldPreset[];
|
|
125
|
+
declare function removedPresetWithPhases(type: RemovedPresetType | string, codecId: string, takesPrecision: boolean, withPrecision?: RemovedPresetPrecisionType): readonly RemovedFieldPreset[];
|
|
105
126
|
/**
|
|
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.
|
|
127
|
+
* The refusal of a field typed by a call to a field preset Prisma 8 removed, naming what to write instead, with the field's `?` or `[]` right after the type and before any attribute. `undefined` when the field is not typed by a call, or `presets` has no row for the call that applies to a stack whose types `types` holds. A row applies where its type, called as the rewrite writes it, resolves as a column would, to the row's codec. 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
128
|
*/
|
|
108
|
-
declare function describeRemovedFieldPreset(presets: RemovedFieldPresets,
|
|
129
|
+
declare function describeRemovedFieldPreset(presets: RemovedFieldPresets, field: FieldSymbol, types: ContributedTypeNamespace, isDeclared: (name: string) => boolean): string | undefined;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/type-choice-calls.d.ts
|
|
132
|
+
/** The span of the argument at `index` of `descriptors` in `call`, named or positional, or the call's when it is not written. */
|
|
133
|
+
declare function argumentSpan(call: ResolvedTypeConstructorCall, descriptors: readonly {
|
|
134
|
+
readonly name?: string | undefined;
|
|
135
|
+
}[] | undefined, index: number | undefined): PslSpan;
|
|
136
|
+
/** The index of the argument an authoring refusal names, when it names one. */
|
|
137
|
+
declare function argumentIndexOf(error: unknown): number | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* The column a field or type alias typed by the type choice `symbol` gets: its call's arguments, read as the choice declares them, choose a type constructor, which is instantiated with the arguments the choice passes on. A refusal is reported at the argument that makes it. `span` is where a bare use is written.
|
|
140
|
+
*/
|
|
141
|
+
declare function instantiatePslTypeChoice(input: {
|
|
142
|
+
readonly symbol: ContributedTypeChoiceSymbol;
|
|
143
|
+
readonly call: ResolvedTypeConstructorCall | undefined;
|
|
144
|
+
readonly span: PslSpan;
|
|
145
|
+
readonly codecLookup: Pick<CodecLookupWithDescriptors, 'descriptorFor'>;
|
|
146
|
+
readonly diagnostics: PslDiagnosticCollector;
|
|
147
|
+
readonly source: DiagnosticSource;
|
|
148
|
+
readonly entityLabel: string;
|
|
149
|
+
readonly dataTypes: DataTypeSupport;
|
|
150
|
+
}): ScalarTypeConstructorOutput | undefined;
|
|
109
151
|
//#endregion
|
|
110
152
|
//#region src/type-constructor-calls.d.ts
|
|
111
153
|
declare function isBareTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor): boolean;
|
|
@@ -123,5 +165,5 @@ declare function reportTypeConstructorNotCalled(input: {
|
|
|
123
165
|
declare function claimedBlockKeywords(descriptors: AuthoringPslBlockDescriptorNamespace | undefined): ReadonlySet<string>;
|
|
124
166
|
declare function unsupportedBlockDiagnostic(block: BlockSymbol, sources: PslSources): PslDiagnostic;
|
|
125
167
|
//#endregion
|
|
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 };
|
|
168
|
+
export { type InvalidFkPairing, type PslInterpretCapable, type PslInterpretInput, type RemovedFieldPreset, type RemovedFieldPresets, type RemovedPresetType, argumentIndexOf, argumentSpan, claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, instantiatePslTypeChoice, isBareTypeConstructor, mapPslHelperArgs, presetType, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics, writtenPresetType };
|
|
127
169
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.d.mts","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.d.mts"],"mappings":";;;;;;;;;;;;;KAUK,yBAAyB,8BAA8B;UAClD;WACC,eAAe;WACf,sBAAsB;;WAEtB,WAAW;;UAEZ,8BAA8B;WAC7B;WACA,MAAM;WACN,aAAa;WACb,QAAQ;WACR;;;;;iBAKM,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;;;;UAIM;WACC;WACA,SAAS,SAAS;;;iBAGZ,WAAW,cAAc,UAAU,SAAS,0BAA0B;;iBAEtE,kBAAkB,MAAM,mBAAmB;;;;UAIlD;WACC,MAAM;WACN;;WAEA,UAAU,MAAM,6BAA6B;;;KAGnD,sBAAsB,SAAS,wBAAwB;;iBAE3C,uBAAuB,MAAM,4BAA4B,iBAAiB,+BAA+B;;UAEhH;WACC,MAAM;WACN;;;;;iBAKM,wBAAwB,MAAM,4BAA4B,iBAAiB,yBAAyB,gBAAgB,sCAAsC;;;;iBAI1J,2BAA2B,SAAS,qBAAqB,OAAO,aAAa,OAAO,0BAA0B,aAAa;;;;iBAI3H,aAAa,MAAM,6BAA6B;WACtD;iBACM,4BAA4B;;iBAE5B,gBAAgB;;;;iBAIhB,yBAAyB;WAC/B,QAAQ;WACR,MAAM;WACN,MAAM;WACN,aAAa,KAAK;WAClB,aAAa;WACb,QAAQ;WACR;WACA,WAAW;IAClB;;;iBAGa,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,124 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as notOk
|
|
3
|
-
import {
|
|
4
|
-
import { T as
|
|
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-CfYTYNSm.mjs";
|
|
1
|
+
import { r as isInternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
|
|
2
|
+
import { n as notOk } from "./result-8OXF26MN.mjs";
|
|
3
|
+
import { $ as validateAuthoringTypeChoiceParams, B as resolveAuthoringTypeChoice, Z as unknownTypeChoiceArgumentMessage, k as isAuthoringPslBlockDescriptor, w as instantiateAuthoringTypeConstructor } from "./temporal-type-aliases-BI3SL5iB-DIP8j4Gv.mjs";
|
|
4
|
+
import { T as writtenContributedTypeCodecId, _ as printTypeConstructorCall, d as diagnosticSource, g as nodePslSpan, h as mapPslHelperArgs, i as argumentsByParameter, n as reportTypeConstructorNotCalled, p as keywordPslSpan, t as isBareTypeConstructor } from "./type-constructor-calls-Bfg5ojed-DYHnzC9z.mjs";
|
|
6
5
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs
|
|
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(", ")})`;
|
|
11
|
-
}
|
|
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
|
-
});
|
|
44
|
-
}
|
|
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);
|
|
56
|
-
}
|
|
57
|
-
return values;
|
|
58
|
-
}
|
|
59
|
-
const INVALID_AUTHORING_ARGUMENT = Symbol("invalidAuthoringArgument");
|
|
60
|
-
function pushInvalidPslHelperArgument(input) {
|
|
61
|
-
input.diagnostics.push({
|
|
62
|
-
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
63
|
-
message: `${input.entityLabel} ${input.helperLabel} ${input.message}`,
|
|
64
|
-
...input.source.at(input.span)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
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.
|
|
69
|
-
*/
|
|
70
|
-
function readPslHelperArgument(input, descriptor, argument, argumentLabel) {
|
|
71
|
-
const { expression } = argument;
|
|
72
|
-
if (expression === void 0 && argument.node !== void 0) {
|
|
73
|
-
pushInvalidPslHelperArgument({
|
|
74
|
-
diagnostics: input.diagnostics,
|
|
75
|
-
source: input.source,
|
|
76
|
-
span: argument.span,
|
|
77
|
-
entityLabel: input.entityLabel,
|
|
78
|
-
helperLabel: input.helperLabel,
|
|
79
|
-
message: `${argumentLabel} has no value.`
|
|
80
|
-
});
|
|
81
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
82
|
-
}
|
|
83
|
-
if (expression === void 0) throw new InternalError(`${input.entityLabel} ${input.helperLabel} received ${argumentLabel} with no expression. A value argument is read from the expression a schema writes; a reader that builds a call must pass the arguments it parsed, or instantiate the constructor with values.`);
|
|
84
|
-
const read = readExpressionAs(input.dataTypes, dataTypeId(descriptor.dataType), expression);
|
|
85
|
-
if (read.ok) return read.value.value;
|
|
86
|
-
input.diagnostics.push({
|
|
87
|
-
code: read.failure.code,
|
|
88
|
-
message: read.failure.message,
|
|
89
|
-
...input.source.at(nodePslSpan(expression.syntax, input.source.sources))
|
|
90
|
-
});
|
|
91
|
-
return INVALID_AUTHORING_ARGUMENT;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
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.
|
|
95
|
-
*/
|
|
96
|
-
function mapPslHelperArgs(input) {
|
|
97
|
-
const refuse = (span, message) => pushInvalidPslHelperArgument({
|
|
98
|
-
diagnostics: input.diagnostics,
|
|
99
|
-
source: input.source,
|
|
100
|
-
span,
|
|
101
|
-
entityLabel: input.entityLabel,
|
|
102
|
-
helperLabel: input.helperLabel,
|
|
103
|
-
message
|
|
104
|
-
});
|
|
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) {
|
|
108
|
-
const descriptor = input.descriptors[index];
|
|
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}`);
|
|
111
|
-
if (value === INVALID_AUTHORING_ARGUMENT) return void 0;
|
|
112
|
-
mappedArgs[index] = value;
|
|
113
|
-
}
|
|
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}".`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
6
|
function enumMemberAttributeDiagnostics(enumBlock, sources) {
|
|
123
7
|
const source = diagnosticSource(sources, enumBlock.node.syntax);
|
|
124
8
|
return enumBlock.entries.flatMap((member) => Array.from(member.attributes(), (attribute) => ({
|
|
@@ -168,46 +52,157 @@ function requiredOneToOneBackrelationDiagnostic(input) {
|
|
|
168
52
|
...diagnosticSource(sources, field.node.syntax).at(field.span)
|
|
169
53
|
};
|
|
170
54
|
}
|
|
55
|
+
/** The type at the dotted `path`, called with `options`. */
|
|
56
|
+
function presetType(path, options = {}) {
|
|
57
|
+
return {
|
|
58
|
+
path: path.split("."),
|
|
59
|
+
options
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** The type as PSL writes it, with `extra` after its options, such as `precision: 3`. */
|
|
63
|
+
function writtenPresetType(type, extra) {
|
|
64
|
+
const args = [...Object.entries(type.options).map(([name, value]) => `${name}: ${value}`), ...extra === void 0 ? [] : [extra]];
|
|
65
|
+
const path = type.path.join(".");
|
|
66
|
+
return args.length === 0 ? path : `${path}(${args.join(", ")})`;
|
|
67
|
+
}
|
|
171
68
|
const PHASES = ["onCreate", "onUpdate"];
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
69
|
+
function asType(type) {
|
|
70
|
+
return typeof type === "string" ? presetType(type) : type;
|
|
71
|
+
}
|
|
72
|
+
/** The row of a preset whose rewrite always writes `type`, then `attributes` when given, such as `Ulid @id @onCreate(ulid())`. */
|
|
73
|
+
function removedPresetWrittenAs(type, codecId, attributes) {
|
|
74
|
+
const written = asType(type);
|
|
75
|
+
const suffix = attributes === void 0 ? "" : ` ${attributes}`;
|
|
175
76
|
return [{
|
|
176
|
-
type:
|
|
177
|
-
|
|
178
|
-
rewrite: () => `Write ${written}.`
|
|
77
|
+
type: written,
|
|
78
|
+
codecId,
|
|
79
|
+
rewrite: (_, modifier) => `Write ${writtenPresetType(written)}${modifier}${suffix}.`
|
|
179
80
|
}];
|
|
180
81
|
}
|
|
181
82
|
/**
|
|
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.
|
|
83
|
+
* 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 `precision` argument and `@onCreate(now())` and `@onUpdate(now())` for the phases the call set. When the call writes a precision and `withPrecision` is given, it writes `withPrecision.type` instead, leaving out a precision equal to its default.
|
|
183
84
|
*/
|
|
184
|
-
function removedPresetWithPhases(type, codecId, takesPrecision) {
|
|
85
|
+
function removedPresetWithPhases(type, codecId, takesPrecision, withPrecision) {
|
|
86
|
+
const written = asType(type);
|
|
185
87
|
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
88
|
return [{
|
|
188
|
-
type:
|
|
89
|
+
type: written,
|
|
189
90
|
codecId,
|
|
190
|
-
rewrite: (call) => {
|
|
91
|
+
rewrite: (call, modifier) => {
|
|
191
92
|
const args = argumentsByParameter(call.args, parameters);
|
|
192
93
|
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
|
|
94
|
+
if (args === void 0 || precision !== void 0 && !/^\d+$/.test(precision) || PHASES.some((phase) => args.has(phase) && args.get(phase) !== "now")) return `Write ${writtenPresetType(written, takesPrecision ? "..." : void 0)}${modifier} with @onCreate(now()) and @onUpdate(now()) for the phases the preset set.`;
|
|
194
95
|
const attributes = PHASES.filter((phase) => args.has(phase)).map((phase) => ` @${phase}(now())`);
|
|
195
|
-
return `Write ${
|
|
96
|
+
return `Write ${precision === void 0 ? writtenPresetType(written) : withPrecision === void 0 ? writtenPresetType(written, `precision: ${precision}`) : writtenPresetType(withPrecision.type, precision === withPrecision.defaultPrecision ? void 0 : `precision: ${precision}`)}${modifier}${attributes.join("")}.`;
|
|
196
97
|
}
|
|
197
98
|
}];
|
|
198
99
|
}
|
|
100
|
+
/** The `?` or `[]` a field writes right after its type. */
|
|
101
|
+
function typeModifier(field) {
|
|
102
|
+
if (field.list) return field.elementOptional ? "?[]" : "[]";
|
|
103
|
+
return field.optional ? "?" : "";
|
|
104
|
+
}
|
|
199
105
|
/**
|
|
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.
|
|
106
|
+
* The refusal of a field typed by a call to a field preset Prisma 8 removed, naming what to write instead, with the field's `?` or `[]` right after the type and before any attribute. `undefined` when the field is not typed by a call, or `presets` has no row for the call that applies to a stack whose types `types` holds. A row applies where its type, called as the rewrite writes it, resolves as a column would, to the row's codec. 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
107
|
*/
|
|
202
|
-
function describeRemovedFieldPreset(presets,
|
|
108
|
+
function describeRemovedFieldPreset(presets, field, types, isDeclared) {
|
|
109
|
+
const call = field.typeConstructor;
|
|
110
|
+
if (call === void 0) return void 0;
|
|
203
111
|
const path = call.path.join(".");
|
|
204
112
|
const preset = (Object.hasOwn(presets, path) ? presets[path] : void 0)?.find((row) => {
|
|
205
|
-
const [name] = row.type;
|
|
206
|
-
|
|
207
|
-
|
|
113
|
+
const [name] = row.type.path;
|
|
114
|
+
return writtenContributedTypeCodecId(types, {
|
|
115
|
+
path: row.type.path,
|
|
116
|
+
args: Object.entries(row.type.options).map(([option, value]) => ({
|
|
117
|
+
kind: "named",
|
|
118
|
+
name: option,
|
|
119
|
+
value,
|
|
120
|
+
span: call.span
|
|
121
|
+
})),
|
|
122
|
+
span: call.span
|
|
123
|
+
}) === row.codecId && (name === void 0 || !isDeclared(name));
|
|
208
124
|
});
|
|
209
125
|
if (preset === void 0) return void 0;
|
|
210
|
-
return `${printTypeConstructorCall(call)} was a field preset, and Prisma 8 removed field presets. ${preset.rewrite(call)}`;
|
|
126
|
+
return `${printTypeConstructorCall(call)} was a field preset, and Prisma 8 removed field presets. ${preset.rewrite(call, typeModifier(field))}`;
|
|
127
|
+
}
|
|
128
|
+
/** The span of the argument at `index` of `descriptors` in `call`, named or positional, or the call's when it is not written. */
|
|
129
|
+
function argumentSpan(call, descriptors, index) {
|
|
130
|
+
if (index === void 0) return call.span;
|
|
131
|
+
const name = descriptors?.[index]?.name;
|
|
132
|
+
const named = call.args.find((arg) => arg.kind === "named" && arg.name === name);
|
|
133
|
+
const positional = call.args.filter((arg) => arg.kind === "positional")[index];
|
|
134
|
+
return (named ?? positional)?.span ?? call.span;
|
|
135
|
+
}
|
|
136
|
+
/** The index of the argument an authoring refusal names, when it names one. */
|
|
137
|
+
function argumentIndexOf(error) {
|
|
138
|
+
if (typeof error !== "object" || error === null || !("details" in error)) return void 0;
|
|
139
|
+
const { details } = error;
|
|
140
|
+
if (typeof details !== "object" || details === null || !("argumentIndex" in details)) return;
|
|
141
|
+
return typeof details.argumentIndex === "number" ? details.argumentIndex : void 0;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The column a field or type alias typed by the type choice `symbol` gets: its call's arguments, read as the choice declares them, choose a type constructor, which is instantiated with the arguments the choice passes on. A refusal is reported at the argument that makes it. `span` is where a bare use is written.
|
|
145
|
+
*/
|
|
146
|
+
function instantiatePslTypeChoice(input) {
|
|
147
|
+
const { symbol } = input;
|
|
148
|
+
const { descriptor } = symbol;
|
|
149
|
+
const helperPath = symbol.path.join(".");
|
|
150
|
+
const call = input.call ?? {
|
|
151
|
+
path: symbol.path,
|
|
152
|
+
args: [],
|
|
153
|
+
span: input.span
|
|
154
|
+
};
|
|
155
|
+
const subject = `${input.entityLabel} type "${helperPath}"`;
|
|
156
|
+
const unknown = call.args.find((arg) => arg.kind === "named" && !descriptor.args.some((declared) => declared.name === arg.name));
|
|
157
|
+
if (unknown?.name !== void 0) {
|
|
158
|
+
input.diagnostics.push({
|
|
159
|
+
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
160
|
+
message: unknownTypeChoiceArgumentMessage(subject, descriptor, unknown.name),
|
|
161
|
+
...input.source.at(unknown.span)
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const args = mapPslHelperArgs({
|
|
166
|
+
args: call.args,
|
|
167
|
+
descriptors: descriptor.args,
|
|
168
|
+
helperLabel: `type "${helperPath}"`,
|
|
169
|
+
span: call.span,
|
|
170
|
+
diagnostics: input.diagnostics,
|
|
171
|
+
source: input.source,
|
|
172
|
+
entityLabel: input.entityLabel,
|
|
173
|
+
dataTypes: input.dataTypes
|
|
174
|
+
});
|
|
175
|
+
if (!args) return void 0;
|
|
176
|
+
let chosen;
|
|
177
|
+
try {
|
|
178
|
+
chosen = resolveAuthoringTypeChoice({
|
|
179
|
+
helperPath,
|
|
180
|
+
descriptor,
|
|
181
|
+
args,
|
|
182
|
+
constructorNamed: (name) => symbol.choiceTypes.get(name)
|
|
183
|
+
});
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (isInternalError(error)) throw error;
|
|
186
|
+
input.diagnostics.push({
|
|
187
|
+
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
188
|
+
message: `${subject}: ${error instanceof Error ? error.message : String(error)}`,
|
|
189
|
+
...input.source.at(argumentSpan(call, descriptor.args, argumentIndexOf(error)))
|
|
190
|
+
});
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const output = instantiateAuthoringTypeConstructor(chosen.descriptor, chosen.args);
|
|
194
|
+
try {
|
|
195
|
+
validateAuthoringTypeChoiceParams(helperPath, descriptor, chosen.descriptor, output.typeParams, input.codecLookup.descriptorFor(output.codecId)?.paramsSchema);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
if (isInternalError(error)) throw error;
|
|
198
|
+
input.diagnostics.push({
|
|
199
|
+
code: "PSL_INVALID_ATTRIBUTE_ARGUMENT",
|
|
200
|
+
message: `${subject}: ${error instanceof Error ? error.message : String(error)}`,
|
|
201
|
+
...input.source.at(argumentSpan(call, descriptor.args, argumentIndexOf(error)))
|
|
202
|
+
});
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
return output;
|
|
211
206
|
}
|
|
212
207
|
/** A generic block is read only when a composed descriptor claims its keyword. */
|
|
213
208
|
function claimedBlockKeywords(descriptors) {
|
|
@@ -223,6 +218,6 @@ function unsupportedBlockDiagnostic(block, sources) {
|
|
|
223
218
|
};
|
|
224
219
|
}
|
|
225
220
|
//#endregion
|
|
226
|
-
export { claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, isBareTypeConstructor, mapPslHelperArgs, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };
|
|
221
|
+
export { argumentIndexOf, argumentSpan, claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, instantiatePslTypeChoice, isBareTypeConstructor, mapPslHelperArgs, presetType, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics, writtenPresetType };
|
|
227
222
|
|
|
228
223
|
//# sourceMappingURL=psl-parser__interpret.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-parser__interpret.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs"],"sourcesContent":["import { a as keywordPslSpan, f as diagnosticSource, n as contributedTypeCodecId, o as nodePslSpan, t as contributedTypeAt } from \"./contributed-type-scope-CbBzMSUB.mjs\";\nimport { n as reportTypeConstructorNotCalled, r as readExpressionAs, t as isBareTypeConstructor } from \"./type-constructor-calls-CNd1Xlw2.mjs\";\nimport { isAuthoringPslBlockDescriptor } from \"@internal/framework-components/authoring\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { dataTypeId } from \"@internal/framework-components/codec\";\n//#region src/call-arguments.ts\n/** The call as the schema writes it, with its arguments separated by `, `. */\nfunction printTypeConstructorCall(call) {\n\tconst args = call.args.map((arg) => arg.kind === \"named\" ? `${arg.name}: ${arg.value}` : arg.value);\n\treturn `${call.path.join(\".\")}(${args.join(\", \")})`;\n}\n/**\n* 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.\n*/\nfunction bindCallArguments(args, parameters) {\n\tconst positional = args.filter((arg) => arg.kind === \"positional\");\n\tif (positional.length > parameters.length) return notOk({\n\t\tkind: \"tooManyPositional\",\n\t\treceived: positional.length,\n\t\tbound: []\n\t});\n\tconst bound = positional.map((argument, index) => ({\n\t\targument,\n\t\tindex\n\t}));\n\tconst filled = new Set(bound.map(({ index }) => index));\n\tfor (const argument of args.filter((arg) => arg.kind === \"named\")) {\n\t\tconst index = argument.name === void 0 ? -1 : parameters.indexOf(argument.name);\n\t\tif (index < 0) return notOk({\n\t\t\tkind: \"unknownName\",\n\t\t\targument,\n\t\t\tbound\n\t\t});\n\t\tif (filled.has(index)) return notOk({\n\t\t\tkind: \"filledTwice\",\n\t\t\targument,\n\t\t\tbound\n\t\t});\n\t\tfilled.add(index);\n\t\tbound.push({\n\t\t\targument,\n\t\t\tindex\n\t\t});\n\t}\n\treturn ok(bound);\n}\n/** Each argument's value, keyed by the parameter it fills, as {@link bindCallArguments} binds them; `undefined` when they do not bind. */\nfunction argumentsByParameter(args, parameters) {\n\tconst bound = bindCallArguments(args, parameters);\n\tif (!bound.ok) return void 0;\n\tconst values = /* @__PURE__ */ new Map();\n\tfor (const { argument, index } of bound.value) {\n\t\tconst parameter = parameters[index];\n\t\tif (parameter === void 0) return void 0;\n\t\tvalues.set(parameter, argument.value);\n\t}\n\treturn values;\n}\n//#endregion\n//#region src/authoring-arguments.ts\nconst INVALID_AUTHORING_ARGUMENT = Symbol(\"invalidAuthoringArgument\");\nfunction pushInvalidPslHelperArgument(input) {\n\tinput.diagnostics.push({\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\tmessage: `${input.entityLabel} ${input.helperLabel} ${input.message}`,\n\t\t...input.source.at(input.span)\n\t});\n}\n/**\n* 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.\n*/\nfunction readPslHelperArgument(input, descriptor, argument, argumentLabel) {\n\tconst { expression } = argument;\n\tif (expression === void 0 && argument.node !== void 0) {\n\t\tpushInvalidPslHelperArgument({\n\t\t\tdiagnostics: input.diagnostics,\n\t\t\tsource: input.source,\n\t\t\tspan: argument.span,\n\t\t\tentityLabel: input.entityLabel,\n\t\t\thelperLabel: input.helperLabel,\n\t\t\tmessage: `${argumentLabel} has no value.`\n\t\t});\n\t\treturn INVALID_AUTHORING_ARGUMENT;\n\t}\n\tif (expression === void 0) throw new InternalError(`${input.entityLabel} ${input.helperLabel} received ${argumentLabel} with no expression. A value argument is read from the expression a schema writes; a reader that builds a call must pass the arguments it parsed, or instantiate the constructor with values.`);\n\tconst read = readExpressionAs(input.dataTypes, dataTypeId(descriptor.dataType), expression);\n\tif (read.ok) return read.value.value;\n\tinput.diagnostics.push({\n\t\tcode: read.failure.code,\n\t\tmessage: read.failure.message,\n\t\t...input.source.at(nodePslSpan(expression.syntax, input.source.sources))\n\t});\n\treturn INVALID_AUTHORING_ARGUMENT;\n}\n/**\n* 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.\n*/\nfunction mapPslHelperArgs(input) {\n\tconst refuse = (span, message) => pushInvalidPslHelperArgument({\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tspan,\n\t\tentityLabel: input.entityLabel,\n\t\thelperLabel: input.helperLabel,\n\t\tmessage\n\t});\n\tconst bound = bindCallArguments(input.args, input.descriptors.map((descriptor) => descriptor?.name));\n\tconst mappedArgs = input.descriptors.map(() => void 0);\n\tfor (const { argument, index } of bound.ok ? bound.value : bound.failure.bound) {\n\t\tconst descriptor = input.descriptors[index];\n\t\tif (!descriptor) return refuse(argument.span, `does not define positional argument #${index + 1}.`);\n\t\tconst value = readPslHelperArgument(input, descriptor, argument, argument.kind === \"named\" ? `named argument \"${argument.name}\"` : `argument #${index + 1}`);\n\t\tif (value === INVALID_AUTHORING_ARGUMENT) return void 0;\n\t\tmappedArgs[index] = value;\n\t}\n\tif (bound.ok) return mappedArgs;\n\tconst failure = bound.failure;\n\tswitch (failure.kind) {\n\t\tcase \"tooManyPositional\": return refuse(input.span, `accepts at most ${input.descriptors.length} argument(s), received ${failure.received}.`);\n\t\tcase \"unknownName\": return refuse(failure.argument.span, `received unknown named argument \"${failure.argument.name}\".`);\n\t\tcase \"filledTwice\": return refuse(failure.argument.span, `received duplicate value for argument \"${failure.argument.name}\".`);\n\t}\n}\n//#endregion\n//#region src/enum-member-attributes.ts\nfunction enumMemberAttributeDiagnostics(enumBlock, sources) {\n\tconst source = diagnosticSource(sources, enumBlock.node.syntax);\n\treturn enumBlock.entries.flatMap((member) => Array.from(member.attributes(), (attribute) => ({\n\t\tcode: \"PSL_UNSUPPORTED_ENUM_MEMBER_ATTRIBUTE\",\n\t\tmessage: `enum \"${enumBlock.name}\": member \"${member.key()?.name() ?? \"?\"}\" carries @${attribute.name()?.path().join(\".\") ?? \"?\"}, but an enum member takes no attributes`,\n\t\t...source.at(nodePslSpan(attribute.syntax, sources))\n\t})));\n}\n//#endregion\n//#region src/interpret.ts\n/**\n* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n* interpretation result. The authored headline is deliberately uniform — it\n* reports how many errors the schema has, never which pipeline stage found\n* them.\n*/\nfunction withSeedDiagnostics(result, seedDiagnostics) {\n\tif (seedDiagnostics.length === 0) return result;\n\tconst diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];\n\treturn notOk({\n\t\tsummary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? \"\" : \"s\"}`,\n\t\tdiagnostics,\n\t\t...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }\n\t});\n}\n/** The single seam that narrows a contract source to the interpret capability. */\nfunction hasPslInterpreter(source) {\n\treturn source.format === \"psl\" && \"interpret\" in source && typeof source.interpret === \"function\";\n}\n//#endregion\n//#region src/relation-backrelations.ts\nfunction fkRelationPairKey(declaringModelName, targetModelName) {\n\treturn `${declaringModelName}::${targetModelName}`;\n}\n/**\n* Claims the one rejected FK side that pairs with this back-relation candidate: same model pair\n* and the same relation name, where an unnamed candidate pairs only with an unnamed FK side.\n* A claimed pairing is removed, so a second candidate on the same pair reports its own problem.\n*/\nfunction consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings) {\n\tconst index = invalidFkPairings.findIndex((pairing) => pairing.pairKey === pairKey && pairing.relationName === candidate.relationName);\n\tif (index === -1) return false;\n\tinvalidFkPairings.splice(index, 1);\n\treturn true;\n}\nfunction requiredOneToOneBackrelationDiagnostic(input) {\n\tconst { modelName, field, targetModelName, sources, recordNoun } = input;\n\treturn {\n\t\tcode: \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\",\n\t\tmessage: `Backrelation field \"${modelName}.${field.name}\" is required, but \"${targetModelName}\" holds the relation fields, so nothing in storage guarantees a \"${targetModelName}\" ${recordNoun} exists. Make it optional: \"${field.name} ${targetModelName}?\".`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\n//#endregion\n//#region src/removed-field-presets.ts\nconst PHASES = [\"onCreate\", \"onUpdate\"];\n/** The row of a preset whose rewrite is always `written`, such as `Ulid @id @onCreate(ulid())`; its type is the first word of `written`. */\nfunction removedPresetWrittenAs(written, codecId) {\n\tconst [type = written] = written.split(/[ (]/);\n\treturn [{\n\t\ttype: type.split(\".\"),\n\t\t...codecId === void 0 ? {} : { codecId },\n\t\trewrite: () => `Write ${written}.`\n\t}];\n}\n/**\n* 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.\n*/\nfunction removedPresetWithPhases(type, codecId, takesPrecision) {\n\tconst parameters = takesPrecision ? [\"precision\", ...PHASES] : [...PHASES];\n\tconst fallback = `Write ${type}${takesPrecision ? \"(...)\" : \"\"} with @onCreate(now()) and @onUpdate(now()) for the phases the preset set.`;\n\treturn [{\n\t\ttype: [type],\n\t\tcodecId,\n\t\trewrite: (call) => {\n\t\t\tconst args = argumentsByParameter(call.args, parameters);\n\t\t\tconst precision = args?.get(\"precision\");\n\t\t\tif (args === void 0 || precision !== void 0 && !/^\\d+$/.test(precision) || PHASES.some((phase) => args.has(phase) && args.get(phase) !== \"now\")) return fallback;\n\t\t\tconst attributes = PHASES.filter((phase) => args.has(phase)).map((phase) => ` @${phase}(now())`);\n\t\t\treturn `Write ${type}${precision === void 0 ? \"\" : `(${precision})`}${attributes.join(\"\")}.`;\n\t\t}\n\t}];\n}\n/**\n* 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.\n*/\nfunction describeRemovedFieldPreset(presets, call, types, isDeclared) {\n\tconst path = call.path.join(\".\");\n\tconst preset = (Object.hasOwn(presets, path) ? presets[path] : void 0)?.find((row) => {\n\t\tconst [name] = row.type;\n\t\tconst replacement = contributedTypeAt(types, row.type);\n\t\treturn replacement !== void 0 && (name === void 0 || !isDeclared(name)) && (row.codecId === void 0 || contributedTypeCodecId(replacement) === row.codecId);\n\t});\n\tif (preset === void 0) return void 0;\n\treturn `${printTypeConstructorCall(call)} was a field preset, and Prisma 8 removed field presets. ${preset.rewrite(call)}`;\n}\n//#endregion\n//#region src/unclaimed-blocks.ts\n/** A generic block is read only when a composed descriptor claims its keyword. */\nfunction claimedBlockKeywords(descriptors) {\n\tconst keywords = /* @__PURE__ */ new Set();\n\tfor (const [keyword, value] of Object.entries(descriptors ?? {})) if (isAuthoringPslBlockDescriptor(value)) keywords.add(keyword);\n\treturn keywords;\n}\nfunction unsupportedBlockDiagnostic(block, sources) {\n\treturn {\n\t\tcode: \"PSL_UNSUPPORTED_TOP_LEVEL_BLOCK\",\n\t\tmessage: `Unsupported top-level block \"${block.keyword}\"`,\n\t\t...diagnosticSource(sources, block.node.syntax).at(keywordPslSpan(block.node.syntax, block.keyword, sources))\n\t};\n}\n//#endregion\nexport { claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, isBareTypeConstructor, mapPslHelperArgs, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics };\n\n//# sourceMappingURL=interpret.mjs.map"],"mappings":";;;;;;;AAQA,SAAS,yBAAyB,MAAM;CACvC,MAAM,OAAO,KAAK,KAAK,KAAK,QAAQ,IAAI,SAAS,UAAU,GAAG,IAAI,KAAK,IAAI,IAAI,UAAU,IAAI,KAAK;CAClG,OAAO,GAAG,KAAK,KAAK,KAAK,GAAG,EAAE,GAAG,KAAK,KAAK,IAAI,EAAE;AAClD;;;;AAIA,SAAS,kBAAkB,MAAM,YAAY;CAC5C,MAAM,aAAa,KAAK,QAAQ,QAAQ,IAAI,SAAS,YAAY;CACjE,IAAI,WAAW,SAAS,WAAW,QAAQ,OAAO,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}
|
|
1
|
+
{"version":3,"file":"psl-parser__interpret.mjs","names":[],"sources":["../../../../1-framework/2-authoring/psl-parser/dist/interpret.mjs"],"sourcesContent":["import { S as diagnosticSource, c as argumentsByParameter, g as nodePslSpan, h as keywordPslSpan, l as printTypeConstructorCall, o as writtenContributedTypeCodecId, s as mapPslHelperArgs } from \"./contributed-type-scope-Ds4uDG91.mjs\";\nimport { n as reportTypeConstructorNotCalled, t as isBareTypeConstructor } from \"./type-constructor-calls-Bfg5ojed.mjs\";\nimport { instantiateAuthoringTypeConstructor, isAuthoringPslBlockDescriptor, resolveAuthoringTypeChoice, unknownTypeChoiceArgumentMessage, validateAuthoringTypeChoiceParams } from \"@internal/framework-components/authoring\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/enum-member-attributes.ts\nfunction enumMemberAttributeDiagnostics(enumBlock, sources) {\n\tconst source = diagnosticSource(sources, enumBlock.node.syntax);\n\treturn enumBlock.entries.flatMap((member) => Array.from(member.attributes(), (attribute) => ({\n\t\tcode: \"PSL_UNSUPPORTED_ENUM_MEMBER_ATTRIBUTE\",\n\t\tmessage: `enum \"${enumBlock.name}\": member \"${member.key()?.name() ?? \"?\"}\" carries @${attribute.name()?.path().join(\".\") ?? \"?\"}, but an enum member takes no attributes`,\n\t\t...source.at(nodePslSpan(attribute.syntax, sources))\n\t})));\n}\n//#endregion\n//#region src/interpret.ts\n/**\n* Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n* interpretation result. The authored headline is deliberately uniform — it\n* reports how many errors the schema has, never which pipeline stage found\n* them.\n*/\nfunction withSeedDiagnostics(result, seedDiagnostics) {\n\tif (seedDiagnostics.length === 0) return result;\n\tconst diagnostics = result.ok ? seedDiagnostics : [...seedDiagnostics, ...result.failure.diagnostics];\n\treturn notOk({\n\t\tsummary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? \"\" : \"s\"}`,\n\t\tdiagnostics,\n\t\t...result.ok || result.failure.meta === void 0 ? {} : { meta: result.failure.meta }\n\t});\n}\n/** The single seam that narrows a contract source to the interpret capability. */\nfunction hasPslInterpreter(source) {\n\treturn source.format === \"psl\" && \"interpret\" in source && typeof source.interpret === \"function\";\n}\n//#endregion\n//#region src/relation-backrelations.ts\nfunction fkRelationPairKey(declaringModelName, targetModelName) {\n\treturn `${declaringModelName}::${targetModelName}`;\n}\n/**\n* Claims the one rejected FK side that pairs with this back-relation candidate: same model pair\n* and the same relation name, where an unnamed candidate pairs only with an unnamed FK side.\n* A claimed pairing is removed, so a second candidate on the same pair reports its own problem.\n*/\nfunction consumeInvalidFkPairing(candidate, pairKey, invalidFkPairings) {\n\tconst index = invalidFkPairings.findIndex((pairing) => pairing.pairKey === pairKey && pairing.relationName === candidate.relationName);\n\tif (index === -1) return false;\n\tinvalidFkPairings.splice(index, 1);\n\treturn true;\n}\nfunction requiredOneToOneBackrelationDiagnostic(input) {\n\tconst { modelName, field, targetModelName, sources, recordNoun } = input;\n\treturn {\n\t\tcode: \"PSL_REQUIRED_ONE_TO_ONE_BACKRELATION\",\n\t\tmessage: `Backrelation field \"${modelName}.${field.name}\" is required, but \"${targetModelName}\" holds the relation fields, so nothing in storage guarantees a \"${targetModelName}\" ${recordNoun} exists. Make it optional: \"${field.name} ${targetModelName}?\".`,\n\t\t...diagnosticSource(sources, field.node.syntax).at(field.span)\n\t};\n}\n//#endregion\n//#region src/removed-field-presets.ts\n/** The type at the dotted `path`, called with `options`. */\nfunction presetType(path, options = {}) {\n\treturn {\n\t\tpath: path.split(\".\"),\n\t\toptions\n\t};\n}\n/** The type as PSL writes it, with `extra` after its options, such as `precision: 3`. */\nfunction writtenPresetType(type, extra) {\n\tconst args = [...Object.entries(type.options).map(([name, value]) => `${name}: ${value}`), ...extra === void 0 ? [] : [extra]];\n\tconst path = type.path.join(\".\");\n\treturn args.length === 0 ? path : `${path}(${args.join(\", \")})`;\n}\nconst PHASES = [\"onCreate\", \"onUpdate\"];\nfunction asType(type) {\n\treturn typeof type === \"string\" ? presetType(type) : type;\n}\n/** The row of a preset whose rewrite always writes `type`, then `attributes` when given, such as `Ulid @id @onCreate(ulid())`. */\nfunction removedPresetWrittenAs(type, codecId, attributes) {\n\tconst written = asType(type);\n\tconst suffix = attributes === void 0 ? \"\" : ` ${attributes}`;\n\treturn [{\n\t\ttype: written,\n\t\tcodecId,\n\t\trewrite: (_, modifier) => `Write ${writtenPresetType(written)}${modifier}${suffix}.`\n\t}];\n}\n/**\n* 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 `precision` argument and `@onCreate(now())` and `@onUpdate(now())` for the phases the call set. When the call writes a precision and `withPrecision` is given, it writes `withPrecision.type` instead, leaving out a precision equal to its default.\n*/\nfunction removedPresetWithPhases(type, codecId, takesPrecision, withPrecision) {\n\tconst written = asType(type);\n\tconst parameters = takesPrecision ? [\"precision\", ...PHASES] : [...PHASES];\n\treturn [{\n\t\ttype: written,\n\t\tcodecId,\n\t\trewrite: (call, modifier) => {\n\t\t\tconst args = argumentsByParameter(call.args, parameters);\n\t\t\tconst precision = args?.get(\"precision\");\n\t\t\tif (args === void 0 || precision !== void 0 && !/^\\d+$/.test(precision) || PHASES.some((phase) => args.has(phase) && args.get(phase) !== \"now\")) return `Write ${writtenPresetType(written, takesPrecision ? \"...\" : void 0)}${modifier} with @onCreate(now()) and @onUpdate(now()) for the phases the preset set.`;\n\t\t\tconst attributes = PHASES.filter((phase) => args.has(phase)).map((phase) => ` @${phase}(now())`);\n\t\t\treturn `Write ${precision === void 0 ? writtenPresetType(written) : withPrecision === void 0 ? writtenPresetType(written, `precision: ${precision}`) : writtenPresetType(withPrecision.type, precision === withPrecision.defaultPrecision ? void 0 : `precision: ${precision}`)}${modifier}${attributes.join(\"\")}.`;\n\t\t}\n\t}];\n}\n/** The `?` or `[]` a field writes right after its type. */\nfunction typeModifier(field) {\n\tif (field.list) return field.elementOptional ? \"?[]\" : \"[]\";\n\treturn field.optional ? \"?\" : \"\";\n}\n/**\n* The refusal of a field typed by a call to a field preset Prisma 8 removed, naming what to write instead, with the field's `?` or `[]` right after the type and before any attribute. `undefined` when the field is not typed by a call, or `presets` has no row for the call that applies to a stack whose types `types` holds. A row applies where its type, called as the rewrite writes it, resolves as a column would, to the row's codec. 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.\n*/\nfunction describeRemovedFieldPreset(presets, field, types, isDeclared) {\n\tconst call = field.typeConstructor;\n\tif (call === void 0) return void 0;\n\tconst path = call.path.join(\".\");\n\tconst preset = (Object.hasOwn(presets, path) ? presets[path] : void 0)?.find((row) => {\n\t\tconst [name] = row.type.path;\n\t\treturn writtenContributedTypeCodecId(types, {\n\t\t\tpath: row.type.path,\n\t\t\targs: Object.entries(row.type.options).map(([option, value]) => ({\n\t\t\t\tkind: \"named\",\n\t\t\t\tname: option,\n\t\t\t\tvalue,\n\t\t\t\tspan: call.span\n\t\t\t})),\n\t\t\tspan: call.span\n\t\t}) === row.codecId && (name === void 0 || !isDeclared(name));\n\t});\n\tif (preset === void 0) return void 0;\n\treturn `${printTypeConstructorCall(call)} was a field preset, and Prisma 8 removed field presets. ${preset.rewrite(call, typeModifier(field))}`;\n}\n//#endregion\n//#region src/type-choice-calls.ts\n/** The span of the argument at `index` of `descriptors` in `call`, named or positional, or the call's when it is not written. */\nfunction argumentSpan(call, descriptors, index) {\n\tif (index === void 0) return call.span;\n\tconst name = descriptors?.[index]?.name;\n\tconst named = call.args.find((arg) => arg.kind === \"named\" && arg.name === name);\n\tconst positional = call.args.filter((arg) => arg.kind === \"positional\")[index];\n\treturn (named ?? positional)?.span ?? call.span;\n}\n/** The index of the argument an authoring refusal names, when it names one. */\nfunction argumentIndexOf(error) {\n\tif (typeof error !== \"object\" || error === null || !(\"details\" in error)) return void 0;\n\tconst { details } = error;\n\tif (typeof details !== \"object\" || details === null || !(\"argumentIndex\" in details)) return;\n\treturn typeof details.argumentIndex === \"number\" ? details.argumentIndex : void 0;\n}\n/**\n* The column a field or type alias typed by the type choice `symbol` gets: its call's arguments, read as the choice declares them, choose a type constructor, which is instantiated with the arguments the choice passes on. A refusal is reported at the argument that makes it. `span` is where a bare use is written.\n*/\nfunction instantiatePslTypeChoice(input) {\n\tconst { symbol } = input;\n\tconst { descriptor } = symbol;\n\tconst helperPath = symbol.path.join(\".\");\n\tconst call = input.call ?? {\n\t\tpath: symbol.path,\n\t\targs: [],\n\t\tspan: input.span\n\t};\n\tconst subject = `${input.entityLabel} type \"${helperPath}\"`;\n\tconst unknown = call.args.find((arg) => arg.kind === \"named\" && !descriptor.args.some((declared) => declared.name === arg.name));\n\tif (unknown?.name !== void 0) {\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: unknownTypeChoiceArgumentMessage(subject, descriptor, unknown.name),\n\t\t\t...input.source.at(unknown.span)\n\t\t});\n\t\treturn;\n\t}\n\tconst args = mapPslHelperArgs({\n\t\targs: call.args,\n\t\tdescriptors: descriptor.args,\n\t\thelperLabel: `type \"${helperPath}\"`,\n\t\tspan: call.span,\n\t\tdiagnostics: input.diagnostics,\n\t\tsource: input.source,\n\t\tentityLabel: input.entityLabel,\n\t\tdataTypes: input.dataTypes\n\t});\n\tif (!args) return void 0;\n\tlet chosen;\n\ttry {\n\t\tchosen = resolveAuthoringTypeChoice({\n\t\t\thelperPath,\n\t\t\tdescriptor,\n\t\t\targs,\n\t\t\tconstructorNamed: (name) => symbol.choiceTypes.get(name)\n\t\t});\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${subject}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t...input.source.at(argumentSpan(call, descriptor.args, argumentIndexOf(error)))\n\t\t});\n\t\treturn;\n\t}\n\tconst output = instantiateAuthoringTypeConstructor(chosen.descriptor, chosen.args);\n\ttry {\n\t\tvalidateAuthoringTypeChoiceParams(helperPath, descriptor, chosen.descriptor, output.typeParams, input.codecLookup.descriptorFor(output.codecId)?.paramsSchema);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\tinput.diagnostics.push({\n\t\t\tcode: \"PSL_INVALID_ATTRIBUTE_ARGUMENT\",\n\t\t\tmessage: `${subject}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t...input.source.at(argumentSpan(call, descriptor.args, argumentIndexOf(error)))\n\t\t});\n\t\treturn;\n\t}\n\treturn output;\n}\n//#endregion\n//#region src/unclaimed-blocks.ts\n/** A generic block is read only when a composed descriptor claims its keyword. */\nfunction claimedBlockKeywords(descriptors) {\n\tconst keywords = /* @__PURE__ */ new Set();\n\tfor (const [keyword, value] of Object.entries(descriptors ?? {})) if (isAuthoringPslBlockDescriptor(value)) keywords.add(keyword);\n\treturn keywords;\n}\nfunction unsupportedBlockDiagnostic(block, sources) {\n\treturn {\n\t\tcode: \"PSL_UNSUPPORTED_TOP_LEVEL_BLOCK\",\n\t\tmessage: `Unsupported top-level block \"${block.keyword}\"`,\n\t\t...diagnosticSource(sources, block.node.syntax).at(keywordPslSpan(block.node.syntax, block.keyword, sources))\n\t};\n}\n//#endregion\nexport { argumentIndexOf, argumentSpan, claimedBlockKeywords, consumeInvalidFkPairing, describeRemovedFieldPreset, enumMemberAttributeDiagnostics, fkRelationPairKey, hasPslInterpreter, instantiatePslTypeChoice, isBareTypeConstructor, mapPslHelperArgs, presetType, removedPresetWithPhases, removedPresetWrittenAs, reportTypeConstructorNotCalled, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic, withSeedDiagnostics, writtenPresetType };\n\n//# sourceMappingURL=interpret.mjs.map"],"mappings":";;;;;AAMA,SAAS,+BAA+B,WAAW,SAAS;CAC3D,MAAM,SAAS,iBAAiB,SAAS,UAAU,KAAK,MAAM;CAC9D,OAAO,UAAU,QAAQ,SAAS,WAAW,MAAM,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O;CAChI,OAAO;AACR;AACA,SAAS,2BAA2B,OAAO,SAAS;CACnD,OAAO;EACN,MAAM;EACN,SAAS,gCAAgC,MAAM,QAAQ;EACvD,GAAG,iBAAiB,SAAS,MAAM,KAAK,MAAM,CAAC,CAAC,GAAG,eAAe,MAAM,KAAK,QAAQ,MAAM,SAAS,OAAO,CAAC;CAC7G;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as TokenKind } from "./tokenizer-i8RaVWVa-7fRwlCPP.mjs";
|
|
2
|
-
import { $ as TypeAnnotationAst, A as NamespaceDeclarationAst, C as IdentifierAst, D as ModelAttributeAst, E as MixinInclusionAst, F as ParseDiagnostic, G as StringLiteralExprAst, H as QualifiedNameAst, I as ParseResult, J as SyntaxKind, K as StringLiteralQuote, L as PathExprAst, M as NumberLiteralExprAst, N as ObjectFieldAst, O as ModelDeclarationAst, P as ObjectLiteralExprAst, Q as TokenAtOffset, R as Position, S as HasDocComment, T as MixinDeclarationAst, U as Range, V as PslSources, W as SourceFile, X as SyntaxToken, Y as SyntaxNode, Z as TaggedLiteralExprAst, _ as GenericBlockDeclarationAst, a as AttributeAst, b as GreenNode, c as BracedBlock, ct as filterChildren, dt as greenNode, et as TypesBlockAst, f as DocumentAst, ft as greenToken, g as FunctionCallAst, h as FieldDeclarationAst, ht as printSyntax, i as AttributeArgListAst, it as createSyntaxTree, j as NamespaceMemberAst, k as NamedTypeDeclarationAst, l as CompositeTypeDeclarationAst, lt as findChildToken, m as FieldAttributeAst, mt as parse, n as AstNode, nt as castExpression, o as BlockMemberAst, p as ExpressionAst, q as SyntaxElement, r as AttributeArgAst, s as BooleanLiteralExprAst, st as dottedPathsIn, t as ArrayLiteralAst, tt as any, u as DeclarationAst, ut as findFirstChild, v as GenericBlockMemberAst, w as KeyValuePairAst, x as GreenToken, y as GreenElement } from "./parse-djL5wker-
|
|
2
|
+
import { $ as TypeAnnotationAst, A as NamespaceDeclarationAst, C as IdentifierAst, D as ModelAttributeAst, E as MixinInclusionAst, F as ParseDiagnostic, G as StringLiteralExprAst, H as QualifiedNameAst, I as ParseResult, J as SyntaxKind, K as StringLiteralQuote, L as PathExprAst, M as NumberLiteralExprAst, N as ObjectFieldAst, O as ModelDeclarationAst, P as ObjectLiteralExprAst, Q as TokenAtOffset, R as Position, S as HasDocComment, T as MixinDeclarationAst, U as Range, V as PslSources, W as SourceFile, X as SyntaxToken, Y as SyntaxNode, Z as TaggedLiteralExprAst, _ as GenericBlockDeclarationAst, a as AttributeAst, b as GreenNode, c as BracedBlock, ct as filterChildren, dt as greenNode, et as TypesBlockAst, f as DocumentAst, ft as greenToken, g as FunctionCallAst, h as FieldDeclarationAst, ht as printSyntax, i as AttributeArgListAst, it as createSyntaxTree, j as NamespaceMemberAst, k as NamedTypeDeclarationAst, l as CompositeTypeDeclarationAst, lt as findChildToken, m as FieldAttributeAst, mt as parse, n as AstNode, nt as castExpression, o as BlockMemberAst, p as ExpressionAst, q as SyntaxElement, r as AttributeArgAst, s as BooleanLiteralExprAst, st as dottedPathsIn, t as ArrayLiteralAst, tt as any, u as DeclarationAst, ut as findFirstChild, v as GenericBlockMemberAst, w as KeyValuePairAst, x as GreenToken, y as GreenElement } from "./parse-djL5wker-4_2Cqwev.mjs";
|
|
3
3
|
//#region ../../../1-framework/2-authoring/psl-parser/dist/syntax.d.mts
|
|
4
4
|
//#region src/syntax/green-builder.d.ts
|
|
5
5
|
declare class GreenNodeBuilder {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as printSyntax, S as findFirstChild, _ as castExpression, a as IdentifierAst, b as filterChildren, c as ObjectLiteralExprAst, d as StringLiteralExprAst, f as SyntaxNode, g as any, h as TokenAtOffset, i as FunctionCallAst, l as PathExprAst, m as TaggedLiteralExprAst, n as AttributeArgAst, o as NumberLiteralExprAst, p as SyntaxToken, r as BooleanLiteralExprAst, s as ObjectFieldAst, t as ArrayLiteralAst, u as QualifiedNameAst, v as createSyntaxTree, x as findChildToken, y as dottedPathsIn } from "./expressions-CMQzbnHk-
|
|
2
|
-
import { _ as isTriviaKind, a as FieldDeclarationAst, c as MixinDeclarationAst, d as ModelDeclarationAst, f as NamedTypeDeclarationAst, g as isTrivia, h as TypesBlockAst, i as FieldAttributeAst, l as MixinInclusionAst, m as TypeAnnotationAst, n as CompositeTypeDeclarationAst, o as GenericBlockDeclarationAst, p as NamespaceDeclarationAst, r as DocumentAst, s as KeyValuePairAst, t as AttributeArgListAst, u as ModelAttributeAst, v as nonTriviaSibling, y as skipTriviaToken } from "./declarations-BgUAq1RG-
|
|
3
|
-
import { a as greenToken, i as greenNode, n as PslSources, o as parse, r as SourceFile, t as GreenNodeBuilder } from "./parse-bZgfjovA-
|
|
1
|
+
import { C as printSyntax, S as findFirstChild, _ as castExpression, a as IdentifierAst, b as filterChildren, c as ObjectLiteralExprAst, d as StringLiteralExprAst, f as SyntaxNode, g as any, h as TokenAtOffset, i as FunctionCallAst, l as PathExprAst, m as TaggedLiteralExprAst, n as AttributeArgAst, o as NumberLiteralExprAst, p as SyntaxToken, r as BooleanLiteralExprAst, s as ObjectFieldAst, t as ArrayLiteralAst, u as QualifiedNameAst, v as createSyntaxTree, x as findChildToken, y as dottedPathsIn } from "./expressions-CMQzbnHk-B7zBWJ0c.mjs";
|
|
2
|
+
import { _ as isTriviaKind, a as FieldDeclarationAst, c as MixinDeclarationAst, d as ModelDeclarationAst, f as NamedTypeDeclarationAst, g as isTrivia, h as TypesBlockAst, i as FieldAttributeAst, l as MixinInclusionAst, m as TypeAnnotationAst, n as CompositeTypeDeclarationAst, o as GenericBlockDeclarationAst, p as NamespaceDeclarationAst, r as DocumentAst, s as KeyValuePairAst, t as AttributeArgListAst, u as ModelAttributeAst, v as nonTriviaSibling, y as skipTriviaToken } from "./declarations-BgUAq1RG-DvmyJ8LS.mjs";
|
|
3
|
+
import { a as greenToken, i as greenNode, n as PslSources, o as parse, r as SourceFile, t as GreenNodeBuilder } from "./parse-bZgfjovA-Vk8LMIu5.mjs";
|
|
4
4
|
export { ArrayLiteralAst, AttributeArgAst, AttributeArgListAst, BooleanLiteralExprAst, CompositeTypeDeclarationAst, DocumentAst, FieldAttributeAst, FieldDeclarationAst, FunctionCallAst, GenericBlockDeclarationAst, GreenNodeBuilder, IdentifierAst, KeyValuePairAst, MixinDeclarationAst, MixinInclusionAst, ModelAttributeAst, ModelDeclarationAst, NamedTypeDeclarationAst, NamespaceDeclarationAst, NumberLiteralExprAst, ObjectFieldAst, ObjectLiteralExprAst, PathExprAst, PslSources, QualifiedNameAst, SourceFile, StringLiteralExprAst, SyntaxNode, SyntaxToken, TaggedLiteralExprAst, TokenAtOffset, TypeAnnotationAst, TypesBlockAst, any, castExpression, createSyntaxTree, dottedPathsIn, filterChildren, findChildToken, findFirstChild, greenNode, greenToken, isTrivia, isTriviaKind, nonTriviaSibling, parse, printSyntax, skipTriviaToken };
|
package/dist/psl-printer.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { x as AuthoringPslBlockDescriptorNamespace } from "./
|
|
2
|
-
import "./authoring-
|
|
3
|
-
import { f as PslDocumentAst } from "./psl-ast-
|
|
4
|
-
import "./psl-ast-
|
|
1
|
+
import { x as AuthoringPslBlockDescriptorNamespace } from "./authoring-type-choice-CHcRX0RP-CkG1L8a9.mjs";
|
|
2
|
+
import "./authoring-BKOoGNxH.mjs";
|
|
3
|
+
import { f as PslDocumentAst } from "./psl-ast-B4ZxpQdr-DT9LRqBC.mjs";
|
|
4
|
+
import "./psl-ast-Dsf1-QLK.mjs";
|
|
5
5
|
//#region ../../../1-framework/2-authoring/psl-printer/dist/index.d.mts
|
|
6
6
|
//#region src/print-psl.d.ts
|
|
7
7
|
type PslBlockDescriptorsNamespace = AuthoringPslBlockDescriptorNamespace;
|
package/dist/psl-printer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ifDefined } from "./defined-BQWA85QH-BRSBMULx.mjs";
|
|
2
2
|
import { o as structuredError } from "./structured-error-BXbihKQ-.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { k as isAuthoringPslBlockDescriptor } from "./temporal-type-aliases-BI3SL5iB-DIP8j4Gv.mjs";
|
|
4
4
|
import { a as flatPslModels, c as namespacePslExtensionBlocks } from "./psl-ast-CyvE6CR-.mjs";
|
|
5
5
|
//#region ../../../1-framework/2-authoring/psl-printer/dist/index.mjs
|
|
6
6
|
function contractError(code, message, options) {
|