import A from 'automerge'; import { AnyAction } from 'redux'; export { ChangeFn } from 'automerge'; import { Clock, Snapshot } from '@localfirst/storage-abstract'; declare type CollectionChange = { collection: string; id: string; fn: A.ChangeFn; }; declare type DeleteFlag = { collection: string; id: string; delete: true; }; declare type DropFlag = { collection: string; drop: true; }; export declare type ChangeManifest = A.ChangeFn | CollectionChange | DeleteFlag | DropFlag; declare type CM = ChangeManifest; export declare const isFunction: (x: ChangeManifest) => x is A.ChangeFn; export declare const isChange: (x: ChangeManifest) => x is CollectionChange; export declare const isDeleteFlag: (x: CM) => x is DeleteFlag; export declare const isDropFlag: (x: CM) => x is DropFlag; export declare type ProxyReducer = (state: T, action: AnyAction) => null | ChangeManifest | ChangeManifest[]; /** * For each document, we have a `Clock`. A ClockMap maps all documentIds that we have to the * corresponding `Clock`. */ export declare type ClockMap = { [documentId: string]: Clock; }; /** * Associates documentIds with a change function to be executed by the reducer. */ export interface ChangeMap { [documentId: string]: A.ChangeFn | symbol; } /** * `RepoHistory` is an object mapping each `documentId` to an array of changes representing the * corresponding document's entire history. */ export declare type RepoHistory = { [documentId: string]: A.Change[]; }; /** * `RepoSnapshot` is a plain JavaScript representation of a repo's contents. It is an object, each * property of which is also an object; so any primitive values or arrays need to be nested a couple * of levels in. */ export interface RepoSnapshot { [documentId: string]: Snapshot | null; } export * from '@localfirst/storage-abstract';