@checkstack/catalog-common 2.0.1 → 2.2.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,107 @@
1
1
  # @checkstack/catalog-common
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9016526: Add a `/rest/:pluginId/*` HTTP mount that serves every plugin's oRPC contract
8
+ through the REST/OpenAPI shape described by `/api/openapi.json`. Queries are
9
+ `GET` with query parameters, mutations are `POST` with the input as the raw
10
+ JSON body. The existing `/api/:pluginId/*` mount continues to serve oRPC's
11
+ native wire protocol unchanged, so existing clients are not affected.
12
+
13
+ The OpenAPI spec at `/api/openapi.json` now reflects the real mount: every
14
+ `paths` entry is prefixed with `/rest` instead of `/api`.
15
+
16
+ Also fixes a SPA-fallback bug: the backend's `/api-docs` route previously
17
+ returned 404 on production deployments because the static-file middleware
18
+ skipped any path starting with `/api`, capturing `/api-docs` along with real
19
+ API routes. The skip now requires a trailing slash (`/api/`, `/rest/`).
20
+
21
+ Required access rules are now visible in the API Docs UI. The OpenAPI spec
22
+ generator was reading a non-existent `accessRules` field on procedure
23
+ metadata; the real field is `access: AccessRule[]`. Each procedure's access
24
+ rules are now flattened to fully-qualified IDs (e.g. `catalog.system.read`)
25
+ and emitted under `x-orpc-meta.accessRules`, which the existing
26
+ `Required Access Rules` section in the docs UI already knew how to render.
27
+
28
+ The API Docs schema renderer now handles record types (zod `z.record`),
29
+ `$ref`s into `components.schemas`, `oneOf`/`anyOf`/`allOf`, nullable union
30
+ types (`type: ["string", "null"]`), and `format` qualifiers. Previously
31
+ record outputs like `{ statuses: object }` masked the actual value type;
32
+ they now render as `{ [key]: <ResolvedType> { ... } }` with the inner
33
+ schema expanded, capped at 12 levels with cycle detection.
34
+
35
+ **REST method conventions.** `proc()` now defaults to `GET` for queries and
36
+ `POST` for mutations on the `/rest` mount, using bracket-notation query
37
+ params (`?filter[status]=active&ids[0]=a`) for GET inputs. Existing
38
+ procedures were updated to follow REST semantics:
39
+
40
+ - `update*` mutations → `PATCH`
41
+ - `delete*` / `remove*` mutations → `DELETE`
42
+ - `getBulk*` queries and any query taking a large array input → `POST`
43
+ (because `@orpc/openapi@1.13.x` has no GET→POST URL-length fallback)
44
+
45
+ GET endpoints require an `object` input — bare scalars like
46
+ `.input(z.string())` are not valid on GET. `getSystemConfigurations` was
47
+ refactored from `.input(z.string())` to `.input(z.object({ systemId: ... }))`
48
+ to fit the GET shape; the only call-site update was the in-process router
49
+ unpacking `input.systemId` instead of passing `input` directly.
50
+
51
+ The API Docs UI now renders query parameters (path/query/header/cookie) in a
52
+ dedicated table for GET endpoints, and the fetch example shows them in the
53
+ URL with `<required>` / `<optional>` placeholders.
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [9016526]
58
+ - @checkstack/common@0.10.0
59
+ - @checkstack/auth-common@0.7.0
60
+ - @checkstack/notification-common@1.1.0
61
+ - @checkstack/frontend-api@0.5.1
62
+
63
+ ## 2.1.0
64
+
65
+ ### Minor Changes
66
+
67
+ - 1ef2e79: feat: hotlinks on incidents/maintenances and additional links on systems
68
+
69
+ Users with `manage` access on an incident, maintenance, or system can now
70
+ attach free-form URL "hotlinks" — Jira tickets, runbooks, dashboards, ticket
71
+ tools, etc. — alongside the existing fields.
72
+
73
+ - **Incidents** & **maintenances**: links live on the entity itself and are
74
+ surfaced both in the editor dialog and on the public detail page. Two new
75
+ RPC procedures per plugin (`addLink`, `removeLink`) gated behind the
76
+ existing `manage` access rule. Links are returned as part of
77
+ `getIncident` / `getMaintenance` and cache-invalidated on every link
78
+ mutation.
79
+ - **Systems**: a parallel `system_links` table with `getSystemLinks`,
80
+ `addSystemLink`, `removeSystemLink` procedures. Surfaced inside the
81
+ system editor (next to contacts) and on the read-only system detail
82
+ sidebar. Cache-scoped per-system so list endpoints remain hot.
83
+ - **Shared UI**: a `LinksEditor` component in `@checkstack/ui` does the
84
+ presentation; the three plugins each own their own RPC wiring.
85
+
86
+ Database changes ship as additive migrations (new `incident_links`,
87
+ `maintenance_links`, `system_links` tables, all FK-cascaded on parent
88
+ delete). No existing columns or rows are touched.
89
+
90
+ The system incident and maintenance history pages now sort by relevance:
91
+ active entries (non-`resolved` incidents, `scheduled` or `in_progress`
92
+ maintenances) appear at the top, with creation date descending as the
93
+ tiebreaker.
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [42abfff]
98
+ - Updated dependencies [aa89bc5]
99
+ - Updated dependencies [950d6ec]
100
+ - @checkstack/common@0.9.0
101
+ - @checkstack/frontend-api@0.5.0
102
+ - @checkstack/auth-common@0.6.6
103
+ - @checkstack/notification-common@1.0.2
104
+
3
105
  ## 2.0.1
