Documentation
¶
Overview ¶
Package data provides helpers for normalizing runtime payload shapes so N.O.R.E. operates on canonical snake_case keys regardless of the casing authors chose at the source (for example camelCase --params for a TypeScript-authored assembly).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalMap ¶
CanonicalMap returns a canonicalized deep copy of source. A nil source yields an empty map rather than nil, so callers that read from the result never have to distinguish "absent" from "empty".
func CanonicalValue ¶
CanonicalValue returns a deep copy of value in the one representation N.O.R.E. uses for every runtime payload.
The engine accepts payloads from several places that each have their own Go types: an HTTP request body decoded into `map[string]any` yields float64 for every number, a CEL expression yields int64 or float64 depending on whether the value was computed or copied out of a native map, and a capability runtime's JSON response yields float64 again. Left alone, the same logical number reaches an in-process capability as `int`, `int64`, or `float64` depending on how the author wrote an expression, and an execution restored from a snapshot observes different types than the same execution before it was persisted.
CanonicalValue removes that ambiguity: on the way in, every JSON number becomes the float64 that `encoding/json` produces, and every container is copied so no caller can mutate engine state through a returned payload.
Values outside the JSON data model are passed through unchanged, because the engine does not own them and rejecting them here would fail a payload that JSON would have carried losslessly.
func DeepSnakeCase ¶
DeepSnakeCase returns a copy of v with every map key converted to snake_case, applied recursively to nested maps and slices. Non-map values are passed through unchanged, so the operation is idempotent.
Types ¶
This section is empty.