naystack 1.5.13 → 1.5.15
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/file/client.cjs.js
CHANGED
|
@@ -77,11 +77,12 @@ function getEnv(key, skipCheck) {
|
|
|
77
77
|
// src/file/client.ts
|
|
78
78
|
var useFileUpload = () => {
|
|
79
79
|
const token = (0, import_client.useToken)();
|
|
80
|
-
return (file, type,
|
|
80
|
+
return (file, type, config) => {
|
|
81
81
|
const formData = new FormData();
|
|
82
82
|
formData.append("type", type);
|
|
83
83
|
formData.append("file", file);
|
|
84
|
-
if (
|
|
84
|
+
if (config?.async) formData.append("async", "true");
|
|
85
|
+
if (config?.data) formData.append("data", JSON.stringify(config.data));
|
|
85
86
|
return fetch(getEnv("NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */), {
|
|
86
87
|
method: "PUT",
|
|
87
88
|
body: formData,
|
package/dist/file/client.d.mts
CHANGED
|
@@ -42,7 +42,10 @@
|
|
|
42
42
|
*
|
|
43
43
|
* @category File
|
|
44
44
|
*/
|
|
45
|
-
declare const useFileUpload: () => (file: File | Blob, type: string,
|
|
45
|
+
declare const useFileUpload: () => (file: File | Blob, type: string, config?: {
|
|
46
|
+
data?: object;
|
|
47
|
+
async?: boolean;
|
|
48
|
+
}) => Promise<FileUploadResponseType>;
|
|
46
49
|
/**
|
|
47
50
|
* Shape of the JSON response from the file upload PUT endpoint.
|
|
48
51
|
*
|
|
@@ -53,7 +56,7 @@ declare const useFileUpload: () => (file: File | Blob, type: string, data?: obje
|
|
|
53
56
|
*/
|
|
54
57
|
interface FileUploadResponseType {
|
|
55
58
|
url?: string;
|
|
56
|
-
|
|
59
|
+
data?: object | null;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export { type FileUploadResponseType, useFileUpload };
|
package/dist/file/client.d.ts
CHANGED
|
@@ -42,7 +42,10 @@
|
|
|
42
42
|
*
|
|
43
43
|
* @category File
|
|
44
44
|
*/
|
|
45
|
-
declare const useFileUpload: () => (file: File | Blob, type: string,
|
|
45
|
+
declare const useFileUpload: () => (file: File | Blob, type: string, config?: {
|
|
46
|
+
data?: object;
|
|
47
|
+
async?: boolean;
|
|
48
|
+
}) => Promise<FileUploadResponseType>;
|
|
46
49
|
/**
|
|
47
50
|
* Shape of the JSON response from the file upload PUT endpoint.
|
|
48
51
|
*
|
|
@@ -53,7 +56,7 @@ declare const useFileUpload: () => (file: File | Blob, type: string, data?: obje
|
|
|
53
56
|
*/
|
|
54
57
|
interface FileUploadResponseType {
|
|
55
58
|
url?: string;
|
|
56
|
-
|
|
59
|
+
data?: object | null;
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export { type FileUploadResponseType, useFileUpload };
|
package/dist/file/client.esm.js
CHANGED
|
@@ -53,11 +53,12 @@ function getEnv(key, skipCheck) {
|
|
|
53
53
|
// src/file/client.ts
|
|
54
54
|
var useFileUpload = () => {
|
|
55
55
|
const token = useToken();
|
|
56
|
-
return (file, type,
|
|
56
|
+
return (file, type, config) => {
|
|
57
57
|
const formData = new FormData();
|
|
58
58
|
formData.append("type", type);
|
|
59
59
|
formData.append("file", file);
|
|
60
|
-
if (
|
|
60
|
+
if (config?.async) formData.append("async", "true");
|
|
61
|
+
if (config?.data) formData.append("data", JSON.stringify(config.data));
|
|
61
62
|
return fetch(getEnv("NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */), {
|
|
62
63
|
method: "PUT",
|
|
63
64
|
body: formData,
|