@koolbase/react-native 12.19.0 → 12.21.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.
@@ -57,3 +57,34 @@ export type { UseFilesResult } from '@koolbase/core/react';
57
57
  * ```
58
58
  */
59
59
  export declare const useFiles: (bucket: string, query?: import("@koolbase/core/dist/cjs").FilesQuery) => import("@koolbase/core/react").UseFilesResult;
60
+ export type { UseFileResult } from '@koolbase/core/react';
61
+ /**
62
+ * One file's details as React state (storage S4): loading, loaded, notFound
63
+ * or error, with refresh -- only a file the signed-in person may view. Reads
64
+ * it again by itself after a change made through this SDK in the bucket: a
65
+ * deleted or moved file is notFound. An empty path is notFound, with no
66
+ * request. Use it after Koolbase.initialize().
67
+ *
68
+ * ```tsx
69
+ * const photo = useFile('photos', path);
70
+ * if (photo.status === 'loaded') return <Text>{photo.file.name}</Text>;
71
+ * ```
72
+ */
73
+ export declare const useFile: (bucket: string, path: string | null | undefined) => import("@koolbase/core/react").UseFileResult;
74
+ export type { UseUploadQueueResult } from '@koolbase/core/react';
75
+ /**
76
+ * Several uploads as React state (storage S4): three at a time unless set,
77
+ * each file with its own status ('queued' | 'uploading' | 'verifying' |
78
+ * 'done' | 'failed' | 'cancelled'), progress and error, and cancel and retry
79
+ * by id. A failed file never stops the others. Use it after
80
+ * Koolbase.initialize().
81
+ *
82
+ * ```tsx
83
+ * const queue = useUploadQueue();
84
+ * queue.add(picked.map((f) => ({ bucket: 'photos', path: `trips/${f.name}`, file: f })));
85
+ * queue.items.map((u) => <Row key={u.id} name={u.name} progress={u.progress} />);
86
+ * ```
87
+ */
88
+ export declare const useUploadQueue: (options?: {
89
+ concurrency?: number;
90
+ }) => import("@koolbase/core/react").UseUploadQueueResult;
package/dist/cjs/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useFiles = exports.useRecord = exports.useCollection = exports.SecureAuthStorage = exports.Koolbase = exports.reactNativePlatform = void 0;
17
+ exports.useUploadQueue = exports.useFile = exports.useFiles = exports.useRecord = exports.useCollection = exports.SecureAuthStorage = exports.Koolbase = exports.reactNativePlatform = void 0;
18
18
  const react_native_1 = require("react-native");
19
19
  // @koolbase/react-native — composes @koolbase/core for a React Native host.
20
20
  //
@@ -212,3 +212,30 @@ exports.useRecord = (0, react_1.createUseRecord)(() => exports.Koolbase.db);
212
212
  * ```
213
213
  */
214
214
  exports.useFiles = (0, react_1.createUseFiles)(() => exports.Koolbase.storage);
