Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary
2021-12-05 19:32:13 +00:00
47 changed files with 541 additions and 177 deletions

View File

@@ -136,8 +136,6 @@ function getCurrentLocale() {
function init(settings) {
if (!initPromise) {
// Keep this as a 'when' promise as top-level red.js uses 'otherwise'
// and embedded users of NR may have copied that.
initPromise = new Promise((resolve,reject) => {
i18n.use(MessageFileLoader);
var opt = {
@@ -146,6 +144,8 @@ function init(settings) {
defaultNS: "runtime",
ns: [],
fallbackLng: defaultLang,
keySeparator: ".",
nsSeparator: ":",
interpolation: {
unescapeSuffix: 'HTML',
escapeValue: false,

View File

@@ -526,10 +526,11 @@ function getSetting(node, name, flow_) {
if (flow) {
if (node && node.g) {
const group = flow.getGroupNode(node.g);
const result = flow.getGroupEnvSetting(node, group, name);
const [result, newName] = flow.getGroupEnvSetting(node, group, name);
if (result) {
return result.val;
}
name = newName;
}
return flow.getSetting(name);
}
@@ -842,6 +843,9 @@ function encodeObject(msg,opts) {
length: msg.msg.size
}
needsStringify = true;
} else if (msg.msg && msg.msg.constructor.name === "RegExp") {
msg.format = 'regexp';
msg.msg = msg.msg.toString();
}
if (needsStringify || (msg.format === "Object")) {
msg.msg = safeJSONStringify(msg.msg, function(key, value) {
@@ -907,6 +911,12 @@ function encodeObject(msg,opts) {
data: Object.fromEntries(Array.from(value.entries()).slice(0,debuglength)),
length: value.size
}
} else if (value.constructor.name === "RegExp") {
value = {
__enc__: true,
type: "regexp",
data: value.toString()
}
}
} else if (value === undefined) {
value = {

View File

@@ -16,10 +16,10 @@
],
"dependencies": {
"fs-extra": "10.0.0",
"i18next": "21.3.1",
"i18next": "21.5.4",
"json-stringify-safe": "5.0.1",
"jsonata": "1.8.5",
"lodash.clonedeep": "^4.5.0",
"moment-timezone": "0.5.33"
"moment-timezone": "0.5.34"
}
}