Writes DSL values out as the short phrases a chart shows.
AshWorkflow.Charts.Graph calls the functions for DSL values, so every
backend gets the same text for a deadline, a retry, a policy or a
condition.
kind_text/1, node_text/1, edge_text/1 and note_text/1 turn a node
or an edge of the graph into a label. The Mermaid and DOT backends call
them, so both charts use the same words. A custom
AshWorkflow.Charts.Backend can call them too.
Summary
Functions
A route's when expression, or nil for a route without one.
The deadline of a timeout entry from AshWorkflow.Info.workflow_graph/1.
A duration tuple as text, in the singular for one unit: {1, :days} is
"1 day" and {7, :days} is "7 days".
The label of an AshWorkflow.Charts.Graph.Edge: a symbol for its kind,
then its text.
The schedule of an every entry from AshWorkflow.Info.workflow_graph/1.
The text of a step kind: "⚙️ automatic", "✋ manual" or
"⏳ wait state". The gear carries U+FE0F, so it draws as a colour emoji,
the same as the other two.
The text inside a step box, for a chart that puts the notes in the step:
the step's name, then kind_text/1 on the next line, then the notes under
a — rule, one per line, as note_text/1 writes them.
The text of an AshWorkflow.Charts.Graph.Note.
A step's policy check, through the check's own describe/1 when it has one.
The retry policy of a step, or nil when the step makes one attempt only.
The label of an undo edge, with the window when the undo block sets
within: "undo" or "undo within 1 hour".
Functions
A route's when expression, or nil for a route without one.
The deadline of a timeout entry from AshWorkflow.Info.workflow_graph/1.
@spec duration(AshWorkflow.Duration.t()) :: String.t()
A duration tuple as text, in the singular for one unit: {1, :days} is
"1 day" and {7, :days} is "7 days".
@spec edge_text(AshWorkflow.Charts.Graph.Edge.t()) :: String.t()
The label of an AshWorkflow.Charts.Graph.Edge: a symbol for its kind,
then its text.
⚙foron_success,✖foron_error,⏱for a timeout and↶for undo. A transition has no symbol.- A timeout gives its name before its deadline:
⏱ auto_escalate after 4 hours. - A conditional route adds
whenand its condition. The fallback route of a conditionalon_successaddsotherwise.
The schedule of an every entry from AshWorkflow.Info.workflow_graph/1.
@spec kind_text(:automatic | :manual | :wait_state) :: String.t()
The text of a step kind: "⚙️ automatic", "✋ manual" or
"⏳ wait state". The gear carries U+FE0F, so it draws as a colour emoji,
the same as the other two.
@spec node_text(AshWorkflow.Charts.Graph.Node.t()) :: String.t()
The text inside a step box, for a chart that puts the notes in the step:
the step's name, then kind_text/1 on the next line, then the notes under
a — rule, one per line, as note_text/1 writes them.
A terminal step has no kind line, but it keeps its notes.
@spec note_text(AshWorkflow.Charts.Graph.Note.t()) :: String.t()
The text of an AshWorkflow.Charts.Graph.Note.
- A policy note is
policy:and the check, and a retry note isretry:and the policy. - A timeout that runs an action is
⏱, its deadline and the action. - An
everyis↻, its schedule and the action.
A timeout or an every with its own retry adds , retry: and the policy.
A step's policy check, through the check's own describe/1 when it has one.
@spec retry(AshWorkflow.Entities.Retry.t() | nil) :: String.t() | nil
The retry policy of a step, or nil when the step makes one attempt only.
@spec undo(AshWorkflow.Entities.Undo.t()) :: String.t()
The label of an undo edge, with the window when the undo block sets
within: "undo" or "undo within 1 hour".