@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.
Files changed (47) hide show
  1. package/README.md +2 -2
  2. package/agent-docs/README.md +1 -1
  3. package/agent-docs/astro.md +4 -4
  4. package/agent-docs/backend-client.md +5 -2
  5. package/agent-docs/configuration.md +3 -3
  6. package/agent-docs/express.md +5 -5
  7. package/agent-docs/fastify.md +5 -5
  8. package/agent-docs/hono.md +5 -5
  9. package/agent-docs/next.md +4 -4
  10. package/agent-docs/provider-azure-blob.md +15 -15
  11. package/agent-docs/provider-custom.md +13 -1
  12. package/agent-docs/provider-edgestore.md +3 -3
  13. package/agent-docs/provider-s3.md +120 -21
  14. package/agent-docs/remix.md +5 -5
  15. package/agent-docs/tanstack-start.md +5 -5
  16. package/agent-docs/troubleshooting.md +4 -4
  17. package/dist/adapters/dispatcher.d.ts.map +1 -1
  18. package/dist/adapters/dispatcher.js +10 -1
  19. package/dist/adapters/shared.d.ts +13 -1
  20. package/dist/adapters/shared.d.ts.map +1 -1
  21. package/dist/adapters/shared.js +96 -4
  22. package/dist/libs/env.d.ts.map +1 -1
  23. package/dist/libs/env.js +3 -0
  24. package/dist/libs/errors/EdgeStoreCredentialsError.js +1 -1
  25. package/dist/providers/azure-blob/index.d.ts +2 -2
  26. package/dist/providers/azure-blob/index.js +1 -1
  27. package/dist/providers/edgestore/index.d.ts +35 -2
  28. package/dist/providers/edgestore/index.d.ts.map +1 -1
  29. package/dist/providers/edgestore/index.js +16 -4
  30. package/dist/providers/s3/index.js +1 -1
  31. package/dist/providers/s3/options.d.ts +3 -3
  32. package/dist/providers/storage/multipartSession.js +2 -2
  33. package/dist/test-utils/edgestoreSmoke.d.ts.map +1 -1
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.d.ts.map +1 -1
  36. package/package.json +3 -3
  37. package/src/adapters/dispatcher.ts +14 -0
  38. package/src/adapters/shared.ts +100 -2
  39. package/src/libs/env.ts +9 -0
  40. package/src/libs/errors/EdgeStoreCredentialsError.ts +1 -1
  41. package/src/providers/azure-blob/index.ts +3 -3
  42. package/src/providers/edgestore/index.ts +13 -6
  43. package/src/providers/s3/index.ts +1 -1
  44. package/src/providers/s3/options.ts +3 -3
  45. package/src/providers/storage/multipartSession.ts +3 -3
  46. package/src/test-utils/edgestoreSmoke.ts +3 -5
  47. 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 `EDGE_STORE_ACCESS_KEY` environment variable is set.
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 `EDGE_STORE_SECRET_KEY` environment variable is set.
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('EDGE_STORE_BASE_URL');
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('EDGE_STORE_ACCESS_KEY');
355
- const secretKey = configuredSecretKey ?? getEnv('EDGE_STORE_SECRET_KEY');
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('EDGE_STORE_API_ENDPOINT');
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,
@@ -61,7 +61,7 @@ export function s3(options: S3ProviderOptions = {}) {
61
61
  });
62
62
  const baseUrl =
63
63
  options.baseUrl ??
64
- getEnv('EDGE_STORE_BASE_URL') ??
64
+ getEnv('EDGESTORE_BASE_URL') ??
65
65
  (endpoint
66
66
  ? `${endpoint.replace(/\/+$/, '')}/${bucketName}`
67
67
  : region
@@ -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 `EDGE_STORE_BASE_URL` environment variable.
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 EDGE_STORE_JWT_SECRET (or EDGE_STORE_SECRET_KEY).
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 `EDGE_STORE_JWT_SECRET` environment variable.
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('EDGE_STORE_JWT_SECRET') ??
46
- getEnv('EDGE_STORE_SECRET_KEY');
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 EDGE_STORE_JWT_SECRET.`,
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
- 'EDGE_STORE_ACCESS_KEY and EDGE_STORE_SECRET_KEY are required',
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-rc.6';
2
+ export const EDGE_STORE_PACKAGE_VERSION = '1.0.0';