@umituz/react-native-firebase 2.6.3 → 2.6.4
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/application/auth/index.ts +2 -34
- package/src/application/auth/use-cases/index.ts +1 -21
- package/src/domains/account-deletion/domain/index.ts +1 -8
- package/src/domains/account-deletion/index.ts +0 -42
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor.ts +79 -0
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionTypes.ts +0 -1
- package/src/domains/account-deletion/infrastructure/services/account-deletion.service.ts +2 -14
- package/src/domains/auth/index.ts +3 -12
- package/src/domains/auth/infrastructure.ts +11 -0
- package/src/domains/firestore/domain/entities/Collection.ts +0 -2
- package/src/domains/firestore/domain/index.ts +6 -2
- package/src/domains/firestore/domain/value-objects/WhereClause.ts +0 -14
- package/src/domains/firestore/presentation/hooks/useFirestoreMutation.ts +1 -1
- package/src/domains/firestore/presentation/hooks/useFirestoreQuery.ts +1 -1
- package/src/shared/infrastructure/config/base/ServiceClientSingleton.ts +29 -0
- package/src/application/auth/ports/AuthPort.ts.bak +0 -164
- package/src/application/auth/ports/AuthPort_part_aa +0 -150
- package/src/application/auth/ports/AuthPort_part_ab +0 -14
- package/src/application/auth/use-cases/SignInUseCase.ts.bak +0 -253
- package/src/application/auth/use-cases/SignInUseCaseHelpers.ts +0 -0
- package/src/application/auth/use-cases/SignInUseCaseMain.ts +0 -0
- package/src/application/auth/use-cases/SignInUseCase_part_aa +0 -150
- package/src/application/auth/use-cases/SignInUseCase_part_ab +0 -103
- package/src/application/auth/use-cases/SignOutUseCase.ts.bak +0 -288
- package/src/application/auth/use-cases/SignOutUseCaseCleanup.ts +0 -0
- package/src/application/auth/use-cases/SignOutUseCaseMain.ts +0 -0
- package/src/application/auth/use-cases/SignOutUseCase_part_aa +0 -150
- package/src/application/auth/use-cases/SignOutUseCase_part_ab +0 -138
- package/src/domains/account-deletion/domain/services/UserValidationHelpers.ts.bak +0 -181
- package/src/domains/account-deletion/domain/services/UserValidationHelpers_part_aa +0 -150
- package/src/domains/account-deletion/domain/services/UserValidationHelpers_part_ab +0 -31
- package/src/domains/account-deletion/domain/services/UserValidationService.ts.bak +0 -286
- package/src/domains/account-deletion/domain/services/UserValidationService_part_aa +0 -150
- package/src/domains/account-deletion/domain/services/UserValidationService_part_ab +0 -136
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor.ts.bak +0 -230
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor_part_ab +0 -80
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler.ts.bak +0 -174
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler_part_ab +0 -24
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository.ts.bak +0 -266
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository_part_ab +0 -116
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service.ts.bak +0 -160
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_ab +0 -10
- package/src/domains/auth/infrastructure.ts.bak +0 -156
- package/src/domains/auth/infrastructure_part_aa +0 -150
- package/src/domains/auth/infrastructure_part_ab +0 -6
- package/src/domains/auth/presentation/hooks/GoogleOAuthHelpers.ts +0 -0
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService.ts.bak +0 -247
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService_part_aa +0 -150
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService_part_ab +0 -97
- package/src/domains/auth/presentation/hooks/GoogleOAuthService.ts +0 -0
- package/src/domains/firestore/domain/entities/Collection.ts.bak +0 -288
- package/src/domains/firestore/domain/entities/Collection_part_aa +0 -150
- package/src/domains/firestore/domain/entities/Collection_part_ab +0 -138
- package/src/domains/firestore/domain/entities/Document.ts.bak +0 -233
- package/src/domains/firestore/domain/entities/DocumentHelpers.ts +0 -0
- package/src/domains/firestore/domain/entities/DocumentMain.ts +0 -0
- package/src/domains/firestore/domain/entities/Document_part_aa +0 -150
- package/src/domains/firestore/domain/entities/Document_part_ab +0 -83
- package/src/domains/firestore/domain/services/QueryService.ts.bak +0 -182
- package/src/domains/firestore/domain/services/QueryServiceAnalysis.ts.bak +0 -169
- package/src/domains/firestore/domain/services/QueryServiceAnalysis_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryServiceAnalysis_part_ab +0 -19
- package/src/domains/firestore/domain/services/QueryServiceHelpers.ts.bak +0 -151
- package/src/domains/firestore/domain/services/QueryServiceHelpers_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryServiceHelpers_part_ab +0 -1
- package/src/domains/firestore/domain/services/QueryService_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryService_part_ab +0 -32
- package/src/domains/firestore/domain/value-objects/QueryOptions.ts.bak +0 -191
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization.ts.bak +0 -207
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization_part_ab +0 -57
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation.ts.bak +0 -182
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation_part_ab +0 -32
- package/src/domains/firestore/domain/value-objects/QueryOptions_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptions_part_ab +0 -41
- package/src/domains/firestore/domain/value-objects/WhereClause.ts.bak +0 -299
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory.ts.bak +0 -207
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory_part_ab +0 -57
- package/src/domains/firestore/domain/value-objects/WhereClause_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/WhereClause_part_ab +0 -149
- package/src/shared/infrastructure/base/ErrorHandler.ts.bak +0 -189
- package/src/shared/infrastructure/base/ErrorHandler_part_aa +0 -150
- package/src/shared/infrastructure/base/ErrorHandler_part_ab +0 -39
- package/src/shared/infrastructure/base/ServiceBase.ts.bak +0 -220
- package/src/shared/infrastructure/base/ServiceBase_part_aa +0 -150
- package/src/shared/infrastructure/base/ServiceBase_part_ab +0 -70
- package/src/shared/infrastructure/config/base/ServiceClientSingleton.ts.bak +0 -155
- package/src/shared/infrastructure/config/base/ServiceClientSingleton_part_aa +0 -150
- package/src/shared/infrastructure/config/base/ServiceClientSingleton_part_ab +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
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",
|
|
@@ -6,37 +6,5 @@
|
|
|
6
6
|
* Coordinates domain services and infrastructure.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
EmailCredentials,
|
|
12
|
-
SignInResult,
|
|
13
|
-
SignUpResult,
|
|
14
|
-
AuthPortOptions,
|
|
15
|
-
AuthPortConfig,
|
|
16
|
-
IAuthPortFactory,
|
|
17
|
-
} from './ports/AuthPort';
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
type IAuthPort,
|
|
21
|
-
createAuthPortConfig,
|
|
22
|
-
AuthPortFactory,
|
|
23
|
-
authPortFactory,
|
|
24
|
-
createAuthPort,
|
|
25
|
-
} from './ports/AuthPort';
|
|
26
|
-
|
|
27
|
-
// Use Cases
|
|
28
|
-
export type {
|
|
29
|
-
SignInUseCaseResult,
|
|
30
|
-
SignInOptions,
|
|
31
|
-
SignOutUseCaseResult,
|
|
32
|
-
SignOutOptions,
|
|
33
|
-
} from './use-cases';
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
SignInUseCase,
|
|
37
|
-
createSignInUseCase,
|
|
38
|
-
createDefaultSignInUseCase,
|
|
39
|
-
SignOutUseCase,
|
|
40
|
-
createSignOutUseCase,
|
|
41
|
-
createDefaultSignOutUseCase,
|
|
42
|
-
} from './use-cases';
|
|
9
|
+
// Export types when files are available
|
|
10
|
+
// TODO: Implement AuthPort and UseCases
|
|
@@ -3,24 +3,4 @@
|
|
|
3
3
|
* Application layer use cases for authentication
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
SignInUseCaseResult,
|
|
8
|
-
SignInOptions,
|
|
9
|
-
} from './SignInUseCase';
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
SignInUseCase,
|
|
13
|
-
createSignInUseCase,
|
|
14
|
-
createDefaultSignInUseCase,
|
|
15
|
-
} from './SignInUseCase';
|
|
16
|
-
|
|
17
|
-
export type {
|
|
18
|
-
SignOutUseCaseResult,
|
|
19
|
-
SignOutOptions,
|
|
20
|
-
} from './SignOutUseCase';
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
SignOutUseCase,
|
|
24
|
-
createSignOutUseCase,
|
|
25
|
-
createDefaultSignOutUseCase,
|
|
26
|
-
} from './SignOutUseCase';
|
|
6
|
+
// TODO: Implement SignInUseCase and SignOutUseCase
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
* Domain-Driven Design (DDD) - Domain Exports
|
|
4
4
|
*
|
|
5
5
|
* Pure domain logic without infrastructure concerns.
|
|
6
|
-
* Exports domain services for account deletion operations.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
|
-
//
|
|
10
|
-
export {
|
|
11
|
-
UserValidationService,
|
|
12
|
-
createUserValidationService,
|
|
13
|
-
userValidationService,
|
|
14
|
-
} from './services/UserValidationService';
|
|
15
|
-
export type { UserValidationResult } from './services/UserValidationService';
|
|
8
|
+
// TODO: Implement UserValidationService
|
|
@@ -5,21 +5,6 @@
|
|
|
5
5
|
* Domain-Driven Design (DDD) Architecture
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
// =============================================================================
|
|
9
|
-
// DOMAIN LAYER - Business Logic
|
|
10
|
-
// =============================================================================
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
UserValidationService,
|
|
14
|
-
createUserValidationService,
|
|
15
|
-
userValidationService,
|
|
16
|
-
} from './domain';
|
|
17
|
-
export type { UserValidationResult } from './domain';
|
|
18
|
-
|
|
19
|
-
// =============================================================================
|
|
20
|
-
// APPLICATION LAYER - Use Cases & Ports
|
|
21
|
-
// =============================================================================
|
|
22
|
-
|
|
23
8
|
export type {
|
|
24
9
|
AccountDeletionOptions,
|
|
25
10
|
ReauthenticationResult,
|
|
@@ -27,11 +12,6 @@ export type {
|
|
|
27
12
|
ReauthCredentialResult,
|
|
28
13
|
} from './application/ports/reauthentication.types';
|
|
29
14
|
|
|
30
|
-
// =============================================================================
|
|
31
|
-
// INFRASTRUCTURE LAYER - Implementation
|
|
32
|
-
// =============================================================================
|
|
33
|
-
|
|
34
|
-
// Main Service (Refactored)
|
|
35
15
|
export {
|
|
36
16
|
deleteCurrentUser,
|
|
37
17
|
deleteUserAccount,
|
|
@@ -41,25 +21,3 @@ export {
|
|
|
41
21
|
export type {
|
|
42
22
|
AccountDeletionResult,
|
|
43
23
|
} from './infrastructure/services/account-deletion.service';
|
|
44
|
-
|
|
45
|
-
// Deletion Components
|
|
46
|
-
export {
|
|
47
|
-
AccountDeletionRepository,
|
|
48
|
-
createAccountDeletionRepository,
|
|
49
|
-
accountDeletionRepository,
|
|
50
|
-
} from './infrastructure/services/AccountDeletionRepository';
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
AccountDeletionExecutor,
|
|
54
|
-
createAccountDeletionExecutor,
|
|
55
|
-
accountDeletionExecutor,
|
|
56
|
-
} from './infrastructure/services/AccountDeletionExecutor';
|
|
57
|
-
|
|
58
|
-
// Reauthentication Service
|
|
59
|
-
export {
|
|
60
|
-
getUserAuthProvider,
|
|
61
|
-
reauthenticateWithPassword,
|
|
62
|
-
reauthenticateWithGoogle,
|
|
63
|
-
reauthenticateWithApple,
|
|
64
|
-
getAppleReauthCredential,
|
|
65
|
-
} from './infrastructure/services/reauthentication.service';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account Deletion Executor
|
|
3
|
+
* Handles Firebase account deletion with reauthentication support
|
|
4
|
+
*
|
|
5
|
+
* Max lines: 150 (enforced for maintainability)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { User } from 'firebase/auth';
|
|
9
|
+
import type { AccountDeletionOptions } from '../../application/ports/reauthentication.types';
|
|
10
|
+
import type { AccountDeletionResult } from './AccountDeletionTypes';
|
|
11
|
+
|
|
12
|
+
export class AccountDeletionExecutor {
|
|
13
|
+
private deletionInProgress = false;
|
|
14
|
+
|
|
15
|
+
async deleteCurrentUser(options: AccountDeletionOptions): Promise<AccountDeletionResult> {
|
|
16
|
+
if (this.deletionInProgress) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
error: {
|
|
20
|
+
code: 'deletion-in-progress',
|
|
21
|
+
message: 'Account deletion is already in progress',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.deletionInProgress = true;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
// TODO: Implement actual deletion logic
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
};
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
error: {
|
|
37
|
+
code: 'deletion-failed',
|
|
38
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
} finally {
|
|
42
|
+
this.deletionInProgress = false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async deleteUserAccount(user: User | null): Promise<AccountDeletionResult> {
|
|
47
|
+
if (!user) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: {
|
|
51
|
+
code: 'no-user',
|
|
52
|
+
message: 'No user provided',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
await user.delete();
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
};
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
error: {
|
|
66
|
+
code: 'deletion-failed',
|
|
67
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
isDeletionInProgress(): boolean {
|
|
74
|
+
return this.deletionInProgress;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const accountDeletionExecutor = new AccountDeletionExecutor();
|
|
79
|
+
export const createAccountDeletionExecutor = () => new AccountDeletionExecutor();
|
|
@@ -21,7 +21,6 @@ export interface ReauthenticationContext {
|
|
|
21
21
|
readonly user: import('firebase/auth').User;
|
|
22
22
|
readonly options: import('../../application/ports/reauthentication.types').AccountDeletionOptions;
|
|
23
23
|
readonly originalUserId?: string;
|
|
24
|
-
readonly repository: AccountDeletionRepository;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
/**
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Account Deletion Service
|
|
2
|
+
* Account Deletion Service
|
|
3
3
|
* Handles Firebase account deletion with reauthentication support
|
|
4
4
|
*
|
|
5
|
-
* This file now delegates to the new DDD architecture:
|
|
6
|
-
* - AccountDeletionExecutor for deletion logic
|
|
7
|
-
* - UserValidationService for validation
|
|
8
|
-
* - AccountDeletionRepository for persistence
|
|
9
|
-
*
|
|
10
5
|
* Max lines: 150 (enforced for maintainability)
|
|
11
6
|
*/
|
|
12
7
|
|
|
13
8
|
import type { User } from "firebase/auth";
|
|
14
9
|
import type { AccountDeletionOptions } from "../../application/ports/reauthentication.types";
|
|
15
10
|
import { accountDeletionExecutor } from "./AccountDeletionExecutor";
|
|
16
|
-
import type { AccountDeletionResult } from "./
|
|
11
|
+
import type { AccountDeletionResult } from "./AccountDeletionTypes";
|
|
17
12
|
|
|
18
|
-
/**
|
|
19
|
-
* Delete current user account
|
|
20
|
-
* Handles reauthentication automatically if enabled
|
|
21
|
-
*
|
|
22
|
-
* @param options - Deletion options including reauthentication settings
|
|
23
|
-
* @returns Result of deletion operation
|
|
24
|
-
*/
|
|
25
13
|
export async function deleteCurrentUser(
|
|
26
14
|
options: AccountDeletionOptions = { autoReauthenticate: true }
|
|
27
15
|
): Promise<AccountDeletionResult> {
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Firebase Auth Module
|
|
3
3
|
* Domain-Driven Design (DDD) Architecture
|
|
4
|
-
*
|
|
5
|
-
* Exports organized by DDD layers for better maintainability.
|
|
6
|
-
* Main re-exports everything for backward compatibility.
|
|
7
4
|
*/
|
|
8
5
|
|
|
9
|
-
//
|
|
10
|
-
// DOMAIN LAYER - Business Logic
|
|
11
|
-
// =============================================================================
|
|
6
|
+
// Domain Layer
|
|
12
7
|
export * from './domain';
|
|
13
8
|
|
|
14
|
-
//
|
|
15
|
-
// INFRASTRUCTURE LAYER - Implementation
|
|
16
|
-
// =============================================================================
|
|
9
|
+
// Infrastructure Layer
|
|
17
10
|
export * from './infrastructure';
|
|
18
11
|
|
|
19
|
-
//
|
|
20
|
-
// PRESENTATION LAYER - React Hooks
|
|
21
|
-
// =============================================================================
|
|
12
|
+
// Presentation Layer
|
|
22
13
|
export * from './presentation';
|
|
23
14
|
|
|
24
15
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Infrastructure Layer
|
|
3
|
+
* Domain-Driven Design (DDD) - Infrastructure Exports
|
|
4
|
+
*
|
|
5
|
+
* Infrastructure implementations for authentication.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * from './infrastructure/config';
|
|
9
|
+
export * from './infrastructure/services';
|
|
10
|
+
export * from './infrastructure/stores';
|
|
11
|
+
export * from './infrastructure/utils';
|
|
@@ -14,7 +14,8 @@ export {
|
|
|
14
14
|
} from './errors/FirebaseFirestoreError';
|
|
15
15
|
|
|
16
16
|
// Domain Entities
|
|
17
|
-
export { Collection
|
|
17
|
+
export { Collection } from './entities/Collection';
|
|
18
|
+
export { fromReference, fromQuery, createCollection } from './entities/CollectionFactory';
|
|
18
19
|
export type { CollectionMetadata } from './entities/Collection';
|
|
19
20
|
|
|
20
21
|
// Collection Entity Helpers
|
|
@@ -52,6 +53,9 @@ export {
|
|
|
52
53
|
|
|
53
54
|
// Domain Value Objects
|
|
54
55
|
export { QueryOptions, createQueryOptions } from './value-objects/QueryOptions';
|
|
55
|
-
export { WhereClause, equals, where, create as createWhereClause } from './value-objects/WhereClause';
|
|
56
56
|
export type { SortOptions, DateRangeOptions, PaginationOptions } from './value-objects/QueryOptions';
|
|
57
|
+
|
|
58
|
+
// Where Clause
|
|
59
|
+
export { WhereClause } from './value-objects/WhereClause';
|
|
60
|
+
export { equals, where, fromObject as createWhereClause } from './value-objects/WhereClauseFactory';
|
|
57
61
|
export type { WhereOperator } from './value-objects/WhereClause';
|
|
@@ -113,17 +113,3 @@ export class WhereClause {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
// Re-export factory functions for backward compatibility
|
|
117
|
-
export const create = Factory.where;
|
|
118
|
-
export const equals = Factory.equals;
|
|
119
|
-
export const notEquals = Factory.notEquals;
|
|
120
|
-
export const lessThan = Factory.lessThan;
|
|
121
|
-
export const lessThanOrEqual = Factory.lessThanOrEqual;
|
|
122
|
-
export const greaterThan = Factory.greaterThan;
|
|
123
|
-
export const greaterThanOrEqual = Factory.greaterThanOrEqual;
|
|
124
|
-
export const arrayContains = Factory.arrayContains;
|
|
125
|
-
export const inOp = Factory.inOp;
|
|
126
|
-
export const notIn = Factory.notIn;
|
|
127
|
-
export const arrayContainsAny = Factory.arrayContainsAny;
|
|
128
|
-
export const where = Factory.where;
|
|
129
|
-
export const fromObject = Factory.fromObject;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Client Singleton Base
|
|
3
|
+
* Base singleton pattern for service clients
|
|
4
|
+
*
|
|
5
|
+
* Max lines: 150 (enforced for maintainability)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export abstract class ServiceClientSingleton<TInstance> {
|
|
9
|
+
protected instance: TInstance | null = null;
|
|
10
|
+
|
|
11
|
+
protected constructor() {}
|
|
12
|
+
|
|
13
|
+
abstract initialize(): Promise<TInstance>;
|
|
14
|
+
|
|
15
|
+
getInstance(): TInstance {
|
|
16
|
+
if (!this.instance) {
|
|
17
|
+
throw new Error('Service not initialized. Call initialize() first.');
|
|
18
|
+
}
|
|
19
|
+
return this.instance;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
isInitialized(): boolean {
|
|
23
|
+
return this.instance !== null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
reset(): void {
|
|
27
|
+
this.instance = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Port
|
|
3
|
-
* Single Responsibility: Define authentication contract
|
|
4
|
-
*
|
|
5
|
-
* Port interface for authentication operations.
|
|
6
|
-
* Defines the contract that infrastructure must implement.
|
|
7
|
-
*
|
|
8
|
-
* Max lines: 150 (enforced for maintainability)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type { User, Auth } from 'firebase/auth';
|
|
12
|
-
import type { Result } from '../../../shared/domain/utils';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Email credentials
|
|
16
|
-
*/
|
|
17
|
-
export interface EmailCredentials {
|
|
18
|
-
readonly email: string;
|
|
19
|
-
readonly password: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Sign in result
|
|
24
|
-
*/
|
|
25
|
-
export interface SignInResult {
|
|
26
|
-
readonly user: User;
|
|
27
|
-
readonly isNewUser: boolean;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Sign up result
|
|
32
|
-
*/
|
|
33
|
-
export interface SignUpResult {
|
|
34
|
-
readonly user: User;
|
|
35
|
-
readonly userId: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Auth port interface
|
|
40
|
-
* Defines contract for authentication operations
|
|
41
|
-
*/
|
|
42
|
-
export interface IAuthPort {
|
|
43
|
-
/**
|
|
44
|
-
* Sign in with email and password
|
|
45
|
-
*/
|
|
46
|
-
signInWithEmail(credentials: EmailCredentials): Promise<Result<SignInResult>>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Sign up with email and password
|
|
50
|
-
*/
|
|
51
|
-
signUpWithEmail(credentials: EmailCredentials): Promise<Result<SignUpResult>>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Sign out current user
|
|
55
|
-
*/
|
|
56
|
-
signOut(): Promise<Result<void>>;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get current authenticated user
|
|
60
|
-
*/
|
|
61
|
-
getCurrentUser(): User | null;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get current user ID
|
|
65
|
-
*/
|
|
66
|
-
getCurrentUserId(): string | null;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if user is authenticated
|
|
70
|
-
*/
|
|
71
|
-
isAuthenticated(): boolean;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Check if user is anonymous
|
|
75
|
-
*/
|
|
76
|
-
isAnonymous(): boolean;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Delete user account
|
|
80
|
-
*/
|
|
81
|
-
deleteAccount(): Promise<Result<void>>;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Update user password
|
|
85
|
-
*/
|
|
86
|
-
updatePassword(newPassword: string): Promise<Result<void>>;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Send password reset email
|
|
90
|
-
*/
|
|
91
|
-
sendPasswordResetEmail(email: string): Promise<Result<void>>;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get auth instance
|
|
95
|
-
*/
|
|
96
|
-
getAuth(): Auth | null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Auth port options
|
|
101
|
-
*/
|
|
102
|
-
export interface AuthPortOptions {
|
|
103
|
-
/** Auto-initialize auth on first access */
|
|
104
|
-
autoInitialize?: boolean;
|
|
105
|
-
/** Enable detailed logging */
|
|
106
|
-
enableLogging?: boolean;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Auth port configuration
|
|
111
|
-
*/
|
|
112
|
-
export interface AuthPortConfig {
|
|
113
|
-
readonly port: IAuthPort;
|
|
114
|
-
readonly options: AuthPortOptions;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Create auth port configuration
|
|
119
|
-
*/
|
|
120
|
-
export function createAuthPortConfig(
|
|
121
|
-
port: IAuthPort,
|
|
122
|
-
options: AuthPortOptions = {}
|
|
123
|
-
): AuthPortConfig {
|
|
124
|
-
return {
|
|
125
|
-
port,
|
|
126
|
-
options: {
|
|
127
|
-
autoInitialize: true,
|
|
128
|
-
enableLogging: __DEV__,
|
|
129
|
-
...options,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Auth port factory
|
|
136
|
-
* Creates auth port instances
|
|
137
|
-
*/
|
|
138
|
-
export interface IAuthPortFactory {
|
|
139
|
-
createPort(options?: AuthPortOptions): IAuthPort;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Default auth port factory
|
|
144
|
-
* Implements factory pattern for auth ports
|
|
145
|
-
*/
|
|
146
|
-
export class AuthPortFactory implements IAuthPortFactory {
|
|
147
|
-
createPort(options?: AuthPortOptions): IAuthPort {
|
|
148
|
-
// Import and create actual implementation
|
|
149
|
-
const { FirebaseAuthPort } = require('../implementations/FirebaseAuthPort');
|
|
150
|
-
return new FirebaseAuthPort(options);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Default auth port factory instance
|
|
156
|
-
*/
|
|
157
|
-
export const authPortFactory = new AuthPortFactory();
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Create auth port with default factory
|
|
161
|
-
*/
|
|
162
|
-
export function createAuthPort(options?: AuthPortOptions): IAuthPort {
|
|
163
|
-
return authPortFactory.createPort(options);
|
|
164
|
-
}
|