Reorganise nodes into new categories

This commit is contained in:
Nick O'Leary
2019-07-09 23:32:22 +01:00
parent 2b66723d42
commit da6db24f9e
148 changed files with 36 additions and 37 deletions

View 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="function">
<p>受信メッセージに対して処理を行うJavaScriptコード(関数の本体)を定義します</p>
<p>入力メッセージは<code>msg</code>JavaScript</p>
<p><code>msg</code><code>msg.payload</code></p>
<p>通常コードはメッセージオブジェクト(もしくは複数のメッセージオブジェクト)を返却します後続フローの実行を停止したい場合はオブジェクトを返却しなくてもかまいません</p>
<h3>詳細</h3>
<p>コードの書き方の詳細については<a target="_blank" href="http://nodered.org/docs/writing-functions.html">オンラインドキュメント</a></p>
<h4>メッセージの送信</h4>
<p>フロー内の次ノードにメッセージを渡すためにはメッセージを返却するか<code>node.send(messages)</code></p>
<p>返却/sendの対象は次のとおりです:</p>
<ul>
<li>単一メッセージオブジェクト - 最初の出力に接続されたノードに渡されます</li>
<li>メッセージオブジェクトの配列 - 対応する出力に接続されたノードに渡されます</li>
</ul>
<p>配列要素が配列の場合には複数のメッセージを対応する出力に送出します</p>
<p>返却方法が単一値か配列要素かにかかわらず返却値がnullの場合メッセージの送出は行いません</p>
<h4>ログ出力とエラー処理</h4>
<p>ログ情報の出力エラー出力を行うには以下の関数を用います:</p>
<ul>
<li><code>node.log("ログメッセージ")</code></li>
<li><code>node.warn("警告")</code></li>
<li><code>node.error("エラー")</code></li>
</ul>
</p>
<p>catchードを用いてエラー処理が可能ですcatchードで処理させるためには<code>msg</code><code>node.error</code>:</p>
<pre>node.error("エラー",msg);</pre>
<h4>ノード情報の参照</h4>
<p>コード中ではードのIDおよび名前を以下のプロパティで参照できます:</p>
<ul>
<li><code>node.id</code> - ID</li>
<li><code>node.name</code> - </li>
</ul>
<h4>環境変数の利用</h4>
<p>環境変数は<code>env.get("MY_ENV_VAR")</code></p>
</script>

View 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="switch">
<p>プロパティの値によってメッセージの振り分けを行います</p>
<h3>詳細</h3>
<p>受信したメッセージに対し指定されたルールを順に評価しマッチしたルールに対応する出力ポートにメッセージを送出します</p>
<p>最初にルールがマッチしたところで評価を止めることも可能です</p>
<p>評価ルールにはメッセージプロパティフローコンテキスト/グローバルコンテキストのプロパティ環境変数JSONata式の評価結果が利用できます</p>
<h4>ルール</h4>
<p>振り分けルールは以下の4つに分類されます</p>
<ol>
<li><b>(value)</b> - </li>
<li><b>(sequence)</b> - (split)</li>
<li><b>JSONata式</b> - </li>
<li><b>その他</b> - </li>
</ol>
<h4>注釈</h4>
<p><code>is true/false</code><code>is null</code></p>
<p><code>is empty</code><code>null</code><code>undefined</code></p>
<h4>メッセージ列の扱い</h4>
<p>switchードは入力メッセージの列に関する情報を保持する<code>msg.parts</code></p>
<p><b>メッセージ列の補正</b>switch<b>settings.js</b><code>nodeMessageBufferMaxLength</code></p>
</script>

View File

@@ -0,0 +1,33 @@
<!--
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>メッセージフローコンテキストグローバルコンテキストのプロパティを変更削除移動します</p>
<p>ルールを複数指定した場合定義した順に適用します</p>
<h3>詳細</h3>
<p>利用可能な処理</p>
<dl class="message-properties">
<dt>代入</dt>
<dd>プロパティをセットします設定値にはさまざまな型の値メッセージやコンテキストの既存プロパティを利用できます<dd>
<dt>置換</dt>
<dd>プロパティに対して検索と置換を行います正規表現を指定した場合置換後の文字列には<code>$1</code></dd>
<dt>削除</dt>
<dd>プロパティを削除します</dd>
<dt>移動</dt>
<dd>プロパティの移動または名前の変更を行います</dd>
</dl>
<p>JSONata式には<a href="http://jsonata.org/" target="_new">JSONata</a></p>
</script>

