@prisma/orm-framework 8.0.0-rc.18-dev.41 → 8.0.0-rc.18-dev.43

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.
Files changed (102) hide show
  1. package/dist/{authoring-BKO7sRLw.d.mts → authoring-C8sYYHu7.d.mts} +3 -3
  2. package/dist/{authoring-BKO7sRLw.d.mts.map → authoring-C8sYYHu7.d.mts.map} +1 -1
  3. package/dist/{authoring-so3aBYD8.mjs → authoring-qO6idK5H.mjs} +24 -3
  4. package/dist/authoring-qO6idK5H.mjs.map +1 -0
  5. package/dist/{binder-WS9-1Mu9-MJi8x3Gm.d.mts → binder-63ozT0D8-BixamO0l.d.mts} +12 -10
  6. package/dist/binder-63ozT0D8-BixamO0l.d.mts.map +1 -0
  7. package/dist/{components-D-8GZwNo.d.mts → components-B3SnaxMU.d.mts} +2 -2
  8. package/dist/{components-D-8GZwNo.d.mts.map → components-B3SnaxMU.d.mts.map} +1 -1
  9. package/dist/components.d.mts +10 -10
  10. package/dist/components.mjs +4 -4
  11. package/dist/components__authoring.d.mts +4 -4
  12. package/dist/components__authoring.mjs +3 -3
  13. package/dist/components__components.d.mts +2 -2
  14. package/dist/components__control.d.mts +3 -3
  15. package/dist/components__control.mjs +3 -3
  16. package/dist/components__execution.d.mts +1 -1
  17. package/dist/components__psl-ast.d.mts +3 -3
  18. package/dist/{config-types-CfdMN7t-.d.mts → config-types-0fY7fbd7.d.mts} +6 -6
  19. package/dist/{config-types-CfdMN7t-.d.mts.map → config-types-0fY7fbd7.d.mts.map} +1 -1
  20. package/dist/config.d.mts +1 -1
  21. package/dist/config__config-types.d.mts +1 -1
  22. package/dist/contract-authoring.d.mts +34 -14
  23. package/dist/contract-authoring.d.mts.map +1 -1
  24. package/dist/contract-authoring.mjs +3 -3
  25. package/dist/{control-B5ezUWD2-BgUEggvd.d.mts → control-B5ezUWD2-D6knyncN.d.mts} +2 -2
  26. package/dist/{control-B5ezUWD2-BgUEggvd.d.mts.map → control-B5ezUWD2-D6knyncN.d.mts.map} +1 -1
  27. package/dist/control-D2ZpYj6i.d.mts +1 -0
  28. package/dist/{control-7DsPHRLi.d.mts → control-D9rb0OBR.d.mts} +18 -48
  29. package/dist/{control-7DsPHRLi.d.mts.map → control-D9rb0OBR.d.mts.map} +1 -1
  30. package/dist/{control-AlBtrJUn.mjs → control-DPasGnOD.mjs} +23 -124
  31. package/dist/control-DPasGnOD.mjs.map +1 -0
  32. package/dist/{control-KsXr4fYD-DJm_48Db.mjs → control-KsXr4fYD-B23ri5vh.mjs} +2 -2
  33. package/dist/{control-KsXr4fYD-DJm_48Db.mjs.map → control-KsXr4fYD-B23ri5vh.mjs.map} +1 -1
  34. package/dist/declarations-BgUAq1RG-ShewcVdd.mjs +459 -0
  35. package/dist/declarations-BgUAq1RG-ShewcVdd.mjs.map +1 -0
  36. package/dist/errors.d.mts +4 -4
  37. package/dist/errors.mjs +3 -3
  38. package/dist/errors__control.d.mts +2 -2
  39. package/dist/errors__control.mjs +1 -1
  40. package/dist/errors__execution.d.mts +1 -1
  41. package/dist/errors__execution.mjs +1 -1
  42. package/dist/errors__migration.d.mts +1 -1
  43. package/dist/errors__migration.mjs +1 -1
  44. package/dist/{execution-BkcXd7Tn.d.mts → execution-C00_IFA7.d.mts} +3 -3
  45. package/dist/{execution-BkcXd7Tn.d.mts.map → execution-C00_IFA7.d.mts.map} +1 -1
  46. package/dist/{execution-KLhn9sSn.mjs → execution-C_4ICly-.mjs} +2 -2
  47. package/dist/{execution-KLhn9sSn.mjs.map → execution-C_4ICly-.mjs.map} +1 -1
  48. package/dist/{execution-DXQQRCfR.d.mts → execution-CktUHYP0.d.mts} +2 -2
  49. package/dist/{execution-DXQQRCfR.d.mts.map → execution-CktUHYP0.d.mts.map} +1 -1
  50. package/dist/expressions-CMQzbnHk-fqYn-D3z.mjs +895 -0
  51. package/dist/expressions-CMQzbnHk-fqYn-D3z.mjs.map +1 -0
  52. package/dist/{framework-authoring-hZgq-M2K-Daz3kgWL.d.mts → framework-authoring-Du7xSUmg-D85Toszi.d.mts} +27 -10
  53. package/dist/framework-authoring-Du7xSUmg-D85Toszi.d.mts.map +1 -0
  54. package/dist/{framework-components-B-yaLbst-nZJUGMuf.d.mts → framework-components-DQFte83L-CIIcH8Bj.d.mts} +3 -3
  55. package/dist/{framework-components-B-yaLbst-nZJUGMuf.d.mts.map → framework-components-DQFte83L-CIIcH8Bj.d.mts.map} +1 -1
  56. package/dist/{migration-CZik9OxU.mjs → migration-Dy-tXHxh.mjs} +2 -2
  57. package/dist/{migration-CZik9OxU.mjs.map → migration-Dy-tXHxh.mjs.map} +1 -1
  58. package/dist/{migration-BVDJBmyi.d.mts → migration-K3Co0dba.d.mts} +2 -2
  59. package/dist/{migration-BVDJBmyi.d.mts.map → migration-K3Co0dba.d.mts.map} +1 -1
  60. package/dist/{parse-BxcaGLV1-BxEIfxh3.mjs → parse-bZgfjovA-Bd80h0ox.mjs} +4 -4
  61. package/dist/{parse-BxcaGLV1-BxEIfxh3.mjs.map → parse-bZgfjovA-Bd80h0ox.mjs.map} +1 -1
  62. package/dist/{parse-CJtBvEYy-BCae0181.d.mts → parse-djL5wker-DYTP4HGq.d.mts} +7 -7
  63. package/dist/{parse-CJtBvEYy-BCae0181.d.mts.map → parse-djL5wker-DYTP4HGq.d.mts.map} +1 -1
  64. package/dist/{psl-ast-BIJIW24G-B8ptjyuO.d.mts → psl-ast-B6X_rlhZ-DCrq7Zie.d.mts} +3 -3
  65. package/dist/{psl-ast-BIJIW24G-B8ptjyuO.d.mts.map → psl-ast-B6X_rlhZ-DCrq7Zie.d.mts.map} +1 -1
  66. package/dist/psl-ast-DlmFfwfZ.d.mts +2 -0
  67. package/dist/psl-parser.d.mts +22 -11
  68. package/dist/psl-parser.d.mts.map +1 -1
  69. package/dist/psl-parser.mjs +14 -110
  70. package/dist/psl-parser.mjs.map +1 -1
  71. package/dist/psl-parser__format.d.mts +1 -1
  72. package/dist/psl-parser__format.mjs +3 -3
  73. package/dist/psl-parser__format.mjs.map +1 -1
  74. package/dist/psl-parser__interpret.d.mts +16 -13
  75. package/dist/psl-parser__interpret.d.mts.map +1 -1
  76. package/dist/psl-parser__interpret.mjs +52 -48
  77. package/dist/psl-parser__interpret.mjs.map +1 -1
  78. package/dist/psl-parser__syntax.d.mts +1 -1
  79. package/dist/psl-parser__syntax.mjs +3 -3
  80. package/dist/psl-printer.d.mts +4 -4
  81. package/dist/psl-printer.mjs +1 -1
  82. package/dist/read-expression-as-Dhyvx51C-Bpn_1X05.mjs +239 -0
  83. package/dist/read-expression-as-Dhyvx51C-Bpn_1X05.mjs.map +1 -0
  84. package/dist/{temporal-presets-Cumws2z--DcYWooYJ.d.mts → temporal-presets-D_TQBbXU-DLIsE1k-.d.mts} +42 -4
  85. package/dist/temporal-presets-D_TQBbXU-DLIsE1k-.d.mts.map +1 -0
  86. package/dist/{temporal-presets-BcDyr_hK-CFplJNGz.mjs → temporal-presets-DmZDnaZV-aUZPt1LX.mjs} +189 -22
  87. package/dist/temporal-presets-DmZDnaZV-aUZPt1LX.mjs.map +1 -0
  88. package/package.json +15 -15
  89. package/dist/ast-helpers-CzydMPdh-Mi0SrZRa.mjs +0 -424
  90. package/dist/ast-helpers-CzydMPdh-Mi0SrZRa.mjs.map +0 -1
  91. package/dist/authoring-so3aBYD8.mjs.map +0 -1
  92. package/dist/binder-WS9-1Mu9-MJi8x3Gm.d.mts.map +0 -1
  93. package/dist/control-AlBtrJUn.mjs.map +0 -1
  94. package/dist/control-CIEbQ0bK.d.mts +0 -1
  95. package/dist/declarations-DuSbyF44-D-Q7-GRi.mjs +0 -930
  96. package/dist/declarations-DuSbyF44-D-Q7-GRi.mjs.map +0 -1
  97. package/dist/framework-authoring-hZgq-M2K-Daz3kgWL.d.mts.map +0 -1
  98. package/dist/psl-ast-rf0UoVty.d.mts +0 -2
  99. package/dist/resolve-C8PUf8zv-QAvnPhCt.mjs +0 -146
  100. package/dist/resolve-C8PUf8zv-QAvnPhCt.mjs.map +0 -1
  101. package/dist/temporal-presets-BcDyr_hK-CFplJNGz.mjs.map +0 -1
  102. package/dist/temporal-presets-Cumws2z--DcYWooYJ.d.mts.map +0 -1
