@prisma-next/psl-parser 0.14.0-dev.5 → 0.14.0-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { t as parsePslDocument } from "./parser-CaplKvRs.mjs";
2
- import { flatPslModels, namespacePslExtensionBlocks } from "@prisma-next/framework-components/psl-ast";
1
+ import { O as printSyntax, c as NamespaceDeclarationAst, i as GenericBlockDeclarationAst, l as TypesBlockAst, m as ArrayLiteralAst, o as ModelDeclarationAst, t as CompositeTypeDeclarationAst } from "./declarations-D9h_ihD3.mjs";
2
+ import { UNSPECIFIED_PSL_NAMESPACE_ID, flatPslModels, makePslNamespace, makePslNamespaceEntries, namespacePslExtensionBlocks, validateExtensionBlock } from "@prisma-next/framework-components/psl-ast";
3
+ import { isAuthoringPslBlockDescriptor } from "@prisma-next/framework-components/authoring";
3
4
  //#region src/attribute-helpers.ts
4
5
  function getPositionalArgument(attribute, index = 0) {
5
6
  return attribute.args.filter((arg) => arg.kind === "positional")[index]?.value;
@@ -10,6 +11,474 @@ function parseQuotedStringLiteral(value) {
10
11
  return match[2] ?? "";
11
12
  }
12
13
  //#endregion
13
- export { flatPslModels, getPositionalArgument, namespacePslExtensionBlocks, parsePslDocument, parseQuotedStringLiteral };
14
+ //#region src/extension-block.ts
15
+ function findBlockDescriptor(descriptors, keyword) {
16
+ if (descriptors === void 0) return void 0;
17
+ for (const value of Object.values(descriptors)) {
18
+ if (value === void 0) continue;
19
+ if (isAuthoringPslBlockDescriptor(value)) {
20
+ if (value.keyword === keyword) return value;
21
+ continue;
22
+ }
23
+ const nested = findBlockDescriptor(value, keyword);
24
+ if (nested !== void 0) return nested;
25
+ }
26
+ }
27
+ function validateExtensionBlockFromSymbol(input) {
28
+ const refCtx = buildRefResolutionContext(input.symbolTable, input.block);
29
+ return validateExtensionBlock(input.block.block, input.descriptor, input.sourceId, input.codecLookup, refCtx);
30
+ }
31
+ const ZERO_SPAN = {
32
+ start: {
33
+ offset: 0,
34
+ line: 1,
35
+ column: 1
36
+ },
37
+ end: {
38
+ offset: 0,
39
+ line: 1,
40
+ column: 1
41
+ }
42
+ };
43
+ function buildRefResolutionContext(symbolTable, block) {
44
+ const unspecifiedNamespace = makeNamespace(UNSPECIFIED_PSL_NAMESPACE_ID, Object.values(symbolTable.topLevel.models));
45
+ const allNamespaces = [unspecifiedNamespace, ...Object.values(symbolTable.topLevel.namespaces).map((namespace) => makeNamespace(namespace.name, Object.values(namespace.models)))];
46
+ const ownerNamespaceName = findOwnerNamespaceName(symbolTable, block);
47
+ return {
48
+ ownerNamespace: allNamespaces.find((namespace) => namespace.name === ownerNamespaceName) ?? unspecifiedNamespace,
49
+ allNamespaces
50
+ };
51
+ }
52
+ function makeNamespace(name, models) {
53
+ return makePslNamespace({
54
+ kind: "namespace",
55
+ name,
56
+ entries: makePslNamespaceEntries(models.map((model) => ({
57
+ kind: "model",
58
+ name: model.name,
59
+ fields: [],
60
+ attributes: [],
61
+ span: ZERO_SPAN
62
+ })), [], []),
63
+ span: ZERO_SPAN
64
+ });
65
+ }
66
+ function findOwnerNamespaceName(symbolTable, block) {
67
+ for (const namespace of Object.values(symbolTable.topLevel.namespaces)) if (Object.values(namespace.blocks).some((candidate) => candidate === block)) return namespace.name;
68
+ return UNSPECIFIED_PSL_NAMESPACE_ID;
69
+ }
70
+ //#endregion
71
+ //#region src/resolve.ts
72
+ function readResolvedAttribute(attribute, sourceFile) {
73
+ return {
74
+ name: attributeName(attribute.name()),
75
+ args: readResolvedArgList(attribute.argList(), sourceFile),
76
+ span: nodePslSpan(attribute.syntax, sourceFile)
77
+ };
78
+ }
79
+ function readResolvedAttributes(attributes, sourceFile) {
80
+ return Array.from(attributes, (attribute) => readResolvedAttribute(attribute, sourceFile));
81
+ }
82
+ function readResolvedConstructorCall(annotation, sourceFile) {
83
+ const argList = annotation?.argList();
84
+ if (annotation === void 0 || argList === void 0) return void 0;
85
+ return {
86
+ path: annotation.name()?.path() ?? [],
87
+ args: readResolvedArgList(argList, sourceFile),
88
+ span: nodePslSpan(annotation.syntax, sourceFile)
89
+ };
90
+ }
91
+ function readResolvedArgList(argList, sourceFile) {
92
+ if (argList === void 0) return [];
93
+ const args = [];
94
+ for (const arg of argList.args()) {
95
+ const name = arg.name()?.name();
96
+ args.push({
97
+ kind: name !== void 0 ? "named" : "positional",
98
+ ...name !== void 0 ? { name } : {},
99
+ value: renderExpression(arg.value()),
100
+ span: nodePslSpan(arg.syntax, sourceFile)
101
+ });
102
+ }
103
+ return args;
104
+ }
105
+ function attributeName(name) {
106
+ return name?.path().join(".") ?? "";
107
+ }
108
+ function renderExpression(expression) {
109
+ if (expression === void 0) return "";
110
+ return printSyntax(expression.syntax).trim();
111
+ }
112
+ function nodePslSpan(node, sourceFile) {
113
+ const start = node.offset;
114
+ const end = start + node.green.textLength;
115
+ return {
116
+ start: offsetToPslPosition(start, sourceFile),
117
+ end: offsetToPslPosition(end, sourceFile)
118
+ };
119
+ }
120
+ /** Unsupported-top-level-block diagnostics are anchored to the keyword token. */
121
+ function keywordPslSpan(node, keyword, sourceFile) {
122
+ const start = node.offset;
123
+ const end = start + keyword.length;
124
+ return {
125
+ start: offsetToPslPosition(start, sourceFile),
126
+ end: offsetToPslPosition(end, sourceFile)
127
+ };
128
+ }
129
+ function rangeToPslSpan(range, sourceFile) {
130
+ return {
131
+ start: offsetToPslPosition(sourceFile.offsetAt(range.start), sourceFile),
132
+ end: offsetToPslPosition(sourceFile.offsetAt(range.end), sourceFile)
133
+ };
134
+ }
135
+ function offsetToPslPosition(offset, sourceFile) {
136
+ const position = sourceFile.positionAt(offset);
137
+ return {
138
+ offset,
139
+ line: position.line + 1,
140
+ column: position.character + 1
141
+ };
142
+ }
143
+ //#endregion
144
+ //#region src/block-reconstruction.ts
145
+ /**
146
+ * Descriptor-free and unknown parameters become `value` stubs so validation can
147
+ * report them via key-set comparison. Duplicate member names are first-wins.
148
+ */
149
+ function reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {
150
+ const keyword = node.keyword()?.text ?? "";
151
+ const blockName = node.name()?.name() ?? "";
152
+ const blockAttributes = [];
153
+ for (const attribute of node.attributes()) {
154
+ const name = attribute.name()?.path().join(".") ?? "";
155
+ const args = Array.from(attribute.argList()?.args() ?? [], (arg) => {
156
+ const value = arg.value();
157
+ return {
158
+ kind: "positional",
159
+ value: value === void 0 ? "" : printSyntax(value.syntax).trim(),
160
+ span: nodePslSpan(arg.syntax, sourceFile)
161
+ };
162
+ });
163
+ blockAttributes.push({
164
+ name,
165
+ args,
166
+ span: nodePslSpan(attribute.syntax, sourceFile)
167
+ });
168
+ }
169
+ const parameters = {};
170
+ for (const entry of node.entries()) {
171
+ const key = entry.key()?.name();
172
+ if (key === void 0) continue;
173
+ const span = nodePslSpan(entry.syntax, sourceFile);
174
+ if (Object.hasOwn(parameters, key)) {
175
+ diagnostics.push({
176
+ code: "PSL_EXTENSION_DUPLICATE_PARAMETER",
177
+ message: `Duplicate parameter "${key}" in "${keyword}" block "${blockName}"; first occurrence wins`,
178
+ range: {
179
+ start: sourceFile.positionAt(entry.syntax.offset),
180
+ end: sourceFile.positionAt(entry.syntax.offset + entry.syntax.green.textLength)
181
+ }
182
+ });
183
+ continue;
184
+ }
185
+ parameters[key] = reconstructParamValue(entry, descriptor?.parameters[key], span, sourceFile, diagnostics);
186
+ }
187
+ return {
188
+ kind: descriptor?.discriminator ?? keyword,
189
+ name: blockName,
190
+ parameters,
191
+ blockAttributes,
192
+ span: nodePslSpan(node.syntax, sourceFile)
193
+ };
194
+ }
195
+ function reconstructParamValue(entry, param, span, sourceFile, diagnostics) {
196
+ const value = entry.value();
197
+ if (value === void 0) return {
198
+ kind: "bare",
199
+ span
200
+ };
201
+ return reconstructFromExpression(value, param, span, sourceFile, diagnostics);
202
+ }
203
+ function reconstructFromExpression(value, param, span, sourceFile, diagnostics) {
204
+ const raw = printSyntax(value.syntax).trim();
205
+ if (param?.kind === "list") {
206
+ const array = ArrayLiteralAst.cast(value.syntax);
207
+ if (!array) {
208
+ diagnostics?.push({
209
+ code: "PSL_EXTENSION_INVALID_VALUE",
210
+ message: `List parameter expects an array literal, got ${raw}`,
211
+ range: {
212
+ start: sourceFile.positionAt(value.syntax.offset),
213
+ end: sourceFile.positionAt(value.syntax.offset + value.syntax.green.textLength)
214
+ }
215
+ });
216
+ return {
217
+ kind: "value",
218
+ raw,
219
+ span
220
+ };
221
+ }
222
+ const items = [];
223
+ for (const element of array.elements()) items.push(reconstructFromExpression(element, param.of, nodePslSpan(element.syntax, sourceFile), sourceFile, diagnostics));
224
+ return {
225
+ kind: "list",
226
+ items,
227
+ span
228
+ };
229
+ }
230
+ switch (param?.kind) {
231
+ case "ref": return {
232
+ kind: "ref",
233
+ identifier: raw,
234
+ span
235
+ };
236
+ case "option": return {
237
+ kind: "option",
238
+ token: raw,
239
+ span
240
+ };
241
+ default: return {
242
+ kind: "value",
243
+ raw,
244
+ span
245
+ };
246
+ }
247
+ }
248
+ //#endregion
249
+ //#region src/symbol-table.ts
250
+ /**
251
+ * Owns duplicate-declaration detection for all PSL scopes; downstream consumers
252
+ * should consume first-wins symbols rather than re-emitting duplicate diagnostics.
253
+ */
254
+ function buildSymbolTable(options) {
255
+ const { document, sourceFile, scalarTypes, pslBlockDescriptors } = options;
256
+ const diagnostics = [];
257
+ const scalarSet = new Set(scalarTypes);
258
+ const namespaces = {};
259
+ const scalars = {};
260
+ const typeAliases = {};
261
+ const blocks = {};
262
+ const models = {};
263
+ const compositeTypes = {};
264
+ const topLevelNames = /* @__PURE__ */ new Set();
265
+ const claim = (taken, name) => {
266
+ const text = name?.name();
267
+ if (text === void 0) return void 0;
268
+ if (taken.has(text)) {
269
+ const range = nameRange(name, sourceFile);
270
+ if (range) diagnostics.push({
271
+ code: "PSL_DUPLICATE_DECLARATION",
272
+ message: `Duplicate declaration of "${text}"`,
273
+ range
274
+ });
275
+ return;
276
+ }
277
+ taken.add(text);
278
+ return text;
279
+ };
280
+ for (const declaration of document.declarations()) if (declaration instanceof ModelDeclarationAst) {
281
+ const name = claim(topLevelNames, declaration.name());
282
+ if (name !== void 0) models[name] = buildModel(name, declaration, sourceFile, diagnostics);
283
+ } else if (declaration instanceof CompositeTypeDeclarationAst) {
284
+ const name = claim(topLevelNames, declaration.name());
285
+ if (name !== void 0) compositeTypes[name] = buildCompositeType(name, declaration, sourceFile, diagnostics);
286
+ } else if (declaration instanceof GenericBlockDeclarationAst) {
287
+ const name = claim(topLevelNames, declaration.name());
288
+ if (name !== void 0) blocks[name] = buildBlock(name, declaration, sourceFile, pslBlockDescriptors, diagnostics);
289
+ } else if (declaration instanceof NamespaceDeclarationAst) {
290
+ const name = claim(topLevelNames, declaration.name());
291
+ if (name !== void 0) namespaces[name] = buildNamespace(name, declaration, diagnostics, sourceFile, pslBlockDescriptors);
292
+ } else if (declaration instanceof TypesBlockAst) for (const binding of declaration.declarations()) {
293
+ const name = claim(topLevelNames, binding.name());
294
+ if (name === void 0) continue;
295
+ const resolved = resolveNamedTypeBinding(binding, sourceFile);
296
+ const span = nodePslSpan(binding.syntax, sourceFile);
297
+ if (isScalarBinding(binding, scalarSet)) scalars[name] = {
298
+ kind: "scalar",
299
+ name,
300
+ node: binding,
301
+ span,
302
+ ...resolved
303
+ };
304
+ else typeAliases[name] = {
305
+ kind: "typeAlias",
306
+ name,
307
+ node: binding,
308
+ span,
309
+ ...resolved
310
+ };
311
+ }
312
+ return {
313
+ table: { topLevel: {
314
+ namespaces,
315
+ scalars,
316
+ typeAliases,
317
+ blocks,
318
+ models,
319
+ compositeTypes
320
+ } },
321
+ diagnostics
322
+ };
323
+ }
324
+ function buildModel(name, node, sourceFile, diagnostics) {
325
+ return {
326
+ kind: "model",
327
+ name,
328
+ node,
329
+ span: nodePslSpan(node.syntax, sourceFile),
330
+ fields: buildFields(name, node.fields(), sourceFile, diagnostics),
331
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
332
+ };
333
+ }
334
+ function buildCompositeType(name, node, sourceFile, diagnostics) {
335
+ return {
336
+ kind: "compositeType",
337
+ name,
338
+ node,
339
+ span: nodePslSpan(node.syntax, sourceFile),
340
+ fields: buildFields(name, node.fields(), sourceFile, diagnostics),
341
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
342
+ };
343
+ }
344
+ function buildBlock(name, node, sourceFile, pslBlockDescriptors, diagnostics) {
345
+ const keyword = node.keyword()?.text ?? "";
346
+ const descriptor = findBlockDescriptor(pslBlockDescriptors, keyword);
347
+ return {
348
+ kind: "block",
349
+ name,
350
+ keyword,
351
+ node,
352
+ span: nodePslSpan(node.syntax, sourceFile),
353
+ block: reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics)
354
+ };
355
+ }
356
+ function buildNamespace(name, node, diagnostics, sourceFile, pslBlockDescriptors) {
357
+ const models = {};
358
+ const compositeTypes = {};
359
+ const blocks = {};
360
+ const taken = /* @__PURE__ */ new Set();
361
+ for (const member of node.declarations()) {
362
+ const memberName = member.name()?.name();
363
+ if (memberName === void 0) continue;
364
+ if (taken.has(memberName)) {
365
+ const range = nameRange(member.name(), sourceFile);
366
+ if (range) diagnostics.push({
367
+ code: "PSL_DUPLICATE_DECLARATION",
368
+ message: `Duplicate declaration of "${memberName}"`,
369
+ range
370
+ });
371
+ continue;
372
+ }
373
+ taken.add(memberName);
374
+ if (member instanceof ModelDeclarationAst) models[memberName] = buildModel(memberName, member, sourceFile, diagnostics);
375
+ else if (member instanceof CompositeTypeDeclarationAst) compositeTypes[memberName] = buildCompositeType(memberName, member, sourceFile, diagnostics);
376
+ else if (member instanceof GenericBlockDeclarationAst) blocks[memberName] = buildBlock(memberName, member, sourceFile, pslBlockDescriptors, diagnostics);
377
+ }
378
+ return {
379
+ kind: "namespace",
380
+ name,
381
+ node,
382
+ span: nodePslSpan(node.syntax, sourceFile),
383
+ models,
384
+ compositeTypes,
385
+ blocks
386
+ };
387
+ }
388
+ function buildFields(ownerName, fields, sourceFile, diagnostics) {
389
+ const result = {};
390
+ for (const field of fields) {
391
+ const nameNode = field.name();
392
+ const name = nameNode?.name();
393
+ if (name === void 0) continue;
394
+ if (Object.hasOwn(result, name)) {
395
+ const range = nameRange(nameNode, sourceFile);
396
+ if (range) diagnostics.push({
397
+ code: "PSL_DUPLICATE_DECLARATION",
398
+ message: `Duplicate declaration of "${name}"`,
399
+ range
400
+ });
401
+ continue;
402
+ }
403
+ result[name] = buildField(ownerName, name, field, sourceFile, diagnostics);
404
+ }
405
+ return result;
406
+ }
407
+ function buildField(ownerName, name, node, sourceFile, diagnostics) {
408
+ const attributes = readResolvedAttributes(node.attributes(), sourceFile);
409
+ const span = nodePslSpan(node.syntax, sourceFile);
410
+ const annotation = node.typeAnnotation();
411
+ const typeName = annotation?.name();
412
+ if (typeName?.isOverQualified()) {
413
+ const path = typeName.path();
414
+ diagnostics.push({
415
+ code: "PSL_INVALID_QUALIFIED_TYPE",
416
+ message: `Field "${ownerName}.${name}" has an invalid qualified type "${path.join(".")}"; use at most one namespace qualifier (e.g. "ns.TypeName")`,
417
+ range: nodeRange(typeName.syntax, sourceFile)
418
+ });
419
+ return {
420
+ kind: "field",
421
+ name,
422
+ node,
423
+ span,
424
+ typeName: path[path.length - 1] ?? "",
425
+ optional: false,
426
+ list: false,
427
+ malformedType: true,
428
+ attributes
429
+ };
430
+ }
431
+ const typeConstructor = annotation?.isConstructor() ? readResolvedConstructorCall(annotation, sourceFile) : void 0;
432
+ const typeNamespaceId = typeName?.namespace()?.name();
433
+ const typeContractSpaceId = typeName?.space()?.name();
434
+ return {
435
+ kind: "field",
436
+ name,
437
+ node,
438
+ span,
439
+ typeName: typeName?.identifier()?.name() ?? "",
440
+ ...typeNamespaceId !== void 0 ? { typeNamespaceId } : {},
441
+ ...typeContractSpaceId !== void 0 ? { typeContractSpaceId } : {},
442
+ optional: annotation?.isOptional() ?? false,
443
+ list: annotation?.isList() ?? false,
444
+ ...typeConstructor !== void 0 ? { typeConstructor } : {},
445
+ attributes
446
+ };
447
+ }
448
+ function resolveNamedTypeBinding(node, sourceFile) {
449
+ const annotation = node.typeAnnotation();
450
+ const isConstructor = annotation?.isConstructor() ?? false;
451
+ const baseType = annotation?.name()?.identifier()?.name();
452
+ const typeConstructor = readResolvedConstructorCall(annotation, sourceFile);
453
+ return {
454
+ isConstructor,
455
+ ...!isConstructor && baseType !== void 0 ? { baseType } : {},
456
+ ...typeConstructor !== void 0 ? { typeConstructor } : {},
457
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
458
+ };
459
+ }
460
+ function isScalarBinding(node, scalarTypes) {
461
+ const annotation = node.typeAnnotation();
462
+ if (annotation === void 0 || annotation.isConstructor()) return false;
463
+ const base = annotation.name()?.identifier()?.name();
464
+ return base !== void 0 && scalarTypes.has(base);
465
+ }
466
+ function nameRange(name, sourceFile) {
467
+ if (name === void 0) return void 0;
468
+ for (const token of name.syntax.tokens()) if (token.kind === "Ident") return {
469
+ start: sourceFile.positionAt(token.offset),
470
+ end: sourceFile.positionAt(token.offset + token.text.length)
471
+ };
472
+ }
473
+ function nodeRange(node, sourceFile) {
474
+ const start = node.offset;
475
+ const end = start + node.green.textLength;
476
+ return {
477
+ start: sourceFile.positionAt(start),
478
+ end: sourceFile.positionAt(end)
479
+ };
480
+ }
481
+ //#endregion
482
+ export { buildSymbolTable, findBlockDescriptor, flatPslModels, getPositionalArgument, keywordPslSpan, namespacePslExtensionBlocks, nodePslSpan, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, validateExtensionBlockFromSymbol };
14
483
 
