import type { SqliteDatabase, SqliteValue, StorageDescriptor } from "./database.js"; type Awaitable = T | Promise; /** A value as a driver returns it. Blobs may be any binary view; the facade returns them as `Uint8Array` copies. */ export type SqliteDriverValue = SqliteValue | ArrayBuffer | ArrayBufferView; /** One statement's result as a driver returns it: column names, positional rows, and the rows it changed. */ export interface SqliteDriverResult { readonly columns: readonly string[]; readonly rows: readonly ArrayLike[]; readonly changes: number; } /** Runs SQL on a driver connection or on an open driver transaction. */ export interface SqliteDriverExecutor { /** Runs one statement with positional `?` parameters. */ execute(sql: string, params: readonly SqliteValue[]): Awaitable; /** Runs zero or more statements that take no parameters. */ executeMultiple(sql: string): Awaitable; } export interface SqliteDriverTransaction extends SqliteDriverExecutor { commit(): Awaitable; rollback(): Awaitable; /** Releases the transaction after it commits or rolls back. */ close?(): Awaitable; } /** The driver calls `createSqliteDatabase` turns into a `SqliteDatabase`. */ export interface SqliteDriver extends SqliteDriverExecutor { /** Diagnostic identity. Its `location` passes through `redact` before the facade exposes it. */ readonly descriptor: StorageDescriptor; /** Begins a write transaction that holds the database's write lock, like `BEGIN IMMEDIATE`. */ beginTransaction(): Awaitable; /** Releases the connection. Called once, after accepted work drains. */ close(): Awaitable; /** Removes credentials from diagnostic text: the descriptor location and driver failure messages and stacks. */ redact?(text: string): string; } /** * A redactor that replaces every non-empty secret, and its URI-encoded and URI-decoded forms, with `[redacted]`. * Longer secrets are replaced first, so a secret that contains another is removed whole. */ export declare function redactSecrets(secrets: Iterable): (text: string) => string; /** * Wraps a SQLite-compatible driver as a `SqliteDatabase`. The facade queues operations in call order and keeps them * outside active transactions, snapshots binary parameters at call time, rejects NUL text, returns safe-range integers * as numbers and blobs as `Uint8Array` copies, expires transaction handles when their callback settles, maps driver * failures to `StorageUnavailableError` with credentials redacted, and reports failed rollbacks with * `StorageRollbackError`. Closing rejects new calls, drains accepted work, then closes the driver once. */ export declare function createSqliteDatabase(driver: SqliteDriver): SqliteDatabase; export {}; //# sourceMappingURL=sqlite-facade.d.ts.map