/// import { Action } from 'redux'; import * as constants from './constants'; export interface MaybeModel { kind?: string; } export declare type Operation = constants.OPERATION_CHANGES | constants.OPERATION_FETCH_DOCS | constants.OPERATION_INSERT | constants.OPERATION_BULK_INSERT | constants.OPERATION_BULK_UPDATE | constants.OPERATION_UPDATE | constants.OPERATION_BULK_REMOVE | constants.OPERATION_REMOVE; export declare type LoadModels = { type: constants.LOAD_MODELS; payload: M[]; meta: { kind: string; }; }; export declare function initialized(name?: string): Initialized; export declare type Initialized = { type: constants.INITIALIZED; meta: { name?: string; }; }; export declare function modelInitialized(kind: string): ModelInitialized; export declare type ModelInitialized = { type: constants.MODEL_INITIALIZED; meta: { kind: string; }; }; export declare function loadModels(models: M[], kind: string): LoadModels; export declare type ModelMeta = { kind: string; fromSync: boolean; }; export declare type InsertModel = { type: constants.INSERT_MODEL; payload: M; meta: ModelMeta; }; export declare function insertModel(model: M, fromSync?: boolean): InsertModel; export declare type InsertBulkModels = { type: constants.INSERT_BULK_MODELS; payload: M[]; meta: ModelMeta; }; export declare function insertBulkModels(models: M[], kind: string, fromSync?: boolean): InsertBulkModels; export declare type UpdateModel = { type: constants.UPDATE_MODEL; payload: M; meta: ModelMeta; }; export declare function updateModel(model: M, fromSync?: boolean): UpdateModel; export declare type UpdateBulkModels = { type: constants.UPDATE_BULK_MODELS; payload: M[]; meta: ModelMeta; }; export declare function updateBulkModels(models: M[], kind: string, fromSync?: boolean): UpdateBulkModels; export declare type RemoveModel = { type: constants.REMOVE_MODEL; payload: { _id: string; _rev: string; }; meta: ModelMeta; }; export declare function removeModel(doc: { _id: string; _rev: string; }, kind: string, fromSync?: boolean): RemoveModel; export declare type RemoveBulkModels = { type: constants.REMOVE_BULK_MODELS; payload: { _id: string; _rev: string; }[]; meta: ModelMeta; }; export declare function removeBulkModels(models: { _id: string; _rev: string; }[], kind: string, fromSync?: boolean): RemoveBulkModels; export declare type ModelError = { type: constants.MODEL_ERROR; payload: Error; meta: { operation: Operation; }; }; export declare function modelError(error: Error, operation: Operation): ModelError; export interface SyncModel { kind: string; _id: string; _rev?: string; createdAt: Date; modifiedAt: Date; [k: string]: any; toJSON?(): { [K in keyof SyncModel]: SyncModel[K]; }; } export interface SyncModelData { kind: string; _id?: string; _rev?: string; createdAt?: Date; modifiedAt?: Date; } /** * SyncModelBase offers a basic implementation of setting/creating _id, createdAt and modifiedAt */ export declare class SyncModelBase implements SyncModel { readonly kind: string; readonly _id: string; readonly _rev?: string; readonly createdAt: Date; modifiedAt: Date; constructor(data: SyncModelData); } export declare type DeletedDoc = PouchDB.Core.IdMeta & PouchDB.Core.RevisionIdMeta & { _deleted: boolean; }; export declare function isDeletedDoc(doc: PouchDB.Core.ExistingDocument<{}>): doc is DeletedDoc; export declare function isModel(doc?: {}): doc is SyncModel; export declare function isModelToSync(doc?: {}, modelsToSync?: string[]): doc is SyncModel; export declare function isAction(action: {} | Function): action is Action; export declare type ActionWithMeta = { type: string; meta: { [k: string]: number | string | boolean | undefined; }; }; export declare function isInsertAction(action: {} | Function): action is InsertModel; export declare function isBulkInsertAction(action: {} | Function): action is InsertBulkModels; export declare function isUpdateAction(action: {} | Function): action is UpdateModel; export declare function isBulkUpdateAction(action: {} | Function): action is UpdateBulkModels; export declare function isRemoveAction(action: {} | Function): action is RemoveModel; export declare function isBulkRemoveAction(action: {} | Function): action is RemoveBulkModels; export declare function hasMeta(action: {} | Function): action is ActionWithMeta; export declare function isFromSync(action: {} | Function): boolean;