/** * Multi-granularity lineage graph for DQL's answer layer. * * Tracks data flow from source tables through blocks, semantic metrics, * domains, and charts — the full "trust chain" from raw data to rendered answer. */ export type LineageNodeType = 'source_table' | 'dbt_model' | 'dbt_source' | 'term' | 'block' | 'business_view' | 'metric' | 'dimension' | 'domain' | 'chart' | 'notebook' | 'dashboard' | 'app'; /** Conceptual layer a node belongs to in the lineage flow. */ export type LineageLayer = 'source' | 'transform' | 'answer' | 'consumption'; /** Get the default layer for a node type. */ export declare function getLayerForNodeType(type: LineageNodeType): LineageLayer; export interface LineageNode { /** Unique identifier (e.g., "block:revenue_by_segment", "metric:total_revenue") */ id: string; type: LineageNodeType; name: string; /** Conceptual layer in the lineage flow (source → transform → answer → consumption) */ layer?: LineageLayer; /** Business domain this node belongs to */ domain?: string; /** Certification status (for blocks) */ status?: 'draft' | 'review' | 'certified' | 'deprecated' | 'pending_recertification'; /** Owner of the block/metric */ owner?: string; /** Additional metadata */ metadata?: Record; /** Optional table-level column metadata */ columns?: Array<{ name: string; type?: string; description?: string; }>; } export type LineageEdgeType = 'reads_from' | 'feeds_into' | 'defines' | 'composes' | 'aggregates' | 'visualizes' | 'depends_on' | 'contains' | 'crosses_domain' | 'certified_by'; export interface LineageEdge { source: string; target: string; type: LineageEdgeType; /** For crosses_domain: source and target domain names */ sourceDomain?: string; targetDomain?: string; /** Additional metadata */ metadata?: Record; } export interface LineageGraphJSON { nodes: LineageNode[]; edges: LineageEdge[]; } export declare class LineageGraph { private nodes; private edges; /** Outgoing edges: source → edges */ private outgoing; /** Incoming edges: target → edges */ private incoming; /** Add a node to the graph. Updates if already exists. */ addNode(node: LineageNode): void; /** Add an edge to the graph. Deduplicates by source+target+type. */ addEdge(edge: LineageEdge): void; /** Get a node by ID. */ getNode(id: string): LineageNode | undefined; /** Get all nodes. */ getAllNodes(): LineageNode[]; /** Get all edges. */ getAllEdges(): LineageEdge[]; /** Get nodes by type. */ getNodesByType(type: LineageNodeType): LineageNode[]; /** Get nodes by lineage layer. */ getNodesByLayer(layer: LineageLayer): LineageNode[]; /** Get nodes by domain. */ getNodesByDomain(domain: string): LineageNode[]; /** Get all unique domains in the graph. */ getDomains(): string[]; /** Get outgoing edges from a node. */ getOutgoingEdges(nodeId: string): LineageEdge[]; /** Get incoming edges to a node. */ getIncomingEdges(nodeId: string): LineageEdge[]; /** * Get all ancestors (upstream) of a node via BFS. * Follows incoming edges backwards. */ ancestors(nodeId: string): LineageNode[]; /** * Get all descendants (downstream) of a node via BFS. * Follows outgoing edges forward. */ descendants(nodeId: string): LineageNode[]; /** * Find the shortest path between two nodes (BFS). * Returns node IDs in order, or empty array if no path exists. */ pathBetween(fromId: string, toId: string): string[]; /** * Extract a subgraph containing only nodes matching a filter and * edges between those nodes. */ subgraph(filter: (node: LineageNode) => boolean): LineageGraph; /** * Get edges that cross domain boundaries. */ getCrossDomainEdges(): LineageEdge[]; /** Serialize the graph to JSON. */ toJSON(): LineageGraphJSON; /** Deserialize a graph from JSON. */ static fromJSON(json: LineageGraphJSON): LineageGraph; /** Number of nodes in the graph. */ get nodeCount(): number; /** Number of edges in the graph. */ get edgeCount(): number; } //# sourceMappingURL=lineage-graph.d.ts.map