Documentation
¶
Overview ¶
Package nodes contains the built-in node types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Commands = &shell.Policy{}
Commands is the process-wide policy the exec node is checked against. main installs it from the configuration before any flow starts, exactly as it does the discovery Scope, so a node can never run against an unset policy — the zero value refuses everything.
var Files = &filescope.Scope{}
Files is the process-wide path scope. main installs it from the configuration before any flow starts; the zero value refuses everything, so a node can never run against an unset scope.
var Links = &LinkRegistry{ inputs: map[string]*linkInNode{}, pending: map[string][]*linkOutNode{}, }
Links is the process-wide link registry.
var Routes = flowhttp.NewRouter("/", nil)
Routes is the process-wide flow route table. main installs it before any flow starts; the zero value has no routes and refuses to register any, so a node can never bind against a router nobody is serving.
var Scope *discover.Scope
Scope is the process-wide discovery scope, installed at startup from the configuration. Nil until then, which reads as disabled.
var TCPReplies = &tcpReplyRegistry{}
TCPReplies is the process-wide reply registry.
Functions ¶
func DeleteTypedTarget ¶
func DeleteTypedTarget(ec EvalContext, targetType, target string) error
DeleteTypedTarget removes a message property or context key.
func SetTypedTarget ¶
func SetTypedTarget(ec EvalContext, targetType, target string, value any) error
SetTypedTarget writes a value to a destination described by a type and a property path: a message property, or a flow- or global-context key.
Types ¶
type EvalContext ¶
type EvalContext struct {
Msg *engine.Msg
Services node.Services
// Now is the clock, injectable so date-typed values are testable.
Now func() time.Time
}
EvalContext is what a typed value needs in order to resolve.
type InfluxTarget ¶
InfluxTarget is how an action node reaches its config node.
type LinkRegistry ¶
type LinkRegistry struct {
// contains filtered or unexported fields
}
LinkRegistry resolves link targets across the whole runtime. Link wires cross tab boundaries, so they cannot be resolved from the flow graph alone.
func (*LinkRegistry) Reset ¶
func (lr *LinkRegistry) Reset()
Reset clears the registry. Called on redeploy, and by tests.
type MQTTBroker ¶
type MQTTBroker interface {
Client() mqtt.Client
Subscribe(topic string, qos byte, h mqtt.MessageHandler) error
Unsubscribe(topic string) error
}
MQTTBroker is how in and out nodes reach their shared connection.
type PoolProvider ¶
PoolProvider is how an action node reaches its config node's connection pool. Config nodes are handed back through Services.ConfigNode as a node.Node, so the capability is discovered by type assertion.
type TypedValue ¶
TypedValue is a value paired with the type discriminator that says how to interpret it.
This is Node-RED's typedInput, and it is the mechanism that makes flows composable: a field can hold a literal, a property of the incoming message, a context lookup, or an environment variable, and the node does not care which. The discriminator is stored in a companion property whose name varies by node — "pt" and "tot" on a Change rule, "vt" on a Switch rule — so it is always read explicitly rather than guessed.
func ReadTypedValue ¶
func ReadTypedValue(raw map[string]any, valueKey, typeKey, defType string) TypedValue
ReadTypedValue pulls a typed value out of a raw config map, given the key holding the value and the key holding its type.
defType is used when the type key is absent, which happens for flows written against older Node-RED versions where some fields were untyped strings.
func (TypedValue) Eval ¶
func (tv TypedValue) Eval(ec EvalContext) (any, bool, error)
Eval resolves a typed value.
Returning (nil, false, nil) means the reference was valid but resolved to nothing — a message property that is absent, a context key that was never set. Callers distinguish that from an error, because "not present" is a normal control-flow signal in a flow and an error is not.