epps
Version:
Enhances Pinia stores with advanced features such as persistence, encryption, and store extension. Simplifies state management and ensures data security for Vue.js and Nuxt applications.
35 lines (34 loc) • 1.25 kB
TypeScript
import { ClientStorage, StorageItem } from "../types/storage";
interface ObjectStoreCreationOptions {
autoIncrement?: boolean;
keyPath?: string;
}
type ObjectItemKey = string | number;
export default class IndexedDB implements ClientStorage {
private _db?;
private _localStorageVersionKey;
private _name;
private _objectStore?;
private _objectStoreOptions?;
private _objectStoreName;
private _transactionMode;
private _version;
constructor(objectStoreName: string, objectStoreCreationOptions?: ObjectStoreCreationOptions, transactionMode?: IDBTransactionMode);
clear(): void;
private createObjectStore;
deleteObjectStore(): void;
getItem(key: ObjectItemKey): Promise<StorageItem | undefined>;
getObjectStoreItem(indexName: string, indexValue: string | number): Promise<Object | undefined>;
private getStoredVersionNumber;
private handleDeleteRequest;
private onError;
private open;
private openRequestEventsHandler;
removeItem(key: ObjectItemKey): void;
removeItems(excludedItems?: any[]): void;
private requestEventsHandler;
private saveVersion;
setItem(item: Object, index?: string[]): void;
updateItem(item: Object): void;
}
export {};