Skip to main content

Module shape

Module shape 

Source
Expand description

Stateless reshaping primitives applied to the result array of an envelope.

Every function here takes and returns plain serde_json data so a single call site in crate::output can serve every subcommand. None of them knows what a memory, an entity or a hit is.

GAP-SG-274: the one thing they do carry is the subcommand slug, threaded through as command and used for nothing but scoping the field-synonym table. It is not knowledge of the domain — it is the same answer the gate used when it admitted the key, and passing it here is what keeps a key that was accepted from silently matching nothing.

Functions§

dedupe
Drops later elements whose scalar at key was already seen.
filter
Keeps only the elements accepted by every predicate.
limit
Truncates the list to at most max elements. 0 means “no cap”.
project
Rewrites each object element to carry only keys, in the requested order.
project_one
Projects a single value; see project.
sort
Sorts elements ascending by the scalar found at the dotted key.
truncate_strings
Shortens every string longer than max characters, recursively.