@checkstack/catalog-backend 1.3.1 → 1.4.1

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/drizzle/0003_tan_spot.sql +17 -0
  3. package/drizzle/0004_heavy_sharon_carter.sql +13 -0
  4. package/drizzle/0005_normal_shaman.sql +60 -0
  5. package/drizzle/0006_optimal_gamora.sql +43 -0
  6. package/drizzle/meta/0003_snapshot.json +479 -0
  7. package/drizzle/meta/0004_snapshot.json +495 -0
  8. package/drizzle/meta/0005_snapshot.json +592 -0
  9. package/drizzle/meta/0006_snapshot.json +592 -0
  10. package/drizzle/meta/_journal.json +28 -0
  11. package/package.json +20 -17
  12. package/src/ai/catalog-add-system-to-group.test.ts +51 -0
  13. package/src/ai/catalog-add-system-to-group.ts +68 -0
  14. package/src/ai/catalog-create-group.test.ts +62 -0
  15. package/src/ai/catalog-create-group.ts +71 -0
  16. package/src/ai/catalog-create-system.test.ts +62 -0
  17. package/src/ai/catalog-create-system.ts +78 -0
  18. package/src/ai/catalog-delete-group.test.ts +83 -0
  19. package/src/ai/catalog-delete-group.ts +77 -0
  20. package/src/ai/catalog-delete-system.test.ts +84 -0
  21. package/src/ai/catalog-delete-system.ts +77 -0
  22. package/src/ai/catalog-remove-system-from-group.test.ts +55 -0
  23. package/src/ai/catalog-remove-system-from-group.ts +74 -0
  24. package/src/ai/catalog-update-group.test.ts +85 -0
  25. package/src/ai/catalog-update-group.ts +88 -0
  26. package/src/ai/catalog-update-system.test.ts +87 -0
  27. package/src/ai/catalog-update-system.ts +93 -0
  28. package/src/ai/catalog.projection.test.ts +37 -0
  29. package/src/ai/register-ai-tools.ts +35 -0
  30. package/src/automations.test.ts +2 -1
  31. package/src/catalog-gitops-kinds.test.ts +288 -0
  32. package/src/index.ts +149 -0
  33. package/src/router.test.ts +107 -0
  34. package/src/router.ts +200 -26
  35. package/src/schema.ts +124 -38
  36. package/src/services/entity-service.test.ts +28 -0
  37. package/src/services/entity-service.ts +154 -1
  38. package/src/services/environment-membership.test.ts +66 -0
  39. package/src/services/environment-membership.ts +40 -0
  40. package/src/services/pg-errors.test.ts +24 -0
  41. package/src/services/pg-errors.ts +21 -0
  42. package/tsconfig.json +6 -0
