import { ContractType, AuthInput, Implementations, KeyValueStoreTypes, HandleResult } from './globalTypes.js'; import { AbstractBackend } from './backendAbstract.js'; export declare type ValueType = string | ArrayBuffer | ArrayBufferView | ReadableStream; export declare type KvDataTypes = 'text' | 'json' | 'arrayBuffer' | 'stream'; export declare type GetResultType = T extends undefined ? string : T extends 'text' ? string : T extends 'json' ? object : T extends 'arrayBuffer' ? ArrayBuffer : T extends 'stream' ? ReadableStream : never; export declare type ListEntry = { name: string; expiration?: number; metadata: object; }; export declare type KvListReturn = { keys: ListEntry[]; list_complete: boolean; cursor: string; }; export declare type KV = { list: (options?: { prefix?: string; limit?: number; cursor?: string; }) => Promise; get: ((key: string, type?: T) => Promise | null>); getWithMetadata: ((key: string, type?: T) => Promise<{ value: GetResultType | null; metadata: object | null; }>); put: (key: string, value: ValueType, additional?: { metadata?: any; expiration?: number; expirationTtl?: number; }) => Promise; delete: (key: string) => Promise; }; /** * Global variable to set custom key value store implementation * **/ export declare var customKv: { [key: string]: () => KV; }; export declare const client: (key: KeyValueStoreTypes) => KV; export declare const destroyAllClients: () => void; export declare const destroyClient: (key: string) => void; export declare const init: (key: any) => KV; declare type KVi = Implementations.keyValue; export declare const get: (contract: ContractType<"GET", Implementations.keyValue, IN, OUT>, auth: AuthInput, idIn: undefined | string | string[], input?: IN | undefined) => Promise>; export declare const post: (contract: ContractType<"POST", Implementations.keyValue, IN, OUT>, auth: AuthInput, id: string | undefined, body: IN) => Promise>; export declare const del: (contract: ContractType<"DELETE", Implementations.keyValue, IN, OUT>, auth: AuthInput, id: string | string[]) => Promise>; export declare const patch: (contract: ContractType<"PATCH", Implementations.keyValue, IN, OUT>, auth: AuthInput, id: string, body: IN) => Promise>; export declare const put: (contract: ContractType<"PUT", Implementations.keyValue, IN, OUT>, auth: AuthInput, id: string, body: IN) => Promise>; export declare const getKvProvider: () => AbstractBackend; export {};