@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
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ npm install @edgestore/server @edgestore/react
|
|
|
19
19
|
Then go to your [Dashboard](https://dashboard.edgestore.dev), create a new project and copy the keys to your environment variables.
|
|
20
20
|
|
|
21
21
|
```shell title=".env"
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
23
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Backend
|
package/agent-docs/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @edgestore/server 1.0.0
|
|
1
|
+
# @edgestore/server 1.0.0: agent references
|
|
2
2
|
|
|
3
3
|
These references ship with this exact package version. Prefer them over newer online examples.
|
|
4
4
|
Generated from the authored documentation; do not edit these files directly.
|
package/agent-docs/astro.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Astro
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/astro
|
|
4
4
|
|
|
5
5
|
The Astro adapter handles server requests. The upload UI below uses a hydrated
|
|
6
6
|
React component.
|
|
@@ -12,7 +12,7 @@ React component.
|
|
|
12
12
|
Packages to install (use the application’s package manager):
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
@edgestore/server
|
|
15
|
+
@edgestore/server @edgestore/react
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### Environment variables
|
|
@@ -22,8 +22,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
22
22
|
Example: title=".env"
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
26
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
> WARNING
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Backend Client
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/backend-client
|
|
4
4
|
|
|
5
5
|
Sometimes you might want to use the EdgeStore functionality directly from your backend. Things like deleting, uploading or even listing files can be done with the use of the backend client.
|
|
6
6
|
|
|
@@ -154,7 +154,10 @@ const res = await backendClient.publicImages.upload({
|
|
|
154
154
|
|
|
155
155
|
### Confirm a temporary file upload
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
Save the upload result's ID/key and URL in your database, then confirm the
|
|
158
|
+
temporary file. Hosted EdgeStore accepts confirmation during processing; a
|
|
159
|
+
preceding `get()` is unnecessary and can return 404 until processing finishes.
|
|
160
|
+
If saving fails, leave the file temporary.
|
|
158
161
|
|
|
159
162
|
```ts
|
|
160
163
|
const res = await backendClient.publicFiles.confirm({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/configuration
|
|
4
4
|
|
|
5
5
|
## Router and Provider
|
|
6
6
|
|
|
@@ -41,7 +41,7 @@ Keep the router object on the server; import only its type into frontend code.
|
|
|
41
41
|
|
|
42
42
|
## Bucket Types
|
|
43
43
|
|
|
44
|
-
There are two types of file buckets: `IMAGE` and `FILE`. Both types of buckets work basically the same way, but the `IMAGE` bucket only accepts [certain mime types](https://
|
|
44
|
+
There are two types of file buckets: `IMAGE` and `FILE`. Both types of buckets work basically the same way, but the `IMAGE` bucket only accepts [certain mime types](https://edgestore.dev/docs/configuration#image-bucket-accepted-mime-types).
|
|
45
45
|
|
|
46
46
|
IMAGE buckets automatically generate a thumbnail version of the image file if the file is bigger than 200px in width or height. In case a thumbnail was generated, the url will be included in the response of the upload request.
|
|
47
47
|
|
|
@@ -220,7 +220,7 @@ const router = es.router({
|
|
|
220
220
|
});
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
## Access Control
|
|
223
|
+
## Access Control
|
|
224
224
|
|
|
225
225
|
You can use the `accessControl` function to add bucket level logic to allow or deny access to files. If you have ever used Prisma, you will probably notice that the structure of the `accessControl` function is similar to how you would write a Prisma query.
|
|
226
226
|
|
package/agent-docs/express.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Express
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/express
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Source: https://next.edgestore.dev/docs/adapters/express
|
|
|
9
9
|
Packages to install (use the application’s package manager):
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
|
-
@edgestore/server
|
|
12
|
+
@edgestore/server @edgestore/react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Environment variables
|
|
@@ -19,8 +19,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
19
19
|
Example: title=".env"
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
23
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
> WARNING
|
|
@@ -114,7 +114,7 @@ function App() {
|
|
|
114
114
|
|
|
115
115
|
## Usage
|
|
116
116
|
|
|
117
|
-
See [Quick start](https://
|
|
117
|
+
See [Quick start](https://edgestore.dev/docs/quick-start) for the upload UI.
|
|
118
118
|
|
|
119
119
|
## Limitations
|
|
120
120
|
|
package/agent-docs/fastify.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fastify
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/fastify
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Source: https://next.edgestore.dev/docs/adapters/fastify
|
|
|
9
9
|
Packages to install (use the application’s package manager):
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
|
-
@edgestore/server
|
|
12
|
+
@edgestore/server @edgestore/react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Environment variables
|
|
@@ -19,8 +19,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
19
19
|
Example: title=".env"
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
23
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
> WARNING
|
|
@@ -113,7 +113,7 @@ function App() {
|
|
|
113
113
|
|
|
114
114
|
## Usage
|
|
115
115
|
|
|
116
|
-
See [Quick start](https://
|
|
116
|
+
See [Quick start](https://edgestore.dev/docs/quick-start) for the upload UI.
|
|
117
117
|
|
|
118
118
|
## Limitations
|
|
119
119
|
|
package/agent-docs/hono.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hono
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/hono
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ Install `@edgestore/server` in the backend and `@edgestore/react` in the fronten
|
|
|
11
11
|
Packages to install (use the application’s package manager):
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
|
-
@edgestore/server
|
|
14
|
+
@edgestore/server @edgestore/react
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### Environment variables
|
|
@@ -21,8 +21,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
21
21
|
Example: title=".env.local (backend only)"
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
25
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
> WARNING
|
|
@@ -121,7 +121,7 @@ Across repositories, share the backend router's type through a package.
|
|
|
121
121
|
|
|
122
122
|
## Usage
|
|
123
123
|
|
|
124
|
-
See [Quick start](https://
|
|
124
|
+
See [Quick start](https://edgestore.dev/docs/quick-start) for the upload UI.
|
|
125
125
|
|
|
126
126
|
## Limitations
|
|
127
127
|
|
package/agent-docs/next.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Quick Start
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/quick-start
|
|
4
4
|
|
|
5
5
|
### Install
|
|
6
6
|
|
|
7
7
|
Packages to install (use the application’s package manager):
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
|
-
@edgestore/server
|
|
10
|
+
@edgestore/server @edgestore/react
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### Environment Variables
|
|
@@ -17,8 +17,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
17
17
|
Example: title=".env.local"
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
21
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
> WARNING
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Azure Blob Storage
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/providers/azure-blob
|
|
4
4
|
|
|
5
5
|
Use the Azure Blob provider when your files must live in your own Azure
|
|
6
6
|
storage account. It supports direct browser uploads, automatic block uploads
|
|
@@ -39,24 +39,24 @@ export type EdgeStoreRouter = typeof router;
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Pass `router` to your framework adapter as its `router` option. Set
|
|
42
|
-
`ES_AZURE_ACCOUNT_KEY` on the server, and set `
|
|
42
|
+
`ES_AZURE_ACCOUNT_KEY` on the server, and set `EDGESTORE_JWT_SECRET` to a
|
|
43
43
|
stable random secret, for example one generated with `openssl rand -base64 32`.
|
|
44
44
|
All application instances must share it. Credentials are only checked when the
|
|
45
45
|
provider is first used, so defining a router does not require them.
|
|
46
46
|
|
|
47
|
-
| Option | Default / environment variable
|
|
48
|
-
| ---------------------------- |
|
|
49
|
-
| `storageAccountName` | `ES_AZURE_ACCOUNT_NAME`
|
|
50
|
-
| `storageAccountKey` | `ES_AZURE_ACCOUNT_KEY`
|
|
51
|
-
| `containerName` | `ES_AZURE_CONTAINER_NAME`
|
|
52
|
-
| `endpoint` | `ES_AZURE_ENDPOINT`, otherwise `https://<account>.blob.core.windows.net`
|
|
53
|
-
| `baseUrl` | `
|
|
54
|
-
| `uploadUrlExpiresIn` | 3600 seconds
|
|
55
|
-
| `signedUrlExpiresIn` | 3600 seconds
|
|
56
|
-
| `multipart.thresholdBytes` | 100 MiB
|
|
57
|
-
| `multipart.partSizeBytes` | 16 MiB; minimum 5 MiB, maximum 4000 MiB
|
|
58
|
-
| `multipart.sessionExpiresIn` | 86400 seconds
|
|
59
|
-
| `jwtSecret` | Multipart signing override; otherwise `
|
|
47
|
+
| Option | Default / environment variable |
|
|
48
|
+
| ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
49
|
+
| `storageAccountName` | `ES_AZURE_ACCOUNT_NAME` |
|
|
50
|
+
| `storageAccountKey` | `ES_AZURE_ACCOUNT_KEY` |
|
|
51
|
+
| `containerName` | `ES_AZURE_CONTAINER_NAME` |
|
|
52
|
+
| `endpoint` | `ES_AZURE_ENDPOINT`, otherwise `https://<account>.blob.core.windows.net` |
|
|
53
|
+
| `baseUrl` | `EDGESTORE_BASE_URL`, otherwise `<endpoint>/<container>` |
|
|
54
|
+
| `uploadUrlExpiresIn` | 3600 seconds |
|
|
55
|
+
| `signedUrlExpiresIn` | 3600 seconds |
|
|
56
|
+
| `multipart.thresholdBytes` | 100 MiB |
|
|
57
|
+
| `multipart.partSizeBytes` | 16 MiB; minimum 5 MiB, maximum 4000 MiB |
|
|
58
|
+
| `multipart.sessionExpiresIn` | 86400 seconds |
|
|
59
|
+
| `jwtSecret` | Multipart signing override; otherwise `EDGESTORE_JWT_SECRET` or `EDGESTORE_SECRET_KEY` |
|
|
60
60
|
|
|
61
61
|
Signed URL lifetimes must be between 1 and 604800 seconds. Upload URLs grant
|
|
62
62
|
only create/write permission on one blob, and read URLs grant only read
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Custom
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/providers/custom
|
|
4
4
|
|
|
5
5
|
Use `defineProvider` to integrate another storage service or a custom storage
|
|
6
6
|
implementation. The same provider instance powers the EdgeStore HTTP handler
|
|
@@ -265,6 +265,18 @@ A single-part plan can include `uploadHeaders`. The browser sends them with the
|
|
|
265
265
|
upload request, which lets a provider sign headers such as `Content-Type` or
|
|
266
266
|
storage metadata into the URL.
|
|
267
267
|
|
|
268
|
+
Return `id` from `uploads.request` when your storage assigns stable file IDs.
|
|
269
|
+
The browser upload result includes it so apps can save it.
|
|
270
|
+
|
|
271
|
+
If your storage processes files after the transfer, return `id` and implement
|
|
272
|
+
`uploads.getStatus({ bucketName, id })`. It returns
|
|
273
|
+
`{ status: 'processing' }`, `{ status: 'canceled' }`, or
|
|
274
|
+
`{ status: 'completed', file }` with the processed `url`, `key`,
|
|
275
|
+
`thumbnailUrl`, and `sizeBytes`. Browser uploads with `waitForProcessing` poll
|
|
276
|
+
it through an encrypted status token that only the uploading browser receives.
|
|
277
|
+
Providers without `getStatus` treat uploads as ready once the transfer
|
|
278
|
+
completes.
|
|
279
|
+
|
|
268
280
|
Set `uploads.supportedOptions` to reject upload options your storage cannot
|
|
269
281
|
honor. For example, `supportedOptions: { temporary: false }` removes
|
|
270
282
|
`temporary` from the browser and backend upload types, and EdgeStore rejects it
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# EdgeStore
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/providers/edgestore
|
|
4
4
|
|
|
5
5
|
The hosted EdgeStore provider uses API v2 and is the default for `es.router()`.
|
|
6
6
|
No provider configuration is needed when using environment credentials. Chain
|
|
@@ -35,14 +35,14 @@ export type EdgeStoreProviderOptions = {
|
|
|
35
35
|
* Access key for your EdgeStore project.
|
|
36
36
|
* Can be found in the EdgeStore dashboard.
|
|
37
37
|
*
|
|
38
|
-
* This can be omitted if the `
|
|
38
|
+
* This can be omitted if the `EDGESTORE_ACCESS_KEY` environment variable is set.
|
|
39
39
|
*/
|
|
40
40
|
accessKey?: string;
|
|
41
41
|
/**
|
|
42
42
|
* Secret key for your EdgeStore project.
|
|
43
43
|
* Can be found in the EdgeStore dashboard.
|
|
44
44
|
*
|
|
45
|
-
* This can be omitted if the `
|
|
45
|
+
* This can be omitted if the `EDGESTORE_SECRET_KEY` environment variable is set.
|
|
46
46
|
*/
|
|
47
47
|
secretKey?: string;
|
|
48
48
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# S3
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/providers/s3
|
|
4
4
|
|
|
5
5
|
The S3 provider supports direct browser uploads, automatic multipart uploads,
|
|
6
6
|
backend uploads, signed downloads, object lookup, and deletion. Your application
|
|
@@ -36,7 +36,7 @@ export type EdgeStoreRouter = typeof router;
|
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Pass `router` to your framework adapter as its `router` option.
|
|
39
|
-
Set `
|
|
39
|
+
Set `EDGESTORE_JWT_SECRET` to a stable random secret, for example one generated
|
|
40
40
|
with `openssl rand -base64 32`. All application instances must share it.
|
|
41
41
|
|
|
42
42
|
Pass `credentials` with an AWS credentials object or provider function. If it
|
|
@@ -44,19 +44,19 @@ is unset, `ES_AWS_ACCESS_KEY_ID` and `ES_AWS_SECRET_ACCESS_KEY` are used when
|
|
|
44
44
|
both are set; otherwise the AWS SDK's default provider chain applies, including
|
|
45
45
|
environment variables, shared config, and instance/task roles.
|
|
46
46
|
|
|
47
|
-
| Option | Default / environment variable
|
|
48
|
-
| ---------------------------- |
|
|
49
|
-
| `bucketName` | `ES_AWS_BUCKET_NAME`
|
|
50
|
-
| `region` | `ES_AWS_REGION`, then AWS SDK region resolution
|
|
51
|
-
| `endpoint` | `ES_AWS_ENDPOINT`
|
|
52
|
-
| `forcePathStyle` | `ES_AWS_FORCE_PATH_STYLE === 'true'`
|
|
53
|
-
| `baseUrl` | `
|
|
54
|
-
| `uploadUrlExpiresIn` | 3600 seconds
|
|
55
|
-
| `signedUrlExpiresIn` | 3600 seconds
|
|
56
|
-
| `multipart.thresholdBytes` | 100 MiB
|
|
57
|
-
| `multipart.partSizeBytes` | 16 MiB; minimum 5 MiB
|
|
58
|
-
| `multipart.sessionExpiresIn` | 86400 seconds
|
|
59
|
-
| `jwtSecret` | Multipart signing override; otherwise `
|
|
47
|
+
| Option | Default / environment variable |
|
|
48
|
+
| ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
49
|
+
| `bucketName` | `ES_AWS_BUCKET_NAME` |
|
|
50
|
+
| `region` | `ES_AWS_REGION`, then AWS SDK region resolution |
|
|
51
|
+
| `endpoint` | `ES_AWS_ENDPOINT` |
|
|
52
|
+
| `forcePathStyle` | `ES_AWS_FORCE_PATH_STYLE === 'true'` |
|
|
53
|
+
| `baseUrl` | `EDGESTORE_BASE_URL`, otherwise the storage URL |
|
|
54
|
+
| `uploadUrlExpiresIn` | 3600 seconds |
|
|
55
|
+
| `signedUrlExpiresIn` | 3600 seconds |
|
|
56
|
+
| `multipart.thresholdBytes` | 100 MiB |
|
|
57
|
+
| `multipart.partSizeBytes` | 16 MiB; minimum 5 MiB |
|
|
58
|
+
| `multipart.sessionExpiresIn` | 86400 seconds |
|
|
59
|
+
| `jwtSecret` | Multipart signing override; otherwise `EDGESTORE_JWT_SECRET` or `EDGESTORE_SECRET_KEY` |
|
|
60
60
|
|
|
61
61
|
Setting `jwtSecret` does not replace the required environment secret.
|
|
62
62
|
Signed URL lifetimes must be between 1 and 604800 seconds; temporary AWS
|
|
@@ -241,7 +241,111 @@ required for browser multipart completion:
|
|
|
241
241
|
|
|
242
242
|
## S3-compatible services
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
`s3()` works with services that implement the S3 API, including Cloudflare R2,
|
|
245
|
+
Backblaze B2, DigitalOcean Spaces, Google Cloud Storage, Tigris, Supabase
|
|
246
|
+
Storage, and MinIO. Point `endpoint` at the service, pass its access keys as
|
|
247
|
+
`credentials` (or the `ES_AWS_ACCESS_KEY_ID` / `ES_AWS_SECRET_ACCESS_KEY`
|
|
248
|
+
environment variables), and configure bucket CORS as described above, including
|
|
249
|
+
exposing `ETag`.
|
|
250
|
+
|
|
251
|
+
The endpoint must be reachable from both your server and the browser. `baseUrl`
|
|
252
|
+
defaults to `<endpoint>/<bucket>`; set it to the service's public or CDN URL when
|
|
253
|
+
public files are served from a different host. Services differ in support for
|
|
254
|
+
tags, storage classes, and KMS encryption, so only set `objectOptions` your
|
|
255
|
+
service supports. EdgeStore's CI runs against MinIO; the setups below follow each
|
|
256
|
+
service's S3 compatibility documentation.
|
|
257
|
+
|
|
258
|
+
### Cloudflare R2
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
s3({
|
|
262
|
+
bucketName: 'edgestore',
|
|
263
|
+
region: 'auto',
|
|
264
|
+
endpoint: 'https://<ACCOUNT_ID>.r2.cloudflarestorage.com',
|
|
265
|
+
credentials: { accessKeyId: '...', secretAccessKey: '...' },
|
|
266
|
+
// Public files: an r2.dev subdomain or a custom domain on the bucket.
|
|
267
|
+
baseUrl: 'https://files.example.com',
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Create the keys as an R2 API token. R2 does not support object tagging or KMS
|
|
272
|
+
encryption, and supports the `STANDARD` and `STANDARD_IA` storage classes.
|
|
273
|
+
|
|
274
|
+
### Backblaze B2
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
s3({
|
|
278
|
+
bucketName: 'edgestore',
|
|
279
|
+
region: 'us-west-004',
|
|
280
|
+
endpoint: 'https://s3.us-west-004.backblazeb2.com',
|
|
281
|
+
credentials: { accessKeyId: '<keyID>', secretAccessKey: '<applicationKey>' },
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Use the region from your bucket's S3 endpoint and an application key. B2 does
|
|
286
|
+
not support object tagging or KMS encryption.
|
|
287
|
+
|
|
288
|
+
### DigitalOcean Spaces
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
s3({
|
|
292
|
+
bucketName: 'edgestore',
|
|
293
|
+
region: 'nyc3',
|
|
294
|
+
endpoint: 'https://nyc3.digitaloceanspaces.com',
|
|
295
|
+
credentials: { accessKeyId: '...', secretAccessKey: '...' },
|
|
296
|
+
// Optional: serve public files through the Spaces CDN.
|
|
297
|
+
baseUrl: 'https://edgestore.nyc3.cdn.digitaloceanspaces.com',
|
|
298
|
+
});
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Spaces supports customer-provided encryption keys but not KMS encryption.
|
|
302
|
+
|
|
303
|
+
### Google Cloud Storage
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
s3({
|
|
307
|
+
bucketName: 'edgestore',
|
|
308
|
+
region: 'auto',
|
|
309
|
+
endpoint: 'https://storage.googleapis.com',
|
|
310
|
+
credentials: { accessKeyId: '<HMAC access ID>', secretAccessKey: '<HMAC secret>' },
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Cloud Storage's XML API is S3-compatible when you use HMAC keys, including
|
|
315
|
+
signed URLs, multipart uploads, and multi-object delete. Create an HMAC key for a
|
|
316
|
+
service account with access to the bucket. Tagging and KMS headers are not
|
|
317
|
+
supported.
|
|
318
|
+
|
|
319
|
+
### Tigris
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
s3({
|
|
323
|
+
bucketName: 'edgestore',
|
|
324
|
+
region: 'auto',
|
|
325
|
+
endpoint: 'https://t3.storage.dev',
|
|
326
|
+
credentials: { accessKeyId: '...', secretAccessKey: '...' },
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Supabase Storage
|
|
331
|
+
|
|
332
|
+
```ts
|
|
333
|
+
s3({
|
|
334
|
+
bucketName: 'edgestore',
|
|
335
|
+
region: '<project region>',
|
|
336
|
+
endpoint: 'https://<project_ref>.storage.supabase.co/storage/v1/s3',
|
|
337
|
+
forcePathStyle: true,
|
|
338
|
+
credentials: { accessKeyId: '...', secretAccessKey: '...' },
|
|
339
|
+
// Public buckets are served from the object endpoint.
|
|
340
|
+
baseUrl:
|
|
341
|
+
'https://<project_ref>.supabase.co/storage/v1/object/public/edgestore',
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Create S3 access keys in your project's storage settings. Supabase Storage does
|
|
346
|
+
not support object tagging, storage classes, or server-side encryption options.
|
|
347
|
+
|
|
348
|
+
### MinIO
|
|
245
349
|
|
|
246
350
|
```ts
|
|
247
351
|
s3({
|
|
@@ -252,11 +356,6 @@ s3({
|
|
|
252
356
|
});
|
|
253
357
|
```
|
|
254
358
|
|
|
255
|
-
The endpoint must be reachable from both the application server and browser.
|
|
256
|
-
Set `baseUrl` explicitly for custom domains or virtual-hosted endpoint layouts.
|
|
257
|
-
S3-compatible services may differ in support for KMS, storage classes, tags,
|
|
258
|
-
checksums, and lifecycle policies; only enable settings your service supports.
|
|
259
|
-
|
|
260
359
|
## Limitations
|
|
261
360
|
|
|
262
361
|
* `temporary` and `replaceTargetUrl` are rejected. Track application-owned files
|
package/agent-docs/remix.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Remix / React Router
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/remix
|
|
4
4
|
|
|
5
5
|
Use the Remix adapter with Remix or React Router framework mode. A client-only
|
|
6
6
|
React Router application needs a separate backend; this route runs on the server.
|
|
@@ -12,7 +12,7 @@ React Router application needs a separate backend; this route runs on the server
|
|
|
12
12
|
Packages to install (use the application’s package manager):
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
@edgestore/server
|
|
15
|
+
@edgestore/server @edgestore/react
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### Environment variables
|
|
@@ -22,8 +22,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
22
22
|
Example: title=".env"
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
26
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
> WARNING
|
|
@@ -114,4 +114,4 @@ export default function App() {
|
|
|
114
114
|
|
|
115
115
|
## Usage
|
|
116
116
|
|
|
117
|
-
See [Quick start](https://
|
|
117
|
+
See [Quick start](https://edgestore.dev/docs/quick-start) for the upload UI.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TanStack Start
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/adapters/tanstack-start
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ Source: https://next.edgestore.dev/docs/adapters/tanstack-start
|
|
|
9
9
|
Packages to install (use the application’s package manager):
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
|
-
@edgestore/server
|
|
12
|
+
@edgestore/server @edgestore/react
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Environment variables
|
|
@@ -19,8 +19,8 @@ Copy your project's keys from the [dashboard](https://dashboard.edgestore.dev/)
|
|
|
19
19
|
Example: title=".env.local"
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
EDGESTORE_ACCESS_KEY=your-access-key
|
|
23
|
+
EDGESTORE_SECRET_KEY=your-secret-key
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
> WARNING
|
|
@@ -96,4 +96,4 @@ function RootComponent() {
|
|
|
96
96
|
|
|
97
97
|
## Usage
|
|
98
98
|
|
|
99
|
-
See [Quick start](https://
|
|
99
|
+
See [Quick start](https://edgestore.dev/docs/quick-start) for the upload UI.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
Source: https://
|
|
3
|
+
Source: https://edgestore.dev/docs/troubleshooting
|
|
4
4
|
|
|
5
5
|
## Ask your agent to debug it
|
|
6
6
|
|
|
@@ -34,7 +34,7 @@ rules.
|
|
|
34
34
|
|
|
35
35
|
Check the browser console for errors and the failing request and response in the
|
|
36
36
|
Network panel, then use
|
|
37
|
-
[Error handling](https://
|
|
37
|
+
[Error handling](https://edgestore.dev/docs/error-handling) to identify validation, size, or access
|
|
38
38
|
errors. Confirm that the React provider wraps the upload component.
|
|
39
39
|
|
|
40
40
|
For separate frontend and backend origins, allow the intended frontend origin in
|
|
@@ -42,7 +42,7 @@ CORS and check the adapter's cookie and deployment requirements.
|
|
|
42
42
|
|
|
43
43
|
## Enable server debug logging
|
|
44
44
|
|
|
45
|
-
Enable [debug logging](https://
|
|
45
|
+
Enable [debug logging](https://edgestore.dev/docs/logging) to inspect server-side failures. Debug output
|
|
46
46
|
includes application context and cookies. Remove those values before sharing logs.
|
|
47
47
|
|
|
48
48
|
## Inspect the application with the CLI
|
|
@@ -70,7 +70,7 @@ npm install
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Add your EdgeStore keys to `.env.local` as shown in
|
|
73
|
-
[Quick start](https://
|
|
73
|
+
[Quick start](https://edgestore.dev/docs/quick-start#environment-variables), then run:
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
76
|
npm run dev
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/adapters/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/adapters/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAiBL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,wBAAwB,CAAC,IAAI,SAAS,UAAU,IAAI;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACvD,aAAa,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,IAAI,SAAS,UAAU,EAAE,QAAQ,IAC/D,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAC9B;IACE,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC3D,GACD;IACE,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAC1D,CAAC;AAER,wBAAgB,cAAc,CAAC,IAAI,SAAS,UAAU,EAAE,QAAQ,EAC9D,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,QAAQ,GAChB,YAAY,CAAC,IAAI,CAAC,CAIpB;AAYD,wBAAsB,wBAAwB,CAC5C,IAAI,SAAS,UAAU,EACvB,MAAM,EAAE;IACR,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,EAAE,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAgJpB;AAED,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ;;;;;GAsB9D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EdgeStoreError, EDGE_STORE_ERROR_CODES } from '@edgestore/shared';
|
|
2
2
|
import { parseCookie } from 'cookie';
|
|
3
3
|
import { matchPath } from '../libs/utils.js';
|
|
4
|
-
import { getCookieConfig, init, requestUpload, requestUploadBodySchema, requestUploadParts, requestUploadPartsBodySchema, completeMultipartUpload, completeMultipartUploadBodySchema, abortMultipartUpload, abortMultipartUploadBodySchema, confirmUploads, confirmUploadsBodySchema, deleteFiles, deleteFilesBodySchema } from './shared.js';
|
|
4
|
+
import { getCookieConfig, init, requestUpload, requestUploadBodySchema, requestUploadParts, requestUploadPartsBodySchema, completeMultipartUpload, completeMultipartUploadBodySchema, abortMultipartUpload, abortMultipartUploadBodySchema, getUploadStatus, uploadStatusBodySchema, confirmUploads, confirmUploadsBodySchema, deleteFiles, deleteFilesBodySchema } from './shared.js';
|
|
5
5
|
|
|
6
6
|
function resolveContext(config, options) {
|
|
7
7
|
return hasCreateContext(config) ? config.createContext(options) : {};
|
|
@@ -87,6 +87,15 @@ async function dispatchEdgeStoreRequest(params) {
|
|
|
87
87
|
status: 200
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
if (matchPath(request.pathname, '/upload-status')) {
|
|
91
|
+
return jsonResponse(await getUploadStatus({
|
|
92
|
+
provider,
|
|
93
|
+
router,
|
|
94
|
+
body: await parseRequestBody(request, uploadStatusBodySchema),
|
|
95
|
+
ctxToken,
|
|
96
|
+
logger
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
90
99
|
if (matchPath(request.pathname, '/confirm-uploads')) {
|
|
91
100
|
return jsonResponse(await confirmUploads({
|
|
92
101
|
provider,
|