import type { DatabaseHandle } from './db.js'; import type { ParsedNode } from '../types.js'; /** * Insert or replace a node. Keeps the FTS5 shadow table in sync — FTS5 with * content='nodes' requires an explicit 'delete' command using the OLD values * before reinserting, otherwise the FTS index will drift. */ export declare function upsertNode(db: DatabaseHandle, node: ParsedNode): void; /** * Fetch a node by id, including its internal rowid (needed for FTS5 / vec0 * joins). */ export declare function getNode(db: DatabaseHandle, id: string): (ParsedNode & { rowid: number; }) | undefined; /** * Return every node id in the database. */ export declare function allNodeIds(db: DatabaseHandle): string[]; /** * Remove a node and every piece of state that references it: FTS5 row, * vec0 embedding, incoming + outgoing edges, and sync-state entry. */ export declare function deleteNode(db: DatabaseHandle, id: string): void; /** * Delete every stub node in `candidateIds` that has zero inbound edges. * "Stub" is identified by frontmatter._stub === true. * Non-stub ids and missing ids are skipped silently. * Returns the count of nodes pruned. */ export declare function pruneOrphanStubs(db: DatabaseHandle, candidateIds: string[]): number; /** * Sweep all stubs in the DB and prune any with zero inbound edges. * Used as a backstop in reindex() and as the migration path for * existing v1.5.7 users with orphan stubs. */ export declare function pruneAllOrphanStubs(db: DatabaseHandle): number; /** * When a real note is created that matches an existing stub's path, * repoint all inbound edges from the stub to the real node and delete * the stub. No-op if the stub doesn't exist or isn't actually a stub. */ export declare function migrateStubToReal(db: DatabaseHandle, stubId: string, realId: string): void;