import { type DeleteRangeOptions } from './delete-range'; import { type BatchOperation, type ConditionalBatchCondition, type ScanOptions, type Storage, type StorageCapabilities } from './interface'; type IndexedDbRuntime = { indexedDB: Pick; IDBKeyRange: Pick; }; /** * IndexedDB-backed {@link Storage} implementation for browser and service-worker * environments. * * Initiates an IndexedDB open request on construction and lazily awaits it on * the first call. All operations transparently await the in-flight open before * issuing their transaction. The database has a single `'kv'` object store, and * `databaseName` defaults to `'weft'`. Use this when running weft inside a * browser tab or service worker where SQLite and LMDB are unavailable. * * @example * ```ts * import { IndexedDBStorage } from '@lostgradient/weft/storage/indexeddb'; * import { workflow, Engine, type WorkflowContext } from '@lostgradient/weft'; * * // Opens (or re-opens) the default 'weft' IndexedDB database * await using storage = new IndexedDBStorage(); * await using engine = new Engine({ storage }); * * engine.register( * workflow({ name: 'greet' }).execute(async function* (ctx: WorkflowContext, input: { name: string }) { * return `Hello, ${input.name}!`; * }), * ); * * const handle = await engine.start('greet', { name: 'World' }); * console.log(await handle.result()); // 'Hello, World!' * ``` */ export declare class IndexedDBStorage implements Storage { #private; constructor(databaseName?: string, runtime?: IndexedDbRuntime); 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]>; batch(operations: BatchOperation[]): Promise; conditionalBatch(conditions: ConditionalBatchCondition[], operations: BatchOperation[]): Promise; keys(prefix: string, options?: ScanOptions): AsyncIterable; count(prefix: string): Promise; scoped(prefix: string): Storage; [Symbol.dispose](): void; } export {};