/** * @module storage-helpers.web.mts * * This is the storage abstraction that wraps indexed db. * * NOTE: * * I just want to say that callbacks are not very cool and that much of the * ridiculousness of this code is due to this fact. * * That said, these functions try to ensure db is closed per function via global * finally block. With nested promises and callbacks, this is a big f*n mess. * But more importantly, this is why there aren't db.close() calls sprinkled * throughout each function. But ths assumes that I am wiring up resolve/reject * calls correctly through all the paths and this is far from certain. */ import { Dirent } from "./storage-types.web.mjs"; /** * key/value pair interface for working with indexeddb */ export interface IndexedDBStorageDatum { key: string; /** * may have to change this to work with binary array buffers. */ value: string | Uint8Array; } export declare function askForPersistStorage(): Promise; /** * initializes db ALWAYS but initializes store given by {@link storeName} ONLY * WHEN VERSION IS HIGHER THAN EXISTING VERSION. * * @see {@link storageCreateStoreIfNotExist} */ export declare function initializeStorage({ dbName, storeName, version, logalot, }: { dbName: string; storeName?: string; version?: number; logalot?: boolean; }): Promise; /** * wrapper for filtered indexedDB.databases() call basically * * @returns db info for given dbName */ export declare function storageGetDBInfo({ dbName, logalot, }: { dbName: string; logalot?: boolean; }): Promise; /** * wrapper that ensures indexeddb store exists */ export declare function storageCreateStoreIfNotExist({ dbName, storeName, logalot, }: { dbName: string; storeName: string; logalot?: boolean; }): Promise; /** * set key/value item * helper for indexeddb storage. */ export declare function storagePut({ dbName, version, storeName, key, value, logalot, }: { dbName: string; version?: number; storeName: string; key: string; value: string | Uint8Array; logalot?: boolean; }): Promise; /** * get item via key * helper for indexeddb storage. */ export declare function storageGet({ dbName, version, storeName, key, logalot, }: { dbName: string; version?: number; storeName: string; key: string; logalot?: boolean; }): Promise; /** * checks if db exists. if store is provided, checks to see if that specific * store exists in the db's schema. * * helper for indexeddb storage. */ export declare function storageDBExists({ dbName, store, }: { dbName: string; store?: string; }): Promise; /** * helper function equivalent to rm -rf in our filesystem space */ export declare function storageRmRF({ dbName, storeName, pathToRm, }: { dbName: string; storeName: string; pathToRm: string; }): Promise; /** * helper function equivalent to readdir in our filesystem space */ export declare function storageReaddir({ dbName, storeName, dirPath, withFileTypes, }: { dbName: string; storeName: string; dirPath: string; withFileTypes?: boolean; }): Promise; /** * Deletes a single key from indexeddb storage. */ export declare function storageDelete({ dbName, storeName, key, logalot, }: { dbName: string; storeName: string; key: string; logalot?: boolean; }): Promise; //# sourceMappingURL=storage-helpers.web.d.mts.map