@checkstack/healthcheck-common 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # @checkstack/healthcheck-common
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d6f7449: Add availability statistics display to HealthCheckSystemOverview
8
+
9
+ - New `getAvailabilityStats` RPC endpoint that calculates availability percentages for 31-day and 365-day periods
10
+ - Availability is calculated as `(healthyRuns / totalRuns) * 100`
11
+ - Data is sourced from both daily aggregates and recent raw runs to include the most up-to-date information
12
+ - Frontend displays availability stats with color-coded badges (green ≥99.9%, yellow ≥99%, red <99%)
13
+ - Shows total run counts for each period
14
+
15
+ ## 0.7.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 1f81b60: ### Clickable Run History with Deep Linking
20
+
21
+ **Backend (`healthcheck-backend`):**
22
+
23
+ - Added `getRunById` service method to fetch a single health check run by ID
24
+
25
+ **Schema (`healthcheck-common`):**
26
+
27
+ - Added `getRunById` RPC procedure for fetching individual runs
28
+ - Added `historyRun` route for deep linking to specific runs (`/history/:systemId/:configurationId/:runId`)
29
+
30
+ **Frontend (`healthcheck-frontend`):**
31
+
32
+ - Table rows in Recent Runs and Run History now navigate to detailed view instead of expanding inline
33
+ - Added "Selected Run" card that displays when navigating to a specific run
34
+ - Extracted `ExpandedResultView` into reusable component
35
+ - Fixed layout shift during table pagination by preserving previous data while loading
36
+ - Removed accordion expansion in favor of consistent navigation UX
37
+
38
+ ### Patch Changes
39
+
40
+ - 090143b: ### Health Check Aggregation & UI Fixes
41
+
42
+ **Backend (`healthcheck-backend`):**
43
+
44
+ - Fixed tail-end bucket truncation where the last aggregated bucket was cut off at the interval boundary instead of extending to the query end date
45
+ - Added `rangeEnd` parameter to `reaggregateBuckets()` to properly extend the last bucket
46
+ - Fixed cross-tier merge logic (`mergeTieredBuckets`) to prevent hourly aggregates from blocking fresh raw data
47
+
48
+ **Schema (`healthcheck-common`):**
49
+
50
+ - Added `bucketEnd` field to `AggregatedBucketBaseSchema` so frontends know the actual end time of each bucket
51
+
52
+ **Frontend (`healthcheck-frontend`):**
53
+
54
+ - Updated all components to use `bucket.bucketEnd` instead of calculating from `bucketIntervalSeconds`
55
+ - Fixed aggregation mode detection: changed `>` to `>=` so 7-day queries use aggregated data when `rawRetentionDays` is 7
56
+ - Added ref-based memoization in `useHealthCheckData` to prevent layout shift during signal-triggered refetches
57
+ - Exposed `isFetching` state to show loading spinner during background refetches
58
+ - Added debounced custom date range with Apply button to prevent fetching on every field change
59
+ - Added validation preventing start date >= end date in custom ranges
60
+ - Added sparkline downsampling: when there are 60+ data points, they are aggregated into buckets with informative tooltips
61
+
62
+ **UI (`ui`):**
63
+
64
+ - Fixed `DateRangeFilter` presets to use true sliding windows (removed `startOfDay` from 7-day and 30-day ranges)
65
+ - Added `disabled` prop to `DateRangeFilter` and `DateTimePicker` components
66
+ - Added `onCustomChange` prop to `DateRangeFilter` for debounced custom date handling
67
+ - Improved layout: custom date pickers now inline with preset buttons on desktop
68
+ - Added responsive mobile layout: date pickers stack vertically with down arrow
69
+ - Added validation error display for invalid date ranges
70
+
3
71
  ## 0.6.0
4
72
 
5
73
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/healthcheck-common",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/routes.ts CHANGED
@@ -7,4 +7,5 @@ export const healthcheckRoutes = createRoutes("healthcheck", {
7
7
  config: "/config",
8
8
  history: "/history",
9
9
  historyDetail: "/history/:systemId/:configurationId",
10
+ historyRun: "/history/:systemId/:configurationId/:runId",
10
11
  });
@@ -222,6 +222,7 @@ export const healthCheckContract = {
222
222
  endDate: z.date().optional(),
223
223
  limit: z.number().optional().default(10),
224
224
  offset: z.number().optional().default(0),
225
+ sortOrder: z.enum(["asc", "desc"]),
225
226
  }),
226
227
  )
227
228
  .output(
@@ -244,6 +245,7 @@ export const healthCheckContract = {
244
245
  endDate: z.date().optional(),
245
246
  limit: z.number().optional().default(10),
246
247
  offset: z.number().optional().default(0),
248
+ sortOrder: z.enum(["asc", "desc"]),
247
249
  }),
248
250
  )
249
251
  .output(
@@ -253,6 +255,18 @@ export const healthCheckContract = {
253
255
  }),
254
256
  ),
255
257
 
258
+ getRunById: proc({
259
+ operationType: "query",
260
+ userType: "authenticated",
261
+ access: [healthCheckAccess.details],
262
+ })
263
+ .input(
264
+ z.object({
265
+ runId: z.string(),
266
+ }),
267
+ )
268
+ .output(HealthCheckRunSchema.optional()),
269
+
256
270
  getAggregatedHistory: proc({
257
271
  operationType: "query",
258
272
  userType: "public",
@@ -349,8 +363,27 @@ export const healthCheckContract = {
349
363
  ),
350
364
  }),
351
365
  ),
352
- };
353
366
 
367
+ getAvailabilityStats: proc({
368
+ operationType: "query",
369
+ userType: "public",
370
+ access: [healthCheckAccess.status],
371
+ })
372
+ .input(
373
+ z.object({
374
+ systemId: z.string(),
375
+ configurationId: z.string(),
376
+ }),
377
+ )
378
+ .output(
379
+ z.object({
380
+ availability31Days: z.number().nullable(),
381
+ availability365Days: z.number().nullable(),
382
+ totalRuns31Days: z.number(),
383
+ totalRuns365Days: z.number(),
384
+ }),
385
+ ),
386
+ };
354
387
  // Export contract type
355
388
  export type HealthCheckContract = typeof healthCheckContract;
356
389
 
package/src/schemas.ts CHANGED
@@ -280,6 +280,8 @@ export const DEFAULT_RETENTION_CONFIG: RetentionConfig = {
280
280
  */
281
281
  export const AggregatedBucketBaseSchema = z.object({
282
282
  bucketStart: z.date(),
283
+ /** Actual end time of this bucket (may differ from start + interval for the last bucket) */
284
+ bucketEnd: z.date(),
283
285
  /** @deprecated Use bucketIntervalSeconds instead. Kept for backward compatibility. */
284
286
  bucketSize: z.enum(["hourly", "daily"]).optional(),
285
287
  /** Bucket interval in seconds (e.g., 7 for 7-second buckets) */