@checkstack/catalog-backend 1.3.0 → 1.4.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +149 -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 +15 -12
  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,479 @@
1
+ {
2
+ "id": "43935c26-5b88-4e16-a65d-9ba7fe3e305d",
3
+ "prevId": "d0f3aff8-8024-4eec-9407-77c1991ecf62",
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
+ "foreignKeys": {},
280
+ "compositePrimaryKeys": {},
281
+ "uniqueConstraints": {},
282
+ "policies": {},
283
+ "checkConstraints": {},
284
+ "isRLSEnabled": false
285
+ },
286
+ "public.systems_environments": {
287
+ "name": "systems_environments",
288
+ "schema": "",
289
+ "columns": {
290
+ "system_id": {
291
+ "name": "system_id",
292
+ "type": "text",
293
+ "primaryKey": false,
294
+ "notNull": true
295
+ },
296
+ "environment_id": {
297
+ "name": "environment_id",
298
+ "type": "text",
299
+ "primaryKey": false,
300
+ "notNull": true
301
+ }
302
+ },
303
+ "indexes": {},
304
+ "foreignKeys": {
305
+ "systems_environments_system_id_systems_id_fk": {
306
+ "name": "systems_environments_system_id_systems_id_fk",
307
+ "tableFrom": "systems_environments",
308
+ "tableTo": "systems",
309
+ "columnsFrom": [
310
+ "system_id"
311
+ ],
312
+ "columnsTo": [
313
+ "id"
314
+ ],
315
+ "onDelete": "cascade",
316
+ "onUpdate": "no action"
317
+ },
318
+ "systems_environments_environment_id_environments_id_fk": {
319
+ "name": "systems_environments_environment_id_environments_id_fk",
320
+ "tableFrom": "systems_environments",
321
+ "tableTo": "environments",
322
+ "columnsFrom": [
323
+ "environment_id"
324
+ ],
325
+ "columnsTo": [
326
+ "id"
327
+ ],
328
+ "onDelete": "cascade",
329
+ "onUpdate": "no action"
330
+ }
331
+ },
332
+ "compositePrimaryKeys": {
333
+ "systems_environments_system_id_environment_id_pk": {
334
+ "name": "systems_environments_system_id_environment_id_pk",
335
+ "columns": [
336
+ "system_id",
337
+ "environment_id"
338
+ ]
339
+ }
340
+ },
341
+ "uniqueConstraints": {},
342
+ "policies": {},
343
+ "checkConstraints": {},
344
+ "isRLSEnabled": false
345
+ },
346
+ "public.systems_groups": {
347
+ "name": "systems_groups",
348
+ "schema": "",
349
+ "columns": {
350
+ "system_id": {
351
+ "name": "system_id",
352
+ "type": "text",
353
+ "primaryKey": false,
354
+ "notNull": true
355
+ },
356
+ "group_id": {
357
+ "name": "group_id",
358
+ "type": "text",
359
+ "primaryKey": false,
360
+ "notNull": true
361
+ }
362
+ },
363
+ "indexes": {},
364
+ "foreignKeys": {
365
+ "systems_groups_system_id_systems_id_fk": {
366
+ "name": "systems_groups_system_id_systems_id_fk",
367
+ "tableFrom": "systems_groups",
368
+ "tableTo": "systems",
369
+ "columnsFrom": [
370
+ "system_id"
371
+ ],
372
+ "columnsTo": [
373
+ "id"
374
+ ],
375
+ "onDelete": "cascade",
376
+ "onUpdate": "no action"
377
+ },
378
+ "systems_groups_group_id_groups_id_fk": {
379
+ "name": "systems_groups_group_id_groups_id_fk",
380
+ "tableFrom": "systems_groups",
381
+ "tableTo": "groups",
382
+ "columnsFrom": [
383
+ "group_id"
384
+ ],
385
+ "columnsTo": [
386
+ "id"
387
+ ],
388
+ "onDelete": "cascade",
389
+ "onUpdate": "no action"
390
+ }
391
+ },
392
+ "compositePrimaryKeys": {
393
+ "systems_groups_system_id_group_id_pk": {
394
+ "name": "systems_groups_system_id_group_id_pk",
395
+ "columns": [
396
+ "system_id",
397
+ "group_id"
398
+ ]
399
+ }
400
+ },
401
+ "uniqueConstraints": {},
402
+ "policies": {},
403
+ "checkConstraints": {},
404
+ "isRLSEnabled": false
405
+ },
406
+ "public.views": {
407
+ "name": "views",
408
+ "schema": "",
409
+ "columns": {
410
+ "id": {
411
+ "name": "id",
412
+ "type": "text",
413
+ "primaryKey": true,
414
+ "notNull": true
415
+ },
416
+ "name": {
417
+ "name": "name",
418
+ "type": "text",
419
+ "primaryKey": false,
420
+ "notNull": true
421
+ },
422
+ "description": {
423
+ "name": "description",
424
+ "type": "text",
425
+ "primaryKey": false,
426
+ "notNull": false
427
+ },
428
+ "configuration": {
429
+ "name": "configuration",
430
+ "type": "json",
431
+ "primaryKey": false,
432
+ "notNull": true,
433
+ "default": "'[]'::json"
434
+ },
435
+ "created_at": {
436
+ "name": "created_at",
437
+ "type": "timestamp",
438
+ "primaryKey": false,
439
+ "notNull": true,
440
+ "default": "now()"
441
+ },
442
+ "updated_at": {
443
+ "name": "updated_at",
444
+ "type": "timestamp",
445
+ "primaryKey": false,
446
+ "notNull": true,
447
+ "default": "now()"
448
+ }
449
+ },
450
+ "indexes": {},
451
+ "foreignKeys": {},
452
+ "compositePrimaryKeys": {},
453
+ "uniqueConstraints": {},
454
+ "policies": {},
455
+ "checkConstraints": {},
456
+ "isRLSEnabled": false
457
+ }
458
+ },
459
+ "enums": {
460
+ "public.contact_type": {
461
+ "name": "contact_type",
462
+ "schema": "public",
463
+ "values": [
464
+ "user",
465
+ "mailbox"
466
+ ]
467
+ }
468
+ },
469
+ "schemas": {},
470
+ "sequences": {},
471
+ "roles": {},
472
+ "policies": {},
473
+ "views": {},
474
+ "_meta": {
475
+ "columns": {},
476
+ "schemas": {},
477
+ "tables": {}
478
+ }
479
+ }