vls-s3 1.3.0 → 1.4.0

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,7 +5,9 @@ export declare class LambdaS3Client {
5
5
  constructor(config: Config);
6
6
  private getClient;
7
7
  uploadFile(payload: Omit<PutObjectCommandInput, 'Bucket'>): Promise<PutObjectCommandOutput>;
8
- getSignedURL(payload: Omit<GetObjectCommandInput, 'Bucket'>, expiresIn?: number): Promise<string>;
8
+ getSignedURL(payload: Omit<GetObjectCommandInput, 'Bucket'> & {
9
+ expiresIn?: number;
10
+ }): Promise<string>;
9
11
  }
10
12
  type Config = {
11
13
  bucketName: string;
@@ -31,13 +31,13 @@ class LambdaS3Client {
31
31
  ...payload
32
32
  }));
33
33
  }
34
- async getSignedURL(payload, expiresIn = 3 * 24 * 60 * 60) {
34
+ async getSignedURL(payload) {
35
35
  const client = this.getClient();
36
36
  return await (0, s3_request_presigner_1.getSignedUrl)(client, new client_s3_1.GetObjectCommand({
37
37
  Bucket: this.config.bucketName,
38
38
  ...payload
39
39
  }), {
40
- expiresIn
40
+ expiresIn: payload.expiresIn ?? 3 * 24 * 60 * 60
41
41
  });
42
42
  }
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vls-s3",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "main": "dist/lambda-s3-client.js",
5
5
  "types": "dist/lambda-s3-client.d.ts",
6
6
  "scripts": {
@@ -45,10 +45,7 @@ export class LambdaS3Client {
45
45
  );
46
46
  }
47
47
 
48
- async getSignedURL(
49
- payload: Omit<GetObjectCommandInput, 'Bucket'>,
50
- expiresIn: number = 3 * 24 * 60 * 60
51
- ): Promise<string> {
48
+ async getSignedURL(payload: Omit<GetObjectCommandInput, 'Bucket'> & { expiresIn?: number }): Promise<string> {
52
49
  const client = this.getClient();
53
50
 
54
51
  return await getSignedUrl(
@@ -58,7 +55,7 @@ export class LambdaS3Client {
58
55
  ...payload
59
56
  }),
60
57
  {
61
- expiresIn
58
+ expiresIn: payload.expiresIn ?? 3 * 24 * 60 * 60
62
59
  }
63
60
  );
64
61
  }