@workglow/task-graph 0.0.64 → 0.0.66

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 CHANGED
@@ -2242,6 +2242,30 @@ class TaskGraph {
2242
2242
  unsubscribes.forEach((unsub) => unsub());
2243
2243
  };
2244
2244
  }
2245
+ subscribeToTaskProgress(callback) {
2246
+ const unsubscribes = [];
2247
+ const tasks = this.getTasks();
2248
+ tasks.forEach((task) => {
2249
+ const unsub = task.subscribe("progress", (progress, message, ...args) => {
2250
+ callback(task.config.id, progress, message, ...args);
2251
+ });
2252
+ unsubscribes.push(unsub);
2253
+ });
2254
+ const handleTaskAdded = (taskId) => {
2255
+ const task = this.getTask(taskId);
2256
+ if (!task || typeof task.subscribe !== "function")
2257
+ return;
2258
+ const unsub = task.subscribe("progress", (progress, message, ...args) => {
2259
+ callback(task.config.id, progress, message, ...args);
2260
+ });
2261
+ unsubscribes.push(unsub);
2262
+ };
2263
+ const graphUnsub = this.subscribe("task_added", handleTaskAdded);
2264
+ unsubscribes.push(graphUnsub);
2265
+ return () => {
2266
+ unsubscribes.forEach((unsub) => unsub());
2267
+ };
2268
+ }
2245
2269
  subscribeToDataflowStatus(callback) {
2246
2270
  const unsubscribes = [];
2247
2271
  const dataflows = this.getDataflows();
@@ -2777,6 +2801,9 @@ class TaskGraphTabularRepository extends TaskGraphRepository {
2777
2801
  super();
2778
2802
  this.tabularRepository = tabularRepository;
2779
2803
  }
2804
+ async setupDatabase() {
2805
+ await this.tabularRepository.setupDatabase?.();
2806
+ }
2780
2807
  async saveTaskGraph(key, output) {
2781
2808
  const value = JSON.stringify(output.toJSON());
2782
2809
  await this.tabularRepository.put({ key, value });
@@ -2822,6 +2849,9 @@ class TaskOutputTabularRepository extends TaskOutputRepository {
2822
2849
  this.tabularRepository = tabularRepository;
2823
2850
  this.outputCompression = outputCompression;
2824
2851
  }
2852
+ async setupDatabase() {
2853
+ await this.tabularRepository.setupDatabase?.();
2854
+ }
2825
2855
  async keyFromInputs(inputs) {
2826
2856
  return await makeFingerprint(inputs);
2827
2857
  }
@@ -2938,4 +2968,4 @@ export {
2938
2968
  ArrayTask
2939
2969
  };
2940
2970
 
2941
- //# debugId=662106DD09E8768F64756E2164756E21
2971
+ //# debugId=7754D6F660A291F164756E2164756E21