Generates and modifies Ash actions based on workflow step declarations.
Adds or modifies the following actions on the resource:
Transition actions (for manual steps) — one
:updateaction per declaredtransitionentity. Each includes:BuiltinChanges.transition_state(target)to move the stateAshWorkflow.Changes.RecordEvent(triggered_by: :manual) to write throughstate_entered_atand append a log row if atransition_logis configured
Automatic step action injection — for automatic steps, the user defines their own update action with business logic. This transformer finds that action by the step's
actionname and appendstransition_stateandRecordEvent(triggered_by: :automatic) changes to it. Raises at compile time if the action is not defined on the resource.Timeout transition actions — for timeouts with
transition_to, generates a hidden update action named__timeout_<step>_<name>that transitions to the target state and records the event (triggered_by: :timeout).Undo action — when the workflow declares an
undoblock, a single:undoupdate action that rewinds the record to the state before its most recent undoable state change. Not atomic: the target is only known after reading the transition log.Primary read action — if the workflow has automatic steps (which generate Oban triggers) and no primary read action is defined, generates one with keyset pagination enabled (required by ash_oban).
Also adds a resource-global change RecordEvent, on: [:create]
(triggered_by: :initial), since workflows are started through the user's
own create action rather than a generated one — there is no per-action call
site to inject into for that event.
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Name of the hidden action a transition timeout performs.
Callback implementation for Spark.Dsl.Transformer.transform/1.
Name of the generated undo action.
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Name of the hidden action a transition timeout performs.
Scoped by step so the same timeout name can be used on more than one step, the way transition names can.
Callback implementation for Spark.Dsl.Transformer.transform/1.
@spec undo_action_name() :: atom()
Name of the generated undo action.