naystack 1.7.40 → 1.7.41

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,3 +1,14 @@
1
+ /**
2
+ * A React Native file descriptor. On native there is no `File`/`Blob` for a file
3
+ * on disk — you append `{ uri, name, type }` to `FormData` and RN's networking
4
+ * streams it straight from disk (no in-memory copy). `FormData.append` accepts it
5
+ * as-is, so `useFileUpload` handles it identically to a web `File`/`Blob`.
6
+ */
7
+ type NativeFile = {
8
+ uri: string;
9
+ name: string;
10
+ type: string;
11
+ };
1
12
  /**
2
13
  * Returns a function that uploads a file to your file upload endpoint with the current auth token.
3
14
  * Must be used inside a tree that provides the token (i.e. inside `AuthWrapper`).
@@ -6,7 +17,8 @@
6
17
  * along with a `type` string and optional JSON `data` for metadata.
7
18
  *
8
19
  * @returns A function `(file, type, config?) => Promise<FileUploadResponseType | null>`.
9
- * - `file` — `File` or `Blob` to upload.
20
+ * - `file` — `File` or `Blob` (web) or a `{ uri, name, type }` {@link NativeFile}
21
+ * descriptor (React Native) to upload.
10
22
  * - `type` — String category (e.g. `"avatar"`, `"DealDocument"`); sent as form field `type`.
11
23
  * - `config` — Optional object with:
12
24
  * - `data` — JSON-serializable metadata object; sent as form field `data`.
@@ -42,7 +54,7 @@
42
54
  *
43
55
  * @category File
44
56
  */
45
- declare const useFileUpload: () => (file: File | Blob, type: string, config?: {
57
+ declare const useFileUpload: () => (file: File | Blob | NativeFile, type: string, config?: {
46
58
  data?: object;
47
59
  async?: boolean;
48
60
  }) => Promise<FileUploadResponseType>;
@@ -59,4 +71,4 @@ interface FileUploadResponseType {
59
71
  data?: object | null;
60
72
  }
61
73
 
62
- export { type FileUploadResponseType, useFileUpload };
74
+ export { type FileUploadResponseType, type NativeFile, useFileUpload };
@@ -1,3 +1,14 @@
1
+ /**
2
+ * A React Native file descriptor. On native there is no `File`/`Blob` for a file
3
+ * on disk — you append `{ uri, name, type }` to `FormData` and RN's networking
4
+ * streams it straight from disk (no in-memory copy). `FormData.append` accepts it
5
+ * as-is, so `useFileUpload` handles it identically to a web `File`/`Blob`.
6
+ */
7
+ type NativeFile = {
8
+ uri: string;
9
+ name: string;
10
+ type: string;
11
+ };
1
12
  /**
2
13
  * Returns a function that uploads a file to your file upload endpoint with the current auth token.
3
14
  * Must be used inside a tree that provides the token (i.e. inside `AuthWrapper`).
@@ -6,7 +17,8 @@
6
17
  * along with a `type` string and optional JSON `data` for metadata.
7
18
  *
8
19
  * @returns A function `(file, type, config?) => Promise<FileUploadResponseType | null>`.
9
- * - `file` — `File` or `Blob` to upload.
20
+ * - `file` — `File` or `Blob` (web) or a `{ uri, name, type }` {@link NativeFile}
21
+ * descriptor (React Native) to upload.
10
22
  * - `type` — String category (e.g. `"avatar"`, `"DealDocument"`); sent as form field `type`.
11
23
  * - `config` — Optional object with:
12
24
  * - `data` — JSON-serializable metadata object; sent as form field `data`.
@@ -42,7 +54,7 @@
42
54
  *
43
55
  * @category File
44
56
  */
45
- declare const useFileUpload: () => (file: File | Blob, type: string, config?: {
57
+ declare const useFileUpload: () => (file: File | Blob | NativeFile, type: string, config?: {
46
58
  data?: object;
47
59
  async?: boolean;
48
60
  }) => Promise<FileUploadResponseType>;
@@ -59,4 +71,4 @@ interface FileUploadResponseType {
59
71
  data?: object | null;
60
72
  }
61
73
 
62
- export { type FileUploadResponseType, useFileUpload };
74
+ export { type FileUploadResponseType, type NativeFile, useFileUpload };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.7.40",
3
+ "version": "1.7.41",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",