@checkstack/catalog-backend 1.0.1 → 1.1.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,168 @@
1
1
  # @checkstack/catalog-backend
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1ef2e79: feat: hotlinks on incidents/maintenances and additional links on systems
8
+
9
+ Users with `manage` access on an incident, maintenance, or system can now
10
+ attach free-form URL "hotlinks" — Jira tickets, runbooks, dashboards, ticket
11
+ tools, etc. — alongside the existing fields.
12
+
13
+ - **Incidents** & **maintenances**: links live on the entity itself and are
14
+ surfaced both in the editor dialog and on the public detail page. Two new
15
+ RPC procedures per plugin (`addLink`, `removeLink`) gated behind the
16
+ existing `manage` access rule. Links are returned as part of
17
+ `getIncident` / `getMaintenance` and cache-invalidated on every link
18
+ mutation.
19
+ - **Systems**: a parallel `system_links` table with `getSystemLinks`,
20
+ `addSystemLink`, `removeSystemLink` procedures. Surfaced inside the
21
+ system editor (next to contacts) and on the read-only system detail
22
+ sidebar. Cache-scoped per-system so list endpoints remain hot.
23
+ - **Shared UI**: a `LinksEditor` component in `@checkstack/ui` does the
24
+ presentation; the three plugins each own their own RPC wiring.
25
+
26
+ Database changes ship as additive migrations (new `incident_links`,
27
+ `maintenance_links`, `system_links` tables, all FK-cascaded on parent
28
+ delete). No existing columns or rows are touched.
29
+
30
+ The system incident and maintenance history pages now sort by relevance:
31
+ active entries (non-`resolved` incidents, `scheduled` or `in_progress`
32
+ maintenances) appear at the top, with creation date descending as the
33
+ tiebreaker.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [42abfff]
38
+ - Updated dependencies [f6f9a5c]
39
+ - Updated dependencies [1ef2e79]
40
+ - Updated dependencies [aa89bc5]
41
+ - @checkstack/common@0.9.0
42
+ - @checkstack/gitops-common@0.3.0
43
+ - @checkstack/gitops-backend@0.3.0
44
+ - @checkstack/catalog-common@2.1.0
45
+ - @checkstack/cache-api@0.3.0
46
+ - @checkstack/auth-backend@0.4.25
47
+ - @checkstack/auth-common@0.6.6
48
+ - @checkstack/backend-api@0.15.1
49
+ - @checkstack/command-backend@0.1.25
50
+ - @checkstack/notification-common@1.0.2
51
+ - @checkstack/cache-utils@0.2.5
52
+
53
+ ## 1.0.2
54
+
55
+ ### Patch Changes
56
+
57
+ - 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
58
+ (including private GitHub Enterprise instances), or tarball uploads at
59
+ runtime, with multi-package bundles, dependency-derived compatibility checks,
60
+ multi-instance coordination via a Postgres artifact store, and
61
+ single-coordinator destructive cleanup.
62
+
63
+ Highlights:
64
+
65
+ - New `PluginSource` discriminated union and `PluginInstaller` /
66
+ `PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
67
+ GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
68
+ GitHub Enterprise can install from `https://ghe.example.com/api/v3`
69
+ instead of `api.github.com`.
70
+ - New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
71
+ every plugin's `package.json` at install time. Required fields: `name`,
72
+ `version`, `description`, `author`, `license`, `checkstack.type`,
73
+ `checkstack.pluginId`. Optional: `checkstack.bundle`,
74
+ `checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
75
+ - New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
76
+ `list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
77
+ `events` procedures.
78
+ - New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
79
+ with per-row uninstall (typed-confirmation modal, schema/configs/cascade
80
+ toggles), install page with NPM / Tarball Upload / GitHub Release tabs
81
+ (Catalog tab disabled — coming soon), and an events page surfacing the
82
+ install/uninstall audit log.
83
+ - New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
84
+ per-package mode produces an npm-shaped tarball; `--bundle` mode produces
85
+ an outer tarball containing every sibling declared in
86
+ `package.json#checkstack.bundle`. Published to npm so external authors
87
+ can `bunx` it directly without a workspace checkout.
88
+ - Compatibility derived from `package.json#dependencies` ranges
89
+ (`semver.satisfies` against the platform's loaded `@checkstack/*`
90
+ versions) — no separate `compatibility` field.
91
+ - Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
92
+ install/uninstall; receiving instances do in-process register/unregister
93
+ only. Destructive ops (drop schema, delete plugin_configs, delete
94
+ artifacts, delete `plugins` rows) run exactly once on the originator.
95
+ - Fresh-instance bootstrap: `loadPlugins()` hydrates any
96
+ `is_uninstallable=true` plugin missing from `node_modules` from the
97
+ artifact store before normal Phase 1 register.
98
+ - New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
99
+ (audit/error log). `plugins` extended with `version`, `metadata`,
100
+ `source`, `bundle_id`, `is_primary`. Local plugin sync now writes
101
+ `version` from each plugin's `package.json` so the admin UI shows real
102
+ versions instead of `—`.
103
+ - Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
104
+ the install UI; access-gated by `pluginmanager.plugin.manage`.
105
+ - Plugin Manager menu link added to the user menu (main grid, alongside
106
+ Profile / Notification Settings / etc.).
107
+
108
+ Cross-cutting changes:
109
+
110
+ - Backend request/response logging now flows through `rootLogger` (winston)
111
+ instead of `hono/logger`. 5xx responses include the response body inline
112
+ so swallowed early-return errors are visible in the log.
113
+ - The `/api/:pluginId/*` dispatcher now logs which core service is missing
114
+ or which `pluginId` had no metadata when it 500s.
115
+ - New `registerCorePluginMetadata` on `PluginManager` for core routers
116
+ (like the plugin manager itself) that need their metadata visible to the
117
+ RPC dispatcher without going through the full plugin lifecycle.
118
+ - ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
119
+ between `null` (writes a real SQL NULL) and `undefined` (skip the column
120
+ on insert), so treating them as interchangeable produced latent bugs at
121
+ the persistence boundary. The bulk of the patch-bumped packages above
122
+ reflect lint-fix touches that landed when this rule was relaxed.
123
+ - Workspace-wide license normalization to `Elastic-2.0` (matches
124
+ `LICENSE.md`). Every `package.json` in the workspace now declares the
125
+ same SPDX identifier; the patch bumps capture this.
126
+
127
+ Plugin packages (every `plugins/*`): added a `pack` npm script
128
+ (`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
129
+ `pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
130
+ so install-time validation passes, stubbed any missing required metadata
131
+ fields (`description`, `author`, `license`), and added
132
+ `checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
133
+ jira, queue-bullmq, queue-memory, cache-memory).
134
+
135
+ Breaking changes:
136
+
137
+ - The legacy single-method `PluginInstaller` interface (`install(packageName)`)
138
+ is removed. Callers must use `coreServices.pluginInstallerRegistry`.
139
+ - The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
140
+ Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
141
+ and `createPluginManagerRouter` in `core/backend`.
142
+ - `@checkstack/test-utils-backend` no longer exports
143
+ `createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
144
+ it shimmed is gone).
145
+
146
+ Note: bumps are limited to `minor` (for packages with new public API
147
+ surface) and `patch` (for downstream consumers, license normalization,
148
+ and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
149
+ the legacy interface had no third-party consumers in the wild before this
150
+ runtime plugin system landed, and the contract surface is the same shape
151
+ modulo the rename.
152
+
153
+ - Updated dependencies [50e5f5f]
154
+ - @checkstack/auth-common@0.6.5
155
+ - @checkstack/backend-api@0.15.0
156
+ - @checkstack/catalog-common@2.0.1
157
+ - @checkstack/common@0.8.0
158
+ - @checkstack/gitops-backend@0.2.8
159
+ - @checkstack/gitops-common@0.2.2
160
+ - @checkstack/auth-backend@0.4.24
161
+ - @checkstack/cache-api@0.2.4
162
+ - @checkstack/cache-utils@0.2.4
163
+ - @checkstack/command-backend@0.1.24
164
+ - @checkstack/notification-common@1.0.1
165
+
3
166
  ## 1.0.1
4
167
 
5
168
  ### Patch Changes
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "system_links" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "system_id" text NOT NULL,
4
+ "label" text,
5
+ "url" text NOT NULL,
6
+ "created_at" timestamp DEFAULT now() NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ ALTER TABLE "system_links" ADD CONSTRAINT "system_links_system_id_systems_id_fk" FOREIGN KEY ("system_id") REFERENCES "systems"("id") ON DELETE cascade ON UPDATE no action;
@@ -0,0 +1,367 @@
1
+ {
2
+ "id": "d0f3aff8-8024-4eec-9407-77c1991ecf62",
3
+ "prevId": "72cd2f27-3627-475c-96f6-778b75a35418",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.groups": {
8
+ "name": "groups",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "name": {
18
+ "name": "name",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "metadata": {
24
+ "name": "metadata",
25
+ "type": "json",
26
+ "primaryKey": false,
27
+ "notNull": false,
28
+ "default": "'{}'::json"
29
+ },
30
+ "created_at": {
31
+ "name": "created_at",
32
+ "type": "timestamp",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "now()"
36
+ },
37
+ "updated_at": {
38
+ "name": "updated_at",
39
+ "type": "timestamp",
40
+ "primaryKey": false,
41
+ "notNull": true,
42
+ "default": "now()"
43
+ }
44
+ },
45
+ "indexes": {},
46
+ "foreignKeys": {},
47
+ "compositePrimaryKeys": {},
48
+ "uniqueConstraints": {},
49
+ "policies": {},
50
+ "checkConstraints": {},
51
+ "isRLSEnabled": false
52
+ },
53
+ "public.system_contacts": {
54
+ "name": "system_contacts",
55
+ "schema": "",
56
+ "columns": {
57
+ "id": {
58
+ "name": "id",
59
+ "type": "text",
60
+ "primaryKey": true,
61
+ "notNull": true
62
+ },
63
+ "system_id": {
64
+ "name": "system_id",
65
+ "type": "text",
66
+ "primaryKey": false,
67
+ "notNull": true
68
+ },
69
+ "type": {
70
+ "name": "type",
71
+ "type": "contact_type",
72
+ "typeSchema": "public",
73
+ "primaryKey": false,
74
+ "notNull": true
75
+ },
76
+ "user_id": {
77
+ "name": "user_id",
78
+ "type": "text",
79
+ "primaryKey": false,
80
+ "notNull": false
81
+ },
82
+ "email": {
83
+ "name": "email",
84
+ "type": "text",
85
+ "primaryKey": false,
86
+ "notNull": false
87
+ },
88
+ "label": {
89
+ "name": "label",
90
+ "type": "text",
91
+ "primaryKey": false,
92
+ "notNull": false
93
+ },
94
+ "created_at": {
95
+ "name": "created_at",
96
+ "type": "timestamp",
97
+ "primaryKey": false,
98
+ "notNull": true,
99
+ "default": "now()"
100
+ }
101
+ },
102
+ "indexes": {},
103
+ "foreignKeys": {
104
+ "system_contacts_system_id_systems_id_fk": {
105
+ "name": "system_contacts_system_id_systems_id_fk",
106
+ "tableFrom": "system_contacts",
107
+ "tableTo": "systems",
108
+ "columnsFrom": [
109
+ "system_id"
110
+ ],
111
+ "columnsTo": [
112
+ "id"
113
+ ],
114
+ "onDelete": "cascade",
115
+ "onUpdate": "no action"
116
+ }
117
+ },
118
+ "compositePrimaryKeys": {},
119
+ "uniqueConstraints": {},
120
+ "policies": {},
121
+ "checkConstraints": {},
122
+ "isRLSEnabled": false
123
+ },
124
+ "public.system_links": {
125
+ "name": "system_links",
126
+ "schema": "",
127
+ "columns": {
128
+ "id": {
129
+ "name": "id",
130
+ "type": "text",
131
+ "primaryKey": true,
132
+ "notNull": true
133
+ },
134
+ "system_id": {
135
+ "name": "system_id",
136
+ "type": "text",
137
+ "primaryKey": false,
138
+ "notNull": true
139
+ },
140
+ "label": {
141
+ "name": "label",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false
145
+ },
146
+ "url": {
147
+ "name": "url",
148
+ "type": "text",
149
+ "primaryKey": false,
150
+ "notNull": true
151
+ },
152
+ "created_at": {
153
+ "name": "created_at",
154
+ "type": "timestamp",
155
+ "primaryKey": false,
156
+ "notNull": true,
157
+ "default": "now()"
158
+ }
159
+ },
160
+ "indexes": {},
161
+ "foreignKeys": {
162
+ "system_links_system_id_systems_id_fk": {
163
+ "name": "system_links_system_id_systems_id_fk",
164
+ "tableFrom": "system_links",
165
+ "tableTo": "systems",
166
+ "columnsFrom": [
167
+ "system_id"
168
+ ],
169
+ "columnsTo": [
170
+ "id"
171
+ ],
172
+ "onDelete": "cascade",
173
+ "onUpdate": "no action"
174
+ }
175
+ },
176
+ "compositePrimaryKeys": {},
177
+ "uniqueConstraints": {},
178
+ "policies": {},
179
+ "checkConstraints": {},
180
+ "isRLSEnabled": false
181
+ },
182
+ "public.systems": {
183
+ "name": "systems",
184
+ "schema": "",
185
+ "columns": {
186
+ "id": {
187
+ "name": "id",
188
+ "type": "text",
189
+ "primaryKey": true,
190
+ "notNull": true
191
+ },
192
+ "name": {
193
+ "name": "name",
194
+ "type": "text",
195
+ "primaryKey": false,
196
+ "notNull": true
197
+ },
198
+ "description": {
199
+ "name": "description",
200
+ "type": "text",
201
+ "primaryKey": false,
202
+ "notNull": false
203
+ },
204
+ "metadata": {
205
+ "name": "metadata",
206
+ "type": "json",
207
+ "primaryKey": false,
208
+ "notNull": false,
209
+ "default": "'{}'::json"
210
+ },
211
+ "created_at": {
212
+ "name": "created_at",
213
+ "type": "timestamp",
214
+ "primaryKey": false,
215
+ "notNull": true,
216
+ "default": "now()"
217
+ },
218
+ "updated_at": {
219
+ "name": "updated_at",
220
+ "type": "timestamp",
221
+ "primaryKey": false,
222
+ "notNull": true,
223
+ "default": "now()"
224
+ }
225
+ },
226
+ "indexes": {},
227
+ "foreignKeys": {},
228
+ "compositePrimaryKeys": {},
229
+ "uniqueConstraints": {},
230
+ "policies": {},
231
+ "checkConstraints": {},
232
+ "isRLSEnabled": false
233
+ },
234
+ "public.systems_groups": {
235
+ "name": "systems_groups",
236
+ "schema": "",
237
+ "columns": {
238
+ "system_id": {
239
+ "name": "system_id",
240
+ "type": "text",
241
+ "primaryKey": false,
242
+ "notNull": true
243
+ },
244
+ "group_id": {
245
+ "name": "group_id",
246
+ "type": "text",
247
+ "primaryKey": false,
248
+ "notNull": true
249
+ }
250
+ },
251
+ "indexes": {},
252
+ "foreignKeys": {
253
+ "systems_groups_system_id_systems_id_fk": {
254
+ "name": "systems_groups_system_id_systems_id_fk",
255
+ "tableFrom": "systems_groups",
256
+ "tableTo": "systems",
257
+ "columnsFrom": [
258
+ "system_id"
259
+ ],
260
+ "columnsTo": [
261
+ "id"
262
+ ],
263
+ "onDelete": "cascade",
264
+ "onUpdate": "no action"
265
+ },
266
+ "systems_groups_group_id_groups_id_fk": {
267
+ "name": "systems_groups_group_id_groups_id_fk",
268
+ "tableFrom": "systems_groups",
269
+ "tableTo": "groups",
270
+ "columnsFrom": [
271
+ "group_id"
272
+ ],
273
+ "columnsTo": [
274
+ "id"
275
+ ],
276
+ "onDelete": "cascade",
277
+ "onUpdate": "no action"
278
+ }
279
+ },
280
+ "compositePrimaryKeys": {
281
+ "systems_groups_system_id_group_id_pk": {
282
+ "name": "systems_groups_system_id_group_id_pk",
283
+ "columns": [
284
+ "system_id",
285
+ "group_id"
286
+ ]
287
+ }
288
+ },
289
+ "uniqueConstraints": {},
290
+ "policies": {},
291
+ "checkConstraints": {},
292
+ "isRLSEnabled": false
293
+ },
294
+ "public.views": {
295
+ "name": "views",
296
+ "schema": "",
297
+ "columns": {
298
+ "id": {
299
+ "name": "id",
300
+ "type": "text",
301
+ "primaryKey": true,
302
+ "notNull": true
303
+ },
304
+ "name": {
305
+ "name": "name",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": true
309
+ },
310
+ "description": {
311
+ "name": "description",
312
+ "type": "text",
313
+ "primaryKey": false,
314
+ "notNull": false
315
+ },
316
+ "configuration": {
317
+ "name": "configuration",
318
+ "type": "json",
319
+ "primaryKey": false,
320
+ "notNull": true,
321
+ "default": "'[]'::json"
322
+ },
323
+ "created_at": {
324
+ "name": "created_at",
325
+ "type": "timestamp",
326
+ "primaryKey": false,
327
+ "notNull": true,
328
+ "default": "now()"
329
+ },
330
+ "updated_at": {
331
+ "name": "updated_at",
332
+ "type": "timestamp",
333
+ "primaryKey": false,
334
+ "notNull": true,
335
+ "default": "now()"
336
+ }
337
+ },
338
+ "indexes": {},
339
+ "foreignKeys": {},
340
+ "compositePrimaryKeys": {},
341
+ "uniqueConstraints": {},
342
+ "policies": {},
343
+ "checkConstraints": {},
344
+ "isRLSEnabled": false
345
+ }
346
+ },
347
+ "enums": {
348
+ "public.contact_type": {
349
+ "name": "contact_type",
350
+ "schema": "public",
351
+ "values": [
352
+ "user",
353
+ "mailbox"
354
+ ]
355
+ }
356
+ },
357
+ "schemas": {},
358
+ "sequences": {},
359
+ "roles": {},
360
+ "policies": {},
361
+ "views": {},
362
+ "_meta": {
363
+ "columns": {},
364
+ "schemas": {},
365
+ "tables": {}
366
+ }
367
+ }
@@ -15,6 +15,13 @@
15
15
  "when": 1769034170052,
