@node-red/util
Advanced tools
Comparing version 2.0.6 to 2.1.0-beta.1
@@ -26,3 +26,3 @@ /** | ||
var path = require("path"); | ||
var fs = require("fs-extra"); | ||
var fs = require("fs"); | ||
@@ -93,3 +93,3 @@ var defaultLang = "en-US"; | ||
const file = path.join(resourceMap[ns].basedir, lng, resourceMap[ns].file); | ||
const content = await fs.readFile(file, "utf8"); | ||
const content = await fs.promises.readFile(file, "utf8"); | ||
resourceCache[ns] = resourceCache[ns] || {}; | ||
@@ -146,2 +146,3 @@ resourceCache[ns][lng] = JSON.parse(content.replace(/^\uFEFF/, '')); | ||
var opt = { | ||
compatibilityJSON: 'v3', | ||
// debug: true, | ||
@@ -148,0 +149,0 @@ defaultNS: "runtime", |
@@ -524,8 +524,13 @@ /** | ||
*/ | ||
function getSetting(node, name) { | ||
if (node && node._flow) { | ||
var flow = node._flow; | ||
if (flow) { | ||
return flow.getSetting(name); | ||
function getSetting(node, name, flow_) { | ||
var flow = (flow_ ? flow_ : (node ? node._flow : null)); | ||
if (flow) { | ||
if (node && node.g) { | ||
const group = flow.getGroupNode(node.g); | ||
const result = flow.getGroupEnvSetting(node, group, name); | ||
if (result) { | ||
return result.val; | ||
} | ||
} | ||
return flow.getSetting(name); | ||
} | ||
@@ -548,2 +553,3 @@ return process.env[name]; | ||
function evaluateEnvProperty(value, node) { | ||
var flow = (node && node.hasOwnProperty("_flow")) ? node._flow : null; | ||
var result; | ||
@@ -553,10 +559,10 @@ if (/^\${[^}]+}$/.test(value)) { | ||
var name = value.substring(2,value.length-1); | ||
result = getSetting(node, name); | ||
result = getSetting(node, name, flow); | ||
} else if (!/\${\S+}/.test(value)) { | ||
// ENV_VAR | ||
result = getSetting(node, value); | ||
result = getSetting(node, value, flow); | ||
} else { | ||
// FOO${ENV_VAR}BAR | ||
return value.replace(/\${([^}]+)}/g, function(match, name) { | ||
var val = getSetting(node, name); | ||
var val = getSetting(node, name, flow); | ||
return (val === undefined)?"":val; | ||
@@ -674,3 +680,3 @@ }); | ||
expr.assign('env', function(name) { | ||
var val = getSetting(node, name); | ||
var val = getSetting(node, name, node._flow); | ||
if (typeof val !== 'undefined') { | ||
@@ -983,3 +989,4 @@ return val; | ||
evaluateJSONataExpression: evaluateJSONataExpression, | ||
parseContextStore: parseContextStore | ||
parseContextStore: parseContextStore, | ||
getSetting: getSetting | ||
}; |
{ | ||
"name": "@node-red/util", | ||
"version": "2.0.6", | ||
"version": "2.1.0-beta.1", | ||
"license": "Apache-2.0", | ||
@@ -19,3 +19,3 @@ "repository": { | ||
"fs-extra": "10.0.0", | ||
"i18next": "20.3.2", | ||
"i18next": "21.2.4", | ||
"json-stringify-safe": "5.0.1", | ||
@@ -22,0 +22,0 @@ "jsonata": "1.8.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
73756
1813
2
+ Addedi18next@21.2.4(transitive)
- Removedi18next@20.3.2(transitive)
Updatedi18next@21.2.4