vls-s3 1.0.0 → 1.1.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.
package/SECURITY.MD ADDED
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ To securely report a vulnerability, please [Contact us!](mailto:security@useinsider.com?subject=[GitHub]_Vulnerability!).
6
+
7
+ <!-- E26CADE3-DF7C-4FF8-A30A-4DD2F28E06BF -->
@@ -1,5 +1,5 @@
1
1
  import { PutObjectCommandInput, GetObjectCommandInput } from '@aws-sdk/client-s3';
2
- export declare class S3Client {
2
+ export declare class LambdaS3Client {
3
3
  private readonly bucketName;
4
4
  constructor(bucketName: string);
5
5
  uploadFile(payload: Omit<PutObjectCommandInput, 'Bucket'>): Promise<void>;
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.S3Client = void 0;
3
+ exports.LambdaS3Client = void 0;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
6
- const awsS3Client = new client_s3_1.S3Client({ region: process.env.REGION });
7
- class S3Client {
6
+ const s3Client = new client_s3_1.S3Client({ region: process.env.REGION });
7
+ class LambdaS3Client {
8
8
  constructor(bucketName) {
9
9
  this.bucketName = bucketName;
10
10
  }
11
11
  async uploadFile(payload) {
12
- await awsS3Client.send(new client_s3_1.PutObjectCommand({
12
+ await s3Client.send(new client_s3_1.PutObjectCommand({
13
13
  Bucket: this.bucketName,
14
14
  ...payload
15
15
  }));
16
16
  }
17
17
  async getSignedURL(payload, expiresIn = 3 * 24 * 60 * 60) {
18
- return await (0, s3_request_presigner_1.getSignedUrl)(awsS3Client, new client_s3_1.GetObjectCommand({
18
+ return await (0, s3_request_presigner_1.getSignedUrl)(s3Client, new client_s3_1.GetObjectCommand({
19
19
  Bucket: this.bucketName,
20
20
  ...payload
21
21
  }), {
@@ -23,4 +23,4 @@ class S3Client {
23
23
  });
24
24
  }
25
25
  }
26
- exports.S3Client = S3Client;
26
+ exports.LambdaS3Client = LambdaS3Client;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "vls-s3",
3
- "version": "1.0.0",
4
- "main": "dist/s3.js",
5
- "types": "dist/s3.d.ts",
3
+ "version": "1.1.0",
4
+ "main": "dist/lambda-s3-client.js",
5
+ "types": "dist/lambda-s3-client.d.ts",
6
6
  "scripts": {
7
7
  "check-format": "prettier . --check",
8
8
  "fix-format": "prettier . --write",
@@ -2,14 +2,14 @@ import {
2
2
  GetObjectCommand,
3
3
  PutObjectCommand,
4
4
  PutObjectCommandInput,
5
- S3Client as AWSS3Client,
5
+ S3Client,
6
6
  GetObjectCommandInput
7
7
  } from '@aws-sdk/client-s3';
8
8
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
9
9
 
10
- const awsS3Client = new AWSS3Client({ region: process.env.REGION });
10
+ const s3Client = new S3Client({ region: process.env.REGION });
11
11
 
12
- export class S3Client {
12
+ export class LambdaS3Client {
13
13
  private readonly bucketName: string;
14
14
 
15
15
  constructor(bucketName: string) {
@@ -17,7 +17,7 @@ export class S3Client {
17
17
  }
18
18
 
19
19
  async uploadFile(payload: Omit<PutObjectCommandInput, 'Bucket'>): Promise<void> {
20
- await awsS3Client.send(
20
+ await s3Client.send(
21
21
  new PutObjectCommand({
22
22
  Bucket: this.bucketName,
23
23
  ...payload
@@ -30,7 +30,7 @@ export class S3Client {
30
30
  expiresIn: number = 3 * 24 * 60 * 60
31
31
  ): Promise<string> {
32
32
  return await getSignedUrl(
33
- awsS3Client,
33
+ s3Client,
34
34
  new GetObjectCommand({
35
35
  Bucket: this.bucketName,
36
36
  ...payload