@umituz/react-native-firebase 1.14.4 → 2.0.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.
Files changed (132) hide show
  1. package/package.json +1 -1
  2. package/src/domains/account-deletion/index.ts +28 -0
  3. package/src/{auth → domains/account-deletion}/infrastructure/services/account-deletion.service.ts +4 -4
  4. package/src/{auth → domains/account-deletion}/infrastructure/services/reauthentication.service.ts +5 -5
  5. package/src/{auth → domains/auth}/index.ts +0 -21
  6. package/src/{auth → domains/auth}/infrastructure/config/FirebaseAuthClient.ts +2 -2
  7. package/src/{auth → domains/auth}/infrastructure/services/apple-auth.service.ts +1 -1
  8. package/src/{auth → domains/auth}/infrastructure/services/auth-listener.service.ts +2 -2
  9. package/src/{auth → domains/auth}/infrastructure/services/auth-utils.service.ts +1 -1
  10. package/src/{auth → domains/auth}/infrastructure/services/base/base-auth.service.ts +1 -1
  11. package/src/{auth → domains/auth}/infrastructure/services/email-auth.service.ts +1 -1
  12. package/src/{auth → domains/auth}/infrastructure/services/google-auth.service.ts +2 -2
  13. package/src/{auth → domains/auth}/infrastructure/services/password.service.ts +1 -1
  14. package/src/{firestore → domains/firestore}/domain/errors/FirebaseFirestoreError.ts +1 -1
  15. package/src/{firestore → domains/firestore}/infrastructure/config/FirestoreClient.ts +2 -2
  16. package/src/{firestore → domains/firestore}/infrastructure/services/RequestLoggerService.ts +1 -1
  17. package/src/{firestore → domains/firestore}/utils/quota-error-detector.util.ts +1 -1
  18. package/src/{firestore → domains/firestore}/utils/transaction/transaction.util.ts +1 -1
  19. package/src/index.ts +12 -11
  20. package/src/init/createFirebaseInitModule.ts +1 -1
  21. package/src/{domain → shared/domain}/utils/credential.util.ts +1 -1
  22. package/src/{infrastructure → shared/infrastructure}/config/clients/FirebaseClientSingleton.ts +1 -1
  23. package/src/auth/domain/errors/README.md +0 -291
  24. package/src/auth/infrastructure/config/README.md +0 -239
  25. package/src/auth/infrastructure/services/README.md +0 -346
  26. package/src/domain/README.md +0 -628
  27. package/src/firestore/domain/README.md +0 -325
  28. package/src/firestore/domain/constants/README.md +0 -332
  29. package/src/firestore/domain/entities/README.md +0 -286
  30. package/src/firestore/domain/errors/README.md +0 -389
  31. package/src/firestore/infrastructure/config/README.md +0 -239
  32. package/src/firestore/infrastructure/middleware/README.md +0 -316
  33. package/src/firestore/infrastructure/repositories/README.md +0 -425
  34. package/src/firestore/infrastructure/services/README.md +0 -332
  35. package/src/firestore/types/pagination/README.md +0 -332
  36. package/src/firestore/utils/README.md +0 -574
  37. package/src/firestore/utils/dateUtils/README.md +0 -171
  38. package/src/firestore/utils/document-mapper.helper/README.md +0 -309
  39. package/src/firestore/utils/pagination.helper/README.md +0 -298
  40. package/src/firestore/utils/query-builder/README.md +0 -291
  41. package/src/infrastructure/README.md +0 -408
  42. package/src/infrastructure/config/README.md +0 -262
  43. package/src/presentation/README.md +0 -556
  44. /package/src/{auth/infrastructure/services → domains/account-deletion/application/ports}/reauthentication.types.ts +0 -0
  45. /package/src/{auth → domains/auth}/domain/entities/AnonymousUser.ts +0 -0
  46. /package/src/{auth → domains/auth}/domain/errors/FirebaseAuthError.ts +0 -0
  47. /package/src/{auth → domains/auth}/domain/value-objects/FirebaseAuthConfig.ts +0 -0
  48. /package/src/{auth → domains/auth}/infrastructure/config/initializers/FirebaseAuthInitializer.ts +0 -0
  49. /package/src/{auth → domains/auth}/infrastructure/services/anonymous-auth.service.ts +0 -0
  50. /package/src/{auth → domains/auth}/infrastructure/services/apple-auth.types.ts +0 -0
  51. /package/src/{auth → domains/auth}/infrastructure/services/auth-guard.service.ts +0 -0
  52. /package/src/{auth → domains/auth}/infrastructure/services/crypto.util.ts +0 -0
  53. /package/src/{auth → domains/auth}/infrastructure/services/firestore-utils.service.ts +0 -0
  54. /package/src/{auth → domains/auth}/infrastructure/services/google-auth.types.ts +0 -0
  55. /package/src/{auth → domains/auth}/infrastructure/services/google-oauth.service.ts +0 -0
  56. /package/src/{auth → domains/auth}/infrastructure/services/user-document-builder.util.ts +0 -0
  57. /package/src/{auth → domains/auth}/infrastructure/services/user-document.service.ts +0 -0
  58. /package/src/{auth → domains/auth}/infrastructure/services/user-document.types.ts +0 -0
  59. /package/src/{auth → domains/auth}/infrastructure/stores/auth.store.ts +0 -0
  60. /package/src/{auth → domains/auth}/presentation/hooks/shared/auth-hooks.util.ts +0 -0
  61. /package/src/{auth → domains/auth}/presentation/hooks/shared/hook-utils.util.ts +0 -0
  62. /package/src/{auth → domains/auth}/presentation/hooks/shared/safe-state-hooks.util.ts +0 -0
  63. /package/src/{auth → domains/auth}/presentation/hooks/shared/state-hooks.util.ts +0 -0
  64. /package/src/{auth → domains/auth}/presentation/hooks/useAnonymousAuth.ts +0 -0
  65. /package/src/{auth → domains/auth}/presentation/hooks/useFirebaseAuth.ts +0 -0
  66. /package/src/{auth → domains/auth}/presentation/hooks/useGoogleOAuth.ts +0 -0
  67. /package/src/{auth → domains/auth}/presentation/hooks/useSocialAuth.ts +0 -0
  68. /package/src/{auth → domains/auth}/presentation/hooks/utils/auth-state-change.handler.ts +0 -0
  69. /package/src/{firestore → domains/firestore}/domain/constants/QuotaLimits.ts +0 -0
  70. /package/src/{firestore → domains/firestore}/domain/entities/QuotaMetrics.ts +0 -0
  71. /package/src/{firestore → domains/firestore}/domain/entities/RequestLog.ts +0 -0
  72. /package/src/{firestore → domains/firestore}/domain/services/QuotaCalculator.ts +0 -0
  73. /package/src/{firestore → domains/firestore}/index.ts +0 -0
  74. /package/src/{firestore → domains/firestore}/infrastructure/config/initializers/FirebaseFirestoreInitializer.ts +0 -0
  75. /package/src/{firestore → domains/firestore}/infrastructure/middleware/QueryDeduplicationMiddleware.ts +0 -0
  76. /package/src/{firestore → domains/firestore}/infrastructure/middleware/QuotaTrackingMiddleware.ts +0 -0
  77. /package/src/{firestore → domains/firestore}/infrastructure/repositories/BasePaginatedRepository.ts +0 -0
  78. /package/src/{firestore → domains/firestore}/infrastructure/repositories/BaseQueryRepository.ts +0 -0
  79. /package/src/{firestore → domains/firestore}/infrastructure/repositories/BaseRepository.ts +0 -0
  80. /package/src/{firestore → domains/firestore}/types/pagination.types.ts +0 -0
  81. /package/src/{firestore → domains/firestore}/utils/dateUtils.ts +0 -0
  82. /package/src/{firestore → domains/firestore}/utils/deduplication/pending-query-manager.util.ts +0 -0
  83. /package/src/{firestore → domains/firestore}/utils/deduplication/query-key-generator.util.ts +0 -0
  84. /package/src/{firestore → domains/firestore}/utils/deduplication/timer-manager.util.ts +0 -0
  85. /package/src/{firestore → domains/firestore}/utils/document-mapper.helper.ts +0 -0
  86. /package/src/{firestore → domains/firestore}/utils/firestore-helper.ts +0 -0
  87. /package/src/{firestore → domains/firestore}/utils/mapper/base-mapper.util.ts +0 -0
  88. /package/src/{firestore → domains/firestore}/utils/mapper/enrichment-mapper.util.ts +0 -0
  89. /package/src/{firestore → domains/firestore}/utils/mapper/multi-enrichment-mapper.util.ts +0 -0
  90. /package/src/{firestore → domains/firestore}/utils/operation/operation-executor.util.ts +0 -0
  91. /package/src/{firestore → domains/firestore}/utils/pagination.helper.ts +0 -0
  92. /package/src/{firestore → domains/firestore}/utils/query/filters.util.ts +0 -0
  93. /package/src/{firestore → domains/firestore}/utils/query/modifiers.util.ts +0 -0
  94. /package/src/{firestore → domains/firestore}/utils/query-builder.ts +0 -0
  95. /package/src/{firestore → domains/firestore}/utils/result/result.util.ts +0 -0
  96. /package/src/{domain → shared/domain}/errors/FirebaseError.ts +0 -0
  97. /package/src/{domain → shared/domain}/guards/firebase-error.guard.ts +0 -0
  98. /package/src/{domain → shared/domain}/utils/async-executor.util.ts +0 -0
  99. /package/src/{domain → shared/domain}/utils/error-handler.util.ts +0 -0
  100. /package/src/{domain → shared/domain}/utils/error-handlers/error-checkers.ts +0 -0
  101. /package/src/{domain → shared/domain}/utils/error-handlers/error-converters.ts +0 -0
  102. /package/src/{domain → shared/domain}/utils/error-handlers/error-messages.ts +0 -0
  103. /package/src/{domain → shared/domain}/utils/executors/advanced-executors.util.ts +0 -0
  104. /package/src/{domain → shared/domain}/utils/executors/basic-executors.util.ts +0 -0
  105. /package/src/{domain → shared/domain}/utils/executors/batch-executors.util.ts +0 -0
  106. /package/src/{domain → shared/domain}/utils/executors/error-converters.util.ts +0 -0
  107. /package/src/{domain → shared/domain}/utils/id-generator.util.ts +0 -0
  108. /package/src/{domain → shared/domain}/utils/index.ts +0 -0
  109. /package/src/{domain → shared/domain}/utils/result/result-creators.ts +0 -0
  110. /package/src/{domain → shared/domain}/utils/result/result-helpers.ts +0 -0
  111. /package/src/{domain → shared/domain}/utils/result/result-types.ts +0 -0
  112. /package/src/{domain → shared/domain}/utils/result.util.ts +0 -0
  113. /package/src/{domain → shared/domain}/utils/service-config.util.ts +0 -0
  114. /package/src/{domain → shared/domain}/utils/type-guards.util.ts +0 -0
  115. /package/src/{domain → shared/domain}/utils/validation.util.ts +0 -0
  116. /package/src/{domain → shared/domain}/utils/validators/composite.validator.ts +0 -0
  117. /package/src/{domain → shared/domain}/utils/validators/firebase.validator.ts +0 -0
  118. /package/src/{domain → shared/domain}/utils/validators/generic.validator.ts +0 -0
  119. /package/src/{domain → shared/domain}/utils/validators/string.validator.ts +0 -0
  120. /package/src/{domain → shared/domain}/utils/validators/url.validator.ts +0 -0
  121. /package/src/{domain → shared/domain}/utils/validators/user-input.validator.ts +0 -0
  122. /package/src/{domain → shared/domain}/value-objects/FirebaseConfig.ts +0 -0
  123. /package/src/{infrastructure → shared/infrastructure}/config/FirebaseClient.ts +0 -0
  124. /package/src/{infrastructure → shared/infrastructure}/config/FirebaseConfigLoader.ts +0 -0
  125. /package/src/{infrastructure → shared/infrastructure}/config/base/ClientStateManager.ts +0 -0
  126. /package/src/{infrastructure → shared/infrastructure}/config/base/ServiceClientSingleton.ts +0 -0
  127. /package/src/{infrastructure → shared/infrastructure}/config/initializers/FirebaseAppInitializer.ts +0 -0
  128. /package/src/{infrastructure → shared/infrastructure}/config/orchestrators/FirebaseInitializationOrchestrator.ts +0 -0
  129. /package/src/{infrastructure → shared/infrastructure}/config/services/FirebaseInitializationService.ts +0 -0
  130. /package/src/{infrastructure → shared/infrastructure}/config/services/FirebaseServiceInitializer.ts +0 -0
  131. /package/src/{infrastructure → shared/infrastructure}/config/state/FirebaseClientState.ts +0 -0
  132. /package/src/{infrastructure → shared/infrastructure}/config/validators/FirebaseConfigValidator.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "1.14.4",
