Skip to main content

Module actions

Module actions 

Source
Expand description

VAPP-194 (eApps E1, spec docs/spec/apps.md §4.5): typed effects, the twin of packages/exponential-ui/src/host/actions.ts (read its header).

  • EXPRESSIONS ARE PURE: validate_package_effects refuses a write or host function in a template’s pure places (the parser refuses one in a CEL expression, crate::cel::function_effect).
  • ACTIONS (actions: {<name>: {params?, steps}}) are the only place a package writes. run_action runs one against ONE snapshot and returns the PLAN ({writes, sets, calls}) or the one error that discards it; the host commits the writes as ONE unit (records.batch, apply_record_batch over in-memory rows), applies the sets, runs the calls. fixtures/actions.json locks it (TS, Rust, Swift, Kotlin).

Re-exports§

pub use crate::cel::function_effect;

Structs§

ActionContext
The snapshot an action runs against.

Constants§

ACTION_CALL_PREFIX
The function-call prefix that runs a package action.
ACTION_LIMIT_ACTIONS
Caps: actions per package, steps per action, and the evaluation steps ONE run may spend over all of its expressions (each keeps its own 10 000).
ACTION_LIMIT_MAX_STEPS
ACTION_LIMIT_STEPS
ACTION_NAME_PATTERN
An action’s name (actions.<name>).
ACTION_STEP_KINDS
The step forms, by their one key.
RECORDS_BATCH_FUNCTION
The host function a host commits an action’s record writes through.

Functions§

action_call_name
The action a call name runs (actions.log → log), else None.
action_var_types
The names a step expression reads, typed: params (the action’s params schema), data (the surface data: open), me (a member id).
apply_record_batch
Apply a batch of writes ({op: "upsert", kind, data, id?} | {op: "delete", id}) to rows ({id, kind, data, createdBy, createdAt, updatedAt}), all or nothing: the new rows and each write’s id, or the first refusal (write <i>: …). A patch merges onto its row and the merged row is checked; a create’s id is new_id(<i-th create>), its createdBy = me, every touched row stamped now.
apply_record_batch_as
eApps R3: apply_record_batch with every write judged by its kind’s policy for the writer me with team role and app access (TS BatchOptions.role / access); role None = not judged.
is_action_name
^[a-z][A-Za-z0-9_]{0,31}$.
run_action
Run a package action against one snapshot: its plan {writes, sets, calls}, or the error that discards it whole (a false require = its message; else step <i>: …).
validate_package_actions
Every problem with a package’s actions.
validate_package_effects
VAPP-194: every function call in a template’s PURE places (component props, a call’s args, an event’s context) is pure; an action’s functionCall may name a host or write function, and an actions.<name> one names a declared action.