node-red-contrib-agilite
Advanced tools
Comparing version 5.4.2 to 5.4.3
@@ -11,4 +11,4 @@ module.exports = function (RED) { | ||
//require type-detect module | ||
const typeDetect = require('type-detect'); | ||
const Mustache = require('mustache'); | ||
@@ -18,5 +18,4 @@ this.on('input', function (msg) { | ||
var apiKey = ""; | ||
var dateTimeValue = ""; | ||
var data = {}; | ||
var formatKey = ""; | ||
var dateTimeValue = config.dateTimeValue; | ||
var formatKey = config.formatKey; | ||
var url = ""; | ||
@@ -33,7 +32,22 @@ var method = "get"; | ||
//Check if there's valid data to pass | ||
if (typeDetect(msg.payload) !== "Object") | ||
msg.payload = {}; | ||
switch(config.actionType){ | ||
case "1": //Encode XML | ||
case "2": //Convert HTML to JSON | ||
//Make sure data is a string | ||
if (typeDetect(msg.payload) !== "string") | ||
msg.payload = ""; | ||
data = msg.payload; | ||
data = msg.payload; | ||
break; | ||
case "3": //Generate PDF | ||
//Make sure data is a object | ||
if (typeDetect(msg.payload) !== "Object") | ||
msg.payload = {}; | ||
data = msg.payload; | ||
break; | ||
default: //get request | ||
data = null; | ||
} | ||
//Check if we need to use programmatic values | ||
@@ -52,16 +66,2 @@ if (msg.agilite) { | ||
} | ||
if (msg.agilite.adhoc) { | ||
if (msg.agilite.adhoc.dateTimeValue) { | ||
if (msg.agilite.adhoc.dateTimeValue !== "") { | ||
dateTimeValue = msg.agilite.adhoc.dateTimeValue; | ||
} | ||
} | ||
if (msg.agilite.adhoc.formatKey) { | ||
if (msg.agilite.adhoc.formatKey !== "") { | ||
formatKey = msg.agilite.adhoc.formatKey; | ||
} | ||
} | ||
} | ||
} | ||
@@ -73,10 +73,2 @@ | ||
if (dateTimeValue === "") { | ||
dateTimeValue = config.dateTimeValue; | ||
} | ||
if (formatKey === "") { | ||
formatKey = config.formatKey; | ||
} | ||
//We need a token, key and data to proceed | ||
@@ -89,15 +81,2 @@ if (apiKey === "") { | ||
errorMessage = "No Server URL Provided"; | ||
} else { | ||
switch (config.actionType) { | ||
case "5": //Format Date/Time | ||
if (dateTimeValue === "") { | ||
success = false; | ||
errorMessage = "No Date/Time Value Key Provided"; | ||
} else if (formatKey === "") { | ||
success = false; | ||
errorMessage = "No Format Key Provided"; | ||
} | ||
break; | ||
} | ||
} | ||
@@ -111,2 +90,5 @@ | ||
dateTimeValue = Mustache.render(dateTimeValue, msg); | ||
formatKey = Mustache.render(formatKey, msg); | ||
//Create msg.agilite if it's null so we can store the result | ||
@@ -113,0 +95,0 @@ if (!msg.agilite) |
{ | ||
"name": "node-red-contrib-agilite", | ||
"license": "MIT", | ||
"version": "5.4.2", | ||
"version": "5.4.3", | ||
"description": "Node-RED nodes to integrate with Agilit-e cloud or Agilit-e on-prem", | ||
@@ -6,0 +6,0 @@ "homepage": "https://portal.agilite.io", |
Sorry, the diff of this file is not supported yet
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
140325
1901