3
+ "version": "2.0.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",
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Account Deletion Domain
3
+ * Handles Firebase account deletion with reauthentication
4
+ */
5
+
6
+ export {
7
+ deleteCurrentUser,
8
+ deleteUserAccount,
9
+ } from './infrastructure/services/account-deletion.service';
10
+
11
+ export type {
12
+ AccountDeletionResult,
13
+ } from './infrastructure/services/account-deletion.service';
14
+
15
+ export type {
16
+ AccountDeletionOptions,
17
+ ReauthenticationResult,
18
+ AuthProviderType,
19
+ ReauthCredentialResult,
20
+ } from './application/ports/reauthentication.types';
21
+
22
+ export {
23
+ getUserAuthProvider,
24
+ reauthenticateWithPassword,
25
+ reauthenticateWithGoogle,
26
+ reauthenticateWithApple,
27
+ getAppleReauthCredential,
28
+ } from './infrastructure/services/reauthentication.service';
@@ -4,21 +4,21 @@
4
4
  */
5
5
 
6
6
  import { deleteUser, type User } from "firebase/auth";
7
- import { getFirebaseAuth } from "../config/FirebaseAuthClient";
7
+ import { getFirebaseAuth } from "../../../auth/infrastructure/config/FirebaseAuthClient";
8
8
  import {
9
9
  getUserAuthProvider,
10
10
  reauthenticateWithApple,
11
11
  reauthenticateWithPassword,
12
12
  reauthenticateWithGoogle,
13
13
  } from "./reauthentication.service";
