The values a step leaves in the exchange under its id, for later steps
of the same pipeline to read (spec 056 S2): a Request's body, status
and headers, a Script's returned body and its named outputs, a
Transform's or a Map's body, a Validate's valid and errors, a pivot's
returned status and headers.
The exchange holds them as ex.steps, a map of scope to step id to
values (values/0, output name to value). The scope is
{pipeline_id, call_scope} (scope_key/2): a pipeline's own steps read
their outputs, never another pipeline's, and a called pipeline's steps
read theirs apart from their caller's. Variables remain the way to share
a value between pipelines.
A later step reads one by a location ({"in": "steps", "id": …, "output": …}, Plugin.Location), a template (${steps.<id>.<output>},
template_refs/1), a step condition (Pipelines.Matcher) or a
script's steps table (Plugins.Script.Lua). fetch/3 is the one read
all of them share: an output's value, then a key or a JSON path inside
it. The first segment below headers is a header name, matched in any
case (the values are stored with lower-case names); below any other
output the segments walk the value, text read as JSON first
(JsonPath.dig/2).
The runner keeps a step's body and outputs only when a later step
reads them (Runner.prepare/2 collects the references, refs/1); its
other outputs always, since they are small. Each value is held up to the
variable cap (Plugin.Location's var_bytes): past it the step fails
with step_output_too_large (check_size/3).
Summary
Types
What a pipeline's steps read of each other: step id to the outputs read
(:all when a reader cannot be followed, a script reaching steps by a
computed name), and :all for the whole map when such a reader may reach
any step.
A scope's outputs: step id to values.
Whose outputs: the pipeline and the call it runs in.
A place a term names a step: the path to it from the term's root (map keys
and list positions), the step id, the output (nil where the place names the
step alone), the key it reads of a keyed output (a location's or a
condition's key, a template's segment after the output; nil for none)
and its form: a {"in": "steps"} :location or a step
:condition (the path leads to the map), or a ${steps.…} :template (the
path leads to the text, one site per template in it).
One step's outputs: output name to value.
Functions
:ok when every value holds at most max_bytes (as JSON; text, and a
body handle the runner has not read, by its bytes), else
{:error, message} naming the step and the output.
The value of step id's output, at segments inside it (see the
module doc): {:ok, value}, or :error when the step did not run, kept
no such output, or the segments lead nowhere.
The values a step keeps of what it returned (extras.values): its
body and outputs only when kept names them (:all, or the output
names a later step reads), the rest always.
Whether read_of/2's answer reads output.
The references as refs/0: pairs of {id, output} (nil for any
output), or :all among them for a reader that may reach any step.
The key of the outputs of pipeline_id's steps in call_scope.
The step outputs a script reads, from its Script.Reads analysis:
{:ok, pairs} (an output of nil is any output of that step), or
:unknown when it may reach any step.
The step outputs a stored step reads in its settings and a container's
conditions: {"in": "steps"} locations at any depth, ${steps.…}
templates in any string, step conditions. A Script's source is read by
Script.Reads (script_refs/1), not here. The {id, output} pairs of
sites/2 that name an output.
Every place term names a step (site/0), depth first, each map before
what it holds; base is put in front of every path. A location or a
condition without an output, and a ${steps.<id>} template, name the step
alone. What settings_refs/1 reads, and what a step's rename rewrites.
The template that reads a step output, for HttpUtils.
The {id, output} pairs the ${steps.…} templates in text read.
The {id, output} pairs the step templates in text name, in order: an
output of nil for ${steps.<id>}, which names the step alone.
Types
What a pipeline's steps read of each other: step id to the outputs read
(:all when a reader cannot be followed, a script reaching steps by a
computed name), and :all for the whole map when such a reader may reach
any step.
A scope's outputs: step id to values.
Whose outputs: the pipeline and the call it runs in.
@type site() :: %{ path: [term()], id: String.t(), output: String.t() | nil, key: String.t() | nil, form: :location | :condition | :template }
A place a term names a step: the path to it from the term's root (map keys
and list positions), the step id, the output (nil where the place names the
step alone), the key it reads of a keyed output (a location's or a
condition's key, a template's segment after the output; nil for none)
and its form: a {"in": "steps"} :location or a step
:condition (the path leads to the map), or a ${steps.…} :template (the
path leads to the text, one site per template in it).
One step's outputs: output name to value.
Functions
@spec check_size(values(), String.t(), pos_integer()) :: :ok | {:error, String.t()}
:ok when every value holds at most max_bytes (as JSON; text, and a
body handle the runner has not read, by its bytes), else
{:error, message} naming the step and the output.
The value of step id's output, at segments inside it (see the
module doc): {:ok, value}, or :error when the step did not run, kept
no such output, or the segments lead nowhere.
The values a step keeps of what it returned (extras.values): its
body and outputs only when kept names them (:all, or the output
names a later step reads), the rest always.
What of step id's outputs is read (refs/1), for kept/2: :all,
the output names sorted, or nil for none. Plain data: a prepared step
carries it, and a compile embeds it.
Whether read_of/2's answer reads output.
The references as refs/0: pairs of {id, output} (nil for any
output), or :all among them for a reader that may reach any step.
The key of the outputs of pipeline_id's steps in call_scope.
The step outputs a script reads, from its Script.Reads analysis:
{:ok, pairs} (an output of nil is any output of that step), or
:unknown when it may reach any step.
The step outputs a stored step reads in its settings and a container's
conditions: {"in": "steps"} locations at any depth, ${steps.…}
templates in any string, step conditions. A Script's source is read by
Script.Reads (script_refs/1), not here. The {id, output} pairs of
sites/2 that name an output.
Every place term names a step (site/0), depth first, each map before
what it holds; base is put in front of every path. A location or a
condition without an output, and a ${steps.<id>} template, name the step
alone. What settings_refs/1 reads, and what a step's rename rewrites.
@spec template() :: Regex.t()
The template that reads a step output, for HttpUtils.
The {id, output} pairs the ${steps.…} templates in text read.
The {id, output} pairs the step templates in text name, in order: an
output of nil for ${steps.<id>}, which names the step alone.