Skip to content

v0.11.0

Choose a tag to compare

@github-actions github-actions released this 29 Oct 11:38
· 256 commits to main since this release
Immutable release. Only release title and notes can be modified.
63cfea4

Upgrading from 0.10.2

  • ash_workflow now depends on ash ~> 3.35, for Ash.Signals.

Added

  • Workflow signals. The new signals option on the workflow section names an Ash.Signals module, and emit declares a signal at four levels: the workflow (every state change), a step (on: :enter or on: :exit), a transition, and a timeout or every. AshWorkflow.Changes.RecordEvent emits each matching signal in its after_action hook, after the log row, with a payload of the workflow fields from_state, to_state, transition_name, triggered_by and occurred_at, the attributes that share a signal field's name, the emit's fields and its literal values. A failing listener fails the action and rolls it back. AshWorkflow.Transformers.AddActions declares each planned signal as a dynamic emit on the action, and AshWorkflow.Verifiers.ValidateSignals checks the names and phases. AshWorkflow.Info.signals/1, emits/1 and action_signals/2 read the configuration. A transition, timeout or every that contains an emit takes its options inside the do block. See the Signals guide.
  • Receiving signals with on_signal. A step can declare on_signal, which moves a record to transition_to, or runs an update action, when a signal from the workflow's signals module (or from) selects that record while it is in the step. filter selects records with ^signal(:field) templates, or read_action names a read action of the resource. AshWorkflow.Transformers.AddActions generates the :__signal_<step>_<signal>_read read action, the :__signal_<step>_<signal> transition action and a signals_in listener named :<step>_<signal>, and the log row records triggered_by: :signal. AshWorkflow.Transformers.AddPolicies authorizes the generated actions with signal_in/2. AshWorkflow.Verifiers.ValidateOnSignal checks the signal, its fields and the outcome, and a step whose only exits are on_signal handlers with transition_to is a wait state. Charts draw an on_signal edge with 📨. See the Signals guide.