node-red-contrib-agilite
Advanced tools
Comparing version 5.1.4 to 5.1.5
{ | ||
"name": "node-red-contrib-agilite", | ||
"license": "MIT", | ||
"version": "5.1.4", | ||
"version": "5.1.5", | ||
"description": "Node-RED nodes to integrate with Agilit-e cloud or Agilit-e on-prem", | ||
@@ -6,0 +6,0 @@ "homepage": "https://portal.agilite.io", |
@@ -97,3 +97,3 @@ module.exports = function(RED) { | ||
if(response.data.success){ | ||
msg.payload = response.data.data.data.data; | ||
msg.payload = response.data.data; | ||
}else{ | ||
@@ -100,0 +100,0 @@ msg.payload = ""; |
@@ -13,6 +13,11 @@ module.exports = function(RED) { | ||
var actionType = ""; | ||
var dateTimeValue = ""; | ||
var formatKey = ""; | ||
var url = ""; | ||
var method = "get"; | ||
var data = null; | ||
var headers = {}; | ||
var params = {}; | ||
var logProcessId = null; | ||
url = serverConfig.server; | ||
@@ -38,2 +43,16 @@ | ||
} | ||
if(msg.agilite.utilities){ | ||
if(msg.agilite.utilities.dateTimeValue){ | ||
if(msg.agilite.utilities.dateTimeValue !== ""){ | ||
dateTimeValue = msg.agilite.utilities.dateTimeValue; | ||
} | ||
} | ||
if(msg.agilite.utilities.formatKey){ | ||
if(msg.agilite.utilities.formatKey !== ""){ | ||
formatKey = msg.agilite.utilities.formatKey; | ||
} | ||
} | ||
} | ||
} | ||
@@ -45,2 +64,10 @@ | ||
if(dateTimeValue === ""){ | ||
dateTimeValue = config.dateTimeValue; | ||
} | ||
if(formatKey === ""){ | ||
formatKey = config.formatKey; | ||
} | ||
//We need a token, key and data to proceed | ||
@@ -53,2 +80,15 @@ 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; | ||
} | ||
} | ||
@@ -69,10 +109,7 @@ | ||
var axios = require("axios"); | ||
headers = {"api-key": apiKey, "Content-Type":"text/plain"}; | ||
var headers = { | ||
headers: {"api-key": apiKey, "Content-Type":"text/plain"} | ||
}; | ||
//Check if we need to pass a Log Process Id | ||
if(logProcessId){ | ||
headers.headers["log-process-id"] = logProcessId; | ||
headers["log-process-id"] = logProcessId; | ||
} | ||
@@ -82,14 +119,27 @@ | ||
case "1"://Encode XML | ||
method = "post"; | ||
url = url + "/utils/encodeXML"; | ||
break; | ||
case "2"://Convert HTML to JSON | ||
method = "post"; | ||
url = url + "/utils/html2json"; | ||
break; | ||
case "3"://Generate PDF | ||
headers.headers["Content-Type"] = "application/json"; | ||
method = "post"; | ||
headers["Content-Type"] = "application/json"; | ||
url = url + "/utils/generatePDF"; | ||
break; | ||
case "4"://Generate UUID | ||
url = url + "/utils/generateUUID"; | ||
break; | ||
case "5"://Format Dated/Time Value | ||
headers["date-time-value"] = dateTimeValue; | ||
headers["format-key"] = formatKey; | ||
url = url + "/utils/formatDateTime"; | ||
break; | ||
} | ||
axios.post(url, data, headers) | ||
params = {method, url, headers, data}; | ||
axios.request(params) | ||
.then(function (response) { | ||
@@ -96,0 +146,0 @@ msg.agilite.success = response.data.success; |
Sorry, the diff of this file is not supported yet
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
75926
1114