@edgestore/server 1.0.0-rc.6 → 1.0.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 +2 -2
- package/agent-docs/README.md +1 -1
- package/agent-docs/astro.md +4 -4
- package/agent-docs/backend-client.md +5 -2
- package/agent-docs/configuration.md +3 -3
- package/agent-docs/express.md +5 -5
- package/agent-docs/fastify.md +5 -5
- package/agent-docs/hono.md +5 -5
- package/agent-docs/next.md +4 -4
- package/agent-docs/provider-azure-blob.md +15 -15
- package/agent-docs/provider-custom.md +13 -1
- package/agent-docs/provider-edgestore.md +3 -3
- package/agent-docs/provider-s3.md +120 -21
- package/agent-docs/remix.md +5 -5
- package/agent-docs/tanstack-start.md +5 -5
- package/agent-docs/troubleshooting.md +4 -4
- package/dist/adapters/dispatcher.d.ts.map +1 -1
- package/dist/adapters/dispatcher.js +10 -1
- package/dist/adapters/shared.d.ts +13 -1
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/adapters/shared.js +96 -4
- package/dist/libs/env.d.ts.map +1 -1
- package/dist/libs/env.js +3 -0
- package/dist/libs/errors/EdgeStoreCredentialsError.js +1 -1
- package/dist/providers/azure-blob/index.d.ts +2 -2
- package/dist/providers/azure-blob/index.js +1 -1
- package/dist/providers/edgestore/index.d.ts +35 -2
- package/dist/providers/edgestore/index.d.ts.map +1 -1
- package/dist/providers/edgestore/index.js +16 -4
- package/dist/providers/s3/index.js +1 -1
- package/dist/providers/s3/options.d.ts +3 -3
- package/dist/providers/storage/multipartSession.js +2 -2
- package/dist/test-utils/edgestoreSmoke.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/adapters/dispatcher.ts +14 -0
- package/src/adapters/shared.ts +100 -2
- package/src/libs/env.ts +9 -0
- package/src/libs/errors/EdgeStoreCredentialsError.ts +1 -1
- package/src/providers/azure-blob/index.ts +3 -3
- package/src/providers/edgestore/index.ts +13 -6
- package/src/providers/s3/index.ts +1 -1
- package/src/providers/s3/options.ts +3 -3
- package/src/providers/storage/multipartSession.ts +3 -3
- package/src/test-utils/edgestoreSmoke.ts +3 -5
- package/src/version.ts +1 -1
|
@@ -41,14 +41,14 @@ type EdgeStoreProjectProviderOptions = {
|
|
|
41
41
|
* Access key for your EdgeStore project.
|
|
42
42
|
* Can be found in the EdgeStore dashboard.
|
|
43
43
|
*
|
|
44
|
-
* This can be omitted if the `
|
|
44
|
+
* This can be omitted if the `EDGESTORE_ACCESS_KEY` environment variable is set.
|
|
45
45
|
*/
|
|
46
46
|
accessKey?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Secret key for your EdgeStore project.
|
|
49
49
|
* Can be found in the EdgeStore dashboard.
|
|
50
50
|
*
|
|
51
|
-
* This can be omitted if the `
|
|
51
|
+
* This can be omitted if the `EDGESTORE_SECRET_KEY` environment variable is set.
|
|
52
52
|
*/
|
|
53
53
|
secretKey?: string;
|
|
54
54
|
token?: never;
|
|
@@ -110,7 +110,7 @@ export function edgestore(options?: EdgeStoreProviderOptions) {
|
|
|
110
110
|
]),
|
|
111
111
|
),
|
|
112
112
|
});
|
|
113
|
-
const overrideBaseUrl = getEnv('
|
|
113
|
+
const overrideBaseUrl = getEnv('EDGESTORE_BASE_URL');
|
|
114
114
|
return {
|
|
115
115
|
clientInit: {
|
|
116
116
|
urls:
|
|
@@ -191,6 +191,12 @@ export function edgestore(options?: EdgeStoreProviderOptions) {
|
|
|
191
191
|
await runtime.uploads.cancel({ uploadId });
|
|
192
192
|
},
|
|
193
193
|
},
|
|
194
|
+
getStatus: async ({ id }) => {
|
|
195
|
+
const result = await runtime.uploads.get({ uploadId: id });
|
|
196
|
+
return 'file' in result
|
|
197
|
+
? { status: 'completed', file: result.file }
|
|
198
|
+
: { status: result.upload.status };
|
|
199
|
+
},
|
|
194
200
|
upload: async ({
|
|
195
201
|
bucketName,
|
|
196
202
|
bucketType,
|
|
@@ -351,8 +357,8 @@ function resolveProviderAuthentication(
|
|
|
351
357
|
);
|
|
352
358
|
}
|
|
353
359
|
|
|
354
|
-
const accessKey = configuredAccessKey ?? getEnv('
|
|
355
|
-
const secretKey = configuredSecretKey ?? getEnv('
|
|
360
|
+
const accessKey = configuredAccessKey ?? getEnv('EDGESTORE_ACCESS_KEY');
|
|
361
|
+
const secretKey = configuredSecretKey ?? getEnv('EDGESTORE_SECRET_KEY');
|
|
356
362
|
|
|
357
363
|
if (
|
|
358
364
|
typeof accessKey !== 'string' ||
|
|
@@ -399,7 +405,7 @@ function mapMutationResult<TErrorCode extends string>(result: {
|
|
|
399
405
|
}
|
|
400
406
|
|
|
401
407
|
function getApiUrl() {
|
|
402
|
-
const configured = getEnv('
|
|
408
|
+
const configured = getEnv('EDGESTORE_API_ENDPOINT');
|
|
403
409
|
if (!configured) return undefined;
|
|
404
410
|
const base = configured.replace(/\/+$/, '');
|
|
405
411
|
return base.endsWith('/v2') ? base : `${base}/v2`;
|
|
@@ -453,6 +459,7 @@ function mapUploadResponse(
|
|
|
453
459
|
multipartConfig?: { partSize: number; totalParts: number },
|
|
454
460
|
): RequestUploadRes {
|
|
455
461
|
const access = {
|
|
462
|
+
id: res.file.id,
|
|
456
463
|
key: res.file.key,
|
|
457
464
|
url: res.file.url,
|
|
458
465
|
thumbnailUrl: res.file.thumbnailUrl,
|
|
@@ -58,15 +58,15 @@ export type S3ProviderOptions = {
|
|
|
58
58
|
* Base URL to use for accessing files.
|
|
59
59
|
* Only needed if you are using a custom domain or cloudfront.
|
|
60
60
|
*
|
|
61
|
-
* It can also be set via the `
|
|
61
|
+
* It can also be set via the `EDGESTORE_BASE_URL` environment variable.
|
|
62
62
|
*/
|
|
63
63
|
baseUrl?: string;
|
|
64
64
|
/**
|
|
65
65
|
* Secret used to sign multipart upload sessions. The adapter context cookie
|
|
66
|
-
* still requires
|
|
66
|
+
* still requires EDGESTORE_JWT_SECRET (or EDGESTORE_SECRET_KEY).
|
|
67
67
|
* Can be generated with `openssl rand -base64 32`.
|
|
68
68
|
*
|
|
69
|
-
* It can also be set via the `
|
|
69
|
+
* It can also be set via the `EDGESTORE_JWT_SECRET` environment variable.
|
|
70
70
|
*/
|
|
71
71
|
jwtSecret?: string;
|
|
72
72
|
/**
|
|
@@ -42,11 +42,11 @@ export function createMultipartSessions({
|
|
|
42
42
|
function signingKey() {
|
|
43
43
|
const value =
|
|
44
44
|
secret ??
|
|
45
|
-
getEnv('
|
|
46
|
-
getEnv('
|
|
45
|
+
getEnv('EDGESTORE_JWT_SECRET') ??
|
|
46
|
+
getEnv('EDGESTORE_SECRET_KEY');
|
|
47
47
|
if (!value)
|
|
48
48
|
throw new Error(
|
|
49
|
-
`${providerName} multipart uploads require jwtSecret or
|
|
49
|
+
`${providerName} multipart uploads require jwtSecret or EDGESTORE_JWT_SECRET.`,
|
|
50
50
|
);
|
|
51
51
|
return new TextEncoder().encode(value);
|
|
52
52
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { getEnv } from '../libs/env';
|
|
2
3
|
|
|
3
4
|
export const SMOKE_CONTENT = 'edgestore smoke test';
|
|
4
5
|
|
|
@@ -11,12 +12,9 @@ export function createSmokeFileName(prefix: string) {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export function requireSmokeCredentials() {
|
|
14
|
-
if (
|
|
15
|
-
!process.env.EDGE_STORE_ACCESS_KEY ||
|
|
16
|
-
!process.env.EDGE_STORE_SECRET_KEY
|
|
17
|
-
) {
|
|
15
|
+
if (!getEnv('EDGESTORE_ACCESS_KEY') || !getEnv('EDGESTORE_SECRET_KEY')) {
|
|
18
16
|
throw new Error(
|
|
19
|
-
'
|
|
17
|
+
'EDGESTORE_ACCESS_KEY and EDGESTORE_SECRET_KEY are required',
|
|
20
18
|
);
|
|
21
19
|
}
|
|
22
20
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const EDGE_STORE_PACKAGE_NAME = '@edgestore/server';
|
|
2
|
-
export const EDGE_STORE_PACKAGE_VERSION = '1.0.0
|
|
2
|
+
export const EDGE_STORE_PACKAGE_VERSION = '1.0.0';
|