🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/psl-parser

Package Overview
Dependencies
Maintainers
4
Versions
643
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/psl-parser - npm Package Compare versions

Comparing version
0.16.0-dev.11
to
0.16.0-dev.12
+123
dist/symbol-table-DVspQ58_.d.mts
import { $ as Range, H as SyntaxNode, T as ExpressionAst, b as FieldAttributeAst, c as DocumentAst, et as SourceFile, h as NamespaceDeclarationAst, l as FieldDeclarationAst, m as NamedTypeDeclarationAst, o as CompositeTypeDeclarationAst, p as ModelDeclarationAst, t as ParseDiagnostic, u as GenericBlockDeclarationAst, v as TypeAnnotationAst, x as ModelAttributeAst } from "./parse-Bl1gwWGn.mjs";
import { PslExtensionBlock, PslSpan } from "@prisma-next/framework-components/psl-ast";
import { AuthoringPslBlockDescriptorNamespace } from "@prisma-next/framework-components/authoring";
//#region src/resolve.d.ts
interface ResolvedAttributeArg {
readonly kind: 'positional' | 'named';
readonly name?: string;
readonly value: string;
readonly expression?: ExpressionAst;
readonly span: PslSpan;
}
interface ResolvedAttribute {
readonly name: string;
readonly args: readonly ResolvedAttributeArg[];
readonly span: PslSpan;
}
interface ResolvedTypeConstructorCall {
readonly path: readonly string[];
readonly args: readonly ResolvedAttributeArg[];
readonly span: PslSpan;
}
declare function readResolvedAttribute(attribute: FieldAttributeAst | ModelAttributeAst, sourceFile: SourceFile): ResolvedAttribute;
declare function readResolvedAttributes(attributes: Iterable<FieldAttributeAst | ModelAttributeAst>, sourceFile: SourceFile): readonly ResolvedAttribute[];
declare function readResolvedConstructorCall(annotation: TypeAnnotationAst | undefined, sourceFile: SourceFile): ResolvedTypeConstructorCall | undefined;
declare function nodePslSpan(node: SyntaxNode, sourceFile: SourceFile): PslSpan;
/** Unsupported-top-level-block diagnostics are anchored to the keyword token. */
declare function keywordPslSpan(node: SyntaxNode, keyword: string, sourceFile: SourceFile): PslSpan;
declare function rangeToPslSpan(range: Range, sourceFile: SourceFile): PslSpan;
//#endregion
//#region src/symbol-table.d.ts
interface SymbolTable {
readonly topLevel: TopLevelScope;
}
interface TopLevelScope {
readonly namespaces: Record<string, NamespaceSymbol>;
readonly namedTypes: Record<string, NamedTypeSymbol>;
readonly blocks: Record<string, BlockSymbol>;
readonly models: Record<string, ModelSymbol>;
readonly compositeTypes: Record<string, CompositeTypeSymbol>;
}
interface NamespaceSymbol {
readonly kind: 'namespace';
readonly name: string;
readonly node: NamespaceDeclarationAst;
readonly span: PslSpan;
readonly models: Record<string, ModelSymbol>;
readonly compositeTypes: Record<string, CompositeTypeSymbol>;
readonly blocks: Record<string, BlockSymbol>;
}
interface ModelSymbol {
readonly kind: 'model';
readonly name: string;
readonly node: ModelDeclarationAst;
readonly span: PslSpan;
readonly fields: Record<string, FieldSymbol>;
readonly attributes: readonly ResolvedAttribute[];
}
interface CompositeTypeSymbol {
readonly kind: 'compositeType';
readonly name: string;
readonly node: CompositeTypeDeclarationAst;
readonly span: PslSpan;
readonly fields: Record<string, FieldSymbol>;
readonly attributes: readonly ResolvedAttribute[];
}
interface BlockSymbol {
readonly kind: 'block';
readonly name: string;
readonly keyword: string;
readonly node: GenericBlockDeclarationAst;
readonly span: PslSpan;
/** Resolved once so consumers do not independently classify block parameters. */
readonly block: PslExtensionBlock;
}
interface ResolvedNamedTypeBinding {
readonly baseType?: string;
readonly typeConstructor?: ResolvedTypeConstructorCall;
readonly isConstructor: boolean;
readonly attributes: readonly ResolvedAttribute[];
}
/**
* A `types {}` binding, collected without classification: whether the binding
* refines a target scalar is pronounced by the interpreter
* (`resolveNamedTypeDeclarations`), not by the family-blind symbol table.
*/
interface NamedTypeSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'namedType';
readonly name: string;
readonly node: NamedTypeDeclarationAst;
readonly span: PslSpan;
}
interface FieldSymbol {
readonly kind: 'field';
readonly name: string;
readonly node: FieldDeclarationAst;
readonly span: PslSpan;
readonly typeName: string;
readonly typeNamespaceId?: string;
readonly typeContractSpaceId?: string;
readonly optional: boolean;
readonly list: boolean;
readonly typeConstructor?: ResolvedTypeConstructorCall;
readonly attributes: readonly ResolvedAttribute[];
/** Prevents cascading unsupported-type diagnostics after invalid qualification. */
readonly malformedType?: boolean;
}
interface BuildSymbolTableOptions {
readonly document: DocumentAst;
readonly sourceFile: SourceFile;
readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;
}
interface SymbolTableResult {
readonly table: SymbolTable;
readonly diagnostics: readonly ParseDiagnostic[];
}
/**
* Owns duplicate-declaration detection for all PSL scopes; downstream consumers
* should consume first-wins symbols rather than re-emitting duplicate diagnostics.
*/
declare function buildSymbolTable(options: BuildSymbolTableOptions): SymbolTableResult;
//#endregion
export { nodePslSpan as _, ModelSymbol as a, readResolvedAttributes as b, ResolvedNamedTypeBinding as c, TopLevelScope as d, buildSymbolTable as f, keywordPslSpan as g, ResolvedTypeConstructorCall as h, FieldSymbol as i, SymbolTable as l, ResolvedAttributeArg as m, BuildSymbolTableOptions as n, NamedTypeSymbol as o, ResolvedAttribute as p, CompositeTypeSymbol as r, NamespaceSymbol as s, BlockSymbol as t, SymbolTableResult as u, rangeToPslSpan as v, readResolvedConstructorCall as x, readResolvedAttribute as y };
//# sourceMappingURL=symbol-table-DVspQ58_.d.mts.map
{"version":3,"file":"symbol-table-DVspQ58_.d.mts","names":[],"sources":["../src/resolve.ts","../src/symbol-table.ts"],"mappings":";;;;UAaiB;WACN;WACA;WACA;WACA,aAAa;WACb,MAAM;;UAGA;WACN;WACA,eAAe;WACf,MAAM;;UAGA;WACN;WACA,eAAe;WACf,MAAM;;iBAGD,sBACd,WAAW,oBAAoB,mBAC/B,YAAY,aACX;iBAQa,uBACd,YAAY,SAAS,oBAAoB,oBACzC,YAAY,sBACF;iBAII,4BACd,YAAY,+BACZ,YAAY,aACX;iBAuCa,YAAY,MAAM,YAAY,YAAY,aAAa;;iBAUvD,eAAe,MAAM,YAAY,iBAAiB,YAAY,aAAa;iBAS3E,eAAe,OAAO,OAAO,YAAY,aAAa;;;UChFrD;WACN,UAAU;;UAGJ;WACN,YAAY,eAAe;WAC3B,YAAY,eAAe;WAC3B,QAAQ,eAAe;WACvB,QAAQ,eAAe;WACvB,gBAAgB,eAAe;;UAGzB;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,gBAAgB,eAAe;WAC/B,QAAQ,eAAe;;UAGjB;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,qBAAqB;;UAGf;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,qBAAqB;;UAGf;WACN;WACA;WACA;WACA,MAAM;WACN,MAAM;;WAEN,OAAO;;UAGD;WACN;WACA,kBAAkB;WAClB;WACA,qBAAqB;;;;;;;UAQf,wBAAwB;WAC9B;WACA;WACA,MAAM;WACN,MAAM;;UAGA;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN;WACA;WACA;WACA;WACA;WACA,kBAAkB;WAClB,qBAAqB;;WAErB;;UAGM;WACN,UAAU;WACV,YAAY;WACZ,qBAAqB;;UAGf;WACN,OAAO;WACP,sBAAsB;;;;;;iBAOjB,iBAAiB,SAAS,0BAA0B"}
+2
-2
import { C as AttributeArgAst, P as AstNode, T as ExpressionAst, b as FieldAttributeAst, et as SourceFile, x as ModelAttributeAst } from "./parse-Bl1gwWGn.mjs";
import { S as readResolvedConstructorCall, _ as keywordPslSpan, a as ModelSymbol, b as readResolvedAttribute, c as ScalarSymbol, d as TopLevelScope, f as TypeAliasSymbol, g as ResolvedTypeConstructorCall, h as ResolvedAttributeArg, i as FieldSymbol, l as SymbolTable, m as ResolvedAttribute, n as BuildSymbolTableOptions, o as NamespaceSymbol, p as buildSymbolTable, r as CompositeTypeSymbol, s as ResolvedNamedTypeBinding, t as BlockSymbol, u as SymbolTableResult, v as nodePslSpan, x as readResolvedAttributes, y as rangeToPslSpan } from "./symbol-table-en_Bich3.mjs";
import { _ as nodePslSpan, a as ModelSymbol, b as readResolvedAttributes, c as ResolvedNamedTypeBinding, d as TopLevelScope, f as buildSymbolTable, g as keywordPslSpan, h as ResolvedTypeConstructorCall, i as FieldSymbol, l as SymbolTable, m as ResolvedAttributeArg, n as BuildSymbolTableOptions, o as NamedTypeSymbol, p as ResolvedAttribute, r as CompositeTypeSymbol, s as NamespaceSymbol, t as BlockSymbol, u as SymbolTableResult, v as rangeToPslSpan, x as readResolvedConstructorCall, y as readResolvedAttribute } from "./symbol-table-DVspQ58_.mjs";
import { PslAttribute, PslAttribute as PslAttribute$1, PslAttributeArgument, PslAttributeNamedArgument, PslAttributePositionalArgument, PslAttributeTarget, PslCompositeType, PslDefaultFunctionValue, PslDefaultLiteralValue, PslDefaultValue, PslDiagnostic, PslDiagnostic as PslDiagnostic$1, PslDiagnosticCode, PslDiagnosticCode as PslDiagnosticCode$1, PslDocumentAst, PslExtensionBlock, PslExtensionBlockAttribute, PslExtensionBlockAttributeArg, PslExtensionBlockParamBare, PslExtensionBlockParamList, PslExtensionBlockParamOption, PslExtensionBlockParamRef, PslExtensionBlockParamScalarValue, PslExtensionBlockParamValue, PslField, PslFieldAttribute, PslModel, PslModelAttribute, PslNamedTypeDeclaration, PslNamespace, PslPosition, PslSpan, PslSpan as PslSpan$1, PslTypeConstructorCall, PslTypesBlock, flatPslModels, namespacePslExtensionBlocks } from "@prisma-next/framework-components/psl-ast";

