@tc-libs/user 0.41.0 → 0.43.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
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tc-libs/user",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
|
-
"@tc-libs/authentication": "0.
|
|
7
|
-
"@tc-libs/service": "0.
|
|
8
|
-
"@tc-libs/database": "0.
|
|
6
|
+
"@tc-libs/authentication": "0.43.0",
|
|
7
|
+
"@tc-libs/service": "0.43.0",
|
|
8
|
+
"@tc-libs/database": "0.43.0",
|
|
9
9
|
"@nestjs/common": "^10.0.2"
|
|
10
10
|
},
|
|
11
11
|
"type": "commonjs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ENUM_AUTH_ACCESS_FOR } from '@tc-libs/authentication';
|
|
2
2
|
import { IUserGetSerialization } from './user.get.serialization.interface';
|
|
3
|
-
export interface IUserPayloadSerialization extends Omit<IUserGetSerialization, 'Role' | 'role' | 'confirmation' | '
|
|
3
|
+
export interface IUserPayloadSerialization extends Omit<IUserGetSerialization, 'Role' | 'role' | 'confirmation' | 'flags' | 'agreements' | 'notifications' | 'authProvidersts' | 'authProviders' | 'createdAt' | 'updatedAt'> {
|
|
4
4
|
rememberMe: boolean;
|
|
5
5
|
accessFor: ENUM_AUTH_ACCESS_FOR;
|
|
6
6
|
}
|
|
@@ -11,45 +11,116 @@ export declare enum AUTH_PROVIDERS {
|
|
|
11
11
|
MI = "microsoft",
|
|
12
12
|
PP = "paypal"
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface representing the acceptance of a flag.
|
|
16
|
+
*
|
|
17
|
+
* @interface IFlagAcceptance
|
|
18
|
+
*
|
|
19
|
+
* @property {boolean} enabled - Indicates whether the flag is enabled.
|
|
20
|
+
* @property {Date} ts - The timestamp when the flag was accepted.
|
|
21
|
+
* @property {string} version - The version of the flag acceptance.
|
|
22
|
+
*/
|
|
14
23
|
export interface IFlagAcceptance {
|
|
15
24
|
enabled: boolean;
|
|
16
25
|
ts: Date;
|
|
17
26
|
version: string;
|
|
18
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Interface representing user notifications settings.
|
|
30
|
+
* @property {IFlagAcceptance} newsletter - User's acceptance of newsletter.
|
|
31
|
+
*/
|
|
19
32
|
export interface IUserNotifications {
|
|
20
33
|
newsletter: IFlagAcceptance;
|
|
21
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Interface representing user agreements.
|
|
37
|
+
*
|
|
38
|
+
* @interface IUserAgreements
|
|
39
|
+
*
|
|
40
|
+
* @property {IFlagAcceptance} terms - User's acceptance of the terms and conditions.
|
|
41
|
+
* @property {IFlagAcceptance} privacy - User's acceptance of the privacy policy.
|
|
42
|
+
* @property {IFlagAcceptance} commercial - User's acceptance of commercial communications.
|
|
43
|
+
*/
|
|
22
44
|
export interface IUserAgreements {
|
|
23
45
|
terms: IFlagAcceptance;
|
|
24
46
|
privacy: IFlagAcceptance;
|
|
25
47
|
commercial: IFlagAcceptance;
|
|
26
48
|
}
|
|
27
49
|
export interface IUserBirthday {
|
|
28
|
-
day
|
|
29
|
-
month
|
|
30
|
-
year
|
|
31
|
-
date
|
|
50
|
+
day?: number;
|
|
51
|
+
month?: number;
|
|
52
|
+
year?: number;
|
|
53
|
+
date?: Date;
|
|
32
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Interface representing the structure of user reset password details.
|
|
57
|
+
*
|
|
58
|
+
* @interface IUserResetPassword
|
|
59
|
+
*
|
|
60
|
+
* @property {string} [code] - The reset password code.
|
|
61
|
+
* @property {string} [tmpPassword] - The temporary password assigned to the user.
|
|
62
|
+
* @property {Date} [ts] - The timestamp when the reset password was requested.
|
|
63
|
+
*/
|
|
33
64
|
export interface IUserResetPassword {
|
|
34
|
-
code
|
|
35
|
-
tmpPassword
|
|
36
|
-
ts
|
|
65
|
+
code?: string;
|
|
66
|
+
tmpPassword?: string;
|
|
67
|
+
ts?: Date;
|
|
37
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Interface representing the history of user passwords.
|
|
71
|
+
*
|
|
72
|
+
* @interface IUserPasswordHistory
|
|
73
|
+
*
|
|
74
|
+
* @property {string} password - The user's previous password.
|
|
75
|
+
* @property {Date} ts - The timestamp when the password was changed.
|
|
76
|
+
*/
|
|
38
77
|
export interface IUserPasswordHistory {
|
|
39
78
|
password: string;
|
|
40
79
|
ts: Date;
|
|
41
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Interface representing the structure of user email confirmation details.
|
|
83
|
+
* @interface IUserEmailConfirmation
|
|
84
|
+
* @property {string} [code] - The confirmation code.
|
|
85
|
+
* @property {Date} [ts] - The timestamp of the confirmation code.
|
|
86
|
+
*/
|
|
42
87
|
export interface IUserEmailConfirmation {
|
|
43
88
|
code?: string;
|
|
44
89
|
ts?: Date;
|
|
45
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Interface representing user login information.
|
|
93
|
+
*
|
|
94
|
+
* @interface IUserLoginInfo
|
|
95
|
+
*
|
|
96
|
+
* @property {number} attempt - The number of unsuccessful login attempts made by the user.
|
|
97
|
+
* @property {number} count - The count of successful logins.
|
|
98
|
+
* @property {string} [ip] - The IP address from which the user attempted to log in.
|
|
99
|
+
* @property {string} [ua] - The user agent string of the browser or device used for login.
|
|
100
|
+
* @property {Date} [lastLogin] - The date and time of the last successful login.
|
|
101
|
+
*/
|
|
46
102
|
export interface IUserLoginInfo {
|
|
47
103
|
attempt: number;
|
|
48
104
|
count: number;
|
|
49
|
-
ip
|
|
50
|
-
ua
|
|
51
|
-
lastLogin
|
|
105
|
+
ip?: string;
|
|
106
|
+
ua?: string;
|
|
107
|
+
lastLogin?: Date;
|
|
52
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Interface representing a user's social media information.
|
|
111
|
+
*
|
|
112
|
+
* @interface IUserSocialInfo
|
|
113
|
+
*
|
|
114
|
+
* @property {string} facebookId - The user's Facebook ID.
|
|
115
|
+
* @property {string} twitterId - The user's Twitter ID.
|
|
116
|
+
* @property {string} githubId - The user's GitHub ID.
|
|
117
|
+
* @property {string} linkedinId - The user's LinkedIn ID.
|
|
118
|
+
* @property {string} amazonId - The user's Amazon ID.
|
|
119
|
+
* @property {string} googleId - The user's Google ID.
|
|
120
|
+
* @property {string} bitbucketId - The user's Bitbucket ID.
|
|
121
|
+
* @property {string} microsoftId - The user's Microsoft ID.
|
|
122
|
+
* @property {string} paypalId - The user's PayPal ID.
|
|
123
|
+
*/
|
|
53
124
|
export interface IUserSocialInfo {
|
|
54
125
|
facebookId: string;
|
|
55
126
|
twitterId: string;
|
|
@@ -61,6 +132,46 @@ export interface IUserSocialInfo {
|
|
|
61
132
|
microsoftId: string;
|
|
62
133
|
paypalId: string;
|
|
63
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Interface representing the flags associated with a user.
|
|
137
|
+
*
|
|
138
|
+
* @property {boolean} confirmed - Indicates if the user has confirmed their account by the email.
|
|
139
|
+
* @property {boolean} [iddqd] - Optional flag for a special status (e.g., god mode).
|
|
140
|
+
* @property {boolean} blocked - Indicates if the user is blocked by admin.
|
|
141
|
+
* @property {Date} [blockedDate] - Optional date when the user was blocked.
|
|
142
|
+
* @property {boolean} active - Indicates if the user is inactivated by itself.
|
|
143
|
+
* @property {Date} [inactiveDate] - Optional date when the user became inactivated by itself.
|
|
144
|
+
*/
|
|
145
|
+
export interface IUserFlags {
|
|
146
|
+
confirmed: boolean;
|
|
147
|
+
iddqd?: boolean;
|
|
148
|
+
blocked: boolean;
|
|
149
|
+
blockedDate?: Date;
|
|
150
|
+
active: boolean;
|
|
151
|
+
inactiveDate?: Date;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Interface representing the base structure of a user entity.
|
|
155
|
+
*
|
|
156
|
+
* @extends IDatabaseMongoBaseEntityAbstract
|
|
157
|
+
*
|
|
158
|
+
* @property {string} email - The email address of the user.
|
|
159
|
+
* @property {string} password - The password of the user.
|
|
160
|
+
* @property {string} role - The role assigned to the user.
|
|
161
|
+
* @property {string} [firstName] - The first name of the user.
|
|
162
|
+
* @property {string} [lastName] - The last name of the user.
|
|
163
|
+
* @property {string} [lang] - The preferred language of the user.
|
|
164
|
+
* @property {IUserFlags} flags - The flags associated with the user.
|
|
165
|
+
* @property {IUserResetPassword} [resetPassword] - Information related to password reset.
|
|
166
|
+
* @property {IUserEmailConfirmation} confirmation - Information related to email confirmation.
|
|
167
|
+
* @property {IUserPasswordHistory[]} [passwordHistory] - History of the user's passwords.
|
|
168
|
+
* @property {IUserLoginInfo} [login] - Information related to user login attempts.
|
|
169
|
+
* @property {IUserSocialInfo} [social] - Information related to user's social media accounts.
|
|
170
|
+
* @property {IUserAgreements} agreements - User's acceptance of various agreements.
|
|
171
|
+
* @property {IUserNotifications} notifications - User's notification preferences.
|
|
172
|
+
* @property {IUserBirthday} [birthday] - User's birthday information.
|
|
173
|
+
* @property {string[]} authProviders - List of authentication providers associated with the user.
|
|
174
|
+
*/
|
|
64
175
|
export interface IBaseUser extends IDatabaseMongoBaseEntityAbstract {
|
|
65
176
|
email: string;
|
|
66
177
|
password: string;
|
|
@@ -68,12 +179,7 @@ export interface IBaseUser extends IDatabaseMongoBaseEntityAbstract {
|
|
|
68
179
|
firstName?: string;
|
|
69
180
|
lastName?: string;
|
|
70
181
|
lang?: string;
|
|
71
|
-
|
|
72
|
-
confirmed: boolean;
|
|
73
|
-
blocked: boolean;
|
|
74
|
-
blockedDate?: Date;
|
|
75
|
-
active: boolean;
|
|
76
|
-
inactiveDate?: Date;
|
|
182
|
+
flags: IUserFlags;
|
|
77
183
|
resetPassword?: IUserResetPassword;
|
|
78
184
|
confirmation: IUserEmailConfirmation;
|
|
79
185
|
passwordHistory?: IUserPasswordHistory[];
|