References are values for later#
FlowExpression<T> represents a typed value that will be resolved during a run. Obtain one from flow.input, a task result, an answer field, or a joined operation. You usually do not construct the class directly.
const message = flow.input.get("message");
const answer = classification.answer("team").choice;
const isBilling = answer.eq("billing");A reference to the data passed to run(). Inside map/loop programs, it refers to the item or iteration input instead.
flow.input: FlowExpression<Input>Select a field from a referenced value. Keys come from your data shape. A missing field is an execution error.
expression.get(key)Reference the result of a named question. The name must match a key in questions; answer fields can be used in later steps.
request.answer(name)A reference to the label selected by a Choice question. Its allowed labels come from that question’s alternatives.
choice: FlowExpression<Label>Build an equality condition. It compares matching scalar values when the flow runs; it does not compare values during definition.
expression.eq(value)API reference: flow.input · expression.get() · answer.choice · expression.eq()
Example walkthrough: get("message") selects the input message. answer("team").choice selects a previous Choice answer. .eq("billing") describes a Boolean comparison that will be evaluated when the flow runs.
This fragment assumes a flow input with message and an earlier request named classification with a Choice question team. See the complete flow example.
Select and compare#
| Method | Meaning |
|---|---|
.get(key) |
Select an existing field, including nested fields. |
.eq(value) |
Compare matching scalar types for equality. |
.lt(value) |
Strictly less than; finite numeric values only. |
.gt(value) |
Strictly greater than; finite numeric values only. |
.gte(value) |
Greater than or equal; finite numeric values only. |
Each comparison accepts a literal or compatible expression. Optional or nullable numeric fields must be resolved to valid numbers before comparison. Missing fields are execution errors. There is no .lte() method; express an inclusive upper bound with not(value.gt(limit)) when the value is a valid number.
Return interfaces#
| Method | Return type | Resolved value |
|---|---|---|
get(key) |
FlowExpression<T[K]> |
Value of the selected field. |
eq, lt, gt, gte |
FlowExpression<boolean> |
The result of the comparison. |
Combine conditions#
Import all, any, and not from jev-devtools/flow:
const shouldReview = all(
eligibility.answer("eligible").noul.gte(0.9),
not(risk.answer("risky").noul.gt(0.2)),
);Combine Boolean flow conditions: every condition must be true. All operands are evaluated; this does not short-circuit missing references.
all(...conditions)Reference the probability of true returned by a Noul question. Any threshold you apply is your application's policy, not a TypeSafe default.
answer.noulBuild a greater-than-or-equal condition. Compares finite numeric values when the flow runs.
expression.gte(value)Invert a Boolean flow condition, evaluated when the flow runs.
not(condition)Build a strictly-greater-than condition. Compares finite numeric values when the flow runs.
expression.gt(value)API reference: all() · answer.noul · expression.gte() · not() · expression.gt()
Example walkthrough: .gte(0.9) checks the eligibility threshold. .gt(0.2) checks the risk threshold, and not() inverts that second condition. all() requires both conditions to hold. These thresholds are explicitly authored application policy.
This fragment assumes earlier requests named eligibility and risk. The thresholds are example application policy, not TypeSafe defaults. all requires every condition, any requires at least one, and not inverts one Boolean expression.
All operands are evaluated. A missing reference remains an error even when another operand would normally short-circuit JavaScript evaluation. There is no arbitrary predicate callback or eval in the expression API.
Return interfaces#
| Helper | Return type | Resolved value |
|---|---|---|
all(...conditions) |
FlowExpression<boolean> |
True when every condition is true. |
any(...conditions) |
FlowExpression<boolean> |
True when at least one condition is true. |
not(condition) |
FlowExpression<boolean> |
The inverse of the condition. |
Respect scope#
A reference belongs to its definition and available execution scope. Do not use a reference from another flow, an untaken branch, or a sibling parallel lane. Return a value from if or parallel to make it available after the join. Pass explicit context into map and loop programs.