@checkstack/incident-common 0.3.1 → 0.3.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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @checkstack/incident-common
2
2
 
3
+ ## 0.3.3
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/frontend-api@0.3.2
14
+ - @checkstack/signal-common@0.1.3
15
+
16
+ ## 0.3.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [83557c7]
21
+ - @checkstack/common@0.4.0
22
+ - @checkstack/frontend-api@0.3.1
23
+ - @checkstack/signal-common@0.1.2
24
+
3
25
  ## 0.3.1
4
26
 
5
27
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/incident-common",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/access.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { access, accessPair } from "@checkstack/common";
1
+ import { accessPair } from "@checkstack/common";
2
2
 
3
3
  /**
4
4
  * Access rules for the Incident plugin.
@@ -8,29 +8,26 @@ export const incidentAccess = {
8
8
  * Incident access with both read and manage levels.
9
9
  * Read is public by default.
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
  incident: accessPair(
13
16
  "incident",
14
17
  {
15
- read: "View incidents",
16
- manage: "Manage incidents - create, edit, resolve, and delete",
18
+ read: {
19
+ description: "View incidents",
20
+ isDefault: true,
21
+ isPublic: true,
22
+ },
23
+ manage: {
24
+ description: "Manage incidents - create, edit, resolve, and delete",
25
+ },
17
26
  },
18
27
  {
19
28
  idParam: "systemId",
20
- readIsDefault: true,
21
- readIsPublic: true,
22
- }
29
+ },
23
30
  ),
24
-
25
- /**
26
- * Bulk incident access for viewing incidents for multiple systems.
27
- * Uses recordKey for filtering the output record by accessible system IDs.
28
- */
29
- bulkIncident: access("incident.incident", "read", "View incidents", {
30
- recordKey: "incidents",
31
- isDefault: true,
32
- isPublic: true,
33
- }),
34
31
  };
35
32
 
36
33
  /**
@@ -26,7 +26,7 @@ export const incidentContract = {
26
26
  systemId: z.string().optional(),
27
27
  includeResolved: z.boolean().optional().default(false),
28
28
  })
29
- .optional()
29
+ .optional(),
30
30
  )
31
31
  .output(z.object({ incidents: z.array(IncidentWithSystemsSchema) })),
32
32
 
@@ -54,13 +54,14 @@ export const incidentContract = {
54
54
  getBulkIncidentsForSystems: proc({
55
55
  operationType: "query",
56
56
  userType: "public",
57
- access: [incidentAccess.bulkIncident],
57
+ access: [incidentAccess.incident.read],
58
+ instanceAccess: { recordKey: "incidents" },
58
59
  })
59
60
  .input(z.object({ systemIds: z.array(z.string()) }))
60
61
  .output(
61
62
  z.object({
62
63
  incidents: z.record(z.string(), z.array(IncidentWithSystemsSchema)),
63
- })
64
+ }),
64
65
  ),
65
66
 
66
67
  /** Create a new incident */
@@ -116,5 +117,5 @@ export type IncidentContract = typeof incidentContract;
116
117
  // Use: const client = rpcApi.forPlugin(IncidentApi);
117
118
  export const IncidentApi = createClientDefinition(
118
119
  incidentContract,
119
- pluginMetadata
120
+ pluginMetadata,
120
121
  );