import { type DeleteRangeOptions } from './delete-range'; import { type BatchOperation, type ConditionalBatchCondition, type ScanOptions, type Storage, type StorageCapabilities } from './interface'; /** * Configuration for connecting to a Turso/libSQL database. * * @example * ```ts * import { TursoStorage, type TursoStorageOptions } from '@lostgradient/weft/storage/turso'; * * const options: TursoStorageOptions = { * url: 'file:local.db', * }; * await using storage = new TursoStorage(options); * ``` */ export type TursoStorageOptions = { /** The database URL (e.g., `libsql://your-db.turso.io`, `file:local.db`, `file::memory:`). */ url: string; /** Authentication token for remote Turso databases. */ authToken?: string; }; /** * Storage adapter backed by Turso/libSQL for distributed SQLite deployments. * * Implements the same `Storage` interface as `BunSQLiteStorage`, but uses `@libsql/client` * so the database can be a remote Turso instance or a local file. * Switch from `BunSQLiteStorage` to `TursoStorage` by changing the connection string — * the rest of the application stays the same. * * @example * ```ts * import { TursoStorage } from '@lostgradient/weft/storage/turso'; * import { Engine } from '@lostgradient/weft'; * * await using storage = new TursoStorage({ * url: 'libsql://my-db.turso.io', * ...(process.env['TURSO_AUTH_TOKEN'] ? { authToken: process.env['TURSO_AUTH_TOKEN'] } : {}), * }); * await using engine = new Engine({ storage }); * ``` */ export declare class TursoStorage implements Storage { #private; constructor(options: TursoStorageOptions); /** * Reports the honest floor for every Turso/libSQL URL form. * * `readAfterWrite` is always `session`: one client observes its own writes, * but another engine instance or replica-routed client may lag. That is why * `assertDurableStorageForRecovery()` rejects `TursoStorage` for durable * recovery even when `persistence` is `local` or `remote`. */ 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?: unknown[]): Promise; [Symbol.dispose](): void; }