@checkstack/maintenance-common 0.3.2 → 0.4.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,22 @@
1
1
  # @checkstack/maintenance-common
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 18fa8e3: Add notification suppression toggle for maintenance windows
8
+
9
+ **New Feature:** When creating or editing a maintenance window, you can now enable "Suppress health notifications" to prevent health status change notifications from being sent for affected systems while the maintenance is active (in_progress status). This is useful for planned downtime where health alerts are expected and would otherwise create noise.
10
+
11
+ **Changes:**
12
+
13
+ - Added `suppressNotifications` field to maintenance schema
14
+ - Added new service-to-service API `hasActiveMaintenanceWithSuppression`
15
+ - Healthcheck queue executor now checks for suppression before sending notifications
16
+ - MaintenanceEditor UI includes new toggle checkbox
17
+
18
+ **Bug Fix:** Fixed migration system to correctly set PostgreSQL search_path when running plugin migrations. Previously, migrations could fail with "relation does not exist" errors because the schema context wasn't properly set.
19
+
3
20
  ## 0.3.2
4
21
 
5
22
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/maintenance-common",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -25,7 +25,7 @@ export const maintenanceContract = {
25
25
  status: MaintenanceStatusEnum.optional(),
26
26
  systemId: z.string().optional(),
27
27
  })
28
- .optional()
28
+ .optional(),
29
29
  )
30
30
  .output(z.object({ maintenances: z.array(MaintenanceWithSystemsSchema) })),
31
31
 
@@ -60,9 +60,9 @@ export const maintenanceContract = {
60
60
  z.object({
61
61
  maintenances: z.record(
62
62
  z.string(),
63
- z.array(MaintenanceWithSystemsSchema)
63
+ z.array(MaintenanceWithSystemsSchema),
64
64
  ),
65
- })
65
+ }),
66
66
  ),
67
67
 
68
68
  /** Create a new maintenance */
@@ -109,6 +109,18 @@ export const maintenanceContract = {
109
109
  })
110
110
  .input(z.object({ id: z.string() }))
111
111
  .output(z.object({ success: z.boolean() })),
112
+
113
+ /** Check if a system has active maintenance with notification suppression enabled.
114
+ * Used by healthcheck to skip notifications during expected downtime.
115
+ * Service-to-service endpoint (not exposed to users).
116
+ */
117
+ hasActiveMaintenanceWithSuppression: proc({
118
+ operationType: "query",
119
+ userType: "service",
120
+ access: [],
121
+ })
122
+ .input(z.object({ systemId: z.string() }))
123
+ .output(z.object({ suppressed: z.boolean() })),
112
124
  };
113
125
 
114
126
  // Export contract type
@@ -118,5 +130,5 @@ export type MaintenanceContract = typeof maintenanceContract;
118
130
  // Use: const client = rpcApi.forPlugin(MaintenanceApi);
119
131
  export const MaintenanceApi = createClientDefinition(
120
132
  maintenanceContract,
121
- pluginMetadata
133
+ pluginMetadata,
122
134
  );
package/src/schemas.ts CHANGED
@@ -18,6 +18,7 @@ export const MaintenanceSchema = z.object({
18
18
  id: z.string(),
19
19
  title: z.string(),
20
20
  description: z.string().optional(),
21
+ suppressNotifications: z.boolean(),
21
22
  status: MaintenanceStatusEnum,
22
23
  startAt: z.date(),
23
24
  endAt: z.date(),
@@ -62,6 +63,7 @@ export const CreateMaintenanceInputSchema = z
62
63
  .object({
63
64
  title: z.string().min(1, "Title is required"),
64
65
  description: z.string().optional(),
66
+ suppressNotifications: z.boolean().optional().default(false),
65
67
  startAt: z.date(),
66
68
  endAt: z.date(),
67
69
  systemIds: z.array(z.string()).min(1, "At least one system is required"),
@@ -78,6 +80,7 @@ export const UpdateMaintenanceInputSchema = z.object({
78
80
  id: z.string(),
79
81
  title: z.string().min(1).optional(),
80
82
  description: z.string().nullable().optional(),
83
+ suppressNotifications: z.boolean().optional(),
81
84
  startAt: z.date().optional(),
82
85
  endAt: z.date().optional(),
83
86
  systemIds: z.array(z.string()).min(1).optional(),