@edgestore/server 0.3.2 → 0.3.3
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.
|
@@ -24,6 +24,17 @@ export type AWSProviderOptions = {
|
|
|
24
24
|
* Can also be set via the `ES_AWS_BUCKET_NAME` environment variable.
|
|
25
25
|
*/
|
|
26
26
|
bucketName?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Custom endpoint for S3-compatible storage providers (e.g., MinIO).
|
|
29
|
+
* Can also be set via the `ES_AWS_ENDPOINT` environment variable.
|
|
30
|
+
*/
|
|
31
|
+
endpoint?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Force path style for S3-compatible storage providers.
|
|
34
|
+
* Can also be set via the `ES_AWS_FORCE_PATH_STYLE` environment variable.
|
|
35
|
+
* Defaults to false for AWS S3, but should be true for most S3-compatible providers.
|
|
36
|
+
*/
|
|
37
|
+
forcePathStyle?: boolean;
|
|
27
38
|
/**
|
|
28
39
|
* Base URL to use for accessing files.
|
|
29
40
|
* Only needed if you are using a custom domain or cloudfront.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/aws/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/aws/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,QAAQ,CA8GlE"}
|
|
@@ -7,15 +7,17 @@ var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
|
7
7
|
var uuid = require('uuid');
|
|
8
8
|
|
|
9
9
|
function AWSProvider(options) {
|
|
10
|
-
const { accessKeyId = process.env.ES_AWS_ACCESS_KEY_ID, secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY, region = process.env.ES_AWS_REGION, bucketName = process.env.ES_AWS_BUCKET_NAME } = options ?? {};
|
|
11
|
-
const baseUrl = options?.baseUrl ?? process.env.EDGE_STORE_BASE_URL ?? `https://${bucketName}.s3.${region}.amazonaws.com
|
|
10
|
+
const { accessKeyId = process.env.ES_AWS_ACCESS_KEY_ID, secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY, region = process.env.ES_AWS_REGION, bucketName = process.env.ES_AWS_BUCKET_NAME, endpoint = process.env.ES_AWS_ENDPOINT, forcePathStyle = process.env.ES_AWS_FORCE_PATH_STYLE === 'true' } = options ?? {};
|
|
11
|
+
const baseUrl = options?.baseUrl ?? process.env.EDGE_STORE_BASE_URL ?? (endpoint ? `${endpoint}/${bucketName}` : `https://${bucketName}.s3.${region}.amazonaws.com`);
|
|
12
12
|
const credentials = accessKeyId && secretAccessKey ? {
|
|
13
13
|
accessKeyId,
|
|
14
14
|
secretAccessKey
|
|
15
15
|
} : undefined;
|
|
16
16
|
const s3Client = new clientS3.S3Client({
|
|
17
17
|
region,
|
|
18
|
-
credentials
|
|
18
|
+
credentials,
|
|
19
|
+
endpoint,
|
|
20
|
+
forcePathStyle
|
|
19
21
|
});
|
|
20
22
|
return {
|
|
21
23
|
async init () {
|
|
@@ -3,15 +3,17 @@ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
4
|
|
|
5
5
|
function AWSProvider(options) {
|
|
6
|
-
const { accessKeyId = process.env.ES_AWS_ACCESS_KEY_ID, secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY, region = process.env.ES_AWS_REGION, bucketName = process.env.ES_AWS_BUCKET_NAME } = options ?? {};
|
|
7
|
-
const baseUrl = options?.baseUrl ?? process.env.EDGE_STORE_BASE_URL ?? `https://${bucketName}.s3.${region}.amazonaws.com
|
|
6
|
+
const { accessKeyId = process.env.ES_AWS_ACCESS_KEY_ID, secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY, region = process.env.ES_AWS_REGION, bucketName = process.env.ES_AWS_BUCKET_NAME, endpoint = process.env.ES_AWS_ENDPOINT, forcePathStyle = process.env.ES_AWS_FORCE_PATH_STYLE === 'true' } = options ?? {};
|
|
7
|
+
const baseUrl = options?.baseUrl ?? process.env.EDGE_STORE_BASE_URL ?? (endpoint ? `${endpoint}/${bucketName}` : `https://${bucketName}.s3.${region}.amazonaws.com`);
|
|
8
8
|
const credentials = accessKeyId && secretAccessKey ? {
|
|
9
9
|
accessKeyId,
|
|
10
10
|
secretAccessKey
|
|
11
11
|
} : undefined;
|
|
12
12
|
const s3Client = new S3Client({
|
|
13
13
|
region,
|
|
14
|
-
credentials
|
|
14
|
+
credentials,
|
|
15
|
+
endpoint,
|
|
16
|
+
forcePathStyle
|
|
15
17
|
});
|
|
16
18
|
return {
|
|
17
19
|
async init () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgestore/server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Upload files with ease from React/Next.js",
|
|
5
5
|
"homepage": "https://edgestore.dev",
|
|
6
6
|
"repository": "https://github.com/edgestorejs/edgestore.git",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
"license": "MIT",
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@edgestore/shared": "0.3.
|
|
92
|
+
"@edgestore/shared": "0.3.3",
|
|
93
93
|
"@panva/hkdf": "^1.0.4",
|
|
94
94
|
"cookie": "^0.5.0",
|
|
95
95
|
"jose": "^4.13.1",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"typescript": "^5.1.6",
|
|
129
129
|
"zod": "3.21.4"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "9bc2c36ee2463f79c26cb39cfc69dc77b7569a21"
|
|
132
132
|
}
|
|
@@ -33,6 +33,17 @@ export type AWSProviderOptions = {
|
|
|
33
33
|
* Can also be set via the `ES_AWS_BUCKET_NAME` environment variable.
|
|
34
34
|
*/
|
|
35
35
|
bucketName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Custom endpoint for S3-compatible storage providers (e.g., MinIO).
|
|
38
|
+
* Can also be set via the `ES_AWS_ENDPOINT` environment variable.
|
|
39
|
+
*/
|
|
40
|
+
endpoint?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Force path style for S3-compatible storage providers.
|
|
43
|
+
* Can also be set via the `ES_AWS_FORCE_PATH_STYLE` environment variable.
|
|
44
|
+
* Defaults to false for AWS S3, but should be true for most S3-compatible providers.
|
|
45
|
+
*/
|
|
46
|
+
forcePathStyle?: boolean;
|
|
36
47
|
/**
|
|
37
48
|
* Base URL to use for accessing files.
|
|
38
49
|
* Only needed if you are using a custom domain or cloudfront.
|
|
@@ -55,12 +66,16 @@ export function AWSProvider(options?: AWSProviderOptions): Provider {
|
|
|
55
66
|
secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY,
|
|
56
67
|
region = process.env.ES_AWS_REGION,
|
|
57
68
|
bucketName = process.env.ES_AWS_BUCKET_NAME,
|
|
69
|
+
endpoint = process.env.ES_AWS_ENDPOINT,
|
|
70
|
+
forcePathStyle = process.env.ES_AWS_FORCE_PATH_STYLE === 'true',
|
|
58
71
|
} = options ?? {};
|
|
59
72
|
|
|
60
73
|
const baseUrl =
|
|
61
74
|
options?.baseUrl ??
|
|
62
75
|
process.env.EDGE_STORE_BASE_URL ??
|
|
63
|
-
|
|
76
|
+
(endpoint
|
|
77
|
+
? `${endpoint}/${bucketName}`
|
|
78
|
+
: `https://${bucketName}.s3.${region}.amazonaws.com`);
|
|
64
79
|
|
|
65
80
|
const credentials =
|
|
66
81
|
accessKeyId && secretAccessKey
|
|
@@ -69,7 +84,12 @@ export function AWSProvider(options?: AWSProviderOptions): Provider {
|
|
|
69
84
|
secretAccessKey,
|
|
70
85
|
}
|
|
71
86
|
: undefined;
|
|
72
|
-
const s3Client = new S3Client({
|
|
87
|
+
const s3Client = new S3Client({
|
|
88
|
+
region,
|
|
89
|
+
credentials,
|
|
90
|
+
endpoint,
|
|
91
|
+
forcePathStyle,
|
|
92
|
+
});
|
|
73
93
|
|
|
74
94
|
return {
|
|
75
95
|
async init() {
|