@edgestore/server 0.3.3 → 0.5.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 (83) hide show
  1. package/README.md +3 -3
  2. package/adapters/astro/index.d.ts +1 -0
  3. package/adapters/astro/index.js +1 -0
  4. package/adapters/fastify/index.d.ts +1 -0
  5. package/adapters/fastify/index.js +1 -0
  6. package/adapters/hono/index.d.ts +1 -0
  7. package/adapters/hono/index.js +1 -0
  8. package/adapters/remix/index.d.ts +1 -0
  9. package/adapters/remix/index.js +1 -0
  10. package/dist/adapters/astro/index.d.ts +14 -0
  11. package/dist/adapters/astro/index.d.ts.map +1 -0
  12. package/dist/adapters/astro/index.js +183 -0
  13. package/dist/adapters/astro/index.mjs +179 -0
  14. package/dist/adapters/express/index.js +4 -4
  15. package/dist/adapters/express/index.mjs +4 -4
  16. package/dist/adapters/fastify/index.d.ts +18 -0
  17. package/dist/adapters/fastify/index.d.ts.map +1 -0
  18. package/dist/adapters/fastify/index.js +147 -0
  19. package/dist/adapters/fastify/index.mjs +143 -0
  20. package/dist/adapters/hono/index.d.ts +82 -0
  21. package/dist/adapters/hono/index.d.ts.map +1 -0
  22. package/dist/adapters/hono/index.js +137 -0
  23. package/dist/adapters/hono/index.mjs +133 -0
  24. package/dist/adapters/next/app/index.js +4 -4
  25. package/dist/adapters/next/app/index.mjs +4 -4
  26. package/dist/adapters/next/pages/index.js +4 -4
  27. package/dist/adapters/next/pages/index.mjs +4 -4
  28. package/dist/adapters/remix/index.d.ts +18 -0
  29. package/dist/adapters/remix/index.d.ts.map +1 -0
  30. package/dist/adapters/remix/index.js +158 -0
  31. package/dist/adapters/remix/index.mjs +154 -0
  32. package/dist/adapters/shared.d.ts +2 -0
  33. package/dist/adapters/shared.d.ts.map +1 -1
  34. package/dist/adapters/start/index.d.ts.map +1 -1
  35. package/dist/adapters/start/index.js +4 -4
  36. package/dist/adapters/start/index.mjs +4 -4
  37. package/dist/core/client/index.d.ts +1 -1
  38. package/dist/core/client/index.d.ts.map +1 -1
  39. package/dist/core/index.js +3 -3
  40. package/dist/core/index.mjs +4 -4
  41. package/dist/core/sdk/index.d.ts +4 -4
  42. package/dist/core/sdk/index.d.ts.map +1 -1
  43. package/dist/{index-28efdacf.mjs → index-2848cb40.mjs} +4 -3
  44. package/dist/{index-beed799d.js → index-421c502f.js} +4 -3
  45. package/dist/{index-4491caf0.js → index-7b259533.js} +6 -5
  46. package/dist/libs/logger.d.ts +1 -1
  47. package/dist/libs/logger.d.ts.map +1 -1
  48. package/dist/providers/aws/index.d.ts.map +1 -1
  49. package/dist/providers/aws/index.js +7 -2
  50. package/dist/providers/aws/index.mjs +7 -2
  51. package/dist/providers/azure/index.d.ts.map +1 -1
  52. package/dist/providers/azure/index.js +6 -1
  53. package/dist/providers/azure/index.mjs +6 -1
  54. package/dist/providers/edgestore/index.d.ts.map +1 -1
  55. package/dist/providers/edgestore/index.js +13 -6
  56. package/dist/providers/edgestore/index.mjs +10 -3
  57. package/dist/{shared-83f288f6.js → shared-25dbfab4.js} +19 -6
  58. package/dist/{shared-039276af.mjs → shared-4b199b96.mjs} +17 -5
  59. package/dist/{shared-7c700083.js → shared-685c8a0c.js} +18 -4
  60. package/dist/{utils-5819d5e1.js → utils-0aab6e3b.js} +3 -1
  61. package/dist/{utils-f6f56d38.mjs → utils-7349adab.mjs} +3 -1
  62. package/dist/{utils-461a2e3b.js → utils-b3d35894.js} +3 -2
  63. package/package.json +31 -8
  64. package/src/adapters/astro/index.ts +222 -0
  65. package/src/adapters/express/index.ts +1 -1
  66. package/src/adapters/fastify/index.ts +205 -0
  67. package/src/adapters/hono/index.ts +195 -0
  68. package/src/adapters/next/app/index.ts +1 -1
  69. package/src/adapters/next/pages/index.ts +1 -1
  70. package/src/adapters/remix/index.ts +201 -0
  71. package/src/adapters/shared.ts +21 -4
  72. package/src/adapters/start/index.ts +1 -1
  73. package/src/core/client/index.ts +11 -3
  74. package/src/core/sdk/index.ts +4 -3
  75. package/src/libs/errors/EdgeStoreCredentialsError.ts +1 -1
  76. package/src/libs/logger.ts +4 -3
  77. package/src/providers/aws/index.ts +8 -7
  78. package/src/providers/azure/index.ts +5 -4
  79. package/src/providers/edgestore/index.ts +8 -3
  80. package/adapters/index.d.ts +0 -1
  81. package/adapters/index.js +0 -1
  82. package/providers/index.d.ts +0 -1
  83. package/providers/index.js +0 -1
