@fdm-monster/server 1.7.2 → 1.7.3
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/.yarn/install-state.gz +0 -0
- package/README.md +2 -1
- package/RELEASE_NOTES.MD +9 -1
- package/dist/controllers/user.controller.js +187 -52
- package/dist/controllers/user.controller.js.map +1 -1
- package/dist/server.constants.js +1 -1
- package/dist/services/orm/base.service.js +3 -0
- package/dist/services/orm/base.service.js.map +1 -1
- package/package.json +4 -4
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Please join the discord, but stay professional and proactive!
|
|
|
76
76
|
These are the people involved in the project. Find the meaning of the emoji keys [here](https://allcontributors.org/docs/en/emoji-key).
|
|
77
77
|
|
|
78
78
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
79
|
-
[](#contributors-)
|
|
80
80
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
81
81
|
|
|
82
82
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
@@ -106,6 +106,7 @@ These are the people involved in the project. Find the meaning of the emoji keys
|
|
|
106
106
|
<td align="center" valign="top" width="14.28%"><a href="https://techinterview.guide"><img src="https://avatars.githubusercontent.com/u/168030?v=4?s=80" width="80px;" alt="w. ian douglas"/><br /><sub><b>w. ian douglas</b></sub></a><br /><a href="#ideas-iandouglas" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
107
107
|
<td align="center" valign="top" width="14.28%"><a href="http://insanityautomation.com/"><img src="https://avatars.githubusercontent.com/u/38436470?v=4?s=80" width="80px;" alt="InsanityAutomation"/><br /><sub><b>InsanityAutomation</b></sub></a><br /><a href="#ideas-InsanityAutomation" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3AInsanityAutomation" title="Bug reports">🐛</a></td>
|
|
108
108
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LyfeOnEdge"><img src="https://avatars.githubusercontent.com/u/26140376?v=4?s=80" width="80px;" alt="Andrew (LyfeOnEdge) (ArcticGentoo)"/><br /><sub><b>Andrew (LyfeOnEdge) (ArcticGentoo)</b></sub></a><br /><a href="#ideas-LyfeOnEdge" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
109
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/callanova"><img src="https://avatars.githubusercontent.com/u/175639705?v=4?s=80" width="80px;" alt="callanova"/><br /><sub><b>callanova</b></sub></a><br /><a href="https://github.com/fdm-monster/fdm-monster/issues?q=author%3Acallanova" title="Bug reports">🐛</a></td>
|
|
109
110
|
</tr>
|
|
110
111
|
</tbody>
|
|
111
112
|
</table>
|
package/RELEASE_NOTES.MD
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
# Develop
|
|
2
2
|
|
|
3
|
+
# FDM Monster 11/11/2024 1.7.3
|
|
4
|
+
|
|
5
|
+
## Fixes:
|
|
6
|
+
|
|
7
|
+
- BaseService: catch null or undefined id before querying database
|
|
8
|
+
- Add set user roles API to avoid users staying in limbo with GUEST role after verification.
|
|
9
|
+
- User API apply consistent string number coercion in user API to avoid unexpected ID comparison
|
|
10
|
+
|
|
3
11
|
# FDM Monster 11/11/2024 1.7.2
|
|
4
12
|
|
|
5
13
|
## Fixes:
|
|
6
14
|
|
|
7
15
|
- API & Service validators: adjust max length of apiKey property validation to 43 to allow new `secrets` based OctoPrint api keys
|
|
8
|
-
|
|
16
|
+
|
|
9
17
|
# FDM Monster 04/11/2024 1.7.1
|
|
10
18
|
|
|
11
19
|
## Changes:
|
|
@@ -2,21 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
UserController: function() {
|
|
5
|
+
Object.defineProperty(exports, "UserController", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
13
8
|
return UserController;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
9
|
}
|
|
18
10
|
});
|
|
19
|
-
const
|
|
11
|
+
const _express = require("express");
|
|
20
12
|
const _serverconstants = require("../server.constants");
|
|
21
13
|
const _authenticate = require("../middleware/authenticate");
|
|
22
14
|
const _authorizationconstants = require("../constants/authorization.constants");
|
|
@@ -25,6 +17,16 @@ const _genericvalidation = require("./validation/generic.validation");
|
|
|
25
17
|
const _runtimeexceptions = require("../exceptions/runtime.exceptions");
|
|
26
18
|
const _demomiddleware = require("../middleware/demo.middleware");
|
|
27
19
|
const _errorutils = require("../utils/error.utils");
|
|
20
|
+
const _awilixexpress = require("awilix-express");
|
|
21
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
22
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
24
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
25
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
26
|
+
}
|
|
27
|
+
function _ts_metadata(k, v) {
|
|
28
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
29
|
+
}
|
|
28
30
|
class UserController {
|
|
29
31
|
userService;
|
|
30
32
|
roleService;
|
|
@@ -42,6 +44,14 @@ class UserController {
|
|
|
42
44
|
this.isTypeormMode = isTypeormMode;
|
|
43
45
|
this.logger = loggerFactory(UserController.name);
|
|
44
46
|
}
|
|
47
|
+
async list(req, res) {
|
|
48
|
+
const users = await this.userService.listUsers();
|
|
49
|
+
res.send(users.map((u)=>this.userService.toDto(u)));
|
|
50
|
+
}
|
|
51
|
+
async listRoles(req, res) {
|
|
52
|
+
const roleDtos = this.roleService.roles.map((r)=>this.roleService.toDto(r));
|
|
53
|
+
res.send(roleDtos);
|
|
54
|
+
}
|
|
45
55
|
async profile(req, res) {
|
|
46
56
|
if (!req.user?.id) {
|
|
47
57
|
res.send({});
|
|
@@ -50,21 +60,16 @@ class UserController {
|
|
|
50
60
|
const user = await this.userService.getUser(req.user?.id);
|
|
51
61
|
res.send(this.userService.toDto(user));
|
|
52
62
|
}
|
|
53
|
-
async
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
async listRoles(req, res) {
|
|
58
|
-
const roleDtos = this.roleService.roles.map((r)=>this.roleService.toDto(r));
|
|
59
|
-
res.send(roleDtos);
|
|
63
|
+
async get(req, res) {
|
|
64
|
+
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
65
|
+
const user = await this.userService.getUser(id);
|
|
66
|
+
res.send(this.userService.toDto(user));
|
|
60
67
|
}
|
|
61
68
|
async delete(req, res) {
|
|
62
69
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
63
70
|
const ownUserId = req.user?.id;
|
|
64
|
-
if (ownUserId) {
|
|
65
|
-
|
|
66
|
-
throw new _runtimeexceptions.ForbiddenError("Not allowed to delete own account");
|
|
67
|
-
}
|
|
71
|
+
if (ownUserId == id) {
|
|
72
|
+
throw new _runtimeexceptions.ForbiddenError("Not allowed to delete own account");
|
|
68
73
|
}
|
|
69
74
|
const isRootUser = await this.userService.isUserRootUser(id);
|
|
70
75
|
if (isRootUser) {
|
|
@@ -84,14 +89,9 @@ class UserController {
|
|
|
84
89
|
}
|
|
85
90
|
res.send();
|
|
86
91
|
}
|
|
87
|
-
async get(req, res) {
|
|
88
|
-
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
89
|
-
const user = await this.userService.getUser(id);
|
|
90
|
-
res.send(this.userService.toDto(user));
|
|
91
|
-
}
|
|
92
92
|
async changeUsername(req, res) {
|
|
93
93
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
94
|
-
if (req.user?.id
|
|
94
|
+
if (req.user?.id != id && await this.settingsStore.getLoginRequired()) {
|
|
95
95
|
throw new _runtimeexceptions.ForbiddenError("Not allowed to change username of other users");
|
|
96
96
|
}
|
|
97
97
|
const { username } = await (0, _validators.validateInput)(req.body, {
|
|
@@ -102,7 +102,7 @@ class UserController {
|
|
|
102
102
|
}
|
|
103
103
|
async changePassword(req, res) {
|
|
104
104
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
105
|
-
if (req.user?.id
|
|
105
|
+
if (req.user?.id != id && await this.settingsStore.getLoginRequired()) {
|
|
106
106
|
throw new _runtimeexceptions.ForbiddenError("Not allowed to change password of other users");
|
|
107
107
|
}
|
|
108
108
|
const { oldPassword, newPassword } = await (0, _validators.validateInput)(req.body, {
|
|
@@ -112,13 +112,34 @@ class UserController {
|
|
|
112
112
|
await this.userService.updatePasswordById(id, oldPassword, newPassword);
|
|
113
113
|
res.send();
|
|
114
114
|
}
|
|
115
|
+
async setUserRoles(req, res) {
|
|
116
|
+
const { id: currentUserId } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
117
|
+
const ownUserId = req.user?.id;
|
|
118
|
+
const ownUser = await this.userService.getUser(ownUserId);
|
|
119
|
+
const ownUserRoles = ownUser.roles;
|
|
120
|
+
const adminRole = await this.roleService.getSynchronizedRoleByName(_authorizationconstants.ROLES.ADMIN);
|
|
121
|
+
if (ownUserId == currentUserId && !ownUserRoles.includes(adminRole.id) && !ownUser.isRootUser) {
|
|
122
|
+
throw new _runtimeexceptions.ForbiddenError("Only an ADMIN or OWNER user is allowed to change its own roles");
|
|
123
|
+
}
|
|
124
|
+
const { roleIds } = await (0, _validators.validateInput)(req.body, {
|
|
125
|
+
roleIds: "array",
|
|
126
|
+
"roleIds.*": "alphaNumeric"
|
|
127
|
+
});
|
|
128
|
+
if (ownUserId == currentUserId && !roleIds.includes(adminRole.id)) {
|
|
129
|
+
if (ownUser.isRootUser) {
|
|
130
|
+
throw new _runtimeexceptions.BadRequestException("It does not make sense to remove ADMIN role from an OWNER user.");
|
|
131
|
+
} else {
|
|
132
|
+
throw new _runtimeexceptions.BadRequestException("An ADMIN user cannot remove its ADMIN role.");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
await this.userService.setUserRoleIds(currentUserId, roleIds);
|
|
136
|
+
res.send();
|
|
137
|
+
}
|
|
115
138
|
async setVerified(req, res) {
|
|
116
139
|
const { id } = await (0, _validators.validateInput)(req.params, (0, _genericvalidation.idRulesV2)(this.isTypeormMode));
|
|
117
140
|
const ownUserId = req.user?.id;
|
|
118
|
-
if (ownUserId) {
|
|
119
|
-
|
|
120
|
-
throw new _runtimeexceptions.ForbiddenError("Not allowed to change own verified status");
|
|
121
|
-
}
|
|
141
|
+
if (ownUserId == id) {
|
|
142
|
+
throw new _runtimeexceptions.ForbiddenError("Not allowed to change own verified status");
|
|
122
143
|
}
|
|
123
144
|
const isRootUser = await this.userService.isUserRootUser(id);
|
|
124
145
|
if (isRootUser) {
|
|
@@ -152,38 +173,152 @@ class UserController {
|
|
|
152
173
|
}
|
|
153
174
|
}
|
|
154
175
|
}
|
|
155
|
-
|
|
156
|
-
(0,
|
|
157
|
-
|
|
158
|
-
before
|
|
176
|
+
_ts_decorate([
|
|
177
|
+
(0, _awilixexpress.GET)(),
|
|
178
|
+
(0, _awilixexpress.route)("/"),
|
|
179
|
+
(0, _awilixexpress.before)([
|
|
159
180
|
(0, _authenticate.authorizeRoles)([
|
|
160
181
|
_authorizationconstants.ROLES.ADMIN
|
|
161
182
|
])
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
]),
|
|
184
|
+
_ts_metadata("design:type", Function),
|
|
185
|
+
_ts_metadata("design:paramtypes", [
|
|
186
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
187
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
188
|
+
]),
|
|
189
|
+
_ts_metadata("design:returntype", Promise)
|
|
190
|
+
], UserController.prototype, "list", null);
|
|
191
|
+
_ts_decorate([
|
|
192
|
+
(0, _awilixexpress.GET)(),
|
|
193
|
+
(0, _awilixexpress.route)("/roles"),
|
|
194
|
+
_ts_metadata("design:type", Function),
|
|
195
|
+
_ts_metadata("design:paramtypes", [
|
|
196
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
197
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
198
|
+
]),
|
|
199
|
+
_ts_metadata("design:returntype", Promise)
|
|
200
|
+
], UserController.prototype, "listRoles", null);
|
|
201
|
+
_ts_decorate([
|
|
202
|
+
(0, _awilixexpress.GET)(),
|
|
203
|
+
(0, _awilixexpress.route)("/profile"),
|
|
204
|
+
_ts_metadata("design:type", Function),
|
|
205
|
+
_ts_metadata("design:paramtypes", [
|
|
206
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
207
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
208
|
+
]),
|
|
209
|
+
_ts_metadata("design:returntype", Promise)
|
|
210
|
+
], UserController.prototype, "profile", null);
|
|
211
|
+
_ts_decorate([
|
|
212
|
+
(0, _awilixexpress.GET)(),
|
|
213
|
+
(0, _awilixexpress.route)("/:id"),
|
|
214
|
+
(0, _awilixexpress.before)([
|
|
165
215
|
(0, _authenticate.authorizeRoles)([
|
|
166
216
|
_authorizationconstants.ROLES.ADMIN
|
|
167
217
|
])
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
|
|
218
|
+
]),
|
|
219
|
+
_ts_metadata("design:type", Function),
|
|
220
|
+
_ts_metadata("design:paramtypes", [
|
|
221
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
222
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
223
|
+
]),
|
|
224
|
+
_ts_metadata("design:returntype", Promise)
|
|
225
|
+
], UserController.prototype, "get", null);
|
|
226
|
+
_ts_decorate([
|
|
227
|
+
(0, _awilixexpress.DELETE)(),
|
|
228
|
+
(0, _awilixexpress.route)("/:id"),
|
|
229
|
+
(0, _awilixexpress.before)([
|
|
171
230
|
(0, _authenticate.authorizeRoles)([
|
|
172
231
|
_authorizationconstants.ROLES.ADMIN
|
|
173
232
|
]),
|
|
174
233
|
_demomiddleware.demoUserNotAllowed
|
|
175
|
-
]
|
|
176
|
-
|
|
177
|
-
|
|
234
|
+
]),
|
|
235
|
+
_ts_metadata("design:type", Function),
|
|
236
|
+
_ts_metadata("design:paramtypes", [
|
|
237
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
238
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
239
|
+
]),
|
|
240
|
+
_ts_metadata("design:returntype", Promise)
|
|
241
|
+
], UserController.prototype, "delete", null);
|
|
242
|
+
_ts_decorate([
|
|
243
|
+
(0, _awilixexpress.POST)(),
|
|
244
|
+
(0, _awilixexpress.route)("/:id/change-username"),
|
|
245
|
+
(0, _awilixexpress.before)([
|
|
246
|
+
_demomiddleware.demoUserNotAllowed
|
|
247
|
+
]),
|
|
248
|
+
_ts_metadata("design:type", Function),
|
|
249
|
+
_ts_metadata("design:paramtypes", [
|
|
250
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
251
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
252
|
+
]),
|
|
253
|
+
_ts_metadata("design:returntype", Promise)
|
|
254
|
+
], UserController.prototype, "changeUsername", null);
|
|
255
|
+
_ts_decorate([
|
|
256
|
+
(0, _awilixexpress.POST)(),
|
|
257
|
+
(0, _awilixexpress.route)("/:id/change-password"),
|
|
258
|
+
(0, _awilixexpress.before)([
|
|
178
259
|
_demomiddleware.demoUserNotAllowed
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
|
|
260
|
+
]),
|
|
261
|
+
_ts_metadata("design:type", Function),
|
|
262
|
+
_ts_metadata("design:paramtypes", [
|
|
263
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
264
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
265
|
+
]),
|
|
266
|
+
_ts_metadata("design:returntype", Promise)
|
|
267
|
+
], UserController.prototype, "changePassword", null);
|
|
268
|
+
_ts_decorate([
|
|
269
|
+
(0, _awilixexpress.POST)(),
|
|
270
|
+
(0, _awilixexpress.route)("/:id/set-user-roles"),
|
|
271
|
+
(0, _awilixexpress.before)([
|
|
182
272
|
(0, _authenticate.authorizeRoles)([
|
|
183
273
|
_authorizationconstants.ROLES.ADMIN
|
|
184
274
|
]),
|
|
185
275
|
_demomiddleware.demoUserNotAllowed
|
|
186
|
-
]
|
|
187
|
-
|
|
276
|
+
]),
|
|
277
|
+
_ts_metadata("design:type", Function),
|
|
278
|
+
_ts_metadata("design:paramtypes", [
|
|
279
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
280
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
281
|
+
]),
|
|
282
|
+
_ts_metadata("design:returntype", Promise)
|
|
283
|
+
], UserController.prototype, "setUserRoles", null);
|
|
284
|
+
_ts_decorate([
|
|
285
|
+
(0, _awilixexpress.POST)(),
|
|
286
|
+
(0, _awilixexpress.route)("/:id/set-verified"),
|
|
287
|
+
(0, _awilixexpress.before)([
|
|
288
|
+
(0, _authenticate.authorizeRoles)([
|
|
289
|
+
_authorizationconstants.ROLES.ADMIN
|
|
290
|
+
]),
|
|
291
|
+
_demomiddleware.demoUserNotAllowed
|
|
292
|
+
]),
|
|
293
|
+
_ts_metadata("design:type", Function),
|
|
294
|
+
_ts_metadata("design:paramtypes", [
|
|
295
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
296
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
297
|
+
]),
|
|
298
|
+
_ts_metadata("design:returntype", Promise)
|
|
299
|
+
], UserController.prototype, "setVerified", null);
|
|
300
|
+
_ts_decorate([
|
|
301
|
+
(0, _awilixexpress.POST)(),
|
|
302
|
+
(0, _awilixexpress.route)("/:id/set-root-user"),
|
|
303
|
+
(0, _awilixexpress.before)([
|
|
304
|
+
_demomiddleware.demoUserNotAllowed
|
|
305
|
+
]),
|
|
306
|
+
_ts_metadata("design:type", Function),
|
|
307
|
+
_ts_metadata("design:paramtypes", [
|
|
308
|
+
typeof _express.Request === "undefined" ? Object : _express.Request,
|
|
309
|
+
typeof _express.Response === "undefined" ? Object : _express.Response
|
|
310
|
+
]),
|
|
311
|
+
_ts_metadata("design:returntype", Promise)
|
|
312
|
+
], UserController.prototype, "setRootUser", null);
|
|
313
|
+
UserController = _ts_decorate([
|
|
314
|
+
(0, _awilixexpress.route)(_serverconstants.AppConstants.apiRoute + "/user"),
|
|
315
|
+
(0, _awilixexpress.before)([
|
|
316
|
+
(0, _authenticate.authenticate)()
|
|
317
|
+
]),
|
|
318
|
+
_ts_metadata("design:type", Function),
|
|
319
|
+
_ts_metadata("design:paramtypes", [
|
|
320
|
+
Object
|
|
321
|
+
])
|
|
322
|
+
], UserController);
|
|
188
323
|
|
|
189
324
|
//# sourceMappingURL=user.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/controllers/user.controller.ts"],"names":["UserController","userService","roleService","configService","authService","settingsStore","logger","isTypeormMode","constructor","loggerFactory","name","
|
|
1
|
+
{"version":3,"sources":["../../src/controllers/user.controller.ts"],"names":["UserController","userService","roleService","configService","authService","settingsStore","logger","isTypeormMode","constructor","loggerFactory","name","list","req","res","users","listUsers","send","map","u","toDto","listRoles","roleDtos","roles","r","profile","user","id","getUser","get","validateInput","params","idRulesV2","delete","ownUserId","ForbiddenError","isRootUser","isUserRootUser","isDemoMode","demoUserId","getDemoUserId","throwIfDemoMode","deleteUser","logoutUserId","e","error","errorSummary","changeUsername","getLoginRequired","username","body","updateUsernameById","changePassword","oldPassword","newPassword","updatePasswordById","setUserRoles","currentUserId","ownUser","ownUserRoles","adminRole","getSynchronizedRoleByName","ROLES","ADMIN","includes","roleIds","BadRequestException","setUserRoleIds","setVerified","isVerified","setVerifiedById","setRootUser","userId","setIsRootUserById","authorizeRoles","demoUserNotAllowed","AppConstants","apiRoute","authenticate"],"mappings":";;;;+BAqBaA;;;eAAAA;;;yBApBqB;iCACL;8BACgB;wCACvB;4BACQ;mCACJ;mCAC0B;gCAGjB;4BAKN;+BAEoB;;;;;;;;;;AAI1C,MAAMA;IACXC,YAA0B;IAC1BC,YAA0B;IAC1BC,cAA8B;IAC9BC,YAA0B;IAC1BC,cAA6B;IAC7BC,OAAsB;IACtBC,cAAuB;IAEvBC,YAAY,EACVP,WAAW,EACXE,aAAa,EACbD,WAAW,EACXG,aAAa,EACbD,WAAW,EACXK,aAAa,EACbF,aAAa,EASd,CAAE;QACD,IAAI,CAACN,WAAW,GAAGA;QACnB,IAAI,CAACE,aAAa,GAAGA;QACrB,IAAI,CAACD,WAAW,GAAGA;QACnB,IAAI,CAACE,WAAW,GAAGA;QACnB,IAAI,CAACC,aAAa,GAAGA;QACrB,IAAI,CAACE,aAAa,GAAGA;QACrB,IAAI,CAACD,MAAM,GAAGG,cAAcT,eAAeU,IAAI;IACjD;IAEA,MAGMC,KAAKC,GAAY,EAAEC,GAAa,EAAE;QACtC,MAAMC,QAAQ,MAAM,IAAI,CAACb,WAAW,CAACc,SAAS;QAC9CF,IAAIG,IAAI,CAACF,MAAMG,GAAG,CAAC,CAACC,IAAM,IAAI,CAACjB,WAAW,CAACkB,KAAK,CAACD;IACnD;IAEA,MAEME,UAAUR,GAAY,EAAEC,GAAa,EAAE;QAC3C,MAAMQ,WAAW,IAAI,CAACnB,WAAW,CA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Z,6BAAK,CAACC,KAAK;SAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2B5BW,IAAAA,4BAAc,EAAC;YAACZ,6BAAK,CAACC,KAAK;SAAC;;;;;;;;;;;;;QAS5BW,IAAAA,4BAAc,EAAC;YAACZ,6BAAK,CAACC,KAAK;SAAC;QAAGY,kCAAkB;;;;;;;;;;;;;QAkCjDA,kCAAkB;;;;;;;;;;;;;QAiBlBA,kCAAkB;;;;;;;;;;;;;QAkBlBD,IAAAA,4BAAc,EAAC;YAACZ,6BAAK,CAACC,KAAK;SAAC;QAAGY,kCAAkB;;;;;;;;;;;;;QAgCjDD,IAAAA,4BAAc,EAAC;YAACZ,6BAAK,CAACC,KAAK;SAAC;QAAGY,kCAAkB;;;;;;;;;;;;;QAwBjDA,kCAAkB;;;;;;;;;;8BAxMtBC,6BAAY,CAACC,QAAQ,GAAG;;QACtBC,IAAAA,0BAAY"}
|
package/dist/server.constants.js
CHANGED
|
@@ -66,7 +66,7 @@ const AppConstants = {
|
|
|
66
66
|
githubUrl: "https://github.com/fdm-monster/fdm-monster",
|
|
67
67
|
orgName: "fdm-monster",
|
|
68
68
|
currentWizardVersion: 1,
|
|
69
|
-
defaultClientMinimum: "1.6.
|
|
69
|
+
defaultClientMinimum: "1.6.10",
|
|
70
70
|
influxUrl: "INFLUX_URL",
|
|
71
71
|
influxToken: "INFLUX_TOKEN",
|
|
72
72
|
influxOrg: "INFLUX_ORG",
|
|
@@ -22,6 +22,9 @@ function BaseService(entity, dto, createDTO, updateDto) {
|
|
|
22
22
|
}
|
|
23
23
|
async get(id, throwIfNotFound = true, options) {
|
|
24
24
|
try {
|
|
25
|
+
if (id === null || id === undefined) {
|
|
26
|
+
throw new _typeorm.EntityNotFoundError(entity, "Id was not provided");
|
|
27
|
+
}
|
|
25
28
|
return this.repository.findOneOrFail({
|
|
26
29
|
...options,
|
|
27
30
|
where: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/services/orm/base.service.ts"],"names":["BaseService","entity","dto","createDTO","updateDto","BaseServiceHost","typeormService","repository","constructor","getDataSource","getRepository","get","id","throwIfNotFound","options","
|
|
1
|
+
{"version":3,"sources":["../../../src/services/orm/base.service.ts"],"names":["BaseService","entity","dto","createDTO","updateDto","BaseServiceHost","typeormService","repository","constructor","getDataSource","getRepository","get","id","throwIfNotFound","options","undefined","EntityNotFoundError","findOneOrFail","where","e","NotFoundException","list","find","listPaged","page","DEFAULT_PAGE","take","pageSize","skip","update","validate","Object","assign","create","save","delete","deleteMany","ids","emitEvent"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;yBAPT;gCACkB;mCAGS;+BACQ;AAEnC,SAASA,YAKdC,MAAuB,EAAEC,GAAc,EAAEC,SAA2B,EAAEC,SAA2B;IACjG,MAAeC;QACbC,eAA+B;QAC/BC,WAA0B;QAE1BC,YAAY,EAAEF,cAAc,EAAsC,CAAE;YAClE,IAAI,CAACA,cAAc,GAAGA;YACtB,IAAI,CAACC,UAAU,GAAGD,eAAeG,aAAa,GAAGC,aAAa,CAACT;QACjE;QAIA,MAAMU,IAAIC,EAAgB,EAAEC,kBAAkB,IAAI,EAAEC,OAA2B,EAAE;YAC/E,IAAI;gBACF,IAAIF,OAAO,QAAQA,OAAOG,WAAW;oBACnC,MAAM,IAAIC,4BAAmB,CAACf,QAAQ;gBACxC;gBACA,OAAO,IAAI,CAACM,UAAU,CAACU,aAAa,CAAC;oBAAE,GAAGH,OAAO;oBAAEI,OAAO;wBAAEN;oBAAG;gBAAE;YACnE,EAAE,OAAOO,GAAG;gBACV,IAAIN,mBAAmBM,aAAaH,4BAAmB,EAAE;oBACvD,MAAM,IAAII,oCAAiB,CAAC,CAAC,WAAW,EAAEnB,OAAO,mCAAmC,CAAC;gBACvF;gBACA,OAAOc;YACT;QACF;QAEA,MAAMM,KAAKP,OAA4B,EAAE;YACvC,OAAO,IAAI,CAACP,UAAU,CAACe,IAAI,CAACR;QAC9B;QAEA,MAAMS,U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
"author": "David Zwart",
|
|
8
8
|
"license": "AGPL-3.0-or-later",
|
|
9
|
-
"version": "1.7.
|
|
9
|
+
"version": "1.7.3",
|
|
10
10
|
"bin": {
|
|
11
11
|
"fdm-monster": "dist/index.js",
|
|
12
12
|
"fdmm": "dist/index.js"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vue"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@fdm-monster/client": "1.6.
|
|
57
|
-
"@fdm-monster/client-next": "0.0.
|
|
56
|
+
"@fdm-monster/client": "1.6.10",
|
|
57
|
+
"@fdm-monster/client-next": "0.0.7",
|
|
58
58
|
"@influxdata/influxdb-client": "1.35.0",
|
|
59
59
|
"@octokit/plugin-throttling": "8.2.0",
|
|
60
60
|
"@sentry/node": "8.37.1",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"toad-scheduler": "3.0.1",
|
|
97
97
|
"typeorm": "0.3.20",
|
|
98
98
|
"uuid": "11.0.3",
|
|
99
|
-
"winston": "3.
|
|
99
|
+
"winston": "3.17.0",
|
|
100
100
|
"ws": "8.18.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|