/** * Storage decorator that transparently compresses and decompresses payloads. * Wraps any {@link Storage} implementation and applies compression above a * configurable size threshold. * * @module storage/compressed-storage */ import type { CompressionOptions } from '../core/compression.ts'; import { type BatchOperation, type ScanOptions, type Storage, type StorageCapabilities } from './interface.ts'; /** * {@link Storage} decorator that transparently compresses payloads above a * configurable size threshold before writing and decompresses on read. * * Wraps any `Storage` implementation — pass a {@link BunSQLiteStorage}, * {@link MemoryStorage}, or any other backend as the first argument. The same * compression algorithm and threshold apply to every stored key. * * @example * ```ts * import { CompressedStorage } from '@lostgradient/weft/storage/compressed'; * import { workflow, Engine, MemoryStorage } from '@lostgradient/weft'; * * await using inner = new MemoryStorage(); * await using storage = new CompressedStorage(inner, { * algorithm: 'gzip', * threshold: 1024, * }); * await using engine = new Engine({ storage }); * * engine.register(workflow({ name: 'noop' }).execute(async function* () { return 'done'; })); * const handle = await engine.start('noop', null); * console.log(await handle.result()); // 'done' * ``` */ export declare class CompressedStorage implements Storage { #private; constructor(inner: Storage, options?: CompressionOptions); capabilities(): StorageCapabilities; get(key: string): Promise; put(key: string, value: Uint8Array): Promise; delete(key: string): Promise; scan(prefix: string, options?: ScanOptions): AsyncIterable<[string, Uint8Array]>; batch(operations: BatchOperation[]): Promise; [Symbol.dispose](): void; }