@umituz/web-firebase 1.0.5 → 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.
- package/README.md +555 -0
- package/dist/application/index.d.mts +273 -0
- package/dist/application/index.d.ts +273 -0
- package/dist/application/index.js +490 -0
- package/dist/application/index.mjs +19 -0
- package/dist/chunk-34DL2QWQ.mjs +87 -0
- package/dist/chunk-4FP2ELQ5.mjs +96 -0
- package/dist/chunk-7TX3OU3O.mjs +721 -0
- package/dist/chunk-I6WGBPFB.mjs +439 -0
- package/dist/chunk-RZ4QR6TB.mjs +96 -0
- package/dist/chunk-U2XI4MGO.mjs +397 -0
- package/dist/domain/index.d.mts +325 -0
- package/dist/domain/index.d.ts +325 -0
- package/dist/domain/index.js +662 -0
- package/dist/domain/index.mjs +36 -0
- package/dist/file.repository.interface-v5vHgVsZ.d.mts +241 -0
- package/dist/file.repository.interface-v5vHgVsZ.d.ts +241 -0
- package/dist/firebase.entity-xvfEPjXZ.d.mts +15 -0
- package/dist/firebase.entity-xvfEPjXZ.d.ts +15 -0
- package/dist/index.d.mts +14 -96
- package/dist/index.d.ts +14 -96
- package/dist/index.js +1717 -78
- package/dist/index.mjs +88 -175
- package/dist/infrastructure/index.d.mts +170 -0
- package/dist/infrastructure/index.d.ts +170 -0
- package/dist/infrastructure/index.js +856 -0
- package/dist/infrastructure/index.mjs +46 -0
- package/dist/presentation/index.d.mts +25 -0
- package/dist/presentation/index.d.ts +25 -0
- package/dist/presentation/index.js +105 -0
- package/dist/presentation/index.mjs +6 -0
- package/dist/user.repository.interface-DS74TsJ5.d.mts +298 -0
- package/dist/user.repository.interface-DS74TsJ5.d.ts +298 -0
- package/package.json +37 -11
- package/src/application/dto/auth.dto.ts +69 -0
- package/src/application/dto/index.ts +7 -0
- package/src/application/dto/user.dto.ts +64 -0
- package/src/application/index.ts +7 -0
- package/src/application/use-cases/auth/reset-password.use-case.ts +66 -0
- package/src/application/use-cases/auth/sign-in-with-google.use-case.ts +86 -0
- package/src/application/use-cases/auth/sign-in.use-case.ts +77 -0
- package/src/application/use-cases/auth/sign-out.use-case.ts +22 -0
- package/src/application/use-cases/auth/sign-up.use-case.ts +99 -0
- package/src/application/use-cases/index.ts +12 -0
- package/src/application/use-cases/user/delete-account.use-case.ts +77 -0
- package/src/application/use-cases/user/update-profile.use-case.ts +98 -0
- package/src/domain/entities/file.entity.ts +151 -0
- package/src/domain/entities/timestamp.entity.ts +116 -0
- package/src/domain/entities/user.entity.ts +193 -0
- package/src/domain/errors/auth.errors.ts +115 -0
- package/src/domain/errors/repository.errors.ts +121 -0
- package/src/domain/index.ts +25 -2
- package/src/domain/interfaces/auth.repository.interface.ts +83 -0
- package/src/domain/interfaces/file.repository.interface.ts +143 -0
- package/src/domain/interfaces/user.repository.interface.ts +75 -0
- package/src/domain/value-objects/email.vo.ts +105 -0
- package/src/domain/value-objects/file-path.vo.ts +184 -0
- package/src/domain/value-objects/user-id.vo.ts +87 -0
- package/src/index.ts +19 -4
- package/src/infrastructure/firebase/auth.adapter.ts +220 -0
- package/src/infrastructure/firebase/client.ts +141 -0
- package/src/infrastructure/firebase/firestore.adapter.ts +190 -0
- package/src/infrastructure/firebase/storage.adapter.ts +323 -0
- package/src/infrastructure/index.ts +10 -5
- package/src/infrastructure/utils/storage.util.ts +3 -3
- package/src/presentation/hooks/useAuth.ts +153 -0
- package/src/presentation/hooks/useFirestore.ts +125 -0
- package/src/presentation/hooks/useStorage.ts +141 -0
- package/src/presentation/providers/FirebaseProvider.tsx +40 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Domain Entities
|
|
3
|
+
* @description File and storage-related entities
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* File Metadata Entity
|
|
7
|
+
* Contains metadata about uploaded files
|
|
8
|
+
*/
|
|
9
|
+
interface FileMetadata {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly fullPath: string;
|
|
13
|
+
readonly contentType: string;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly createdAt: number;
|
|
16
|
+
readonly updatedAt: number;
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
readonly type: FileType;
|
|
19
|
+
category?: FileCategory;
|
|
20
|
+
description?: string;
|
|
21
|
+
tags?: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* File Types
|
|
25
|
+
*/
|
|
26
|
+
type FileType = 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
27
|
+
/**
|
|
28
|
+
* File Categories
|
|
29
|
+
*/
|
|
30
|
+
type FileCategory = 'profile' | 'content' | 'document' | 'attachment' | 'backup';
|
|
31
|
+
/**
|
|
32
|
+
* Upload Progress Entity
|
|
33
|
+
* Tracks upload progress for resumable uploads
|
|
34
|
+
*/
|
|
35
|
+
interface UploadProgress {
|
|
36
|
+
bytesTransferred: number;
|
|
37
|
+
totalBytes: number;
|
|
38
|
+
progress: number;
|
|
39
|
+
state: UploadState;
|
|
40
|
+
speed?: number;
|
|
41
|
+
remaining?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Upload States
|
|
45
|
+
*/
|
|
46
|
+
type UploadState = 'paused' | 'running' | 'success' | 'canceled' | 'error';
|
|
47
|
+
/**
|
|
48
|
+
* File Upload Result Entity
|
|
49
|
+
* Result of a file upload operation
|
|
50
|
+
*/
|
|
51
|
+
interface FileUploadResult {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly fullPath: string;
|
|
55
|
+
readonly downloadURL: string;
|
|
56
|
+
readonly contentType: string;
|
|
57
|
+
readonly size: number;
|
|
58
|
+
readonly createdAt: number;
|
|
59
|
+
}
|
|
60
|
+
type UploadResult = FileUploadResult;
|
|
61
|
+
/**
|
|
62
|
+
* Upload Options
|
|
63
|
+
* Configuration for file uploads
|
|
64
|
+
*/
|
|
65
|
+
interface UploadOptions {
|
|
66
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
67
|
+
metadata?: FileMetadata;
|
|
68
|
+
customMetadata?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* File Validation Options
|
|
72
|
+
*/
|
|
73
|
+
interface FileValidationOptions {
|
|
74
|
+
maxSizeBytes?: number;
|
|
75
|
+
maxSizeMB?: number;
|
|
76
|
+
allowedTypes?: string[];
|
|
77
|
+
allowedExtensions?: string[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Validation Result
|
|
81
|
+
*/
|
|
82
|
+
interface ValidationResult {
|
|
83
|
+
valid: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
errorCode?: FileErrorCode;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* File Error Codes
|
|
89
|
+
*/
|
|
90
|
+
declare enum FileErrorCode {
|
|
91
|
+
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
92
|
+
INVALID_TYPE = "INVALID_TYPE",
|
|
93
|
+
INVALID_EXTENSION = "INVALID_EXTENSION",
|
|
94
|
+
UPLOAD_FAILED = "UPLOAD_FAILED",
|
|
95
|
+
DOWNLOAD_FAILED = "DOWNLOAD_FAILED",
|
|
96
|
+
DELETE_FAILED = "DELETE_FAILED",
|
|
97
|
+
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
98
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
99
|
+
CANCELLED = "CANCELLED"
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* File Filters
|
|
103
|
+
*/
|
|
104
|
+
interface FileFilters {
|
|
105
|
+
type?: FileType;
|
|
106
|
+
category?: FileCategory;
|
|
107
|
+
startDate?: number;
|
|
108
|
+
endDate?: number;
|
|
109
|
+
minSize?: number;
|
|
110
|
+
maxSize?: number;
|
|
111
|
+
tags?: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* File Query Result
|
|
115
|
+
*/
|
|
116
|
+
interface FileQueryResult {
|
|
117
|
+
files: FileMetadata[];
|
|
118
|
+
totalCount: number;
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
lastDocId?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Storage Statistics
|
|
124
|
+
*/
|
|
125
|
+
interface StorageStats {
|
|
126
|
+
totalFiles: number;
|
|
127
|
+
totalSize: number;
|
|
128
|
+
filesByType: Record<FileType, number>;
|
|
129
|
+
filesByCategory: Record<FileCategory, number>;
|
|
130
|
+
lastUploadAt?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* File Repository Interface
|
|
135
|
+
* @description Defines contract for file storage operations
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* File Repository Interface
|
|
140
|
+
* Defines operations for file storage and management
|
|
141
|
+
*/
|
|
142
|
+
interface IFileRepository {
|
|
143
|
+
/**
|
|
144
|
+
* Upload file to storage
|
|
145
|
+
*/
|
|
146
|
+
uploadFile(userId: string, path: string, file: File | Blob, options?: UploadOptions): Promise<UploadResult>;
|
|
147
|
+
/**
|
|
148
|
+
* Upload image with automatic categorization
|
|
149
|
+
*/
|
|
150
|
+
uploadImage(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Upload video with automatic categorization
|
|
153
|
+
*/
|
|
154
|
+
uploadVideo(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Upload document with automatic categorization
|
|
157
|
+
*/
|
|
158
|
+
uploadDocument(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Upload profile picture
|
|
161
|
+
*/
|
|
162
|
+
uploadProfilePicture(userId: string, file: File): Promise<UploadResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Get download URL for a file
|
|
165
|
+
*/
|
|
166
|
+
getDownloadURL(path: string): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Delete file by path
|
|
169
|
+
*/
|
|
170
|
+
deleteFile(path: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete all user files
|
|
173
|
+
*/
|
|
174
|
+
deleteUserFiles(userId: string): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Delete user image
|
|
177
|
+
*/
|
|
178
|
+
deleteImage(userId: string, filename: string): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Delete user video
|
|
181
|
+
*/
|
|
182
|
+
deleteVideo(userId: string, filename: string): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Delete profile picture
|
|
185
|
+
*/
|
|
186
|
+
deleteProfilePicture(userId: string, filename: string): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* List user files
|
|
189
|
+
*/
|
|
190
|
+
listUserFiles(userId: string, path?: string): Promise<string[]>;
|
|
191
|
+
/**
|
|
192
|
+
* List user images
|
|
193
|
+
*/
|
|
194
|
+
listUserImages(userId: string): Promise<string[]>;
|
|
195
|
+
/**
|
|
196
|
+
* List user videos
|
|
197
|
+
*/
|
|
198
|
+
listUserVideos(userId: string): Promise<string[]>;
|
|
199
|
+
/**
|
|
200
|
+
* Get file metadata
|
|
201
|
+
*/
|
|
202
|
+
getFileMetadata(path: string): Promise<FileMetadata>;
|
|
203
|
+
/**
|
|
204
|
+
* Query files with filters
|
|
205
|
+
*/
|
|
206
|
+
queryFiles(userId: string, filters?: FileFilters): Promise<FileQueryResult>;
|
|
207
|
+
/**
|
|
208
|
+
* Get storage statistics
|
|
209
|
+
*/
|
|
210
|
+
getStorageStats(userId: string): Promise<StorageStats>;
|
|
211
|
+
/**
|
|
212
|
+
* Validate file before upload
|
|
213
|
+
*/
|
|
214
|
+
validateFile(file: File, options?: {
|
|
215
|
+
maxSizeBytes?: number;
|
|
216
|
+
maxSizeMB?: number;
|
|
217
|
+
allowedTypes?: string[];
|
|
218
|
+
}): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Check if file is an image
|
|
221
|
+
*/
|
|
222
|
+
isImageFile(file: File): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Check if file is a video
|
|
225
|
+
*/
|
|
226
|
+
isVideoFile(file: File): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Check if file is a document
|
|
229
|
+
*/
|
|
230
|
+
isDocumentFile(file: File): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Generate unique filename
|
|
233
|
+
*/
|
|
234
|
+
generateUniqueFilename(originalName: string): string;
|
|
235
|
+
/**
|
|
236
|
+
* Get file extension
|
|
237
|
+
*/
|
|
238
|
+
getFileExtension(filename: string): string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { type FileCategory as F, type IFileRepository as I, type StorageStats as S, type UploadOptions as U, type ValidationResult as V, FileErrorCode as a, type FileFilters as b, type FileMetadata as c, type FileQueryResult as d, type FileType as e, type FileUploadResult as f, type FileValidationOptions as g, type UploadProgress as h, type UploadResult as i, type UploadState as j };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Domain Entities
|
|
3
|
+
* @description File and storage-related entities
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* File Metadata Entity
|
|
7
|
+
* Contains metadata about uploaded files
|
|
8
|
+
*/
|
|
9
|
+
interface FileMetadata {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly fullPath: string;
|
|
13
|
+
readonly contentType: string;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly createdAt: number;
|
|
16
|
+
readonly updatedAt: number;
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
readonly type: FileType;
|
|
19
|
+
category?: FileCategory;
|
|
20
|
+
description?: string;
|
|
21
|
+
tags?: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* File Types
|
|
25
|
+
*/
|
|
26
|
+
type FileType = 'image' | 'video' | 'audio' | 'document' | 'other';
|
|
27
|
+
/**
|
|
28
|
+
* File Categories
|
|
29
|
+
*/
|
|
30
|
+
type FileCategory = 'profile' | 'content' | 'document' | 'attachment' | 'backup';
|
|
31
|
+
/**
|
|
32
|
+
* Upload Progress Entity
|
|
33
|
+
* Tracks upload progress for resumable uploads
|
|
34
|
+
*/
|
|
35
|
+
interface UploadProgress {
|
|
36
|
+
bytesTransferred: number;
|
|
37
|
+
totalBytes: number;
|
|
38
|
+
progress: number;
|
|
39
|
+
state: UploadState;
|
|
40
|
+
speed?: number;
|
|
41
|
+
remaining?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Upload States
|
|
45
|
+
*/
|
|
46
|
+
type UploadState = 'paused' | 'running' | 'success' | 'canceled' | 'error';
|
|
47
|
+
/**
|
|
48
|
+
* File Upload Result Entity
|
|
49
|
+
* Result of a file upload operation
|
|
50
|
+
*/
|
|
51
|
+
interface FileUploadResult {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly fullPath: string;
|
|
55
|
+
readonly downloadURL: string;
|
|
56
|
+
readonly contentType: string;
|
|
57
|
+
readonly size: number;
|
|
58
|
+
readonly createdAt: number;
|
|
59
|
+
}
|
|
60
|
+
type UploadResult = FileUploadResult;
|
|
61
|
+
/**
|
|
62
|
+
* Upload Options
|
|
63
|
+
* Configuration for file uploads
|
|
64
|
+
*/
|
|
65
|
+
interface UploadOptions {
|
|
66
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
67
|
+
metadata?: FileMetadata;
|
|
68
|
+
customMetadata?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* File Validation Options
|
|
72
|
+
*/
|
|
73
|
+
interface FileValidationOptions {
|
|
74
|
+
maxSizeBytes?: number;
|
|
75
|
+
maxSizeMB?: number;
|
|
76
|
+
allowedTypes?: string[];
|
|
77
|
+
allowedExtensions?: string[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Validation Result
|
|
81
|
+
*/
|
|
82
|
+
interface ValidationResult {
|
|
83
|
+
valid: boolean;
|
|
84
|
+
error?: string;
|
|
85
|
+
errorCode?: FileErrorCode;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* File Error Codes
|
|
89
|
+
*/
|
|
90
|
+
declare enum FileErrorCode {
|
|
91
|
+
FILE_TOO_LARGE = "FILE_TOO_LARGE",
|
|
92
|
+
INVALID_TYPE = "INVALID_TYPE",
|
|
93
|
+
INVALID_EXTENSION = "INVALID_EXTENSION",
|
|
94
|
+
UPLOAD_FAILED = "UPLOAD_FAILED",
|
|
95
|
+
DOWNLOAD_FAILED = "DOWNLOAD_FAILED",
|
|
96
|
+
DELETE_FAILED = "DELETE_FAILED",
|
|
97
|
+
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
98
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
99
|
+
CANCELLED = "CANCELLED"
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* File Filters
|
|
103
|
+
*/
|
|
104
|
+
interface FileFilters {
|
|
105
|
+
type?: FileType;
|
|
106
|
+
category?: FileCategory;
|
|
107
|
+
startDate?: number;
|
|
108
|
+
endDate?: number;
|
|
109
|
+
minSize?: number;
|
|
110
|
+
maxSize?: number;
|
|
111
|
+
tags?: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* File Query Result
|
|
115
|
+
*/
|
|
116
|
+
interface FileQueryResult {
|
|
117
|
+
files: FileMetadata[];
|
|
118
|
+
totalCount: number;
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
lastDocId?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Storage Statistics
|
|
124
|
+
*/
|
|
125
|
+
interface StorageStats {
|
|
126
|
+
totalFiles: number;
|
|
127
|
+
totalSize: number;
|
|
128
|
+
filesByType: Record<FileType, number>;
|
|
129
|
+
filesByCategory: Record<FileCategory, number>;
|
|
130
|
+
lastUploadAt?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* File Repository Interface
|
|
135
|
+
* @description Defines contract for file storage operations
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* File Repository Interface
|
|
140
|
+
* Defines operations for file storage and management
|
|
141
|
+
*/
|
|
142
|
+
interface IFileRepository {
|
|
143
|
+
/**
|
|
144
|
+
* Upload file to storage
|
|
145
|
+
*/
|
|
146
|
+
uploadFile(userId: string, path: string, file: File | Blob, options?: UploadOptions): Promise<UploadResult>;
|
|
147
|
+
/**
|
|
148
|
+
* Upload image with automatic categorization
|
|
149
|
+
*/
|
|
150
|
+
uploadImage(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Upload video with automatic categorization
|
|
153
|
+
*/
|
|
154
|
+
uploadVideo(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Upload document with automatic categorization
|
|
157
|
+
*/
|
|
158
|
+
uploadDocument(userId: string, file: File, filename?: string): Promise<UploadResult>;
|
|
159
|
+
/**
|
|
160
|
+
* Upload profile picture
|
|
161
|
+
*/
|
|
162
|
+
uploadProfilePicture(userId: string, file: File): Promise<UploadResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Get download URL for a file
|
|
165
|
+
*/
|
|
166
|
+
getDownloadURL(path: string): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Delete file by path
|
|
169
|
+
*/
|
|
170
|
+
deleteFile(path: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete all user files
|
|
173
|
+
*/
|
|
174
|
+
deleteUserFiles(userId: string): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Delete user image
|
|
177
|
+
*/
|
|
178
|
+
deleteImage(userId: string, filename: string): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Delete user video
|
|
181
|
+
*/
|
|
182
|
+
deleteVideo(userId: string, filename: string): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Delete profile picture
|
|
185
|
+
*/
|
|
186
|
+
deleteProfilePicture(userId: string, filename: string): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* List user files
|
|
189
|
+
*/
|
|
190
|
+
listUserFiles(userId: string, path?: string): Promise<string[]>;
|
|
191
|
+
/**
|
|
192
|
+
* List user images
|
|
193
|
+
*/
|
|
194
|
+
listUserImages(userId: string): Promise<string[]>;
|
|
195
|
+
/**
|
|
196
|
+
* List user videos
|
|
197
|
+
*/
|
|
198
|
+
listUserVideos(userId: string): Promise<string[]>;
|
|
199
|
+
/**
|
|
200
|
+
* Get file metadata
|
|
201
|
+
*/
|
|
202
|
+
getFileMetadata(path: string): Promise<FileMetadata>;
|
|
203
|
+
/**
|
|
204
|
+
* Query files with filters
|
|
205
|
+
*/
|
|
206
|
+
queryFiles(userId: string, filters?: FileFilters): Promise<FileQueryResult>;
|
|
207
|
+
/**
|
|
208
|
+
* Get storage statistics
|
|
209
|
+
*/
|
|
210
|
+
getStorageStats(userId: string): Promise<StorageStats>;
|
|
211
|
+
/**
|
|
212
|
+
* Validate file before upload
|
|
213
|
+
*/
|
|
214
|
+
validateFile(file: File, options?: {
|
|
215
|
+
maxSizeBytes?: number;
|
|
216
|
+
maxSizeMB?: number;
|
|
217
|
+
allowedTypes?: string[];
|
|
218
|
+
}): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Check if file is an image
|
|
221
|
+
*/
|
|
222
|
+
isImageFile(file: File): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Check if file is a video
|
|
225
|
+
*/
|
|
226
|
+
isVideoFile(file: File): boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Check if file is a document
|
|
229
|
+
*/
|
|
230
|
+
isDocumentFile(file: File): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Generate unique filename
|
|
233
|
+
*/
|
|
234
|
+
generateUniqueFilename(originalName: string): string;
|
|
235
|
+
/**
|
|
236
|
+
* Get file extension
|
|
237
|
+
*/
|
|
238
|
+
getFileExtension(filename: string): string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { type FileCategory as F, type IFileRepository as I, type StorageStats as S, type UploadOptions as U, type ValidationResult as V, FileErrorCode as a, type FileFilters as b, type FileMetadata as c, type FileQueryResult as d, type FileType as e, type FileUploadResult as f, type FileValidationOptions as g, type UploadProgress as h, type UploadResult as i, type UploadState as j };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Entity Types
|
|
3
|
+
*/
|
|
4
|
+
type FirebaseTimestamp = {
|
|
5
|
+
toDate(): Date;
|
|
6
|
+
} | Date;
|
|
7
|
+
interface FirebaseUser {
|
|
8
|
+
uid: string;
|
|
9
|
+
email: string | null;
|
|
10
|
+
displayName: string | null;
|
|
11
|
+
photoURL: string | null;
|
|
12
|
+
emailVerified: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { FirebaseTimestamp as F, FirebaseUser as a };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Entity Types
|
|
3
|
+
*/
|
|
4
|
+
type FirebaseTimestamp = {
|
|
5
|
+
toDate(): Date;
|
|
6
|
+
} | Date;
|
|
7
|
+
interface FirebaseUser {
|
|
8
|
+
uid: string;
|
|
9
|
+
email: string | null;
|
|
10
|
+
displayName: string | null;
|
|
11
|
+
photoURL: string | null;
|
|
12
|
+
emailVerified: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { FirebaseTimestamp as F, FirebaseUser as a };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,96 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
uid: string;
|
|
16
|
-
email: string | null;
|
|
17
|
-
displayName: string | null;
|
|
18
|
-
photoURL: string | null;
|
|
19
|
-
emailVerified: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Base Repository Interface
|
|
24
|
-
*/
|
|
25
|
-
interface IBaseRepository<T> {
|
|
26
|
-
getById(id: string, parentPath?: string): Promise<T | null>;
|
|
27
|
-
getAll(constraints?: any[], parentPath?: string): Promise<T[]>;
|
|
28
|
-
create(id: string, data: Omit<T, 'id'>, parentPath?: string): Promise<void>;
|
|
29
|
-
update(id: string, data: Partial<T>, parentPath?: string): Promise<void>;
|
|
30
|
-
delete(id: string, parentPath?: string): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Firebase Service Infrastructure
|
|
35
|
-
* @description Initialization and instance management for Firebase
|
|
36
|
-
*/
|
|
37
|
-
interface FirebaseInstances {
|
|
38
|
-
app: FirebaseApp;
|
|
39
|
-
auth: Auth;
|
|
40
|
-
db: Firestore;
|
|
41
|
-
storage: FirebaseStorage;
|
|
42
|
-
functions: Functions;
|
|
43
|
-
}
|
|
44
|
-
declare function initializeFirebase(config: FirebaseOptions, appName?: string): FirebaseInstances;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Firestore Repository Implementation
|
|
48
|
-
* @description Generic CRUD operations for Firestore collections
|
|
49
|
-
*/
|
|
50
|
-
declare class FirestoreRepository<T extends DocumentData> implements IBaseRepository<T> {
|
|
51
|
-
protected db: Firestore;
|
|
52
|
-
protected collectionName: string;
|
|
53
|
-
constructor(db: Firestore, collectionName: string);
|
|
54
|
-
protected getCollection(parentPath?: string): CollectionReference<T>;
|
|
55
|
-
protected getDocRef(id: string, parentPath?: string): _firebase_firestore.DocumentReference<DocumentData, DocumentData>;
|
|
56
|
-
getById(id: string, parentPath?: string): Promise<T | null>;
|
|
57
|
-
getAll(constraints?: QueryConstraint[], parentPath?: string): Promise<T[]>;
|
|
58
|
-
create(id: string, data: Omit<T, 'id'>, parentPath?: string): Promise<void>;
|
|
59
|
-
update(id: string, data: Partial<T>, parentPath?: string): Promise<void>;
|
|
60
|
-
delete(id: string, parentPath?: string): Promise<void>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Firebase Storage Utils
|
|
65
|
-
* @description Upload and delete helpers for Firebase Storage
|
|
66
|
-
*/
|
|
67
|
-
interface UploadResult {
|
|
68
|
-
url: string;
|
|
69
|
-
path: string;
|
|
70
|
-
}
|
|
71
|
-
declare function uploadFile(storage: FirebaseStorage, path: string, file: File | Blob): Promise<UploadResult>;
|
|
72
|
-
declare function uploadBase64(storage: FirebaseStorage, path: string, base64: string, mimeType?: string): Promise<UploadResult>;
|
|
73
|
-
declare function deleteFile(storage: FirebaseStorage, path: string): Promise<void>;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* useFirebaseAuth Hook
|
|
77
|
-
* @description Hook to manage Firebase authentication state and operations
|
|
78
|
-
*/
|
|
79
|
-
interface UseFirebaseAuthOptions {
|
|
80
|
-
onUserChange?: (user: FirebaseUser | null) => void;
|
|
81
|
-
}
|
|
82
|
-
interface UseFirebaseAuthReturn {
|
|
83
|
-
user: FirebaseUser | null;
|
|
84
|
-
loading: boolean;
|
|
85
|
-
isAuthenticated: boolean;
|
|
86
|
-
signIn(email: string, password: string): Promise<UserCredential>;
|
|
87
|
-
signUp(email: string, password: string, name?: string): Promise<UserCredential>;
|
|
88
|
-
signOut(): Promise<void>;
|
|
89
|
-
updateUserProfile(name: string, photoURL?: string): Promise<void>;
|
|
90
|
-
updateUserPassword(newPassword: string): Promise<void>;
|
|
91
|
-
resetPassword(email: string): Promise<void>;
|
|
92
|
-
getIdToken(): Promise<string>;
|
|
93
|
-
}
|
|
94
|
-
declare function useFirebaseAuth(auth: Auth, options?: UseFirebaseAuthOptions): UseFirebaseAuthReturn;
|
|
95
|
-
|
|
96
|
-
export { type FirebaseInstances, type FirebaseTimestamp, type FirebaseUser, FirestoreRepository, type IBaseRepository, type UploadResult, type UseFirebaseAuthOptions, type UseFirebaseAuthReturn, deleteFile, initializeFirebase, uploadBase64, uploadFile, useFirebaseAuth };
|
|
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
|
+
export { AuthError, AuthErrorCode, Email, FilePath, IBaseRepository, RepositoryError, RepositoryErrorCode, ServerTimestamp, Timestamp, TimestampField, UserId, createAuthError, createRepositoryError, serverTimestamp } from './domain/index.mjs';
|
|
5
|
+
export { CreateUserDTO, DeleteAccountDTO, DeleteAccountUseCase, ResetPasswordDTO, ResetPasswordUseCase, SignInDTO, SignInUseCase, SignInWithGoogleUseCase, SignOutUseCase, SignUpDTO, SignUpResult, SignUpUseCase, UpdateEmailDTO, UpdatePasswordDTO, UpdateProfileDTO, UpdateProfileUseCase, UpdateUserDTO, UpdateUserSettingsDTO, UpdateUserSubscriptionDTO, UserQueryResult } from './application/index.mjs';
|
|
6
|
+
export { AuthAdapter, FirebaseInstances, FirestoreAdapter, StorageAdapter, StorageUploadResult, analytics, app, auth, db, deleteFile, functions, getFirebaseAnalytics, getFirebaseApp, getFirebaseAuth, getFirebaseDB, getFirebaseFunctions, getFirebaseInstances, getFirebaseStorage, initializeFirebase, storage, uploadBase64, uploadFile } from './infrastructure/index.mjs';
|
|
7
|
+
export { UseFirebaseAuthOptions, UseFirebaseAuthReturn, useFirebaseAuth } from './presentation/index.mjs';
|
|
8
|
+
import 'firebase/auth';
|
|
9
|
+
import 'firebase/firestore';
|
|
10
|
+
import 'firebase/app';
|
|
11
|
+
import 'firebase/storage';
|
|
12
|
+
import 'firebase/analytics';
|
|
13
|
+
import 'firebase/functions';
|
|
14
|
+
import '@firebase/util';
|