@@ -148,3 +148,3 @@ import { Result } from "@prisma-next/utils/result";

//#endregion
export { type ArgBindingSpec, type ArgType, type AttributeLevel, type AttributeOut, type AttributeSpec, type BlockSymbol, type BuildSymbolTableOptions, type CompositeTypeSymbol, type FieldRefArgType, type FieldRefScope, type FieldSymbol, type FuncCallSig, type InferAttr, type InterpretCtx, type ListOptions, type ModelSymbol, type NamedOut, type NamespaceSymbol, type OptionalArgType, type OutOf, type Param, type PosOut, type PositionalParam, type PslAttribute, type PslAttributeArgument, type PslAttributeNamedArgument, type PslAttributePositionalArgument, type PslAttributeTarget, type PslCompositeType, type PslDefaultFunctionValue, type PslDefaultLiteralValue, type PslDefaultValue, type PslDiagnostic, type PslDiagnosticCode, type PslDocumentAst, type PslExtensionBlock, type PslExtensionBlockAttribute, type PslExtensionBlockAttributeArg, type PslExtensionBlockParamBare, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, type PslField, type PslFieldAttribute, type PslModel, type PslModelAttribute, type PslNamedTypeDeclaration, type PslNamespace, type PslPosition, type PslSpan, type PslTypeConstructorCall, type PslTypesBlock, type ResolvedAttribute, type ResolvedAttributeArg, type ResolvedNamedTypeBinding, type ResolvedTypeConstructorCall, type ScalarSymbol, type SymbolTable, type SymbolTableResult, type TopLevelScope, type TypeAliasSymbol, type TypedFuncCall, bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, str, validateExtensionBlockFromSymbol };
export { type ArgBindingSpec, type ArgType, type AttributeLevel, type AttributeOut, type AttributeSpec, type BlockSymbol, type BuildSymbolTableOptions, type CompositeTypeSymbol, type FieldRefArgType, type FieldRefScope, type FieldSymbol, type FuncCallSig, type InferAttr, type InterpretCtx, type ListOptions, type ModelSymbol, type NamedOut, type NamedTypeSymbol, type NamespaceSymbol, type OptionalArgType, type OutOf, type Param, type PosOut, type PositionalParam, type PslAttribute, type PslAttributeArgument, type PslAttributeNamedArgument, type PslAttributePositionalArgument, type PslAttributeTarget, type PslCompositeType, type PslDefaultFunctionValue, type PslDefaultLiteralValue, type PslDefaultValue, type PslDiagnostic, type PslDiagnosticCode, type PslDocumentAst, type PslExtensionBlock, type PslExtensionBlockAttribute, type PslExtensionBlockAttributeArg, type PslExtensionBlockParamBare, type PslExtensionBlockParamList, type PslExtensionBlockParamOption, type PslExtensionBlockParamRef, type PslExtensionBlockParamScalarValue, type PslExtensionBlockParamValue, type PslField, type PslFieldAttribute, type PslModel, type PslModelAttribute, type PslNamedTypeDeclaration, type PslNamespace, type PslPosition, type PslSpan, type PslTypeConstructorCall, type PslTypesBlock, type ResolvedAttribute, type ResolvedAttributeArg, type ResolvedNamedTypeBinding, type ResolvedTypeConstructorCall, type SymbolTable, type SymbolTableResult, type TopLevelScope, type TypedFuncCall, bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, str, validateExtensionBlockFromSymbol };
//# sourceMappingURL=index.d.mts.map

