@umituz/react-native-firebase 2.4.97 → 2.5.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/domains/auth/domain/value-objects/FirebaseAuthConfig.ts +1 -1
- package/src/domains/auth/infrastructure/config/initializers/FirebaseAuthInitializer.ts +5 -41
- package/src/domains/firestore/index.ts +0 -58
- package/src/domains/firestore/infrastructure/config/initializers/FirebaseFirestoreInitializer.ts +4 -255
- package/src/domains/firestore/infrastructure/repositories/BasePaginatedRepository.ts +1 -7
- package/src/domains/firestore/infrastructure/repositories/BaseQueryRepository.ts +8 -34
- package/src/domains/firestore/infrastructure/repositories/BaseRepository.ts +9 -48
- package/src/domains/firestore/presentation/hooks/index.ts +0 -10
- package/src/index.ts +1 -1
- package/src/shared/infrastructure/config/clients/FirebaseClientSingleton.ts +1 -1
- package/src/shared/infrastructure/config/services/FirebaseInitializationService.ts +1 -1
- package/src/shared/infrastructure/config/state/FirebaseClientState.ts +1 -1
- package/src/domains/firestore/domain/constants/QuotaLimits.ts +0 -101
- package/src/domains/firestore/domain/entities/QuotaMetrics.ts +0 -26
- package/src/domains/firestore/domain/entities/RequestLog.ts +0 -28
- package/src/domains/firestore/domain/services/QuotaCalculator.ts +0 -71
- package/src/domains/firestore/infrastructure/middleware/QueryDeduplicationMiddleware.ts +0 -312
- package/src/domains/firestore/infrastructure/middleware/QuotaTrackingMiddleware.ts +0 -95
- package/src/domains/firestore/infrastructure/services/RequestLoggerService.ts +0 -165
- package/src/domains/firestore/presentation/hooks/useSmartFirestoreSnapshot.ts +0 -361
- package/src/domains/firestore/presentation/query-keys/createFirestoreKeys.ts +0 -32
- package/src/domains/firestore/presentation/query-keys/index.ts +0 -1
- package/src/domains/firestore/utils/deduplication/pending-query-manager.util.ts +0 -119
- package/src/domains/firestore/utils/deduplication/query-key-generator.util.ts +0 -34
- package/src/domains/firestore/utils/deduplication/timer-manager.util.ts +0 -83
- package/src/shared/infrastructure/config/initializers/FirebaseAppInitializer.ts +0 -9
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Timer Manager Utility
|
|
3
|
-
* Manages cleanup timers for deduplication middleware
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
interface TimerManagerOptions {
|
|
7
|
-
cleanupIntervalMs: number;
|
|
8
|
-
onCleanup: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class TimerManager {
|
|
12
|
-
private timer: ReturnType<typeof setInterval> | null = null;
|
|
13
|
-
private readonly options: TimerManagerOptions;
|
|
14
|
-
private destroyed = false;
|
|
15
|
-
|
|
16
|
-
constructor(options: TimerManagerOptions) {
|
|
17
|
-
this.options = options;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Start the cleanup timer
|
|
22
|
-
* Idempotent: safe to call multiple times
|
|
23
|
-
*/
|
|
24
|
-
start(): void {
|
|
25
|
-
if (this.destroyed) {
|
|
26
|
-
return; // Don't start if destroyed
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Clear existing timer if running (prevents duplicate timers)
|
|
30
|
-
if (this.timer) {
|
|
31
|
-
this.stop();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this.timer = setInterval(() => {
|
|
35
|
-
if (this.destroyed) {
|
|
36
|
-
this.stop();
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
this.options.onCleanup();
|
|
42
|
-
} catch (error) {
|
|
43
|
-
// Silently handle cleanup errors to prevent timer from causing issues
|
|
44
|
-
// Log error in development for debugging (use __DEV__ for React Native)
|
|
45
|
-
if (__DEV__) {
|
|
46
|
-
console.error('TimerManager cleanup error:', error);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, this.options.cleanupIntervalMs);
|
|
50
|
-
|
|
51
|
-
// In React Native, timers may not run when app is backgrounded
|
|
52
|
-
// Unref the timer to allow the event loop to exit if this is the only active timer
|
|
53
|
-
if (typeof (this.timer as any).unref === 'function') {
|
|
54
|
-
(this.timer as any).unref();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Stop the cleanup timer
|
|
60
|
-
*/
|
|
61
|
-
stop(): void {
|
|
62
|
-
if (this.timer) {
|
|
63
|
-
clearInterval(this.timer);
|
|
64
|
-
this.timer = null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if timer is running
|
|
70
|
-
*/
|
|
71
|
-
isRunning(): boolean {
|
|
72
|
-
return this.timer !== null && !this.destroyed;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Destroy the timer manager
|
|
77
|
-
* Prevents timer from restarting
|
|
78
|
-
*/
|
|
79
|
-
destroy(): void {
|
|
80
|
-
this.destroyed = true;
|
|
81
|
-
this.stop();
|
|
82
|
-
}
|
|
83
|
-
}
|