cel library

FFX-CEL alone (05 §3): the parser, the evaluator and celFieldsRead, the same engine the emulator runs, without the rule decisions of rules.dart.

Classes

CelEnvironment
The variable environment of one evaluation (05 §3.5).
CelFieldsRead
What one expression reads under one variable root, record or newRecord (local data, 5.13): the top-level field names it reads, or all of it. A phone decides from this whether a rule's denial can be final (every field the denial read is known on the phone).
CelProgram

Constants

maxRuleExpressionLength → const int
The configuration schema and TypeScript parser enforce the same budgets.
maxSpend → const int
The most credits one rule's spend() takes: as many as a pack may hold, the largest integer every client reads exactly (packages/schema config/payments-limits.ts creditsAmountMax).

Functions

celFieldsRead(CelProgram program, String variable) → CelFieldsRead
The top-level fields program reads under variable (record or newRecord; any other root name, such as params, reads its members the same way). size(newRecord.title) <= 80 reads {title} under newRecord and nothing under record (size is a function in FFX-CEL, never a method: newRecord.title.size() does not parse). A changedFields() call reads the whole of both record and newRecord.
celFieldType(Map<String, Object?> spec) → Map<String, Object?>?
The rules engine's type of one config field ({type, values?, model?}, rules-engine fieldToCelType), or null for a type rules cannot address (map, bytes, geopoint).
celFieldTypes(String model, Map<String, Map<String, Object?>> fields) → Map<String, Object?>
Every field type a rule over model can address (rules-engine modelFieldCelTypes): the system fields, then each declared field of fields (config field specs, by name) that celFieldType types.
evaluateCel(CelProgram program, CelEnvironment env) → bool
Evaluates program in env to its boolean. Throws CelEvaluationError on a deterministic evaluation error — callers DENY on it (05 §6.3).
parseCel(String expression) → CelProgram
Parses one FFX-CEL expression (05 §3.2). Throws CelParseError (message
runCel(CelProgram program, CelEnvironment env) → ({bool allowed, Map<String, int> spends})
Evaluates program in env, and what its spend("…", n) calls spend when it allows: the credits on the path that allowed it, summed by name (05 §3.4); empty when it denies. Throws as evaluateCel does.

Typedefs

RecordLookup = Map<String, Object?>? Function(String model, String id)
One parsed FFX-CEL expression, evaluated any number of times by evaluateCel.

Exceptions / Errors

CelEvaluationError
A deterministic evaluation error (05 §3.6): null in an ordering, arithmetic, membership, or method; a type mismatch the schema-free parse could not see; a record read with no record bound; or a non-boolean result. Callers deny on it — it is never a 500 (05 §6.3).
CelParseError
A grammar, limit, or schema-free typing violation in an expression — what the platform reports at publish time. Carries the platform's fix.