import { StorageAdapter } from "./api/StorageAdapter"; import { ModelSchema } from "../ModelSchema"; import { Filter } from "../filters"; /** * Implements local storage that saves data to specified adapter (underlying store) * and notifies developers about changes in store. */ export declare class LocalStorage { readonly adapter: StorageAdapter; constructor(adapter: StorageAdapter); /** * @returns a new LocalStorage instance in transaction mode * In transaction, no events are fired unitll the transaction is committed. */ createTransaction(): Promise; /** * Commits a transaction if one is open. * @throws Will throw error if not in transaction */ commit(): Promise; /** * Rollback all changes that occured in this transaction, if one is open. * @throws Will throw error if not in transaction */ rollback(): Promise; save(storeName: string, input: any): Promise; query(storeName: string, filter?: Filter): Promise; queryById(storeName: string, idField: string, id: string): Promise; update(storeName: string, input: any, filter?: Filter): Promise; updateById(storeName: string, idField: string, input: any): Promise; saveOrUpdate(storeName: string, idField: string, input: any): Promise; remove(storeName: string, idField: string, filter?: Filter): Promise; removeById(storeName: string, idField: string, input: any): Promise; deleteStore(storeName: string): Promise; /** * Create store in underlying storage provider * * @param config */ addStore(config: ModelSchema): void; /** * Trigger creation of stores in underlying storage provider * * @param config */ createStores(): void; }