FlowRunner (flow_runner v6.15.1)
Copy MarkdownProvides functions to run a Flow.
Summary
Functions
Compile takes a json flow and returns a parsed and validated flow as a tuple.
Compile takes a json flow and returns a parsed and validated flow.
Get the default language for a flow.
Expression evaluation options for a context.
Fetches a flow from a container with the given UUID
Find the next block the current context is expecting. Returns both the current block and the next block
Get the language struct for a context
Functions
Compile takes a json flow and returns a parsed and validated flow as a tuple.
Compile takes a json flow and returns a parsed and validated flow.
@spec default_flow_language(FlowRunner.Spec.Flow.t()) :: FlowRunner.Spec.Language.t()
Get the default language for a flow.
The flowspec is unclear about how to go about this. Our assumption is that the first language defined in the list of a flow's languages is the default language.
The flowspec does guarantee that there must be at least 1 language.
@spec expression_opts(FlowRunner.Context.t() | map()) :: Keyword.t()
Expression evaluation options for a context.
The expression-language mode is stamped into context.private by the
consumer (engage stamps it per journey); a missing stamp degrades safely
to :v2, and a bare vars map (accepted for backwards compatibility)
likewise evaluates under :v2.
Fetches a flow from a container with the given UUID
@spec find_next_block( FlowRunner.Spec.Container.t(), FlowRunner.Spec.Flow.t(), FlowRunner.Context.t(), user_input :: String.t() | nil ) :: {:ok, FlowRunner.Context.t(), previous_block :: FlowRunner.Spec.Block.t() | nil, next_block :: FlowRunner.Spec.Block.t() | nil} | {:error, reason :: String.t()}
Find the next block the current context is expecting. Returns both the current block and the next block
@spec language_for_context(FlowRunner.Spec.Flow.t(), FlowRunner.Context.t()) :: FlowRunner.Spec.Language.t()
Get the language struct for a context
The FlowRunner.Context stores the language as an iso-639-3 language code ("eng"/"afr" etc). Internally flowspec maintains a list of languages which have a UUID as an id.
Here we lookup the language struct for the language code currently active in the context. This is needed because the Flowspec resource values refer to languages by the Language's ID (uuid) rather than the iso-639-3 code.