@constructive-io/s3-streamer 2.18.0 → 2.19.1

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.
Files changed (4) hide show
  1. package/esm/s3.js +7 -18
  2. package/package.json +3 -3
  3. package/s3.d.ts +1 -1
  4. package/s3.js +7 -18
package/esm/s3.js CHANGED
@@ -1,21 +1,10 @@
1
- import { S3Client } from '@aws-sdk/client-s3';
1
+ import { createS3Client } from '@constructive-io/s3-utils';
2
2
  export default function getS3(opts) {
3
- const awsConfig = {
3
+ return createS3Client({
4
+ provider: opts.provider || 'minio',
4
5
  region: opts.awsRegion,
5
- ...(opts.awsAccessKey && opts.awsSecretKey
6
- ? {
7
- credentials: {
8
- accessKeyId: opts.awsAccessKey,
9
- secretAccessKey: opts.awsSecretKey,
10
- },
11
- }
12
- : {}),
13
- ...(opts.endpoint
14
- ? {
15
- endpoint: opts.endpoint,
16
- forcePathStyle: true,
17
- }
18
- : {}),
19
- };
20
- return new S3Client(awsConfig);
6
+ accessKeyId: opts.awsAccessKey,
7
+ secretAccessKey: opts.awsSecretKey,
8
+ ...(opts.endpoint ? { endpoint: opts.endpoint } : {}),
9
+ });
21
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/s3-streamer",
3
- "version": "2.18.0",
3
+ "version": "2.19.1",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "stream files to s3",
6
6
  "main": "index.js",
@@ -29,7 +29,6 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "devDependencies": {
32
- "@constructive-io/s3-utils": "^2.11.0",
33
32
  "@pgpmjs/env": "^2.18.0",
34
33
  "glob": "^13.0.6",
35
34
  "makage": "^0.3.0"
@@ -38,6 +37,7 @@
38
37
  "@aws-sdk/client-s3": "^3.1009.0",
39
38
  "@aws-sdk/lib-storage": "^3.1009.0",
40
39
  "@constructive-io/content-type-stream": "^2.12.0",
40
+ "@constructive-io/s3-utils": "^2.12.1",
41
41
  "@pgpmjs/types": "^2.22.0"
42
42
  },
43
43
  "keywords": [
@@ -48,5 +48,5 @@
48
48
  "minio",
49
49
  "constructive"
50
50
  ],
51
- "gitHead": "1b3af3c5189b9ca2e765b9239a4b287099e64a03"
51
+ "gitHead": "a8ccaed4f3a7c6c82495241ee1581700db9dd2dd"
52
52
  }
package/s3.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S3Client } from '@aws-sdk/client-s3';
1
+ import type { S3Client } from '@aws-sdk/client-s3';
2
2
  import type { BucketProvider } from '@pgpmjs/types';
3
3
  interface S3Options {
4
4
  awsAccessKey: string;
package/s3.js CHANGED
@@ -1,24 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = getS3;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
4
+ const s3_utils_1 = require("@constructive-io/s3-utils");
5
5
  function getS3(opts) {
6
- const awsConfig = {
6
+ return (0, s3_utils_1.createS3Client)({
7
+ provider: opts.provider || 'minio',
7
8
  region: opts.awsRegion,
8
- ...(opts.awsAccessKey && opts.awsSecretKey
9
- ? {
10
- credentials: {
11
- accessKeyId: opts.awsAccessKey,
12
- secretAccessKey: opts.awsSecretKey,
13
- },
14
- }
15
- : {}),
16
- ...(opts.endpoint
17
- ? {
18
- endpoint: opts.endpoint,
19
- forcePathStyle: true,
20
- }
21
- : {}),
22
- };
23
- return new client_s3_1.S3Client(awsConfig);
9
+ accessKeyId: opts.awsAccessKey,
10
+ secretAccessKey: opts.awsSecretKey,
11
+ ...(opts.endpoint ? { endpoint: opts.endpoint } : {}),
12
+ });
24
13
  }