import Database from 'better-sqlite3';
import type { Logger } from 'pino';
export interface SqliteHelper {
    /** Get the live Database, or null if init has failed. */
    get(): Database.Database | null;
    /** Wrap a DB call with a try/catch that returns `fallback` on error. */
    safe<T>(fn: (d: Database.Database) => T, fallback: T): T;
    /** Close the underlying handle if open. Idempotent — subsequent get()
     *  attempts will re-open a fresh connection. Used by graceful shutdown
     *  in cli.ts so WAL is checkpointed cleanly instead of leaving the
     *  next startup to recover from -wal/-shm.  */
    close(): void;
    /** Mark the DB broken (test hook). */
    _markBroken(reason: string): void;
}
export interface CreateOptions {
    /** Absolute path to the .db file. The parent dir is created if missing. */
    file: string;
    /** SQL DDL run once after open (`CREATE TABLE IF NOT EXISTS …`). */
    schema: string;
    /** Optional one-time migration / cleanup callback (e.g. job-board's
     *  reapStaleRunning). Invoked exactly once per process, after schema. */
    init?: (d: Database.Database) => void;
    /** Pino logger (or compatible). Used to surface init failures. */
    logger?: Logger;
    /** Component tag for logger child binding. Default: derived from file basename. */
    component?: string;
}
/**
 * Create an opener that lazily initializes the DB on first call. If the
 * native module can't be loaded (bun runtime, missing libstdc++) or any
 * step throws, the helper transitions to "broken" and every subsequent
 * `get()` returns null — letting callers fail soft without crashing the
 * pipeline.
 */
export declare function createSqliteHelper(opts: CreateOptions): SqliteHelper;
//# sourceMappingURL=sqlite-helper.d.ts.map