-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
114 lines (98 loc) · 2.1 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* @adonisjs/health
*
* (c) AdonisJS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
export type HealthCheckResult = {
/**
* A summary of the check result
*/
message: string
/**
* The status of the check.
*/
status: 'ok' | 'warning' | 'error'
/**
* Date/time when this check was completed
*/
finishedAt: Date
/**
* An meta-data associated with the check
*/
meta?: Record<string, any>
}
/**
* The health check report generated by the health check
* runner
*/
export type HealthCheckReport = {
/**
* Is the entire report healthy. The value will be set to
* false when one or more of the checks has a status or
* "error"
*/
isHealthy: boolean
/**
* Status of the entire report.
*
* - Set to "ok" when all checks have ok status
* - Set to "warning" when one or more checks have warning status
* - Set to "error" when one or more checks have error status
*/
status: 'ok' | 'warning' | 'error'
/**
* The date/time when the entire report was computed
*/
finishedAt: Date
/**
* The debugging info for the running process
*/
debugInfo: {
/**
* The process id
*/
pid: number
/**
* The process id for the parent process (if any)
*/
ppid?: number
/**
* The number of seconds for which the process has been
* running.
*/
uptime: number
/**
* Node.js version
*/
version: string
/**
* The platform on which the application is running
*/
platform: string
}
/**
* Perform checks and their report
*/
checks: ({ isCached: boolean; name: string } & HealthCheckResult)[]
}
/**
* Health checks must adhere to the HealthCheckContract
*/
export interface HealthCheckContract {
/**
* A unique name for the check
*/
name: string
/**
* Whether to cache the results or not. The value must be
* specified in seconds
*/
cacheDuration?: number
/**
* The method to execute to perform the check
*/
run(): Promise<HealthCheckResult>
}