@kipicore/dbcore 1.1.357 → 1.1.359

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.
@@ -5,4 +5,5 @@ export declare const awsClient: {
5
5
  s3(): Promise<S3Client>;
6
6
  ses(): Promise<SESClient>;
7
7
  sns(): Promise<SNSClient>;
8
+ expiry(): Promise<number>;
8
9
  };
@@ -65,4 +65,8 @@ exports.awsClient = {
65
65
  await ensureClients();
66
66
  return cached.sns;
67
67
  },
68
+ async expiry() {
69
+ await ensureClients();
70
+ return cached.expiry;
71
+ },
68
72
  };
@@ -39,12 +39,13 @@ const getPresignedUrl = async (bucket, fileStorage, expiresIn = 60 * 60 * 24) =>
39
39
  if (fileStorage.filePath)
40
40
  return fileStorage.filePath;
41
41
  const s3 = await configs_1.awsClient.s3();
42
+ expiresIn = await configs_1.awsClient.expiry();
42
43
  const s3Key = `${fileStorage.storagePath}/${fileStorage.storageFileName}`;
43
44
  const command = new client_s3_1.GetObjectCommand({
44
45
  Bucket: bucket,
45
46
  Key: s3Key,
46
47
  });
47
- const signedUrl = await (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn }); // in seconds
48
+ const signedUrl = await (0, s3_request_presigner_1.getSignedUrl)(s3, command, { expiresIn: new Date(expiresIn).getSeconds() }); // in seconds
48
49
  return signedUrl;
49
50
  };
50
51
  exports.getPresignedUrl = getPresignedUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.357",
3
+ "version": "1.1.359",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",