mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Reorganise nodes into new categories
This commit is contained in:
58
packages/node_modules/@node-red/nodes/locales/en-US/function/10-function.html
vendored
Normal file
58
packages/node_modules/@node-red/nodes/locales/en-US/function/10-function.html
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="function">
|
||||
<p>A JavaScript function block to run against the messages being received by the node.</p>
|
||||
<p>The messages are passed in as a JavaScript object called <code>msg</code>.</p>
|
||||
<p>By convention it will have a <code>msg.payload</code> property containing
|
||||
the body of the message.</p>
|
||||
<p>The function is expected to return a message object (or multiple message objects), but can choose
|
||||
to return nothing in order to halt a flow.</p>
|
||||
<h3>Details</h3>
|
||||
<p>See the <a target="_blank" href="http://nodered.org/docs/writing-functions.html">online documentation</a>
|
||||
for more information on writing functions.</p>
|
||||
<h4>Sending messages</h4>
|
||||
<p>The function can either return the messages it wants to pass on to the next nodes
|
||||
in the flow, or can call <code>node.send(messages)</code>.</p>
|
||||
<p>It can return/send:</p>
|
||||
<ul>
|
||||
<li>a single message object - passed to nodes connected to the first output</li>
|
||||
<li>an array of message objects - passed to nodes connected to the corresponding outputs</li>
|
||||
</ul>
|
||||
<p>If any element of the array is itself an array of messages, multiple
|
||||
messages are sent to the corresponding output.</p>
|
||||
<p>If null is returned, either by itself or as an element of the array, no
|
||||
message is passed on.</p>
|
||||
<h4>Logging and Error Handling</h4>
|
||||
<p>To log any information, or report an error, the following functions are available:</p>
|
||||
<ul>
|
||||
<li><code>node.log("Log message")</code></li>
|
||||
<li><code>node.warn("Warning")</code></li>
|
||||
<li><code>node.error("Error")</code></li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>The Catch node can also be used to handle errors. To invoke a Catch node,
|
||||
pass <code>msg</code> as a second argument to <code>node.error</code>:</p>
|
||||
<pre>node.error("Error",msg);</pre>
|
||||
<h4>Accessing Node Information</h4>
|
||||
<p>In the function block, id and name of the node can be referenced using the following properties:</p>
|
||||
<ul>
|
||||
<li><code>node.id</code> - id of the node</li>
|
||||
<li><code>node.name</code> - name of the node</li>
|
||||
</ul>
|
||||
<h4>Using environment variables</h4>
|
||||
<p>Environment variables can be accessed using <code>env.get("MY_ENV_VAR")</code>.</p>
|
||||
</script>
|
||||
51
packages/node_modules/@node-red/nodes/locales/en-US/function/10-switch.html
vendored
Normal file
51
packages/node_modules/@node-red/nodes/locales/en-US/function/10-switch.html
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="switch">
|
||||
<p>Route messages based on their property values or sequence position.</p>
|
||||
<h3>Details</h3>
|
||||
<p>When a message arrives, the node will evaluate each of the defined rules
|
||||
and forward the message to the corresponding outputs of any matching rules.</p>
|
||||
<p>Optionally, the node can be set to stop evaluating rules once it finds one
|
||||
that matches.</p>
|
||||
<p>The rules can be evaluated against an individual message property, a flow or global
|
||||
context property, environment variable or the result of a JSONata expression.</p>
|
||||
<h4>Rules</h4>
|
||||
<p>There are four types of rule:</p>
|
||||
<ol>
|
||||
<li><b>Value</b> rules are evaluated against the configured property</li>
|
||||
<li><b>Sequence</b> rules can be used on message sequences, such as those
|
||||
generated by the Split node</li>
|
||||
<li>A JSONata <b>Expression</b> can be provided that will be evaluated
|
||||
against the whole message and will match if the expression returns
|
||||
a true value.</li>
|
||||
<li>An <b>Otherwise</b> rule can be used to match if none of the preceeding
|
||||
rules have matched.</li>
|
||||
</ol>
|
||||
<h4>Notes</h4>
|
||||
<p>The <code>is true/false</code> and <code>is null</code> rules perform strict
|
||||
comparisons against those types. They do not convert between types.</p>
|
||||
<p>The <code>is empty</code> rule passes for Strings, Arrays and Buffers that have
|
||||
a length of 0, or Objects that have no properties. It does not pass for <code>null</code>
|
||||
or <code>undefined</code> values.</p>
|
||||
<h4>Handling message sequences</h4>
|
||||
<p>By default, the node does not modify the <code>msg.parts</code> property of messages
|
||||
that are part of a sequence.</p>
|
||||
<p>The <b>recreate message sequences</b> option can be enabled to generate new message sequences
|
||||
for each rule that matches. In this mode, the node will buffer the entire incoming
|
||||
sequence before sending the new sequences on. The runtime setting <code>nodeMessageBufferMaxLength</code>
|
||||
can be used to limit how many messages nodes will buffer.</p>
|
||||
</script>
|
||||
39
packages/node_modules/@node-red/nodes/locales/en-US/function/15-change.html
vendored
Normal file
39
packages/node_modules/@node-red/nodes/locales/en-US/function/15-change.html
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="change">
|
||||
<p>Set, change, delete or move properties of a message, flow context or global context.</p>
|
||||
<p>The node can specify multiple rules that will be applied in the order they are defined.</p>
|
||||
<h3>Details</h3>
|
||||
<p>The available operations are:</p>
|
||||
<dl class="message-properties">
|
||||
<dt>Set</dt>
|
||||
<dd>set a property. The value can be a variety of different types, or
|
||||
can be taken from an existing message or context property.</dd>
|
||||
<dt>Change</dt>
|
||||
<dd>search & replace parts of the property. If regular expressions
|
||||
are enabled, the "replace with" property can include capture groups, for
|
||||
example <code>$1</code>. Replace will only change the type if there
|
||||
is a complete match.</dd>
|
||||
<dt>Delete</dt>
|
||||
<dd>delete a property.</dd>
|
||||
<dt>Move</dt>
|
||||
<dd>move or rename a property.</dd>
|
||||
</dl>
|
||||
<p>The "expression" type uses the <a href="http://jsonata.org/" target="_new">JSONata</a>
|
||||
query and expression language.
|
||||
</p>
|
||||
</script>
|
||||
37
packages/node_modules/@node-red/nodes/locales/en-US/function/16-range.html
vendored
Normal file
37
packages/node_modules/@node-red/nodes/locales/en-US/function/16-range.html
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="range">
|
||||
<p>Maps a numeric value to a different range.</p>
|
||||
<h3>Inputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">number</span></dt>
|
||||
<dd>The payload <i>must</i> be a number. Anything else will try to be
|
||||
parsed into a number and rejected if that fails.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">number</span></dt>
|
||||
<dd>The value mapped to the new range.</dd>
|
||||
</dl>
|
||||
<h3>Details</h3>
|
||||
<p>This node will linearly scale the received value. By default, the result
|
||||
is not constrained to the range defined in the node.</p>
|
||||
<p><i>Scale and limit to target range</i> means that the result will never be outside
|
||||
the range specified within the result range.</p>
|
||||
<p><i>Scale and wrap within the target range</i> means that the result will
|
||||
be wrapped within the result range.</p>
|
||||
</script>
|
||||
51
packages/node_modules/@node-red/nodes/locales/en-US/function/80-template.html
vendored
Normal file
51
packages/node_modules/@node-red/nodes/locales/en-US/function/80-template.html
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="template">
|
||||
<p>Sets a property based on the provided template.</p>
|
||||
<h3>Inputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>msg <span class="property-type">object</span></dt>
|
||||
<dd>A msg object containing information to populate the template.</dd>
|
||||
<dt class="optional">template <span class="property-type">string</span></dt>
|
||||
<dd>A template to be populated from msg.payload. If not configured in the edit panel,
|
||||
this can be set as a property of msg.</dd>
|
||||
</dl>
|
||||
<h3>Outputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>msg <span class="property-type">object</span></dt>
|
||||
<dd>a msg with a property set by populating the configured template with properties from the incoming msg.</dd>
|
||||
</dl>
|
||||
<h3>Details</h3>
|
||||
<p>By default this uses the <i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>
|
||||
format, but this can be switched off if required.</p>
|
||||
<p>For example, when a template of:
|
||||
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
|
||||
<p>receives a message containing:
|
||||
<pre>{
|
||||
date: "Monday"
|
||||
payload: {
|
||||
name: "Fred",
|
||||
}
|
||||
}</pre>
|
||||
<p>The resulting property will be:
|
||||
<pre>Hello Fred. Today is Monday</pre>
|
||||
<p>It is possible to use a property from the flow context or global context. Just use <code>{{flow.name}}</code> or
|
||||
<code>{{global.name}}</code>, or for persistable store <code>store</code> use <code>{{flow[store].name}}</code> or
|
||||
<code>{{global[store].name}}</code>.
|
||||
<p><b>Note: </b>By default, <i>mustache</i> will escape any HTML entities in the values it substitutes.
|
||||
To prevent this, use <code>{{{triple}}}</code> braces.
|
||||
</script>
|
||||
45
packages/node_modules/@node-red/nodes/locales/en-US/function/89-delay.html
vendored
Normal file
45
packages/node_modules/@node-red/nodes/locales/en-US/function/89-delay.html
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="delay">
|
||||
<p>Delays each message passing through the node or limits the rate at which they can pass.</p>
|
||||
<h3>Inputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt class="optional">delay <span class="property-type">number</span></dt>
|
||||
<dd>Sets the delay, in milliseconds, to be applied to the message. This
|
||||
option only applies if the node is configured to allow the message to
|
||||
override the configured default delay interval.</dd>
|
||||
<dt class="optional">reset</dt>
|
||||
<dd>If the received message has this property set to any value, all
|
||||
outstanding messages held by the node are cleared without being sent.</dd>
|
||||
<dt class="optional">flush</dt>
|
||||
<dd>If the received message has this property set to any value, all
|
||||
outstanding messages held by the node are sent immediately.</dd>
|
||||
</dl>
|
||||
<h3>Details</h3>
|
||||
<p>When configured to delay messages, the delay interval can be a fixed value,
|
||||
a random value within a range or dynamically set for each message.</p>
|
||||
<p>When configured to rate limit messages, their delivery is spread across
|
||||
the configured time period. The status shows the number of messages currently in the queue.
|
||||
It can optionally discard intermediate messages as they arrive.</p>
|
||||
</p>
|
||||
<p>The rate limiting can be applied to all messages, or group them according to
|
||||
their <code>msg.topic</code> value. When grouping, intermerdiate messages are
|
||||
automatically dropped. At each time interval, the node can either release
|
||||
the most recent message for all topics, or release the most recent message
|
||||
for the next topic.
|
||||
</p>
|
||||
</script>
|
||||
45
packages/node_modules/@node-red/nodes/locales/en-US/function/89-trigger.html
vendored
Normal file
45
packages/node_modules/@node-red/nodes/locales/en-US/function/89-trigger.html
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="trigger">
|
||||
<p>When triggered, can send a message, and then optionally a second message, unless extended or reset.</p>
|
||||
|
||||
<h3>Inputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt class="optional">reset</dt>
|
||||
<dd>If a message is received with this property, any timeout or repeat
|
||||
currently in progress will be cleared and no message triggered.</dd>
|
||||
</dl>
|
||||
|
||||
<h3>Details</h3>
|
||||
<p>This node can be used to create a timeout within a flow. By default, when
|
||||
it receives a message, it sends on a message with a <code>payload</code> of <code>1</code>.
|
||||
It then waits 250ms before sending a second message with a <code>payload</code> of <code>0</code>.
|
||||
This could be used, for example, to blink an LED attached to a Raspberry Pi GPIO pin.</p>
|
||||
<p>The payloads of each message sent can be configured to a variety of values, including
|
||||
the option to not send anything. For example, setting the initial message to <i>nothing</i> and
|
||||
selecting the option to extend the timer with each received message, the node will
|
||||
act as a watchdog timer; only sending a message if nothing is received within the
|
||||
set interval.</p>
|
||||
<p>If set to a <i>string</i> type, the node supports the mustache template syntax.</p>
|
||||
<p>If the node receives a message with a <code>reset</code> property, or a <code>payload</code>
|
||||
that matches that configured in the node, any timeout or repeat currently in
|
||||
progress will be cleared and no message triggered.</p>
|
||||
<p>The node can be configured to resend a message at a regular interval until it
|
||||
is reset by a received message.</p>
|
||||
<p>Optionally, the node can be configured to treat messages with <code>msg.topic</code> as if they
|
||||
are separate streams.</p>
|
||||
</script>
|
||||
83
packages/node_modules/@node-red/nodes/locales/en-US/function/90-exec.html
vendored
Normal file
83
packages/node_modules/@node-red/nodes/locales/en-US/function/90-exec.html
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<!--
|
||||
Copyright JS Foundation and other contributors, http://js.foundation
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<script type="text/x-red" data-help-name="exec">
|
||||
<p>Runs a system command and returns its output.</p>
|
||||
<p>The node can be configured to either wait until the command completes, or to
|
||||
send its output as the command generates it.</p>
|
||||
<p>The command that is run can be configured in the node or provided by the received
|
||||
message.</p>
|
||||
|
||||
<h3>Inputs</h3>
|
||||
<dl class="message-properties">
|
||||
<dt class="optional">payload <span class="property-type">string</span></dt>
|
||||
<dd>if configured to do so, will be appended to the executed command.</dd>
|
||||
<dt class="optional">kill <span class="property-type">string</span></dt>
|
||||
<dd>the type of kill signal to send an existing exec node process.</dd>
|
||||
<dt class="optional">pid <span class="property-type">number|string</span></dt>
|
||||
<dd>the process ID of an existing exec node process to kill.</dd>
|
||||
</dl>
|
||||
|
||||
<h3>Outputs</h3>
|
||||
<ol class="node-ports">
|
||||
<li>Standard output
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">string</span></dt>
|
||||
<dd>the standard output of the command.</dd>
|
||||
</dl>
|
||||
<dl class="message-properties">
|
||||
<dt>rc <span class="property-type">object</span></dt>
|
||||
<dd>exec mode only, a copy of the return code object (also available on port 3)</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li>Standard error
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">string</span></dt>
|
||||
<dd>the standard error of the command.</dd>
|
||||
</dl>
|
||||
<dl class="message-properties">
|
||||
<dt>rc <span class="property-type">object</span></dt>
|
||||
<dd>exec mode only, a copy of the return code object (also available on port 3)</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li>Return code
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">object</span></dt>
|
||||
<dd>an object containing the return code, and possibly <code>message</code>, <code>signal</code> properties.</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ol>
|
||||
<h3>Details</h3>
|
||||
<p>By default uses the <code>exec</code> system call which calls the command, waits for it to complete, and then
|
||||
returns the output. For example a successful command should have a return code of <code>{ code: 0 }</code>.</p>
|
||||
<p>Optionally can use <code>spawn</code> instead, which returns the output from stdout and stderr
|
||||
as the command runs, usually one line at a time. On completion it then returns an object
|
||||
on the 3rd port. For example, a successful command should return <code>{ code: 0 }</code>.</p>
|
||||
<p>Errors may return extra information on the 3rd port <code>msg.payload</code>, such as a <code>message</code> string,
|
||||
<code>signal</code> string.</p>
|
||||
<p>The command that is run is defined within the node, with an option to append <code>msg.payload</code> and a further set of parameters.</p>
|
||||
<p>Commands or parameters with spaces should be enclosed in quotes - <code>"This is a single parameter"</code></p>
|
||||
<p>The returned <code>payload</code> is usually a <i>string</i>, unless non-UTF8 characters are detected, in which
|
||||
case it is a <i>buffer</i>.</p>
|
||||
<p>The node's status icon and PID will be visible while the node is active. Changes to this can be read by the <code>Status</code> node.</p>
|
||||
<h4>Killing processes</h4>
|
||||
<p>Sending <code>msg.kill</code> will kill a single active process. <code>msg.kill</code> should be a string containing
|
||||
the type of signal to be sent, for example, <code>SIGINT</code>, <code>SIGQUIT</code> or <code>SIGHUP</code>.
|
||||
Defaults to <code>SIGTERM</code> if set to an empty string.</p>
|
||||
<p>If the node has more than one process running then <code>msg.pid</code> must also be set with the value of the PID to be killed.</p>
|
||||
<p>If a value is provided in the <code>Timeout</code> field then, if the process has not completed when the specified number of seconds has elapsed, the process will be killed automatically</p>
|
||||
<p>Tip: if running a Python app you may need to use the <code>-u</code> parameter to stop the output being buffered.</p>
|
||||
</script>
|
||||
Reference in New Issue
Block a user