Skip to main content

Module mapping

Module mapping 

Source
Expand description

The mapping language the store adapters and the tool overrides share: render an argument object / URL / body from a template over named inputs, and extract a value from a result.

  • JSON templates — a JSON text with {name} placeholders: a placeholder inside quotes ("{key}") is substituted as JSON-escaped string content; a bare placeholder ("seq": {seq}, "state": {envelope}) is substituted as the JSON serialization of the value; the result must parse as JSON. A template that is exactly one bare placeholder yields the value itself.
  • Text templates{name} substituted textually (URLs, header values).
  • CEL: expressions — evaluated over the same inputs (feature cel; an error without the feature).
  • Extraction — a JSON pointer (/result/structuredContent/state), a dotted path (result.structuredContent.state, numeric segments index arrays), or CEL: over the context.

No dependency: placeholders are {ident} or {{ident}} where ident is [A-Za-z_][A-Za-z0-9_.]* (dotted paths reach into object inputs) — JSON braces are followed by " / } / whitespace, never an identifier, so the two never collide.

Structs§

MappingError
A rendering/extraction failure (a template that does not parse, an unknown placeholder, a CEL error).

Functions§

extract
Extract a value from ctx by JSON pointer, dotted path, or CEL:. None when the path does not resolve (a CEL error is Err).
render_json
Render a JSON template (or a CEL: expression) into a value.
render_text
Render a text template ({name} substituted textually) or a CEL: expression (its result stringified).
store_vars
Build the standard Vars for a store operation.
truthy
Truthiness for ok/conflict predicates: true, a non-zero number, a non-empty string/array/object.
vars_from
Convenience: an object → Vars.

Type Aliases§

Vars
The named inputs a template renders over.