@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/browser.js +83 -7
- package/dist/browser.js.map +9 -7
- package/dist/bun.js +83 -7
- package/dist/bun.js.map +9 -7
- package/dist/common.d.ts +2 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +83 -7
- package/dist/node.js.map +9 -7
- package/dist/task/InputTask.d.ts +27 -0
- package/dist/task/InputTask.d.ts.map +1 -0
- package/dist/task/OutputTask.d.ts +27 -0
- package/dist/task/OutputTask.d.ts.map +1 -0
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/browser.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.
|
|
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 =
|
|
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
|
|
2433
|
+
return reactiveResults;
|
|
2433
2434
|
} else {
|
|
2434
|
-
|
|
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(
|
|
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=
|
|
3060
|
+
//# debugId=E59B822A237BFEFE64756E2164756E21
|