@edgestore/react 0.1.5-alpha.1 → 0.1.5-alpha.3

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type AnyRouter, type InferBucketPathObject, type InferMetadataObject } from '@edgestore/server/core';
2
+ import { type AnyRouter, type InferBucketPathObject, type InferMetadataObject, type UploadOptions } from '@edgestore/server/core';
3
3
  import { type z } from 'zod';
4
4
  /**
5
5
  * @internal
@@ -44,35 +44,6 @@ export type BucketFunctions<TRouter extends AnyRouter> = {
44
44
  };
45
45
  };
46
46
  type OnProgressChangeHandler = (progress: number) => void;
47
- type UploadOptions = {
48
- /**
49
- * e.g. 'my-file-name.jpg'
50
- *
51
- * By default, a unique file name will be generated for each upload.
52
- * If you want to use a custom file name, you can use this option.
53
- * If you use the same file name for multiple uploads, the previous file will be overwritten.
54
- * But it might take some time for the CDN cache to be cleared.
55
- * So maybe you will keep seeing the old file for a while.
56
- *
57
- * If you want to replace an existing file immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
58
- */
59
- manualFileName?: string;
60
- /**
61
- * Use this to replace an existing file.
62
- * It will automatically delete the existing file when the upload is complete.
63
- */
64
- replaceTargetUrl?: string;
65
- /**
66
- * If true, the file needs to be confirmed by using the `confirmUpload` function.
67
- * If the file is not confirmed within 24 hours, it will be deleted.
68
- *
69
- * This is useful for pages where the file is uploaded as soon as it is selected,
70
- * but the user can leave the page without submitting the form.
71
- *
72
- * This avoids unnecessary zombie files in the bucket.
73
- */
74
- temporary?: boolean;
75
- };
76
47
  export declare function createNextProxy<TRouter extends AnyRouter>({ apiPath, uploadingCountRef, maxConcurrentUploads, }: {
77
48
  apiPath: string;
78
49
  uploadingCountRef: React.MutableRefObject<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"createNextProxy.d.ts","sourceRoot":"","sources":["../src/createNextProxy.ts"],"names":[],"mappings":";AACA,OAAO,EACL,KA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,OAAO,EACP,iBAAiB,EACjB,oBAAwB,GACzB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,4BA6CA"}
package/dist/index.js CHANGED
@@ -335,6 +335,7 @@ function EdgeStoreProviderInner({ children, context, basePath, maxConcurrentUplo
335
335
  const json = await res.json();
336
336
  await fetch(`${DEFAULT_BASE_URL}/_init`, {
337
337
  method: 'GET',
338
+ credentials: 'include',
338
339
  headers: {
339
340
  'x-edgestore-token': json.token
340
341
  }
package/dist/index.mjs CHANGED
@@ -311,6 +311,7 @@ function EdgeStoreProviderInner({ children, context, basePath, maxConcurrentUplo
311
311
  const json = await res.json();
312
312
  await fetch(`${DEFAULT_BASE_URL}/_init`, {
313
313
  method: 'GET',
314
+ credentials: 'include',
314
315
  headers: {
315
316
  'x-edgestore-token': json.token
316
317
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestore/react",
3
- "version": "0.1.5-alpha.1",
3
+ "version": "0.1.5-alpha.3",
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",
@@ -60,14 +60,14 @@
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@edgestore/server": "0.1.5-alpha.1",
63
+ "@edgestore/server": "0.1.5-alpha.3",
64
64
  "next": "*",
65
65
  "react": ">=16.8.0",
66
66
  "react-dom": ">=16.8.0",
67
67
  "zod": ">=3.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@edgestore/server": "0.1.5-alpha.1",
70
+ "@edgestore/server": "0.1.5-alpha.3",
71
71
  "@types/cookie": "^0.5.1",
72
72
  "@types/node": "^18.11.18",
73
73
  "@types/uuid": "^9.0.1",
@@ -77,5 +77,5 @@
77
77
  "typescript": "^5.1.6",
78
78
  "zod": "^3.21.4"
79
79
  },
80
- "gitHead": "94b31fd879a0f4f9ed13cc08c9646e29d03c3f92"
80
+ "gitHead": "ca121ee10a9cba4b397412588b4a447e800d4789"
81
81
  }
@@ -101,6 +101,7 @@ function EdgeStoreProviderInner<TRouter extends AnyRouter>({
101
101
  const json = await res.json();
102
102
  await fetch(`${DEFAULT_BASE_URL}/_init`, {
103
103
  method: 'GET',
104
+ credentials: 'include',
104
105
  headers: {
105
106
  'x-edgestore-token': json.token,
106
107
  },
@@ -3,6 +3,7 @@ import {
3
3
  type AnyRouter,
4
4
  type InferBucketPathObject,
5
5
  type InferMetadataObject,
6
+ type UploadOptions,
6
7
  } from '@edgestore/server/core';
7
8
  import { type z } from 'zod';
8
9
  import EdgeStoreError from './libs/errors/EdgeStoreError';
@@ -62,36 +63,6 @@ export type BucketFunctions<TRouter extends AnyRouter> = {
62
63
 
63
64
  type OnProgressChangeHandler = (progress: number) => void;
64
65
 
65
- type UploadOptions = {
66
- /**
67
- * e.g. 'my-file-name.jpg'
68
- *
69
- * By default, a unique file name will be generated for each upload.
70
- * If you want to use a custom file name, you can use this option.
71
- * If you use the same file name for multiple uploads, the previous file will be overwritten.
72
- * But it might take some time for the CDN cache to be cleared.
73
- * So maybe you will keep seeing the old file for a while.
74
- *
75
- * If you want to replace an existing file immediately leave the `manualFileName` option empty and use the `replaceTargetUrl` option.
76
- */
77
- manualFileName?: string;
78
- /**
79
- * Use this to replace an existing file.
80
- * It will automatically delete the existing file when the upload is complete.
81
- */
82
- replaceTargetUrl?: string;
83
- /**
84
- * If true, the file needs to be confirmed by using the `confirmUpload` function.
85
- * If the file is not confirmed within 24 hours, it will be deleted.
86
- *
87
- * This is useful for pages where the file is uploaded as soon as it is selected,
88
- * but the user can leave the page without submitting the form.
89
- *
90
- * This avoids unnecessary zombie files in the bucket.
91
- */
92
- temporary?: boolean;
93
- };
94
-
95
66
  export function createNextProxy<TRouter extends AnyRouter>({
96
67
  apiPath,
97
68
  uploadingCountRef,