Shared projection helper functions used by all profile projections (stepwise, FSM, flow).
Extracted to eliminate duplication across projection components.
Summary
Functions
Builds the projection extensions map.
Safe conversion of a binary key to an existing atom. Returns nil
if the atom doesn't exist in the atom table, rather than raising.
Replaces {key} placeholders in a topic template with values from
the runtime context. Returns nil if any placeholder is missing or empty.
Builds the subscriptions list from spec declarations and runtime context,
prepending the mandatory workflow_execution topic and interpolating
{placeholder} variables from runtime context.
Resolves a UI descriptor for a given state from the spec definition.
Functions
Builds the projection extensions map.
When spec.projection_enricher names a module exporting enrich/2,
it is called with the base extensions and the runtime, and its return
replaces the extensions map. When absent, extensions contain just the
runtime meta (if any).
This is shared so all profiles (stepwise, FSM, flow) can populate extensions consistently.
Safe conversion of a binary key to an existing atom. Returns nil
if the atom doesn't exist in the atom table, rather than raising.
Replaces {key} placeholders in a topic template with values from
the runtime context. Returns nil if any placeholder is missing or empty.
Builds the subscriptions list from spec declarations and runtime context,
prepending the mandatory workflow_execution topic and interpolating
{placeholder} variables from runtime context.
Resolves a UI descriptor for a given state from the spec definition.
Looks up state_def.ui with optional key and assigns and merges
in context assigns (context and state). Returns nil if no UI key
is configured for the state.