import type { CallEdge, FunctionNode, ClassNode, InheritanceEdge } from '../analyzer/call-graph.js'; import type { FunctionCfg } from '../analyzer/cfg.js'; import type { DecisionNode, DecisionAffectsEdge } from '../decisions/project.js'; import type { FileProvenance } from '../provenance/git-provenance.js'; import type { FileChangeCoupling, ChangeCouplingResult } from '../provenance/change-coupling.js'; export declare class EdgeStore { private readonly db; /** * True when opening this DB found a stale SCHEMA_VERSION and wiped it (rebuild-on-bump). * The data is gone until the next analyze repopulates it — callers that READ * (vs. analyze, which repopulates) should treat the store as unavailable so they * can tell the user to re-run analyze instead of serving an empty graph. */ private _wasReset; get wasReset(): boolean; private constructor(); private initSchema; /** All distinct files that call into calleeFile (reverse lookup before delete). */ getCallerFiles(calleeFile: string): string[]; /** All outgoing + incoming edges touching a file. */ getEdgesForFile(file: string): { outgoing: CallEdge[]; incoming: CallEdge[]; }; /** Outgoing edges from a node ID (its direct callees). */ getCallees(nodeId: string): CallEdge[]; /** Incoming edges to a node ID (its direct callers). */ getCallers(nodeId: string): CallEdge[]; /** Batch: outgoing edges for a set of caller IDs — one query instead of N. */ getCalleesForIds(callerIds: string[]): CallEdge[]; /** Batch: incoming edges for a set of callee IDs — one query instead of N. */ getCallersForIds(calleeIds: string[]): CallEdge[]; /** Remove all edges where this file is caller or callee. */ deleteEdgesForFile(file: string): void; /** Remove only outgoing edges from this file (incoming edges remain). */ deleteOutgoingEdgesForFile(file: string): void; /** Bulk-insert edges in a single transaction. */ insertEdges(edges: CallEdge[]): void; /** Bulk-insert inheritance edges in a single transaction. */ insertInheritanceEdges(edges: InheritanceEdge[]): void; getNode(id: string): FunctionNode | null; getNodesForFile(file: string): FunctionNode[]; /** * Resolve a node by its content-addressed `stableId` * (add-content-addressed-stable-symbol-ids). Returns the match only when it is * unambiguous — a single internal node. Ambiguous (a collision the ordinal pass * still left, or two files momentarily sharing one) or absent → null, so a * rename-resolution caller never guesses between candidates. */ getNodeByStableId(stableId: string): FunctionNode | null; /** * All internal (non-external) nodes. Used to seed cross-file call resolution * during an incremental subset rebuild, so calls into files outside the * re-parsed subset still resolve to their real node instead of `external::`. */ getAllInternalNodes(): FunctionNode[]; /** Case-insensitive substring search on node name. FTS5 trigram for ≥3 chars, LIKE fallback otherwise. */ searchNodes(pattern: string, limit?: number): FunctionNode[]; getHubs(limit?: number): FunctionNode[]; getEntryPoints(limit?: number): FunctionNode[]; countNodes(): number; deleteNodesForFile(file: string): void; /** * Bulk-insert nodes. hubIds/entryIds are optional sets used to mark flags; * omit them during incremental watcher updates (flags preserved from last analyze). */ insertNodes(nodes: FunctionNode[], hubIds?: Set, entryIds?: Set): void; /** * Lazily load one function's control-flow + reaching-definitions overlay. * Returns null when the function has no overlay (unsupported language, a parse * that produced no CFG, or a pre-overlay store). DB-only — never resident. */ getCfg(functionId: string): FunctionCfg | null; /** True when any overlay rows exist (used to tell "no overlay" from "absent feature"). */ hasCfgOverlay(): boolean; /** Delete every overlay row for a file (per-file incremental recompute). */ deleteCfgForFile(file: string): void; /** Bulk-insert per-function overlays in a single transaction. */ insertCfgs(cfgs: Array<{ functionId: string; filePath: string; cfg: FunctionCfg; }>): void; getClass(id: string): ClassNode | null; getClassesForFile(file: string): ClassNode[]; deleteClassesForFile(file: string): void; insertClasses(classes: ClassNode[]): void; /** Replace the projected decision graph wholesale (idempotent re-projection). */ insertDecisions(nodes: DecisionNode[], edges: DecisionAffectsEdge[]): void; /** Every projected decision node (deterministic order). */ getAllDecisions(): DecisionNode[]; countDecisions(): number; /** * Governing decisions for a set of files — the deterministic graph join that * replaces orient's runtime affectedFiles set-membership filter (spec-16). * * Path forms differ across callers (edge-store nodes are repo-relative; some * callers pass absolute paths), and decisions are few, so we match in JS with a * tolerant suffix comparator rather than relying on exact SQL equality. */ getDecisionsForFiles(files: string[]): DecisionNode[]; /** Replace the per-file provenance wholesale (idempotent re-extraction). */ insertProvenance(records: FileProvenance[]): void; countProvenance(): number; /** * Provenance for a set of files. Path forms differ across callers (edge-store * nodes are repo-relative; some callers pass absolute paths), so match with the * same tolerant comparator used for decisions (spec-18). */ getProvenanceForFiles(files: string[]): FileProvenance[]; /** Replace the per-file change-coupling snapshot wholesale (idempotent re-mine). */ insertChangeCoupling(result: ChangeCouplingResult): void; countChangeCoupling(): number; /** Change-coupling records for a set of files (tolerant path match, spec-22). */ getChangeCouplingForFiles(files: string[]): FileChangeCoupling[]; /** Top-churn (most volatile) files, descending. */ getTopVolatile(limit?: number): FileChangeCoupling[]; getFileHash(filePath: string): string | null; setFileHash(filePath: string, hash: string): void; /** Drop all graph data — used by full analyze rebuild. */ clearAll(): void; /** Run fn inside a single SQLite transaction. */ transaction(fn: () => void): void; close(): void; static open(dbPath: string): EdgeStore; static exists(outputDir: string): boolean; static dbPath(outputDir: string): string; } //# sourceMappingURL=edge-store.d.ts.map