@umituz/react-native-firebase 2.4.44 → 2.4.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "2.4.44",
3
+ "version": "2.4.46",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -64,10 +64,8 @@ class FirestoreClientSingleton extends ServiceClientSingleton<Firestore> {
64
64
  function getFirestoreClientSafe(): FirestoreClientSingleton | null {
65
65
  try {
66
66
  return FirestoreClientSingleton.getInstance();
67
- } catch {
68
- if (__DEV__) {
69
- console.warn('[Firestore] Could not create Firestore client singleton.');
70
- }
67
+ } catch (error) {
68
+ console.error('[Firestore] Could not create Firestore client singleton:', error);
71
69
  return null;
72
70
  }
73
71
  }
@@ -24,26 +24,28 @@ export async function withFirestore<T>(
24
24
 
25
25
  /**
26
26
  * Execute a Firestore operation that returns void
27
+ * @throws {Error} if Firestore is not available
27
28
  */
28
29
  export async function withFirestoreVoid(
29
30
  operation: (db: Firestore) => Promise<void>,
30
31
  ): Promise<void> {
31
32
  const db = getFirestore();
32
33
  if (!db) {
33
- return;
34
+ throw new Error('[withFirestoreVoid] Firestore is not available');
34
35
  }
35
36
  return operation(db);
36
37
  }
37
38
 
38
39
  /**
39
40
  * Execute a Firestore operation that returns boolean
41
+ * @throws {Error} if Firestore is not available
40
42
  */
41
43
  export async function withFirestoreBool(
42
44
  operation: (db: Firestore) => Promise<boolean>,
43
45
  ): Promise<boolean> {
44
46
  const db = getFirestore();
45
47
  if (!db) {
46
- return false;
48
+ throw new Error('[withFirestoreBool] Firestore is not available');
47
49
  }
48
50
  return operation(db);
49
51
  }
@@ -9,7 +9,7 @@ export type NoDbResult = FailureResult;
9
9
 
10
10
  const NO_DB_ERROR: NoDbResult = {
11
11
  success: false,
12
- error: { message: "No DB", code: "DB_ERR" },
12
+ error: { message: "Firestore is not initialized", code: "firestore/not-initialized" },
13
13
  };
14
14
 
15
15
  /**
@@ -22,7 +22,9 @@ export function createErrorResult<T>(message: string, code: string): Result<T> {
22
22
  /**
23
23
  * Create a standard success result
24
24
  */
25
- export function createSuccessResult<T>(data?: T): Result<T> {
25
+ export function createSuccessResult(): Result<void>;
26
+ export function createSuccessResult<T>(data: T): Result<T>;
27
+ export function createSuccessResult<T = void>(data?: T): Result<T> {
26
28
  return { success: true, data: data as T };
27
29
  }
28
30
 
@@ -9,6 +9,8 @@ import { toErrorInfo } from '../error-handlers/error-converters';
9
9
  /**
10
10
  * Create a success result with optional data
11
11
  */
12
+ export function successResult(): SuccessResult<void>;
13
+ export function successResult<T>(data: T): SuccessResult<T>;
12
14
  export function successResult<T = void>(data?: T): SuccessResult<T> {
13
15
  return { success: true, data: data as T };
14
16
  }