@checkstack/healthcheck-common 0.4.0 → 0.4.2

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,25 @@
1
1
  # @checkstack/healthcheck-common
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 8a87cd4: Updated access rules to use new `accessPair` interface
8
+
9
+ Migrated to the new `accessPair` interface with per-level options objects for cleaner access rule definitions.
10
+
11
+ - Updated dependencies [8a87cd4]
12
+ - @checkstack/common@0.5.0
13
+ - @checkstack/signal-common@0.1.3
14
+
15
+ ## 0.4.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [83557c7]
20
+ - @checkstack/common@0.4.0
21
+ - @checkstack/signal-common@0.1.2
22
+
3
23
  ## 0.4.0
4
24
 
5
25
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/healthcheck-common",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/access.ts CHANGED
@@ -8,6 +8,9 @@ export const healthCheckAccess = {
8
8
  * Status-only access for viewing health check status.
9
9
  * Enabled by default for anonymous and authenticated users.
10
10
  * Uses system-level instance access for team-based filtering.
11
+ *
12
+ * Bulk endpoints should use the same access rule with instanceAccess
13
+ * override at the contract level.
11
14
  */
12
15
  status: access("healthcheck.status", "read", "View Health Check Status", {
13
16
  idParam: "systemId",
@@ -15,22 +18,12 @@ export const healthCheckAccess = {
15
18
  isPublic: true,
16
19
  }),
17
20
 
18
- /**
19
- * Bulk status access for viewing health check status for multiple systems.
20
- * Uses recordKey for filtering the output record by accessible system IDs.
21
- */
22
- bulkStatus: access("healthcheck.status", "read", "View Health Check Status", {
23
- recordKey: "statuses",
24
- isDefault: true,
25
- isPublic: true,
26
- }),
27
-
28
21
  /**
29
22
  * Configuration access for viewing and managing health check configurations.
30
23
  */
31
24
  configuration: accessPair("healthcheck", {
32
- read: "Read Health Check Configurations",
33
- manage: "Full management of Health Check Configurations",
25
+ read: { description: "Read Health Check Configurations" },
26
+ manage: { description: "Full management of Health Check Configurations" },
34
27
  }),
35
28
 
36
29
  /**
@@ -40,7 +33,7 @@ export const healthCheckAccess = {
40
33
  details: access(
41
34
  "healthcheck.details",
42
35
  "read",
43
- "View Detailed Health Check Run Data (Warning: This may expose sensitive data, depending on the health check strategy)"
36
+ "View Detailed Health Check Run Data (Warning: This may expose sensitive data, depending on the health check strategy)",
44
37
  ),
45
38
  };
46
39
 
@@ -67,7 +67,7 @@ export const healthCheckContract = {
67
67
  userType: "authenticated",
68
68
  access: [healthCheckAccess.configuration.read],
69
69
  }).output(
70
- z.object({ configurations: z.array(HealthCheckConfigurationSchema) })
70
+ z.object({ configurations: z.array(HealthCheckConfigurationSchema) }),
71
71
  ),
72
72
 
73
73
  createConfiguration: proc({
@@ -87,7 +87,7 @@ export const healthCheckContract = {
87
87
  z.object({
88
88
  id: z.string(),
89
89
  body: UpdateHealthCheckConfigurationSchema,
90
- })
90
+ }),
91
91
  )
92
92
  .output(HealthCheckConfigurationSchema),
93
93
 
@@ -124,8 +124,8 @@ export const healthCheckContract = {
124
124
  configurationName: z.string(),
125
125
  enabled: z.boolean(),
126
126
  stateThresholds: StateThresholdsSchema.optional(),
127
- })
128
- )
127
+ }),
128
+ ),
129
129
  ),
130
130
 
131
131
  associateSystem: proc({
@@ -137,7 +137,7 @@ export const healthCheckContract = {
137
137
  z.object({
138
138
  systemId: z.string(),
139
139
  body: AssociateHealthCheckSchema,
140
- })
140
+ }),
141
141
  )
142
142
  .output(z.void()),
143
143
 
@@ -150,7 +150,7 @@ export const healthCheckContract = {
150
150
  z.object({
151
151
  systemId: z.string(),
152
152
  configId: z.string(),
153
- })
153
+ }),
154
154
  )
155
155
  .output(z.void()),
156
156
 
@@ -167,12 +167,12 @@ export const healthCheckContract = {
167
167
  z.object({
168
168
  systemId: z.string(),
169
169
  configurationId: z.string(),
170
- })
170
+ }),
171
171
  )
172
172
  .output(
173
173
  z.object({
174
174
  retentionConfig: RetentionConfigSchema.nullable(),
175
- })
175
+ }),
176
176
  ),
177
177
 
178
178
  updateRetentionConfig: proc({
@@ -185,7 +185,7 @@ export const healthCheckContract = {
185
185
  systemId: z.string(),
186
186
  configurationId: z.string(),
187
187
  retentionConfig: RetentionConfigSchema.nullable(),
188
- })
188
+ }),
189
189
  )
190
190
  .output(z.void()),
191
191
 
@@ -206,13 +206,13 @@ export const healthCheckContract = {
206
206
  endDate: z.date().optional(),
207
207
  limit: z.number().optional().default(10),
208
208
  offset: z.number().optional().default(0),
209
- })
209
+ }),
210
210
  )
211
211
  .output(
212
212
  z.object({
213
213
  runs: z.array(HealthCheckRunPublicSchema),
214
214
  total: z.number(),
215
- })
215
+ }),
216
216
  ),
217
217
 
218
218
  getDetailedHistory: proc({
@@ -228,13 +228,13 @@ export const healthCheckContract = {
228
228
  endDate: z.date().optional(),
229
229
  limit: z.number().optional().default(10),
230
230
  offset: z.number().optional().default(0),
231
- })
231
+ }),
232
232
  )
233
233
  .output(
234
234
  z.object({
235
235
  runs: z.array(HealthCheckRunSchema),
236
236
  total: z.number(),
237
- })
237
+ }),
238
238
  ),
239
239
 
240
240
  getAggregatedHistory: proc({
@@ -249,12 +249,12 @@ export const healthCheckContract = {
249
249
  startDate: z.date(),
250
250
  endDate: z.date(),
251
251
  bucketSize: z.enum(["hourly", "daily", "auto"]),
252
- })
252
+ }),
253
253
  )
254
254
  .output(
255
255
  z.object({
256
256
  buckets: z.array(AggregatedBucketBaseSchema),
257
- })
257
+ }),
258
258
  ),
259
259
 
260
260
  getDetailedAggregatedHistory: proc({
@@ -269,12 +269,12 @@ export const healthCheckContract = {
269
269
  startDate: z.date(),
270
270
  endDate: z.date(),
271
271
  bucketSize: z.enum(["hourly", "daily", "auto"]),
272
- })
272
+ }),
273
273
  )
274
274
  .output(
275
275
  z.object({
276
276
  buckets: z.array(AggregatedBucketSchema),
277
- })
277
+ }),
278
278
  ),
279
279
 
280
280
  getSystemHealthStatus: proc({
@@ -288,13 +288,14 @@ export const healthCheckContract = {
288
288
  getBulkSystemHealthStatus: proc({
289
289
  operationType: "query",
290
290
  userType: "public",
291
- access: [healthCheckAccess.bulkStatus],
291
+ access: [healthCheckAccess.status],
292
+ instanceAccess: { recordKey: "statuses" },
292
293
  })
293
294
  .input(z.object({ systemIds: z.array(z.string()) }))
294
295
  .output(
295
296
  z.object({
296
297
  statuses: z.record(z.string(), SystemHealthStatusResponseSchema),
297
- })
298
+ }),
298
299
  ),
299
300
 
300
301
  getSystemHealthOverview: proc({
@@ -320,11 +321,11 @@ export const healthCheckContract = {
320
321
  id: z.string(),
321
322
  status: HealthCheckStatusSchema,
322
323
  timestamp: z.date(),
323
- })
324
+ }),
324
325
  ),
325
- })
326
+ }),
326
327
  ),
327
- })
328
+ }),
328
329
  ),
329
330
  };
330
331
 
@@ -335,5 +336,5 @@ export type HealthCheckContract = typeof healthCheckContract;
335
336
  // Use: const client = rpcApi.forPlugin(HealthCheckApi);
336
337
  export const HealthCheckApi = createClientDefinition(
337
338
  healthCheckContract,
338
- pluginMetadata
339
+ pluginMetadata,
339
340
  );