mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Deprecate synchronous access to jsonata
This commit is contained in:
14
packages/node_modules/@node-red/util/lib/util.js
vendored
14
packages/node_modules/@node-red/util/lib/util.js
vendored
@@ -25,7 +25,7 @@ const moment = require("moment-timezone");
|
||||
const safeJSONStringify = require("json-stringify-safe");
|
||||
const util = require("util");
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
|
||||
const log = require("./log")
|
||||
/**
|
||||
* Safely returns the object construtor name.
|
||||
* @return {String} the name of the object constructor if it exists, empty string otherwise.
|
||||
@@ -671,8 +671,11 @@ function evaluateNodeProperty(value, type, node, msg, callback) {
|
||||
} else if (type === 'bool') {
|
||||
result = /^true$/i.test(value);
|
||||
} else if (type === 'jsonata') {
|
||||
var expr = prepareJSONataExpression(value,node);
|
||||
result = evaluateJSONataExpression(expr,msg);
|
||||
var expr = prepareJSONataExpression(value, node);
|
||||
result = evaluateJSONataExpression(expr, msg, callback);
|
||||
if (callback) {
|
||||
return
|
||||
}
|
||||
} else if (type === 'env') {
|
||||
result = evaluateEnvProperty(value, node);
|
||||
}
|
||||
@@ -767,6 +770,11 @@ function evaluateJSONataExpression(expr,msg,callback) {
|
||||
})
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log.warn('Deprecated API warning: Calls to RED.util.evaluateJSONataExpression must include a callback. '+
|
||||
'This will not be optional in Node-RED 4.0. Please identify the node from the following stack '+
|
||||
'and check for an update on npm. If none is available, please notify the node author.')
|
||||
log.warn(new Error().stack)
|
||||
}
|
||||
return expr.evaluate(context, bindings, callback);
|
||||
}
|
||||
|
Reference in New Issue
Block a user