vtlab-generic-functions 1.0.34 → 1.0.36

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.
@@ -56,6 +56,15 @@ module.exports = class Lambda {
56
56
  this.DEBUG = DEBUG;
57
57
  }
58
58
 
59
+ recoverFullPayload = async () => {
60
+ if (this.event?.s3PayloadPath) {
61
+ let contentResponse = await this.s3.download(this.event.s3PayloadPath);
62
+ this.jobs = JSON.parse(contentResponse.Body.toString());
63
+ } else {
64
+ this.jobs = this.event?.payload || [];
65
+ }
66
+ };
67
+
59
68
  s3 = {
60
69
  upload: async (data, path, options = {}) => {
61
70
  return await s3bucket.uploadToS3(path, data, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtlab-generic-functions",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },
package/s3bucket/index.js CHANGED
@@ -149,9 +149,10 @@ const uploadFilesToS3 = async (path, files, extension = 'pdf', options = {
149
149
  if (files.length === 0 || !path) {
150
150
  return "";
151
151
  }
152
+ let randonId = Math.random().toString(36).substring(2, 15);
152
153
 
153
154
  return promisesCollector(files, async (_file) => {
154
- let _path = `${path}${new Date().getTime()}.${extension}`;
155
+ let _path = `${path}${new Date().getTime()}${randonId}.${extension}`;
155
156
  try {
156
157
  let file = Buffer.from(_file.content, "base64");
157
158
  return uploadToS3(_path, file, options);