@workglow/task-graph 0.2.4 → 0.2.6

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
@@ -2540,8 +2540,8 @@ class TopologicalScheduler {
2540
2540
  yield this.sortedNodes[this.currentIndex++];
2541
2541
  }
2542
2542
  }
2543
- onTaskCompleted(taskId) {}
2544
- onTaskStreaming(taskId) {}
2543
+ onTaskCompleted(_taskId) {}
2544
+ onTaskStreaming(_taskId) {}
2545
2545
  reset() {
2546
2546
  this.sortedNodes = this.dag.topologicallySortedNodes();
2547
2547
  this.currentIndex = 0;
@@ -3101,7 +3101,7 @@ class TaskGraphRunner {
3101
3101
  }
3102
3102
  });
3103
3103
  }
3104
- pushStreamToEdges(task, streamMode) {
3104
+ pushStreamToEdges(task, _streamMode) {
3105
3105
  const targetDataflows = this.graph.getTargetDataflows(task.id);
3106
3106
  if (targetDataflows.length === 0)
3107
3107
  return;
@@ -3418,9 +3418,9 @@ class GraphAsTask extends Task {
3418
3418
  static compoundMerge = PROPERTY_ARRAY;
3419
3419
  static hasDynamicSchemas = true;
3420
3420
  static hasDynamicEntitlements = true;
3421
- constructor(config = {}) {
3421
+ constructor(config = {}, runConfig = {}) {
3422
3422
  const { subGraph, ...rest } = config;
3423
- super(rest);
3423
+ super(rest, runConfig);
3424
3424
  if (subGraph) {
3425
3425
  this.subGraph = subGraph;
3426
3426
  }
@@ -3571,13 +3571,22 @@ class GraphAsTask extends Task {
3571
3571
  this.emitEntitlementChange();
3572
3572
  }
3573
3573
  _entitlementUnsub;
3574
+ _subscribingEntitlements = false;
3574
3575
  _subscribeToSubGraphEntitlements(graph) {
3575
3576
  this._entitlementUnsub?.();
3576
- this._entitlementUnsub = graph.subscribeToTaskEntitlements(() => {
3577
- this.emitEntitlementChange();
3578
- });
3577
+ this._entitlementUnsub = undefined;
3578
+ this._subscribingEntitlements = true;
3579
+ try {
3580
+ this._entitlementUnsub = graph.subscribeToTaskEntitlements(() => {
3581
+ this.emitEntitlementChange();
3582
+ });
3583
+ } finally {
3584
+ this._subscribingEntitlements = false;
3585
+ }
3579
3586
  }
3580
3587
  _syncSubGraphEntitlementSubscription(graph = this._subGraph) {
3588
+ if (this._subscribingEntitlements)
3589
+ return;
3581
3590
  if ((this._events?.listenerCount("entitlementChange") ?? 0) === 0) {
3582
3591
  this._entitlementUnsub?.();
3583
3592
  this._entitlementUnsub = undefined;
@@ -4122,7 +4131,7 @@ function parallel(args, mergeFn = PROPERTY_ARRAY, workflow = new Workflow) {
4122
4131
  const config = {
4123
4132
  compoundMerge: mergeFn
4124
4133
  };
4125
- const name = `‖${args.map((arg) => "\uD835\uDC53").join("‖")}‖`;
4134
+ const name = `‖${args.map((_arg) => "\uD835\uDC53").join("‖")}‖`;
4126
4135
 
4127
4136
  class ParallelTask extends GraphAsTask {
4128
4137
  static type = name;
@@ -5003,7 +5012,7 @@ function generateRegularTask(task, chainIndent, lines) {
5003
5012
  lines.push(`${chainIndent}.addTask(${args})`);
5004
5013
  }
5005
5014
  }
5006
- function generateLoopTask(task, loopInfo, incomingDataflows, taskOrder, indent, depth, lines) {
5015
+ function generateLoopTask(task, loopInfo, _incomingDataflows, _taskOrder, indent, depth, lines) {
5007
5016
  const chainIndent = indent.repeat(depth + 1);
5008
5017
  const config = extractLoopConfig(task);
5009
5018
  const loopColOffset = chainIndent.length + `.${loopInfo.method}(`.length;
@@ -8199,4 +8208,4 @@ export {
8199
8208
  BROWSER_GRANTS
8200
8209
  };
8201
8210
 
8202
- //# debugId=8A43A4F12CABDEAB64756E2164756E21
8211
+ //# debugId=1664425925BB4C1264756E2164756E21