@workglow/task-graph 0.0.55 → 0.0.56
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/browser.js +49 -1
- package/dist/browser.js.map +5 -5
- package/dist/bun.js +49 -1
- package/dist/bun.js.map +5 -5
- package/dist/node.js +49 -1
- package/dist/node.js.map +5 -5
- package/dist/task/Task.d.ts.map +1 -1
- package/dist/task-graph/ITaskGraph.d.ts +3 -1
- package/dist/task-graph/ITaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraph.d.ts +17 -1
- package/dist/task-graph/TaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphEvents.d.ts +8 -8
- package/dist/task-graph/TaskGraphEvents.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/bun.js
CHANGED
|
@@ -2218,6 +2218,54 @@ class TaskGraph {
|
|
|
2218
2218
|
this.on(name, fn);
|
|
2219
2219
|
return () => this.off(name, fn);
|
|
2220
2220
|
}
|
|
2221
|
+
subscribeToTaskStatus(callback) {
|
|
2222
|
+
const unsubscribes = [];
|
|
2223
|
+
const tasks = this.getTasks();
|
|
2224
|
+
tasks.forEach((task) => {
|
|
2225
|
+
const unsub = task.subscribe("status", (status) => {
|
|
2226
|
+
callback(task.config.id, status);
|
|
2227
|
+
});
|
|
2228
|
+
unsubscribes.push(unsub);
|
|
2229
|
+
});
|
|
2230
|
+
const handleTaskAdded = (taskId) => {
|
|
2231
|
+
const task = this.getTask(taskId);
|
|
2232
|
+
if (!task || typeof task.subscribe !== "function")
|
|
2233
|
+
return;
|
|
2234
|
+
const unsub = task.subscribe("status", (status) => {
|
|
2235
|
+
callback(task.config.id, status);
|
|
2236
|
+
});
|
|
2237
|
+
unsubscribes.push(unsub);
|
|
2238
|
+
};
|
|
2239
|
+
const graphUnsub = this.subscribe("task_added", handleTaskAdded);
|
|
2240
|
+
unsubscribes.push(graphUnsub);
|
|
2241
|
+
return () => {
|
|
2242
|
+
unsubscribes.forEach((unsub) => unsub());
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
subscribeToDataflowStatus(callback) {
|
|
2246
|
+
const unsubscribes = [];
|
|
2247
|
+
const dataflows = this.getDataflows();
|
|
2248
|
+
dataflows.forEach((dataflow) => {
|
|
2249
|
+
const unsub = dataflow.subscribe("status", (status) => {
|
|
2250
|
+
callback(dataflow.id, status);
|
|
2251
|
+
});
|
|
2252
|
+
unsubscribes.push(unsub);
|
|
2253
|
+
});
|
|
2254
|
+
const handleDataflowAdded = (dataflowId) => {
|
|
2255
|
+
const dataflow = this.getDataflow(dataflowId);
|
|
2256
|
+
if (!dataflow || typeof dataflow.subscribe !== "function")
|
|
2257
|
+
return;
|
|
2258
|
+
const unsub = dataflow.subscribe("status", (status) => {
|
|
2259
|
+
callback(dataflow.id, status);
|
|
2260
|
+
});
|
|
2261
|
+
unsubscribes.push(unsub);
|
|
2262
|
+
};
|
|
2263
|
+
const graphUnsub = this.subscribe("dataflow_added", handleDataflowAdded);
|
|
2264
|
+
unsubscribes.push(graphUnsub);
|
|
2265
|
+
return () => {
|
|
2266
|
+
unsubscribes.forEach((unsub) => unsub());
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2221
2269
|
on(name, fn) {
|
|
2222
2270
|
const dagEvent = EventTaskGraphToDagMapping[name];
|
|
2223
2271
|
if (dagEvent) {
|
|
@@ -2840,4 +2888,4 @@ export {
|
|
|
2840
2888
|
ArrayTask
|
|
2841
2889
|
};
|
|
2842
2890
|
|
|
2843
|
-
//# debugId=
|
|
2891
|
+
//# debugId=C28425FA5364B74264756E2164756E21
|