@workglow/task-graph 0.0.87 → 0.0.88
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 +292 -1378
- package/dist/browser.js.map +8 -16
- package/dist/bun.js +292 -1378
- package/dist/bun.js.map +8 -16
- package/dist/node.js +292 -1378
- package/dist/node.js.map +8 -16
- package/dist/task/index.d.ts +1 -13
- package/dist/task/index.d.ts.map +1 -1
- package/dist/task-graph/Workflow.d.ts +8 -94
- package/dist/task-graph/Workflow.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/task/BatchTask.d.ts +0 -154
- package/dist/task/BatchTask.d.ts.map +0 -1
- package/dist/task/ForEachTask.d.ts +0 -120
- package/dist/task/ForEachTask.d.ts.map +0 -1
- package/dist/task/IteratorTask.d.ts +0 -197
- package/dist/task/IteratorTask.d.ts.map +0 -1
- package/dist/task/IteratorTaskRunner.d.ts +0 -63
- package/dist/task/IteratorTaskRunner.d.ts.map +0 -1
- package/dist/task/MapTask.d.ts +0 -134
- package/dist/task/MapTask.d.ts.map +0 -1
- package/dist/task/ReduceTask.d.ts +0 -155
- package/dist/task/ReduceTask.d.ts.map +0 -1
- package/dist/task/WhileTask.d.ts +0 -176
- package/dist/task/WhileTask.d.ts.map +0 -1
package/dist/task/index.d.ts
CHANGED
|
@@ -3,19 +3,13 @@
|
|
|
3
3
|
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
export * from "./BatchTask";
|
|
7
6
|
export * from "./ConditionalTask";
|
|
8
|
-
export * from "./ForEachTask";
|
|
9
7
|
export * from "./GraphAsTask";
|
|
10
8
|
export * from "./GraphAsTaskRunner";
|
|
11
9
|
export * from "./InputResolver";
|
|
12
10
|
export * from "./ITask";
|
|
13
|
-
export * from "./IteratorTask";
|
|
14
|
-
export * from "./IteratorTaskRunner";
|
|
15
11
|
export * from "./JobQueueFactory";
|
|
16
12
|
export * from "./JobQueueTask";
|
|
17
|
-
export * from "./MapTask";
|
|
18
|
-
export * from "./ReduceTask";
|
|
19
13
|
export * from "./Task";
|
|
20
14
|
export * from "./TaskError";
|
|
21
15
|
export * from "./TaskEvents";
|
|
@@ -23,13 +17,7 @@ export * from "./TaskJSON";
|
|
|
23
17
|
export * from "./TaskQueueRegistry";
|
|
24
18
|
export * from "./TaskRegistry";
|
|
25
19
|
export * from "./TaskTypes";
|
|
26
|
-
export * from "./WhileTask";
|
|
27
|
-
import { BatchTask } from "./BatchTask";
|
|
28
20
|
import { ConditionalTask } from "./ConditionalTask";
|
|
29
|
-
import { ForEachTask } from "./ForEachTask";
|
|
30
21
|
import { GraphAsTask } from "./GraphAsTask";
|
|
31
|
-
|
|
32
|
-
import { ReduceTask } from "./ReduceTask";
|
|
33
|
-
import { WhileTask } from "./WhileTask";
|
|
34
|
-
export declare const registerBaseTasks: () => (typeof ConditionalTask | typeof GraphAsTask | typeof ForEachTask | typeof MapTask | typeof BatchTask | typeof WhileTask | typeof ReduceTask)[];
|
|
22
|
+
export declare const registerBaseTasks: () => (typeof ConditionalTask | typeof GraphAsTask)[];
|
|
35
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/task/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/task/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/task/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,eAAO,MAAM,iBAAiB,uDAI7B,CAAC"}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { EventEmitter, type EventParameters } from "@workglow/util";
|
|
7
|
-
import { IteratorTask } from "../common";
|
|
8
7
|
import { TaskOutputRepository } from "../storage/TaskOutputRepository";
|
|
9
8
|
import { GraphAsTask } from "../task/GraphAsTask";
|
|
10
9
|
import type { ITask, ITaskConstructor } from "../task/ITask";
|
|
@@ -16,32 +15,6 @@ import { IWorkflow } from "./IWorkflow";
|
|
|
16
15
|
import { TaskGraph } from "./TaskGraph";
|
|
17
16
|
import { CompoundMergeStrategy, type PropertyArrayGraphResult } from "./TaskGraphRunner";
|
|
18
17
|
export type CreateWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig> = (input?: Partial<I>, config?: Partial<C>) => Workflow<I, O>;
|
|
19
|
-
export declare function CreateWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig>(taskClass: ITaskConstructor<I, O, C>): CreateWorkflow<I, O, C>;
|
|
20
|
-
/**
|
|
21
|
-
* Type for loop workflow methods (forEach, map, batch, while, reduce).
|
|
22
|
-
* Represents the method signature with proper `this` context.
|
|
23
|
-
* Loop methods take only a config parameter - input is not used for loop tasks.
|
|
24
|
-
*/
|
|
25
|
-
export type CreateLoopWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig> = (this: Workflow<I, O>, config?: Partial<C>) => Workflow<I, O>;
|
|
26
|
-
/**
|
|
27
|
-
* Factory function that creates a loop workflow method for a given task class.
|
|
28
|
-
* Returns a method that can be assigned to Workflow.prototype.
|
|
29
|
-
*
|
|
30
|
-
* @param taskClass - The iterator task class (ForEachTask, MapTask, etc.)
|
|
31
|
-
* @returns A method that creates the task and returns a loop builder workflow
|
|
32
|
-
*/
|
|
33
|
-
export declare function CreateLoopWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig>(taskClass: ITaskConstructor<I, O, C>): CreateLoopWorkflow<I, O, C>;
|
|
34
|
-
/**
|
|
35
|
-
* Type for end loop workflow methods (endForEach, endMap, etc.).
|
|
36
|
-
*/
|
|
37
|
-
export type EndLoopWorkflow = (this: Workflow) => Workflow;
|
|
38
|
-
/**
|
|
39
|
-
* Factory function that creates an end loop workflow method.
|
|
40
|
-
*
|
|
41
|
-
* @param methodName - The name of the method (for error messages)
|
|
42
|
-
* @returns A method that finalizes the loop and returns to the parent workflow
|
|
43
|
-
*/
|
|
44
|
-
export declare function CreateEndLoopWorkflow(methodName: string): EndLoopWorkflow;
|
|
45
18
|
export type WorkflowEventListeners = {
|
|
46
19
|
changed: (id: unknown) => void;
|
|
47
20
|
reset: () => void;
|
|
@@ -56,32 +29,19 @@ export type WorkflowEventParameters<Event extends WorkflowEvents> = EventParamet
|
|
|
56
29
|
/**
|
|
57
30
|
* Class for building and managing a task graph
|
|
58
31
|
* Provides methods for adding tasks, connecting outputs to inputs, and running the task graph
|
|
59
|
-
*
|
|
60
|
-
* When used with a parent workflow (loop builder mode), this class redirects task additions
|
|
61
|
-
* to the iterator task's template graph until an end method (endMap, endForEach, etc.) is called.
|
|
62
32
|
*/
|
|
63
33
|
export declare class Workflow<Input extends DataPorts = DataPorts, Output extends DataPorts = DataPorts> implements IWorkflow<Input, Output> {
|
|
64
34
|
/**
|
|
65
35
|
* Creates a new Workflow
|
|
66
36
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param parent - Optional parent workflow (for loop builder mode)
|
|
69
|
-
* @param iteratorTask - Optional iterator task being configured (for loop builder mode)
|
|
37
|
+
* @param repository - Optional repository for task outputs
|
|
70
38
|
*/
|
|
71
|
-
constructor(
|
|
39
|
+
constructor(repository?: TaskOutputRepository);
|
|
72
40
|
private _graph;
|
|
73
41
|
private _dataFlows;
|
|
74
42
|
private _error;
|
|
75
|
-
private
|
|
43
|
+
private _repository?;
|
|
76
44
|
private _abortController?;
|
|
77
|
-
private readonly _parentWorkflow?;
|
|
78
|
-
private readonly _iteratorTask?;
|
|
79
|
-
outputCache(): TaskOutputRepository | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Whether this workflow is in loop builder mode.
|
|
82
|
-
* When true, tasks are added to the template graph for an iterator task.
|
|
83
|
-
*/
|
|
84
|
-
get isLoopBuilder(): boolean;
|
|
85
45
|
/**
|
|
86
46
|
* Event emitter for task graph events
|
|
87
47
|
*/
|
|
@@ -186,56 +146,10 @@ export declare class Workflow<Input extends DataPorts = DataPorts, Output extend
|
|
|
186
146
|
* Connects outputs to inputs between tasks
|
|
187
147
|
*/
|
|
188
148
|
connect(sourceTaskId: unknown, sourceTaskPortId: string, targetTaskId: unknown, targetTaskPortId: string): Workflow;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Adds a task to the workflow using the same logic as createWorkflow() helpers.
|
|
192
|
-
* Auto-generates an ID, processes pending dataflows, and auto-connects to previous tasks.
|
|
193
|
-
*
|
|
194
|
-
* @param taskClass - The task class to instantiate and add
|
|
195
|
-
* @param input - Optional input values for the task
|
|
196
|
-
* @param config - Optional configuration (id will be auto-generated if not provided)
|
|
197
|
-
* @returns The workflow for chaining
|
|
198
|
-
*/
|
|
199
|
-
addTask<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig>(taskClass: ITaskConstructor<I, O, C>, input?: Partial<I>, config?: Partial<C>): Workflow<Input, Output>;
|
|
200
|
-
/**
|
|
201
|
-
* Options for auto-connect operation.
|
|
202
|
-
*/
|
|
203
|
-
static readonly AutoConnectOptions: unique symbol;
|
|
204
|
-
/**
|
|
205
|
-
* Auto-connects two tasks based on their schemas.
|
|
206
|
-
* Uses multiple matching strategies:
|
|
207
|
-
* 1. Match by type AND port name (highest priority)
|
|
208
|
-
* 2. Match by specific type only (format, $id) for unmatched ports
|
|
209
|
-
* 3. Look back through earlier tasks for unmatched required inputs
|
|
210
|
-
*
|
|
211
|
-
* @param graph - The task graph to add dataflows to
|
|
212
|
-
* @param sourceTask - The source task to connect from
|
|
213
|
-
* @param targetTask - The target task to connect to
|
|
214
|
-
* @param options - Optional configuration for the auto-connect operation
|
|
215
|
-
* @returns Result containing matches made, any errors, and unmatched required inputs
|
|
216
|
-
*/
|
|
217
|
-
static autoConnect(graph: TaskGraph, sourceTask: ITask, targetTask: ITask, options?: {
|
|
218
|
-
/** Keys of inputs that are already provided and don't need connection */
|
|
219
|
-
readonly providedInputKeys?: Set<string>;
|
|
220
|
-
/** Earlier tasks to search for unmatched required inputs (in reverse chronological order) */
|
|
221
|
-
readonly earlierTasks?: readonly ITask[];
|
|
222
|
-
}): {
|
|
223
|
-
readonly matches: Map<string, string>;
|
|
224
|
-
readonly error?: string;
|
|
225
|
-
readonly unmatchedRequired: readonly string[];
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Finalizes the template graph and sets it on the iterator task.
|
|
229
|
-
* Only applicable in loop builder mode.
|
|
230
|
-
*/
|
|
231
|
-
finalizeTemplate(): void;
|
|
232
|
-
/**
|
|
233
|
-
* Finalizes the template graph and returns the parent workflow.
|
|
234
|
-
* Only applicable in loop builder mode.
|
|
235
|
-
*
|
|
236
|
-
* @returns The parent workflow
|
|
237
|
-
* @throws WorkflowError if not in loop builder mode
|
|
238
|
-
*/
|
|
239
|
-
finalizeAndReturn(): Workflow;
|
|
149
|
+
addTask<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig>(taskClass: ITaskConstructor<I, O, C>, input: I, config: C): ITask<I, O, C>;
|
|
240
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Helper function for backward compatibility
|
|
153
|
+
*/
|
|
154
|
+
export declare function CreateWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig = TaskConfig>(taskClass: any): CreateWorkflow<I, O, C>;
|
|
241
155
|
//# sourceMappingURL=Workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../src/task-graph/Workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../src/task-graph/Workflow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAA+B,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,qBAAqB,EAErB,KAAK,wBAAwB,EAC9B,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,IAAI,CAC3F,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,MAA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MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,QAAQ;IAkC3E,WAAW,IAAI,SAAS;IAIxB,MAAM,IAAI,WAAW;IAMrB;;;;OAIG;IACI,KAAK,IAAI,QAAQ;IAcxB;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACH,OAAO,CAAC,WAAW;IASnB;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACI,OAAO,CACZ,YAAY,EAAE,OAAO,EACrB,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,OAAO,EACrB,gBAAgB,EAAE,MAAM,GACvB,QAAQ;IAuCJ,OAAO,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU,EACxF,SAAS,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACpC,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,GACR,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAMlB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,UAAU,GAAG,UAAU,EACjC,SAAS,EAAE,GAAG,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAEzC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/task-graph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.88",
|
|
5
5
|
"description": "Task graph management for Workglow, providing DAG construction, execution planning, and workflow orchestration.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@workglow/job-queue": "0.0.
|
|
40
|
-
"@workglow/storage": "0.0.
|
|
41
|
-
"@workglow/util": "0.0.
|
|
39
|
+
"@workglow/job-queue": "0.0.88",
|
|
40
|
+
"@workglow/storage": "0.0.88",
|
|
41
|
+
"@workglow/util": "0.0.88"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@workglow/job-queue": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@workglow/job-queue": "0.0.
|
|
56
|
-
"@workglow/storage": "0.0.
|
|
57
|
-
"@workglow/util": "0.0.
|
|
55
|
+
"@workglow/job-queue": "0.0.88",
|
|
56
|
+
"@workglow/storage": "0.0.88",
|
|
57
|
+
"@workglow/util": "0.0.88"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/dist/task/BatchTask.d.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { type DataPortSchema } from "@workglow/util";
|
|
7
|
-
import { IteratorTask, IteratorTaskConfig } from "./IteratorTask";
|
|
8
|
-
import type { TaskInput, TaskOutput, TaskTypeName } from "./TaskTypes";
|
|
9
|
-
/**
|
|
10
|
-
* Configuration for BatchTask.
|
|
11
|
-
*/
|
|
12
|
-
export interface BatchTaskConfig extends IteratorTaskConfig {
|
|
13
|
-
/**
|
|
14
|
-
* Number of items per batch.
|
|
15
|
-
* @default 10
|
|
16
|
-
*/
|
|
17
|
-
readonly batchSize?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to flatten results from all batches into a single array.
|
|
20
|
-
* When false, results are grouped by batch.
|
|
21
|
-
* @default true
|
|
22
|
-
*/
|
|
23
|
-
readonly flattenResults?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Whether to execute batches in parallel or sequentially.
|
|
26
|
-
* @default "sequential"
|
|
27
|
-
*/
|
|
28
|
-
readonly batchExecutionMode?: "parallel" | "sequential";
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* BatchTask processes an array in configurable chunks/batches.
|
|
32
|
-
*
|
|
33
|
-
* This task is useful for:
|
|
34
|
-
* - Rate-limited API calls that accept multiple items
|
|
35
|
-
* - Memory-constrained processing
|
|
36
|
-
* - Progress tracking at batch granularity
|
|
37
|
-
*
|
|
38
|
-
* ## Features
|
|
39
|
-
*
|
|
40
|
-
* - Groups array into chunks of batchSize
|
|
41
|
-
* - Runs inner workflow per batch (receives array of items)
|
|
42
|
-
* - Configurable batch and within-batch execution
|
|
43
|
-
* - Optional result flattening
|
|
44
|
-
*
|
|
45
|
-
* ## Usage
|
|
46
|
-
*
|
|
47
|
-
* ```typescript
|
|
48
|
-
* // Process in batches of 10
|
|
49
|
-
* workflow
|
|
50
|
-
* .input({ documents: [...100 docs...] })
|
|
51
|
-
* .batch({ batchSize: 10 })
|
|
52
|
-
* .bulkEmbed()
|
|
53
|
-
* .bulkStore()
|
|
54
|
-
* .endBatch()
|
|
55
|
-
*
|
|
56
|
-
* // Sequential batches for rate limiting
|
|
57
|
-
* workflow
|
|
58
|
-
* .batch({ batchSize: 5, batchExecutionMode: "sequential" })
|
|
59
|
-
* .apiCall()
|
|
60
|
-
* .endBatch()
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @template Input - The input type containing the array to batch
|
|
64
|
-
* @template Output - The output type (collected batch results)
|
|
65
|
-
* @template Config - The configuration type
|
|
66
|
-
*/
|
|
67
|
-
export declare class BatchTask<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput, Config extends BatchTaskConfig = BatchTaskConfig> extends IteratorTask<Input, Output, Config> {
|
|
68
|
-
static type: TaskTypeName;
|
|
69
|
-
static category: string;
|
|
70
|
-
static title: string;
|
|
71
|
-
static description: string;
|
|
72
|
-
/**
|
|
73
|
-
* BatchTask always uses PROPERTY_ARRAY merge strategy.
|
|
74
|
-
*/
|
|
75
|
-
static readonly compoundMerge: "PROPERTY_ARRAY";
|
|
76
|
-
/**
|
|
77
|
-
* Static input schema for BatchTask.
|
|
78
|
-
*/
|
|
79
|
-
static inputSchema(): DataPortSchema;
|
|
80
|
-
/**
|
|
81
|
-
* Static output schema for BatchTask.
|
|
82
|
-
*/
|
|
83
|
-
static outputSchema(): DataPortSchema;
|
|
84
|
-
/**
|
|
85
|
-
* Gets the batch size.
|
|
86
|
-
*/
|
|
87
|
-
get batchSize(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Whether to flatten results from all batches.
|
|
90
|
-
*/
|
|
91
|
-
get flattenResults(): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Batch execution mode.
|
|
94
|
-
*/
|
|
95
|
-
get batchExecutionMode(): "parallel" | "sequential";
|
|
96
|
-
/**
|
|
97
|
-
* Override to group items into batches instead of individual items.
|
|
98
|
-
*/
|
|
99
|
-
protected getIterableItems(input: Input): unknown[];
|
|
100
|
-
/**
|
|
101
|
-
* Groups items into batches of batchSize.
|
|
102
|
-
*/
|
|
103
|
-
protected groupIntoBatches(items: unknown[]): unknown[][];
|
|
104
|
-
/**
|
|
105
|
-
* Creates iteration tasks for batches.
|
|
106
|
-
* Each batch receives the array of items for that batch.
|
|
107
|
-
*/
|
|
108
|
-
protected createIterationTasks(batches: unknown[]): void;
|
|
109
|
-
/**
|
|
110
|
-
* Returns the empty result for BatchTask.
|
|
111
|
-
*/
|
|
112
|
-
protected getEmptyResult(): Output;
|
|
113
|
-
/**
|
|
114
|
-
* Output schema for BatchTask.
|
|
115
|
-
* Similar to MapTask - wraps inner outputs in arrays.
|
|
116
|
-
*/
|
|
117
|
-
outputSchema(): DataPortSchema;
|
|
118
|
-
/**
|
|
119
|
-
* Collects and optionally flattens results from all batches.
|
|
120
|
-
*/
|
|
121
|
-
protected collectResults(results: TaskOutput[]): Output;
|
|
122
|
-
/**
|
|
123
|
-
* Regenerates the graph for batch execution.
|
|
124
|
-
*/
|
|
125
|
-
regenerateGraph(): void;
|
|
126
|
-
}
|
|
127
|
-
declare module "../task-graph/Workflow" {
|
|
128
|
-
interface Workflow {
|
|
129
|
-
/**
|
|
130
|
-
* Starts a batch loop that processes arrays in chunks.
|
|
131
|
-
* Use .endBatch() to close the loop and return to the parent workflow.
|
|
132
|
-
*
|
|
133
|
-
* @param config - Configuration for the batch loop
|
|
134
|
-
* @returns A Workflow in loop builder mode for defining the batch processing
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```typescript
|
|
138
|
-
* workflow
|
|
139
|
-
* .batch({ batchSize: 10 })
|
|
140
|
-
* .bulkProcess()
|
|
141
|
-
* .endBatch()
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
batch: CreateLoopWorkflow<TaskInput, TaskOutput, BatchTaskConfig>;
|
|
145
|
-
/**
|
|
146
|
-
* Ends the batch loop and returns to the parent workflow.
|
|
147
|
-
* Only callable on workflows in loop builder mode.
|
|
148
|
-
*
|
|
149
|
-
* @returns The parent workflow
|
|
150
|
-
*/
|
|
151
|
-
endBatch(): Workflow;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=BatchTask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BatchTask.d.ts","sourceRoot":"","sources":["../../src/task/BatchTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW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AEG;cACgB,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM;IAqBhE;;OAEG;IACa,eAAe,IAAI,IAAI;CAqBxC;AAMD,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAU,QAAQ;QAChB;;;;;;;;;;;;;;WAcG;QAEH,KAAK,EAAE,kBAAkB,CAAC,SAAS,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAElE;;;;;WAKG;QACH,QAAQ,IAAI,QAAQ,CAAC;KACtB;CACF"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import type { DataPortSchema } from "@workglow/util";
|
|
7
|
-
import { IteratorTask, IteratorTaskConfig } from "./IteratorTask";
|
|
8
|
-
import type { TaskInput, TaskOutput, TaskTypeName } from "./TaskTypes";
|
|
9
|
-
/**
|
|
10
|
-
* Configuration for ForEachTask.
|
|
11
|
-
*/
|
|
12
|
-
export interface ForEachTaskConfig extends IteratorTaskConfig {
|
|
13
|
-
/**
|
|
14
|
-
* Whether to collect and return results from each iteration.
|
|
15
|
-
* When false (default), ForEachTask is optimized for side effects.
|
|
16
|
-
* When true, results are collected but not transformed.
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
readonly shouldCollectResults?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* ForEachTask iterates over an array and runs a workflow for each element.
|
|
23
|
-
*
|
|
24
|
-
* This task is optimized for side-effect operations where the primary goal
|
|
25
|
-
* is to process each item rather than collect transformed results.
|
|
26
|
-
* For transformations that collect results, use MapTask instead.
|
|
27
|
-
*
|
|
28
|
-
* ## Features
|
|
29
|
-
*
|
|
30
|
-
* - Iterates over array input
|
|
31
|
-
* - Runs inner workflow for each element
|
|
32
|
-
* - Configurable execution modes (parallel, sequential, etc.)
|
|
33
|
-
* - Optimized for side effects (default: doesn't collect results)
|
|
34
|
-
*
|
|
35
|
-
* ## Usage
|
|
36
|
-
*
|
|
37
|
-
* ```typescript
|
|
38
|
-
* // Using Workflow API
|
|
39
|
-
* workflow
|
|
40
|
-
* .input({ items: ["a", "b", "c"] })
|
|
41
|
-
* .forEach()
|
|
42
|
-
* .processItem()
|
|
43
|
-
* .saveToDatabase()
|
|
44
|
-
* .endForEach()
|
|
45
|
-
*
|
|
46
|
-
* // With sequential execution
|
|
47
|
-
* workflow
|
|
48
|
-
* .forEach({ executionMode: "sequential" })
|
|
49
|
-
* .processItem()
|
|
50
|
-
* .endForEach()
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @template Input - The input type containing the array to iterate
|
|
54
|
-
* @template Output - The output type (typically empty for side-effect operations)
|
|
55
|
-
* @template Config - The configuration type
|
|
56
|
-
*/
|
|
57
|
-
export declare class ForEachTask<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput, Config extends ForEachTaskConfig = ForEachTaskConfig> extends IteratorTask<Input, Output, Config> {
|
|
58
|
-
static type: TaskTypeName;
|
|
59
|
-
static category: string;
|
|
60
|
-
static title: string;
|
|
61
|
-
static description: string;
|
|
62
|
-
/**
|
|
63
|
-
* Static input schema for ForEachTask.
|
|
64
|
-
* Accepts any object with at least one array property.
|
|
65
|
-
*/
|
|
66
|
-
static inputSchema(): DataPortSchema;
|
|
67
|
-
/**
|
|
68
|
-
* Static output schema for ForEachTask.
|
|
69
|
-
* By default, returns an empty object (side-effect focused).
|
|
70
|
-
*/
|
|
71
|
-
static outputSchema(): DataPortSchema;
|
|
72
|
-
/**
|
|
73
|
-
* Whether to collect results from iterations.
|
|
74
|
-
*/
|
|
75
|
-
get shouldCollectResults(): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Returns the empty result for ForEachTask.
|
|
78
|
-
* Indicates completion with zero items processed.
|
|
79
|
-
*/
|
|
80
|
-
protected getEmptyResult(): Output;
|
|
81
|
-
/**
|
|
82
|
-
* Output schema for ForEachTask instance.
|
|
83
|
-
* If shouldCollectResults is enabled, wraps inner output in arrays.
|
|
84
|
-
* Otherwise, returns the simple completion status schema.
|
|
85
|
-
*/
|
|
86
|
-
outputSchema(): DataPortSchema;
|
|
87
|
-
/**
|
|
88
|
-
* Collects results from all iterations.
|
|
89
|
-
* For ForEachTask, this primarily returns completion status.
|
|
90
|
-
*/
|
|
91
|
-
protected collectResults(results: TaskOutput[]): Output;
|
|
92
|
-
}
|
|
93
|
-
declare module "../task-graph/Workflow" {
|
|
94
|
-
interface Workflow {
|
|
95
|
-
/**
|
|
96
|
-
* Starts a forEach loop that iterates over an array.
|
|
97
|
-
* Use .endForEach() to close the loop and return to the parent workflow.
|
|
98
|
-
*
|
|
99
|
-
* @param config - Configuration for the forEach loop
|
|
100
|
-
* @returns A Workflow in loop builder mode for defining the loop body
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* workflow
|
|
105
|
-
* .forEach({ executionMode: "sequential" })
|
|
106
|
-
* .processItem()
|
|
107
|
-
* .endForEach()
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
forEach: CreateLoopWorkflow<TaskInput, TaskOutput, ForEachTaskConfig>;
|
|
111
|
-
/**
|
|
112
|
-
* Ends the forEach loop and returns to the parent workflow.
|
|
113
|
-
* Only callable on workflows in loop builder mode.
|
|
114
|
-
*
|
|
115
|
-
* @returns The parent workflow
|
|
116
|
-
*/
|
|
117
|
-
endForEach(): Workflow;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=ForEachTask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ForEachTask.d.ts","sourceRoot":"","sources":["../../src/task/ForEachTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAM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