View File

@@ -0,0 +1,33 @@
<!--
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>数値を異なる範囲の値に変換します</p>
<h3>入力</h3>
<dl class="message-properties">
<dt>payload<span class="property-type">数値</span></dt>
<dd>数値を指定します数値以外を指定した場合は数値に変換します変換不能な場合はエラーとなります</dd>
</dl>
<h3>出力</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">数値</span></dt>
<dd>新しい範囲に変換した結果の値</dd>
</dl>
<h3>詳細</h3>
<p>このノードは受け取った数値を線形スケーリングしますデフォルトでは結果の値はノードに設定した範囲内に限定しません</p>
<p><i>入力値の範囲外の値を最小値/最大値として拡大/縮小</i></p>
<p><i>入力値の範囲外の値を範囲幅で割った余りとし拡大/縮小</i></p>
</script>

View File

@@ -0,0 +1,49 @@
<!--
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>テンプレートに基づいてプロパティを設定します</p>
<h3>入力</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">オブジェクト</span></dt>
<dd>テンプレートを生成するための情報を含むメッセージオブジェクト</dd>
<dt class="optional">template <span class="property-type">文字列</span></dt>
<dd><code>msg.payload</code></dd>
</dl>
<h3>出力</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">オブジェクト</span></dt>
<dd>指定したテンプレートと入力メッセージのプロパティから生成した値を設定したメッセージ</dd>
</dl>
<h3>詳細</h3>
<p>このノードは<i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>形式をデフォルトで利用しますが使用しないようにすることもできます</p>
<p>例えば
<pre>こんにちは{{payload.name}}さん今日は{{date}}です</pre>
<p>というテンプレートに対して
<pre>{
date: "月曜日"
payload: {
name: "山田",
}
}</pre>
<p>というメッセージを受信した場合</p>
<pre>こんにちは山田さん今日は月曜日です</pre>
<p>というプロパティが生成されます</p>
<p>フローコンテキストもしくはグローバルコンテキストのプロパティ値を使うこともできますそれぞれ<code>{{flow.名前}}</code><code>{{global.}}</code>(<code>store</code>)<code>{{flow[store].}}</code>
<code>{{global[store].名前}}</code>
</p>
<p><b>: </b>デフォルトでは、<i>mustache</i>形式は置換対象のHTML要素をエスケープしますこれを抑止するには<code>{{{三重}}}</code>使</p>
</script>

View File

@@ -0,0 +1,32 @@
<!--
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>ノードを通過するメッセージを遅延もしくは流量を制限します</p>
<h3>入力</h3>
<dl class="message-properties">
<dt class="optional">delay <span class="property-type">数値</span></dt>
<dd>メッセージの遅延時間をミリ秒単位で設定しますこれはノードの設定でデフォルトの遅延時間を上書きできるようノードを設定した場合にのみ適用します</dd>
<dt class="optional">reset</dt>
<dd>受信メッセージでこのプロパティを任意の値に設定するとノードが保持する全ての未送信メッセージをクリアします</dd>
<dt class="optional">flush</dt>
<dd>受信メッセージでこのプロパティを任意の値に設定するとノードが保持する全ての未送信メッセージを直ちに送信します</dd>
</dl>
<h3>詳細</h3>
<p>メッセージを遅延させるように設定する場合遅延時間は固定値範囲内の乱数値メッセージ毎の動的な指定値のいずれかを指定できます</p>
<p>流量制御する場合メッセージは指定した時間間隔内に分散して送信しますキューに残っているメッセージ数はノードのステータスに表示されます受け取った中間メッセージを破棄することも可能です</p>
<p>流量制御は全てのメッセージに適用することも<code>msg.topic</code></p>
</script>

View File

