@checkstack/backend 0.8.1 → 0.9.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 (40) hide show
  1. package/CHANGELOG.md +280 -0
  2. package/drizzle/0001_slim_mordo.sql +34 -0
  3. package/drizzle/meta/0001_snapshot.json +444 -0
  4. package/drizzle/meta/_journal.json +7 -0
  5. package/package.json +14 -9
  6. package/src/index.ts +460 -23
  7. package/src/plugin-deregistration.test.ts +137 -0
  8. package/src/plugin-manager/api-router.ts +35 -11
  9. package/src/plugin-manager/core-services.ts +21 -2
  10. package/src/plugin-manager/plugin-loader.ts +94 -0
  11. package/src/plugin-manager.ts +324 -105
  12. package/src/router-incremental.test.ts +49 -0
  13. package/src/schema.ts +79 -1
  14. package/src/services/compatibility-checker.test.ts +146 -0
  15. package/src/services/compatibility-checker.ts +137 -0
  16. package/src/services/dev-auth.test.ts +87 -0
  17. package/src/services/dev-auth.ts +56 -0
  18. package/src/services/plugin-artifact-store.ts +131 -0
  19. package/src/services/plugin-bundle-resolver.ts +76 -0
  20. package/src/services/plugin-event-recorder.ts +87 -0
  21. package/src/services/plugin-installers/catalog-installer.ts +33 -0
  22. package/src/services/plugin-installers/github-installer.ts +207 -0
  23. package/src/services/plugin-installers/install-from-tarball.ts +69 -0
  24. package/src/services/plugin-installers/installer-registry.ts +51 -0
  25. package/src/services/plugin-installers/npm-installer.ts +156 -0
  26. package/src/services/plugin-installers/plugin-install-error.ts +37 -0
  27. package/src/services/plugin-installers/tarball-installer.ts +80 -0
  28. package/src/services/plugin-installers/tarball-utils.test.ts +200 -0
  29. package/src/services/plugin-installers/tarball-utils.ts +172 -0
  30. package/src/services/plugin-manager-orchestrator.ts +522 -0
  31. package/src/services/plugin-manager-router.ts +219 -0
  32. package/src/services/readiness-registry.test.ts +124 -0
  33. package/src/services/readiness-registry.ts +103 -0
  34. package/src/utils/plugin-discovery.test.ts +6 -0
  35. package/src/utils/plugin-discovery.ts +6 -1
  36. package/tsconfig.json +36 -1
  37. package/src/plugin-lifecycle.test.ts +0 -276
  38. package/src/plugin-manager/plugin-admin-router.ts +0 -89
  39. package/src/services/plugin-installer.test.ts +0 -90
  40. package/src/services/plugin-installer.ts +0 -70
