UNPKG

zeno-db

Version:

A lightweight, offline-first client-side database with automatic sync capabilities

31 lines (30 loc) 935 B
import { StorageAdapter, Change } from '../types'; export declare class IndexedDBAdapter implements StorageAdapter { private dbName; private storeName; private version; private db; private subscribers; private changes; constructor(config: { name?: string; storeName?: string; version?: number; }); init(): Promise<void>; get(key: string): Promise<any>; set(key: string, value: any): Promise<void>; delete(key: string): Promise<void>; keys(): Promise<string[]>; getAll(): Promise<Record<string, any>>; getMany(keys: string[]): Promise<any[]>; setMany(items: { id: string; [key: string]: any; }[]): Promise<void>; subscribe(callback: (key: string, value: any) => void): void; notifySubscribers(key: string, value: any): void; getChanges(): Change[]; clearChanges(): void; queueChange(change: Change): void; }