215
+ /**
216
+ * One file's details as React state (storage S4): loading, loaded, notFound
217
+ * or error, with refresh -- only a file the signed-in person may view. Reads
218
+ * it again by itself after a change made through this SDK in the bucket: a
219
+ * deleted or moved file is notFound. An empty path is notFound, with no
220
+ * request. Use it after Koolbase.initialize().
221
+ *
222
+ * ```tsx
223
+ * const photo = useFile('photos', path);
224
+ * if (photo.status === 'loaded') return <Text>{photo.file.name}</Text>;
225
+ * ```
226
+ */
227
+ exports.useFile = (0, react_1.createUseFile)(() => exports.Koolbase.storage);
228
+ /**
229
+ * Several uploads as React state (storage S4): three at a time unless set,
230
+ * each file with its own status ('queued' | 'uploading' | 'verifying' |
231
+ * 'done' | 'failed' | 'cancelled'), progress and error, and cancel and retry
232
+ * by id. A failed file never stops the others. Use it after
233
+ * Koolbase.initialize().
234
+ *
235
+ * ```tsx
236
+ * const queue = useUploadQueue();
237
+ * queue.add(picked.map((f) => ({ bucket: 'photos', path: `trips/${f.name}`, file: f })));
238
+ * queue.items.map((u) => <Row key={u.id} name={u.name} progress={u.progress} />);
239
+ * ```
240
+ */
241
+ exports.useUploadQueue = (0, react_1.createUseUploadQueue)(() => exports.Koolbase.storage);
@@ -57,3 +57,34 @@ export type { UseFilesResult } from '@koolbase/core/react';
57
57
  * ```
58
58
  */
59
59
  export declare const useFiles: (bucket: string, query?: import("@koolbase/core").FilesQuery) => import("@koolbase/core/react").UseFilesResult;
60
+ export type { UseFileResult } from '@koolbase/core/react';
61
+ /**
62
+ * One file's details as React state (storage S4): loading, loaded, notFound
63
+ * or error, with refresh -- only a file the signed-in person may view. Reads
64
+ * it again by itself after a change made through this SDK in the bucket: a
65
+ * deleted or moved file is notFound. An empty path is notFound, with no
66
+ * request. Use it after Koolbase.initialize().
67
+ *
68
+ * ```tsx
69
+ * const photo = useFile('photos', path);
70
+ * if (photo.status === 'loaded') return <Text>{photo.file.name}</Text>;
71
+ * ```
72
+ */
73
+ export declare const useFile: (bucket: string, path: string | null | undefined) => import("@koolbase/core/react").UseFileResult;
74
+ export type { UseUploadQueueResult } from '@koolbase/core/react';
75
+ /**
76
+ * Several uploads as React state (storage S4): three at a time unless set,
77
+ * each file with its own status ('queued' | 'uploading' | 'verifying' |
78
+ * 'done' | 'failed' | 'cancelled'), progress and error, and cancel and retry
79
+ * by id. A failed file never stops the others. Use it after
80
+ * Koolbase.initialize().
81
+ *
82
+ * ```tsx
83
+ * const queue = useUploadQueue();
84
+ * queue.add(picked.map((f) => ({ bucket: 'photos', path: `trips/${f.name}`, file: f })));
85
+ * queue.items.map((u) => <Row key={u.id} name={u.name} progress={u.progress} />);
86
+ * ```
87
+ */
88
+ export declare const useUploadQueue: (options?: {
89
+ concurrency?: number;
90
+ }) => import("@koolbase/core/react").UseUploadQueueResult;
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ export * from '@koolbase/core';
9
9
  export { reactNativePlatform } from './platform.js';
10
10
  import { KoolbaseAuth, KoolbaseDatabase, KoolbaseFiscal, KoolbaseStorage, KoolbaseRealtime, KoolbaseFunctions, KoolbaseConnectivity, KoolbaseFlags, KoolbaseAnalytics, disabledAnalytics, KoolbaseMessaging, getOrCreateDeviceId, setPlatform, setSessionRenewal } from '@koolbase/core';
11
11
  import { reactNativePlatform } from './platform.js';
12
- import { createUseCollection, createUseFiles, createUseRecord } from '@koolbase/core/react';
12
+ import { createUseCollection, createUseFile, createUseFiles, createUseRecord, createUseUploadQueue } from '@koolbase/core/react';
13
13
  let _auth = null;
14
14
  let _db = null;
15
15
  let _storage = null;
@@ -193,3 +193,30 @@ export const useRecord = createUseRecord(() => Koolbase.db);
193
193
  * ```
194
194
  */
195
195
  export const useFiles = createUseFiles(() => Koolbase.storage);
196
+ /**
197
+ * One file's details as React state (storage S4): loading, loaded, notFound
198
+ * or error, with refresh -- only a file the signed-in person may view. Reads
199
+ * it again by itself after a change made through this SDK in the bucket: a
200
+ * deleted or moved file is notFound. An empty path is notFound, with no
201
+ * request. Use it after Koolbase.initialize().
202
+ *
203
+ * ```tsx
204
+ * const photo = useFile('photos', path);
205
+ * if (photo.status === 'loaded') return <Text>{photo.file.name}</Text>;
206
+ * ```
207
+ */
208
+ export const useFile = createUseFile(() => Koolbase.storage);
209
+ /**
210
+ * Several uploads as React state (storage S4): three at a time unless set,
211
+ * each file with its own status ('queued' | 'uploading' | 'verifying' |
212
+ * 'done' | 'failed' | 'cancelled'), progress and error, and cancel and retry
213
+ * by id. A failed file never stops the others. Use it after
214
+ * Koolbase.initialize().
215
+ *
216
+ * ```tsx
217
+ * const queue = useUploadQueue();
218
+ * queue.add(picked.map((f) => ({ bucket: 'photos', path: `trips/${f.name}`, file: f })));
219
+ * queue.items.map((u) => <Row key={u.id} name={u.name} progress={u.progress} />);
220
+ * ```
221
+ */
222
+ export const useUploadQueue = createUseUploadQueue(() => Koolbase.storage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/react-native",
3
- "version": "12.19.0",
3
+ "version": "12.21.0",
4
4
  "description": "React Native SDK for Koolbase \u2014 auth, database, storage, realtime, feature flags, and functions in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/koolbase/koolbase-react-native"
25
25
  },
26
26
  "dependencies": {
27
- "@koolbase/core": "12.19.0"
27
+ "@koolbase/core": "12.21.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-native-async-storage/async-storage": "^2.2.0 || ^3.0.2",