import { type SQLQueryBindings } from 'bun:sqlite'; import { type DeleteRangeOptions } from './delete-range'; import { type BatchOperation, type ConditionalBatchCondition, type ScanOptions, type Storage, type StorageCapabilities } from './interface'; /** * Runtime-neutral alias for the Bun SQLite adapter. Consumers that import * from `@lostgradient/weft/storage/sqlite` get this class under Bun. */ export { BunSQLiteStorage as SQLiteStorage }; /** * SQLite-backed {@link Storage} using Bun's built-in `bun:sqlite` module. * * Opens the database in WAL mode with prepared-statement caching so the hot * `get`/`put`/`batch` paths pay zero per-call `prepare()` cost. Pass * `':memory:'` (the default) for ephemeral storage, or a file path for durable * persistence across restarts. * * `query(sql, params?)` runs read-only SQL against the underlying database * after validation with `assertReadOnlyQuery`. It is intended for dashboards or * debugging; arbitrary mutations are rejected. * * @example * ```ts * import { BunSQLiteStorage } from '@lostgradient/weft/storage/sqlite/bun'; * import { workflow, Engine, type WorkflowContext } from '@lostgradient/weft'; * * // Durable on-disk storage * await using storage = new BunSQLiteStorage('./weft.db'); * await using engine = new Engine({ storage }); * * engine.register( * workflow({ name: 'echo' }).execute(async function* (ctx: WorkflowContext, input: unknown) { * return input; * }), * ); * * const handle = await engine.start('echo', { msg: 'hi' }); * console.log(await handle.result()); // { msg: 'hi' } * ``` */ export declare class BunSQLiteStorage implements Storage { #private; /** * Number of distinct prepared-statement cache entries for scan(). * Exposed for regression tests that assert the cache stays bounded * regardless of the numeric values callers pass. */ get scanStatementCacheSize(): number; constructor(path?: string); capabilities(): StorageCapabilities; get(key: string): Promise; put(key: string, value: Uint8Array): Promise; delete(key: string): Promise; has(key: string): Promise; deletePrefix(prefix: string): Promise; deleteRange(prefix: string, options: DeleteRangeOptions): Promise; scan(prefix: string, options?: ScanOptions): AsyncIterable<[string, Uint8Array]>; keys(prefix: string, options?: ScanOptions): AsyncIterable; count(prefix: string): Promise; scoped(prefix: string): Storage; batch(operations: BatchOperation[]): Promise; conditionalBatch(conditions: ConditionalBatchCondition[], operations: BatchOperation[]): Promise; query(sql: string, parameters?: SQLQueryBindings[]): Promise; [Symbol.dispose](): void; }