4
106
 
5
107
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/catalog-common",
3
- "version": "2.0.1",
3
+ "version": "2.2.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,17 +9,17 @@
9
9
  }
10
10
  },
11
11
  "dependencies": {
12
- "@checkstack/common": "0.7.0",
13
- "@checkstack/auth-common": "0.6.4",
14
- "@checkstack/frontend-api": "0.4.1",
15
- "@checkstack/notification-common": "1.0.0",
12
+ "@checkstack/common": "0.9.0",
13
+ "@checkstack/auth-common": "0.6.6",
14
+ "@checkstack/frontend-api": "0.5.0",
15
+ "@checkstack/notification-common": "1.0.2",
16
16
  "@orpc/contract": "^1.13.14",
17
17
  "zod": "^4.2.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "typescript": "^5.7.2",
21
- "@checkstack/tsconfig": "0.0.6",
22
- "@checkstack/scripts": "0.1.2"
21
+ "@checkstack/tsconfig": "0.0.7",
22
+ "@checkstack/scripts": "0.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "typecheck": "tsgo -b",
@@ -7,6 +7,7 @@ import {
7
7
  ViewSchema,
8
8
  SystemContactSchema,
9
9
  ContactTypeSchema,
10
+ SystemLinkSchema,
10
11
  } from "./types";
11
12
  import { catalogAccess } from "./access";
12
13
 
@@ -115,6 +116,7 @@ export const catalogContract = {
115
116
  userType: "authenticated",
116
117
  access: [catalogAccess.system.manage],
117
118
  })
119
+ .route({ method: "PATCH" })
118
120
  .input(UpdateSystemInputSchema)
119
121
  .output(SystemSchema),
120
122
 
@@ -123,6 +125,7 @@ export const catalogContract = {
123
125
  userType: "authenticated",
124
126
  access: [catalogAccess.system.manage],
125
127
  })
128
+ .route({ method: "DELETE" })
126
129
  .input(z.string())
127
130
  .output(z.object({ success: z.boolean() })),
128
131
 
@@ -161,6 +164,45 @@ export const catalogContract = {
161
164
  userType: "authenticated",
162
165
  access: [catalogAccess.system.manage],
163
166
  })
167
+ .route({ method: "DELETE" })
168
+ .input(z.string())
169
+ .output(z.object({ success: z.boolean() })),
170
+
171
+ // ==========================================================================
172
+ // SYSTEM LINKS MANAGEMENT
173
+ // Free-form URLs (Jira boards, dashboards, runbooks) attached to a system.
174
+ // ==========================================================================
175
+
176
+ getSystemLinks: proc({
177
+ operationType: "query",
178
+ userType: "public",
179
+ access: [catalogAccess.system.read],
180
+ instanceAccess: { idParam: "systemId" },
181
+ })
182
+ .input(z.object({ systemId: z.string() }))
183
+ .output(z.array(SystemLinkSchema)),
184
+
185
+ addSystemLink: proc({
186
+ operationType: "mutation",
187
+ userType: "authenticated",
188
+ access: [catalogAccess.system.manage],
189
+ instanceAccess: { idParam: "systemId" },
190
+ })
191
+ .input(
192
+ z.object({
193
+ systemId: z.string(),
194
+ label: z.string().max(120).optional(),
195
+ url: z.string().url("Must be a valid URL"),
196
+ }),
197
+ )
198
+ .output(SystemLinkSchema),
199
+
200
+ removeSystemLink: proc({
201
+ operationType: "mutation",
202
+ userType: "authenticated",
203
+ access: [catalogAccess.system.manage],
204
+ })
205
+ .route({ method: "DELETE" })
164
206
  .input(z.string())
165
207
  .output(z.object({ success: z.boolean() })),
166
208
 
@@ -181,6 +223,7 @@ export const catalogContract = {
181
223
  userType: "authenticated",
182
224
  access: [catalogAccess.group.manage],
183
225
  })
226
+ .route({ method: "PATCH" })
184
227
  .input(UpdateGroupInputSchema)
185
228
  .output(GroupSchema),
186
229
 
@@ -189,6 +232,7 @@ export const catalogContract = {
189
232
  userType: "authenticated",
190
233
  access: [catalogAccess.group.manage],
191
234
  })
235
+ .route({ method: "DELETE" })
192
236
  .input(z.string())
193
237
  .output(z.object({ success: z.boolean() })),
194
238
 
@@ -214,6 +258,7 @@ export const catalogContract = {
214
258
  userType: "authenticated",
215
259
  access: [catalogAccess.system.manage],
216
260
  })
261
+ .route({ method: "DELETE" })
217
262
  .input(
218
263
  z.object({
219
264
  groupId: z.string(),
package/src/types.ts CHANGED
@@ -46,6 +46,16 @@ export const SystemContactSchema = z.discriminatedUnion("type", [
46
46
  ]);
47
47
  export type SystemContact = z.infer<typeof SystemContactSchema>;
48
48
 
49
+ // System Links — free-form hotlinks attached to a system (Jira board, dashboards, etc.)
50
+ export const SystemLinkSchema = z.object({
51
+ id: z.string(),
52
+ systemId: z.string(),
53
+ label: z.string().nullable(),
54
+ url: z.string(),
55
+ createdAt: z.date(),
56
+ });
57
+ export type SystemLink = z.infer<typeof SystemLinkSchema>;
58
+
49
59
  export const GroupSchema = z.object({
50
60
  id: z.string(),
51
61
  name: z.string(),