mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
2 Commits
subflow-st
...
filein-clo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c4e782c60 | ||
|
|
c8b8beda6a |
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,25 +1,3 @@
|
||||
#### 1.0.3: Maintenance Release
|
||||
|
||||
Runtime
|
||||
- Increase timeouts in Subflow tests to minimise false positives
|
||||
- Update grunt-sass and add node-sass for node12 support
|
||||
- Fix timings of Delay node tests
|
||||
- #2340 Update JSONata to 1.7.0
|
||||
- Bump https-proxy-agent version
|
||||
- #2332 Fix error handling of nodes with multiple input handlers
|
||||
- Add script to generate npm publish script
|
||||
|
||||
Editor
|
||||
- #2328 Fix language handling in subflow node
|
||||
- Use default language if lng param not set in i18n req
|
||||
- #2326 Fix palette editor search visualization
|
||||
|
||||
Nodes
|
||||
- Delay: Fix delay to not pass through .reset and .flush props consistently
|
||||
- #2352 File: Using the ‘a msg per line’ the last line does not get msg.topic passed
|
||||
- #2339 HTTP Request: Check auth type on opening
|
||||
- HTTP Request: add units info
|
||||
|
||||
#### 1.0.2: Maintenance Release
|
||||
|
||||
Runtime
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-api",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,8 +16,8 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "1.0.3",
|
||||
"@node-red/editor-client": "1.0.3",
|
||||
"@node-red/util": "1.0.2",
|
||||
"@node-red/editor-client": "1.0.2",
|
||||
"bcryptjs": "2.4.3",
|
||||
"body-parser": "1.19.0",
|
||||
"clone": "2.1.2",
|
||||
|
||||
@@ -15,17 +15,6 @@
|
||||
"next": "Next",
|
||||
"clone": "Clone project",
|
||||
"cont": "Continue"
|
||||
},
|
||||
"type": {
|
||||
"string": "string",
|
||||
"number": "number",
|
||||
"boolean": "boolean",
|
||||
"array": "array",
|
||||
"buffer": "buffer",
|
||||
"object": "object",
|
||||
"jsonString": "JSON string",
|
||||
"undefined": "undefined",
|
||||
"null": "null"
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
@@ -803,14 +792,10 @@
|
||||
"copyPath": "Copy path to item",
|
||||
"expandItems": "Expand items",
|
||||
"collapseItems": "Collapse items",
|
||||
"duplicate": "Duplicate",
|
||||
"error": {
|
||||
"invalidJSON": "Invalid JSON: "
|
||||
}
|
||||
"duplicate": "Duplicate"
|
||||
},
|
||||
"markdownEditor": {
|
||||
"title": "Markdown editor",
|
||||
"expand": "Expand",
|
||||
"format": "Formatted with markdown",
|
||||
"heading1": "Heading 1",
|
||||
"heading2": "Heading 2",
|
||||
|
||||
@@ -15,17 +15,6 @@
|
||||
"next": "進む",
|
||||
"clone": "プロジェクトをクローン",
|
||||
"cont": "続ける"
|
||||
},
|
||||
"type": {
|
||||
"string": "文字列",
|
||||
"number": "数値",
|
||||
"boolean": "真偽値",
|
||||
"array": "配列",
|
||||
"buffer": "バッファ",
|
||||
"object": "オブジェクト",
|
||||
"jsonString": "JSON文字列",
|
||||
"undefined": "undefined",
|
||||
"null": "null"
|
||||
}
|
||||
},
|
||||
"workspace": {
|
||||
@@ -802,14 +791,10 @@
|
||||
"copyPath": "要素のパスをコピー",
|
||||
"expandItems": "要素を展開",
|
||||
"collapseItems": "要素を折り畳む",
|
||||
"duplicate": "複製",
|
||||
"error": {
|
||||
"invalidJSON": "不正なJSON: "
|
||||
}
|
||||
"duplicate": "複製"
|
||||
},
|
||||
"markdownEditor": {
|
||||
"title": "マークダウンエディタ",
|
||||
"expand": "拡大",
|
||||
"format": "マークダウン形式で記述",
|
||||
"heading1": "見出しレベル1",
|
||||
"heading2": "見出しレベル2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$string": {
|
||||
"args": "arg[, prettify]",
|
||||
"desc": "以下の型変換ルールを用いて、引数 *arg* を文字列へ型変換します。:\n\n - 文字列は変換しません。\n - 関数は空の文字列に変換します。\n - JSONの数値として表現できないため、無限大やNaNはエラーになります。\n - 他の値は `JSON.stringify` 関数を用いて、JSONの文字列へ変換します。`prettify`が真の場合、JSONを整形出力します。フィールドを1行毎に出力。フィールドのネスト深さによってインデントを行います。"
|
||||
"args": "arg",
|
||||
"desc": "以下の型変換ルールを用いて、引数 *arg* を文字列へ型変換します。:\n\n - 文字列は変換しません。\n - 関数は空の文字列に変換します。\n - JSONの数値として表現できないため、無限大やNaNはエラーになります。\n - 他の値は `JSON.stringify` 関数を用いて、JSONの文字列へ変換します。"
|
||||
},
|
||||
"$length": {
|
||||
"args": "str",
|
||||
@@ -185,7 +185,7 @@
|
||||
},
|
||||
"$reduce": {
|
||||
"args": "array, function [, init]",
|
||||
"desc": "配列の各要素値に関数 `function` を連続的に適用して得られる集約値を返します。 `function` の適用の際には、直前の `function` の適用結果と要素値が引数として与えられます。\n\n関数 `function` は引数を2つ取り、配列の各要素の間に配置する中置演算子のように作用しなくてはなりません。関数`function`のシグネチャは`myfunc($accumulator, $value[, $index[, $array]])`という形式でなければなりません。\n\n任意の引数 `init` には、集約時の初期値を設定します。"
|
||||
"desc": "配列の各要素値に関数 `function` を連続的に適用して得られる集約値を返します。 `function` の適用の際には、直前の `function` の適用結果と要素値が引数として与えられます。\n\n関数 `function` は引数を2つ取り、配列の各要素の間に配置する中置演算子のように作用しなくてはなりません。\n\n任意の引数 `init` には、集約時の初期値を設定します。"
|
||||
},
|
||||
"$flowContext": {
|
||||
"args": "string",
|
||||
@@ -230,37 +230,5 @@
|
||||
"$parseInteger": {
|
||||
"args": "string, picture",
|
||||
"desc": "`picture`文字列の指定に従って、`string`パラメータを整数(JSON数値)に変換します。`picture`文字列は`$formatInteger`と同じ形式です。"
|
||||
},
|
||||
"$error": {
|
||||
"args": "[str]",
|
||||
"desc": "メッセージを指定して例外を送出します。メッセージ`str`を省略した場合は`$error() function evaluated`をメッセージとします。"
|
||||
},
|
||||
"$assert": {
|
||||
"args": "arg, str",
|
||||
"desc": "`arg`が真の場合、undefinedを返します。偽の場合、`str`をメッセージとする例外を送出します。"
|
||||
},
|
||||
"$single": {
|
||||
"args": "array, function",
|
||||
"desc": "`array`の要素のうち、条件判定関数`function`を満たす(`function`に与えた場合に真偽値`true`を返す)要素が1つのみである場合、それを返します。マッチする要素が1つのみでない場合、例外を送出します。\n\n指定する関数は`function(value [, index [, array]])`というシグネチャでなければなりません。ここで、`value`は`array`の要素値、`index`は要素の添字、第三引数には配列全体を渡します。"
|
||||
},
|
||||
"$encodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "Uniform Resource Locator (URL)を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrlComponent(\"?x=test\")` => `\"%3Fx%3Dtest\"`"
|
||||
},
|
||||
"$encodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "Uniform Resource Locator (URL)要素を構成する文字を1、2、3、もしくは、4文字エスケープシーケンスのUTF-8文字エンコーディングで置換します。\n\n例: `$encodeUrl(\"https://mozilla.org/?x=шеллы\")` => `\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\"`"
|
||||
},
|
||||
"$decodeUrl": {
|
||||
"args": "str",
|
||||
"desc": "encodeUrlComponentで置換したUniform Resource Locator (URL)をデコードします。\n\n例: `$decodeUrlComponent(\"%3Fx%3Dtest\")` => `\"?x=test\"`"
|
||||
},
|
||||
"$decodeUrlComponent": {
|
||||
"args": "str",
|
||||
"desc": "encodeUrlで置換したUniform Resource Locator (URL)要素をデコードします。 \n\n例: `$decodeUrl(\"https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B\")` => `\"https://mozilla.org/?x=шеллы\"`"
|
||||
},
|
||||
"$distinct": {
|
||||
"args": "array",
|
||||
"desc": "配列`array`から重複要素を削除した配列を返します。"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/editor-client",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -39,7 +39,7 @@ RED.history = (function() {
|
||||
inverseEv = {
|
||||
t: 'replace',
|
||||
config: RED.nodes.createCompleteNodeSet(),
|
||||
changed: {},
|
||||
changed: [],
|
||||
rev: RED.nodes.version()
|
||||
};
|
||||
RED.nodes.clear();
|
||||
|
||||
@@ -845,7 +845,7 @@ RED.nodes = (function() {
|
||||
var m = /^subflow:(.+)$/.exec(newNodes[i].type);
|
||||
if (m) {
|
||||
var subflowId = m[1];
|
||||
var parent = getSubflow(activeWorkspace);
|
||||
var parent = getSubflow(newNodes[i].z || activeWorkspace);
|
||||
if (parent) {
|
||||
var err;
|
||||
if (subflowId === parent.id) {
|
||||
|
||||
@@ -218,7 +218,7 @@ RED.tabs = (function() {
|
||||
var thisTab = $(this).parent();
|
||||
var fireSelectionChanged = false;
|
||||
if (options.onselect) {
|
||||
if (evt.metaKey || evt.ctrlKey) {
|
||||
if (evt.metaKey) {
|
||||
if (thisTab.hasClass("selected")) {
|
||||
thisTab.removeClass("selected");
|
||||
if (thisTab[0] !== currentTab[0]) {
|
||||
|
||||
@@ -2484,7 +2484,7 @@ RED.editor = (function() {
|
||||
editor.toolbar = customEditTypes['_markdown'].buildToolbar(toolbarRow,editor);
|
||||
if (options.expandable !== false) {
|
||||
var expandButton = $('<button type="button" class="red-ui-button" style="float: right;"><i class="fa fa-expand"></i></button>').appendTo(editor.toolbar);
|
||||
RED.popover.tooltip(expandButton, RED._("markdownEditor.expand"));
|
||||
|
||||
expandButton.on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var value = editor.getValue();
|
||||
|
||||
@@ -207,7 +207,6 @@
|
||||
}
|
||||
expressionEditor.getSession().setValue(v||"",-1);
|
||||
});
|
||||
funcSelect.change();
|
||||
|
||||
var tabs = RED.tabs.create({
|
||||
element: $("#red-ui-editor-type-expression-tabs"),
|
||||
|
||||
@@ -302,8 +302,8 @@
|
||||
types:[
|
||||
'str','num','bool',
|
||||
{value:"null",label:"null",hasValue:false},
|
||||
{value:"array",label:RED._("common.type.array"),hasValue:false},
|
||||
{value:"object",label:RED._("common.type.object"),hasValue:false}
|
||||
{value:"array",label:"array",hasValue:false},
|
||||
{value:"object",label:"object",hasValue:false}
|
||||
],
|
||||
default: valType
|
||||
});
|
||||
@@ -577,7 +577,7 @@
|
||||
} catch(err) {
|
||||
rootNode = null;
|
||||
list.treeList('data',[{
|
||||
label: RED._("jsonEditor.error.invalidJSON")+err.toString()
|
||||
label: "Invalid JSON: "+err.toString()
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,12 @@ RED.subflow = (function() {
|
||||
var currentLocale = "en-US";
|
||||
|
||||
var _subflowEditTemplate = '<script type="text/x-red" data-template-name="subflow">'+
|
||||
'<div class="form-row">'+
|
||||
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
|
||||
'<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">'+
|
||||
'</div>'+
|
||||
'<div class="form-row"><label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label><input type="text" id="node-input-name"></div>'+
|
||||
'<div id="subflow-input-ui"></div>'+
|
||||
'</script>';
|
||||
|
||||
var _subflowTemplateEditTemplate = '<script type="text/x-red" data-template-name="subflow-template">'+
|
||||
'<div class="form-row">'+
|
||||
'<label for="subflow-input-name" data-i18n="[append]common.label.name"><i class="fa fa-tag"></i> </label>'+
|
||||
'<input type="text" id="subflow-input-name" data-i18n="[placeholder]common.label.name">'+
|
||||
'</div>'+
|
||||
'<div class="form-row"><label for="subflow-input-name" data-i18n="[append]common.label.name"><i class="fa fa-tag"></i> </label><input type="text" id="subflow-input-name"></div>'+
|
||||
'<div class="form-row">'+
|
||||
'<ul style="margin-bottom: 20px;" id="subflow-env-tabs"></ul>'+
|
||||
'</div>'+
|
||||
|
||||
@@ -164,7 +164,7 @@ RED.workspaces = (function() {
|
||||
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
|
||||
$('<div class="form-row">'+
|
||||
'<label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>'+
|
||||
'<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">'+
|
||||
'<input type="text" id="node-input-name">'+
|
||||
'</div>').appendTo(dialogForm);
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
border: 1px solid $primary-border-color;
|
||||
box-sizing: border-box;
|
||||
background: $secondary-background;
|
||||
white-space: nowrap;
|
||||
z-index: 2000;
|
||||
a {
|
||||
padding: 6px 18px 6px 6px;
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
<!-- (with the 'node-input-' prefix). -->
|
||||
<!-- The available icon classes are defined Font Awesome Icons (FA Icons) -->
|
||||
<div class="form-row">
|
||||
<label for="node-input-topic"><i class="fa fa-tasks"></i> <span data-i18n="common.label.topic"></span></label>
|
||||
<input type="text" id="node-input-topic" data-i18n="[placeholder]common.label.topic">
|
||||
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
|
||||
<input type="text" id="node-input-topic" placeholder="Topic">
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<!-- By convention, most nodes have a 'name' property. The following div -->
|
||||
<!-- provides the necessary field. Should always be the last option -->
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<script type="text/x-red" data-template-name="comment">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
<input type="text" id="node-input-name">
|
||||
</div>
|
||||
<div class="form-row node-text-editor-row">
|
||||
<input type="hidden" id="node-input-info" autofocus="autofocus">
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
},
|
||||
oneditprepare: function() {
|
||||
var node = this;
|
||||
var previousValueType = {value:"prev",label:this._("switch.previous"),hasValue:false};
|
||||
var previousValueType = {value:"prev",label:this._("inject.previous"),hasValue:false};
|
||||
|
||||
$("#node-input-property").typedInput({default:this.propertyType||'msg',types:['msg','flow','global','jsonata','env']});
|
||||
var outputCount = $("#node-input-outputs").val("{}");
|
||||
@@ -237,15 +237,15 @@
|
||||
|
||||
function createTypeValueField(){
|
||||
return $('<input/>',{class:"node-input-rule-type-value",type:"text",style:"margin-left: 5px;"}).appendTo(row).typedInput({default:'string',types:[
|
||||
{value:"string",label:RED._("common.type.string"),hasValue:false,icon:"red/images/typedInput/az.png"},
|
||||
{value:"number",label:RED._("common.type.number"),hasValue:false,icon:"red/images/typedInput/09.png"},
|
||||
{value:"boolean",label:RED._("common.type.boolean"),hasValue:false,icon:"red/images/typedInput/bool.png"},
|
||||
{value:"array",label:RED._("common.type.array"),hasValue:false,icon:"red/images/typedInput/json.png"},
|
||||
{value:"buffer",label:RED._("common.type.buffer"),hasValue:false,icon:"red/images/typedInput/bin.png"},
|
||||
{value:"object",label:RED._("common.type.object"),hasValue:false,icon:"red/images/typedInput/json.png"},
|
||||
{value:"json",label:RED._("common.type.jsonString"),hasValue:false,icon:"red/images/typedInput/json.png"},
|
||||
{value:"undefined",label:RED._("common.type.undefined"),hasValue:false},
|
||||
{value:"null",label:RED._("common.type.null"),hasValue:false}
|
||||
{value:"string",label:"string",hasValue:false},
|
||||
{value:"number",label:"number",hasValue:false},
|
||||
{value:"boolean",label:"boolean",hasValue:false},
|
||||
{value:"array",label:"array",hasValue:false},
|
||||
{value:"buffer",label:"buffer",hasValue:false},
|
||||
{value:"object",label:"object",hasValue:false},
|
||||
{value:"json",label:"JSON string",hasValue:false},
|
||||
{value:"undefined",label:"undefined",hasValue:false},
|
||||
{value:"null",label:"null",hasValue:false}
|
||||
]});
|
||||
}
|
||||
|
||||
|
||||
@@ -153,24 +153,15 @@ module.exports = function(RED) {
|
||||
}
|
||||
else if (node.pauseType === "rate") {
|
||||
node.on("input", function(msg) {
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
if (node.intervalID !== -1 ) {
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = -1;
|
||||
}
|
||||
node.buffer = [];
|
||||
node.status({text:"reset"});
|
||||
return;
|
||||
}
|
||||
if (!node.drop) {
|
||||
var m = RED.util.cloneMessage(msg);
|
||||
delete m.flush;
|
||||
if (node.intervalID !== -1) {
|
||||
node.buffer.push(m);
|
||||
node.reportDepth();
|
||||
if (!msg.hasOwnProperty("flush")) {
|
||||
node.buffer.push(msg);
|
||||
node.reportDepth();
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.send(m);
|
||||
node.send(msg);
|
||||
node.reportDepth();
|
||||
node.intervalID = setInterval(function() {
|
||||
if (node.buffer.length === 0) {
|
||||
@@ -183,12 +174,6 @@ module.exports = function(RED) {
|
||||
node.reportDepth();
|
||||
}, node.rate);
|
||||
}
|
||||
if (msg.hasOwnProperty("flush")) {
|
||||
while (node.buffer.length > 0) {
|
||||
node.send(node.buffer.shift());
|
||||
}
|
||||
node.status({});
|
||||
}
|
||||
}
|
||||
else {
|
||||
var timeSinceLast;
|
||||
@@ -204,6 +189,18 @@ module.exports = function(RED) {
|
||||
node.send(msg);
|
||||
}
|
||||
}
|
||||
if (msg.hasOwnProperty("reset")) {
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = -1;
|
||||
node.buffer = [];
|
||||
node.status({text:"reset"});
|
||||
}
|
||||
if (msg.hasOwnProperty("flush")) {
|
||||
while (node.buffer.length > 0) {
|
||||
node.send(node.buffer.shift());
|
||||
}
|
||||
node.status({});
|
||||
}
|
||||
});
|
||||
node.on("close", function() {
|
||||
clearInterval(node.intervalID);
|
||||
|
||||
@@ -285,11 +285,7 @@
|
||||
$("#node-input-property").typedInput('types',['msg']);
|
||||
$("#node-input-joiner").typedInput("show");
|
||||
} else {
|
||||
$("#node-input-property").typedInput('types', ['msg', {
|
||||
value: "full",
|
||||
label: RED._("node-red:join.completeMessage"),
|
||||
hasValue: false
|
||||
}]);
|
||||
$("#node-input-property").typedInput('types',['msg', {value:"full",label:"complete message",hasValue:false}]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -301,11 +297,7 @@
|
||||
|
||||
$("#node-input-property").typedInput({
|
||||
typeField: $("#node-input-propertyType"),
|
||||
types: ['msg', {
|
||||
value: "full",
|
||||
label: RED._("node-red:join.completeMessage"),
|
||||
hasValue: false
|
||||
}]
|
||||
types:['msg', {value:"full", label:"complete message", hasValue:false}]
|
||||
});
|
||||
|
||||
$("#node-input-key").typedInput({
|
||||
|
||||
@@ -140,8 +140,8 @@ module.exports = function(RED) {
|
||||
try {
|
||||
var stat = fs.statSync(filename);
|
||||
node.wstreamIno = stat.ino;
|
||||
} catch(err) {
|
||||
}
|
||||
}
|
||||
catch(err) { }
|
||||
});
|
||||
node.wstream.on("error", function(err) {
|
||||
node.error(RED._("file.errors.appendfail",{error:err.toString()}),msg);
|
||||
@@ -276,7 +276,6 @@ module.exports = function(RED) {
|
||||
ch = "\n";
|
||||
type = "string";
|
||||
}
|
||||
var hwm;
|
||||
var getout = false;
|
||||
|
||||
var rs = fs.createReadStream(filename)
|
||||
@@ -290,30 +289,24 @@ module.exports = function(RED) {
|
||||
spare += decode(chunk, node.encoding);
|
||||
var bits = spare.split("\n");
|
||||
for (var i=0; i < bits.length - 1; i++) {
|
||||
var m = {
|
||||
payload:bits[i],
|
||||
topic:msg.topic,
|
||||
filename:msg.filename,
|
||||
parts:{index:count, ch:ch, type:type, id:msg._msgid}
|
||||
}
|
||||
var sendMessage = RED.util.cloneMessage(msg);
|
||||
sendMessage.payload = bits[i];
|
||||
sendMessage.parts = {index:count, ch:ch, type:type, id:msg._msgid};
|
||||
count += 1;
|
||||
nodeSend(m);
|
||||
nodeSend(sendMessage);
|
||||
}
|
||||
spare = bits[i];
|
||||
}
|
||||
if (node.format === "stream") {
|
||||
var m = {
|
||||
payload:chunk,
|
||||
topic:msg.topic,
|
||||
filename:msg.filename,
|
||||
parts:{index:count, ch:ch, type:type, id:msg._msgid}
|
||||
}
|
||||
var sendMessage = RED.util.cloneMessage(msg);
|
||||
sendMessage.payload = chunk;
|
||||
sendMessage.parts = {index:count, ch:ch, type:type, id:msg._msgid};
|
||||
count += 1;
|
||||
if (chunk.length < hwm) { // last chunk is smaller that high water mark = eof
|
||||
getout = false;
|
||||
m.parts.count = count;
|
||||
sendMessage.parts.count = count;
|
||||
}
|
||||
nodeSend(m);
|
||||
nodeSend(sendMessage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -332,29 +325,23 @@ module.exports = function(RED) {
|
||||
nodeDone();
|
||||
})
|
||||
.on('end', function() {
|
||||
var sendMessage = RED.util.cloneMessage(msg);
|
||||
if (node.chunk === false) {
|
||||
if (node.format === "utf8") {
|
||||
msg.payload = decode(lines, node.encoding);
|
||||
sendMessage.payload = decode(lines, node.encoding);
|
||||
}
|
||||
else { msg.payload = lines; }
|
||||
nodeSend(msg);
|
||||
else { sendMessage.payload = lines; }
|
||||
nodeSend(sendMessage);
|
||||
}
|
||||
else if (node.format === "lines") {
|
||||
var m = { payload: spare,
|
||||
topic:msg.topic,
|
||||
parts: {
|
||||
index: count,
|
||||
count: count+1,
|
||||
ch: ch,
|
||||
type: type,
|
||||
id: msg._msgid
|
||||
}
|
||||
};
|
||||
nodeSend(m);
|
||||
sendMessage.payload = spare;
|
||||
sendMessage.parts = { index:count, count:count+1, ch:ch, type:type, id:msg._msgid };
|
||||
nodeSend(sendMessage);
|
||||
}
|
||||
else if (getout) { // last chunk same size as high water mark - have to send empty extra packet.
|
||||
var m = { parts:{index:count, count:count, ch:ch, type:type, id:msg._msgid} };
|
||||
nodeSend(m);
|
||||
delete sendMessage.payload;
|
||||
sendMessage.parts = { parts:{index:count, count:count, ch:ch, type:type, id:msg._msgid} };
|
||||
nodeSend(sendMessage);
|
||||
}
|
||||
nodeDone();
|
||||
});
|
||||
|
||||
@@ -604,34 +604,33 @@
|
||||
"label": {
|
||||
"property": "Property",
|
||||
"rule": "rule",
|
||||
"repair": "recreate message sequences"
|
||||
"repair" : "recreate message sequences"
|
||||
},
|
||||
"previous": "previous value",
|
||||
"and": "and",
|
||||
"checkall": "checking all rules",
|
||||
"stopfirst": "stopping after first match",
|
||||
"ignorecase": "ignore case",
|
||||
"rules": {
|
||||
"btwn": "is between",
|
||||
"cont": "contains",
|
||||
"regex": "matches regex",
|
||||
"true": "is true",
|
||||
"false": "is false",
|
||||
"null": "is null",
|
||||
"nnull": "is not null",
|
||||
"istype": "is of type",
|
||||
"empty": "is empty",
|
||||
"nempty": "is not empty",
|
||||
"head": "head",
|
||||
"tail": "tail",
|
||||
"index": "index between",
|
||||
"exp": "JSONata exp",
|
||||
"else": "otherwise",
|
||||
"hask": "has key"
|
||||
"btwn":"is between",
|
||||
"cont":"contains",
|
||||
"regex":"matches regex",
|
||||
"true":"is true",
|
||||
"false":"is false",
|
||||
"null":"is null",
|
||||
"nnull":"is not null",
|
||||
"istype":"is of type",
|
||||
"empty":"is empty",
|
||||
"nempty":"is not empty",
|
||||
"head":"head",
|
||||
"tail":"tail",
|
||||
"index":"index between",
|
||||
"exp":"JSONata exp",
|
||||
"else":"otherwise",
|
||||
"hask":"has key"
|
||||
},
|
||||
"errors": {
|
||||
"invalid-expr": "Invalid JSONata expression: __error__",
|
||||
"too-many": "too many pending messages in switch node"
|
||||
"too-many" : "too many pending messages in switch node"
|
||||
}
|
||||
},
|
||||
"change": {
|
||||
@@ -849,42 +848,41 @@
|
||||
"stream":"Handle as a stream of messages",
|
||||
"addname":" Copy key to "
|
||||
},
|
||||
"join": {
|
||||
"join":{
|
||||
"join": "join",
|
||||
"mode": {
|
||||
"mode": "Mode",
|
||||
"auto": "automatic",
|
||||
"merge": "merge sequences",
|
||||
"reduce": "reduce sequence",
|
||||
"custom": "manual"
|
||||
"mode":{
|
||||
"mode":"Mode",
|
||||
"auto":"automatic",
|
||||
"merge":"merge sequences",
|
||||
"reduce":"reduce sequence",
|
||||
"custom":"manual"
|
||||
},
|
||||
"combine": "Combine each",
|
||||
"completeMessage": "complete message",
|
||||
"create": "to create",
|
||||
"type": {
|
||||
"string": "a String",
|
||||
"array": "an Array",
|
||||
"buffer": "a Buffer",
|
||||
"object": "a key/value Object",
|
||||
"merged": "a merged Object"
|
||||
"combine":"Combine each",
|
||||
"create":"to create",
|
||||
"type":{
|
||||
"string":"a String",
|
||||
"array":"an Array",
|
||||
"buffer":"a Buffer",
|
||||
"object":"a key/value Object",
|
||||
"merged":"a merged Object"
|
||||
},
|
||||
"using": "using the value of",
|
||||
"key": "as the key",
|
||||
"joinedUsing": "joined using",
|
||||
"send": "Send the message:",
|
||||
"afterCount": "After a number of message parts",
|
||||
"count": "count",
|
||||
"subsequent": "and every subsequent message.",
|
||||
"afterTimeout": "After a timeout following the first message",
|
||||
"seconds": "seconds",
|
||||
"complete": "After a message with the <code>msg.complete</code> property set",
|
||||
"tip": "This mode assumes this node is either paired with a <i>split</i> node or the received messages will have a properly configured <code>msg.parts</code> property.",
|
||||
"too-many": "too many pending messages in join node",
|
||||
"using":"using the value of",
|
||||
"key":"as the key",
|
||||
"joinedUsing":"joined using",
|
||||
"send":"Send the message:",
|
||||
"afterCount":"After a number of message parts",
|
||||
"count":"count",
|
||||
"subsequent":"and every subsequent message.",
|
||||
"afterTimeout":"After a timeout following the first message",
|
||||
"seconds":"seconds",
|
||||
"complete":"After a message with the <code>msg.complete</code> property set",
|
||||
"tip":"This mode assumes this node is either paired with a <i>split</i> node or the received messages will have a properly configured <code>msg.parts</code> property.",
|
||||
"too-many" : "too many pending messages in join node",
|
||||
"merge": {
|
||||
"topics-label": "Merged Topics",
|
||||
"topics": "topics",
|
||||
"topic": "topic",
|
||||
"on-change": "Send merged message on arrival of a new topic"
|
||||
"topics-label":"Merged Topics",
|
||||
"topics":"topics",
|
||||
"topic" : "topic",
|
||||
"on-change":"Send merged message on arrival of a new topic"
|
||||
},
|
||||
"reduce": {
|
||||
"exp": "Reduce exp",
|
||||
|
||||
@@ -604,7 +604,6 @@
|
||||
"rule": "条件",
|
||||
"repair": "メッセージ列の補正"
|
||||
},
|
||||
"previous": "前回の値",
|
||||
"and": "~",
|
||||
"checkall": "全ての条件を適用",
|
||||
"stopfirst": "最初に合致した条件で終了",
|
||||
@@ -857,7 +856,6 @@
|
||||
"custom": "手動"
|
||||
},
|
||||
"combine": "結合",
|
||||
"completeMessage": "メッセージ全体",
|
||||
"create": "出力",
|
||||
"type": {
|
||||
"string": "文字列",
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<p>「<i>合計値</i>」には出力メッセージを送信する前に受信すべきメッセージ数を指定します。オブジェクト出力の場合、この合計値に達すると後続メッセージの到着毎にメッセージを出力するように設定することもできます。</p>
|
||||
<p>「<i>秒</i>」には新規メッセージを送信するまでの経過時間を設定します。</p>
|
||||
<p><code>msg.complete</code>プロパティを設定したメッセージを受信すると、出力メッセージを送信します。この時、メッセージ列の数をリセットします。</p>
|
||||
<p><code>msg.reset</code>プロパティを設定したメッセージを受信すると、部分的に受信済みのメッセージを破棄します。これらのメッセージは送信されません。この時、メッセージ列の数をリセットします。</p>
|
||||
<p><code>msg.reset</code>プロパティを設定したメッセージを受診すると、部分的に受信済みのメッセージを破棄します。これらのメッセージは送信されません。この時、メッセージ列の数をリセットします。</p>
|
||||
|
||||
<h4>列の集約モード</h4>
|
||||
<p>列の集約モードを選択すると、メッセージ列を構成する各々のメッセージに対して式を適用し、集約した値を用いて一つのメッセージを構成します。</p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/nodes",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/registry",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/util": "1.0.3",
|
||||
"@node-red/util": "1.0.2",
|
||||
"semver": "6.3.0",
|
||||
"uglify-js": "3.6.0",
|
||||
"when": "3.7.8"
|
||||
|
||||
@@ -200,9 +200,6 @@ class Subflow extends Flow {
|
||||
self.node.status({text:text});
|
||||
} else if (msg.status !== undefined) {
|
||||
// if msg.status exists
|
||||
if (msg.status.hasOwnProperty("text") && msg.status.text.indexOf("common.") === 0) {
|
||||
msg.status.text = "node-red:"+msg.status.text;
|
||||
}
|
||||
self.node.status(msg.status)
|
||||
}
|
||||
})
|
||||
@@ -313,6 +310,7 @@ class Subflow extends Flow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.start(diff);
|
||||
}
|
||||
|
||||
@@ -437,6 +435,7 @@ class Subflow extends Flow {
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/runtime",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/index.js",
|
||||
"repository": {
|
||||
@@ -16,8 +16,8 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/registry": "1.0.3",
|
||||
"@node-red/util": "1.0.3",
|
||||
"@node-red/registry": "1.0.2",
|
||||
"@node-red/util": "1.0.2",
|
||||
"clone": "2.1.2",
|
||||
"express": "4.17.1",
|
||||
"fs-extra": "8.1.0",
|
||||
|
||||
@@ -84,14 +84,9 @@ var consoleLogger = function(msg) {
|
||||
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+msg.msg.stack);
|
||||
} else {
|
||||
var message = msg.msg;
|
||||
try {
|
||||
if (typeof message === 'object' && message !== null && message.toString() === '[object Object]' && message.message) {
|
||||
message = message.message;
|
||||
}
|
||||
} catch(e){
|
||||
message = 'Exception trying to log: '+util.inspect(message);
|
||||
if (typeof message === 'object' && message !== null && message.toString() === '[object Object]' && message.message) {
|
||||
message = message.message;
|
||||
}
|
||||
|
||||
util.log("["+levelNames[msg.level]+"] "+(msg.type?"["+msg.type+":"+(msg.name||msg.id)+"] ":"")+message);
|
||||
}
|
||||
}
|
||||
|
||||
252
packages/node_modules/@node-red/util/lib/util.js
vendored
252
packages/node_modules/@node-red/util/lib/util.js
vendored
@@ -652,148 +652,130 @@ function normaliseNodeTypeName(name) {
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
function encodeObject(msg,opts) {
|
||||
try {
|
||||
var debuglength = 1000;
|
||||
if (opts && opts.hasOwnProperty('maxLength')) {
|
||||
debuglength = opts.maxLength;
|
||||
}
|
||||
var msgType = typeof msg.msg;
|
||||
if (msg.msg instanceof Error) {
|
||||
msg.format = "error";
|
||||
var errorMsg = {};
|
||||
if (msg.msg.name) {
|
||||
errorMsg.name = msg.msg.name;
|
||||
}
|
||||
if (msg.msg.hasOwnProperty('message')) {
|
||||
errorMsg.message = msg.msg.message;
|
||||
} else {
|
||||
errorMsg.message = msg.msg.toString();
|
||||
}
|
||||
msg.msg = JSON.stringify(errorMsg);
|
||||
} else if (msg.msg instanceof Buffer) {
|
||||
msg.format = "buffer["+msg.msg.length+"]";
|
||||
msg.msg = msg.msg.toString('hex');
|
||||
if (msg.msg.length > debuglength) {
|
||||
msg.msg = msg.msg.substring(0,debuglength);
|
||||
}
|
||||
} else if (msg.msg && msgType === 'object') {
|
||||
try {
|
||||
msg.format = msg.msg.constructor.name || "Object";
|
||||
// Handle special case of msg.req/res objects from HTTP In node
|
||||
if (msg.format === "IncomingMessage" || msg.format === "ServerResponse") {
|
||||
msg.format = "Object";
|
||||
}
|
||||
} catch(err) {
|
||||
msg.format = "Object";
|
||||
}
|
||||
if (/error/i.test(msg.format)) {
|
||||
msg.msg = JSON.stringify({
|
||||
name: msg.msg.name,
|
||||
message: msg.msg.message
|
||||
});
|
||||
} else {
|
||||
var isArray = util.isArray(msg.msg);
|
||||
if (isArray) {
|
||||
msg.format = "array["+msg.msg.length+"]";
|
||||
if (msg.msg.length > debuglength) {
|
||||
// msg.msg = msg.msg.slice(0,debuglength);
|
||||
msg.msg = {
|
||||
__enc__: true,
|
||||
type: "array",
|
||||
data: msg.msg.slice(0,debuglength),
|
||||
length: msg.msg.length
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isArray || (msg.format === "Object")) {
|
||||
msg.msg = safeJSONStringify(msg.msg, function(key, value) {
|
||||
if (key === '_req' || key === '_res') {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "internal"
|
||||
}
|
||||
} else if (value instanceof Error) {
|
||||
value = value.toString()
|
||||
} else if (util.isArray(value) && value.length > debuglength) {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "array",
|
||||
data: value.slice(0,debuglength),
|
||||
length: value.length
|
||||
}
|
||||
} else if (typeof value === 'string') {
|
||||
if (value.length > debuglength) {
|
||||
value = value.substring(0,debuglength)+"...";
|
||||
}
|
||||
} else if (typeof value === 'function') {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "function"
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
if (isNaN(value) || value === Infinity || value === -Infinity) {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "number",
|
||||
data: value.toString()
|
||||
}
|
||||
}
|
||||
} else if (value && value.constructor) {
|
||||
if (value.type === "Buffer") {
|
||||
value.__enc__ = true;
|
||||
value.length = value.data.length;
|
||||
if (value.length > debuglength) {
|
||||
value.data = value.data.slice(0,debuglength);
|
||||
}
|
||||
} else if (value.constructor.name === "ServerResponse") {
|
||||
value = "[internal]"
|
||||
} else if (value.constructor.name === "Socket") {
|
||||
value = "[internal]"
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}," ");
|
||||
} else {
|
||||
try { msg.msg = msg.msg.toString(); }
|
||||
catch(e) { msg.msg = "[Type not printable]" + util.inspect(msg.msg); }
|
||||
}
|
||||
}
|
||||
} else if (msgType === "function") {
|
||||
msg.format = "function";
|
||||
msg.msg = "[function]"
|
||||
} else if (msgType === "boolean") {
|
||||
msg.format = "boolean";
|
||||
msg.msg = msg.msg.toString();
|
||||
} else if (msgType === "number") {
|
||||
msg.format = "number";
|
||||
msg.msg = msg.msg.toString();
|
||||
} else if (msg.msg === null || msgType === "undefined") {
|
||||
msg.format = (msg.msg === null)?"null":"undefined";
|
||||
msg.msg = "(undefined)";
|
||||
} else {
|
||||
msg.format = "string["+msg.msg.length+"]";
|
||||
if (msg.msg.length > debuglength) {
|
||||
msg.msg = msg.msg.substring(0,debuglength)+"...";
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
} catch(e) {
|
||||
var debuglength = 1000;
|
||||
if (opts && opts.hasOwnProperty('maxLength')) {
|
||||
debuglength = opts.maxLength;
|
||||
}
|
||||
var msgType = typeof msg.msg;
|
||||
if (msg.msg instanceof Error) {
|
||||
msg.format = "error";
|
||||
var errorMsg = {};
|
||||
if (e.name) {
|
||||
errorMsg.name = e.name;
|
||||
if (msg.msg.name) {
|
||||
errorMsg.name = msg.msg.name;
|
||||
}
|
||||
if (e.hasOwnProperty('message')) {
|
||||
errorMsg.message = 'encodeObject Error: ['+e.message + '] Value: '+util.inspect(msg.msg);
|
||||
if (msg.msg.hasOwnProperty('message')) {
|
||||
errorMsg.message = msg.msg.message;
|
||||
} else {
|
||||
errorMsg.message = 'encodeObject Error: ['+e.toString() + '] Value: '+util.inspect(msg.msg);
|
||||
}
|
||||
if (errorMsg.message.length > debuglength) {
|
||||
errorMsg.message = errorMsg.message.substring(0,debuglength);
|
||||
errorMsg.message = msg.msg.toString();
|
||||
}
|
||||
msg.msg = JSON.stringify(errorMsg);
|
||||
return msg;
|
||||
} else if (msg.msg instanceof Buffer) {
|
||||
msg.format = "buffer["+msg.msg.length+"]";
|
||||
msg.msg = msg.msg.toString('hex');
|
||||
if (msg.msg.length > debuglength) {
|
||||
msg.msg = msg.msg.substring(0,debuglength);
|
||||
}
|
||||
} else if (msg.msg && msgType === 'object') {
|
||||
try {
|
||||
msg.format = msg.msg.constructor.name || "Object";
|
||||
// Handle special case of msg.req/res objects from HTTP In node
|
||||
if (msg.format === "IncomingMessage" || msg.format === "ServerResponse") {
|
||||
msg.format = "Object";
|
||||
}
|
||||
} catch(err) {
|
||||
msg.format = "Object";
|
||||
}
|
||||
if (/error/i.test(msg.format)) {
|
||||
msg.msg = JSON.stringify({
|
||||
name: msg.msg.name,
|
||||
message: msg.msg.message
|
||||
});
|
||||
} else {
|
||||
var isArray = util.isArray(msg.msg);
|
||||
if (isArray) {
|
||||
msg.format = "array["+msg.msg.length+"]";
|
||||
if (msg.msg.length > debuglength) {
|
||||
// msg.msg = msg.msg.slice(0,debuglength);
|
||||
msg.msg = {
|
||||
__enc__: true,
|
||||
type: "array",
|
||||
data: msg.msg.slice(0,debuglength),
|
||||
length: msg.msg.length
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isArray || (msg.format === "Object")) {
|
||||
msg.msg = safeJSONStringify(msg.msg, function(key, value) {
|
||||
if (key === '_req' || key === '_res') {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "internal"
|
||||
}
|
||||
} else if (value instanceof Error) {
|
||||
value = value.toString()
|
||||
} else if (util.isArray(value) && value.length > debuglength) {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "array",
|
||||
data: value.slice(0,debuglength),
|
||||
length: value.length
|
||||
}
|
||||
} else if (typeof value === 'string') {
|
||||
if (value.length > debuglength) {
|
||||
value = value.substring(0,debuglength)+"...";
|
||||
}
|
||||
} else if (typeof value === 'function') {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "function"
|
||||
}
|
||||
} else if (typeof value === 'number') {
|
||||
if (isNaN(value) || value === Infinity || value === -Infinity) {
|
||||
value = {
|
||||
__enc__: true,
|
||||
type: "number",
|
||||
data: value.toString()
|
||||
}
|
||||
}
|
||||
} else if (value && value.constructor) {
|
||||
if (value.type === "Buffer") {
|
||||
value.__enc__ = true;
|
||||
value.length = value.data.length;
|
||||
if (value.length > debuglength) {
|
||||
value.data = value.data.slice(0,debuglength);
|
||||
}
|
||||
} else if (value.constructor.name === "ServerResponse") {
|
||||
value = "[internal]"
|
||||
} else if (value.constructor.name === "Socket") {
|
||||
value = "[internal]"
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}," ");
|
||||
} else {
|
||||
try { msg.msg = msg.msg.toString(); }
|
||||
catch(e) { msg.msg = "[Type not printable]"; }
|
||||
}
|
||||
}
|
||||
} else if (msgType === "function") {
|
||||
msg.format = "function";
|
||||
msg.msg = "[function]"
|
||||
} else if (msgType === "boolean") {
|
||||
msg.format = "boolean";
|
||||
msg.msg = msg.msg.toString();
|
||||
} else if (msgType === "number") {
|
||||
msg.format = "number";
|
||||
msg.msg = msg.msg.toString();
|
||||
} else if (msg.msg === null || msgType === "undefined") {
|
||||
msg.format = (msg.msg === null)?"null":"undefined";
|
||||
msg.msg = "(undefined)";
|
||||
} else {
|
||||
msg.format = "string["+msg.msg.length+"]";
|
||||
if (msg.msg.length > debuglength) {
|
||||
msg.msg = msg.msg.substring(0,debuglength)+"...";
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/util",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
10
packages/node_modules/node-red/package.json
vendored
10
packages/node_modules/node-red/package.json
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.2",
|
||||
"description": "Low-code programming for event-driven applications",
|
||||
"homepage": "http://nodered.org",
|
||||
"license": "Apache-2.0",
|
||||
@@ -31,10 +31,10 @@
|
||||
"flow"
|
||||
],
|
||||
"dependencies": {
|
||||
"@node-red/editor-api": "1.0.3",
|
||||
"@node-red/runtime": "1.0.3",
|
||||
"@node-red/util": "1.0.3",
|
||||
"@node-red/nodes": "1.0.3",
|
||||
"@node-red/editor-api": "1.0.2",
|
||||
"@node-red/runtime": "1.0.2",
|
||||
"@node-red/util": "1.0.2",
|
||||
"@node-red/nodes": "1.0.2",
|
||||
"basic-auth": "2.0.1",
|
||||
"bcryptjs": "2.4.3",
|
||||
"express": "4.17.1",
|
||||
|
||||
@@ -4,4 +4,4 @@ npm install --no-save \
|
||||
wdio-mocha-framework@^0.6.4 \
|
||||
wdio-spec-reporter@^0.1.5 \
|
||||
webdriverio@^4.14.1 \
|
||||
chromedriver@^78.0.1
|
||||
chromedriver@2
|
||||
|
||||
@@ -61,7 +61,7 @@ exports.config = {
|
||||
maxInstances: 2,
|
||||
//
|
||||
browserName: 'chrome',
|
||||
'goog:chromeOptions': {
|
||||
chromeOptions: {
|
||||
args: process.env.NODE_RED_NON_HEADLESS
|
||||
// Runs tests with opening a browser.
|
||||
? ['--disable-gpu']
|
||||
@@ -134,7 +134,7 @@ exports.config = {
|
||||
// Services take over a specific job you don't want to take care of. They enhance
|
||||
// your test setup with almost no effort. Unlike plugins, they don't add new
|
||||
// commands. Instead, they hook themselves up into the test process.
|
||||
port: 9515,
|
||||
port: '9515',
|
||||
path: '/',
|
||||
services: ['chromedriver'],
|
||||
//
|
||||
|
||||
@@ -1192,6 +1192,43 @@ describe('file Nodes', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should read in a file and output split lines with parts and preserve other properties', function(done) {
|
||||
var flow = [{id:"fileInNode1", type:"file in", name: "fileInNode", filename:fileToTest, format:"lines", wires:[["n2"]]},
|
||||
{id:"n2", type:"helper"}];
|
||||
helper.load(fileNode, flow, function() {
|
||||
var n1 = helper.getNode("fileInNode1");
|
||||
var n2 = helper.getNode("n2");
|
||||
var c = 0;
|
||||
n2.on("input", function(msg) {
|
||||
try {
|
||||
msg.should.have.property('payload');
|
||||
msg.payload.should.be.a.String();
|
||||
msg.should.have.property('topic',"dujour");
|
||||
msg.should.have.property('foo',"bar");
|
||||
msg.should.have.property('parts');
|
||||
msg.parts.should.have.property('index',c);
|
||||
msg.parts.should.have.property('type','string');
|
||||
msg.parts.should.have.property('ch','\n');
|
||||
if (c === 0) {
|
||||
msg.payload.should.equal("File message line 1");
|
||||
}
|
||||
if (c === 1) {
|
||||
msg.payload.should.equal("File message line 2");
|
||||
}
|
||||
if (c === 2) {
|
||||
msg.payload.should.equal("");
|
||||
done();
|
||||
}
|
||||
c++;
|
||||
}
|
||||
catch(e) {
|
||||
done(e);
|
||||
}
|
||||
});
|
||||
n1.receive({payload:"",topic:"dujour",foo:"bar"});
|
||||
});
|
||||
});
|
||||
|
||||
it('should read in a file and output a buffer with parts', function(done) {
|
||||
var flow = [{id:"fileInNode1", type:"file in", name: "fileInNode", filename:fileToTest, format:"stream", wires:[["n2"]]},
|
||||
{id:"n2", type:"helper"}];
|
||||
@@ -1212,6 +1249,28 @@ describe('file Nodes', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should read in a file and output a buffer with parts and preserve other properties', function(done) {
|
||||
var flow = [{id:"fileInNode1", type:"file in", name: "fileInNode", filename:fileToTest, format:"stream", wires:[["n2"]]},
|
||||
{id:"n2", type:"helper"}];
|
||||
helper.load(fileNode, flow, function() {
|
||||
var n1 = helper.getNode("fileInNode1");
|
||||
var n2 = helper.getNode("n2");
|
||||
n2.on("input", function(msg) {
|
||||
msg.should.have.property('payload');
|
||||
msg.should.have.property('topic',"dujour");
|
||||
msg.should.have.property('foo',"bar");
|
||||
Buffer.isBuffer(msg.payload).should.be.true();
|
||||
msg.payload.should.have.length(40);
|
||||
msg.should.have.property('parts');
|
||||
msg.parts.should.have.property('count',1);
|
||||
msg.parts.should.have.property('type','buffer');
|
||||
msg.parts.should.have.property('ch','');
|
||||
done();
|
||||
});
|
||||
n1.receive({payload:"",topic:"dujour",foo:"bar"});
|
||||
});
|
||||
});
|
||||
|
||||
it('should warn if no filename set', function(done) {
|
||||
var flow = [{id:"fileInNode1", type:"file in", name: "fileInNode", "format":""}];
|
||||
helper.load(fileNode, flow, function() {
|
||||
|
||||
@@ -298,7 +298,7 @@ describe('Subflow', function() {
|
||||
// // stoppedNodes.should.have.a.property(sfConfigId);
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("instantiates a subflow inside a subflow and stops it",function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -331,7 +331,7 @@ describe('Subflow', function() {
|
||||
Object.keys(currentNodes).should.have.length(0);
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("rewires a subflow node on update/start",function(done){
|
||||
|
||||
@@ -391,8 +391,8 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},150);
|
||||
},50);
|
||||
},50);
|
||||
});
|
||||
});
|
||||
describe('#stop', function() {
|
||||
@@ -452,7 +452,7 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("passes a status event to the subflow's parent tab status node - targetted scope",function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -491,7 +491,7 @@ describe('Subflow', function() {
|
||||
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -536,7 +536,7 @@ describe('Subflow', function() {
|
||||
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("emits a status event when a message is passed to a subflow-status node - msg.payload as status obj", function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -578,7 +578,7 @@ describe('Subflow', function() {
|
||||
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("emits a status event when a message is passed to a subflow-status node - msg.status", function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -620,7 +620,7 @@ describe('Subflow', function() {
|
||||
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("does not emit a regular status event if it contains a subflow-status node", function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -690,7 +690,7 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
it("passes an error event to the subflow's parent tab catch node - targetted scope",function(done) {
|
||||
var config = flowUtils.parseConfig([
|
||||
@@ -727,7 +727,7 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
|
||||
});
|
||||
});
|
||||
@@ -777,7 +777,7 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
|
||||
it("can access subflow env var", function(done) {
|
||||
@@ -817,7 +817,7 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},50);
|
||||
});
|
||||
|
||||
it("can access nested subflow env var", function(done) {
|
||||
@@ -875,9 +875,9 @@ describe('Subflow', function() {
|
||||
flow.stop().then(function() {
|
||||
done();
|
||||
});
|
||||
},150);
|
||||
},150);
|
||||
},150);
|
||||
},50);
|
||||
},50);
|
||||
},50);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -224,29 +224,5 @@ describe("@node-red/util/log", function() {
|
||||
|
||||
|
||||
});
|
||||
it('it can log without exception', function() {
|
||||
var msg = {
|
||||
msg: {
|
||||
mystrangeobj:"hello",
|
||||
},
|
||||
};
|
||||
msg.msg.toString = function(){
|
||||
throw new Error('Exception in toString - should have been caught');
|
||||
}
|
||||
msg.msg.constructor = { name: "strangeobj" };
|
||||
var ret = log.info(msg.msg);
|
||||
});
|
||||
it('it can log an object but use .message', function() {
|
||||
var msg = {
|
||||
msg: {
|
||||
message: "my special message",
|
||||
mystrangeobj:"hello",
|
||||
},
|
||||
};
|
||||
var ret = log.info(msg.msg);
|
||||
sinon.assert.calledWithMatch(util.log,"my special message");
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -772,117 +772,6 @@ describe("@node-red/util/util", function() {
|
||||
var resultJson = JSON.parse(result.msg);
|
||||
resultJson.socket.should.eql('[internal]');
|
||||
});
|
||||
it('object which fails to serialise', function(done) {
|
||||
var msg = {
|
||||
msg: {
|
||||
obj:{
|
||||
cantserialise:{
|
||||
message:'this will not be displayed',
|
||||
toJSON: function(val) {
|
||||
throw 'this exception should have been caught';
|
||||
return 'should not display because we threw first';
|
||||
},
|
||||
},
|
||||
canserialise:{
|
||||
message:'this should be displayed',
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
var result = util.encodeObject(msg);
|
||||
result.format.should.eql("error");
|
||||
var success = (result.msg.indexOf('cantserialise') > 0);
|
||||
success &= (result.msg.indexOf('this exception should have been caught') > 0);
|
||||
success &= (result.msg.indexOf('canserialise') > 0);
|
||||
success.should.eql(1);
|
||||
done();
|
||||
});
|
||||
it('object which fails to serialise - different error type', function(done) {
|
||||
var msg = {
|
||||
msg: {
|
||||
obj:{
|
||||
cantserialise:{
|
||||
message:'this will not be displayed',
|
||||
toJSON: function(val) {
|
||||
throw new Error('this exception should have been caught');
|
||||
return 'should not display because we threw first';
|
||||
},
|
||||
},
|
||||
canserialise:{
|
||||
message:'this should be displayed',
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
var result = util.encodeObject(msg);
|
||||
result.format.should.eql("error");
|
||||
var success = (result.msg.indexOf('cantserialise') > 0);
|
||||
success &= (result.msg.indexOf('this exception should have been caught') > 0);
|
||||
success &= (result.msg.indexOf('canserialise') > 0);
|
||||
success.should.eql(1);
|
||||
done();
|
||||
});
|
||||
it('very large object which fails to serialise should be truncated', function(done) {
|
||||
var msg = {
|
||||
msg: {
|
||||
obj:{
|
||||
big:"",
|
||||
cantserialise:{
|
||||
message:'this will not be displayed',
|
||||
toJSON: function(val) {
|
||||
throw new Error('this exception should have been caught');
|
||||
return 'should not display because we threw first';
|
||||
},
|
||||
},
|
||||
canserialise:{
|
||||
message:'this should be displayed',
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < 1000; i++) {
|
||||
msg.msg.obj.big += 'some more string ';
|
||||
}
|
||||
|
||||
var result = util.encodeObject(msg);
|
||||
result.format.should.eql("error");
|
||||
var resultJson = JSON.parse(result.msg);
|
||||
var success = (resultJson.message.length <= 1000);
|
||||
success.should.eql(true);
|
||||
done();
|
||||
});
|
||||
it('test bad toString', function(done) {
|
||||
var msg = {
|
||||
msg: {
|
||||
mystrangeobj:"hello",
|
||||
},
|
||||
};
|
||||
msg.msg.toString = function(){
|
||||
throw new Error('Exception in toString - should have been caught');
|
||||
}
|
||||
msg.msg.constructor = { name: "strangeobj" };
|
||||
|
||||
var result = util.encodeObject(msg);
|
||||
var success = (result.msg.indexOf('[Type not printable]') >= 0);
|
||||
success.should.eql(true);
|
||||
done();
|
||||
});
|
||||
it('test bad object constructor', function(done) {
|
||||
var msg = {
|
||||
msg: {
|
||||
mystrangeobj:"hello",
|
||||
constructor: {
|
||||
get name(){
|
||||
throw new Error('Exception in constructor name');
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
var result = util.encodeObject(msg);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user