vtlab-generic-functions 1.0.8 → 1.0.10

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.
@@ -24,7 +24,9 @@ const putLogEvents = async (logEvents = [], logGroupName, logLevel = 2, logStrea
24
24
  }
25
25
  });
26
26
 
27
- Array.isArray(logEvents) || (logEvents = [String(logEvents)]);
27
+ if (!Array.isArray(logEvents)) {
28
+ logEvents = [logEvents];
29
+ }
28
30
 
29
31
  if (logEvents.length === 0) {
30
32
  throw new Error('Empty log event');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vtlab-generic-functions",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "scripts": {
5
5
  "test": "jest"
6
6
  },
package/s3bucket/index.js CHANGED
@@ -108,7 +108,7 @@ const downloadFileFromS3 = async (path) => {
108
108
  });
109
109
 
110
110
  try {
111
- let response = await s3.send(command);
111
+ let response = await s3Client.send(command);
112
112
  let Body = response.Body;
113
113
 
114
114
  if (Body && Body instanceof stream.Readable) {
@@ -175,7 +175,14 @@ const generatePresignedUrl = async (bucket, key, expirationInSeconds = 604000) =
175
175
  if(expirationInSeconds > 604000){ //7 days is the max expiration time for a presigned url v4
176
176
  expirationInSeconds = 604000;
177
177
  }
178
- const s3Client = new S3Client();
178
+ const allConfig = await config.get();
179
+ const s3Client = new S3Client({
180
+ credentials: {
181
+ accessKeyId: allConfig.awsCredentials.accessKeyId,
182
+ secretAccessKey: allConfig.awsCredentials.secretAccessKey,
183
+ },
184
+ region: allConfig.awsCredentials.region
185
+ });
179
186
 
180
187
  const command = new GetObjectCommand({
181
188
  Bucket: bucket,