@workglow/task-graph 0.0.125 → 0.0.126
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/README.md +104 -12
- package/dist/browser.js +605 -771
- package/dist/browser.js.map +19 -20
- package/dist/bun.js +605 -767
- package/dist/bun.js.map +19 -20
- package/dist/node.js +605 -767
- package/dist/node.js.map +19 -20
- package/dist/task-graph/Conversions.d.ts.map +1 -1
- package/package.json +20 -11
- package/src/storage/README.md +51 -5
- package/dist/types.d.ts +0 -8
- package/dist/types.d.ts.map +0 -1
package/dist/node.js
CHANGED
|
@@ -1,89 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
function __accessProp(key) {
|
|
6
|
-
return this[key];
|
|
7
|
-
}
|
|
8
|
-
var __toCommonJS = (from) => {
|
|
9
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
10
|
-
if (entry)
|
|
11
|
-
return entry;
|
|
12
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (var key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(entry, key))
|
|
16
|
-
__defProp(entry, key, {
|
|
17
|
-
get: __accessProp.bind(from, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
__moduleCache.set(from, entry);
|
|
22
|
-
return entry;
|
|
23
|
-
};
|
|
24
|
-
var __moduleCache;
|
|
25
|
-
var __returnValue = (v) => v;
|
|
26
|
-
function __exportSetter(name, newValue) {
|
|
27
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
28
|
-
}
|
|
29
|
-
var __export = (target, all) => {
|
|
30
|
-
for (var name in all)
|
|
31
|
-
__defProp(target, name, {
|
|
32
|
-
get: all[name],
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
set: __exportSetter.bind(all, name)
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
1
|
+
// src/task-graph/Dataflow.ts
|
|
2
|
+
import { areSemanticallyCompatible } from "@workglow/util/schema";
|
|
3
|
+
import { EventEmitter } from "@workglow/util";
|
|
39
4
|
|
|
40
5
|
// src/task/TaskTypes.ts
|
|
41
|
-
var TaskStatus
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
id: {
|
|
56
|
-
"x-ui-hidden": true
|
|
57
|
-
},
|
|
58
|
-
title: { type: "string" },
|
|
59
|
-
description: { type: "string" },
|
|
60
|
-
cacheable: { type: "boolean" },
|
|
61
|
-
timeout: { type: "number", description: "Max execution time in milliseconds" },
|
|
62
|
-
inputSchema: {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {},
|
|
65
|
-
additionalProperties: true,
|
|
66
|
-
"x-ui-hidden": true
|
|
67
|
-
},
|
|
68
|
-
outputSchema: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {},
|
|
71
|
-
additionalProperties: true,
|
|
72
|
-
"x-ui-hidden": true
|
|
73
|
-
},
|
|
74
|
-
extras: {
|
|
75
|
-
type: "object",
|
|
76
|
-
additionalProperties: true,
|
|
77
|
-
"x-ui-hidden": true
|
|
78
|
-
}
|
|
6
|
+
var TaskStatus = {
|
|
7
|
+
PENDING: "PENDING",
|
|
8
|
+
DISABLED: "DISABLED",
|
|
9
|
+
PROCESSING: "PROCESSING",
|
|
10
|
+
STREAMING: "STREAMING",
|
|
11
|
+
COMPLETED: "COMPLETED",
|
|
12
|
+
ABORTING: "ABORTING",
|
|
13
|
+
FAILED: "FAILED"
|
|
14
|
+
};
|
|
15
|
+
var TaskConfigSchema = {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
id: {
|
|
19
|
+
"x-ui-hidden": true
|
|
79
20
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
21
|
+
title: { type: "string" },
|
|
22
|
+
description: { type: "string" },
|
|
23
|
+
cacheable: { type: "boolean" },
|
|
24
|
+
timeout: { type: "number", description: "Max execution time in milliseconds" },
|
|
25
|
+
inputSchema: {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: {},
|
|
28
|
+
additionalProperties: true,
|
|
29
|
+
"x-ui-hidden": true
|
|
30
|
+
},
|
|
31
|
+
outputSchema: {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {},
|
|
34
|
+
additionalProperties: true,
|
|
35
|
+
"x-ui-hidden": true
|
|
36
|
+
},
|
|
37
|
+
extras: {
|
|
38
|
+
type: "object",
|
|
39
|
+
additionalProperties: true,
|
|
40
|
+
"x-ui-hidden": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
additionalProperties: false
|
|
44
|
+
};
|
|
83
45
|
|
|
84
46
|
// src/task-graph/Dataflow.ts
|
|
85
|
-
|
|
86
|
-
|
|
47
|
+
var DATAFLOW_ALL_PORTS = "*";
|
|
48
|
+
var DATAFLOW_ERROR_PORT = "[error]";
|
|
87
49
|
|
|
88
50
|
class Dataflow {
|
|
89
51
|
sourceTaskId;
|
|
@@ -268,22 +230,18 @@ class Dataflow {
|
|
|
268
230
|
this._events?.emit(name, ...args);
|
|
269
231
|
}
|
|
270
232
|
}
|
|
271
|
-
var DATAFLOW_ALL_PORTS = "*", DATAFLOW_ERROR_PORT = "[error]", DataflowArrow;
|
|
272
|
-
var init_Dataflow = __esm(() => {
|
|
273
|
-
init_TaskTypes();
|
|
274
|
-
DataflowArrow = class DataflowArrow extends Dataflow {
|
|
275
|
-
constructor(dataflow) {
|
|
276
|
-
const pattern = /^([a-zA-Z0-9-]+?)\[([a-zA-Z0-9-]+?)\] ==> ([a-zA-Z0-9-]+?)\[([a-zA-Z0-9-]+?)\]$/;
|
|
277
|
-
const match = dataflow.match(pattern);
|
|
278
|
-
if (!match) {
|
|
279
|
-
throw new Error(`Invalid dataflow format: ${dataflow}`);
|
|
280
|
-
}
|
|
281
|
-
const [, sourceTaskId, sourceTaskPortId, targetTaskId, targetTaskPortId] = match;
|
|
282
|
-
super(sourceTaskId, sourceTaskPortId, targetTaskId, targetTaskPortId);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
});
|
|
286
233
|
|
|
234
|
+
class DataflowArrow extends Dataflow {
|
|
235
|
+
constructor(dataflow) {
|
|
236
|
+
const pattern = /^([a-zA-Z0-9-]+?)\[([a-zA-Z0-9-]+?)\] ==> ([a-zA-Z0-9-]+?)\[([a-zA-Z0-9-]+?)\]$/;
|
|
237
|
+
const match = dataflow.match(pattern);
|
|
238
|
+
if (!match) {
|
|
239
|
+
throw new Error(`Invalid dataflow format: ${dataflow}`);
|
|
240
|
+
}
|
|
241
|
+
const [, sourceTaskId, sourceTaskPortId, targetTaskId, targetTaskPortId] = match;
|
|
242
|
+
super(sourceTaskId, sourceTaskPortId, targetTaskId, targetTaskPortId);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
287
245
|
// src/task-graph/GraphSchemaUtils.ts
|
|
288
246
|
import { uuid4 } from "@workglow/util";
|
|
289
247
|
function calculateNodeDepths(graph) {
|
|
@@ -632,74 +590,27 @@ function addBoundaryNodesToDependencyJson(items, graph) {
|
|
|
632
590
|
}
|
|
633
591
|
return [...prependItems, ...items, ...appendItems];
|
|
634
592
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
593
|
+
// src/task-graph/TaskGraph.ts
|
|
594
|
+
import { DirectedAcyclicGraph } from "@workglow/util/graph";
|
|
595
|
+
import { EventEmitter as EventEmitter4, uuid4 as uuid44 } from "@workglow/util";
|
|
638
596
|
|
|
639
|
-
// src/task/
|
|
640
|
-
import {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
super(message);
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
WorkflowError = class WorkflowError extends TaskError {
|
|
656
|
-
static type = "WorkflowError";
|
|
657
|
-
constructor(message) {
|
|
658
|
-
super(message);
|
|
659
|
-
}
|
|
660
|
-
};
|
|
661
|
-
TaskAbortedError = class TaskAbortedError extends TaskError {
|
|
662
|
-
static type = "TaskAbortedError";
|
|
663
|
-
constructor(message = "Task aborted") {
|
|
664
|
-
super(message);
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
TaskTimeoutError = class TaskTimeoutError extends TaskAbortedError {
|
|
668
|
-
static type = "TaskTimeoutError";
|
|
669
|
-
constructor(timeoutMs) {
|
|
670
|
-
super(timeoutMs ? `Task timed out after ${timeoutMs}ms` : "Task timed out");
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
TaskFailedError = class TaskFailedError extends TaskError {
|
|
674
|
-
static type = "TaskFailedError";
|
|
675
|
-
constructor(message = "Task failed") {
|
|
676
|
-
super(message);
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
JobTaskFailedError = class JobTaskFailedError extends TaskFailedError {
|
|
680
|
-
static type = "JobTaskFailedError";
|
|
681
|
-
jobError;
|
|
682
|
-
constructor(err) {
|
|
683
|
-
super(String(err));
|
|
684
|
-
this.jobError = err;
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
TaskJSONError = class TaskJSONError extends TaskError {
|
|
688
|
-
static type = "TaskJSONError";
|
|
689
|
-
constructor(message = "Error converting JSON to a Task") {
|
|
690
|
-
super(message);
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
TaskInvalidInputError = class TaskInvalidInputError extends TaskError {
|
|
694
|
-
static type = "TaskInvalidInputError";
|
|
695
|
-
constructor(message = "Invalid input data") {
|
|
696
|
-
super(message);
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
});
|
|
597
|
+
// src/task/GraphAsTask.ts
|
|
598
|
+
import { compileSchema as compileSchema2 } from "@workglow/util/schema";
|
|
599
|
+
|
|
600
|
+
// src/task-graph/TaskGraphRunner.ts
|
|
601
|
+
import {
|
|
602
|
+
collectPropertyValues,
|
|
603
|
+
getLogger as getLogger2,
|
|
604
|
+
getTelemetryProvider as getTelemetryProvider2,
|
|
605
|
+
globalServiceRegistry as globalServiceRegistry2,
|
|
606
|
+
ServiceRegistry as ServiceRegistry2,
|
|
607
|
+
SpanStatusCode as SpanStatusCode2,
|
|
608
|
+
uuid4 as uuid43
|
|
609
|
+
} from "@workglow/util";
|
|
700
610
|
|
|
701
611
|
// src/storage/TaskOutputRepository.ts
|
|
702
612
|
import { createServiceToken, EventEmitter as EventEmitter2 } from "@workglow/util";
|
|
613
|
+
var TASK_OUTPUT_REPOSITORY = createServiceToken("taskgraph.taskOutputRepository");
|
|
703
614
|
|
|
704
615
|
class TaskOutputRepository {
|
|
705
616
|
outputCompression;
|
|
@@ -726,10 +637,155 @@ class TaskOutputRepository {
|
|
|
726
637
|
this._events?.emit(name, ...args);
|
|
727
638
|
}
|
|
728
639
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
640
|
+
|
|
641
|
+
// src/task/ConditionalTask.ts
|
|
642
|
+
import { getLogger } from "@workglow/util";
|
|
643
|
+
|
|
644
|
+
// src/task/ConditionUtils.ts
|
|
645
|
+
function evaluateCondition(fieldValue, operator, compareValue) {
|
|
646
|
+
if (fieldValue === null || fieldValue === undefined) {
|
|
647
|
+
switch (operator) {
|
|
648
|
+
case "is_empty":
|
|
649
|
+
return true;
|
|
650
|
+
case "is_not_empty":
|
|
651
|
+
return false;
|
|
652
|
+
case "is_true":
|
|
653
|
+
return false;
|
|
654
|
+
case "is_false":
|
|
655
|
+
return true;
|
|
656
|
+
default:
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
const strValue = String(fieldValue);
|
|
661
|
+
const numValue = Number(fieldValue);
|
|
662
|
+
switch (operator) {
|
|
663
|
+
case "equals":
|
|
664
|
+
if (!isNaN(numValue) && !isNaN(Number(compareValue))) {
|
|
665
|
+
return numValue === Number(compareValue);
|
|
666
|
+
}
|
|
667
|
+
return strValue === compareValue;
|
|
668
|
+
case "not_equals":
|
|
669
|
+
if (!isNaN(numValue) && !isNaN(Number(compareValue))) {
|
|
670
|
+
return numValue !== Number(compareValue);
|
|
671
|
+
}
|
|
672
|
+
return strValue !== compareValue;
|
|
673
|
+
case "greater_than":
|
|
674
|
+
return numValue > Number(compareValue);
|
|
675
|
+
case "greater_or_equal":
|
|
676
|
+
return numValue >= Number(compareValue);
|
|
677
|
+
case "less_than":
|
|
678
|
+
return numValue < Number(compareValue);
|
|
679
|
+
case "less_or_equal":
|
|
680
|
+
return numValue <= Number(compareValue);
|
|
681
|
+
case "contains":
|
|
682
|
+
return strValue.toLowerCase().includes(compareValue.toLowerCase());
|
|
683
|
+
case "starts_with":
|
|
684
|
+
return strValue.toLowerCase().startsWith(compareValue.toLowerCase());
|
|
685
|
+
case "ends_with":
|
|
686
|
+
return strValue.toLowerCase().endsWith(compareValue.toLowerCase());
|
|
687
|
+
case "is_empty":
|
|
688
|
+
return strValue === "" || Array.isArray(fieldValue) && fieldValue.length === 0;
|
|
689
|
+
case "is_not_empty":
|
|
690
|
+
return strValue !== "" && !(Array.isArray(fieldValue) && fieldValue.length === 0);
|
|
691
|
+
case "is_true":
|
|
692
|
+
return Boolean(fieldValue) === true;
|
|
693
|
+
case "is_false":
|
|
694
|
+
return Boolean(fieldValue) === false;
|
|
695
|
+
default:
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function getNestedValue(obj, path) {
|
|
700
|
+
const parts = path.split(".");
|
|
701
|
+
let current = obj;
|
|
702
|
+
for (const part of parts) {
|
|
703
|
+
if (current === null || current === undefined || typeof current !== "object") {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
current = current[part];
|
|
707
|
+
}
|
|
708
|
+
return current;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// src/task/Task.ts
|
|
712
|
+
import { compileSchema } from "@workglow/util/schema";
|
|
713
|
+
import { deepEqual, EventEmitter as EventEmitter3, uuid4 as uuid42 } from "@workglow/util";
|
|
714
|
+
|
|
715
|
+
// src/task/TaskError.ts
|
|
716
|
+
import { BaseError } from "@workglow/util";
|
|
717
|
+
|
|
718
|
+
class TaskError extends BaseError {
|
|
719
|
+
static type = "TaskError";
|
|
720
|
+
constructor(message) {
|
|
721
|
+
super(message);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
class TaskConfigurationError extends TaskError {
|
|
726
|
+
static type = "TaskConfigurationError";
|
|
727
|
+
constructor(message) {
|
|
728
|
+
super(message);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
class WorkflowError extends TaskError {
|
|
733
|
+
static type = "WorkflowError";
|
|
734
|
+
constructor(message) {
|
|
735
|
+
super(message);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
class TaskAbortedError extends TaskError {
|
|
740
|
+
static type = "TaskAbortedError";
|
|
741
|
+
constructor(message = "Task aborted") {
|
|
742
|
+
super(message);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
class TaskTimeoutError extends TaskAbortedError {
|
|
747
|
+
static type = "TaskTimeoutError";
|
|
748
|
+
constructor(timeoutMs) {
|
|
749
|
+
super(timeoutMs ? `Task timed out after ${timeoutMs}ms` : "Task timed out");
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
class TaskFailedError extends TaskError {
|
|
754
|
+
static type = "TaskFailedError";
|
|
755
|
+
constructor(message = "Task failed") {
|
|
756
|
+
super(message);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
class JobTaskFailedError extends TaskFailedError {
|
|
761
|
+
static type = "JobTaskFailedError";
|
|
762
|
+
jobError;
|
|
763
|
+
constructor(err) {
|
|
764
|
+
super(String(err));
|
|
765
|
+
this.jobError = err;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
class TaskJSONError extends TaskError {
|
|
770
|
+
static type = "TaskJSONError";
|
|
771
|
+
constructor(message = "Error converting JSON to a Task") {
|
|
772
|
+
super(message);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
class TaskInvalidInputError extends TaskError {
|
|
777
|
+
static type = "TaskInvalidInputError";
|
|
778
|
+
constructor(message = "Invalid input data") {
|
|
779
|
+
super(message);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// src/task/TaskRunner.ts
|
|
784
|
+
import {
|
|
785
|
+
getTelemetryProvider,
|
|
786
|
+
globalServiceRegistry,
|
|
787
|
+
SpanStatusCode
|
|
788
|
+
} from "@workglow/util";
|
|
733
789
|
|
|
734
790
|
// src/task/InputResolver.ts
|
|
735
791
|
import { getInputResolvers } from "@workglow/util";
|
|
@@ -812,7 +868,6 @@ async function resolveSchemaInputs(input, schema, config) {
|
|
|
812
868
|
}
|
|
813
869
|
return resolved;
|
|
814
870
|
}
|
|
815
|
-
var init_InputResolver = () => {};
|
|
816
871
|
|
|
817
872
|
// src/task/StreamTypes.ts
|
|
818
873
|
function getPortStreamMode(schema, portId) {
|
|
@@ -916,11 +971,6 @@ function hasStructuredOutput(schema) {
|
|
|
916
971
|
}
|
|
917
972
|
|
|
918
973
|
// src/task/TaskRunner.ts
|
|
919
|
-
import {
|
|
920
|
-
getTelemetryProvider,
|
|
921
|
-
globalServiceRegistry,
|
|
922
|
-
SpanStatusCode
|
|
923
|
-
} from "@workglow/util";
|
|
924
974
|
function hasRunConfig(i) {
|
|
925
975
|
return i !== null && typeof i === "object" && "runConfig" in i;
|
|
926
976
|
}
|
|
@@ -1297,18 +1347,8 @@ class TaskRunner {
|
|
|
1297
1347
|
await this.updateProgress(this.task, progress, message, ...args);
|
|
1298
1348
|
}
|
|
1299
1349
|
}
|
|
1300
|
-
var init_TaskRunner = __esm(() => {
|
|
1301
|
-
init_TaskOutputRepository();
|
|
1302
|
-
init_Conversions();
|
|
1303
|
-
init_InputResolver();
|
|
1304
|
-
init_TaskError();
|
|
1305
|
-
init_TaskTypes();
|
|
1306
|
-
});
|
|
1307
1350
|
|
|
1308
1351
|
// src/task/Task.ts
|
|
1309
|
-
import { compileSchema } from "@workglow/util/schema";
|
|
1310
|
-
import { deepEqual, EventEmitter as EventEmitter3, uuid4 as uuid42 } from "@workglow/util";
|
|
1311
|
-
|
|
1312
1352
|
class Task {
|
|
1313
1353
|
static type = "Task";
|
|
1314
1354
|
static category = "Hidden";
|
|
@@ -1788,146 +1828,52 @@ class Task {
|
|
|
1788
1828
|
this.events.emit("regenerate");
|
|
1789
1829
|
}
|
|
1790
1830
|
}
|
|
1791
|
-
var init_Task = __esm(() => {
|
|
1792
|
-
init_Dataflow();
|
|
1793
|
-
init_TaskGraph();
|
|
1794
|
-
init_TaskError();
|
|
1795
|
-
init_TaskRunner();
|
|
1796
|
-
init_TaskTypes();
|
|
1797
|
-
});
|
|
1798
|
-
|
|
1799
|
-
// src/task/ConditionUtils.ts
|
|
1800
|
-
function evaluateCondition(fieldValue, operator, compareValue) {
|
|
1801
|
-
if (fieldValue === null || fieldValue === undefined) {
|
|
1802
|
-
switch (operator) {
|
|
1803
|
-
case "is_empty":
|
|
1804
|
-
return true;
|
|
1805
|
-
case "is_not_empty":
|
|
1806
|
-
return false;
|
|
1807
|
-
case "is_true":
|
|
1808
|
-
return false;
|
|
1809
|
-
case "is_false":
|
|
1810
|
-
return true;
|
|
1811
|
-
default:
|
|
1812
|
-
return false;
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
const strValue = String(fieldValue);
|
|
1816
|
-
const numValue = Number(fieldValue);
|
|
1817
|
-
switch (operator) {
|
|
1818
|
-
case "equals":
|
|
1819
|
-
if (!isNaN(numValue) && !isNaN(Number(compareValue))) {
|
|
1820
|
-
return numValue === Number(compareValue);
|
|
1821
|
-
}
|
|
1822
|
-
return strValue === compareValue;
|
|
1823
|
-
case "not_equals":
|
|
1824
|
-
if (!isNaN(numValue) && !isNaN(Number(compareValue))) {
|
|
1825
|
-
return numValue !== Number(compareValue);
|
|
1826
|
-
}
|
|
1827
|
-
return strValue !== compareValue;
|
|
1828
|
-
case "greater_than":
|
|
1829
|
-
return numValue > Number(compareValue);
|
|
1830
|
-
case "greater_or_equal":
|
|
1831
|
-
return numValue >= Number(compareValue);
|
|
1832
|
-
case "less_than":
|
|
1833
|
-
return numValue < Number(compareValue);
|
|
1834
|
-
case "less_or_equal":
|
|
1835
|
-
return numValue <= Number(compareValue);
|
|
1836
|
-
case "contains":
|
|
1837
|
-
return strValue.toLowerCase().includes(compareValue.toLowerCase());
|
|
1838
|
-
case "starts_with":
|
|
1839
|
-
return strValue.toLowerCase().startsWith(compareValue.toLowerCase());
|
|
1840
|
-
case "ends_with":
|
|
1841
|
-
return strValue.toLowerCase().endsWith(compareValue.toLowerCase());
|
|
1842
|
-
case "is_empty":
|
|
1843
|
-
return strValue === "" || Array.isArray(fieldValue) && fieldValue.length === 0;
|
|
1844
|
-
case "is_not_empty":
|
|
1845
|
-
return strValue !== "" && !(Array.isArray(fieldValue) && fieldValue.length === 0);
|
|
1846
|
-
case "is_true":
|
|
1847
|
-
return Boolean(fieldValue) === true;
|
|
1848
|
-
case "is_false":
|
|
1849
|
-
return Boolean(fieldValue) === false;
|
|
1850
|
-
default:
|
|
1851
|
-
return false;
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
function getNestedValue(obj, path) {
|
|
1855
|
-
const parts = path.split(".");
|
|
1856
|
-
let current = obj;
|
|
1857
|
-
for (const part of parts) {
|
|
1858
|
-
if (current === null || current === undefined || typeof current !== "object") {
|
|
1859
|
-
return;
|
|
1860
|
-
}
|
|
1861
|
-
current = current[part];
|
|
1862
|
-
}
|
|
1863
|
-
return current;
|
|
1864
|
-
}
|
|
1865
1831
|
|
|
1866
1832
|
// src/task/ConditionalTask.ts
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
type: "
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
{
|
|
1897
|
-
id: "default",
|
|
1898
|
-
condition: () => true,
|
|
1899
|
-
outputPort: "1"
|
|
1900
|
-
}
|
|
1901
|
-
];
|
|
1902
|
-
}
|
|
1903
|
-
return conditionConfig.branches.map((branch, index) => ({
|
|
1904
|
-
id: branch.id,
|
|
1905
|
-
outputPort: String(index + 1),
|
|
1906
|
-
condition: (inputData) => {
|
|
1907
|
-
const fieldValue = getNestedValue(inputData, branch.field);
|
|
1908
|
-
return evaluateCondition(fieldValue, branch.operator, branch.value);
|
|
1833
|
+
var conditionalTaskConfigSchema = {
|
|
1834
|
+
type: "object",
|
|
1835
|
+
properties: {
|
|
1836
|
+
...TaskConfigSchema["properties"],
|
|
1837
|
+
branches: { type: "array", items: {} },
|
|
1838
|
+
defaultBranch: { type: "string" },
|
|
1839
|
+
exclusive: { type: "boolean" },
|
|
1840
|
+
conditionConfig: { type: "object", additionalProperties: true }
|
|
1841
|
+
},
|
|
1842
|
+
additionalProperties: false
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1845
|
+
class ConditionalTask extends Task {
|
|
1846
|
+
static type = "ConditionalTask";
|
|
1847
|
+
static category = "Flow Control";
|
|
1848
|
+
static title = "Condition";
|
|
1849
|
+
static description = "Route data based on conditions";
|
|
1850
|
+
static hasDynamicSchemas = true;
|
|
1851
|
+
static configSchema() {
|
|
1852
|
+
return conditionalTaskConfigSchema;
|
|
1853
|
+
}
|
|
1854
|
+
activeBranches = new Set;
|
|
1855
|
+
buildBranchesFromConditionConfig(conditionConfig) {
|
|
1856
|
+
if (!conditionConfig?.branches || conditionConfig.branches.length === 0) {
|
|
1857
|
+
return [
|
|
1858
|
+
{
|
|
1859
|
+
id: "default",
|
|
1860
|
+
condition: () => true,
|
|
1861
|
+
outputPort: "1"
|
|
1909
1862
|
}
|
|
1910
|
-
|
|
1863
|
+
];
|
|
1911
1864
|
}
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
defaultBranch: this.config.defaultBranch,
|
|
1919
|
-
fromConditionConfig: false
|
|
1920
|
-
};
|
|
1921
|
-
}
|
|
1922
|
-
const conditionConfig = input.conditionConfig ?? this.config.conditionConfig;
|
|
1923
|
-
if (conditionConfig) {
|
|
1924
|
-
return {
|
|
1925
|
-
branches: this.buildBranchesFromConditionConfig(conditionConfig),
|
|
1926
|
-
isExclusive: conditionConfig.exclusive ?? true,
|
|
1927
|
-
defaultBranch: conditionConfig.defaultBranch,
|
|
1928
|
-
fromConditionConfig: true
|
|
1929
|
-
};
|
|
1865
|
+
return conditionConfig.branches.map((branch, index) => ({
|
|
1866
|
+
id: branch.id,
|
|
1867
|
+
outputPort: String(index + 1),
|
|
1868
|
+
condition: (inputData) => {
|
|
1869
|
+
const fieldValue = getNestedValue(inputData, branch.field);
|
|
1870
|
+
return evaluateCondition(fieldValue, branch.operator, branch.value);
|
|
1930
1871
|
}
|
|
1872
|
+
}));
|
|
1873
|
+
}
|
|
1874
|
+
resolveBranches(input) {
|
|
1875
|
+
const configBranches = this.config.branches ?? [];
|
|
1876
|
+
if (configBranches.length > 0 && typeof configBranches[0].condition === "function") {
|
|
1931
1877
|
return {
|
|
1932
1878
|
branches: configBranches,
|
|
1933
1879
|
isExclusive: this.config.exclusive ?? true,
|
|
@@ -1935,146 +1881,161 @@ var init_ConditionalTask = __esm(() => {
|
|
|
1935
1881
|
fromConditionConfig: false
|
|
1936
1882
|
};
|
|
1937
1883
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1884
|
+
const conditionConfig = input.conditionConfig ?? this.config.conditionConfig;
|
|
1885
|
+
if (conditionConfig) {
|
|
1886
|
+
return {
|
|
1887
|
+
branches: this.buildBranchesFromConditionConfig(conditionConfig),
|
|
1888
|
+
isExclusive: conditionConfig.exclusive ?? true,
|
|
1889
|
+
defaultBranch: conditionConfig.defaultBranch,
|
|
1890
|
+
fromConditionConfig: true
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
return {
|
|
1894
|
+
branches: configBranches,
|
|
1895
|
+
isExclusive: this.config.exclusive ?? true,
|
|
1896
|
+
defaultBranch: this.config.defaultBranch,
|
|
1897
|
+
fromConditionConfig: false
|
|
1898
|
+
};
|
|
1899
|
+
}
|
|
1900
|
+
async execute(input, context) {
|
|
1901
|
+
if (context.signal?.aborted) {
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
this.activeBranches.clear();
|
|
1905
|
+
const { branches, isExclusive, defaultBranch, fromConditionConfig } = this.resolveBranches(input);
|
|
1906
|
+
for (const branch of branches) {
|
|
1907
|
+
try {
|
|
1908
|
+
const isActive = branch.condition(input);
|
|
1909
|
+
if (isActive) {
|
|
1910
|
+
this.activeBranches.add(branch.id);
|
|
1911
|
+
if (isExclusive) {
|
|
1912
|
+
break;
|
|
1952
1913
|
}
|
|
1953
|
-
} catch (error) {
|
|
1954
|
-
getLogger().warn(`Condition evaluation failed for branch "${branch.id}":`, { error });
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
if (this.activeBranches.size === 0 && defaultBranch) {
|
|
1958
|
-
const defaultBranchExists = branches.some((b) => b.id === defaultBranch);
|
|
1959
|
-
if (defaultBranchExists) {
|
|
1960
|
-
this.activeBranches.add(defaultBranch);
|
|
1961
1914
|
}
|
|
1915
|
+
} catch (error) {
|
|
1916
|
+
getLogger().warn(`Condition evaluation failed for branch "${branch.id}":`, { error });
|
|
1962
1917
|
}
|
|
1963
|
-
|
|
1964
|
-
|
|
1918
|
+
}
|
|
1919
|
+
if (this.activeBranches.size === 0 && defaultBranch) {
|
|
1920
|
+
const defaultBranchExists = branches.some((b) => b.id === defaultBranch);
|
|
1921
|
+
if (defaultBranchExists) {
|
|
1922
|
+
this.activeBranches.add(defaultBranch);
|
|
1965
1923
|
}
|
|
1966
|
-
return this.buildOutput(input);
|
|
1967
1924
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1925
|
+
if (fromConditionConfig) {
|
|
1926
|
+
return this.buildConditionConfigOutput(input, branches, isExclusive);
|
|
1927
|
+
}
|
|
1928
|
+
return this.buildOutput(input);
|
|
1929
|
+
}
|
|
1930
|
+
buildConditionConfigOutput(input, branches, isExclusive) {
|
|
1931
|
+
const output = {};
|
|
1932
|
+
const { conditionConfig, ...passThrough } = input;
|
|
1933
|
+
const inputKeys = Object.keys(passThrough);
|
|
1934
|
+
let matchedBranchNumber = null;
|
|
1935
|
+
for (let i = 0;i < branches.length; i++) {
|
|
1936
|
+
if (this.activeBranches.has(branches[i].id)) {
|
|
1937
|
+
if (matchedBranchNumber === null) {
|
|
1938
|
+
matchedBranchNumber = i + 1;
|
|
1978
1939
|
}
|
|
1979
1940
|
}
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
} else {
|
|
1986
|
-
for (const key of inputKeys) {
|
|
1987
|
-
output[`${key}_else`] = passThrough[key];
|
|
1988
|
-
}
|
|
1941
|
+
}
|
|
1942
|
+
if (isExclusive) {
|
|
1943
|
+
if (matchedBranchNumber !== null) {
|
|
1944
|
+
for (const key of inputKeys) {
|
|
1945
|
+
output[`${key}_${matchedBranchNumber}`] = passThrough[key];
|
|
1989
1946
|
}
|
|
1990
1947
|
} else {
|
|
1991
|
-
for (
|
|
1992
|
-
|
|
1993
|
-
for (const key of inputKeys) {
|
|
1994
|
-
output[`${key}_${i + 1}`] = passThrough[key];
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1948
|
+
for (const key of inputKeys) {
|
|
1949
|
+
output[`${key}_else`] = passThrough[key];
|
|
1997
1950
|
}
|
|
1998
1951
|
}
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
const branches = this.config.branches ?? [];
|
|
2006
|
-
for (const branch of branches) {
|
|
2007
|
-
if (this.activeBranches.has(branch.id)) {
|
|
2008
|
-
output[branch.outputPort] = { ...input };
|
|
1952
|
+
} else {
|
|
1953
|
+
for (let i = 0;i < branches.length; i++) {
|
|
1954
|
+
if (this.activeBranches.has(branches[i].id)) {
|
|
1955
|
+
for (const key of inputKeys) {
|
|
1956
|
+
output[`${key}_${i + 1}`] = passThrough[key];
|
|
1957
|
+
}
|
|
2009
1958
|
}
|
|
2010
1959
|
}
|
|
2011
|
-
return output;
|
|
2012
|
-
}
|
|
2013
|
-
isBranchActive(branchId) {
|
|
2014
|
-
return this.activeBranches.has(branchId);
|
|
2015
|
-
}
|
|
2016
|
-
getActiveBranches() {
|
|
2017
|
-
return new Set(this.activeBranches);
|
|
2018
1960
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
1961
|
+
return output;
|
|
1962
|
+
}
|
|
1963
|
+
buildOutput(input) {
|
|
1964
|
+
const output = {
|
|
1965
|
+
_activeBranches: Array.from(this.activeBranches)
|
|
1966
|
+
};
|
|
1967
|
+
const branches = this.config.branches ?? [];
|
|
1968
|
+
for (const branch of branches) {
|
|
1969
|
+
if (this.activeBranches.has(branch.id)) {
|
|
1970
|
+
output[branch.outputPort] = { ...input };
|
|
2024
1971
|
}
|
|
2025
|
-
return status;
|
|
2026
1972
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
1973
|
+
return output;
|
|
1974
|
+
}
|
|
1975
|
+
isBranchActive(branchId) {
|
|
1976
|
+
return this.activeBranches.has(branchId);
|
|
1977
|
+
}
|
|
1978
|
+
getActiveBranches() {
|
|
1979
|
+
return new Set(this.activeBranches);
|
|
1980
|
+
}
|
|
1981
|
+
getPortActiveStatus() {
|
|
1982
|
+
const status = new Map;
|
|
1983
|
+
const branches = this.config.branches ?? [];
|
|
1984
|
+
for (const branch of branches) {
|
|
1985
|
+
status.set(branch.outputPort, this.activeBranches.has(branch.id));
|
|
2039
1986
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
1987
|
+
return status;
|
|
1988
|
+
}
|
|
1989
|
+
static outputSchema() {
|
|
1990
|
+
return {
|
|
1991
|
+
type: "object",
|
|
1992
|
+
properties: {
|
|
2043
1993
|
_activeBranches: {
|
|
2044
1994
|
type: "array",
|
|
2045
1995
|
items: { type: "string" },
|
|
2046
1996
|
description: "List of active branch IDs after condition evaluation"
|
|
2047
1997
|
}
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
1998
|
+
},
|
|
1999
|
+
additionalProperties: true
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
outputSchema() {
|
|
2003
|
+
const branches = this.config?.branches ?? [];
|
|
2004
|
+
const properties = {
|
|
2005
|
+
_activeBranches: {
|
|
2006
|
+
type: "array",
|
|
2007
|
+
items: { type: "string" },
|
|
2008
|
+
description: "List of active branch IDs after condition evaluation"
|
|
2055
2009
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
additionalProperties: false
|
|
2060
|
-
};
|
|
2061
|
-
}
|
|
2062
|
-
static inputSchema() {
|
|
2063
|
-
return {
|
|
2064
|
-
type: "object",
|
|
2065
|
-
properties: {},
|
|
2066
|
-
additionalProperties: true
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
inputSchema() {
|
|
2070
|
-
return {
|
|
2010
|
+
};
|
|
2011
|
+
for (const branch of branches) {
|
|
2012
|
+
properties[branch.outputPort] = {
|
|
2071
2013
|
type: "object",
|
|
2072
|
-
|
|
2014
|
+
description: `Output for branch "${branch.id}" when active`,
|
|
2073
2015
|
additionalProperties: true
|
|
2074
2016
|
};
|
|
2075
2017
|
}
|
|
2076
|
-
|
|
2077
|
-
|
|
2018
|
+
return {
|
|
2019
|
+
type: "object",
|
|
2020
|
+
properties,
|
|
2021
|
+
additionalProperties: false
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
static inputSchema() {
|
|
2025
|
+
return {
|
|
2026
|
+
type: "object",
|
|
2027
|
+
properties: {},
|
|
2028
|
+
additionalProperties: true
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
inputSchema() {
|
|
2032
|
+
return {
|
|
2033
|
+
type: "object",
|
|
2034
|
+
properties: {},
|
|
2035
|
+
additionalProperties: true
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2078
2039
|
|
|
2079
2040
|
// src/task-graph/TaskGraphScheduler.ts
|
|
2080
2041
|
class TopologicalScheduler {
|
|
@@ -2219,24 +2180,14 @@ class DependencyBasedScheduler {
|
|
|
2219
2180
|
this.nextResolver = null;
|
|
2220
2181
|
}
|
|
2221
2182
|
}
|
|
2222
|
-
var init_TaskGraphScheduler = __esm(() => {
|
|
2223
|
-
init_TaskTypes();
|
|
2224
|
-
});
|
|
2225
2183
|
|
|
2226
2184
|
// src/task-graph/TaskGraphRunner.ts
|
|
2227
|
-
import {
|
|
2228
|
-
collectPropertyValues,
|
|
2229
|
-
getLogger as getLogger2,
|
|
2230
|
-
getTelemetryProvider as getTelemetryProvider2,
|
|
2231
|
-
globalServiceRegistry as globalServiceRegistry2,
|
|
2232
|
-
ServiceRegistry as ServiceRegistry2,
|
|
2233
|
-
SpanStatusCode as SpanStatusCode2,
|
|
2234
|
-
uuid4 as uuid43
|
|
2235
|
-
} from "@workglow/util";
|
|
2236
2185
|
function taskPrototypeHasOwnExecute(task) {
|
|
2237
2186
|
const Ctor = task.constructor;
|
|
2238
2187
|
return Object.hasOwn(Ctor.prototype, "execute");
|
|
2239
2188
|
}
|
|
2189
|
+
var PROPERTY_ARRAY = "PROPERTY_ARRAY";
|
|
2190
|
+
var GRAPH_RESULT_ARRAY = "GRAPH_RESULT_ARRAY";
|
|
2240
2191
|
|
|
2241
2192
|
class TaskGraphRunner {
|
|
2242
2193
|
processScheduler;
|
|
@@ -2838,254 +2789,231 @@ class TaskGraphRunner {
|
|
|
2838
2789
|
}
|
|
2839
2790
|
}
|
|
2840
2791
|
}
|
|
2841
|
-
var PROPERTY_ARRAY = "PROPERTY_ARRAY", GRAPH_RESULT_ARRAY = "GRAPH_RESULT_ARRAY";
|
|
2842
|
-
var init_TaskGraphRunner = __esm(() => {
|
|
2843
|
-
init_TaskOutputRepository();
|
|
2844
|
-
init_ConditionalTask();
|
|
2845
|
-
init_TaskError();
|
|
2846
|
-
init_TaskTypes();
|
|
2847
|
-
init_Dataflow();
|
|
2848
|
-
init_TaskGraphScheduler();
|
|
2849
|
-
});
|
|
2850
2792
|
|
|
2851
2793
|
// src/task/GraphAsTaskRunner.ts
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
async handleDisable() {
|
|
2874
|
-
if (this.task.hasChildren()) {
|
|
2875
|
-
await this.task.subGraph.disable();
|
|
2876
|
-
}
|
|
2877
|
-
super.handleDisable();
|
|
2794
|
+
class GraphAsTaskRunner extends TaskRunner {
|
|
2795
|
+
async executeTaskChildren(input) {
|
|
2796
|
+
const unsubscribe = this.task.subGraph.subscribe("graph_progress", (progress, message, ...args) => {
|
|
2797
|
+
this.task.emit("progress", progress, message, ...args);
|
|
2798
|
+
});
|
|
2799
|
+
const results = await this.task.subGraph.run(input, {
|
|
2800
|
+
parentSignal: this.abortController?.signal,
|
|
2801
|
+
outputCache: this.outputCache,
|
|
2802
|
+
registry: this.registry
|
|
2803
|
+
});
|
|
2804
|
+
unsubscribe();
|
|
2805
|
+
return results;
|
|
2806
|
+
}
|
|
2807
|
+
async executeTaskChildrenReactive() {
|
|
2808
|
+
return this.task.subGraph.runReactive(this.task.runInputData, {
|
|
2809
|
+
registry: this.registry
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
async handleDisable() {
|
|
2813
|
+
if (this.task.hasChildren()) {
|
|
2814
|
+
await this.task.subGraph.disable();
|
|
2878
2815
|
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2816
|
+
super.handleDisable();
|
|
2817
|
+
}
|
|
2818
|
+
async executeTask(input) {
|
|
2819
|
+
if (this.task.hasChildren()) {
|
|
2820
|
+
const runExecuteOutputData = await this.executeTaskChildren(input);
|
|
2821
|
+
this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(runExecuteOutputData, this.task.compoundMerge);
|
|
2822
|
+
} else {
|
|
2823
|
+
const result = await super.executeTask(input);
|
|
2824
|
+
this.task.runOutputData = result ?? {};
|
|
2888
2825
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2826
|
+
return this.task.runOutputData;
|
|
2827
|
+
}
|
|
2828
|
+
async executeTaskReactive(input, output) {
|
|
2829
|
+
if (this.task.hasChildren()) {
|
|
2830
|
+
const reactiveResults = await this.executeTaskChildrenReactive();
|
|
2831
|
+
this.task.runOutputData = this.task.subGraph.mergeExecuteOutputsToRunOutput(reactiveResults, this.task.compoundMerge);
|
|
2832
|
+
} else {
|
|
2833
|
+
const reactiveResults = await super.executeTaskReactive(input, output);
|
|
2834
|
+
this.task.runOutputData = Object.assign({}, output, reactiveResults ?? {});
|
|
2898
2835
|
}
|
|
2899
|
-
|
|
2900
|
-
}
|
|
2836
|
+
return this.task.runOutputData;
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2901
2839
|
|
|
2902
2840
|
// src/task/GraphAsTask.ts
|
|
2903
|
-
var
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
}
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
GraphAsTask = class GraphAsTask extends Task {
|
|
2925
|
-
static type = "GraphAsTask";
|
|
2926
|
-
static title = "Group";
|
|
2927
|
-
static description = "A group of tasks that are executed together";
|
|
2928
|
-
static category = "Flow Control";
|
|
2929
|
-
static compoundMerge = PROPERTY_ARRAY;
|
|
2930
|
-
static hasDynamicSchemas = true;
|
|
2931
|
-
constructor(input = {}, config = {}) {
|
|
2932
|
-
const { subGraph, ...rest } = config;
|
|
2933
|
-
super(input, rest);
|
|
2934
|
-
if (subGraph) {
|
|
2935
|
-
this.subGraph = subGraph;
|
|
2936
|
-
}
|
|
2937
|
-
this.regenerateGraph();
|
|
2841
|
+
var graphAsTaskConfigSchema = {
|
|
2842
|
+
type: "object",
|
|
2843
|
+
properties: {
|
|
2844
|
+
...TaskConfigSchema["properties"],
|
|
2845
|
+
compoundMerge: { type: "string", "x-ui-hidden": true }
|
|
2846
|
+
},
|
|
2847
|
+
additionalProperties: false
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2850
|
+
class GraphAsTask extends Task {
|
|
2851
|
+
static type = "GraphAsTask";
|
|
2852
|
+
static title = "Group";
|
|
2853
|
+
static description = "A group of tasks that are executed together";
|
|
2854
|
+
static category = "Flow Control";
|
|
2855
|
+
static compoundMerge = PROPERTY_ARRAY;
|
|
2856
|
+
static hasDynamicSchemas = true;
|
|
2857
|
+
constructor(input = {}, config = {}) {
|
|
2858
|
+
const { subGraph, ...rest } = config;
|
|
2859
|
+
super(input, rest);
|
|
2860
|
+
if (subGraph) {
|
|
2861
|
+
this.subGraph = subGraph;
|
|
2938
2862
|
}
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2863
|
+
this.regenerateGraph();
|
|
2864
|
+
}
|
|
2865
|
+
get runner() {
|
|
2866
|
+
if (!this._runner) {
|
|
2867
|
+
this._runner = new GraphAsTaskRunner(this);
|
|
2944
2868
|
}
|
|
2945
|
-
|
|
2946
|
-
|
|
2869
|
+
return this._runner;
|
|
2870
|
+
}
|
|
2871
|
+
static configSchema() {
|
|
2872
|
+
return graphAsTaskConfigSchema;
|
|
2873
|
+
}
|
|
2874
|
+
get compoundMerge() {
|
|
2875
|
+
return this.config?.compoundMerge || this.constructor.compoundMerge;
|
|
2876
|
+
}
|
|
2877
|
+
get cacheable() {
|
|
2878
|
+
return this.runConfig?.cacheable ?? this.config?.cacheable ?? (this.constructor.cacheable && !this.hasChildren());
|
|
2879
|
+
}
|
|
2880
|
+
inputSchema() {
|
|
2881
|
+
if (!this.hasChildren()) {
|
|
2882
|
+
return this.constructor.inputSchema();
|
|
2947
2883
|
}
|
|
2948
|
-
|
|
2949
|
-
|
|
2884
|
+
return computeGraphInputSchema(this.subGraph);
|
|
2885
|
+
}
|
|
2886
|
+
_inputSchemaNode;
|
|
2887
|
+
getInputSchemaNode() {
|
|
2888
|
+
if (!this._inputSchemaNode) {
|
|
2889
|
+
try {
|
|
2890
|
+
const dataPortSchema = this.inputSchema();
|
|
2891
|
+
const schemaNode = Task.generateInputSchemaNode(dataPortSchema);
|
|
2892
|
+
this._inputSchemaNode = schemaNode;
|
|
2893
|
+
} catch (error) {
|
|
2894
|
+
console.warn(`Failed to compile input schema for ${this.type}, falling back to permissive validation:`, error);
|
|
2895
|
+
this._inputSchemaNode = compileSchema2({});
|
|
2896
|
+
}
|
|
2950
2897
|
}
|
|
2951
|
-
|
|
2952
|
-
|
|
2898
|
+
return this._inputSchemaNode;
|
|
2899
|
+
}
|
|
2900
|
+
outputSchema() {
|
|
2901
|
+
if (!this.hasChildren()) {
|
|
2902
|
+
return this.constructor.outputSchema();
|
|
2953
2903
|
}
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2904
|
+
return computeGraphOutputSchema(this.subGraph);
|
|
2905
|
+
}
|
|
2906
|
+
resetInputData() {
|
|
2907
|
+
super.resetInputData();
|
|
2908
|
+
if (this.hasChildren()) {
|
|
2909
|
+
this.subGraph.getTasks().forEach((node) => {
|
|
2910
|
+
node.resetInputData();
|
|
2911
|
+
});
|
|
2912
|
+
this.subGraph.getDataflows().forEach((dataflow) => {
|
|
2913
|
+
dataflow.reset();
|
|
2914
|
+
});
|
|
2959
2915
|
}
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2916
|
+
}
|
|
2917
|
+
async* executeStream(input, context) {
|
|
2918
|
+
if (context.inputStreams) {
|
|
2919
|
+
for (const [, stream] of context.inputStreams) {
|
|
2920
|
+
const reader = stream.getReader();
|
|
2963
2921
|
try {
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2922
|
+
while (true) {
|
|
2923
|
+
const { done, value } = await reader.read();
|
|
2924
|
+
if (done)
|
|
2925
|
+
break;
|
|
2926
|
+
if (value.type === "finish")
|
|
2927
|
+
continue;
|
|
2928
|
+
yield value;
|
|
2929
|
+
}
|
|
2930
|
+
} finally {
|
|
2931
|
+
reader.releaseLock();
|
|
2970
2932
|
}
|
|
2971
2933
|
}
|
|
2972
|
-
return this._inputSchemaNode;
|
|
2973
|
-
}
|
|
2974
|
-
outputSchema() {
|
|
2975
|
-
if (!this.hasChildren()) {
|
|
2976
|
-
return this.constructor.outputSchema();
|
|
2977
|
-
}
|
|
2978
|
-
return computeGraphOutputSchema(this.subGraph);
|
|
2979
|
-
}
|
|
2980
|
-
resetInputData() {
|
|
2981
|
-
super.resetInputData();
|
|
2982
|
-
if (this.hasChildren()) {
|
|
2983
|
-
this.subGraph.getTasks().forEach((node) => {
|
|
2984
|
-
node.resetInputData();
|
|
2985
|
-
});
|
|
2986
|
-
this.subGraph.getDataflows().forEach((dataflow) => {
|
|
2987
|
-
dataflow.reset();
|
|
2988
|
-
});
|
|
2989
|
-
}
|
|
2990
2934
|
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
const { done, value } = await reader.read();
|
|
2998
|
-
if (done)
|
|
2999
|
-
break;
|
|
3000
|
-
if (value.type === "finish")
|
|
3001
|
-
continue;
|
|
3002
|
-
yield value;
|
|
3003
|
-
}
|
|
3004
|
-
} finally {
|
|
3005
|
-
reader.releaseLock();
|
|
3006
|
-
}
|
|
2935
|
+
if (this.hasChildren()) {
|
|
2936
|
+
const endingNodeIds = new Set;
|
|
2937
|
+
const tasks = this.subGraph.getTasks();
|
|
2938
|
+
for (const task of tasks) {
|
|
2939
|
+
if (this.subGraph.getTargetDataflows(task.id).length === 0) {
|
|
2940
|
+
endingNodeIds.add(task.id);
|
|
3007
2941
|
}
|
|
3008
2942
|
}
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
2943
|
+
const eventQueue = [];
|
|
2944
|
+
let resolveWaiting;
|
|
2945
|
+
let subgraphDone = false;
|
|
2946
|
+
const unsub = this.subGraph.subscribeToTaskStreaming({
|
|
2947
|
+
onStreamChunk: (taskId, event) => {
|
|
2948
|
+
if (endingNodeIds.has(taskId) && event.type !== "finish") {
|
|
2949
|
+
eventQueue.push(event);
|
|
2950
|
+
resolveWaiting?.();
|
|
3015
2951
|
}
|
|
3016
2952
|
}
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
const runPromise = this.subGraph.run(input, { parentSignal: context.signal, accumulateLeafOutputs: false }).then((results2) => {
|
|
3029
|
-
subgraphDone = true;
|
|
3030
|
-
resolveWaiting?.();
|
|
3031
|
-
return results2;
|
|
3032
|
-
});
|
|
3033
|
-
while (!subgraphDone) {
|
|
3034
|
-
if (eventQueue.length === 0) {
|
|
3035
|
-
await new Promise((resolve) => {
|
|
3036
|
-
resolveWaiting = resolve;
|
|
3037
|
-
});
|
|
3038
|
-
}
|
|
3039
|
-
while (eventQueue.length > 0) {
|
|
3040
|
-
yield eventQueue.shift();
|
|
3041
|
-
}
|
|
2953
|
+
});
|
|
2954
|
+
const runPromise = this.subGraph.run(input, { parentSignal: context.signal, accumulateLeafOutputs: false }).then((results2) => {
|
|
2955
|
+
subgraphDone = true;
|
|
2956
|
+
resolveWaiting?.();
|
|
2957
|
+
return results2;
|
|
2958
|
+
});
|
|
2959
|
+
while (!subgraphDone) {
|
|
2960
|
+
if (eventQueue.length === 0) {
|
|
2961
|
+
await new Promise((resolve) => {
|
|
2962
|
+
resolveWaiting = resolve;
|
|
2963
|
+
});
|
|
3042
2964
|
}
|
|
3043
2965
|
while (eventQueue.length > 0) {
|
|
3044
2966
|
yield eventQueue.shift();
|
|
3045
2967
|
}
|
|
3046
|
-
unsub();
|
|
3047
|
-
const results = await runPromise;
|
|
3048
|
-
const mergedOutput = this.subGraph.mergeExecuteOutputsToRunOutput(results, this.compoundMerge);
|
|
3049
|
-
yield { type: "finish", data: mergedOutput };
|
|
3050
|
-
} else {
|
|
3051
|
-
yield { type: "finish", data: input };
|
|
3052
2968
|
}
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
this._inputSchemaNode = undefined;
|
|
3056
|
-
this.events.emit("regenerate");
|
|
3057
|
-
}
|
|
3058
|
-
toJSON(options) {
|
|
3059
|
-
let json = super.toJSON(options);
|
|
3060
|
-
const hasChildren = this.hasChildren();
|
|
3061
|
-
if (hasChildren) {
|
|
3062
|
-
json = {
|
|
3063
|
-
...json,
|
|
3064
|
-
merge: this.compoundMerge,
|
|
3065
|
-
subgraph: this.subGraph.toJSON(options)
|
|
3066
|
-
};
|
|
2969
|
+
while (eventQueue.length > 0) {
|
|
2970
|
+
yield eventQueue.shift();
|
|
3067
2971
|
}
|
|
3068
|
-
|
|
2972
|
+
unsub();
|
|
2973
|
+
const results = await runPromise;
|
|
2974
|
+
const mergedOutput = this.subGraph.mergeExecuteOutputsToRunOutput(results, this.compoundMerge);
|
|
2975
|
+
yield { type: "finish", data: mergedOutput };
|
|
2976
|
+
} else {
|
|
2977
|
+
yield { type: "finish", data: input };
|
|
3069
2978
|
}
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
2979
|
+
}
|
|
2980
|
+
regenerateGraph() {
|
|
2981
|
+
this._inputSchemaNode = undefined;
|
|
2982
|
+
this.events.emit("regenerate");
|
|
2983
|
+
}
|
|
2984
|
+
toJSON(options) {
|
|
2985
|
+
let json = super.toJSON(options);
|
|
2986
|
+
const hasChildren = this.hasChildren();
|
|
2987
|
+
if (hasChildren) {
|
|
2988
|
+
json = {
|
|
2989
|
+
...json,
|
|
2990
|
+
merge: this.compoundMerge,
|
|
2991
|
+
subgraph: this.subGraph.toJSON(options)
|
|
2992
|
+
};
|
|
2993
|
+
}
|
|
2994
|
+
return json;
|
|
2995
|
+
}
|
|
2996
|
+
toDependencyJSON(options) {
|
|
2997
|
+
const json = this.toJSON(options);
|
|
2998
|
+
if (this.hasChildren()) {
|
|
2999
|
+
if ("subgraph" in json) {
|
|
3000
|
+
delete json.subgraph;
|
|
3077
3001
|
}
|
|
3078
|
-
return json;
|
|
3002
|
+
return { ...json, subtasks: this.subGraph.toDependencyJSON(options) };
|
|
3079
3003
|
}
|
|
3080
|
-
|
|
3081
|
-
}
|
|
3004
|
+
return json;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3082
3007
|
|
|
3083
3008
|
// src/task-graph/Conversions.ts
|
|
3009
|
+
var _OwnGraphTask;
|
|
3010
|
+
var _OwnWorkflowTask;
|
|
3011
|
+
var _GraphTask;
|
|
3012
|
+
var _ConvWorkflowTask;
|
|
3084
3013
|
function getWrapperClasses() {
|
|
3085
3014
|
if (!_OwnGraphTask) {
|
|
3086
|
-
const GaT = (init_GraphAsTask(), __toCommonJS(exports_GraphAsTask)).GraphAsTask;
|
|
3087
3015
|
|
|
3088
|
-
class ListeningGraphAsTask extends
|
|
3016
|
+
class ListeningGraphAsTask extends GraphAsTask {
|
|
3089
3017
|
constructor(input, config) {
|
|
3090
3018
|
super(input, config);
|
|
3091
3019
|
this.subGraph.on("start", () => {
|
|
@@ -3108,11 +3036,11 @@ function getWrapperClasses() {
|
|
|
3108
3036
|
static type = "Own[Workflow]";
|
|
3109
3037
|
}
|
|
3110
3038
|
|
|
3111
|
-
class GraphTask extends
|
|
3039
|
+
class GraphTask extends GraphAsTask {
|
|
3112
3040
|
static type = "Graph";
|
|
3113
3041
|
}
|
|
3114
3042
|
|
|
3115
|
-
class ConvWorkflowTask extends
|
|
3043
|
+
class ConvWorkflowTask extends GraphAsTask {
|
|
3116
3044
|
static type = "Workflow";
|
|
3117
3045
|
}
|
|
3118
3046
|
_OwnGraphTask = OwnGraphTask;
|
|
@@ -3177,37 +3105,31 @@ function ensureTask(arg, config = {}) {
|
|
|
3177
3105
|
}
|
|
3178
3106
|
return convertPipeFunctionToTask(arg, config);
|
|
3179
3107
|
}
|
|
3180
|
-
var _OwnGraphTask, _OwnWorkflowTask, _GraphTask, _ConvWorkflowTask;
|
|
3181
|
-
var init_Conversions = __esm(() => {
|
|
3182
|
-
init_Task();
|
|
3183
|
-
init_Dataflow();
|
|
3184
|
-
init_TaskGraph();
|
|
3185
|
-
});
|
|
3186
3108
|
|
|
3187
3109
|
// src/task-graph/TaskGraphEvents.ts
|
|
3188
|
-
var EventDagToTaskGraphMapping
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
dataflow_replaced: "edge-replaced"
|
|
3205
|
-
};
|
|
3206
|
-
});
|
|
3110
|
+
var EventDagToTaskGraphMapping = {
|
|
3111
|
+
"node-added": "task_added",
|
|
3112
|
+
"node-removed": "task_removed",
|
|
3113
|
+
"node-replaced": "task_replaced",
|
|
3114
|
+
"edge-added": "dataflow_added",
|
|
3115
|
+
"edge-removed": "dataflow_removed",
|
|
3116
|
+
"edge-replaced": "dataflow_replaced"
|
|
3117
|
+
};
|
|
3118
|
+
var EventTaskGraphToDagMapping = {
|
|
3119
|
+
task_added: "node-added",
|
|
3120
|
+
task_removed: "node-removed",
|
|
3121
|
+
task_replaced: "node-replaced",
|
|
3122
|
+
dataflow_added: "edge-added",
|
|
3123
|
+
dataflow_removed: "edge-removed",
|
|
3124
|
+
dataflow_replaced: "edge-replaced"
|
|
3125
|
+
};
|
|
3207
3126
|
|
|
3208
3127
|
// src/task-graph/TaskGraph.ts
|
|
3209
|
-
|
|
3210
|
-
|
|
3128
|
+
class TaskGraphDAG extends DirectedAcyclicGraph {
|
|
3129
|
+
constructor() {
|
|
3130
|
+
super((task) => task.id, (dataflow) => dataflow.id);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3211
3133
|
|
|
3212
3134
|
class TaskGraph {
|
|
3213
3135
|
outputCache;
|
|
@@ -3493,38 +3415,7 @@ function serialGraph(tasks, inputHandle, outputHandle) {
|
|
|
3493
3415
|
graph.addDataflows(serialGraphEdges(tasks, inputHandle, outputHandle));
|
|
3494
3416
|
return graph;
|
|
3495
3417
|
}
|
|
3496
|
-
var TaskGraphDAG;
|
|
3497
|
-
var init_TaskGraph = __esm(() => {
|
|
3498
|
-
init_Conversions();
|
|
3499
|
-
init_Dataflow();
|
|
3500
|
-
init_GraphSchemaUtils();
|
|
3501
|
-
init_TaskGraphEvents();
|
|
3502
|
-
init_TaskGraphRunner();
|
|
3503
|
-
TaskGraphDAG = class TaskGraphDAG extends DirectedAcyclicGraph {
|
|
3504
|
-
constructor() {
|
|
3505
|
-
super((task) => task.id, (dataflow) => dataflow.id);
|
|
3506
|
-
}
|
|
3507
|
-
};
|
|
3508
|
-
});
|
|
3509
|
-
|
|
3510
|
-
// src/common.ts
|
|
3511
|
-
init_Dataflow();
|
|
3512
|
-
init_GraphSchemaUtils();
|
|
3513
|
-
init_TaskGraph();
|
|
3514
|
-
init_TaskGraphEvents();
|
|
3515
|
-
init_TaskGraphRunner();
|
|
3516
|
-
init_Conversions();
|
|
3517
|
-
|
|
3518
|
-
// src/task-graph/GraphToWorkflowCode.ts
|
|
3519
|
-
init_Dataflow();
|
|
3520
|
-
|
|
3521
3418
|
// src/task-graph/Workflow.ts
|
|
3522
|
-
init_GraphAsTask();
|
|
3523
|
-
init_TaskError();
|
|
3524
|
-
init_Conversions();
|
|
3525
|
-
init_Dataflow();
|
|
3526
|
-
init_TaskGraph();
|
|
3527
|
-
init_TaskGraphRunner();
|
|
3528
3419
|
import {
|
|
3529
3420
|
EventEmitter as EventEmitter5,
|
|
3530
3421
|
getLogger as getLogger3,
|
|
@@ -4616,17 +4507,7 @@ ${baseIndent}}`;
|
|
|
4616
4507
|
function resetMethodNameCache() {
|
|
4617
4508
|
methodNameCache = undefined;
|
|
4618
4509
|
}
|
|
4619
|
-
// src/task/index.ts
|
|
4620
|
-
init_ConditionalTask();
|
|
4621
|
-
|
|
4622
|
-
// src/task/FallbackTask.ts
|
|
4623
|
-
init_GraphAsTask();
|
|
4624
|
-
|
|
4625
4510
|
// src/task/FallbackTaskRunner.ts
|
|
4626
|
-
init_GraphAsTaskRunner();
|
|
4627
|
-
init_TaskError();
|
|
4628
|
-
init_TaskTypes();
|
|
4629
|
-
|
|
4630
4511
|
class FallbackTaskRunner extends GraphAsTaskRunner {
|
|
4631
4512
|
async executeTask(input) {
|
|
4632
4513
|
if (this.task.fallbackMode === "data") {
|
|
@@ -4825,21 +4706,8 @@ queueMicrotask(() => {
|
|
|
4825
4706
|
};
|
|
4826
4707
|
Workflow.prototype.endFallbackWith = CreateEndLoopWorkflow("endFallbackWith");
|
|
4827
4708
|
});
|
|
4828
|
-
|
|
4829
|
-
// src/task/index.ts
|
|
4830
|
-
init_GraphAsTask();
|
|
4831
|
-
init_GraphAsTaskRunner();
|
|
4832
|
-
init_InputResolver();
|
|
4833
|
-
|
|
4834
|
-
// src/task/IteratorTask.ts
|
|
4835
|
-
init_GraphAsTask();
|
|
4836
|
-
|
|
4837
4709
|
// src/task/IteratorTaskRunner.ts
|
|
4838
|
-
init_Dataflow();
|
|
4839
|
-
init_TaskGraph();
|
|
4840
|
-
init_GraphAsTaskRunner();
|
|
4841
4710
|
import { uuid4 as uuid46 } from "@workglow/util";
|
|
4842
|
-
|
|
4843
4711
|
class IteratorTaskRunner extends GraphAsTaskRunner {
|
|
4844
4712
|
aggregatingParentMapProgress = false;
|
|
4845
4713
|
mapPartialProgress = [];
|
|
@@ -5005,7 +4873,6 @@ class IteratorTaskRunner extends GraphAsTaskRunner {
|
|
|
5005
4873
|
}
|
|
5006
4874
|
|
|
5007
4875
|
// src/task/IteratorTask.ts
|
|
5008
|
-
init_TaskError();
|
|
5009
4876
|
var ITERATOR_CONTEXT_SCHEMA = {
|
|
5010
4877
|
type: "object",
|
|
5011
4878
|
properties: {
|
|
@@ -5497,13 +5364,7 @@ class IteratorTask extends GraphAsTask {
|
|
|
5497
5364
|
}
|
|
5498
5365
|
}
|
|
5499
5366
|
|
|
5500
|
-
// src/task/WhileTask.ts
|
|
5501
|
-
init_GraphAsTask();
|
|
5502
|
-
init_TaskError();
|
|
5503
|
-
|
|
5504
5367
|
// src/task/WhileTaskRunner.ts
|
|
5505
|
-
init_GraphAsTaskRunner();
|
|
5506
|
-
|
|
5507
5368
|
class WhileTaskRunner extends GraphAsTaskRunner {
|
|
5508
5369
|
async executeTask(input) {
|
|
5509
5370
|
const result = await this.task.execute(input, {
|
|
@@ -6130,9 +5991,7 @@ if (!globalServiceRegistry3.has(JOB_QUEUE_FACTORY)) {
|
|
|
6130
5991
|
registerJobQueueFactory(defaultJobQueueFactory);
|
|
6131
5992
|
}
|
|
6132
5993
|
// src/task/JobQueueTask.ts
|
|
6133
|
-
init_GraphAsTask();
|
|
6134
5994
|
import { Job as Job2 } from "@workglow/job-queue";
|
|
6135
|
-
init_TaskError();
|
|
6136
5995
|
|
|
6137
5996
|
// src/task/TaskQueueRegistry.ts
|
|
6138
5997
|
var taskQueueRegistry = null;
|
|
@@ -6331,7 +6190,6 @@ class JobQueueTask extends GraphAsTask {
|
|
|
6331
6190
|
}
|
|
6332
6191
|
}
|
|
6333
6192
|
// src/task/MapTask.ts
|
|
6334
|
-
init_TaskGraphRunner();
|
|
6335
6193
|
var mapTaskConfigSchema = {
|
|
6336
6194
|
type: "object",
|
|
6337
6195
|
properties: {
|
|
@@ -6503,16 +6361,6 @@ queueMicrotask(() => {
|
|
|
6503
6361
|
Workflow.prototype.reduce = CreateLoopWorkflow(ReduceTask);
|
|
6504
6362
|
Workflow.prototype.endReduce = CreateEndLoopWorkflow("endReduce");
|
|
6505
6363
|
});
|
|
6506
|
-
|
|
6507
|
-
// src/task/index.ts
|
|
6508
|
-
init_Task();
|
|
6509
|
-
init_TaskError();
|
|
6510
|
-
|
|
6511
|
-
// src/task/TaskJSON.ts
|
|
6512
|
-
init_Dataflow();
|
|
6513
|
-
init_TaskGraph();
|
|
6514
|
-
init_TaskError();
|
|
6515
|
-
|
|
6516
6364
|
// src/task/TaskRegistry.ts
|
|
6517
6365
|
import {
|
|
6518
6366
|
createServiceToken as createServiceToken3,
|
|
@@ -6561,7 +6409,6 @@ function resolveTaskFromRegistry(id, _format, registry) {
|
|
|
6561
6409
|
registerInputResolver("tasks", resolveTaskFromRegistry);
|
|
6562
6410
|
|
|
6563
6411
|
// src/task/TaskJSON.ts
|
|
6564
|
-
init_GraphAsTask();
|
|
6565
6412
|
var createSingleTaskFromJSON = (item, registry) => {
|
|
6566
6413
|
if (!item.id)
|
|
6567
6414
|
throw new TaskJSONError("Task id required");
|
|
@@ -6617,11 +6464,7 @@ var createGraphFromGraphJSON = (graphJsonObj, registry) => {
|
|
|
6617
6464
|
}
|
|
6618
6465
|
return subGraph;
|
|
6619
6466
|
};
|
|
6620
|
-
|
|
6621
6467
|
// src/task/index.ts
|
|
6622
|
-
init_ConditionalTask();
|
|
6623
|
-
init_TaskTypes();
|
|
6624
|
-
init_GraphAsTask();
|
|
6625
6468
|
var registerBaseTasks = () => {
|
|
6626
6469
|
const tasks = [GraphAsTask, ConditionalTask, FallbackTask, MapTask, WhileTask, ReduceTask];
|
|
6627
6470
|
tasks.map(TaskRegistry.registerTask);
|
|
@@ -6703,12 +6546,7 @@ class TaskGraphTabularRepository extends TaskGraphRepository {
|
|
|
6703
6546
|
return await this.tabularRepository.size();
|
|
6704
6547
|
}
|
|
6705
6548
|
}
|
|
6706
|
-
|
|
6707
|
-
// src/common.ts
|
|
6708
|
-
init_TaskOutputRepository();
|
|
6709
|
-
|
|
6710
6549
|
// src/storage/TaskOutputTabularRepository.ts
|
|
6711
|
-
init_TaskOutputRepository();
|
|
6712
6550
|
import { compress, decompress } from "@workglow/util/compress";
|
|
6713
6551
|
import { makeFingerprint } from "@workglow/util";
|
|
6714
6552
|
var TaskOutputSchema = {
|
|
@@ -6916,4 +6754,4 @@ export {
|
|
|
6916
6754
|
ConditionalTask
|
|
6917
6755
|
};
|
|
6918
6756
|
|
|
6919
|
-
//# debugId=
|
|
6757
|
+
//# debugId=A032A5F42103EE2664756E2164756E21
|