14
- import { successResult, type Result } from "../../../domain/utils";
15
- import type { AccountDeletionOptions } from "./reauthentication.types";
14
+ import { successResult, type Result } from "../../../../shared/domain/utils";
15
+ import type { AccountDeletionOptions } from "../../application/ports/reauthentication.types";
16
16
 
17
17
  export interface AccountDeletionResult extends Result<void> {
18
18
  requiresReauth?: boolean;
19
19
  }
20
20
 
21
- export type { AccountDeletionOptions } from "./reauthentication.types";
21
+ export type { AccountDeletionOptions } from "../../application/ports/reauthentication.types";
22
22
 
23
23
  export async function deleteCurrentUser(
24
24
  options: AccountDeletionOptions = { autoReauthenticate: true }
@@ -12,20 +12,20 @@ import {
12
12
  } from "firebase/auth";
13
13
  import * as AppleAuthentication from "expo-apple-authentication";
14
14
  import { Platform } from "react-native";
15
- import { generateNonce, hashNonce } from "./crypto.util";
16
- import { executeOperation, failureResultFrom } from "../../../domain/utils";
17
- import { isCancelledError } from "../../../domain/utils/error-handler.util";
15
+ import { generateNonce, hashNonce } from "../../../auth/infrastructure/services/crypto.util";
16
+ import { executeOperation, failureResultFrom } from "../../../../shared/domain/utils";
17
+ import { isCancelledError } from "../../../../shared/domain/utils/error-handler.util";
18
18
  import type {
19
19
  ReauthenticationResult,
20
20
  AuthProviderType,
21
21
  ReauthCredentialResult
22
- } from "./reauthentication.types";
22
+ } from "../../application/ports/reauthentication.types";
23
23
 
