bunqueue 2.4.6 → 2.5.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 (81) hide show
  1. package/README.md +45 -1
  2. package/dist/application/contextFactory.d.ts +1 -0
  3. package/dist/application/contextFactory.d.ts.map +1 -1
  4. package/dist/application/contextFactory.js +2 -0
  5. package/dist/application/contextFactory.js.map +1 -1
  6. package/dist/application/operations/ack.d.ts +1 -0
  7. package/dist/application/operations/ack.d.ts.map +1 -1
  8. package/dist/application/operations/ack.js +1 -0
  9. package/dist/application/operations/ack.js.map +1 -1
  10. package/dist/application/operations/ackHelpers.d.ts +1 -0
  11. package/dist/application/operations/ackHelpers.d.ts.map +1 -1
  12. package/dist/application/operations/ackHelpers.js +2 -1
  13. package/dist/application/operations/ackHelpers.js.map +1 -1
  14. package/dist/application/operations/queryOperations.d.ts +1 -0
  15. package/dist/application/operations/queryOperations.d.ts.map +1 -1
  16. package/dist/application/operations/queryOperations.js +16 -0
  17. package/dist/application/operations/queryOperations.js.map +1 -1
  18. package/dist/application/queueManager.d.ts +1 -0
  19. package/dist/application/queueManager.d.ts.map +1 -1
  20. package/dist/application/queueManager.js +5 -0
  21. package/dist/application/queueManager.js.map +1 -1
  22. package/dist/infrastructure/backup/s3BackupOperations.d.ts.map +1 -1
  23. package/dist/infrastructure/backup/s3BackupOperations.js +3 -1
  24. package/dist/infrastructure/backup/s3BackupOperations.js.map +1 -1
  25. package/dist/infrastructure/scheduler/cronScheduler.d.ts +18 -5
  26. package/dist/infrastructure/scheduler/cronScheduler.d.ts.map +1 -1
  27. package/dist/infrastructure/scheduler/cronScheduler.js +69 -14
  28. package/dist/infrastructure/scheduler/cronScheduler.js.map +1 -1
  29. package/dist/mcp/adapter.d.ts +341 -0
  30. package/dist/mcp/adapter.d.ts.map +1 -0
  31. package/dist/mcp/adapter.js +695 -0
  32. package/dist/mcp/adapter.js.map +1 -0
  33. package/dist/mcp/index.d.ts +26 -4
  34. package/dist/mcp/index.d.ts.map +1 -1
  35. package/dist/mcp/index.js +68 -87
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/mcp/resources.d.ts +8 -0
  38. package/dist/mcp/resources.d.ts.map +1 -0
  39. package/dist/mcp/resources.js +77 -0
  40. package/dist/mcp/resources.js.map +1 -0
  41. package/dist/mcp/tools/consumptionTools.d.ts +8 -0
  42. package/dist/mcp/tools/consumptionTools.d.ts.map +1 -0
  43. package/dist/mcp/tools/consumptionTools.js +94 -0
  44. package/dist/mcp/tools/consumptionTools.js.map +1 -0
  45. package/dist/mcp/tools/cronTools.d.ts +7 -0
  46. package/dist/mcp/tools/cronTools.d.ts.map +1 -0
  47. package/dist/mcp/tools/cronTools.js +50 -0
  48. package/dist/mcp/tools/cronTools.js.map +1 -0
  49. package/dist/mcp/tools/dlqTools.d.ts +7 -0
  50. package/dist/mcp/tools/dlqTools.d.ts.map +1 -0
  51. package/dist/mcp/tools/dlqTools.js +57 -0
  52. package/dist/mcp/tools/dlqTools.js.map +1 -0
  53. package/dist/mcp/tools/jobMgmtTools.d.ts +8 -0
  54. package/dist/mcp/tools/jobMgmtTools.d.ts.map +1 -0
  55. package/dist/mcp/tools/jobMgmtTools.js +60 -0
  56. package/dist/mcp/tools/jobMgmtTools.js.map +1 -0
  57. package/dist/mcp/tools/jobTools.d.ts +8 -0
  58. package/dist/mcp/tools/jobTools.d.ts.map +1 -0
  59. package/dist/mcp/tools/jobTools.js +112 -0
  60. package/dist/mcp/tools/jobTools.js.map +1 -0
  61. package/dist/mcp/tools/monitoringTools.d.ts +7 -0
  62. package/dist/mcp/tools/monitoringTools.d.ts.map +1 -0
  63. package/dist/mcp/tools/monitoringTools.js +92 -0
  64. package/dist/mcp/tools/monitoringTools.js.map +1 -0
  65. package/dist/mcp/tools/queueTools.d.ts +8 -0
  66. package/dist/mcp/tools/queueTools.d.ts.map +1 -0
  67. package/dist/mcp/tools/queueTools.js +125 -0
  68. package/dist/mcp/tools/queueTools.js.map +1 -0
  69. package/dist/mcp/tools/rateLimitTools.d.ts +7 -0
  70. package/dist/mcp/tools/rateLimitTools.d.ts.map +1 -0
  71. package/dist/mcp/tools/rateLimitTools.js +62 -0
  72. package/dist/mcp/tools/rateLimitTools.js.map +1 -0
  73. package/dist/mcp/tools/webhookTools.d.ts +7 -0
  74. package/dist/mcp/tools/webhookTools.d.ts.map +1 -0
  75. package/dist/mcp/tools/webhookTools.js +55 -0
  76. package/dist/mcp/tools/webhookTools.js.map +1 -0
  77. package/dist/mcp/tools/workerMgmtTools.d.ts +8 -0
  78. package/dist/mcp/tools/workerMgmtTools.d.ts.map +1 -0
  79. package/dist/mcp/tools/workerMgmtTools.js +32 -0
  80. package/dist/mcp/tools/workerMgmtTools.js.map +1 -0
  81. package/package.json +15 -13
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MCP Tools - Webhook Management
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { McpBackend } from '../adapter';
6
+ export declare function registerWebhookTools(server: McpServer, backend: McpBackend): void;
7
+ //# sourceMappingURL=webhookTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhookTools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/webhookTools.ts"],"names":[],"mappings":"AACA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,QAoE1E"}
@@ -0,0 +1,55 @@
1
+ /* eslint-disable @typescript-eslint/no-deprecated */
2
+ /**
3
+ * MCP Tools - Webhook Management
4
+ */
5
+ import { z } from 'zod';
6
+ export function registerWebhookTools(server, backend) {
7
+ server.tool('bunqueue_add_webhook', 'Add a webhook to receive notifications for job events.', {
8
+ url: z.url().describe('Webhook URL to receive POST requests'),
9
+ events: z
10
+ .array(z.enum([
11
+ 'job.completed',
12
+ 'job.failed',
13
+ 'job.progress',
14
+ 'job.active',
15
+ 'job.waiting',
16
+ 'job.delayed',
17
+ ]))
18
+ .describe('Events to subscribe to'),
19
+ queue: z.string().optional().describe('Limit to a specific queue (omit for all queues)'),
20
+ }, async ({ url, events, queue }) => {
21
+ const webhook = await backend.addWebhook(url, events, queue);
22
+ return {
23
+ content: [
24
+ { type: 'text', text: JSON.stringify({ success: true, ...webhook }, null, 2) },
25
+ ],
26
+ };
27
+ });
28
+ server.tool('bunqueue_remove_webhook', 'Remove a webhook by ID.', {
29
+ id: z.string().describe('Webhook ID to remove'),
30
+ }, async ({ id }) => {
31
+ const success = await backend.removeWebhook(id);
32
+ return { content: [{ type: 'text', text: JSON.stringify({ success, id }) }] };
33
+ });
34
+ server.tool('bunqueue_list_webhooks', 'List all registered webhooks.', {}, async () => {
35
+ const webhooks = await backend.listWebhooks();
36
+ return {
37
+ content: [
38
+ {
39
+ type: 'text',
40
+ text: JSON.stringify({ count: webhooks.length, webhooks }, null, 2),
41
+ },
42
+ ],
43
+ };
44
+ });
45
+ server.tool('bunqueue_set_webhook_enabled', 'Enable or disable a webhook without removing it.', {
46
+ id: z.string().describe('Webhook ID'),
47
+ enabled: z.boolean().describe('Whether the webhook should be enabled'),
48
+ }, async ({ id, enabled }) => {
49
+ const success = await backend.setWebhookEnabled(id, enabled);
50
+ return {
51
+ content: [{ type: 'text', text: JSON.stringify({ success, id, enabled }) }],
52
+ };
53
+ });
54
+ }
55
+ //# sourceMappingURL=webhookTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhookTools.js","sourceRoot":"","sources":["../../../src/mcp/tools/webhookTools.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,OAAmB;IACzE,MAAM,CAAC,IAAI,CACT,sBA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AAC,IAAI,CAAC,wBAAwB,EAAE,+BAA+B,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE;QACpF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC9C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACpE;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CACT,8BAA8B,EAC9B,kDAAkD,EAClD;QACE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;QACrC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KACvE,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;SACrF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * MCP Tools - Worker Management
3
+ * Register, unregister, heartbeat workers
4
+ */
5
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ import type { McpBackend } from '../adapter';
7
+ export declare function registerWorkerMgmtTools(server: McpServer, backend: McpBackend): void;
8
+ //# sourceMappingURL=workerMgmtTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerMgmtTools.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/workerMgmtTools.ts"],"names":[],"mappings":"AACA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,QAyC7E"}
@@ -0,0 +1,32 @@
1
+ /* eslint-disable @typescript-eslint/no-deprecated */
2
+ /**
3
+ * MCP Tools - Worker Management
4
+ * Register, unregister, heartbeat workers
5
+ */
6
+ import { z } from 'zod';
7
+ export function registerWorkerMgmtTools(server, backend) {
8
+ server.tool('bunqueue_register_worker', 'Register a new worker to process jobs from specified queues.', {
9
+ name: z.string().describe('Worker name/identifier'),
10
+ queues: z.array(z.string()).min(1).describe('Queues this worker will process'),
11
+ }, async ({ name, queues }) => {
12
+ const worker = await backend.registerWorker(name, queues);
13
+ return {
14
+ content: [
15
+ { type: 'text', text: JSON.stringify({ success: true, worker }, null, 2) },
16
+ ],
17
+ };
18
+ });
19
+ server.tool('bunqueue_unregister_worker', 'Unregister a worker, removing it from the active workers list.', {
20
+ workerId: z.string().describe('Worker ID to unregister'),
21
+ }, async ({ workerId }) => {
22
+ const success = await backend.unregisterWorker(workerId);
23
+ return { content: [{ type: 'text', text: JSON.stringify({ success, workerId }) }] };
24
+ });
25
+ server.tool('bunqueue_worker_heartbeat', 'Send a heartbeat to keep a registered worker alive.', {
26
+ workerId: z.string().describe('Worker ID'),
27
+ }, async ({ workerId }) => {
28
+ const success = await backend.workerHeartbeat(workerId);
29
+ return { content: [{ type: 'text', text: JSON.stringify({ success, workerId }) }] };
30
+ });
31
+ }
32
+ //# sourceMappingURL=workerMgmtTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workerMgmtTools.js","sourceRoot":"","sources":["../../../src/mcp/tools/workerMgmtTools.ts"],"names":[],"mappings":"AAAA,qDAAqD;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AI,CACT,2BAA2B,EAC3B,qDAAqD,EACrD;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;KAC3C,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACxD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/F,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bunqueue",
3
- "version": "2.4.6",
4
- "description": "High-performance job queue server written in TypeScript. SQLite persistence, cron scheduling, priorities, retries, DLQ, webhooks. Minimal dependencies.",
3
+ "version": "2.5.0",
4
+ "description": "High-performance job queue for Bun & AI agents. SQLite persistence, cron scheduling, priorities, retries, DLQ, webhooks, native MCP server. Zero external dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -58,23 +58,25 @@
58
58
  "prepublishOnly": "bun run build:lib"
