@umituz/react-native-firebase 1.13.164 → 1.14.1
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 +1 -1
- package/src/auth/infrastructure/config/FirebaseAuthClient.ts +1 -1
- package/src/auth/infrastructure/services/google-auth.service.ts +1 -1
- package/src/firestore/index.ts +1 -0
- package/src/firestore/infrastructure/config/FirestoreClient.ts +1 -1
- package/src/firestore/infrastructure/repositories/BaseRepository.ts +10 -27
- package/src/infrastructure/config/base/ServiceClientSingleton.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
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",
|
|
@@ -42,7 +42,7 @@ class FirebaseAuthClientSingleton extends ServiceClientSingleton<Auth, FirebaseA
|
|
|
42
42
|
/**
|
|
43
43
|
* Initialize Auth with optional configuration
|
|
44
44
|
*/
|
|
45
|
-
initialize(config?: FirebaseAuthConfig): Auth | null {
|
|
45
|
+
override initialize(config?: FirebaseAuthConfig): Auth | null {
|
|
46
46
|
return super.initialize(config);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -17,7 +17,7 @@ import { ConfigurableService } from "../../../domain/utils/service-config.util";
|
|
|
17
17
|
* Provides Google Sign-In functionality for Firebase
|
|
18
18
|
*/
|
|
19
19
|
export class GoogleAuthService extends ConfigurableService<GoogleAuthConfig> {
|
|
20
|
-
protected isValidConfig(config: GoogleAuthConfig): boolean {
|
|
20
|
+
protected override isValidConfig(config: GoogleAuthConfig): boolean {
|
|
21
21
|
return (
|
|
22
22
|
config !== null &&
|
|
23
23
|
(!!config.webClientId || !!config.iosClientId || !!config.androidClientId)
|
package/src/firestore/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ export type { Firestore } from './infrastructure/config/FirestoreClient';
|
|
|
23
23
|
|
|
24
24
|
// Repositories
|
|
25
25
|
export { BaseRepository } from './infrastructure/repositories/BaseRepository';
|
|
26
|
+
export type { IPathResolver } from './infrastructure/repositories/BaseRepository';
|
|
26
27
|
export { BaseQueryRepository } from './infrastructure/repositories/BaseQueryRepository';
|
|
27
28
|
export { BasePaginatedRepository } from './infrastructure/repositories/BasePaginatedRepository';
|
|
28
29
|
|
|
@@ -12,19 +12,17 @@ import type { Firestore, CollectionReference, DocumentReference, DocumentData }
|
|
|
12
12
|
import { getFirestore, collection, doc } from 'firebase/firestore';
|
|
13
13
|
import { isQuotaError as checkQuotaError } from '../../utils/quota-error-detector.util';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Repository destruction state
|
|
17
|
-
*/
|
|
18
15
|
export enum RepositoryState {
|
|
19
16
|
ACTIVE = 'active',
|
|
20
17
|
DESTROYED = 'destroyed',
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
export interface IPathResolver {
|
|
21
|
+
getUserCollection(userId: string): CollectionReference<DocumentData> | null;
|
|
22
|
+
getDocRef(userId: string, documentId: string): DocumentReference<DocumentData> | null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export abstract class BaseRepository implements IPathResolver {
|
|
28
26
|
protected state: RepositoryState = RepositoryState.ACTIVE;
|
|
29
27
|
protected readonly collectionName: string;
|
|
30
28
|
|
|
@@ -43,32 +41,17 @@ export abstract class BaseRepository {
|
|
|
43
41
|
return getFirestore();
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
* Get user collection reference
|
|
48
|
-
* Pattern: users/{userId}/{collectionName}
|
|
49
|
-
*
|
|
50
|
-
* @param userId User identifier
|
|
51
|
-
* @returns CollectionReference or null if db not initialized
|
|
52
|
-
*/
|
|
53
|
-
protected getUserCollection = (userId: string): CollectionReference<DocumentData> | null => {
|
|
44
|
+
getUserCollection(userId: string): CollectionReference<DocumentData> | null {
|
|
54
45
|
const db = this.getDb();
|
|
55
46
|
if (!db) return null;
|
|
56
47
|
return collection(db, 'users', userId, this.collectionName);
|
|
57
|
-
}
|
|
48
|
+
}
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
* Get document reference
|
|
61
|
-
* Pattern: users/{userId}/{collectionName}/{documentId}
|
|
62
|
-
*
|
|
63
|
-
* @param userId User identifier
|
|
64
|
-
* @param documentId Document identifier
|
|
65
|
-
* @returns DocumentReference or null if db not initialized
|
|
66
|
-
*/
|
|
67
|
-
protected getDocRef = (userId: string, documentId: string): DocumentReference<DocumentData> | null => {
|
|
50
|
+
getDocRef(userId: string, documentId: string): DocumentReference<DocumentData> | null {
|
|
68
51
|
const db = this.getDb();
|
|
69
52
|
if (!db) return null;
|
|
70
53
|
return doc(db, 'users', userId, this.collectionName, documentId);
|
|
71
|
-
}
|
|
54
|
+
}
|
|
72
55
|
|
|
73
56
|
/**
|
|
74
57
|
* Check if Firestore is initialized
|
|
@@ -31,8 +31,6 @@ export interface ServiceClientOptions<TInstance, TConfig = unknown> {
|
|
|
31
31
|
* Provides common initialization, state management, and error handling
|
|
32
32
|
*/
|
|
33
33
|
export class ServiceClientSingleton<TInstance, TConfig = unknown> {
|
|
34
|
-
private static instances = new Map<string, ServiceClientSingleton<unknown, unknown>>();
|
|
35
|
-
|
|
36
34
|
protected state: ServiceClientState<TInstance>;
|
|
37
35
|
private readonly options: ServiceClientOptions<TInstance, TConfig>;
|
|
38
36
|
|