set, state, emit, repeatWhile, repeatUntil, and key.
Value Types
Devset recognises four distinct value types. You can mix them freely within any stage.Plain Literal
A bare JSON value — string, number, boolean, ornull. The engine uses it exactly as written.
Function Call ($fn)
An object with a "$fn" key whose value is a function expression string. The engine calls the named built-in function and substitutes the return value.
Relative Field Reference ($ref)
An object with a "$ref" key that names a field in the current stage’s payload. Use this to read a value that was set earlier in the same stage’s set block, or carried over via source: "previous-stage".
$ref reads from the payload object being assembled by the current stage. To read from workflow-scoped state, use $path instead.Absolute Path Reference ($path)
An object with a "$path" key containing a dot-notation path into the workflow state. Use this to read any value that was written by a previous stage’s state block.
Conditional Values (when)
The when form lets you express if/else logic inline. The engine evaluates the when expression; if it is truthy, the value is used, otherwise default is used.
value and default:
Path References in Functions
Functions that take field arguments accept two path syntaxes:
Examples:
unitPrice field from the current payload and checks whether it is greater than zero.
count from state.batch and checks whether it is less than 50.
index value stored in state.sequence.
Built-in Function Reference
Weighted choice example
"completed" 70% of the time, "failed" 20% of the time, and "pending" 10% of the time.
Expressions in Context
The following workflow fragment shows all four value types and a conditional used together in a realistic stage:paymentIdandinitiatedAtuse$fnto generate random values at runtime.amount,currency, andmethoduse$fnwith weighted or range functions.sequenceNumberuses$pathto read from workflow state.referenceuses$refto copypaymentIdinto a second field within the same payload.requiresReviewuses awhenconditional that checks the freshly assignedamount.emituses$fnto skip dispatch ifamountis zero.