@checkstack/healthcheck-common 0.0.2 → 0.0.3
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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/zod-health-result.ts +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @checkstack/healthcheck-common
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cb82e4d: Improved `counter` and `pie` auto-chart types to show frequency distributions instead of just the latest value. Both chart types now count occurrences of each unique value across all runs/buckets, making them more intuitive for visualizing data like HTTP status codes.
|
|
8
|
+
|
|
9
|
+
Changed HTTP health check chart annotations: `statusCode` now uses `pie` chart (distribution view), `contentType` now uses `counter` chart (frequency count).
|
|
10
|
+
|
|
11
|
+
Fixed scrollbar hopping when health check signals update the accordion content. All charts now update silently without layout shift or loading state flicker.
|
|
12
|
+
|
|
13
|
+
Refactored health check visualization architecture:
|
|
14
|
+
|
|
15
|
+
- `HealthCheckStatusTimeline` and `HealthCheckLatencyChart` now accept `HealthCheckDiagramSlotContext` directly, handling data transformation internally
|
|
16
|
+
- `HealthCheckDiagram` refactored to accept context from parent, ensuring all visualizations share the same data source and update together on signals
|
|
17
|
+
- `HealthCheckSystemOverview` simplified to use `useHealthCheckData` hook for consolidated data fetching with automatic signal-driven refresh
|
|
18
|
+
|
|
19
|
+
Added `silentRefetch()` method to `usePagination` hook for background data refreshes without showing loading indicators.
|
|
20
|
+
|
|
21
|
+
Fixed `useSignal` hook to use a ref pattern internally, preventing stale closure issues. Callbacks now always access the latest values without requiring manual memoization or refs in consumer components.
|
|
22
|
+
|
|
23
|
+
Added signal handling to `useHealthCheckData` hook for automatic chart refresh when health check runs complete.
|
|
24
|
+
|
|
3
25
|
## 0.0.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/package.json
CHANGED
package/src/zod-health-result.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { z } from "zod";
|
|
|
10
10
|
* Numeric types:
|
|
11
11
|
* - line: Time series line chart for numeric metrics over time
|
|
12
12
|
* - bar: Bar chart for distributions (record of string to number)
|
|
13
|
+
* - pie: Pie chart for category distributions (record of string to number)
|
|
13
14
|
* - counter: Simple count display with trend indicator
|
|
14
15
|
* - gauge: Percentage gauge for rates/percentages (0-100)
|
|
15
16
|
*
|
|
@@ -21,6 +22,7 @@ import { z } from "zod";
|
|
|
21
22
|
export type ChartType =
|
|
22
23
|
| "line"
|
|
23
24
|
| "bar"
|
|
25
|
+
| "pie"
|
|
24
26
|
| "counter"
|
|
25
27
|
| "gauge"
|
|
26
28
|
| "boolean"
|
|
@@ -85,3 +87,41 @@ export function healthResultBoolean(meta: HealthResultMeta) {
|
|
|
85
87
|
schema.register(healthResultRegistry, meta);
|
|
86
88
|
return schema;
|
|
87
89
|
}
|
|
90
|
+
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// METADATA RETRIEVAL - For toJsonSchema integration
|
|
93
|
+
// ============================================================================
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Unwraps a Zod schema to get the inner schema, handling:
|
|
97
|
+
* - ZodOptional
|
|
98
|
+
* - ZodDefault
|
|
99
|
+
* - ZodNullable
|
|
100
|
+
*/
|
|
101
|
+
function unwrapSchema(schema: z.ZodTypeAny): z.ZodTypeAny {
|
|
102
|
+
let unwrapped = schema;
|
|
103
|
+
|
|
104
|
+
if (unwrapped instanceof z.ZodOptional) {
|
|
105
|
+
unwrapped = unwrapped.unwrap() as z.ZodTypeAny;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (unwrapped instanceof z.ZodDefault) {
|
|
109
|
+
unwrapped = unwrapped.def.innerType as z.ZodTypeAny;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (unwrapped instanceof z.ZodNullable) {
|
|
113
|
+
unwrapped = unwrapped.unwrap() as z.ZodTypeAny;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return unwrapped;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get health result metadata for a schema.
|
|
121
|
+
* Automatically unwraps Optional/Default/Nullable wrappers.
|
|
122
|
+
*/
|
|
123
|
+
export function getHealthResultMeta(
|
|
124
|
+
schema: z.ZodTypeAny
|
|
125
|
+
): HealthResultMeta | undefined {
|
|
126
|
+
return healthResultRegistry.get(unwrapSchema(schema));
|
|
127
|
+
}
|