@@ -0,0 +1,201 @@
1
+ import {
2
+ EDGE_STORE_ERROR_CODES,
3
+ EdgeStoreError,
4
+ type EdgeStoreErrorCodeKey,
5
+ type EdgeStoreRouter,
6
+ type MaybePromise,
7
+ type Provider,
8
+ } from '@edgestore/shared';
9
+ import Logger, { type LogLevel } from '../../libs/logger';
10
+ import { matchPath } from '../../libs/utils';
11
+ import { EdgeStoreProvider } from '../../providers/edgestore';
12
+ import {
13
+ completeMultipartUpload,
14
+ confirmUpload,
15
+ deleteFile,
16
+ init,
17
+ requestUpload,
18
+ requestUploadParts,
19
+ type CompleteMultipartUploadBody,
20
+ type ConfirmUploadBody,
21
+ type DeleteFileBody,
22
+ type RequestUploadBody,
23
+ type RequestUploadPartsParams,
24
+ } from '../shared';
25
+
26
+ export type CreateContextOptions = {
27
+ req: Request;
28
+ };
29
+
30
+ export type Config<TCtx> = {
31
+ provider?: Provider;
32
+ router: EdgeStoreRouter<TCtx>;
33
+ logLevel?: LogLevel;
34
+ } & (TCtx extends Record<string, never>
35
+ ? object
36
+ : {
37
+ provider?: Provider;
38
+ router: EdgeStoreRouter<TCtx>;
39
+ createContext: (opts: CreateContextOptions) => MaybePromise<TCtx>;
40
+ });
41
+
42
+ declare const globalThis: {
43
+ _EDGE_STORE_LOGGER: Logger;
44
+ };
45
+
46
+ // Helper to safely get cookies from Remix request
47
+ function getCookie(req: Request, name: string): string | undefined {
48
+ const cookieHeader = req.headers.get('cookie');
49
+ if (!cookieHeader) return undefined;
50
+
51
+ const cookies = cookieHeader
52
+ .split(';')
53
+ .reduce<Record<string, string>>((acc, cookie) => {
54
+ const [key, value] = cookie.trim().split('=');
55
+ if (key && value) acc[key] = value;
56
+ return acc;
57
+ }, {});
58
+
59
+ return cookies[name];
60
+ }
61
+
62
+ export function createEdgeStoreRemixHandler<TCtx>(config: Config<TCtx>) {
63
+ const { provider = EdgeStoreProvider() } = config;
64
+ const log = new Logger(config.logLevel);
65
+ globalThis._EDGE_STORE_LOGGER = log;
66
+ log.debug('Creating EdgeStore Remix handler');
67
+
68
+ return async ({ request: req }: { request: Request }) => {
69
+ try {
70
+ const url = new URL(req.url);
71
+ const pathname = url.pathname;
72
+
73
+ if (matchPath(pathname, '/health')) {
74
+ return new Response('OK');
75
+ } else if (matchPath(pathname, '/init')) {
76
+ let ctx = {} as TCtx;
77
+ try {
78
+ ctx =
79
+ 'createContext' in config
80
+ ? await config.createContext({ req })
81
+ : ({} as TCtx);
82
+ } catch (err) {
83
+ throw new EdgeStoreError({
84
+ message: 'Error creating context',
85
+ code: 'CREATE_CONTEXT_ERROR',
86
+ cause: err instanceof Error ? err : undefined,
87
+ });
88
+ }
89
+ const { newCookies, token, baseUrl } = await init({
90
+ ctx,
91
+ provider,
92
+ router: config.router,
93
+ });
94
+
95
+ // Create response with cookies and token
96
+ const responseHeaders = new Headers();
97
+
98
+ if (Array.isArray(newCookies)) {
99
+ for (const cookie of newCookies) {
100
+ responseHeaders.append('Set-Cookie', cookie);
101
+ }
102
+ } else if (newCookies) {
103
+ responseHeaders.append('Set-Cookie', newCookies);
104
+ }
105
+
106
+ return new Response(JSON.stringify({ token, baseUrl }), {
107
+ headers: responseHeaders,
108
+ status: 200,
109
+ });
110
+ } else if (matchPath(pathname, '/request-upload')) {
111
+ const body = (await req.json()) as RequestUploadBody;
112
+ return Response.json(
113
+ await requestUpload({
114
+ provider,
115
+ router: config.router,
116
+ body,
117
+ ctxToken: getCookie(req, 'edgestore-ctx'),
118
+ }),
119
+ );
120
+ } else if (matchPath(pathname, '/request-upload-parts')) {
121
+ const body = (await req.json()) as RequestUploadPartsParams;
122
+ return Response.json(
123
+ await requestUploadParts({
124
+ provider,
125
+ router: config.router,
126
+ body,
127
+ ctxToken: getCookie(req, 'edgestore-ctx'),
128
+ }),
129
+ );
130
+ } else if (matchPath(pathname, '/complete-multipart-upload')) {
131
+ const body = (await req.json()) as CompleteMultipartUploadBody;
132
+ await completeMultipartUpload({
133
+ provider,
134
+ router: config.router,
135
+ body,
136
+ ctxToken: getCookie(req, 'edgestore-ctx'),
137
+ });
138
+ return new Response(null, { status: 200 });
139
+ } else if (matchPath(pathname, '/confirm-upload')) {
140
+ const body = (await req.json()) as ConfirmUploadBody;
141
+ return Response.json(
142
+ await confirmUpload({
143
+ provider,
144
+ router: config.router,
145
+ body,
146
+ ctxToken: getCookie(req, 'edgestore-ctx'),
147
+ }),
148
+ );
149
+ } else if (matchPath(pathname, '/delete-file')) {
150
+ const body = (await req.json()) as DeleteFileBody;
151
+ return Response.json(
152
+ await deleteFile({
153
+ provider,
154
+ router: config.router,
155
+ body,
156
+ ctxToken: getCookie(req, 'edgestore-ctx'),
157
+ }),
158
+ );
159
+ } else if (matchPath(pathname, '/proxy-file')) {
160
+ const url = new URL(req.url).searchParams.get('url');
161
+ if (typeof url === 'string') {
162
+ const proxyRes = await fetch(url, {
163
+ headers: {
164
+ cookie: req.headers.get('cookie') ?? '',
165
+ },
166
+ });
167
+
168
+ const data = await proxyRes.arrayBuffer();
169
+ const headers = new Headers();
170
+ headers.set(
171
+ 'Content-Type',
172
+ proxyRes.headers.get('Content-Type') ?? 'application/octet-stream',
173
+ );
174
+
175
+ return new Response(data, { headers });
176
+ } else {
177
+ return new Response(null, { status: 400 });
178
+ }
179
+ } else {
180
+ return new Response(null, { status: 404 });
181
+ }
182
+ } catch (err) {
183
+ if (err instanceof EdgeStoreError) {
184
+ log[err.level](err.formattedMessage());
185
+ if (err.cause) log[err.level](err.cause);
186
+ return Response.json(err.formattedJson(), {
187
+ status: EDGE_STORE_ERROR_CODES[err.code as EdgeStoreErrorCodeKey],
188
+ });
189
+ } else {
190
+ log.error(err);
191
+ return Response.json(
192
+ new EdgeStoreError({
193
+ message: 'Internal Server Error',
194
+ code: 'SERVER_ERROR',
195
+ }).formattedJson(),
196
+ { status: 500 },
197
+ );
198
+ }
199
+ }
200
+ };
201
+ }
@@ -434,7 +434,7 @@ export async function deleteFile<TCtx>(params: {
434
434
 
435
435
  async function encryptJWT(ctx: any) {
436
436
  const secret =
437
- process.env.EDGE_STORE_JWT_SECRET ?? process.env.EDGE_STORE_SECRET_KEY;
437
+ getEnv('EDGE_STORE_JWT_SECRET') ?? getEnv('EDGE_STORE_SECRET_KEY');
438
438
  if (!secret) {
439
439
  throw new EdgeStoreError({
440
440
  message: 'EDGE_STORE_JWT_SECRET or EDGE_STORE_SECRET_KEY is not defined',
@@ -452,7 +452,7 @@ async function encryptJWT(ctx: any) {
452
452
 
453
453
  async function decryptJWT(token: string) {
454
454
  const secret =
455
- process.env.EDGE_STORE_JWT_SECRET ?? process.env.EDGE_STORE_SECRET_KEY;
455
+ getEnv('EDGE_STORE_JWT_SECRET') ?? getEnv('EDGE_STORE_SECRET_KEY');
456
456
  if (!secret) {
457
457
  throw new EdgeStoreError({
458
458
  message: 'EDGE_STORE_JWT_SECRET or EDGE_STORE_SECRET_KEY is not defined',
@@ -471,7 +471,7 @@ async function getDerivedEncryptionKey(secret: string) {
471
471
  'sha256',
472
472
  secret,
473
473
  '',
474
- 'Edge Store Generated Encryption Key',
474
+ 'EdgeStore Generated Encryption Key',
475
475
  32,
476
476
  );
477
477
  }
@@ -539,7 +539,7 @@ async function getContext(token: string) {
539
539
  * so that we can delete or confirm the upload.
540
540
  */
541
541
  function unproxyUrl(url: string) {
542
- if (process.env.NODE_ENV === 'development' && url.startsWith('http://')) {
542
+ if (isDev() && url.startsWith('http://')) {
543
543
  // get the url param from the query string
544
544
  const urlParam = new URL(url).searchParams.get('url');
545
545
  if (urlParam) {
@@ -548,3 +548,20 @@ function unproxyUrl(url: string) {
548
548
  }
549
549
  return url;
550
550
  }
551
+
552
+ export function getEnv(key: string): string | undefined {
553
+ if (typeof process !== 'undefined' && process.env) {
554
+ // @ts-expect-error - In Vite/Astro, the env variables are available on `import.meta`.
555
+ return process.env[key] ?? import.meta.env?.[key];
556
+ }
557
+ // @ts-expect-error - In Vite/Astro, the env variables are available on `import.meta`.
558
+ return import.meta.env?.[key];
559
+ }
560
+
561
+ export function isDev(): boolean {
562
+ return (
563
+ process?.env?.NODE_ENV === 'development' ||
564
+ // @ts-expect-error - In Vite/Astro, the env variables are available on `import.meta`.
565
+ import.meta.env?.DEV
566
+ );
567
+ }
@@ -63,7 +63,7 @@ export function createEdgeStoreStartHandler<TCtx>(config: Config<TCtx>) {
63
63
  const { provider = EdgeStoreProvider() } = config;
64
64
  const log = new Logger(config.logLevel);
65
65
  globalThis._EDGE_STORE_LOGGER = log;
66
- log.debug('Creating Edge Store TanStack Start handler');
66
+ log.debug('Creating EdgeStore TanStack Start handler');
67
67
 
68
68
  return async ({ request }: { request: Request }) => {
69
69
  try {
@@ -10,7 +10,7 @@ import {
10
10
  } from '@edgestore/shared';
11
11
  import { type z, type ZodNever } from 'zod';
12
12
  import { type Comparison } from '..';
13
- import { buildPath, parsePath } from '../../adapters/shared';
13
+ import { buildPath, isDev, parsePath } from '../../adapters/shared';
14
14
  import { initEdgeStoreSdk } from '../sdk';
15
15
 
16
16
  export type GetFileRes<TBucket extends AnyBuilder> = {
@@ -408,7 +408,7 @@ export function initEdgeStoreClient<TRouter extends AnyRouter>(config: {
408
408
  * we need to proxy the file through the server.
409
409
  */
410
410
  function getUrl(url: string, baseUrl?: string) {
411
- if (process.env.NODE_ENV === 'development' && !url.includes('/_public/')) {
411
+ if (isDev() && !url.includes('/_public/')) {
412
412
  if (!baseUrl) {
413
413
  throw new Error(
414
414
  'Missing baseUrl. You need to pass the baseUrl to `initEdgeStoreClient` to get protected files in development.',
@@ -432,7 +432,15 @@ async function getBlobFromUrl(url: string) {
432
432
  export type InferClientResponse<TRouter extends AnyRouter> = {
433
433
  [TBucketName in keyof TRouter['buckets']]: {
434
434
  [TClienFn in keyof EdgeStoreClient<TRouter>[TBucketName]]: Simplify<
435
- Awaited<ReturnType<EdgeStoreClient<TRouter>[TBucketName][TClienFn]>>
435
+ Awaited<
436
+ ReturnType<
437
+ EdgeStoreClient<TRouter>[TBucketName][TClienFn] extends (
438
+ ...args: any
439
+ ) => any
440
+ ? EdgeStoreClient<TRouter>[TBucketName][TClienFn]
441
+ : never
442
+ >
443
+ >
436
444
  >;
437
445
  };
438
446
  };
@@ -4,10 +4,11 @@ import {
4
4
  type AnyMetadata,
5
5
  type AnyRouter,
6
6
  } from '@edgestore/shared';
7
+ import { getEnv } from '../../adapters/shared';
7
8
  import EdgeStoreCredentialsError from '../../libs/errors/EdgeStoreCredentialsError';
8
9
 
9
10
  const API_ENDPOINT =
10
- process.env.EDGE_STORE_API_ENDPOINT ?? 'https://api.edgestore.dev';
11
+ getEnv('EDGE_STORE_API_ENDPOINT') ?? 'https://api.edgestore.dev';
11
12
 
12
13
  type FileInfoForUpload = {
13
14
  size: number;
@@ -359,8 +360,8 @@ export function initEdgeStoreSdk(params: {
359
360
  secretKey?: string;
360
361
  }) {
361
362
  const {
362
- accessKey = process.env.EDGE_STORE_ACCESS_KEY,
363
- secretKey = process.env.EDGE_STORE_SECRET_KEY,
363
+ accessKey = getEnv('EDGE_STORE_ACCESS_KEY'),
364
+ secretKey = getEnv('EDGE_STORE_SECRET_KEY'),
364
365
  } = params ?? {};
365
366
 
366
367
  if (!accessKey || !secretKey) {
@@ -1,5 +1,5 @@
1
1
  const DEFAULT_MESSAGE = `Missing EDGE_STORE_ACCESS_KEY or EDGE_STORE_SECRET_KEY.
2
- This can happen if you are trying to import something related to the backend of Edge Store in a client component.`;
2
+ This can happen if you are trying to import something related to the backend of EdgeStore in a client component.`;
3
3
 
4
4
  class EdgeStoreCredentialsError extends Error {
5
5
  constructor(message = DEFAULT_MESSAGE) {
@@ -1,15 +1,16 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
+ import { isDev } from '../adapters/shared';
4
+
3
5
  const logLevel = ['debug', 'info', 'warn', 'error', 'none'] as const;
4
6
 
5
- export type LogLevel = typeof logLevel[number];
7
+ export type LogLevel = (typeof logLevel)[number];
6
8
 
7
9
  class Logger {
8
10
  private logLevel: LogLevel;
9
11
 
10
12
  constructor(logLevel?: LogLevel) {
11
- this.logLevel =
12
- logLevel ?? (process.env.NODE_ENV === 'production' ? 'error' : 'info');
13
+ this.logLevel = logLevel ?? (isDev() ? 'info' : 'error');
13
14
  }
14
15
 
15
16
  private shouldLog(level: LogLevel): boolean {
@@ -7,6 +7,7 @@ import {
7
7
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
8
8
  import { type Provider } from '@edgestore/shared';
9
9
  import { v4 as uuidv4 } from 'uuid';
10
+ import { getEnv } from '../../adapters/shared';
10
11
 
11
12
  export type AWSProviderOptions = {
12
13
  /**
@@ -62,17 +63,17 @@ export type AWSProviderOptions = {
62
63
 
63
64
  export function AWSProvider(options?: AWSProviderOptions): Provider {
64
65
  const {
65
- accessKeyId = process.env.ES_AWS_ACCESS_KEY_ID,
66
- secretAccessKey = process.env.ES_AWS_SECRET_ACCESS_KEY,
67
- region = process.env.ES_AWS_REGION,
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',
66
+ accessKeyId = getEnv('ES_AWS_ACCESS_KEY_ID'),
67
+ secretAccessKey = getEnv('ES_AWS_SECRET_ACCESS_KEY'),
68
+ region = getEnv('ES_AWS_REGION'),
69
+ bucketName = getEnv('ES_AWS_BUCKET_NAME'),
70
+ endpoint = getEnv('ES_AWS_ENDPOINT'),
71
+ forcePathStyle = getEnv('ES_AWS_FORCE_PATH_STYLE') === 'true',
71
72
  } = options ?? {};
72
73
 
73
74
  const baseUrl =
74
75
  options?.baseUrl ??
75
- process.env.EDGE_STORE_BASE_URL ??
76
+ getEnv('EDGE_STORE_BASE_URL') ??
76
77
  (endpoint
77
78
  ? `${endpoint}/${bucketName}`
78
79
  : `https://${bucketName}.s3.${region}.amazonaws.com`);
@@ -1,6 +1,7 @@
1
1
  import { BlobServiceClient } from '@azure/storage-blob';
2
2
  import { type Provider } from '@edgestore/shared';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
+ import { getEnv } from '../../adapters/shared';
4
5
 
5
6
  /**
6
7
  * Options for the Azure provider. Compatible with Azure Blob Storage and Azurite.
@@ -41,10 +42,10 @@ export type AzureProviderOptions = {
41
42
 
42
43
  export function AzureProvider(options?: AzureProviderOptions): Provider {
43
44
  const {
44
- storageAccountName = process.env.ES_AZURE_ACCOUNT_NAME,
45
- sasToken = process.env.ES_AZURE_SAS_TOKEN,
46
- containerName = process.env.ES_AZURE_CONTAINER_NAME,
47
- customBaseUrl = process.env.ES_AZURE_BASE_URL,
45
+ storageAccountName = getEnv('ES_AZURE_ACCOUNT_NAME'),
46
+ sasToken = getEnv('ES_AZURE_SAS_TOKEN'),
47
+ containerName = getEnv('ES_AZURE_CONTAINER_NAME'),
48
+ customBaseUrl = getEnv('ES_AZURE_BASE_URL'),
48
49
  } = options ?? {};
49
50
 
50
51
  const baseUrl =
@@ -3,6 +3,7 @@ import {
3
3
  type Provider,
4
4
  type RequestUploadRes,
5
5
  } from '@edgestore/shared';
6
+ import { getEnv } from '../../adapters/shared';
6
7
  import { initEdgeStoreSdk } from '../../core/sdk';
7
8
  import EdgeStoreCredentialsError from '../../libs/errors/EdgeStoreCredentialsError';
8
9
 
@@ -29,11 +30,15 @@ export function EdgeStoreProvider(
29
30
  options?: EdgeStoreProviderOptions,
30
31
  ): Provider {
31
32
  const {
32
- accessKey = process.env.EDGE_STORE_ACCESS_KEY,
33
- secretKey = process.env.EDGE_STORE_SECRET_KEY,
33
+ accessKey = getEnv('EDGE_STORE_ACCESS_KEY') ??
34
+ // @ts-expect-error - In Vite/Astro, the env variables are available on `import.meta`.
35
+ import.meta.env?.EDGE_STORE_ACCESS_KEY,
36
+ secretKey = getEnv('EDGE_STORE_SECRET_KEY') ??
37
+ // @ts-expect-error - In Vite/Astro, the env variables are available on `import.meta`.
38
+ import.meta.env?.EDGE_STORE_SECRET_KEY,
34
39
  } = options ?? {};
35
40
 
36
- const baseUrl = process.env.EDGE_STORE_BASE_URL ?? DEFAULT_BASE_URL;
41
+ const baseUrl = getEnv('EDGE_STORE_BASE_URL') ?? DEFAULT_BASE_URL;
37
42
 
38
43
  if (!accessKey || !secretKey) {
39
44
  throw new EdgeStoreCredentialsError();
@@ -1 +0,0 @@
1
- export * from '../dist/adapters';
package/adapters/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('../dist/adapters');
@@ -1 +0,0 @@
1
- export * from '../dist/providers';
@@ -1 +0,0 @@
1
- module.exports = require('../dist/providers');