@edgestore/react 0.1.5-alpha.0 → 0.1.5-alpha.2
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,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"createNextProxy.d.ts","sourceRoot":"","sources":["../src/createNextProxy.ts"],"names":[],"mappings":";AACA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,KAAK,IAAI;KAC3B,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAE7B,GAAG,EAAE,CAAC;AAEP,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,SAAS,IAAI;KACtD,CAAC,IAAI,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG;QAC/B,MAAM,EAAE,CACN,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,GACjE;YACE,IAAI,EAAE,IAAI,CAAC;YACX,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;YAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;SACzB,GACD;YACE,IAAI,EAAE,IAAI,CAAC;YACX,KAAK,EAAE,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I,CAAC,CAAC;QAC1D,MAAM,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD;CACF,CAAC;AAEF,KAAK,uBAAuB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1D,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,EACzD,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgestore/react",
|
|
3
|
-
"version": "0.1.5-alpha.
|
|
3
|
+
"version": "0.1.5-alpha.2",
|
|
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.
|
|
63
|
+
"@edgestore/server": "0.1.5-alpha.2",
|
|
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.
|
|
70
|
+
"@edgestore/server": "0.1.5-alpha.2",
|
|
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": "
|
|
80
|
+
"gitHead": "d14ccf9e6af38023cfab35d4b64bc75cc69052b4"
|
|
81
81
|
}
|
package/src/createNextProxy.ts
CHANGED
|
@@ -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,
|