import { Observable } from 'rxjs'; import { PersistentWorkItem } from './persistent-work-item'; import { PersistentWorkItemApplyState } from './persistent-work-item-apply-state'; import { PersistentWorkflow } from './persistent-workflow'; /** * Store the custom checkpoint data if necessary. */ export interface PersistentWorkflowContextStore { /** * Store current context to allow restore. * * @param workItem the work item. * @param context the context of workflow. */ save(workItem: PersistentWorkItem>, context: PersistentWorkflowContext): Observable; } /** * The logging record. */ export interface PersistentWorkflowLog { /** * The timestamp. */ time: number; /** * The name of work item. */ name: string; /** * The state of work item. */ state: string; } /** * The context of workflow. */ export interface PersistentWorkflowContext { /** * The transit data which wouldn't be stored into persistent store, but can pass around within a workflow cycle. */ transitData: TTransitData; /** * The persistent data which would be saved and would be restored when browser was closed/reopened. */ persistentData: TPersistentData; /** * The store interface to take a snapshot at during a call. */ store: PersistentWorkflowContextStore; /** * The state of applying condition after preValidate() call. */ applyState: PersistentWorkItemApplyState; /** * The logging of state change. */ logs: PersistentWorkflowLog[]; /** * The workflow instance. */ workflow: PersistentWorkflow; /** * The version of restored workflow. */ restoreVersion?: number; /** * The error object. */ error?: any; /** * The instance ID. */ instanceId?: number; }