@@ -1,930 +0,0 @@
1
- import { A as resolvePslBacktickEscapes, s as canonicalizeTaggedLiteralBody } from "./temporal-presets-BcDyr_hK-CFplJNGz.mjs";
2
- import { c as findFirstChild, n as SyntaxToken, o as filterChildren, s as findChildToken, t as SyntaxNode, u as readDocComment } from "./ast-helpers-CzydMPdh-Mi0SrZRa.mjs";
3
- import { r as isTerminatedStringLiteral } from "./tokenizer-C-GTKKjR-B1vOzJy0.mjs";
4
- //#region ../../../1-framework/2-authoring/psl-parser/dist/declarations-DuSbyF44.mjs
5
- var IdentifierAst = class IdentifierAst {
6
- syntax;
7
- constructor(syntax) {
8
- this.syntax = syntax;
9
- }
10
- token() {
11
- return findChildToken(this.syntax, "Ident");
12
- }
13
- name() {
14
- return this.token()?.text;
15
- }
16
- static cast(node) {
17
- return node.kind === "Identifier" ? new IdentifierAst(node) : void 0;
18
- }
19
- };
20
- /** A namespace-qualified name, e.g. `pgvector.Vector` or `supabase:auth.User`. */
21
- var QualifiedNameAst = class QualifiedNameAst {
22
- syntax;
23
- constructor(syntax) {
24
- this.syntax = syntax;
25
- }
26
- #segmentBefore(boundary) {
27
- let found;
28
- for (const segment of filterChildren(this.syntax, IdentifierAst.cast)) {
29
- if (segment.syntax.offset >= boundary) break;
30
- found = segment;
31
- }
32
- return found;
33
- }
34
- #segmentAfter(boundary) {
35
- for (const segment of filterChildren(this.syntax, IdentifierAst.cast)) if (segment.syntax.offset > boundary) return segment;
36
- }
37
- #separatorCount(kind) {
38
- let count = 0;
39
- for (const child of this.syntax.children()) if (!(child instanceof SyntaxNode) && child.kind === kind) count++;
40
- return count;
41
- }
42
- colon() {
43
- return findChildToken(this.syntax, "Colon");
44
- }
45
- dot() {
46
- return findChildToken(this.syntax, "Dot");
47
- }
48
- space() {
49
- const colon = this.colon();
50
- if (!colon) return void 0;
51
- return this.#segmentBefore(colon.offset);
52
- }
53
- namespace() {
54
- const dot = this.dot();
55
- if (!dot) return void 0;
56
- return this.#segmentBefore(dot.offset);
57
- }
58
- identifier() {
59
- const dot = this.dot();
60
- if (dot) return this.#segmentAfter(dot.offset);
61
- const colon = this.colon();
62
- if (colon) return this.#segmentAfter(colon.offset);
63
- return findFirstChild(this.syntax, IdentifierAst.cast);
64
- }
65
- segments() {
66
- return filterChildren(this.syntax, IdentifierAst.cast);
67
- }
68
- /**
69
- * Every identifier segment, in source order. A bare `Vector` yields
70
- * `['Vector']`; a qualified `pgvector.Vector` yields `['pgvector', 'Vector']`.
71
- */
72
- path() {
73
- const segments = [];
74
- for (const segment of this.segments()) {
75
- const text = segment.token()?.text;
76
- if (text !== void 0) segments.push(text);
77
- }
78
- return segments;
79
- }
80
- /** True iff this is a single unqualified identifier whose text equals `name`. */
81
- isSimpleName(name) {
82
- if (this.dot() !== void 0 || this.colon() !== void 0) return false;
83
- return this.identifier()?.token()?.text === name;
84
- }
85
- /**
86
- * Flags a malformed name with more qualifier segments than allowed (a second
87
- * `:`-space or a second `.`-namespace).
88
- */
89
- isOverQualified() {
90
- return this.#separatorCount("Dot") > 1 || this.#separatorCount("Colon") > 1;
91
- }
92
- static cast(node) {
93
- return node.kind === "QualifiedName" ? new QualifiedNameAst(node) : void 0;
94
- }
95
- };
96
- var FunctionCallAst = class FunctionCallAst {
97
- syntax;
98
- constructor(syntax) {
99
- this.syntax = syntax;
100
- }
101
- /** The callee when it is a bare name, such as `now` in `now()`; `undefined` when the callee is dotted. */
102
- name() {
103
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
104
- }
105
- /**
106
- * The callee's segments, in source order. A bare `Vector(…)` yields
107
- * `['Vector']`; `pgvector.Vector(…)` yields `['pgvector', 'Vector']`;
108
- * `address.geo.lat(…)` yields `['address', 'geo', 'lat']`. Empty when the
109
- * call carries no identifier.
110
- */
111
- path() {
112
- return segmentNames((this.name() ?? this.memberPath())?.syntax ?? this.syntax);
113
- }
114
- /** The callee when it is dotted, such as `address.city` in `address.city(sort: Asc)`; `undefined` for a bare callee. */
115
- memberPath() {
116
- return findFirstChild(this.syntax, PathExprAst.cast);
117
- }
118
- lparen() {
119
- return findChildToken(this.syntax, "LParen");
120
- }
121
- rparen() {
122
- return findChildToken(this.syntax, "RParen");
123
- }
124
- *args() {
125
- yield* filterChildren(this.syntax, AttributeArgAst.cast);
126
- }
127
- static cast(node) {
128
- return node.kind === "FunctionCall" ? new FunctionCallAst(node) : void 0;
129
- }
130
- };
131
- function segmentNames(node) {
132
- const segments = [];
133
- for (const segment of filterChildren(node, IdentifierAst.cast)) {
134
- const text = segment.token()?.text;
135
- if (text !== void 0) segments.push(text);
136
- }
137
- return segments;
138
- }
139
- /** A dotted member path in expression position, such as `address.city` in `@@index([address.city])`. */
140
- var PathExprAst = class PathExprAst {
141
- syntax;
142
- constructor(syntax) {
143
- this.syntax = syntax;
144
- }
145
- *segments() {
146
- yield* filterChildren(this.syntax, IdentifierAst.cast);
147
- }
148
- /**
149
- * The segment names, in source order: `['address', 'city']` for `address.city`. A path that ends
150
- * in a `.` with no name after it, as in `address.`, ends in an empty name.
151
- */
152
- path() {
153
- const segments = segmentNames(this.syntax);
154
- return this.syntax.lastToken?.kind === "Dot" ? [...segments, ""] : segments;
155
- }
156
- static cast(node) {
157
- return node.kind === "PathExpr" ? new PathExprAst(node) : void 0;
158
- }
159
- };
160
- var ArrayLiteralAst = class ArrayLiteralAst {
161
- syntax;
162
- constructor(syntax) {
163
- this.syntax = syntax;
164
- }
165
- lbracket() {
166
- return findChildToken(this.syntax, "LBracket");
167
- }
168
- rbracket() {
169
- return findChildToken(this.syntax, "RBracket");
170
- }
171
- *elements() {
172
- yield* filterChildren(this.syntax, castExpression);
173
- }
174
- static cast(node) {
175
- return node.kind === "ArrayLiteral" ? new ArrayLiteralAst(node) : void 0;
176
- }
177
- };
178
- const HEX = /^[0-9a-fA-F]+$/;
179
- function decodeFixedHex(raw, start, width) {
180
- if (start + width > raw.length) return void 0;
181
- const hex = raw.slice(start, start + width);
182
- if (!HEX.test(hex)) return void 0;
183
- return String.fromCharCode(Number.parseInt(hex, 16));
184
- }
185
- function decodeStringLiteral(raw) {
186
- let out = "";
187
- let i = 0;
188
- while (i < raw.length) {
189
- const ch = raw.charAt(i);
190
- if (ch !== "\\" || i + 1 >= raw.length) {
191
- out += ch;
192
- i++;
193
- continue;
194
- }
195
- const next = raw.charAt(i + 1);
196
- switch (next) {
197
- case "/":
198
- out += "/";
199
- i += 2;
200
- continue;
201
- case "b":
202
- out += "\b";
203
- i += 2;
204
- continue;
205
- case "f":
206
- out += "\f";
207
- i += 2;
208
- continue;
209
- case "n":
210
- out += "\n";
211
- i += 2;
212
- continue;
213
- case "r":
214
- out += "\r";
215
- i += 2;
216
- continue;
217
- case "t":
218
- out += " ";
219
- i += 2;
220
- continue;
221
- case "\"":
222
- out += "\"";
223
- i += 2;
224
- continue;
225
- case "'":
226
- out += "'";
227
- i += 2;
228
- continue;
229
- case "\\":
230
- out += "\\";
231
- i += 2;
232
- continue;
233
- case "x": {
234
- const decoded = decodeFixedHex(raw, i + 2, 2);
235
- if (decoded === void 0) {
236
- out += "\\x";
237
- i += 2;
238
- continue;
239
- }
240
- out += decoded;
241
- i += 4;
242
- continue;
243
- }
244
- case "u": {
245
- const decoded = decodeFixedHex(raw, i + 2, 4);
246
- if (decoded === void 0) {
247
- out += "\\u";
248
- i += 2;
249
- continue;
250
- }
251
- out += decoded;
252
- i += 6;
253
- continue;
254
- }
255
- default:
256
- out += `\\${next}`;
257
- i += 2;
258
- continue;
259
- }
260
- }
261
- return out;
262
- }
263
- var StringLiteralExprAst = class StringLiteralExprAst {
264
- syntax;
265
- constructor(syntax) {
266
- this.syntax = syntax;
267
- }
268
- token() {
269
- return findChildToken(this.syntax, "StringLiteral");
270
- }
271
- quote() {
272
- const quote = this.token()?.text.charAt(0);
273
- return quote === "\"" || quote === "'" || quote === "`" ? quote : void 0;
274
- }
275
- /**
276
- * The decoded string. A `"` or `'` string resolves the usual escapes; a backtick string resolves
277
- * only `` \` `` and `\\`, keeping every other backslash sequence as written.
278
- */
279
- value() {
280
- const tok = this.token();
281
- if (!tok) return void 0;
282
- const raw = isTerminatedStringLiteral(tok.text) ? tok.text.slice(1, -1) : tok.text.slice(1);
283
- return this.quote() === "`" ? resolvePslBacktickEscapes(raw) : decodeStringLiteral(raw);
284
- }
285
- static cast(node) {
286
- return node.kind === "StringLiteralExpr" ? new StringLiteralExprAst(node) : void 0;
287
- }
288
- };
289
- /** `` tag`body` ``, `tag"body"`, or `tag'body'`: a qualified-name tag followed by a string literal. */
290
- var TaggedLiteralExprAst = class TaggedLiteralExprAst {
291
- syntax;
292
- constructor(syntax) {
293
- this.syntax = syntax;
294
- }
295
- tag() {
296
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
297
- }
298
- /** The tag without trivia, e.g. `postgis.geometry`. */
299
- tagName() {
300
- const tag = this.tag();
301
- const space = tag?.space()?.name();
302
- const namespace = tag?.namespace()?.name();
303
- return (space === void 0 ? "" : `${space}:`) + (namespace === void 0 ? "" : `${namespace}.`) + (tag?.identifier()?.name() ?? "");
304
- }
305
- literal() {
306
- return findFirstChild(this.syntax, StringLiteralExprAst.cast);
307
- }
308
- canonicalization() {
309
- return canonicalizeTaggedLiteralBody(this.literal()?.value() ?? "");
310
- }
311
- /** The canonical text shared with the TypeScript `sql` tag, or `undefined` when canonicalization fails. */
312
- text() {
313
- const result = this.canonicalization();
314
- return result.ok ? result.text : void 0;
315
- }
316
- static cast(node) {
317
- return node.kind === "TaggedLiteral" ? new TaggedLiteralExprAst(node) : void 0;
318
- }
319
- };
320
- var NumberLiteralExprAst = class NumberLiteralExprAst {
321
- syntax;
322
- constructor(syntax) {
323
- this.syntax = syntax;
324
- }
325
- token() {
326
- return findChildToken(this.syntax, "NumberLiteral");
327
- }
328
- value() {
329
- const tok = this.token();
330
- if (!tok) return void 0;
331
- return Number(tok.text);
332
- }
333
- static cast(node) {
334
- return node.kind === "NumberLiteralExpr" ? new NumberLiteralExprAst(node) : void 0;
335
- }
336
- };
337
- var BooleanLiteralExprAst = class BooleanLiteralExprAst {
338
- syntax;
339
- constructor(syntax) {
340
- this.syntax = syntax;
341
- }
342
- token() {
343
- return findChildToken(this.syntax, "Ident");
344
- }
345
- value() {
346
- const tok = this.token();
347
- if (!tok) return void 0;
348
- if (tok.text === "true") return true;
349
- if (tok.text === "false") return false;
350
- }
351
- static cast(node) {
352
- return node.kind === "BooleanLiteralExpr" ? new BooleanLiteralExprAst(node) : void 0;
353
- }
354
- };
355
- var ObjectLiteralExprAst = class ObjectLiteralExprAst {
356
- syntax;
357
- constructor(syntax) {
358
- this.syntax = syntax;
359
- }
360
- lbrace() {
361
- return findChildToken(this.syntax, "LBrace");
362
- }
363
- rbrace() {
364
- return findChildToken(this.syntax, "RBrace");
365
- }
366
- *fields() {
367
- yield* filterChildren(this.syntax, ObjectFieldAst.cast);
368
- }
369
- static cast(node) {
370
- return node.kind === "ObjectLiteralExpr" ? new ObjectLiteralExprAst(node) : void 0;
371
- }
372
- };
373
- var ObjectFieldAst = class ObjectFieldAst {
374
- syntax;
375
- constructor(syntax) {
376
- this.syntax = syntax;
377
- }
378
- key() {
379
- for (const child of this.syntax.children()) {
380
- if (!(child instanceof SyntaxNode)) {
381
- if (child.kind === "Colon") break;
382
- continue;
383
- }
384
- return IdentifierAst.cast(child);
385
- }
386
- }
387
- /**
388
- * The field's logical key name, unquoted. An identifier key (`length:`) yields
389
- * its text; a string-literal key (`"length":`) yields the decoded string.
390
- * `undefined` when the field carries no key node.
391
- */
392
- keyName() {
393
- for (const child of this.syntax.children()) {
394
- if (!(child instanceof SyntaxNode)) {
395
- if (child.kind === "Colon") break;
396
- continue;
397
- }
398
- const identifier = IdentifierAst.cast(child);
399
- if (identifier) return identifier.token()?.text;
400
- const stringKey = StringLiteralExprAst.cast(child);
401
- if (stringKey) return stringKey.value();
402
- return;
403
- }
404
- }
405
- colon() {
406
- return findChildToken(this.syntax, "Colon");
407
- }
408
- value() {
409
- if (this.colon()) {
410
- let pastColon = false;
411
- for (const child of this.syntax.children()) {
412
- if (!(child instanceof SyntaxNode)) {
413
- if (child.kind === "Colon") pastColon = true;
414
- continue;
415
- }
416
- if (pastColon) {
417
- const expr = castExpression(child);
418
- if (expr) return expr;
419
- }
420
- }
421
- return;
422
- }
423
- return findFirstChild(this.syntax, castExpression);
424
- }
425
- static cast(node) {
426
- return node.kind === "ObjectField" ? new ObjectFieldAst(node) : void 0;
427
- }
428
- };
429
- /** Every dotted path in an expression: the expression itself, a dotted callee, or a path inside a list, record or call argument. */
430
- function dottedPathsIn(expression) {
431
- const paths = [];
432
- for (const element of expression.syntax.descendants()) {
433
- const path = element instanceof SyntaxNode ? PathExprAst.cast(element) : void 0;
434
- if (path !== void 0) paths.push(path);
435
- }
436
- return paths;
437
- }
438
- function castExpression(node) {
439
- return FunctionCallAst.cast(node) ?? ArrayLiteralAst.cast(node) ?? StringLiteralExprAst.cast(node) ?? TaggedLiteralExprAst.cast(node) ?? NumberLiteralExprAst.cast(node) ?? BooleanLiteralExprAst.cast(node) ?? ObjectLiteralExprAst.cast(node) ?? PathExprAst.cast(node) ?? IdentifierAst.cast(node);
440
- }
441
- var AttributeArgAst = class AttributeArgAst {
442
- syntax;
443
- constructor(syntax) {
444
- this.syntax = syntax;
445
- }
446
- name() {
447
- if (!this.colon()) return void 0;
448
- return findFirstChild(this.syntax, IdentifierAst.cast);
449
- }
450
- colon() {
451
- return findChildToken(this.syntax, "Colon");
452
- }
453
- value() {
454
- if (this.colon()) {
455
- let pastColon = false;
456
- for (const child of this.syntax.children()) {
457
- if (!(child instanceof SyntaxNode)) {
458
- if (child.kind === "Colon") pastColon = true;
459
- continue;
460
- }
461
- if (pastColon) {
462
- const expr = castExpression(child);
463
- if (expr) return expr;
464
- }
465
- }
466
- return;
467
- }
468
- return findFirstChild(this.syntax, castExpression);
469
- }
470
- static cast(node) {
471
- return node.kind === "AttributeArg" ? new AttributeArgAst(node) : void 0;
472
- }
473
- };
474
- var AttributeArgListAst = class AttributeArgListAst {
475
- syntax;
476
- constructor(syntax) {
477
- this.syntax = syntax;
478
- }
479
- lparen() {
480
- return findChildToken(this.syntax, "LParen");
481
- }
482
- rparen() {
483
- return findChildToken(this.syntax, "RParen");
484
- }
485
- *args() {
486
- yield* filterChildren(this.syntax, AttributeArgAst.cast);
487
- }
488
- static cast(node) {
489
- return node.kind === "AttributeArgList" ? new AttributeArgListAst(node) : void 0;
490
- }
491
- };
492
- var FieldAttributeAst = class FieldAttributeAst {
493
- syntax;
494
- constructor(syntax) {
495
- this.syntax = syntax;
496
- }
497
- at() {
498
- return findChildToken(this.syntax, "At");
499
- }
500
- name() {
501
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
502
- }
503
- argList() {
504
- return findFirstChild(this.syntax, AttributeArgListAst.cast);
505
- }
506
- static cast(node) {
507
- return node.kind === "FieldAttribute" ? new FieldAttributeAst(node) : void 0;
508
- }
509
- };
510
- var ModelAttributeAst = class ModelAttributeAst {
511
- syntax;
512
- constructor(syntax) {
513
- this.syntax = syntax;
514
- }
515
- doubleAt() {
516
- return findChildToken(this.syntax, "DoubleAt");
517
- }
518
- name() {
519
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
520
- }
521
- argList() {
522
- return findFirstChild(this.syntax, AttributeArgListAst.cast);
523
- }
524
- static cast(node) {
525
- return node.kind === "ModelAttribute" ? new ModelAttributeAst(node) : void 0;
526
- }
527
- };
528
- const TRIVIA_KINDS = /* @__PURE__ */ new Set([
529
- "Whitespace",
530
- "Newline",
531
- "Comment"
532
- ]);
533
- /** Whether a token kind is trivia (whitespace, newline, or comment). */
534
- function isTriviaKind(kind) {
535
- return TRIVIA_KINDS.has(kind);
536
- }
537
- /** Whether a token is trivia. */
538
- function isTrivia(token) {
539
- return isTriviaKind(token.kind);
540
- }
541
- /**
542
- * The first non-trivia token at or beyond `token` in `direction`. Returns
543
- * `token` itself when it is already significant.
544
- */
545
- function skipTriviaToken(token, direction) {
546
- let current = token;
547
- while (current !== void 0 && isTrivia(current)) current = direction === "next" ? current.nextToken : current.prevToken;
548
- return current;
549
- }
550
- /**
551
- * The nearest sibling of `element` (within the same parent) in `direction` that
552
- * is not a trivia token. Nodes are always significant.
553
- */
554
- function nonTriviaSibling(element, direction) {
555
- let sibling = step(element, direction);
556
- while (sibling !== void 0) {
557
- if (!(sibling instanceof SyntaxToken) || !isTrivia(sibling)) return sibling;
558
- sibling = step(sibling, direction);
559
- }
560
- }
561
- function step(element, direction) {
562
- return direction === "next" ? element.nextSiblingOrToken : element.prevSiblingOrToken;
563
- }
564
- var TypeAnnotationAst = class TypeAnnotationAst {
565
- syntax;
566
- constructor(syntax) {
567
- this.syntax = syntax;
568
- }
569
- /** The annotation's reference, doubling as the constructor callee when an {@link argList} follows. */
570
- name() {
571
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
572
- }
573
- /** Present when the annotation is a constructor (`Vector(1536)`) rather than a plain reference. */
574
- argList() {
575
- return findFirstChild(this.syntax, AttributeArgListAst.cast);
576
- }
577
- isConstructor() {
578
- return this.argList() !== void 0;
579
- }
580
- lbracket() {
581
- return findChildToken(this.syntax, "LBracket");
582
- }
583
- rbracket() {
584
- return findChildToken(this.syntax, "RBracket");
585
- }
586
- questionMark() {
587
- return findChildToken(this.syntax, "Question");
588
- }
589
- isList() {
590
- return this.lbracket() !== void 0;
591
- }
592
- /**
593
- * The list/field axis: a `?` after `]` (list nullable) or, when this is not a
594
- * list, the sole field-level `?`. A `?` before `[` is the element axis and
595
- * does not count here.
596
- */
597
- isOptional() {
598
- const lbracket = this.lbracket();
599
- if (lbracket === void 0) return this.questionMark() !== void 0;
600
- const anchor = this.rbracket() ?? lbracket;
601
- return this.#questionTokens().some((question) => question.index > anchor.index);
602
- }
603
- /** The element axis: a `?` positioned before `[`, meaningful only for lists. */
604
- isElementOptional() {
605
- const lbracket = this.lbracket();
606
- if (lbracket === void 0) return false;
607
- return this.#questionTokens().some((question) => question.index < lbracket.index);
608
- }
609
- #questionTokens() {
610
- const result = [];
611
- for (const child of this.syntax.children()) if (!(child instanceof SyntaxNode) && child.kind === "Question") result.push(child);
612
- return result;
613
- }
614
- static cast(node) {
615
- return node.kind === "TypeAnnotation" ? new TypeAnnotationAst(node) : void 0;
616
- }
617
- };
618
- function castNamespaceMember(node) {
619
- return ModelDeclarationAst.cast(node) ?? CompositeTypeDeclarationAst.cast(node) ?? GenericBlockDeclarationAst.cast(node) ?? MixinDeclarationAst.cast(node);
620
- }
621
- var DocumentAst = class DocumentAst {
622
- syntax;
623
- constructor(syntax) {
624
- this.syntax = syntax;
625
- }
626
- *declarations() {
627
- yield* filterChildren(this.syntax, (node) => castNamespaceMember(node) ?? TypesBlockAst.cast(node) ?? NamespaceDeclarationAst.cast(node));
628
- }
629
- static cast(node) {
630
- return node.kind === "Document" ? new DocumentAst(node) : void 0;
631
- }
632
- };
633
- var ModelDeclarationAst = class ModelDeclarationAst {
634
- syntax;
635
- constructor(syntax) {
636
- this.syntax = syntax;
637
- }
638
- keyword() {
639
- return findChildToken(this.syntax, "Ident");
640
- }
641
- name() {
642
- return findFirstChild(this.syntax, IdentifierAst.cast);
643
- }
644
- lbrace() {
645
- return findChildToken(this.syntax, "LBrace");
646
- }
647
- rbrace() {
648
- return findChildToken(this.syntax, "RBrace");
649
- }
650
- *fields() {
651
- yield* filterChildren(this.syntax, FieldDeclarationAst.cast);
652
- }
653
- *attributes() {
654
- yield* filterChildren(this.syntax, ModelAttributeAst.cast);
655
- }
656
- *inclusions() {
657
- yield* filterChildren(this.syntax, MixinInclusionAst.cast);
658
- }
659
- *members() {
660
- yield* filterChildren(this.syntax, (node) => FieldDeclarationAst.cast(node) ?? ModelAttributeAst.cast(node) ?? MixinInclusionAst.cast(node));
661
- }
662
- docComment() {
663
- return readDocComment(this.syntax);
664
- }
665
- static cast(node) {
666
- return node.kind === "ModelDeclaration" ? new ModelDeclarationAst(node) : void 0;
667
- }
668
- };
669
- var CompositeTypeDeclarationAst = class CompositeTypeDeclarationAst {
670
- syntax;
671
- constructor(syntax) {
672
- this.syntax = syntax;
673
- }
674
- keyword() {
675
- return findChildToken(this.syntax, "Ident");
676
- }
677
- name() {
678
- return findFirstChild(this.syntax, IdentifierAst.cast);
679
- }
680
- lbrace() {
681
- return findChildToken(this.syntax, "LBrace");
682
- }
683
- rbrace() {
684
- return findChildToken(this.syntax, "RBrace");
685
- }
686
- *fields() {
687
- yield* filterChildren(this.syntax, FieldDeclarationAst.cast);
688
- }
689
- *attributes() {
690
- yield* filterChildren(this.syntax, ModelAttributeAst.cast);
691
- }
692
- *inclusions() {
693
- yield* filterChildren(this.syntax, MixinInclusionAst.cast);
694
- }
695
- *members() {
696
- yield* filterChildren(this.syntax, (node) => FieldDeclarationAst.cast(node) ?? ModelAttributeAst.cast(node) ?? MixinInclusionAst.cast(node));
697
- }
698
- docComment() {
699
- return readDocComment(this.syntax);
700
- }
701
- static cast(node) {
702
- return node.kind === "CompositeTypeDeclaration" ? new CompositeTypeDeclarationAst(node) : void 0;
703
- }
704
- };
705
- var NamespaceDeclarationAst = class NamespaceDeclarationAst {
706
- syntax;
707
- constructor(syntax) {
708
- this.syntax = syntax;
709
- }
710
- keyword() {
711
- return findChildToken(this.syntax, "Ident");
712
- }
713
- name() {
714
- return findFirstChild(this.syntax, IdentifierAst.cast);
715
- }
716
- lbrace() {
717
- return findChildToken(this.syntax, "LBrace");
718
- }
719
- rbrace() {
720
- return findChildToken(this.syntax, "RBrace");
721
- }
722
- *declarations() {
723
- yield* filterChildren(this.syntax, castNamespaceMember);
724
- }
725
- static cast(node) {
726
- return node.kind === "Namespace" ? new NamespaceDeclarationAst(node) : void 0;
727
- }
728
- };
729
- var TypesBlockAst = class TypesBlockAst {
730
- syntax;
731
- constructor(syntax) {
732
- this.syntax = syntax;
733
- }
734
- keyword() {
735
- return findChildToken(this.syntax, "Ident");
736
- }
737
- lbrace() {
738
- return findChildToken(this.syntax, "LBrace");
739
- }
740
- rbrace() {
741
- return findChildToken(this.syntax, "RBrace");
742
- }
743
- *declarations() {
744
- yield* filterChildren(this.syntax, NamedTypeDeclarationAst.cast);
745
- }
746
- static cast(node) {
747
- return node.kind === "TypesBlock" ? new TypesBlockAst(node) : void 0;
748
- }
749
- };
750
- var GenericBlockDeclarationAst = class GenericBlockDeclarationAst {
751
- syntax;
752
- constructor(syntax) {
753
- this.syntax = syntax;
754
- }
755
- keyword() {
756
- return findChildToken(this.syntax, "Ident");
757
- }
758
- name() {
759
- return findFirstChild(this.syntax, IdentifierAst.cast);
760
- }
761
- lbrace() {
762
- return findChildToken(this.syntax, "LBrace");
763
- }
764
- rbrace() {
765
- return findChildToken(this.syntax, "RBrace");
766
- }
767
- *entries() {
768
- yield* filterChildren(this.syntax, KeyValuePairAst.cast);
769
- }
770
- /** Field lines of a `view` body. Empty for every other generic block. */
771
- *fields() {
772
- yield* filterChildren(this.syntax, FieldDeclarationAst.cast);
773
- }
774
- *attributes() {
775
- yield* filterChildren(this.syntax, ModelAttributeAst.cast);
776
- }
777
- *inclusions() {
778
- yield* filterChildren(this.syntax, MixinInclusionAst.cast);
779
- }
780
- *members() {
781
- yield* filterChildren(this.syntax, (node) => KeyValuePairAst.cast(node) ?? ModelAttributeAst.cast(node) ?? MixinInclusionAst.cast(node));
782
- }
783
- docComment() {
784
- return readDocComment(this.syntax);
785
- }
786
- static cast(node) {
787
- return node.kind === "GenericBlockDeclaration" ? new GenericBlockDeclarationAst(node) : void 0;
788
- }
789
- };
790
- var MixinDeclarationAst = class MixinDeclarationAst {
791
- syntax;
792
- constructor(syntax) {
793
- this.syntax = syntax;
794
- }
795
- keyword() {
796
- return findChildToken(this.syntax, "Ident");
797
- }
798
- mixinKeyword() {
799
- const next = this.keyword()?.nextToken;
800
- const token = next === void 0 ? void 0 : skipTriviaToken(next, "next");
801
- return token?.kind === "Ident" && token.parent === this.syntax ? token : void 0;
802
- }
803
- name() {
804
- return findFirstChild(this.syntax, IdentifierAst.cast);
805
- }
806
- lbrace() {
807
- return findChildToken(this.syntax, "LBrace");
808
- }
809
- rbrace() {
810
- return findChildToken(this.syntax, "RBrace");
811
- }
812
- *fields() {
813
- yield* filterChildren(this.syntax, FieldDeclarationAst.cast);
814
- }
815
- *entries() {
816
- yield* filterChildren(this.syntax, KeyValuePairAst.cast);
817
- }
818
- *attributes() {
819
- yield* filterChildren(this.syntax, ModelAttributeAst.cast);
820
- }
821
- /** A mixin cannot include a mixin, but the parser still reads an inclusion written in a mixin body, so that it can be reported as an error at that inclusion. */
822
- *inclusions() {
823
- yield* filterChildren(this.syntax, MixinInclusionAst.cast);
824
- }
825
- *members() {
826
- yield* filterChildren(this.syntax, (node) => FieldDeclarationAst.cast(node) ?? KeyValuePairAst.cast(node) ?? ModelAttributeAst.cast(node) ?? MixinInclusionAst.cast(node));
827
- }
828
- docComment() {
829
- return readDocComment(this.syntax);
830
- }
831
- static cast(node) {
832
- return node.kind === "MixinDeclaration" ? new MixinDeclarationAst(node) : void 0;
833
- }
834
- };
835
- var MixinInclusionAst = class MixinInclusionAst {
836
- syntax;
837
- constructor(syntax) {
838
- this.syntax = syntax;
839
- }
840
- plus() {
841
- return findChildToken(this.syntax, "Plus");
842
- }
843
- name() {
844
- return findFirstChild(this.syntax, QualifiedNameAst.cast);
845
- }
846
- static cast(node) {
847
- return node.kind === "MixinInclusion" ? new MixinInclusionAst(node) : void 0;
848
- }
849
- };
850
- var KeyValuePairAst = class KeyValuePairAst {
851
- syntax;
852
- constructor(syntax) {
853
- this.syntax = syntax;
854
- }
855
- key() {
856
- return findFirstChild(this.syntax, IdentifierAst.cast);
857
- }
858
- equals() {
859
- return findChildToken(this.syntax, "Equals");
860
- }
861
- value() {
862
- let pastEquals = false;
863
- for (const child of this.syntax.children()) {
864
- if (!(child instanceof SyntaxNode)) {
865
- if (child.kind === "Equals") pastEquals = true;
866
- continue;
867
- }
868
- if (pastEquals) {
869
- const expr = castExpression(child);
870
- if (expr) return expr;
871
- }
872
- }
873
- }
874
- /** `@` attributes after the key or value, as in `USER @map("user")`. */
875
- *attributes() {
876
- yield* filterChildren(this.syntax, FieldAttributeAst.cast);
877
- }
878
- static cast(node) {
879
- return node.kind === "KeyValuePair" ? new KeyValuePairAst(node) : void 0;
880
- }
881
- };
882
- var FieldDeclarationAst = class FieldDeclarationAst {
883
- syntax;
884
- constructor(syntax) {
885
- this.syntax = syntax;
886
- }
887
- name() {
888
- return findFirstChild(this.syntax, IdentifierAst.cast);
889
- }
890
- typeAnnotation() {
891
- return findFirstChild(this.syntax, TypeAnnotationAst.cast);
892
- }
893
- *attributes() {
894
- yield* filterChildren(this.syntax, FieldAttributeAst.cast);
895
- }
896
- docComment() {
897
- return readDocComment(this.syntax);
898
- }
899
- static cast(node) {
900
- return node.kind === "FieldDeclaration" ? new FieldDeclarationAst(node) : void 0;
901
- }
902
- };
903
- var NamedTypeDeclarationAst = class NamedTypeDeclarationAst {
904
- syntax;
905
- constructor(syntax) {
906
- this.syntax = syntax;
907
- }
908
- name() {
909
- return findFirstChild(this.syntax, IdentifierAst.cast);
910
- }
911
- equals() {
912
- return findChildToken(this.syntax, "Equals");
913
- }
914
- typeAnnotation() {
915
- return findFirstChild(this.syntax, TypeAnnotationAst.cast);
916
- }
917
- *attributes() {
918
- yield* filterChildren(this.syntax, FieldAttributeAst.cast);
919
- }
920
- docComment() {
921
- return readDocComment(this.syntax);
922
- }
923
- static cast(node) {
924
- return node.kind === "NamedTypeDeclaration" ? new NamedTypeDeclarationAst(node) : void 0;
925
- }
926
- };
927
- //#endregion
928
- export { isTrivia as A, QualifiedNameAst as C, TypesBlockAst as D, TypeAnnotationAst as E, nonTriviaSibling as M, skipTriviaToken as N, castExpression as O, PathExprAst as S, TaggedLiteralExprAst as T, NamedTypeDeclarationAst as _, CompositeTypeDeclarationAst as a, ObjectFieldAst as b, FieldDeclarationAst as c, IdentifierAst as d, KeyValuePairAst as f, ModelDeclarationAst as g, ModelAttributeAst as h, BooleanLiteralExprAst as i, isTriviaKind as j, dottedPathsIn as k, FunctionCallAst as l, MixinInclusionAst as m, AttributeArgAst as n, DocumentAst as o, MixinDeclarationAst as p, AttributeArgListAst as r, FieldAttributeAst as s, ArrayLiteralAst as t, GenericBlockDeclarationAst as u, NamespaceDeclarationAst as v, StringLiteralExprAst as w, ObjectLiteralExprAst as x, NumberLiteralExprAst as y };
929
-
930
- //# sourceMappingURL=declarations-DuSbyF44-D-Q7-GRi.mjs.map