16
16
  "tag": "0001_early_madrox",
17
17
  "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1777907813247,
23
+ "tag": "0002_harsh_carmella_unuscione",
24
+ "breakpoints": true
18
25
  }
19
26
  ]
20
27
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@checkstack/catalog-backend",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
+ "license": "Elastic-2.0",
4
5
  "type": "module",
5
6
  "main": "src/index.ts",
6
7
  "checkstack": {
@@ -13,27 +14,27 @@
13
14
  "lint:code": "eslint . --max-warnings 0"
14
15
  },
15
16
  "dependencies": {
16
- "@checkstack/backend-api": "0.14.0",
17
- "@checkstack/cache-api": "0.2.2",
18
- "@checkstack/cache-utils": "0.2.2",
19
- "@checkstack/auth-common": "0.6.4",
20
- "@checkstack/catalog-common": "2.0.0",
21
- "@checkstack/command-backend": "0.1.22",
22
- "@checkstack/auth-backend": "0.4.22",
23
- "@checkstack/gitops-backend": "0.2.6",
24
- "@checkstack/gitops-common": "0.2.1",
25
- "@checkstack/notification-common": "1.0.0",
17
+ "@checkstack/backend-api": "0.15.0",
18
+ "@checkstack/cache-api": "0.2.4",
19
+ "@checkstack/cache-utils": "0.2.4",
20
+ "@checkstack/auth-common": "0.6.5",
21
+ "@checkstack/catalog-common": "2.0.1",
22
+ "@checkstack/command-backend": "0.1.24",
23
+ "@checkstack/auth-backend": "0.4.24",
24
+ "@checkstack/gitops-backend": "0.2.8",
25
+ "@checkstack/gitops-common": "0.2.2",
26
+ "@checkstack/notification-common": "1.0.1",
26
27
  "@orpc/server": "^1.13.2",
27
28
  "drizzle-orm": "^0.45.0",
28
29
  "hono": "^4.12.14",
29
30
  "uuid": "^13.0.0",
30
31
  "zod": "^4.2.1",
31
- "@checkstack/common": "0.7.0"
32
+ "@checkstack/common": "0.8.0"
32
33
  },
