LatticeFlow v2 Node Reference
Every node in LatticeFlow v2 is registered and validated by validateNodeDefinition in plugins/nocobase/plugin-dxos-studio/src/server/flow/registry.js. The 24 node types span 6 categories (trigger, control, data, logic, ai, integration) and share a common graph envelope: id, type, label, position, config, continueOnFail, and optional timeoutMs.
/api/dxosAutomations:nodeRegistry/api/dxosAutomations:testNodeAll 24 Node Types Index
| # | Node Type Key | Category | Inputs | Outputs | Summary |
|---|---|---|---|---|---|
| 1 | trigger.event | trigger | [] | main | Starts on matching CloudEvents from the Event Bus |
| 2 | trigger.record | trigger | [] | main | Starts on ORM create, update, or delete hooks |
| 3 | trigger.schedule | trigger | [] | main | Starts on a 5-field cron schedule and IANA timezone |
| 4 | trigger.webhook | trigger | [] | main | Starts on inbound HTTP POST with HMAC or Bearer auth |
| 5 | trigger.manual | trigger | [] | main | Starts from Control Studio or dxosAutomations:runNow |
| 6 | control.if | control | in | true, false, error | Binary branch evaluated by structured filter rules |
| 7 | control.switch | control | in | case_0, case_1, case_2, default, error | Multi-way branch routed by ordered cases |
| 8 | control.parallel | control | in | main, error | Fans out execution across all connected outgoing edges |
| 9 | control.merge | control | in | main, error | Joins parallel branches via wait_all or first_completed |
| 10 | control.loop | control | in | item, done, error | Bounded iteration (max 100 items) with durable cursor state |
| 11 | control.delay | control | in | main, error | Suspends execution for durationSec or until untilIso |
| 12 | control.approval | control | in | approved, rejected, error | Enqueues an HITL approval and pauses until decided |
| 13 | control.subflow | control | in | main, error | Invokes another rule in the same org (max depth 8) |
| 14 | data.query | data | in | main, error | Queries tenant-scoped records from allowlisted collections |
| 15 | data.create | data | in | main, error | Inserts a record with forced organizationId and depth tracking |
| 16 | data.update | data | in | main, error | Updates records matching recordId or non-empty filter |
| 17 | logic.dmn | logic | in | main, error | Evaluates a tenant DMN table and populates context.dmn |
| 18 | logic.transform | logic | in | main, error | Runs 9 declarative data operations without eval() |
| 19 | ai.llm | ai | in | main, error | Calls OpenAI-compatible llmServices with PII redaction |
| 20 | ai.agent | ai | in | main, error | Runs single-turn triage proposals or multi-turn ReAct agents |
| 21 | integration.http | integration | in | main, error | Calls origin-locked Vault connectors with SSRF and HMAC guards |
| 22 | iot.twin_command | integration | in | main, error | Dispatches desiredPatch to Digital Twin or HITL queue |
| 23 | notify.send | integration | in | main, error | Sends role-targeted notifications across 5 delivery channels |
| 24 | event.emit | integration | in | main, error | Publishes a CloudEvent to the Event Bus with incremented depth |
trigger Category (5 Nodes)
All trigger nodes (nodes/triggers.js) declare inputs: [] and outputs: ['main'], and normalize their output payload to the same envelope:
{
"type": "lot.held_mkt",
"data": { "lotCode": "LOT-VAX-01", "mktCelsius": 10.4 },
"record": null,
"timestamp": "2026-11-26T08:30:00.000Z",
"webhook": null,
"schedule": null
}1. trigger.event
Starts a workflow when a CloudEvent published on the Lattice Event Bus matches eventType (supports * wildcards and comma-separated patterns) and passes filterJson.
| Parameter | Type | Default | Description |
|---|---|---|---|
eventTyperequired | string | * | CloudEvent type pattern to match (for example lot.held_mkt or entity.*). |
filterJson | json | null | Optional structured filter evaluated against event data before creating a run. |
2. trigger.record
Starts from ORM lifecycle hooks (registerRecordTriggerHooks) when records are created, updated, or deleted in an allowlisted business collection or latticeCustom* table. output.record holds the sanitized ORM record.
| Parameter | Type | Default | Description |
|---|---|---|---|
collectionrequired | string | "" | Allowlisted business collection or custom latticeCustom* table name. |
operationrequired | string | create | ORM event operation: create, update, or delete. |
filterJson | json | null | Optional structured filter applied to the mutated record. |
3. trigger.schedule
Starts periodically from a 5-field cron expression (minute hour dom month dow, normalizing Sunday 7 to 0) and IANA timezone. Dispatched by tickScheduledRules under the PostgreSQL advisory lock dxos_flow_scheduler_tick; sets output.schedule to { cron, timezone }.
| Parameter | Type | Default | Description |
|---|---|---|---|
cronrequired | string | 0 * * * * | Standard 5-field UNIX cron expression. |
timezone | string | UTC | IANA timezone evaluated via Intl.DateTimeFormat (for example Asia/Ho_Chi_Minh). |
4. trigger.webhook
Starts from an external HTTP POST sent to POST /api/dxosAutomations:webhookIngress. Validates request authentication before starting the graph and populates output.webhook with { webhookPath, authMode, secretHeader }.
| Parameter | Type | Default | Description |
|---|---|---|---|
webhookPathrequired | string | "" | Logical webhook path descriptor associated with the rule. |
authModerequired | string | hmac | Verification mode: hmac (HMAC-SHA256 or Standard Webhooks) or bearer. |
secretHeader | string | X-Lattice-Signature-256 | HTTP header inspected for hex HMAC signatures when authMode is hmac. |
5. trigger.manual
Starts manually from Control Studio or via POST /api/dxosAutomations:runNow. inputSchemaJson documents the expected JSON payload schema for operators and test callers.
| Parameter | Type | Default | Description |
|---|---|---|---|
inputSchemaJson | json | {} | JSON schema describing expected manual trigger input fields. |
control Category (8 Nodes)
Control nodes (nodes/control.js) accept input on in and handle branching, fan-out, fan-in, bounded loops, durable suspension, and nested rule calls.
6. control.if
Interpolates {{path}} tokens inside condition and evaluates it with matchesFilter. Outputs on ['true', 'false', 'error'] and returns { matched, condition }.
| Parameter | Type | Default | Description |
|---|---|---|---|
conditionrequired | json | {"field":"","op":"eq","value":""} | Structured filter supporting $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists, $contains, $and, $or, and $not. |
7. control.switch
Reads expression and evaluates cases in order, routing to the first matching port (case_0, case_1, case_2, or custom case port) or default if none match (outputs: ['case_0', 'case_1', 'case_2', 'default', 'error']). Returns { matched, port, value }.
| Parameter | Type | Default | Description |
|---|---|---|---|
expressionrequired | string | "" | Context path (data.priority) or {{path}} template to inspect. |
casesrequired | json | [{"port":"case_0","operator":"eq","equals":""}] | Ordered array of case definitions with port, operator (or op), equals (or value), or condition. |
8. control.parallel
Fans out execution simultaneously over main to every connected downstream branch (outputs: ['main', 'error']). Ready target nodes are dispatched via runRlsAwareBatch. Returns { fannedOut: true, input }.
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | string | fan_out | Fan-out execution mode (fixed to fan_out). |
9. control.merge
Joins outputs from incoming parallel branches (outputs: ['main', 'error']) and returns { mode, merged, branches }. In wait_all mode, execution waits for all non-skipped predecessors; in first_completed mode, the first arriving branch triggers downstream execution immediately.
| Parameter | Type | Default | Description |
|---|---|---|---|
moderequired | string | wait_all | Branch join strategy: wait_all or first_completed. |
10. control.loop
Iterates over the array resolved at itemsPath, executing the subgraph attached to item with loop = { item, index, count } before routing aggregated results to done (outputs: ['item', 'done', 'error']). Bounded by MAX_LOOP_CAP = 100; final output is { items, count, totalCount, maxIterations, truncated, results }.
| Parameter | Type | Default | Description |
|---|---|---|---|
itemsPathrequired | string | data.items | Path to the array in execution context. |
maxIterationsrequired | number | 100 | Iteration limit in range 1..100; values outside range throw FLOW_LOOP_LIMIT_EXCEEDED. |
strictLimit | boolean | false | When true, throws FLOW_LOOP_LIMIT_EXCEEDED if array length exceeds maxIterations instead of truncating. |
11. control.delay
Computes resumeAt from untilIso or Date.now() + durationSec * 1000 and suspends the run (status: 'suspended', outputs: ['main', 'error']). During dryRun, returns { delayed: true, simulated: true, resumeAt, durationSec } without suspending.
| Parameter | Type | Default | Description |
|---|---|---|---|
durationSec | number | 60 | Delay duration in seconds when untilIso is omitted. |
untilIso | string | "" | Target ISO-8601 wake-up timestamp (supports {{path}} templates). |
12. control.approval
Inserts a pending approval into latticeAiApprovalQueue and suspends the run (outputs: ['approved', 'rejected', 'error']) with a SHA-256 resumeTokenHash and expiration resumeAt. Calling resumeRun as an authorized approverRole or active delegate routes execution to approved or rejected.
| Parameter | Type | Default | Description |
|---|---|---|---|
approverRolerequired | string | ldx_manager | Role required (directly or via active delegation) to decide the approval. |
titlerequired | string | Cần phê duyệt | Approval item title shown in the HITL queue. |
summary | string | "" | Decision summary shown to reviewers (supports {{path}}). |
riskLevel | string | medium | Risk classification: low, medium, high, or critical. |
ttlHours | number | 24 | Expiration window in hours (clamped 1..720). |
13. control.subflow
Invokes another published rule (ruleKey) within the same organizationId via helpers.executeSubflow (outputs: ['main', 'error']). Blocks direct self-recursion (FLOW_SELF_RECURSIVE_SUBFLOW) and returns { ruleKey, depth, result }.
| Parameter | Type | Default | Description |
|---|---|---|---|
ruleKeyrequired | string | "" | Target workflow ruleKey within the same organization. |
payloadMapping | json | {} | Object mapped and template-interpolated as data for the child flow. |
maxDepth | number | 8 | Per-node recursion depth limit (1..8, bounded by MAX_SUBFLOW_DEPTH). |
data Category (3 Nodes)
Data nodes (nodes/data.js) operate exclusively on ALLOWLISTED_BUSINESS_COLLECTIONS (latticeRequests, latticeOrders, latticeOrderLines, latticeServiceTickets, latticeParaDocuments, latticeIncidentCases, latticeLocations, latticeAssets, latticeAgentProposals) and custom collections matching ^latticeCustom[A-Z][A-Za-z0-9]{1,40}$. Every query or mutation injects organizationId and blocks FORBIDDEN_SYSTEM_COLLECTIONS.
On core voucher tables (latticeRequests, latticeOrders, latticeServiceTickets), sanitizeWriteValues strips id, organizationId, status, version, amendedFromId, amendmentNo, submittedAt, submittedBy, cancelledAt, cancelledBy, and cancelReason.
14. data.query
Queries tenant-scoped records (outputs: ['main', 'error']) using sanitizeDirectFilter and assertSafeDirectSort, returning { collection, count, items }.
| Parameter | Type | Default | Description |
|---|---|---|---|
collectionrequired | string | latticeRequests | Allowlisted business or latticeCustom* collection name. |
filter | json | {} | Filter object merged with mandatory organizationId scope. |
limit | number | 20 | Maximum records returned (1..200). |
sort | json | [] | Validated sort field array (for example ["-createdAt"]). |
15. data.create
Creates a tenant-scoped record inside runWithOrmDepth (incrementing ORM hook depth) and returns { collection, id, record }.
| Parameter | Type | Default | Description |
|---|---|---|---|
collectionrequired | string | "" | Allowlisted target collection name. |
valuesrequired | json | {} | Record field values after {{path}} interpolation and protected-field stripping. |
16. data.update
Queries matching records within organizationId using filter or recordId and applies sanitized updates up to limit (outputs: ['main', 'error']). Rejects empty filters (DATA_UPDATE_FILTER_REQUIRED) to prevent accidental full-table updates; returns { collection, matchedCount, updatedCount }.
| Parameter | Type | Default | Description |
|---|---|---|---|
collectionrequired | string | "" | Allowlisted target collection name. |
recordId | string | "" | Target record ID used when filter is omitted. |
filter | json | {} | Non-empty filter expression (takes precedence over recordId). |
valuesrequired | json | {} | Updated field values after protected-field stripping. |
limit | number | 20 | Maximum matched records updated per call (1..200). |
logic Category (2 Nodes)
17. logic.dmn
Evaluates an active decision table (tableKey) in latticeDecisionTables for the current tenant via evaluateDecisionTable (outputs: ['main', 'error']). Writes outputs to both context.dmn (accessible downstream as {{dmn.<field>}}) and context.dmnResult, and returns { tableKey, matched, hitPolicy, outputs, matchedRules }.
| Parameter | Type | Default | Description |
|---|---|---|---|
tableKeyrequired | string | "" | Key of an active DMN table belonging to the current organization. |
facts | json | {} | Additional fact overrides merged with event.data and upstream input. |
18. logic.transform
Executes an ordered array of declarative operations without eval() or new Function() (outputs: ['main', 'error']). Each step reads from both the in-progress result object and the enclosing evalCtx.
| Parameter | Type | Default | Description |
|---|---|---|---|
operationsrequired | json | [] | Ordered array of transform operations keyed by op. |
baseFromInput | boolean | true | Initializes result as a sanitized copy of input when true, or {} when false. |
All 9 supported op primitives in logic.transform:
op | Key Fields | Behavior |
|---|---|---|
set | target, source or value | Assigns a value from source path or interpolated value into target. |
template | target, expr / template / value | Interpolates a {{path}} string and writes it to target. |
coerceNumber | target, source / value, precision?, fallback? | Parses a finite number with optional rounding (0..12), falling back on invalid input. |
coerceBoolean | target, source / value | Maps 'false', '0', 'no', 'off', and '' to false; otherwise Boolean(raw). |
math | target, operator (add, sub, mul, div), left/right or operands or expr, precision? | Evaluates binary arithmetic safely and rejects division by zero (TRANSFORM_DIVIDE_BY_ZERO). |
concat | target, parts / sources, separator? | Joins resolved paths or templates using separator. |
rename | from / source, to / target | Moves a value from the source path to the target path and deletes the old key. |
pick | keys / fields, target? | Retains only listed keys (into target or replacing result). |
omit | keys / fields | Deletes listed keys from result. |
ai Category (2 Nodes)
19. ai.llm
Calls the active OpenAI-compatible provider configured in llmServices via callConfiguredLlm (outputs: ['main', 'error']), applying PII redaction and assertSafeLlmUrl SSRF checks. If no LLM provider is configured and fallbackOutput is present, it returns mode: 'offline-fallback' on main.
| Parameter | Type | Default | Description |
|---|---|---|---|
systemPrompt | string | "" | System instruction prepended to the message array. |
userPromptrequired | string | "" | User prompt sent to the model (supports {{path}} interpolation). |
responseFormat | string | json | Expected output format: json or text. |
temperature | number | 0.2 | Sampling temperature passed to the provider. |
maxTokens | number | 1600 | Maximum completion tokens. |
model | string | "" | Optional model override; defaults to the active llmServices model. |
fallbackOutput | json | null | Static or templated fallback returned in dryRun or unconfigured environments. |
Successful calls return { mode, model, content, parsedJson, data, usage, piiRedactedCount }.
20. ai.agent
Supports two execution modes (outputs: ['main', 'error']) scoped to an allowlisted targetCollection:
singlemode (default): Performs a single-turn structured triage call (withoffline_fallbackwhen unconfigured) and writes aproposedrecord tolatticeAgentProposals(orlatticeAiApprovalQueue).reactmode (mode: 'react',enableReact: true, or non-emptytools): RunsexecuteReactAgentup tomaxTurns(1..12), emits OpenTelemetry GenAI spans (chat,execute_tool,invoke_agent), validatesoutputSchemawith up to 1 self-repair turn, and suspends for HITL approval (suspend: { kind: 'approval' }) whenever the agent invokes a mutating tool (isMutatingTool).
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | string | single | Reasoning mode: single or react. |
enableReact | boolean | false | Enables the ReAct loop when mode is not explicitly set to react. |
maxTurns | number | 5 | Maximum ReAct turns in range 1..12. |
tools | json | [] | Allowlisted tool names exposed to the ReAct agent. |
outputSchema | json | null | JSON Schema enforced on the final ReAct response. |
memoryScope | string | org | Long-term memory scope: org, agent, user, or none. |
enableMemory | boolean | false | Automatically recalls matching latticeAiMemory items before reasoning. |
systemPrompt | string | "" | Custom system instruction for the agent. |
targetCollectionrequired | string | latticeAssets | Allowlisted business collection linked to proposals or triage items. |
targetRecordId | string | 0 | Target record ID. |
severity | string | medium | Default triage severity: low, medium, high, or critical. |
recommendation | string | "" | Default recommendation text when LLM fallback applies. |
prompt | string | "" | Analysis instruction for the agent. |
evidence | json | null | Structured evidence payload attached to the proposal. |
aiEmployee | string | ops_triage | Agent persona identifier. |
toolName | string | triage_flow_event | Tool label recorded in HITL approval queue items. |
model | string | "" | Optional model override (for example ag/gemini-3.8-flash). |
temperature | number | 0.2 | Sampling temperature. |
maxTokens | number | 1000 | Maximum completion tokens per turn. |
integration Category (4 Nodes)
21. integration.http
Dispatches HTTP requests through a Connector Vault entry (connectorKey, outputs: ['main', 'error']). Locks the target origin to connector.baseUrl (buildConnectorUrl), enforces synchronous and async DNS SSRF checks, injects Vault auth headers, signs X-Lattice-Signature-256 and Standard Webhooks (webhook-signature) when authType === 'hmac', disables HTTP redirects (redirect: 'error'), and scrubs secrets from { connectorKey, authType, method, url, status, ok, response }.
| Parameter | Type | Default | Description |
|---|---|---|---|
connectorKeyrequired | string | "" | Connector key stored in latticeConnectors. |
methodrequired | string | POST | HTTP method: GET, POST, PUT, PATCH, or DELETE. |
path | string | "" | Relative path appended to connector baseUrl (origin changes rejected). |
headers | json | {} | Additional headers; Authorization, Host, and signature headers are stripped. |
body | json | null | JSON request body for POST, PUT, and PATCH methods. |
timeoutMs | number | 5000 | Request timeout in milliseconds (clamped 100..60000). |
22. iot.twin_command
Calls digitalTwinMod.requestDesiredSetpoint to update desired state (desiredPatch) on assetEntityId (outputs: ['main', 'error']). Setpoint changes exceeding the Digital Twin HITL delta threshold route into the approval queue before publishing downlinks to Node-RED / Mosquitto.
| Parameter | Type | Default | Description |
|---|---|---|---|
assetId | string | "" | Optional latticeAssets record ID. |
assetEntityIdrequired | string | "" | NGSI-LD / Digital Twin entity ID (for example urn:ngsi-ld:ColdRoom:HCM-01). |
desiredPatchrequired | json | {} | Desired twin property patch object. |
downlinkUrl | string | "" | Optional downlink override URL (validated against static SSRF rules). |
23. notify.send
Delivers tenant-scoped notifications to roleNames via notificationCenter.dispatchRoleNotifications (outputs: ['main', 'error']), returning { roleNames, notifyChannels, templateKey?, dispatched, title }.
| Parameter | Type | Default | Description |
|---|---|---|---|
roleNamesrequired | json | ["ldx_operator"] | Target role names receiving the notification. |
titlerequired | string | "" | Notification title after {{path}} interpolation. |
body | string | "" | Notification message body. |
severity | string | warning | Severity level: info, warning, high, or critical. |
category | string | system | Category: system, mention, voucher, sla, alarm, or approval. |
targetCollection | string | "" | Linked business collection name. |
targetRecordId | string | "" | Linked record ID. |
targetPath | string | "" | Portal route opened when clicking the notification. |
notifyChannels | json | ["in_app"] | Delivery channels: in_app, email_smtp, telegram, slack, webhook. |
templateKey | string | "" | Optional notification template key (max 120 chars). |
channelConfig | json | {} | Per-channel metadata such as connectorKey. |
24. event.emit
Publishes a tenant-scoped CloudEvent onto the Lattice Event Bus (outputs: ['main', 'error']) and returns { published: true, eventType, subject, depth }. Automatically increments depth by 1 and throws RECURSION_DEPTH_LIMIT_EXCEEDED if depth > MAX_HARD_DEPTH (8).
| Parameter | Type | Default | Description |
|---|---|---|---|
eventTyperequired | string | "" | CloudEvent type string to publish. |
subject | string | "" | Optional business subject identifier. |
data | json | {} | Event data payload after {{path}} interpolation and prototype sanitization. |
{
"nodes": [
{
"id": "tx_1",
"type": "logic.transform",
"config": {
"baseFromInput": false,
"operations": [
{ "op": "set", "target": "lotCode", "source": "data.lotCode" },
{ "op": "math", "target": "overThresholdC", "operator": "sub", "left": "data.mktCelsius", "right": "data.thresholdCelsius", "precision": 2 },
{ "op": "template", "target": "summary", "expr": "Lot {{result.lotCode}} exceeded by {{result.overThresholdC}}C" }
]
}
},
{
"id": "http_1",
"type": "integration.http",
"config": {
"connectorKey": "n8n-coldchain-orchestrator",
"method": "POST",
"path": "/webhook/mkt-alert",
"body": { "lotCode": "{{steps.tx_1.lotCode}}", "summary": "{{steps.tx_1.summary}}" },
"timeoutMs": 5000
}
}
]
}