@@ -0,0 +1,444 @@
1
+ {
2
+ "id": "e9c1c743-ed3f-4089-a3af-cc26af23c28d",
3
+ "prevId": "0f04d1ab-b47d-4057-b267-4b904deebd99",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.jwt_keys": {
8
+ "name": "jwt_keys",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "public_key": {
18
+ "name": "public_key",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "private_key": {
24
+ "name": "private_key",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "algorithm": {
30
+ "name": "algorithm",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "created_at": {
36
+ "name": "created_at",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "expires_at": {
42
+ "name": "expires_at",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "revoked_at": {
48
+ "name": "revoked_at",
49
+ "type": "text",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ }
53
+ },
54
+ "indexes": {},
55
+ "foreignKeys": {},
56
+ "compositePrimaryKeys": {},
57
+ "uniqueConstraints": {},
58
+ "policies": {},
59
+ "checkConstraints": {},
60
+ "isRLSEnabled": false
61
+ },
62
+ "public.plugin_artifacts": {
63
+ "name": "plugin_artifacts",
64
+ "schema": "",
65
+ "columns": {
66
+ "id": {
67
+ "name": "id",
68
+ "type": "uuid",
69
+ "primaryKey": true,
70
+ "notNull": true,
71
+ "default": "gen_random_uuid()"
72
+ },
73
+ "plugin_name": {
74
+ "name": "plugin_name",
75
+ "type": "text",
76
+ "primaryKey": false,
77
+ "notNull": true
78
+ },
79
+ "version": {
80
+ "name": "version",
81
+ "type": "text",
82
+ "primaryKey": false,
83
+ "notNull": true
84
+ },
85
+ "bundle_id": {
86
+ "name": "bundle_id",
87
+ "type": "uuid",
88
+ "primaryKey": false,
89
+ "notNull": false
90
+ },
91
+ "tarball": {
92
+ "name": "tarball",
93
+ "type": "text",
94
+ "primaryKey": false,
95
+ "notNull": true
96
+ },
97
+ "content_hash": {
98
+ "name": "content_hash",
99
+ "type": "text",
100
+ "primaryKey": false,
101
+ "notNull": true
102
+ },
103
+ "size_bytes": {
104
+ "name": "size_bytes",
105
+ "type": "integer",
106
+ "primaryKey": false,
107
+ "notNull": true
108
+ },
109
+ "created_at": {
110
+ "name": "created_at",
111
+ "type": "timestamp",
112
+ "primaryKey": false,
113
+ "notNull": true,
114
+ "default": "now()"
115
+ }
116
+ },
117
+ "indexes": {
118
+ "plugin_artifacts_name_version_idx": {
119
+ "name": "plugin_artifacts_name_version_idx",
120
+ "columns": [
121
+ {
122
+ "expression": "plugin_name",
123
+ "isExpression": false,
124
+ "asc": true,
125
+ "nulls": "last"
126
+ },
127
+ {
128
+ "expression": "version",
129
+ "isExpression": false,
130
+ "asc": true,
131
+ "nulls": "last"
132
+ }
133
+ ],
134
+ "isUnique": true,
135
+ "concurrently": false,
136
+ "method": "btree",
137
+ "with": {}
138
+ },
139
+ "plugin_artifacts_content_hash_idx": {
140
+ "name": "plugin_artifacts_content_hash_idx",
141
+ "columns": [
142
+ {
143
+ "expression": "content_hash",
144
+ "isExpression": false,
145
+ "asc": true,
146
+ "nulls": "last"
147
+ }
148
+ ],
149
+ "isUnique": false,
150
+ "concurrently": false,
151
+ "method": "btree",
152
+ "with": {}
153
+ }
154
+ },
155
+ "foreignKeys": {},
156
+ "compositePrimaryKeys": {},
157
+ "uniqueConstraints": {},
158
+ "policies": {},
159
+ "checkConstraints": {},
160
+ "isRLSEnabled": false
161
+ },
162
+ "public.plugin_configs": {
163
+ "name": "plugin_configs",
164
+ "schema": "",
165
+ "columns": {
166
+ "plugin_id": {
167
+ "name": "plugin_id",
168
+ "type": "text",
169
+ "primaryKey": false,
170
+ "notNull": true
171
+ },
172
+ "config_id": {
173
+ "name": "config_id",
174
+ "type": "text",
175
+ "primaryKey": false,
176
+ "notNull": true
177
+ },
178
+ "data": {
179
+ "name": "data",
180
+ "type": "jsonb",
181
+ "primaryKey": false,
182
+ "notNull": true
183
+ },
184
+ "updated_at": {
185
+ "name": "updated_at",
186
+ "type": "timestamp",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "default": "now()"
190
+ }
191
+ },
192
+ "indexes": {},
193
+ "foreignKeys": {},
194
+ "compositePrimaryKeys": {
195
+ "plugin_configs_plugin_id_config_id_pk": {
196
+ "name": "plugin_configs_plugin_id_config_id_pk",
197
+ "columns": [
198
+ "plugin_id",
199
+ "config_id"
200
+ ]
201
+ }
202
+ },
203
+ "uniqueConstraints": {},
204
+ "policies": {},
205
+ "checkConstraints": {},
206
+ "isRLSEnabled": false
207
+ },
208
+ "public.plugin_install_events": {
209
+ "name": "plugin_install_events",
210
+ "schema": "",
211
+ "columns": {
212
+ "id": {
213
+ "name": "id",
214
+ "type": "uuid",
215
+ "primaryKey": true,
216
+ "notNull": true,
217
+ "default": "gen_random_uuid()"
218
+ },
219
+ "plugin_name": {
220
+ "name": "plugin_name",
221
+ "type": "text",
222
+ "primaryKey": false,
223
+ "notNull": false
224
+ },
225
+ "bundle_id": {
226
+ "name": "bundle_id",
227
+ "type": "uuid",
228
+ "primaryKey": false,
229
+ "notNull": false
230
+ },
231
+ "action": {
232
+ "name": "action",
233
+ "type": "text",
234
+ "primaryKey": false,
235
+ "notNull": true
236
+ },
237
+ "phase": {
238
+ "name": "phase",
239
+ "type": "text",
240
+ "primaryKey": false,
241
+ "notNull": true
242
+ },
243
+ "status": {
244
+ "name": "status",
245
+ "type": "text",
246
+ "primaryKey": false,
247
+ "notNull": true
248
+ },
249
+ "source": {
250
+ "name": "source",
251
+ "type": "jsonb",
252
+ "primaryKey": false,
253
+ "notNull": false
254
+ },
255
+ "error": {
256
+ "name": "error",
257
+ "type": "text",
258
+ "primaryKey": false,
259
+ "notNull": false
260
+ },
261
+ "instance_id": {
262
+ "name": "instance_id",
263
+ "type": "text",
264
+ "primaryKey": false,
265
+ "notNull": true
266
+ },
267
+ "user_id": {
268
+ "name": "user_id",
269
+ "type": "text",
270
+ "primaryKey": false,
271
+ "notNull": false
272
+ },
273
+ "created_at": {
274
+ "name": "created_at",
275
+ "type": "timestamp",
276
+ "primaryKey": false,
277
+ "notNull": true,
278
+ "default": "now()"
279
+ }
280
+ },
281
+ "indexes": {
282
+ "plugin_install_events_name_created_idx": {
283
+ "name": "plugin_install_events_name_created_idx",
284
+ "columns": [
285
+ {
286
+ "expression": "plugin_name",
287
+ "isExpression": false,
288
+ "asc": true,
289
+ "nulls": "last"
290
+ },
291
+ {
292
+ "expression": "created_at",
293
+ "isExpression": false,
294
+ "asc": true,
295
+ "nulls": "last"
296
+ }
297
+ ],
298
+ "isUnique": false,
299
+ "concurrently": false,
300
+ "method": "btree",
301
+ "with": {}
302
+ },
303
+ "plugin_install_events_status_created_idx": {
304
+ "name": "plugin_install_events_status_created_idx",
305
+ "columns": [
306
+ {
307
+ "expression": "status",
308
+ "isExpression": false,
309
+ "asc": true,
310
+ "nulls": "last"
311
+ },
312
+ {
313
+ "expression": "created_at",
314
+ "isExpression": false,
315
+ "asc": true,
316
+ "nulls": "last"
317
+ }
318
+ ],
319
+ "isUnique": false,
320
+ "concurrently": false,
321
+ "method": "btree",
322
+ "with": {}
323
+ }
324
+ },
325
+ "foreignKeys": {},
326
+ "compositePrimaryKeys": {},
327
+ "uniqueConstraints": {},
328
+ "policies": {},
329
+ "checkConstraints": {},
330
+ "isRLSEnabled": false
331
+ },
332
+ "public.plugins": {
333
+ "name": "plugins",
334
+ "schema": "",
335
+ "columns": {
336
+ "id": {
337
+ "name": "id",
338
+ "type": "serial",
339
+ "primaryKey": true,
340
+ "notNull": true
341
+ },
342
+ "name": {
343
+ "name": "name",
344
+ "type": "text",
345
+ "primaryKey": false,
346
+ "notNull": true
347
+ },
348
+ "path": {
349
+ "name": "path",
350
+ "type": "text",
351
+ "primaryKey": false,
352
+ "notNull": true
353
+ },
354
+ "is_uninstallable": {
355
+ "name": "is_uninstallable",
356
+ "type": "boolean",
357
+ "primaryKey": false,
358
+ "notNull": true,
359
+ "default": false
360
+ },
361
+ "config": {
362
+ "name": "config",
363
+ "type": "json",
364
+ "primaryKey": false,
365
+ "notNull": false,
366
+ "default": "'{}'::json"
367
+ },
368
+ "enabled": {
369
+ "name": "enabled",
370
+ "type": "boolean",
371
+ "primaryKey": false,
372
+ "notNull": true,
373
+ "default": true
374
+ },
375
+ "type": {
376
+ "name": "type",
377
+ "type": "text",
378
+ "primaryKey": false,
379
+ "notNull": true,
380
+ "default": "'backend'"
381
+ },
382
+ "version": {
383
+ "name": "version",
384
+ "type": "text",
385
+ "primaryKey": false,
386
+ "notNull": true,
387
+ "default": "''"
388
+ },
389
+ "metadata": {
390
+ "name": "metadata",
391
+ "type": "jsonb",
392
+ "primaryKey": false,
393
+ "notNull": true,
394
+ "default": "'{}'::jsonb"
395
+ },
396
+ "source": {
397
+ "name": "source",
398
+ "type": "jsonb",
399
+ "primaryKey": false,
400
+ "notNull": false
401
+ },
402
+ "bundle_id": {
403
+ "name": "bundle_id",
404
+ "type": "uuid",
405
+ "primaryKey": false,
406
+ "notNull": false
407
+ },
408
+ "is_primary": {
409
+ "name": "is_primary",
410
+ "type": "boolean",
411
+ "primaryKey": false,
412
+ "notNull": true,
413
+ "default": false
414
+ }
415
+ },
416
+ "indexes": {},
417
+ "foreignKeys": {},
418
+ "compositePrimaryKeys": {},
419
+ "uniqueConstraints": {
420
+ "plugins_name_unique": {
421
+ "name": "plugins_name_unique",
422
+ "nullsNotDistinct": false,
423
+ "columns": [
424
+ "name"
425
+ ]
426
+ }
427
+ },
428
+ "policies": {},
429
+ "checkConstraints": {},
430
+ "isRLSEnabled": false
431
+ }
432
+ },
433
+ "enums": {},
434
+ "schemas": {},
435
+ "sequences": {},
436
+ "roles": {},
437
+ "policies": {},
438
+ "views": {},
439
+ "_meta": {
440
+ "columns": {},
441
+ "schemas": {},
442
+ "tables": {}
443
+ }
444
+ }
@@ -8,6 +8,13 @@
8
8
  "when": 1767314744846,
9
9
  "tag": "0000_loose_yellow_claw",
10
10
  "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1777826951043,
16
+ "tag": "0001_slim_mordo",
17
+ "breakpoints": true
11
18
  }
12
19
  ]