@@ -0,0 +1,33 @@
<!--
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>メッセージを受信すると別のメッセージの送信を行います延長もしくは初期化が指定されていない場合には2つ目のメッセージを送信することもできます</p>
<h3>入力</h3>
<dl class="message-properties">
<dt class="optional">reset</dt>
<dd>このプロパティを持つメッセージを受け取ると仕掛かり中の待機や繰り返しをクリアしメッセージの送信は行いません</dd>
</dl>
<h3>詳細</h3>
<p>フロー内でタイムアウトを作成するのに利用しますメッセージを受け取るとデフォルトでは<code>payload</code><code>1</code>250ms<code>payload</code><code>0</code>2Raspberry PiGPIOLED</p>
<p>各送信メッセージのペイロードはさまざまな種類の値に設定できます再送信データなしとすることも可能です例えば再送信データを<i>なし</i>trigger</p>
<p>ペイロードに<i>文字列</i>mustache</p>
<p><code>reset</code><code>payload</code></p>
<p>受信メッセージでリセットするまで一定間隔でメッセージを再送するように指定することもできます</p>
<p><code>msg.topic</code></p>
</script>

View File

@@ -0,0 +1,74 @@
<!--
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>システムのコマンドを実行し出力を返します</p>
<p>コマンドの完了まで待つかコマンドが出力を行う毎にメッセージを出力するかを指定できます</p>
<p>実行対象のコマンドはノードの設定もしくは受信メッセージで指定します</p>
<h3>入力</h3>
<dl class="message-properties">
<dt class="optional">payload <span class="property-type">文字列</span></dt>
<dd>実行コマンドの最後に追加するよう設定できます</dd>
<dt class="optional">kill <span class="property-type">文字列</span></dt>
<dd>execードのプロセスに対して送るシグナルの種別を指定します</dd>
<dt class="optional">pid <span class="property-type">数値|文字列</span></dt>
<dd>シグナル送信対象のexecードのプロセスIDを指定します</dd>
</dl>
<h3>出力</h3>
<ol class="node-ports">
<li>標準出力(stdout)
<dl class="message-properties">
<dt>payload <span class="property-type">文字列</span></dt>
<dd>コマンドの標準出力</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">オブジェクト</span></dt>
<dd>返却コードオブジェクト(3番目の端子でも受取り可能)のコピー(execモードのみ)</dd>
</dl>
</li>
<li>標準エラー出力(stderr)
<dl class="message-properties">
<dt>payload <span class="property-type">文字列</span></dt>
<dd>コマンドの標準エラー出力</dd>
</dl>
<dl class="message-properties">
<dt>rc <span class="property-type">オブジェクト</span></dt>
<dd>返却コードオブジェクト(3番目の端子でも受取り可能)のコピー(execモードのみ)</dd>
</dl>
</li>
<li>返却コード(return code)
<dl class="message-properties">
<dt>payload <span class="property-type">オブジェクト</span></dt>
<dd>リターンコード<code>message</code><code>signal</code>(<code>message</code><code>signal</code>)</dd>
</dl>
</li>
</ol>
<h3>詳細</h3>
<p>デフォルトでは<code>exec</code><code>{ code: 0 }</code></p>
<p><code>spawn</code>使13<code>{ code: 0 }</code></p>
<p>エラー発生時には3番目の端子の<code>msg.payload</code><code>message</code><code>signal</code></p>
<p>実行対象のコマンドはノード設定で定義します<code>msg.payload</code></p>
<p>コマンドもしくはパラメータが空白を含む場合には引用符で囲みます- <code>"これは一つのパラメータです"</code></p>
<p>返却する<code>payload</code>は通常<i>文字列</i>ですがUTF8文字以外が存在すると<i>バッファ</i></p>
<p>ノードが実行中の場合ステータスアイコンとPIDを表示しますこの状態変化は<code>Status</code></p>
<h4>プロセスの停止</h4>
<p><code>msg.kill</code><code>msg.kill</code><code>SIGINT</code><code>SIGQUIT</code><code>SIGHUP</code><code>SIGTERM</code></p>
<p>ードが1つ以上のプロセスを実行している場合<code>msg.pid</code>PID</p>
<p><code>タイムアウト</code></p>
<p>ヒント: Pythonアプリケーションを実行する場合<code>-u</code></p>
</script>