vtlab-generic-functions 1.0.40 → 1.0.42

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.
@@ -18,14 +18,16 @@ module.exports = class Lambda {
18
18
  ftpConnection;
19
19
  jobsByTrackingId;
20
20
  DEBUG;
21
+ context;
21
22
 
22
23
  results = {
23
24
  totalError: 0, totalSuccess: 0, error: [], success: [],
24
25
  };
25
26
 
26
- constructor({ carrier, event, DEBUG = false }) {
27
+ constructor({ carrier, event, DEBUG = false, context }) {
27
28
  this.DEBUG = false;
28
29
  this.carrier = carrier;
30
+ this.context = context;
29
31
  if (event.body) {
30
32
  //Locally we receive event.body, event.body needs to be parsed. In AWS all fields are into event. (event={lodId:'...', payload:[]})
31
33
  event = JSON.parse(event.body);
@@ -196,7 +198,7 @@ module.exports = class Lambda {
196
198
  };
197
199
 
198
200
  logMessage = async (message) => {
199
- await cloudwatch.putLogEvents(`${this.logUuid} ${message}`, this.logGroupName, 2, this.logStreamName);
201
+ await cloudwatch.putLogEvents(`${this?.context?.awsRequestId || '-'} ${this.logUuid} ${message}`, this.logGroupName, 2, this.logStreamName);
200
202
  };
201
203
 
202
204
  logError = async (error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtlab-generic-functions",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },
package/soap/index.js CHANGED
@@ -26,7 +26,7 @@ var xml2js = require('xml2js');
26
26
  * }
27
27
  * @throw error: If validate method fails.
28
28
  */
29
- const sendSoapRequest = async ({url, headers, xml, timeout=3000 }) => {
29
+ const sendSoapRequest = async ({url, headers, xml, timeout=60000 }) => {
30
30
  try{
31
31
  let {response} = await soapRequest({ url: url, headers: headers, xml: xml, timeout});
32
32
  return response; //{ headers, body, statusCode }