@tsed/terminus 7.0.0-beta.3 → 7.0.0-beta.4
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/lib/cjs/TerminusModule.js +11 -11
- package/lib/cjs/TerminusModule.js.map +1 -1
- package/lib/cjs/index.js +8 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/interfaces.js +3 -0
- package/lib/cjs/interfaces/interfaces.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/esm/index.js +8 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/interfaces.js +2 -0
- package/lib/esm/interfaces/interfaces.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/types/index.d.ts +6 -2
- package/lib/types/interfaces/{index.d.ts → interfaces.d.ts} +0 -1
- package/package.json +23 -12
- package/readme.md +26 -24
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/interfaces/index.js +0 -5
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -2
- package/lib/esm/interfaces/index.js.map +0 -1
|
@@ -4,8 +4,8 @@ exports.TerminusModule = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const terminus_1 = require("@godaddy/terminus");
|
|
6
6
|
const di_1 = require("@tsed/di");
|
|
7
|
-
const https_1 =
|
|
8
|
-
const http_1 =
|
|
7
|
+
const https_1 = tslib_1.__importDefault(require("https"));
|
|
8
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
9
9
|
let TerminusModule = class TerminusModule {
|
|
10
10
|
$onInit() {
|
|
11
11
|
this.mount();
|
|
@@ -55,23 +55,23 @@ let TerminusModule = class TerminusModule {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
tslib_1.__decorate([
|
|
59
59
|
(0, di_1.Configuration)(),
|
|
60
|
-
|
|
60
|
+
tslib_1.__metadata("design:type", Object)
|
|
61
61
|
], TerminusModule.prototype, "configuration", void 0);
|
|
62
|
-
|
|
62
|
+
tslib_1.__decorate([
|
|
63
63
|
(0, di_1.Inject)(),
|
|
64
|
-
|
|
64
|
+
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
65
65
|
], TerminusModule.prototype, "injector", void 0);
|
|
66
|
-
|
|
66
|
+
tslib_1.__decorate([
|
|
67
67
|
(0, di_1.Inject)(http_1.default.Server),
|
|
68
|
-
|
|
68
|
+
tslib_1.__metadata("design:type", Object)
|
|
69
69
|
], TerminusModule.prototype, "httpServer", void 0);
|
|
70
|
-
|
|
70
|
+
tslib_1.__decorate([
|
|
71
71
|
(0, di_1.Inject)(https_1.default.Server),
|
|
72
|
-
|
|
72
|
+
tslib_1.__metadata("design:type", Object)
|
|
73
73
|
], TerminusModule.prototype, "httpsServer", void 0);
|
|
74
|
-
TerminusModule =
|
|
74
|
+
TerminusModule = tslib_1.__decorate([
|
|
75
75
|
(0, di_1.Module)()
|
|
76
76
|
], TerminusModule);
|
|
77
77
|
exports.TerminusModule = TerminusModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerminusModule.js","sourceRoot":"","sources":["../../src/TerminusModule.ts"],"names":[],"mappings":";;;;AAAA,gDAAiD;AACjD,iCAAgF;AAChF
|
|
1
|
+
{"version":3,"file":"TerminusModule.js","sourceRoot":"","sources":["../../src/TerminusModule.ts"],"names":[],"mappings":";;;;AAAA,gDAAiD;AACjD,iCAAgF;AAChF,0DAA0B;AAC1B,wDAAwB;AAGxB,IAAa,cAAc,GAA3B,MAAa,cAAc;IAalB,OAAO;QACZ,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAEO,KAAK;QACX,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,aAAa,CAAC;QACtC,MAAM,cAAc,GAAG;YACrB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAa;YACnC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE;YAC/B,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;YACvC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC;YAC3C,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC;YACnD,2BAA2B,EAAE,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC;YAC7E,GAAG,QAAQ;SACZ,CAAC;QAEF,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAA,yBAAc,EAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;SACjD;QAED,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAA,yBAAc,EAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;SAClD;IACH,CAAC;IAEO,YAAY,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtD,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,QAAQ,CAAC,IAAY;QAC3B,OAAO,IAAI,CAAC,QAAQ;aACjB,YAAY,EAAE;aACd,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAClB,IAAI,EAAE,CAAC;IACZ,CAAC;IAEO,UAAU;QAChB,MAAM,OAAO,GAAsC,EAAE,CAAC;QAEtD,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC3D,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;IAEO,YAAY,CAAC,IAAY;QAC/B,OAAO,KAAK,IAAI,EAAE;YAChB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AAnEC;IADC,IAAA,kBAAa,GAAE;;qDACqB;AAGrC;IADC,IAAA,WAAM,GAAE;sCACS,oBAAe;gDAAC;AAGlC;IADC,IAAA,WAAM,EAAC,cAAI,CAAC,MAAM,CAAC;;kDACmB;AAGvC;IADC,IAAA,WAAM,EAAC,eAAK,CAAC,MAAM,CAAC;;mDACoB;AAX9B,cAAc;IAD1B,IAAA,WAAM,GAAE;GACI,cAAc,CAqE1B;AArEY,wCAAc","sourcesContent":["import {createTerminus} from \"@godaddy/terminus\";\nimport {Configuration, Inject, InjectorService, Module, OnInit} from \"@tsed/di\";\nimport Https from \"https\";\nimport Http from \"http\";\n\n@Module()\nexport class TerminusModule implements OnInit {\n @Configuration()\n private configuration: Configuration;\n\n @Inject()\n private injector: InjectorService;\n\n @Inject(Http.Server)\n private httpServer: Http.Server | null;\n\n @Inject(Https.Server)\n private httpsServer: Https.Server | null;\n\n public $onInit() {\n this.mount();\n }\n\n private mount() {\n const {terminus} = this.configuration;\n const terminusConfig = {\n logger: this.injector.logger as any,\n healthChecks: this.getHealths(),\n onSignal: this.execShutdown(\"onSignal\"),\n onShutdown: this.execShutdown(\"onShutdown\"),\n beforeShutdown: this.execShutdown(\"beforeShutdown\"),\n onSendFailureDuringShutdown: this.execShutdown(\"onSendFailureDuringShutdown\"),\n ...terminus\n };\n\n if (this.httpServer) {\n createTerminus(this.httpServer, terminusConfig);\n }\n\n if (this.httpsServer) {\n createTerminus(this.httpsServer, terminusConfig);\n }\n }\n\n private getProviders(name: string) {\n return this.injector.getProviders().filter((provider) => {\n return provider.store.get(name);\n });\n }\n\n private getStore(name: string) {\n return this.injector\n .getProviders()\n .map((provider) => provider.store.get(name))\n .filter((x) => !!x)\n .flat();\n }\n\n private getHealths() {\n const healths: {[k: string]: () => Promise<any>} = {};\n\n this.getProviders(\"terminus\").forEach((provider) => {\n Object.keys(provider.store.get(\"terminus\")).forEach((name) => {\n healths[`${provider.path}${name}`] = provider.store.get(\"terminus\")[name];\n });\n });\n\n return healths;\n }\n\n private execShutdown(name: string) {\n return async () => {\n this.getStore(name).forEach((func) => func());\n };\n }\n}\n"]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
tslib_1.__exportStar(require("./TerminusModule"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./decorators/health"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./decorators/shutdown"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./interfaces/TerminusSettings"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./interfaces/interfaces"), exports);
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/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;;GAEG;;;AAEH,2DAAiC;AACjC,8DAAoC;AACpC,gEAAsC;AACtC,wEAA8C;AAC9C,kEAAwC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./TerminusModule\";\nexport * from \"./decorators/health\";\nexport * from \"./decorators/shutdown\";\nexport * from \"./interfaces/TerminusSettings\";\nexport * from \"./interfaces/interfaces\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {TerminusSettings} from \"./TerminusSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n terminus: TerminusSettings;\n }\n }\n}\n"]}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./TerminusModule";
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./TerminusModule.js";
|
|
5
|
+
export * from "./decorators/health.js";
|
|
6
|
+
export * from "./decorators/shutdown.js";
|
|
7
|
+
export * from "./interfaces/TerminusSettings.js";
|
|
8
|
+
export * from "./interfaces/interfaces.js";
|
|
5
9
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./TerminusModule\";\nexport * from \"./decorators/health\";\nexport * from \"./decorators/shutdown\";\nexport * from \"./interfaces/TerminusSettings\";\nexport * from \"./interfaces/interfaces\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {TerminusSettings} from \"./TerminusSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n terminus: TerminusSettings;\n }\n }\n}\n"]}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./TerminusModule";
|
|
1
5
|
export * from "./decorators/health";
|
|
2
6
|
export * from "./decorators/shutdown";
|
|
3
|
-
export * from "./interfaces";
|
|
4
|
-
export * from "./
|
|
7
|
+
export * from "./interfaces/TerminusSettings";
|
|
8
|
+
export * from "./interfaces/interfaces";
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/terminus",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.4",
|
|
4
4
|
"description": "Adds graceful shutdown and Kubernetes readiness / liveness checks for any HTTP applications.",
|
|
5
5
|
"author": "Romain Lenzotti",
|
|
6
6
|
"private": false,
|
|
7
7
|
"source": "./src/index.ts",
|
|
8
8
|
"main": "./lib/cjs/index.js",
|
|
9
|
+
"module": "./lib/esm/index.js",
|
|
9
10
|
"typings": "./lib/types/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
"types": "./lib/types/index.d.ts",
|
|
@@ -14,31 +15,41 @@
|
|
|
14
15
|
"default": "./lib/esm/index.js"
|
|
15
16
|
},
|
|
16
17
|
"scripts": {
|
|
17
|
-
"build": "yarn run build:esm && yarn run build:cjs",
|
|
18
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
18
19
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
19
20
|
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
21
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
20
22
|
"start": "ts-node -r tsconfig-paths/register test/app/index.ts"
|
|
21
23
|
},
|
|
22
24
|
"dependencies": {
|
|
23
25
|
"@godaddy/terminus": "^4.7.1",
|
|
24
|
-
"tslib": "2.
|
|
26
|
+
"tslib": "2.3.1"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"@tsed/core": "7.0.0-beta.
|
|
28
|
-
"@tsed/di": "7.0.0-beta.
|
|
29
|
-
"@tsed/
|
|
30
|
-
"@tsed/schema": "7.0.0-beta.3"
|
|
29
|
+
"@tsed/core": "7.0.0-beta.4",
|
|
30
|
+
"@tsed/di": "7.0.0-beta.4",
|
|
31
|
+
"@tsed/schema": "7.0.0-beta.4"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"@tsed/core": "^7.0.0-beta.
|
|
34
|
-
"@tsed/di": "^7.0.0-beta.
|
|
35
|
-
"@tsed/
|
|
36
|
-
|
|
34
|
+
"@tsed/core": "^7.0.0-beta.4",
|
|
35
|
+
"@tsed/di": "^7.0.0-beta.4",
|
|
36
|
+
"@tsed/schema": "^7.0.0-beta.4"
|
|
37
|
+
},
|
|
38
|
+
"peerDependenciesMeta": {
|
|
39
|
+
"@tsed/core": {
|
|
40
|
+
"optional": false
|
|
41
|
+
},
|
|
42
|
+
"@tsed/di": {
|
|
43
|
+
"optional": false
|
|
44
|
+
},
|
|
45
|
+
"@tsed/schema": {
|
|
46
|
+
"optional": false
|
|
47
|
+
}
|
|
37
48
|
},
|
|
38
49
|
"repository": "https://github.com/tsedio/tsed",
|
|
39
50
|
"bugs": {
|
|
40
51
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
41
52
|
},
|
|
42
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
53
|
+
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/third-parties/terminus",
|
|
43
54
|
"license": "MIT"
|
|
44
55
|
}
|
package/readme.md
CHANGED
|
@@ -43,10 +43,8 @@ Then import `@tsed/terminus` and add the following configuration in your `Server
|
|
|
43
43
|
import {Configuration} from "@tsed/common";
|
|
44
44
|
import "@tsed/terminus"; // import terminus Ts.ED module
|
|
45
45
|
import {resolve} from "path";
|
|
46
|
-
const rootDir = resolve(__dirname);
|
|
47
46
|
|
|
48
47
|
@Configuration({
|
|
49
|
-
rootDir,
|
|
50
48
|
terminus: {
|
|
51
49
|
// ... see Terminus configuration options on https://github.com/godaddy/terminus
|
|
52
50
|
}
|
|
@@ -59,27 +57,28 @@ export class Server {}
|
|
|
59
57
|
`terminus` configuration options waiting the same option description in the official Terminus documentation [here](https://github.com/godaddy/terminus).
|
|
60
58
|
The following the options are managed by the `@tsed/terminus` package:
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
- healthChecks
|
|
61
|
+
- onSignal
|
|
62
|
+
- onSendFailureDuringShutdown
|
|
63
|
+
- onShutdown
|
|
64
|
+
- beforeShutdown
|
|
65
|
+
- onSigterm
|
|
68
66
|
|
|
69
67
|
```typescript
|
|
70
68
|
export type TerminusSettings = Omit<
|
|
71
|
-
TerminusOptions,
|
|
72
|
-
"healthChecks" | "onSignal" | "onSendFailureDuringShutdown" | "onShutdown" | "beforeShutdown" | "onSigterm"
|
|
69
|
+
TerminusOptions,
|
|
70
|
+
"healthChecks" | "onSignal" | "onSendFailureDuringShutdown" | "onShutdown" | "beforeShutdown" | "onSigterm"
|
|
73
71
|
>;
|
|
74
72
|
```
|
|
75
73
|
|
|
76
74
|
## Usage
|
|
75
|
+
|
|
77
76
|
### Readiness / liveness checks
|
|
78
77
|
|
|
79
78
|
To create a readiness / liveness checks use the `@Health` decorator.
|
|
80
79
|
|
|
81
80
|
```ts
|
|
82
|
-
import {
|
|
81
|
+
import {Health} from "@tsed/terminus";
|
|
83
82
|
|
|
84
83
|
@Controller("/mongo")
|
|
85
84
|
class MongoCtrl {
|
|
@@ -91,27 +90,29 @@ class MongoCtrl {
|
|
|
91
90
|
}
|
|
92
91
|
```
|
|
93
92
|
|
|
94
|
-
You can also create an
|
|
93
|
+
You can also create an `HealthCheckError` when an error appear during your check.
|
|
95
94
|
|
|
96
95
|
```ts
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
96
|
+
import {Health} from "@tsed/terminus";
|
|
97
|
+
import {HealthCheckError} from "@godaddy/terminus";
|
|
99
98
|
|
|
100
99
|
@Controller("/redis")
|
|
101
100
|
class Redis {
|
|
102
101
|
@Health("/health")
|
|
103
102
|
health() {
|
|
104
103
|
// Here check the redis health
|
|
105
|
-
return Promise.reject(
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
return Promise.reject(
|
|
105
|
+
new HealthCheckError("failed", {
|
|
106
|
+
redis: "down"
|
|
107
|
+
})
|
|
108
|
+
);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
```
|
|
111
112
|
|
|
112
113
|
### Graceful shutdown
|
|
113
114
|
|
|
114
|
-
`@tsed/terminus` package give some decorators to handle Terminus hooks. These hooks allow you to adds graceful shutdown.
|
|
115
|
+
`@tsed/terminus` package give some decorators to handle Terminus hooks. These hooks allow you to adds graceful shutdown.
|
|
115
116
|
Here is the list of decorators:
|
|
116
117
|
|
|
117
118
|
- `BeforeShutdown`: Use this hook if you deploy your application with Kubernetes (see more details [here](https://github.com/godaddy/terminus#how-to-set-terminus-up-with-kubernetes)),
|
|
@@ -120,34 +121,36 @@ Here is the list of decorators:
|
|
|
120
121
|
- `OnSendFailureDuringShutdown`: called before sending each 503 during shutdowns.
|
|
121
122
|
|
|
122
123
|
**Example:**
|
|
124
|
+
|
|
123
125
|
```typescript
|
|
124
|
-
import {
|
|
126
|
+
import {BeforeShutdown, OnSendFailureDuringShutdown, OnShutdown, OnSignal} from "@tsed/terminus";
|
|
125
127
|
|
|
126
128
|
@Controller("/redis")
|
|
127
129
|
class RedisCtrl {
|
|
128
130
|
@BeforeShutdown()
|
|
129
131
|
beforeShutdow() {
|
|
130
|
-
console.log(
|
|
132
|
+
console.log("called before shutdown");
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
@OnSignal()
|
|
134
136
|
OnSignal() {
|
|
135
|
-
console.log(
|
|
137
|
+
console.log("called on signal");
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
@OnShutdown()
|
|
139
141
|
OnShutdown() {
|
|
140
|
-
console.log(
|
|
142
|
+
console.log("called on shutdown");
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
@OnSendFailureDuringShutdown()
|
|
144
146
|
OnSendFailureDuringShutdown() {
|
|
145
|
-
console.log(
|
|
147
|
+
console.log("on send failure during shutdown");
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
```
|
|
149
151
|
|
|
150
152
|
## Contributors
|
|
153
|
+
|
|
151
154
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html).
|
|
152
155
|
|
|
153
156
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
@@ -158,7 +161,6 @@ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com
|
|
|
158
161
|
|
|
159
162
|
<a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
|
|
160
163
|
|
|
161
|
-
|
|
162
164
|
## Sponsors
|
|
163
165
|
|
|
164
166
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
|
|
@@ -8,16 +8,5 @@
|
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"declarationDir": "./lib/types"
|
|
10
10
|
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"test",
|
|
14
|
-
"lib",
|
|
15
|
-
"benchmark",
|
|
16
|
-
"coverage",
|
|
17
|
-
"spec",
|
|
18
|
-
"**/*.benchmark.ts",
|
|
19
|
-
"**/*.spec.ts",
|
|
20
|
-
"keys",
|
|
21
|
-
"jest.config.js"
|
|
22
|
-
]
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
23
12
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAUA,kEAAmC","sourcesContent":["import {TerminusSettings} from \"./TerminusSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n terminus: TerminusSettings;\n }\n }\n}\n\nexport * from \"./TerminusSettings\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAUA,cAAc,oBAAoB,CAAC","sourcesContent":["import {TerminusSettings} from \"./TerminusSettings\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n terminus: TerminusSettings;\n }\n }\n}\n\nexport * from \"./TerminusSettings\";\n"]}
|