/** * Please be aware these types are compatible with the keyv package, to ensure we can use its store-adapters for free. * * Be very careful when extending/changing!. Normally you will want to create an adapter or decorator for your additional behaviour or requirements */ import { OrPromise } from '@veramo/utils'; export interface KeyvOptions { [key: string]: any; /** Namespace for the current instance. */ namespace?: string | undefined; /** A custom serialization function. */ serialize?: (data: KeyvDeserializedData) => OrPromise; /** A custom deserialization function. */ deserialize?: (data: any) => OrPromise | undefined>; /** The connection string URI. */ uri?: string | undefined; /** The storage adapter instance to be used by Keyv. */ store?: KeyvStore | undefined; /** Default TTL. Can be overridden by specififying a TTL on `.set()`. */ ttl?: number | undefined; /** Specify an adapter to use. e.g `'redis'` or `'mongodb'`. */ adapter?: 'redis' | 'mongodb' | 'mongo' | 'sqlite' | 'postgresql' | 'postgres' | 'mysql' | object | string | undefined; /** Enable compression option **/ compression?: KeyvCompressionAdapter | undefined; emitErrors?: boolean; } export interface KeyvCompressionAdapter { compress(value: any, options?: any): OrPromise; decompress(value: any, options?: any): OrPromise; serialize(value: any): OrPromise; deserialize(value: any): OrPromise; } export interface KeyvDeserializedData { value: Value; expires: number | undefined; } export type KeyvStoredData = KeyvDeserializedData | string | Value | undefined; export interface KeyvStore { namespace?: string | undefined; opts: KeyvOptions; on?(eventName: string | symbol, listener: (...args: any[]) => void): void; get(key: string | string[], options?: { raw?: boolean; }): OrPromise | Array>>; getMany?(keys: string[], options?: { raw?: boolean; }): OrPromise>> | undefined; iterator?(namespace?: string | undefined): AsyncGenerator; set(key: string, value: Value, ttl?: number): any; delete(key: string | string[]): OrPromise; deleteMany?(keys: string[]): OrPromise; clear(): OrPromise; has?(key: string): OrPromise; disconnect?(): void; } //# sourceMappingURL=keyv-types.d.ts.map