import { type DeleteRangeOptions } from './delete-range.ts'; import { type BatchOperation, type ScanOptions, type Storage, type StorageCapabilities } from './interface.ts'; /** Named WebExtension storage area used by {@link WebExtensionStorage}. * @example * ```ts * import { WebExtensionStorage, type WebExtensionStorageArea } from '@lostgradient/weft/storage/web-extension'; * const area: WebExtensionStorageArea = 'local'; * const storage = new WebExtensionStorage({ area }); * ``` */ export type WebExtensionStorageArea = 'local' | 'sync' | 'session' | 'managed'; /** Constructor options for {@link WebExtensionStorage}. * @example * ```ts * import { WebExtensionStorage, type WebExtensionStorageOptions } from '@lostgradient/weft/storage/web-extension'; * const options: WebExtensionStorageOptions = { area: 'sync' }; * const storage = new WebExtensionStorage(options); * ``` */ export type WebExtensionStorageOptions = { area?: WebExtensionStorageArea; }; /** * WebExtension storage adapter for browser extension contexts. * * Values are stored as JSON envelopes containing base64-encoded `Uint8Array` * bytes so the canonical Weft storage value type stays portable across * `browser.storage` and callback-style `chrome.storage` implementations. * * @example * ```ts * import { Engine } from '@lostgradient/weft'; * import { WebExtensionStorage } from '@lostgradient/weft/storage/web-extension'; * * await using storage = new WebExtensionStorage({ area: 'local' }); * await using engine = new Engine({ storage }); * ``` */ export declare class WebExtensionStorage implements Storage { #private; constructor(options?: WebExtensionStorageOptions, namespace?: unknown); 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; has(key: string): Promise; keys(prefix: string, options?: ScanOptions): AsyncIterable; count(prefix: string): Promise; deletePrefix(prefix: string): Promise; deleteRange(prefix: string, options: DeleteRangeOptions): Promise; scoped(prefix: string): Storage; [Symbol.dispose](): void; }