diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-11-08 14:50:00 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-08 14:50:00 +0000 |
| commit | 99413db0e79a156a1b87eacd3c6a7b83e9df946e (patch) | |
| tree | 73f0a5fceb507f75f662a109b00beeb3fa6b16fb /packages/plugins-queue-restate/src/admin.ts | |
| parent | 737b03172c2e063ba311c23d6552418bd2ab1955 (diff) | |
| download | karakeep-99413db0e79a156a1b87eacd3c6a7b83e9df946e.tar.zst | |
refactor: consolidate multiple karakeep plugins into one package (#2101)
* refactor: consolidate plugin packages into single plugins directory
- Create new `packages/plugins` directory with consolidated package.json
- Move queue-liteque, queue-restate, and search-meilisearch to subdirectories
- Update imports in packages/shared-server/src/plugins.ts
- Remove individual plugin package directories
- Update shared-server dependency to use @karakeep/plugins
This reduces overhead of maintaining multiple separate packages for plugins.
* refactor: consolidate plugin config files to root level
- Move .oxlintrc.json to packages/plugins root
- Move vitest.config.ts to packages/plugins root
- Update vitest config paths to work from root
- Remove individual config files from plugin subdirectories
This reduces configuration duplication across plugin subdirectories.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'packages/plugins-queue-restate/src/admin.ts')
| -rw-r--r-- | packages/plugins-queue-restate/src/admin.ts | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/packages/plugins-queue-restate/src/admin.ts b/packages/plugins-queue-restate/src/admin.ts deleted file mode 100644 index dddc8f00..00000000 --- a/packages/plugins-queue-restate/src/admin.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { z } from "zod"; - -export class AdminClient { - constructor(private addr: string) {} - - async upsertDeployment(deploymentAddr: string) { - const res = await fetch(`${this.addr}/deployments`, { - method: "POST", - body: JSON.stringify({ - uri: deploymentAddr, - force: true, - }), - headers: { - "Content-Type": "application/json", - }, - }); - - if (!res.ok) { - throw new Error(`Failed to upsert deployment: ${res.status}`); - } - } - - async getStats(serviceName: string) { - const query = `select status, count(*) as count from sys_invocation where target_service_name='${serviceName}' group by status`; - const res = await fetch(`${this.addr}/query`, { - method: "POST", - body: JSON.stringify({ - query, - }), - headers: { - "Content-Type": "application/json", - Accept: "application/json", - }, - }); - - if (!res.ok) { - throw new Error(`Failed to get stats: ${res.status}`); - } - const zStatus = z.enum([ - "pending", - "scheduled", - "ready", - "running", - "paused", - "backing-off", - "suspended", - "completed", - ]); - const zSchema = z.object({ - rows: z.array( - z.object({ - status: zStatus, - count: z.number(), - }), - ), - }); - - return zSchema.parse(await res.json()).rows.reduce( - (acc, cur) => { - acc[cur.status] = cur.count; - return acc; - }, - { - pending: 0, - scheduled: 0, - ready: 0, - running: 0, - paused: 0, - "backing-off": 0, - suspended: 0, - completed: 0, - } as Record<z.infer<typeof zStatus>, number>, - ); - } -} |
