@node-red/runtime
Advanced tools
Comparing version 0.20.2 to 0.20.3
@@ -72,2 +72,16 @@ /** | ||
/** | ||
* Log an error-level message from this flow | ||
* @param {[type]} msg [description] | ||
* @return {[type]} [description] | ||
*/ | ||
error(msg) { | ||
Log.log({ | ||
id: this.id||"global", | ||
level: Log.ERROR, | ||
type:this.TYPE, | ||
msg:msg | ||
}) | ||
} | ||
/** | ||
* Log a info-level message from this flow | ||
@@ -74,0 +88,0 @@ * @param {[type]} msg [description] |
@@ -266,13 +266,33 @@ /** | ||
getSetting(name) { | ||
var env = this.env; | ||
if (env && env.hasOwnProperty(name)) { | ||
var val = env[name]; | ||
try { | ||
var ret = redUtil.evaluateNodeProperty(val.value, val.type, this.node, null, null); | ||
return ret; | ||
this.trace("getSetting:"+name); | ||
if (!/^\$parent\./.test(name)) { | ||
var env = this.env; | ||
if (env && env.hasOwnProperty(name)) { | ||
var val = env[name]; | ||
// If this is an env type property we need to be careful not | ||
// to get into lookup loops. | ||
// 1. if the value to lookup is the same as this one, go straight to parent | ||
// 2. otherwise, check if it is a compound env var ("foo $(bar)") | ||
// and if so, substitute any instances of `name` with $parent.name | ||
// See https://github.com/node-red/node-red/issues/2099 | ||
if (val.type !== 'env' || val.value !== name) { | ||
let value = val.value; | ||
if (val.type === 'env') { | ||
value = value.replace(new RegExp("\\${"+name+"}","g"),"${$parent."+name+"}"); | ||
} | ||
try { | ||
var ret = redUtil.evaluateNodeProperty(value, val.type, this.node, null, null); | ||
return ret; | ||
} | ||
catch (e) { | ||
this.error(e); | ||
return undefined; | ||
} | ||
} else { | ||
// This _is_ an env property pointing at itself - go to parent | ||
} | ||
} | ||
catch (e) { | ||
this.error(e); | ||
return undefined; | ||
} | ||
} else { | ||
// name starts $parent. ... so delegate to parent automatically | ||
name = name.substring(8); | ||
} | ||
@@ -279,0 +299,0 @@ var parent = this.parent; |
@@ -482,3 +482,3 @@ /** | ||
try { | ||
conf._flow = flow; | ||
Object.defineProperty(conf,'_flow', {value: flow, enumerable: false, writable: true }) | ||
newNode = new nodeTypeConstructor(conf); | ||
@@ -485,0 +485,0 @@ } catch (err) { |
{ | ||
"name": "@node-red/runtime", | ||
"version": "0.20.2", | ||
"version": "0.20.3", | ||
"license": "Apache-2.0", | ||
@@ -19,4 +19,4 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"@node-red/registry": "0.20.2", | ||
"@node-red/util": "0.20.2", | ||
"@node-red/registry": "0.20.3", | ||
"@node-red/util": "0.20.3", | ||
"clone": "2.1.2", | ||
@@ -23,0 +23,0 @@ "express": "4.16.4", |
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
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
440412
10643
+ Added@node-red/registry@0.20.3(transitive)
+ Added@node-red/util@0.20.3(transitive)
- Removed@node-red/registry@0.20.2(transitive)
- Removed@node-red/util@0.20.2(transitive)
Updated@node-red/registry@0.20.3
Updated@node-red/util@0.20.3