- Update all submodule URLs from gitea.centraal.wbd-rd.nl to gitea.wbd-rd.nl - Add settler as proper submodule in .gitmodules - Add agent skills, function anchors, decisions, and improvements - Add Docker configuration and scripts - Add manuals and third_party docs - Update .gitignore with secrets and build artifacts - Remove stale .tgz build artifact Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
1006 B
Markdown
30 lines
1006 B
Markdown
# Node-RED Function Node Patterns (EVOLV Summary)
|
|
|
|
Based on: https://nodered.org/docs/user-guide/writing-functions
|
|
|
|
## Return Semantics
|
|
|
|
- `return msg;` sends to output 1.
|
|
- `return [msg1, msg2, ...];` sends one message per output position.
|
|
- Use `null` for outputs that should not emit.
|
|
|
|
Examples:
|
|
|
|
- `return [msg, null, null];` -> output 1 only
|
|
- `return [null, msg, null];` -> output 2 only
|
|
|
|
## Message Mutation Pattern
|
|
|
|
- Start with the incoming `msg`, set fields (`msg.topic`, `msg.payload`), then return/send.
|
|
- This preserves message context unless there is a deliberate reason to create a new object.
|
|
|
|
## Async Function Pattern
|
|
|
|
- For asynchronous work, call `node.send(...)` and then `node.done()`.
|
|
- Avoid returning a message when output is sent asynchronously.
|
|
|
|
## EVOLV Practical Rule
|
|
|
|
- In example flows (including parsers), always align return-array position with downstream wiring.
|
|
- For dashboard parser functions, keep one stable output mapping per metric to avoid wire-level regressions.
|