import { type WriteStream } from 'fs'; /** Injectable for tests (backpressure/error simulation), mirroring split. */ export type WriteStreamFactory = (filePath: string) => WriteStream; /** * Derive a node's table label from its graph id. Matches the legacy * `getNodeLabel` that lived inline in `loadGraphToLbug`: * - `comm_*` → Community * - `proc_*` → Process * - otherwise the prefix before the first `:` (e.g. `Function:…` → Function) */ export declare const getNodeLabel: (nodeId: string) => string; export interface RelPairMeta { csvPath: string; rows: number; } /** * Routes already-escaped relationship CSV rows to per-FROM→TO-label-pair * files. Filters edges whose endpoint labels are not valid node tables * (counted as `skipped`), exactly as the legacy split did. */ export declare class RelPairRouter { private readonly csvDir; private readonly header; private readonly validTables; private readonly wsFactory; /** pairKey (`From|To`) → { csvPath, rows } */ readonly byPair: Map; private readonly streams; skipped: number; total: number; private streamError; private readonly abort; constructor(csvDir: string, header: string, validTables: Set, wsFactory?: WriteStreamFactory); private markError; /** * The first stream error observed, if any. Lets the emit caller rethrow the * real error (EMFILE / disk-full) instead of the generic `AbortError` that a * pending `once(ws,'drain',{signal})` rejects with when the abort fires — * mirroring the retained `splitRelCsvByLabelPair`'s `throw streamError ?? err`. */ get lastError(): Error | null; /** * Route one already-escaped CSV row (no trailing newline) to its pair file. * Returns `void` on the synchronous hot path; a `Promise` only when a * stream signals backpressure (or a new pair's header does) — the caller * awaits the promise before routing the next edge. */ route(fromId: string, toId: string, row: string): void | Promise; private openAndWrite; /** Flush + close every pair stream. Rejects if any stream errored. */ close(): Promise; /** Tear down all streams (no flush) — used on the error path. */ destroy(): void; }