mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'dev' into master
This commit is contained in:
48
packages/node_modules/@node-red/util/lib/util.js
vendored
48
packages/node_modules/@node-red/util/lib/util.js
vendored
@@ -80,23 +80,25 @@ function ensureBuffer(o) {
|
||||
* @memberof @node-red/util_util
|
||||
*/
|
||||
function cloneMessage(msg) {
|
||||
// Temporary fix for #97
|
||||
// TODO: remove this http-node-specific fix somehow
|
||||
var req = msg.req;
|
||||
var res = msg.res;
|
||||
delete msg.req;
|
||||
delete msg.res;
|
||||
|
||||
var m = clonedeep(msg);
|
||||
if (req) {
|
||||
m.req = req;
|
||||
msg.req = req;
|
||||
if (typeof msg !== "undefined") {
|
||||
// Temporary fix for #97
|
||||
// TODO: remove this http-node-specific fix somehow
|
||||
var req = msg.req;
|
||||
var res = msg.res;
|
||||
delete msg.req;
|
||||
delete msg.res;
|
||||
var m = clonedeep(msg);
|
||||
if (req) {
|
||||
m.req = req;
|
||||
msg.req = req;
|
||||
}
|
||||
if (res) {
|
||||
m.res = res;
|
||||
msg.res = res;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
if (res) {
|
||||
m.res = res;
|
||||
msg.res = res;
|
||||
}
|
||||
return m;
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -555,15 +557,19 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
|
||||
*/
|
||||
function prepareJSONataExpression(value,node) {
|
||||
var expr = jsonata(value);
|
||||
expr.assign('flowContext',function(val) {
|
||||
return node.context().flow.get(val);
|
||||
expr.assign('flowContext',function(val, store) {
|
||||
return node.context().flow.get(val, store);
|
||||
});
|
||||
expr.assign('globalContext',function(val) {
|
||||
return node.context().global.get(val);
|
||||
expr.assign('globalContext',function(val, store) {
|
||||
return node.context().global.get(val, store);
|
||||
});
|
||||
expr.assign('env', function(name) {
|
||||
var val = getSetting(node, name);
|
||||
return (val ? val : "");
|
||||
if (typeof val !== 'undefined') {
|
||||
return val;
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
})
|
||||
expr.registerFunction('clone', cloneMessage, '<(oa)-:o>');
|
||||
expr._legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(value);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@node-red/util",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -18,7 +18,7 @@
|
||||
"clone": "2.1.2",
|
||||
"i18next": "15.1.2",
|
||||
"json-stringify-safe": "5.0.1",
|
||||
"jsonata": "1.7.0",
|
||||
"jsonata": "1.8.1",
|
||||
"lodash.clonedeep": "^4.5.0",
|
||||
"when": "3.7.8"
|
||||
}
|
||||
|
Reference in New Issue
Block a user