import { type DeleteRangeOptions } from './delete-range.ts'; import { type BatchOperation, type ConditionalBatchCondition, type ScanOptions, type Storage, type StorageCapabilities } from './interface.ts'; /** * Options for connecting {@link HTTPStorage} to a remote Weft storage API. * * @example * ```ts * import { HTTPStorage, type HTTPStorageOptions } from '@lostgradient/weft/storage/http'; * * const token = 'example-token'; * const options: HTTPStorageOptions = { * baseUrl: 'https://weft.example.com', * headers: { authorization: `Bearer ${token}` }, * }; * const storage = new HTTPStorage(options); * void storage; * ``` */ export type HTTPStorageOptions = { baseUrl: string | URL; headers?: Record; /** * Whether the remote server's storage backend supports compare-and-swap. * The client cannot detect this — it depends on the server's backend — so the * honest default is `false`: a feature gated on `conditionalBatch` fails fast * locally instead of issuing a request the server answers with `501`. Set * `true` only when you have verified the remote backend implements it. * * @default false */ remoteConditionalBatch?: boolean; }; /** * Remote {@link Storage} adapter backed by Weft's storage REST endpoints. * * Single-value reads and writes use `application/octet-stream`; scans stream * newline-delimited JSON entries with base64-encoded values. * * @example * ```ts * import { HTTPStorage } from '@lostgradient/weft/storage/http'; * * const token = 'example-token'; * await using storage = new HTTPStorage({ * baseUrl: 'https://weft.example.com', * headers: { authorization: `Bearer ${token}` }, * }); * ``` */ export declare class HTTPStorage implements Storage { #private; constructor(options: HTTPStorageOptions); 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; conditionalBatch(conditions: ConditionalBatchCondition[], 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; }