@umituz/react-native-firebase 1.4.0 → 1.5.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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/application/ports/IFirebaseClient.d.ts +37 -0
- package/lib/application/ports/IFirebaseClient.d.ts.map +1 -0
- package/lib/application/ports/IFirebaseClient.js +8 -0
- package/lib/application/ports/IFirebaseClient.js.map +1 -0
- package/lib/domain/errors/FirebaseError.d.ts +28 -0
- package/lib/domain/errors/FirebaseError.d.ts.map +1 -0
- package/lib/domain/errors/FirebaseError.js +46 -0
- package/lib/domain/errors/FirebaseError.js.map +1 -0
- package/lib/domain/value-objects/FirebaseConfig.d.ts +36 -0
- package/lib/domain/value-objects/FirebaseConfig.d.ts.map +1 -0
- package/lib/domain/value-objects/FirebaseConfig.js +8 -0
- package/lib/domain/value-objects/FirebaseConfig.js.map +1 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/config/FirebaseClient.d.ts +145 -0
- package/lib/infrastructure/config/FirebaseClient.d.ts.map +1 -0
- package/lib/infrastructure/config/FirebaseClient.js +335 -0
- package/lib/infrastructure/config/FirebaseClient.js.map +1 -0
- package/lib/infrastructure/config/FirebaseConfigLoader.d.ts +16 -0
- package/lib/infrastructure/config/FirebaseConfigLoader.d.ts.map +1 -0
- package/lib/infrastructure/config/FirebaseConfigLoader.js +131 -0
- package/lib/infrastructure/config/FirebaseConfigLoader.js.map +1 -0
- package/lib/infrastructure/config/initializers/FirebaseAppInitializer.d.ts +17 -0
- package/lib/infrastructure/config/initializers/FirebaseAppInitializer.d.ts.map +1 -0
- package/lib/infrastructure/config/initializers/FirebaseAppInitializer.js +83 -0
- package/lib/infrastructure/config/initializers/FirebaseAppInitializer.js.map +1 -0
- package/lib/infrastructure/config/validators/FirebaseConfigValidator.d.ts +18 -0
- package/lib/infrastructure/config/validators/FirebaseConfigValidator.d.ts.map +1 -0
- package/lib/infrastructure/config/validators/FirebaseConfigValidator.js +62 -0
- package/lib/infrastructure/config/validators/FirebaseConfigValidator.js.map +1 -0
- package/package.json +19 -4
- package/src/application/ports/IFirebaseClient.ts +1 -1
- package/src/domain/errors/FirebaseError.ts +0 -0
- package/src/domain/value-objects/FirebaseConfig.ts +0 -0
- package/src/index.ts +0 -0
- package/src/infrastructure/config/FirebaseClient.ts +222 -92
- package/src/infrastructure/config/FirebaseConfigLoader.ts +140 -45
- package/src/infrastructure/config/initializers/FirebaseAppInitializer.ts +67 -27
- package/src/infrastructure/config/validators/FirebaseConfigValidator.ts +58 -25
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Client Port (Interface)
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design: Application layer port for Firebase client
|
|
5
|
+
* Defines the contract for Firebase client operations
|
|
6
|
+
*/
|
|
7
|
+
export type FirebaseApp = any;
|
|
8
|
+
/**
|
|
9
|
+
* Firebase Client Interface
|
|
10
|
+
* Defines the contract for Firebase client operations
|
|
11
|
+
*
|
|
12
|
+
* Note:
|
|
13
|
+
* - Firebase Auth is now handled by @umituz/react-native-firebase-auth
|
|
14
|
+
* - Firestore is now handled by @umituz/react-native-firestore
|
|
15
|
+
*/
|
|
16
|
+
export interface IFirebaseClient {
|
|
17
|
+
/**
|
|
18
|
+
* Get the Firebase app instance
|
|
19
|
+
* Returns null if config is not available (offline mode)
|
|
20
|
+
* @returns Firebase app instance or null if not initialized
|
|
21
|
+
*/
|
|
22
|
+
getApp(): FirebaseApp | null;
|
|
23
|
+
/**
|
|
24
|
+
* Check if client is initialized
|
|
25
|
+
*/
|
|
26
|
+
isInitialized(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get initialization error if any
|
|
29
|
+
*/
|
|
30
|
+
getInitializationError(): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Reset the client instance
|
|
33
|
+
* Useful for testing
|
|
34
|
+
*/
|
|
35
|
+
reset(): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=IFirebaseClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFirebaseClient.d.ts","sourceRoot":"","sources":["../../../src/application/ports/IFirebaseClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,MAAM,IAAI,WAAW,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC;IAEzB;;OAEG;IACH,sBAAsB,IAAI,MAAM,GAAG,IAAI,CAAC;IAExC;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IFirebaseClient.js","sourceRoot":"","sources":["../../../src/application/ports/IFirebaseClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Domain Errors
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design: Error types for Firebase operations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base Firebase Error
|
|
8
|
+
*/
|
|
9
|
+
export declare class FirebaseError extends Error {
|
|
10
|
+
readonly code?: string | undefined;
|
|
11
|
+
readonly originalError?: unknown | undefined;
|
|
12
|
+
constructor(message: string, code?: string | undefined, originalError?: unknown | undefined);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Initialization Error
|
|
16
|
+
* Thrown when Firebase client fails to initialize
|
|
17
|
+
*/
|
|
18
|
+
export declare class FirebaseInitializationError extends FirebaseError {
|
|
19
|
+
constructor(message: string, originalError?: unknown);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Configuration Error
|
|
23
|
+
* Thrown when required configuration is missing or invalid
|
|
24
|
+
*/
|
|
25
|
+
export declare class FirebaseConfigurationError extends FirebaseError {
|
|
26
|
+
constructor(message: string, originalError?: unknown);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=FirebaseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirebaseError.d.ts","sourceRoot":"","sources":["../../../src/domain/errors/FirebaseError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;aAGpB,IAAI,CAAC,EAAE,MAAM;aACb,aAAa,CAAC,EAAE,OAAO;gBAFvC,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,aAAa,CAAC,EAAE,OAAO,YAAA;CAM1C;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,aAAa;gBAChD,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO;CAKrD;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,aAAa;gBAC/C,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO;CAKrD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Domain Errors
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design: Error types for Firebase operations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Base Firebase Error
|
|
8
|
+
*/
|
|
9
|
+
export class FirebaseError extends Error {
|
|
10
|
+
constructor(message, code, originalError) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.originalError = originalError;
|
|
14
|
+
this.name = 'FirebaseError';
|
|
15
|
+
Object.setPrototypeOf(this, FirebaseError.prototype);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Initialization Error
|
|
20
|
+
* Thrown when Firebase client fails to initialize
|
|
21
|
+
*/
|
|
22
|
+
export class FirebaseInitializationError extends FirebaseError {
|
|
23
|
+
constructor(message, originalError) {
|
|
24
|
+
super(message, 'INITIALIZATION_ERROR', originalError);
|
|
25
|
+
this.name = 'FirebaseInitializationError';
|
|
26
|
+
Object.setPrototypeOf(this, FirebaseInitializationError.prototype);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration Error
|
|
31
|
+
* Thrown when required configuration is missing or invalid
|
|
32
|
+
*/
|
|
33
|
+
export class FirebaseConfigurationError extends FirebaseError {
|
|
34
|
+
constructor(message, originalError) {
|
|
35
|
+
super(message, 'CONFIGURATION_ERROR', originalError);
|
|
36
|
+
this.name = 'FirebaseConfigurationError';
|
|
37
|
+
Object.setPrototypeOf(this, FirebaseConfigurationError.prototype);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Note: FirebaseAnalyticsError, FirebaseCrashlyticsError, FirebaseAuthError, and FirebaseFirestoreError
|
|
41
|
+
// have been moved to their respective packages:
|
|
42
|
+
// - @umituz/react-native-firebase-analytics
|
|
43
|
+
// - @umituz/react-native-firebase-crashlytics
|
|
44
|
+
// - @umituz/react-native-firebase-auth
|
|
45
|
+
// - @umituz/react-native-firestore
|
|
46
|
+
//# sourceMappingURL=FirebaseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirebaseError.js","sourceRoot":"","sources":["../../../src/domain/errors/FirebaseError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,IAAa,EACb,aAAuB;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAS;QACb,kBAAa,GAAb,aAAa,CAAU;QAGvC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,aAAa;IAC5D,YAAY,OAAe,EAAE,aAAuB;QAClD,KAAK,CAAC,OAAO,EAAE,sBAAsB,EAAE,aAAa,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;QAC1C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACrE,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAC3D,YAAY,OAAe,EAAE,aAAuB;QAClD,KAAK,CAAC,OAAO,EAAE,qBAAqB,EAAE,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;CACF;AAED,wGAAwG;AACxG,gDAAgD;AAChD,4CAA4C;AAC5C,8CAA8C;AAC9C,uCAAuC;AACvC,mCAAmC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Configuration Value Object
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design: Value object for Firebase configuration
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Firebase Configuration
|
|
8
|
+
* Required configuration for initializing Firebase client
|
|
9
|
+
*/
|
|
10
|
+
export interface FirebaseConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Firebase API Key
|
|
13
|
+
*/
|
|
14
|
+
apiKey: string;
|
|
15
|
+
/**
|
|
16
|
+
* Firebase Auth Domain
|
|
17
|
+
*/
|
|
18
|
+
authDomain: string;
|
|
19
|
+
/**
|
|
20
|
+
* Firebase Project ID
|
|
21
|
+
*/
|
|
22
|
+
projectId: string;
|
|
23
|
+
/**
|
|
24
|
+
* Firebase Storage Bucket
|
|
25
|
+
*/
|
|
26
|
+
storageBucket?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Firebase Messaging Sender ID
|
|
29
|
+
*/
|
|
30
|
+
messagingSenderId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Firebase App ID
|
|
33
|
+
*/
|
|
34
|
+
appId?: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=FirebaseConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirebaseConfig.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/FirebaseConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirebaseConfig.js","sourceRoot":"","sources":["../../../src/domain/value-objects/FirebaseConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAsCH,mFAAmF"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native Firebase - Minimal Core Package
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design (DDD) Architecture
|
|
5
|
+
*
|
|
6
|
+
* This package provides ONLY Firebase App initialization.
|
|
7
|
+
* For other Firebase services, use dedicated packages:
|
|
8
|
+
* - @umituz/react-native-firebase-auth - Firebase Authentication
|
|
9
|
+
* - @umituz/react-native-firebase-analytics - Firebase Analytics
|
|
10
|
+
* - @umituz/react-native-firebase-crashlytics - Firebase Crashlytics
|
|
11
|
+
* - @umituz/react-native-firestore - Firestore initialization and utilities
|
|
12
|
+
*
|
|
13
|
+
* Architecture:
|
|
14
|
+
* - domain: Entities, value objects, errors (business logic)
|
|
15
|
+
* - application: Ports (interfaces)
|
|
16
|
+
* - infrastructure: Firebase client implementation
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* import { initializeFirebase, getFirebaseApp } from '@umituz/react-native-firebase';
|
|
20
|
+
*/
|
|
21
|
+
export { FirebaseError, FirebaseInitializationError, FirebaseConfigurationError, } from './domain/errors/FirebaseError';
|
|
22
|
+
export type { FirebaseConfig } from './domain/value-objects/FirebaseConfig';
|
|
23
|
+
export type { IFirebaseClient } from './application/ports/IFirebaseClient';
|
|
24
|
+
export { initializeFirebase, getFirebaseApp, autoInitializeFirebase, initializeAllFirebaseServices, isFirebaseInitialized, getFirebaseInitializationError, resetFirebaseClient, firebaseClient, } from './infrastructure/config/FirebaseClient';
|
|
25
|
+
export type { FirebaseApp, } from './infrastructure/config/FirebaseClient';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAM5E,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM3E,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,GACf,MAAM,wCAAwC,CAAC;AAEhD,YAAY,EACV,WAAW,GACZ,MAAM,wCAAwC,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native Firebase - Minimal Core Package
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design (DDD) Architecture
|
|
5
|
+
*
|
|
6
|
+
* This package provides ONLY Firebase App initialization.
|
|
7
|
+
* For other Firebase services, use dedicated packages:
|
|
8
|
+
* - @umituz/react-native-firebase-auth - Firebase Authentication
|
|
9
|
+
* - @umituz/react-native-firebase-analytics - Firebase Analytics
|
|
10
|
+
* - @umituz/react-native-firebase-crashlytics - Firebase Crashlytics
|
|
11
|
+
* - @umituz/react-native-firestore - Firestore initialization and utilities
|
|
12
|
+
*
|
|
13
|
+
* Architecture:
|
|
14
|
+
* - domain: Entities, value objects, errors (business logic)
|
|
15
|
+
* - application: Ports (interfaces)
|
|
16
|
+
* - infrastructure: Firebase client implementation
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* import { initializeFirebase, getFirebaseApp } from '@umituz/react-native-firebase';
|
|
20
|
+
*/
|
|
21
|
+
// =============================================================================
|
|
22
|
+
// DOMAIN LAYER - Business Logic
|
|
23
|
+
// =============================================================================
|
|
24
|
+
export { FirebaseError, FirebaseInitializationError, FirebaseConfigurationError, } from './domain/errors/FirebaseError';
|
|
25
|
+
// =============================================================================
|
|
26
|
+
// INFRASTRUCTURE LAYER - Implementation
|
|
27
|
+
// =============================================================================
|
|
28
|
+
export { initializeFirebase, getFirebaseApp, autoInitializeFirebase, initializeAllFirebaseServices, isFirebaseInitialized, getFirebaseInitializationError, resetFirebaseClient, firebaseClient, } from './infrastructure/config/FirebaseClient';
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAUvC,gFAAgF;AAChF,wCAAwC;AACxC,gFAAgF;AAEhF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,8BAA8B,EAC9B,mBAAmB,EACnB,cAAc,GACf,MAAM,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Client - Infrastructure Layer
|
|
3
|
+
*
|
|
4
|
+
* Domain-Driven Design: Infrastructure implementation of Firebase client
|
|
5
|
+
* Singleton pattern for managing Firebase client instance
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: This package does NOT read from .env files.
|
|
8
|
+
* Configuration must be provided by the application.
|
|
9
|
+
*
|
|
10
|
+
* SOLID Principles:
|
|
11
|
+
* - Single Responsibility: Only orchestrates initialization, delegates to specialized classes
|
|
12
|
+
* - Open/Closed: Extensible through configuration, closed for modification
|
|
13
|
+
* - Dependency Inversion: Depends on abstractions (interfaces), not concrete implementations
|
|
14
|
+
*/
|
|
15
|
+
import type { FirebaseConfig } from '../../domain/value-objects/FirebaseConfig';
|
|
16
|
+
import type { IFirebaseClient } from '../../application/ports/IFirebaseClient';
|
|
17
|
+
export type FirebaseApp = any;
|
|
18
|
+
/**
|
|
19
|
+
* Firebase Client Singleton
|
|
20
|
+
* Orchestrates Firebase initialization using specialized initializers
|
|
21
|
+
*/
|
|
22
|
+
declare class FirebaseClientSingleton implements IFirebaseClient {
|
|
23
|
+
private static instance;
|
|
24
|
+
private state;
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Get singleton instance
|
|
28
|
+
*/
|
|
29
|
+
static getInstance(): FirebaseClientSingleton;
|
|
30
|
+
/**
|
|
31
|
+
* Initialize Firebase client with configuration
|
|
32
|
+
* Configuration must be provided by the application (not from .env)
|
|
33
|
+
*
|
|
34
|
+
* @param config - Firebase configuration
|
|
35
|
+
* @returns Firebase app instance or null if initialization fails
|
|
36
|
+
*/
|
|
37
|
+
initialize(config: FirebaseConfig): FirebaseApp | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get the Firebase app instance
|
|
40
|
+
* Auto-initializes from Constants/environment if not already initialized
|
|
41
|
+
* Returns null if config is not available (offline mode - no error)
|
|
42
|
+
* @returns Firebase app instance or null if not initialized
|
|
43
|
+
*/
|
|
44
|
+
getApp(): FirebaseApp | null;
|
|
45
|
+
/**
|
|
46
|
+
* Check if client is initialized
|
|
47
|
+
*/
|
|
48
|
+
isInitialized(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get initialization error if any
|
|
51
|
+
*/
|
|
52
|
+
getInitializationError(): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Reset the client instance
|
|
55
|
+
* Useful for testing
|
|
56
|
+
*/
|
|
57
|
+
reset(): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Singleton instance
|
|
61
|
+
*/
|
|
62
|
+
export declare const firebaseClient: FirebaseClientSingleton;
|
|
63
|
+
/**
|
|
64
|
+
* Initialize Firebase client
|
|
65
|
+
* This is the main entry point for applications
|
|
66
|
+
*
|
|
67
|
+
* @param config - Firebase configuration (must be provided by app, not from .env)
|
|
68
|
+
* @returns Firebase app instance or null if initialization fails
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import { initializeFirebase } from '@umituz/react-native-firebase';
|
|
73
|
+
*
|
|
74
|
+
* const config = {
|
|
75
|
+
* apiKey: 'your-api-key',
|
|
76
|
+
* authDomain: 'your-project.firebaseapp.com',
|
|
77
|
+
* projectId: 'your-project-id',
|
|
78
|
+
* };
|
|
79
|
+
*
|
|
80
|
+
* const app = initializeFirebase(config);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function initializeFirebase(config: FirebaseConfig): FirebaseApp | null;
|
|
84
|
+
/**
|
|
85
|
+
* Get Firebase app instance
|
|
86
|
+
* Auto-initializes from Constants/environment if not already initialized
|
|
87
|
+
* Returns null if config is not available (offline mode - no error)
|
|
88
|
+
* @returns Firebase app instance or null if not initialized
|
|
89
|
+
*/
|
|
90
|
+
export declare function getFirebaseApp(): FirebaseApp | null;
|
|
91
|
+
/**
|
|
92
|
+
* Auto-initialize Firebase from Constants/environment
|
|
93
|
+
* Called automatically when getFirebaseApp() is first accessed
|
|
94
|
+
* Can be called manually to initialize early
|
|
95
|
+
* @returns Firebase app instance or null if initialization fails
|
|
96
|
+
*/
|
|
97
|
+
export declare function autoInitializeFirebase(): FirebaseApp | null;
|
|
98
|
+
/**
|
|
99
|
+
* Service initialization result interface
|
|
100
|
+
*/
|
|
101
|
+
interface ServiceInitializationResult {
|
|
102
|
+
app: FirebaseApp | null;
|
|
103
|
+
auth: any | null;
|
|
104
|
+
analytics: any | null;
|
|
105
|
+
crashlytics: any | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Initialize all Firebase services (App, Auth, Analytics, Crashlytics)
|
|
109
|
+
* This is the main entry point for applications - call this once at app startup
|
|
110
|
+
* All services will be initialized automatically if Firebase App is available
|
|
111
|
+
*
|
|
112
|
+
* @param config - Optional Firebase configuration (if not provided, will auto-load from Constants/env)
|
|
113
|
+
* @returns Object with initialization results for each service
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { initializeAllFirebaseServices } from '@umituz/react-native-firebase';
|
|
118
|
+
*
|
|
119
|
+
* // Auto-initialize from Constants/env
|
|
120
|
+
* const result = await initializeAllFirebaseServices();
|
|
121
|
+
*
|
|
122
|
+
* // Or provide config explicitly
|
|
123
|
+
* const result = await initializeAllFirebaseServices({
|
|
124
|
+
* apiKey: 'your-api-key',
|
|
125
|
+
* projectId: 'your-project-id',
|
|
126
|
+
* // ...
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function initializeAllFirebaseServices(config?: FirebaseConfig): Promise<ServiceInitializationResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Check if Firebase client is initialized
|
|
133
|
+
*/
|
|
134
|
+
export declare function isFirebaseInitialized(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Get initialization error if any
|
|
137
|
+
*/
|
|
138
|
+
export declare function getFirebaseInitializationError(): string | null;
|
|
139
|
+
/**
|
|
140
|
+
* Reset Firebase client instance
|
|
141
|
+
* Useful for testing
|
|
142
|
+
*/
|
|
143
|
+
export declare function resetFirebaseClient(): void;
|
|
144
|
+
export {};
|
|
145
|
+
//# sourceMappingURL=FirebaseClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirebaseClient.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/config/FirebaseClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAK/E,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC;AA6I9B;;;GAGG;AACH,cAAM,uBAAwB,YAAW,eAAe;IACtD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwC;IAC/D,OAAO,CAAC,KAAK,CAAsB;IAEnC,OAAO;IAIP;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,uBAAuB;IAO7C;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI;IAItD;;;;;OAKG;IACH,MAAM,IAAI,WAAW,GAAG,IAAI;IAI5B;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,sBAAsB,IAAI,MAAM,GAAG,IAAI;IAIvC;;;OAGG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,yBAAwC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,GACrB,WAAW,GAAG,IAAI,CAEpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,WAAW,GAAG,IAAI,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,WAAW,GAAG,IAAI,CAM3D;AAED;;GAEG;AACH,UAAU,2BAA2B;IACnC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB,SAAS,EAAE,GAAG,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,GAAG,GAAG,IAAI,CAAC;CACzB;AAiED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,2BAA2B,CAAC,CAoBtC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,GAAG,IAAI,CAE9D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|