@koolbase/react-native 12.18.0 → 12.20.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.
@@ -44,3 +44,30 @@ export type { UseRecordResult } from '@koolbase/core/react';
44
44
  export declare const useRecord: (collection: string, id: string | null | undefined, options?: {
45
45
  live?: boolean;
46
46
  }) => import("@koolbase/core/react").UseRecordResult;
47
+ export type { UseFilesResult } from '@koolbase/core/react';
48
+ /**
49
+ * A bucket's files as React state (storage S4): loading, loaded or error,
50
+ * with refresh and loadMore -- only the files the signed-in person may view.
51
+ * Reloads by itself after an upload, delete, move, copy, metadata change or
52
+ * restore made through this SDK in the bucket. Use it after
53
+ * Koolbase.initialize().
54
+ *
55
+ * ```tsx
56
+ * const photos = useFiles('photos', { prefix: 'trips/', sort: 'createdAt', descending: true });
57
+ * ```
58
+ */
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;
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.useRecord = exports.useCollection = exports.SecureAuthStorage = exports.Koolbase = exports.reactNativePlatform = void 0;
17
+ 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
  //
@@ -200,3 +200,28 @@ exports.useCollection = (0, react_1.createUseCollection)(() => exports.Koolbase.
200
200
  * ```
201
201
  */
202
202
  exports.useRecord = (0, react_1.createUseRecord)(() => exports.Koolbase.db);
203
+ /**
204
+ * A bucket's files as React state (storage S4): loading, loaded or error,
205
+ * with refresh and loadMore -- only the files the signed-in person may view.
206
+ * Reloads by itself after an upload, delete, move, copy, metadata change or
207
+ * restore made through this SDK in the bucket. Use it after
208
+ * Koolbase.initialize().
209
+ *
210
+ * ```tsx
211
+ * const photos = useFiles('photos', { prefix: 'trips/', sort: 'createdAt', descending: true });
212
+ * ```
213
+ */
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);
@@ -44,3 +44,30 @@ export type { UseRecordResult } from '@koolbase/core/react';
44
44
  export declare const useRecord: (collection: string, id: string | null | undefined, options?: {
45
45
  live?: boolean;
46
46
  }) => import("@koolbase/core/react").UseRecordResult;
47
+ export type { UseFilesResult } from '@koolbase/core/react';
48
+ /**
49
+ * A bucket's files as React state (storage S4): loading, loaded or error,
50
+ * with refresh and loadMore -- only the files the signed-in person may view.
51
+ * Reloads by itself after an upload, delete, move, copy, metadata change or
52
+ * restore made through this SDK in the bucket. Use it after
53
+ * Koolbase.initialize().
54
+ *
55
+ * ```tsx
56
+ * const photos = useFiles('photos', { prefix: 'trips/', sort: 'createdAt', descending: true });
57
+ * ```
58
+ */
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;
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, createUseRecord } from '@koolbase/core/react';
12
+ import { createUseCollection, createUseFile, createUseFiles, createUseRecord } from '@koolbase/core/react';
13
13
  let _auth = null;
14
14
  let _db = null;
15
15
  let _storage = null;
@@ -181,3 +181,28 @@ export const useCollection = createUseCollection(() => Koolbase.db);
181
181
  * ```
182
182
  */
183
183
  export const useRecord = createUseRecord(() => Koolbase.db);
184
+ /**
185
+ * A bucket's files as React state (storage S4): loading, loaded or error,
186
+ * with refresh and loadMore -- only the files the signed-in person may view.
187
+ * Reloads by itself after an upload, delete, move, copy, metadata change or
188
+ * restore made through this SDK in the bucket. Use it after
189
+ * Koolbase.initialize().
190
+ *
191
+ * ```tsx
192
+ * const photos = useFiles('photos', { prefix: 'trips/', sort: 'createdAt', descending: true });
193
+ * ```
194
+ */
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/react-native",
3
- "version": "12.18.0",
3
+ "version": "12.20.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.18.0"
27
+ "@koolbase/core": "12.20.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@react-native-async-storage/async-storage": "^2.2.0 || ^3.0.2",