@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
63 lines (61 loc) • 2.1 kB
JavaScript
import { PersistentWorkItemState } from './persistent-work-item-state';
/**
* Abstract class of work item to build a work flow. The sequence of handlers called within
* the work item.
*
* [Standard sequence]
* The workflow has been completed within single worker instance. If there is an error the
* sequence stops at the error.
*
* 1) init() => void.
* 2) preValidate() => Observable. (state === PersistentWorkItemState.PreValidating)
* 3) apply() => Observable.
* 4) postValidate() => Observable.
* 5) finalize() => void.
*
* [Restore the work item]
* When user closed the browser but completion of apply() was not undetermined, restoration of
* work item will be processed.
*
* If preValidate() updates applyState to 'PersistentWorkItemApplyState.Required', call apply() again.
* 1) preValidate() => Observable. (state === PersistentWorkItemState.PreValidating)
* 2) apply() => Observable.
* 3) postValidate() => Observable.
* 4) finalize() => void.
*
* If preValidate() updates applyState to 'PersistentWorkItemApplyState.Skip', skip apply().
* 1) preValidate() => Observable. (state === PersistentWorkItemState.PreValidating)
* 2) postValidate() => Observable.
* 3) finalize() => void.
*
* When apply() was already succeeded state, it starts from postValidate() call.
*
* 1) postValidate() => Observable.
* 2) finalize() => void.
*
*/
export class PersistentWorkItem {
name;
/**
* The identification of work item in the workflow.
*/
id;
/**
* The next identification of work item. This value can be update dynamically to switch the work item
* instead of single sequence.
*/
nextId;
/**
* The state of work item. This value is maintained by the workflow runner, so don't modify it.
*/
state = PersistentWorkItemState.NotStarted;
/**
* Initializes a new instance of the PersistentWorkItem class.
*
* @param name the name of work item.
*/
constructor(name) {
this.name = name;
}
}
//# sourceMappingURL=persistent-work-item.js.map