@darco2903/pulse 1.0.0 → 1.1.0
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/README.md +2 -0
- package/dist/health.js +3 -2
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ The endpoint is public, so it only says whether each check passed. Why a check f
|
|
|
54
54
|
| `version` | required |
|
|
55
55
|
| `commit` | `$GIT_COMMIT`, then `git rev-parse --short HEAD` |
|
|
56
56
|
| `buildTime` | `$BUILD_TIME` |
|
|
57
|
+
|
|
58
|
+
`commit` and `buildTime` are left out of the report when they are unknown, so a Docker image built without the build args below only has the version and uptime.
|
|
57
59
|
| `path` | `/health` |
|
|
58
60
|
| `checks` | none |
|
|
59
61
|
| `timeout` | `2000` ms per check |
|
package/dist/health.js
CHANGED
|
@@ -66,8 +66,9 @@ export function createHealth(options) {
|
|
|
66
66
|
return {
|
|
67
67
|
status,
|
|
68
68
|
version: options.version,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
// Left out when unknown, rather than null
|
|
70
|
+
...(commit && { commit }),
|
|
71
|
+
...(buildTime && { buildTime }),
|
|
71
72
|
uptime: Math.floor(process.uptime()),
|
|
72
73
|
...(checks.length > 0 && {
|
|
73
74
|
checks: Object.fromEntries(checks.map(([name], i) => [name, results[i].ok ? "ok" : "fail"])),
|
package/dist/types.d.ts
CHANGED
|
@@ -32,8 +32,10 @@ export type HealthStatus = "ok" | "degraded" | "down";
|
|
|
32
32
|
export interface HealthReport {
|
|
33
33
|
status: HealthStatus;
|
|
34
34
|
version: string;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
/** Left out when unknown (no option, no $GIT_COMMIT and not in a git repository) */
|
|
36
|
+
commit?: string;
|
|
37
|
+
/** Left out when unknown (no option and no $BUILD_TIME) */
|
|
38
|
+
buildTime?: string;
|
|
37
39
|
/** In seconds */
|
|
38
40
|
uptime: number;
|
|
39
41
|
checks?: Record<string, "ok" | "fail">;
|