@umituz/react-native-auth 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Auth Error Classes
3
+ * Domain-specific error types for authentication
4
+ */
5
+
6
+ export class AuthError extends Error {
7
+ constructor(
8
+ message: string,
9
+ public readonly code: string = "AUTH_ERROR",
10
+ ) {
11
+ super(message);
12
+ this.name = "AuthError";
13
+ }
14
+ }
15
+
16
+ export class AuthInitializationError extends AuthError {
17
+ constructor(message: string = "Auth service not initialized") {
18
+ super(message, "AUTH_INITIALIZATION_ERROR");
19
+ this.name = "AuthInitializationError";
20
+ }
21
+ }
22
+
23
+ export class AuthConfigurationError extends AuthError {
24
+ constructor(message: string = "Invalid auth configuration") {
25
+ super(message, "AUTH_CONFIGURATION_ERROR");
26
+ this.name = "AuthConfigurationError";
27
+ }
28
+ }
29
+
30
+ export class AuthValidationError extends AuthError {
31
+ constructor(message: string = "Validation failed") {
32
+ super(message, "AUTH_VALIDATION_ERROR");
33
+ this.name = "AuthValidationError";
34
+ }
35
+ }
36
+
37
+ export class AuthNetworkError extends AuthError {
38
+ constructor(message: string = "Network error") {
39
+ super(message, "AUTH_NETWORK_ERROR");
40
+ this.name = "AuthNetworkError";
41
+ }
42
+ }
43
+
44
+ export class AuthUserNotFoundError extends AuthError {
45
+ constructor(message: string = "User not found") {
46
+ super(message, "AUTH_USER_NOT_FOUND");
47
+ this.name = "AuthUserNotFoundError";
48
+ }
49
+ }
50
+
51
+ export class AuthWrongPasswordError extends AuthError {
52
+ constructor(message: string = "Wrong password") {
53
+ super(message, "AUTH_WRONG_PASSWORD");
54
+ this.name = "AuthWrongPasswordError";
55
+ }
56
+ }
57
+
58
+ export class AuthEmailAlreadyInUseError extends AuthError {
59
+ constructor(message: string = "Email already in use") {
60
+ super(message, "AUTH_EMAIL_ALREADY_IN_USE");
61
+ this.name = "AuthEmailAlreadyInUseError";
62
+ }
63
+ }
64
+
65
+ export class AuthWeakPasswordError extends AuthError {
66
+ constructor(message: string = "Password is too weak") {
67
+ super(message, "AUTH_WEAK_PASSWORD");
68
+ this.name = "AuthWeakPasswordError";
69
+ }
70
+ }
71
+
72
+ export class AuthInvalidEmailError extends AuthError {
73
+ constructor(message: string = "Invalid email address") {
74
+ super(message, "AUTH_INVALID_EMAIL");
75
+ this.name = "AuthInvalidEmailError";
76
+ }
77
+ }