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_effectsrefuses 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_actionruns 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_batchover in-memory rows), applies the sets, runs the calls.fixtures/actions.jsonlocks it (TS, Rust, Swift, Kotlin).
Re-exports§
pub use crate::cel::function_effect;
Structs§
- Action
Context - 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), elseNone. - 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}) torows({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 isnew_id(<i-th create>), itscreatedBy=me, every touched row stampednow. - apply_
record_ batch_ as - eApps R3:
apply_record_batchwith every write judged by its kind’s policy for the writermewith teamroleand appaccess(TSBatchOptions.role/access);roleNone= 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 falserequire= its message; elsestep <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
functionCallmay name a host or write function, and anactions.<name>one names a declared action.