Skip to content

generateMermaidExecution

function generateMermaidExecution(params): MermaidExecutionOutput;

Defined in: src/execution.ts:1633

Generate a Mermaid execution overlay. Colours each state by its outcome and appends duration / retry annotations to state labels.

Note: Mermaid stateDiagram-v2 cannot style individual transitions, so taken-path highlighting is expressed through node colours and label annotations only (the SVG overlay from generateExecution dims untaken edges).

GenerateMermaidExecutionParams

The diagram options plain generateMermaid honours: catchHandling, catchLabelStyle, collapse, customColors, includeComments, layout, showVariables and theme

MermaidExecutionOutput

MermaidExecutionOutput with Mermaid code and a per-status summary

Every state takes its run-status class, so customColors changes the emitted state-type classDefs but colours no state, as in the SVG overlay.

With collapse, each collapsed container’s placeholder takes the status rolled up from the states it hides, as in generateExecution, and a 3/4 succeeded-style summary beside its own duration. The status summary in metadata still covers every state in the definition.

import { generateMermaidExecution } from 'sfn-diagram';
const { code } = generateMermaidExecution({ aslDefinition: asl, collapse: true, history: events });