@workglow/task-graph 0.2.33 → 0.2.35

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.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../src/bun.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,UAAU,CAAC"}
package/dist/bun.js CHANGED
@@ -5313,20 +5313,24 @@ class WorkflowBuilder {
5313
5313
  this._dataFlows = [];
5314
5314
  this._error = "";
5315
5315
  }
5316
- addTaskInstance(taskClass, config) {
5317
- const task = new taskClass(config, this._registry ? { registry: this._registry } : undefined);
5316
+ addTaskInstance(taskClass, config, runConfig) {
5317
+ let mergedRunConfig = runConfig;
5318
+ if (this._registry !== undefined) {
5319
+ mergedRunConfig = { ...runConfig ?? {}, registry: this._registry };
5320
+ }
5321
+ const task = new taskClass(config, mergedRunConfig);
5318
5322
  const id = this._facade.graph.addTask(task);
5319
5323
  this._facade.events.emit("changed", id);
5320
5324
  return task;
5321
5325
  }
5322
- addTaskWithAutoConnect(taskClass, input = {}, config = {}) {
5326
+ addTaskWithAutoConnect(taskClass, input = {}, config = {}, runConfig) {
5323
5327
  this._error = "";
5324
5328
  const parent = getLastTask(this._facade);
5325
5329
  const task = this.addTaskInstance(taskClass, {
5326
5330
  id: uuid47(),
5327
5331
  ...config,
5328
5332
  defaults: input
5329
- });
5333
+ }, runConfig);
5330
5334
  if (this._dataFlows.length > 0) {
5331
5335
  this._dataFlows.forEach((dataflow) => {
5332
5336
  const taskSchema = task.inputSchema();
@@ -5370,14 +5374,14 @@ class WorkflowBuilder {
5370
5374
  }
5371
5375
  return this._facade;
5372
5376
  }
5373
- addLoopTask(taskClass, config = {}) {
5377
+ addLoopTask(taskClass, config = {}, runConfig) {
5374
5378
  this._error = "";
5375
5379
  const parent = getLastTask(this._facade);
5376
5380
  const schema = taskClass.configSchema?.();
5377
5381
  const required = typeof schema === "object" && schema !== null ? schema.required : undefined;
5378
5382
  const needsMaxIterations = Array.isArray(required) && required.includes("maxIterations");
5379
5383
  const resolvedConfig = needsMaxIterations && config.maxIterations === undefined ? { ...config, maxIterations: "unbounded" } : config;
5380
- const task = this.addTaskInstance(taskClass, { id: uuid47(), ...resolvedConfig });
5384
+ const task = this.addTaskInstance(taskClass, { id: uuid47(), ...resolvedConfig }, runConfig);
5381
5385
  if (this._dataFlows.length > 0) {
5382
5386
  this._dataFlows.forEach((dataflow) => {
5383
5387
  const taskSchema = task.inputSchema();
@@ -5565,8 +5569,8 @@ function CreateWorkflow(taskClass) {
5565
5569
  return Workflow.createWorkflow(taskClass);
5566
5570
  }
5567
5571
  function CreateLoopWorkflow(taskClass) {
5568
- return function(config = {}) {
5569
- return this.addLoopTask(taskClass, config);
5572
+ return function(config = {}, runConfig) {
5573
+ return this.addLoopTask(taskClass, config, runConfig);
5570
5574
  };
5571
5575
  }
5572
5576
  function CreateEndLoopWorkflow(methodName) {
@@ -5580,13 +5584,13 @@ function CreateEndLoopWorkflow(methodName) {
5580
5584
  function CreateAdaptiveWorkflow(scalarClass, vectorClass) {
5581
5585
  const scalarHelper = Workflow.createWorkflow(scalarClass);
5582
5586
  const vectorHelper = Workflow.createWorkflow(vectorClass);
5583
- return function(input = {}, config = {}) {
5587
+ return function(input = {}, config = {}, runConfig) {
5584
5588
  const parent = getLastTask(this);
5585
5589
  const useVector = parent !== undefined && hasVectorOutput(parent) || hasVectorLikeInput(input);
5586
5590
  if (useVector) {
5587
- return vectorHelper.call(this, input, config);
5591
+ return vectorHelper.call(this, input, config, runConfig);
5588
5592
  }
5589
- return scalarHelper.call(this, input, config);
5593
+ return scalarHelper.call(this, input, config, runConfig);
5590
5594
  };
5591
5595
  }
5592
5596
 
@@ -5627,8 +5631,8 @@ class Workflow {
5627
5631
  }
5628
5632
  events = new EventEmitter5;
5629
5633
  static createWorkflow(taskClass) {
5630
- const helper = function(input = {}, config = {}) {
5631
- this._builder.addTaskWithAutoConnect(taskClass, input, config);
5634
+ const helper = function(input = {}, config = {}, runConfig) {
5635
+ this._builder.addTaskWithAutoConnect(taskClass, input, config, runConfig);
5632
5636
  return this;
5633
5637
  };
5634
5638
  helper.type = taskClass.runtype ?? taskClass.type;
@@ -5765,11 +5769,11 @@ class Workflow {
5765
5769
  addTaskToGraph(taskClass, config) {
5766
5770
  return this._builder.addTaskInstance(taskClass, config);
5767
5771
  }
5768
- addTask(taskClass, input, config) {
5769
- return this._builder.addTaskWithAutoConnect(taskClass, input, config);
5772
+ addTask(taskClass, input, config, runConfig) {
5773
+ return this._builder.addTaskWithAutoConnect(taskClass, input, config, runConfig);
5770
5774
  }
5771
- addLoopTask(taskClass, config = {}) {
5772
- return this._builder.addLoopTask(taskClass, config);
5775
+ addLoopTask(taskClass, config = {}, runConfig) {
5776
+ return this._builder.addLoopTask(taskClass, config, runConfig);
5773
5777
  }
5774
5778
  if(condition) {
5775
5779
  return this._builder.createConditional(condition);
@@ -9002,4 +9006,4 @@ export {
9002
9006
  BROWSER_GRANTS
9003
9007
  };
9004
9008
 
9005
- //# debugId=896F2287B3DD5F3464756E2164756E21
9009
+ //# debugId=DD546652E4C6BFEA64756E2164756E21