@experts_hub/shared 1.0.25 → 1.0.26
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/dist/entities/index.d.ts +2 -0
- package/dist/entities/refresh-token.entity.d.ts +12 -0
- package/dist/entities/user.entity.d.ts +14 -0
- package/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +91 -0
- package/dist/index.mjs +92 -0
- package/package.json +4 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RefreshToken } from './refresh-token.entity';
|
|
2
|
+
export declare class User {
|
|
3
|
+
id: string;
|
|
4
|
+
username: string;
|
|
5
|
+
email: string;
|
|
6
|
+
password: string;
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
role: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
refreshTokens: RefreshToken[];
|
|
14
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -14,4 +14,30 @@ declare const UserTCPAdapter: () => MicroserviceOptions;
|
|
|
14
14
|
|
|
15
15
|
declare const UserRMQAdapter: (mode?: string) => MicroserviceOptions;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare class RefreshToken {
|
|
18
|
+
id: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
tokenId: string;
|
|
21
|
+
deviceInfo: any;
|
|
22
|
+
isRevoked: boolean;
|
|
23
|
+
expiresAt: Date;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
user: User;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class User {
|
|
30
|
+
id: string;
|
|
31
|
+
username: string;
|
|
32
|
+
email: string;
|
|
33
|
+
password: string;
|
|
34
|
+
firstName: string;
|
|
35
|
+
lastName: string;
|
|
36
|
+
role: string;
|
|
37
|
+
isActive: boolean;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
refreshTokens: RefreshToken[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { AUTHENTICATION_PATTERN, RefreshToken, User, UserRMQAdapter, UserTCPAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,30 @@ declare const UserTCPAdapter: () => MicroserviceOptions;
|
|
|
14
14
|
|
|
15
15
|
declare const UserRMQAdapter: (mode?: string) => MicroserviceOptions;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
declare class RefreshToken {
|
|
18
|
+
id: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
tokenId: string;
|
|
21
|
+
deviceInfo: any;
|
|
22
|
+
isRevoked: boolean;
|
|
23
|
+
expiresAt: Date;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
user: User;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class User {
|
|
30
|
+
id: string;
|
|
31
|
+
username: string;
|
|
32
|
+
email: string;
|
|
33
|
+
password: string;
|
|
34
|
+
firstName: string;
|
|
35
|
+
lastName: string;
|
|
36
|
+
role: string;
|
|
37
|
+
isActive: boolean;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
refreshTokens: RefreshToken[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { AUTHENTICATION_PATTERN, RefreshToken, User, UserRMQAdapter, UserTCPAdapter };
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
20
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
+
if (decorator = decorators[i])
|
|
22
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
23
|
+
if (kind && result) __defProp(target, key, result);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
18
26
|
|
|
19
27
|
// src/index.ts
|
|
20
28
|
var index_exports = {};
|
|
21
29
|
__export(index_exports, {
|
|
22
30
|
AUTHENTICATION_PATTERN: () => AUTHENTICATION_PATTERN,
|
|
31
|
+
RefreshToken: () => RefreshToken,
|
|
32
|
+
User: () => User,
|
|
23
33
|
UserRMQAdapter: () => UserRMQAdapter,
|
|
24
34
|
UserTCPAdapter: () => UserTCPAdapter
|
|
25
35
|
});
|
|
@@ -107,9 +117,90 @@ var UserRMQAdapter = (mode = "microservice") => {
|
|
|
107
117
|
}
|
|
108
118
|
return config3;
|
|
109
119
|
};
|
|
120
|
+
|
|
121
|
+
// src/entities/user.entity.ts
|
|
122
|
+
var import_typeorm2 = require("typeorm");
|
|
123
|
+
|
|
124
|
+
// src/entities/refresh-token.entity.ts
|
|
125
|
+
var import_typeorm = require("typeorm");
|
|
126
|
+
var RefreshToken = class {
|
|
127
|
+
};
|
|
128
|
+
__decorateClass([
|
|
129
|
+
(0, import_typeorm.PrimaryGeneratedColumn)("uuid")
|
|
130
|
+
], RefreshToken.prototype, "id", 2);
|
|
131
|
+
__decorateClass([
|
|
132
|
+
(0, import_typeorm.Column)({ name: "user_id" })
|
|
133
|
+
], RefreshToken.prototype, "userId", 2);
|
|
134
|
+
__decorateClass([
|
|
135
|
+
(0, import_typeorm.Column)({ name: "token_id" })
|
|
136
|
+
], RefreshToken.prototype, "tokenId", 2);
|
|
137
|
+
__decorateClass([
|
|
138
|
+
(0, import_typeorm.Column)({ name: "device_info", type: "json", nullable: true })
|
|
139
|
+
], RefreshToken.prototype, "deviceInfo", 2);
|
|
140
|
+
__decorateClass([
|
|
141
|
+
(0, import_typeorm.Column)({ name: "is_revoked", default: false })
|
|
142
|
+
], RefreshToken.prototype, "isRevoked", 2);
|
|
143
|
+
__decorateClass([
|
|
144
|
+
(0, import_typeorm.Column)({ name: "expires_at" })
|
|
145
|
+
], RefreshToken.prototype, "expiresAt", 2);
|
|
146
|
+
__decorateClass([
|
|
147
|
+
(0, import_typeorm.CreateDateColumn)({ name: "created_at" })
|
|
148
|
+
], RefreshToken.prototype, "createdAt", 2);
|
|
149
|
+
__decorateClass([
|
|
150
|
+
(0, import_typeorm.UpdateDateColumn)({ name: "updated_at" })
|
|
151
|
+
], RefreshToken.prototype, "updatedAt", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
(0, import_typeorm.ManyToOne)(() => User, (user) => user.refreshTokens),
|
|
154
|
+
(0, import_typeorm.JoinColumn)({ name: "user_id" })
|
|
155
|
+
], RefreshToken.prototype, "user", 2);
|
|
156
|
+
RefreshToken = __decorateClass([
|
|
157
|
+
(0, import_typeorm.Entity)("refresh_tokens")
|
|
158
|
+
], RefreshToken);
|
|
159
|
+
|
|
160
|
+
// src/entities/user.entity.ts
|
|
161
|
+
var User = class {
|
|
162
|
+
};
|
|
163
|
+
__decorateClass([
|
|
164
|
+
(0, import_typeorm2.PrimaryGeneratedColumn)("uuid")
|
|
165
|
+
], User.prototype, "id", 2);
|
|
166
|
+
__decorateClass([
|
|
167
|
+
(0, import_typeorm2.Column)({ unique: true })
|
|
168
|
+
], User.prototype, "username", 2);
|
|
169
|
+
__decorateClass([
|
|
170
|
+
(0, import_typeorm2.Column)({ unique: true })
|
|
171
|
+
], User.prototype, "email", 2);
|
|
172
|
+
__decorateClass([
|
|
173
|
+
(0, import_typeorm2.Column)()
|
|
174
|
+
], User.prototype, "password", 2);
|
|
175
|
+
__decorateClass([
|
|
176
|
+
(0, import_typeorm2.Column)({ name: "first_name", nullable: true })
|
|
177
|
+
], User.prototype, "firstName", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
(0, import_typeorm2.Column)({ name: "last_name", nullable: true })
|
|
180
|
+
], User.prototype, "lastName", 2);
|
|
181
|
+
__decorateClass([
|
|
182
|
+
(0, import_typeorm2.Column)({ default: "user" })
|
|
183
|
+
], User.prototype, "role", 2);
|
|
184
|
+
__decorateClass([
|
|
185
|
+
(0, import_typeorm2.Column)({ name: "is_active", default: true })
|
|
186
|
+
], User.prototype, "isActive", 2);
|
|
187
|
+
__decorateClass([
|
|
188
|
+
(0, import_typeorm2.CreateDateColumn)({ name: "created_at" })
|
|
189
|
+
], User.prototype, "createdAt", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
(0, import_typeorm2.UpdateDateColumn)({ name: "updated_at" })
|
|
192
|
+
], User.prototype, "updatedAt", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
(0, import_typeorm2.OneToMany)(() => RefreshToken, (token) => token.user)
|
|
195
|
+
], User.prototype, "refreshTokens", 2);
|
|
196
|
+
User = __decorateClass([
|
|
197
|
+
(0, import_typeorm2.Entity)("users")
|
|
198
|
+
], User);
|
|
110
199
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
200
|
0 && (module.exports = {
|
|
112
201
|
AUTHENTICATION_PATTERN,
|
|
202
|
+
RefreshToken,
|
|
203
|
+
User,
|
|
113
204
|
UserRMQAdapter,
|
|
114
205
|
UserTCPAdapter
|
|
115
206
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
// src/modules/authentication/pattern/pattern.ts
|
|
2
13
|
var AUTHENTICATION_PATTERN = {
|
|
3
14
|
handleValidateToken: "handle.validate.token",
|
|
@@ -80,8 +91,89 @@ var UserRMQAdapter = (mode = "microservice") => {
|
|
|
80
91
|
}
|
|
81
92
|
return config3;
|
|
82
93
|
};
|
|
94
|
+
|
|
95
|
+
// src/entities/user.entity.ts
|
|
96
|
+
import { Entity as Entity2, PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column2, CreateDateColumn as CreateDateColumn2, UpdateDateColumn as UpdateDateColumn2, OneToMany } from "typeorm";
|
|
97
|
+
|
|
98
|
+
// src/entities/refresh-token.entity.ts
|
|
99
|
+
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, CreateDateColumn, UpdateDateColumn } from "typeorm";
|
|
100
|
+
var RefreshToken = class {
|
|
101
|
+
};
|
|
102
|
+
__decorateClass([
|
|
103
|
+
PrimaryGeneratedColumn("uuid")
|
|
104
|
+
], RefreshToken.prototype, "id", 2);
|
|
105
|
+
__decorateClass([
|
|
106
|
+
Column({ name: "user_id" })
|
|
107
|
+
], RefreshToken.prototype, "userId", 2);
|
|
108
|
+
__decorateClass([
|
|
109
|
+
Column({ name: "token_id" })
|
|
110
|
+
], RefreshToken.prototype, "tokenId", 2);
|
|
111
|
+
__decorateClass([
|
|
112
|
+
Column({ name: "device_info", type: "json", nullable: true })
|
|
113
|
+
], RefreshToken.prototype, "deviceInfo", 2);
|
|
114
|
+
__decorateClass([
|
|
115
|
+
Column({ name: "is_revoked", default: false })
|
|
116
|
+
], RefreshToken.prototype, "isRevoked", 2);
|
|
117
|
+
__decorateClass([
|
|
118
|
+
Column({ name: "expires_at" })
|
|
119
|
+
], RefreshToken.prototype, "expiresAt", 2);
|
|
120
|
+
__decorateClass([
|
|
121
|
+
CreateDateColumn({ name: "created_at" })
|
|
122
|
+
], RefreshToken.prototype, "createdAt", 2);
|
|
123
|
+
__decorateClass([
|
|
124
|
+
UpdateDateColumn({ name: "updated_at" })
|
|
125
|
+
], RefreshToken.prototype, "updatedAt", 2);
|
|
126
|
+
__decorateClass([
|
|
127
|
+
ManyToOne(() => User, (user) => user.refreshTokens),
|
|
128
|
+
JoinColumn({ name: "user_id" })
|
|
129
|
+
], RefreshToken.prototype, "user", 2);
|
|
130
|
+
RefreshToken = __decorateClass([
|
|
131
|
+
Entity("refresh_tokens")
|
|
132
|
+
], RefreshToken);
|
|
133
|
+
|
|
134
|
+
// src/entities/user.entity.ts
|
|
135
|
+
var User = class {
|
|
136
|
+
};
|
|
137
|
+
__decorateClass([
|
|
138
|
+
PrimaryGeneratedColumn2("uuid")
|
|
139
|
+
], User.prototype, "id", 2);
|
|
140
|
+
__decorateClass([
|
|
141
|
+
Column2({ unique: true })
|
|
142
|
+
], User.prototype, "username", 2);
|
|
143
|
+
__decorateClass([
|
|
144
|
+
Column2({ unique: true })
|
|
145
|
+
], User.prototype, "email", 2);
|
|
146
|
+
__decorateClass([
|
|
147
|
+
Column2()
|
|
148
|
+
], User.prototype, "password", 2);
|
|
149
|
+
__decorateClass([
|
|
150
|
+
Column2({ name: "first_name", nullable: true })
|
|
151
|
+
], User.prototype, "firstName", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
Column2({ name: "last_name", nullable: true })
|
|
154
|
+
], User.prototype, "lastName", 2);
|
|
155
|
+
__decorateClass([
|
|
156
|
+
Column2({ default: "user" })
|
|
157
|
+
], User.prototype, "role", 2);
|
|
158
|
+
__decorateClass([
|
|
159
|
+
Column2({ name: "is_active", default: true })
|
|
160
|
+
], User.prototype, "isActive", 2);
|
|
161
|
+
__decorateClass([
|
|
162
|
+
CreateDateColumn2({ name: "created_at" })
|
|
163
|
+
], User.prototype, "createdAt", 2);
|
|
164
|
+
__decorateClass([
|
|
165
|
+
UpdateDateColumn2({ name: "updated_at" })
|
|
166
|
+
], User.prototype, "updatedAt", 2);
|
|
167
|
+
__decorateClass([
|
|
168
|
+
OneToMany(() => RefreshToken, (token) => token.user)
|
|
169
|
+
], User.prototype, "refreshTokens", 2);
|
|
170
|
+
User = __decorateClass([
|
|
171
|
+
Entity2("users")
|
|
172
|
+
], User);
|
|
83
173
|
export {
|
|
84
174
|
AUTHENTICATION_PATTERN,
|
|
175
|
+
RefreshToken,
|
|
176
|
+
User,
|
|
85
177
|
UserRMQAdapter,
|
|
86
178
|
UserTCPAdapter
|
|
87
179
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experts_hub/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "Shared DTOs, interfaces, and utilities for experts hub applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@nestjs/microservices": "^11.0.19",
|
|
53
53
|
"@nestjs/swagger": "^11.1.2",
|
|
54
|
-
"
|
|
54
|
+
"@nestjs/typeorm": "^11.0.0",
|
|
55
|
+
"dotenv": "^16.5.0",
|
|
56
|
+
"typeorm": "^0.3.22"
|
|
55
57
|
}
|
|
56
58
|
}
|