@warlock.js/queue 5.13.0 → 5.15.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 (46) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +43 -7
  3. package/cjs/index.cjs +525 -29
  4. package/cjs/index.cjs.map +1 -1
  5. package/esm/dashboard-boot.d.mts +20 -0
  6. package/esm/dashboard-boot.d.mts.map +1 -0
  7. package/esm/dashboard-boot.mjs +38 -0
  8. package/esm/dashboard-boot.mjs.map +1 -0
  9. package/esm/dashboard-guard-plugin.mjs +28 -0
  10. package/esm/dashboard-guard-plugin.mjs.map +1 -0
  11. package/esm/dashboard-middleware-adapter.mjs +39 -0
  12. package/esm/dashboard-middleware-adapter.mjs.map +1 -0
  13. package/esm/dashboard.d.mts +8 -0
  14. package/esm/dashboard.d.mts.map +1 -1
  15. package/esm/dashboard.mjs +3 -1
  16. package/esm/dashboard.mjs.map +1 -1
  17. package/esm/define-job.mjs +13 -6
  18. package/esm/define-job.mjs.map +1 -1
  19. package/esm/index.d.mts +4 -2
  20. package/esm/index.mjs +3 -1
  21. package/esm/queue-connector.d.mts.map +1 -1
  22. package/esm/queue-connector.mjs +17 -1
  23. package/esm/queue-connector.mjs.map +1 -1
  24. package/esm/queue-dashboard-unguarded.error.d.mts +13 -0
  25. package/esm/queue-dashboard-unguarded.error.d.mts.map +1 -0
  26. package/esm/queue-dashboard-unguarded.error.mjs +17 -0
  27. package/esm/queue-dashboard-unguarded.error.mjs.map +1 -0
  28. package/esm/types.d.mts +19 -2
  29. package/esm/types.d.mts.map +1 -1
  30. package/llms-full.txt +45 -9
  31. package/llms.txt +2 -2
  32. package/package.json +3 -17
  33. package/skills/configure-queue/SKILL.md +4 -0
  34. package/skills/manage-failed-jobs/SKILL.md +33 -4
  35. package/skills/overview/SKILL.md +1 -1
  36. package/skills/queue-notifications/SKILL.md +6 -4
  37. package/cjs/define-job-DideGKQK.cjs +0 -468
  38. package/cjs/define-job-DideGKQK.cjs.map +0 -1
  39. package/cjs/notifications/index.cjs +0 -68
  40. package/cjs/notifications/index.cjs.map +0 -1
  41. package/esm/notifications/index.d.mts +0 -2
  42. package/esm/notifications/index.mjs +0 -3
  43. package/esm/notifications/queue-notification-dispatcher.d.mts +0 -34
  44. package/esm/notifications/queue-notification-dispatcher.d.mts.map +0 -1
  45. package/esm/notifications/queue-notification-dispatcher.mjs +0 -67
  46. package/esm/notifications/queue-notification-dispatcher.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ All notable changes to `@warlock.js/queue` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 5.15.0 - 2026-09-18
8
+
9
+ ### BREAKING
10
+
11
+ - Removed `@warlock.js/queue/notifications` (`queueNotificationDispatcher`), deprecated in 5.14. Use `bullmqQueue()` from `@warlock.js/notifications` instead. The `@warlock.js/notifications` peer dependency is also dropped, since this was the only thing in the package that needed it.
12
+
13
+ ### Fixed
14
+
15
+ - The dashboard guard now ends the request explicitly when a middleware short-circuits, instead of leaving it to Fastify noticing the reply was already sent. The adapter has always returned a "handled" boolean for this; the hook discarded it, so whether an unauthenticated caller reached the dashboard depended on write ordering — a guard answering asynchronously could lose that race.
16
+
17
+ ## 5.14.0 - 2026-09-17
18
+
19
+ ### Added
20
+
21
+ - `dashboard: { enabled, path, middleware }` in `src/config/queue.ts`: the queue connector mounts Bull Board at boot, guarded by the given middleware.
22
+ - `QueueDashboardUnguardedError`: in production the dashboard refuses to mount without guard middleware, since it can retry and delete jobs.
23
+ - `queueDashboard()` accepts a `middleware` option.
24
+
25
+ ### Deprecated
26
+
27
+ - `@warlock.js/queue/notifications` (`queueNotificationDispatcher`): use `bullmqQueue()` from `@warlock.js/notifications`. It still works in 5.14, warns once, and is removed in the next release.
28
+
29
+ ### Fixed
30
+
31
+ - The connector registers the queue config when it mounts the dashboard at boot, so an app whose only queue usage is the dashboard no longer fails to start with `QueueNotConfiguredError`.
32
+ - `find(id)` no longer returns a completed job with `result: null` and `attemptsMade: 0` when the job finishes mid-read.
33
+
7
34
  ## 5.13.0 - 2026-09-17
