/** * Promise-base interface for interacting with indexedDB * This is where actual operations to IndexedDB occurs */ import { Doc } from "../types"; import { EnsureIndexOptions } from "./datastore"; export type Line = Partial & Record; interface PersistenceLayer { get(key: string): Promise; getBulk(keys: string[]): Promise<(Line | undefined)[]>; set(key: string, value: Line): Promise; setBulk(entries: [string, Line][]): Promise; delBulk(keys: string[]): Promise; clear(): Promise; keys(): Promise; documents(): Promise; byID(_id: string): Promise; } export type UseStore = (txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike) => Promise; export declare class IDB implements PersistenceLayer { private store; constructor(name: string); /** * Converts IDB requests/transactions to promises. */ private pr; /** * Converts cursor iterations to promises */ private eachCursor; /** * Get a value by its key. */ get(key: string): Promise; /** * Get values for a given set of keys */ getBulk(keys: string[]): Promise<(Line | undefined)[]>; /** * Set a value with a key. */ set(key: string, value: Line): 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. */ setBulk(entries: [string, Line][]): Promise; /** * Delete multiple keys at once. * */ delBulk(keys: string[]): Promise; /** * Clear all values in the store. * */ clear(): Promise; /** * Get all keys in the store. */ keys(): Promise; /** * Get all documents in the store. */ documents(): Promise; /** * Get key by ID (since keys are ID_REV) */ byID(_id: string): Promise; /** * Get length of the DB */ length(): Promise; } export {};