@prisma-next/framework-components 0.13.0 → 0.14.0
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.d.mts +2 -2
- package/dist/authoring.mjs +1 -1
- package/dist/{codec-DCQAerzB.d.mts → codec-types-yY3eSmi0.d.mts} +90 -67
- package/dist/codec-types-yY3eSmi0.d.mts.map +1 -0
- package/dist/codec.d.mts +31 -2
- package/dist/codec.d.mts.map +1 -1
- package/dist/codec.mjs +2 -1
- package/dist/codec.mjs.map +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/control.d.mts +13 -25
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +12 -2
- package/dist/control.mjs.map +1 -1
- package/dist/{emission-types-vfpSTe63.d.mts → emission-types-C561PwcN.d.mts} +4 -4
- package/dist/emission-types-C561PwcN.d.mts.map +1 -0
- package/dist/emission.d.mts +1 -1
- package/dist/execution.d.mts +1 -1
- package/dist/{framework-authoring-R0TYCkvG.d.mts → framework-authoring-CJC4jwGo.d.mts} +121 -9
- package/dist/framework-authoring-CJC4jwGo.d.mts.map +1 -0
- package/dist/{framework-authoring-CnwPJCO4.mjs → framework-authoring-Dv5F3EFC.mjs} +51 -24
- package/dist/framework-authoring-Dv5F3EFC.mjs.map +1 -0
- package/dist/{framework-components-DDQXmW0b.d.mts → framework-components-5hA9ij1v.d.mts} +3 -3
- package/dist/{framework-components-DDQXmW0b.d.mts.map → framework-components-5hA9ij1v.d.mts.map} +1 -1
- package/dist/ir.d.mts +34 -4
- package/dist/ir.d.mts.map +1 -1
- package/dist/ir.mjs +51 -6
- package/dist/ir.mjs.map +1 -1
- package/dist/{psl-ast-Cn50B-UG.d.mts → psl-ast-B-C_9dWr.d.mts} +11 -37
- package/dist/psl-ast-B-C_9dWr.d.mts.map +1 -0
- package/dist/psl-ast.d.mts +4 -4
- package/dist/psl-ast.mjs +18 -32
- package/dist/psl-ast.mjs.map +1 -1
- package/dist/resolve-codec-D8EPZosv.mjs +59 -0
- package/dist/resolve-codec-D8EPZosv.mjs.map +1 -0
- package/dist/runtime-error-B2gWOtgH.mjs +37 -0
- package/dist/runtime-error-B2gWOtgH.mjs.map +1 -0
- package/dist/runtime.d.mts +12 -10
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -33
- package/dist/runtime.mjs.map +1 -1
- package/package.json +7 -7
- package/src/control/control-migration-types.ts +5 -22
- package/src/control/control-stack.ts +28 -3
- package/src/control/emission-types.ts +3 -3
- package/src/control/psl-ast.ts +10 -61
- package/src/control/psl-extension-block-validator.ts +11 -9
- package/src/execution/runtime-error.ts +5 -55
- package/src/exports/authoring.ts +1 -0
- package/src/exports/codec.ts +7 -0
- package/src/exports/control.ts +0 -1
- package/src/exports/ir.ts +3 -1
- package/src/ir/entity-kind.ts +54 -0
- package/src/ir/storage.ts +32 -6
- package/src/shared/codec-descriptor.ts +5 -0
- package/src/shared/codec-types.ts +21 -1
- package/src/shared/framework-authoring.ts +118 -35
- package/src/shared/psl-extension-block.ts +85 -5
- package/src/shared/resolve-codec.ts +86 -0
- package/src/shared/runtime-error.ts +50 -0
- package/dist/codec-DCQAerzB.d.mts.map +0 -1
- package/dist/emission-types-vfpSTe63.d.mts.map +0 -1
- package/dist/framework-authoring-CnwPJCO4.mjs.map +0 -1
- package/dist/framework-authoring-R0TYCkvG.d.mts.map +0 -1
- package/dist/psl-ast-Cn50B-UG.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { r as CodecLookup } from "./codec-types-yY3eSmi0.mjs";
|
|
2
|
+
import { R as PslDiagnosticCode, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, z as PslExtensionBlock } from "./framework-authoring-CJC4jwGo.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/control/psl-ast.d.ts
|
|
5
5
|
interface PslDiagnostic {
|
|
@@ -94,28 +94,6 @@ interface PslModel {
|
|
|
94
94
|
*/
|
|
95
95
|
readonly comment?: string;
|
|
96
96
|
}
|
|
97
|
-
interface PslEnumValue {
|
|
98
|
-
readonly kind: 'enumValue';
|
|
99
|
-
readonly name: string;
|
|
100
|
-
/**
|
|
101
|
-
* Optional storage label for the enum member, captured from a trailing
|
|
102
|
-
* `@map("...")` attribute on the member line. The parser populates this
|
|
103
|
-
* when the source PSL carries an explicit `@map`. Producers (e.g.
|
|
104
|
-
* `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)`
|
|
105
|
-
* automatically when normalisation would change the printed member name
|
|
106
|
-
* (so an enum value `'in-progress'` becomes `inProgress @map("in-progress")`
|
|
107
|
-
* in PSL, preserving the round-trip).
|
|
108
|
-
*/
|
|
109
|
-
readonly mapName?: string;
|
|
110
|
-
readonly span: PslSpan;
|
|
111
|
-
}
|
|
112
|
-
interface PslEnum {
|
|
113
|
-
readonly kind: 'enum';
|
|
114
|
-
readonly name: string;
|
|
115
|
-
readonly values: readonly PslEnumValue[];
|
|
116
|
-
readonly attributes: readonly PslAttribute[];
|
|
117
|
-
readonly span: PslSpan;
|
|
118
|
-
}
|
|
119
97
|
/**
|
|
120
98
|
* A reusable group of fields embedded in a model (a `type Name { … }` block) —
|
|
121
99
|
* e.g. a MongoDB embedded document or a Postgres composite type. Unlike
|
|
@@ -160,7 +138,7 @@ interface PslTypesBlock {
|
|
|
160
138
|
*/
|
|
161
139
|
declare const UNSPECIFIED_PSL_NAMESPACE_ID = "__unspecified__";
|
|
162
140
|
/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */
|
|
163
|
-
type PslNamespaceEntry = PslModel |
|
|
141
|
+
type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;
|
|
164
142
|
/**
|
|
165
143
|
* A namespace block, or the parser's synthesised `__unspecified__` bucket for
|
|
166
144
|
* declarations outside any `namespace { … }`. Same-name blocks reopen-merge;
|
|
@@ -177,8 +155,6 @@ interface PslNamespace {
|
|
|
177
155
|
readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
|
|
178
156
|
/** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */
|
|
179
157
|
readonly models: readonly PslModel[];
|
|
180
|
-
/** Built-in enums, from `entries['enum']`. */
|
|
181
|
-
readonly enums: readonly PslEnum[];
|
|
182
158
|
/** Built-in composite types, from `entries['compositeType']`. */
|
|
183
159
|
readonly compositeTypes: readonly PslCompositeType[];
|
|
184
160
|
readonly span: PslSpan;
|
|
@@ -195,7 +171,7 @@ declare function makePslNamespace(init: {
|
|
|
195
171
|
* Built-ins key on their PSL keyword; extension blocks key on their `kind`
|
|
196
172
|
* discriminator. Call this rather than hand-building the literal.
|
|
197
173
|
*/
|
|
198
|
-
declare function makePslNamespaceEntries(models: readonly PslModel[],
|
|
174
|
+
declare function makePslNamespaceEntries(models: readonly PslModel[], compositeTypes: readonly PslCompositeType[], extensionBlocks: readonly PslExtensionBlock[]): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;
|
|
199
175
|
interface PslDocumentAst {
|
|
200
176
|
readonly kind: 'document';
|
|
201
177
|
readonly sourceId: string;
|
|
@@ -208,10 +184,6 @@ interface PslDocumentAst {
|
|
|
208
184
|
* for consumers that don't (yet) need namespace-awareness.
|
|
209
185
|
*/
|
|
210
186
|
declare function flatPslModels(ast: PslDocumentAst): readonly PslModel[];
|
|
211
|
-
/**
|
|
212
|
-
* Returns all enums from every namespace in document order.
|
|
213
|
-
*/
|
|
214
|
-
declare function flatPslEnums(ast: PslDocumentAst): readonly PslEnum[];
|
|
215
187
|
/**
|
|
216
188
|
* Returns all composite types from every namespace in document order.
|
|
217
189
|
*/
|
|
@@ -222,15 +194,17 @@ declare function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslComposi
|
|
|
222
194
|
* that is **not** in this set was contributed by an extension-block descriptor.
|
|
223
195
|
*
|
|
224
196
|
* Built-in keys match the PSL keyword used on each block type:
|
|
225
|
-
* `'model'`, `'
|
|
197
|
+
* `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the
|
|
198
|
+
* extension-block grammar via a registered descriptor, so `entries['enum']`
|
|
199
|
+
* holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.
|
|
226
200
|
*/
|
|
227
201
|
declare const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string>;
|
|
228
202
|
/**
|
|
229
203
|
* Returns all extension-contributed blocks in the given namespace, in
|
|
230
204
|
* insertion order (the order the parser encountered them in the source).
|
|
231
205
|
*
|
|
232
|
-
* Reads from `namespace.entries`, skipping the
|
|
233
|
-
* (`'model'`, `'
|
|
206
|
+
* Reads from `namespace.entries`, skipping the built-in kind keys
|
|
207
|
+
* (`'model'`, `'compositeType'`). All remaining kind maps contain
|
|
234
208
|
* only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).
|
|
235
209
|
*/
|
|
236
210
|
declare function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[];
|
|
@@ -269,5 +243,5 @@ interface ParsePslDocumentResult {
|
|
|
269
243
|
readonly ok: boolean;
|
|
270
244
|
}
|
|
271
245
|
//#endregion
|
|
272
|
-
export {
|
|
273
|
-
//# sourceMappingURL=psl-ast-
|
|
246
|
+
export { makePslNamespace as A, PslReferentialAction as C, UNSPECIFIED_PSL_NAMESPACE_ID as D, PslUniqueConstraint as E, namespacePslExtensionBlocks as M, flatPslCompositeTypes as O, PslNamespaceEntry as S, PslTypesBlock as T, PslIndexConstraint as _, PslAttributeArgument as a, PslNamedTypeDeclaration as b, PslAttributeTarget as c, PslDefaultLiteralValue as d, PslDefaultValue as f, PslFieldAttribute as g, PslField as h, PslAttribute as i, makePslNamespaceEntries as j, flatPslModels as k, PslCompositeType as l, PslDocumentAst as m, ParsePslDocumentInput as n, PslAttributeNamedArgument as o, PslDiagnostic as p, ParsePslDocumentResult as r, PslAttributePositionalArgument as s, BUILTIN_PSL_KIND_KEYS as t, PslDefaultFunctionValue as u, PslModel as v, PslTypeConstructorCall as w, PslNamespace as x, PslModelAttribute as y };
|
|
247
|
+
//# sourceMappingURL=psl-ast-B-C_9dWr.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-ast-B-C_9dWr.d.mts","names":[],"sources":["../src/control/psl-ast.ts"],"mappings":";;;;UA0BiB,aAAA;EAAA,SACN,IAAA,EAAM,iBAAA;EAAA,SACN,OAAA;EAAA,SACA,QAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,uBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAI;AAAA;AAAA,UAGE,sBAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAK;AAAA;AAAA,KAGJ,eAAA,GAAkB,uBAAA,GAA0B,sBAAsB;AAAA,KAElE,kBAAA;AAAA,UAEK,8BAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,yBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,KAAA;EAAA,SACA,IAAA,EAAM,OAAO;AAAA;AAAA,KAGZ,oBAAA,GAAuB,8BAAA,GAAiC,yBAAyB;AAAA,UAE5E,sBAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA,WAAe,oBAAA;EAAA,SACf,IAAA,EAAM,OAAO;AAAA;AAAA,UAGP,YAAA;EAAA,SACN,IAAA;EAAA,SACA,MAAA,EAAQ,kBAAA;EAAA,SACR,IAAA;EAAA,SACA,IAAA,WAAe,oBAAA;EAAA,SACf,IAAA,EAAM,OAAA;AAAA;AAAA,KAGL,oBAAA;AAAA,KAEA,iBAAA,GAAoB,YAAY;AAAA,UAE3B,QAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EA5BA;EAAA,SA8BA,QAAA;EA5BA;EAAA,SA8BA,eAAA;EA9Ba;AAAA;AAGxB;;;;AAA6F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AAA,WAAsB,aAAa;EAAA,SACnC,EAAA;AAAA"}
|
package/dist/psl-ast.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
1
|
+
import { r as CodecLookup } from "./codec-types-yY3eSmi0.mjs";
|
|
2
|
+
import { B as PslExtensionBlockAttribute, F as PslBlockParamOption, G as PslExtensionBlockParamRef, H as PslExtensionBlockParamBare, I as PslBlockParamRef, J as PslPosition, K as PslExtensionBlockParamScalarValue, L as PslBlockParamValue, N as PslBlockParam, P as PslBlockParamList, R as PslDiagnosticCode, U as PslExtensionBlockParamList, V as PslExtensionBlockAttributeArg, W as PslExtensionBlockParamOption, Y as PslSpan, h as AuthoringPslBlockDescriptorNamespace, m as AuthoringPslBlockDescriptor, q as PslExtensionBlockParamValue, z as PslExtensionBlock } from "./framework-authoring-CJC4jwGo.mjs";
|
|
3
|
+
import { A as makePslNamespace, C as PslReferentialAction, D as UNSPECIFIED_PSL_NAMESPACE_ID, E as PslUniqueConstraint, M as namespacePslExtensionBlocks, O as flatPslCompositeTypes, S as PslNamespaceEntry, T as PslTypesBlock, _ as PslIndexConstraint, a as PslAttributeArgument, b as PslNamedTypeDeclaration, c as PslAttributeTarget, d as PslDefaultLiteralValue, f as PslDefaultValue, g as PslFieldAttribute, h as PslField, i as PslAttribute, j as makePslNamespaceEntries, k as flatPslModels, l as PslCompositeType, m as PslDocumentAst, n as ParsePslDocumentInput, o as PslAttributeNamedArgument, p as PslDiagnostic, r as ParsePslDocumentResult, s as PslAttributePositionalArgument, t as BUILTIN_PSL_KIND_KEYS, u as PslDefaultFunctionValue, v as PslModel, w as PslTypeConstructorCall, x as PslNamespace, y as PslModelAttribute } from "./psl-ast-B-C_9dWr.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/control/psl-extension-block-validator.d.ts
|
|
6
6
|
/**
|
|
@@ -33,5 +33,5 @@ interface ExtensionBlockRefResolutionContext {
|
|
|
33
33
|
*/
|
|
34
34
|
declare function validateExtensionBlock(node: PslExtensionBlock, descriptor: AuthoringPslBlockDescriptor, sourceId: string, codecLookup: CodecLookup, refCtx?: ExtensionBlockRefResolutionContext): readonly PslDiagnostic[];
|
|
35
35
|
//#endregion
|
|
36
|
-
export { type AuthoringPslBlockDescriptorNamespace, BUILTIN_PSL_KIND_KEYS, type ExtensionBlockRefResolutionContext, ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, type PslDiagnosticCode, PslDocumentAst,
|
|
36
|
+
export { type AuthoringPslBlockDescriptorNamespace, BUILTIN_PSL_KIND_KEYS, type ExtensionBlockRefResolutionContext, ParsePslDocumentInput, ParsePslDocumentResult, PslAttribute, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, type PslBlockParam, type PslBlockParamList, type PslBlockParamOption, type PslBlockParamRef, type PslBlockParamValue, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, type PslDiagnosticCode, PslDocumentAst, type PslExtensionBlock, type PslExtensionBlockAttribute, type PslExtensionBlockAttributeArg, type PslExtensionBlockParamBare, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, PslField, PslFieldAttribute, PslIndexConstraint, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslNamespace, PslNamespaceEntry, type PslPosition, PslReferentialAction, type PslSpan, PslTypeConstructorCall, PslTypesBlock, PslUniqueConstraint, UNSPECIFIED_PSL_NAMESPACE_ID, flatPslCompositeTypes, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock };
|
|
37
37
|
//# sourceMappingURL=psl-ast.d.mts.map
|
package/dist/psl-ast.mjs
CHANGED
|
@@ -32,9 +32,6 @@ var PslNamespaceNode = class {
|
|
|
32
32
|
get models() {
|
|
33
33
|
return blindCast(Object.values(this.entries["model"] ?? {}));
|
|
34
34
|
}
|
|
35
|
-
get enums() {
|
|
36
|
-
return blindCast(Object.values(this.entries["enum"] ?? {}));
|
|
37
|
-
}
|
|
38
35
|
get compositeTypes() {
|
|
39
36
|
return blindCast(Object.values(this.entries["compositeType"] ?? {}));
|
|
40
37
|
}
|
|
@@ -48,18 +45,13 @@ function makePslNamespace(init) {
|
|
|
48
45
|
* Built-ins key on their PSL keyword; extension blocks key on their `kind`
|
|
49
46
|
* discriminator. Call this rather than hand-building the literal.
|
|
50
47
|
*/
|
|
51
|
-
function makePslNamespaceEntries(models,
|
|
48
|
+
function makePslNamespaceEntries(models, compositeTypes, extensionBlocks) {
|
|
52
49
|
const container = {};
|
|
53
50
|
if (models.length > 0) {
|
|
54
51
|
const map = {};
|
|
55
52
|
for (const m of models) map[m.name] = m;
|
|
56
53
|
container["model"] = Object.freeze(map);
|
|
57
54
|
}
|
|
58
|
-
if (enums.length > 0) {
|
|
59
|
-
const map = {};
|
|
60
|
-
for (const e of enums) map[e.name] = e;
|
|
61
|
-
container["enum"] = Object.freeze(map);
|
|
62
|
-
}
|
|
63
55
|
if (compositeTypes.length > 0) {
|
|
64
56
|
const map = {};
|
|
65
57
|
for (const ct of compositeTypes) map[ct.name] = ct;
|
|
@@ -81,12 +73,6 @@ function flatPslModels(ast) {
|
|
|
81
73
|
return ast.namespaces.flatMap((ns) => blindCast(Object.values(ns.entries["model"] ?? {})));
|
|
82
74
|
}
|
|
83
75
|
/**
|
|
84
|
-
* Returns all enums from every namespace in document order.
|
|
85
|
-
*/
|
|
86
|
-
function flatPslEnums(ast) {
|
|
87
|
-
return ast.namespaces.flatMap((ns) => blindCast(Object.values(ns.entries["enum"] ?? {})));
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
76
|
* Returns all composite types from every namespace in document order.
|
|
91
77
|
*/
|
|
92
78
|
function flatPslCompositeTypes(ast) {
|
|
@@ -98,19 +84,17 @@ function flatPslCompositeTypes(ast) {
|
|
|
98
84
|
* that is **not** in this set was contributed by an extension-block descriptor.
|
|
99
85
|
*
|
|
100
86
|
* Built-in keys match the PSL keyword used on each block type:
|
|
101
|
-
* `'model'`, `'
|
|
87
|
+
* `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the
|
|
88
|
+
* extension-block grammar via a registered descriptor, so `entries['enum']`
|
|
89
|
+
* holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.
|
|
102
90
|
*/
|
|
103
|
-
const BUILTIN_PSL_KIND_KEYS = new Set([
|
|
104
|
-
"model",
|
|
105
|
-
"enum",
|
|
106
|
-
"compositeType"
|
|
107
|
-
]);
|
|
91
|
+
const BUILTIN_PSL_KIND_KEYS = new Set(["model", "compositeType"]);
|
|
108
92
|
/**
|
|
109
93
|
* Returns all extension-contributed blocks in the given namespace, in
|
|
110
94
|
* insertion order (the order the parser encountered them in the source).
|
|
111
95
|
*
|
|
112
|
-
* Reads from `namespace.entries`, skipping the
|
|
113
|
-
* (`'model'`, `'
|
|
96
|
+
* Reads from `namespace.entries`, skipping the built-in kind keys
|
|
97
|
+
* (`'model'`, `'compositeType'`). All remaining kind maps contain
|
|
114
98
|
* only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).
|
|
115
99
|
*/
|
|
116
100
|
function namespacePslExtensionBlocks(ns) {
|
|
@@ -143,14 +127,16 @@ function validateExtensionBlock(node, descriptor, sourceId, codecLookup, refCtx)
|
|
|
143
127
|
const diagnostics = [];
|
|
144
128
|
const descriptorKeys = new Set(Object.keys(descriptor.parameters));
|
|
145
129
|
const nodeKeys = new Set(Object.keys(node.parameters));
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
if (!descriptor.variadicParameters) {
|
|
131
|
+
for (const key of nodeKeys) if (!descriptorKeys.has(key)) {
|
|
132
|
+
const captured = node.parameters[key];
|
|
133
|
+
diagnostics.push({
|
|
134
|
+
code: "PSL_EXTENSION_UNKNOWN_PARAMETER",
|
|
135
|
+
message: `Unknown parameter "${key}" in "${descriptor.keyword}" block "${node.name}". The descriptor does not declare this parameter.`,
|
|
136
|
+
sourceId,
|
|
137
|
+
span: captured?.span ?? node.span
|
|
138
|
+
});
|
|
139
|
+
}
|
|
154
140
|
}
|
|
155
141
|
for (const [key, param] of Object.entries(descriptor.parameters)) if (param.required === true && !nodeKeys.has(key)) diagnostics.push({
|
|
156
142
|
code: "PSL_EXTENSION_MISSING_REQUIRED_PARAMETER",
|
|
@@ -250,6 +236,6 @@ function resolveEntityInNamespaces(name, refKind, namespaces) {
|
|
|
250
236
|
return false;
|
|
251
237
|
}
|
|
252
238
|
//#endregion
|
|
253
|
-
export { BUILTIN_PSL_KIND_KEYS, UNSPECIFIED_PSL_NAMESPACE_ID, flatPslCompositeTypes,
|
|
239
|
+
export { BUILTIN_PSL_KIND_KEYS, UNSPECIFIED_PSL_NAMESPACE_ID, flatPslCompositeTypes, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock };
|
|
254
240
|
|
|
255
241
|
//# sourceMappingURL=psl-ast.mjs.map
|
package/dist/psl-ast.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"psl-ast.mjs","names":[],"sources":["../src/control/psl-ast.ts","../src/control/psl-extension-block-validator.ts"],"sourcesContent":["export type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nexport type {\n PslBlockParam,\n PslBlockParamList,\n PslBlockParamOption,\n PslBlockParamRef,\n PslBlockParamValue,\n PslDiagnosticCode,\n PslExtensionBlock,\n PslExtensionBlockParamList,\n PslExtensionBlockParamOption,\n PslExtensionBlockParamRef,\n PslExtensionBlockParamScalarValue,\n PslExtensionBlockParamValue,\n PslPosition,\n PslSpan,\n} from '../shared/psl-extension-block';\n\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nimport type { PslDiagnosticCode, PslExtensionBlock, PslSpan } from '../shared/psl-extension-block';\n\nexport interface PslDiagnostic {\n readonly code: PslDiagnosticCode;\n readonly message: string;\n readonly sourceId: string;\n readonly span: PslSpan;\n}\n\nexport interface PslDefaultFunctionValue {\n readonly kind: 'function';\n readonly name: 'autoincrement' | 'now';\n}\n\nexport interface PslDefaultLiteralValue {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;\n\nexport type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';\n\nexport interface PslAttributePositionalArgument {\n readonly kind: 'positional';\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport interface PslAttributeNamedArgument {\n readonly kind: 'named';\n readonly name: string;\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;\n\nexport interface PslTypeConstructorCall {\n readonly kind: 'typeConstructor';\n readonly path: readonly string[];\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport interface PslAttribute {\n readonly kind: 'attribute';\n readonly target: PslAttributeTarget;\n readonly name: string;\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport type PslReferentialAction = string;\n\nexport type PslFieldAttribute = PslAttribute;\n\nexport interface PslField {\n readonly kind: 'field';\n readonly name: string;\n /** Unqualified type name, e.g. `\"User\"` for both `User`, `auth.User`, and `supabase:auth.User`. */\n readonly typeName: string;\n /** Namespace qualifier from a dot-qualified type reference, e.g. `\"auth\"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */\n readonly typeNamespaceId?: string;\n /**\n * Contract-space qualifier from a colon-prefix type reference, e.g. `\"supabase\"` for\n * `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.\n *\n * When present, the field references a model from a different contract space. The namespace\n * (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.\n * Physical table resolution against the extension contract is deferred to the aggregate stage (M3).\n */\n readonly typeContractSpaceId?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly optional: boolean;\n readonly list: boolean;\n readonly typeRef?: string;\n readonly attributes: readonly PslFieldAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslUniqueConstraint {\n readonly kind: 'unique';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport interface PslIndexConstraint {\n readonly kind: 'index';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport type PslModelAttribute = PslAttribute;\n\nexport interface PslModel {\n readonly kind: 'model';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslModelAttribute[];\n readonly span: PslSpan;\n /**\n * Optional leading comment line emitted above the `model` keyword by the\n * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection\n * advisories such as \"// WARNING: This table has no primary key in the\n * database\" here. The parser leaves this field unset; round-tripping a\n * parsed schema does not re-attach comments.\n */\n readonly comment?: string;\n}\n\nexport interface PslEnumValue {\n readonly kind: 'enumValue';\n readonly name: string;\n /**\n * Optional storage label for the enum member, captured from a trailing\n * `@map(\"...\")` attribute on the member line. The parser populates this\n * when the source PSL carries an explicit `@map`. Producers (e.g.\n * `sqlSchemaIrToPslAst`) leave it unset; the printer emits `@map(...)`\n * automatically when normalisation would change the printed member name\n * (so an enum value `'in-progress'` becomes `inProgress @map(\"in-progress\")`\n * in PSL, preserving the round-trip).\n */\n readonly mapName?: string;\n readonly span: PslSpan;\n}\n\nexport interface PslEnum {\n readonly kind: 'enum';\n readonly name: string;\n readonly values: readonly PslEnumValue[];\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\n/**\n * A reusable group of fields embedded in a model (a `type Name { … }` block) —\n * e.g. a MongoDB embedded document or a Postgres composite type. Unlike\n * {@link PslModel} it has no storage or identity of its own.\n */\nexport interface PslCompositeType {\n readonly kind: 'compositeType';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslNamedTypeDeclaration {\n readonly kind: 'namedType';\n readonly name: string;\n /**\n * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.\n * Expressing this as a discriminated union trips TypeScript narrowing when\n * the declaration flows through helpers that accept the full union.\n */\n readonly baseType?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslTypesBlock {\n readonly kind: 'types';\n readonly declarations: readonly PslNamedTypeDeclaration[];\n readonly span: PslSpan;\n}\n\n/**\n * Name of the synthesised namespace bucket the framework parser uses for\n * top-level declarations that appear outside any `namespace { … }` block.\n * The double-underscore decoration signals that the identifier is parser-\n * synthesised and never appears in user-authored PSL source — writing\n * `namespace __unspecified__ { … }` is a parse error.\n *\n * Distinct from the IR sentinel `__unbound__`: the PSL bucket describes\n * syntactic absence at the parser layer; the IR sentinel describes a late-\n * bound storage slot at the IR layer. Per-target interpreters decide how\n * (or whether) to map the PSL bucket to the IR sentinel.\n */\nexport const UNSPECIFIED_PSL_NAMESPACE_ID = '__unspecified__';\n\n/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */\nexport type PslNamespaceEntry = PslModel | PslEnum | PslCompositeType | PslExtensionBlock;\n\n/**\n * A namespace block, or the parser's synthesised `__unspecified__` bucket for\n * declarations outside any `namespace { … }`. Same-name blocks reopen-merge;\n * `span` points at the first opening.\n *\n * Entities are stored canonically (ADR 224) in `entries[kind][name]`, where\n * `kind` is the PSL keyword for built-ins or the block discriminator for\n * extension kinds, e.g. `entries['policy_select']['ReadPosts']`.\n */\nexport interface PslNamespace {\n readonly kind: 'namespace';\n readonly name: string;\n /** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n /** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */\n readonly models: readonly PslModel[];\n /** Built-in enums, from `entries['enum']`. */\n readonly enums: readonly PslEnum[];\n /** Built-in composite types, from `entries['compositeType']`. */\n readonly compositeTypes: readonly PslCompositeType[];\n readonly span: PslSpan;\n}\n\n/**\n * Stores `entries`; exposes `models`/`enums`/`compositeTypes` as getters over\n * it. The getters are prototype members (non-enumerable), so spreading or\n * `JSON.stringify`-ing a namespace copies only `entries`, never a duplicate view.\n */\nclass PslNamespaceNode implements PslNamespace {\n readonly kind = 'namespace' as const;\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n\n constructor(init: {\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n }) {\n this.name = init.name;\n this.entries = init.entries;\n this.span = init.span;\n Object.freeze(this);\n }\n\n get models(): readonly PslModel[] {\n return blindCast<readonly PslModel[], 'entries[model] holds only PslModel by construction'>(\n Object.values(this.entries['model'] ?? {}),\n );\n }\n\n get enums(): readonly PslEnum[] {\n return blindCast<readonly PslEnum[], 'entries[enum] holds only PslEnum by construction'>(\n Object.values(this.entries['enum'] ?? {}),\n );\n }\n\n get compositeTypes(): readonly PslCompositeType[] {\n return blindCast<\n readonly PslCompositeType[],\n 'entries[compositeType] holds only PslCompositeType by construction'\n >(Object.values(this.entries['compositeType'] ?? {}));\n }\n}\n\n/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */\nexport function makePslNamespace(init: {\n readonly kind: 'namespace';\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n}): PslNamespace {\n return new PslNamespaceNode(init);\n}\n\n/**\n * Builds the frozen `entries[kind][name]` container from per-kind arrays.\n * Built-ins key on their PSL keyword; extension blocks key on their `kind`\n * discriminator. Call this rather than hand-building the literal.\n */\nexport function makePslNamespaceEntries(\n models: readonly PslModel[],\n enums: readonly PslEnum[],\n compositeTypes: readonly PslCompositeType[],\n extensionBlocks: readonly PslExtensionBlock[],\n): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>> {\n const container: Record<string, Readonly<Record<string, PslNamespaceEntry>>> = {};\n\n if (models.length > 0) {\n const map: Record<string, PslModel> = {};\n for (const m of models) {\n map[m.name] = m;\n }\n container['model'] = Object.freeze(map);\n }\n\n if (enums.length > 0) {\n const map: Record<string, PslEnum> = {};\n for (const e of enums) {\n map[e.name] = e;\n }\n container['enum'] = Object.freeze(map);\n }\n\n if (compositeTypes.length > 0) {\n const map: Record<string, PslCompositeType> = {};\n for (const ct of compositeTypes) {\n map[ct.name] = ct;\n }\n container['compositeType'] = Object.freeze(map);\n }\n\n for (const block of extensionBlocks) {\n const existing = container[block.kind];\n const newMap: Record<string, PslExtensionBlock> = existing\n ? blindCast<Record<string, PslExtensionBlock>, 'kind map holds only PslExtensionBlock'>({\n ...existing,\n })\n : {};\n newMap[block.name] = block;\n container[block.kind] = Object.freeze(newMap);\n }\n\n return Object.freeze(container);\n}\n\nexport interface PslDocumentAst {\n readonly kind: 'document';\n readonly sourceId: string;\n readonly namespaces: readonly PslNamespace[];\n readonly types?: PslTypesBlock;\n readonly span: PslSpan;\n}\n\n/**\n * Returns all models from every namespace in document order. Convenience\n * for consumers that don't (yet) need namespace-awareness.\n */\nexport function flatPslModels(ast: PslDocumentAst): readonly PslModel[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<PslModel[], 'model kind map contains only PslModel by construction'>(\n Object.values(ns.entries['model'] ?? {}),\n ),\n );\n}\n\n/**\n * Returns all enums from every namespace in document order.\n */\nexport function flatPslEnums(ast: PslDocumentAst): readonly PslEnum[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<PslEnum[], 'enum kind map contains only PslEnum by construction'>(\n Object.values(ns.entries['enum'] ?? {}),\n ),\n );\n}\n\n/**\n * Returns all composite types from every namespace in document order.\n */\nexport function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<\n PslCompositeType[],\n 'compositeType kind map contains only PslCompositeType by construction'\n >(Object.values(ns.entries['compositeType'] ?? {})),\n );\n}\n\n/**\n * The set of `entries` kind keys that the framework parser reserves for\n * built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`\n * that is **not** in this set was contributed by an extension-block descriptor.\n *\n * Built-in keys match the PSL keyword used on each block type:\n * `'model'`, `'enum'`, `'compositeType'`.\n */\nexport const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string> = new Set([\n 'model',\n 'enum',\n 'compositeType',\n]);\n\n/**\n * Returns all extension-contributed blocks in the given namespace, in\n * insertion order (the order the parser encountered them in the source).\n *\n * Reads from `namespace.entries`, skipping the three built-in kind keys\n * (`'model'`, `'enum'`, `'compositeType'`). All remaining kind maps contain\n * only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).\n */\nexport function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[] {\n const result: PslExtensionBlock[] = [];\n for (const [kindKey, kindMap] of Object.entries(ns.entries)) {\n if (BUILTIN_PSL_KIND_KEYS.has(kindKey)) continue;\n for (const entry of Object.values(kindMap)) {\n result.push(\n blindCast<\n PslExtensionBlock,\n 'non-builtin kind maps contain only PslExtensionBlock by construction'\n >(entry),\n );\n }\n }\n return result;\n}\n\nexport interface ParsePslDocumentInput {\n readonly schema: string;\n readonly sourceId: string;\n /**\n * Registry of declarative block descriptors, keyed by arbitrary path\n * segments with {@link AuthoringPslBlockDescriptor} leaves. The registry\n * teaches the parser which top-level keywords belong to extension\n * contributions: when the parser encounters an unknown keyword, it looks\n * it up here and, when found, reads the block generically into a\n * {@link PslExtensionBlock} node. Absent or undefined means no extension\n * blocks are registered and any unknown keyword yields\n * `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.\n *\n * Contrast with the parsed block nodes themselves, which live in\n * {@link PslNamespace.entries} under their discriminator key (read them with\n * {@link namespacePslExtensionBlocks}); this field holds the registry of\n * descriptors that teach the parser how to read those blocks.\n */\n readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;\n /**\n * Codec lookup for validating `value`-kind extension block parameters.\n * When provided alongside `pslBlockDescriptors`, the generic validator runs\n * over every parsed extension block after the full AST is assembled,\n * appending any diagnostics to the parse result. Absent or undefined means\n * no codec validation runs; `ref` resolution still runs when namespace\n * context is available (built from the assembled namespaces).\n */\n readonly codecLookup?: CodecLookup;\n}\n\nexport interface ParsePslDocumentResult {\n readonly ast: PslDocumentAst;\n readonly diagnostics: readonly PslDiagnostic[];\n readonly ok: boolean;\n}\n","/**\n * Generic validator for extension-contributed top-level PSL blocks.\n *\n * One function — {@link validateExtensionBlock} — takes a parsed\n * {@link PslExtensionBlock}, its {@link AuthoringPslBlockDescriptor}, a\n * {@link CodecLookup} (for `value` parameters), and the set of\n * {@link PslNamespace} objects from the document (for `ref` resolution), and\n * returns the full list of {@link PslDiagnostic} objects for the block.\n *\n * Detection logic per failure mode:\n *\n * 1. **Unknown parameter** — keys present in `node.parameters` that are absent\n * from `descriptor.parameters` (key-set difference). The parser stores\n * unknown parameters as `kind:'value'` stubs; the validator discovers them\n * by comparing the key sets, not by inspecting the captured kind.\n *\n * 2. **Missing required parameter** — `descriptor.parameters` entries with\n * `required: true` whose key is absent from `node.parameters`.\n *\n * 3. **`option` value outside its set** — the captured `token` is not in\n * `descriptor.values`.\n *\n * 4. **`value` rejected by its codec** — the raw string is first parsed as\n * JSON (`JSON.parse(raw)`). If `JSON.parse` throws, the literal is not valid\n * JSON and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is emitted. If parsing\n * succeeds but `codec.decodeJson(jsonValue)` throws, the JSON value is not\n * acceptable to the codec and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is\n * emitted. If `codecLookup.get(codecId)` returns `undefined` (unknown codec\n * id), a `PSL_EXTENSION_INVALID_VALUE` diagnostic is also emitted.\n *\n * 5. **`ref` that does not resolve within its scope** — the captured\n * `identifier` is looked up in the PSL document's `PslNamespace` objects\n * according to `param.scope`:\n * - `same-namespace`: the referent must be in the same namespace as the\n * block (the namespace containing the block).\n * - `same-space`: the referent may be in any namespace in the document.\n * - `cross-space`: pass-through — enforcement is scoped to first-consumer\n * need (RLS roles). This case is documented and clearly flagged; the\n * caller is responsible for wiring cross-space resolution when needed.\n *\n * 6. **`list`** — each element is validated against `param.of` recursively.\n *\n * ### `char`/`varchar` length\n * Not enforced. RLS `using`/`check` strings are unbounded text and the codec\n * already rejects structurally invalid literals; length constraints are a\n * database-side concern, not a PSL authoring constraint.\n *\n * ### `cross-space` scope\n * Implemented as a documented pass-through. The spec permits scoping\n * cross-space enforcement to first-consumer need (RLS roles). When RLS roles\n * arrive, wire `cross-space` resolution through the cross-contract-space\n * coordinate model `(spaceId, namespaceId, entityKind, entityName)`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptor } from '../shared/framework-authoring';\nimport type {\n PslBlockParam,\n PslBlockParamRef,\n PslExtensionBlock,\n PslExtensionBlockParamValue,\n PslSpan,\n} from '../shared/psl-extension-block';\nimport type { PslDiagnostic, PslNamespace } from './psl-ast';\n\n/**\n * Context for ref resolution during extension-block validation.\n *\n * - `ownerNamespace` is the `PslNamespace` that contains the block being\n * validated. Used for `same-namespace` scope checks.\n * - `allNamespaces` is every namespace in the document. Used for `same-space`\n * scope checks.\n */\nexport interface ExtensionBlockRefResolutionContext {\n readonly ownerNamespace: PslNamespace;\n readonly allNamespaces: readonly PslNamespace[];\n}\n\n/**\n * Validate a single parsed extension block against its descriptor.\n *\n * Returns an array of {@link PslDiagnostic} objects (possibly empty). The\n * caller is responsible for threading `sourceId` into each returned diagnostic\n * — the returned objects already have `sourceId` set from the `sourceId`\n * parameter.\n *\n * @param node - The parsed block node produced by the generic framework parser.\n * @param descriptor - The descriptor that claims this block's keyword.\n * @param sourceId - The PSL source file identifier (threaded into diagnostics).\n * @param codecLookup - Used to validate `value`-kind parameter literals via\n * `codecLookup.get(codecId)?.decodeJson(JSON.parse(raw))`.\n * @param refCtx - Namespace context for `ref`-kind scope resolution. Required\n * when any descriptor parameter is `kind: 'ref'`; may be omitted if none are.\n */\nexport function validateExtensionBlock(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx?: ExtensionBlockRefResolutionContext,\n): readonly PslDiagnostic[] {\n const diagnostics: PslDiagnostic[] = [];\n\n const descriptorKeys = new Set(Object.keys(descriptor.parameters));\n const nodeKeys = new Set(Object.keys(node.parameters));\n\n // 1. Unknown parameters — keys in the node not in the descriptor.\n for (const key of nodeKeys) {\n if (!descriptorKeys.has(key)) {\n const captured = node.parameters[key];\n diagnostics.push({\n code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',\n message: `Unknown parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\". The descriptor does not declare this parameter.`,\n sourceId,\n span: captured?.span ?? node.span,\n });\n }\n }\n\n // 2. Missing required parameters — required descriptor keys absent from the node.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n if (param.required === true && !nodeKeys.has(key)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER',\n message: `Required parameter \"${key}\" is missing from \"${descriptor.keyword}\" block \"${node.name}\".`,\n sourceId,\n span: node.span,\n });\n }\n }\n\n // 3–5. Per-parameter validation for parameters that are present.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n const captured = node.parameters[key];\n if (captured === undefined) {\n continue;\n }\n validateParam(\n node,\n descriptor,\n key,\n param,\n captured,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n\n return diagnostics;\n}\n\nfunction validateParam(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParam,\n captured: PslExtensionBlockParamValue,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n switch (param.kind) {\n case 'option': {\n if (captured.kind !== 'option') {\n return;\n }\n if (!param.values.includes(captured.token)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_OPTION_OUT_OF_SET',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" has value \"${captured.token}\" which is not one of the allowed values: ${param.values.map((v) => `\"${v}\"`).join(', ')}.`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'value': {\n if (captured.kind !== 'value') {\n return;\n }\n const codec = codecLookup.get(param.codecId);\n if (codec === undefined) {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" references unknown codec \"${param.codecId}\".`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(captured.raw);\n } catch {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" is not a valid JSON literal (expected a JSON string, number, boolean, or null): ${captured.raw}`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n try {\n codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" was rejected by codec \"${param.codecId}\": ${reason}`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'ref': {\n if (captured.kind !== 'ref') {\n return;\n }\n validateRef(\n node,\n descriptor,\n key,\n param,\n captured.identifier,\n captured.span,\n sourceId,\n refCtx,\n diagnostics,\n );\n return;\n }\n\n case 'list': {\n if (captured.kind !== 'list') {\n return;\n }\n for (const item of captured.items) {\n validateParam(\n node,\n descriptor,\n key,\n param.of,\n item,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n return;\n }\n }\n}\n\nfunction validateRef(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParamRef,\n identifier: string,\n span: PslSpan,\n sourceId: string,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n if (param.scope === 'cross-space') {\n // cross-space enforcement is a documented pass-through. The spec permits\n // scoping cross-space resolution to first-consumer need (RLS roles). When\n // that consumer arrives, wire resolution here through the\n // cross-contract-space coordinate model\n // (spaceId, namespaceId, entityKind, entityName).\n // For now, cross-space refs pass validation unconditionally.\n return;\n }\n\n if (refCtx === undefined) {\n // If no resolution context was provided, skip ref resolution. This matches\n // the closed-grammar invariant: callers that register ref parameters must\n // provide resolution context; callers without namespaces (e.g. unit tests\n // that only exercise other validation modes) can omit it.\n return;\n }\n\n const namespacesToSearch: readonly PslNamespace[] =\n param.scope === 'same-namespace' ? [refCtx.ownerNamespace] : refCtx.allNamespaces;\n\n if (!resolveEntityInNamespaces(identifier, param.refKind, namespacesToSearch)) {\n const scopeLabel =\n param.scope === 'same-namespace' ? 'the same namespace' : 'any namespace in the schema';\n diagnostics.push({\n code: 'PSL_EXTENSION_UNRESOLVED_REF',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" refers to \"${identifier}\" (expected ${param.refKind}), but no entity with that name and kind was found in ${scopeLabel}.`,\n sourceId,\n span,\n });\n }\n}\n\n/**\n * True if an entity named `name` of kind `refKind` exists in any of the given\n * namespaces. Built-in and extension kinds resolve the same way, through\n * `entries[refKind]`.\n */\nfunction resolveEntityInNamespaces(\n name: string,\n refKind: string,\n namespaces: readonly PslNamespace[],\n): boolean {\n for (const ns of namespaces) {\n const kindMap = ns.entries[refKind];\n if (kindMap !== undefined && Object.hasOwn(kindMap, name)) return true;\n }\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;AAyMA,MAAa,+BAA+B;;;;;;AAiC5C,IAAM,mBAAN,MAA+C;CAC7C,OAAgB;CAChB;CACA;CACA;CAEA,YAAY,MAIT;EACD,KAAK,OAAO,KAAK;EACjB,KAAK,UAAU,KAAK;EACpB,KAAK,OAAO,KAAK;EACjB,OAAO,OAAO,IAAI;CACpB;CAEA,IAAI,SAA8B;EAChC,OAAO,UACL,OAAO,OAAO,KAAK,QAAQ,YAAY,CAAC,CAAC,CAC3C;CACF;CAEA,IAAI,QAA4B;EAC9B,OAAO,UACL,OAAO,OAAO,KAAK,QAAQ,WAAW,CAAC,CAAC,CAC1C;CACF;CAEA,IAAI,iBAA8C;EAChD,OAAO,UAGL,OAAO,OAAO,KAAK,QAAQ,oBAAoB,CAAC,CAAC,CAAC;CACtD;AACF;;AAGA,SAAgB,iBAAiB,MAKhB;CACf,OAAO,IAAI,iBAAiB,IAAI;AAClC;;;;;;AAOA,SAAgB,wBACd,QACA,OACA,gBACA,iBACuE;CACvE,MAAM,YAAyE,CAAC;CAEhF,IAAI,OAAO,SAAS,GAAG;EACrB,MAAM,MAAgC,CAAC;EACvC,KAAK,MAAM,KAAK,QACd,IAAI,EAAE,QAAQ;EAEhB,UAAU,WAAW,OAAO,OAAO,GAAG;CACxC;CAEA,IAAI,MAAM,SAAS,GAAG;EACpB,MAAM,MAA+B,CAAC;EACtC,KAAK,MAAM,KAAK,OACd,IAAI,EAAE,QAAQ;EAEhB,UAAU,UAAU,OAAO,OAAO,GAAG;CACvC;CAEA,IAAI,eAAe,SAAS,GAAG;EAC7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AS,kBAAkB,GAAG;EAC7E,MAAM,aACJ,MAAM,UAAU,mBAAmB,uBAAuB;EAC5D,YAAY,KAAK;GACf,MAAM;GACN,SAAS,cAAc,IAAI,QAAQ,WAAW,QAAQ,WAAW,KAAK,KAAK,eAAe,WAAW,cAAc,MAAM,QAAQ,wDAAwD,WAAW;GACpM;GACA;EACF,CAAC;CACH;AACF;;;;;;AAOA,SAAS,0BACP,MACA,SACA,YACS;CACT,KAAK,MAAM,MAAM,YAAY;EAC3B,MAAM,UAAU,GAAG,QAAQ;EAC3B,IAAI,YAAY,KAAA,KAAa,OAAO,OAAO,SAAS,IAAI,GAAG,OAAO;CACpE;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"psl-ast.mjs","names":[],"sources":["../src/control/psl-ast.ts","../src/control/psl-extension-block-validator.ts"],"sourcesContent":["export type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nexport type {\n PslBlockParam,\n PslBlockParamList,\n PslBlockParamOption,\n PslBlockParamRef,\n PslBlockParamValue,\n PslDiagnosticCode,\n PslExtensionBlock,\n PslExtensionBlockAttribute,\n PslExtensionBlockAttributeArg,\n PslExtensionBlockParamBare,\n PslExtensionBlockParamList,\n PslExtensionBlockParamOption,\n PslExtensionBlockParamRef,\n PslExtensionBlockParamScalarValue,\n PslExtensionBlockParamValue,\n PslPosition,\n PslSpan,\n} from '../shared/psl-extension-block';\n\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptorNamespace } from '../shared/framework-authoring';\nimport type { PslDiagnosticCode, PslExtensionBlock, PslSpan } from '../shared/psl-extension-block';\n\nexport interface PslDiagnostic {\n readonly code: PslDiagnosticCode;\n readonly message: string;\n readonly sourceId: string;\n readonly span: PslSpan;\n}\n\nexport interface PslDefaultFunctionValue {\n readonly kind: 'function';\n readonly name: 'autoincrement' | 'now';\n}\n\nexport interface PslDefaultLiteralValue {\n readonly kind: 'literal';\n readonly value: string | number | boolean;\n}\n\nexport type PslDefaultValue = PslDefaultFunctionValue | PslDefaultLiteralValue;\n\nexport type PslAttributeTarget = 'field' | 'model' | 'enum' | 'namedType';\n\nexport interface PslAttributePositionalArgument {\n readonly kind: 'positional';\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport interface PslAttributeNamedArgument {\n readonly kind: 'named';\n readonly name: string;\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport type PslAttributeArgument = PslAttributePositionalArgument | PslAttributeNamedArgument;\n\nexport interface PslTypeConstructorCall {\n readonly kind: 'typeConstructor';\n readonly path: readonly string[];\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport interface PslAttribute {\n readonly kind: 'attribute';\n readonly target: PslAttributeTarget;\n readonly name: string;\n readonly args: readonly PslAttributeArgument[];\n readonly span: PslSpan;\n}\n\nexport type PslReferentialAction = string;\n\nexport type PslFieldAttribute = PslAttribute;\n\nexport interface PslField {\n readonly kind: 'field';\n readonly name: string;\n /** Unqualified type name, e.g. `\"User\"` for both `User`, `auth.User`, and `supabase:auth.User`. */\n readonly typeName: string;\n /** Namespace qualifier from a dot-qualified type reference, e.g. `\"auth\"` for `auth.User` or `supabase:auth.User`. Absent for unqualified types. */\n readonly typeNamespaceId?: string;\n /**\n * Contract-space qualifier from a colon-prefix type reference, e.g. `\"supabase\"` for\n * `supabase:auth.User` or `supabase:User`. Absent for local (same-space) type references.\n *\n * When present, the field references a model from a different contract space. The namespace\n * (`typeNamespaceId`) and model name (`typeName`) identify the target within that space.\n * Physical table resolution against the extension contract is deferred to the aggregate stage (M3).\n */\n readonly typeContractSpaceId?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly optional: boolean;\n readonly list: boolean;\n readonly typeRef?: string;\n readonly attributes: readonly PslFieldAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslUniqueConstraint {\n readonly kind: 'unique';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport interface PslIndexConstraint {\n readonly kind: 'index';\n readonly fields: readonly string[];\n readonly span: PslSpan;\n}\n\nexport type PslModelAttribute = PslAttribute;\n\nexport interface PslModel {\n readonly kind: 'model';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslModelAttribute[];\n readonly span: PslSpan;\n /**\n * Optional leading comment line emitted above the `model` keyword by the\n * printer. Producers (e.g. `sqlSchemaIrToPslAst`) attach introspection\n * advisories such as \"// WARNING: This table has no primary key in the\n * database\" here. The parser leaves this field unset; round-tripping a\n * parsed schema does not re-attach comments.\n */\n readonly comment?: string;\n}\n\n/**\n * A reusable group of fields embedded in a model (a `type Name { … }` block) —\n * e.g. a MongoDB embedded document or a Postgres composite type. Unlike\n * {@link PslModel} it has no storage or identity of its own.\n */\nexport interface PslCompositeType {\n readonly kind: 'compositeType';\n readonly name: string;\n readonly fields: readonly PslField[];\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslNamedTypeDeclaration {\n readonly kind: 'namedType';\n readonly name: string;\n /**\n * Parser invariant: exactly one of `baseType` and `typeConstructor` is set.\n * Expressing this as a discriminated union trips TypeScript narrowing when\n * the declaration flows through helpers that accept the full union.\n */\n readonly baseType?: string;\n readonly typeConstructor?: PslTypeConstructorCall;\n readonly attributes: readonly PslAttribute[];\n readonly span: PslSpan;\n}\n\nexport interface PslTypesBlock {\n readonly kind: 'types';\n readonly declarations: readonly PslNamedTypeDeclaration[];\n readonly span: PslSpan;\n}\n\n/**\n * Name of the synthesised namespace bucket the framework parser uses for\n * top-level declarations that appear outside any `namespace { … }` block.\n * The double-underscore decoration signals that the identifier is parser-\n * synthesised and never appears in user-authored PSL source — writing\n * `namespace __unspecified__ { … }` is a parse error.\n *\n * Distinct from the IR sentinel `__unbound__`: the PSL bucket describes\n * syntactic absence at the parser layer; the IR sentinel describes a late-\n * bound storage slot at the IR layer. Per-target interpreters decide how\n * (or whether) to map the PSL bucket to the IR sentinel.\n */\nexport const UNSPECIFIED_PSL_NAMESPACE_ID = '__unspecified__';\n\n/** A value in {@link PslNamespace.entries}: a built-in entity node or an extension-contributed {@link PslExtensionBlock}. */\nexport type PslNamespaceEntry = PslModel | PslCompositeType | PslExtensionBlock;\n\n/**\n * A namespace block, or the parser's synthesised `__unspecified__` bucket for\n * declarations outside any `namespace { … }`. Same-name blocks reopen-merge;\n * `span` points at the first opening.\n *\n * Entities are stored canonically (ADR 224) in `entries[kind][name]`, where\n * `kind` is the PSL keyword for built-ins or the block discriminator for\n * extension kinds, e.g. `entries['policy_select']['ReadPosts']`.\n */\nexport interface PslNamespace {\n readonly kind: 'namespace';\n readonly name: string;\n /** Canonical store: a frozen container of frozen per-kind maps. The accessors below derive from it. */\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n /** Built-in models, from `entries['model']`. Extension kinds: {@link namespacePslExtensionBlocks}. */\n readonly models: readonly PslModel[];\n /** Built-in composite types, from `entries['compositeType']`. */\n readonly compositeTypes: readonly PslCompositeType[];\n readonly span: PslSpan;\n}\n\n/**\n * Stores `entries`; exposes `models`/`enums`/`compositeTypes` as getters over\n * it. The getters are prototype members (non-enumerable), so spreading or\n * `JSON.stringify`-ing a namespace copies only `entries`, never a duplicate view.\n */\nclass PslNamespaceNode implements PslNamespace {\n readonly kind = 'namespace' as const;\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n\n constructor(init: {\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n }) {\n this.name = init.name;\n this.entries = init.entries;\n this.span = init.span;\n Object.freeze(this);\n }\n\n get models(): readonly PslModel[] {\n return blindCast<readonly PslModel[], 'entries[model] holds only PslModel by construction'>(\n Object.values(this.entries['model'] ?? {}),\n );\n }\n\n get compositeTypes(): readonly PslCompositeType[] {\n return blindCast<\n readonly PslCompositeType[],\n 'entries[compositeType] holds only PslCompositeType by construction'\n >(Object.values(this.entries['compositeType'] ?? {}));\n }\n}\n\n/** Constructs a {@link PslNamespace}. Use this, never a namespace literal — the accessors must derive from `entries`. */\nexport function makePslNamespace(init: {\n readonly kind: 'namespace';\n readonly name: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>>;\n readonly span: PslSpan;\n}): PslNamespace {\n return new PslNamespaceNode(init);\n}\n\n/**\n * Builds the frozen `entries[kind][name]` container from per-kind arrays.\n * Built-ins key on their PSL keyword; extension blocks key on their `kind`\n * discriminator. Call this rather than hand-building the literal.\n */\nexport function makePslNamespaceEntries(\n models: readonly PslModel[],\n compositeTypes: readonly PslCompositeType[],\n extensionBlocks: readonly PslExtensionBlock[],\n): Readonly<Record<string, Readonly<Record<string, PslNamespaceEntry>>>> {\n const container: Record<string, Readonly<Record<string, PslNamespaceEntry>>> = {};\n\n if (models.length > 0) {\n const map: Record<string, PslModel> = {};\n for (const m of models) {\n map[m.name] = m;\n }\n container['model'] = Object.freeze(map);\n }\n\n if (compositeTypes.length > 0) {\n const map: Record<string, PslCompositeType> = {};\n for (const ct of compositeTypes) {\n map[ct.name] = ct;\n }\n container['compositeType'] = Object.freeze(map);\n }\n\n for (const block of extensionBlocks) {\n const existing = container[block.kind];\n const newMap: Record<string, PslExtensionBlock> = existing\n ? blindCast<Record<string, PslExtensionBlock>, 'kind map holds only PslExtensionBlock'>({\n ...existing,\n })\n : {};\n newMap[block.name] = block;\n container[block.kind] = Object.freeze(newMap);\n }\n\n return Object.freeze(container);\n}\n\nexport interface PslDocumentAst {\n readonly kind: 'document';\n readonly sourceId: string;\n readonly namespaces: readonly PslNamespace[];\n readonly types?: PslTypesBlock;\n readonly span: PslSpan;\n}\n\n/**\n * Returns all models from every namespace in document order. Convenience\n * for consumers that don't (yet) need namespace-awareness.\n */\nexport function flatPslModels(ast: PslDocumentAst): readonly PslModel[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<PslModel[], 'model kind map contains only PslModel by construction'>(\n Object.values(ns.entries['model'] ?? {}),\n ),\n );\n}\n\n/**\n * Returns all composite types from every namespace in document order.\n */\nexport function flatPslCompositeTypes(ast: PslDocumentAst): readonly PslCompositeType[] {\n return ast.namespaces.flatMap((ns) =>\n blindCast<\n PslCompositeType[],\n 'compositeType kind map contains only PslCompositeType by construction'\n >(Object.values(ns.entries['compositeType'] ?? {})),\n );\n}\n\n/**\n * The set of `entries` kind keys that the framework parser reserves for\n * built-in PSL entity kinds. Any own-enumerable key on `PslNamespace.entries`\n * that is **not** in this set was contributed by an extension-block descriptor.\n *\n * Built-in keys match the PSL keyword used on each block type:\n * `'model'`, `'compositeType'`. The `'enum'` keyword is claimed by the\n * extension-block grammar via a registered descriptor, so `entries['enum']`\n * holds `PslExtensionBlock` nodes and is returned by `namespacePslExtensionBlocks`.\n */\nexport const BUILTIN_PSL_KIND_KEYS: ReadonlySet<string> = new Set(['model', 'compositeType']);\n\n/**\n * Returns all extension-contributed blocks in the given namespace, in\n * insertion order (the order the parser encountered them in the source).\n *\n * Reads from `namespace.entries`, skipping the built-in kind keys\n * (`'model'`, `'compositeType'`). All remaining kind maps contain\n * only `PslExtensionBlock` nodes by construction (see `makePslNamespaceEntries`).\n */\nexport function namespacePslExtensionBlocks(ns: PslNamespace): readonly PslExtensionBlock[] {\n const result: PslExtensionBlock[] = [];\n for (const [kindKey, kindMap] of Object.entries(ns.entries)) {\n if (BUILTIN_PSL_KIND_KEYS.has(kindKey)) continue;\n for (const entry of Object.values(kindMap)) {\n result.push(\n blindCast<\n PslExtensionBlock,\n 'non-builtin kind maps contain only PslExtensionBlock by construction'\n >(entry),\n );\n }\n }\n return result;\n}\n\nexport interface ParsePslDocumentInput {\n readonly schema: string;\n readonly sourceId: string;\n /**\n * Registry of declarative block descriptors, keyed by arbitrary path\n * segments with {@link AuthoringPslBlockDescriptor} leaves. The registry\n * teaches the parser which top-level keywords belong to extension\n * contributions: when the parser encounters an unknown keyword, it looks\n * it up here and, when found, reads the block generically into a\n * {@link PslExtensionBlock} node. Absent or undefined means no extension\n * blocks are registered and any unknown keyword yields\n * `PSL_UNSUPPORTED_TOP_LEVEL_BLOCK`.\n *\n * Contrast with the parsed block nodes themselves, which live in\n * {@link PslNamespace.entries} under their discriminator key (read them with\n * {@link namespacePslExtensionBlocks}); this field holds the registry of\n * descriptors that teach the parser how to read those blocks.\n */\n readonly pslBlockDescriptors?: AuthoringPslBlockDescriptorNamespace;\n /**\n * Codec lookup for validating `value`-kind extension block parameters.\n * When provided alongside `pslBlockDescriptors`, the generic validator runs\n * over every parsed extension block after the full AST is assembled,\n * appending any diagnostics to the parse result. Absent or undefined means\n * no codec validation runs; `ref` resolution still runs when namespace\n * context is available (built from the assembled namespaces).\n */\n readonly codecLookup?: CodecLookup;\n}\n\nexport interface ParsePslDocumentResult {\n readonly ast: PslDocumentAst;\n readonly diagnostics: readonly PslDiagnostic[];\n readonly ok: boolean;\n}\n","/**\n * Generic validator for extension-contributed top-level PSL blocks.\n *\n * One function — {@link validateExtensionBlock} — takes a parsed\n * {@link PslExtensionBlock}, its {@link AuthoringPslBlockDescriptor}, a\n * {@link CodecLookup} (for `value` parameters), and the set of\n * {@link PslNamespace} objects from the document (for `ref` resolution), and\n * returns the full list of {@link PslDiagnostic} objects for the block.\n *\n * Detection logic per failure mode:\n *\n * 1. **Unknown parameter** — keys present in `node.parameters` that are absent\n * from `descriptor.parameters` (key-set difference). The parser stores\n * unknown parameters as `kind:'value'` stubs; the validator discovers them\n * by comparing the key sets, not by inspecting the captured kind.\n *\n * 2. **Missing required parameter** — `descriptor.parameters` entries with\n * `required: true` whose key is absent from `node.parameters`.\n *\n * 3. **`option` value outside its set** — the captured `token` is not in\n * `descriptor.values`.\n *\n * 4. **`value` rejected by its codec** — the raw string is first parsed as\n * JSON (`JSON.parse(raw)`). If `JSON.parse` throws, the literal is not valid\n * JSON and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is emitted. If parsing\n * succeeds but `codec.decodeJson(jsonValue)` throws, the JSON value is not\n * acceptable to the codec and a `PSL_EXTENSION_INVALID_VALUE` diagnostic is\n * emitted. If `codecLookup.get(codecId)` returns `undefined` (unknown codec\n * id), a `PSL_EXTENSION_INVALID_VALUE` diagnostic is also emitted.\n *\n * 5. **`ref` that does not resolve within its scope** — the captured\n * `identifier` is looked up in the PSL document's `PslNamespace` objects\n * according to `param.scope`:\n * - `same-namespace`: the referent must be in the same namespace as the\n * block (the namespace containing the block).\n * - `same-space`: the referent may be in any namespace in the document.\n * - `cross-space`: pass-through — enforcement is scoped to first-consumer\n * need (RLS roles). This case is documented and clearly flagged; the\n * caller is responsible for wiring cross-space resolution when needed.\n *\n * 6. **`list`** — each element is validated against `param.of` recursively.\n *\n * ### `char`/`varchar` length\n * Not enforced. RLS `using`/`check` strings are unbounded text and the codec\n * already rejects structurally invalid literals; length constraints are a\n * database-side concern, not a PSL authoring constraint.\n *\n * ### `cross-space` scope\n * Implemented as a documented pass-through. The spec permits scoping\n * cross-space enforcement to first-consumer need (RLS roles). When RLS roles\n * arrive, wire `cross-space` resolution through the cross-contract-space\n * coordinate model `(spaceId, namespaceId, entityKind, entityName)`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport type { CodecLookup } from '../shared/codec-types';\nimport type { AuthoringPslBlockDescriptor } from '../shared/framework-authoring';\nimport type {\n PslBlockParam,\n PslBlockParamRef,\n PslExtensionBlock,\n PslExtensionBlockParamValue,\n PslSpan,\n} from '../shared/psl-extension-block';\nimport type { PslDiagnostic, PslNamespace } from './psl-ast';\n\n/**\n * Context for ref resolution during extension-block validation.\n *\n * - `ownerNamespace` is the `PslNamespace` that contains the block being\n * validated. Used for `same-namespace` scope checks.\n * - `allNamespaces` is every namespace in the document. Used for `same-space`\n * scope checks.\n */\nexport interface ExtensionBlockRefResolutionContext {\n readonly ownerNamespace: PslNamespace;\n readonly allNamespaces: readonly PslNamespace[];\n}\n\n/**\n * Validate a single parsed extension block against its descriptor.\n *\n * Returns an array of {@link PslDiagnostic} objects (possibly empty). The\n * caller is responsible for threading `sourceId` into each returned diagnostic\n * — the returned objects already have `sourceId` set from the `sourceId`\n * parameter.\n *\n * @param node - The parsed block node produced by the generic framework parser.\n * @param descriptor - The descriptor that claims this block's keyword.\n * @param sourceId - The PSL source file identifier (threaded into diagnostics).\n * @param codecLookup - Used to validate `value`-kind parameter literals via\n * `codecLookup.get(codecId)?.decodeJson(JSON.parse(raw))`.\n * @param refCtx - Namespace context for `ref`-kind scope resolution. Required\n * when any descriptor parameter is `kind: 'ref'`; may be omitted if none are.\n */\nexport function validateExtensionBlock(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx?: ExtensionBlockRefResolutionContext,\n): readonly PslDiagnostic[] {\n const diagnostics: PslDiagnostic[] = [];\n\n const descriptorKeys = new Set(Object.keys(descriptor.parameters));\n const nodeKeys = new Set(Object.keys(node.parameters));\n\n // 1. Unknown parameters — keys in the node not in the descriptor.\n if (!descriptor.variadicParameters) {\n for (const key of nodeKeys) {\n if (!descriptorKeys.has(key)) {\n const captured = node.parameters[key];\n diagnostics.push({\n code: 'PSL_EXTENSION_UNKNOWN_PARAMETER',\n message: `Unknown parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\". The descriptor does not declare this parameter.`,\n sourceId,\n span: captured?.span ?? node.span,\n });\n }\n }\n }\n\n // 2. Missing required parameters — required descriptor keys absent from the node.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n if (param.required === true && !nodeKeys.has(key)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_MISSING_REQUIRED_PARAMETER',\n message: `Required parameter \"${key}\" is missing from \"${descriptor.keyword}\" block \"${node.name}\".`,\n sourceId,\n span: node.span,\n });\n }\n }\n\n // 3–5. Per-parameter validation for parameters that are present.\n for (const [key, param] of Object.entries(descriptor.parameters)) {\n const captured = node.parameters[key];\n if (captured === undefined) {\n continue;\n }\n validateParam(\n node,\n descriptor,\n key,\n param,\n captured,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n\n return diagnostics;\n}\n\nfunction validateParam(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParam,\n captured: PslExtensionBlockParamValue,\n sourceId: string,\n codecLookup: CodecLookup,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n switch (param.kind) {\n case 'option': {\n if (captured.kind !== 'option') {\n return;\n }\n if (!param.values.includes(captured.token)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_OPTION_OUT_OF_SET',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" has value \"${captured.token}\" which is not one of the allowed values: ${param.values.map((v) => `\"${v}\"`).join(', ')}.`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'value': {\n if (captured.kind !== 'value') {\n return;\n }\n const codec = codecLookup.get(param.codecId);\n if (codec === undefined) {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" references unknown codec \"${param.codecId}\".`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n let jsonValue: unknown;\n try {\n jsonValue = JSON.parse(captured.raw);\n } catch {\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" is not a valid JSON literal (expected a JSON string, number, boolean, or null): ${captured.raw}`,\n sourceId,\n span: captured.span,\n });\n return;\n }\n try {\n codec.decodeJson(\n blindCast<JsonValue, 'JSON.parse returns a JsonValue-compatible value'>(jsonValue),\n );\n } catch (err) {\n const reason = err instanceof Error ? err.message : String(err);\n diagnostics.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" was rejected by codec \"${param.codecId}\": ${reason}`,\n sourceId,\n span: captured.span,\n });\n }\n return;\n }\n\n case 'ref': {\n if (captured.kind !== 'ref') {\n return;\n }\n validateRef(\n node,\n descriptor,\n key,\n param,\n captured.identifier,\n captured.span,\n sourceId,\n refCtx,\n diagnostics,\n );\n return;\n }\n\n case 'list': {\n if (captured.kind !== 'list') {\n return;\n }\n for (const item of captured.items) {\n validateParam(\n node,\n descriptor,\n key,\n param.of,\n item,\n sourceId,\n codecLookup,\n refCtx,\n diagnostics,\n );\n }\n return;\n }\n }\n}\n\nfunction validateRef(\n node: PslExtensionBlock,\n descriptor: AuthoringPslBlockDescriptor,\n key: string,\n param: PslBlockParamRef,\n identifier: string,\n span: PslSpan,\n sourceId: string,\n refCtx: ExtensionBlockRefResolutionContext | undefined,\n diagnostics: PslDiagnostic[],\n): void {\n if (param.scope === 'cross-space') {\n // cross-space enforcement is a documented pass-through. The spec permits\n // scoping cross-space resolution to first-consumer need (RLS roles). When\n // that consumer arrives, wire resolution here through the\n // cross-contract-space coordinate model\n // (spaceId, namespaceId, entityKind, entityName).\n // For now, cross-space refs pass validation unconditionally.\n return;\n }\n\n if (refCtx === undefined) {\n // If no resolution context was provided, skip ref resolution. This matches\n // the closed-grammar invariant: callers that register ref parameters must\n // provide resolution context; callers without namespaces (e.g. unit tests\n // that only exercise other validation modes) can omit it.\n return;\n }\n\n const namespacesToSearch: readonly PslNamespace[] =\n param.scope === 'same-namespace' ? [refCtx.ownerNamespace] : refCtx.allNamespaces;\n\n if (!resolveEntityInNamespaces(identifier, param.refKind, namespacesToSearch)) {\n const scopeLabel =\n param.scope === 'same-namespace' ? 'the same namespace' : 'any namespace in the schema';\n diagnostics.push({\n code: 'PSL_EXTENSION_UNRESOLVED_REF',\n message: `Parameter \"${key}\" in \"${descriptor.keyword}\" block \"${node.name}\" refers to \"${identifier}\" (expected ${param.refKind}), but no entity with that name and kind was found in ${scopeLabel}.`,\n sourceId,\n span,\n });\n }\n}\n\n/**\n * True if an entity named `name` of kind `refKind` exists in any of the given\n * namespaces. Built-in and extension kinds resolve the same way, through\n * `entries[refKind]`.\n */\nfunction resolveEntityInNamespaces(\n name: string,\n refKind: string,\n namespaces: readonly PslNamespace[],\n): boolean {\n for (const ns of namespaces) {\n const kindMap = ns.entries[refKind];\n if (kindMap !== undefined && Object.hasOwn(kindMap, name)) return true;\n }\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;AAoLA,MAAa,+BAA+B;;;;;;AA+B5C,IAAM,mBAAN,MAA+C;CAC7C,OAAgB;CAChB;CACA;CACA;CAEA,YAAY,MAIT;EACD,KAAK,OAAO,KAAK;EACjB,KAAK,UAAU,KAAK;EACpB,KAAK,OAAO,KAAK;EACjB,OAAO,OAAO,IAAI;CACpB;CAEA,IAAI,SAA8B;EAChC,OAAO,UACL,OAAO,OAAO,KAAK,QAAQ,YAAY,CAAC,CAAC,CAC3C;CACF;CAEA,IAAI,iBAA8C;EAChD,OAAO,UAGL,OAAO,OAAO,KAAK,QAAQ,oBAAoB,CAAC,CAAC,CAAC;CACtD;AACF;;AAGA,SAAgB,iBAAiB,MAKhB;CACf,OAAO,IAAI,iBAAiB,IAAI;AAClC;;;;;;AAOA,SAAgB,wBACd,QACA,gBACA,iBACuE;CACvE,MAAM,YAAyE,CAAC;CAEhF,IAAI,OAAO,SAAS,GAAG;EACrB,MAAM,MAAgC,CAAC;EACvC,KAAK,MAAM,KAAK,QACd,IAAI,EAAE,QAAQ;EAEhB,UAAU,WAAW,OAAO,OAAO,GAAG;CACxC;CAEA,IAAI,eAAe,SAAS,GAAG;EAC7B,MAAM,MAAwC,CAAC;EAC/C,KAAK,MAAM,MAAM,gBACf,IAAI,GAAG,QAAQ;EAEjB,UAAU,mBAAmB,OAAO,OAAO,GAAG;CAChD;CAEA,KAAK,MAAM,SAAS,iBAAiB;EACnC,MAAM,WAAW,UAAU,MAAM;EACjC,MAAM,SAA4C,WAC9C,UAAsF,EACpF,GAAG,SACL,CAAC,IACD,CAAC;EACL,OAAO,M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,OAAO,SAAS,IAAI,GAAG,OAAO;CACpE;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as runtimeError } from "./runtime-error-B2gWOtgH.mjs";
|
|
2
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
3
|
+
//#region src/shared/resolve-codec.ts
|
|
4
|
+
const CONTRACT_CODEC_DESCRIPTOR_MISSING = "CONTRACT.CODEC_DESCRIPTOR_MISSING";
|
|
5
|
+
/**
|
|
6
|
+
* Look up a descriptor for `ref.codecId` using `descriptorFor`; throw
|
|
7
|
+
* `code` if none is found. Each plane names its own error path: the control
|
|
8
|
+
* plane resolves contract-stack descriptors (`CONTRACT.*`), the execution
|
|
9
|
+
* plane resolves at query time (`RUNTIME.*`).
|
|
10
|
+
*/
|
|
11
|
+
function resolveCodecDescriptorOrThrow(descriptorFor, ref, code) {
|
|
12
|
+
const descriptor = descriptorFor(ref.codecId);
|
|
13
|
+
if (!descriptor) throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, { codecId: ref.codecId });
|
|
14
|
+
return descriptor;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates `ref.typeParams` against `descriptor.paramsSchema`.
|
|
18
|
+
*
|
|
19
|
+
* Parameterized codecs that omit `typeParams` have it normalized to `{}` before
|
|
20
|
+
* validation (mirrors `ast-codec-resolver.ts` semantics). Throws
|
|
21
|
+
* `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or
|
|
22
|
+
* reports issues.
|
|
23
|
+
*/
|
|
24
|
+
function validateCodecTypeParams(descriptor, ref) {
|
|
25
|
+
const normalized = descriptor.isParameterized && ref.typeParams === void 0 ? {
|
|
26
|
+
...ref,
|
|
27
|
+
typeParams: {}
|
|
28
|
+
} : ref;
|
|
29
|
+
const result = blindCast(descriptor.paramsSchema["~standard"].validate(normalized.typeParams));
|
|
30
|
+
if (result instanceof Promise) throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`, {
|
|
31
|
+
codecId: ref.codecId,
|
|
32
|
+
typeParams: ref.typeParams
|
|
33
|
+
});
|
|
34
|
+
if ("issues" in result && result.issues) {
|
|
35
|
+
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
36
|
+
throw runtimeError("RUNTIME.TYPE_PARAMS_INVALID", `Invalid typeParams for codec '${ref.codecId}': ${messages}`, {
|
|
37
|
+
codecId: ref.codecId,
|
|
38
|
+
typeParams: ref.typeParams
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return blindCast(result).value;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolves a `Codec` instance: validates `ref.typeParams` via
|
|
45
|
+
* {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`.
|
|
46
|
+
*
|
|
47
|
+
* The descriptor's `factory` is typed against its own `P`; the registry erases
|
|
48
|
+
* `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`
|
|
49
|
+
* at the call boundary. The `paramsSchema` validates the input above before we
|
|
50
|
+
* forward it, so the narrowing is safe by construction.
|
|
51
|
+
*/
|
|
52
|
+
function materializeCodec(descriptor, ref, ctx) {
|
|
53
|
+
const validated = validateCodecTypeParams(descriptor, ref);
|
|
54
|
+
return blindCast(descriptor.factory)(validated)(ctx);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { validateCodecTypeParams as i, materializeCodec as n, resolveCodecDescriptorOrThrow as r, CONTRACT_CODEC_DESCRIPTOR_MISSING as t };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=resolve-codec-D8EPZosv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-codec-D8EPZosv.mjs","names":[],"sources":["../src/shared/resolve-codec.ts"],"sourcesContent":["import { blindCast } from '@prisma-next/utils/casts';\nimport type { Codec } from './codec';\nimport type { AnyCodecDescriptor } from './codec-descriptor';\nimport type { CodecInstanceContext, CodecRef } from './codec-types';\nimport { runtimeError } from './runtime-error';\n\nexport const CONTRACT_CODEC_DESCRIPTOR_MISSING = 'CONTRACT.CODEC_DESCRIPTOR_MISSING' as const;\n\n/**\n * Look up a descriptor for `ref.codecId` using `descriptorFor`; throw\n * `code` if none is found. Each plane names its own error path: the control\n * plane resolves contract-stack descriptors (`CONTRACT.*`), the execution\n * plane resolves at query time (`RUNTIME.*`).\n */\nexport function resolveCodecDescriptorOrThrow(\n descriptorFor: (codecId: string) => AnyCodecDescriptor | undefined,\n ref: CodecRef,\n code: 'CONTRACT.CODEC_DESCRIPTOR_MISSING' | 'RUNTIME.CODEC_DESCRIPTOR_MISSING',\n): AnyCodecDescriptor {\n const descriptor = descriptorFor(ref.codecId);\n if (!descriptor) {\n throw runtimeError(code, `No codec descriptor registered for codecId '${ref.codecId}'.`, {\n codecId: ref.codecId,\n });\n }\n return descriptor;\n}\n\n/**\n * Validates `ref.typeParams` against `descriptor.paramsSchema`.\n *\n * Parameterized codecs that omit `typeParams` have it normalized to `{}` before\n * validation (mirrors `ast-codec-resolver.ts` semantics). Throws\n * `RUNTIME.TYPE_PARAMS_INVALID` when the validator returns a `Promise` or\n * reports issues.\n */\nexport function validateCodecTypeParams(descriptor: AnyCodecDescriptor, ref: CodecRef): unknown {\n const normalized =\n descriptor.isParameterized && ref.typeParams === undefined ? { ...ref, typeParams: {} } : ref;\n\n const result = blindCast<\n { value: unknown } | { issues: ReadonlyArray<{ message: string }> } | Promise<unknown>,\n 'Standard Schema validate returns unknown; the spec guarantees this union shape'\n >(descriptor.paramsSchema['~standard'].validate(normalized.typeParams));\n\n if (result instanceof Promise) {\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `paramsSchema for codec '${ref.codecId}' returned a Promise; runtime validation requires a synchronous Standard Schema validator.`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n if ('issues' in result && result.issues) {\n const messages = result.issues.map((issue) => issue.message).join('; ');\n throw runtimeError(\n 'RUNTIME.TYPE_PARAMS_INVALID',\n `Invalid typeParams for codec '${ref.codecId}': ${messages}`,\n { codecId: ref.codecId, typeParams: ref.typeParams },\n );\n }\n\n return blindCast<{ value: unknown }, 'issues guard above rules out the issues branch'>(result)\n .value;\n}\n\n/**\n * Resolves a `Codec` instance: validates `ref.typeParams` via\n * {@link validateCodecTypeParams} then calls `descriptor.factory(validated)(ctx)`.\n *\n * The descriptor's `factory` is typed against its own `P`; the registry erases\n * `P` to `any`, so the factory is narrowed to `(params: unknown) => (ctx) => Codec`\n * at the call boundary. The `paramsSchema` validates the input above before we\n * forward it, so the narrowing is safe by construction.\n */\nexport function materializeCodec(\n descriptor: AnyCodecDescriptor,\n ref: CodecRef,\n ctx: CodecInstanceContext,\n): Codec {\n const validated = validateCodecTypeParams(descriptor, ref);\n return blindCast<\n (params: unknown) => (ctx: CodecInstanceContext) => Codec,\n 'registry erases P to any; paramsSchema validates input before forwarding'\n >(descriptor.factory)(validated)(ctx);\n}\n"],"mappings":";;;AAMA,MAAa,oCAAoC;;;;;;;AAQjD,SAAgB,8BACd,eACA,KACA,MACoB;CACpB,MAAM,aAAa,cAAc,IAAI,OAAO;CAC5C,IAAI,CAAC,YACH,MAAM,aAAa,MAAM,+CAA+C,IAAI,QAAQ,KAAK,EACvF,SAAS,IAAI,QACf,CAAC;CAEH,OAAO;AACT;;;;;;;;;AAUA,SAAgB,wBAAwB,YAAgC,KAAwB;CAC9F,MAAM,aACJ,WAAW,mBAAmB,IAAI,eAAe,KAAA,IAAY;EAAE,GAAG;EAAK,YAAY,CAAC;CAAE,IAAI;CAE5F,MAAM,SAAS,UAGb,WAAW,aAAa,YAAY,CAAC,SAAS,WAAW,UAAU,CAAC;CAEtE,IAAI,kBAAkB,SACpB,MAAM,aACJ,+BACA,2BAA2B,IAAI,QAAQ,6FACvC;EAAE,SAAS,IAAI;EAAS,YAAY,IAAI;CAAW,CACrD;CAGF,IAAI,YAAY,UAAU,OAAO,QAAQ;EACvC,MAAM,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,OAAO,CAAC,CAAC,KAAK,IAAI;EACtE,MAAM,aACJ,+BACA,iCAAiC,IAAI,QAAQ,KAAK,YAClD;GAAE,SAAS,IAAI;GAAS,YAAY,IAAI;EAAW,CACrD;CACF;CAEA,OAAO,UAAgF,MAAM,CAAC,CAC3F;AACL;;;;;;;;;;AAWA,SAAgB,iBACd,YACA,KACA,KACO;CACP,MAAM,YAAY,wBAAwB,YAAY,GAAG;CACzD,OAAO,UAGL,WAAW,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG;AACtC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/shared/runtime-error.ts
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for the runtime-error envelope produced by `runtimeError`.
|
|
4
|
+
*
|
|
5
|
+
* Prefer this over duck-typing on `error.code` directly so consumers stay
|
|
6
|
+
* insulated from the envelope's internal shape.
|
|
7
|
+
*/
|
|
8
|
+
function isRuntimeError(error) {
|
|
9
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" && "category" in error && "severity" in error;
|
|
10
|
+
}
|
|
11
|
+
function runtimeError(code, message, details) {
|
|
12
|
+
const error = Object.assign(new Error(message), {
|
|
13
|
+
code,
|
|
14
|
+
category: resolveCategory(code),
|
|
15
|
+
severity: "error",
|
|
16
|
+
...details !== void 0 ? { details } : {}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(error, "name", {
|
|
19
|
+
value: "RuntimeError",
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
return error;
|
|
23
|
+
}
|
|
24
|
+
function resolveCategory(code) {
|
|
25
|
+
const prefix = code.split(".")[0] ?? "RUNTIME";
|
|
26
|
+
switch (prefix) {
|
|
27
|
+
case "PLAN":
|
|
28
|
+
case "CONTRACT":
|
|
29
|
+
case "LINT":
|
|
30
|
+
case "BUDGET": return prefix;
|
|
31
|
+
default: return "RUNTIME";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { runtimeError as n, isRuntimeError as t };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=runtime-error-B2gWOtgH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-error-B2gWOtgH.mjs","names":[],"sources":["../src/shared/runtime-error.ts"],"sourcesContent":["export interface RuntimeErrorEnvelope extends Error {\n readonly code: string;\n readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';\n readonly severity: 'error';\n readonly details?: Record<string, unknown>;\n}\n\n/**\n * Type guard for the runtime-error envelope produced by `runtimeError`.\n *\n * Prefer this over duck-typing on `error.code` directly so consumers stay\n * insulated from the envelope's internal shape.\n */\nexport function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope {\n return (\n error instanceof Error &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string' &&\n 'category' in error &&\n 'severity' in error\n );\n}\n\nexport function runtimeError(\n code: string,\n message: string,\n details?: Record<string, unknown>,\n): RuntimeErrorEnvelope {\n const error = Object.assign(new Error(message), {\n code,\n category: resolveCategory(code),\n severity: 'error' as const,\n ...(details !== undefined ? { details } : {}),\n });\n Object.defineProperty(error, 'name', { value: 'RuntimeError', configurable: true });\n return error;\n}\n\nfunction resolveCategory(code: string): RuntimeErrorEnvelope['category'] {\n const prefix = code.split('.')[0] ?? 'RUNTIME';\n switch (prefix) {\n case 'PLAN':\n case 'CONTRACT':\n case 'LINT':\n case 'BUDGET':\n return prefix;\n default:\n return 'RUNTIME';\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,eAAe,OAA+C;CAC5E,OACE,iBAAiB,SACjB,UAAU,SACV,OAAQ,MAA6B,SAAS,YAC9C,cAAc,SACd,cAAc;AAElB;AAEA,SAAgB,aACd,MACA,SACA,SACsB;CACtB,MAAM,QAAQ,OAAO,OAAO,IAAI,MAAM,OAAO,GAAG;EAC9C;EACA,UAAU,gBAAgB,IAAI;EAC9B,UAAU;EACV,GAAI,YAAY,KAAA,IAAY,EAAE,QAAQ,IAAI,CAAC;CAC7C,CAAC;CACD,OAAO,eAAe,OAAO,QAAQ;EAAE,OAAO;EAAgB,cAAc;CAAK,CAAC;CAClF,OAAO;AACT;AAEA,SAAS,gBAAgB,MAAgD;CACvE,MAAM,SAAS,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM;CACrC,QAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as CodecCallContext } from "./codec-types-yY3eSmi0.mjs";
|
|
2
2
|
import { PlanMeta } from "@prisma-next/contract/types";
|
|
3
3
|
|
|
4
4
|
//#region src/annotations.d.ts
|
|
@@ -617,13 +617,23 @@ declare function checkMiddlewareCompatibility(middleware: RuntimeMiddleware, run
|
|
|
617
617
|
*/
|
|
618
618
|
declare function runBeforeExecuteChain<TExec extends ExecutionPlan, TMutator extends ParamRefMutator = ParamRefMutator>(plan: TExec, middleware: ReadonlyArray<RuntimeMiddleware<TExec, TMutator>>, ctx: RuntimeMiddlewareContext, paramsMutator?: TMutator): Promise<void>;
|
|
619
619
|
//#endregion
|
|
620
|
-
//#region src/
|
|
620
|
+
//#region src/shared/runtime-error.d.ts
|
|
621
621
|
interface RuntimeErrorEnvelope extends Error {
|
|
622
622
|
readonly code: string;
|
|
623
623
|
readonly category: 'PLAN' | 'CONTRACT' | 'LINT' | 'BUDGET' | 'RUNTIME';
|
|
624
624
|
readonly severity: 'error';
|
|
625
625
|
readonly details?: Record<string, unknown>;
|
|
626
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Type guard for the runtime-error envelope produced by `runtimeError`.
|
|
629
|
+
*
|
|
630
|
+
* Prefer this over duck-typing on `error.code` directly so consumers stay
|
|
631
|
+
* insulated from the envelope's internal shape.
|
|
632
|
+
*/
|
|
633
|
+
declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope;
|
|
634
|
+
declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/execution/runtime-error.d.ts
|
|
627
637
|
/**
|
|
628
638
|
* Stable code emitted by the runtime when an in-flight `execute()`
|
|
629
639
|
* is cancelled via the per-query `AbortSignal`. The envelope's
|
|
@@ -641,14 +651,6 @@ interface RuntimeErrorEnvelope extends Error {
|
|
|
641
651
|
declare const RUNTIME_ABORTED: "RUNTIME.ABORTED";
|
|
642
652
|
/** Discriminator placed in `details.phase` of a `RUNTIME.ABORTED` envelope. */
|
|
643
653
|
type RuntimeAbortedPhase = 'encode' | 'decode' | 'stream' | 'beforeExecute' | 'afterExecute' | 'onRow';
|
|
644
|
-
/**
|
|
645
|
-
* Type guard for the runtime-error envelope produced by `runtimeError`.
|
|
646
|
-
*
|
|
647
|
-
* Prefer this over duck-typing on `error.code` directly so consumers stay
|
|
648
|
-
* insulated from the envelope's internal shape.
|
|
649
|
-
*/
|
|
650
|
-
declare function isRuntimeError(error: unknown): error is RuntimeErrorEnvelope;
|
|
651
|
-
declare function runtimeError(code: string, message: string, details?: Record<string, unknown>): RuntimeErrorEnvelope;
|
|
652
654
|
/**
|
|
653
655
|
* Construct a `RUNTIME.ABORTED` envelope. Phase distinguishes where the
|
|
654
656
|
* abort was observed — codec call sites (`encode` / `decode` / `stream`)
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/annotations.ts","../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-middleware.ts","../src/execution/before-execute-chain.ts","../src/execution/runtime-error.ts","../src/execution/race-against-abort.ts","../src/execution/run-with-middleware.ts","../src/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N,MAAA,GAAS,WAAW;EAAA,SACpB,KAAA;AAAA;;;;;;;AD/NJ;;UC0OU,eAAA,eAA8B,SAAA;EAC7C,OAAA,MACE,IAAA,EAAM,KAAA;IAAA,SAAmB,IAAA,GAAO,GAAA;EAAA,GAChC,OAAA,GAAU,qBAAA,GACT,mBAAA,CAAoB,GAAA;EACvB,KAAA,IAAS,OAAA;AAAA;AAAA,iBAGK,4BAAA,CACd,UAAA,EAAY,iBAAiB,EAC7B,eAAA,UACA,eAAA;;;;;AHpRF;;;;AAAyB;AAazB;;;;;;;;;;;;;;;;;;;;AAI0C;AA4C1C;;;;;;;;;;;;;;;;;;;;;iBIvBsB,qBAAA,eACN,aAAA,mBACG,eAAA,GAAkB,eAAA,EAEnC,IAAA,EAAM,KAAA,EACN,UAAA,EAAY,aAAA,CAAc,iBAAA,CAAkB,KAAA,EAAO,QAAA,IACnD,GAAA,EAAK,wBAAA,EACL,aAAA,GAAgB,QAAA,GACf,OAAA;;;UCjEc,oBAAA,SAA6B,KAAK;EAAA,SACxC,IAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA,GAAU,MAAA;AAAA;;;ALeI;AAazB
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/annotations.ts","../src/execution/async-iterable-result.ts","../src/execution/query-plan.ts","../src/execution/runtime-middleware.ts","../src/execution/before-execute-chain.ts","../src/shared/runtime-error.ts","../src/execution/runtime-error.ts","../src/execution/race-against-abort.ts","../src/execution/run-with-middleware.ts","../src/execution/runtime-core.ts","../src/meta-builder.ts"],"mappings":";;;;;;;;AAmBA;;;;AAAyB;AAazB;;;;;;;;KAbY,aAAA;;;;;;;;;;;;UAaK,eAAA,wBAAuC,aAAA;EAAA,SAC7C,YAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA,EAAO,OAAA;EAAA,SACP,YAAA,EAAc,WAAA,CAAY,KAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDxB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