/** * Query and QueryBuilder implementation for the Model Query SDK. * Provides fluent, lazy evaluation of model queries. */ import type { LangiumDocument, URI } from 'langium'; import type { BoundedContext, Domain, Model, Relationship } from '../generated/ast.js'; import type { DomainLangServices } from './bootstrap.js'; import type { Query } from './types.js'; /** * Creates a Query instance from a Model node. * Zero-copy operation for already-linked AST (used in LSP/validation). * * Automatically augments the AST with resolved properties on first access. * * @param model - Root Model node * @returns Query interface for model traversal */ export declare function fromModel(model: Model): Query; /** * Creates a Query instance from a LangiumDocument. * Zero-copy operation for already-linked AST (used in LSP providers). * * Automatically augments the AST with resolved properties on first access. * * @param document - LangiumDocument containing a Model * @returns Query interface for model traversal */ export declare function fromDocument(document: LangiumDocument): Query; /** * Creates a Query instance from DomainLangServices and document URI. * Zero-copy operation for already-linked AST (used when only services available). * * Automatically augments the AST with resolved properties on first access. * * @param services - DomainLangServices instance * @param documentUri - URI of the document to query * @returns Query interface for model traversal * @throws Error if document not found or not a Model */ export declare function fromServices(services: DomainLangServices, documentUri: URI): Query; /** * Augments BoundedContext instances with SDK-resolved properties. * Called during model loading to enrich the AST. * * Properties use natural names (not sdk* prefix) per PRS: * "Properties are discoverable in IDE autocomplete. The SDK enriches the AST * during load, so `bc.classification` just works—no imports needed." * * Note: We use getters to avoid computing values until accessed. * Note: We use Object.defineProperty to avoid modifying the original interface. * * @param bc - BoundedContext to augment */ export declare function augmentBoundedContext(bc: BoundedContext): void; /** * Augments Domain instances with SDK-resolved properties. * Called during model loading to enrich the AST. * * Only includes properties that add value beyond direct AST access: * - fqn: computed qualified name * - hasType: helper method * * Direct access (no augmentation needed): * - domain.description * - domain.vision * - domain.type?.ref * * @param domain - Domain to augment */ export declare function augmentDomain(domain: Domain): void; /** * Augments Relationship instances with SDK helper methods. * Called during model loading to enrich the AST. * * @param rel - Relationship to augment * @param containingBc - BoundedContext containing this relationship (for 'this' resolution) */ export declare function augmentRelationship(rel: Relationship, containingBc?: BoundedContext): void; /** * Augments all AST nodes in a model with SDK-resolved properties. * * This function walks the entire AST and adds lazy getters for resolved * properties like `effectiveClassification`, `effectiveTeam`, etc. * * Idempotent - safe to call multiple times on the same model. * Automatically called by `fromModel()`, `fromDocument()`, and `fromServices()`. * * @param model - Root Model node to augment */ export declare function augmentModel(model: Model): void;