@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/bun.js
CHANGED
|
@@ -369,7 +369,7 @@ class TaskRunner {
|
|
|
369
369
|
}
|
|
370
370
|
async executeTaskReactive(input, output) {
|
|
371
371
|
const reactiveResult = await this.task.executeReactive(input, output, { own: this.own });
|
|
372
|
-
return Object.
|
|
372
|
+
return Object.assign({}, output, reactiveResult ?? {});
|
|
373
373
|
}
|
|
374
374
|
async handleStart(config = {}) {
|
|
375
375
|
if (this.task.status === TaskStatus.PROCESSING)
|
|
@@ -1475,7 +1475,7 @@ class GraphAsTaskRunner extends TaskRunner {
|
|
|
1475
1475
|
this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(reactiveResults, this.task.compoundMerge);
|
|
1476
1476
|
} else {
|
|
1477
1477
|
const reactiveResults = await super.executeTaskReactive(this.fixInput(input), output);
|
|
1478
|
-
this.task.runOutputData =
|
|
1478
|
+
this.task.runOutputData = Object.assign({}, output, reactiveResults ?? {});
|
|
1479
1479
|
}
|
|
1480
1480
|
return this.task.runOutputData;
|
|
1481
1481
|
}
|
|
@@ -2429,15 +2429,52 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
|
|
|
2429
2429
|
return super.executeTaskChildren({});
|
|
2430
2430
|
}
|
|
2431
2431
|
async executeTaskReactive(input, output) {
|
|
2432
|
+
const reactiveResults = await super.executeTaskReactive(input, output);
|
|
2432
2433
|
if (this.task.hasChildren()) {
|
|
2433
|
-
return
|
|
2434
|
+
return reactiveResults;
|
|
2434
2435
|
} else {
|
|
2435
|
-
|
|
2436
|
-
this.task.runOutputData = reactiveResults ?? output ?? {};
|
|
2436
|
+
this.task.runOutputData = Object.assign({}, output, reactiveResults ?? {});
|
|
2437
2437
|
return this.task.runOutputData;
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
|
+
// src/task/InputTask.ts
|
|
2442
|
+
import { Task as Task2 } from "@workglow/task-graph";
|
|
2443
|
+
|
|
2444
|
+
class InputTask extends Task2 {
|
|
2445
|
+
static type = "InputTask";
|
|
2446
|
+
static category = "Flow Control";
|
|
2447
|
+
static title = "Input";
|
|
2448
|
+
static description = "Starts the workflow";
|
|
2449
|
+
static hasDynamicSchemas = true;
|
|
2450
|
+
static cacheable = false;
|
|
2451
|
+
static inputSchema() {
|
|
2452
|
+
return {
|
|
2453
|
+
type: "object",
|
|
2454
|
+
properties: {},
|
|
2455
|
+
additionalProperties: true
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
static outputSchema() {
|
|
2459
|
+
return {
|
|
2460
|
+
type: "object",
|
|
2461
|
+
properties: {},
|
|
2462
|
+
additionalProperties: true
|
|
2463
|
+
};
|
|
2464
|
+
}
|
|
2465
|
+
inputSchema() {
|
|
2466
|
+
return this.config?.extras?.inputSchema ?? this.constructor.inputSchema();
|
|
2467
|
+
}
|
|
2468
|
+
outputSchema() {
|
|
2469
|
+
return this.config?.extras?.outputSchema ?? this.constructor.outputSchema();
|
|
2470
|
+
}
|
|
2471
|
+
async execute(input, _context) {
|
|
2472
|
+
return input;
|
|
2473
|
+
}
|
|
2474
|
+
async executeReactive(input, _output, _context) {
|
|
2475
|
+
return input;
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2441
2478
|
// src/task/JobQueueFactory.ts
|
|
2442
2479
|
import {
|
|
2443
2480
|
JobQueueClient,
|
|
@@ -2698,6 +2735,43 @@ class JobQueueTask extends ArrayTask {
|
|
|
2698
2735
|
super.abort();
|
|
2699
2736
|
}
|
|
2700
2737
|
}
|
|
2738
|
+
// src/task/OutputTask.ts
|
|
2739
|
+
import { Task as Task3 } from "@workglow/task-graph";
|
|
2740
|
+
|
|
2741
|
+
class OutputTask extends Task3 {
|
|
2742
|
+
static type = "OutputTask";
|
|
2743
|
+
static category = "Flow Control";
|
|
2744
|
+
static title = "Output";
|
|
2745
|
+
static description = "Ends the workflow";
|
|
2746
|
+
static hasDynamicSchemas = true;
|
|
2747
|
+
static cacheable = false;
|
|
2748
|
+
static inputSchema() {
|
|
2749
|
+
return {
|
|
2750
|
+
type: "object",
|
|
2751
|
+
properties: {},
|
|
2752
|
+
additionalProperties: true
|
|
2753
|
+
};
|
|
2754
|
+
}
|
|
2755
|
+
static outputSchema() {
|
|
2756
|
+
return {
|
|
2757
|
+
type: "object",
|
|
2758
|
+
properties: {},
|
|
2759
|
+
additionalProperties: true
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2762
|
+
inputSchema() {
|
|
2763
|
+
return this.config?.extras?.inputSchema ?? this.constructor.inputSchema();
|
|
2764
|
+
}
|
|
2765
|
+
outputSchema() {
|
|
2766
|
+
return this.config?.extras?.outputSchema ?? this.constructor.outputSchema();
|
|
2767
|
+
}
|
|
2768
|
+
async execute(input, _context) {
|
|
2769
|
+
return input;
|
|
2770
|
+
}
|
|
2771
|
+
async executeReactive(input, _output, _context) {
|
|
2772
|
+
return input;
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2701
2775
|
// src/task/TaskRegistry.ts
|
|
2702
2776
|
var taskConstructors = new Map;
|
|
2703
2777
|
function registerTask(baseClass) {
|
|
@@ -2920,7 +2994,7 @@ class TaskOutputTabularRepository extends TaskOutputRepository {
|
|
|
2920
2994
|
}
|
|
2921
2995
|
async clearOlderThan(olderThanInMs) {
|
|
2922
2996
|
const date = new Date(Date.now() - olderThanInMs).toISOString();
|
|
2923
|
-
await this.tabularRepository.deleteSearch(
|
|
2997
|
+
await this.tabularRepository.deleteSearch({ createdAt: { value: date, operator: "<" } });
|
|
2924
2998
|
this.emit("output_pruned");
|
|
2925
2999
|
}
|
|
2926
3000
|
}
|
|
@@ -2965,9 +3039,11 @@ export {
|
|
|
2965
3039
|
TASK_OUTPUT_REPOSITORY,
|
|
2966
3040
|
TASK_GRAPH_REPOSITORY,
|
|
2967
3041
|
PROPERTY_ARRAY,
|
|
3042
|
+
OutputTask,
|
|
2968
3043
|
JobTaskFailedError,
|
|
2969
3044
|
JobQueueTask,
|
|
2970
3045
|
JOB_QUEUE_FACTORY,
|
|
3046
|
+
InputTask,
|
|
2971
3047
|
GraphAsTaskRunner,
|
|
2972
3048
|
GraphAsTask,
|
|
2973
3049
|
GRAPH_RESULT_ARRAY,
|
|
@@ -2982,4 +3058,4 @@ export {
|
|
|
2982
3058
|
ArrayTask
|
|
2983
3059
|
};
|
|
2984
3060
|
|
|
2985
|
-
//# debugId=
|
|
3061
|
+
//# debugId=B04A540E23B60ABE64756E2164756E21
|