/** * Runtime-agnostic SQLite loader. * * Under Bun: uses the built-in `bun:sqlite` (zero install). Under Node: falls * back to `better-sqlite3` loaded as an optional peer dependency. API surface * of both databases is equivalent for the subset we use (`prepare`, `run`, * `get`, `all`, `exec`, `pragma`, `transaction`, `close`), so callers can * treat the returned handle uniformly. * * Callers should treat the database handle as `SqliteDatabase` (structurally * typed) and the statement handle as `SqliteStatement`. Runtime detection * happens once per process; subsequent opens reuse the same constructor. */ export type SqliteDatabase = any; export type SqliteStatement = any; type SqliteCtor = new (path: string, opts?: any) => SqliteDatabase; /** * @returns 'bun' if running under Bun, else 'node'. */ export declare function detectSqliteRuntime(): 'bun' | 'node'; /** * Load the SQLite Database constructor for the current runtime. * Caches the result so subsequent calls skip the dynamic import. */ export declare function loadSqliteCtor(): Promise; /** * Open a SQLite database at `path` with sensible defaults (WAL journal, * foreign keys on). The schema init function runs once on the returned * handle before it's returned to the caller. */ export declare function openSqlite(path: string, initSchema: (db: SqliteDatabase) => void): Promise; /** * @returns whether SQLite is currently available in this process. */ export declare function isSqliteAvailable(): Promise; /** * @returns the cached runtime label, or null if the loader hasn't run yet. * For diagnostics and logs. */ export declare function getResolvedSqliteRuntime(): 'bun' | 'node' | null; /** * Internal: reset the cached constructor. For tests only. */ export declare function __resetSqliteCache(): void; export {}; //# sourceMappingURL=sqlite-runtime.d.ts.map