@edgestore/server 0.1.7 → 0.2.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
CHANGED
|
@@ -98,7 +98,7 @@ export default function RootLayout({
|
|
|
98
98
|
|
|
99
99
|
### Upload file
|
|
100
100
|
|
|
101
|
-
You can use the `useEdgeStore` hook to access typesafe frontend client and use it to upload files.
|
|
101
|
+
You can use the `useEdgeStore` hook to access a typesafe frontend client and use it to upload files.
|
|
102
102
|
|
|
103
103
|
```tsx {1, 6, 19-28}
|
|
104
104
|
import * as React from 'react';
|
|
@@ -144,7 +144,7 @@ export default function Page() {
|
|
|
144
144
|
By passing the `replaceTargetUrl` option, you can replace an existing file with a new one.
|
|
145
145
|
It will automatically delete the old file after the upload is complete.
|
|
146
146
|
|
|
147
|
-
You can also
|
|
147
|
+
You can also upload the file using the same file name, but in that case, you might still see the old file for a while because of the CDN cache.
|
|
148
148
|
|
|
149
149
|
```tsx
|
|
150
150
|
const res = await edgestore.publicFiles.upload({
|
|
@@ -18,7 +18,7 @@ export type UploadOptions = {
|
|
|
18
18
|
* But it might take some time for the CDN cache to be cleared.
|
|
19
19
|
* So maybe you will keep seeing the old file for a while.
|
|
20
20
|
*
|
|
21
|
-
* If you want to replace an existing file immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
|
|
21
|
+
* If you want to replace an existing file, immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
|
|
22
22
|
*/
|
|
23
23
|
manualFileName?: string;
|
|
24
24
|
/**
|
|
@@ -202,7 +202,7 @@ export declare function initEdgeStoreClient<TRouter extends AnyRouter>(config: {
|
|
|
202
202
|
/**
|
|
203
203
|
* The base URL of your application.
|
|
204
204
|
*
|
|
205
|
-
* This is only needed for getting protected files
|
|
205
|
+
* This is only needed for getting protected files in a development environment.
|
|
206
206
|
*
|
|
207
207
|
* @example http://localhost:3000/api/edgestore
|
|
208
208
|
*/
|
package/dist/core/index.js
CHANGED
|
@@ -157,7 +157,7 @@ function initEdgeStoreClient(config) {
|
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Protected files need third-party cookies to work.
|
|
160
|
-
* Since third party cookies
|
|
160
|
+
* Since third party cookies don't work on localhost,
|
|
161
161
|
* we need to proxy the file through the server.
|
|
162
162
|
*/ function getUrl(url, baseUrl) {
|
|
163
163
|
if (process.env.NODE_ENV === 'development' && !url.includes('/_public/')) {
|
package/dist/core/index.mjs
CHANGED
|
@@ -154,7 +154,7 @@ function initEdgeStoreClient(config) {
|
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Protected files need third-party cookies to work.
|
|
157
|
-
* Since third party cookies
|
|
157
|
+
* Since third party cookies don't work on localhost,
|
|
158
158
|
* we need to proxy the file through the server.
|
|
159
159
|
*/ function getUrl(url, baseUrl) {
|
|
160
160
|
if (process.env.NODE_ENV === 'development' && !url.includes('/_public/')) {
|
|
@@ -28,14 +28,14 @@ export type AWSProviderOptions = {
|
|
|
28
28
|
* Base URL to use for accessing files.
|
|
29
29
|
* Only needed if you are using a custom domain or cloudfront.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
31
|
+
* It can also be set via the `EDGE_STORE_BASE_URL` environment variable.
|
|
32
32
|
*/
|
|
33
33
|
baseUrl?: string;
|
|
34
34
|
/**
|
|
35
35
|
* Secret to use for encrypting JWT tokens.
|
|
36
36
|
* Can be generated with `openssl rand -base64 32`.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* It can also be set via the `EDGE_STORE_JWT_SECRET` environment variable.
|
|
39
39
|
*/
|
|
40
40
|
jwtSecret?: string;
|
|
41
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgestore/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Upload files with ease from React/Next.js",
|
|
5
5
|
"homepage": "https://edgestore.dev",
|
|
6
6
|
"repository": "https://github.com/edgestorejs/edgestore.git",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"license": "MIT",
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@edgestore/shared": "0.
|
|
87
|
+
"@edgestore/shared": "0.2.0",
|
|
88
88
|
"@panva/hkdf": "^1.0.4",
|
|
89
89
|
"cookie": "^0.5.0",
|
|
90
90
|
"jose": "^4.13.1",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"typescript": "^5.1.6",
|
|
124
124
|
"zod": "3.21.4"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "a5ecda9ba69eaada4624556dd9422ce49e5dfb66"
|
|
127
127
|
}
|
package/src/core/client/index.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type UploadOptions = {
|
|
|
31
31
|
* But it might take some time for the CDN cache to be cleared.
|
|
32
32
|
* So maybe you will keep seeing the old file for a while.
|
|
33
33
|
*
|
|
34
|
-
* If you want to replace an existing file immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
|
|
34
|
+
* If you want to replace an existing file, immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
|
|
35
35
|
*/
|
|
36
36
|
manualFileName?: string;
|
|
37
37
|
/**
|
|
@@ -245,7 +245,7 @@ export function initEdgeStoreClient<TRouter extends AnyRouter>(config: {
|
|
|
245
245
|
/**
|
|
246
246
|
* The base URL of your application.
|
|
247
247
|
*
|
|
248
|
-
* This is only needed for getting protected files
|
|
248
|
+
* This is only needed for getting protected files in a development environment.
|
|
249
249
|
*
|
|
250
250
|
* @example http://localhost:3000/api/edgestore
|
|
251
251
|
*/
|
|
@@ -404,7 +404,7 @@ export function initEdgeStoreClient<TRouter extends AnyRouter>(config: {
|
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
406
|
* Protected files need third-party cookies to work.
|
|
407
|
-
* Since third party cookies
|
|
407
|
+
* Since third party cookies don't work on localhost,
|
|
408
408
|
* we need to proxy the file through the server.
|
|
409
409
|
*/
|
|
410
410
|
function getUrl(url: string, baseUrl?: string) {
|
|
@@ -37,14 +37,14 @@ export type AWSProviderOptions = {
|
|
|
37
37
|
* Base URL to use for accessing files.
|
|
38
38
|
* Only needed if you are using a custom domain or cloudfront.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* It can also be set via the `EDGE_STORE_BASE_URL` environment variable.
|
|
41
41
|
*/
|
|
42
42
|
baseUrl?: string;
|
|
43
43
|
/**
|
|
44
44
|
* Secret to use for encrypting JWT tokens.
|
|
45
45
|
* Can be generated with `openssl rand -base64 32`.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* It can also be set via the `EDGE_STORE_JWT_SECRET` environment variable.
|
|
48
48
|
*/
|
|
49
49
|
jwtSecret?: string;
|
|
50
50
|
};
|