Skip to main content

Module cel

Module cel 

Source
Expand description

VAPP-191 (eApps Q2): expressions, the Rust twin of packages/exponential-ui/src/cel.ts (line by line; read its header for the language). A SUBSET of CEL with ONE number type (a double, like JSON), hand-written so both twins replay fixtures/expressions.json exactly: numbers, dates and error texts. No loops, no user functions, a length cap, no nested comprehensions and a step limit, so it always terminates. The functions are ONE table shared with the A2UI function form ({"call": "mul", …}, call_expression_function); dates run in the team zone (an offset per instant, ExpressionEnv::offset).

Structs§

ExpressionEnv
The clock, the team zone and the step limit an evaluation runs with.

Enums§

FunctionEffect
VAPP-194 (E1): what calling a function does. Expressions are PURE: a binding, visible, a computed field or a query param never writes. A write changes records or the surface data, a host function reaches outside the surface (a toast, an MCP call, a link, another action); both run only as steps of a package action (crate::host::actions).
Node
A parsed expression (at = the code point it starts at).

Constants§

CALENDAR_UNITS
CALL_NAMES
The A2UI form’s names in the bind table (size = the existing len; expr = the string form, {expr, vars}).
DATE_UNITS
Every unit dateAdd / dateDiff take; startOf / endOf take the calendar ones.
DURATION_FORMATS
The formats formatDuration writes.
FUNCTION_NAMES
THE function table (spec §4.2), positional for CEL, named (args) for the A2UI form. Generic only: no working days, no holidays.
HOST_FUNCTIONS
The built-in host functions; every name under a host prefix is one too.
HOST_FUNCTION_PREFIXES
MAX_DEPTH
MAX_LENGTH
The cost caps (spec §4.2): characters (code points), nesting, steps.
MAX_STEPS
WRITE_FUNCTIONS
The functions that write (records, the surface data model).

Functions§

call_expression_function
The A2UI function form {call: name, args} with its arguments resolved. Outer None = not an expression function; inner None = no value (an error, like every bind-time function). VAPP-195: a failed call shows its default (absent = no value).
check_expression
Type-check an expression against the names it may read (a kind’s fields, a binding’s value): the type, or the error (the parse error, or the first type error). Types are spelled as JSON ("number", [T], a row object, {"?": T} for a value that may be missing).
effect_words
Why an effectful function is refused in a pure place.
evaluate_counted
VAPP-194: evaluate a parsed tree and count its steps (an action spends one budget over all of its expressions): the result and the steps used.
evaluate_expression
Evaluate an expression over vars: the value, or the error (a syntax, type, range or cost error).
evaluate_node
Evaluate a parsed tree (see parse_expression).
expression_names
VAPP-214: the free names an expression reads, sorted (a macro’s own variable is not free inside its body).
format_timestamp
An instant as YYYY-MM-DDTHH:MM:SS.sssZ (JS toISOString), years 0..9999.
function_effect
The effect of a function by name: the signature table’s (every expression function, every bind-time function) is pure.
is_optional
VAPP-195 (E2): a value that may be missing is T?, spelled {"?": T} (a row never has a field named ?).
optional_type
T? (null and an optional stay as they are).
parse_expression
Parse once (at package validation, or before evaluating): the tree, or the first syntax / cost error (at <code point>: <reason>).
parse_timestamp
An ISO instant (YYYY-MM-DDTHH:MM[:SS[.fff]][Z|±HH:MM], no offset = UTC) as epoch ms; None when it is not one.
path_text
VAPP-195: a value’s path as written (a.b[0].c, m['k']): names, fields and literal indexes; None for anything else.
required_type
T of a T?.
type_display
The name a type prints as in an error: a list list, a row map, an optional T?.
type_name
The runtime type name errors print.