jp.ms.common.modules 1.0.10 → 1.0.12

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.
@@ -0,0 +1,9 @@
1
+ interface Log {
2
+ message: string;
3
+ level: string;
4
+ stackTrace?: string;
5
+ }
6
+ export interface LogsDto {
7
+ logs: Array<Log>;
8
+ }
9
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=log.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.dto.js","sourceRoot":"","sources":["../../../src/dto/common/log.dto.ts"],"names":[],"mappings":""}
@@ -1,5 +1,8 @@
1
1
  import type { Response } from 'express';
2
+ import { IAppHeaders } from 'jp.common.models';
2
3
  import { PlayerConnectedDto } from '../../dto/common/player-connected.dto';
4
+ import { JpLoggerService } from '../logger/jp-logger.service';
5
+ import { LogsDto } from '../../dto/common/log.dto';
3
6
  import { SupportService } from './support.service';
4
7
  import { MetricService } from './metric.service';
5
8
  import { DumpService } from './dump.service';
@@ -7,9 +10,10 @@ export declare class SupportController {
7
10
  private readonly supportService;
8
11
  private readonly metricService;
9
12
  private readonly dumpService;
10
- constructor(supportService: SupportService, metricService: MetricService, dumpService: DumpService);
13
+ private readonly logger;
14
+ constructor(supportService: SupportService, metricService: MetricService, dumpService: DumpService, logger: JpLoggerService);
11
15
  getUsers(): Promise<Array<PlayerConnectedDto>>;
12
16
  getDump(response: Response): Promise<void>;
13
17
  getMetrics(response: Response): Promise<void>;
14
- addLog(): void;
18
+ addLog(headers: IAppHeaders, body: LogsDto): void;
15
19
  }
@@ -14,6 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.SupportController = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
+ const jp_logger_service_1 = require("../logger/jp-logger.service");
17
18
  const support_service_1 = require("./support.service");
18
19
  const metric_service_1 = require("./metric.service");
19
20
  const dump_service_1 = require("./dump.service");
@@ -21,10 +22,12 @@ let SupportController = class SupportController {
21
22
  supportService;
22
23
  metricService;
23
24
  dumpService;
24
- constructor(supportService, metricService, dumpService) {
25
+ logger;
26
+ constructor(supportService, metricService, dumpService, logger) {
25
27
  this.supportService = supportService;
26
28
  this.metricService = metricService;
27
29
  this.dumpService = dumpService;
30
+ this.logger = logger;
28
31
  }
29
32
  getUsers() {
30
33
  return this.supportService.getUsers();
@@ -42,7 +45,19 @@ let SupportController = class SupportController {
42
45
  response.set({ 'Content-Type': register.contentType });
43
46
  response.send(await register.metrics());
44
47
  }
45
- addLog() {
48
+ addLog(headers, body) {
49
+ body.logs.forEach((item) => {
50
+ this.logger.log({
51
+ client_auth_token: headers.client_auth_token,
52
+ client_game: headers.client_game,
53
+ client_channel: headers.client_channel,
54
+ client_language: headers.client_language,
55
+ client_version: headers.client_version,
56
+ description: item.message,
57
+ stackTrace: item.stackTrace,
58
+ level: item.level,
59
+ });
60
+ });
46
61
  }
47
62
  };
48
63
  exports.SupportController = SupportController;
@@ -68,14 +83,19 @@ __decorate([
68
83
  ], SupportController.prototype, "getMetrics", null);
69
84
  __decorate([
70
85
  (0, common_1.Post)('log'),
86
+ (0, common_1.HttpCode)(common_1.HttpStatus.OK),
87
+ __param(0, (0, common_1.Headers)()),
88
+ __param(1, (0, common_1.Body)()),
71
89
  __metadata("design:type", Function),
72
- __metadata("design:paramtypes", []),
90
+ __metadata("design:paramtypes", [Object, Object]),
73
91
  __metadata("design:returntype", void 0)
74
92
  ], SupportController.prototype, "addLog", null);
75
93
  exports.SupportController = SupportController = __decorate([
76
94
  (0, common_1.Controller)('support'),
95
+ __param(3, (0, common_1.Inject)()),
77
96
  __metadata("design:paramtypes", [support_service_1.SupportService,
78
97
  metric_service_1.MetricService,
79
- dump_service_1.DumpService])
98
+ dump_service_1.DumpService,
99
+ jp_logger_service_1.JpLoggerService])
80
100
  ], SupportController);
81
101
  //# sourceMappingURL=support.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"support.controller.js","sourceRoot":"","sources":["../../../src/modules/support/support.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4D;AAK5D,uDAAmD;AACnD,qDAAiD;AACjD,iDAA6C;AAGtC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAEL;IACA;IACA;IAHrB,YACqB,cAA8B,EAC9B,aAA4B,EAC5B,WAAwB;QAFxB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,kBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAW,GAAX,WAAW,CAAa;IAE7C,CAAC;IAGD,QAAQ;QACJ,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IAC1C,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CAAS,QAAkB;QACpC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAA;QAE7C,QAAQ,CAAC,GAAG,CAAC;YACT,cAAc,EAAE,0BAA0B;YAC1C,qBAAqB,EAAE,iDAAiD;SAC3E,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CAAS,QAAkB;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAEvD,QAAQ,CAAC,IAAI,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5C,CAAC;IAGD,MAAM;IACN,CAAC;CACJ,CAAA;AApCY,8CAAiB;AAS1B;IADC,IAAA,YAAG,EAAC,OAAO,CAAC;;;;iDAGZ;AAGK;IADL,IAAA,YAAG,EAAC,MAAM,CAAC;IACI,WAAA,IAAA,YAA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AL7C,iBAAiB,CAkD7B"}
@@ -4,5 +4,4 @@ export declare class SupportService {
4
4
  private readonly playersManager;
5
5
  constructor(playersManager: PlayersManagerService);
6
6
  getUsers(): Promise<Array<PlayerConnectedDto>>;
7
- getMetrics(): Promise<void>;
8
7
  }
@@ -21,8 +21,6 @@ let SupportService = class SupportService {
21
21
  async getUsers() {
22
22
  return this.playersManager.getPlayers().map((item) => player_connected_dto_1.PlayerConnectedDto.fromEntities(item));
23
23
  }
24
- async getMetrics() {
25
- }
26
24
  };
27
25
  exports.SupportService = SupportService;
28
26
  exports.SupportService = SupportService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"support.service.js","sourceRoot":"","sources":["../../../src/modules/support/support.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wFAAmF;AACnF,gFAA2E;AAGpE,IAAM,cAAc,GAApB,MAAM,cAAc;IAEF;IADrB,YACqB,cAAqC;QAArC,mBAAc,GAAd,cAAc,CAAuB;IAE1D,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yCAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,KAAK,CAAC,UAAU;IAEhB,CAAC;CACJ,CAAA;AAbY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAG4B,+CAAqB;GAFjD,cAAc,CAa1B"}
1
+ {"version":3,"file":"support.service.js","sourceRoot":"","sources":["../../../src/modules/support/support.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wFAAmF;AACnF,gFAA2E;AAGpE,IAAM,cAAc,GAApB,MAAM,cAAc;IAEF;IADrB,YACqB,cAAqC;QAArC,mBAAc,GAAd,cAAc,CAAuB;IAE1D,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yCAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,CAAC;CACJ,CAAA;AATY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;qCAG4B,+CAAqB;GAFjD,cAAc,CAS1B"}