8
35
 
9
36
  ### Added
package/README.md CHANGED
@@ -90,31 +90,67 @@ await retryFailedJob("invoice:43");
90
90
 
91
91
  ## Notifications
92
92
 
93
+ Vendor integrations live as lazy drivers inside the feature package now:
94
+ configure the BullMQ driver from `@warlock.js/notifications` itself.
95
+
93
96
  ```ts title="src/config/notifications.ts"
94
- import { queueNotificationDispatcher } from "@warlock.js/queue/notifications";
97
+ import { bullmqQueue } from "@warlock.js/notifications";
95
98
 
96
99
  const config: NotificationConfig = {
97
100
  channels: { mail: mailChannel() },
98
- queue: queueNotificationDispatcher({ attempts: 3 }),
101
+ queue: bullmqQueue({ attempts: 3 }),
99
102
  };
100
103
  ```
101
104
 
102
105
  `.queue()` notifications now go through BullMQ. `SendOptions.delay` is honoured.
106
+ `@warlock.js/queue` is dynamically imported the first time `.queue()` runs —
107
+ notifications never pays for it unless `bullmqQueue()` is configured.
108
+
103
109
 
104
110
  ## Dashboard (optional)
105
111
 
106
112
  ```sh
107
- npm install @bull-board/api @bull-board/fastify
113
+ warlock add bull-board
108
114
  ```
109
115
 
116
+ Installs `@bull-board/api` and `@bull-board/fastify` and adds a `dashboard` block to
117
+ `src/config/queue.ts`:
118
+
110
119
  ```ts
111
- import { getHttpServer } from "@warlock.js/core";
112
- import { queueDashboard } from "@warlock.js/queue";
120
+ import { middleware } from "@warlock.js/core";
121
+ import { authMiddleware } from "@warlock.js/auth";
122
+ import type { QueueConfig } from "@warlock.js/queue";
113
123
 
114
- await queueDashboard(getHttpServer(), { basePath: "/admin/queues" });
124
+ const queueConfig: QueueConfig = {
125
+ // ...
126
+ dashboard: {
127
+ enabled: true,
128
+ path: "/admin/queues",
129
+ // Runs before every dashboard route — the dashboard can retry and delete
130
+ // jobs, so guard it. An empty list here throws
131
+ // QueueDashboardUnguardedError at boot when NODE_ENV is "production".
132
+ middleware: [authMiddleware("admin")],
133
+ },
134
+ };
135
+
136
+ export default queueConfig;
115
137
  ```
116
138
 
117
- The bull-board packages are loaded only when `queueDashboard` is called. If they are missing it throws `QueueDashboardDependencyError` with the install command. Protect the route yourself; the dashboard can retry and delete jobs.
139
+ `queueConnector()` mounts the dashboard for you at boot, once the HTTP server exists.
140
+ Outside production an empty `middleware` list is allowed — it mounts anyway and logs one
141
+ warning, so local development stays frictionless.
142
+
143
+ > **Advanced — mounting manually:** `queueDashboard(server, { basePath, middleware, queues })`
144
+ > is still exported for scripts, worker-only processes, or a custom mount point. The
145
+ > bull-board packages are loaded only when it is called; a missing one throws
146
+ > `QueueDashboardDependencyError` with the install command.
147
+ >
148
+ > ```ts
149
+ > import { getHttpServer } from "@warlock.js/core";
150
+ > import { queueDashboard } from "@warlock.js/queue";
151
+ >
152
+ > await queueDashboard(getHttpServer(), { basePath: "/admin/queues", middleware: [authMiddleware("admin")] });
153
+ > ```
118
154
 
119
155
  ## License
120
156