@getworkbench/core 0.3.0 → 0.3.2
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/dist/hono.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +60 -22
- package/dist/index.js.map +1 -1
- package/dist/ui/assets/index.css +1 -1
- package/dist/ui/assets/index.js +73 -73
- package/dist/{workbench-CRdU4cB7.d.ts → workbench-Btnvit1t.d.ts} +5 -1
- package/package.json +2 -2
- package/dist/workbench-DMfd1JuA.d.ts +0 -692
|
@@ -1,692 +0,0 @@
|
|
|
1
|
-
import { Queue, RedisOptions } from 'bullmq';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Job status types matching BullMQ states
|
|
5
|
-
*/
|
|
6
|
-
type JobStatus = "waiting" | "active" | "completed" | "failed" | "delayed" | "paused" | "unknown";
|
|
7
|
-
/**
|
|
8
|
-
* Configuration options for Workbench
|
|
9
|
-
*/
|
|
10
|
-
interface WorkbenchOptions {
|
|
11
|
-
/** BullMQ Queue instances to display */
|
|
12
|
-
queues?: Queue[];
|
|
13
|
-
/** Redis connection for auto-discovery of queues */
|
|
14
|
-
redis?: string | RedisOptions;
|
|
15
|
-
/** Basic auth credentials */
|
|
16
|
-
auth?: {
|
|
17
|
-
username: string;
|
|
18
|
-
password: string;
|
|
19
|
-
};
|
|
20
|
-
/** Dashboard title */
|
|
21
|
-
title?: string;
|
|
22
|
-
/** Logo URL */
|
|
23
|
-
logo?: string;
|
|
24
|
-
/** Override base path detection */
|
|
25
|
-
basePath?: string;
|
|
26
|
-
/** Disable actions (retry, remove, promote) */
|
|
27
|
-
readonly?: boolean;
|
|
28
|
-
/** Fields from job.data to extract as filterable tags (e.g., ['teamId', 'userId']) */
|
|
29
|
-
tags?: string[];
|
|
30
|
-
/**
|
|
31
|
-
* BullMQ key prefix used during queue auto-discovery from `redis`. Ignored
|
|
32
|
-
* when `queues` is set explicitly. Defaults to `"bull"`.
|
|
33
|
-
*/
|
|
34
|
-
prefix?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Maximum number of queues to keep when auto-discovering from `redis`.
|
|
37
|
-
* Prevents connection storms on very large Redis deployments. Defaults to
|
|
38
|
-
* 100. Ignored when `queues` is set explicitly.
|
|
39
|
-
*/
|
|
40
|
-
maxQueues?: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Queue information for API responses
|
|
44
|
-
*/
|
|
45
|
-
interface QueueInfo {
|
|
46
|
-
name: string;
|
|
47
|
-
counts: {
|
|
48
|
-
waiting: number;
|
|
49
|
-
active: number;
|
|
50
|
-
completed: number;
|
|
51
|
-
failed: number;
|
|
52
|
-
delayed: number;
|
|
53
|
-
paused: number;
|
|
54
|
-
};
|
|
55
|
-
isPaused: boolean;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Worker information from BullMQ
|
|
59
|
-
*/
|
|
60
|
-
interface WorkerInfo {
|
|
61
|
-
id: string;
|
|
62
|
-
name: string;
|
|
63
|
-
addr: string;
|
|
64
|
-
age: number;
|
|
65
|
-
idle: number;
|
|
66
|
-
started: number;
|
|
67
|
-
queueName: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Extracted tag key-value pairs from job data
|
|
71
|
-
*/
|
|
72
|
-
type JobTags = Record<string, string | number | boolean | null>;
|
|
73
|
-
/**
|
|
74
|
-
* Job information for API responses
|
|
75
|
-
*/
|
|
76
|
-
interface JobInfo {
|
|
77
|
-
id: string;
|
|
78
|
-
name: string;
|
|
79
|
-
data: unknown;
|
|
80
|
-
opts: {
|
|
81
|
-
attempts?: number;
|
|
82
|
-
delay?: number;
|
|
83
|
-
priority?: number;
|
|
84
|
-
};
|
|
85
|
-
progress: number | object;
|
|
86
|
-
attemptsMade: number;
|
|
87
|
-
processedOn?: number;
|
|
88
|
-
finishedOn?: number;
|
|
89
|
-
timestamp: number;
|
|
90
|
-
failedReason?: string;
|
|
91
|
-
stacktrace?: string[];
|
|
92
|
-
returnvalue?: unknown;
|
|
93
|
-
status: JobStatus;
|
|
94
|
-
duration?: number;
|
|
95
|
-
/** Extracted tag values from job.data based on configured tag fields */
|
|
96
|
-
tags?: JobTags;
|
|
97
|
-
/** Parent job info if this job is part of a flow */
|
|
98
|
-
parent?: {
|
|
99
|
-
id: string;
|
|
100
|
-
queueName: string;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Overview stats for dashboard
|
|
105
|
-
*/
|
|
106
|
-
interface OverviewStats {
|
|
107
|
-
totalJobs: number;
|
|
108
|
-
activeJobs: number;
|
|
109
|
-
failedJobs: number;
|
|
110
|
-
completedToday: number;
|
|
111
|
-
avgDuration: number;
|
|
112
|
-
queues: QueueInfo[];
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Paginated response wrapper
|
|
116
|
-
*/
|
|
117
|
-
interface PaginatedResponse<T> {
|
|
118
|
-
data: T[];
|
|
119
|
-
total: number;
|
|
120
|
-
cursor?: string;
|
|
121
|
-
hasMore: boolean;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Search result item
|
|
125
|
-
*/
|
|
126
|
-
interface SearchResult {
|
|
127
|
-
queue: string;
|
|
128
|
-
job: JobInfo;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Run item - job execution with queue context
|
|
132
|
-
*/
|
|
133
|
-
interface RunInfo extends JobInfo {
|
|
134
|
-
queueName: string;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Lightweight run info for list view - only fields needed for table display
|
|
138
|
-
* Excludes large fields like full job.data, opts, progress, etc.
|
|
139
|
-
*/
|
|
140
|
-
interface RunInfoList {
|
|
141
|
-
id: string;
|
|
142
|
-
name: string;
|
|
143
|
-
status: JobStatus;
|
|
144
|
-
queueName: string;
|
|
145
|
-
tags?: JobTags;
|
|
146
|
-
processedOn?: number;
|
|
147
|
-
timestamp: number;
|
|
148
|
-
duration?: number;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Scheduler info for repeatable jobs
|
|
152
|
-
*/
|
|
153
|
-
interface SchedulerInfo {
|
|
154
|
-
key: string;
|
|
155
|
-
name: string;
|
|
156
|
-
queueName: string;
|
|
157
|
-
pattern?: string;
|
|
158
|
-
every?: number;
|
|
159
|
-
next?: number;
|
|
160
|
-
endDate?: number;
|
|
161
|
-
tz?: string;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Delayed job info
|
|
165
|
-
*/
|
|
166
|
-
interface DelayedJobInfo {
|
|
167
|
-
id: string;
|
|
168
|
-
name: string;
|
|
169
|
-
queueName: string;
|
|
170
|
-
delay: number;
|
|
171
|
-
processAt: number;
|
|
172
|
-
data: unknown;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Test job request
|
|
176
|
-
*/
|
|
177
|
-
interface TestJobRequest {
|
|
178
|
-
queueName: string;
|
|
179
|
-
jobName: string;
|
|
180
|
-
data: unknown;
|
|
181
|
-
opts?: {
|
|
182
|
-
delay?: number;
|
|
183
|
-
priority?: number;
|
|
184
|
-
attempts?: number;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Sort direction
|
|
189
|
-
*/
|
|
190
|
-
type SortDirection = "asc" | "desc";
|
|
191
|
-
/**
|
|
192
|
-
* Sort options for API requests
|
|
193
|
-
*/
|
|
194
|
-
interface SortOptions {
|
|
195
|
-
field: string;
|
|
196
|
-
direction: SortDirection;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Valid sort fields for runs/jobs
|
|
200
|
-
*/
|
|
201
|
-
type RunSortField = "timestamp" | "name" | "status" | "duration" | "queueName";
|
|
202
|
-
/**
|
|
203
|
-
* Valid sort fields for repeatable schedulers
|
|
204
|
-
*/
|
|
205
|
-
type RepeatableSortField = "name" | "queueName" | "pattern" | "next" | "tz";
|
|
206
|
-
/**
|
|
207
|
-
* Valid sort fields for delayed schedulers
|
|
208
|
-
*/
|
|
209
|
-
type DelayedSortField = "name" | "queueName" | "processAt" | "delay";
|
|
210
|
-
/**
|
|
211
|
-
* Hourly bucket for metrics aggregation
|
|
212
|
-
*/
|
|
213
|
-
interface HourlyBucket {
|
|
214
|
-
/** Unix timestamp (start of hour) */
|
|
215
|
-
hour: number;
|
|
216
|
-
/** Number of completed jobs */
|
|
217
|
-
completed: number;
|
|
218
|
-
/** Number of failed jobs */
|
|
219
|
-
failed: number;
|
|
220
|
-
/** Average processing duration in ms */
|
|
221
|
-
avgDuration: number;
|
|
222
|
-
/** Average queue wait time in ms */
|
|
223
|
-
avgWaitTime: number;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Metrics for a single queue
|
|
227
|
-
*/
|
|
228
|
-
interface QueueMetrics {
|
|
229
|
-
queueName: string;
|
|
230
|
-
buckets: HourlyBucket[];
|
|
231
|
-
summary: {
|
|
232
|
-
totalCompleted: number;
|
|
233
|
-
totalFailed: number;
|
|
234
|
-
/** Error rate as 0-1 */
|
|
235
|
-
errorRate: number;
|
|
236
|
-
/** Average processing duration in ms */
|
|
237
|
-
avgDuration: number;
|
|
238
|
-
/** Average queue wait time in ms */
|
|
239
|
-
avgWaitTime: number;
|
|
240
|
-
/** Average throughput per hour */
|
|
241
|
-
throughputPerHour: number;
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Slowest job entry
|
|
246
|
-
*/
|
|
247
|
-
interface SlowestJob {
|
|
248
|
-
name: string;
|
|
249
|
-
queueName: string;
|
|
250
|
-
duration: number;
|
|
251
|
-
jobId: string;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Most failing job type entry
|
|
255
|
-
*/
|
|
256
|
-
interface FailingJobType {
|
|
257
|
-
name: string;
|
|
258
|
-
queueName: string;
|
|
259
|
-
failCount: number;
|
|
260
|
-
totalCount: number;
|
|
261
|
-
errorRate: number;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Complete metrics response
|
|
265
|
-
*/
|
|
266
|
-
interface MetricsResponse {
|
|
267
|
-
/** Metrics per queue */
|
|
268
|
-
queues: QueueMetrics[];
|
|
269
|
-
/** Aggregated metrics across all queues */
|
|
270
|
-
aggregate: Omit<QueueMetrics, "queueName"> & {
|
|
271
|
-
queueName: "all";
|
|
272
|
-
};
|
|
273
|
-
/** Top 10 slowest jobs */
|
|
274
|
-
slowestJobs: SlowestJob[];
|
|
275
|
-
/** Top 10 most failing job types */
|
|
276
|
-
mostFailingTypes: FailingJobType[];
|
|
277
|
-
/** Timestamp when metrics were computed */
|
|
278
|
-
computedAt: number;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* A node in a flow tree representing a job and its children
|
|
282
|
-
*/
|
|
283
|
-
interface FlowNode {
|
|
284
|
-
job: JobInfo;
|
|
285
|
-
queueName: string;
|
|
286
|
-
children?: FlowNode[];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Flow summary for list view
|
|
290
|
-
*/
|
|
291
|
-
interface FlowSummary {
|
|
292
|
-
/** Root job ID */
|
|
293
|
-
id: string;
|
|
294
|
-
/** Root job name */
|
|
295
|
-
name: string;
|
|
296
|
-
/** Queue containing root job */
|
|
297
|
-
queueName: string;
|
|
298
|
-
/** Root job status */
|
|
299
|
-
status: JobStatus;
|
|
300
|
-
/** Total number of jobs in flow */
|
|
301
|
-
totalJobs: number;
|
|
302
|
-
/** Number of completed jobs */
|
|
303
|
-
completedJobs: number;
|
|
304
|
-
/** Number of failed jobs */
|
|
305
|
-
failedJobs: number;
|
|
306
|
-
/** When flow was created */
|
|
307
|
-
timestamp: number;
|
|
308
|
-
/** Duration if completed */
|
|
309
|
-
duration?: number;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Request to create a test flow
|
|
313
|
-
*/
|
|
314
|
-
interface CreateFlowRequest {
|
|
315
|
-
name: string;
|
|
316
|
-
queueName: string;
|
|
317
|
-
data?: unknown;
|
|
318
|
-
children: CreateFlowChildRequest[];
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Child job in a flow creation request
|
|
322
|
-
*/
|
|
323
|
-
interface CreateFlowChildRequest {
|
|
324
|
-
name: string;
|
|
325
|
-
queueName: string;
|
|
326
|
-
data?: unknown;
|
|
327
|
-
children?: CreateFlowChildRequest[];
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Activity bucket for timeline
|
|
331
|
-
*/
|
|
332
|
-
interface ActivityBucket {
|
|
333
|
-
/** Unix timestamp (start of bucket) */
|
|
334
|
-
time: number;
|
|
335
|
-
/** Number of completed jobs */
|
|
336
|
-
completed: number;
|
|
337
|
-
/** Number of failed jobs */
|
|
338
|
-
failed: number;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Activity stats response for the 7-day timeline
|
|
342
|
-
*/
|
|
343
|
-
interface ActivityStatsResponse {
|
|
344
|
-
/** Activity buckets (4-hour intervals over 7 days) */
|
|
345
|
-
buckets: ActivityBucket[];
|
|
346
|
-
/** Start time of the first bucket */
|
|
347
|
-
startTime: number;
|
|
348
|
-
/** End time (now) */
|
|
349
|
-
endTime: number;
|
|
350
|
-
/** Size of each bucket in ms */
|
|
351
|
-
bucketSize: number;
|
|
352
|
-
/** Total completed in period */
|
|
353
|
-
totalCompleted: number;
|
|
354
|
-
/** Total failed in period */
|
|
355
|
-
totalFailed: number;
|
|
356
|
-
/** Timestamp when stats were computed */
|
|
357
|
-
computedAt: number;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Manages queue operations for the Workbench dashboard
|
|
362
|
-
*/
|
|
363
|
-
declare class QueueManager {
|
|
364
|
-
private queues;
|
|
365
|
-
private tagFields;
|
|
366
|
-
private flowProducer;
|
|
367
|
-
private cache;
|
|
368
|
-
private readonly CACHE_TTL;
|
|
369
|
-
constructor(queues: Queue[], tagFields?: string[]);
|
|
370
|
-
/**
|
|
371
|
-
* Get cached value or compute and cache
|
|
372
|
-
*/
|
|
373
|
-
private cached;
|
|
374
|
-
/**
|
|
375
|
-
* Execute a promise with a timeout
|
|
376
|
-
*/
|
|
377
|
-
private withTimeout;
|
|
378
|
-
/**
|
|
379
|
-
* Get jobs by time range using Redis sorted sets (ZRANGEBYSCORE)
|
|
380
|
-
* This is more efficient than fetching all jobs and filtering in memory
|
|
381
|
-
*/
|
|
382
|
-
private getJobsByTimeRange;
|
|
383
|
-
/**
|
|
384
|
-
* Cache for job state lookups to avoid repeated Redis calls
|
|
385
|
-
*/
|
|
386
|
-
private jobStateCache;
|
|
387
|
-
/**
|
|
388
|
-
* Cache for job counts to avoid repeated Redis calls
|
|
389
|
-
* Short TTL since counts change frequently but are expensive to fetch
|
|
390
|
-
*/
|
|
391
|
-
private countCache;
|
|
392
|
-
/**
|
|
393
|
-
* Get job counts with caching
|
|
394
|
-
*/
|
|
395
|
-
private getCachedJobCounts;
|
|
396
|
-
/**
|
|
397
|
-
* Invalidate caches related to a job or queue
|
|
398
|
-
*/
|
|
399
|
-
private invalidateJobCache;
|
|
400
|
-
/**
|
|
401
|
-
* Clear cache (useful after mutations)
|
|
402
|
-
*/
|
|
403
|
-
clearCache(prefix?: string): void;
|
|
404
|
-
/**
|
|
405
|
-
* Get quick job counts across all queues (lightweight, for smart polling)
|
|
406
|
-
* Returns total counts per status - cached and very fast
|
|
407
|
-
*/
|
|
408
|
-
getQuickCounts(): Promise<{
|
|
409
|
-
waiting: number;
|
|
410
|
-
active: number;
|
|
411
|
-
completed: number;
|
|
412
|
-
failed: number;
|
|
413
|
-
delayed: number;
|
|
414
|
-
total: number;
|
|
415
|
-
timestamp: number;
|
|
416
|
-
}>;
|
|
417
|
-
/**
|
|
418
|
-
* Get configured tag field names
|
|
419
|
-
*/
|
|
420
|
-
getTagFields(): string[];
|
|
421
|
-
/**
|
|
422
|
-
* Get just queue names (very fast, no Redis calls)
|
|
423
|
-
* Used for sidebar initial render
|
|
424
|
-
*/
|
|
425
|
-
getQueueNames(): string[];
|
|
426
|
-
/**
|
|
427
|
-
* Get a queue by name
|
|
428
|
-
*/
|
|
429
|
-
getQueue(name: string): Queue | undefined;
|
|
430
|
-
/**
|
|
431
|
-
* Get information for all queues (cached)
|
|
432
|
-
*/
|
|
433
|
-
getQueues(): Promise<QueueInfo[]>;
|
|
434
|
-
/**
|
|
435
|
-
* Get overview statistics (cached)
|
|
436
|
-
*/
|
|
437
|
-
getOverview(): Promise<OverviewStats>;
|
|
438
|
-
/**
|
|
439
|
-
* Pause a queue - stops processing new jobs
|
|
440
|
-
*/
|
|
441
|
-
pauseQueue(queueName: string): Promise<void>;
|
|
442
|
-
/**
|
|
443
|
-
* Resume a paused queue
|
|
444
|
-
*/
|
|
445
|
-
resumeQueue(queueName: string): Promise<void>;
|
|
446
|
-
/**
|
|
447
|
-
* Check if a queue is paused
|
|
448
|
-
*/
|
|
449
|
-
isQueuePaused(queueName: string): Promise<boolean>;
|
|
450
|
-
/**
|
|
451
|
-
* Get metrics for the last 24 hours (cached - expensive operation)
|
|
452
|
-
*/
|
|
453
|
-
getMetrics(): Promise<MetricsResponse>;
|
|
454
|
-
/**
|
|
455
|
-
* Get activity stats for the last 7 days (cached)
|
|
456
|
-
* Returns 4-hour buckets for the activity timeline
|
|
457
|
-
*/
|
|
458
|
-
getActivityStats(): Promise<ActivityStatsResponse>;
|
|
459
|
-
/**
|
|
460
|
-
* Get jobs for a specific queue with pagination and sorting
|
|
461
|
-
*/
|
|
462
|
-
getJobs(queueName: string, status?: JobStatus, limit?: number, start?: number, sort?: SortOptions): Promise<PaginatedResponse<JobInfo>>;
|
|
463
|
-
/**
|
|
464
|
-
* Get a single job by ID
|
|
465
|
-
*/
|
|
466
|
-
getJob(queueName: string, jobId: string): Promise<JobInfo | null>;
|
|
467
|
-
/**
|
|
468
|
-
* Retry a failed job
|
|
469
|
-
*/
|
|
470
|
-
retryJob(queueName: string, jobId: string): Promise<boolean>;
|
|
471
|
-
/**
|
|
472
|
-
* Remove a job
|
|
473
|
-
*/
|
|
474
|
-
removeJob(queueName: string, jobId: string): Promise<boolean>;
|
|
475
|
-
/**
|
|
476
|
-
* Promote a delayed job to waiting
|
|
477
|
-
*/
|
|
478
|
-
promoteJob(queueName: string, jobId: string): Promise<boolean>;
|
|
479
|
-
/**
|
|
480
|
-
* Parse search query for field:value filters
|
|
481
|
-
* Returns { filters: { field: value }, text: remainingText }
|
|
482
|
-
*/
|
|
483
|
-
private parseSearchQuery;
|
|
484
|
-
/**
|
|
485
|
-
* Check if a raw job matches all provided filters (before conversion)
|
|
486
|
-
* This is more efficient than converting to JobInfo first
|
|
487
|
-
*/
|
|
488
|
-
private jobMatchesAllFilters;
|
|
489
|
-
/**
|
|
490
|
-
* Check if a job matches the given tag filters
|
|
491
|
-
*/
|
|
492
|
-
private jobMatchesFilters;
|
|
493
|
-
/**
|
|
494
|
-
* Search jobs across all queues
|
|
495
|
-
* Supports field:value syntax (e.g., "teamId:abc-123 invoice")
|
|
496
|
-
* Optimized with parallel processing, early exits, and count checks
|
|
497
|
-
*/
|
|
498
|
-
search(query: string, limit?: number): Promise<SearchResult[]>;
|
|
499
|
-
/**
|
|
500
|
-
* Clean jobs from a queue
|
|
501
|
-
*/
|
|
502
|
-
cleanJobs(queueName: string, status: "completed" | "failed", grace?: number): Promise<number>;
|
|
503
|
-
/**
|
|
504
|
-
* FAST PATH: Get latest runs without filters
|
|
505
|
-
* Optimized for the common case of viewing newest jobs (timestamp desc, no filters)
|
|
506
|
-
* - Single getJobs call per queue (not per status type)
|
|
507
|
-
* - No count checks needed
|
|
508
|
-
* - Minimal Redis round-trips
|
|
509
|
-
*/
|
|
510
|
-
private getLatestRuns;
|
|
511
|
-
/**
|
|
512
|
-
* Get all runs (jobs) across all queues with sorting and filtering
|
|
513
|
-
* Uses fast path for common case (no filters, timestamp desc)
|
|
514
|
-
*/
|
|
515
|
-
getAllRuns(limit?: number, start?: number, sort?: SortOptions, filters?: {
|
|
516
|
-
status?: JobStatus;
|
|
517
|
-
tags?: Record<string, string>;
|
|
518
|
-
text?: string;
|
|
519
|
-
timeRange?: {
|
|
520
|
-
start: number;
|
|
521
|
-
end: number;
|
|
522
|
-
};
|
|
523
|
-
}): Promise<PaginatedResponse<RunInfoList>>;
|
|
524
|
-
/**
|
|
525
|
-
* Get all schedulers (repeatable and delayed jobs) with sorting
|
|
526
|
-
*/
|
|
527
|
-
getSchedulers(repeatableSort?: SortOptions, delayedSort?: SortOptions): Promise<{
|
|
528
|
-
repeatable: SchedulerInfo[];
|
|
529
|
-
delayed: DelayedJobInfo[];
|
|
530
|
-
}>;
|
|
531
|
-
/**
|
|
532
|
-
* Enqueue a new job (for testing)
|
|
533
|
-
*/
|
|
534
|
-
enqueueJob(request: TestJobRequest): Promise<{
|
|
535
|
-
id: string;
|
|
536
|
-
}>;
|
|
537
|
-
/**
|
|
538
|
-
* Extract tag values from job data based on configured tag fields
|
|
539
|
-
*/
|
|
540
|
-
private extractTags;
|
|
541
|
-
/**
|
|
542
|
-
* Get unique values for a specific tag field across all jobs
|
|
543
|
-
*/
|
|
544
|
-
getTagValues(field: string, limit?: number): Promise<{
|
|
545
|
-
value: string;
|
|
546
|
-
count: number;
|
|
547
|
-
}[]>;
|
|
548
|
-
/**
|
|
549
|
-
* Get sortable value from JobInfo/RunInfo
|
|
550
|
-
*/
|
|
551
|
-
private getSortValue;
|
|
552
|
-
/**
|
|
553
|
-
* Get sortable value from RunInfoList (lightweight version)
|
|
554
|
-
*/
|
|
555
|
-
private getSortValueForList;
|
|
556
|
-
/**
|
|
557
|
-
* Get sortable value from SchedulerInfo
|
|
558
|
-
*/
|
|
559
|
-
private getSchedulerSortValue;
|
|
560
|
-
/**
|
|
561
|
-
* Get sortable value from DelayedJobInfo
|
|
562
|
-
*/
|
|
563
|
-
private getDelayedSortValue;
|
|
564
|
-
/**
|
|
565
|
-
* Convert a BullMQ Job to JobInfo or RunInfoList
|
|
566
|
-
* @param job - The BullMQ job to convert
|
|
567
|
-
* @param fields - "list" for lightweight list view, "full" for complete job details
|
|
568
|
-
* @param knownState - Optional: skip getState() call if state is already known from fetch
|
|
569
|
-
*/
|
|
570
|
-
private jobToInfo;
|
|
571
|
-
/**
|
|
572
|
-
* Retry multiple jobs across queues
|
|
573
|
-
* Processed in parallel for better performance
|
|
574
|
-
*/
|
|
575
|
-
bulkRetry(jobs: {
|
|
576
|
-
queueName: string;
|
|
577
|
-
jobId: string;
|
|
578
|
-
}[]): Promise<{
|
|
579
|
-
success: number;
|
|
580
|
-
failed: number;
|
|
581
|
-
}>;
|
|
582
|
-
/**
|
|
583
|
-
* Delete multiple jobs across queues
|
|
584
|
-
* Processed in parallel for better performance
|
|
585
|
-
*/
|
|
586
|
-
bulkDelete(jobs: {
|
|
587
|
-
queueName: string;
|
|
588
|
-
jobId: string;
|
|
589
|
-
}[]): Promise<{
|
|
590
|
-
success: number;
|
|
591
|
-
failed: number;
|
|
592
|
-
}>;
|
|
593
|
-
/**
|
|
594
|
-
* Promote multiple delayed jobs across queues (move to waiting)
|
|
595
|
-
* Processed in parallel for better performance
|
|
596
|
-
*/
|
|
597
|
-
bulkPromote(jobs: {
|
|
598
|
-
queueName: string;
|
|
599
|
-
jobId: string;
|
|
600
|
-
}[]): Promise<{
|
|
601
|
-
success: number;
|
|
602
|
-
failed: number;
|
|
603
|
-
}>;
|
|
604
|
-
/**
|
|
605
|
-
* Get all flows (jobs that have children or are part of a flow) - cached
|
|
606
|
-
* Optimized to focus on waiting-children type first and early exit
|
|
607
|
-
*/
|
|
608
|
-
getFlows(limit?: number): Promise<FlowSummary[]>;
|
|
609
|
-
/**
|
|
610
|
-
* Get a single flow tree by root job ID
|
|
611
|
-
*/
|
|
612
|
-
getFlow(queueName: string, jobId: string): Promise<FlowNode | null>;
|
|
613
|
-
/**
|
|
614
|
-
* Create a new flow
|
|
615
|
-
*/
|
|
616
|
-
createFlow(request: CreateFlowRequest): Promise<{
|
|
617
|
-
id: string;
|
|
618
|
-
}>;
|
|
619
|
-
/**
|
|
620
|
-
* Build a FlowJob from CreateFlowRequest or CreateFlowChildRequest
|
|
621
|
-
*/
|
|
622
|
-
private buildFlowJob;
|
|
623
|
-
/**
|
|
624
|
-
* Convert BullMQ flow tree to our FlowNode structure
|
|
625
|
-
*/
|
|
626
|
-
private convertFlowTree;
|
|
627
|
-
/**
|
|
628
|
-
* Count statistics for a flow tree
|
|
629
|
-
*/
|
|
630
|
-
private countFlowStats;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Internal metadata produced by {@link WorkbenchCore.fromOptions} when queues
|
|
635
|
-
* are auto-discovered from a Redis connection.
|
|
636
|
-
*/
|
|
637
|
-
interface DiscoveryMeta {
|
|
638
|
-
/** Total number of queues found on the connection (before capping). */
|
|
639
|
-
total: number;
|
|
640
|
-
/** True if the result was capped at `maxQueues`. */
|
|
641
|
-
capped: boolean;
|
|
642
|
-
/** The cap that was applied. */
|
|
643
|
-
cap: number;
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Core Workbench class that manages the dashboard
|
|
647
|
-
*/
|
|
648
|
-
declare class WorkbenchCore {
|
|
649
|
-
readonly options: Required<Pick<WorkbenchOptions, "title" | "readonly">> & WorkbenchOptions;
|
|
650
|
-
readonly queueManager: QueueManager;
|
|
651
|
-
readonly discovery: DiscoveryMeta | null;
|
|
652
|
-
constructor(options: WorkbenchOptions | Queue[], discovery?: DiscoveryMeta | null);
|
|
653
|
-
/**
|
|
654
|
-
* Async factory: build a `WorkbenchCore` from `WorkbenchOptions`, performing
|
|
655
|
-
* BullMQ queue auto-discovery via `SCAN <prefix>:*:meta` when `queues` is
|
|
656
|
-
* not provided.
|
|
657
|
-
*
|
|
658
|
-
* - When `queues` is set explicitly, behaves like `new WorkbenchCore(opts)`.
|
|
659
|
-
* - When only `redis` is set, scans the connection for queues, caps at
|
|
660
|
-
* `maxQueues` (default 100) to avoid connection storms with very large
|
|
661
|
-
* deployments, and constructs the core with the resulting list.
|
|
662
|
-
* - When no queues are discovered, the core is constructed with an empty
|
|
663
|
-
* queue map so the dashboard can render an "empty" state instead of
|
|
664
|
-
* erroring out.
|
|
665
|
-
*/
|
|
666
|
-
static fromOptions(opts: WorkbenchOptions): Promise<WorkbenchCore>;
|
|
667
|
-
/**
|
|
668
|
-
* Get the queue manager instance
|
|
669
|
-
*/
|
|
670
|
-
getQueueManager(): QueueManager;
|
|
671
|
-
/**
|
|
672
|
-
* Check if authentication is required
|
|
673
|
-
*/
|
|
674
|
-
requiresAuth(): boolean;
|
|
675
|
-
/**
|
|
676
|
-
* Validate authentication credentials
|
|
677
|
-
*/
|
|
678
|
-
validateAuth(username: string, password: string): boolean;
|
|
679
|
-
/**
|
|
680
|
-
* Get dashboard configuration for the UI
|
|
681
|
-
*/
|
|
682
|
-
getConfig(): {
|
|
683
|
-
title: string;
|
|
684
|
-
logo: string | undefined;
|
|
685
|
-
readonly: boolean;
|
|
686
|
-
queues: string[];
|
|
687
|
-
tags: string[];
|
|
688
|
-
discovery: DiscoveryMeta | null;
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
export { type ActivityBucket as A, type CreateFlowChildRequest as C, type DelayedJobInfo as D, type FailingJobType as F, type HourlyBucket as H, type JobInfo as J, type MetricsResponse as M, type OverviewStats as O, type PaginatedResponse as P, type QueueInfo as Q, type RepeatableSortField as R, type SchedulerInfo as S, type TestJobRequest as T, WorkbenchCore as W, type WorkbenchOptions as a, type ActivityStatsResponse as b, type CreateFlowRequest as c, type DelayedSortField as d, type DiscoveryMeta as e, type FlowNode as f, type FlowSummary as g, type JobStatus as h, type JobTags as i, QueueManager as j, type QueueMetrics as k, type RunInfo as l, type RunInfoList as m, type RunSortField as n, type SearchResult as o, type SlowestJob as p, type SortDirection as q, type SortOptions as r, type WorkerInfo as s };
|