export interface IKVStore { /** * Get a value by its key. * * @param key */ get(key: string): Promise; /** * Set a value with a key. * * @param key * @param value */ set(key: string, value: any): Promise; /** * Set multiple values at once. This is faster than calling set() multiple times. * It's also atomic – if one of the pairs can't be added, none will be added. * * @param entries Array of entries, where each entry is an array of `[key, value]`. */ setMany(entries: [string, any][]): Promise; /** * Get multiple values by their keys * * @param keys */ getMany(keys: string[]): Promise<[string, T][]>; /** * Delete a particular key from the store. * * @param key */ delete(key: string): Promise; /** * Delete multiple keys at once. * * @param keys List of keys to delete. */ deleteMany(keys: string[]): Promise; /** * Clear all values in the store. * */ clear(): Promise; keys(): Promise; values(): Promise; entries(): Promise<[string, T][]>; } export declare class LocalStorageKVStore implements IKVStore { get(key: string): Promise; set(key: string, value: any): Promise; setMany(entries: [string, any][]): Promise; getMany(keys: string[]): Promise<[string, T][]>; delete(key: string): Promise; deleteMany(keys: string[]): Promise; clear(): Promise; keys(): Promise; values(): Promise; entries(): Promise<[string, T][]>; } export declare class MemoryKVStore implements IKVStore { private storage; get(key: string): Promise; set(key: string, value: any): Promise; setMany(entries: [string, any][]): Promise; getMany(keys: string[]): Promise<[string, T][]>; delete(key: string): Promise; deleteMany(keys: string[]): Promise; clear(): Promise; keys(): Promise; values(): Promise; entries(): Promise<[string, T][]>; } export type UseStore = (txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike) => Promise; export declare class IndexedDBKVStore implements IKVStore { store: UseStore; static isIndexedDBSupported(): boolean; constructor(databaseName: string, storeName: string); private promisifyRequest; private createStore; private eachCursor; get(key: string): Promise; set(key: string, value: any): Promise; setMany(entries: [string, any][]): Promise; getMany(keys: string[]): Promise<[string, T][]>; delete(key: string): Promise; deleteMany(keys: string[]): Promise; clear(): Promise; keys(): Promise; values(): Promise; entries(): Promise<[ KeyType, ValueType ][]>; }