tuil
ReferencePackages@mwillbanks/tuil-workflowAPI

WorkflowDefinition

interface exported by @mwillbanks/tuil-workflow.

View rawEdit

interface

Public interface exported by @mwillbanks/tuil-workflow.

export interface WorkflowDefinition<TState> {
  readonly id: string;
  readonly version: number;
  readonly initialState: TState | (() => TState);
  readonly steps: Readonly<Record<string, WorkflowStep<TState>>>;
  readonly transitions: readonly WorkflowTransition<TState>[];
  readonly persistence?: WorkflowPersistence<TState>;
  readonly migrate?: (
    persisted: PersistedWorkflow<unknown>,
    signal: AbortSignal,
  ) => PersistedWorkflow<TState> | Promise<PersistedWorkflow<TState>>;
  readonly exitGuard?: (
    context: WorkflowContext<TState>,
  ) => boolean | Promise<boolean>;
  readonly analytics?: (event: WorkflowEvent<TState>) => void;
  readonly onObserverError?: (error: unknown) => void;
}

Members

MemberTypeRequiredDescriptionRelated types
idstringYesThe id member uses the string contract.
versionnumberYesThe version member uses the number contract.
initialStateTState | (() => TState)YesThe initialState member uses the TState | (() => TState) contract.
stepsReadonly<Record<string, WorkflowStep<TState>>>YesThe steps member uses the Readonly<Record<string, WorkflowStep<TState>>> contract.WorkflowStep
transitionsreadonly WorkflowTransition<TState>[]YesThe transitions member uses the readonly WorkflowTransition<TState>[] contract.WorkflowTransition
persistenceWorkflowPersistence<TState> | undefinedNoThe persistence member uses the WorkflowPersistence<TState> | undefined contract.WorkflowPersistence
migrate((persisted: PersistedWorkflow<unknown>, signal: AbortSignal) => PersistedWorkflow<TState> | Promise<PersistedWorkflow<TState>>) | undefinedNoThe migrate member uses the ((persisted: PersistedWorkflow<unknown>, signal: AbortSignal) => PersistedWorkflow<TState> | Promise<PersistedWorkflow<TState>>) | undefined contract.PersistedWorkflow
exitGuard((context: WorkflowContext<TState>) => boolean | Promise<boolean>) | undefinedNoThe exitGuard member uses the ((context: WorkflowContext<TState>) => boolean | Promise<boolean>) | undefined contract.WorkflowContext
analytics((event: WorkflowEvent<TState>) => void) | undefinedNoThe analytics member uses the ((event: WorkflowEvent<TState>) => void) | undefined contract.WorkflowEvent
onObserverError((error: unknown) => void) | undefinedNoThe onObserverError member uses the ((error: unknown) => void) | undefined contract.

Parameters

This declaration has no public members.

Returns

This declaration does not return a value.

Throws

No thrown errors are documented for this declaration.

Source

View the secondary source reference

Package

@mwillbanks/tuil-workflow

On this page