import { OpenDBCallbacks, IDBPDatabase } from 'idb'; import { NetIdType } from './networkConfig'; export declare const INDEX_DB_ERROR = "A mutation operation was attempted on a database that did not allow mutations."; export interface IDBIndex { name: string; unique?: boolean; } export interface IDBStores { name: string; keyPath?: string; indexes?: IDBIndex[]; } export interface IDBConstructor { dbName: string; stores?: IDBStores[]; } export declare class IndexedDB { dbExists: boolean; isBlocked: boolean; options: OpenDBCallbacks; dbName: string; dbVersion: number; db?: IDBPDatabase; constructor({ dbName, stores }: IDBConstructor); initDB(): Promise; _removeExist(): Promise; getFromIndex({ storeName, indexName, key, }: { storeName: string; indexName: string; key?: string; }): Promise; getAllFromIndex({ storeName, indexName, key, count, }: { storeName: string; indexName: string; key?: string; count?: number; }): Promise; getItem({ storeName, key }: { storeName: string; key: string; }): Promise; addItem({ storeName, data, key }: { storeName: string; data: any; key: string; }): Promise; putItem({ storeName, data, key }: { storeName: string; data: any; key?: string; }): Promise; deleteItem({ storeName, key }: { storeName: string; key: string; }): Promise; getAll({ storeName }: { storeName: string; }): Promise; /** * Simple key-value store inspired by idb-keyval package */ getValue(key: string): Promise; setValue(key: string, data: any): Promise; delValue(key: string): Promise; clearStore({ storeName, mode }: { storeName: string; mode: IDBTransactionMode; }): Promise; createTransactions({ storeName, data, mode, }: { storeName: string; data: any; mode: IDBTransactionMode; }): Promise; createMultipleTransactions({ storeName, data, index, mode, }: { storeName: string; data: any[]; index?: any; mode?: IDBTransactionMode; }): Promise; } /** * Should check if DB is initialized well */ export declare function getIndexedDB(netId?: NetIdType): Promise;