File tree 3 files changed +22
-8
lines changed
3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* @deprecated
3
- * This class has been deprecated and will be removed in the next major release.
3
+ * ** This class has been deprecated and will be removed in the next major release.**
4
4
* Instead utilise the `HealthIndicatorService` to indicate the health of your health indicator.
5
+ *
6
+ * @see {@link https://docs.nestjs.com/migration-guide#terminus-module|Migration Guide }
5
7
*/
6
8
export class HealthCheckError extends Error {
7
9
causes : any ;
Original file line number Diff line number Diff line change @@ -7,18 +7,23 @@ import { type HealthIndicatorResult } from './health-indicator-result.interface'
7
7
*/
8
8
@Injectable ( )
9
9
export class HealthIndicatorService {
10
- check < Key extends string > ( key : Key ) {
10
+ check < const Key extends string > ( key : Key ) {
11
11
return new HealthIndicatorSession ( key ) ;
12
12
}
13
13
}
14
14
15
15
type AdditionalData = Record < string , unknown > ;
16
16
17
+ /**
18
+ * Indicate the health of a health indicator with the given key
19
+ *
20
+ * @publicApi
21
+ */
17
22
export class HealthIndicatorSession < Key extends Readonly < string > = string > {
18
23
constructor ( private readonly key : Key ) { }
19
24
20
25
/**
21
- * Mark the health indicator as down
26
+ * Mark the health indicator as ` down`
22
27
* @param data additional data which will get appended to the result object
23
28
*/
24
29
down < T extends AdditionalData > (
@@ -49,6 +54,10 @@ export class HealthIndicatorSession<Key extends Readonly<string> = string> {
49
54
} as Record < Key , typeof detail > ;
50
55
}
51
56
57
+ /**
58
+ * Mark the health indicator as `up`
59
+ * @param data additional data which will get appended to the result object
60
+ */
52
61
up < T extends AdditionalData > ( data ?: T ) : HealthIndicatorResult < Key , 'up' , T > ;
53
62
up < T extends string > (
54
63
data ?: T ,
Original file line number Diff line number Diff line change @@ -10,13 +10,20 @@ export type HealthIndicatorFunction = () =>
10
10
| HealthIndicatorResult ;
11
11
12
12
/**
13
+ * @deprecated
14
+ * **This class has been deprecated and will be removed in the next major release.**
15
+ * Instead utilise the `HealthIndicatorService` to indicate the health of your health indicator.
16
+ *
17
+ * @see {@link https://docs.nestjs.com/migration-guide#terminus-module|Migration Guide }
18
+ *
19
+ * @description
13
20
* Represents an abstract health indicator
14
21
* with common functionalities
15
22
*
16
23
* A custom HealthIndicator should inherit the `HealthIndicator` class.
17
24
*
25
+ * @example
18
26
* ```typescript
19
- *
20
27
* class MyHealthIndicator extends HealthIndicator {
21
28
* public check(key: string) {
22
29
* // Replace with the actual check
@@ -26,11 +33,7 @@ export type HealthIndicatorFunction = () =>
26
33
* }
27
34
* }
28
35
* ```
29
- *
30
36
* @publicApi
31
- * @deprecated
32
- * This class has been deprecated and will be removed in the next major release.
33
- * Instead utilise the `HealthIndicatorService` to indicate the health of your health indicator.
34
37
*/
35
38
export abstract class HealthIndicator {
36
39
/**
You can’t perform that action at this time.
0 commit comments