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