@workglow/tasks 0.0.89 → 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
@@ -2660,7 +2660,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2660
2660
  }(strFunctions[i][0]);
2661
2661
  this.setProperty(globalObject, strFunctions[i][1], this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2662
2662
  }
2663
- wrapper = function setTimeout(var_args) {
2663
+ wrapper = function setTimeout2(var_args) {
2664
2664
  return thisInterpreter.createTask_(false, arguments);
2665
2665
  };
2666
2666
  this.setProperty(globalObject, "setTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2668,7 +2668,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2668
2668
  return thisInterpreter.createTask_(true, arguments);
2669
2669
  };
2670
2670
  this.setProperty(globalObject, "setInterval", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2671
- wrapper = function clearTimeout(pid) {
2671
+ wrapper = function clearTimeout2(pid) {
2672
2672
  thisInterpreter.deleteTask_(pid);
2673
2673
  };
2674
2674
  this.setProperty(globalObject, "clearTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2695,7 +2695,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2695
2695
  var thisInterpreter = this;
2696
2696
  var wrapper;
2697
2697
  var identifierRegexp = /^[A-Za-z_$][\w$]*$/;
2698
- wrapper = function Function(var_args) {
2698
+ wrapper = function Function2(var_args) {
2699
2699
  if (arguments.length) {
2700
2700
  var code = String(arguments[arguments.length - 1]);
2701
2701
  } else {
@@ -2773,7 +2773,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2773
2773
  Interpreter.prototype.initObject = function(globalObject) {
2774
2774
  var thisInterpreter = this;
2775
2775
  var wrapper;
2776
- wrapper = function Object(value) {
2776
+ wrapper = function Object2(value) {
2777
2777
  if (value === undefined || value === null) {
2778
2778
  if (thisInterpreter.calledWithNew()) {
2779
2779
  return this;
@@ -2913,7 +2913,7 @@ Interpreter.prototype.initObject = function(globalObject) {
2913
2913
  Interpreter.prototype.initArray = function(globalObject) {
2914
2914
  var thisInterpreter = this;
2915
2915
  var wrapper;
2916
- wrapper = function Array(var_args) {
2916
+ wrapper = function Array2(var_args) {
2917
2917
  if (thisInterpreter.calledWithNew()) {
2918
2918
  var newArray = this;
2919
2919
  } else {
@@ -2951,7 +2951,7 @@ Interpreter.prototype.initArray = function(globalObject) {
2951
2951
  Interpreter.prototype.initString = function(globalObject) {
2952
2952
  var thisInterpreter = this;
2953
2953
  var wrapper;
2954
- wrapper = function String(value) {
2954
+ wrapper = function String2(value) {
2955
2955
  value = arguments.length ? Interpreter.nativeGlobal.String(value) : "";
2956
2956
  if (thisInterpreter.calledWithNew()) {
2957
2957
  this.data = value;
@@ -3126,7 +3126,7 @@ Interpreter.prototype.initString = function(globalObject) {
3126
3126
  Interpreter.prototype.initBoolean = function(globalObject) {
3127
3127
  var thisInterpreter = this;
3128
3128
  var wrapper;
3129
- wrapper = function Boolean(value) {
3129
+ wrapper = function Boolean2(value) {
3130
3130
  value = Interpreter.nativeGlobal.Boolean(value);
3131
3131
  if (thisInterpreter.calledWithNew()) {
3132
3132
  this.data = value;
@@ -3141,7 +3141,7 @@ Interpreter.prototype.initBoolean = function(globalObject) {
3141
3141
  Interpreter.prototype.initNumber = function(globalObject) {
3142
3142
  var thisInterpreter = this;
3143
3143
  var wrapper;
3144
- wrapper = function Number(value) {
3144
+ wrapper = function Number2(value) {
3145
3145
  value = arguments.length ? Interpreter.nativeGlobal.Number(value) : 0;
3146
3146
  if (thisInterpreter.calledWithNew()) {
3147
3147
  this.data = value;
@@ -3202,7 +3202,7 @@ Interpreter.prototype.initNumber = function(globalObject) {
3202
3202
  Interpreter.prototype.initDate = function(globalObject) {
3203
3203
  var thisInterpreter = this;
3204
3204
  var wrapper;
3205
- wrapper = function Date(_value, var_args) {
3205
+ wrapper = function Date2(_value, var_args) {
3206
3206
  if (!thisInterpreter.calledWithNew()) {
3207
3207
  return Interpreter.nativeGlobal.Date();
3208
3208
  }
@@ -3282,7 +3282,7 @@ Interpreter.prototype.initDate = function(globalObject) {
3282
3282
  Interpreter.prototype.initRegExp = function(globalObject) {
3283
3283
  var thisInterpreter = this;
3284
3284
  var wrapper;
3285
- wrapper = function RegExp(pattern, flags) {
3285
+ wrapper = function RegExp2(pattern, flags) {
3286
3286
  if (thisInterpreter.calledWithNew()) {
3287
3287
  var rgx = this;
3288
3288
  } else {
@@ -3359,7 +3359,7 @@ Interpreter.prototype.initRegExp = function(globalObject) {
3359
3359
  };
3360
3360
  Interpreter.prototype.initError = function(globalObject) {
3361
3361
  var thisInterpreter = this;
3362
- this.ERROR = this.createNativeFunction(function Error(opt_message) {
3362
+ this.ERROR = this.createNativeFunction(function Error2(opt_message) {
3363
3363
  if (thisInterpreter.calledWithNew()) {
3364
3364
  var newError = this;
3365
3365
  } else {
@@ -3429,7 +3429,7 @@ Interpreter.prototype.initJSON = function(globalObject) {
3429
3429
  var thisInterpreter = this;
3430
3430
  var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);
3431
3431
  this.setProperty(globalObject, "JSON", myJSON, Interpreter.NONENUMERABLE_DESCRIPTOR);
3432
- wrapper = function parse(text) {
3432
+ wrapper = function parse2(text) {
3433
3433
  try {
3434
3434
  var nativeObj = JSON.parse(String(text));
3435
3435
  } catch (e) {
@@ -5420,10 +5420,7 @@ class JavaScriptTask extends Task5 {
5420
5420
  const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
5421
5421
  myInterpreter.run();
5422
5422
  output.output = myInterpreter.value;
5423
- console.log("output", output.output);
5424
- } catch (e) {
5425
- console.error("error", e);
5426
- }
5423
+ } catch (e) {}
5427
5424
  }
5428
5425
  return output;
5429
5426
  }
@@ -5435,6 +5432,7 @@ Workflow6.prototype.javaScript = CreateWorkflow6(JavaScriptTask);
5435
5432
  // src/task/JsonTask.ts
5436
5433
  import {
5437
5434
  createGraphFromDependencyJSON,
5435
+ createGraphFromGraphJSON,
5438
5436
  CreateWorkflow as CreateWorkflow7,
5439
5437
  Dataflow,
5440
5438
  GraphAsTask as GraphAsTask2,
@@ -5477,10 +5475,13 @@ class JsonTask extends GraphAsTask2 {
5477
5475
  regenerateGraph() {
5478
5476
  if (!this.runInputData.json)
5479
5477
  return;
5480
- let data = JSON.parse(this.runInputData.json);
5481
- if (!Array.isArray(data))
5482
- data = [data];
5483
- 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];
5484
5485
  this.subGraph = createGraphFromDependencyJSON(jsonItems);
5485
5486
  for (const item of jsonItems) {
5486
5487
  if (!item.dependencies)
@@ -5613,7 +5614,7 @@ class MergeTask extends Task7 {
5613
5614
  static outputSchema() {
5614
5615
  return outputSchema8;
5615
5616
  }
5616
- async execute(input2, context) {
5617
+ async execute(input2, _context) {
5617
5618
  const keys = Object.keys(input2).sort();
5618
5619
  const values = keys.map((key) => input2[key]);
5619
5620
  return {
@@ -5721,7 +5722,6 @@ Workflow11.prototype.split = CreateWorkflow11(SplitTask);
5721
5722
  import { TaskRegistry } from "@workglow/task-graph";
5722
5723
  var registerCommonTasks = () => {
5723
5724
  const tasks = [
5724
- ArrayTask,
5725
5725
  DebugLogTask,
5726
5726
  DelayTask,
5727
5727
  FetchUrlTask,
@@ -5767,4 +5767,4 @@ export {
5767
5767
  ArrayTask
5768
5768
  };
5769
5769
 
5770
- //# debugId=169B7E13C7F6B8CF64756E2164756E21
5770
+ //# debugId=D326EDEDA4D6BDB564756E2164756E21