24
24
  export type {
25
25
  ReauthenticationResult,
26
26
  AuthProviderType,
27
27
  ReauthCredentialResult
28
- } from "./reauthentication.types";
28
+ } from "../../application/ports/reauthentication.types";
29
29
 
30
30
  export function getUserAuthProvider(user: User): AuthProviderType {
31
31
  if (user.isAnonymous) return "anonymous";
@@ -74,27 +74,6 @@ export type {
74
74
  FirestoreQuerySkipReason,
75
75
  } from './infrastructure/services/firestore-utils.service';
76
76
 
77
- // Account Deletion
78
- export {
79
- deleteCurrentUser,
80
- deleteUserAccount,
81
- } from './infrastructure/services/account-deletion.service';
82
-
83
- export type { AccountDeletionResult, AccountDeletionOptions } from './infrastructure/services/account-deletion.service';
84
-
85
- // Reauthentication Service
86
- export {
87
- getUserAuthProvider,
88
- reauthenticateWithGoogle,
89
- reauthenticateWithApple,
90
- reauthenticateWithPassword,
91
- getAppleReauthCredential,
92
- } from './infrastructure/services/reauthentication.service';
93
-
94
- export type {
95
- ReauthenticationResult,
96
- AuthProviderType,
97
- } from './infrastructure/services/reauthentication.service';
98
77
 
99
78
  // =============================================================================
100
79
  // INFRASTRUCTURE LAYER - Social Auth Services
@@ -5,10 +5,10 @@
5
5
  */
6
6
 
7
7
  import type { Auth } from 'firebase/auth';
8
- import { getFirebaseApp } from '../../../infrastructure/config/FirebaseClient';
8
+ import { getFirebaseApp } from '../../../../shared/infrastructure/config/FirebaseClient';
9
9
  import { FirebaseAuthInitializer } from './initializers/FirebaseAuthInitializer';
10
10
  import type { FirebaseAuthConfig } from '../../domain/value-objects/FirebaseAuthConfig';
11
- import { ServiceClientSingleton } from '../../../infrastructure/config/base/ServiceClientSingleton';
11
+ import { ServiceClientSingleton } from '../../../../shared/infrastructure/config/base/ServiceClientSingleton';
12
12
 
13
13
  /**
14
14
  * Firebase Auth Client Singleton
@@ -15,7 +15,7 @@ import type { AppleAuthResult } from "./apple-auth.types";
15
15
  import {
16
16
  isCancellationError,
17
17
  } from "./base/base-auth.service";
18
- import { executeAuthOperation, type Result } from "../../../domain/utils";
18
+ import { executeAuthOperation, type Result } from "../../../../shared/domain/utils";
19
19
 
20
20
  // Conditional import - expo-apple-authentication is optional
21
21
  let AppleAuthentication: any = null;
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { onIdTokenChanged, type User } from "firebase/auth";
7
7
  import { getFirebaseAuth } from "../config/FirebaseAuthClient";
8
- import type { Result } from "../../../domain/utils";
9
- import { failureResultFrom } from "../../../domain/utils";
8
+ import type { Result } from "../../../../shared/domain/utils";
9
+ import { failureResultFrom } from "../../../../shared/domain/utils";
10
10
 
11
11
  export interface AuthListenerConfig {
12
12
  /**
@@ -5,7 +5,7 @@
5
5
 
6
6
  import type { User, Auth } from 'firebase/auth';
7
7
  import { getFirebaseAuth } from '../config/FirebaseAuthClient';
8
- import { isValidString } from '../../../domain/utils/validation.util';
8
+ import { isValidString } from '../../../../shared/domain/utils/validation.util';
9
9
 
10
10
  export interface AuthCheckResult {
11
11
  isAuthenticated: boolean;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { UserCredential } from 'firebase/auth';
9
- import { authErrorConverter, type Result } from '../../../../domain/utils';
9
+ import { authErrorConverter, type Result } from '../../../../../shared/domain/utils';
10
10
 
11
11
  /**
12
12
  * Authentication result with user credential
@@ -13,7 +13,7 @@ import {
13
13
  type User,
14
14
  } from "firebase/auth";
15
15
  import { getFirebaseAuth } from "../config/FirebaseAuthClient";
16
- import { executeOperation, failureResultFrom, successResult, type Result } from "../../../domain/utils";
16
+ import { executeOperation, failureResultFrom, successResult, type Result } from "../../../../shared/domain/utils";
17
17
 
18
18
  export interface EmailCredentials {
19
19
  email: string;
@@ -9,8 +9,8 @@ import {
9
9
  type Auth,
10
10
  } from "firebase/auth";
11
11
  import type { GoogleAuthConfig, GoogleAuthResult } from "./google-auth.types";
12
- import { executeAuthOperation, type Result } from "../../../domain/utils";
13
- import { ConfigurableService } from "../../../domain/utils/service-config.util";
12
+ import { executeAuthOperation, type Result } from "../../../../shared/domain/utils";
13
+ import { ConfigurableService } from "../../../../shared/domain/utils/service-config.util";
14
14
 
15
15
  /**
16
16
  * Google Auth Service
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { updatePassword, type User } from 'firebase/auth';
7
- import { executeAuthOperation, type Result } from '../../../domain/utils';
7
+ import { executeAuthOperation, type Result } from '../../../../shared/domain/utils';
8
8
 
9
9
  /**
10
10
  * Result of a password update operation
@@ -4,7 +4,7 @@
4
4
  * Domain-Driven Design: Error types for Firestore operations
5
5
  */
6
6
 
7
- import { FirebaseError } from '../../../domain/errors/FirebaseError';
7
+ import { FirebaseError } from '../../../../shared/domain/errors/FirebaseError';
8
8
 
9
9
  /**
10
10
  * Firestore Error
@@ -9,9 +9,9 @@
9
9
  */
10
10
 
11
11
  import type { Firestore } from 'firebase/firestore';
12
- import { getFirebaseApp } from '../../../infrastructure/config/FirebaseClient';
12
+ import { getFirebaseApp } from '../../../../shared/infrastructure/config/FirebaseClient';
13
13
  import { FirebaseFirestoreInitializer } from './initializers/FirebaseFirestoreInitializer';
14
- import { ServiceClientSingleton } from '../../../infrastructure/config/base/ServiceClientSingleton';
14
+ import { ServiceClientSingleton } from '../../../../shared/infrastructure/config/base/ServiceClientSingleton';
15
15
 
16
16
  /**
17
17
  * Firestore Client Singleton
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { RequestLog, RequestStats, RequestType } from '../../domain/entities/RequestLog';
7
- import { generateUniqueId } from '../../../domain/utils/id-generator.util';
7
+ import { generateUniqueId } from '../../../../shared/domain/utils/id-generator.util';
8
8
 
9
9
  export class RequestLoggerService {
10
10
  private logs: RequestLog[] = [];
@@ -10,4 +10,4 @@ export {
10
10
  isRetryableError,
11
11
  getQuotaErrorMessage,
12
12
  getRetryableErrorMessage,
13
- } from '../../domain/utils/error-handler.util';
13
+ } from '../../../shared/domain/utils/error-handler.util';
@@ -9,7 +9,7 @@ import {
9
9
  type Transaction,
10
10
  } from "firebase/firestore";
11
11
  import { getFirestore } from "../../infrastructure/config/FirestoreClient";
12
- import { hasCodeProperty } from "../../../domain/utils/type-guards.util";
12
+ import { hasCodeProperty } from "../../../../shared/domain/utils/type-guards.util";
13
13
 
14
14
  /**
15
15
  * Execute a transaction with automatic DB instance check.
package/src/index.ts CHANGED
@@ -15,10 +15,10 @@ export {
15
15
  FirebaseError,
16
16
  FirebaseInitializationError,
17
17
  FirebaseConfigurationError,
18
- } from "./domain/errors/FirebaseError";
18
+ } from "./shared/domain/errors/FirebaseError";
19
19
 
20
20
  // Core Types
21
- export type { FirebaseConfig } from "./domain/value-objects/FirebaseConfig";
21
+ export type { FirebaseConfig } from "./shared/domain/value-objects/FirebaseConfig";
22
22
  export type { IFirebaseClient } from "./application/ports/IFirebaseClient";
23
23
 
24
24
  // Core Client
@@ -31,14 +31,14 @@ export {
31
31
  getFirebaseInitializationError,
32
32
  resetFirebaseClient,
33
33
  firebaseClient,
34
- } from "./infrastructure/config/FirebaseClient";
34
+ } from "./shared/infrastructure/config/FirebaseClient";
35
35
 
36
36
  export type {
37
37
  FirebaseApp,
38
38
  AuthInitializer,
39
39
  ServiceInitializationOptions,
40
40
  ServiceInitializationResult,
41
- } from "./infrastructure/config/FirebaseClient";
41
+ } from "./shared/infrastructure/config/FirebaseClient";
42
42
 
43
43
  // Type Guards
44
44
  export {
@@ -50,10 +50,11 @@ export {
50
50
  isQuotaExceededError,
51
51
  getSafeErrorMessage,
52
52
  getSafeErrorCode,
53
- } from "./domain/guards/firebase-error.guard";
53
+ } from "./shared/domain/guards/firebase-error.guard";
54
54
 
55
- // Auth Module Exports
56
- export * from "./auth";
55
+ // Domain Exports
56
+ export * from "./domains/auth";
57
+ export * from "./domains/account-deletion";
57
58
 
58
59
 
59
60
 
@@ -62,8 +63,8 @@ export {
62
63
  BaseRepository,
63
64
  BaseQueryRepository,
64
65
  BasePaginatedRepository,
65
- } from "./firestore";
66
- export * from "./firestore";
66
+ } from "./domains/firestore";
67
+ export * from "./domains/firestore";
67
68
  export { Timestamp } from "firebase/firestore";
68
69
  export type {
69
70
  Transaction,
@@ -86,8 +87,8 @@ export {
86
87
  createSuccessResult,
87
88
  runTransaction,
88
89
  serverTimestamp,
89
- } from "./firestore/utils/firestore-helper";
90
- export type { FirestoreResult, NoDbResult } from "./firestore/utils/firestore-helper";
90
+ } from "./domains/firestore/utils/firestore-helper";
91
+ export type { FirestoreResult, NoDbResult } from "./domains/firestore/utils/firestore-helper";
91
92
 
92
93
  // Init Module Factory
93
94
  export {
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { InitModule } from '@umituz/react-native-design-system';
7
- import { initializeAllFirebaseServices } from '../infrastructure/config/FirebaseClient';
7
+ import { initializeAllFirebaseServices } from '../shared/infrastructure/config/FirebaseClient';
8
8
 
9
9
  export interface FirebaseInitModuleConfig {
10
10
  /**
@@ -11,7 +11,7 @@ import {
11
11
  } from 'firebase/auth';
12
12
  import * as AppleAuthentication from 'expo-apple-authentication';
13
13
  import { Platform } from 'react-native';
14
- import { generateNonce, hashNonce } from '../../auth/infrastructure/services/crypto.util';
14
+ import { generateNonce, hashNonce } from '../../../domains/auth/infrastructure/services/crypto.util';
15
15
 
16
16
  /**
17
17
  * Generate Google credential from ID token
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { FirebaseConfig } from '../../../domain/value-objects/FirebaseConfig';
7
- import type { IFirebaseClient } from '../../../application/ports/IFirebaseClient';
7
+ import type { IFirebaseClient } from '../../../../application/ports/IFirebaseClient';
8
8
  import type { FirebaseApp } from '../initializers/FirebaseAppInitializer';
9
9
  import { FirebaseClientState } from '../state/FirebaseClientState';
10
10
  import { FirebaseInitializationOrchestrator } from '../orchestrators/FirebaseInitializationOrchestrator';
@@ -1,291 +0,0 @@
1
- # Auth Errors
2
-
3
- Firebase Authentication error types and error handling utilities.
4
-
5
- ## Purpose
6
-
7
- Provides custom error classes for Firebase Authentication operations with structured error handling, type safety, and user-friendly error messages.
8
-
9
- ## For AI Agents
10
-
11
- ### Before Using Auth Errors
12
-
13
- 1. **USE** custom error classes (not raw Firebase errors)
14
- 2. **CHECK** error types with instanceof
15
- 3. **PROVIDE** user-friendly error messages
16
- 4. **HANDLE** retryable errors appropriately
17
- 5. **LOG** errors for debugging
18
-
19
- ### Required Practices
20
-
21
- 1. **Use custom error classes** - Import from auth module
22
- 2. **Check error types** - Use instanceof for type checking
23
- 3. **Map error codes** - Convert to user-friendly messages
24
- 4. **Handle retryable errors** - Implement retry logic
25
- 5. **Log errors** - Include context for debugging
26
-
27
- ### Forbidden Practices
28
-
29
- ## ❌ NEVER
30
-
31
- - Throw primitive values (always Error instances)
32
- - Show technical error messages to users
33
- - Ignore error codes
34
- - Assume all errors are fatal
35
- - Catch and suppress errors silently
36
-
37
- ## ⚠️ Avoid
38
-
39
- - Generic error handling
40
- - Not checking error types
41
- - Not providing user feedback
42
- - Missing error context
43
- - Not logging auth errors
44
-
45
- ## Error Classes
46
-
47
- ### FirebaseAuthError
48
-
49
- **Import From:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
50
-
51
- **Purpose:** Base error class for all Firebase Auth errors
52
-
53
- **Properties:**
54
- - `code: string` - Error code for programmatic handling
55
- - `message: string` - Human-readable error message
56
-
57
- **Usage:**
58
- - Base class for all auth errors
59
- - Type checking with instanceof
60
- - Error code for conditional logic
61
-
62
- **When to Use:**
63
- - Throwing custom auth errors
64
- - Catching and handling auth errors
65
- - Type-safe error handling
66
-
67
- ### FirebaseAuthInitializationError
68
-
69
- **Import From:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
70
-
71
- **Purpose:** Error thrown when Firebase Auth fails to initialize
72
-
73
- **Extends:** FirebaseAuthError
74
-
75
- **Usage:**
76
- - Initialization failures
77
- - Configuration errors
78
- - Firebase setup issues
79
-
80
- **When to Use:**
81
- - Auth not initialized
82
- - Invalid Firebase config
83
- - Initialization timeout
84
-
85
- ## Error Handling Strategies
86
-
87
- ### For Auth Operation Errors
88
-
89
- **Strategy:** Catch and handle auth errors with user-friendly messages.
90
-
91
- **Import From:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
92
-
93
- **When to Use:**
94
- - Sign-in failures
95
- - Sign-up failures
96
- - Password reset failures
97
- - Email verification failures
98
-
99
- **Handling Strategy:**
100
- 1. Wrap auth operation in try-catch
101
- 2. Check error type with instanceof
102
- 3. Map error code to user message
103
- 4. Display error to user
104
- 5. Provide retry option if appropriate
105
- 6. Log technical error for debugging
106
-
107
- ### For Initialization Errors
108
-
109
- **Strategy:** Handle Firebase Auth initialization failures.
110
-
111
- **Import From:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
112
-
113
- **When to Use:**
114
- - App startup
115
- - Auth service initialization
116
- - Configuration loading
117
-
118
- **Handling Strategy:**
119
- 1. Catch initialization error
120
- 2. Check if FirebaseAuthInitializationError
121
- 3. Show setup error message
122
- 4. Provide setup instructions
123
- 5. Offer retry option
124
-
125
- ### For Network Errors
126
-
127
- **Strategy:** Retry transient network failures.
128
-
129
- **Import From:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
130
-
131
- **When to Use:**
132
- - Network connection failed
133
- - Request timeout
134
- - Service unavailable
135
-
136
- **Handling Strategy:**
137
- 1. Check error code for network issues
138
- 2. Show network error message
139
- 3. Provide retry button
140
- 4. Implement retry with delay
141
- 5. Limit retry attempts
142
-
143
- ### For User-Facing Messages
144
-
145
- **Strategy:** Map error codes to user-friendly messages.
146
-
147
- **Import From:** Use error.code to map messages
148
-
149
- **Common Error Messages:**
150
- - `INVALID_CREDENTIALS` → "Invalid email or password"
151
- - `USER_NOT_FOUND` → "Account not found"
152
- - `WEAK_PASSWORD` → "Password is too weak"
153
- - `EMAIL_ALREADY_IN_USE` → "Email already registered"
154
- - `NETWORK_ERROR` → "Network error. Please check your connection"
155
- - `TOO_MANY_REQUESTS` → "Too many attempts. Please try again later"
156
-
157
- **Implementation:**
158
- 1. Create error message mapper
159
- 2. Map error codes to messages
160
- 3. Display message to user
161
- 4. Provide action buttons
162
- 5. Handle retry scenarios
163
-
164
- ## Error Codes Reference
165
-
166
- ### Common Error Codes
167
-
168
- **Import From:** Error.code property
169
-
170
- | Error Code | Description | Retryable | User Message |
171
- |------------|-------------|-----------|--------------|
172
- | `INVALID_CREDENTIALS` | Invalid email or password | No | Invalid email or password |
173
- | `USER_NOT_FOUND` | User account not found | No | Account not found |
174
- | `WEAK_PASSWORD` | Password too weak | No | Password is too weak |
175
- | `EMAIL_ALREADY_IN_USE` | Email already registered | No | Email already registered |
176
- | `NETWORK_ERROR` | Network connection failed | Yes | Network error. Check connection |
177
- | `TIMEOUT` | Request timeout | Yes | Request timeout. Try again |
178
- | `TOO_MANY_REQUESTS` | Rate limit exceeded | Yes | Too many attempts. Wait |
179
- | `USER_DISABLED` | User account disabled | No | Account disabled |
180
- | `INVALID_EMAIL` | Invalid email format | No | Invalid email format |
181
- | `EMAIL_NOT_VERIFIED` | Email not verified | No | Please verify your email |
182
-
183
- ## Common Mistakes to Avoid
184
-
185
- 1. ❌ Not checking error types
186
- - ✅ Use instanceof for type checking
187
-
188
- 2. ❌ Showing technical messages to users
189
- - ✅ Map error codes to user-friendly messages
190
-
191
- 3. ❌ Not providing retry options
192
- - ✅ Offer retry for retryable errors
193
-
194
- 4. ❌ Not logging errors
195
- - ✅ Log errors with context
196
-
197
- 5. ❌ Generic error handling
198
- - ✅ Handle specific error types
199
-
200
- ## AI Agent Instructions
201
-
202
- ### When Handling Auth Errors
203
-
204
- 1. Wrap auth operations in try-catch
205
- 2. Check error type with instanceof
206
- 3. Map error code to user message
207
- 4. Display user-friendly message
208
- 5. Provide retry option if appropriate
209
- 6. Log technical error for debugging
210
-
211
- ### When Creating Error Messages
212
-
213
- 1. Map error codes to messages
214
- 2. Use clear, non-technical language
215
- 3. Provide actionable next steps
216
- 4. Keep messages concise
217
- 5. Localize if needed
218
-
219
- ### When Implementing Retry Logic
220
-
221
- 1. Check if error is retryable
222
- 2. Show retry button to user
223
- 3. Implement retry with delay
224
- 4. Limit retry attempts
225
- 5. Show countdown if rate limited
226
-
227
- ## Code Quality Standards
228
-
229
- ### Error Handling
230
-
231
- - Always use custom error classes
232
- - Check error types before handling
233
- - Provide user-friendly messages
234
- - Log errors with context
235
- - Handle specific error types
236
-
237
- ### Type Safety
238
-
239
- - Use instanceof for type checking
240
- - Never use `any` for errors
241
- - Type all error parameters
242
- - Export error classes
243
- - Use discriminated unions
244
-
245
- ### User Experience
246
-
247
- - Show clear error messages
248
- - Provide actionable next steps
249
- - Offer retry when appropriate
250
- - Don't show technical details
251
- - Test error flows
252
-
253
- ## Performance Considerations
254
-
255
- ### Error Logging
256
-
257
- - Log errors asynchronously
258
- - Don't block on logging
259
- - Include context (operation, userId)
260
- - Sanitize sensitive data
261
- - Use error tracking service
262
-
263
- ### Retry Logic
264
-
265
- - Limit retry attempts
266
- - Use exponential backoff
267
- - Show retry progress
268
- - Don't retry non-retryable errors
269
- - Consider rate limiting
270
-
271
- ## Related Documentation
272
-
273
- - [Auth Module README](../../README.md)
274
- - [Auth Services README](../infrastructure/services/README.md)
275
- - [Auth Stores README](../infrastructure/stores/README.md)
276
-
277
- ## API Reference
278
-
279
- ### Error Classes
280
-
281
- **Import Path:** `@umituz/react-native-firebase/auth` or `src/auth/domain/errors`
282
-
283
- | Class | Constructor Parameters | Description |
284
- |-------|----------------------|-------------|
285
- | `FirebaseAuthError` | `(message: string, code: string)` | Base auth error |
286
- | `FirebaseAuthInitializationError` | `(message: string)` | Init error |
287
-
288
- ---
289
-
290
- **Last Updated:** 2025-01-08
291
- **Maintainer:** Auth Module Team