@maysun/common 3.0.20 → 3.0.22
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/build/errors/request-validation-error.js +1 -2
- package/build/middleware/current-user.js +1 -2
- package/build/middleware/rateLimit.d.ts +1 -1
- package/build/middleware/rateLimit.js +2 -2
- package/build/types/interfaces.d.ts +9 -0
- package/build/types/interfaces.js +2 -0
- package/package.json +1 -1
|
@@ -12,10 +12,9 @@ class RequestValidationError extends custom_error_1.CustomError {
|
|
|
12
12
|
}
|
|
13
13
|
serializeErrors() {
|
|
14
14
|
return this.error.issues.map((err) => {
|
|
15
|
-
var _a;
|
|
16
15
|
return {
|
|
17
16
|
message: err.message,
|
|
18
|
-
field:
|
|
17
|
+
field: err.path[0]?.toString(),
|
|
19
18
|
};
|
|
20
19
|
});
|
|
21
20
|
// return [{ message: 'Not found!' }];
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.currentUser = void 0;
|
|
7
7
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
8
|
const currentUser = (req, res, next) => {
|
|
9
|
-
|
|
10
|
-
if (!((_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt)) {
|
|
9
|
+
if (!req.session?.jwt) {
|
|
11
10
|
return next();
|
|
12
11
|
}
|
|
13
12
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const limiter: import("express-rate-limit").RateLimitRequestHandler;
|
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.limiter = void 0;
|
|
7
7
|
const public_config_1 = require("../config/public.config");
|
|
8
8
|
const express_rate_limit_1 = __importDefault(require("express-rate-limit"));
|
|
9
|
-
exports.
|
|
9
|
+
exports.limiter = (0, express_rate_limit_1.default)({
|
|
10
10
|
max: public_config_1.RATE_LIMIT,
|
|
11
11
|
windowMs: public_config_1.WINDOW_MS * 60 * 1000,
|
|
12
12
|
message: `Too many request per ip, in ${public_config_1.WINDOW_MS} minutes!`,
|