@umituz/react-native-firebase 3.0.0 → 3.0.2

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": "3.0.0",
3
+ "version": "3.0.2",
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",
@@ -18,14 +18,19 @@ export * from './domain';
18
18
  // INFRASTRUCTURE LAYER - Implementation
19
19
  // =============================================================================
20
20
 
21
- // Firestore Client
22
- export {
23
- initializeFirestore,
24
- getFirestore,
25
- isFirestoreInitialized,
26
- getFirestoreInitializationError,
27
- resetFirestoreClient,
28
- } from './infrastructure/config/FirestoreClient';
21
+ // IMPORTANT: Use Firebase SDK directly for Firestore operations
22
+ // Import in your app: import { getFirestore } from 'firebase/firestore';
23
+ //
24
+ // Firestore initialization:
25
+ // import { initializeFirestore } from 'firebase/firestore';
26
+ // import { getReactNativePersistence } from 'firebase/firestore/react-native';
27
+ // import AsyncStorage from '@react-native-async-storage/async-storage';
28
+ //
29
+ // const db = initializeFirestore(firebaseApp, {
30
+ // localCache: getReactNativePersistence(AsyncStorage)
31
+ // });
32
+
33
+ // Firestore type (any to avoid conflicts)
29
34
  export type { Firestore } from './infrastructure/config/FirestoreClient';
30
35
 
31
36
  // Repositories
@@ -1,80 +1,24 @@
1
1
  /**
2
2
  * Firestore Configuration Client
3
3
  *
4
- * IMPORTANT: Does NOT import from firebase/firestore.
5
- * Import firebase SDK in your app and initialize it there.
6
- *
7
- * This client only provides type definitions and initialization helpers.
8
- */
9
-
10
- import { FirebaseInitializationError } from "../../../../shared/domain/errors/FirebaseError";
11
-
12
- export interface Firestore {
13
- app: unknown; // FirebaseApp from firebase/app
14
- }
15
-
16
- let firestoreInstance: Firestore | null = null;
17
- let initializationError: Error | null = null;
18
-
19
- /**
20
- * Initialize Firestore
21
- * Note: This is a placeholder. You should initialize Firestore in your app using:
22
- * import { initializeFirestore } from 'firebase/firestore';
4
+ * IMPORTANT: This package does NOT provide Firestore initialization.
5
+ * Use Firebase SDK directly in your app:
6
+ * ```typescript
7
+ * import { getFirestore, initializeFirestore } from 'firebase/firestore';
23
8
  * import { getReactNativePersistence } from 'firebase/firestore/react-native';
9
+ * import AsyncStorage from '@react-native-async-storage/async-storage';
10
+ *
11
+ * const db = initializeFirestore(firebaseApp, {
12
+ * localCache: getReactNativePersistence(AsyncStorage)
13
+ * });
14
+ * ```
15
+ *
16
+ * This package only provides:
17
+ * - Base repository classes (extend these for your data layer)
18
+ * - Utilities for pagination, queries, dates
19
+ * - Type definitions (import from 'firebase/firestore' in your app)
24
20
  */
25
- export async function initializeFirestore(
26
- firebaseApp: unknown // FirebaseApp from firebase/app
27
- ): Promise<Firestore> {
28
- if (firestoreInstance) {
29
- return firestoreInstance;
30
- }
31
-
32
- try {
33
- // In a real app, you would do:
34
- // const { getFirestore, initializeFirestore } = await import('firebase/firestore');
35
- // const { getReactNativePersistence } = await import('firebase/firestore/react-native');
36
- // const persistence = getReactNativePersistence();
37
- // firestoreInstance = initializeFirestore(firebaseApp, {
38
- // localCache: persistence
39
- // });
40
-
41
- // For now, this is a placeholder that assumes firestore is initialized elsewhere
42
- throw new FirebaseInitializationError(
43
- "Firestore must be initialized in your app using firebase/firestore SDK. " +
44
- "Use initializeFirestore() from 'firebase/firestore' with React Native persistence."
45
- );
46
- } catch (error) {
47
- initializationError = error as Error;
48
- throw error;
49
- }
50
- }
51
-
52
- /**
53
- * Get Firestore instance
54
- * Returns null if not initialized
55
- */
56
- export function getFirestore(): Firestore | null {
57
- return firestoreInstance;
58
- }
59
-
60
- /**
61
- * Check if Firestore is initialized
62
- */
63
- export function isFirestoreInitialized(): boolean {
64
- return firestoreInstance !== null;
65
- }
66
-
67
- /**
68
- * Get Firestore initialization error
69
- */
70
- export function getFirestoreInitializationError(): Error | null {
71
- return initializationError;
72
- }
73
21
 
74
- /**
75
- * Reset Firestore client state
76
- */
77
- export function resetFirestoreClient(): void {
78
- firestoreInstance = null;
79
- initializationError = null;
80
- }
22
+ // Firestore type - use 'any' to avoid type conflicts with Firebase SDK
23
+ // The actual type checking happens in your app when you import from firebase/firestore
24
+ export type Firestore = any;
@@ -29,9 +29,9 @@ export interface FirebaseAppOptions {
29
29
  // Firestore Types
30
30
  // =============================================================================
31
31
 
32
- export interface Firestore {
33
- app: FirebaseApp;
34
- }
32
+ // Firestore type - use 'any' to avoid type conflicts with Firebase SDK
33
+ // In your app, import the actual type: import type { Firestore } from 'firebase/firestore'
34
+ export type Firestore = any;
35
35
 
36
36
  export interface DocumentSnapshot<T = unknown> {
37
37
  id: string;