@mwillbanks/tuil-workflow
Persistent, resumable, observable multi-step workflows for tuil applications.
Overview
Persistent, resumable, observable multi-step workflows for tuil applications.
@mwillbanks/tuil-workflow is independently installable and also participates in the
umbrella @mwillbanks/tuil runtime where applicable.
Installation
npm install @mwillbanks/tuil-workflowHow it operates
Workflow runners coordinate typed state, guarded transitions, validation, nested and parallel work, operations, persistence, migration, retry, cancellation, and compensation.
API
| API | Signature | Description |
|---|---|---|
createWorkflow | function createWorkflow | Public function createWorkflow. |
defineOperationStep | function defineOperationStep | Public function defineOperationStep. |
defineStep | function defineStep | Public function defineStep. |
defineWorkflow | function defineWorkflow | Public function defineWorkflow. |
PersistedWorkflow | interface PersistedWorkflow | Public interface PersistedWorkflow. |
transition | function transition | Public function transition. |
WorkflowContext | interface WorkflowContext | Public interface WorkflowContext. |
WorkflowDefinition | interface WorkflowDefinition | Public interface WorkflowDefinition. |
WorkflowEvent | interface WorkflowEvent | Public interface WorkflowEvent. |
WorkflowEventType | type WorkflowEventType | Public type WorkflowEventType. |
WorkflowParallelBranch | interface WorkflowParallelBranch | Public interface WorkflowParallelBranch. |
WorkflowParallelSnapshot | interface WorkflowParallelSnapshot | Public interface WorkflowParallelSnapshot. |
WorkflowPersistence | interface WorkflowPersistence | Public interface WorkflowPersistence. |
WorkflowRunner | class WorkflowRunner | Public class WorkflowRunner. |
WorkflowSnapshot | interface WorkflowSnapshot | Public interface WorkflowSnapshot. |
WorkflowStatus | type WorkflowStatus | Public type WorkflowStatus. |
WorkflowStep | interface WorkflowStep | Public interface WorkflowStep. |
WorkflowTransition | interface WorkflowTransition | Public interface WorkflowTransition. |
Events and lifecycle
workflow:start, workflow:step-enter, workflow:step-leave, workflow:validate, workflow:skip, workflow:back, workflow:resume, workflow:retry, workflow:rollback, workflow:cancel, workflow:complete, and workflow:error.
All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.
Example
import { createWorkflow, defineWorkflow } from "@mwillbanks/tuil-workflow";
const runner = createWorkflow(defineWorkflow({ id: "setup", version: 1, initialState: {}, steps, transitions }));