@constructive-io/s3-utils 2.33.0 → 2.34.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/README.md +5 -5
- package/client.d.ts +9 -9
- package/client.js +5 -5
- package/esm/client.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Unified S3 utilities for the Constructive ecosystem — client factory, file ope
|
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **Multi-provider support** — AWS S3,
|
|
19
|
+
- **Multi-provider support** — AWS S3, RustFS (or any S3-compatible store), MinIO, Cloudflare R2, Google Cloud Storage, DigitalOcean Spaces
|
|
20
20
|
- **Presigned URLs** — generate secure PUT and GET URLs with configurable expiry
|
|
21
21
|
- **File operations** — streaming upload, download, existence checks, and metadata retrieval
|
|
22
22
|
- **Bucket management** — create buckets with provider-appropriate policies and CORS
|
|
@@ -43,9 +43,9 @@ import {
|
|
|
43
43
|
const client = createS3Client({
|
|
44
44
|
provider: 'minio',
|
|
45
45
|
region: 'us-east-1',
|
|
46
|
-
endpoint: 'http://
|
|
47
|
-
accessKeyId: '
|
|
48
|
-
secretAccessKey: '
|
|
46
|
+
endpoint: 'http://rustfs:9000',
|
|
47
|
+
accessKeyId: 'constructive',
|
|
48
|
+
secretAccessKey: 'constructive-dev-secret',
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// 2. Upload a file via stream
|
|
@@ -198,7 +198,7 @@ someReadable.pipe(pass);
|
|
|
198
198
|
|
|
199
199
|
Creates a bucket with provider-appropriate policies and CORS configuration.
|
|
200
200
|
|
|
201
|
-
- **MinIO**: read-only public access policy (list + get)
|
|
201
|
+
- **Path-style S3-compatible (`minio`, covering RustFS and MinIO)**: read-only public access policy (list + get)
|
|
202
202
|
- **RustFS/S3/GCS**: full-access policy with CORS rules for browser uploads
|
|
203
203
|
|
|
204
204
|
```typescript
|
package/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* instead of wiring up @aws-sdk/client-s3 directly.
|
|
7
7
|
*
|
|
8
8
|
* Handles provider-specific defaults:
|
|
9
|
-
* - minio: forces path-style URLs, requires endpoint
|
|
9
|
+
* - minio: forces path-style URLs, requires endpoint (RustFS or MinIO)
|
|
10
10
|
* - rustfs: forces path-style URLs, requires endpoint
|
|
11
11
|
* - r2: forces path-style URLs, requires endpoint
|
|
12
12
|
* - gcs: forces path-style URLs, requires endpoint
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* const client = createS3Client({
|
|
21
21
|
* provider: 'minio',
|
|
22
22
|
* region: 'us-east-1',
|
|
23
|
-
* endpoint: 'http://
|
|
24
|
-
* accessKeyId: '
|
|
25
|
-
* secretAccessKey: '
|
|
23
|
+
* endpoint: 'http://rustfs:9000',
|
|
24
|
+
* accessKeyId: 'constructive',
|
|
25
|
+
* secretAccessKey: 'constructive-dev-secret',
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
@@ -30,7 +30,7 @@ import { S3Client } from '@aws-sdk/client-s3';
|
|
|
30
30
|
/**
|
|
31
31
|
* Supported storage provider identifiers.
|
|
32
32
|
*
|
|
33
|
-
* Used to select provider-specific behavior (e.g., path-style URLs for MinIO,
|
|
33
|
+
* Used to select provider-specific behavior (e.g., path-style URLs for RustFS or MinIO,
|
|
34
34
|
* jurisdiction headers for R2).
|
|
35
35
|
*/
|
|
36
36
|
export type StorageProvider = 's3' | 'minio' | 'rustfs' | 'r2' | 'gcs' | 'spaces';
|
|
@@ -39,20 +39,20 @@ export type StorageProvider = 's3' | 'minio' | 'rustfs' | 'r2' | 'gcs' | 'spaces
|
|
|
39
39
|
*
|
|
40
40
|
* This is the input you provide to connect to your storage provider.
|
|
41
41
|
* For AWS S3, only `region` and credentials are needed.
|
|
42
|
-
* For MinIO/
|
|
42
|
+
* For RustFS/MinIO/R2/etc., also provide `endpoint`.
|
|
43
43
|
*/
|
|
44
44
|
export interface StorageConnectionConfig {
|
|
45
45
|
/** Storage provider type */
|
|
46
46
|
provider: StorageProvider;
|
|
47
47
|
/** S3 region (e.g., "us-east-1"). Required for AWS S3. */
|
|
48
48
|
region: string;
|
|
49
|
-
/** S3-compatible endpoint URL (e.g., "http://
|
|
49
|
+
/** S3-compatible endpoint URL (e.g., "http://rustfs:9000"). Required for non-AWS providers. */
|
|
50
50
|
endpoint?: string;
|
|
51
51
|
/** AWS access key ID */
|
|
52
52
|
accessKeyId: string;
|
|
53
53
|
/** AWS secret access key */
|
|
54
54
|
secretAccessKey: string;
|
|
55
|
-
/** Use path-style URLs (required for MinIO, optional for others) */
|
|
55
|
+
/** Use path-style URLs (required for RustFS and MinIO, optional for others) */
|
|
56
56
|
forcePathStyle?: boolean;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -66,7 +66,7 @@ export declare class S3ConfigError extends Error {
|
|
|
66
66
|
* Create an S3Client from a storage connection config.
|
|
67
67
|
*
|
|
68
68
|
* Provider-specific defaults:
|
|
69
|
-
* - `minio`:
|
|
69
|
+
* - `minio`: path-style S3-compatible storage (RustFS or MinIO)
|
|
70
70
|
* - `rustfs`: forces path-style URLs
|
|
71
71
|
* - `r2`: forces path-style URLs (required by Cloudflare R2)
|
|
72
72
|
* - `s3`: uses virtual-hosted style (AWS default)
|
package/client.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* instead of wiring up @aws-sdk/client-s3 directly.
|
|
8
8
|
*
|
|
9
9
|
* Handles provider-specific defaults:
|
|
10
|
-
* - minio: forces path-style URLs, requires endpoint
|
|
10
|
+
* - minio: forces path-style URLs, requires endpoint (RustFS or MinIO)
|
|
11
11
|
* - rustfs: forces path-style URLs, requires endpoint
|
|
12
12
|
* - r2: forces path-style URLs, requires endpoint
|
|
13
13
|
* - gcs: forces path-style URLs, requires endpoint
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
* const client = createS3Client({
|
|
22
22
|
* provider: 'minio',
|
|
23
23
|
* region: 'us-east-1',
|
|
24
|
-
* endpoint: 'http://
|
|
25
|
-
* accessKeyId: '
|
|
26
|
-
* secretAccessKey: '
|
|
24
|
+
* endpoint: 'http://rustfs:9000',
|
|
25
|
+
* accessKeyId: 'constructive',
|
|
26
|
+
* secretAccessKey: 'constructive-dev-secret',
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
@@ -49,7 +49,7 @@ exports.S3ConfigError = S3ConfigError;
|
|
|
49
49
|
* Create an S3Client from a storage connection config.
|
|
50
50
|
*
|
|
51
51
|
* Provider-specific defaults:
|
|
52
|
-
* - `minio`:
|
|
52
|
+
* - `minio`: path-style S3-compatible storage (RustFS or MinIO)
|
|
53
53
|
* - `rustfs`: forces path-style URLs
|
|
54
54
|
* - `r2`: forces path-style URLs (required by Cloudflare R2)
|
|
55
55
|
* - `s3`: uses virtual-hosted style (AWS default)
|
package/esm/client.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* instead of wiring up @aws-sdk/client-s3 directly.
|
|
7
7
|
*
|
|
8
8
|
* Handles provider-specific defaults:
|
|
9
|
-
* - minio: forces path-style URLs, requires endpoint
|
|
9
|
+
* - minio: forces path-style URLs, requires endpoint (RustFS or MinIO)
|
|
10
10
|
* - rustfs: forces path-style URLs, requires endpoint
|
|
11
11
|
* - r2: forces path-style URLs, requires endpoint
|
|
12
12
|
* - gcs: forces path-style URLs, requires endpoint
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* const client = createS3Client({
|
|
21
21
|
* provider: 'minio',
|
|
22
22
|
* region: 'us-east-1',
|
|
23
|
-
* endpoint: 'http://
|
|
24
|
-
* accessKeyId: '
|
|
25
|
-
* secretAccessKey: '
|
|
23
|
+
* endpoint: 'http://rustfs:9000',
|
|
24
|
+
* accessKeyId: 'constructive',
|
|
25
|
+
* secretAccessKey: 'constructive-dev-secret',
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
@@ -44,7 +44,7 @@ export class S3ConfigError extends Error {
|
|
|
44
44
|
* Create an S3Client from a storage connection config.
|
|
45
45
|
*
|
|
46
46
|
* Provider-specific defaults:
|
|
47
|
-
* - `minio`:
|
|
47
|
+
* - `minio`: path-style S3-compatible storage (RustFS or MinIO)
|
|
48
48
|
* - `rustfs`: forces path-style URLs
|
|
49
49
|
* - `r2`: forces path-style URLs (required by Cloudflare R2)
|
|
50
50
|
* - `s3`: uses virtual-hosted style (AWS default)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/s3-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.0",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "Unified S3 utilities — client factory, file operations, presigned URLs",
|
|
6
6
|
"main": "index.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@types/node": "^22.19.11",
|
|
39
39
|
"makage": "^0.8.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "baa84094b8541eb5000701b0060aa5b298032dc7"
|
|
42
42
|
}
|