@maysun/common 3.0.21 → 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.
@@ -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: (_a = err.path[0]) === null || _a === void 0 ? void 0 : _a.toString(),
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
- var _a;
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 {
@@ -0,0 +1,9 @@
1
+ export interface User {
2
+ id: string;
3
+ phoneNumber: string;
4
+ domain: string;
5
+ }
6
+ export interface IContext {
7
+ domain: string;
8
+ currentUser: User | null;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maysun/common",
3
- "version": "3.0.21",
3
+ "version": "3.0.22",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [