@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
75 lines (74 loc) • 2.07 kB
TypeScript
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<TTransitData, TPersistentData> {
/**
* Store current context to allow restore.
*
* @param workItem the work item.
* @param context the context of workflow.
*/
save(workItem: PersistentWorkItem<PersistentWorkflowContext<TTransitData, TPersistentData>>, context: PersistentWorkflowContext<TTransitData, TPersistentData>): Observable<void>;
}
/**
* 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<TTransitData, TPersistentData> {
/**
* 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<TTransitData, TPersistentData>;
/**
* 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;
}