@umituz/web-firebase 2.1.1 → 3.0.0
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 +12 -39
- package/src/domains/auth/entities/index.ts +60 -0
- package/src/domains/auth/index.ts +13 -0
- package/src/domains/auth/services/auth.service.ts +245 -0
- package/src/domains/auth/services/index.ts +7 -0
- package/src/domains/auth/types/auth-service.interface.ts +72 -0
- package/src/domains/auth/types/index.ts +5 -0
- package/src/domains/firestore/entities/index.ts +82 -0
- package/src/domains/firestore/index.ts +13 -0
- package/src/domains/firestore/services/firestore.service.ts +191 -0
- package/src/domains/firestore/services/index.ts +7 -0
- package/src/domains/firestore/types/firestore-service.interface.ts +64 -0
- package/src/domains/firestore/types/index.ts +5 -0
- package/src/domains/storage/entities/index.ts +94 -0
- package/src/domains/storage/index.ts +13 -0
- package/src/domains/storage/services/index.ts +7 -0
- package/src/domains/storage/services/storage.service.ts +223 -0
- package/src/domains/storage/types/index.ts +5 -0
- package/src/domains/storage/types/storage-service.interface.ts +120 -0
- package/src/index.ts +12 -16
- package/src/presentation/hooks/useAuth.ts +69 -26
- package/src/presentation/providers/FirebaseProvider.tsx +9 -14
- package/dist/application/index.d.mts +0 -273
- package/dist/application/index.d.ts +0 -273
- package/dist/application/index.js +0 -490
- package/dist/application/index.mjs +0 -19
- package/dist/chunk-34DL2QWQ.mjs +0 -87
- package/dist/chunk-4FP2ELQ5.mjs +0 -96
- package/dist/chunk-7TX3OU3O.mjs +0 -721
- package/dist/chunk-I6WGBPFB.mjs +0 -439
- package/dist/chunk-RZ4QR6TB.mjs +0 -96
- package/dist/chunk-U2XI4MGO.mjs +0 -397
- package/dist/domain/index.d.mts +0 -325
- package/dist/domain/index.d.ts +0 -325
- package/dist/domain/index.js +0 -662
- package/dist/domain/index.mjs +0 -36
- package/dist/file.repository.interface-v5vHgVsZ.d.mts +0 -241
- package/dist/file.repository.interface-v5vHgVsZ.d.ts +0 -241
- package/dist/firebase.entity-xvfEPjXZ.d.mts +0 -15
- package/dist/firebase.entity-xvfEPjXZ.d.ts +0 -15
- package/dist/index.d.mts +0 -14
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -1833
- package/dist/index.mjs +0 -98
- package/dist/infrastructure/index.d.mts +0 -170
- package/dist/infrastructure/index.d.ts +0 -170
- package/dist/infrastructure/index.js +0 -856
- package/dist/infrastructure/index.mjs +0 -46
- package/dist/presentation/index.d.mts +0 -25
- package/dist/presentation/index.d.ts +0 -25
- package/dist/presentation/index.js +0 -105
- package/dist/presentation/index.mjs +0 -6
- package/dist/user.repository.interface-DS74TsJ5.d.mts +0 -298
- package/dist/user.repository.interface-DS74TsJ5.d.ts +0 -298
package/dist/domain/index.d.mts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
export { F as FirebaseTimestamp, a as FirebaseUser } from '../firebase.entity-xvfEPjXZ.mjs';
|
|
2
|
-
export { A as AccountMetrics, I as IAuthRepository, a as IUserRepository, P as PlatformBreakdown, U as USER_COLLECTIONS, b as USER_SUBCOLLECTIONS, c as User, d as UserAnalytics, e as UserConnectedAccount, f as UserContent, g as UserCredits, h as UserNotifications, i as UserPrivacy, j as UserProfile, k as UserSettings, l as UserSubscription } from '../user.repository.interface-DS74TsJ5.mjs';
|
|
3
|
-
export { F as FileCategory, a as FileErrorCode, b as FileFilters, c as FileMetadata, d as FileQueryResult, e as FileType, f as FileUploadResult, g as FileValidationOptions, I as IFileRepository, S as StorageStats, U as UploadOptions, h as UploadProgress, i as UploadResult, j as UploadState, V as ValidationResult } from '../file.repository.interface-v5vHgVsZ.mjs';
|
|
4
|
-
import { Timestamp as Timestamp$1 } from 'firebase/firestore';
|
|
5
|
-
import 'firebase/auth';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Timestamp Value Objects
|
|
9
|
-
* @description Value objects for handling timestamps in Firestore
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Firebase Timestamp wrapper
|
|
14
|
-
* Provides type safety and utility methods for timestamp handling
|
|
15
|
-
*/
|
|
16
|
-
declare class Timestamp {
|
|
17
|
-
readonly seconds: number;
|
|
18
|
-
readonly nanoseconds: number;
|
|
19
|
-
constructor(seconds: number, nanoseconds: number);
|
|
20
|
-
/**
|
|
21
|
-
* Create Timestamp from JavaScript Date
|
|
22
|
-
*/
|
|
23
|
-
static fromDate(date: Date): Timestamp;
|
|
24
|
-
/**
|
|
25
|
-
* Create Timestamp from milliseconds
|
|
26
|
-
*/
|
|
27
|
-
static fromMillis(milliseconds: number): Timestamp;
|
|
28
|
-
/**
|
|
29
|
-
* Create Timestamp from Firestore Timestamp
|
|
30
|
-
*/
|
|
31
|
-
static fromFirestoreTimestamp(timestamp: Timestamp$1): Timestamp;
|
|
32
|
-
/**
|
|
33
|
-
* Get current timestamp
|
|
34
|
-
*/
|
|
35
|
-
static now(): Timestamp;
|
|
36
|
-
/**
|
|
37
|
-
* Convert to JavaScript Date
|
|
38
|
-
*/
|
|
39
|
-
toDate(): Date;
|
|
40
|
-
/**
|
|
41
|
-
* Convert to milliseconds
|
|
42
|
-
*/
|
|
43
|
-
toMillis(): number;
|
|
44
|
-
/**
|
|
45
|
-
* Convert to Firestore Timestamp
|
|
46
|
-
*/
|
|
47
|
-
toFirestoreTimestamp(): Timestamp$1;
|
|
48
|
-
/**
|
|
49
|
-
* Convert to ISO string
|
|
50
|
-
*/
|
|
51
|
-
toISOString(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Check if timestamp is in the past
|
|
54
|
-
*/
|
|
55
|
-
isPast(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Check if timestamp is in the future
|
|
58
|
-
*/
|
|
59
|
-
isFuture(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Get difference in milliseconds with another timestamp
|
|
62
|
-
*/
|
|
63
|
-
diff(other: Timestamp): number;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Server timestamp sentinel for Firestore
|
|
67
|
-
*/
|
|
68
|
-
declare const serverTimestamp: {
|
|
69
|
-
readonly __type__: "serverTimestamp";
|
|
70
|
-
};
|
|
71
|
-
type ServerTimestamp = typeof serverTimestamp;
|
|
72
|
-
/**
|
|
73
|
-
* Timestamp field that can be a Timestamp, server timestamp, or ISO string
|
|
74
|
-
*/
|
|
75
|
-
type TimestampField = Timestamp | ServerTimestamp | string;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Email Value Object
|
|
79
|
-
* @description Immutable email address value object with validation
|
|
80
|
-
*/
|
|
81
|
-
declare class Email {
|
|
82
|
-
private readonly value;
|
|
83
|
-
private readonly validated;
|
|
84
|
-
constructor(email: string);
|
|
85
|
-
/**
|
|
86
|
-
* Validate email format
|
|
87
|
-
*/
|
|
88
|
-
private isValid;
|
|
89
|
-
/**
|
|
90
|
-
* Get email value
|
|
91
|
-
*/
|
|
92
|
-
getValue(): string;
|
|
93
|
-
/**
|
|
94
|
-
* Get local part (before @)
|
|
95
|
-
*/
|
|
96
|
-
getLocalPart(): string;
|
|
97
|
-
/**
|
|
98
|
-
* Get domain part (after @)
|
|
99
|
-
*/
|
|
100
|
-
getDomain(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Check if email is from a specific domain
|
|
103
|
-
*/
|
|
104
|
-
isFromDomain(domain: string): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Check if email is from a corporate domain (not gmail, yahoo, etc.)
|
|
107
|
-
*/
|
|
108
|
-
isCorporate(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Mask email for display (e.g., u***@gmail.com)
|
|
111
|
-
*/
|
|
112
|
-
mask(): string;
|
|
113
|
-
/**
|
|
114
|
-
* Convert to string
|
|
115
|
-
*/
|
|
116
|
-
toString(): string;
|
|
117
|
-
/**
|
|
118
|
-
* Check equality with another email
|
|
119
|
-
*/
|
|
120
|
-
equals(other: Email): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Create Email from string (returns null if invalid)
|
|
123
|
-
*/
|
|
124
|
-
static create(email: string): Email | null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* UserId Value Object
|
|
129
|
-
* @description Immutable user ID value object with validation
|
|
130
|
-
*/
|
|
131
|
-
declare class UserId {
|
|
132
|
-
private readonly value;
|
|
133
|
-
constructor(id: string);
|
|
134
|
-
/**
|
|
135
|
-
* Validate user ID
|
|
136
|
-
*/
|
|
137
|
-
private validate;
|
|
138
|
-
/**
|
|
139
|
-
* Get user ID value
|
|
140
|
-
*/
|
|
141
|
-
getValue(): string;
|
|
142
|
-
/**
|
|
143
|
-
* Check if this is a temporary ID (not yet persisted)
|
|
144
|
-
*/
|
|
145
|
-
isTemporary(): boolean;
|
|
146
|
-
/**
|
|
147
|
-
* Convert to string
|
|
148
|
-
*/
|
|
149
|
-
toString(): string;
|
|
150
|
-
/**
|
|
151
|
-
* Check equality with another user ID
|
|
152
|
-
*/
|
|
153
|
-
equals(other: UserId): boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Generate a temporary user ID
|
|
156
|
-
*/
|
|
157
|
-
static generateTemp(): UserId;
|
|
158
|
-
/**
|
|
159
|
-
* Create UserId from string (returns null if invalid)
|
|
160
|
-
*/
|
|
161
|
-
static create(id: string): UserId | null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* FilePath Value Object
|
|
166
|
-
* @description Immutable file path value object with validation for Firebase Storage paths
|
|
167
|
-
*/
|
|
168
|
-
declare class FilePath {
|
|
169
|
-
private readonly value;
|
|
170
|
-
private readonly parts;
|
|
171
|
-
constructor(path: string);
|
|
172
|
-
/**
|
|
173
|
-
* Validate file path
|
|
174
|
-
*/
|
|
175
|
-
private validate;
|
|
176
|
-
/**
|
|
177
|
-
* Get file path value
|
|
178
|
-
*/
|
|
179
|
-
getValue(): string;
|
|
180
|
-
/**
|
|
181
|
-
* Get path parts
|
|
182
|
-
*/
|
|
183
|
-
getParts(): string[];
|
|
184
|
-
/**
|
|
185
|
-
* Get filename (last part of path)
|
|
186
|
-
*/
|
|
187
|
-
getFileName(): string;
|
|
188
|
-
/**
|
|
189
|
-
* Get directory path (all parts except last)
|
|
190
|
-
*/
|
|
191
|
-
getDirectory(): string;
|
|
192
|
-
/**
|
|
193
|
-
* Get file extension
|
|
194
|
-
*/
|
|
195
|
-
getExtension(): string;
|
|
196
|
-
/**
|
|
197
|
-
* Get file name without extension
|
|
198
|
-
*/
|
|
199
|
-
getFileNameWithoutExtension(): string;
|
|
200
|
-
/**
|
|
201
|
-
* Check if path is in a specific directory
|
|
202
|
-
*/
|
|
203
|
-
isInDirectory(directory: string): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* Check if file has a specific extension
|
|
206
|
-
*/
|
|
207
|
-
hasExtension(extension: string): boolean;
|
|
208
|
-
/**
|
|
209
|
-
* Create a new path by appending segments
|
|
210
|
-
*/
|
|
211
|
-
append(...segments: string[]): FilePath;
|
|
212
|
-
/**
|
|
213
|
-
* Create a new path in a parent directory
|
|
214
|
-
*/
|
|
215
|
-
withParent(parent: string): FilePath;
|
|
216
|
-
/**
|
|
217
|
-
* Create a new path with a different filename
|
|
218
|
-
*/
|
|
219
|
-
withFileName(fileName: string): FilePath;
|
|
220
|
-
/**
|
|
221
|
-
* Convert to string
|
|
222
|
-
*/
|
|
223
|
-
toString(): string;
|
|
224
|
-
/**
|
|
225
|
-
* Check equality with another file path
|
|
226
|
-
*/
|
|
227
|
-
equals(other: FilePath): boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Create user path (users/{userId}/...)
|
|
230
|
-
*/
|
|
231
|
-
static userPath(userId: string, ...segments: string[]): FilePath;
|
|
232
|
-
/**
|
|
233
|
-
* Create public path (public/...)
|
|
234
|
-
*/
|
|
235
|
-
static publicPath(...segments: string[]): FilePath;
|
|
236
|
-
/**
|
|
237
|
-
* Create FilePath from string (returns null if invalid)
|
|
238
|
-
*/
|
|
239
|
-
static create(path: string): FilePath | null;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Base Repository Interface
|
|
244
|
-
*/
|
|
245
|
-
interface IBaseRepository<T> {
|
|
246
|
-
getById(id: string, parentPath?: string): Promise<T | null>;
|
|
247
|
-
getAll(constraints?: any[], parentPath?: string): Promise<T[]>;
|
|
248
|
-
create(id: string, data: Omit<T, 'id'>, parentPath?: string): Promise<void>;
|
|
249
|
-
update(id: string, data: Partial<T>, parentPath?: string): Promise<void>;
|
|
250
|
-
delete(id: string, parentPath?: string): Promise<void>;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Domain Errors for Authentication
|
|
255
|
-
* @description Custom error types for authentication-related failures
|
|
256
|
-
*/
|
|
257
|
-
declare class AuthError extends Error {
|
|
258
|
-
code: AuthErrorCode;
|
|
259
|
-
originalError?: unknown | undefined;
|
|
260
|
-
constructor(message: string, code: AuthErrorCode, originalError?: unknown | undefined);
|
|
261
|
-
}
|
|
262
|
-
declare enum AuthErrorCode {
|
|
263
|
-
USER_NOT_FOUND = "USER_NOT_FOUND",
|
|
264
|
-
USER_ALREADY_EXISTS = "USER_ALREADY_EXISTS",
|
|
265
|
-
INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
|
|
266
|
-
WEAK_PASSWORD = "WEAK_PASSWORD",
|
|
267
|
-
EMAIL_NOT_VERIFIED = "EMAIL_NOT_VERIFIED",
|
|
268
|
-
SESSION_EXPIRED = "SESSION_EXPIRED",
|
|
269
|
-
UNAUTHENTICATED = "UNAUTHENTICATED",
|
|
270
|
-
TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS",
|
|
271
|
-
OAUTH_ERROR = "OAUTH_ERROR",
|
|
272
|
-
OAUTH_CANCELLED = "OAUTH_CANCELLED",
|
|
273
|
-
OAUTH_ACCOUNT_EXISTS = "OAUTH_ACCOUNT_EXISTS",
|
|
274
|
-
SIGN_IN_FAILED = "SIGN_IN_FAILED",
|
|
275
|
-
SIGN_UP_FAILED = "SIGN_UP_FAILED",
|
|
276
|
-
SIGN_OUT_FAILED = "SIGN_OUT_FAILED",
|
|
277
|
-
PASSWORD_RESET_FAILED = "PASSWORD_RESET_FAILED",
|
|
278
|
-
EMAIL_VERIFICATION_FAILED = "EMAIL_VERIFICATION_FAILED",
|
|
279
|
-
PROFILE_UPDATE_FAILED = "PROFILE_UPDATE_FAILED",
|
|
280
|
-
EMAIL_UPDATE_FAILED = "EMAIL_UPDATE_FAILED",
|
|
281
|
-
PASSWORD_UPDATE_FAILED = "PASSWORD_UPDATE_FAILED",
|
|
282
|
-
ACCOUNT_DELETE_FAILED = "ACCOUNT_DELETE_FAILED",
|
|
283
|
-
REAUTHENTICATION_REQUIRED = "REAUTHENTICATION_REQUIRED",
|
|
284
|
-
REAUTHENTICATION_FAILED = "REAUTHENTICATION_FAILED",
|
|
285
|
-
UNKNOWN = "UNKNOWN"
|
|
286
|
-
}
|
|
287
|
-
declare function createAuthError(code: AuthErrorCode, message?: string, originalError?: unknown): AuthError;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Domain Errors for Repository Operations
|
|
291
|
-
* @description Custom error types for repository-related failures
|
|
292
|
-
*/
|
|
293
|
-
declare class RepositoryError extends Error {
|
|
294
|
-
code: RepositoryErrorCode;
|
|
295
|
-
originalError?: unknown | undefined;
|
|
296
|
-
constructor(message: string, code: RepositoryErrorCode, originalError?: unknown | undefined);
|
|
297
|
-
}
|
|
298
|
-
declare enum RepositoryErrorCode {
|
|
299
|
-
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
300
|
-
DOCUMENT_ALREADY_EXISTS = "DOCUMENT_ALREADY_EXISTS",
|
|
301
|
-
DOCUMENT_INVALID = "DOCUMENT_INVALID",
|
|
302
|
-
COLLECTION_NOT_FOUND = "COLLECTION_NOT_FOUND",
|
|
303
|
-
COLLECTION_INVALID = "COLLECTION_INVALID",
|
|
304
|
-
QUERY_INVALID = "QUERY_INVALID",
|
|
305
|
-
QUERY_FAILED = "QUERY_FAILED",
|
|
306
|
-
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
307
|
-
TRANSACTION_ABORTED = "TRANSACTION_ABORTED",
|
|
308
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
309
|
-
TIMEOUT = "TIMEOUT",
|
|
310
|
-
OFFLINE = "OFFLINE",
|
|
311
|
-
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
312
|
-
UNAUTHORIZED = "UNAUTHORIZED",
|
|
313
|
-
VALIDATION_FAILED = "VALIDATION_FAILED",
|
|
314
|
-
INVALID_DATA = "INVALID_DATA",
|
|
315
|
-
CONFLICT = "CONFLICT",
|
|
316
|
-
VERSION_MISMATCH = "VERSION_MISMATCH",
|
|
317
|
-
STORAGE_ERROR = "STORAGE_ERROR",
|
|
318
|
-
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
319
|
-
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
320
|
-
INVALID_FILE_TYPE = "INVALID_FILE_TYPE",
|
|
321
|
-
UNKNOWN = "UNKNOWN"
|
|
322
|
-
}
|
|
323
|
-
declare function createRepositoryError(code: RepositoryErrorCode, message?: string, originalError?: unknown): RepositoryError;
|
|
324
|
-
|
|
325
|
-
export { AuthError, AuthErrorCode, Email, FilePath, type IBaseRepository, RepositoryError, RepositoryErrorCode, type ServerTimestamp, Timestamp, type TimestampField, UserId, createAuthError, createRepositoryError, serverTimestamp };
|
package/dist/domain/index.d.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
export { F as FirebaseTimestamp, a as FirebaseUser } from '../firebase.entity-xvfEPjXZ.js';
|
|
2
|
-
export { A as AccountMetrics, I as IAuthRepository, a as IUserRepository, P as PlatformBreakdown, U as USER_COLLECTIONS, b as USER_SUBCOLLECTIONS, c as User, d as UserAnalytics, e as UserConnectedAccount, f as UserContent, g as UserCredits, h as UserNotifications, i as UserPrivacy, j as UserProfile, k as UserSettings, l as UserSubscription } from '../user.repository.interface-DS74TsJ5.js';
|
|
3
|
-
export { F as FileCategory, a as FileErrorCode, b as FileFilters, c as FileMetadata, d as FileQueryResult, e as FileType, f as FileUploadResult, g as FileValidationOptions, I as IFileRepository, S as StorageStats, U as UploadOptions, h as UploadProgress, i as UploadResult, j as UploadState, V as ValidationResult } from '../file.repository.interface-v5vHgVsZ.js';
|
|
4
|
-
import { Timestamp as Timestamp$1 } from 'firebase/firestore';
|
|
5
|
-
import 'firebase/auth';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Timestamp Value Objects
|
|
9
|
-
* @description Value objects for handling timestamps in Firestore
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Firebase Timestamp wrapper
|
|
14
|
-
* Provides type safety and utility methods for timestamp handling
|
|
15
|
-
*/
|
|
16
|
-
declare class Timestamp {
|
|
17
|
-
readonly seconds: number;
|
|
18
|
-
readonly nanoseconds: number;
|
|
19
|
-
constructor(seconds: number, nanoseconds: number);
|
|
20
|
-
/**
|
|
21
|
-
* Create Timestamp from JavaScript Date
|
|
22
|
-
*/
|
|
23
|
-
static fromDate(date: Date): Timestamp;
|
|
24
|
-
/**
|
|
25
|
-
* Create Timestamp from milliseconds
|
|
26
|
-
*/
|
|
27
|
-
static fromMillis(milliseconds: number): Timestamp;
|
|
28
|
-
/**
|
|
29
|
-
* Create Timestamp from Firestore Timestamp
|
|
30
|
-
*/
|
|
31
|
-
static fromFirestoreTimestamp(timestamp: Timestamp$1): Timestamp;
|
|
32
|
-
/**
|
|
33
|
-
* Get current timestamp
|
|
34
|
-
*/
|
|
35
|
-
static now(): Timestamp;
|
|
36
|
-
/**
|
|
37
|
-
* Convert to JavaScript Date
|
|
38
|
-
*/
|
|
39
|
-
toDate(): Date;
|
|
40
|
-
/**
|
|
41
|
-
* Convert to milliseconds
|
|
42
|
-
*/
|
|
43
|
-
toMillis(): number;
|
|
44
|
-
/**
|
|
45
|
-
* Convert to Firestore Timestamp
|
|
46
|
-
*/
|
|
47
|
-
toFirestoreTimestamp(): Timestamp$1;
|
|
48
|
-
/**
|
|
49
|
-
* Convert to ISO string
|
|
50
|
-
*/
|
|
51
|
-
toISOString(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Check if timestamp is in the past
|
|
54
|
-
*/
|
|
55
|
-
isPast(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Check if timestamp is in the future
|
|
58
|
-
*/
|
|
59
|
-
isFuture(): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Get difference in milliseconds with another timestamp
|
|
62
|
-
*/
|
|
63
|
-
diff(other: Timestamp): number;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Server timestamp sentinel for Firestore
|
|
67
|
-
*/
|
|
68
|
-
declare const serverTimestamp: {
|
|
69
|
-
readonly __type__: "serverTimestamp";
|
|
70
|
-
};
|
|
71
|
-
type ServerTimestamp = typeof serverTimestamp;
|
|
72
|
-
/**
|
|
73
|
-
* Timestamp field that can be a Timestamp, server timestamp, or ISO string
|
|
74
|
-
*/
|
|
75
|
-
type TimestampField = Timestamp | ServerTimestamp | string;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Email Value Object
|
|
79
|
-
* @description Immutable email address value object with validation
|
|
80
|
-
*/
|
|
81
|
-
declare class Email {
|
|
82
|
-
private readonly value;
|
|
83
|
-
private readonly validated;
|
|
84
|
-
constructor(email: string);
|
|
85
|
-
/**
|
|
86
|
-
* Validate email format
|
|
87
|
-
*/
|
|
88
|
-
private isValid;
|
|
89
|
-
/**
|
|
90
|
-
* Get email value
|
|
91
|
-
*/
|
|
92
|
-
getValue(): string;
|
|
93
|
-
/**
|
|
94
|
-
* Get local part (before @)
|
|
95
|
-
*/
|
|
96
|
-
getLocalPart(): string;
|
|
97
|
-
/**
|
|
98
|
-
* Get domain part (after @)
|
|
99
|
-
*/
|
|
100
|
-
getDomain(): string;
|
|
101
|
-
/**
|
|
102
|
-
* Check if email is from a specific domain
|
|
103
|
-
*/
|
|
104
|
-
isFromDomain(domain: string): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Check if email is from a corporate domain (not gmail, yahoo, etc.)
|
|
107
|
-
*/
|
|
108
|
-
isCorporate(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Mask email for display (e.g., u***@gmail.com)
|
|
111
|
-
*/
|
|
112
|
-
mask(): string;
|
|
113
|
-
/**
|
|
114
|
-
* Convert to string
|
|
115
|
-
*/
|
|
116
|
-
toString(): string;
|
|
117
|
-
/**
|
|
118
|
-
* Check equality with another email
|
|
119
|
-
*/
|
|
120
|
-
equals(other: Email): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Create Email from string (returns null if invalid)
|
|
123
|
-
*/
|
|
124
|
-
static create(email: string): Email | null;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* UserId Value Object
|
|
129
|
-
* @description Immutable user ID value object with validation
|
|
130
|
-
*/
|
|
131
|
-
declare class UserId {
|
|
132
|
-
private readonly value;
|
|
133
|
-
constructor(id: string);
|
|
134
|
-
/**
|
|
135
|
-
* Validate user ID
|
|
136
|
-
*/
|
|
137
|
-
private validate;
|
|
138
|
-
/**
|
|
139
|
-
* Get user ID value
|
|
140
|
-
*/
|
|
141
|
-
getValue(): string;
|
|
142
|
-
/**
|
|
143
|
-
* Check if this is a temporary ID (not yet persisted)
|
|
144
|
-
*/
|
|
145
|
-
isTemporary(): boolean;
|
|
146
|
-
/**
|
|
147
|
-
* Convert to string
|
|
148
|
-
*/
|
|
149
|
-
toString(): string;
|
|
150
|
-
/**
|
|
151
|
-
* Check equality with another user ID
|
|
152
|
-
*/
|
|
153
|
-
equals(other: UserId): boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Generate a temporary user ID
|
|
156
|
-
*/
|
|
157
|
-
static generateTemp(): UserId;
|
|
158
|
-
/**
|
|
159
|
-
* Create UserId from string (returns null if invalid)
|
|
160
|
-
*/
|
|
161
|
-
static create(id: string): UserId | null;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* FilePath Value Object
|
|
166
|
-
* @description Immutable file path value object with validation for Firebase Storage paths
|
|
167
|
-
*/
|
|
168
|
-
declare class FilePath {
|
|
169
|
-
private readonly value;
|
|
170
|
-
private readonly parts;
|
|
171
|
-
constructor(path: string);
|
|
172
|
-
/**
|
|
173
|
-
* Validate file path
|
|
174
|
-
*/
|
|
175
|
-
private validate;
|
|
176
|
-
/**
|
|
177
|
-
* Get file path value
|
|
178
|
-
*/
|
|
179
|
-
getValue(): string;
|
|
180
|
-
/**
|
|
181
|
-
* Get path parts
|
|
182
|
-
*/
|
|
183
|
-
getParts(): string[];
|
|
184
|
-
/**
|
|
185
|
-
* Get filename (last part of path)
|
|
186
|
-
*/
|
|
187
|
-
getFileName(): string;
|
|
188
|
-
/**
|
|
189
|
-
* Get directory path (all parts except last)
|
|
190
|
-
*/
|
|
191
|
-
getDirectory(): string;
|
|
192
|
-
/**
|
|
193
|
-
* Get file extension
|
|
194
|
-
*/
|
|
195
|
-
getExtension(): string;
|
|
196
|
-
/**
|
|
197
|
-
* Get file name without extension
|
|
198
|
-
*/
|
|
199
|
-
getFileNameWithoutExtension(): string;
|
|
200
|
-
/**
|
|
201
|
-
* Check if path is in a specific directory
|
|
202
|
-
*/
|
|
203
|
-
isInDirectory(directory: string): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* Check if file has a specific extension
|
|
206
|
-
*/
|
|
207
|
-
hasExtension(extension: string): boolean;
|
|
208
|
-
/**
|
|
209
|
-
* Create a new path by appending segments
|
|
210
|
-
*/
|
|
211
|
-
append(...segments: string[]): FilePath;
|
|
212
|
-
/**
|
|
213
|
-
* Create a new path in a parent directory
|
|
214
|
-
*/
|
|
215
|
-
withParent(parent: string): FilePath;
|
|
216
|
-
/**
|
|
217
|
-
* Create a new path with a different filename
|
|
218
|
-
*/
|
|
219
|
-
withFileName(fileName: string): FilePath;
|
|
220
|
-
/**
|
|
221
|
-
* Convert to string
|
|
222
|
-
*/
|
|
223
|
-
toString(): string;
|
|
224
|
-
/**
|
|
225
|
-
* Check equality with another file path
|
|
226
|
-
*/
|
|
227
|
-
equals(other: FilePath): boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Create user path (users/{userId}/...)
|
|
230
|
-
*/
|
|
231
|
-
static userPath(userId: string, ...segments: string[]): FilePath;
|
|
232
|
-
/**
|
|
233
|
-
* Create public path (public/...)
|
|
234
|
-
*/
|
|
235
|
-
static publicPath(...segments: string[]): FilePath;
|
|
236
|
-
/**
|
|
237
|
-
* Create FilePath from string (returns null if invalid)
|
|
238
|
-
*/
|
|
239
|
-
static create(path: string): FilePath | null;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Base Repository Interface
|
|
244
|
-
*/
|
|
245
|
-
interface IBaseRepository<T> {
|
|
246
|
-
getById(id: string, parentPath?: string): Promise<T | null>;
|
|
247
|
-
getAll(constraints?: any[], parentPath?: string): Promise<T[]>;
|
|
248
|
-
create(id: string, data: Omit<T, 'id'>, parentPath?: string): Promise<void>;
|
|
249
|
-
update(id: string, data: Partial<T>, parentPath?: string): Promise<void>;
|
|
250
|
-
delete(id: string, parentPath?: string): Promise<void>;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Domain Errors for Authentication
|
|
255
|
-
* @description Custom error types for authentication-related failures
|
|
256
|
-
*/
|
|
257
|
-
declare class AuthError extends Error {
|
|
258
|
-
code: AuthErrorCode;
|
|
259
|
-
originalError?: unknown | undefined;
|
|
260
|
-
constructor(message: string, code: AuthErrorCode, originalError?: unknown | undefined);
|
|
261
|
-
}
|
|
262
|
-
declare enum AuthErrorCode {
|
|
263
|
-
USER_NOT_FOUND = "USER_NOT_FOUND",
|
|
264
|
-
USER_ALREADY_EXISTS = "USER_ALREADY_EXISTS",
|
|
265
|
-
INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
|
|
266
|
-
WEAK_PASSWORD = "WEAK_PASSWORD",
|
|
267
|
-
EMAIL_NOT_VERIFIED = "EMAIL_NOT_VERIFIED",
|
|
268
|
-
SESSION_EXPIRED = "SESSION_EXPIRED",
|
|
269
|
-
UNAUTHENTICATED = "UNAUTHENTICATED",
|
|
270
|
-
TOO_MANY_REQUESTS = "TOO_MANY_REQUESTS",
|
|
271
|
-
OAUTH_ERROR = "OAUTH_ERROR",
|
|
272
|
-
OAUTH_CANCELLED = "OAUTH_CANCELLED",
|
|
273
|
-
OAUTH_ACCOUNT_EXISTS = "OAUTH_ACCOUNT_EXISTS",
|
|
274
|
-
SIGN_IN_FAILED = "SIGN_IN_FAILED",
|
|
275
|
-
SIGN_UP_FAILED = "SIGN_UP_FAILED",
|
|
276
|
-
SIGN_OUT_FAILED = "SIGN_OUT_FAILED",
|
|
277
|
-
PASSWORD_RESET_FAILED = "PASSWORD_RESET_FAILED",
|
|
278
|
-
EMAIL_VERIFICATION_FAILED = "EMAIL_VERIFICATION_FAILED",
|
|
279
|
-
PROFILE_UPDATE_FAILED = "PROFILE_UPDATE_FAILED",
|
|
280
|
-
EMAIL_UPDATE_FAILED = "EMAIL_UPDATE_FAILED",
|
|
281
|
-
PASSWORD_UPDATE_FAILED = "PASSWORD_UPDATE_FAILED",
|
|
282
|
-
ACCOUNT_DELETE_FAILED = "ACCOUNT_DELETE_FAILED",
|
|
283
|
-
REAUTHENTICATION_REQUIRED = "REAUTHENTICATION_REQUIRED",
|
|
284
|
-
REAUTHENTICATION_FAILED = "REAUTHENTICATION_FAILED",
|
|
285
|
-
UNKNOWN = "UNKNOWN"
|
|
286
|
-
}
|
|
287
|
-
declare function createAuthError(code: AuthErrorCode, message?: string, originalError?: unknown): AuthError;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Domain Errors for Repository Operations
|
|
291
|
-
* @description Custom error types for repository-related failures
|
|
292
|
-
*/
|
|
293
|
-
declare class RepositoryError extends Error {
|
|
294
|
-
code: RepositoryErrorCode;
|
|
295
|
-
originalError?: unknown | undefined;
|
|
296
|
-
constructor(message: string, code: RepositoryErrorCode, originalError?: unknown | undefined);
|
|
297
|
-
}
|
|
298
|
-
declare enum RepositoryErrorCode {
|
|
299
|
-
DOCUMENT_NOT_FOUND = "DOCUMENT_NOT_FOUND",
|
|
300
|
-
DOCUMENT_ALREADY_EXISTS = "DOCUMENT_ALREADY_EXISTS",
|
|
301
|
-
DOCUMENT_INVALID = "DOCUMENT_INVALID",
|
|
302
|
-
COLLECTION_NOT_FOUND = "COLLECTION_NOT_FOUND",
|
|
303
|
-
COLLECTION_INVALID = "COLLECTION_INVALID",
|
|
304
|
-
QUERY_INVALID = "QUERY_INVALID",
|
|
305
|
-
QUERY_FAILED = "QUERY_FAILED",
|
|
306
|
-
TRANSACTION_FAILED = "TRANSACTION_FAILED",
|
|
307
|
-
TRANSACTION_ABORTED = "TRANSACTION_ABORTED",
|
|
308
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
309
|
-
TIMEOUT = "TIMEOUT",
|
|
310
|
-
OFFLINE = "OFFLINE",
|
|
311
|
-
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
312
|
-
UNAUTHORIZED = "UNAUTHORIZED",
|
|
313
|
-
VALIDATION_FAILED = "VALIDATION_FAILED",
|
|
314
|
-
INVALID_DATA = "INVALID_DATA",
|
|
315
|
-
CONFLICT = "CONFLICT",
|
|
316
|
-
VERSION_MISMATCH = "VERSION_MISMATCH",
|
|
317
|
-
STORAGE_ERROR = "STORAGE_ERROR",
|
|
318
|
-
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
319
|
-
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
320
|
-
INVALID_FILE_TYPE = "INVALID_FILE_TYPE",
|
|
321
|
-
UNKNOWN = "UNKNOWN"
|
|
322
|
-
}
|
|
323
|
-
declare function createRepositoryError(code: RepositoryErrorCode, message?: string, originalError?: unknown): RepositoryError;
|
|
324
|
-
|
|
325
|
-
export { AuthError, AuthErrorCode, Email, FilePath, type IBaseRepository, RepositoryError, RepositoryErrorCode, type ServerTimestamp, Timestamp, type TimestampField, UserId, createAuthError, createRepositoryError, serverTimestamp };
|