@umituz/react-native-firebase 3.0.3 → 3.0.6
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 +7 -1
- package/src/domains/account-deletion/index.ts +15 -10
- package/src/domains/account-deletion/infrastructure/services/account-deletion.service.ts +235 -26
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service.ts +160 -0
- package/src/domains/auth/domain/value-objects/FirebaseAuthConfig.ts +1 -1
- package/src/domains/auth/index.ts +156 -6
- package/src/domains/auth/infrastructure/config/FirebaseAuthClient.ts +60 -48
- package/src/domains/auth/infrastructure/config/initializers/FirebaseAuthInitializer.ts +41 -5
- package/src/domains/auth/infrastructure/stores/auth.store.ts +4 -1
- package/src/domains/auth/presentation/hooks/useAnonymousAuth.ts +3 -1
- package/src/domains/auth/presentation/hooks/useGoogleOAuth.ts +115 -20
- package/src/domains/auth/presentation/hooks/utils/auth-state-change.handler.ts +5 -11
- package/src/domains/firestore/domain/constants/QuotaLimits.ts +101 -0
- package/src/domains/firestore/domain/entities/QuotaMetrics.ts +26 -0
- package/src/domains/firestore/domain/entities/RequestLog.ts +28 -0
- package/src/domains/firestore/domain/services/QuotaCalculator.ts +71 -0
- package/src/domains/firestore/index.ts +85 -31
- package/src/domains/firestore/infrastructure/config/FirestoreClient.ts +82 -45
- package/src/domains/firestore/infrastructure/config/initializers/FirebaseFirestoreInitializer.ts +249 -4
- package/src/domains/firestore/infrastructure/middleware/QueryDeduplicationMiddleware.ts +306 -0
- package/src/domains/firestore/infrastructure/middleware/QuotaTrackingMiddleware.ts +92 -0
- package/src/domains/firestore/infrastructure/repositories/BasePaginatedRepository.ts +9 -1
- package/src/domains/firestore/infrastructure/repositories/BaseQueryRepository.ts +34 -8
- package/src/domains/firestore/infrastructure/repositories/BaseRepository.ts +48 -9
- package/src/domains/firestore/infrastructure/services/RequestLoggerService.ts +168 -0
- package/src/domains/firestore/presentation/hooks/index.ts +10 -0
- package/src/domains/firestore/presentation/hooks/useFirestoreMutation.ts +1 -1
- package/src/domains/firestore/presentation/hooks/useFirestoreQuery.ts +1 -1
- package/src/domains/firestore/presentation/hooks/useFirestoreSnapshot.ts +2 -1
- package/src/domains/firestore/presentation/hooks/useSmartFirestoreSnapshot.ts +362 -0
- package/src/domains/firestore/presentation/query-keys/createFirestoreKeys.ts +32 -0
- package/src/domains/firestore/presentation/query-keys/index.ts +1 -0
- package/src/domains/firestore/utils/deduplication/pending-query-manager.util.ts +126 -0
- package/src/domains/firestore/utils/deduplication/query-key-generator.util.ts +41 -0
- package/src/domains/firestore/utils/deduplication/timer-manager.util.ts +83 -0
- package/src/domains/firestore/utils/pagination.helper.ts +5 -2
- package/src/domains/firestore/utils/transaction/transaction.util.ts +8 -2
- package/src/index.ts +324 -32
- package/src/shared/domain/utils/calculation.util.ts +305 -17
- package/src/shared/domain/utils/error-handlers/error-messages.ts +0 -15
- package/src/shared/domain/utils/index.ts +5 -0
- package/src/shared/infrastructure/config/base/ClientStateManager.ts +82 -0
- package/src/shared/infrastructure/config/base/ServiceClientSingleton.ts +136 -20
- package/src/shared/infrastructure/config/clients/FirebaseClientSingleton.ts +1 -1
- package/src/shared/infrastructure/config/initializers/FirebaseAppInitializer.ts +9 -0
- package/src/shared/infrastructure/config/services/FirebaseInitializationService.ts +1 -1
- package/src/shared/infrastructure/config/state/FirebaseClientState.ts +14 -36
- package/src/application/auth/index.ts +0 -10
- package/src/application/auth/use-cases/index.ts +0 -6
- package/src/domains/account-deletion/domain/index.ts +0 -8
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor.ts +0 -79
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionTypes.ts +0 -32
- package/src/domains/auth/domain.ts +0 -16
- package/src/domains/auth/infrastructure/config/index.ts +0 -2
- package/src/domains/auth/infrastructure/config/initializers/index.ts +0 -1
- package/src/domains/auth/infrastructure/services/index.ts +0 -16
- package/src/domains/auth/infrastructure/services/utils/index.ts +0 -1
- package/src/domains/auth/infrastructure/stores/index.ts +0 -1
- package/src/domains/auth/infrastructure/utils/index.ts +0 -1
- package/src/domains/auth/infrastructure.ts +0 -11
- package/src/domains/auth/presentation/hooks/useAppleAuth.ts +0 -82
- package/src/domains/auth/presentation.ts +0 -31
- package/src/domains/firestore/domain/entities/Collection.ts +0 -122
- package/src/domains/firestore/domain/entities/CollectionFactory.ts +0 -55
- package/src/domains/firestore/domain/entities/CollectionHelpers.ts +0 -143
- package/src/domains/firestore/domain/entities/CollectionUtils.ts +0 -72
- package/src/domains/firestore/domain/entities/CollectionValidation.ts +0 -138
- package/src/domains/firestore/domain/index.ts +0 -61
- package/src/domains/firestore/domain/value-objects/QueryOptions.ts +0 -143
- package/src/domains/firestore/domain/value-objects/QueryOptionsFactory.ts +0 -95
- package/src/domains/firestore/domain/value-objects/QueryOptionsHelpers.ts +0 -110
- package/src/domains/firestore/domain/value-objects/WhereClause.ts +0 -114
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory.ts +0 -101
- package/src/domains/firestore/domain/value-objects/WhereClauseHelpers.ts +0 -123
- package/src/domains/firestore/domain/value-objects/WhereClauseValidation.ts +0 -83
- package/src/shared/infrastructure/base/ErrorHandler.ts +0 -81
- package/src/shared/infrastructure/base/ServiceBase.ts +0 -62
- package/src/shared/infrastructure/base/TypedGuard.ts +0 -131
- package/src/shared/infrastructure/base/index.ts +0 -34
- package/src/shared/types/firebase.types.ts +0 -274
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending Query Manager Utility
|
|
3
|
+
* Manages pending queries for deduplication
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
interface PendingQuery {
|
|
7
|
+
promise: Promise<unknown>;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class PendingQueryManager {
|
|
12
|
+
private pendingQueries = new Map<string, PendingQuery>();
|
|
13
|
+
private deduplicationWindowMs: number;
|
|
14
|
+
|
|
15
|
+
constructor(deduplicationWindowMs: number = 1000) {
|
|
16
|
+
this.deduplicationWindowMs = deduplicationWindowMs;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Update the deduplication window dynamically
|
|
21
|
+
* Used for quota-aware adaptive deduplication
|
|
22
|
+
*/
|
|
23
|
+
setWindow(windowMs: number): void {
|
|
24
|
+
this.deduplicationWindowMs = windowMs;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get current deduplication window
|
|
29
|
+
*/
|
|
30
|
+
getWindow(): number {
|
|
31
|
+
return this.deduplicationWindowMs;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if query is pending and not expired
|
|
36
|
+
*/
|
|
37
|
+
isPending(key: string): boolean {
|
|
38
|
+
const pending = this.pendingQueries.get(key);
|
|
39
|
+
if (!pending) return false;
|
|
40
|
+
|
|
41
|
+
// PERF: Cache Date.now() to avoid multiple calls in hot path
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
const age = now - pending.timestamp;
|
|
44
|
+
if (age > this.deduplicationWindowMs) {
|
|
45
|
+
this.pendingQueries.delete(key);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get pending query promise
|
|
54
|
+
*/
|
|
55
|
+
get(key: string): Promise<unknown> | null {
|
|
56
|
+
const pending = this.pendingQueries.get(key);
|
|
57
|
+
return pending ? pending.promise : null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Add query to pending list.
|
|
62
|
+
* Cleanup is handled by the caller's finally block in deduplicate().
|
|
63
|
+
* Also attaches cleanup handlers to prevent memory leaks.
|
|
64
|
+
*/
|
|
65
|
+
add(key: string, promise: Promise<unknown>): void {
|
|
66
|
+
// PERF: Cache timestamp to avoid multiple Date.now() calls
|
|
67
|
+
const now = Date.now();
|
|
68
|
+
|
|
69
|
+
// Set first, then attach cleanup handler to prevent race condition
|
|
70
|
+
// where immediately-resolved promise triggers cleanup before set()
|
|
71
|
+
this.pendingQueries.set(key, {
|
|
72
|
+
promise,
|
|
73
|
+
timestamp: now,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Attach cleanup handler to ensure query is removed from map
|
|
77
|
+
// even if caller's finally block doesn't execute (e.g., unhandled rejection)
|
|
78
|
+
promise.finally(() => {
|
|
79
|
+
// Immediate cleanup - no delay needed for better performance
|
|
80
|
+
this.pendingQueries.delete(key);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Remove a specific query from pending list
|
|
86
|
+
*/
|
|
87
|
+
remove(key: string): void {
|
|
88
|
+
this.pendingQueries.delete(key);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Clean up expired queries
|
|
93
|
+
* Uses current deduplication window (may be adjusted dynamically)
|
|
94
|
+
*/
|
|
95
|
+
cleanup(): void {
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
const windowMs = this.deduplicationWindowMs; // Capture current window
|
|
98
|
+
|
|
99
|
+
for (const [key, query] of this.pendingQueries.entries()) {
|
|
100
|
+
if (now - query.timestamp > windowMs) {
|
|
101
|
+
this.pendingQueries.delete(key);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Clear all pending queries
|
|
108
|
+
*/
|
|
109
|
+
clear(): void {
|
|
110
|
+
this.pendingQueries.clear();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get pending queries count
|
|
115
|
+
*/
|
|
116
|
+
size(): number {
|
|
117
|
+
return this.pendingQueries.size;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Check if there are any pending queries
|
|
122
|
+
*/
|
|
123
|
+
isEmpty(): boolean {
|
|
124
|
+
return this.pendingQueries.size === 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query Key Generator Utility
|
|
3
|
+
* Generates unique keys for query deduplication
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface QueryKey {
|
|
7
|
+
collection: string;
|
|
8
|
+
filters: string;
|
|
9
|
+
limit?: number;
|
|
10
|
+
orderBy?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Escape special characters in query key components
|
|
15
|
+
* Prevents key collisions when filter strings contain separator characters
|
|
16
|
+
* FIX: Escape ALL special characters that could cause issues, not just % and |
|
|
17
|
+
*/
|
|
18
|
+
function escapeKeyComponent(component: string): string {
|
|
19
|
+
return component
|
|
20
|
+
.replace(/%/g, '%25')
|
|
21
|
+
.replace(/\|/g, '%7C')
|
|
22
|
+
.replace(/\n/g, '%0A')
|
|
23
|
+
.replace(/\r/g, '%0D')
|
|
24
|
+
.replace(/\0/g, '%00')
|
|
25
|
+
.replace(/\//g, '%2F');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate a unique key from query parameters
|
|
30
|
+
* Uses URL encoding to prevent collisions from separator characters
|
|
31
|
+
*/
|
|
32
|
+
export function generateQueryKey(key: QueryKey): string {
|
|
33
|
+
const parts = [
|
|
34
|
+
escapeKeyComponent(key.collection),
|
|
35
|
+
escapeKeyComponent(key.filters),
|
|
36
|
+
key.limit?.toString() || '',
|
|
37
|
+
escapeKeyComponent(key.orderBy || ''),
|
|
38
|
+
];
|
|
39
|
+
return parts.join('|');
|
|
40
|
+
}
|
|
41
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
}
|
|
@@ -49,8 +49,11 @@ export class PaginationHelper<T> {
|
|
|
49
49
|
let nextCursor: string | null = null;
|
|
50
50
|
if (hasMoreValue && resultItems.length > 0) {
|
|
51
51
|
// Access is safe because we checked length > 0
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const lastIndex = resultItems.length - 1;
|
|
53
|
+
const lastItem = resultItems[lastIndex];
|
|
54
|
+
if (lastItem) {
|
|
55
|
+
nextCursor = getCursor(lastItem);
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
return {
|
|
@@ -31,10 +31,16 @@ export async function runTransaction<T>(
|
|
|
31
31
|
const errorCode = hasCodeProperty(error) ? error.code : 'unknown';
|
|
32
32
|
|
|
33
33
|
if (isQuotaError(error)) {
|
|
34
|
-
|
|
34
|
+
// FIX: Preserve original error by adding it as a custom property
|
|
35
|
+
const quotaError = new Error(`[runTransaction] ${ERROR_MESSAGES.FIRESTORE.QUOTA_EXCEEDED}: ${errorMessage} (Code: ${errorCode})`);
|
|
36
|
+
(quotaError as any).originalError = error;
|
|
37
|
+
throw quotaError;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
// FIX: Preserve original error for debugging
|
|
41
|
+
const transactionError = new Error(`[runTransaction] Transaction failed: ${errorMessage} (Code: ${errorCode})`);
|
|
42
|
+
(transactionError as any).originalError = error;
|
|
43
|
+
throw transactionError;
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* React Native Firebase - Unified Package
|
|
3
3
|
*
|
|
4
4
|
* Domain-Driven Design (DDD) Architecture
|
|
5
|
-
*
|
|
6
|
-
* IMPORTANT: This package does NOT import from 'firebase/app' or other firebase packages.
|
|
7
|
-
* Import firebase SDK directly in your app if you need those types.
|
|
8
|
-
*
|
|
9
|
-
* This package provides utilities and abstractions ONLY for React Native.
|
|
10
5
|
*/
|
|
11
6
|
|
|
12
7
|
// Core Errors
|
|
@@ -37,6 +32,8 @@ export type {
|
|
|
37
32
|
ServiceInitializationResult,
|
|
38
33
|
} from "./shared/infrastructure/config/services/FirebaseInitializationService";
|
|
39
34
|
|
|
35
|
+
export type { FirebaseApp } from "./shared/infrastructure/config/initializers/FirebaseAppInitializer";
|
|
36
|
+
|
|
40
37
|
// Type Guards
|
|
41
38
|
export {
|
|
42
39
|
isFirestoreError,
|
|
@@ -49,37 +46,332 @@ export {
|
|
|
49
46
|
getSafeErrorCode,
|
|
50
47
|
} from "./shared/domain/guards/firebase-error.guard";
|
|
51
48
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// AUTH DOMAIN EXPORTS
|
|
51
|
+
// =============================================================================
|
|
52
|
+
|
|
53
|
+
// Domain Layer
|
|
54
|
+
export type { FirebaseAuthConfig } from './domains/auth/domain/value-objects/FirebaseAuthConfig';
|
|
55
|
+
export {
|
|
56
|
+
isAnonymousUser,
|
|
57
|
+
} from './domains/auth/domain/entities/AnonymousUser';
|
|
58
|
+
export type { AnonymousUser } from './domains/auth/domain/entities/AnonymousUser';
|
|
59
|
+
|
|
60
|
+
// Infrastructure Layer - Config
|
|
61
|
+
export {
|
|
62
|
+
getFirebaseAuth,
|
|
63
|
+
isFirebaseAuthInitialized,
|
|
64
|
+
getFirebaseAuthInitializationError,
|
|
65
|
+
resetFirebaseAuthClient,
|
|
66
|
+
firebaseAuthClient,
|
|
67
|
+
initializeFirebaseAuth,
|
|
68
|
+
} from './domains/auth/infrastructure/config/FirebaseAuthClient';
|
|
69
|
+
export type { Auth } from './domains/auth/infrastructure/config/FirebaseAuthClient';
|
|
70
|
+
|
|
71
|
+
// Infrastructure Layer - Services
|
|
72
|
+
export {
|
|
73
|
+
checkAuthState,
|
|
74
|
+
isAuthenticated,
|
|
75
|
+
isAnonymous,
|
|
76
|
+
getCurrentUserId,
|
|
77
|
+
getCurrentUser,
|
|
78
|
+
getCurrentUserIdFromGlobal,
|
|
79
|
+
getCurrentUserFromGlobal,
|
|
80
|
+
isCurrentUserAuthenticated,
|
|
81
|
+
isCurrentUserAnonymous,
|
|
82
|
+
verifyUserId,
|
|
83
|
+
isValidUser,
|
|
84
|
+
} from './domains/auth/infrastructure/services/auth-utils.service';
|
|
85
|
+
export type { AuthCheckResult } from './domains/auth/infrastructure/services/auth-utils.service';
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
AnonymousAuthService,
|
|
89
|
+
anonymousAuthService,
|
|
90
|
+
} from './domains/auth/infrastructure/services/anonymous-auth.service';
|
|
91
|
+
export type {
|
|
92
|
+
AnonymousAuthResult,
|
|
93
|
+
AnonymousAuthServiceInterface,
|
|
94
|
+
} from './domains/auth/infrastructure/services/anonymous-auth.service';
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
shouldSkipFirestoreQuery,
|
|
98
|
+
createFirestoreQueryOptions,
|
|
99
|
+
} from './domains/auth/infrastructure/services/firestore-utils.service';
|
|
100
|
+
export type {
|
|
101
|
+
FirestoreQueryOptions,
|
|
102
|
+
FirestoreQueryResult,
|
|
103
|
+
FirestoreQuerySkipReason,
|
|
104
|
+
} from './domains/auth/infrastructure/services/firestore-utils.service';
|
|
105
|
+
|
|
106
|
+
// Social Auth Services
|
|
107
|
+
export {
|
|
108
|
+
GoogleAuthService,
|
|
109
|
+
googleAuthService,
|
|
110
|
+
} from './domains/auth/infrastructure/services/google-auth.service';
|
|
111
|
+
export type {
|
|
112
|
+
GoogleAuthConfig,
|
|
113
|
+
GoogleAuthResult,
|
|
114
|
+
} from './domains/auth/infrastructure/services/google-auth.types';
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
GoogleOAuthService,
|
|
118
|
+
googleOAuthService,
|
|
119
|
+
} from './domains/auth/infrastructure/services/google-oauth.service';
|
|
120
|
+
export type { GoogleOAuthConfig } from './domains/auth/infrastructure/services/google-oauth.service';
|
|
121
|
+
|
|
122
|
+
export {
|
|
123
|
+
AppleAuthService,
|
|
124
|
+
appleAuthService,
|
|
125
|
+
} from './domains/auth/infrastructure/services/apple-auth.service';
|
|
126
|
+
export type { AppleAuthResult } from './domains/auth/infrastructure/services/apple-auth.types';
|
|
127
|
+
|
|
128
|
+
// Password & Email/Password Auth
|
|
129
|
+
export {
|
|
130
|
+
updateUserPassword,
|
|
131
|
+
} from './domains/auth/infrastructure/services/password.service';
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
signInWithEmail,
|
|
135
|
+
signUpWithEmail,
|
|
136
|
+
signOut,
|
|
137
|
+
linkAnonymousWithEmail,
|
|
138
|
+
} from './domains/auth/infrastructure/services/email-auth.service';
|
|
139
|
+
export type {
|
|
140
|
+
EmailCredentials,
|
|
141
|
+
EmailAuthResult,
|
|
142
|
+
} from './domains/auth/infrastructure/services/email-auth.service';
|
|
143
|
+
|
|
144
|
+
// Auth Listener
|
|
145
|
+
export {
|
|
146
|
+
setupAuthListener,
|
|
147
|
+
} from './domains/auth/infrastructure/services/auth-listener.service';
|
|
148
|
+
export type {
|
|
149
|
+
AuthListenerConfig,
|
|
150
|
+
AuthListenerResult,
|
|
151
|
+
} from './domains/auth/infrastructure/services/auth-listener.service';
|
|
152
|
+
|
|
153
|
+
// User Document Service
|
|
154
|
+
export {
|
|
155
|
+
ensureUserDocument,
|
|
156
|
+
markUserDeleted,
|
|
157
|
+
configureUserDocumentService,
|
|
158
|
+
} from './domains/auth/infrastructure/services/user-document.service';
|
|
159
|
+
export type {
|
|
160
|
+
UserDocumentUser,
|
|
161
|
+
UserDocumentConfig,
|
|
162
|
+
UserDocumentExtras,
|
|
163
|
+
} from './domains/auth/infrastructure/services/user-document.types';
|
|
164
|
+
|
|
165
|
+
// Presentation Layer - Hooks
|
|
166
|
+
export { useFirebaseAuth } from './domains/auth/presentation/hooks/useFirebaseAuth';
|
|
167
|
+
export type { UseFirebaseAuthResult } from './domains/auth/presentation/hooks/useFirebaseAuth';
|
|
168
|
+
|
|
169
|
+
export { useAnonymousAuth } from './domains/auth/presentation/hooks/useAnonymousAuth';
|
|
170
|
+
export type { UseAnonymousAuthResult } from './domains/auth/presentation/hooks/useAnonymousAuth';
|
|
171
|
+
|
|
172
|
+
export { useSocialAuth } from './domains/auth/presentation/hooks/useSocialAuth';
|
|
173
|
+
export type {
|
|
174
|
+
SocialAuthConfig,
|
|
175
|
+
SocialAuthResult,
|
|
176
|
+
UseSocialAuthResult,
|
|
177
|
+
} from './domains/auth/presentation/hooks/useSocialAuth';
|
|
178
|
+
|
|
179
|
+
export { useGoogleOAuth } from './domains/auth/presentation/hooks/useGoogleOAuth';
|
|
180
|
+
export type { UseGoogleOAuthResult } from './domains/auth/presentation/hooks/useGoogleOAuth';
|
|
181
|
+
|
|
182
|
+
// =============================================================================
|
|
183
|
+
// ACCOUNT DELETION DOMAIN EXPORTS
|
|
184
|
+
// =============================================================================
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
deleteCurrentUser,
|
|
188
|
+
deleteUserAccount,
|
|
189
|
+
} from './domains/account-deletion/infrastructure/services/account-deletion.service';
|
|
190
|
+
export type { AccountDeletionResult } from './domains/account-deletion/infrastructure/services/account-deletion.service';
|
|
191
|
+
|
|
192
|
+
export type {
|
|
193
|
+
AccountDeletionOptions,
|
|
194
|
+
ReauthenticationResult,
|
|
195
|
+
AuthProviderType,
|
|
196
|
+
ReauthCredentialResult,
|
|
197
|
+
} from './domains/account-deletion/application/ports/reauthentication.types';
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
getUserAuthProvider,
|
|
201
|
+
reauthenticateWithPassword,
|
|
202
|
+
reauthenticateWithGoogle,
|
|
203
|
+
reauthenticateWithApple,
|
|
204
|
+
getAppleReauthCredential,
|
|
205
|
+
} from './domains/account-deletion/infrastructure/services/reauthentication.service';
|
|
206
|
+
|
|
207
|
+
// =============================================================================
|
|
208
|
+
// FIRESTORE DOMAIN EXPORTS
|
|
209
|
+
// =============================================================================
|
|
71
210
|
|
|
211
|
+
// Domain Errors
|
|
212
|
+
export {
|
|
213
|
+
FirebaseFirestoreError,
|
|
214
|
+
FirebaseFirestoreInitializationError,
|
|
215
|
+
FirebaseFirestoreQuotaError,
|
|
216
|
+
} from './domains/firestore/domain/errors/FirebaseFirestoreError';
|
|
217
|
+
|
|
218
|
+
// Firestore Client
|
|
219
|
+
export {
|
|
220
|
+
initializeFirestore,
|
|
221
|
+
getFirestore,
|
|
222
|
+
isFirestoreInitialized,
|
|
223
|
+
getFirestoreInitializationError,
|
|
224
|
+
resetFirestoreClient,
|
|
225
|
+
firestoreClient,
|
|
226
|
+
} from './domains/firestore/infrastructure/config/FirestoreClient';
|
|
227
|
+
export type { Firestore } from './domains/firestore/infrastructure/config/FirestoreClient';
|
|
228
|
+
|
|
229
|
+
// Repositories
|
|
230
|
+
export { BaseRepository } from './domains/firestore/infrastructure/repositories/BaseRepository';
|
|
231
|
+
export type { IPathResolver } from './domains/firestore/infrastructure/repositories/BaseRepository';
|
|
232
|
+
export { BaseQueryRepository } from './domains/firestore/infrastructure/repositories/BaseQueryRepository';
|
|
233
|
+
export { BasePaginatedRepository } from './domains/firestore/infrastructure/repositories/BasePaginatedRepository';
|
|
234
|
+
|
|
235
|
+
// Date Utilities
|
|
236
|
+
export {
|
|
237
|
+
isoToTimestamp,
|
|
238
|
+
timestampToISO,
|
|
239
|
+
timestampToDate,
|
|
240
|
+
getCurrentISOString,
|
|
241
|
+
formatRelativeTime,
|
|
242
|
+
} from './domains/firestore/utils/dateUtils';
|
|
243
|
+
export type { RelativeTimeLabels } from './domains/firestore/utils/dateUtils';
|
|
244
|
+
|
|
245
|
+
// Query Builder
|
|
246
|
+
export {
|
|
247
|
+
buildQuery,
|
|
248
|
+
createInFilter,
|
|
249
|
+
createEqualFilter,
|
|
250
|
+
} from './domains/firestore/utils/query-builder';
|
|
251
|
+
export type {
|
|
252
|
+
QueryBuilderOptions,
|
|
253
|
+
FieldFilter,
|
|
254
|
+
} from './domains/firestore/utils/query-builder';
|
|
255
|
+
|
|
256
|
+
// Pagination
|
|
257
|
+
export {
|
|
258
|
+
PaginationHelper,
|
|
259
|
+
createPaginationHelper,
|
|
260
|
+
} from './domains/firestore/utils/pagination.helper';
|
|
261
|
+
export type {
|
|
262
|
+
PaginatedResult,
|
|
263
|
+
PaginationParams,
|
|
264
|
+
} from './domains/firestore/types/pagination.types';
|
|
265
|
+
export { EMPTY_PAGINATED_RESULT } from './domains/firestore/types/pagination.types';
|
|
266
|
+
|
|
267
|
+
// Domain Constants
|
|
268
|
+
export {
|
|
269
|
+
FREE_TIER_LIMITS,
|
|
270
|
+
QUOTA_THRESHOLDS,
|
|
271
|
+
calculateQuotaUsage,
|
|
272
|
+
isQuotaThresholdReached,
|
|
273
|
+
getRemainingQuota,
|
|
274
|
+
} from './domains/firestore/domain/constants/QuotaLimits';
|
|
275
|
+
|
|
276
|
+
// Domain Entities
|
|
277
|
+
export type {
|
|
278
|
+
QuotaMetrics,
|
|
279
|
+
QuotaLimits,
|
|
280
|
+
QuotaStatus,
|
|
281
|
+
} from './domains/firestore/domain/entities/QuotaMetrics';
|
|
72
282
|
export type {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
283
|
+
RequestLog,
|
|
284
|
+
RequestStats,
|
|
285
|
+
RequestType,
|
|
286
|
+
} from './domains/firestore/domain/entities/RequestLog';
|
|
76
287
|
|
|
77
|
-
// Domain
|
|
78
|
-
export
|
|
79
|
-
export * from "./domains/account-deletion";
|
|
288
|
+
// Domain Services
|
|
289
|
+
export { QuotaCalculator } from './domains/firestore/domain/services/QuotaCalculator';
|
|
80
290
|
|
|
81
|
-
//
|
|
82
|
-
export
|
|
291
|
+
// Quota Error Detection
|
|
292
|
+
export {
|
|
293
|
+
isQuotaError,
|
|
294
|
+
isRetryableError,
|
|
295
|
+
} from './shared/domain/utils/error-handlers/error-checkers';
|
|
296
|
+
export {
|
|
297
|
+
ERROR_MESSAGES,
|
|
298
|
+
} from './shared/domain/utils/error-handlers/error-messages';
|
|
299
|
+
|
|
300
|
+
// Middleware
|
|
301
|
+
export {
|
|
302
|
+
QueryDeduplicationMiddleware,
|
|
303
|
+
queryDeduplicationMiddleware,
|
|
304
|
+
syncDeduplicationWithQuota,
|
|
305
|
+
} from './domains/firestore/infrastructure/middleware/QueryDeduplicationMiddleware';
|
|
306
|
+
export type {
|
|
307
|
+
QueryDeduplicationConfig,
|
|
308
|
+
DeduplicationStatistics,
|
|
309
|
+
} from './domains/firestore/infrastructure/middleware/QueryDeduplicationMiddleware';
|
|
310
|
+
export {
|
|
311
|
+
QuotaTrackingMiddleware,
|
|
312
|
+
quotaTrackingMiddleware,
|
|
313
|
+
} from './domains/firestore/infrastructure/middleware/QuotaTrackingMiddleware';
|
|
314
|
+
|
|
315
|
+
// Services
|
|
316
|
+
export {
|
|
317
|
+
RequestLoggerService,
|
|
318
|
+
requestLoggerService,
|
|
319
|
+
} from './domains/firestore/infrastructure/services/RequestLoggerService';
|
|
320
|
+
|
|
321
|
+
// Firestore Helper Utilities
|
|
322
|
+
export {
|
|
323
|
+
withFirestore,
|
|
324
|
+
withFirestoreVoid,
|
|
325
|
+
withFirestoreBool,
|
|
326
|
+
} from './domains/firestore/utils/operation/operation-executor.util';
|
|
327
|
+
export {
|
|
328
|
+
runTransaction,
|
|
329
|
+
serverTimestamp,
|
|
330
|
+
} from './domains/firestore/utils/transaction/transaction.util';
|
|
331
|
+
export {
|
|
332
|
+
createErrorResult,
|
|
333
|
+
createSuccessResult,
|
|
334
|
+
} from './domains/firestore/utils/result/result.util';
|
|
335
|
+
export type { NoDbResult } from './domains/firestore/utils/result/result.util';
|
|
336
|
+
|
|
337
|
+
// Validation Utilities
|
|
338
|
+
export {
|
|
339
|
+
isValidCursor,
|
|
340
|
+
validateCursorOrThrow,
|
|
341
|
+
CursorValidationError,
|
|
342
|
+
} from './domains/firestore/utils/validation/cursor-validator.util';
|
|
343
|
+
export {
|
|
344
|
+
isValidFieldName,
|
|
345
|
+
} from './domains/firestore/utils/validation/field-validator.util';
|
|
346
|
+
export {
|
|
347
|
+
isValidDateRange,
|
|
348
|
+
validateDateRangeOrThrow,
|
|
349
|
+
} from './domains/firestore/utils/validation/date-validator.util';
|
|
350
|
+
|
|
351
|
+
// Presentation — TanStack Query integration
|
|
352
|
+
export { useFirestoreQuery } from './domains/firestore/presentation/hooks/useFirestoreQuery';
|
|
353
|
+
export { useFirestoreMutation } from './domains/firestore/presentation/hooks/useFirestoreMutation';
|
|
354
|
+
export { useFirestoreSnapshot } from './domains/firestore/presentation/hooks/useFirestoreSnapshot';
|
|
355
|
+
export { useSmartFirestoreSnapshot, useSmartListenerControl } from './domains/firestore/presentation/hooks/useSmartFirestoreSnapshot';
|
|
356
|
+
export { createFirestoreKeys } from './domains/firestore/presentation/query-keys/createFirestoreKeys';
|
|
357
|
+
|
|
358
|
+
export type { UseFirestoreQueryOptions } from './domains/firestore/presentation/hooks/useFirestoreQuery';
|
|
359
|
+
export type { UseFirestoreMutationOptions } from './domains/firestore/presentation/hooks/useFirestoreMutation';
|
|
360
|
+
export type { UseFirestoreSnapshotOptions } from './domains/firestore/presentation/hooks/useFirestoreSnapshot';
|
|
361
|
+
export type { UseSmartFirestoreSnapshotOptions, BackgroundStrategy } from './domains/firestore/presentation/hooks/useSmartFirestoreSnapshot';
|
|
362
|
+
|
|
363
|
+
// Firebase Types
|
|
364
|
+
export { Timestamp } from 'firebase/firestore';
|
|
365
|
+
export type {
|
|
366
|
+
CollectionReference,
|
|
367
|
+
QueryDocumentSnapshot,
|
|
368
|
+
DocumentData,
|
|
369
|
+
Transaction,
|
|
370
|
+
DocumentReference,
|
|
371
|
+
WriteBatch,
|
|
372
|
+
DocumentSnapshot,
|
|
373
|
+
QuerySnapshot,
|
|
374
|
+
} from 'firebase/firestore';
|
|
83
375
|
|
|
84
376
|
// Init Module Factory
|
|
85
377
|
export {
|