33
34
  "devDependencies": {
34
- "@checkstack/drizzle-helper": "0.0.4",
35
- "@checkstack/scripts": "0.1.2",
36
- "@checkstack/tsconfig": "0.0.5",
35
+ "@checkstack/drizzle-helper": "0.0.5",
36
+ "@checkstack/scripts": "0.3.0",
37
+ "@checkstack/tsconfig": "0.0.7",
37
38
  "@types/bun": "^1.3.5",
38
39
  "@types/node": "^20.0.0",
39
40
  "@types/uuid": "^11.0.0",
package/src/cache.ts CHANGED
@@ -16,6 +16,7 @@ const CATALOG_TTL_MS = 25_000;
16
16
  const ENTITY_PREFIX = "entity:";
17
17
  const VIEW_PREFIX = "view:";
18
18
  const CONTACTS_PREFIX = "contacts:";
19
+ const LINKS_PREFIX = "links:";
19
20
 
20
21
  const ENTITIES_KEY = `${ENTITY_PREFIX}entities`;
21
22
  const SYSTEMS_KEY = `${ENTITY_PREFIX}systems`;
@@ -27,6 +28,7 @@ const groupsForSystemKey = (systemId: string): string =>
27
28
  `${ENTITY_PREFIX}groups-for-system:${systemId}`;
28
29
  const contactsKey = (systemId: string): string =>
29
30
  `${CONTACTS_PREFIX}${systemId}`;
31
+ const linksKey = (systemId: string): string => `${LINKS_PREFIX}${systemId}`;
30
32
 
31
33
  export interface CatalogCache {
32
34
  /** Read-through caches for the dashboard hot paths. */
@@ -40,6 +42,7 @@ export interface CatalogCache {
40
42
  ) => Promise<T>;
41
43
  wrapViews: <T>(loader: () => Promise<T>) => Promise<T>;
42
44
  wrapContacts: <T>(systemId: string, loader: () => Promise<T>) => Promise<T>;
45
+ wrapLinks: <T>(systemId: string, loader: () => Promise<T>) => Promise<T>;
43
46
 
44
47
  /**
45
48
  * Drop the whole topology family (entities, systems, groups, per-system,
@@ -55,6 +58,9 @@ export interface CatalogCache {
55
58
  /** Drop one system's contact cache. */
56
59
  invalidateContacts: (systemId: string) => Promise<void>;
57
60
 
61
+ /** Drop one system's hotlink cache. */
62
+ invalidateLinks: (systemId: string) => Promise<void>;
63
+
58
64
  scope: CachedScope;
59
65
  }
60
66
 
@@ -84,10 +90,12 @@ export function createCatalogCache({
84
90
  wrapViews: (loader) => scope.wrap(VIEWS_KEY, loader),
85
91
  wrapContacts: (systemId, loader) =>
86
92
  scope.wrap(contactsKey(systemId), loader),
93
+ wrapLinks: (systemId, loader) => scope.wrap(linksKey(systemId), loader),
87
94
 
88
95
  invalidateTopology: () => scope.invalidatePrefix(ENTITY_PREFIX),
89
96
  invalidateViews: () => scope.invalidatePrefix(VIEW_PREFIX),
90
97
  invalidateContacts: (systemId) => scope.invalidate(contactsKey(systemId)),
98
+ invalidateLinks: (systemId) => scope.invalidate(linksKey(systemId)),
91
99
 
92
100
  scope,
93
101
  };
@@ -12,9 +12,11 @@ const passthroughCache: CatalogCache = {
12
12
  wrapGroupsForSystem: (_systemId, loader) => loader(),
13
13
  wrapViews: (loader) => loader(),
14
14
  wrapContacts: (_systemId, loader) => loader(),
15
+ wrapLinks: (_systemId, loader) => loader(),
15
16
  invalidateTopology: async () => 0,
16
17
  invalidateViews: async () => 0,
17
18
  invalidateContacts: async () => {},
19
+ invalidateLinks: async () => {},
18
20
  scope: {} as CatalogCache["scope"],
19
21
  };
20
22
 
package/src/router.ts CHANGED
@@ -180,7 +180,7 @@ export const createCatalogRouter = ({
180
180
  const system = await entityService.getSystem(input.systemId);
181
181
  if (!system) {
182
182
  // oRPC contract uses .nullable() which requires null
183
- // eslint-disable-next-line unicorn/no-null
183
+
184
184
  return null;
185
185
  }
186
186
  return system as typeof system & {
@@ -497,6 +497,33 @@ export const createCatalogRouter = ({
497
497
  },
498
498
  );
499
499
 
500
+ // System Links handlers (free-form URL hotlinks attached to a system)
501
+ const getSystemLinks = os.getSystemLinks.handler(async ({ input }) =>
502
+ cache.wrapLinks(input.systemId, async () =>
503
+ entityService.getLinksForSystem(input.systemId),
504
+ ),
505
+ );
506
+
507
+ const addSystemLink = os.addSystemLink.handler(async ({ input }) => {
508
+ await enforceNotGitOpsLocked("System", input.systemId);
509
+ const result = await entityService.addLink({
510
+ systemId: input.systemId,
511
+ label: input.label,
512
+ url: input.url,
513
+ });
514
+ await cache.invalidateLinks(input.systemId);
515
+ return result;
516
+ });
517
+
518
+ const removeSystemLink = os.removeSystemLink.handler(async ({ input }) => {
519
+ const removed = await entityService.removeLink(input);
520
+ if (removed) {
521
+ await enforceNotGitOpsLocked("System", removed.systemId);
522
+ await cache.invalidateLinks(removed.systemId);
523
+ }
524
+ return { success: !!removed };
525
+ });
526
+
500
527
  /**
501
528
  * Get the catalog group IDs that contain a specific system.
502
529
  * Used by the dependency plugin for batched notification deduplication.
@@ -526,6 +553,9 @@ export const createCatalogRouter = ({
526
553
  getSystemContacts,
527
554
  addSystemContact,
528
555
  removeSystemContact,
556
+ getSystemLinks,
557
+ addSystemLink,
558
+ removeSystemLink,
529
559
  createGroup,
530
560
  updateGroup,
531
561
  deleteGroup,
package/src/schema.ts CHANGED
@@ -59,6 +59,20 @@ export const systemsGroups = pgTable(
59
59
  }),
60
60
  );
61
61
 
62
+ /**
63
+ * Free-form hotlinks attached to a system — e.g. Jira board, dashboard URL,
64
+ * runbook. Sits alongside contacts but is purely URL-based, no user/email.
65
+ */
66
+ export const systemLinks = pgTable("system_links", {
67
+ id: text("id").primaryKey(),
68
+ systemId: text("system_id")
69
+ .notNull()
70
+ .references(() => systems.id, { onDelete: "cascade" }),
71
+ label: text("label"),
72
+ url: text("url").notNull(),
73
+ createdAt: timestamp("created_at").defaultNow().notNull(),
74
+ });
75
+
62
76
  export const views = pgTable("views", {
63
77
  id: text("id").primaryKey(),
64
78
  name: text("name").notNull(),
@@ -98,6 +98,30 @@ export class EntityService {
98
98
  .where(eq(schema.systemContacts.userId, userId));
99
99
  }
100
100
 
101
+ // System Links — free-form URLs attached to a system
102
+ async getLinksForSystem(systemId: string) {
103
+ return this.database
104
+ .select()
105
+ .from(schema.systemLinks)
106
+ .where(eq(schema.systemLinks.systemId, systemId));
107
+ }
108
+
109
+ async addLink(props: { systemId: string; label?: string; url: string }) {
110
+ const result = await this.database
111
+ .insert(schema.systemLinks)
112
+ .values({ id: uuidv4(), ...props })
113
+ .returning();
114
+ return result[0];
115
+ }
116
+
117
+ async removeLink(linkId: string) {
118
+ const result = await this.database
119
+ .delete(schema.systemLinks)
120
+ .where(eq(schema.systemLinks.id, linkId))
121
+ .returning();
122
+ return result[0];
123
+ }
124
+
101
125
  // Groups
102
126
  async getGroups() {
103
127
  // Fetch all groups