No longer pass in date

This commit is contained in:
Ross Casey 2019-12-17 17:36:13 +00:00
parent 7fdd7f89e4
commit 542ef7d506
3 changed files with 1361 additions and 1379 deletions

View File

@ -70,17 +70,8 @@ module.exports = function(RED) {
"on:__node__.on,"+ "on:__node__.on,"+
"status:__node__.status,"+ "status:__node__.status,"+
"send:function(msgs){ __node__.send(__msgid__,msgs);}"+ "send:function(msgs){ __node__.send(__msgid__,msgs);}"+
"};\n"+ "};\n"+
"var innerFunc = (msg) => {\n" +
this.func+"\n"+ this.func+"\n"+
"};\n" +
"let output;\n" +
"try {\n" +
" const result = innerFunc(msg);\n" +
" return JSON.stringify({ type: 'msg', result });\n" +
"} catch (e) {\n" +
" return JSON.stringify({ type: 'error', message: e.message, stack: e.stack });\n" +
"}" +
"})(msg);"; "})(msg);";
this.topic = n.topic; this.topic = n.topic;
this.outstandingTimers = []; this.outstandingTimers = [];
@ -89,7 +80,7 @@ module.exports = function(RED) {
console: console, console: console,
util:util, util:util,
//Buffer:Buffer, //Buffer:Buffer,
Date: Date, //Date: Date,
RED: { RED: {
util: RED.util util: RED.util
}, },
@ -218,18 +209,9 @@ module.exports = function(RED) {
try { try {
var start = process.hrtime(); var start = process.hrtime();
sandbox.msg = msg; sandbox.msg = msg;
const logger = msg.logger;
const vm2Instance = new vm2.VM({ sandbox }); const vm2Instance = new vm2.VM({ sandbox });
const result = JSON.parse(vm2Instance.run(functionText)); const result = vm2Instance.run(functionText);
if(result.type === 'error') { sendResults(this,msg._msgid, result);
const error = new Error(result.message);
error.stack = result.stack;
throw error;
}
result.result.logger = logger;
sendResults(this,msg._msgid, result.result);
var duration = process.hrtime(start); var duration = process.hrtime(start);
var converted = Math.floor((duration[0] * 1e9 + duration[1])/10000)/100; var converted = Math.floor((duration[0] * 1e9 + duration[1])/10000)/100;

2712
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@servisbot/node-red", "name": "@servisbot/node-red",
"version": "0.18.7-patch-4", "version": "0.18.7-patch-5",
"description": "A visual tool for wiring the Internet of Things", "description": "A visual tool for wiring the Internet of Things",
"homepage": "http://nodered.org", "homepage": "http://nodered.org",
"license": "Apache-2.0", "license": "Apache-2.0",