@@ -632,8 +632,6 @@ import { _ as FunctionCallAst, b as ObjectLiteralExprAst, c as NamespaceDeclarationAst, g as BooleanLiteralExprAst, i as GenericBlockDeclarationAst, k as printSyntax, l as TypesBlockAst, m as ArrayLiteralAst, o as ModelDeclarationAst, t as CompositeTypeDeclarationAst, v as NumberLiteralExprAst, w as IdentifierAst, x as StringLiteralExprAst } from "./declarations-DR6To8_k.mjs";

function buildSymbolTable(options) {
const { document, sourceFile, scalarTypes, pslBlockDescriptors } = options;
const { document, sourceFile, pslBlockDescriptors } = options;
const diagnostics = [];
const scalarSet = new Set(scalarTypes);
const namespaces = {};
const scalars = {};
const typeAliases = {};
const namedTypes = {};
const blocks = {};

@@ -674,17 +672,9 @@ const models = {};

const resolved = resolveNamedTypeBinding(binding, sourceFile);
const span = nodePslSpan(binding.syntax, sourceFile);
if (isScalarBinding(binding, scalarSet)) scalars[name] = {
kind: "scalar",
namedTypes[name] = {
kind: "namedType",
name,
node: binding,
span,
span: nodePslSpan(binding.syntax, sourceFile),
...resolved
};
else typeAliases[name] = {
kind: "typeAlias",
name,
node: binding,
span,
...resolved
};
}

@@ -694,4 +684,3 @@ return {

namespaces,
scalars,
typeAliases,
namedTypes,
blocks,

@@ -840,8 +829,2 @@ models,

}
function isScalarBinding(node, scalarTypes) {
const annotation = node.typeAnnotation();
if (annotation === void 0 || annotation.isConstructor()) return false;
const base = annotation.name()?.identifier()?.name();
return base !== void 0 && scalarTypes.has(base);
}
function nameRange(name, sourceFile) {

@@ -848,0 +831,0 @@ if (name === void 0) return void 0;

import { c as DocumentAst, et as SourceFile } from "./parse-Bl1gwWGn.mjs";
import { l as SymbolTable } from "./symbol-table-en_Bich3.mjs";
import { l as SymbolTable } from "./symbol-table-DVspQ58_.mjs";
import { Result } from "@prisma-next/utils/result";

@@ -4,0 +4,0 @@ import { ContractSourceContext, ContractSourceDiagnostic, ContractSourceDiagnostics, ContractSourceProvider, PslContractSourceProvider } from "@prisma-next/config/config-types";

{
"name": "@prisma-next/psl-parser",
"version": "0.16.0-dev.11",
"version": "0.16.0-dev.12",
"license": "Apache-2.0",

@@ -9,10 +9,10 @@ "type": "module",

"dependencies": {
"@prisma-next/config": "0.16.0-dev.11",
"@prisma-next/contract": "0.16.0-dev.11",
"@prisma-next/framework-components": "0.16.0-dev.11",
"@prisma-next/utils": "0.16.0-dev.11"
"@prisma-next/config": "0.16.0-dev.12",
"@prisma-next/contract": "0.16.0-dev.12",
"@prisma-next/framework-components": "0.16.0-dev.12",
"@prisma-next/utils": "0.16.0-dev.12"
},
"devDependencies": {
"@prisma-next/tsconfig": "0.16.0-dev.11",
"@prisma-next/tsdown": "0.16.0-dev.11",
"@prisma-next/tsconfig": "0.16.0-dev.12",
"@prisma-next/tsdown": "0.16.0-dev.12",
"tsdown": "0.22.8",

@@ -19,0 +19,0 @@ "typescript": "5.9.3",

@@ -88,2 +88,3 @@ export type {

ModelSymbol,
NamedTypeSymbol,
NamespaceSymbol,

@@ -94,8 +95,6 @@ ResolvedAttribute,

ResolvedTypeConstructorCall,
ScalarSymbol,
SymbolTable,
SymbolTableResult,
TopLevelScope,
TypeAliasSymbol,
} from '../symbol-table';
export { buildSymbolTable } from '../symbol-table';

@@ -39,4 +39,3 @@ import type { AuthoringPslBlockDescriptorNamespace } from '@prisma-next/framework-components/authoring';

readonly namespaces: Record<string, NamespaceSymbol>;
readonly scalars: Record<string, ScalarSymbol>;
readonly typeAliases: Record<string, TypeAliasSymbol>;
readonly namedTypes: Record<string, NamedTypeSymbol>;
readonly blocks: Record<string, BlockSymbol>;

@@ -92,4 +91,9 @@ readonly models: Record<string, ModelSymbol>;

export interface ScalarSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'scalar';
/**
* A `types {}` binding, collected without classification: whether the binding
* refines a target scalar is pronounced by the interpreter
* (`resolveNamedTypeDeclarations`), not by the family-blind symbol table.
*/
export interface NamedTypeSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'namedType';
readonly name: string;

@@ -100,9 +104,2 @@ readonly node: NamedTypeDeclarationAst;

export interface TypeAliasSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'typeAlias';
readonly name: string;
readonly node: NamedTypeDeclarationAst;
readonly span: PslSpan;
}
export interface FieldSymbol {

@@ -127,3 +124,2 @@ readonly kind: 'field';

readonly sourceFile: SourceFile;
readonly scalarTypes: readonly string[];
readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;

@@ -142,9 +138,7 @@ }

export function buildSymbolTable(options: BuildSymbolTableOptions): SymbolTableResult {
const { document, sourceFile, scalarTypes, pslBlockDescriptors } = options;
const { document, sourceFile, pslBlockDescriptors } = options;
const diagnostics: ParseDiagnostic[] = [];
const scalarSet = new Set(scalarTypes);
const namespaces: Record<string, NamespaceSymbol> = {};
const scalars: Record<string, ScalarSymbol> = {};
const typeAliases: Record<string, TypeAliasSymbol> = {};
const namedTypes: Record<string, NamedTypeSymbol> = {};
const blocks: Record<string, BlockSymbol> = {};

@@ -204,7 +198,3 @@ const models: Record<string, ModelSymbol> = {};

const span = nodePslSpan(binding.syntax, sourceFile);
if (isScalarBinding(binding, scalarSet)) {
scalars[name] = { kind: 'scalar', name, node: binding, span, ...resolved };
} else {
typeAliases[name] = { kind: 'typeAlias', name, node: binding, span, ...resolved };
}
namedTypes[name] = { kind: 'namedType', name, node: binding, span, ...resolved };
}

@@ -215,3 +205,3 @@ }

const table: SymbolTable = {
topLevel: { namespaces, scalars, typeAliases, blocks, models, compositeTypes },
topLevel: { namespaces, namedTypes, blocks, models, compositeTypes },
};

@@ -426,9 +416,2 @@ return { table, diagnostics };

function isScalarBinding(node: NamedTypeDeclarationAst, scalarTypes: Set<string>): boolean {
const annotation = node.typeAnnotation();
if (annotation === undefined || annotation.isConstructor()) return false;
const base = annotation.name()?.identifier()?.name();
return base !== undefined && scalarTypes.has(base);
}
function nameRange(name: IdentifierAst | undefined, sourceFile: SourceFile): Range | undefined {

@@ -435,0 +418,0 @@ if (name === undefined) return undefined;

import { $ as Range, H as SyntaxNode, T as ExpressionAst, b as FieldAttributeAst, c as DocumentAst, et as SourceFile, h as NamespaceDeclarationAst, l as FieldDeclarationAst, m as NamedTypeDeclarationAst, o as CompositeTypeDeclarationAst, p as ModelDeclarationAst, t as ParseDiagnostic, u as GenericBlockDeclarationAst, v as TypeAnnotationAst, x as ModelAttributeAst } from "./parse-Bl1gwWGn.mjs";
import { PslExtensionBlock, PslSpan } from "@prisma-next/framework-components/psl-ast";
import { AuthoringPslBlockDescriptorNamespace } from "@prisma-next/framework-components/authoring";
//#region src/resolve.d.ts
interface ResolvedAttributeArg {
readonly kind: 'positional' | 'named';
readonly name?: string;
readonly value: string;
readonly expression?: ExpressionAst;
readonly span: PslSpan;
}
interface ResolvedAttribute {
readonly name: string;
readonly args: readonly ResolvedAttributeArg[];
readonly span: PslSpan;
}
interface ResolvedTypeConstructorCall {
readonly path: readonly string[];
readonly args: readonly ResolvedAttributeArg[];
readonly span: PslSpan;
}
declare function readResolvedAttribute(attribute: FieldAttributeAst | ModelAttributeAst, sourceFile: SourceFile): ResolvedAttribute;
declare function readResolvedAttributes(attributes: Iterable<FieldAttributeAst | ModelAttributeAst>, sourceFile: SourceFile): readonly ResolvedAttribute[];
declare function readResolvedConstructorCall(annotation: TypeAnnotationAst | undefined, sourceFile: SourceFile): ResolvedTypeConstructorCall | undefined;
declare function nodePslSpan(node: SyntaxNode, sourceFile: SourceFile): PslSpan;
/** Unsupported-top-level-block diagnostics are anchored to the keyword token. */
declare function keywordPslSpan(node: SyntaxNode, keyword: string, sourceFile: SourceFile): PslSpan;
declare function rangeToPslSpan(range: Range, sourceFile: SourceFile): PslSpan;
//#endregion
//#region src/symbol-table.d.ts
interface SymbolTable {
readonly topLevel: TopLevelScope;
}
interface TopLevelScope {
readonly namespaces: Record<string, NamespaceSymbol>;
readonly scalars: Record<string, ScalarSymbol>;
readonly typeAliases: Record<string, TypeAliasSymbol>;
readonly blocks: Record<string, BlockSymbol>;
readonly models: Record<string, ModelSymbol>;
readonly compositeTypes: Record<string, CompositeTypeSymbol>;
}
interface NamespaceSymbol {
readonly kind: 'namespace';
readonly name: string;
readonly node: NamespaceDeclarationAst;
readonly span: PslSpan;
readonly models: Record<string, ModelSymbol>;
readonly compositeTypes: Record<string, CompositeTypeSymbol>;
readonly blocks: Record<string, BlockSymbol>;
}
interface ModelSymbol {
readonly kind: 'model';
readonly name: string;
readonly node: ModelDeclarationAst;
readonly span: PslSpan;
readonly fields: Record<string, FieldSymbol>;
readonly attributes: readonly ResolvedAttribute[];
}
interface CompositeTypeSymbol {
readonly kind: 'compositeType';
readonly name: string;
readonly node: CompositeTypeDeclarationAst;
readonly span: PslSpan;
readonly fields: Record<string, FieldSymbol>;
readonly attributes: readonly ResolvedAttribute[];
}
interface BlockSymbol {
readonly kind: 'block';
readonly name: string;
readonly keyword: string;
readonly node: GenericBlockDeclarationAst;
readonly span: PslSpan;
/** Resolved once so consumers do not independently classify block parameters. */
readonly block: PslExtensionBlock;
}
interface ResolvedNamedTypeBinding {
readonly baseType?: string;
readonly typeConstructor?: ResolvedTypeConstructorCall;
readonly isConstructor: boolean;
readonly attributes: readonly ResolvedAttribute[];
}
interface ScalarSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'scalar';
readonly name: string;
readonly node: NamedTypeDeclarationAst;
readonly span: PslSpan;
}
interface TypeAliasSymbol extends ResolvedNamedTypeBinding {
readonly kind: 'typeAlias';
readonly name: string;
readonly node: NamedTypeDeclarationAst;
readonly span: PslSpan;
}
interface FieldSymbol {
readonly kind: 'field';
readonly name: string;
readonly node: FieldDeclarationAst;
readonly span: PslSpan;
readonly typeName: string;
readonly typeNamespaceId?: string;
readonly typeContractSpaceId?: string;
readonly optional: boolean;
readonly list: boolean;
readonly typeConstructor?: ResolvedTypeConstructorCall;
readonly attributes: readonly ResolvedAttribute[];
/** Prevents cascading unsupported-type diagnostics after invalid qualification. */
readonly malformedType?: boolean;
}
interface BuildSymbolTableOptions {
readonly document: DocumentAst;
readonly sourceFile: SourceFile;
readonly scalarTypes: readonly string[];
readonly pslBlockDescriptors: AuthoringPslBlockDescriptorNamespace;
}
interface SymbolTableResult {
readonly table: SymbolTable;
readonly diagnostics: readonly ParseDiagnostic[];
}
/**
* Owns duplicate-declaration detection for all PSL scopes; downstream consumers
* should consume first-wins symbols rather than re-emitting duplicate diagnostics.
*/
declare function buildSymbolTable(options: BuildSymbolTableOptions): SymbolTableResult;
//#endregion
export { readResolvedConstructorCall as S, keywordPslSpan as _, ModelSymbol as a, readResolvedAttribute as b, ScalarSymbol as c, TopLevelScope as d, TypeAliasSymbol as f, ResolvedTypeConstructorCall as g, ResolvedAttributeArg as h, FieldSymbol as i, SymbolTable as l, ResolvedAttribute as m, BuildSymbolTableOptions as n, NamespaceSymbol as o, buildSymbolTable as p, CompositeTypeSymbol as r, ResolvedNamedTypeBinding as s, BlockSymbol as t, SymbolTableResult as u, nodePslSpan as v, readResolvedAttributes as x, rangeToPslSpan as y };
//# sourceMappingURL=symbol-table-en_Bich3.d.mts.map
{"version":3,"file":"symbol-table-en_Bich3.d.mts","names":[],"sources":["../src/resolve.ts","../src/symbol-table.ts"],"mappings":";;;;UAaiB;WACN;WACA;WACA;WACA,aAAa;WACb,MAAM;;UAGA;WACN;WACA,eAAe;WACf,MAAM;;UAGA;WACN;WACA,eAAe;WACf,MAAM;;iBAGD,sBACd,WAAW,oBAAoB,mBAC/B,YAAY,aACX;iBAQa,uBACd,YAAY,SAAS,oBAAoB,oBACzC,YAAY,sBACF;iBAII,4BACd,YAAY,+BACZ,YAAY,aACX;iBAuCa,YAAY,MAAM,YAAY,YAAY,aAAa;;iBAUvD,eAAe,MAAM,YAAY,iBAAiB,YAAY,aAAa;iBAS3E,eAAe,OAAO,OAAO,YAAY,aAAa;;;UChFrD;WACN,UAAU;;UAGJ;WACN,YAAY,eAAe;WAC3B,SAAS,eAAe;WACxB,aAAa,eAAe;WAC5B,QAAQ,eAAe;WACvB,QAAQ,eAAe;WACvB,gBAAgB,eAAe;;UAGzB;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,gBAAgB,eAAe;WAC/B,QAAQ,eAAe;;UAGjB;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,qBAAqB;;UAGf;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN,QAAQ,eAAe;WACvB,qBAAqB;;UAGf;WACN;WACA;WACA;WACA,MAAM;WACN,MAAM;;WAEN,OAAO;;UAGD;WACN;WACA,kBAAkB;WAClB;WACA,qBAAqB;;UAGf,qBAAqB;WAC3B;WACA;WACA,MAAM;WACN,MAAM;;UAGA,wBAAwB;WAC9B;WACA;WACA,MAAM;WACN,MAAM;;UAGA;WACN;WACA;WACA,MAAM;WACN,MAAM;WACN;WACA;WACA;WACA;WACA;WACA,kBAAkB;WAClB,qBAAqB;;WAErB;;UAGM;WACN,UAAU;WACV,YAAY;WACZ;WACA,qBAAqB;;UAGf;WACN,OAAO;WACP,sBAAsB;;;;;;iBAOjB,iBAAiB,SAAS,0BAA0B"}

Sorry, the diff of this file is too big to display