/* auto-generated by NAPI-RS */ /* eslint-disable */ export declare class Database { /** * Begin a write transaction. Must `.commit()` or `.rollback()`. * Dropping without either rolls back. */ transaction(): Transaction /** SELECT returns `Array` (each row is a plain object). */ query(sql: string, params?: Array | undefined | null): Array> /** * Update watcher for this database. `await ev.next()` resolves * on every commit to the database (any process, any writer). * * N subscribers share a single background poll thread via the * core SharedUpdateWatcher. */ updateEvents(): UpdateEvents /** * Delete notifications older than a duration, or beyond a count. * Returns number of rows removed. */ pruneNotifications(olderThanS?: number | undefined | null, maxKeep?: number | undefined | null): number /** * Release the underlying SQLite handles and the watcher poll * thread so the OS can unlink the database file. After `close()`, * any further `transaction()` / `query()` / `updateEvents()` / * `pruneNotifications()` calls return an error. * * Idempotent. Safe to call from `finally`/`afterEach` blocks even * if the test never used the database. * * Why this matters on Windows: SQLite holds the `.db` file open * for the lifetime of every Connection. On Linux/macOS, `unlink` * on a still-open file works (the inode survives until the last * fd closes). On Windows, it does not — `EBUSY` until every * handle is dropped. Without explicit close, the writer/reader * connections live until the JavaScript GC drops every * Transaction/UpdateEvents object that ever cloned the * `Arc` / `Arc`, which a test-cleanup block * can't force. */ close(): void } export declare class Transaction { execute(sql: string, params?: Array | undefined | null): number query(sql: string, params?: Array | undefined | null): Array> /** * Publish a cross-process notification. `payload` is any * JSON-serializable value; it's `JSON.stringify`'d on the way in * and `JSON.parse`'d by consumers on the way out. Matches the * Python binding's unconditional `json.dumps` contract so payloads * round-trip identically across bindings. */ notify(channel: string, payload: JsonValue): number commit(): void rollback(): void } export declare class UpdateEvents { /** * Await the next database update. Resolves on every DB commit. * Rejects with a "watcher died or was closed" message when the * subscription's channel closes — either because the watcher * thread died (e.g. the db file was replaced) or because close() * unsubscribed. Callers can match on "watcher died" to decide * whether to reopen the database. */ next(): Promise /** Stop this subscription eagerly. Idempotent. */ close(): void } /** * Open a Honker database at `path`. * * `watcherBackend` selects the update-detection strategy: * - omitted / `"polling"` — default 1 ms PRAGMA polling * - `"kernel"` — kernel filesystem notifications (experimental) * - `"shm"` — mmap `-shm` fast path (experimental) * * `watcherPollIntervalMs` raises the default 1 ms watcher cadence when * lower idle CPU matters more than lowest-latency wakeups. * * Experimental backends require the corresponding Cargo feature. Builds * without that feature reject an explicit request instead of silently * falling back to polling. */ export declare function open(path: string, maxReaders?: number | undefined | null, watcherBackend?: string | undefined | null, watcherPollIntervalMs?: number | undefined | null): Database