@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/browser.js CHANGED
@@ -731,6 +731,9 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
731
731
  async executeTaskChildren(_input) {
732
732
  return super.executeTaskChildren({});
733
733
  }
734
+ async executeTaskChildrenReactive() {
735
+ return this.task.subGraph.runReactive({});
736
+ }
734
737
  async executeTaskReactive(input, output) {
735
738
  await super.executeTaskReactive(input, output);
736
739
  if (this.task.hasChildren()) {
@@ -2657,7 +2660,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2657
2660
  }(strFunctions[i][0]);
2658
2661
  this.setProperty(globalObject, strFunctions[i][1], this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2659
2662
  }
2660
- wrapper = function setTimeout(var_args) {
2663
+ wrapper = function setTimeout2(var_args) {
2661
2664
  return thisInterpreter.createTask_(false, arguments);
2662
2665
  };
2663
2666
  this.setProperty(globalObject, "setTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2665,7 +2668,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2665
2668
  return thisInterpreter.createTask_(true, arguments);
2666
2669
  };
2667
2670
  this.setProperty(globalObject, "setInterval", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2668
- wrapper = function clearTimeout(pid) {
2671
+ wrapper = function clearTimeout2(pid) {
2669
2672
  thisInterpreter.deleteTask_(pid);
2670
2673
  };
2671
2674
  this.setProperty(globalObject, "clearTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2692,7 +2695,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2692
2695
  var thisInterpreter = this;
2693
2696
  var wrapper;
2694
2697
  var identifierRegexp = /^[A-Za-z_$][\w$]*$/;
2695
- wrapper = function Function(var_args) {
2698
+ wrapper = function Function2(var_args) {
2696
2699
  if (arguments.length) {
2697
2700
  var code = String(arguments[arguments.length - 1]);
2698
2701
  } else {
@@ -2770,7 +2773,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2770
2773
  Interpreter.prototype.initObject = function(globalObject) {
2771
2774
  var thisInterpreter = this;
2772
2775
  var wrapper;
2773
- wrapper = function Object(value) {
2776
+ wrapper = function Object2(value) {
2774
2777
  if (value === undefined || value === null) {
2775
2778
  if (thisInterpreter.calledWithNew()) {
2776
2779
  return this;
@@ -2910,7 +2913,7 @@ Interpreter.prototype.initObject = function(globalObject) {
2910
2913
  Interpreter.prototype.initArray = function(globalObject) {
2911
2914
  var thisInterpreter = this;
2912
2915
  var wrapper;
2913
- wrapper = function Array(var_args) {
2916
+ wrapper = function Array2(var_args) {
2914
2917
  if (thisInterpreter.calledWithNew()) {
2915
2918
  var newArray = this;
2916
2919
  } else {
@@ -2948,7 +2951,7 @@ Interpreter.prototype.initArray = function(globalObject) {
2948
2951
  Interpreter.prototype.initString = function(globalObject) {
2949
2952
  var thisInterpreter = this;
2950
2953
  var wrapper;
2951
- wrapper = function String(value) {
2954
+ wrapper = function String2(value) {
2952
2955
  value = arguments.length ? Interpreter.nativeGlobal.String(value) : "";
2953
2956
  if (thisInterpreter.calledWithNew()) {
2954
2957
  this.data = value;
@@ -3123,7 +3126,7 @@ Interpreter.prototype.initString = function(globalObject) {
3123
3126
  Interpreter.prototype.initBoolean = function(globalObject) {
3124
3127
  var thisInterpreter = this;
3125
3128
  var wrapper;
3126
- wrapper = function Boolean(value) {
3129
+ wrapper = function Boolean2(value) {
3127
3130
  value = Interpreter.nativeGlobal.Boolean(value);
3128
3131
  if (thisInterpreter.calledWithNew()) {
3129
3132
  this.data = value;
@@ -3138,7 +3141,7 @@ Interpreter.prototype.initBoolean = function(globalObject) {
3138
3141
  Interpreter.prototype.initNumber = function(globalObject) {
3139
3142
  var thisInterpreter = this;
3140
3143
  var wrapper;
3141
- wrapper = function Number(value) {
3144
+ wrapper = function Number2(value) {
3142
3145
  value = arguments.length ? Interpreter.nativeGlobal.Number(value) : 0;
3143
3146
  if (thisInterpreter.calledWithNew()) {
3144
3147
  this.data = value;
@@ -3199,7 +3202,7 @@ Interpreter.prototype.initNumber = function(globalObject) {
3199
3202
  Interpreter.prototype.initDate = function(globalObject) {
3200
3203
  var thisInterpreter = this;
3201
3204
  var wrapper;
3202
- wrapper = function Date(_value, var_args) {
3205
+ wrapper = function Date2(_value, var_args) {
3203
3206
  if (!thisInterpreter.calledWithNew()) {
3204
3207
  return Interpreter.nativeGlobal.Date();
3205
3208
  }
@@ -3279,7 +3282,7 @@ Interpreter.prototype.initDate = function(globalObject) {
3279
3282
  Interpreter.prototype.initRegExp = function(globalObject) {
3280
3283
  var thisInterpreter = this;
3281
3284
  var wrapper;
3282
- wrapper = function RegExp(pattern, flags) {
3285
+ wrapper = function RegExp2(pattern, flags) {
3283
3286
  if (thisInterpreter.calledWithNew()) {
3284
3287
  var rgx = this;
3285
3288
  } else {
@@ -3356,7 +3359,7 @@ Interpreter.prototype.initRegExp = function(globalObject) {
3356
3359
  };
3357
3360
  Interpreter.prototype.initError = function(globalObject) {
3358
3361
  var thisInterpreter = this;
3359
- this.ERROR = this.createNativeFunction(function Error(opt_message) {
3362
+ this.ERROR = this.createNativeFunction(function Error2(opt_message) {
3360
3363
  if (thisInterpreter.calledWithNew()) {
3361
3364
  var newError = this;
3362
3365
  } else {
@@ -3426,7 +3429,7 @@ Interpreter.prototype.initJSON = function(globalObject) {
3426
3429
  var thisInterpreter = this;
3427
3430
  var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);
3428
3431
  this.setProperty(globalObject, "JSON", myJSON, Interpreter.NONENUMERABLE_DESCRIPTOR);
3429
- wrapper = function parse(text) {
3432
+ wrapper = function parse2(text) {
3430
3433
  try {
3431
3434
  var nativeObj = JSON.parse(String(text));
3432
3435
  } catch (e) {
@@ -5417,10 +5420,7 @@ class JavaScriptTask extends Task5 {
5417
5420
  const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
5418
5421
  myInterpreter.run();
5419
5422
  output.output = myInterpreter.value;
5420
- console.log("output", output.output);
5421
- } catch (e) {
5422
- console.error("error", e);
5423
- }
5423
+ } catch (e) {}
5424
5424
  }
5425
5425
  return output;
5426
5426
  }
@@ -5432,6 +5432,7 @@ Workflow6.prototype.javaScript = CreateWorkflow6(JavaScriptTask);
5432
5432
  // src/task/JsonTask.ts
5433
5433
  import {
5434
5434
  createGraphFromDependencyJSON,
5435
+ createGraphFromGraphJSON,
5435
5436
  CreateWorkflow as CreateWorkflow7,
5436
5437
  Dataflow,
5437
5438
  GraphAsTask as GraphAsTask2,
@@ -5474,10 +5475,13 @@ class JsonTask extends GraphAsTask2 {
5474
5475
  regenerateGraph() {
5475
5476
  if (!this.runInputData.json)
5476
5477
  return;
5477
- let data = JSON.parse(this.runInputData.json);
5478
- if (!Array.isArray(data))
5479
- data = [data];
5480
- const jsonItems = data;
5478
+ const data = JSON.parse(this.runInputData.json);
5479
+ if (data && typeof data === "object" && "tasks" in data && Array.isArray(data.tasks) && "dataflows" in data && Array.isArray(data.dataflows)) {
5480
+ this.subGraph = createGraphFromGraphJSON(data);
5481
+ super.regenerateGraph();
5482
+ return;
5483
+ }
5484
+ let jsonItems = Array.isArray(data) ? data : [data];
5481
5485
  this.subGraph = createGraphFromDependencyJSON(jsonItems);
5482
5486
  for (const item of jsonItems) {
5483
5487
  if (!item.dependencies)
@@ -5610,7 +5614,7 @@ class MergeTask extends Task7 {
5610
5614
  static outputSchema() {
5611
5615
  return outputSchema8;
5612
5616
  }
5613
- async execute(input2, context) {
5617
+ async execute(input2, _context) {
5614
5618
  const keys = Object.keys(input2).sort();
5615
5619
  const values = keys.map((key) => input2[key]);
5616
5620
  return {
@@ -5718,7 +5722,6 @@ Workflow11.prototype.split = CreateWorkflow11(SplitTask);
5718
5722
  import { TaskRegistry } from "@workglow/task-graph";
5719
5723
  var registerCommonTasks = () => {
5720
5724
  const tasks = [
5721
- ArrayTask,
5722
5725
  DebugLogTask,
5723
5726
  DelayTask,
5724
5727
  FetchUrlTask,
@@ -5764,4 +5767,4 @@ export {
5764
5767
  ArrayTask
5765
5768
  };
5766
5769
 
5767
- //# debugId=B1BD272CB310F36564756E2164756E21
5770
+ //# debugId=D326EDEDA4D6BDB564756E2164756E21