@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
package/dist/hono.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Queue, RedisOptions } from 'bullmq';
|
|
2
|
-
import { W as WorkbenchCore, r as WorkbenchOptions } from './workbench-
|
|
3
|
-
export { A as ActivityBucket, a as ActivityStatsResponse, C as CreateFlowChildRequest, b as CreateFlowRequest, D as DelayedJobInfo, c as DelayedSortField, d as DiscoveryMeta, F as FailingJobType, e as FlowNode, f as FlowSummary, H as HourlyBucket, J as JobInfo, g as JobStatus, h as JobTags, M as MetricsResponse, O as OverviewStats, P as PaginatedResponse, Q as QueueInfo, i as QueueManager, j as QueueMetrics, R as RepeatableSortField, k as RunInfo, l as RunInfoList, m as RunSortField, S as SchedulerInfo, n as SearchResult, o as SlowestJob, p as SortDirection, q as SortOptions, T as TestJobRequest, s as WorkerInfo } from './workbench-
|
|
2
|
+
import { W as WorkbenchCore, r as WorkbenchOptions } from './workbench-Btnvit1t.js';
|
|
3
|
+
export { A as ActivityBucket, a as ActivityStatsResponse, C as CreateFlowChildRequest, b as CreateFlowRequest, D as DelayedJobInfo, c as DelayedSortField, d as DiscoveryMeta, F as FailingJobType, e as FlowNode, f as FlowSummary, H as HourlyBucket, J as JobInfo, g as JobStatus, h as JobTags, M as MetricsResponse, O as OverviewStats, P as PaginatedResponse, Q as QueueInfo, i as QueueManager, j as QueueMetrics, R as RepeatableSortField, k as RunInfo, l as RunInfoList, m as RunSortField, S as SchedulerInfo, n as SearchResult, o as SlowestJob, p as SortDirection, q as SortOptions, T as TestJobRequest, s as WorkerInfo } from './workbench-Btnvit1t.js';
|
|
4
4
|
|
|
5
5
|
interface FetchHandlerResult {
|
|
6
6
|
/**
|
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ var QueueManager = class {
|
|
|
168
168
|
if (!client) {
|
|
169
169
|
const jobs2 = await queue.getJobs([status], 0, limit * 2);
|
|
170
170
|
return jobs2.filter(
|
|
171
|
-
(job) => job.finishedOn && job.finishedOn >= startTime && job.finishedOn <= endTime
|
|
171
|
+
(job) => job != null && !!job.finishedOn && job.finishedOn >= startTime && job.finishedOn <= endTime
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
const queueKey = `bull:${queue.name}:${status}`;
|
|
@@ -191,7 +191,7 @@ var QueueManager = class {
|
|
|
191
191
|
} catch (_error) {
|
|
192
192
|
const jobs = await queue.getJobs([status], 0, limit * 2);
|
|
193
193
|
return jobs.filter(
|
|
194
|
-
(job) => job.finishedOn && job.finishedOn >= startTime && job.finishedOn <= endTime
|
|
194
|
+
(job) => job != null && !!job.finishedOn && job.finishedOn >= startTime && job.finishedOn <= endTime
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
@@ -265,6 +265,8 @@ var QueueManager = class {
|
|
|
265
265
|
completed: 0,
|
|
266
266
|
failed: 0,
|
|
267
267
|
delayed: 0,
|
|
268
|
+
prioritized: 0,
|
|
269
|
+
"waiting-children": 0,
|
|
268
270
|
total: 0,
|
|
269
271
|
timestamp: Date.now()
|
|
270
272
|
};
|
|
@@ -276,9 +278,11 @@ var QueueManager = class {
|
|
|
276
278
|
totals.completed += counts.completed || 0;
|
|
277
279
|
totals.failed += counts.failed || 0;
|
|
278
280
|
totals.delayed += counts.delayed || 0;
|
|
281
|
+
totals.prioritized += counts.prioritized || 0;
|
|
282
|
+
totals["waiting-children"] += counts["waiting-children"] || 0;
|
|
279
283
|
})
|
|
280
284
|
);
|
|
281
|
-
totals.total = totals.waiting + totals.active + totals.completed + totals.failed + totals.delayed;
|
|
285
|
+
totals.total = totals.waiting + totals.active + totals.completed + totals.failed + totals.delayed + totals.prioritized + totals["waiting-children"];
|
|
282
286
|
return totals;
|
|
283
287
|
});
|
|
284
288
|
}
|
|
@@ -321,6 +325,8 @@ var QueueManager = class {
|
|
|
321
325
|
completed: counts.completed || 0,
|
|
322
326
|
failed: counts.failed || 0,
|
|
323
327
|
delayed: counts.delayed || 0,
|
|
328
|
+
prioritized: counts.prioritized || 0,
|
|
329
|
+
"waiting-children": counts["waiting-children"] || 0,
|
|
324
330
|
paused: counts.paused || 0
|
|
325
331
|
},
|
|
326
332
|
isPaused
|
|
@@ -340,7 +346,7 @@ var QueueManager = class {
|
|
|
340
346
|
let activeJobs = 0;
|
|
341
347
|
let failedJobs = 0;
|
|
342
348
|
for (const queue of queues) {
|
|
343
|
-
totalJobs += queue.counts.waiting + queue.counts.active + queue.counts.delayed;
|
|
349
|
+
totalJobs += queue.counts.waiting + queue.counts.active + queue.counts.delayed + queue.counts.prioritized + queue.counts["waiting-children"];
|
|
344
350
|
activeJobs += queue.counts.active;
|
|
345
351
|
failedJobs += queue.counts.failed;
|
|
346
352
|
}
|
|
@@ -709,7 +715,15 @@ var QueueManager = class {
|
|
|
709
715
|
if (!queue) {
|
|
710
716
|
return { data: [], total: 0, hasMore: false };
|
|
711
717
|
}
|
|
712
|
-
const types = status ? [status] : [
|
|
718
|
+
const types = status ? [status] : [
|
|
719
|
+
"active",
|
|
720
|
+
"waiting",
|
|
721
|
+
"waiting-children",
|
|
722
|
+
"prioritized",
|
|
723
|
+
"completed",
|
|
724
|
+
"failed",
|
|
725
|
+
"delayed"
|
|
726
|
+
];
|
|
713
727
|
const counts = await this.getCachedJobCounts(queue);
|
|
714
728
|
const jobsWithState = [];
|
|
715
729
|
let total = 0;
|
|
@@ -916,7 +930,7 @@ var QueueManager = class {
|
|
|
916
930
|
const queueChecks = await Promise.all(
|
|
917
931
|
queueEntries.map(async ([queueName, queue]) => {
|
|
918
932
|
const counts = await this.getCachedJobCounts(queue);
|
|
919
|
-
const hasJobs = (counts.waiting || 0) > 0 || (counts.active || 0) > 0 || (counts.completed || 0) > 0 || (counts.failed || 0) > 0 || (counts.delayed || 0) > 0;
|
|
933
|
+
const hasJobs = (counts.waiting || 0) > 0 || (counts.active || 0) > 0 || (counts.completed || 0) > 0 || (counts.failed || 0) > 0 || (counts.delayed || 0) > 0 || (counts.prioritized || 0) > 0 || (counts["waiting-children"] || 0) > 0;
|
|
920
934
|
return { queueName, queue, hasJobs };
|
|
921
935
|
})
|
|
922
936
|
);
|
|
@@ -924,7 +938,15 @@ var QueueManager = class {
|
|
|
924
938
|
if (relevantQueues.length === 0) {
|
|
925
939
|
return [];
|
|
926
940
|
}
|
|
927
|
-
const types = [
|
|
941
|
+
const types = [
|
|
942
|
+
"active",
|
|
943
|
+
"waiting",
|
|
944
|
+
"waiting-children",
|
|
945
|
+
"prioritized",
|
|
946
|
+
"completed",
|
|
947
|
+
"failed",
|
|
948
|
+
"delayed"
|
|
949
|
+
];
|
|
928
950
|
const fetchLimit = Math.min(limit * 2, 50);
|
|
929
951
|
const stringifiedDataCache = /* @__PURE__ */ new WeakMap();
|
|
930
952
|
const queueResults = await Promise.allSettled(
|
|
@@ -1004,16 +1026,23 @@ var QueueManager = class {
|
|
|
1004
1026
|
}
|
|
1005
1027
|
const perQueueFetch = Math.max(5, Math.ceil((limit + 10) / numQueues) + 2);
|
|
1006
1028
|
const allTypes = [
|
|
1007
|
-
"waiting",
|
|
1008
1029
|
"active",
|
|
1030
|
+
"waiting",
|
|
1031
|
+
"waiting-children",
|
|
1032
|
+
"prioritized",
|
|
1009
1033
|
"completed",
|
|
1010
1034
|
"failed",
|
|
1011
1035
|
"delayed"
|
|
1012
1036
|
];
|
|
1013
1037
|
const results = await Promise.all(
|
|
1014
1038
|
queueEntries.map(async ([queueName, queue]) => {
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1039
|
+
const jobArrays = await Promise.all(
|
|
1040
|
+
allTypes.map(async (type) => {
|
|
1041
|
+
const jobs = await queue.getJobs(type, 0, perQueueFetch);
|
|
1042
|
+
return jobs.map((job) => ({ job, queueName, state: type }));
|
|
1043
|
+
})
|
|
1044
|
+
);
|
|
1045
|
+
return jobArrays.flat();
|
|
1017
1046
|
})
|
|
1018
1047
|
);
|
|
1019
1048
|
const allJobs = results.flat();
|
|
@@ -1024,15 +1053,7 @@ var QueueManager = class {
|
|
|
1024
1053
|
});
|
|
1025
1054
|
const jobsToConvert = allJobs.slice(start, start + limit);
|
|
1026
1055
|
const runInfos = await Promise.all(
|
|
1027
|
-
jobsToConvert.map(async ({ job, queueName }) => {
|
|
1028
|
-
let state = "waiting";
|
|
1029
|
-
if (job.finishedOn) {
|
|
1030
|
-
state = job.failedReason ? "failed" : "completed";
|
|
1031
|
-
} else if (job.processedOn) {
|
|
1032
|
-
state = "active";
|
|
1033
|
-
} else if (job.delay && job.delay > 0) {
|
|
1034
|
-
state = "delayed";
|
|
1035
|
-
}
|
|
1056
|
+
jobsToConvert.map(async ({ job, queueName, state }) => {
|
|
1036
1057
|
const info = await this.jobToInfo(job, "list", state);
|
|
1037
1058
|
return { ...info, queueName };
|
|
1038
1059
|
})
|
|
@@ -1059,7 +1080,15 @@ var QueueManager = class {
|
|
|
1059
1080
|
return this.getLatestRuns(limit, start);
|
|
1060
1081
|
}
|
|
1061
1082
|
const queueEntries = Array.from(this.queues.entries());
|
|
1062
|
-
const types = filters?.status ? [filters.status] : [
|
|
1083
|
+
const types = filters?.status ? [filters.status] : [
|
|
1084
|
+
"active",
|
|
1085
|
+
"waiting",
|
|
1086
|
+
"waiting-children",
|
|
1087
|
+
"prioritized",
|
|
1088
|
+
"completed",
|
|
1089
|
+
"failed",
|
|
1090
|
+
"delayed"
|
|
1091
|
+
];
|
|
1063
1092
|
const hasTimeRange = !!filters?.timeRange;
|
|
1064
1093
|
const numQueues = Math.max(queueEntries.length, 1);
|
|
1065
1094
|
if (queueEntries.length === 0) {
|
|
@@ -1287,7 +1316,15 @@ var QueueManager = class {
|
|
|
1287
1316
|
*/
|
|
1288
1317
|
async getTagValues(field, limit = 50) {
|
|
1289
1318
|
const valueMap = /* @__PURE__ */ new Map();
|
|
1290
|
-
const types = [
|
|
1319
|
+
const types = [
|
|
1320
|
+
"active",
|
|
1321
|
+
"waiting",
|
|
1322
|
+
"waiting-children",
|
|
1323
|
+
"prioritized",
|
|
1324
|
+
"completed",
|
|
1325
|
+
"failed",
|
|
1326
|
+
"delayed"
|
|
1327
|
+
];
|
|
1291
1328
|
const queueEntries = Array.from(this.queues.entries());
|
|
1292
1329
|
const queueResults = await Promise.all(
|
|
1293
1330
|
queueEntries.map(async ([, queue]) => {
|
|
@@ -1584,8 +1621,9 @@ var QueueManager = class {
|
|
|
1584
1621
|
return { queueName, jobs: waitingChildrenJobs };
|
|
1585
1622
|
}
|
|
1586
1623
|
const otherTypes = [
|
|
1587
|
-
"waiting",
|
|
1588
1624
|
"active",
|
|
1625
|
+
"waiting",
|
|
1626
|
+
"prioritized",
|
|
1589
1627
|
"completed",
|
|
1590
1628
|
"failed",
|
|
1591
1629
|
"delayed"
|