13
20
  }
package/package.json CHANGED
@@ -1,27 +1,29 @@
1
1
  {
2
2
  "name": "@checkstack/backend",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
+ "license": "Elastic-2.0",
4
5
  "checkstack": {
5
6
  "type": "backend"
6
7
  },
7
8
  "type": "module",
8
9
  "scripts": {
9
10
  "dev": "bun --env-file=../../.env --watch src/index.ts",
10
- "typecheck": "tsc --noEmit",
11
+ "typecheck": "tsgo -b",
11
12
  "generate": "bun --env-file=../../.env run drizzle-kit generate",
12
13
  "lint": "bun run lint:code",
13
14
  "lint:code": "eslint . --max-warnings 0"
14
15
  },
15
16
  "dependencies": {
16
17
  "@checkstack/api-docs-common": "0.1.10",
17
- "@checkstack/auth-common": "0.6.3",
18
- "@checkstack/backend-api": "0.13.1",
18
+ "@checkstack/auth-common": "0.6.4",
19
+ "@checkstack/backend-api": "0.14.1",
19
20
  "@checkstack/common": "0.7.0",
20
21
  "@checkstack/drizzle-helper": "0.0.4",
21
- "@checkstack/cache-api": "0.2.1",
22
- "@checkstack/queue-api": "0.2.15",
23
- "@checkstack/signal-backend": "0.2.0",
22
+ "@checkstack/cache-api": "0.2.3",
23
+ "@checkstack/queue-api": "0.2.17",
24
+ "@checkstack/signal-backend": "0.2.2",
24
25
  "@checkstack/signal-common": "0.2.0",
26
+ "@checkstack/pluginmanager-common": "0.1.0",
25
27
  "@hono/zod-validator": "^0.7.6",
26
28
  "@orpc/client": "^1.13.14",
27
29
  "@orpc/contract": "^1.13.14",
@@ -33,15 +35,18 @@
33
35
  "hono": "^4.12.14",
34
36
  "jose": "^6.1.3",
35
37
  "pg": "^8.11.0",
38
+ "semver": "^7.6.3",
39
+ "tar": "^7.4.3",
36
40
  "winston": "^3.19.0",
37
41
  "zod": "^4.2.1"
38
42
  },
39
43
  "devDependencies": {
40
44
  "@types/pg": "^8.11.0",
41
45
  "@types/bun": "latest",
42
- "@checkstack/tsconfig": "0.0.5",
46
+ "@types/semver": "^7.5.0",
47
+ "@checkstack/tsconfig": "0.0.6",
43
48
  "@checkstack/scripts": "0.1.2",
44
- "@checkstack/test-utils-backend": "0.1.21",
49
+ "@checkstack/test-utils-backend": "0.1.23",
45
50
  "drizzle-kit": "^0.31.10"
46
51
  }
47
52
  }