@tsed/terminus 6.102.0 → 6.102.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/terminus",
3
- "version": "6.102.0",
3
+ "version": "6.102.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,
@@ -24,17 +24,12 @@
24
24
  "tslib": "2.2.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@tsed/core": "6.102.0",
28
- "@tsed/di": "6.102.0",
29
- "@tsed/openspec": "6.102.0",
30
- "@tsed/schema": "6.102.0"
31
- },
32
- "peerDependencies": {
33
- "@tsed/core": "^6.102.0",
34
- "@tsed/di": "^6.102.0",
35
- "@tsed/openspec": "^6.102.0",
36
- "@tsed/schema": "^6.102.0"
27
+ "@tsed/core": "6.102.4",
28
+ "@tsed/di": "6.102.4",
29
+ "@tsed/openspec": "6.102.4",
30
+ "@tsed/schema": "6.102.4"
37
31
  },
32
+ "peerDependencies": {},
38
33
  "repository": "https://github.com/tsedio/tsed",
39
34
  "bugs": {
40
35
  "url": "https://github.com/tsedio/tsed/issues"
package/readme.md CHANGED
@@ -59,27 +59,28 @@ export class Server {}
59
59
  `terminus` configuration options waiting the same option description in the official Terminus documentation [here](https://github.com/godaddy/terminus).
60
60
  The following the options are managed by the `@tsed/terminus` package:
61
61
 
62
- - healthChecks
63
- - onSignal
64
- - onSendFailureDuringShutdown
65
- - onShutdown
66
- - beforeShutdown
67
- - onSigterm
62
+ - healthChecks
63
+ - onSignal
64
+ - onSendFailureDuringShutdown
65
+ - onShutdown
66
+ - beforeShutdown
67
+ - onSigterm
68
68
 
69
69
  ```typescript
70
70
  export type TerminusSettings = Omit<
71
- TerminusOptions,
72
- "healthChecks" | "onSignal" | "onSendFailureDuringShutdown" | "onShutdown" | "beforeShutdown" | "onSigterm"
71
+ TerminusOptions,
72
+ "healthChecks" | "onSignal" | "onSendFailureDuringShutdown" | "onShutdown" | "beforeShutdown" | "onSigterm"
73
73
  >;
74
74
  ```
75
75
 
76
76
  ## Usage
77
+
77
78
  ### Readiness / liveness checks
78
79
 
79
80
  To create a readiness / liveness checks use the `@Health` decorator.
80
81
 
81
82
  ```ts
82
- import { Health } from "@tsed/terminus";
83
+ import {Health} from "@tsed/terminus";
83
84
 
84
85
  @Controller("/mongo")
85
86
  class MongoCtrl {
@@ -91,27 +92,29 @@ class MongoCtrl {
91
92
  }
92
93
  ```
93
94
 
94
- You can also create an ``HealthCheckError`` when an error appear during your check.
95
+ You can also create an `HealthCheckError` when an error appear during your check.
95
96
 
96
97
  ```ts
97
- import { Health } from "@tsed/terminus";
98
- import { HealthCheckError } from "@godaddy/terminus";
98
+ import {Health} from "@tsed/terminus";
99
+ import {HealthCheckError} from "@godaddy/terminus";
99
100
 
100
101
  @Controller("/redis")
101
102
  class Redis {
102
103
  @Health("/health")
103
104
  health() {
104
105
  // Here check the redis health
105
- return Promise.reject(new HealthCheckError('failed', {
106
- redis: 'down',
107
- }));
106
+ return Promise.reject(
107
+ new HealthCheckError("failed", {
108
+ redis: "down"
109
+ })
110
+ );
108
111
  }
109
112
  }
110
113
  ```
111
114
 
112
115
  ### Graceful shutdown
113
116
 
114
- `@tsed/terminus` package give some decorators to handle Terminus hooks. These hooks allow you to adds graceful shutdown.
117
+ `@tsed/terminus` package give some decorators to handle Terminus hooks. These hooks allow you to adds graceful shutdown.
115
118
  Here is the list of decorators:
116
119
 
117
120
  - `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 +123,36 @@ Here is the list of decorators:
120
123
  - `OnSendFailureDuringShutdown`: called before sending each 503 during shutdowns.
121
124
 
122
125
  **Example:**
126
+
123
127
  ```typescript
124
- import { BeforeShutdown, OnSendFailureDuringShutdown, OnShutdown, OnSignal } from "@tsed/terminus";
128
+ import {BeforeShutdown, OnSendFailureDuringShutdown, OnShutdown, OnSignal} from "@tsed/terminus";
125
129
 
126
130
  @Controller("/redis")
127
131
  class RedisCtrl {
128
132
  @BeforeShutdown()
129
133
  beforeShutdow() {
130
- console.log('called before shutdown');
134
+ console.log("called before shutdown");
131
135
  }
132
136
 
133
137
  @OnSignal()
134
138
  OnSignal() {
135
- console.log('called on signal');
139
+ console.log("called on signal");
136
140
  }
137
141
 
138
142
  @OnShutdown()
139
143
  OnShutdown() {
140
- console.log('called on shutdown');
144
+ console.log("called on shutdown");
141
145
  }
142
146
 
143
147
  @OnSendFailureDuringShutdown()
144
148
  OnSendFailureDuringShutdown() {
145
- console.log('on send failure during shutdown');
149
+ console.log("on send failure during shutdown");
146
150
  }
147
151
  }
148
152
  ```
149
153
 
150
154
  ## Contributors
155
+
151
156
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html).
152
157
 
153
158
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
@@ -158,7 +163,6 @@ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com
158
163
 
159
164
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
160
165
 
161
-
162
166
  ## Sponsors
163
167
 
164
168
  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
  }