vls-s3 1.2.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,12 +5,14 @@ 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;
12
14
  region?: string;
13
- accessKey?: string;
15
+ secretAccessKey?: string;
14
16
  accessKeyID?: string;
15
17
  };
16
18
  export {};
@@ -12,11 +12,11 @@ class LambdaS3Client {
12
12
  if (!this.client) {
13
13
  this.client = new client_s3_1.S3Client({
14
14
  region: this.config.region ?? process.env.REGION,
15
- ...(this.config.accessKeyID && this.config.accessKey
15
+ ...(this.config.accessKeyID && this.config.secretAccessKey
16
16
  ? {
17
17
  credentials: {
18
18
  accessKeyId: this.config.accessKeyID,
19
- secretAccessKey: this.config.accessKey
19
+ secretAccessKey: this.config.secretAccessKey
20
20
  }
21
21
  }
22
22
  : {})
@@ -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.2.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": {
package/release.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- branches: ['main'],
2
+ branches: ['s3'],
3
3
  plugins: [
4
4
  '@semantic-release/commit-analyzer',
5
5
  '@semantic-release/release-notes-generator',
@@ -20,11 +20,11 @@ export class LambdaS3Client {
20
20
  if (!this.client) {
21
21
  this.client = new S3Client({
22
22
  region: this.config.region ?? process.env.REGION,
23
- ...(this.config.accessKeyID && this.config.accessKey
23
+ ...(this.config.accessKeyID && this.config.secretAccessKey
24
24
  ? {
25
25
  credentials: {
26
26
  accessKeyId: this.config.accessKeyID,
27
- secretAccessKey: this.config.accessKey
27
+ secretAccessKey: this.config.secretAccessKey
28
28
  }
29
29
  }
30
30
  : {})
@@ -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
  }
@@ -67,6 +64,6 @@ export class LambdaS3Client {
67
64
  type Config = {
68
65
  bucketName: string;
69
66
  region?: string;
70
- accessKey?: string;
67
+ secretAccessKey?: string;
71
68
  accessKeyID?: string;
72
69
  };