15
484
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/attribute-helpers.ts"],"sourcesContent":["import type { PslAttribute } from '@prisma-next/framework-components/psl-ast';\n\nexport function getPositionalArgument(attribute: PslAttribute, index = 0): string | undefined {\n const entries = attribute.args.filter((arg) => arg.kind === 'positional');\n return entries[index]?.value;\n}\n\nexport function parseQuotedStringLiteral(value: string): string | undefined {\n const trimmed = value.trim();\n const match = trimmed.match(/^(['\"])(.*)\\1$/);\n if (!match) return undefined;\n return match[2] ?? '';\n}\n"],"mappings":";;;AAEA,SAAgB,sBAAsB,WAAyB,QAAQ,GAAuB;CAE5F,OADgB,UAAU,KAAK,QAAQ,QAAQ,IAAI,SAAS,YAC/C,CAAC,CAAC,MAAM,EAAE;AACzB;AAEA,SAAgB,yBAAyB,OAAmC;CAE1E,MAAM,QADU,MAAM,KACF,CAAC,CAAC,MAAM,gBAAgB;CAC5C,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,OAAO,MAAM,MAAM;AACrB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/attribute-helpers.ts","../src/extension-block.ts","../src/resolve.ts","../src/block-reconstruction.ts","../src/symbol-table.ts"],"sourcesContent":["import type { PslAttribute } from '@prisma-next/framework-components/psl-ast';\n\nexport function getPositionalArgument(attribute: PslAttribute, index = 0): string | undefined {\n const entries = attribute.args.filter((arg) => arg.kind === 'positional');\n return entries[index]?.value;\n}\n\nexport function parseQuotedStringLiteral(value: string): string | undefined {\n const trimmed = value.trim();\n const match = trimmed.match(/^(['\"])(.*)\\1$/);\n if (!match) return undefined;\n return match[2] ?? '';\n}\n","import {\n type AuthoringPslBlockDescriptor,\n type AuthoringPslBlockDescriptorNamespace,\n isAuthoringPslBlockDescriptor,\n} from '@prisma-next/framework-components/authoring';\nimport type { CodecLookup } from '@prisma-next/framework-components/codec';\nimport {\n makePslNamespace,\n makePslNamespaceEntries,\n type PslDiagnostic,\n type PslModel,\n type PslSpan,\n UNSPECIFIED_PSL_NAMESPACE_ID,\n validateExtensionBlock,\n} from '@prisma-next/framework-components/psl-ast';\nimport type { SourceFile } from './source-file';\nimport type { BlockSymbol, ModelSymbol, SymbolTable } from './symbol-table';\n\nexport function findBlockDescriptor(\n descriptors: AuthoringPslBlockDescriptorNamespace | undefined,\n keyword: string,\n): AuthoringPslBlockDescriptor | undefined {\n if (descriptors === undefined) return undefined;\n for (const value of Object.values(descriptors)) {\n if (value === undefined) continue;\n if (isAuthoringPslBlockDescriptor(value)) {\n if (value.keyword === keyword) return value;\n continue;\n }\n const nested = findBlockDescriptor(value, keyword);\n if (nested !== undefined) return nested;\n }\n return undefined;\n}\n\nexport function validateExtensionBlockFromSymbol(input: {\n readonly block: BlockSymbol;\n readonly descriptor: AuthoringPslBlockDescriptor;\n readonly symbolTable: SymbolTable;\n readonly sourceFile: SourceFile;\n readonly sourceId: string;\n readonly codecLookup: CodecLookup;\n}): readonly PslDiagnostic[] {\n const refCtx = buildRefResolutionContext(input.symbolTable, input.block);\n return validateExtensionBlock(\n input.block.block,\n input.descriptor,\n input.sourceId,\n input.codecLookup,\n refCtx,\n );\n}\n\nconst ZERO_SPAN: PslSpan = {\n start: { offset: 0, line: 1, column: 1 },\n end: { offset: 0, line: 1, column: 1 },\n};\n\nfunction buildRefResolutionContext(\n symbolTable: SymbolTable,\n block: BlockSymbol,\n): {\n ownerNamespace: ReturnType<typeof makePslNamespace>;\n allNamespaces: readonly ReturnType<typeof makePslNamespace>[];\n} {\n const unspecifiedNamespace = makeNamespace(\n UNSPECIFIED_PSL_NAMESPACE_ID,\n Object.values(symbolTable.topLevel.models),\n );\n const namedNamespaces = Object.values(symbolTable.topLevel.namespaces).map((namespace) =>\n makeNamespace(namespace.name, Object.values(namespace.models)),\n );\n const allNamespaces = [unspecifiedNamespace, ...namedNamespaces];\n const ownerNamespaceName = findOwnerNamespaceName(symbolTable, block);\n const ownerNamespace =\n allNamespaces.find((namespace) => namespace.name === ownerNamespaceName) ??\n unspecifiedNamespace;\n return { ownerNamespace, allNamespaces };\n}\n\nfunction makeNamespace(\n name: string,\n models: readonly ModelSymbol[],\n): ReturnType<typeof makePslNamespace> {\n const modelStubs: PslModel[] = models.map((model) => ({\n kind: 'model',\n name: model.name,\n fields: [],\n attributes: [],\n span: ZERO_SPAN,\n }));\n return makePslNamespace({\n kind: 'namespace',\n name,\n entries: makePslNamespaceEntries(modelStubs, [], []),\n span: ZERO_SPAN,\n });\n}\n\nfunction findOwnerNamespaceName(symbolTable: SymbolTable, block: BlockSymbol): string {\n for (const namespace of Object.values(symbolTable.topLevel.namespaces)) {\n if (Object.values(namespace.blocks).some((candidate) => candidate === block)) {\n return namespace.name;\n }\n }\n return UNSPECIFIED_PSL_NAMESPACE_ID;\n}\n","import type { PslSpan } from '@prisma-next/framework-components/psl-ast';\nimport type { Position, Range, SourceFile } from './source-file';\nimport type {\n AttributeArgListAst,\n FieldAttributeAst,\n ModelAttributeAst,\n} from './syntax/ast/attributes';\nimport type { ExpressionAst } from './syntax/ast/expressions';\nimport type { QualifiedNameAst } from './syntax/ast/qualified-name';\nimport type { TypeAnnotationAst } from './syntax/ast/type-annotation';\nimport { printSyntax } from './syntax/ast-helpers';\nimport type { SyntaxNode } from './syntax/red';\n\nexport interface ResolvedAttributeArg {\n readonly kind: 'positional' | 'named';\n readonly name?: string;\n readonly value: string;\n readonly span: PslSpan;\n}\n\nexport interface ResolvedAttribute {\n readonly name: string;\n readonly args: readonly ResolvedAttributeArg[];\n readonly span: PslSpan;\n}\n\nexport interface ResolvedTypeConstructorCall {\n readonly path: readonly string[];\n readonly args: readonly ResolvedAttributeArg[];\n readonly span: PslSpan;\n}\n\nexport function readResolvedAttribute(\n attribute: FieldAttributeAst | ModelAttributeAst,\n sourceFile: SourceFile,\n): ResolvedAttribute {\n return {\n name: attributeName(attribute.name()),\n args: readResolvedArgList(attribute.argList(), sourceFile),\n span: nodePslSpan(attribute.syntax, sourceFile),\n };\n}\n\nexport function readResolvedAttributes(\n attributes: Iterable<FieldAttributeAst | ModelAttributeAst>,\n sourceFile: SourceFile,\n): readonly ResolvedAttribute[] {\n return Array.from(attributes, (attribute) => readResolvedAttribute(attribute, sourceFile));\n}\n\nexport function readResolvedConstructorCall(\n annotation: TypeAnnotationAst | undefined,\n sourceFile: SourceFile,\n): ResolvedTypeConstructorCall | undefined {\n const argList = annotation?.argList();\n if (annotation === undefined || argList === undefined) return undefined;\n return {\n path: annotation.name()?.path() ?? [],\n args: readResolvedArgList(argList, sourceFile),\n span: nodePslSpan(annotation.syntax, sourceFile),\n };\n}\n\nfunction readResolvedArgList(\n argList: AttributeArgListAst | undefined,\n sourceFile: SourceFile,\n): readonly ResolvedAttributeArg[] {\n if (argList === undefined) return [];\n const args: ResolvedAttributeArg[] = [];\n for (const arg of argList.args()) {\n const name = arg.name()?.name();\n args.push({\n kind: name !== undefined ? 'named' : 'positional',\n ...(name !== undefined ? { name } : {}),\n value: renderExpression(arg.value()),\n span: nodePslSpan(arg.syntax, sourceFile),\n });\n }\n return args;\n}\n\nfunction attributeName(name: QualifiedNameAst | undefined): string {\n return name?.path().join('.') ?? '';\n}\n\nfunction renderExpression(expression: ExpressionAst | undefined): string {\n if (expression === undefined) return '';\n return printSyntax(expression.syntax).trim();\n}\n\nexport function nodePslSpan(node: SyntaxNode, sourceFile: SourceFile): PslSpan {\n const start = node.offset;\n const end = start + node.green.textLength;\n return {\n start: offsetToPslPosition(start, sourceFile),\n end: offsetToPslPosition(end, sourceFile),\n };\n}\n\n/** Unsupported-top-level-block diagnostics are anchored to the keyword token. */\nexport function keywordPslSpan(node: SyntaxNode, keyword: string, sourceFile: SourceFile): PslSpan {\n const start = node.offset;\n const end = start + keyword.length;\n return {\n start: offsetToPslPosition(start, sourceFile),\n end: offsetToPslPosition(end, sourceFile),\n };\n}\n\nexport function rangeToPslSpan(range: Range, sourceFile: SourceFile): PslSpan {\n return {\n start: offsetToPslPosition(sourceFile.offsetAt(range.start), sourceFile),\n end: offsetToPslPosition(sourceFile.offsetAt(range.end), sourceFile),\n };\n}\n\nfunction offsetToPslPosition(offset: number, sourceFile: SourceFile): PslSpan['start'] {\n const position: Position = sourceFile.positionAt(offset);\n return { offset, line: position.line + 1, column: position.character + 1 };\n}\n","import type { AuthoringPslBlockDescriptor } from '@prisma-next/framework-components/authoring';\nimport type {\n PslBlockParam,\n PslExtensionBlock,\n PslExtensionBlockAttribute,\n PslExtensionBlockParamValue,\n PslSpan,\n} from '@prisma-next/framework-components/psl-ast';\nimport type { ParseDiagnostic } from './parse';\nimport { nodePslSpan } from './resolve';\nimport type { SourceFile } from './source-file';\nimport type { GenericBlockDeclarationAst, KeyValuePairAst } from './syntax/ast/declarations';\nimport { ArrayLiteralAst, type ExpressionAst } from './syntax/ast/expressions';\nimport { printSyntax } from './syntax/ast-helpers';\n\n/**\n * Descriptor-free and unknown parameters become `value` stubs so validation can\n * report them via key-set comparison. Duplicate member names are first-wins.\n */\nexport function reconstructExtensionBlock(\n node: GenericBlockDeclarationAst,\n descriptor: AuthoringPslBlockDescriptor | undefined,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): PslExtensionBlock {\n const keyword = node.keyword()?.text ?? '';\n const blockName = node.name()?.name() ?? '';\n\n const blockAttributes: PslExtensionBlockAttribute[] = [];\n for (const attribute of node.attributes()) {\n const name = attribute.name()?.path().join('.') ?? '';\n const args = Array.from(attribute.argList()?.args() ?? [], (arg) => {\n const value = arg.value();\n return {\n kind: 'positional' as const,\n value: value === undefined ? '' : printSyntax(value.syntax).trim(),\n span: nodePslSpan(arg.syntax, sourceFile),\n };\n });\n blockAttributes.push({\n name,\n args,\n span: nodePslSpan(attribute.syntax, sourceFile),\n });\n }\n\n const parameters: Record<string, PslExtensionBlockParamValue> = {};\n for (const entry of node.entries()) {\n const key = entry.key()?.name();\n if (key === undefined) continue;\n const span = nodePslSpan(entry.syntax, sourceFile);\n if (Object.hasOwn(parameters, key)) {\n diagnostics.push({\n code: 'PSL_EXTENSION_DUPLICATE_PARAMETER',\n message: `Duplicate parameter \"${key}\" in \"${keyword}\" block \"${blockName}\"; first occurrence wins`,\n range: {\n start: sourceFile.positionAt(entry.syntax.offset),\n end: sourceFile.positionAt(entry.syntax.offset + entry.syntax.green.textLength),\n },\n });\n continue;\n }\n parameters[key] = reconstructParamValue(\n entry,\n descriptor?.parameters[key],\n span,\n sourceFile,\n diagnostics,\n );\n }\n\n return {\n kind: descriptor?.discriminator ?? keyword,\n name: blockName,\n parameters,\n blockAttributes,\n span: nodePslSpan(node.syntax, sourceFile),\n };\n}\n\nfunction reconstructParamValue(\n entry: KeyValuePairAst,\n param: PslBlockParam | undefined,\n span: PslSpan,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): PslExtensionBlockParamValue {\n const value = entry.value();\n if (value === undefined) {\n return { kind: 'bare', span };\n }\n return reconstructFromExpression(value, param, span, sourceFile, diagnostics);\n}\n\nfunction reconstructFromExpression(\n value: ExpressionAst,\n param: PslBlockParam | undefined,\n span: PslSpan,\n sourceFile: SourceFile,\n diagnostics?: ParseDiagnostic[],\n): PslExtensionBlockParamValue {\n const raw = printSyntax(value.syntax).trim();\n if (param?.kind === 'list') {\n const array = ArrayLiteralAst.cast(value.syntax);\n if (!array) {\n diagnostics?.push({\n code: 'PSL_EXTENSION_INVALID_VALUE',\n message: `List parameter expects an array literal, got ${raw}`,\n range: {\n start: sourceFile.positionAt(value.syntax.offset),\n end: sourceFile.positionAt(value.syntax.offset + value.syntax.green.textLength),\n },\n });\n return { kind: 'value', raw, span };\n }\n\n const items: PslExtensionBlockParamValue[] = [];\n for (const element of array.elements()) {\n items.push(\n reconstructFromExpression(\n element,\n param.of,\n nodePslSpan(element.syntax, sourceFile),\n sourceFile,\n diagnostics,\n ),\n );\n }\n return { kind: 'list', items, span };\n }\n switch (param?.kind) {\n case 'ref':\n return { kind: 'ref', identifier: raw, span };\n case 'option':\n return { kind: 'option', token: raw, span };\n default:\n return { kind: 'value', raw, span };\n }\n}\n","import type { AuthoringPslBlockDescriptorNamespace } from '@prisma-next/framework-components/authoring';\nimport type { PslExtensionBlock, PslSpan } from '@prisma-next/framework-components/psl-ast';\nimport { reconstructExtensionBlock } from './block-reconstruction';\nimport { findBlockDescriptor } from './extension-block';\nimport type { ParseDiagnostic } from './parse';\nimport {\n nodePslSpan,\n type ResolvedAttribute,\n type ResolvedTypeConstructorCall,\n readResolvedAttributes,\n readResolvedConstructorCall,\n} from './resolve';\nimport type { Range, SourceFile } from './source-file';\nimport {\n CompositeTypeDeclarationAst,\n type DocumentAst,\n type FieldDeclarationAst,\n GenericBlockDeclarationAst,\n ModelDeclarationAst,\n type NamedTypeDeclarationAst,\n NamespaceDeclarationAst,\n TypesBlockAst,\n} from './syntax/ast/declarations';\nimport type { IdentifierAst } from './syntax/ast/identifier';\nimport type { SyntaxNode } from './syntax/red';\n\nexport type {\n ResolvedAttribute,\n ResolvedAttributeArg,\n ResolvedTypeConstructorCall,\n} from './resolve';\n\nexport interface SymbolTable {\n readonly topLevel: TopLevelScope;\n}\n\nexport interface TopLevelScope {\n readonly namespaces: Record<string, NamespaceSymbol>;\n readonly scalars: Record<string, ScalarSymbol>;\n readonly typeAliases: Record<string, TypeAliasSymbol>;\n readonly blocks: Record<string, BlockSymbol>;\n readonly models: Record<string, ModelSymbol>;\n readonly compositeTypes: Record<string, CompositeTypeSymbol>;\n}\n\nexport interface NamespaceSymbol {\n readonly kind: 'namespace';\n readonly name: string;\n readonly node: NamespaceDeclarationAst;\n readonly span: PslSpan;\n readonly models: Record<string, ModelSymbol>;\n readonly compositeTypes: Record<string, CompositeTypeSymbol>;\n readonly blocks: Record<string, BlockSymbol>;\n}\n\nexport interface ModelSymbol {\n readonly kind: 'model';\n readonly name: string;\n readonly node: ModelDeclarationAst;\n readonly span: PslSpan;\n readonly fields: Record<string, FieldSymbol>;\n readonly attributes: readonly ResolvedAttribute[];\n}\n\nexport interface CompositeTypeSymbol {\n readonly kind: 'compositeType';\n readonly name: string;\n readonly node: CompositeTypeDeclarationAst;\n readonly span: PslSpan;\n readonly fields: Record<string, FieldSymbol>;\n readonly attributes: readonly ResolvedAttribute[];\n}\n\nexport interface BlockSymbol {\n readonly kind: 'block';\n readonly name: string;\n readonly keyword: string;\n readonly node: GenericBlockDeclarationAst;\n readonly span: PslSpan;\n /** Resolved once so consumers do not independently classify block parameters. */\n readonly block: PslExtensionBlock;\n}\n\nexport interface ResolvedNamedTypeBinding {\n readonly baseType?: string;\n readonly typeConstructor?: ResolvedTypeConstructorCall;\n readonly isConstructor: boolean;\n readonly attributes: readonly ResolvedAttribute[];\n}\n\nexport interface ScalarSymbol extends ResolvedNamedTypeBinding {\n readonly kind: 'scalar';\n readonly name: string;\n readonly node: NamedTypeDeclarationAst;\n readonly span: PslSpan;\n}\n\nexport interface TypeAliasSymbol extends ResolvedNamedTypeBinding {\n readonly kind: 'typeAlias';\n readonly name: string;\n readonly node: NamedTypeDeclarationAst;\n readonly span: PslSpan;\n}\n\nexport interface FieldSymbol {\n readonly kind: 'field';\n readonly name: string;\n readonly node: FieldDeclarationAst;\n readonly span: PslSpan;\n readonly typeName: string;\n readonly typeNamespaceId?: string;\n readonly typeContractSpaceId?: string;\n readonly optional: boolean;\n readonly list: boolean;\n readonly typeConstructor?: ResolvedTypeConstructorCall;\n readonly attributes: readonly ResolvedAttribute[];\n /** Prevents cascading unsupported-type diagnostics after invalid qualification. */\n readonly malformedType?: boolean;\n}\n\nexport interface BuildSymbolTableOptions {\n readonly document: DocumentAst;\n readonly sourceFile: SourceFile;\n readonly scalarTypes: readonly string[];\n readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;\n}\n\nexport interface SymbolTableResult {\n readonly table: SymbolTable;\n readonly diagnostics: readonly ParseDiagnostic[];\n}\n\n/**\n * Owns duplicate-declaration detection for all PSL scopes; downstream consumers\n * should consume first-wins symbols rather than re-emitting duplicate diagnostics.\n */\nexport function buildSymbolTable(options: BuildSymbolTableOptions): SymbolTableResult {\n const { document, sourceFile, scalarTypes, pslBlockDescriptors } = options;\n const diagnostics: ParseDiagnostic[] = [];\n const scalarSet = new Set(scalarTypes);\n\n const namespaces: Record<string, NamespaceSymbol> = {};\n const scalars: Record<string, ScalarSymbol> = {};\n const typeAliases: Record<string, TypeAliasSymbol> = {};\n const blocks: Record<string, BlockSymbol> = {};\n const models: Record<string, ModelSymbol> = {};\n const compositeTypes: Record<string, CompositeTypeSymbol> = {};\n const topLevelNames = new Set<string>();\n\n const claim = (taken: Set<string>, name: IdentifierAst | undefined): string | undefined => {\n const text = name?.name();\n if (text === undefined) return undefined;\n if (taken.has(text)) {\n const range = nameRange(name, sourceFile);\n if (range) {\n diagnostics.push({\n code: 'PSL_DUPLICATE_DECLARATION',\n message: `Duplicate declaration of \"${text}\"`,\n range,\n });\n }\n return undefined;\n }\n taken.add(text);\n return text;\n };\n\n for (const declaration of document.declarations()) {\n if (declaration instanceof ModelDeclarationAst) {\n const name = claim(topLevelNames, declaration.name());\n if (name !== undefined) models[name] = buildModel(name, declaration, sourceFile, diagnostics);\n } else if (declaration instanceof CompositeTypeDeclarationAst) {\n const name = claim(topLevelNames, declaration.name());\n if (name !== undefined) {\n compositeTypes[name] = buildCompositeType(name, declaration, sourceFile, diagnostics);\n }\n } else if (declaration instanceof GenericBlockDeclarationAst) {\n const name = claim(topLevelNames, declaration.name());\n if (name !== undefined) {\n blocks[name] = buildBlock(name, declaration, sourceFile, pslBlockDescriptors, diagnostics);\n }\n } else if (declaration instanceof NamespaceDeclarationAst) {\n const name = claim(topLevelNames, declaration.name());\n if (name !== undefined) {\n namespaces[name] = buildNamespace(\n name,\n declaration,\n diagnostics,\n sourceFile,\n pslBlockDescriptors,\n );\n }\n } else if (declaration instanceof TypesBlockAst) {\n for (const binding of declaration.declarations()) {\n const name = claim(topLevelNames, binding.name());\n if (name === undefined) continue;\n const resolved = resolveNamedTypeBinding(binding, sourceFile);\n const span = nodePslSpan(binding.syntax, sourceFile);\n if (isScalarBinding(binding, scalarSet)) {\n scalars[name] = { kind: 'scalar', name, node: binding, span, ...resolved };\n } else {\n typeAliases[name] = { kind: 'typeAlias', name, node: binding, span, ...resolved };\n }\n }\n }\n }\n\n const table: SymbolTable = {\n topLevel: { namespaces, scalars, typeAliases, blocks, models, compositeTypes },\n };\n return { table, diagnostics };\n}\n\nfunction buildModel(\n name: string,\n node: ModelDeclarationAst,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): ModelSymbol {\n return {\n kind: 'model',\n name,\n node,\n span: nodePslSpan(node.syntax, sourceFile),\n fields: buildFields(name, node.fields(), sourceFile, diagnostics),\n attributes: readResolvedAttributes(node.attributes(), sourceFile),\n };\n}\n\nfunction buildCompositeType(\n name: string,\n node: CompositeTypeDeclarationAst,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): CompositeTypeSymbol {\n return {\n kind: 'compositeType',\n name,\n node,\n span: nodePslSpan(node.syntax, sourceFile),\n fields: buildFields(name, node.fields(), sourceFile, diagnostics),\n attributes: readResolvedAttributes(node.attributes(), sourceFile),\n };\n}\n\nfunction buildBlock(\n name: string,\n node: GenericBlockDeclarationAst,\n sourceFile: SourceFile,\n pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace,\n diagnostics: ParseDiagnostic[],\n): BlockSymbol {\n const keyword = node.keyword()?.text ?? '';\n const descriptor = findBlockDescriptor(pslBlockDescriptors, keyword);\n return {\n kind: 'block',\n name,\n keyword,\n node,\n span: nodePslSpan(node.syntax, sourceFile),\n block: reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics),\n };\n}\n\nfunction buildNamespace(\n name: string,\n node: NamespaceDeclarationAst,\n diagnostics: ParseDiagnostic[],\n sourceFile: SourceFile,\n pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace,\n): NamespaceSymbol {\n const models: Record<string, ModelSymbol> = {};\n const compositeTypes: Record<string, CompositeTypeSymbol> = {};\n const blocks: Record<string, BlockSymbol> = {};\n const taken = new Set<string>();\n\n for (const member of node.declarations()) {\n const memberName = member.name()?.name();\n if (memberName === undefined) continue;\n if (taken.has(memberName)) {\n const range = nameRange(member.name(), sourceFile);\n if (range) {\n diagnostics.push({\n code: 'PSL_DUPLICATE_DECLARATION',\n message: `Duplicate declaration of \"${memberName}\"`,\n range,\n });\n }\n continue;\n }\n taken.add(memberName);\n if (member instanceof ModelDeclarationAst) {\n models[memberName] = buildModel(memberName, member, sourceFile, diagnostics);\n } else if (member instanceof CompositeTypeDeclarationAst) {\n compositeTypes[memberName] = buildCompositeType(memberName, member, sourceFile, diagnostics);\n } else if (member instanceof GenericBlockDeclarationAst) {\n blocks[memberName] = buildBlock(\n memberName,\n member,\n sourceFile,\n pslBlockDescriptors,\n diagnostics,\n );\n }\n }\n\n return {\n kind: 'namespace',\n name,\n node,\n span: nodePslSpan(node.syntax, sourceFile),\n models,\n compositeTypes,\n blocks,\n };\n}\n\nfunction buildFields(\n ownerName: string,\n fields: Iterable<FieldDeclarationAst>,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): Record<string, FieldSymbol> {\n const result: Record<string, FieldSymbol> = {};\n for (const field of fields) {\n const nameNode = field.name();\n const name = nameNode?.name();\n if (name === undefined) continue;\n if (Object.hasOwn(result, name)) {\n const range = nameRange(nameNode, sourceFile);\n if (range) {\n diagnostics.push({\n code: 'PSL_DUPLICATE_DECLARATION',\n message: `Duplicate declaration of \"${name}\"`,\n range,\n });\n }\n continue;\n }\n result[name] = buildField(ownerName, name, field, sourceFile, diagnostics);\n }\n return result;\n}\n\nfunction buildField(\n ownerName: string,\n name: string,\n node: FieldDeclarationAst,\n sourceFile: SourceFile,\n diagnostics: ParseDiagnostic[],\n): FieldSymbol {\n const attributes = readResolvedAttributes(node.attributes(), sourceFile);\n const span = nodePslSpan(node.syntax, sourceFile);\n const annotation = node.typeAnnotation();\n const typeName = annotation?.name();\n\n if (typeName?.isOverQualified()) {\n const path = typeName.path();\n diagnostics.push({\n code: 'PSL_INVALID_QUALIFIED_TYPE',\n message: `Field \"${ownerName}.${name}\" has an invalid qualified type \"${path.join('.')}\"; use at most one namespace qualifier (e.g. \"ns.TypeName\")`,\n range: nodeRange(typeName.syntax, sourceFile),\n });\n return {\n kind: 'field',\n name,\n node,\n span,\n typeName: path[path.length - 1] ?? '',\n optional: false,\n list: false,\n malformedType: true,\n attributes,\n };\n }\n\n const typeConstructor = annotation?.isConstructor()\n ? readResolvedConstructorCall(annotation, sourceFile)\n : undefined;\n const typeNamespaceId = typeName?.namespace()?.name();\n const typeContractSpaceId = typeName?.space()?.name();\n\n return {\n kind: 'field',\n name,\n node,\n span,\n typeName: typeName?.identifier()?.name() ?? '',\n ...(typeNamespaceId !== undefined ? { typeNamespaceId } : {}),\n ...(typeContractSpaceId !== undefined ? { typeContractSpaceId } : {}),\n optional: annotation?.isOptional() ?? false,\n list: annotation?.isList() ?? false,\n ...(typeConstructor !== undefined ? { typeConstructor } : {}),\n attributes,\n };\n}\n\nfunction resolveNamedTypeBinding(\n node: NamedTypeDeclarationAst,\n sourceFile: SourceFile,\n): {\n baseType?: string;\n typeConstructor?: ResolvedTypeConstructorCall;\n isConstructor: boolean;\n attributes: readonly ResolvedAttribute[];\n} {\n const annotation = node.typeAnnotation();\n const isConstructor = annotation?.isConstructor() ?? false;\n const baseType = annotation?.name()?.identifier()?.name();\n const typeConstructor = readResolvedConstructorCall(annotation, sourceFile);\n return {\n isConstructor,\n ...(!isConstructor && baseType !== undefined ? { baseType } : {}),\n ...(typeConstructor !== undefined ? { typeConstructor } : {}),\n attributes: readResolvedAttributes(node.attributes(), sourceFile),\n };\n}\n\nfunction isScalarBinding(node: NamedTypeDeclarationAst, scalarTypes: Set<string>): boolean {\n const annotation = node.typeAnnotation();\n if (annotation === undefined || annotation.isConstructor()) return false;\n const base = annotation.name()?.identifier()?.name();\n return base !== undefined && scalarTypes.has(base);\n}\n\nfunction nameRange(name: IdentifierAst | undefined, sourceFile: SourceFile): Range | undefined {\n if (name === undefined) return undefined;\n for (const token of name.syntax.tokens()) {\n if (token.kind === 'Ident') {\n return {\n start: sourceFile.positionAt(token.offset),\n end: sourceFile.positionAt(token.offset + token.text.length),\n };\n }\n }\n return undefined;\n}\n\nfunction nodeRange(node: SyntaxNode, sourceFile: SourceFile): Range {\n const start = node.offset;\n const end = start + node.green.textLength;\n return {\n start: sourceFile.positionAt(start),\n end: sourceFile.positionAt(end),\n };\n}\n"],"mappings":";;;;AAEA,SAAgB,sBAA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