Add the vocabulary a real installation is mostly made of
Every one of these could be written as a function node, and until now had to be. But nine node types account for most of what an actual Node-RED installation contains — inject alone is placed 58 times, change 62 — and a rule you fill in reads better on a canvas, and survives editing better, than the same five lines repeated eighty times. Inject, switch, change, filter-unchanged, join, trigger, command, file and ntfy. They configure themselves through the editor's generated form, so none of them needed frontend work beyond an icon. The stateful ones (filter-unchanged, trigger) keep what they remember in the engine's own state under a reserved prefix, never as a message. That is the line: code you write is a pure function of its inputs, node types the engine ships may remember things. Verified against a live instance — a hook feeding change into filter-unchanged into switch scales a raw reading, swallows a change inside the deadband, and routes the rest to the right branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011LF61rxW1FG5YCD2J9YqjY
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
import { Handle, type NodeProps, Position } from "@xyflow/react"
|
||||
import { Braces, Clock, Code2, Database, Globe, Radio } from "lucide-react"
|
||||
import {
|
||||
Bell,
|
||||
Braces,
|
||||
Clock,
|
||||
Code2,
|
||||
Database,
|
||||
FileText,
|
||||
Filter,
|
||||
Globe,
|
||||
Merge,
|
||||
Play,
|
||||
Radio,
|
||||
Shuffle,
|
||||
Split,
|
||||
Terminal,
|
||||
Timer,
|
||||
} from "lucide-react"
|
||||
import { memo } from "react"
|
||||
|
||||
import type { MessageSpec, NodeDef_Input } from "@/client"
|
||||
@@ -19,6 +35,15 @@ const NODE_ICONS = {
|
||||
influxdb: Database,
|
||||
delay: Clock,
|
||||
mlp: Braces,
|
||||
inject: Play,
|
||||
switch: Split,
|
||||
change: Shuffle,
|
||||
rbe: Filter,
|
||||
join: Merge,
|
||||
trigger: Timer,
|
||||
exec: Terminal,
|
||||
file: FileText,
|
||||
ntfy: Bell,
|
||||
} as const
|
||||
|
||||
// One dot says everything about a node's state. Idle nodes carry no dot at all,
|
||||
|
||||
Reference in New Issue
Block a user