@edgestore/server 0.1.5-alpha.8 → 0.1.5
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/dist/adapters/express/index.d.ts +18 -0
- package/dist/adapters/express/index.d.ts.map +1 -0
- package/dist/adapters/express/index.js +117 -0
- package/dist/adapters/express/index.mjs +113 -0
- package/dist/adapters/next/app/index.d.ts +1 -3
- package/dist/adapters/next/app/index.d.ts.map +1 -1
- package/dist/adapters/next/app/index.js +20 -16
- package/dist/adapters/next/app/index.mjs +9 -5
- package/dist/adapters/next/pages/index.d.ts +1 -3
- package/dist/adapters/next/pages/index.d.ts.map +1 -1
- package/dist/adapters/next/pages/index.js +18 -16
- package/dist/adapters/next/pages/index.mjs +7 -5
- package/dist/adapters/shared.d.ts +7 -43
- package/dist/adapters/shared.d.ts.map +1 -1
- package/dist/core/client/index.d.ts +4 -10
- package/dist/core/client/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -13
- package/dist/core/index.mjs +5 -14
- package/dist/core/sdk/index.d.ts +1 -2
- package/dist/core/sdk/index.d.ts.map +1 -1
- package/dist/{index-537039e4.mjs → index-28efdacf.mjs} +3 -39
- package/dist/{index-874abae5.js → index-4491caf0.js} +3 -41
- package/dist/{index-b8745c2f.js → index-beed799d.js} +3 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -215
- package/dist/index.mjs +1 -218
- package/dist/libs/errors/EdgeStoreCredentialsError.d.ts.map +1 -1
- package/dist/{logger-7ea2248c.mjs → logger-09f43a75.mjs} +14 -3
- package/dist/{logger-b530a3e1.js → logger-dcb682ae.js} +14 -3
- package/dist/providers/aws/index.d.ts +1 -1
- package/dist/providers/aws/index.d.ts.map +1 -1
- package/dist/providers/azure/index.d.ts +1 -1
- package/dist/providers/azure/index.d.ts.map +1 -1
- package/dist/providers/edgestore/index.d.ts +1 -1
- package/dist/providers/edgestore/index.d.ts.map +1 -1
- package/dist/providers/edgestore/index.js +4 -4
- package/dist/providers/edgestore/index.mjs +2 -2
- package/dist/{shared-6b717151.mjs → shared-039276af.mjs} +1 -1
- package/dist/{shared-4c2a6210.js → shared-7c700083.js} +20 -20
- package/dist/{shared-e84dbdde.js → shared-83f288f6.js} +1 -1
- package/package.json +9 -12
- package/src/adapters/express/index.ts +165 -0
- package/src/adapters/next/app/index.ts +12 -7
- package/src/adapters/next/pages/index.ts +10 -7
- package/src/adapters/shared.ts +14 -17
- package/src/core/client/index.ts +9 -12
- package/src/core/index.ts +0 -15
- package/src/core/sdk/index.ts +6 -3
- package/src/index.ts +1 -1
- package/src/libs/errors/EdgeStoreCredentialsError.ts +1 -2
- package/src/providers/aws/index.ts +1 -1
- package/src/providers/azure/index.ts +1 -1
- package/src/providers/edgestore/index.ts +5 -2
- package/dist/adapters/index.d.ts +0 -2
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -2
- package/dist/adapters/index.mjs +0 -1
- package/dist/core/internals/bucketBuilder.d.ts +0 -269
- package/dist/core/internals/bucketBuilder.d.ts.map +0 -1
- package/dist/core/internals/createPathParamProxy.d.ts +0 -21
- package/dist/core/internals/createPathParamProxy.d.ts.map +0 -1
- package/dist/libs/errors/EdgeStoreApiClientError.d.ts +0 -8
- package/dist/libs/errors/EdgeStoreApiClientError.d.ts.map +0 -1
- package/dist/libs/errors/EdgeStoreError.d.ts +0 -48
- package/dist/libs/errors/EdgeStoreError.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -2
- package/dist/providers/index.mjs +0 -1
- package/dist/providers/types.d.ts +0 -114
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/types.d.ts +0 -94
- package/dist/types.d.ts.map +0 -1
- package/src/adapters/index.ts +0 -6
- package/src/core/internals/bucketBuilder.ts +0 -555
- package/src/core/internals/createPathParamProxy.ts +0 -40
- package/src/libs/errors/EdgeStoreApiClientError.ts +0 -14
- package/src/libs/errors/EdgeStoreError.ts +0 -92
- package/src/providers/index.ts +0 -1
- package/src/providers/types.ts +0 -140
- package/src/types.ts +0 -148
|
@@ -0,0 +1,165 @@
|
|
|
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 { type Request, type Response } from 'express';
|
|
10
|
+
import Logger, { type LogLevel } from '../../libs/logger';
|
|
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
|
+
res: Response;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type Config<TCtx> = {
|
|
32
|
+
provider?: Provider;
|
|
33
|
+
router: EdgeStoreRouter<TCtx>;
|
|
34
|
+
logLevel?: LogLevel;
|
|
35
|
+
} & (TCtx extends Record<string, never>
|
|
36
|
+
? object
|
|
37
|
+
: {
|
|
38
|
+
provider?: Provider;
|
|
39
|
+
router: EdgeStoreRouter<TCtx>;
|
|
40
|
+
createContext: (opts: CreateContextOptions) => MaybePromise<TCtx>;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
declare const globalThis: {
|
|
44
|
+
_EDGE_STORE_LOGGER: Logger;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export function createEdgeStoreExpressHandler<TCtx>(config: Config<TCtx>) {
|
|
48
|
+
const { provider = EdgeStoreProvider() } = config;
|
|
49
|
+
const log = new Logger(config.logLevel);
|
|
50
|
+
globalThis._EDGE_STORE_LOGGER = log;
|
|
51
|
+
log.debug('Creating Edge Store Express handler');
|
|
52
|
+
|
|
53
|
+
return async (req: Request, res: Response) => {
|
|
54
|
+
try {
|
|
55
|
+
if (req.url?.includes?.('/health')) {
|
|
56
|
+
res.send('OK');
|
|
57
|
+
} else if (req.url?.includes?.('/init')) {
|
|
58
|
+
let ctx = {} as TCtx;
|
|
59
|
+
try {
|
|
60
|
+
ctx =
|
|
61
|
+
'createContext' in config
|
|
62
|
+
? await config.createContext({ req, res })
|
|
63
|
+
: ({} as TCtx);
|
|
64
|
+
} catch (err) {
|
|
65
|
+
throw new EdgeStoreError({
|
|
66
|
+
message: 'Error creating context',
|
|
67
|
+
code: 'CREATE_CONTEXT_ERROR',
|
|
68
|
+
cause: err instanceof Error ? err : undefined,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const { newCookies, token, baseUrl } = await init({
|
|
72
|
+
ctx,
|
|
73
|
+
provider,
|
|
74
|
+
router: config.router,
|
|
75
|
+
});
|
|
76
|
+
res.setHeader('Set-Cookie', newCookies);
|
|
77
|
+
res.json({
|
|
78
|
+
token,
|
|
79
|
+
baseUrl,
|
|
80
|
+
});
|
|
81
|
+
} else if (req.url?.includes?.('/request-upload')) {
|
|
82
|
+
res.json(
|
|
83
|
+
await requestUpload({
|
|
84
|
+
provider,
|
|
85
|
+
router: config.router,
|
|
86
|
+
body: req.body as RequestUploadBody,
|
|
87
|
+
ctxToken: req.cookies['edgestore-ctx'],
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
} else if (req.url?.includes?.('/request-upload-parts')) {
|
|
91
|
+
res.json(
|
|
92
|
+
await requestUploadParts({
|
|
93
|
+
provider,
|
|
94
|
+
router: config.router,
|
|
95
|
+
body: req.body as RequestUploadPartsParams,
|
|
96
|
+
ctxToken: req.cookies['edgestore-ctx'],
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
} else if (req.url?.includes?.('/complete-multipart-upload')) {
|
|
100
|
+
await completeMultipartUpload({
|
|
101
|
+
provider,
|
|
102
|
+
router: config.router,
|
|
103
|
+
body: req.body as CompleteMultipartUploadBody,
|
|
104
|
+
ctxToken: req.cookies['edgestore-ctx'],
|
|
105
|
+
});
|
|
106
|
+
res.status(200).end();
|
|
107
|
+
} else if (req.url?.includes?.('/confirm-upload')) {
|
|
108
|
+
res.json(
|
|
109
|
+
await confirmUpload({
|
|
110
|
+
provider,
|
|
111
|
+
router: config.router,
|
|
112
|
+
body: req.body as ConfirmUploadBody,
|
|
113
|
+
ctxToken: req.cookies['edgestore-ctx'],
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
} else if (req.url?.includes?.('/delete-file')) {
|
|
117
|
+
res.json(
|
|
118
|
+
await deleteFile({
|
|
119
|
+
provider,
|
|
120
|
+
router: config.router,
|
|
121
|
+
body: req.body as DeleteFileBody,
|
|
122
|
+
ctxToken: req.cookies['edgestore-ctx'],
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
} else if (req.url?.includes?.('/proxy-file')) {
|
|
126
|
+
const { url } = req.query;
|
|
127
|
+
if (typeof url === 'string') {
|
|
128
|
+
const proxyRes = await fetch(url, {
|
|
129
|
+
headers: {
|
|
130
|
+
cookie: req.headers.cookie ?? '',
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const data = await proxyRes.arrayBuffer();
|
|
135
|
+
res.setHeader(
|
|
136
|
+
'Content-Type',
|
|
137
|
+
proxyRes.headers.get('Content-Type') ?? 'application/octet-stream',
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
res.end(Buffer.from(data));
|
|
141
|
+
} else {
|
|
142
|
+
res.status(400).end();
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
res.status(404).end();
|
|
146
|
+
}
|
|
147
|
+
} catch (err) {
|
|
148
|
+
if (err instanceof EdgeStoreError) {
|
|
149
|
+
log[err.level](err.formattedMessage());
|
|
150
|
+
if (err.cause) log[err.level](err.cause);
|
|
151
|
+
res
|
|
152
|
+
.status(EDGE_STORE_ERROR_CODES[err.code as EdgeStoreErrorCodeKey])
|
|
153
|
+
.json(err.formattedJson());
|
|
154
|
+
} else {
|
|
155
|
+
log.error(err);
|
|
156
|
+
res.status(500).send(
|
|
157
|
+
new EdgeStoreError({
|
|
158
|
+
message: 'Internal Server Error',
|
|
159
|
+
code: 'SERVER_ERROR',
|
|
160
|
+
}).formattedJson(),
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type EdgeStoreRouter } from '../../../core/internals/bucketBuilder';
|
|
3
|
-
import EdgeStoreError, {
|
|
1
|
+
import {
|
|
4
2
|
EDGE_STORE_ERROR_CODES,
|
|
3
|
+
EdgeStoreError,
|
|
5
4
|
type EdgeStoreErrorCodeKey,
|
|
6
|
-
|
|
5
|
+
type EdgeStoreRouter,
|
|
6
|
+
type MaybePromise,
|
|
7
|
+
type Provider,
|
|
8
|
+
} from '@edgestore/shared';
|
|
9
|
+
import { type NextRequest } from 'next/server';
|
|
7
10
|
import Logger, { type LogLevel } from '../../../libs/logger';
|
|
8
11
|
import { EdgeStoreProvider } from '../../../providers/edgestore';
|
|
9
|
-
import { type Provider } from '../../../providers/types';
|
|
10
|
-
import { type MaybePromise } from '../../../types';
|
|
11
12
|
import {
|
|
12
13
|
completeMultipartUpload,
|
|
13
14
|
confirmUpload,
|
|
@@ -56,7 +57,11 @@ export function createEdgeStoreNextHandler<TCtx>(config: Config<TCtx>) {
|
|
|
56
57
|
'Error running the app adapter. Make sure you are importing the correct adapter in your router configuration',
|
|
57
58
|
code: 'SERVER_ERROR',
|
|
58
59
|
});
|
|
59
|
-
if (req.nextUrl.pathname.endsWith('/
|
|
60
|
+
if (req.nextUrl.pathname.endsWith('/health')) {
|
|
61
|
+
return new Response('OK', {
|
|
62
|
+
status: 200,
|
|
63
|
+
});
|
|
64
|
+
} else if (req.nextUrl.pathname.endsWith('/init')) {
|
|
60
65
|
let ctx = {} as TCtx;
|
|
61
66
|
try {
|
|
62
67
|
ctx =
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type EdgeStoreRouter } from '../../../core/internals/bucketBuilder';
|
|
3
|
-
import EdgeStoreError, {
|
|
1
|
+
import {
|
|
4
2
|
EDGE_STORE_ERROR_CODES,
|
|
3
|
+
EdgeStoreError,
|
|
5
4
|
type EdgeStoreErrorCodeKey,
|
|
6
|
-
|
|
5
|
+
type EdgeStoreRouter,
|
|
6
|
+
type MaybePromise,
|
|
7
|
+
type Provider,
|
|
8
|
+
} from '@edgestore/shared';
|
|
9
|
+
import { type NextApiRequest, type NextApiResponse } from 'next/types';
|
|
7
10
|
import Logger, { type LogLevel } from '../../../libs/logger';
|
|
8
11
|
import { EdgeStoreProvider } from '../../../providers/edgestore';
|
|
9
|
-
import { type Provider } from '../../../providers/types';
|
|
10
|
-
import { type MaybePromise } from '../../../types';
|
|
11
12
|
import {
|
|
12
13
|
completeMultipartUpload,
|
|
13
14
|
confirmUpload,
|
|
@@ -57,7 +58,9 @@ export function createEdgeStoreNextHandler<TCtx>(config: Config<TCtx>) {
|
|
|
57
58
|
'Error running the pages adapter. Make sure you are importing the correct adapter in your router configuration',
|
|
58
59
|
code: 'SERVER_ERROR',
|
|
59
60
|
});
|
|
60
|
-
if (req.url?.includes?.('/
|
|
61
|
+
if (req.url?.includes?.('/health')) {
|
|
62
|
+
res.send('OK');
|
|
63
|
+
} else if (req.url?.includes?.('/init')) {
|
|
61
64
|
let ctx = {} as TCtx;
|
|
62
65
|
try {
|
|
63
66
|
ctx =
|
package/src/adapters/shared.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EdgeStoreError,
|
|
3
|
+
type AnyBuilder,
|
|
4
|
+
type EdgeStoreRouter,
|
|
5
|
+
type Provider,
|
|
6
|
+
type SharedDeleteFileRes,
|
|
7
|
+
type SharedInitRes,
|
|
8
|
+
type SharedRequestUploadPartsRes,
|
|
9
|
+
type SharedRequestUploadRes,
|
|
10
|
+
} from '@edgestore/shared';
|
|
1
11
|
import { hkdf } from '@panva/hkdf';
|
|
2
12
|
import { serialize } from 'cookie';
|
|
3
13
|
import { EncryptJWT, jwtDecrypt } from 'jose';
|
|
4
14
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
-
import {
|
|
6
|
-
type AnyBuilder,
|
|
7
|
-
type EdgeStoreRouter,
|
|
8
|
-
} from '../core/internals/bucketBuilder';
|
|
9
|
-
import EdgeStoreError from '../libs/errors/EdgeStoreError';
|
|
10
15
|
import type Logger from '../libs/logger';
|
|
11
|
-
import { type Provider } from '../providers/types';
|
|
12
16
|
import { IMAGE_MIME_TYPES } from './imageTypes';
|
|
13
17
|
|
|
14
18
|
// TODO: change it to 1 hour when we have a way to refresh the token
|
|
@@ -22,7 +26,7 @@ export async function init<TCtx>(params: {
|
|
|
22
26
|
provider: Provider;
|
|
23
27
|
router: EdgeStoreRouter<TCtx>;
|
|
24
28
|
ctx: TCtx;
|
|
25
|
-
}) {
|
|
29
|
+
}): Promise<SharedInitRes> {
|
|
26
30
|
const log = globalThis._EDGE_STORE_LOGGER;
|
|
27
31
|
const { ctx, provider, router } = params;
|
|
28
32
|
log.debug('Running [init]', { ctx });
|
|
@@ -74,7 +78,7 @@ export async function requestUpload<TCtx>(params: {
|
|
|
74
78
|
router: EdgeStoreRouter<TCtx>;
|
|
75
79
|
ctxToken: string | undefined;
|
|
76
80
|
body: RequestUploadBody;
|
|
77
|
-
}) {
|
|
81
|
+
}): Promise<SharedRequestUploadRes> {
|
|
78
82
|
const {
|
|
79
83
|
provider,
|
|
80
84
|
router,
|
|
@@ -231,7 +235,7 @@ export async function requestUploadParts<TCtx>(params: {
|
|
|
231
235
|
router: EdgeStoreRouter<TCtx>;
|
|
232
236
|
ctxToken: string | undefined;
|
|
233
237
|
body: RequestUploadPartsParams;
|
|
234
|
-
}) {
|
|
238
|
+
}): Promise<SharedRequestUploadPartsRes> {
|
|
235
239
|
const {
|
|
236
240
|
provider,
|
|
237
241
|
ctxToken,
|
|
@@ -370,7 +374,7 @@ export async function deleteFile<TCtx>(params: {
|
|
|
370
374
|
router: EdgeStoreRouter<TCtx>;
|
|
371
375
|
ctxToken: string | undefined;
|
|
372
376
|
body: DeleteFileBody;
|
|
373
|
-
}) {
|
|
377
|
+
}): Promise<SharedDeleteFileRes> {
|
|
374
378
|
const {
|
|
375
379
|
provider,
|
|
376
380
|
router,
|
|
@@ -544,10 +548,3 @@ function unproxyUrl(url: string) {
|
|
|
544
548
|
}
|
|
545
549
|
return url;
|
|
546
550
|
}
|
|
547
|
-
|
|
548
|
-
export type InitRes = Awaited<ReturnType<typeof init>>;
|
|
549
|
-
export type RequestUploadRes = Awaited<ReturnType<typeof requestUpload>>;
|
|
550
|
-
export type RequestUploadPartsRes = Awaited<
|
|
551
|
-
ReturnType<typeof requestUploadParts>
|
|
552
|
-
>;
|
|
553
|
-
export type DeleteFileRes = Awaited<ReturnType<typeof deleteFile>>;
|
package/src/core/client/index.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
import { type z, type ZodNever } from 'zod';
|
|
3
|
-
import { type AnyRouter, type Comparison } from '..';
|
|
4
|
-
import { buildPath, parsePath } from '../../adapters/shared';
|
|
5
|
-
import { type Prettify, type Simplify } from '../../types';
|
|
6
2
|
import {
|
|
7
3
|
type AnyBuilder,
|
|
4
|
+
type AnyRouter,
|
|
8
5
|
type InferBucketPathKeys,
|
|
9
6
|
type InferBucketPathObject,
|
|
10
7
|
type InferMetadataObject,
|
|
11
|
-
|
|
8
|
+
type Prettify,
|
|
9
|
+
type Simplify,
|
|
10
|
+
} from '@edgestore/shared';
|
|
11
|
+
import { type z, type ZodNever } from 'zod';
|
|
12
|
+
import { type Comparison } from '..';
|
|
13
|
+
import { buildPath, parsePath } from '../../adapters/shared';
|
|
12
14
|
import { initEdgeStoreSdk } from '../sdk';
|
|
13
15
|
|
|
14
16
|
export type GetFileRes<TBucket extends AnyBuilder> = {
|
|
@@ -79,27 +81,22 @@ export type UploadFileRequest<TBucket extends AnyBuilder> = {
|
|
|
79
81
|
* If it's a string, it will be converted to a blob with the type `text/plain`.
|
|
80
82
|
*
|
|
81
83
|
* @example
|
|
82
|
-
* ```ts
|
|
83
84
|
* // string
|
|
84
85
|
* content: "some text"
|
|
85
|
-
* ```
|
|
86
86
|
*
|
|
87
87
|
* @example
|
|
88
|
-
* ```ts
|
|
89
88
|
* // blob
|
|
90
89
|
* content: {
|
|
91
90
|
* blob: new Blob([text], { type: "text/csv" }),
|
|
92
91
|
* extension: "csv",
|
|
93
92
|
* }
|
|
94
|
-
* ```
|
|
95
93
|
*
|
|
96
94
|
* @example
|
|
97
|
-
* ```ts
|
|
98
95
|
* // url
|
|
99
96
|
* content: {
|
|
100
|
-
*
|
|
97
|
+
* url: "https://example.com/my-file.csv",
|
|
98
|
+
* extension: "csv",
|
|
101
99
|
* }
|
|
102
|
-
* ```
|
|
103
100
|
*/
|
|
104
101
|
content: TextContent | BlobContent | UrlContent;
|
|
105
102
|
options?: UploadOptions;
|
package/src/core/index.ts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import { type EdgeStoreRouter } from './internals/bucketBuilder';
|
|
2
|
-
|
|
3
1
|
export * from './client';
|
|
4
2
|
export * from './sdk';
|
|
5
|
-
export type {
|
|
6
|
-
InferBucketPathKeys,
|
|
7
|
-
InferBucketPathObject,
|
|
8
|
-
InferMetadataObject,
|
|
9
|
-
} from './internals/bucketBuilder';
|
|
10
|
-
export type {
|
|
11
|
-
EdgeStoreErrorCodeKey,
|
|
12
|
-
EdgeStoreErrorDetails,
|
|
13
|
-
EdgeStoreJsonResponse,
|
|
14
|
-
} from '../libs/errors/EdgeStoreError';
|
|
15
|
-
export { EdgeStoreApiClientError } from '../libs/errors/EdgeStoreApiClientError';
|
|
16
|
-
|
|
17
|
-
export type AnyRouter = EdgeStoreRouter<any>;
|
package/src/core/sdk/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
EdgeStoreError,
|
|
3
|
+
type AnyContext,
|
|
4
|
+
type AnyMetadata,
|
|
5
|
+
type AnyRouter,
|
|
6
|
+
} from '@edgestore/shared';
|
|
2
7
|
import EdgeStoreCredentialsError from '../../libs/errors/EdgeStoreCredentialsError';
|
|
3
|
-
import EdgeStoreError from '../../libs/errors/EdgeStoreError';
|
|
4
|
-
import { type AnyContext, type AnyMetadata } from '../internals/bucketBuilder';
|
|
5
8
|
|
|
6
9
|
const API_ENDPOINT =
|
|
7
10
|
process.env.EDGE_STORE_API_ENDPOINT ?? 'https://api.edgestore.dev';
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { initEdgeStore } from '
|
|
1
|
+
export { initEdgeStore } from '@edgestore/shared';
|
|
@@ -1,6 +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
|
|
3
|
-
The vanilla client should only be used in the backend.`;
|
|
2
|
+
This can happen if you are trying to import something related to the backend of Edge Store in a client component.`;
|
|
4
3
|
|
|
5
4
|
class EdgeStoreCredentialsError extends Error {
|
|
6
5
|
constructor(message = DEFAULT_MESSAGE) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
S3Client,
|
|
6
6
|
} from '@aws-sdk/client-s3';
|
|
7
7
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
8
|
+
import { type Provider } from '@edgestore/shared';
|
|
8
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
-
import { type Provider } from '../types';
|
|
10
10
|
|
|
11
11
|
export type AWSProviderOptions = {
|
|
12
12
|
/**
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EdgeStoreError,
|
|
3
|
+
type Provider,
|
|
4
|
+
type RequestUploadRes,
|
|
5
|
+
} from '@edgestore/shared';
|
|
1
6
|
import { initEdgeStoreSdk } from '../../core/sdk';
|
|
2
7
|
import EdgeStoreCredentialsError from '../../libs/errors/EdgeStoreCredentialsError';
|
|
3
|
-
import EdgeStoreError from '../../libs/errors/EdgeStoreError';
|
|
4
|
-
import { type Provider, type RequestUploadRes } from '../types';
|
|
5
8
|
|
|
6
9
|
const DEFAULT_BASE_URL = 'https://files.edgestore.dev';
|
|
7
10
|
|
package/dist/adapters/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,GACd,MAAM,UAAU,CAAC"}
|
package/dist/adapters/index.js
DELETED
package/dist/adapters/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|