import { Future } from "@omnia/fx-models"; import { Ref } from "vue"; /** * Async api for working with indexedDB. Remember to await the useIndexedDb since its async * @export * @param {string} name * @param {string} table * @return {*} {Future} */ export declare function useIndexedDb(name: string, table: string): Future; /** * * * @export * @interface IndexedDbApi */ export interface IndexedDbApi { /** * Current database instance * @type {(IDBDatabase | null)} * @memberof IndexedDbApi */ currentDb: IDBDatabase | null; /** * Current database name * @type {Ref} * @memberof IndexedDbApi */ currentDbName: Ref; /** * Current database version * @type {Ref} * @memberof IndexedDbApi */ currentDbVersion: Ref; /** * Gets the data by key from the database * @memberof IndexedDbApi */ get: (key: IDBValidKey) => Promise; /** * Gets all the data from the database * @memberof IndexedDbApi */ getAll: () => Promise>; /** * Adds the key to the database if the key exists it will throw exception * use upsert for add or update operations * @memberof IndexedDbApi */ add: (key: IDBValidKey, data: T) => Promise; /** * Does an add or update depending on if the key exists * @memberof IndexedDbApi */ upsert: (key: IDBValidKey, data: T) => Promise; /** * Removes the key from the database * @memberof IndexedDbApi */ remove: (key: IDBValidKey) => Promise; /** * Closes the database connection and dispsoses the instance from the cache * Note if you have multiple tables opened on the same database it will close all instances * this means you have to call useIndexedDb again after this * @memberof IndexedDbApi */ close: () => void; }