import { SnapshotIndex } from "../snapshot.mjs"; /** * Runs arbitrary SQL and returns rows as plain objects. Caller supplies * this so the function works with AsyncDuckDB (browser DuckDB-WASM) or * @duckdb/node-api (Node) without coupling to either. */ type SnapshotQueryRunner = (sql: string) => Promise>>; interface AttachSnapshotOptions { /** Index produced by the builder. */ index: SnapshotIndex; /** * Map from filename (`cold-YYYY-MM.duckdb`, `hot.duckdb`) to an HTTPS * URL (typically a pre-signed R2 URL). Must contain an entry for every * cold month in `index.cold` and — if `index.hot` — for `hot.duckdb`. */ attachUrls: Record; /** Schema the unified views land under. Default `main`. */ schema?: string; /** * DuckDB httpfs can error with "Server sent back more data than expected" * against some proxies; `force_download=true` sidesteps it. Default true. */ forceDownload?: boolean; } interface AttachSnapshotResult { schema: string; /** Aliases we ATTACH'd — e.g. ['cold_2024_09', 'cold_2024_10', 'hot']. */ aliases: string[]; /** Table names with a UNION view created under `schema`. */ tables: string[]; } /** * Turns a filename like `cold-2024-09.duckdb` into a valid SQL identifier * `cold_2024_09`. `hot.duckdb` → `hot`. */ declare function snapshotAlias(fileName: string): string; declare function attachSnapshotIndex(runner: SnapshotQueryRunner, opts: AttachSnapshotOptions): Promise; export { AttachSnapshotOptions, AttachSnapshotResult, SnapshotQueryRunner, attachSnapshotIndex, snapshotAlias };