import type { ReadonlyJSONValue } from '../../../shared/src/json.ts';
import type { Read, Store, Write } from './store.ts';
/**
 * A SQLite prepared statement.
 *
 * `run` executes the statement with optional parameters.
 * `all` executes the statement and returns the result rows.
 * `finalize` releases the statement.
 */
export interface PreparedStatement {
    firstValue(params: string[]): Promise<unknown>;
    exec(params: string[]): Promise<void>;
}
export interface SQLiteDatabase {
    /**
     * Close the database connection.
     */
    close(): void;
    /**
     * Destroy or delete the database (e.g. delete file).
     */
    destroy(): void;
    /**
     * Prepare a SQL string, returning a statement you can execute.
     * E.g. `const stmt = db.prepare("SELECT * FROM todos WHERE id=?");`
     */
    prepare(sql: string): PreparedStatement;
    execSync(sql: string): void;
}
export type CreateSQLiteDatabase = (filename: string, opts?: SQLiteStoreOptions) => SQLiteDatabase;
/**
 * SQLite-based implementation of the Store interface using a configurable delegate.
 * Supports shared connections between multiple store instances with the same name,
 * providing efficient resource utilization and proper transaction isolation.
 * Uses parameterized queries for safety and performance.
 */
export declare class SQLiteStore implements Store {
    #private;
    constructor(name: string, create: CreateSQLiteDatabase, opts?: SQLiteStoreOptions);
    read(): Promise<Read>;
    write(): Promise<Write>;
    close(): Promise<void>;
    get closed(): boolean;
}
export declare function safeFilename(name: string): string;
export type PreparedStatements = {
    has: PreparedStatement;
    get: PreparedStatement;
    put: PreparedStatement;
    del: PreparedStatement;
};
export interface SQLiteStoreOptions {
    busyTimeout?: number;
    journalMode?: 'WAL' | 'DELETE';
    synchronous?: 'NORMAL' | 'FULL';
    readUncommitted?: boolean;
}
/**
 * Common database setup logic shared between expo-sqlite and op-sqlite implementations.
 * Configures SQLite pragmas, creates the entry table, and prepares common statements.
 */
export declare function setupDatabase(delegate: SQLiteDatabase, opts?: SQLiteStoreOptions): PreparedStatements;
export declare class SQLiteStoreRead implements Read {
    #private;
    constructor(release: () => void, preparedStatements: PreparedStatements);
    has(key: string): Promise<boolean>;
    get(key: string): Promise<ReadonlyJSONValue | undefined>;
    release(): void;
    get closed(): boolean;
}
export declare class SQLiteWrite implements Write {
    #private;
    constructor(release: () => void, dbDelegate: SQLiteDatabase, preparedStatements: PreparedStatements);
    has(key: string): Promise<boolean>;
    get(key: string): Promise<ReadonlyJSONValue | undefined>;
    put(key: string, value: ReadonlyJSONValue): Promise<void>;
    del(key: string): Promise<void>;
    commit(): Promise<void>;
    release(): void;
    get closed(): boolean;
}
export declare function clearAllNamedStoresForTesting(): void;
export declare function dropStore(name: string, createDelegate: (filename: string, opts?: SQLiteStoreOptions) => SQLiteDatabase): Promise<void>;
//# sourceMappingURL=sqlite-store.d.ts.map