@node-red/util 2.1.1 → 2.1.5
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/events.js +8 -2
- package/lib/i18n.js +2 -2
- package/lib/util.js +12 -2
- package/package.json +3 -3
package/lib/events.js
CHANGED
|
@@ -32,8 +32,14 @@ function wrapEventFunction(obj,func) {
|
|
|
32
32
|
return function(eventName, listener) {
|
|
33
33
|
if (deprecatedEvents.hasOwnProperty(eventName)) {
|
|
34
34
|
const log = require("@node-red/util").log;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
const stack = (new Error().stack).split("\n");
|
|
37
|
+
let location = "(unknown)"
|
|
38
|
+
// See https://github.com/node-red/node-red/issues/3292
|
|
39
|
+
if (stack.length > 2) {
|
|
40
|
+
location = stack[2].split("(")[1].slice(0,-1);
|
|
41
|
+
}
|
|
42
|
+
log.warn(`[RED.events] Deprecated use of "${eventName}" event from "${location}". Use "${deprecatedEvents[eventName]}" instead.`)
|
|
37
43
|
}
|
|
38
44
|
return events["_"+func].call(events,eventName,listener)
|
|
39
45
|
}
|
package/lib/i18n.js
CHANGED
|
@@ -136,8 +136,6 @@ function getCurrentLocale() {
|
|
|
136
136
|
|
|
137
137
|
function init(settings) {
|
|
138
138
|
if (!initPromise) {
|
|
139
|
-
// Keep this as a 'when' promise as top-level red.js uses 'otherwise'
|
|
140
|
-
// and embedded users of NR may have copied that.
|
|
141
139
|
initPromise = new Promise((resolve,reject) => {
|
|
142
140
|
i18n.use(MessageFileLoader);
|
|
143
141
|
var opt = {
|
|
@@ -146,6 +144,8 @@ function init(settings) {
|
|
|
146
144
|
defaultNS: "runtime",
|
|
147
145
|
ns: [],
|
|
148
146
|
fallbackLng: defaultLang,
|
|
147
|
+
keySeparator: ".",
|
|
148
|
+
nsSeparator: ":",
|
|
149
149
|
interpolation: {
|
|
150
150
|
unescapeSuffix: 'HTML',
|
|
151
151
|
escapeValue: false,
|
package/lib/util.js
CHANGED
|
@@ -526,10 +526,11 @@ function getSetting(node, name, flow_) {
|
|
|
526
526
|
if (flow) {
|
|
527
527
|
if (node && node.g) {
|
|
528
528
|
const group = flow.getGroupNode(node.g);
|
|
529
|
-
const result = flow.getGroupEnvSetting(node, group, name);
|
|
529
|
+
const [result, newName] = flow.getGroupEnvSetting(node, group, name);
|
|
530
530
|
if (result) {
|
|
531
531
|
return result.val;
|
|
532
532
|
}
|
|
533
|
+
name = newName;
|
|
533
534
|
}
|
|
534
535
|
return flow.getSetting(name);
|
|
535
536
|
}
|
|
@@ -685,7 +686,7 @@ function prepareJSONataExpression(value,node) {
|
|
|
685
686
|
return moment(arg1, arg2, arg3, arg4);
|
|
686
687
|
});
|
|
687
688
|
expr.registerFunction('clone', cloneMessage, '<(oa)-:o>');
|
|
688
|
-
expr._legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(value);
|
|
689
|
+
expr._legacyMode = /(^|[^a-zA-Z0-9_'".])msg([^a-zA-Z0-9_'"]|$)/.test(value);
|
|
689
690
|
expr._node = node;
|
|
690
691
|
return expr;
|
|
691
692
|
}
|
|
@@ -842,6 +843,9 @@ function encodeObject(msg,opts) {
|
|
|
842
843
|
length: msg.msg.size
|
|
843
844
|
}
|
|
844
845
|
needsStringify = true;
|
|
846
|
+
} else if (msg.msg && msg.msg.constructor.name === "RegExp") {
|
|
847
|
+
msg.format = 'regexp';
|
|
848
|
+
msg.msg = msg.msg.toString();
|
|
845
849
|
}
|
|
846
850
|
if (needsStringify || (msg.format === "Object")) {
|
|
847
851
|
msg.msg = safeJSONStringify(msg.msg, function(key, value) {
|
|
@@ -907,6 +911,12 @@ function encodeObject(msg,opts) {
|
|
|
907
911
|
data: Object.fromEntries(Array.from(value.entries()).slice(0,debuglength)),
|
|
908
912
|
length: value.size
|
|
909
913
|
}
|
|
914
|
+
} else if (value.constructor.name === "RegExp") {
|
|
915
|
+
value = {
|
|
916
|
+
__enc__: true,
|
|
917
|
+
type: "regexp",
|
|
918
|
+
data: value.toString()
|
|
919
|
+
}
|
|
910
920
|
}
|
|
911
921
|
} else if (value === undefined) {
|
|
912
922
|
value = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/util",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"fs-extra": "10.0.0",
|
|
19
|
-
"i18next": "21.
|
|
19
|
+
"i18next": "21.6.6",
|
|
20
20
|
"json-stringify-safe": "5.0.1",
|
|
21
21
|
"jsonata": "1.8.5",
|
|
22
22
|
"lodash.clonedeep": "^4.5.0",
|
|
23
|
-
"moment-timezone": "0.5.
|
|
23
|
+
"moment-timezone": "0.5.34"
|
|
24
24
|
}
|
|
25
25
|
}
|