@@ -0,0 +1,495 @@
1
+ {
2
+ "id": "30f5c748-251d-49c3-bf89-a5526a3420e9",
3
+ "prevId": "43935c26-5b88-4e16-a65d-9ba7fe3e305d",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.environments": {
8
+ "name": "environments",
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
+ "description": {
24
+ "name": "description",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": false
28
+ },
29
+ "metadata": {
30
+ "name": "metadata",
31
+ "type": "json",
32
+ "primaryKey": false,
33
+ "notNull": false,
34
+ "default": "'{}'::json"
35
+ },
36
+ "created_at": {
37
+ "name": "created_at",
38
+ "type": "timestamp",
39
+ "primaryKey": false,
40
+ "notNull": true,
41
+ "default": "now()"
42
+ },
43
+ "updated_at": {
44
+ "name": "updated_at",
45
+ "type": "timestamp",
46
+ "primaryKey": false,
47
+ "notNull": true,
48
+ "default": "now()"
49
+ }
50
+ },
51
+ "indexes": {},
52
+ "foreignKeys": {},
53
+ "compositePrimaryKeys": {},
54
+ "uniqueConstraints": {},
55
+ "policies": {},
56
+ "checkConstraints": {},
57
+ "isRLSEnabled": false
58
+ },
59
+ "public.groups": {
60
+ "name": "groups",
61
+ "schema": "",
62
+ "columns": {
63
+ "id": {
64
+ "name": "id",
65
+ "type": "text",
66
+ "primaryKey": true,
67
+ "notNull": true
68
+ },
69
+ "name": {
70
+ "name": "name",
71
+ "type": "text",
72
+ "primaryKey": false,
73
+ "notNull": true
74
+ },
75
+ "metadata": {
76
+ "name": "metadata",
77
+ "type": "json",
78
+ "primaryKey": false,
79
+ "notNull": false,
80
+ "default": "'{}'::json"
81
+ },
82
+ "created_at": {
83
+ "name": "created_at",
84
+ "type": "timestamp",
85
+ "primaryKey": false,
86
+ "notNull": true,
87
+ "default": "now()"
88
+ },
89
+ "updated_at": {
90
+ "name": "updated_at",
91
+ "type": "timestamp",
92
+ "primaryKey": false,
93
+ "notNull": true,
94
+ "default": "now()"
95
+ }
96
+ },
97
+ "indexes": {},
98
+ "foreignKeys": {},
99
+ "compositePrimaryKeys": {},
100
+ "uniqueConstraints": {},
101
+ "policies": {},
102
+ "checkConstraints": {},
103
+ "isRLSEnabled": false
104
+ },
105
+ "public.system_contacts": {
106
+ "name": "system_contacts",
107
+ "schema": "",
108
+ "columns": {
109
+ "id": {
110
+ "name": "id",
111
+ "type": "text",
112
+ "primaryKey": true,
113
+ "notNull": true
114
+ },
115
+ "system_id": {
116
+ "name": "system_id",
117
+ "type": "text",
118
+ "primaryKey": false,
119
+ "notNull": true
120
+ },
121
+ "type": {
122
+ "name": "type",
123
+ "type": "contact_type",
124
+ "typeSchema": "public",
125
+ "primaryKey": false,
126
+ "notNull": true
127
+ },
128
+ "user_id": {
129
+ "name": "user_id",
130
+ "type": "text",
131
+ "primaryKey": false,
132
+ "notNull": false
133
+ },
134
+ "email": {
135
+ "name": "email",
136
+ "type": "text",
137
+ "primaryKey": false,
138
+ "notNull": false
139
+ },
140
+ "label": {
141
+ "name": "label",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false
145
+ },
146
+ "created_at": {
147
+ "name": "created_at",
148
+ "type": "timestamp",
149
+ "primaryKey": false,
150
+ "notNull": true,
151
+ "default": "now()"
152
+ }
153
+ },
154
+ "indexes": {},
155
+ "foreignKeys": {
156
+ "system_contacts_system_id_systems_id_fk": {
157
+ "name": "system_contacts_system_id_systems_id_fk",
158
+ "tableFrom": "system_contacts",
159
+ "tableTo": "systems",
160
+ "columnsFrom": [
161
+ "system_id"
162
+ ],
163
+ "columnsTo": [
164
+ "id"
165
+ ],
166
+ "onDelete": "cascade",
167
+ "onUpdate": "no action"
168
+ }
169
+ },
170
+ "compositePrimaryKeys": {},
171
+ "uniqueConstraints": {},
172
+ "policies": {},
173
+ "checkConstraints": {},
174
+ "isRLSEnabled": false
175
+ },
176
+ "public.system_links": {
177
+ "name": "system_links",
178
+ "schema": "",
179
+ "columns": {
180
+ "id": {
181
+ "name": "id",
182
+ "type": "text",
183
+ "primaryKey": true,
184
+ "notNull": true
185
+ },
186
+ "system_id": {
187
+ "name": "system_id",
188
+ "type": "text",
189
+ "primaryKey": false,
190
+ "notNull": true
191
+ },
192
+ "label": {
193
+ "name": "label",
194
+ "type": "text",
195
+ "primaryKey": false,
196
+ "notNull": false
197
+ },
198
+ "url": {
199
+ "name": "url",
200
+ "type": "text",
201
+ "primaryKey": false,
202
+ "notNull": true
203
+ },
204
+ "created_at": {
205
+ "name": "created_at",
206
+ "type": "timestamp",
207
+ "primaryKey": false,
208
+ "notNull": true,
209
+ "default": "now()"
210
+ }
211
+ },
212
+ "indexes": {},
213
+ "foreignKeys": {
214
+ "system_links_system_id_systems_id_fk": {
215
+ "name": "system_links_system_id_systems_id_fk",
216
+ "tableFrom": "system_links",
217
+ "tableTo": "systems",
218
+ "columnsFrom": [
219
+ "system_id"
220
+ ],
221
+ "columnsTo": [
222
+ "id"
223
+ ],
224
+ "onDelete": "cascade",
225
+ "onUpdate": "no action"
226
+ }
227
+ },
228
+ "compositePrimaryKeys": {},
229
+ "uniqueConstraints": {},
230
+ "policies": {},
231
+ "checkConstraints": {},
232
+ "isRLSEnabled": false
233
+ },
234
+ "public.systems": {
235
+ "name": "systems",
236
+ "schema": "",
237
+ "columns": {
238
+ "id": {
239
+ "name": "id",
240
+ "type": "text",
241
+ "primaryKey": true,
242
+ "notNull": true
243
+ },
244
+ "name": {
245
+ "name": "name",
246
+ "type": "text",
247
+ "primaryKey": false,
248
+ "notNull": true
249
+ },
250
+ "description": {
251
+ "name": "description",
252
+ "type": "text",
253
+ "primaryKey": false,
254
+ "notNull": false
255
+ },
256
+ "metadata": {
257
+ "name": "metadata",
258
+ "type": "json",
259
+ "primaryKey": false,
260
+ "notNull": false,
261
+ "default": "'{}'::json"
262
+ },
263
+ "created_at": {
264
+ "name": "created_at",
265
+ "type": "timestamp",
266
+ "primaryKey": false,
267
+ "notNull": true,
268
+ "default": "now()"
269
+ },
270
+ "updated_at": {
271
+ "name": "updated_at",
272
+ "type": "timestamp",
273
+ "primaryKey": false,
274
+ "notNull": true,
275
+ "default": "now()"
276
+ }
277
+ },
278
+ "indexes": {
279
+ "systems_name_unique": {
280
+ "name": "systems_name_unique",
281
+ "columns": [
282
+ {
283
+ "expression": "name",
284
+ "isExpression": false,
285
+ "asc": true,
286
+ "nulls": "last"
287
+ }
288
+ ],
289
+ "isUnique": true,
290
+ "concurrently": false,
291
+ "method": "btree",
292
+ "with": {}
293
+ }
294
+ },
295
+ "foreignKeys": {},
296
+ "compositePrimaryKeys": {},
297
+ "uniqueConstraints": {},
298
+ "policies": {},
299
+ "checkConstraints": {},
300
+ "isRLSEnabled": false
301
+ },
302
+ "public.systems_environments": {
303
+ "name": "systems_environments",
304
+ "schema": "",
305
+ "columns": {
306
+ "system_id": {
307
+ "name": "system_id",
308
+ "type": "text",
309
+ "primaryKey": false,
310
+ "notNull": true
311
+ },
312
+ "environment_id": {
313
+ "name": "environment_id",
314
+ "type": "text",
315
+ "primaryKey": false,
316
+ "notNull": true
317
+ }
318
+ },
319
+ "indexes": {},
320
+ "foreignKeys": {
321
+ "systems_environments_system_id_systems_id_fk": {
322
+ "name": "systems_environments_system_id_systems_id_fk",
323
+ "tableFrom": "systems_environments",
324
+ "tableTo": "systems",
325
+ "columnsFrom": [
326
+ "system_id"
327
+ ],
328
+ "columnsTo": [
329
+ "id"
330
+ ],
331
+ "onDelete": "cascade",
332
+ "onUpdate": "no action"
333
+ },
334
+ "systems_environments_environment_id_environments_id_fk": {
335
+ "name": "systems_environments_environment_id_environments_id_fk",
336
+ "tableFrom": "systems_environments",
337
+ "tableTo": "environments",
338
+ "columnsFrom": [
339
+ "environment_id"
340
+ ],
341
+ "columnsTo": [
342
+ "id"
343
+ ],
344
+ "onDelete": "cascade",
345
+ "onUpdate": "no action"
346
+ }
347
+ },
348
+ "compositePrimaryKeys": {
349
+ "systems_environments_system_id_environment_id_pk": {
350
+ "name": "systems_environments_system_id_environment_id_pk",
351
+ "columns": [
352
+ "system_id",
353
+ "environment_id"
354
+ ]
355
+ }
356
+ },
357
+ "uniqueConstraints": {},
358
+ "policies": {},
359
+ "checkConstraints": {},
360
+ "isRLSEnabled": false
361
+ },
362
+ "public.systems_groups": {
363
+ "name": "systems_groups",
364
+ "schema": "",
365
+ "columns": {
366
+ "system_id": {
367
+ "name": "system_id",
368
+ "type": "text",
369
+ "primaryKey": false,
370
+ "notNull": true
371
+ },
372
+ "group_id": {
373
+ "name": "group_id",
374
+ "type": "text",
375
+ "primaryKey": false,
376
+ "notNull": true
377
+ }
378
+ },
379
+ "indexes": {},
380
+ "foreignKeys": {
381
+ "systems_groups_system_id_systems_id_fk": {
382
+ "name": "systems_groups_system_id_systems_id_fk",
383
+ "tableFrom": "systems_groups",
384
+ "tableTo": "systems",
385
+ "columnsFrom": [
386
+ "system_id"
387
+ ],
388
+ "columnsTo": [
389
+ "id"
390
+ ],
391
+ "onDelete": "cascade",
392
+ "onUpdate": "no action"
393
+ },
394
+ "systems_groups_group_id_groups_id_fk": {
395
+ "name": "systems_groups_group_id_groups_id_fk",
396
+ "tableFrom": "systems_groups",
397
+ "tableTo": "groups",
398
+ "columnsFrom": [
399
+ "group_id"
400
+ ],
401
+ "columnsTo": [
402
+ "id"
403
+ ],
404
+ "onDelete": "cascade",
405
+ "onUpdate": "no action"
406
+ }
407
+ },
408
+ "compositePrimaryKeys": {
409
+ "systems_groups_system_id_group_id_pk": {
410
+ "name": "systems_groups_system_id_group_id_pk",
411
+ "columns": [
412
+ "system_id",
413
+ "group_id"
414
+ ]
415
+ }
416
+ },
417
+ "uniqueConstraints": {},
418
+ "policies": {},
419
+ "checkConstraints": {},
420
+ "isRLSEnabled": false
421
+ },
422
+ "public.views": {
423
+ "name": "views",
424
+ "schema": "",
425
+ "columns": {
426
+ "id": {
427
+ "name": "id",
428
+ "type": "text",
429
+ "primaryKey": true,
430
+ "notNull": true
431
+ },
432
+ "name": {
433
+ "name": "name",
434
+ "type": "text",
435
+ "primaryKey": false,
436
+ "notNull": true
437
+ },
438
+ "description": {
439
+ "name": "description",
440
+ "type": "text",
441
+ "primaryKey": false,
442
+ "notNull": false
443
+ },
444
+ "configuration": {
445
+ "name": "configuration",
446
+ "type": "json",
447
+ "primaryKey": false,
448
+ "notNull": true,
449
+ "default": "'[]'::json"
450
+ },
451
+ "created_at": {
452
+ "name": "created_at",
453
+ "type": "timestamp",
454
+ "primaryKey": false,
455
+ "notNull": true,
456
+ "default": "now()"
457
+ },
458
+ "updated_at": {
459
+ "name": "updated_at",
460
+ "type": "timestamp",
461
+ "primaryKey": false,
462
+ "notNull": true,
463
+ "default": "now()"
464
+ }
465
+ },
466
+ "indexes": {},
467
+ "foreignKeys": {},
468
+ "compositePrimaryKeys": {},
469
+ "uniqueConstraints": {},
470
+ "policies": {},
471
+ "checkConstraints": {},
472
+ "isRLSEnabled": false
473
+ }
474
+ },
475
+ "enums": {
476
+ "public.contact_type": {
477
+ "name": "contact_type",
478
+ "schema": "public",
479
+ "values": [
480
+ "user",
481
+ "mailbox"
482
+ ]
483
+ }
484
+ },
485
+ "schemas": {},
486
+ "sequences": {},
487
+ "roles": {},
488
+ "policies": {},
489
+ "views": {},
490
+ "_meta": {
491
+ "columns": {},
492
+ "schemas": {},
493
+ "tables": {}
494
+ }
495
+ }