@node-red/runtime 2.2.0 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/flows/Flow.js +1 -1
- package/lib/flows/Subflow.js +0 -1
- package/lib/flows/util.js +6 -5
- package/lib/nodes/Node.js +41 -19
- package/lib/nodes/credentials.js +16 -6
- package/locales/en-US/runtime.json +3 -1
- package/locales/ja/runtime.json +3 -1
- package/package.json +3 -3
- package/restart.js +0 -0
package/lib/flows/Flow.js
CHANGED
|
@@ -582,7 +582,7 @@ class Flow {
|
|
|
582
582
|
reportingNode = node;
|
|
583
583
|
}
|
|
584
584
|
if (!muteStatusEvent) {
|
|
585
|
-
if (statusMessage.hasOwnProperty("text") && typeof
|
|
585
|
+
if (statusMessage.hasOwnProperty("text") && typeof statusMessage.text !== "string") {
|
|
586
586
|
try {
|
|
587
587
|
statusMessage.text = statusMessage.text.toString();
|
|
588
588
|
}
|
package/lib/flows/Subflow.js
CHANGED
package/lib/flows/util.js
CHANGED
|
@@ -77,15 +77,16 @@ function createNode(flow,config) {
|
|
|
77
77
|
if (typeof nodeTypeConstructor === "function") {
|
|
78
78
|
var conf = clone(config);
|
|
79
79
|
delete conf.credentials;
|
|
80
|
-
for (var p in conf) {
|
|
81
|
-
if (conf.hasOwnProperty(p)) {
|
|
82
|
-
mapEnvVarProperties(conf,p,flow,conf);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
80
|
try {
|
|
86
81
|
Object.defineProperty(conf,'_module', {value: typeRegistry.getNodeInfo(type), enumerable: false, writable: true })
|
|
87
82
|
Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true })
|
|
88
83
|
Object.defineProperty(conf,'_path', {value: `${flow.path}/${config._alias||config.id}`, enumerable: false, writable: true })
|
|
84
|
+
|
|
85
|
+
for (var p in conf) {
|
|
86
|
+
if (conf.hasOwnProperty(p)) {
|
|
87
|
+
mapEnvVarProperties(conf,p,flow,conf);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
89
90
|
newNode = new nodeTypeConstructor(conf);
|
|
90
91
|
} catch (err) {
|
|
91
92
|
Log.log({
|
package/lib/nodes/Node.js
CHANGED
|
@@ -503,10 +503,25 @@ function log_helper(self, level, msg) {
|
|
|
503
503
|
o.name = self.name;
|
|
504
504
|
}
|
|
505
505
|
// See https://github.com/node-red/node-red/issues/3327
|
|
506
|
+
// See https://github.com/node-red/node-red/issues/3389
|
|
507
|
+
|
|
508
|
+
let srcError;
|
|
509
|
+
if (msg instanceof Error) {
|
|
510
|
+
srcError = msg;//use existing err object for actual stack
|
|
511
|
+
} else {
|
|
512
|
+
srcError = new Error(msg);//generate a new error for generate a stack
|
|
513
|
+
}
|
|
506
514
|
try {
|
|
507
|
-
self._flow
|
|
515
|
+
if(self instanceof Node && self._flow) {
|
|
516
|
+
self._flow.log(o);
|
|
517
|
+
} else {
|
|
518
|
+
//if self._flow is not present, this is not a node-red Node
|
|
519
|
+
//Set info to "Node object is not a node-red Node" to point out the `Node type` problem in log
|
|
520
|
+
logUnexpectedError(self, srcError, "Node object is not a node-red Node")
|
|
521
|
+
}
|
|
508
522
|
} catch(err) {
|
|
509
|
-
|
|
523
|
+
//build an unexpected error report indicating using the original error (for better stack trace)
|
|
524
|
+
logUnexpectedError(self, srcError, `An error occured attempting to make a log entry: ${err}`)
|
|
510
525
|
}
|
|
511
526
|
}
|
|
512
527
|
/**
|
|
@@ -531,7 +546,7 @@ Node.prototype.error = function(logMessage,msg) {
|
|
|
531
546
|
logMessage = logMessage || "";
|
|
532
547
|
}
|
|
533
548
|
var handled = false;
|
|
534
|
-
if (msg && typeof msg === 'object') {
|
|
549
|
+
if (this._flow && msg && typeof msg === 'object') {
|
|
535
550
|
handled = this._flow.handleError(this,logMessage,msg);
|
|
536
551
|
}
|
|
537
552
|
if (!handled) {
|
|
@@ -619,27 +634,34 @@ function inspectObject(flow) {
|
|
|
619
634
|
}
|
|
620
635
|
}
|
|
621
636
|
|
|
622
|
-
function logUnexpectedError(node, error) {
|
|
623
|
-
|
|
624
|
-
Log.error(`
|
|
637
|
+
function logUnexpectedError(node, error, info) {
|
|
638
|
+
const header = `
|
|
625
639
|
********************************************************************
|
|
626
640
|
Unexpected Node Error
|
|
627
|
-
|
|
628
|
-
Node:
|
|
629
|
-
Type: ${node.type}
|
|
630
|
-
Module: ${moduleInfo}
|
|
631
|
-
ID: ${node._alias||node.id}
|
|
632
|
-
Properties:
|
|
633
|
-
${inspectObject(node)}
|
|
634
|
-
Flow: ${node._flow?node._flow.path:'undefined'}
|
|
635
|
-
Type: ${node._flow?node._flow.TYPE:'undefined'}
|
|
636
|
-
Properties:
|
|
637
|
-
${node._flow?inspectObject(node._flow):'undefined'}
|
|
641
|
+
********************************************************************`;
|
|
638
642
|
|
|
643
|
+
const footer = `
|
|
639
644
|
Please report this issue, including the information logged above:
|
|
640
645
|
https://github.com/node-red/node-red/issues/
|
|
641
|
-
|
|
642
|
-
|
|
646
|
+
********************************************************************`;
|
|
647
|
+
|
|
648
|
+
let detail = [`Info:\n ${info || 'No additional info'}`];
|
|
649
|
+
|
|
650
|
+
//Include Error info?
|
|
651
|
+
if(error && error.stack){
|
|
652
|
+
detail.push(`Stack:\n ${error.stack}`)
|
|
653
|
+
}
|
|
654
|
+
//Include Node info?
|
|
655
|
+
if(node && (node._module || node.type)){
|
|
656
|
+
const moduleInfo = node._module?`${node._module.module}@${node._module.version}`:"undefined";
|
|
657
|
+
const id = node._alias||node.id||"undefined";
|
|
658
|
+
detail.push(`Node:\n Type: ${node.type}\n Module: ${moduleInfo}\n ID: ${id}\n Properties:\n ${inspectObject(node)}`)
|
|
659
|
+
}
|
|
660
|
+
//Include Flow info?
|
|
661
|
+
if(node && node._flow){
|
|
662
|
+
detail.push(`Flow: ${node._flow.path}\n Type: ${node._flow.TYPE}\n Properties:\n ${inspectObject(node._flow)}`)
|
|
663
|
+
}
|
|
664
|
+
Log.error(`${header}\n${detail.join("\n")}\n${footer}`);
|
|
643
665
|
}
|
|
644
666
|
|
|
645
667
|
module.exports = Node;
|
package/lib/nodes/credentials.js
CHANGED
|
@@ -239,7 +239,15 @@ var api = module.exports = {
|
|
|
239
239
|
throw error;
|
|
240
240
|
}
|
|
241
241
|
} else {
|
|
242
|
-
|
|
242
|
+
if (encryptionEnabled) {
|
|
243
|
+
// Our config expects the credentials to be encrypted but the encrypted object is not found
|
|
244
|
+
log.warn(log._("nodes.credentials.encryptedNotFound"))
|
|
245
|
+
credentialCache = credentials;
|
|
246
|
+
} else {
|
|
247
|
+
// credentialSecret is set to False
|
|
248
|
+
log.warn(log._("nodes.credentials.unencrypted"))
|
|
249
|
+
credentialCache = credentials;
|
|
250
|
+
}
|
|
243
251
|
}
|
|
244
252
|
if (clearInvalidFlag) {
|
|
245
253
|
// TODO: this delves too deep into Project structure
|
|
@@ -365,11 +373,13 @@ var api = module.exports = {
|
|
|
365
373
|
|
|
366
374
|
}
|
|
367
375
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
|
|
376
|
+
if (/^subflow(:|$)/.test(nodeType)) {
|
|
377
|
+
for (cred in savedCredentials) {
|
|
378
|
+
if (savedCredentials.hasOwnProperty(cred)) {
|
|
379
|
+
if (!newCreds.hasOwnProperty(cred)) {
|
|
380
|
+
delete savedCredentials[cred];
|
|
381
|
+
dirty = true;
|
|
382
|
+
}
|
|
373
383
|
}
|
|
374
384
|
}
|
|
375
385
|
}
|
|
@@ -104,7 +104,9 @@
|
|
|
104
104
|
"error":"Error loading credentials: __message__",
|
|
105
105
|
"error-saving":"Error saving credentials: __message__",
|
|
106
106
|
"not-registered": "Credential type '__type__' is not registered",
|
|
107
|
-
"system-key-warning": "\n\n---------------------------------------------------------------------\nYour flow credentials file is encrypted using a system-generated key.\n\nIf the system-generated key is lost for any reason, your credentials\nfile will not be recoverable, you will have to delete it and re-enter\nyour credentials.\n\nYou should set your own key using the 'credentialSecret' option in\nyour settings file. Node-RED will then re-encrypt your credentials\nfile using your chosen key the next time you deploy a change.\n---------------------------------------------------------------------\n"
|
|
107
|
+
"system-key-warning": "\n\n---------------------------------------------------------------------\nYour flow credentials file is encrypted using a system-generated key.\n\nIf the system-generated key is lost for any reason, your credentials\nfile will not be recoverable, you will have to delete it and re-enter\nyour credentials.\n\nYou should set your own key using the 'credentialSecret' option in\nyour settings file. Node-RED will then re-encrypt your credentials\nfile using your chosen key the next time you deploy a change.\n---------------------------------------------------------------------\n",
|
|
108
|
+
"unencrypted" : "Using unencrypted credentials",
|
|
109
|
+
"encryptedNotFound" : "Encrypted credentials not found"
|
|
108
110
|
},
|
|
109
111
|
"flows": {
|
|
110
112
|
"safe-mode": "Flows stopped in safe mode. Deploy to start.",
|
package/locales/ja/runtime.json
CHANGED
|
@@ -100,7 +100,9 @@
|
|
|
100
100
|
"error": "クレデンシャルの読み込みエラー: __message__",
|
|
101
101
|
"error-saving": "クレデンシャルの保存エラー: __message__",
|
|
102
102
|
"not-registered": "クレデンシャル '__type__' は登録されていません",
|
|
103
|
-
"system-key-warning": "\n\n---------------------------------------------------------------------\nフローのクレデンシャルファイルはシステム生成キーで暗号化されています。\n\nシステム生成キーを何らかの理由で失った場合、クレデンシャルファイルを\n復元することはできません。その場合、ファイルを削除してクレデンシャルを\n再入力しなければなりません。\n\n設定ファイル内で 'credentialSecret' オプションを使って独自キーを設定\nします。変更を次にデプロイする際、Node-REDは選択したキーを用いてクレ\nデンシャルを再暗号化します。 \n\n---------------------------------------------------------------------\n"
|
|
103
|
+
"system-key-warning": "\n\n---------------------------------------------------------------------\nフローのクレデンシャルファイルはシステム生成キーで暗号化されています。\n\nシステム生成キーを何らかの理由で失った場合、クレデンシャルファイルを\n復元することはできません。その場合、ファイルを削除してクレデンシャルを\n再入力しなければなりません。\n\n設定ファイル内で 'credentialSecret' オプションを使って独自キーを設定\nします。変更を次にデプロイする際、Node-REDは選択したキーを用いてクレ\nデンシャルを再暗号化します。 \n\n---------------------------------------------------------------------\n",
|
|
104
|
+
"unencrypted": "暗号化されていないクレデンシャルを使用",
|
|
105
|
+
"encryptedNotFound": "暗号化されたクレデンシャルが存在しません"
|
|
104
106
|
},
|
|
105
107
|
"flows": {
|
|
106
108
|
"safe-mode": "セーフモードでフローを停止しました。開始するためにはデプロイしてください",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/runtime",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@node-red/registry": "2.2.
|
|
20
|
-
"@node-red/util": "2.2.
|
|
19
|
+
"@node-red/registry": "2.2.3",
|
|
20
|
+
"@node-red/util": "2.2.3",
|
|
21
21
|
"async-mutex": "0.3.2",
|
|
22
22
|
"clone": "2.1.2",
|
|
23
23
|
"express": "4.17.2",
|
package/restart.js
ADDED
|
File without changes
|