@seas-computing/nestjs-healthcheck 0.0.5-0 → 0.0.5-10
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/dist/src/constants.d.ts +4 -0
- package/dist/src/constants.js +9 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/healthcheck.controller.d.ts +5 -2
- package/dist/src/healthcheck.controller.js +14 -7
- package/dist/src/healthcheck.controller.js.map +1 -1
- package/dist/src/healthcheck.module-definition.d.ts +2 -0
- package/dist/src/healthcheck.module-definition.js +7 -0
- package/dist/src/healthcheck.module-definition.js.map +1 -0
- package/dist/src/healthcheck.module.d.ts +2 -2
- package/dist/src/healthcheck.module.js +6 -5
- package/dist/src/healthcheck.module.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +5 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/types/ConfigServiceInterface.d.ts +1 -0
- package/dist/src/types/ConfigServiceInterface.js +2 -0
- package/dist/src/types/ConfigServiceInterface.js.map +1 -1
- package/dist/src/types/healthcheckModuleOptions.d.ts +9 -0
- package/dist/src/types/healthcheckModuleOptions.js +4 -0
- package/dist/src/types/healthcheckModuleOptions.js.map +1 -0
- package/package.json +3 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HEALTH_STRATEGY_NAME = void 0;
|
|
4
|
+
var HEALTH_STRATEGY_NAME;
|
|
5
|
+
(function (HEALTH_STRATEGY_NAME) {
|
|
6
|
+
HEALTH_STRATEGY_NAME["HEALTHCHECK"] = "HealthcheckStrategy";
|
|
7
|
+
HEALTH_STRATEGY_NAME["DEV"] = "DevStrategy";
|
|
8
|
+
})(HEALTH_STRATEGY_NAME || (exports.HEALTH_STRATEGY_NAME = HEALTH_STRATEGY_NAME = {}));
|
|
9
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAGA,IAAY,oBAkBX;AAlBD,WAAY,oBAAoB;IAI9B,2DAAmC,CAAA;IAanC,2CAAmB,CAAA;AACrB,CAAC,EAlBW,oBAAoB,oCAApB,oBAAoB,QAkB/B"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { HealthCheckService, HealthCheckResult, HttpHealthIndicator } from '@nestjs/terminus';
|
|
1
|
+
import { HealthCheckService, TypeOrmHealthIndicator, HealthCheckResult, HttpHealthIndicator } from '@nestjs/terminus';
|
|
2
|
+
import { ConfigServiceInterface } from './types/ConfigServiceInterface';
|
|
2
3
|
import { RedisHealthService } from './RedisHealthService';
|
|
3
4
|
export declare class HealthCheckController {
|
|
5
|
+
private config;
|
|
4
6
|
private health;
|
|
7
|
+
private db;
|
|
5
8
|
private http;
|
|
6
9
|
private redisHealth;
|
|
7
|
-
constructor(health: HealthCheckService, http: HttpHealthIndicator, redisHealth: RedisHealthService);
|
|
10
|
+
constructor(config: ConfigServiceInterface, health: HealthCheckService, db: TypeOrmHealthIndicator, http: HttpHealthIndicator, redisHealth: RedisHealthService);
|
|
8
11
|
getHealthCheck(): Promise<HealthCheckResult & {
|
|
9
12
|
version: string;
|
|
10
13
|
}>;
|
|
@@ -16,21 +16,25 @@ exports.HealthCheckController = void 0;
|
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const swagger_1 = require("@nestjs/swagger");
|
|
18
18
|
const terminus_1 = require("@nestjs/terminus");
|
|
19
|
+
const ConfigServiceInterface_1 = require("./types/ConfigServiceInterface");
|
|
19
20
|
const RedisHealthService_1 = require("./RedisHealthService");
|
|
20
21
|
let HealthCheckController = class HealthCheckController {
|
|
21
|
-
constructor(health, http, redisHealth) {
|
|
22
|
+
constructor(config, health, db, http, redisHealth) {
|
|
23
|
+
this.config = config;
|
|
22
24
|
this.health = health;
|
|
25
|
+
this.db = db;
|
|
23
26
|
this.http = http;
|
|
24
27
|
this.redisHealth = redisHealth;
|
|
25
28
|
}
|
|
26
29
|
async getHealthCheck() {
|
|
27
30
|
const status = await this.health.check([
|
|
28
|
-
() => this.
|
|
31
|
+
() => this.db.pingCheck('database'),
|
|
32
|
+
() => this.http.pingCheck('harvard-key', `${this.config.casBaseURL}/cas/logout`),
|
|
29
33
|
async () => this.redisHealth.checkRedisConnection(),
|
|
30
34
|
]);
|
|
31
35
|
return {
|
|
32
36
|
...status,
|
|
33
|
-
version:
|
|
37
|
+
version: this.config.buildVersion,
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
};
|
|
@@ -52,10 +56,13 @@ __decorate([
|
|
|
52
56
|
exports.HealthCheckController = HealthCheckController = __decorate([
|
|
53
57
|
(0, swagger_1.ApiTags)('Health Check'),
|
|
54
58
|
(0, common_1.Controller)('health-check'),
|
|
55
|
-
__param(0, (0, common_1.Inject)(
|
|
56
|
-
__param(1, (0, common_1.Inject)(terminus_1.
|
|
57
|
-
__param(2, (0, common_1.Inject)(
|
|
58
|
-
|
|
59
|
+
__param(0, (0, common_1.Inject)(ConfigServiceInterface_1.CONFIG_SERVICE)),
|
|
60
|
+
__param(1, (0, common_1.Inject)(terminus_1.HealthCheckService)),
|
|
61
|
+
__param(2, (0, common_1.Inject)(terminus_1.TypeOrmHealthIndicator)),
|
|
62
|
+
__param(3, (0, common_1.Inject)(terminus_1.HttpHealthIndicator)),
|
|
63
|
+
__param(4, (0, common_1.Inject)(RedisHealthService_1.RedisHealthService)),
|
|
64
|
+
__metadata("design:paramtypes", [Object, terminus_1.HealthCheckService,
|
|
65
|
+
terminus_1.TypeOrmHealthIndicator,
|
|
59
66
|
terminus_1.HttpHealthIndicator,
|
|
60
67
|
RedisHealthService_1.RedisHealthService])
|
|
61
68
|
], HealthCheckController);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthcheck.controller.js","sourceRoot":"","sources":["../../src/healthcheck.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyD;AACzD,6CAAuE;AACvE,+
|
|
1
|
+
{"version":3,"file":"healthcheck.controller.js","sourceRoot":"","sources":["../../src/healthcheck.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyD;AACzD,6CAAuE;AACvE,+CAAmI;AACnI,2EAAwF;AACxF,6DAA0D;AAInD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAEhC,YACkC,MAA8B,EAC1B,MAA0B,EACtB,EAA0B,EAC7B,IAAyB,EAC1B,WAA+B;QAJnC,WAAM,GAAN,MAAM,CAAwB;QAC1B,WAAM,GAAN,MAAM,CAAoB;QACtB,OAAE,GAAF,EAAE,CAAwB;QAC7B,SAAI,GAAJ,IAAI,CAAqB;QAC1B,gBAAW,GAAX,WAAW,CAAoB;IAClE,CAAC;IAcS,AAAN,KAAK,CAAC,cAAc;QAEzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACrC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC;YACnC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CACvB,aAAa,EACb,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,aAAa,CACvC;YACD,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,EAAE;SACpD,CACA,CAAC;QACF,OAAO;YACL,GAAG,MAAM;YACT,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;SAClC,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,sDAAqB;AAsBnB;IATZ,IAAA,YAAG,EAAC,GAAG,CAAC;IACR,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,sDAAsD;KAChE,CAAC;IACD,IAAA,uBAAa,EAAC;QACb,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,KAAK;KACf,CAAC;IACD,IAAA,sBAAW,GAAE;;;;2DAgBb;gCArCU,qBAAqB;IAFjC,IAAA,iBAAO,EAAC,cAAc,CAAC;IACvB,IAAA,mBAAU,EAAC,cAAc,CAAC;IAItB,WAAA,IAAA,eAAM,EAAC,uCAAc,CAAC,CAAA;IACtB,WAAA,IAAA,eAAM,EAAC,6BAAkB,CAAC,CAAA;IAC1B,WAAA,IAAA,eAAM,EAAC,iCAAsB,CAAC,CAAA;IAC9B,WAAA,IAAA,eAAM,EAAC,8BAAmB,CAAC,CAAA;IAC3B,WAAA,IAAA,eAAM,EAAC,uCAAkB,CAAC,CAAA;6CAHiB,6BAAkB;QAClB,iCAAsB;QACvB,8BAAmB;QACb,uCAAkB;GAP1D,qBAAqB,CAsCjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = void 0;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
_a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN;
|
|
7
|
+
//# sourceMappingURL=healthcheck.module-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healthcheck.module-definition.js","sourceRoot":"","sources":["../../src/healthcheck.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAO9C,KAGT,IAAI,kCAAyB,EAA4B,CAAC,KAAK,EAAE,EAFnE,+BAAuB,+BACvB,4BAAoB,2BACgD"}
|
|
@@ -6,17 +6,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.HealthcheckModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const terminus_1 = require("@nestjs/terminus");
|
|
12
12
|
const axios_1 = require("@nestjs/axios");
|
|
13
13
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
14
14
|
const healthcheck_controller_1 = require("./healthcheck.controller");
|
|
15
15
|
const RedisHealthService_1 = require("./RedisHealthService");
|
|
16
|
-
|
|
16
|
+
const healthcheck_module_definition_1 = require("./healthcheck.module-definition");
|
|
17
|
+
let HealthcheckModule = class HealthcheckModule extends healthcheck_module_definition_1.ConfigurableModuleClass {
|
|
17
18
|
};
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
19
|
+
exports.HealthcheckModule = HealthcheckModule;
|
|
20
|
+
exports.HealthcheckModule = HealthcheckModule = __decorate([
|
|
20
21
|
(0, common_1.Module)({
|
|
21
22
|
imports: [
|
|
22
23
|
terminus_1.TerminusModule,
|
|
@@ -26,5 +27,5 @@ exports.HealthCheckModule = HealthCheckModule = __decorate([
|
|
|
26
27
|
controllers: [healthcheck_controller_1.HealthCheckController],
|
|
27
28
|
providers: [RedisHealthService_1.RedisHealthService],
|
|
28
29
|
})
|
|
29
|
-
],
|
|
30
|
+
], HealthcheckModule);
|
|
30
31
|
//# sourceMappingURL=healthcheck.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"healthcheck.module.js","sourceRoot":"","sources":["../../src/healthcheck.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAClD,yCAA2C;AAC3C,6CAAgD;AAChD,qEAAiE;AACjE,6DAA0D;
|
|
1
|
+
{"version":3,"file":"healthcheck.module.js","sourceRoot":"","sources":["../../src/healthcheck.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAClD,yCAA2C;AAC3C,6CAAgD;AAChD,qEAAiE;AACjE,6DAA0D;AAC1D,mFAA0E;AAYnE,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,uDAAuB;CAAG,CAAA;AAApD,8CAAiB;4BAAjB,iBAAiB;IAV7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yBAAc;YACd,kBAAU;YACV,uBAAa,CAAC,UAAU,CAAC,EAAE,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,8CAAqB,CAAC;QACpC,SAAS,EAAE,CAAC,uCAAkB,CAAC;KAChC,CAAC;GAEW,iBAAiB,CAAmC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { HealthcheckModule } from './healthcheck.module';
|
|
2
2
|
export * from './healthcheck.controller';
|
|
3
3
|
export * from './RedisHealthService';
|
|
4
4
|
export * from './types/ConfigServiceInterface';
|
|
5
|
+
export * from './types/healthcheckModuleOptions';
|
|
6
|
+
export * from './constants';
|
package/dist/src/index.js
CHANGED
|
@@ -14,8 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
exports.HealthcheckModule = void 0;
|
|
18
|
+
var healthcheck_module_1 = require("./healthcheck.module");
|
|
19
|
+
Object.defineProperty(exports, "HealthcheckModule", { enumerable: true, get: function () { return healthcheck_module_1.HealthcheckModule; } });
|
|
18
20
|
__exportStar(require("./healthcheck.controller"), exports);
|
|
19
21
|
__exportStar(require("./RedisHealthService"), exports);
|
|
20
22
|
__exportStar(require("./types/ConfigServiceInterface"), exports);
|
|
23
|
+
__exportStar(require("./types/healthcheckModuleOptions"), exports);
|
|
24
|
+
__exportStar(require("./constants"), exports);
|
|
21
25
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,2DAAyC;AACzC,uDAAqC;AACrC,iEAA+C;AAC/C,mEAAiD;AACjD,8CAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigServiceInterface.js","sourceRoot":"","sources":["../../../src/types/ConfigServiceInterface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ConfigServiceInterface.js","sourceRoot":"","sources":["../../../src/types/ConfigServiceInterface.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|
2
|
+
import { HEALTH_STRATEGY_NAME } from '../constants';
|
|
3
|
+
export interface HealthcheckModuleOptions {
|
|
4
|
+
casBaseURL: string;
|
|
5
|
+
dbOptions: TypeOrmModuleOptions;
|
|
6
|
+
redisUrl: string;
|
|
7
|
+
version: string;
|
|
8
|
+
strategy: HEALTH_STRATEGY_NAME;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"healthcheckModuleOptions.js","sourceRoot":"","sources":["../../../src/types/healthcheckModuleOptions.ts"],"names":[],"mappings":";;AAYC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seas-computing/nestjs-healthcheck",
|
|
3
|
-
"version": "0.0.5-
|
|
3
|
+
"version": "0.0.5-10",
|
|
4
4
|
"description": "A standalone healthcheck module for NestJS apps",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -28,14 +28,11 @@
|
|
|
28
28
|
"@nestjs/core": "^10.4.15",
|
|
29
29
|
"@nestjs/swagger": "^7.1.16",
|
|
30
30
|
"@nestjs/terminus": "^10.0.0 || ^11.0.0",
|
|
31
|
-
"@nestjs/testing": "^10.1.0",
|
|
32
31
|
"@nestjs/typeorm": "^10.0.0 || ^11.0.0",
|
|
33
32
|
"ioredis": "^5.6.1",
|
|
34
33
|
"redis": "^4.7.0",
|
|
35
34
|
"reflect-metadata": "^0.1.13",
|
|
36
|
-
"
|
|
37
|
-
"typeorm": "^0.3.22",
|
|
38
|
-
"typescript": "^5.1.6"
|
|
35
|
+
"typeorm": "^0.3.22"
|
|
39
36
|
},
|
|
40
37
|
"devDependencies": {
|
|
41
38
|
"@nestjs/swagger": "^7.4.2",
|
|
@@ -48,6 +45,7 @@
|
|
|
48
45
|
"mocha": "^10.2.0",
|
|
49
46
|
"nyc": "^15.1.0",
|
|
50
47
|
"rimraf": "^6.0.1",
|
|
48
|
+
"sinon": "^20.0.0",
|
|
51
49
|
"ts-node": "^10.9.2",
|
|
52
50
|
"typescript": "^5.8.3"
|
|
53
51
|
}
|