import SyncItem from "./SyncItem"; import Collection from "./Collection"; import { SyncOptions } from "./types/SyncTypes"; import SyncStatus from "./types/SyncStatus"; declare class Synchronizer { /** Used to keep state of sync process. */ private lastSyncedItem?; private _startDate?; private _endDate?; /** List of filtered items (removing conflicts, etc) that actually get sent to the destination collection for syncing. */ private _itemsToSync; private _ignoredItems; private _conflictItems; private _syncStatus; private destCollection; private committed; private _rollbacked; get successfullyRollbacked(): boolean; get successfullyCommitted(): boolean; get syncStatus(): SyncStatus; get lastUpdatedAt(): Date | undefined; get itemsToSync(): SyncItem[]; get conflictItems(): SyncItem[]; get ignoredItems(): SyncItem[]; constructor(destCollection: Collection); /** * This method sends the data to the destination collection. * It throws no exception related to WRITE/DELETE database operations. * READ operations used inside this method might fail, as well as errors due to wrong * arguments, but when a WRITE/DELETE fails, it sets the status accordingly for further inspection, * and does not throw any error. * This method can only be executed once. In order to sync again, create a new instance. */ executeSync(lastSyncAt: Date | undefined, items: SyncItem[], options: SyncOptions): Promise; private cleanUp; /** Executes a commit. If it does not succeed, status is set to `SyncStatus.UnexpectedError`. */ commit(): Promise; /** Executes a rollback. If it does not succeed, status is set to `SyncStatus.UnexpectedError`. */ rollback(): Promise; /** * Retries a function N times until it succeeds. If it doesn't succeed, it sets * the status to error. */ private retryUntilSuccess; private syncItems; abort(): void; private itemHighestUpdatedAt; private areItemsSorted; } export default Synchronizer;