59
59
  },
60
60
  "dependencies": {
61
- "msgpackr": "^1.11.0",
62
- "croner": "^9.0.0"
61
+ "@modelcontextprotocol/sdk": "^1.26.0",
62
+ "croner": "^10.0.1",
63
+ "msgpackr": "^1.11.8",
64
+ "zod": "^4.3.6"
63
65
  },
64
66
  "devDependencies": {
65
- "@eslint/js": "^9.39.2",
66
- "@types/bun": "latest",
67
- "bullmq": "^5.67.2",
68
- "elysia": "^1.4.22",
69
- "eslint": "^9.39.2",
67
+ "@eslint/js": "^10.0.1",
68
+ "@types/bun": "^1.3.9",
69
+ "bullmq": "^5.70.1",
70
+ "elysia": "^1.4.25",
71
+ "eslint": "^10.0.1",
70
72
  "eslint-config-prettier": "^10.1.8",
71
- "ioredis": "^5.9.2",
73
+ "ioredis": "^5.9.3",
72
74
  "prettier": "^3.8.1",
73
- "typescript": "^5.7.3",
74
- "typescript-eslint": "^8.54.0"
75
+ "typescript": "^5.9.3",
76
+ "typescript-eslint": "^8.56.1"
75
77
  },
76
78
  "peerDependencies": {
77
- "bun": ">=1.0.0"
79
+ "bun": "^1.3.9"
78
80
  },
79
81
  "keywords": [
80
82
  "bun",