@umituz/web-firebase 1.0.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 (75) hide show
  1. package/README.md +555 -0
  2. package/dist/application/index.d.mts +273 -0
  3. package/dist/application/index.d.ts +273 -0
  4. package/dist/application/index.js +490 -0
  5. package/dist/application/index.mjs +19 -0
  6. package/dist/chunk-34DL2QWQ.mjs +87 -0
  7. package/dist/chunk-4FP2ELQ5.mjs +96 -0
  8. package/dist/chunk-7TX3OU3O.mjs +721 -0
  9. package/dist/chunk-I6WGBPFB.mjs +439 -0
  10. package/dist/chunk-RZ4QR6TB.mjs +96 -0
  11. package/dist/chunk-U2XI4MGO.mjs +397 -0
  12. package/dist/domain/index.d.mts +325 -0
  13. package/dist/domain/index.d.ts +325 -0
  14. package/dist/domain/index.js +662 -0
  15. package/dist/domain/index.mjs +36 -0
  16. package/dist/file.repository.interface-v5vHgVsZ.d.mts +241 -0
  17. package/dist/file.repository.interface-v5vHgVsZ.d.ts +241 -0
  18. package/dist/firebase.entity-xvfEPjXZ.d.mts +15 -0
  19. package/dist/firebase.entity-xvfEPjXZ.d.ts +15 -0
  20. package/dist/index.d.mts +14 -96
  21. package/dist/index.d.ts +14 -96
  22. package/dist/index.js +1717 -78
  23. package/dist/index.mjs +88 -175
  24. package/dist/infrastructure/index.d.mts +170 -0
  25. package/dist/infrastructure/index.d.ts +170 -0
  26. package/dist/infrastructure/index.js +856 -0
  27. package/dist/infrastructure/index.mjs +46 -0
  28. package/dist/presentation/index.d.mts +25 -0
  29. package/dist/presentation/index.d.ts +25 -0
  30. package/dist/presentation/index.js +105 -0
  31. package/dist/presentation/index.mjs +6 -0
  32. package/dist/user.repository.interface-DS74TsJ5.d.mts +298 -0
  33. package/dist/user.repository.interface-DS74TsJ5.d.ts +298 -0
  34. package/package.json +39 -12
  35. package/src/application/dto/auth.dto.ts +69 -0
  36. package/src/application/dto/index.ts +7 -0
  37. package/src/application/dto/user.dto.ts +64 -0
  38. package/src/application/index.ts +7 -0
  39. package/src/application/use-cases/auth/reset-password.use-case.ts +66 -0
  40. package/src/application/use-cases/auth/sign-in-with-google.use-case.ts +86 -0
  41. package/src/application/use-cases/auth/sign-in.use-case.ts +77 -0
  42. package/src/application/use-cases/auth/sign-out.use-case.ts +22 -0
  43. package/src/application/use-cases/auth/sign-up.use-case.ts +99 -0
  44. package/src/application/use-cases/index.ts +12 -0
  45. package/src/application/use-cases/user/delete-account.use-case.ts +77 -0
  46. package/src/application/use-cases/user/update-profile.use-case.ts +98 -0
  47. package/src/domain/entities/file.entity.ts +151 -0
  48. package/src/domain/entities/firebase.entity.ts +13 -0
  49. package/src/domain/entities/timestamp.entity.ts +116 -0
  50. package/src/domain/entities/user.entity.ts +193 -0
  51. package/src/domain/errors/auth.errors.ts +115 -0
  52. package/src/domain/errors/repository.errors.ts +121 -0
  53. package/src/domain/index.ts +30 -0
  54. package/src/domain/interfaces/auth.repository.interface.ts +83 -0
  55. package/src/domain/interfaces/file.repository.interface.ts +143 -0
  56. package/src/domain/interfaces/repository.interface.ts +11 -0
  57. package/src/domain/interfaces/user.repository.interface.ts +75 -0
  58. package/src/domain/value-objects/email.vo.ts +105 -0
  59. package/src/domain/value-objects/file-path.vo.ts +184 -0
  60. package/src/domain/value-objects/user-id.vo.ts +87 -0
  61. package/src/index.ts +23 -0
  62. package/src/infrastructure/firebase/auth.adapter.ts +220 -0
  63. package/src/infrastructure/firebase/client.ts +141 -0
  64. package/src/infrastructure/firebase/firestore.adapter.ts +190 -0
  65. package/src/infrastructure/firebase/storage.adapter.ts +323 -0
  66. package/src/infrastructure/index.ts +13 -0
  67. package/src/infrastructure/services/firebase.service.ts +30 -0
  68. package/src/infrastructure/services/firestore.repository.ts +66 -0
  69. package/src/infrastructure/utils/storage.util.ts +46 -0
  70. package/src/presentation/hooks/useAuth.ts +153 -0
  71. package/src/presentation/hooks/useFirebaseAuth.ts +122 -0
  72. package/src/presentation/hooks/useFirestore.ts +125 -0
  73. package/src/presentation/hooks/useStorage.ts +141 -0
  74. package/src/presentation/index.ts +6 -0
  75. package/src/presentation/providers/FirebaseProvider.tsx +40 -0
