bunqueue-dashboard 0.0.40 → 0.0.42
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.
- package/README.md +24 -8
- package/agent/backup/resultValidation.ts +1 -1
- package/agent/manager/config.ts +1 -1
- package/agent/manager/storageMode.ts +19 -0
- package/agent/manager.ts +5 -1
- package/agent/queue/routes.ts +33 -3
- package/agent/queue/runtime.ts +49 -3
- package/agent/queue/types.ts +16 -1
- package/agent/queue/validation.ts +8 -0
- package/agent/server/controlStatus.ts +5 -0
- package/agent/workflows.ts +1 -1
- package/dist/.vite/manifest.json +235 -216
- package/dist/assets/AddJob-FNaPbs_V.js +3 -0
- package/dist/assets/{Alerts-CFj-u0iV.js → Alerts-BvWBv-z7.js} +1 -1
- package/dist/assets/{Benchmark-Ey2sq57q.js → Benchmark-BywalSmU.js} +1 -1
- package/dist/assets/BulkAddJobs-IiL1uud0.js +5 -0
- package/dist/assets/{CopilotPanel-CniuIIPn.js → CopilotPanel-CH2jbbYA.js} +1 -1
- package/dist/assets/{Cron-B5XFBvU-.js → Cron-1DZTZWXO.js} +1 -1
- package/dist/assets/CronManager-B6xLLgI5.js +1 -0
- package/dist/assets/Database-BzEkXws0.js +3 -0
- package/dist/assets/{Diagnostics-BDRftXQy.js → Diagnostics-CPqhV3er.js} +1 -1
- package/dist/assets/{Dlq-CJO9itzJ.js → Dlq-CbLN0zQ5.js} +1 -1
- package/dist/assets/{DlqControl-DZL2lHOU.js → DlqControl-C5Bgzmk0.js} +1 -1
- package/dist/assets/DlqPro-Cgaxtuwh.js +1 -0
- package/dist/assets/Fleet-Bdrj9bLI.js +1 -0
- package/dist/assets/{Flows-BItJzbVQ.js → Flows-BtUGOaif.js} +2 -2
- package/dist/assets/{JobInspector-CJHX63p_.js → JobInspector-DsOt4mLJ.js} +2 -2
- package/dist/assets/{Jobs-BwmTsjJx.js → Jobs-BTMpbAHD.js} +1 -1
- package/dist/assets/{JobsPro-eFVAZJ10.js → JobsPro-BfXTm9gH.js} +1 -1
- package/dist/assets/{Logs-CXIf58M4.js → Logs-uuzU5ohI.js} +1 -1
- package/dist/assets/{LogsPro-Xm6rylAd.js → LogsPro-DHWbhWyq.js} +1 -1
- package/dist/assets/{McpServer-Rf3i6lRn.js → McpServer-BqmbhrKh.js} +2 -2
- package/dist/assets/{Metrics-Cj3VYxzL.js → Metrics-DKyBZoFa.js} +1 -1
- package/dist/assets/{MetricsPro-C63eY00A.js → MetricsPro-BR2ULqIc.js} +1 -1
- package/dist/assets/{Overview-CUM3XG7A.js → Overview-ClsyxH2e.js} +1 -1
- package/dist/assets/{QueueActions-b19K0vCT.js → QueueActions-BWnmNEqV.js} +1 -1
- package/dist/assets/QueueControl-BW0XXd0B.js +1 -0
- package/dist/assets/{QueueDetail-CpFIG1PU.js → QueueDetail-C1dXXN70.js} +1 -1
- package/dist/assets/{QueueDetailPro-BNlBOj5s.js → QueueDetailPro-DDGxs2J2.js} +1 -1
- package/dist/assets/{Queues-CZ2qc7FY.js → Queues-DkPuIy1C.js} +1 -1
- package/dist/assets/QueuesOverview-COo-V8D_.js +1 -0
- package/dist/assets/{S3Backup-x4mOV-AO.js → S3Backup-DNABHR2Q.js} +1 -1
- package/dist/assets/{S3BackupPro-BtvbPVg-.js → S3BackupPro-DxNVFvY1.js} +3 -3
- package/dist/assets/{ServerControl-C5nQ7CCp.js → ServerControl-B0Po974t.js} +2 -2
- package/dist/assets/Settings-z9k4EVa_.js +1 -0
- package/dist/assets/{Usage-UYovs3D-.js → Usage-cdWDQUaq.js} +1 -1
- package/dist/assets/{UsagePro-bT82DS-d.js → UsagePro-DLuwnM8n.js} +1 -1
- package/dist/assets/{Webhooks-BjsUMJAn.js → Webhooks-DT2LK17V.js} +1 -1
- package/dist/assets/{Workers-CD4YZpca.js → Workers-CVo9rJ_V.js} +1 -1
- package/dist/assets/{WorkersPro-hCPhfb1Z.js → WorkersPro-BYaredE9.js} +1 -1
- package/dist/assets/Workflows-DZZA6aGW.js +1 -0
- package/dist/assets/{api-BxYPEynh.js → api-BgWE-705.js} +1 -1
- package/dist/assets/bq-F5BbTG1T.js +1 -0
- package/dist/assets/connectionStore-BJLihGaC.js +1 -0
- package/dist/assets/controlConnectionEpoch-CZsS0wAb.js +1 -0
- package/dist/assets/{flowMutationSafety-DSd3JLAV.js → flowMutationSafety-YKTHxqKv.js} +1 -1
- package/dist/assets/index-C9yGKhQ8.css +1 -0
- package/dist/assets/index-mID5W7vq.js +8 -0
- package/dist/assets/{install-C5y2ohOo.js → install-D4uRZ7XA.js} +2 -2
- package/dist/assets/responses-BkR2JTH9.js +1 -0
- package/dist/assets/{toastStore-B31o6Z5J.js → toastStore-IZn6OPLZ.js} +1 -1
- package/dist/assets/{upstreamPaths-B_cyinGI.js → upstreamPaths-DQeKSxGc.js} +1 -1
- package/dist/assets/{useControlActionGuard-DT7uudrj.js → useControlActionGuard-B-bzKZKI.js} +1 -1
- package/dist/assets/usePolledData-0CVelkl2.js +1 -0
- package/dist/assets/{useServerActionGuard-Db7PPgaI.js → useServerActionGuard-uGePilQQ.js} +1 -1
- package/dist/assets/{useThroughputSeries-y7Yyi7Zh.js → useThroughputSeries-DgO8uicf.js} +1 -1
- package/dist/index.html +8 -8
- package/package.json +8 -4
- package/scripts/embedded.gen.ts +150 -148
- package/dist/assets/AddJob-DkbI_J5p.js +0 -3
- package/dist/assets/BulkAddJobs-BwPoeSB6.js +0 -5
- package/dist/assets/CronManager-Bdg2BECM.js +0 -1
- package/dist/assets/Database-CB0oOEFB.js +0 -3
- package/dist/assets/DlqPro-OqBlzCnN.js +0 -1
- package/dist/assets/QueueControl-DusMoa05.js +0 -1
- package/dist/assets/QueuesOverview-CBFqQ3N_.js +0 -1
- package/dist/assets/Settings-B5kCRSBH.js +0 -1
- package/dist/assets/Workflows-DOpeo-TP.js +0 -1
- package/dist/assets/bq-C7wdABtE.js +0 -1
- package/dist/assets/connectionStore-CFuNYZ_8.js +0 -1
- package/dist/assets/controlConnectionEpoch-DzbuWOhe.js +0 -1
- package/dist/assets/index-AUHH2nTG.js +0 -8
- package/dist/assets/index-BK7fjWKK.css +0 -1
- package/dist/assets/responses-DiIfPXXq.js +0 -1
- package/dist/assets/usePolledData-CNtNtd0a.js +0 -1
package/README.md
CHANGED
|
@@ -90,13 +90,13 @@ The full dashboard running on sample data, no server needed.
|
|
|
90
90
|
bunqueue exposes a rich HTTP API, but operating it by hand (curl, ad-hoc scripts) is slow and
|
|
91
91
|
error-prone. This dashboard is a production-oriented operator console: it exposes the verified,
|
|
92
92
|
safe subset of the API, fails closed where
|
|
93
|
-
[Bunqueue 2.9.x](https://github.com/egeominotti/bunqueue/releases/tag/v2.9.
|
|
93
|
+
[Bunqueue 2.9.x](https://github.com/egeominotti/bunqueue/releases/tag/v2.9.3) lacks atomic
|
|
94
94
|
flow-safety guarantees, and also manages the
|
|
95
95
|
server *process* through a separate guarded agent.
|
|
96
96
|
|
|
97
97
|
It uses Bunqueue's public HTTP API (`:6790`) for ordinary remote observability and a small local
|
|
98
98
|
**control agent** for process, FlowProducer, Workflow Engine, database, and backup operations. The
|
|
99
|
-
agent is pinned to the server it manages and uses the exact installable Bunqueue 2.9.
|
|
99
|
+
agent is pinned to the server it manages and uses the exact installable Bunqueue 2.9.3 npm client
|
|
100
100
|
contracts; it never patches Bunqueue internals.
|
|
101
101
|
|
|
102
102
|
## Features
|
|
@@ -104,10 +104,11 @@ contracts; it never patches Bunqueue internals.
|
|
|
104
104
|
| Area | Where | What you can do |
|
|
105
105
|
| --- | --- | --- |
|
|
106
106
|
| **Home** | Overview | Live health banner, throughput, queue health, recent activity |
|
|
107
|
+
| **Fleet** | Fleet | Probe and operate multiple Bunqueue APIs + paired agents; verify shared PostgreSQL target/namespace topology |
|
|
107
108
|
| **Server** | Control ▸ Server | **Start / stop / restart** the server process, edit its config, tail process logs |
|
|
108
109
|
| **Enqueue** | Control ▸ Add Job | Add jobs (single or bulk) with every option |
|
|
109
110
|
| **Inspect** | Control ▸ Job Inspector | Look up any job; promote / re-prioritize / delay; view data & result |
|
|
110
|
-
| **Queues** | Control ▸ Queue Control | Pause/resume/promote; desired-state writes plus live SDK limits, deduplication, metrics and journal retention |
|
|
111
|
+
| **Queues** | Control ▸ Queue Control | Pause/resume/promote; desired-state writes plus live SDK limits, group jobs/priorities/pause/policies, deduplication, metrics and journal retention |
|
|
111
112
|
| **Cron** | Control ▸ Cron Manager | Submit acknowledged cron/interval upserts and delete schedules |
|
|
112
113
|
| **Workflow Engine** | Workflow ▸ Overview / Executions / Waiting / Compensation / Archive | Start, recover, signal, inspect, compensate, archive and clean durable executions |
|
|
113
114
|
| **Job Flows** | Workflow ▸ Job Flows | Explore DAGs, run all FlowProducer create modes and operate safe Flow Job methods |
|
|
@@ -117,7 +118,7 @@ contracts; it never patches Bunqueue internals.
|
|
|
117
118
|
| **S3 backup** | Management ▸ S3 Backup | Configure, inspect, list, create and guarded-restore official snapshots |
|
|
118
119
|
| **Browse** | Queues / Jobs / DLQ / Cron / Metrics / Workers / Logs | Read-only browsing with basic actions |
|
|
119
120
|
|
|
120
|
-
> Job actions are gated by the v2.9.
|
|
121
|
+
> Job actions are gated by the v2.9.3 flow contract. Every DLQ retry and completed-job requeue is
|
|
121
122
|
> unavailable: the DLQ GET + POST sequence has no atomic generation/state/topology precondition and
|
|
122
123
|
> can target a job recreated under the same ID, while `retryCompleted` does not rebuild dependency
|
|
123
124
|
> registration or flow order. Cancel, Discard, Drain, Clean, Obliterate and DLQ Purge also fail
|
|
@@ -192,14 +193,22 @@ flowchart LR
|
|
|
192
193
|
- **Writes** through the same HTTP API, with every mutation shape-verified against the live server.
|
|
193
194
|
- **Process lifecycle**, the one thing HTTP can't do, is delegated to the local control agent.
|
|
194
195
|
|
|
196
|
+
For multiple brokers, create one named Dashboard profile and one paired control
|
|
197
|
+
agent per broker. The Fleet page probes all profiles without retargeting the
|
|
198
|
+
active UI, groups brokers that share an exact PostgreSQL target + namespace,
|
|
199
|
+
and drives each node's Start/Stop/Restart controls. Queue state is shared by
|
|
200
|
+
PostgreSQL; lifecycle, process logs/config, in-memory webhooks, and each agent's
|
|
201
|
+
Workflow Engine store remain node-local. See the
|
|
202
|
+
[Fleet guide](https://egeominotti.github.io/bunqueue-dashboard/docs/guide/fleet).
|
|
203
|
+
|
|
195
204
|
Two HTTP clients coexist on purpose: `src/lib/api.ts` (first-generation view pages) and
|
|
196
205
|
`src/lib/bq.ts` (the complete, shape-verified client used by every `Control ▸ *` page). See
|
|
197
206
|
[`docs/`](docs/README.md) for the full, source-verified reference.
|
|
198
207
|
|
|
199
208
|
## Configuration
|
|
200
209
|
|
|
201
|
-
The `VITE_*` dashboard defaults are build-time values and can **also**
|
|
202
|
-
|
|
210
|
+
The `VITE_*` dashboard defaults are build-time values and can **also** seed the first named profile
|
|
211
|
+
in **Settings**. Add up to 32 broker/agent profiles at runtime. The all-in-one server reads the non-`VITE_*` runtime variables below.
|
|
203
212
|
Copy [`.env.example`](.env.example) to `.env` to set defaults.
|
|
204
213
|
|
|
205
214
|
| Variable | Purpose | Default |
|
|
@@ -253,6 +262,9 @@ target-pinned Flow, Workflow, Queue and Backup agent operations.
|
|
|
253
262
|
| `bun run check` | Oxlint + Oxfmt validation (the CI gate) |
|
|
254
263
|
| `bun run check:fix` | Apply safe Oxlint fixes, then format with Oxfmt |
|
|
255
264
|
| `bun test` | Unit + agent-lifecycle tests |
|
|
265
|
+
| `bun run test:e2e:upgrade` | Real npm Bunqueue 2.9.2 SQLite schema-35 → 2.9.3 schema-37 migration and retention semantics |
|
|
266
|
+
| `bun run test:e2e` | Real Flow, Workflow, Queue SDK, and three-broker PostgreSQL runtime tests |
|
|
267
|
+
| `bun run test:e2e:postgres-fleet` | Three authenticated Bunqueue 2.9.3 brokers + three agents sharing disposable PostgreSQL 18.6 |
|
|
256
268
|
|
|
257
269
|
## Docker
|
|
258
270
|
|
|
@@ -299,8 +311,12 @@ The canonical gate must be green before a change is considered done; CI runs the
|
|
|
299
311
|
bun run quality # architecture, lint/build, size, docs, coverage, real E2E, packed-bin smoke, audit
|
|
300
312
|
```
|
|
301
313
|
|
|
302
|
-
The E2E stage starts disposable Bunqueue 2.9.
|
|
303
|
-
Workflow Engine, and Queue SDK operator bridges.
|
|
314
|
+
The E2E stage starts disposable Bunqueue 2.9.3 processes and exercises the complete FlowProducer,
|
|
315
|
+
Workflow Engine, and Queue SDK operator bridges. It also starts PostgreSQL 18.6 in Docker with
|
|
316
|
+
three authenticated brokers and paired agents, proving cross-broker enqueue/inspect/leased
|
|
317
|
+
pull+ack, pause/resume, cron, rate limits, group admission, group priority and group pause/resume
|
|
318
|
+
on PostgreSQL schema 20. Run it alone with `bun run test:e2e` (Docker is required for the
|
|
319
|
+
PostgreSQL stage).
|
|
304
320
|
|
|
305
321
|
The blocking browser job builds the production bundle under `/e2e/dashboard`, starts an
|
|
306
322
|
authenticated disposable Bunqueue server, and drives the UI with Playwright on Chromium, Firefox,
|
package/agent/manager/config.ts
CHANGED
|
@@ -10,7 +10,7 @@ const CONFIG_KEYS = new Set<keyof ServerConfig>([
|
|
|
10
10
|
|
|
11
11
|
export function defaultConfig(): ServerConfig {
|
|
12
12
|
return {
|
|
13
|
-
command: process.env.BUNQUEUE_START_CMD || 'bunx bunqueue@2.9.
|
|
13
|
+
command: process.env.BUNQUEUE_START_CMD || 'bunx bunqueue@2.9.3 start',
|
|
14
14
|
httpPort: Number(process.env.HTTP_PORT) || 6790,
|
|
15
15
|
tcpPort: Number(process.env.TCP_PORT) || 6789,
|
|
16
16
|
dataPath: process.env.BUNQUEUE_DATA_PATH || './data/bunq.db',
|
|
@@ -23,6 +23,25 @@ export function managedPostgresNamespace(config: ServerConfig): string {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** Credential-free PostgreSQL cluster label safe to expose to authenticated operators. */
|
|
27
|
+
export function managedPostgresTarget(config: ServerConfig): string | undefined {
|
|
28
|
+
const configured = managedPostgresUrl(config);
|
|
29
|
+
if (!configured) return undefined;
|
|
30
|
+
try {
|
|
31
|
+
const parsed = new URL(configured);
|
|
32
|
+
if (
|
|
33
|
+
(parsed.protocol !== 'postgres:' && parsed.protocol !== 'postgresql:') ||
|
|
34
|
+
!parsed.hostname
|
|
35
|
+
) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const database = decodeURIComponent(parsed.pathname.replace(/^\/+/, '')) || 'postgres';
|
|
39
|
+
return `${parsed.hostname}:${parsed.port || '5432'}/${database}`;
|
|
40
|
+
} catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
/** Fail before spawning when Bunqueue would reject an incomplete PostgreSQL config. */
|
|
27
46
|
export function validateManagedStorage(config: ServerConfig): ManagedStorageMode {
|
|
28
47
|
const mode = managedStorageMode(config);
|
package/agent/manager.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/** Public compatibility entrypoint for managed bunqueue process supervision. */
|
|
2
2
|
export { validateConfigPatch } from './manager/config';
|
|
3
3
|
export { ProcessManager } from './manager/process';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
managedPostgresNamespace,
|
|
6
|
+
managedPostgresTarget,
|
|
7
|
+
managedStorageMode,
|
|
8
|
+
} from './manager/storageMode';
|
|
5
9
|
export type {
|
|
6
10
|
DbStats,
|
|
7
11
|
LogLine,
|
package/agent/queue/routes.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
eventRetention,
|
|
13
13
|
exactJsonBody,
|
|
14
14
|
exactQuery,
|
|
15
|
+
groupJobsRange,
|
|
15
16
|
metricsRange,
|
|
16
17
|
optionalMaxCount,
|
|
17
18
|
optionalMaxJobs,
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
|
|
24
25
|
const READ_ROUTE = /^\/queue-operations\/([^/]+)\/(limits|groups|deduplication|metrics)$/;
|
|
25
26
|
const MUTATION_ROUTE =
|
|
26
|
-
/^\/queue-operations\/([^/]+)\/(groups\/(?:rate-limit|concurrency)(?:\/remove)?|deduplication\/remove|events\/trim)$/;
|
|
27
|
+
/^\/queue-operations\/([^/]+)\/(groups\/(?:(?:rate-limit|concurrency)(?:\/remove)?|pause|resume)|deduplication\/remove|events\/trim)$/;
|
|
27
28
|
|
|
28
29
|
export async function routeQueueOperationsRequest(
|
|
29
30
|
request: Request,
|
|
@@ -58,15 +59,26 @@ export async function routeQueueOperationsRequest(
|
|
|
58
59
|
const query = pinnedQuery(
|
|
59
60
|
request,
|
|
60
61
|
config,
|
|
61
|
-
['target', 'groupId', 'maxJobs', 'maxCount'],
|
|
62
|
+
['target', 'groupId', 'maxJobs', 'maxCount', 'start', 'end'],
|
|
62
63
|
targetPolicy
|
|
63
64
|
);
|
|
64
65
|
const groupId = requiredGroupId(query.get('groupId'));
|
|
65
66
|
const maxJobs = optionalMaxJobs(query);
|
|
66
67
|
const maxCount = optionalMaxCount(query);
|
|
68
|
+
const range = groupJobsRange(query);
|
|
67
69
|
assertRunning(running);
|
|
68
70
|
return admitted(query, config, running, admission, targetPolicy, async ({ config: current }) =>
|
|
69
|
-
ok({
|
|
71
|
+
ok({
|
|
72
|
+
group: await runtime.group(
|
|
73
|
+
current,
|
|
74
|
+
queue,
|
|
75
|
+
groupId,
|
|
76
|
+
maxJobs,
|
|
77
|
+
maxCount,
|
|
78
|
+
range.start,
|
|
79
|
+
range.end
|
|
80
|
+
),
|
|
81
|
+
})
|
|
70
82
|
);
|
|
71
83
|
}
|
|
72
84
|
const query = pinnedQuery(request, config, ['target', 'type', 'start', 'end'], targetPolicy);
|
|
@@ -93,6 +105,24 @@ export async function routeQueueOperationsRequest(
|
|
|
93
105
|
);
|
|
94
106
|
}
|
|
95
107
|
if (mutation[2].startsWith('groups/')) {
|
|
108
|
+
if (mutation[2] === 'groups/pause' || mutation[2] === 'groups/resume') {
|
|
109
|
+
const body = await exactJsonBody(request, ['groupId']);
|
|
110
|
+
const groupId = requiredGroupId(body.groupId);
|
|
111
|
+
return admitted(
|
|
112
|
+
query,
|
|
113
|
+
config,
|
|
114
|
+
running,
|
|
115
|
+
admission,
|
|
116
|
+
targetPolicy,
|
|
117
|
+
async ({ config: current }) =>
|
|
118
|
+
ok({
|
|
119
|
+
changed:
|
|
120
|
+
mutation[2] === 'groups/pause'
|
|
121
|
+
? await runtime.pauseGroup(current, queue, groupId)
|
|
122
|
+
: await runtime.resumeGroup(current, queue, groupId),
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
96
126
|
const remove = mutation[2].endsWith('/remove');
|
|
97
127
|
const rateLimit = mutation[2].includes('/rate-limit');
|
|
98
128
|
const allowed = remove
|
package/agent/queue/runtime.ts
CHANGED
|
@@ -21,6 +21,11 @@ export type QueueOperationsClient = Pick<
|
|
|
21
21
|
| 'setGroupConcurrency'
|
|
22
22
|
| 'getGroupConcurrency'
|
|
23
23
|
| 'removeGroupConcurrency'
|
|
24
|
+
| 'pauseGroup'
|
|
25
|
+
| 'resumeGroup'
|
|
26
|
+
| 'isGroupPaused'
|
|
27
|
+
| 'getGroupJobs'
|
|
28
|
+
| 'getCountsPerPriorityForGroup'
|
|
24
29
|
| 'getDeduplicationJobId'
|
|
25
30
|
| 'removeDeduplicationKey'
|
|
26
31
|
| 'removeDlqJob'
|
|
@@ -57,21 +62,62 @@ export class QueueOperationsRuntime implements QueueOperationsPort {
|
|
|
57
62
|
queue: string,
|
|
58
63
|
groupId: string,
|
|
59
64
|
maxJobs?: number,
|
|
60
|
-
maxCount?: number
|
|
65
|
+
maxCount?: number,
|
|
66
|
+
start?: number,
|
|
67
|
+
end?: number
|
|
61
68
|
): Promise<QueueGroupSnapshot> {
|
|
62
69
|
return this.withQueue(config, queue, async (client) => {
|
|
63
|
-
const [
|
|
70
|
+
const [
|
|
71
|
+
jobs,
|
|
72
|
+
active,
|
|
73
|
+
totalGrouped,
|
|
74
|
+
rateLimit,
|
|
75
|
+
rateLimitTtl,
|
|
76
|
+
concurrency,
|
|
77
|
+
paused,
|
|
78
|
+
groupJobs,
|
|
79
|
+
priorityCounts,
|
|
80
|
+
] = await Promise.all([
|
|
64
81
|
client.getGroupJobsCount(groupId),
|
|
65
82
|
client.getGroupActiveCount(groupId),
|
|
66
83
|
client.getGroupsJobsCount(maxCount),
|
|
67
84
|
client.getGroupRateLimit(groupId),
|
|
68
85
|
client.getGroupRateLimitTtl(groupId, maxJobs),
|
|
69
86
|
client.getGroupConcurrency(groupId),
|
|
87
|
+
client.isGroupPaused(groupId),
|
|
88
|
+
client.getGroupJobs(groupId, start, end),
|
|
89
|
+
client.getCountsPerPriorityForGroup(groupId),
|
|
70
90
|
]);
|
|
71
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
jobs,
|
|
93
|
+
active,
|
|
94
|
+
totalGrouped,
|
|
95
|
+
rateLimit,
|
|
96
|
+
rateLimitTtl,
|
|
97
|
+
concurrency,
|
|
98
|
+
paused,
|
|
99
|
+
entries: groupJobs.map((job) => ({
|
|
100
|
+
id: job.id,
|
|
101
|
+
name: job.name,
|
|
102
|
+
priority: job.priority,
|
|
103
|
+
delay: job.delay,
|
|
104
|
+
timestamp: job.timestamp,
|
|
105
|
+
})),
|
|
106
|
+
priorityCounts: Object.fromEntries(
|
|
107
|
+
Object.entries(priorityCounts).map(([priority, count]) => [String(priority), count])
|
|
108
|
+
),
|
|
109
|
+
};
|
|
72
110
|
});
|
|
73
111
|
}
|
|
74
112
|
|
|
113
|
+
pauseGroup(config: ServerConfig, queue: string, groupId: string): Promise<boolean> {
|
|
114
|
+
return this.withQueue(config, queue, (client) => client.pauseGroup(groupId));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
resumeGroup(config: ServerConfig, queue: string, groupId: string): Promise<boolean> {
|
|
118
|
+
return this.withQueue(config, queue, (client) => client.resumeGroup(groupId));
|
|
119
|
+
}
|
|
120
|
+
|
|
75
121
|
setGroupRateLimit(
|
|
76
122
|
config: ServerConfig,
|
|
77
123
|
queue: string,
|
package/agent/queue/types.ts
CHANGED
|
@@ -12,11 +12,22 @@ export interface QueueGroupSnapshot {
|
|
|
12
12
|
jobs: number;
|
|
13
13
|
active: number;
|
|
14
14
|
totalGrouped: number;
|
|
15
|
+
paused: boolean;
|
|
16
|
+
entries: QueueGroupJobSummary[];
|
|
17
|
+
priorityCounts: Record<string, number>;
|
|
15
18
|
rateLimit: { max: number; duration: number } | null;
|
|
16
19
|
rateLimitTtl: number;
|
|
17
20
|
concurrency: number | null;
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
export interface QueueGroupJobSummary {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
priority: number;
|
|
27
|
+
delay: number;
|
|
28
|
+
timestamp: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
20
31
|
export interface QueueOperationsPort {
|
|
21
32
|
limits(config: ServerConfig, queue: string, maxJobs?: number): Promise<QueueLimitSnapshot>;
|
|
22
33
|
group(
|
|
@@ -24,8 +35,12 @@ export interface QueueOperationsPort {
|
|
|
24
35
|
queue: string,
|
|
25
36
|
groupId: string,
|
|
26
37
|
maxJobs?: number,
|
|
27
|
-
maxCount?: number
|
|
38
|
+
maxCount?: number,
|
|
39
|
+
start?: number,
|
|
40
|
+
end?: number
|
|
28
41
|
): Promise<QueueGroupSnapshot>;
|
|
42
|
+
pauseGroup(config: ServerConfig, queue: string, groupId: string): Promise<boolean>;
|
|
43
|
+
resumeGroup(config: ServerConfig, queue: string, groupId: string): Promise<boolean>;
|
|
29
44
|
setGroupRateLimit(
|
|
30
45
|
config: ServerConfig,
|
|
31
46
|
queue: string,
|
|
@@ -45,6 +45,14 @@ export function optionalMaxCount(query: URLSearchParams): number | undefined {
|
|
|
45
45
|
return raw === null ? undefined : boundedInteger(raw, 'maxCount', 1, 1_000_000);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export function groupJobsRange(query: URLSearchParams): { start: number; end: number } {
|
|
49
|
+
const start = optionalInteger(query.get('start'), 'start', 0, 1_000_000, 0);
|
|
50
|
+
const end = optionalInteger(query.get('end'), 'end', 0, 1_000_000, start + 24);
|
|
51
|
+
if (end < start) throw new Error('Group jobs end must be at least start');
|
|
52
|
+
if (end - start >= 100) throw new Error('Group jobs page must contain at most 100 jobs');
|
|
53
|
+
return { start, end };
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
export function requiredGroupId(value: unknown): string {
|
|
49
57
|
if (typeof value !== 'string' || !value || value.length > 256 || value.includes('\0')) {
|
|
50
58
|
throw new Error('groupId must be a non-empty string of at most 256 characters without NUL');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
managedPostgresNamespace,
|
|
3
|
+
managedPostgresTarget,
|
|
3
4
|
managedStorageMode,
|
|
4
5
|
type ProcessManager,
|
|
5
6
|
} from '../manager';
|
|
@@ -64,6 +65,8 @@ export async function statusWithHealth(
|
|
|
64
65
|
storageMode: currentStorageMode,
|
|
65
66
|
postgresNamespace:
|
|
66
67
|
currentStorageMode === 'postgres' ? managedPostgresNamespace(currentConfig) : undefined,
|
|
68
|
+
postgresTarget:
|
|
69
|
+
currentStorageMode === 'postgres' ? managedPostgresTarget(currentConfig) : undefined,
|
|
67
70
|
db: await statusDatabase(manager, currentConfig),
|
|
68
71
|
};
|
|
69
72
|
}
|
|
@@ -76,6 +79,8 @@ export async function statusWithHealth(
|
|
|
76
79
|
storageMode,
|
|
77
80
|
postgresNamespace:
|
|
78
81
|
storageMode === 'postgres' ? managedPostgresNamespace(effectiveConfig) : undefined,
|
|
82
|
+
postgresTarget:
|
|
83
|
+
storageMode === 'postgres' ? managedPostgresTarget(effectiveConfig) : undefined,
|
|
79
84
|
db: database,
|
|
80
85
|
};
|
|
81
86
|
}
|
package/agent/workflows.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read-only facade for Bunqueue 2.9.
|
|
2
|
+
* Read-only facade for Bunqueue 2.9.3 Workflow Engine observability.
|
|
3
3
|
* Persistence, decoding and validation live behind this stable public module.
|
|
4
4
|
*/
|
|
5
5
|
export { workflowExecution } from './workflow/detail';
|