@workglow/tasks 0.0.88 → 0.0.90

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
@@ -897,6 +897,9 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
897
897
  async executeTaskChildren(_input) {
898
898
  return super.executeTaskChildren({});
899
899
  }
900
+ async executeTaskChildrenReactive() {
901
+ return this.task.subGraph.runReactive({});
902
+ }
900
903
  async executeTaskReactive(input, output) {
901
904
  await super.executeTaskReactive(input, output);
902
905
  if (this.task.hasChildren()) {
@@ -2823,7 +2826,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2823
2826
  }(strFunctions[i][0]);
2824
2827
  this.setProperty(globalObject, strFunctions[i][1], this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2825
2828
  }
2826
- wrapper = function setTimeout(var_args) {
2829
+ wrapper = function setTimeout2(var_args) {
2827
2830
  return thisInterpreter.createTask_(false, arguments);
2828
2831
  };
2829
2832
  this.setProperty(globalObject, "setTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2831,7 +2834,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2831
2834
  return thisInterpreter.createTask_(true, arguments);
2832
2835
  };
2833
2836
  this.setProperty(globalObject, "setInterval", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2834
- wrapper = function clearTimeout(pid) {
2837
+ wrapper = function clearTimeout2(pid) {
2835
2838
  thisInterpreter.deleteTask_(pid);
2836
2839
  };
2837
2840
  this.setProperty(globalObject, "clearTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2858,7 +2861,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2858
2861
  var thisInterpreter = this;
2859
2862
  var wrapper;
2860
2863
  var identifierRegexp = /^[A-Za-z_$][\w$]*$/;
2861
- wrapper = function Function(var_args) {
2864
+ wrapper = function Function2(var_args) {
2862
2865
  if (arguments.length) {
2863
2866
  var code = String(arguments[arguments.length - 1]);
2864
2867
  } else {
@@ -2936,7 +2939,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2936
2939
  Interpreter.prototype.initObject = function(globalObject) {
2937
2940
  var thisInterpreter = this;
2938
2941
  var wrapper;
2939
- wrapper = function Object(value) {
2942
+ wrapper = function Object2(value) {
2940
2943
  if (value === undefined || value === null) {
2941
2944
  if (thisInterpreter.calledWithNew()) {
2942
2945
  return this;
@@ -3076,7 +3079,7 @@ Interpreter.prototype.initObject = function(globalObject) {
3076
3079
  Interpreter.prototype.initArray = function(globalObject) {
3077
3080
  var thisInterpreter = this;
3078
3081
  var wrapper;
3079
- wrapper = function Array(var_args) {
3082
+ wrapper = function Array2(var_args) {
3080
3083
  if (thisInterpreter.calledWithNew()) {
3081
3084
  var newArray = this;
3082
3085
  } else {
@@ -3114,7 +3117,7 @@ Interpreter.prototype.initArray = function(globalObject) {
3114
3117
  Interpreter.prototype.initString = function(globalObject) {
3115
3118
  var thisInterpreter = this;
3116
3119
  var wrapper;
3117
- wrapper = function String(value) {
3120
+ wrapper = function String2(value) {
3118
3121
  value = arguments.length ? Interpreter.nativeGlobal.String(value) : "";
3119
3122
  if (thisInterpreter.calledWithNew()) {
3120
3123
  this.data = value;
@@ -3289,7 +3292,7 @@ Interpreter.prototype.initString = function(globalObject) {
3289
3292
  Interpreter.prototype.initBoolean = function(globalObject) {
3290
3293
  var thisInterpreter = this;
3291
3294
  var wrapper;
3292
- wrapper = function Boolean(value) {
3295
+ wrapper = function Boolean2(value) {
3293
3296
  value = Interpreter.nativeGlobal.Boolean(value);
3294
3297
  if (thisInterpreter.calledWithNew()) {
3295
3298
  this.data = value;
@@ -3304,7 +3307,7 @@ Interpreter.prototype.initBoolean = function(globalObject) {
3304
3307
  Interpreter.prototype.initNumber = function(globalObject) {
3305
3308
  var thisInterpreter = this;
3306
3309
  var wrapper;
3307
- wrapper = function Number(value) {
3310
+ wrapper = function Number2(value) {
3308
3311
  value = arguments.length ? Interpreter.nativeGlobal.Number(value) : 0;
3309
3312
  if (thisInterpreter.calledWithNew()) {
3310
3313
  this.data = value;
@@ -3365,7 +3368,7 @@ Interpreter.prototype.initNumber = function(globalObject) {
3365
3368
  Interpreter.prototype.initDate = function(globalObject) {
3366
3369
  var thisInterpreter = this;
3367
3370
  var wrapper;
3368
- wrapper = function Date(_value, var_args) {
3371
+ wrapper = function Date2(_value, var_args) {
3369
3372
  if (!thisInterpreter.calledWithNew()) {
3370
3373
  return Interpreter.nativeGlobal.Date();
3371
3374
  }
@@ -3445,7 +3448,7 @@ Interpreter.prototype.initDate = function(globalObject) {
3445
3448
  Interpreter.prototype.initRegExp = function(globalObject) {
3446
3449
  var thisInterpreter = this;
3447
3450
  var wrapper;
3448
- wrapper = function RegExp(pattern, flags) {
3451
+ wrapper = function RegExp2(pattern, flags) {
3449
3452
  if (thisInterpreter.calledWithNew()) {
3450
3453
  var rgx = this;
3451
3454
  } else {
@@ -3522,7 +3525,7 @@ Interpreter.prototype.initRegExp = function(globalObject) {
3522
3525
  };
3523
3526
  Interpreter.prototype.initError = function(globalObject) {
3524
3527
  var thisInterpreter = this;
3525
- this.ERROR = this.createNativeFunction(function Error(opt_message) {
3528
+ this.ERROR = this.createNativeFunction(function Error2(opt_message) {
3526
3529
  if (thisInterpreter.calledWithNew()) {
3527
3530
  var newError = this;
3528
3531
  } else {
@@ -3592,7 +3595,7 @@ Interpreter.prototype.initJSON = function(globalObject) {
3592
3595
  var thisInterpreter = this;
3593
3596
  var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);
3594
3597
  this.setProperty(globalObject, "JSON", myJSON, Interpreter.NONENUMERABLE_DESCRIPTOR);
3595
- wrapper = function parse(text) {
3598
+ wrapper = function parse2(text) {
3596
3599
  try {
3597
3600
  var nativeObj = JSON.parse(String(text));
3598
3601
  } catch (e) {
@@ -5583,10 +5586,7 @@ class JavaScriptTask extends Task5 {
5583
5586
  const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
5584
5587
  myInterpreter.run();
5585
5588
  output.output = myInterpreter.value;
5586
- console.log("output", output.output);
5587
- } catch (e) {
5588
- console.error("error", e);
5589
- }
5589
+ } catch (e) {}
5590
5590
  }
5591
5591
  return output;
5592
5592
  }
@@ -5598,6 +5598,7 @@ Workflow7.prototype.javaScript = CreateWorkflow7(JavaScriptTask);
5598
5598
  // src/task/JsonTask.ts
5599
5599
  import {
5600
5600
  createGraphFromDependencyJSON,
5601
+ createGraphFromGraphJSON,
5601
5602
  CreateWorkflow as CreateWorkflow8,
5602
5603
  Dataflow,
5603
5604
  GraphAsTask as GraphAsTask2,
@@ -5640,10 +5641,13 @@ class JsonTask extends GraphAsTask2 {
5640
5641
  regenerateGraph() {
5641
5642
  if (!this.runInputData.json)
5642
5643
  return;
5643
- let data = JSON.parse(this.runInputData.json);
5644
- if (!Array.isArray(data))
5645
- data = [data];
5646
- const jsonItems = data;
5644
+ const data = JSON.parse(this.runInputData.json);
5645
+ if (data && typeof data === "object" && "tasks" in data && Array.isArray(data.tasks) && "dataflows" in data && Array.isArray(data.dataflows)) {
5646
+ this.subGraph = createGraphFromGraphJSON(data);
5647
+ super.regenerateGraph();
5648
+ return;
5649
+ }
5650
+ let jsonItems = Array.isArray(data) ? data : [data];
5647
5651
  this.subGraph = createGraphFromDependencyJSON(jsonItems);
5648
5652
  for (const item of jsonItems) {
5649
5653
  if (!item.dependencies)
@@ -5776,7 +5780,7 @@ class MergeTask extends Task7 {
5776
5780
  static outputSchema() {
5777
5781
  return outputSchema8;
5778
5782
  }
5779
- async execute(input2, context) {
5783
+ async execute(input2, _context) {
5780
5784
  const keys = Object.keys(input2).sort();
5781
5785
  const values = keys.map((key) => input2[key]);
5782
5786
  return {
@@ -5884,7 +5888,6 @@ Workflow12.prototype.split = CreateWorkflow12(SplitTask);
5884
5888
  import { TaskRegistry } from "@workglow/task-graph";
5885
5889
  var registerCommonTasks = () => {
5886
5890
  const tasks = [
5887
- ArrayTask,
5888
5891
  DebugLogTask,
5889
5892
  DelayTask,
5890
5893
  FetchUrlTask,
@@ -5930,4 +5933,4 @@ export {
5930
5933
  ArrayTask
5931
5934
  };
5932
5935
 
5933
- //# debugId=1F47CA5617DB100764756E2164756E21
5936
+ //# debugId=B2B64E263BDC9B5464756E2164756E21