@nathapp/nestjs-health 3.3.0

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.
Files changed (86) hide show
  1. package/.eslintrc.js +8 -0
  2. package/.nax/features/nestjs-health/.nax-acceptance.test.ts +756 -0
  3. package/.turbo/turbo-build.log +4 -0
  4. package/CHANGELOG.md +15 -0
  5. package/README.md +19 -0
  6. package/dist/constant/health.constants.d.ts +5 -0
  7. package/dist/constant/health.constants.js +9 -0
  8. package/dist/constant/health.constants.js.map +1 -0
  9. package/dist/constant/index.d.ts +1 -0
  10. package/dist/constant/index.js +18 -0
  11. package/dist/constant/index.js.map +1 -0
  12. package/dist/controller/health.controller.d.ts +5 -0
  13. package/dist/controller/health.controller.js +48 -0
  14. package/dist/controller/health.controller.js.map +1 -0
  15. package/dist/controller/index.d.ts +1 -0
  16. package/dist/controller/index.js +18 -0
  17. package/dist/controller/index.js.map +1 -0
  18. package/dist/index.d.ts +6 -0
  19. package/dist/index.js +23 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/indicator/cache-health.check.d.ts +20 -0
  22. package/dist/indicator/cache-health.check.js +50 -0
  23. package/dist/indicator/cache-health.check.js.map +1 -0
  24. package/dist/indicator/generic-health.check.d.ts +13 -0
  25. package/dist/indicator/generic-health.check.js +51 -0
  26. package/dist/indicator/generic-health.check.js.map +1 -0
  27. package/dist/indicator/index.d.ts +4 -0
  28. package/dist/indicator/index.js +21 -0
  29. package/dist/indicator/index.js.map +1 -0
  30. package/dist/indicator/prisma-health.check.d.ts +20 -0
  31. package/dist/indicator/prisma-health.check.js +53 -0
  32. package/dist/indicator/prisma-health.check.js.map +1 -0
  33. package/dist/indicator/queue-health.check.d.ts +22 -0
  34. package/dist/indicator/queue-health.check.js +56 -0
  35. package/dist/indicator/queue-health.check.js.map +1 -0
  36. package/dist/interface/health-indicator.interface.d.ts +4 -0
  37. package/dist/interface/health-indicator.interface.js +3 -0
  38. package/dist/interface/health-indicator.interface.js.map +1 -0
  39. package/dist/interface/health-module-options.interface.d.ts +22 -0
  40. package/dist/interface/health-module-options.interface.js +19 -0
  41. package/dist/interface/health-module-options.interface.js.map +1 -0
  42. package/dist/interface/index.d.ts +2 -0
  43. package/dist/interface/index.js +19 -0
  44. package/dist/interface/index.js.map +1 -0
  45. package/dist/module/health.module.d.ts +8 -0
  46. package/dist/module/health.module.js +58 -0
  47. package/dist/module/health.module.js.map +1 -0
  48. package/dist/module/index.d.ts +1 -0
  49. package/dist/module/index.js +18 -0
  50. package/dist/module/index.js.map +1 -0
  51. package/dist/service/health-executor.service.d.ts +20 -0
  52. package/dist/service/health-executor.service.js +50 -0
  53. package/dist/service/health-executor.service.js.map +1 -0
  54. package/dist/service/index.d.ts +1 -0
  55. package/dist/service/index.js +18 -0
  56. package/dist/service/index.js.map +1 -0
  57. package/lib/constant/health.constants.ts +23 -0
  58. package/lib/constant/index.ts +1 -0
  59. package/lib/controller/health.controller.ts +37 -0
  60. package/lib/controller/index.ts +1 -0
  61. package/lib/index.ts +6 -0
  62. package/lib/indicator/cache-health.check.ts +59 -0
  63. package/lib/indicator/generic-health.check.ts +43 -0
  64. package/lib/indicator/index.ts +4 -0
  65. package/lib/indicator/prisma-health.check.ts +59 -0
  66. package/lib/indicator/queue-health.check.ts +72 -0
  67. package/lib/interface/health-indicator.interface.ts +18 -0
  68. package/lib/interface/health-module-options.interface.ts +85 -0
  69. package/lib/interface/index.ts +2 -0
  70. package/lib/module/health.module.ts +62 -0
  71. package/lib/module/index.ts +1 -0
  72. package/lib/service/health-executor.service.ts +69 -0
  73. package/lib/service/index.ts +1 -0
  74. package/package.json +67 -0
  75. package/test/constant/health.constants.spec.ts +34 -0
  76. package/test/controller/health.controller.spec.ts +117 -0
  77. package/test/indicator/cache-health.check.spec.ts +88 -0
  78. package/test/indicator/generic-health.check.spec.ts +61 -0
  79. package/test/indicator/prisma-health.check.spec.ts +69 -0
  80. package/test/indicator/queue-health.check.spec.ts +88 -0
  81. package/test/interface/health-module-options.spec.ts +59 -0
  82. package/test/jest-nax.json +27 -0
  83. package/test/jest-test.json +28 -0
  84. package/test/module/health.module.spec.ts +311 -0
  85. package/test/service/health-executor.service.spec.ts +186 -0
  86. package/tsconfig.json +9 -0
