@deno/kv
Version:
A Deno KV client library optimized for Node.js.
37 lines (36 loc) • 1.57 kB
TypeScript
import { KvConnectProtocolVersion } from "./kv_connect_api.js";
import { KvService } from "./kv_types.js";
import { DecodeV8, EncodeV8 } from "./kv_util.js";
type Fetcher = typeof fetch;
export interface RemoteServiceOptions {
/** Access token used to authenticate to the remote service */
readonly accessToken: string;
/** Wrap unsupported V8 payloads to instances of UnknownV8 instead of failing.
*
* Only applicable when using the default serializer. */
readonly wrapUnknownValues?: boolean;
/** Enable some console logging */
readonly debug?: boolean;
/** Custom serializer to use when serializing v8-encoded KV values.
*
* When you are running on Node 18+, pass the 'serialize' function in Node's 'v8' module. */
readonly encodeV8?: EncodeV8;
/** Custom deserializer to use when deserializing v8-encoded KV values.
*
* When you are running on Node 18+, pass the 'deserialize' function in Node's 'v8' module. */
readonly decodeV8?: DecodeV8;
/** Custom fetcher to use for the underlying http calls.
*
* Defaults to global 'fetch'`
*/
readonly fetcher?: Fetcher;
/** Max number of times to attempt to retry certain fetch errors (like 5xx) */
readonly maxRetries?: number;
/** Limit to specific KV Connect protocol versions */
readonly supportedVersions?: KvConnectProtocolVersion[];
}
/**
* Return a new KvService that can be used to open a remote KV database.
*/
export declare function makeRemoteService(opts: RemoteServiceOptions): KvService;
export {};