Workflows hooks

Hand-written shim. Generated CRUD via ./workflows.gen. The hooks below cover the workflow-run sub-resource and graph-replace mutation that the manifest pipeline doesn't model.

Hooks

useCreateWorkflow mutation

Create a workflow.

TypeScript
useCreateWorkflow(options?: MutationOpts<Workflow, CreateWorkflowParams>)

Types: Workflow · CreateWorkflowParams

useDeleteWorkflow mutation

Soft-delete a workflow.

TypeScript
useDeleteWorkflow(options?: MutationOpts<SuccessResponse, string>)

Types: SuccessResponse

useGetWorkflowRun query

Fetch a single workflow run by workflow and run ID.

TypeScript
useGetWorkflowRun(workflowId: string, runId: string, options?: QueryOpts<WorkflowRun>)

Types: WorkflowRun

TypeScript
const { data: run } = useGetWorkflowRun("wfl_abc123", "run_abc123");

useListWorkflows query

List workflows.

TypeScript
useListWorkflows(params?: Omit<ListWorkflowsParams, | > & { filter?: WorkflowFilter; orderBy?: WorkflowOrderBy[]; } & WorkflowShorthands, options?: QueryOpts<Page<Workflow>>)

Types: ListWorkflowsParams · WorkflowFilter · WorkflowOrderBy · WorkflowShorthands · Page · Workflow

usePurgeWorkflow composite

Permanently delete a soft-deleted workflow.

TypeScript
usePurgeWorkflow(options?: MutationOpts<SuccessResponse, PurgeWorkflowParams>)

Types: SuccessResponse · PurgeWorkflowParams

usePutWorkflowGraph composite

Replace the entire graph (nodes + edges) of a workflow. Auto-invalidates workflow queries.

TypeScript
usePutWorkflowGraph(options?: MutationOpts<Workflow, PutWorkflowGraphParams>)

Types: Workflow

TypeScript
const put = usePutWorkflowGraph();
put.mutate({ id: "wfl_abc123", nodes: [...], edges: [...] });

useRestoreWorkflow composite

Restore a soft-deleted workflow.

TypeScript
useRestoreWorkflow(options?: MutationOpts<Workflow, string>)

Types: Workflow

useRetrieveWorkflow query

Get a workflow by ID.

TypeScript
useRetrieveWorkflow(id: string, options?: QueryOpts<Workflow>)

Types: Workflow

useStartWorkflowRun composite

Start a new run for a workflow. Auto-invalidates workflow and run queries.

TypeScript
useStartWorkflowRun(options?: MutationOpts<Run, StartWorkflowRunParams>)

Types: Run

TypeScript
const start = useStartWorkflowRun();
start.mutate({ workflowId: "wfl_abc123", input: {} });

useUpdateWorkflow mutation

Update a workflow.

TypeScript
useUpdateWorkflow(options?: MutationOpts<Workflow, UpdateWorkflowParams>)

Types: Workflow · UpdateWorkflowParams

useWorkflowRunAction composite

Perform an action on a workflow run (pause, resume, retry, cancel). Auto-invalidates workflow and run queries.

TypeScript
useWorkflowRunAction(options?: MutationOpts<Run, WorkflowRunActionParams>)

Types: Run

TypeScript
const act = useWorkflowRunAction();
act.mutate({ runId: "run_abc123", action: "cancel" });