@@ -0,0 +1,4 @@
1
+
2
+ > @nathapp/nestjs-health@3.3.0 build
3
+ > rimraf dist && tsc -p tsconfig.json
4
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # @nathapp/nestjs-health
2
+
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a27440f: 3.3.0 milestone release. The `@nathapp/nestjs-*` packages now version and publish in lockstep at a unified version.
8
+
9
+ - **nestjs-csrf**: first public release — stateless double-submit-cookie CSRF guard (zero-dep HMAC, Express + Fastify, Bearer coexist skip, `@SkipCsrf()`, auto-binds `APP_GUARD`).
10
+ - **nestjs-health**: first public release — terminus aggregator over cache/prisma/queue with k8s liveness/readiness probes via a dynamic controller factory.
11
+ - **nestjs-idempotency**: first public release — `@Idempotent()` interceptor (zero-dep sha256 fingerprint, Express + Fastify, 409-in-flight, 2xx replay, fingerprint mismatch 422, fail-closed on store error).
12
+ - **nestjs-observability**: first public release — Prometheus RED metrics + OpenTelemetry tracing joined to the logging ALS; `initTracing()` pre-bootstrap hook.
13
+ - **nestjs-outbox**: first public release — transactional outbox relay (at-least-once via `ITransactionManager`, lease-claim + backoff, dead-letter).
14
+ - **nestjs-storage**: migrated from aws-sdk v2 to v3 (zero runtime dep via `import type` + lazy `loadPackage`); NFSStorage stub replaced with an S3-style HTTP file-service client.
15
+ - **nestjs-cache**: `delByPattern` now routes through Redis SCAN instead of an O(n) key sweep, with glob-detection and multi-tier iterator support.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @nathapp/nestjs-health
2
+
3
+ Health-check aggregator for NestJS. Unifies the per-subsystem `isHealthy()` checks
4
+ exposed by `@nathapp/nestjs-cache`, `@nathapp/nestjs-prisma`, and
5
+ `@nathapp/nestjs-queue` behind [`@nestjs/terminus`](https://github.com/nestjs/terminus),
6
+ and exposes Kubernetes-grade **liveness** and **readiness** HTTP probes.
7
+
8
+ ## Design
9
+
10
+ - Built on `@nestjs/terminus` (v11 `HealthIndicatorService` API).
11
+ - Named adapter checks (`CacheHealthCheck`, `PrismaHealthCheck`,
12
+ `QueueHealthCheck`) map each source package's health shape into terminus. The
13
+ three source packages are **optional** peer dependencies, bound by the consumer
14
+ via injection tokens, so this package installs and boots standalone.
15
+ - `GenericHealthCheck` wraps any custom `{ isHealthy() }` source.
16
+ - `HealthModule.register({ liveness, readiness })` wires per-probe indicator
17
+ arrays and a controller exposing `GET /health/live` and `GET /health/ready`.
18
+
19
+ See `docs/superpowers/specs/2026-07-07-nestjs-health-design.md`.
@@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_LIVENESS_PATH = "health/live";
2
+ export declare const DEFAULT_READINESS_PATH = "health/ready";
3
+ export declare const CACHE_HEALTH_SOURCE: unique symbol;
4
+ export declare const PRISMA_HEALTH_SOURCE: unique symbol;
5
+ export declare const QUEUE_HEALTH_SOURCE: unique symbol;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QUEUE_HEALTH_SOURCE = exports.PRISMA_HEALTH_SOURCE = exports.CACHE_HEALTH_SOURCE = exports.DEFAULT_READINESS_PATH = exports.DEFAULT_LIVENESS_PATH = void 0;
4
+ exports.DEFAULT_LIVENESS_PATH = 'health/live';
5
+ exports.DEFAULT_READINESS_PATH = 'health/ready';
6
+ exports.CACHE_HEALTH_SOURCE = Symbol.for('CACHE_HEALTH_SOURCE');
7
+ exports.PRISMA_HEALTH_SOURCE = Symbol.for('PRISMA_HEALTH_SOURCE');
8
+ exports.QUEUE_HEALTH_SOURCE = Symbol.for('QUEUE_HEALTH_SOURCE');
9
+ //# sourceMappingURL=health.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.constants.js","sourceRoot":"","sources":["../../lib/constant/health.constants.ts"],"names":[],"mappings":";;;AACa,QAAA,qBAAqB,GAAG,aAAa,CAAC;AAGtC,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAMxC,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAMxD,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAM1D,QAAA,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './health.constants';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./health.constants"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
@@ -0,0 +1,5 @@
1
+ import { Type } from '@nestjs/common';
2
+ export declare function createHealthController(paths: {
3
+ livenessPath: string;
4
+ readinessPath: string;
5
+ }): Type<unknown>;
@@ -0,0 +1,48 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createHealthController = createHealthController;
13
+ const common_1 = require("@nestjs/common");
14
+ const terminus_1 = require("@nestjs/terminus");
15
+ const health_executor_service_1 = require("../service/health-executor.service");
16
+ function createHealthController(paths) {
17
+ let HealthController = class HealthController {
18
+ constructor(executor) {
19
+ this.executor = executor;
20
+ }
21
+ live() {
22
+ return this.executor.runLiveness();
23
+ }
24
+ ready() {
25
+ return this.executor.runReadiness();
26
+ }
27
+ };
28
+ __decorate([
29
+ (0, common_1.Get)(paths.livenessPath),
30
+ (0, terminus_1.HealthCheck)(),
31
+ __metadata("design:type", Function),
32
+ __metadata("design:paramtypes", []),
33
+ __metadata("design:returntype", void 0)
34
+ ], HealthController.prototype, "live", null);
35
+ __decorate([
36
+ (0, common_1.Get)(paths.readinessPath),
37
+ (0, terminus_1.HealthCheck)(),
38
+ __metadata("design:type", Function),
39
+ __metadata("design:paramtypes", []),
40
+ __metadata("design:returntype", void 0)
41
+ ], HealthController.prototype, "ready", null);
42
+ HealthController = __decorate([
43
+ (0, common_1.Controller)(),
44
+ __metadata("design:paramtypes", [health_executor_service_1.HealthExecutorService])
45
+ ], HealthController);
46
+ return HealthController;
47
+ }
48
+ //# sourceMappingURL=health.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../lib/controller/health.controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAcA,wDAsBC;AApCD,2CAAuD;AACvD,+CAA+C;AAC/C,gFAA2E;AAY3E,SAAgB,sBAAsB,CAAC,KAGtC;IACC,IACM,gBAAgB,GADtB,MACM,gBAAgB;QACpB,YAA6B,QAA+B;YAA/B,aAAQ,GAAR,QAAQ,CAAuB;QAAG,CAAC;QAIhE,IAAI;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC;QAID,KAAK;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC;KACF,CAAA;IATC;QAFC,IAAA,YAAG,EAAC,KAAK,CAAC,YAAY,CAAC;QACvB,IAAA,sBAAW,GAAE;;;;gDAGb;IAID;QAFC,IAAA,YAAG,EAAC,KAAK,CAAC,aAAa,CAAC;QACxB,IAAA,sBAAW,GAAE;;;;iDAGb;IAbG,gBAAgB;QADrB,IAAA,mBAAU,GAAE;yCAE4B,+CAAqB;OADxD,gBAAgB,CAcrB;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './health.controller';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./health.controller"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/controller/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
@@ -0,0 +1,6 @@
1
+ export * from './constant';
2
+ export * from './interface';
3
+ export * from './indicator';
4
+ export * from './service';
5
+ export * from './controller';
6
+ export * from './module';
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constant"), exports);
18
+ __exportStar(require("./interface"), exports);
19
+ __exportStar(require("./indicator"), exports);
20
+ __exportStar(require("./service"), exports);
21
+ __exportStar(require("./controller"), exports);
22
+ __exportStar(require("./module"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,4CAA0B;AAC1B,+CAA6B;AAC7B,2CAAyB"}
@@ -0,0 +1,20 @@
1
+ import { HealthIndicatorService } from '@nestjs/terminus';
2
+ export interface CacheHealthSource {
3
+ isHealthy(): Promise<{
4
+ healthy: boolean;
5
+ connections?: unknown[];
6
+ }>;
7
+ }
8
+ export declare const DEFAULT_CACHE_KEY = "cache";
9
+ type TerminusResult = {
10
+ [k: string]: {
11
+ status: 'up' | 'down';
12
+ };
13
+ };
14
+ export declare class CacheHealthCheck {
15
+ private readonly healthIndicatorService;
16
+ private readonly source?;
17
+ constructor(healthIndicatorService: HealthIndicatorService, source?: CacheHealthSource);
18
+ isHealthy(key?: string): Promise<TerminusResult>;
19
+ }
20
+ export {};
@@ -0,0 +1,50 @@
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.CacheHealthCheck = exports.DEFAULT_CACHE_KEY = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const terminus_1 = require("@nestjs/terminus");
18
+ const health_constants_1 = require("../constant/health.constants");
19
+ exports.DEFAULT_CACHE_KEY = 'cache';
20
+ let CacheHealthCheck = class CacheHealthCheck {
21
+ constructor(healthIndicatorService, source) {
22
+ this.healthIndicatorService = healthIndicatorService;
23
+ this.source = source;
24
+ }
25
+ async isHealthy(key = exports.DEFAULT_CACHE_KEY) {
26
+ const indicator = this.healthIndicatorService.check(key);
27
+ if (!this.source) {
28
+ return indicator.down({ reason: 'source not provided' });
29
+ }
30
+ try {
31
+ const result = await this.source.isHealthy();
32
+ const details = { connections: result.connections };
33
+ return result.healthy
34
+ ? indicator.up(details)
35
+ : indicator.down(details);
36
+ }
37
+ catch (err) {
38
+ const message = err instanceof Error ? err.message : String(err);
39
+ return indicator.down({ error: message });
40
+ }
41
+ }
42
+ };
43
+ exports.CacheHealthCheck = CacheHealthCheck;
44
+ exports.CacheHealthCheck = CacheHealthCheck = __decorate([
45
+ (0, common_1.Injectable)(),
46
+ __param(1, (0, common_1.Optional)()),
47
+ __param(1, (0, common_1.Inject)(health_constants_1.CACHE_HEALTH_SOURCE)),
48
+ __metadata("design:paramtypes", [terminus_1.HealthIndicatorService, Object])
49
+ ], CacheHealthCheck);
50
+ //# sourceMappingURL=cache-health.check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-health.check.js","sourceRoot":"","sources":["../../lib/indicator/cache-health.check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,+CAA0D;AAC1D,mEAAmE;AAYtD,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAkBlC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,sBAA8C,EAG9C,MAA0B;QAH1B,2BAAsB,GAAtB,sBAAsB,CAAwB;QAG9C,WAAM,GAAN,MAAM,CAAoB;IAC1C,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,MAAc,yBAAiB;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAA8B,CAAC;QACxF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;YACpD,OAAO,MAAM,CAAC,OAAO;gBACnB,CAAC,CAAE,SAAS,CAAC,EAAE,CAAC,OAAO,CAA+B;gBACtD,CAAC,CAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAA+B,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAA8B,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,sCAAmB,CAAC,CAAA;qCAFa,iCAAsB;GAFtD,gBAAgB,CA0B5B"}
@@ -0,0 +1,13 @@
1
+ import { HealthIndicatorService } from '@nestjs/terminus';
2
+ import type { HealthIndicatorSource, HealthNormalize } from '../interface/health-indicator.interface';
3
+ export declare class GenericHealthCheck<TResult = unknown> {
4
+ private readonly healthIndicatorService;
5
+ private readonly source?;
6
+ private readonly normalize?;
7
+ constructor(healthIndicatorService: HealthIndicatorService, source?: HealthIndicatorSource<TResult>, normalize?: HealthNormalize<TResult>);
8
+ isHealthy(key?: string): Promise<{
9
+ [k: string]: {
10
+ status: 'up' | 'down';
11
+ };
12
+ }>;
13
+ }
@@ -0,0 +1,51 @@
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.GenericHealthCheck = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const terminus_1 = require("@nestjs/terminus");
18
+ let GenericHealthCheck = class GenericHealthCheck {
19
+ constructor(healthIndicatorService, source, normalize) {
20
+ this.healthIndicatorService = healthIndicatorService;
21
+ this.source = source;
22
+ this.normalize = normalize;
23
+ }
24
+ async isHealthy(key = 'generic') {
25
+ if (!this.source || !this.normalize) {
26
+ const session = this.healthIndicatorService.check(key);
27
+ return session.down();
28
+ }
29
+ let result;
30
+ try {
31
+ result = await this.source.isHealthy();
32
+ }
33
+ catch (err) {
34
+ return this.healthIndicatorService
35
+ .check(key)
36
+ .down({ error: err instanceof Error ? err.message : String(err) });
37
+ }
38
+ const isUp = this.normalize(result);
39
+ return isUp
40
+ ? this.healthIndicatorService.check(key).up()
41
+ : this.healthIndicatorService.check(key).down();
42
+ }
43
+ };
44
+ exports.GenericHealthCheck = GenericHealthCheck;
45
+ exports.GenericHealthCheck = GenericHealthCheck = __decorate([
46
+ (0, common_1.Injectable)(),
47
+ __param(1, (0, common_1.Optional)()),
48
+ __param(2, (0, common_1.Optional)()),
49
+ __metadata("design:paramtypes", [terminus_1.HealthIndicatorService, Object, Function])
50
+ ], GenericHealthCheck);
51
+ //# sourceMappingURL=generic-health.check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-health.check.js","sourceRoot":"","sources":["../../lib/indicator/generic-health.check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsD;AACtD,+CAA0D;AAcnD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACmB,sBAA8C,EAClC,MAAuC,EACvC,SAAoC;QAFhD,2BAAsB,GAAtB,sBAAsB,CAAwB;QAClC,WAAM,GAAN,MAAM,CAAiC;QACvC,cAAS,GAAT,SAAS,CAA2B;IAChE,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,SAAS;QAC7B,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvD,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,sBAAsB;iBAC/B,KAAK,CAAC,GAAG,CAAC;iBACV,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,IAAI;YACT,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE;YAC7C,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;CACF,CAAA;AA3BY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAF8B,iCAAsB;GAFtD,kBAAkB,CA2B9B"}
@@ -0,0 +1,4 @@
1
+ export * from './cache-health.check';
2
+ export * from './generic-health.check';
3
+ export * from './prisma-health.check';
4
+ export * from './queue-health.check';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./cache-health.check"), exports);
18
+ __exportStar(require("./generic-health.check"), exports);
19
+ __exportStar(require("./prisma-health.check"), exports);
20
+ __exportStar(require("./queue-health.check"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/indicator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,yDAAuC;AACvC,wDAAsC;AACtC,uDAAqC"}
@@ -0,0 +1,20 @@
1
+ import { HealthIndicatorService } from '@nestjs/terminus';
2
+ export interface PrismaHealthSource {
3
+ isHealthy(): Promise<{
4
+ status: 'up' | 'down';
5
+ message?: string;
6
+ }>;
7
+ }
8
+ export declare const DEFAULT_PRISMA_KEY = "prisma";
9
+ type TerminusResult = {
10
+ [k: string]: {
11
+ status: 'up' | 'down';
12
+ };
13
+ };
14
+ export declare class PrismaHealthCheck {
15
+ private readonly healthIndicatorService;
16
+ private readonly source?;
17
+ constructor(healthIndicatorService: HealthIndicatorService, source?: PrismaHealthSource);
18
+ isHealthy(key?: string): Promise<TerminusResult>;
19
+ }
20
+ export {};
@@ -0,0 +1,53 @@
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.PrismaHealthCheck = exports.DEFAULT_PRISMA_KEY = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const terminus_1 = require("@nestjs/terminus");
18
+ const health_constants_1 = require("../constant/health.constants");
19
+ exports.DEFAULT_PRISMA_KEY = 'prisma';
20
+ let PrismaHealthCheck = class PrismaHealthCheck {
21
+ constructor(healthIndicatorService, source) {
22
+ this.healthIndicatorService = healthIndicatorService;
23
+ this.source = source;
24
+ }
25
+ async isHealthy(key = exports.DEFAULT_PRISMA_KEY) {
26
+ const indicator = this.healthIndicatorService.check(key);
27
+ if (!this.source) {
28
+ return indicator.down({ reason: 'source not provided' });
29
+ }
30
+ try {
31
+ const result = await this.source.isHealthy();
32
+ const details = {};
33
+ if (result.message !== undefined) {
34
+ details.message = result.message;
35
+ }
36
+ return result.status === 'up'
37
+ ? indicator.up(details)
38
+ : indicator.down(details);
39
+ }
40
+ catch (err) {
41
+ const message = err instanceof Error ? err.message : String(err);
42
+ return indicator.down({ error: message });
43
+ }
44
+ }
45
+ };
46
+ exports.PrismaHealthCheck = PrismaHealthCheck;
47
+ exports.PrismaHealthCheck = PrismaHealthCheck = __decorate([
48
+ (0, common_1.Injectable)(),
49
+ __param(1, (0, common_1.Optional)()),
50
+ __param(1, (0, common_1.Inject)(health_constants_1.PRISMA_HEALTH_SOURCE)),
51
+ __metadata("design:paramtypes", [terminus_1.HealthIndicatorService, Object])
52
+ ], PrismaHealthCheck);
53
+ //# sourceMappingURL=prisma-health.check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma-health.check.js","sourceRoot":"","sources":["../../lib/indicator/prisma-health.check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,+CAA0D;AAC1D,mEAAoE;AAYvD,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAepC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YACmB,sBAA8C,EAG9C,MAA2B;QAH3B,2BAAsB,GAAtB,sBAAsB,CAAwB;QAG9C,WAAM,GAAN,MAAM,CAAqB;IAC3C,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,MAAc,0BAAkB;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAA8B,CAAC;QACxF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAyB,EAAE,CAAC;YACzC,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;YACnC,CAAC;YACD,OAAO,MAAM,CAAC,MAAM,KAAK,IAAI;gBAC3B,CAAC,CAAE,SAAS,CAAC,EAAE,CAAC,OAAO,CAA+B;gBACtD,CAAC,CAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAA+B,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAA8B,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAA;AA7BY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,uCAAoB,CAAC,CAAA;qCAFY,iCAAsB;GAFtD,iBAAiB,CA6B7B"}
@@ -0,0 +1,22 @@
1
+ import { HealthIndicatorService } from '@nestjs/terminus';
2
+ export interface QueueHealthSource {
3
+ isHealthy(): Promise<{
4
+ healthy: boolean;
5
+ provider: string;
6
+ connections: unknown[];
7
+ latencyMs?: number;
8
+ }>;
9
+ }
10
+ export declare const DEFAULT_QUEUE_KEY = "queue";
11
+ type TerminusResult = {
12
+ [k: string]: {
13
+ status: 'up' | 'down';
14
+ };
15
+ };
16
+ export declare class QueueHealthCheck {
17
+ private readonly healthIndicatorService;
18
+ private readonly source?;
19
+ constructor(healthIndicatorService: HealthIndicatorService, source?: QueueHealthSource);
20
+ isHealthy(key?: string): Promise<TerminusResult>;
21
+ }
22
+ export {};
@@ -0,0 +1,56 @@
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.QueueHealthCheck = exports.DEFAULT_QUEUE_KEY = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const terminus_1 = require("@nestjs/terminus");
18
+ const health_constants_1 = require("../constant/health.constants");
19
+ exports.DEFAULT_QUEUE_KEY = 'queue';
20
+ let QueueHealthCheck = class QueueHealthCheck {
21
+ constructor(healthIndicatorService, source) {
22
+ this.healthIndicatorService = healthIndicatorService;
23
+ this.source = source;
24
+ }
25
+ async isHealthy(key = exports.DEFAULT_QUEUE_KEY) {
26
+ const indicator = this.healthIndicatorService.check(key);
27
+ if (!this.source) {
28
+ return indicator.down({ reason: 'source not provided' });
29
+ }
30
+ try {
31
+ const result = await this.source.isHealthy();
32
+ const details = {
33
+ provider: result.provider,
34
+ connections: result.connections,
35
+ };
36
+ if (result.latencyMs !== undefined) {
37
+ details.latencyMs = result.latencyMs;
38
+ }
39
+ return result.healthy
40
+ ? indicator.up(details)
41
+ : indicator.down(details);
42
+ }
43
+ catch (err) {
44
+ const message = err instanceof Error ? err.message : String(err);
45
+ return indicator.down({ error: message });
46
+ }
47
+ }
48
+ };
49
+ exports.QueueHealthCheck = QueueHealthCheck;
50
+ exports.QueueHealthCheck = QueueHealthCheck = __decorate([
51
+ (0, common_1.Injectable)(),
52
+ __param(1, (0, common_1.Optional)()),
53
+ __param(1, (0, common_1.Inject)(health_constants_1.QUEUE_HEALTH_SOURCE)),
54
+ __metadata("design:paramtypes", [terminus_1.HealthIndicatorService, Object])
55
+ ], QueueHealthCheck);
56
+ //# sourceMappingURL=queue-health.check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-health.check.js","sourceRoot":"","sources":["../../lib/indicator/queue-health.check.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,+CAA0D;AAC1D,mEAAmE;AAiBtD,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAgBlC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,sBAA8C,EAG9C,MAA0B;QAH1B,2BAAsB,GAAtB,sBAAsB,CAAwB;QAG9C,WAAM,GAAN,MAAM,CAAoB;IAC1C,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,MAAc,yBAAiB;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAA8B,CAAC;QACxF,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC7C,MAAM,OAAO,GAIT;gBACF,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC;YACF,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBACnC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;YACvC,CAAC;YACD,OAAO,MAAM,CAAC,OAAO;gBACnB,CAAC,CAAE,SAAS,CAAC,EAAE,CAAC,OAAO,CAA+B;gBACtD,CAAC,CAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAA+B,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAA8B,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAA;AApCY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,sCAAmB,CAAC,CAAA;qCAFa,iCAAsB;GAFtD,gBAAgB,CAoC5B"}
@@ -0,0 +1,4 @@
1
+ export interface HealthIndicatorSource<TResult = unknown> {
2
+ isHealthy(): PromiseLike<TResult> | TResult;
3
+ }
4
+ export type HealthNormalize<TResult = unknown> = (result: TResult) => boolean;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=health-indicator.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-indicator.interface.js","sourceRoot":"","sources":["../../lib/interface/health-indicator.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import type { Type } from '@nestjs/common';
2
+ export interface HealthControllerOptions {
3
+ livenessPath?: string;
4
+ readinessPath?: string;
5
+ }
6
+ export type ResolvedHealthControllerOptions = false | {
7
+ livenessPath: string;
8
+ readinessPath: string;
9
+ };
10
+ export declare function resolveHealthControllerOptions(controller?: false | HealthControllerOptions): ResolvedHealthControllerOptions;
11
+ export interface HealthModuleOptions {
12
+ controller?: false | HealthControllerOptions;
13
+ liveness?: Type<unknown>[];
14
+ readiness?: Type<unknown>[];
15
+ }
16
+ export declare const HEALTH_MODULE_OPTIONS = "HEALTH_MODULE_OPTIONS";
17
+ export interface HealthAsyncModuleOptions {
18
+ controller?: false | HealthControllerOptions;
19
+ useFactory?: (...args: unknown[]) => Promise<HealthModuleOptions> | HealthModuleOptions;
20
+ inject?: unknown[];
21
+ imports?: unknown[];
22
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HEALTH_MODULE_OPTIONS = void 0;
4
+ exports.resolveHealthControllerOptions = resolveHealthControllerOptions;
5
+ const health_constants_1 = require("../constant/health.constants");
6
+ function resolveHealthControllerOptions(controller) {
7
+ if (controller === false) {
8
+ return false;
9
+ }
10
+ const livenessPath = (controller === null || controller === void 0 ? void 0 : controller.livenessPath) && controller.livenessPath.trim().length > 0
11
+ ? controller.livenessPath
12
+ : health_constants_1.DEFAULT_LIVENESS_PATH;
13
+ const readinessPath = (controller === null || controller === void 0 ? void 0 : controller.readinessPath) && controller.readinessPath.trim().length > 0
14
+ ? controller.readinessPath
15
+ : health_constants_1.DEFAULT_READINESS_PATH;
16
+ return { livenessPath, readinessPath };
17
+ }
18
+ exports.HEALTH_MODULE_OPTIONS = 'HEALTH_MODULE_OPTIONS';
19
+ //# sourceMappingURL=health-module-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health-module-options.interface.js","sourceRoot":"","sources":["../../lib/interface/health-module-options.interface.ts"],"names":[],"mappings":";;;AAgCA,wEAiBC;AAhDD,mEAGsC;AA4BtC,SAAgB,8BAA8B,CAC5C,UAA4C;IAE5C,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,YAAY,GAChB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,YAAY,KAAI,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACnE,CAAC,CAAC,UAAU,CAAC,YAAY;QACzB,CAAC,CAAC,wCAAqB,CAAC;IAC5B,MAAM,aAAa,GACjB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,KAAI,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACrE,CAAC,CAAC,UAAU,CAAC,aAAa;QAC1B,CAAC,CAAC,yCAAsB,CAAC;IAE7B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACzC,CAAC;AAgBY,QAAA,qBAAqB,GAAG,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './health-indicator.interface';
2
+ export * from './health-module-options.interface';