Skip to main content

📦 Node Reference

This guide provides a deep technical reference for all standard nodes available in the Jet Admin Workflow Engine.

Logic Nodes

JavaScript Node

JavaScript Node

The JavaScript node allows you to execute arbitrary code within a secure, sandboxed environment (vm2). It is the primary tool for data transformation and complex business logic.

  • Handler: javascriptHandler.js
  • Output Handle: success (green), error (red)

Configuration Properties

PropertyTypeDefaultRequiredDescription
codestringreturn true;YesThe actual JavaScript code to execute. The last evaluated expression or return value constitutes the output.
outputVariablestringscriptResultNoThe key under which the return value will be stored in the workflow context. Accessed via ctx.{outputVariable}.
timeoutSecondsnumber30NoHard limit on execution time. If exceeded, the node fails with a timeout error.
retryLimitnumber0NoNumber of times to retry execution upon failure (excluding syntax errors).
retryDelaySecondsnumber5NoBackoff wait time between retry attempts.
errorHandlingenumfail_workflowNoStrategy for handling uncaught errors: fail_workflow, continue (proceed to next node with error output), retry_then_continue, retry_then_fail.

Context & Sandbox Environment

The code runs in a sandbox with the following restricted global limitations:

  • Available Globals: JSON, Math, Date, Array, Object, String, Number, Boolean, parseInt, parseFloat, isNaN, isFinite.
  • Unavailable: process, require, console (stubbed to no-op), setTimeout/setInterval (stubbed).

Context Object (ctx): Variables from previous nodes are accessed via the global ctx object.

// Example Context Access
const userId = ctx.input.user_id;
const queryData = ctx.myQuery.data;

JSON Structure

{
"id": "node_123",
"type": "javascript",
"data": {
"code": "return ctx.input.value * 2;",
"outputVariable": "doubledValue",
"errorHandling": "continue"
}
}

Condition Node

Condition Node

The Condition node executes logic branching. It evaluates a series of JavaScript boolean expressions and routes execution to the first matching branch.

  • Handler: conditionHandler.js
  • Output Handles: One per branch ID, plus a default handle.

Configuration Properties

PropertyTypeDefaultRequiredDescription
branchesarray[]NoAn array of branch objects. Each object contains an id (handle ID) and a condition (JS expression string).
defaultBranchstring-YesThe handle ID to use if no conditions evaluate to true.

Evaluation Logic

  1. Iterates through branches in order.
  2. Executes Boolean(condition_expression) in a VM2 sandbox.
  3. On first true, returns that branch's ID as the nextHandle.
  4. If none match, returns defaultBranch.

JSON Structure

{
"id": "node_456",
"type": "condition",
"data": {
"branches": [
{ "id": "branch_1", "condition": "ctx.status === 'active'" },
{ "id": "branch_2", "condition": "ctx.amount > 100" }
],
"defaultBranch": "branch_default"
}
}

Data Nodes

Data Query Node

Data Query Node

Executes a server-side Data Query (SQL, REST, etc.) defined in the Jet Admin application.

  • Handler: dataQueryHandler.js
  • Output Handle: success, error

Configuration Properties

PropertyTypeDefaultRequiredDescription
dataQueryIDstring-YesUUID of the tblDataQueries record to execute.
argsobject{}NoMap of query arguments. Values starting with ctx. are dynamically resolved from context.
outputVariablestringqueryResultNoVariable name for the storage of the query result (e.g., rows, status).

Context Resolution

Dynamic arguments are processed before query execution.

  • If an argument value is "ctx.input.id", it is replaced with the actual value 123.
  • Literal values (e.g., "approved") remain as strings.

JSON Structure

{
"id": "node_789",
"type": "dataQuery",
"data": {
"dataQueryID": "dq_abc123",
"args": {
"user_id": "ctx.input.id",
"status": "pending"
}
}
}

Control Flow Nodes

⏱️ Delay Node

Pauses workflow execution for a set period.

  • Handler: delayHandler.js
  • Mechanism: Non-blocking. The node returns a queueDelay property, causing the Orchestrator to schedule the next node's job into a RabbitMQ delayed queue/exchange.

Configuration Properties

PropertyTypeDefaultRequiredDescription
delayTypeenumfixedYesfixed (static configuration) or dynamic (read from context).
delayMinutesnumber0NoFixed minutes component.
delaySecondsnumber0NoFixed seconds component.
delayMsnumber0NoFixed milliseconds component.
delayVariablestring-NoIf dynamic, the context path to read the total delay (in ms) from.

🔄 Loop Node

Iterates over an array.

  • Handler: loopHandler.js
  • Output Handle: loop (body), done (completion)

Configuration Properties

PropertyTypeDefaultRequiredDescription
sourceVariablestring-YesContext path to the array to iterate over.
itemVariablestringitemNoThe variable name exposed to the loop body context representing the current item.
indexVariablestringindexNoThe variable name exposed for the current iteration index.

Execution Flow

  1. Initialization: The node reads the array.
  2. Orchestrator Control: The Orchestrator manages the iteration state. It queues the first node of the loop body.
  3. Completion: When the index reaches the array length, the done handle is followed.

Start Node

Start Node

The required entry point.

  • Handler: startHandler.js
  • Output Handle: output (default)
  • Function: Validates input parameters and initializes the execution log. Does not perform logic.

End Node

End Node

The terminal point.

  • Handler: endHandler.js
  • Function: Marks the tblWorkflowInstances record as COMPLETED.
  • Output: Constructs a final output object based on outputParameters mapping, which is persisted to the instance record.