MimirWorkflows.Template (mimir_workflows v0.7.0)

Copy Markdown View Source

{{ref}} extraction and resolution — the IR's dataflow syntax.

Two ref namespaces: {{params.name}} resolves against declared workflow params; {{step_id}} resolves against upstream step results. A string that is exactly one ref substitutes the referenced value of any type; refs embedded in a longer string interpolate via to_string/1. Resolution recurses through maps and lists; non-string terms pass through untouched.

Summary

Functions

All {{...}} refs in a term, recursively through maps and lists. Duplicates are preserved (callers count or Enum.uniq/1 as they need).

Resolves every ref in template against ctx; the first missing ref short-circuits as {:error, {:unresolved_ref, ref}}.

Types

ctx()

@type ctx() :: %{results: map(), params: map()}

Functions

refs(term)

@spec refs(term()) :: [String.t()]

All {{...}} refs in a term, recursively through maps and lists. Duplicates are preserved (callers count or Enum.uniq/1 as they need).

resolve(template, ctx)

@spec resolve(term(), ctx()) ::
  {:ok, term()} | {:error, {:unresolved_ref, String.t()}}

Resolves every ref in template against ctx; the first missing ref short-circuits as {:error, {:unresolved_ref, ref}}.