@maydotinc/q-studio 0.1.1 → 0.8.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.
@@ -1,377 +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
- * Group/folder of related BullMQ queues.
9
- */
10
- interface QueueGroup {
11
- name: string;
12
- queues: Queue[];
13
- }
14
- /**
15
- * Configuration options for Workbench
16
- */
17
- interface WorkbenchOptions {
18
- /** BullMQ Queue instances to display */
19
- queues?: Queue[];
20
- /** Named groups/folders of BullMQ Queue instances to display together */
21
- queueGroups?: QueueGroup[];
22
- /** Alias for queueGroups */
23
- groups?: QueueGroup[];
24
- /** Redis connection for auto-discovery of queues */
25
- redis?: string | RedisOptions;
26
- /** Basic auth credentials */
27
- auth?: {
28
- username: string;
29
- password: string;
30
- };
31
- /** Dashboard title */
32
- title?: string;
33
- /** Logo URL */
34
- logo?: string;
35
- /** Override base path detection */
36
- basePath?: string;
37
- /** Disable actions (retry, remove, promote) */
38
- readonly?: boolean;
39
- /** Fields from job.data to extract as filterable tags (e.g., ['teamId', 'userId']) */
40
- tags?: string[];
41
- }
42
- /**
43
- * Queue information for API responses
44
- */
45
- interface QueueInfo {
46
- name: string;
47
- group?: string;
48
- counts: {
49
- waiting: number;
50
- active: number;
51
- completed: number;
52
- failed: number;
53
- delayed: number;
54
- paused: number;
55
- };
56
- isPaused: boolean;
57
- }
58
- /**
59
- * Queue group information for API responses
60
- */
61
- interface QueueGroupInfo {
62
- name: string;
63
- queues: string[];
64
- }
65
- /**
66
- * Worker information from BullMQ
67
- */
68
- interface WorkerInfo {
69
- id: string;
70
- name: string;
71
- addr: string;
72
- age: number;
73
- idle: number;
74
- started: number;
75
- queueName: string;
76
- }
77
- /**
78
- * Extracted tag key-value pairs from job data
79
- */
80
- type JobTags = Record<string, string | number | boolean | null>;
81
- /**
82
- * Job information for API responses
83
- */
84
- interface JobInfo {
85
- id: string;
86
- name: string;
87
- data: unknown;
88
- opts: {
89
- attempts?: number;
90
- delay?: number;
91
- priority?: number;
92
- };
93
- progress: number | object;
94
- attemptsMade: number;
95
- processedOn?: number;
96
- finishedOn?: number;
97
- timestamp: number;
98
- failedReason?: string;
99
- stacktrace?: string[];
100
- returnvalue?: unknown;
101
- status: JobStatus;
102
- duration?: number;
103
- /** Extracted tag values from job.data based on configured tag fields */
104
- tags?: JobTags;
105
- /** Parent job info if this job is part of a flow */
106
- parent?: {
107
- id: string;
108
- queueName: string;
109
- };
110
- }
111
- /**
112
- * BullMQ log lines for a job.
113
- */
114
- interface JobLogsResponse {
115
- logs: string[];
116
- count: number;
117
- start: number;
118
- end: number;
119
- }
120
- /**
121
- * Overview stats for dashboard
122
- */
123
- interface OverviewStats {
124
- totalJobs: number;
125
- activeJobs: number;
126
- failedJobs: number;
127
- completedToday: number;
128
- avgDuration: number;
129
- queues: QueueInfo[];
130
- }
131
- /**
132
- * Paginated response wrapper
133
- */
134
- interface PaginatedResponse<T> {
135
- data: T[];
136
- total: number;
137
- cursor?: string;
138
- hasMore: boolean;
139
- }
140
- /**
141
- * Search result item
142
- */
143
- interface SearchResult {
144
- queue: string;
145
- job: JobInfo;
146
- }
147
- /**
148
- * Run item - job execution with queue context
149
- */
150
- interface RunInfo extends JobInfo {
151
- queueName: string;
152
- }
153
- /**
154
- * Lightweight run info for list view - only fields needed for table display
155
- * Excludes large fields like full job.data, opts, progress, etc.
156
- */
157
- interface RunInfoList {
158
- id: string;
159
- name: string;
160
- status: JobStatus;
161
- queueName: string;
162
- tags?: JobTags;
163
- processedOn?: number;
164
- timestamp: number;
165
- duration?: number;
166
- }
167
- /**
168
- * Scheduler info for repeatable jobs
169
- */
170
- interface SchedulerInfo {
171
- key: string;
172
- name: string;
173
- queueName: string;
174
- pattern?: string;
175
- every?: number;
176
- next?: number;
177
- endDate?: number;
178
- tz?: string;
179
- }
180
- /**
181
- * Delayed job info
182
- */
183
- interface DelayedJobInfo {
184
- id: string;
185
- name: string;
186
- queueName: string;
187
- delay: number;
188
- processAt: number;
189
- data: unknown;
190
- }
191
- /**
192
- * Test job request
193
- */
194
- interface TestJobRequest {
195
- queueName: string;
196
- jobName: string;
197
- data: unknown;
198
- opts?: {
199
- delay?: number;
200
- priority?: number;
201
- attempts?: number;
202
- };
203
- }
204
- /**
205
- * Sort direction
206
- */
207
- type SortDirection = "asc" | "desc";
208
- /**
209
- * Sort options for API requests
210
- */
211
- interface SortOptions {
212
- field: string;
213
- direction: SortDirection;
214
- }
215
- /**
216
- * Valid sort fields for runs/jobs
217
- */
218
- type RunSortField = "timestamp" | "name" | "status" | "duration" | "queueName";
219
- /**
220
- * Valid sort fields for repeatable schedulers
221
- */
222
- type RepeatableSortField = "name" | "queueName" | "pattern" | "next" | "tz";
223
- /**
224
- * Valid sort fields for delayed schedulers
225
- */
226
- type DelayedSortField = "name" | "queueName" | "processAt" | "delay";
227
- /**
228
- * Hourly bucket for metrics aggregation
229
- */
230
- interface HourlyBucket {
231
- /** Unix timestamp (start of hour) */
232
- hour: number;
233
- /** Number of completed jobs */
234
- completed: number;
235
- /** Number of failed jobs */
236
- failed: number;
237
- /** Average processing duration in ms */
238
- avgDuration: number;
239
- /** Average queue wait time in ms */
240
- avgWaitTime: number;
241
- }
242
- /**
243
- * Metrics for a single queue
244
- */
245
- interface QueueMetrics {
246
- queueName: string;
247
- buckets: HourlyBucket[];
248
- summary: {
249
- totalCompleted: number;
250
- totalFailed: number;
251
- /** Error rate as 0-1 */
252
- errorRate: number;
253
- /** Average processing duration in ms */
254
- avgDuration: number;
255
- /** Average queue wait time in ms */
256
- avgWaitTime: number;
257
- /** Average throughput per hour */
258
- throughputPerHour: number;
259
- };
260
- }
261
- /**
262
- * Slowest job entry
263
- */
264
- interface SlowestJob {
265
- name: string;
266
- queueName: string;
267
- duration: number;
268
- jobId: string;
269
- }
270
- /**
271
- * Most failing job type entry
272
- */
273
- interface FailingJobType {
274
- name: string;
275
- queueName: string;
276
- failCount: number;
277
- totalCount: number;
278
- errorRate: number;
279
- }
280
- /**
281
- * Complete metrics response
282
- */
283
- interface MetricsResponse {
284
- /** Metrics per queue */
285
- queues: QueueMetrics[];
286
- /** Aggregated metrics across all queues */
287
- aggregate: Omit<QueueMetrics, "queueName"> & {
288
- queueName: "all";
289
- };
290
- /** Top 10 slowest jobs */
291
- slowestJobs: SlowestJob[];
292
- /** Top 10 most failing job types */
293
- mostFailingTypes: FailingJobType[];
294
- /** Timestamp when metrics were computed */
295
- computedAt: number;
296
- }
297
- /**
298
- * A node in a flow tree representing a job and its children
299
- */
300
- interface FlowNode {
301
- job: JobInfo;
302
- queueName: string;
303
- children?: FlowNode[];
304
- }
305
- /**
306
- * Flow summary for list view
307
- */
308
- interface FlowSummary {
309
- /** Root job ID */
310
- id: string;
311
- /** Root job name */
312
- name: string;
313
- /** Queue containing root job */
314
- queueName: string;
315
- /** Root job status */
316
- status: JobStatus;
317
- /** Total number of jobs in flow */
318
- totalJobs: number;
319
- /** Number of completed jobs */
320
- completedJobs: number;
321
- /** Number of failed jobs */
322
- failedJobs: number;
323
- /** When flow was created */
324
- timestamp: number;
325
- /** Duration if completed */
326
- duration?: number;
327
- }
328
- /**
329
- * Request to create a test flow
330
- */
331
- interface CreateFlowRequest {
332
- name: string;
333
- queueName: string;
334
- data?: unknown;
335
- children: CreateFlowChildRequest[];
336
- }
337
- /**
338
- * Child job in a flow creation request
339
- */
340
- interface CreateFlowChildRequest {
341
- name: string;
342
- queueName: string;
343
- data?: unknown;
344
- children?: CreateFlowChildRequest[];
345
- }
346
- /**
347
- * Activity bucket for timeline
348
- */
349
- interface ActivityBucket {
350
- /** Unix timestamp (start of bucket) */
351
- time: number;
352
- /** Number of completed jobs */
353
- completed: number;
354
- /** Number of failed jobs */
355
- failed: number;
356
- }
357
- /**
358
- * Activity stats response for the 7-day timeline
359
- */
360
- interface ActivityStatsResponse {
361
- /** Activity buckets (4-hour intervals over 7 days) */
362
- buckets: ActivityBucket[];
363
- /** Start time of the first bucket */
364
- startTime: number;
365
- /** End time (now) */
366
- endTime: number;
367
- /** Size of each bucket in ms */
368
- bucketSize: number;
369
- /** Total completed in period */
370
- totalCompleted: number;
371
- /** Total failed in period */
372
- totalFailed: number;
373
- /** Timestamp when stats were computed */
374
- computedAt: number;
375
- }
376
-
377
- export type { ActivityBucket as A, CreateFlowChildRequest as C, DelayedJobInfo as D, FailingJobType as F, HourlyBucket as H, JobInfo as J, MetricsResponse as M, OverviewStats as O, PaginatedResponse as P, QueueGroup as Q, RepeatableSortField as R, SchedulerInfo as S, TestJobRequest as T, WorkbenchOptions as W, ActivityStatsResponse as a, CreateFlowRequest as b, DelayedSortField as c, FlowNode as d, FlowSummary as e, JobLogsResponse as f, JobStatus as g, JobTags as h, QueueGroupInfo as i, QueueInfo as j, QueueMetrics as k, RunInfo as l, RunInfoList as m, RunSortField as n, SearchResult as o, SlowestJob as p, SortDirection as q, SortOptions as r, WorkerInfo as s };
Binary file