tuil
ReferencePackages

@mwillbanks/tuil-workflow

Persistent, resumable, observable multi-step workflows for tuil applications.

View rawEdit

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-workflow

How it operates

Workflow runners coordinate typed state, guarded transitions, validation, nested and parallel work, operations, persistence, migration, retry, cancellation, and compensation.

Documentation flow diagram. idle; running; blocked | completed | failed | cancelled | rolling-back; S0 leads to S1; S1 leads to S2
Documentation flow diagram. idle; running; blocked | completed | failed | cancelled | rolling-back; S0 leads to S1; S1 leads to S2

API

APISignatureDescription
createWorkflowfunction createWorkflowPublic function createWorkflow.
defineOperationStepfunction defineOperationStepPublic function defineOperationStep.
defineStepfunction defineStepPublic function defineStep.
defineWorkflowfunction defineWorkflowPublic function defineWorkflow.
PersistedWorkflowinterface PersistedWorkflowPublic interface PersistedWorkflow.
transitionfunction transitionPublic function transition.
WorkflowContextinterface WorkflowContextPublic interface WorkflowContext.
WorkflowDefinitioninterface WorkflowDefinitionPublic interface WorkflowDefinition.
WorkflowEventinterface WorkflowEventPublic interface WorkflowEvent.
WorkflowEventTypetype WorkflowEventTypePublic type WorkflowEventType.
WorkflowParallelBranchinterface WorkflowParallelBranchPublic interface WorkflowParallelBranch.
WorkflowParallelSnapshotinterface WorkflowParallelSnapshotPublic interface WorkflowParallelSnapshot.
WorkflowPersistenceinterface WorkflowPersistencePublic interface WorkflowPersistence.
WorkflowRunnerclass WorkflowRunnerPublic class WorkflowRunner.
WorkflowSnapshotinterface WorkflowSnapshotPublic interface WorkflowSnapshot.
WorkflowStatustype WorkflowStatusPublic type WorkflowStatus.
WorkflowStepinterface WorkflowStepPublic interface WorkflowStep.
WorkflowTransitioninterface WorkflowTransitionPublic 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 }));

On this page