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