import type { ParserRuleContext } from "antlr4ng"; import { SqlDocument, type DocumentAnalysis, type DocumentVariant, type UnionCte } from "./document/document.js"; import type { NodeHit } from "./document/node-at.js"; import { type Lineage, type TypeInfo } from "./api.js"; import type { Dialect } from "./dialect.js"; import type { QueryExpr } from "./ir/ir.js"; import type { Type } from "./infer/types.js"; import type { TagNode } from "./minijinja/tag-ast.js"; import type { TemplateRegion, TemplateSymbol } from "./minijinja/regions.js"; import type { SyntaxDiagnostic } from "./parse-diagnostics.js"; import { type CompleteOptions, type CompletionResult } from "./completion/complete.js"; import type { Diagnostic, Qualification } from "./qualify/qualify.js"; import type { SchemaProvider } from "./qualify/schema-provider.js"; import { type TemplateProvider } from "./qualify/template-provider.js"; import type { Occurrences } from "./references/references.js"; import type { LineageHop } from "./lineage/hops.js"; import { type SignatureHelpInfo } from "./signature/signature.js"; import type { Scope, ScopeTree } from "./scope/scope.js"; import type { Frame } from "./scope/frame.js"; import type { ClauseInfo } from "./scope/clauses.js"; import type { SetOpArms } from "./scope/setop-arms.js"; import type { Span, Sym } from "./symbols/symbols.js"; import type { TemplateEngine } from "./template/engine.js"; import type { Token } from "./token/token.js"; export interface SessionOptions { uri?: string; schema?: SchemaProvider; provider?: TemplateProvider; templating?: TemplateEngine; } export declare class SqlSession { /** The document underneath — the escape hatch DOWN. */ readonly doc: SqlDocument; private readonly schema; private constructor(); static create(text: string, dialect: Dialect, opts?: SessionOptions): SqlSession; /** An edit: a new session over the successor document. Version auto-increments from doc.version + 1; * the templating engine + provider ride forward via SqlDocument.withText's own carry. */ withText(text: string): SqlSession; get text(): string; get dialect(): Dialect; get ast(): QueryExpr; get tokens(): readonly Token[]; get cst(): ParserRuleContext; get scopes(): ScopeTree; get syntaxDiagnostics(): readonly SyntaxDiagnostic[]; get tags(): readonly TagNode[]; get regions(): readonly TemplateRegion[]; get templateSymbols(): readonly TemplateSymbol[]; get placeholder(): string; get degraded(): boolean; tagOf(node: object): TagNode | undefined; nodeOf(tag: TagNode): object | undefined; diagnosticsOf(tag: TagNode): SyntaxDiagnostic[]; get variants(): readonly DocumentVariant[]; analyze(): DocumentAnalysis; qualify(): Qualification; deriveSymbols(): Sym[]; /** Syntax + semantic diagnostics, one doc-ordered list (syntax diagnostics first — both arrays are * already in document order on their own; see DocumentAnalysis.diagnostics / SqlDocument.diagnostics). */ diagnostics(): (SyntaxDiagnostic | Diagnostic)[]; /** Column lineage for the output columns. WHOLE-DOCUMENT-scoped: on a multi-statement document * `doc.scopes` is the compound facade (no outputs), so this answers empty there — use * `lineageAt(offset)` for per-statement lineage. Single-statement documents (every dbt model, * and all templated documents) are fully covered. */ lineage(): Lineage; types(): TypeInfo; tokenAt(offset: number): Token | undefined; nodeAt(offset: number): NodeHit | undefined; scopeAt(offset: number): Scope | undefined; /** The ONE documented two-step composition: nodeAt locates the expr + its scope, types().typeOf * infers it. A miss returns Type's own `unknown` (src/infer/types.ts's UNKNOWN), never a throw. */ typeAt(offset: number): Type; completeAt(offset: number, opts?: CompleteOptions): CompletionResult; signatureAt(offset: number): SignatureHelpInfo | null; referencesAt(offset: number): Occurrences | null; lineageAt(offset: number): LineageHop | undefined; /** Schema-free: frame identity is structural. */ frameAt(offset: number): Frame | undefined; clausesOf(scope: Scope): ClauseInfo[]; setOpArmsOf(scope: Scope): SetOpArms | undefined; variantAt(offset: number): DocumentVariant | undefined; unionSymbols(): Sym[]; unionDiagnostics(): (SyntaxDiagnostic | Diagnostic)[]; unionCtes(): UnionCte[]; unionOutputColumns(): { name: string; span: Span; }[]; }