@workglow/task-graph 0.0.76 → 0.0.78

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/common.d.ts CHANGED
@@ -7,9 +7,11 @@ export * from "./task/ArrayTask";
7
7
  export * from "./task/ConditionalTask";
8
8
  export * from "./task/GraphAsTask";
9
9
  export * from "./task/GraphAsTaskRunner";
10
+ export * from "./task/InputTask";
10
11
  export * from "./task/ITask";
11
12
  export * from "./task/JobQueueFactory";
12
13
  export * from "./task/JobQueueTask";
14
+ export * from "./task/OutputTask";
13
15
  export * from "./task/Task";
14
16
  export * from "./task/TaskError";
15
17
  export * from "./task/TaskEvents";
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC"}
package/dist/node.js CHANGED
@@ -368,7 +368,7 @@ class TaskRunner {
368
368
  }
369
369
  async executeTaskReactive(input, output) {
370
370
  const reactiveResult = await this.task.executeReactive(input, output, { own: this.own });
371
- return Object.keys(reactiveResult || {}) >= Object.keys(output || {}) ? reactiveResult : output ?? {};
371
+ return Object.assign({}, output, reactiveResult ?? {});
372
372
  }
373
373
  async handleStart(config = {}) {
374
374
  if (this.task.status === TaskStatus.PROCESSING)
@@ -1474,7 +1474,7 @@ class GraphAsTaskRunner extends TaskRunner {
1474
1474
  this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(reactiveResults, this.task.compoundMerge);
1475
1475
  } else {
1476
1476
  const reactiveResults = await super.executeTaskReactive(this.fixInput(input), output);
1477
- this.task.runOutputData = reactiveResults ?? output ?? {};
1477
+ this.task.runOutputData = Object.assign({}, output, reactiveResults ?? {});
1478
1478
  }
1479
1479
  return this.task.runOutputData;
1480
1480
  }
@@ -2428,15 +2428,52 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
2428
2428
  return super.executeTaskChildren({});
2429
2429
  }
2430
2430
  async executeTaskReactive(input, output) {
2431
+ const reactiveResults = await super.executeTaskReactive(input, output);
2431
2432
  if (this.task.hasChildren()) {
2432
- return super.executeTaskReactive(input, output);
2433
+ return reactiveResults;
2433
2434
  } else {
2434
- const reactiveResults = await super.executeTaskReactive(input, output);
2435
- this.task.runOutputData = reactiveResults ?? output ?? {};
2435
+ this.task.runOutputData = Object.assign({}, output, reactiveResults ?? {});
2436
2436
  return this.task.runOutputData;
2437
2437
  }
2438
2438
  }
2439
2439
  }
2440
+ // src/task/InputTask.ts
2441
+ import { Task as Task2 } from "@workglow/task-graph";
2442
+
2443
+ class InputTask extends Task2 {
2444
+ static type = "InputTask";
2445
+ static category = "Flow Control";
2446
+ static title = "Input";
2447
+ static description = "Starts the workflow";
2448
+ static hasDynamicSchemas = true;
2449
+ static cacheable = false;
2450
+ static inputSchema() {
2451
+ return {
2452
+ type: "object",
2453
+ properties: {},
2454
+ additionalProperties: true
2455
+ };
2456
+ }
2457
+ static outputSchema() {
2458
+ return {
2459
+ type: "object",
2460
+ properties: {},
2461
+ additionalProperties: true
2462
+ };
2463
+ }
2464
+ inputSchema() {
2465
+ return this.config?.extras?.inputSchema ?? this.constructor.inputSchema();
2466
+ }
2467
+ outputSchema() {
2468
+ return this.config?.extras?.outputSchema ?? this.constructor.outputSchema();
2469
+ }
2470
+ async execute(input, _context) {
2471
+ return input;
2472
+ }
2473
+ async executeReactive(input, _output, _context) {
2474
+ return input;
2475
+ }
2476
+ }
2440
2477
  // src/task/JobQueueFactory.ts
2441
2478
  import {
2442
2479
  JobQueueClient,
@@ -2697,6 +2734,43 @@ class JobQueueTask extends ArrayTask {
2697
2734
  super.abort();
2698
2735
  }
2699
2736
  }
2737
+ // src/task/OutputTask.ts
2738
+ import { Task as Task3 } from "@workglow/task-graph";
2739
+
2740
+ class OutputTask extends Task3 {
2741
+ static type = "OutputTask";
2742
+ static category = "Flow Control";
2743
+ static title = "Output";
2744
+ static description = "Ends the workflow";
2745
+ static hasDynamicSchemas = true;
2746
+ static cacheable = false;
2747
+ static inputSchema() {
2748
+ return {
2749
+ type: "object",
2750
+ properties: {},
2751
+ additionalProperties: true
2752
+ };
2753
+ }
2754
+ static outputSchema() {
2755
+ return {
2756
+ type: "object",
2757
+ properties: {},
2758
+ additionalProperties: true
2759
+ };
2760
+ }
2761
+ inputSchema() {
2762
+ return this.config?.extras?.inputSchema ?? this.constructor.inputSchema();
2763
+ }
2764
+ outputSchema() {
2765
+ return this.config?.extras?.outputSchema ?? this.constructor.outputSchema();
2766
+ }
2767
+ async execute(input, _context) {
2768
+ return input;
2769
+ }
2770
+ async executeReactive(input, _output, _context) {
2771
+ return input;
2772
+ }
2773
+ }
2700
2774
  // src/task/TaskRegistry.ts
2701
2775
  var taskConstructors = new Map;
2702
2776
  function registerTask(baseClass) {
@@ -2919,7 +2993,7 @@ class TaskOutputTabularRepository extends TaskOutputRepository {
2919
2993
  }
2920
2994
  async clearOlderThan(olderThanInMs) {
2921
2995
  const date = new Date(Date.now() - olderThanInMs).toISOString();
2922
- await this.tabularRepository.deleteSearch("createdAt", date, "<");
2996
+ await this.tabularRepository.deleteSearch({ createdAt: { value: date, operator: "<" } });
2923
2997
  this.emit("output_pruned");
2924
2998
  }
2925
2999
  }
@@ -2964,9 +3038,11 @@ export {
2964
3038
  TASK_OUTPUT_REPOSITORY,
2965
3039
  TASK_GRAPH_REPOSITORY,
2966
3040
  PROPERTY_ARRAY,
3041
+ OutputTask,
2967
3042
  JobTaskFailedError,
2968
3043
  JobQueueTask,
2969
3044
  JOB_QUEUE_FACTORY,
3045
+ InputTask,
2970
3046
  GraphAsTaskRunner,
2971
3047
  GraphAsTask,
2972
3048
  GRAPH_RESULT_ARRAY,
@@ -2981,4 +3057,4 @@ export {
2981
3057
  ArrayTask
2982
3058
  };
2983
3059
 
2984
- //# debugId=1054901EA463871564756E2164756E21
3060
+ //# debugId=1AE09A7FA617090D64756E2164756E21