Skip to content

generateExecution

function generateExecution(params): ExecutionOutput;

Defined in: src/execution.ts:1502

Generate an SVG execution overlay: the ASL diagram with each state coloured by its outcome, the taken path emphasized, untaken transitions dimmed, and per-state duration / retry annotations.

States not present in the execution history are rendered as “not reached” (greyed).

GenerateExecutionParams

Any additional DiagramOptions

ExecutionOutput

ExecutionOutput with SVG markup and a per-status summary

A caller-supplied edgeOverrides / nodeAnnotations / nodeOverrides entry wins over the overlay’s computed value for that same key; every key the caller does not name keeps the overlay’s styling. A legacy bare ${from}->${to} edge key claims every edge between that pair, suppressing the overlay’s own styling for all of them.

Execution history records transitions as { from, to } only, so two Choice rules sharing a Next are both highlighted when either fires. Retry self-loops are never highlighted — retries emit no transition event.

With collapse, each collapsed container’s placeholder is coloured by the status rolled up from the states it hides — any failure makes it failed, otherwise any running makes it running, otherwise the container’s own outcome — and annotated with a 3/4 succeeded-style summary beside its own duration.

import { generateExecution } from 'sfn-diagram';
const { svg } = generateExecution({ aslDefinition: asl, history: events });