Skip to content
Français

defineWorkflow

import { defineWorkflow } from "@elie-laloum/outpost";

Validate a named task list and return a frozen Workflow whose start() runs the graph and diagram() draws it as Mermaid. Throws on an empty name, a duplicate key, a dependency missing from the list, a cycle, or a gate with a condition, retry, timeout or cache.

Complete example and detailed rules.

  • nameRequired
    string
    Workflow name, not empty; part of the checkpoint identity and of every event.
  • tasksRequired
    readonly Task<unknown>[]
    Every task of the graph; each dependency must also be in the list.

Workflow

export declare function defineWorkflow(
  name: string,
  tasks: readonly Task[],
): Workflow;