@@ -0,0 +1,439 @@
1
+ import {
2
+ createRepositoryError
3
+ } from "./chunk-4FP2ELQ5.mjs";
4
+
5
+ // src/domain/entities/user.entity.ts
6
+ var USER_COLLECTIONS = {
7
+ USERS: "users",
8
+ CONTENT: "content",
9
+ ANALYTICS: "analytics",
10
+ CONNECTED_ACCOUNTS: "connectedAccounts"
11
+ };
12
+ var USER_SUBCOLLECTIONS = {
13
+ CONTENT: "content",
14
+ ANALYTICS: "analytics",
15
+ SCHEDULED: "scheduled",
16
+ PUBLISHED: "published",
17
+ DRAFTS: "drafts"
18
+ };
19
+
20
+ // src/domain/entities/file.entity.ts
21
+ var FileErrorCode = /* @__PURE__ */ ((FileErrorCode2) => {
22
+ FileErrorCode2["FILE_TOO_LARGE"] = "FILE_TOO_LARGE";
23
+ FileErrorCode2["INVALID_TYPE"] = "INVALID_TYPE";
24
+ FileErrorCode2["INVALID_EXTENSION"] = "INVALID_EXTENSION";
25
+ FileErrorCode2["UPLOAD_FAILED"] = "UPLOAD_FAILED";
26
+ FileErrorCode2["DOWNLOAD_FAILED"] = "DOWNLOAD_FAILED";
27
+ FileErrorCode2["DELETE_FAILED"] = "DELETE_FAILED";
28
+ FileErrorCode2["FILE_NOT_FOUND"] = "FILE_NOT_FOUND";
29
+ FileErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
30
+ FileErrorCode2["CANCELLED"] = "CANCELLED";
31
+ return FileErrorCode2;
32
+ })(FileErrorCode || {});
33
+
34
+ // src/domain/entities/timestamp.entity.ts
35
+ var Timestamp = class _Timestamp {
36
+ constructor(seconds, nanoseconds) {
37
+ this.seconds = seconds;
38
+ this.nanoseconds = nanoseconds;
39
+ }
40
+ /**
41
+ * Create Timestamp from JavaScript Date
42
+ */
43
+ static fromDate(date) {
44
+ const milliseconds = date.getTime();
45
+ const seconds = Math.floor(milliseconds / 1e3);
46
+ const nanoseconds = milliseconds % 1e3 * 1e6;
47
+ return new _Timestamp(seconds, nanoseconds);
48
+ }
49
+ /**
50
+ * Create Timestamp from milliseconds
51
+ */
52
+ static fromMillis(milliseconds) {
53
+ const seconds = Math.floor(milliseconds / 1e3);
54
+ const nanoseconds = milliseconds % 1e3 * 1e6;
55
+ return new _Timestamp(seconds, nanoseconds);
56
+ }
57
+ /**
58
+ * Create Timestamp from Firestore Timestamp
59
+ */
60
+ static fromFirestoreTimestamp(timestamp) {
61
+ return new _Timestamp(timestamp.seconds, timestamp.nanoseconds);
62
+ }
63
+ /**
64
+ * Get current timestamp
65
+ */
66
+ static now() {
67
+ return _Timestamp.fromDate(/* @__PURE__ */ new Date());
68
+ }
69
+ /**
70
+ * Convert to JavaScript Date
71
+ */
72
+ toDate() {
73
+ return new Date(this.seconds * 1e3 + this.nanoseconds / 1e6);
74
+ }
75
+ /**
76
+ * Convert to milliseconds
77
+ */
78
+ toMillis() {
79
+ return this.seconds * 1e3 + this.nanoseconds / 1e6;
80
+ }
81
+ /**
82
+ * Convert to Firestore Timestamp
83
+ */
84
+ toFirestoreTimestamp() {
85
+ return {
86
+ seconds: this.seconds,
87
+ nanoseconds: this.nanoseconds
88
+ };
89
+ }
90
+ /**
91
+ * Convert to ISO string
92
+ */
93
+ toISOString() {
94
+ return this.toDate().toISOString();
95
+ }
96
+ /**
97
+ * Check if timestamp is in the past
98
+ */
99
+ isPast() {
100
+ return this.toMillis() < Date.now();
101
+ }
102
+ /**
103
+ * Check if timestamp is in the future
104
+ */
105
+ isFuture() {
106
+ return this.toMillis() > Date.now();
107
+ }
108
+ /**
109
+ * Get difference in milliseconds with another timestamp
110
+ */
111
+ diff(other) {
112
+ return this.toMillis() - other.toMillis();
113
+ }
114
+ };
115
+ var serverTimestamp = {
116
+ __type__: "serverTimestamp"
117
+ };
118
+
119
+ // src/domain/value-objects/email.vo.ts
120
+ var Email = class _Email {
121
+ value;
122
+ validated;
123
+ constructor(email) {
124
+ this.value = email.trim().toLowerCase();
125
+ this.validated = this.isValid();
126
+ if (!this.validated) {
127
+ throw new Error(`Invalid email address: ${email}`);
128
+ }
129
+ }
130
+ /**
131
+ * Validate email format
132
+ */
133
+ isValid() {
134
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
135
+ return emailRegex.test(this.value);
136
+ }
137
+ /**
138
+ * Get email value
139
+ */
140
+ getValue() {
141
+ return this.value;
142
+ }
143
+ /**
144
+ * Get local part (before @)
145
+ */
146
+ getLocalPart() {
147
+ return this.value.split("@")[0];
148
+ }
149
+ /**
150
+ * Get domain part (after @)
151
+ */
152
+ getDomain() {
153
+ return this.value.split("@")[1] || "";
154
+ }
155
+ /**
156
+ * Check if email is from a specific domain
157
+ */
158
+ isFromDomain(domain) {
159
+ return this.getDomain() === domain.toLowerCase();
160
+ }
161
+ /**
162
+ * Check if email is from a corporate domain (not gmail, yahoo, etc.)
163
+ */
164
+ isCorporate() {
165
+ const freeDomains = [
166
+ "gmail.com",
167
+ "yahoo.com",
168
+ "hotmail.com",
169
+ "outlook.com",
170
+ "aol.com",
171
+ "icloud.com",
172
+ "protonmail.com"
173
+ ];
174
+ return !freeDomains.includes(this.getDomain());
175
+ }
176
+ /**
177
+ * Mask email for display (e.g., u***@gmail.com)
178
+ */
179
+ mask() {
180
+ const [local, domain] = this.value.split("@");
181
+ if (local.length <= 2) {
182
+ return `${local[0]}***@${domain}`;
183
+ }
184
+ return `${local[0]}${"*".repeat(local.length - 2)}${local[local.length - 1]}@${domain}`;
185
+ }
186
+ /**
187
+ * Convert to string
188
+ */
189
+ toString() {
190
+ return this.value;
191
+ }
192
+ /**
193
+ * Check equality with another email
194
+ */
195
+ equals(other) {
196
+ return this.value === other.value;
197
+ }
198
+ /**
199
+ * Create Email from string (returns null if invalid)
200
+ */
201
+ static create(email) {
202
+ try {
203
+ return new _Email(email);
204
+ } catch {
205
+ return null;
206
+ }
207
+ }
208
+ };
209
+
210
+ // src/domain/value-objects/user-id.vo.ts
211
+ var UserId = class _UserId {
212
+ value;
213
+ constructor(id) {
214
+ this.value = id;
215
+ this.validate();
216
+ }
217
+ /**
218
+ * Validate user ID
219
+ */
220
+ validate() {
221
+ if (!this.value) {
222
+ throw createRepositoryError("INVALID_DATA" /* INVALID_DATA */, "User ID cannot be empty");
223
+ }
224
+ if (this.value.length < 20) {
225
+ throw createRepositoryError(
226
+ "INVALID_DATA" /* INVALID_DATA */,
227
+ "User ID is too short (must be at least 20 characters)"
228
+ );
229
+ }
230
+ const validPattern = /^[a-zA-Z0-9_-]+$/;
231
+ if (!validPattern.test(this.value)) {
232
+ throw createRepositoryError(
233
+ "INVALID_DATA" /* INVALID_DATA */,
234
+ "User ID contains invalid characters"
235
+ );
236
+ }
237
+ }
238
+ /**
239
+ * Get user ID value
240
+ */
241
+ getValue() {
242
+ return this.value;
243
+ }
244
+ /**
245
+ * Check if this is a temporary ID (not yet persisted)
246
+ */
247
+ isTemporary() {
248
+ return this.value.startsWith("temp_");
249
+ }
250
+ /**
251
+ * Convert to string
252
+ */
253
+ toString() {
254
+ return this.value;
255
+ }
256
+ /**
257
+ * Check equality with another user ID
258
+ */
259
+ equals(other) {
260
+ return this.value === other.value;
261
+ }
262
+ /**
263
+ * Generate a temporary user ID
264
+ */
265
+ static generateTemp() {
266
+ return new _UserId(`temp_${Date.now()}_${Math.random().toString(36).substring(7)}`);
267
+ }
268
+ /**
269
+ * Create UserId from string (returns null if invalid)
270
+ */
271
+ static create(id) {
272
+ try {
273
+ return new _UserId(id);
274
+ } catch {
275
+ return null;
276
+ }
277
+ }
278
+ };
279
+
280
+ // src/domain/value-objects/file-path.vo.ts
281
+ var FilePath = class _FilePath {
282
+ value;
283
+ parts;
284
+ constructor(path) {
285
+ this.value = path.trim();
286
+ this.parts = this.value.split("/").filter((p) => p.length > 0);
287
+ this.validate();
288
+ }
289
+ /**
290
+ * Validate file path
291
+ */
292
+ validate() {
293
+ if (!this.value) {
294
+ throw createRepositoryError("INVALID_DATA" /* INVALID_DATA */, "File path cannot be empty");
295
+ }
296
+ if (this.value.startsWith("/") || this.value.endsWith("/")) {
297
+ throw createRepositoryError(
298
+ "INVALID_DATA" /* INVALID_DATA */,
299
+ "File path should not start or end with /"
300
+ );
301
+ }
302
+ if (this.value.includes("//")) {
303
+ throw createRepositoryError("INVALID_DATA" /* INVALID_DATA */, "File path should not contain //");
304
+ }
305
+ if (this.parts.length === 0) {
306
+ throw createRepositoryError("INVALID_DATA" /* INVALID_DATA */, "File path must have at least one segment");
307
+ }
308
+ for (const part of this.parts) {
309
+ if (/[<>:"|?*]/.test(part)) {
310
+ throw createRepositoryError(
311
+ "INVALID_DATA" /* INVALID_DATA */,
312
+ `Invalid characters in path segment: ${part}`
313
+ );
314
+ }
315
+ if (part === "." || part === "..") {
316
+ throw createRepositoryError(
317
+ "INVALID_DATA" /* INVALID_DATA */,
318
+ `Invalid path segment: ${part}`
319
+ );
320
+ }
321
+ }
322
+ }
323
+ /**
324
+ * Get file path value
325
+ */
326
+ getValue() {
327
+ return this.value;
328
+ }
329
+ /**
330
+ * Get path parts
331
+ */
332
+ getParts() {
333
+ return [...this.parts];
334
+ }
335
+ /**
336
+ * Get filename (last part of path)
337
+ */
338
+ getFileName() {
339
+ return this.parts[this.parts.length - 1] || "";
340
+ }
341
+ /**
342
+ * Get directory path (all parts except last)
343
+ */
344
+ getDirectory() {
345
+ return this.parts.slice(0, -1).join("/");
346
+ }
347
+ /**
348
+ * Get file extension
349
+ */
350
+ getExtension() {
351
+ const fileName = this.getFileName();
352
+ const lastDot = fileName.lastIndexOf(".");
353
+ return lastDot > 0 ? fileName.substring(lastDot + 1) : "";
354
+ }
355
+ /**
356
+ * Get file name without extension
357
+ */
358
+ getFileNameWithoutExtension() {
359
+ const fileName = this.getFileName();
360
+ const lastDot = fileName.lastIndexOf(".");
361
+ return lastDot > 0 ? fileName.substring(0, lastDot) : fileName;
362
+ }
363
+ /**
364
+ * Check if path is in a specific directory
365
+ */
366
+ isInDirectory(directory) {
367
+ return this.value.startsWith(directory + "/");
368
+ }
369
+ /**
370
+ * Check if file has a specific extension
371
+ */
372
+ hasExtension(extension) {
373
+ return this.getExtension().toLowerCase() === extension.toLowerCase();
374
+ }
375
+ /**
376
+ * Create a new path by appending segments
377
+ */
378
+ append(...segments) {
379
+ return new _FilePath([...this.parts, ...segments].join("/"));
380
+ }
381
+ /**
382
+ * Create a new path in a parent directory
383
+ */
384
+ withParent(parent) {
385
+ return new _FilePath([parent, ...this.parts].join("/"));
386
+ }
387
+ /**
388
+ * Create a new path with a different filename
389
+ */
390
+ withFileName(fileName) {
391
+ const dir = this.getDirectory();
392
+ return dir ? new _FilePath(`${dir}/${fileName}`) : new _FilePath(fileName);
393
+ }
394
+ /**
395
+ * Convert to string
396
+ */
397
+ toString() {
398
+ return this.value;
399
+ }
400
+ /**
401
+ * Check equality with another file path
402
+ */
403
+ equals(other) {
404
+ return this.value === other.value;
405
+ }
406
+ /**
407
+ * Create user path (users/{userId}/...)
408
+ */
409
+ static userPath(userId, ...segments) {
410
+ return new _FilePath(["users", userId, ...segments].join("/"));
411
+ }
412
+ /**
413
+ * Create public path (public/...)
414
+ */
415
+ static publicPath(...segments) {
416
+ return new _FilePath(["public", ...segments].join("/"));
417
+ }
418
+ /**
419
+ * Create FilePath from string (returns null if invalid)
420
+ */
421
+ static create(path) {
422
+ try {
423
+ return new _FilePath(path);
424
+ } catch {
425
+ return null;
426
+ }
427
+ }
428
+ };
429
+
430
+ export {
431
+ USER_COLLECTIONS,
432
+ USER_SUBCOLLECTIONS,
433
+ FileErrorCode,
434
+ Timestamp,
435
+ serverTimestamp,
436
+ Email,
437
+ UserId,
438
+ FilePath
439
+ };
@@ -0,0 +1,96 @@
1
+ // src/domain/errors/auth.errors.ts
2
+ var AuthError = class extends Error {
3
+ constructor(message, code, originalError) {
4
+ super(message);
5
+ this.code = code;
6
+ this.originalError = originalError;
7
+ this.name = "AuthError";
8
+ }
9
+ };
10
+ var AuthErrorCode = /* @__PURE__ */ ((AuthErrorCode2) => {
11
+ AuthErrorCode2["USER_NOT_FOUND"] = "USER_NOT_FOUND";
12
+ AuthErrorCode2["USER_ALREADY_EXISTS"] = "USER_ALREADY_EXISTS";
13
+ AuthErrorCode2["INVALID_CREDENTIALS"] = "INVALID_CREDENTIALS";
14
+ AuthErrorCode2["WEAK_PASSWORD"] = "WEAK_PASSWORD";
15
+ AuthErrorCode2["EMAIL_NOT_VERIFIED"] = "EMAIL_NOT_VERIFIED";
16
+ AuthErrorCode2["SESSION_EXPIRED"] = "SESSION_EXPIRED";
17
+ AuthErrorCode2["UNAUTHENTICATED"] = "UNAUTHENTICATED";
18
+ AuthErrorCode2["TOO_MANY_REQUESTS"] = "TOO_MANY_REQUESTS";
19
+ AuthErrorCode2["OAUTH_ERROR"] = "OAUTH_ERROR";
20
+ AuthErrorCode2["OAUTH_CANCELLED"] = "OAUTH_CANCELLED";
21
+ AuthErrorCode2["OAUTH_ACCOUNT_EXISTS"] = "OAUTH_ACCOUNT_EXISTS";
22
+ AuthErrorCode2["SIGN_IN_FAILED"] = "SIGN_IN_FAILED";
23
+ AuthErrorCode2["SIGN_UP_FAILED"] = "SIGN_UP_FAILED";
24
+ AuthErrorCode2["SIGN_OUT_FAILED"] = "SIGN_OUT_FAILED";
25
+ AuthErrorCode2["PASSWORD_RESET_FAILED"] = "PASSWORD_RESET_FAILED";
26
+ AuthErrorCode2["EMAIL_VERIFICATION_FAILED"] = "EMAIL_VERIFICATION_FAILED";
27
+ AuthErrorCode2["PROFILE_UPDATE_FAILED"] = "PROFILE_UPDATE_FAILED";
28
+ AuthErrorCode2["EMAIL_UPDATE_FAILED"] = "EMAIL_UPDATE_FAILED";
29
+ AuthErrorCode2["PASSWORD_UPDATE_FAILED"] = "PASSWORD_UPDATE_FAILED";
30
+ AuthErrorCode2["ACCOUNT_DELETE_FAILED"] = "ACCOUNT_DELETE_FAILED";
31
+ AuthErrorCode2["REAUTHENTICATION_REQUIRED"] = "REAUTHENTICATION_REQUIRED";
32
+ AuthErrorCode2["REAUTHENTICATION_FAILED"] = "REAUTHENTICATION_FAILED";
33
+ AuthErrorCode2["UNKNOWN"] = "UNKNOWN";
34
+ return AuthErrorCode2;
35
+ })(AuthErrorCode || {});
36
+ function createAuthError(code, message, originalError) {
37
+ const defaultMessage = getAuthErrorMessage(code);
38
+ return new AuthError(message || defaultMessage, code, originalError);
39
+ }
40
+ function getAuthErrorMessage(code) {
41
+ switch (code) {
42
+ case "USER_NOT_FOUND" /* USER_NOT_FOUND */:
43
+ return "User not found";
44
+ case "USER_ALREADY_EXISTS" /* USER_ALREADY_EXISTS */:
45
+ return "User already exists";
46
+ case "INVALID_CREDENTIALS" /* INVALID_CREDENTIALS */:
47
+ return "Invalid credentials";
48
+ case "WEAK_PASSWORD" /* WEAK_PASSWORD */:
49
+ return "Password is too weak";
50
+ case "EMAIL_NOT_VERIFIED" /* EMAIL_NOT_VERIFIED */:
51
+ return "Email not verified";
52
+ case "SESSION_EXPIRED" /* SESSION_EXPIRED */:
53
+ return "Session expired";
54
+ case "UNAUTHENTICATED" /* UNAUTHENTICATED */:
55
+ return "User not authenticated";
56
+ case "TOO_MANY_REQUESTS" /* TOO_MANY_REQUESTS */:
57
+ return "Too many requests";
58
+ case "OAUTH_ERROR" /* OAUTH_ERROR */:
59
+ return "OAuth error occurred";
60
+ case "OAUTH_CANCELLED" /* OAUTH_CANCELLED */:
61
+ return "OAuth cancelled by user";
62
+ case "OAUTH_ACCOUNT_EXISTS" /* OAUTH_ACCOUNT_EXISTS */:
63
+ return "Account already exists with this provider";
64
+ case "SIGN_IN_FAILED" /* SIGN_IN_FAILED */:
65
+ return "Sign in failed";
66
+ case "SIGN_UP_FAILED" /* SIGN_UP_FAILED */:
67
+ return "Sign up failed";
68
+ case "SIGN_OUT_FAILED" /* SIGN_OUT_FAILED */:
69
+ return "Sign out failed";
70
+ case "PASSWORD_RESET_FAILED" /* PASSWORD_RESET_FAILED */:
71
+ return "Password reset failed";
72
+ case "EMAIL_VERIFICATION_FAILED" /* EMAIL_VERIFICATION_FAILED */:
73
+ return "Email verification failed";
74
+ case "PROFILE_UPDATE_FAILED" /* PROFILE_UPDATE_FAILED */:
75
+ return "Profile update failed";
76
+ case "EMAIL_UPDATE_FAILED" /* EMAIL_UPDATE_FAILED */:
77
+ return "Email update failed";
78
+ case "PASSWORD_UPDATE_FAILED" /* PASSWORD_UPDATE_FAILED */:
79
+ return "Password update failed";
80
+ case "ACCOUNT_DELETE_FAILED" /* ACCOUNT_DELETE_FAILED */:
81
+ return "Account deletion failed";
82
+ case "REAUTHENTICATION_REQUIRED" /* REAUTHENTICATION_REQUIRED */:
83
+ return "Reauthentication required";
84
+ case "REAUTHENTICATION_FAILED" /* REAUTHENTICATION_FAILED */:
85
+ return "Reauthentication failed";
86
+ case "UNKNOWN" /* UNKNOWN */:
87
+ default:
88
+ return "An unknown error occurred";
89
+ }
90
+ }
91
+
92
+ export {
93
+ AuthError,
94
+ AuthErrorCode,
95
+ createAuthError
96
+ };