WorkflowStem.IR (workflow_stem v0.2.0)

Copy Markdown View Source

Normalization helpers for workflow specs compiled into IR.

Delegates common normalizations (initial_state, states, transitions) to Mobus.Stepwise.IR and adds workflow_stem-specific extensions: multi-profile support (flow, fsm), route resolution, and routing maps.

Summary

Functions

Returns the route tuple declared on a state, or nil if the state has none.

Returns the {module, function} resolver tuple for a named route, or nil.

Types

t()

@type t() :: map()

Functions

normalize(spec)

@spec normalize(map()) :: t()

route_for_state(spec, state_name)

@spec route_for_state(t(), atom() | String.t()) :: tuple() | list() | nil

Returns the route tuple declared on a state, or nil if the state has none.

Route tuples mirror ALF's DSL macros 1:1 (see WorkflowStem.SpecBehaviour):

  • {:stage, target, opts}, {:switch, name, %{branch_key => body}}, {:composer, module, opts}, {:goto, name, opts}, {:goto_point, name}, {:done, name, opts}, {:dead_end, name}, {:from, module, opts}, {:plug_with, module, body}, {:tbd, name}

A state's :route may also be a LIST of such tuples — return type reflects that with list() as a possible shape.

routing_for(spec, route_name)

@spec routing_for(t(), atom()) :: {module(), atom()} | nil

Returns the {module, function} resolver tuple for a named route, or nil.