createWorkflow(config)
Creates a new, immutable workflow builder.
typescript
import { createWorkflow } from 'reflow-ts'
import { z } from 'zod'
const workflow = createWorkflow({
name: 'process-content',
input: z.object({ url: z.string() }),
})| Parameter | Type | Description |
|---|---|---|
config.name | string | Unique workflow name. Captured as a string-literal type. |
config.input | StandardSchemaV1 | Any Standard Schema-compatible schema used to validate input. |
config.label | (input) => string | Optional. Names each run for people, from its typed input — an order number, a user id — wherever runs are listed, such as the dashboard. Without it a run is shown by its idempotency key, or else its id. |
config.concurrency | number | Optional. The most runs of this workflow running at once, across every process sharing the storage; the rest wait as pending. See limiting a workflow. |
Returns a Workflow with .step(), .parallel(), .onFailure(), and .parseInput().
The builder is immutable — every method returns a new Workflow, so a base workflow can be branched without the branches affecting each other. See Workflows.
workflow.parseInput(input)
Validates an unknown value against the workflow's input schema and returns the typed, parsed value. Throws ValidationError if validation fails. The engine calls this for you on enqueue(); it's exposed for validating input at your own boundaries.
typescript
const parsed = workflow.parseInput(req.body) // typed as the schema output, or throwsAsync schema validation is not supported — a schema that returns a Promise throws a TypeError.