@constructive-io/bucket-provisioner 0.3.0 → 0.4.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.
- package/client.d.ts +10 -9
- package/client.js +17 -29
- package/esm/client.d.ts +10 -9
- package/esm/client.js +17 -29
- package/package.json +4 -3
package/client.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* S3 client factory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Delegates to @constructive-io/s3-utils for the actual S3Client creation.
|
|
5
|
+
* Re-exports createS3Client so existing consumers of bucket-provisioner
|
|
6
|
+
* continue to work without changes.
|
|
6
7
|
*/
|
|
7
|
-
import { S3Client } from '@aws-sdk/client-s3';
|
|
8
|
+
import type { S3Client } from '@aws-sdk/client-s3';
|
|
8
9
|
import type { StorageConnectionConfig } from './types';
|
|
9
10
|
/**
|
|
10
11
|
* Create an S3Client from a storage connection config.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Delegates to @constructive-io/s3-utils/createS3Client.
|
|
14
|
+
* This wrapper exists for backward compatibility — new code should
|
|
15
|
+
* import createS3Client from @constructive-io/s3-utils directly.
|
|
16
|
+
*
|
|
17
|
+
* Catches S3ConfigError from s3-utils and re-throws as ProvisionerError
|
|
18
|
+
* so existing consumers that catch ProvisionerError continue to work.
|
|
18
19
|
*/
|
|
19
20
|
export declare function createS3Client(config: StorageConnectionConfig): S3Client;
|
package/client.js
CHANGED
|
@@ -2,44 +2,32 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* S3 client factory.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Delegates to @constructive-io/s3-utils for the actual S3Client creation.
|
|
6
|
+
* Re-exports createS3Client so existing consumers of bucket-provisioner
|
|
7
|
+
* continue to work without changes.
|
|
7
8
|
*/
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.createS3Client = createS3Client;
|
|
10
|
-
const
|
|
11
|
+
const s3_utils_1 = require("@constructive-io/s3-utils");
|
|
11
12
|
const types_1 = require("./types");
|
|
12
13
|
/**
|
|
13
14
|
* Create an S3Client from a storage connection config.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* Delegates to @constructive-io/s3-utils/createS3Client.
|
|
17
|
+
* This wrapper exists for backward compatibility — new code should
|
|
18
|
+
* import createS3Client from @constructive-io/s3-utils directly.
|
|
19
|
+
*
|
|
20
|
+
* Catches S3ConfigError from s3-utils and re-throws as ProvisionerError
|
|
21
|
+
* so existing consumers that catch ProvisionerError continue to work.
|
|
21
22
|
*/
|
|
22
23
|
function createS3Client(config) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
if (!config.region) {
|
|
27
|
-
throw new types_1.ProvisionerError('INVALID_CONFIG', 'region is required');
|
|
24
|
+
try {
|
|
25
|
+
return (0, s3_utils_1.createS3Client)(config);
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
throw new types_1.ProvisionerError('INVALID_CONFIG', `endpoint is required for provider '${config.provider}'`);
|
|
27
|
+
catch (err) {
|
|
28
|
+
if (err instanceof s3_utils_1.S3ConfigError) {
|
|
29
|
+
throw new types_1.ProvisionerError(err.code, err.message);
|
|
30
|
+
}
|
|
31
|
+
throw err;
|
|
35
32
|
}
|
|
36
|
-
return new client_s3_1.S3Client({
|
|
37
|
-
region: config.region,
|
|
38
|
-
endpoint: config.endpoint,
|
|
39
|
-
forcePathStyle,
|
|
40
|
-
credentials: {
|
|
41
|
-
accessKeyId: config.accessKeyId,
|
|
42
|
-
secretAccessKey: config.secretAccessKey,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
33
|
}
|
package/esm/client.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* S3 client factory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Delegates to @constructive-io/s3-utils for the actual S3Client creation.
|
|
5
|
+
* Re-exports createS3Client so existing consumers of bucket-provisioner
|
|
6
|
+
* continue to work without changes.
|
|
6
7
|
*/
|
|
7
|
-
import { S3Client } from '@aws-sdk/client-s3';
|
|
8
|
+
import type { S3Client } from '@aws-sdk/client-s3';
|
|
8
9
|
import type { StorageConnectionConfig } from './types';
|
|
9
10
|
/**
|
|
10
11
|
* Create an S3Client from a storage connection config.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Delegates to @constructive-io/s3-utils/createS3Client.
|
|
14
|
+
* This wrapper exists for backward compatibility — new code should
|
|
15
|
+
* import createS3Client from @constructive-io/s3-utils directly.
|
|
16
|
+
*
|
|
17
|
+
* Catches S3ConfigError from s3-utils and re-throws as ProvisionerError
|
|
18
|
+
* so existing consumers that catch ProvisionerError continue to work.
|
|
18
19
|
*/
|
|
19
20
|
export declare function createS3Client(config: StorageConnectionConfig): S3Client;
|
package/esm/client.js
CHANGED
|
@@ -1,42 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* S3 client factory.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Delegates to @constructive-io/s3-utils for the actual S3Client creation.
|
|
5
|
+
* Re-exports createS3Client so existing consumers of bucket-provisioner
|
|
6
|
+
* continue to work without changes.
|
|
6
7
|
*/
|
|
7
|
-
import {
|
|
8
|
+
import { createS3Client as createS3ClientFromUtils, S3ConfigError } from '@constructive-io/s3-utils';
|
|
8
9
|
import { ProvisionerError } from './types';
|
|
9
10
|
/**
|
|
10
11
|
* Create an S3Client from a storage connection config.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* Delegates to @constructive-io/s3-utils/createS3Client.
|
|
14
|
+
* This wrapper exists for backward compatibility — new code should
|
|
15
|
+
* import createS3Client from @constructive-io/s3-utils directly.
|
|
16
|
+
*
|
|
17
|
+
* Catches S3ConfigError from s3-utils and re-throws as ProvisionerError
|
|
18
|
+
* so existing consumers that catch ProvisionerError continue to work.
|
|
18
19
|
*/
|
|
19
20
|
export function createS3Client(config) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
if (!config.region) {
|
|
24
|
-
throw new ProvisionerError('INVALID_CONFIG', 'region is required');
|
|
21
|
+
try {
|
|
22
|
+
return createS3ClientFromUtils(config);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
throw new ProvisionerError('INVALID_CONFIG', `endpoint is required for provider '${config.provider}'`);
|
|
24
|
+
catch (err) {
|
|
25
|
+
if (err instanceof S3ConfigError) {
|
|
26
|
+
throw new ProvisionerError(err.code, err.message);
|
|
27
|
+
}
|
|
28
|
+
throw err;
|
|
32
29
|
}
|
|
33
|
-
return new S3Client({
|
|
34
|
-
region: config.region,
|
|
35
|
-
endpoint: config.endpoint,
|
|
36
|
-
forcePathStyle,
|
|
37
|
-
credentials: {
|
|
38
|
-
accessKeyId: config.accessKeyId,
|
|
39
|
-
secretAccessKey: config.secretAccessKey,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/bucket-provisioner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "S3-compatible bucket provisioning library — create buckets, configure privacy policies, CORS, and access controls",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-sdk/client-s3": "^3.1009.0"
|
|
32
|
+
"@aws-sdk/client-s3": "^3.1009.0",
|
|
33
|
+
"@constructive-io/s3-utils": "^2.12.1"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"makage": "^0.3.0"
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"storage",
|
|
44
45
|
"constructive"
|
|
45
46
|
],
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a8ccaed4f3a7c6c82495241ee1581700db9dd2dd"
|
|
47
48
|
}
|