@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/bun.js CHANGED
@@ -2826,7 +2826,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2826
2826
  }(strFunctions[i][0]);
2827
2827
  this.setProperty(globalObject, strFunctions[i][1], this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2828
2828
  }
2829
- wrapper = function setTimeout(var_args) {
2829
+ wrapper = function setTimeout2(var_args) {
2830
2830
  return thisInterpreter.createTask_(false, arguments);
2831
2831
  };
2832
2832
  this.setProperty(globalObject, "setTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2834,7 +2834,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
2834
2834
  return thisInterpreter.createTask_(true, arguments);
2835
2835
  };
2836
2836
  this.setProperty(globalObject, "setInterval", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
2837
- wrapper = function clearTimeout(pid) {
2837
+ wrapper = function clearTimeout2(pid) {
2838
2838
  thisInterpreter.deleteTask_(pid);
2839
2839
  };
2840
2840
  this.setProperty(globalObject, "clearTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
@@ -2861,7 +2861,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2861
2861
  var thisInterpreter = this;
2862
2862
  var wrapper;
2863
2863
  var identifierRegexp = /^[A-Za-z_$][\w$]*$/;
2864
- wrapper = function Function(var_args) {
2864
+ wrapper = function Function2(var_args) {
2865
2865
  if (arguments.length) {
2866
2866
  var code = String(arguments[arguments.length - 1]);
2867
2867
  } else {
@@ -2939,7 +2939,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
2939
2939
  Interpreter.prototype.initObject = function(globalObject) {
2940
2940
  var thisInterpreter = this;
2941
2941
  var wrapper;
2942
- wrapper = function Object(value) {
2942
+ wrapper = function Object2(value) {
2943
2943
  if (value === undefined || value === null) {
2944
2944
  if (thisInterpreter.calledWithNew()) {
2945
2945
  return this;
@@ -3079,7 +3079,7 @@ Interpreter.prototype.initObject = function(globalObject) {
3079
3079
  Interpreter.prototype.initArray = function(globalObject) {
3080
3080
  var thisInterpreter = this;
3081
3081
  var wrapper;
3082
- wrapper = function Array(var_args) {
3082
+ wrapper = function Array2(var_args) {
3083
3083
  if (thisInterpreter.calledWithNew()) {
3084
3084
  var newArray = this;
3085
3085
  } else {
@@ -3117,7 +3117,7 @@ Interpreter.prototype.initArray = function(globalObject) {
3117
3117
  Interpreter.prototype.initString = function(globalObject) {
3118
3118
  var thisInterpreter = this;
3119
3119
  var wrapper;
3120
- wrapper = function String(value) {
3120
+ wrapper = function String2(value) {
3121
3121
  value = arguments.length ? Interpreter.nativeGlobal.String(value) : "";
3122
3122
  if (thisInterpreter.calledWithNew()) {
3123
3123
  this.data = value;
@@ -3292,7 +3292,7 @@ Interpreter.prototype.initString = function(globalObject) {
3292
3292
  Interpreter.prototype.initBoolean = function(globalObject) {
3293
3293
  var thisInterpreter = this;
3294
3294
  var wrapper;
3295
- wrapper = function Boolean(value) {
3295
+ wrapper = function Boolean2(value) {
3296
3296
  value = Interpreter.nativeGlobal.Boolean(value);
3297
3297
  if (thisInterpreter.calledWithNew()) {
3298
3298
  this.data = value;
@@ -3307,7 +3307,7 @@ Interpreter.prototype.initBoolean = function(globalObject) {
3307
3307
  Interpreter.prototype.initNumber = function(globalObject) {
3308
3308
  var thisInterpreter = this;
3309
3309
  var wrapper;
3310
- wrapper = function Number(value) {
3310
+ wrapper = function Number2(value) {
3311
3311
  value = arguments.length ? Interpreter.nativeGlobal.Number(value) : 0;
3312
3312
  if (thisInterpreter.calledWithNew()) {
3313
3313
  this.data = value;
@@ -3368,7 +3368,7 @@ Interpreter.prototype.initNumber = function(globalObject) {
3368
3368
  Interpreter.prototype.initDate = function(globalObject) {
3369
3369
  var thisInterpreter = this;
3370
3370
  var wrapper;
3371
- wrapper = function Date(_value, var_args) {
3371
+ wrapper = function Date2(_value, var_args) {
3372
3372
  if (!thisInterpreter.calledWithNew()) {
3373
3373
  return Interpreter.nativeGlobal.Date();
3374
3374
  }
@@ -3448,7 +3448,7 @@ Interpreter.prototype.initDate = function(globalObject) {
3448
3448
  Interpreter.prototype.initRegExp = function(globalObject) {
3449
3449
  var thisInterpreter = this;
3450
3450
  var wrapper;
3451
- wrapper = function RegExp(pattern, flags) {
3451
+ wrapper = function RegExp2(pattern, flags) {
3452
3452
  if (thisInterpreter.calledWithNew()) {
3453
3453
  var rgx = this;
3454
3454
  } else {
@@ -3525,7 +3525,7 @@ Interpreter.prototype.initRegExp = function(globalObject) {
3525
3525
  };
3526
3526
  Interpreter.prototype.initError = function(globalObject) {
3527
3527
  var thisInterpreter = this;
3528
- this.ERROR = this.createNativeFunction(function Error(opt_message) {
3528
+ this.ERROR = this.createNativeFunction(function Error2(opt_message) {
3529
3529
  if (thisInterpreter.calledWithNew()) {
3530
3530
  var newError = this;
3531
3531
  } else {
@@ -3595,7 +3595,7 @@ Interpreter.prototype.initJSON = function(globalObject) {
3595
3595
  var thisInterpreter = this;
3596
3596
  var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);
3597
3597
  this.setProperty(globalObject, "JSON", myJSON, Interpreter.NONENUMERABLE_DESCRIPTOR);
3598
- wrapper = function parse(text) {
3598
+ wrapper = function parse2(text) {
3599
3599
  try {
3600
3600
  var nativeObj = JSON.parse(String(text));
3601
3601
  } catch (e) {
@@ -5586,10 +5586,7 @@ class JavaScriptTask extends Task5 {
5586
5586
  const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
5587
5587
  myInterpreter.run();
5588
5588
  output.output = myInterpreter.value;
5589
- console.log("output", output.output);
5590
- } catch (e) {
5591
- console.error("error", e);
5592
- }
5589
+ } catch (e) {}
5593
5590
  }
5594
5591
  return output;
5595
5592
  }
@@ -5601,6 +5598,7 @@ Workflow7.prototype.javaScript = CreateWorkflow7(JavaScriptTask);
5601
5598
  // src/task/JsonTask.ts
5602
5599
  import {
5603
5600
  createGraphFromDependencyJSON,
5601
+ createGraphFromGraphJSON,
5604
5602
  CreateWorkflow as CreateWorkflow8,
5605
5603
  Dataflow,
5606
5604
  GraphAsTask as GraphAsTask2,
@@ -5643,10 +5641,13 @@ class JsonTask extends GraphAsTask2 {
5643
5641
  regenerateGraph() {
5644
5642
  if (!this.runInputData.json)
5645
5643
  return;
5646
- let data = JSON.parse(this.runInputData.json);
5647
- if (!Array.isArray(data))
5648
- data = [data];
5649
- 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];
5650
5651
  this.subGraph = createGraphFromDependencyJSON(jsonItems);
5651
5652
  for (const item of jsonItems) {
5652
5653
  if (!item.dependencies)
@@ -5779,7 +5780,7 @@ class MergeTask extends Task7 {
5779
5780
  static outputSchema() {
5780
5781
  return outputSchema8;
5781
5782
  }
5782
- async execute(input2, context) {
5783
+ async execute(input2, _context) {
5783
5784
  const keys = Object.keys(input2).sort();
5784
5785
  const values = keys.map((key) => input2[key]);
5785
5786
  return {
@@ -5887,7 +5888,6 @@ Workflow12.prototype.split = CreateWorkflow12(SplitTask);
5887
5888
  import { TaskRegistry } from "@workglow/task-graph";
5888
5889
  var registerCommonTasks = () => {
5889
5890
  const tasks = [
5890
- ArrayTask,
5891
5891
  DebugLogTask,
5892
5892
  DelayTask,
5893
5893
  FetchUrlTask,
@@ -5933,4 +5933,4 @@ export {
5933
5933
  ArrayTask
5934
5934
  };
5935
5935
 
5936
- //# debugId=D6ED89C19A69544464756E2164756E21
5936
+ //# debugId=B2B64E263BDC9B5464756E2164756E21