@nest-omni/core 1.0.35 → 1.0.38

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.
@@ -14,7 +14,7 @@ function getOmniAuthData(request, key) {
14
14
  let user;
15
15
  const configService = new config_1.ConfigService(request);
16
16
  if ((0, lodash_1.isEmpty)(headers['x-user-id']) || (0, lodash_1.isEmpty)(headers['x-username'])) {
17
- if (process.env.NODE_ENV === 'dev') {
17
+ if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'uat') {
18
18
  user = {
19
19
  uid: configService.get('MOCK_UID'),
20
20
  username: configService.get('MOCK_USERNAME'),
@@ -24,6 +24,10 @@ function getOmniAuthData(request, key) {
24
24
  role: configService.get('MOCK_ROLE', ''),
25
25
  };
26
26
  }
27
+ else {
28
+ console.error('User information is not transparently transmitted through the gateway: ' +
29
+ headers);
30
+ }
27
31
  }
28
32
  else {
29
33
  user = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-omni/core",
3
- "version": "1.0.35",
3
+ "version": "1.0.38",
4
4
  "description": "framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextProvider = void 0;
4
4
  const nestjs_cls_1 = require("nestjs-cls");
5
+ const common_1 = require("@nestjs/common");
5
6
  class ContextProvider {
6
7
  static get(key) {
7
8
  const store = nestjs_cls_1.ClsServiceManager.getClsService();
@@ -54,7 +55,7 @@ class ContextProvider {
54
55
  static getAuthUser() {
55
56
  const auth = ContextProvider.get(ContextProvider.authUserKey);
56
57
  if (!auth) {
57
- throw new Error('User information not found.');
58
+ throw new common_1.BadGatewayException('User information not found.');
58
59
  }
59
60
  return auth;
60
61
  }