@application-kit/observability 0.3.0 → 0.3.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @application-kit/observability
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ed0384: `HealthCliModule`: команда `health` снова регистрируется в группе потребителя. В 0.3.0 она была унаследована подклассом-группой,
8
+ а сканер nestjs-console видит только собственные методы класса — CLI отвечал `too many arguments for '<группа>'`, и проверка
9
+ по крону не выполнялась.
10
+
3
11
  ## 0.3.0
4
12
 
5
13
  ### Minor Changes
@@ -0,0 +1,10 @@
1
+ import { HealthCheckService } from '@nestjs/terminus';
2
+ import type { ObservabilityLoggerInterface } from '../../logging/observability-logger.interface.js';
3
+ import { HealthChecks } from '../health-checks.js';
4
+ export declare class HealthCliCommands {
5
+ private readonly health;
6
+ private readonly logger;
7
+ private readonly healthChecks;
8
+ constructor(health: HealthCheckService, logger: ObservabilityLoggerInterface, healthChecks: HealthChecks);
9
+ getHealth(): Promise<void>;
10
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HealthCliCommands = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const terminus_1 = require("@nestjs/terminus");
18
+ const constants_js_1 = require("../../logging/constants.js");
19
+ const health_checks_js_1 = require("../health-checks.js");
20
+ let HealthCliCommands = class HealthCliCommands {
21
+ health;
22
+ logger;
23
+ healthChecks;
24
+ constructor(health, logger, healthChecks) {
25
+ this.health = health;
26
+ this.logger = logger;
27
+ this.healthChecks = healthChecks;
28
+ }
29
+ async getHealth() {
30
+ try {
31
+ const healthResult = await this.health.check(this.healthChecks.build());
32
+ this.logger.info({ healthResult }, healthResult.status);
33
+ }
34
+ catch (error) {
35
+ const healthResult = error instanceof common_1.ServiceUnavailableException ? error.getResponse() : 'unknown';
36
+ this.logger.error({ healthResult }, 'error');
37
+ }
38
+ }
39
+ };
40
+ exports.HealthCliCommands = HealthCliCommands;
41
+ exports.HealthCliCommands = HealthCliCommands = __decorate([
42
+ __param(0, (0, common_1.Inject)(terminus_1.HealthCheckService)),
43
+ __param(1, (0, common_1.Inject)(constants_js_1.OBSERVABILITY_LOGGER)),
44
+ __param(2, (0, common_1.Inject)(health_checks_js_1.HealthChecks)),
45
+ __metadata("design:paramtypes", [terminus_1.HealthCheckService, Object, health_checks_js_1.HealthChecks])
46
+ ], HealthCliCommands);
@@ -1,13 +1,4 @@
1
1
  import type { Type } from '@nestjs/common';
2
- import { HealthCheckService } from '@nestjs/terminus';
3
- import type { ObservabilityLoggerInterface } from '../../logging/observability-logger.interface.js';
4
2
  import type { HealthCliOptionsInterface } from './health-cli-options.interface.js';
5
- import { HealthChecks } from '../health-checks.js';
6
- export declare class HealthCliCommands {
7
- private readonly health;
8
- private readonly logger;
9
- private readonly healthChecks;
10
- constructor(health: HealthCheckService, logger: ObservabilityLoggerInterface, healthChecks: HealthChecks);
11
- getHealth(): Promise<void>;
12
- }
3
+ import { HealthCliCommands } from './health-cli-commands.js';
13
4
  export declare const createHealthCli: (options: HealthCliOptionsInterface) => Type<HealthCliCommands>;
@@ -8,49 +8,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.createHealthCli = exports.HealthCliCommands = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const terminus_1 = require("@nestjs/terminus");
12
+ exports.createHealthCli = void 0;
18
13
  const nestjs_console_1 = require("nestjs-console");
19
- const constants_js_1 = require("../../logging/constants.js");
20
- const with_class_decorator_js_1 = require("../../shared/with-class-decorator.js");
21
- const health_checks_js_1 = require("../health-checks.js");
22
- let HealthCliCommands = class HealthCliCommands {
23
- health;
24
- logger;
25
- healthChecks;
26
- constructor(health, logger, healthChecks) {
27
- this.health = health;
28
- this.logger = logger;
29
- this.healthChecks = healthChecks;
30
- }
31
- async getHealth() {
32
- try {
33
- const healthResult = await this.health.check(this.healthChecks.build());
34
- this.logger.info({ healthResult }, healthResult.status);
35
- }
36
- catch (error) {
37
- const healthResult = error instanceof common_1.ServiceUnavailableException ? error.getResponse() : 'unknown';
38
- this.logger.error({ healthResult }, 'error');
14
+ const health_cli_commands_js_1 = require("./health-cli-commands.js");
15
+ const createHealthCli = (options) => {
16
+ let HealthCli = class HealthCli extends health_cli_commands_js_1.HealthCliCommands {
17
+ async getHealth() {
18
+ await super.getHealth();
39
19
  }
40
- }
20
+ };
21
+ __decorate([
22
+ (0, nestjs_console_1.Command)({ command: 'health' }),
23
+ __metadata("design:type", Function),
24
+ __metadata("design:paramtypes", []),
25
+ __metadata("design:returntype", Promise)
26
+ ], HealthCli.prototype, "getHealth", null);
27
+ HealthCli = __decorate([
28
+ (0, nestjs_console_1.Console)({ command: options.command })
29
+ ], HealthCli);
30
+ return HealthCli;
41
31
  };
42
- exports.HealthCliCommands = HealthCliCommands;
43
- __decorate([
44
- (0, nestjs_console_1.Command)({ command: 'health' }),
45
- __metadata("design:type", Function),
46
- __metadata("design:paramtypes", []),
47
- __metadata("design:returntype", Promise)
48
- ], HealthCliCommands.prototype, "getHealth", null);
49
- exports.HealthCliCommands = HealthCliCommands = __decorate([
50
- __param(0, (0, common_1.Inject)(terminus_1.HealthCheckService)),
51
- __param(1, (0, common_1.Inject)(constants_js_1.OBSERVABILITY_LOGGER)),
52
- __param(2, (0, common_1.Inject)(health_checks_js_1.HealthChecks)),
53
- __metadata("design:paramtypes", [terminus_1.HealthCheckService, Object, health_checks_js_1.HealthChecks])
54
- ], HealthCliCommands);
55
- const createHealthCli = (options) => (0, with_class_decorator_js_1.withClassDecorator)(HealthCliCommands, (0, nestjs_console_1.Console)({ command: options.command }));
56
32
  exports.createHealthCli = createHealthCli;
@@ -1,3 +1,4 @@
1
1
  export * from './health-cli.js';
2
+ export * from './health-cli-commands.js';
2
3
  export * from './health-cli-options.interface.js';
3
4
  export * from './health-cli.module.js';
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./health-cli.js"), exports);
18
+ __exportStar(require("./health-cli-commands.js"), exports);
18
19
  __exportStar(require("./health-cli-options.interface.js"), exports);
19
20
  __exportStar(require("./health-cli.module.js"), exports);
@@ -0,0 +1,10 @@
1
+ import { HealthCheckService } from '@nestjs/terminus';
2
+ import type { ObservabilityLoggerInterface } from '../../logging/observability-logger.interface.js';
3
+ import { HealthChecks } from '../health-checks.js';
4
+ export declare class HealthCliCommands {
5
+ private readonly health;
6
+ private readonly logger;
7
+ private readonly healthChecks;
8
+ constructor(health: HealthCheckService, logger: ObservabilityLoggerInterface, healthChecks: HealthChecks);
9
+ getHealth(): Promise<void>;
10
+ }
@@ -0,0 +1,43 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Inject, ServiceUnavailableException } from '@nestjs/common';
14
+ import { HealthCheckService } from '@nestjs/terminus';
15
+ import { OBSERVABILITY_LOGGER } from '../../logging/constants.js';
16
+ import { HealthChecks } from '../health-checks.js';
17
+ let HealthCliCommands = class HealthCliCommands {
18
+ health;
19
+ logger;
20
+ healthChecks;
21
+ constructor(health, logger, healthChecks) {
22
+ this.health = health;
23
+ this.logger = logger;
24
+ this.healthChecks = healthChecks;
25
+ }
26
+ async getHealth() {
27
+ try {
28
+ const healthResult = await this.health.check(this.healthChecks.build());
29
+ this.logger.info({ healthResult }, healthResult.status);
30
+ }
31
+ catch (error) {
32
+ const healthResult = error instanceof ServiceUnavailableException ? error.getResponse() : 'unknown';
33
+ this.logger.error({ healthResult }, 'error');
34
+ }
35
+ }
36
+ };
37
+ HealthCliCommands = __decorate([
38
+ __param(0, Inject(HealthCheckService)),
39
+ __param(1, Inject(OBSERVABILITY_LOGGER)),
40
+ __param(2, Inject(HealthChecks)),
41
+ __metadata("design:paramtypes", [HealthCheckService, Object, HealthChecks])
42
+ ], HealthCliCommands);
43
+ export { HealthCliCommands };
@@ -1,13 +1,4 @@
1
1
  import type { Type } from '@nestjs/common';
2
- import { HealthCheckService } from '@nestjs/terminus';
3
- import type { ObservabilityLoggerInterface } from '../../logging/observability-logger.interface.js';
4
2
  import type { HealthCliOptionsInterface } from './health-cli-options.interface.js';
5
- import { HealthChecks } from '../health-checks.js';
6
- export declare class HealthCliCommands {
7
- private readonly health;
8
- private readonly logger;
9
- private readonly healthChecks;
10
- constructor(health: HealthCheckService, logger: ObservabilityLoggerInterface, healthChecks: HealthChecks);
11
- getHealth(): Promise<void>;
12
- }
3
+ import { HealthCliCommands } from './health-cli-commands.js';
13
4
  export declare const createHealthCli: (options: HealthCliOptionsInterface) => Type<HealthCliCommands>;
@@ -7,46 +7,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- var __param = (this && this.__param) || function (paramIndex, decorator) {
11
- return function (target, key) { decorator(target, key, paramIndex); }
12
- };
13
- import { Inject, ServiceUnavailableException } from '@nestjs/common';
14
- import { HealthCheckService } from '@nestjs/terminus';
15
10
  import { Command, Console } from 'nestjs-console';
16
- import { OBSERVABILITY_LOGGER } from '../../logging/constants.js';
17
- import { withClassDecorator } from '../../shared/with-class-decorator.js';
18
- import { HealthChecks } from '../health-checks.js';
19
- let HealthCliCommands = class HealthCliCommands {
20
- health;
21
- logger;
22
- healthChecks;
23
- constructor(health, logger, healthChecks) {
24
- this.health = health;
25
- this.logger = logger;
26
- this.healthChecks = healthChecks;
27
- }
28
- async getHealth() {
29
- try {
30
- const healthResult = await this.health.check(this.healthChecks.build());
31
- this.logger.info({ healthResult }, healthResult.status);
32
- }
33
- catch (error) {
34
- const healthResult = error instanceof ServiceUnavailableException ? error.getResponse() : 'unknown';
35
- this.logger.error({ healthResult }, 'error');
11
+ import { HealthCliCommands } from './health-cli-commands.js';
12
+ export const createHealthCli = (options) => {
13
+ let HealthCli = class HealthCli extends HealthCliCommands {
14
+ async getHealth() {
15
+ await super.getHealth();
36
16
  }
37
- }
17
+ };
18
+ __decorate([
19
+ Command({ command: 'health' }),
20
+ __metadata("design:type", Function),
21
+ __metadata("design:paramtypes", []),
22
+ __metadata("design:returntype", Promise)
23
+ ], HealthCli.prototype, "getHealth", null);
24
+ HealthCli = __decorate([
25
+ Console({ command: options.command })
26
+ ], HealthCli);
27
+ return HealthCli;
38
28
  };
39
- __decorate([
40
- Command({ command: 'health' }),
41
- __metadata("design:type", Function),
42
- __metadata("design:paramtypes", []),
43
- __metadata("design:returntype", Promise)
44
- ], HealthCliCommands.prototype, "getHealth", null);
45
- HealthCliCommands = __decorate([
46
- __param(0, Inject(HealthCheckService)),
47
- __param(1, Inject(OBSERVABILITY_LOGGER)),
48
- __param(2, Inject(HealthChecks)),
49
- __metadata("design:paramtypes", [HealthCheckService, Object, HealthChecks])
50
- ], HealthCliCommands);
51
- export { HealthCliCommands };
52
- export const createHealthCli = (options) => withClassDecorator(HealthCliCommands, Console({ command: options.command }));
@@ -1,3 +1,4 @@
1
1
  export * from './health-cli.js';
2
+ export * from './health-cli-commands.js';
2
3
  export * from './health-cli-options.interface.js';
3
4
  export * from './health-cli.module.js';
@@ -1,3 +1,4 @@
1
1
  export * from './health-cli.js';
2
+ export * from './health-cli-commands.js';
2
3
  export * from './health-cli-options.interface.js';
3
4
  export * from './health-cli.module.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@application-kit/observability",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Наблюдаемость NestJS-процесса: метрики Prometheus и RED-гистограммы, health-чеки и пробы, опции pino с request-id и trace-контекстом, логирование CQRS-шин, реальный IP клиента за прокси",
5
5
  "keywords": [
6
6
  "cqrs",