@umituz/web-firebase 3.0.0 → 3.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/package.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Authentication Repository Interface
|
|
3
|
-
* @description
|
|
3
|
+
* @description Generic contract for authentication operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { User as FirebaseUser
|
|
7
|
-
import type { User } from '../entities/user.entity'
|
|
6
|
+
import type { UserCredential, User as FirebaseUser } from 'firebase/auth'
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* Authentication Repository Interface
|
|
11
|
-
* Defines operations for user authentication and management
|
|
12
|
-
*/
|
|
13
8
|
export interface IAuthRepository {
|
|
14
9
|
/**
|
|
15
10
|
* Sign in with email and password
|
|
@@ -44,7 +39,7 @@ export interface IAuthRepository {
|
|
|
44
39
|
/**
|
|
45
40
|
* Update user profile (displayName, photoURL)
|
|
46
41
|
*/
|
|
47
|
-
updateProfile(updates:
|
|
42
|
+
updateProfile(updates: { displayName?: string; photoURL?: string }): Promise<void>
|
|
48
43
|
|
|
49
44
|
/**
|
|
50
45
|
* Update user email (requires password)
|
|
@@ -69,15 +64,5 @@ export interface IAuthRepository {
|
|
|
69
64
|
/**
|
|
70
65
|
* Subscribe to auth state changes
|
|
71
66
|
*/
|
|
72
|
-
onAuthStateChanged(callback: (user: FirebaseUser | null) => void): () => void
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Create user document in Firestore
|
|
76
|
-
*/
|
|
77
|
-
createUserDocument(userId: string, data: Partial<Omit<User, 'profile'>> & { email: string; displayName: string }): Promise<void>
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Update last login timestamp
|
|
81
|
-
*/
|
|
82
|
-
updateLastLogin(userId: string): Promise<void>
|
|
67
|
+
onAuthStateChanged(callback: (user: FirebaseUser | null) => void, onError?: (error: Error) => void): () => void
|
|
83
68
|
}
|
|
@@ -1,51 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* File Repository Interface
|
|
3
|
-
* @description
|
|
3
|
+
* @description Generic contract for file storage operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
FileMetadata,
|
|
8
|
-
UploadResult,
|
|
9
|
-
UploadOptions,
|
|
10
|
-
FileFilters,
|
|
11
|
-
FileQueryResult,
|
|
12
|
-
StorageStats,
|
|
13
|
-
} from '../entities/file.entity'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* File Repository Interface
|
|
17
|
-
* Defines operations for file storage and management
|
|
18
|
-
*/
|
|
19
6
|
export interface IFileRepository {
|
|
20
7
|
/**
|
|
21
8
|
* Upload file to storage
|
|
22
9
|
*/
|
|
23
|
-
uploadFile(
|
|
24
|
-
userId: string,
|
|
25
|
-
path: string,
|
|
26
|
-
file: File | Blob,
|
|
27
|
-
options?: UploadOptions
|
|
28
|
-
): Promise<UploadResult>
|
|
10
|
+
uploadFile(userId: string, path: string, file: File | Blob, options?: any): Promise<any>
|
|
29
11
|
|
|
30
12
|
/**
|
|
31
13
|
* Upload image with automatic categorization
|
|
32
14
|
*/
|
|
33
|
-
uploadImage(userId: string, file: File, filename?: string): Promise<
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Upload video with automatic categorization
|
|
37
|
-
*/
|
|
38
|
-
uploadVideo(userId: string, file: File, filename?: string): Promise<UploadResult>
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Upload document with automatic categorization
|
|
42
|
-
*/
|
|
43
|
-
uploadDocument(userId: string, file: File, filename?: string): Promise<UploadResult>
|
|
15
|
+
uploadImage(userId: string, file: File, filename?: string): Promise<any>
|
|
44
16
|
|
|
45
17
|
/**
|
|
46
18
|
* Upload profile picture
|
|
47
19
|
*/
|
|
48
|
-
uploadProfilePicture(userId: string, file: File): Promise<
|
|
20
|
+
uploadProfilePicture(userId: string, file: File): Promise<any>
|
|
49
21
|
|
|
50
22
|
/**
|
|
51
23
|
* Get download URL for a file
|
|
@@ -62,82 +34,13 @@ export interface IFileRepository {
|
|
|
62
34
|
*/
|
|
63
35
|
deleteUserFiles(userId: string): Promise<void>
|
|
64
36
|
|
|
65
|
-
/**
|
|
66
|
-
* Delete user image
|
|
67
|
-
*/
|
|
68
|
-
deleteImage(userId: string, filename: string): Promise<void>
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Delete user video
|
|
72
|
-
*/
|
|
73
|
-
deleteVideo(userId: string, filename: string): Promise<void>
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Delete profile picture
|
|
77
|
-
*/
|
|
78
|
-
deleteProfilePicture(userId: string, filename: string): Promise<void>
|
|
79
|
-
|
|
80
37
|
/**
|
|
81
38
|
* List user files
|
|
82
39
|
*/
|
|
83
40
|
listUserFiles(userId: string, path?: string): Promise<string[]>
|
|
84
41
|
|
|
85
|
-
/**
|
|
86
|
-
* List user images
|
|
87
|
-
*/
|
|
88
|
-
listUserImages(userId: string): Promise<string[]>
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* List user videos
|
|
92
|
-
*/
|
|
93
|
-
listUserVideos(userId: string): Promise<string[]>
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Get file metadata
|
|
97
|
-
*/
|
|
98
|
-
getFileMetadata(path: string): Promise<FileMetadata>
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Query files with filters
|
|
102
|
-
*/
|
|
103
|
-
queryFiles(userId: string, filters?: FileFilters): Promise<FileQueryResult>
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Get storage statistics
|
|
107
|
-
*/
|
|
108
|
-
getStorageStats(userId: string): Promise<StorageStats>
|
|
109
|
-
|
|
110
42
|
/**
|
|
111
43
|
* Validate file before upload
|
|
112
44
|
*/
|
|
113
|
-
validateFile(file: File, options?:
|
|
114
|
-
maxSizeBytes?: number
|
|
115
|
-
maxSizeMB?: number
|
|
116
|
-
allowedTypes?: string[]
|
|
117
|
-
}): boolean
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Check if file is an image
|
|
121
|
-
*/
|
|
122
|
-
isImageFile(file: File): boolean
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Check if file is a video
|
|
126
|
-
*/
|
|
127
|
-
isVideoFile(file: File): boolean
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Check if file is a document
|
|
131
|
-
*/
|
|
132
|
-
isDocumentFile(file: File): boolean
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Generate unique filename
|
|
136
|
-
*/
|
|
137
|
-
generateUniqueFilename(originalName: string): string
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get file extension
|
|
141
|
-
*/
|
|
142
|
-
getFileExtension(filename: string): string
|
|
45
|
+
validateFile(file: File, options?: any): boolean
|
|
143
46
|
}
|
|
@@ -1,75 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* User Repository Interface
|
|
3
|
-
* @description
|
|
3
|
+
* @description Generic contract for user data operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { User } from '../entities/user.entity'
|
|
7
6
|
import type { QueryConstraint } from 'firebase/firestore'
|
|
8
7
|
|
|
9
|
-
/**
|
|
10
|
-
* User Repository Interface
|
|
11
|
-
* Defines operations for user data management
|
|
12
|
-
*/
|
|
13
8
|
export interface IUserRepository {
|
|
14
9
|
/**
|
|
15
|
-
* Get
|
|
16
|
-
*/
|
|
17
|
-
getUser(userId: string): Promise<User | null>
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get user by email
|
|
21
|
-
*/
|
|
22
|
-
getUserByEmail(email: string): Promise<User | null>
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Create user
|
|
26
|
-
*/
|
|
27
|
-
createUser(userId: string, data: Partial<User>): Promise<void>
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Update user
|
|
10
|
+
* Get document by ID
|
|
31
11
|
*/
|
|
32
|
-
|
|
12
|
+
getById<T>(userId: string): Promise<T | null>
|
|
33
13
|
|
|
34
14
|
/**
|
|
35
|
-
*
|
|
15
|
+
* Get document by field
|
|
36
16
|
*/
|
|
37
|
-
|
|
17
|
+
getByField<T>(collectionPath: string, field: string, value: any): Promise<T | null>
|
|
38
18
|
|
|
39
19
|
/**
|
|
40
|
-
*
|
|
20
|
+
* Create document
|
|
41
21
|
*/
|
|
42
|
-
|
|
22
|
+
create(userId: string, data: any): Promise<void>
|
|
43
23
|
|
|
44
24
|
/**
|
|
45
|
-
* Update
|
|
25
|
+
* Update document
|
|
46
26
|
*/
|
|
47
|
-
|
|
27
|
+
update(userId: string, data: any, options?: { merge?: boolean }): Promise<void>
|
|
48
28
|
|
|
49
29
|
/**
|
|
50
|
-
*
|
|
30
|
+
* Delete document
|
|
51
31
|
*/
|
|
52
|
-
|
|
53
|
-
userId: string,
|
|
54
|
-
subscription: Partial<User['subscription']>
|
|
55
|
-
): Promise<void>
|
|
32
|
+
delete(userId: string): Promise<void>
|
|
56
33
|
|
|
57
34
|
/**
|
|
58
|
-
*
|
|
35
|
+
* Query collection with constraints
|
|
59
36
|
*/
|
|
60
|
-
|
|
37
|
+
query<T>(collectionPath: string, constraints: QueryConstraint[]): Promise<T[]>
|
|
61
38
|
|
|
62
39
|
/**
|
|
63
|
-
*
|
|
40
|
+
* Subscribe to document changes
|
|
64
41
|
*/
|
|
65
|
-
|
|
42
|
+
subscribeToDoc<T>(docPath: string, callback: (data: T | null) => void): () => void
|
|
66
43
|
|
|
67
44
|
/**
|
|
68
|
-
* Subscribe to
|
|
45
|
+
* Subscribe to collection changes
|
|
69
46
|
*/
|
|
70
|
-
|
|
71
|
-
userId: string,
|
|
72
|
-
callback: (user: User | null) => void,
|
|
73
|
-
onError?: (error: Error) => void
|
|
74
|
-
): () => void
|
|
47
|
+
subscribeToCollection<T>(collectionPath: string, callback: (data: T[]) => void, constraints?: QueryConstraint[]): () => void
|
|
75
48
|
}
|