mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add JSONata support for env var definition
This commit is contained in:
parent
30ea300f65
commit
93a88a83a8
@ -2,7 +2,7 @@ RED.editor.envVarList = (function() {
|
||||
|
||||
var currentLocale = 'en-US';
|
||||
var DEFAULT_ENV_TYPE_LIST = ['str','num','bool','json','bin','env'];
|
||||
var DEFAULT_ENV_TYPE_LIST_INC_CRED = ['str','num','bool','json','bin','env','cred'];
|
||||
var DEFAULT_ENV_TYPE_LIST_INC_CRED = ['str','num','bool','json','bin','env','cred','jsonata'];
|
||||
|
||||
/**
|
||||
* Create env var edit interface
|
||||
|
12
packages/node_modules/@node-red/util/lib/util.js
vendored
12
packages/node_modules/@node-red/util/lib/util.js
vendored
@ -696,13 +696,19 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
|
||||
function prepareJSONataExpression(value,node) {
|
||||
var expr = jsonata(value);
|
||||
expr.assign('flowContext', function(val, store) {
|
||||
return node.context().flow.get(val, store);
|
||||
if (node) {
|
||||
return node.context().flow.get(val, store);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expr.assign('globalContext', function(val, store) {
|
||||
return node.context().global.get(val, store);
|
||||
if (node) {
|
||||
return node.context().global.get(val, store);
|
||||
}
|
||||
return "";
|
||||
});
|
||||
expr.assign('env', function(name) {
|
||||
var val = getSetting(node, name, node._flow);
|
||||
var val = getSetting(node, name, node ? node._flow : null);
|
||||
if (typeof val !== 'undefined') {
|
||||
return val;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user