bot-functions 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +26 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -882,6 +882,30 @@ const sendData2 = async (params, dataJSON) => {
|
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
|
|
885
|
+
const sendDataCH = async (params, dataJSON) => {
|
|
886
|
+
return new Promise(async function (resolve, reject) {
|
|
887
|
+
actualFunction = "sendDataCH";
|
|
888
|
+
try {
|
|
889
|
+
const batchPromises = [];
|
|
890
|
+
const stringData = JSON.stringify(dataJSON);
|
|
891
|
+
const response = await axios({
|
|
892
|
+
method: 'post', url: process.env.INSERT_CH, data: {jsonContent: stringData },
|
|
893
|
+
maxBodyLength: Infinity, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }
|
|
894
|
+
});
|
|
895
|
+
batchPromises.push(response.status);
|
|
896
|
+
batchPromises.map(reg => log.info('Insert status', reg));
|
|
897
|
+
if (batchPromises.every(reg => reg == 200)) {
|
|
898
|
+
resolve({ status: "Packages inserted successfully", exit: 1 });
|
|
899
|
+
} else {
|
|
900
|
+
return reject(new Error('No se insertaron todos los paquetes'));
|
|
901
|
+
}
|
|
902
|
+
} catch (error) {
|
|
903
|
+
await insertLog(params, 107);
|
|
904
|
+
return reject(new Error(error.message));
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
|
|
885
909
|
const waitFrame = (page, frame, framename, info, timeout, parent = null) => {
|
|
886
910
|
return new Promise(async function (resolve, reject) {
|
|
887
911
|
let counter = 0;
|
|
@@ -1384,5 +1408,6 @@ module.exports = {
|
|
|
1384
1408
|
lastDateSales,
|
|
1385
1409
|
EmailManager,
|
|
1386
1410
|
manageEmails,
|
|
1387
|
-
insertLogExec
|
|
1411
|
+
insertLogExec,
|
|
1412
|
+
sendDataCH
|
|
1388
1413
|
}
|