@workglow/tasks 0.0.78 → 0.0.80
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 +34 -34
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +143 -36
- package/dist/index.js.map +11 -9
- package/dist/task/DebugLogTask.d.ts +2 -2
- package/dist/task/DelayTask.d.ts +2 -2
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/{FetchTask.d.ts → FetchUrlTask.d.ts} +9 -9
- package/dist/task/FetchUrlTask.d.ts.map +1 -0
- package/dist/task/JavaScriptTask.d.ts +2 -2
- package/dist/task/JsonTask.d.ts +2 -2
- package/dist/task/LambdaTask.d.ts +3 -3
- package/dist/task/LambdaTask.d.ts.map +1 -1
- package/dist/task/MergeTask.d.ts +74 -0
- package/dist/task/MergeTask.d.ts.map +1 -0
- package/dist/task/SplitTask.d.ts +74 -0
- package/dist/task/SplitTask.d.ts.map +1 -0
- package/package.json +9 -9
- package/dist/task/FetchTask.d.ts.map +0 -1
|
@@ -80,12 +80,12 @@ export declare class DebugLogTask<Input extends DebugLogTaskInput = DebugLogTask
|
|
|
80
80
|
};
|
|
81
81
|
executeReactive(input: Input, output: Output): Promise<Output>;
|
|
82
82
|
}
|
|
83
|
-
export declare const
|
|
83
|
+
export declare const debugLog: (input: DebugLogTaskInput, config?: TaskConfig) => Promise<{
|
|
84
84
|
console?: unknown;
|
|
85
85
|
}>;
|
|
86
86
|
declare module "@workglow/task-graph" {
|
|
87
87
|
interface Workflow {
|
|
88
|
-
|
|
88
|
+
debugLog: CreateWorkflow<DebugLogTaskInput, DebugLogTaskOutput, TaskConfig>;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
export {};
|
package/dist/task/DelayTask.d.ts
CHANGED
|
@@ -61,12 +61,12 @@ export declare class DelayTask<Input extends DelayTaskInput = DelayTaskInput, Ou
|
|
|
61
61
|
*
|
|
62
62
|
* @param {delay} - The delay in milliseconds
|
|
63
63
|
*/
|
|
64
|
-
export declare const
|
|
64
|
+
export declare const delay: (input: DelayTaskInput, config?: TaskConfig) => Promise<{
|
|
65
65
|
[x: string]: unknown;
|
|
66
66
|
}>;
|
|
67
67
|
declare module "@workglow/task-graph" {
|
|
68
68
|
interface Workflow {
|
|
69
|
-
|
|
69
|
+
delay: CreateWorkflow<DelayTaskInput, DelayTaskOutput, TaskConfig>;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayTask.d.ts","sourceRoot":"","sources":["../../src/task/DelayTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DelayTask.d.ts","sourceRoot":"","sources":["../../src/task/DelayTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,eAAe,EACf,IAAI,EAEJ,UAAU,EAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAkB,UAAU,EAAS,MAAM,gBAAgB,CAAC;AAEnE,QAAA,MAAM,WAAW;;;;;;;;;;;;;;CAckB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;CAIiB,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE9D,qBAAa,SAAS,CACpB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,MAAM,SAAS,eAAe,GAAG,eAAe,EAChD,MAAM,SAAS,UAAU,GAAG,UAAU,CACtC,SAAQ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IACnC,MAAM,CAAC,QAAQ,CAAC,IAAI,eAAe;IACnC,MAAM,CAAC,QAAQ,CAAC,QAAQ,aAAa;IACrC,OAAc,KAAK,SAAW;IAC9B,OAAc,WAAW,SAAsE;IAE/F,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;IAIlB,MAAM,CAAC,YAAY;;;;;IAIb,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CAiB9E;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,cAAc,EAAE,SAAQ,UAAe;;EAGnE,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;KACpE;CACF"}
|
|
@@ -85,14 +85,14 @@ declare const outputSchema: {
|
|
|
85
85
|
};
|
|
86
86
|
readonly additionalProperties: false;
|
|
87
87
|
};
|
|
88
|
-
export type
|
|
89
|
-
export type
|
|
90
|
-
export type
|
|
88
|
+
export type FetchUrlTaskInput = FromSchema<typeof inputSchema>;
|
|
89
|
+
export type FetchUrlTaskOutput = FromSchema<typeof outputSchema>;
|
|
90
|
+
export type FetchUrlTaskConfig = JobQueueTaskConfig;
|
|
91
91
|
/**
|
|
92
92
|
* Extends the base Job class to provide custom execution functionality
|
|
93
93
|
* through a provided function.
|
|
94
94
|
*/
|
|
95
|
-
export declare class
|
|
95
|
+
export declare class FetchUrlJob<Input extends FetchUrlTaskInput = FetchUrlTaskInput, Output = FetchUrlTaskOutput> extends Job<Input, Output> {
|
|
96
96
|
constructor(config?: JobQueueTaskConfig & {
|
|
97
97
|
input: Input;
|
|
98
98
|
});
|
|
@@ -103,9 +103,9 @@ export declare class FetchJob<Input extends FetchTaskInput = FetchTaskInput, Out
|
|
|
103
103
|
execute(input: Input, context: IJobExecuteContext): Promise<Output>;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
106
|
+
* FetchUrlTask provides a task for fetching data from a URL.
|
|
107
107
|
*/
|
|
108
|
-
export declare class
|
|
108
|
+
export declare class FetchUrlTask<Input extends FetchUrlTaskInput = FetchUrlTaskInput, Output extends FetchUrlTaskOutput = FetchUrlTaskOutput, Config extends FetchUrlTaskConfig = FetchUrlTaskConfig> extends JobQueueTask<Input, Output, Config> {
|
|
109
109
|
static type: string;
|
|
110
110
|
static category: string;
|
|
111
111
|
static title: string;
|
|
@@ -204,11 +204,11 @@ export declare class FetchTask<Input extends FetchTaskInput = FetchTaskInput, Ou
|
|
|
204
204
|
setInput(input: Record<string, any>): void;
|
|
205
205
|
protected getDefaultQueueName(input: Input): Promise<string | undefined>;
|
|
206
206
|
}
|
|
207
|
-
export declare const
|
|
207
|
+
export declare const fetchUrl: (input: FetchUrlTaskInput, config?: FetchUrlTaskConfig) => Promise<FetchUrlTaskOutput>;
|
|
208
208
|
declare module "@workglow/task-graph" {
|
|
209
209
|
interface Workflow {
|
|
210
|
-
|
|
210
|
+
fetch: CreateWorkflow<FetchUrlTaskInput, FetchUrlTaskOutput, FetchUrlTaskConfig>;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
export {};
|
|
214
|
-
//# sourceMappingURL=
|
|
214
|
+
//# sourceMappingURL=FetchUrlTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUrlTask.d.ts","sourceRoot":"","sources":["../../src/task/FetchUrlTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,kBAAkB,EAKnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;CAs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,CAAC,GAAG,IAAI;cA4BjC,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAgBxF;AAID,eAAO,MAAM,QAAQ,GACnB,OAAO,iBAAiB,EACxB,SAAQ,kBAAuB,KAC9B,OAAO,CAAC,kBAAkB,CAG5B,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,KAAK,EAAE,cAAc,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;KAClF;CACF"}
|
|
@@ -66,12 +66,12 @@ export declare class JavaScriptTask extends Task<JavaScriptTaskInput, JavaScript
|
|
|
66
66
|
output: unknown;
|
|
67
67
|
}>;
|
|
68
68
|
}
|
|
69
|
-
export declare const
|
|
69
|
+
export declare const javaScript: (input: JavaScriptTaskInput, config?: TaskConfig) => Promise<{
|
|
70
70
|
output: unknown;
|
|
71
71
|
}>;
|
|
72
72
|
declare module "@workglow/task-graph" {
|
|
73
73
|
interface Workflow {
|
|
74
|
-
|
|
74
|
+
javaScript: CreateWorkflow<JavaScriptTaskInput, JavaScriptTaskOutput, TaskConfig>;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
export {};
|
package/dist/task/JsonTask.d.ts
CHANGED
|
@@ -65,12 +65,12 @@ export declare class JsonTask<Input extends JsonTaskInput = JsonTaskInput, Outpu
|
|
|
65
65
|
/**
|
|
66
66
|
* Convenience function to create and run a JsonTask
|
|
67
67
|
*/
|
|
68
|
-
export declare const
|
|
68
|
+
export declare const json: (input: JsonTaskInput, config?: TaskConfig) => Promise<{
|
|
69
69
|
output?: unknown;
|
|
70
70
|
}>;
|
|
71
71
|
declare module "@workglow/task-graph" {
|
|
72
72
|
interface Workflow {
|
|
73
|
-
|
|
73
|
+
json: CreateWorkflow<JsonTaskInput, JsonTaskOutput, TaskConfig>;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
export {};
|
|
@@ -74,11 +74,11 @@ export declare function process(value: boolean): string;
|
|
|
74
74
|
/**
|
|
75
75
|
* Convenience function to create and run a LambdaTask
|
|
76
76
|
*/
|
|
77
|
-
export declare function
|
|
78
|
-
export declare function
|
|
77
|
+
export declare function lambda<I extends TaskInput, O extends TaskOutput>(fn: (input: I, context: IExecuteContext) => Promise<O>): Promise<TaskOutput>;
|
|
78
|
+
export declare function lambda<I extends TaskInput, O extends TaskOutput>(input: I, config?: LambdaTaskConfig<I, O>): Promise<TaskOutput>;
|
|
79
79
|
declare module "@workglow/task-graph" {
|
|
80
80
|
interface Workflow {
|
|
81
|
-
|
|
81
|
+
lambda: <I extends TaskInput, O extends TaskOutput>(input: Partial<I>, config: LambdaTaskConfig<I, O>) => Workflow;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LambdaTask.d.ts","sourceRoot":"","sources":["../../src/task/LambdaTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"LambdaTask.d.ts","sourceRoot":"","sources":["../../src/task/LambdaTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,eAAe,EACf,uBAAuB,EACvB,IAAI,EACJ,UAAU,EAEV,SAAS,EACT,UAAU,EAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAkB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,UAAU,gBAAgB,CACxB,KAAK,SAAS,SAAS,GAAG,SAAS,EACnC,MAAM,SAAS,UAAU,GAAG,UAAU,CACtC,SAAQ,UAAU;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,eAAe,CAAC,EAAE,CAChB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uB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EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,GACrD,OAAO,CAAC,UAAU,CAAC,CAAC;AACvB,wBAAgB,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,EAC9D,KAAK,EAAE,CAAC,EACR,MAAM,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC9B,OAAO,CAAC,UAAU,CAAC,CAAC;AAkBvB,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,MAAM,EAAE,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,EAChD,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EACjB,MAAM,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,KAC3B,QAAQ,CAAC;KACf;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, IExecuteContext, Task, TaskConfig } from "@workglow/task-graph";
|
|
7
|
+
import { FromSchema } from "@workglow/util";
|
|
8
|
+
declare const inputSchema: {
|
|
9
|
+
readonly type: "object";
|
|
10
|
+
readonly properties: {};
|
|
11
|
+
readonly additionalProperties: true;
|
|
12
|
+
};
|
|
13
|
+
declare const outputSchema: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly output: {
|
|
17
|
+
readonly type: "array";
|
|
18
|
+
readonly title: "Merged Array";
|
|
19
|
+
readonly description: "Array containing all input values in order";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly additionalProperties: false;
|
|
23
|
+
};
|
|
24
|
+
export type MergeTaskInput = FromSchema<typeof inputSchema>;
|
|
25
|
+
export type MergeTaskOutput = FromSchema<typeof outputSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* MergeTask takes multiple inputs and merges them into a single array output.
|
|
28
|
+
* Input properties are collected and sorted by key name to create a deterministic output order.
|
|
29
|
+
* Useful for collecting results from parallel branches into a single array.
|
|
30
|
+
*
|
|
31
|
+
* Features:
|
|
32
|
+
* - Accepts any number of input properties (additionalProperties: true)
|
|
33
|
+
* - Merges all input values into a single array output
|
|
34
|
+
* - Sorts inputs by property name for consistent ordering
|
|
35
|
+
* - Output is always an array
|
|
36
|
+
*
|
|
37
|
+
* Example:
|
|
38
|
+
* Input: { input_0: "a", input_1: "b", input_2: "c" }
|
|
39
|
+
* Output: { output: ["a", "b", "c"] }
|
|
40
|
+
*/
|
|
41
|
+
export declare class MergeTask<Input extends MergeTaskInput = MergeTaskInput, Output extends MergeTaskOutput = MergeTaskOutput, Config extends TaskConfig = TaskConfig> extends Task<Input, Output, Config> {
|
|
42
|
+
static type: string;
|
|
43
|
+
static category: string;
|
|
44
|
+
static title: string;
|
|
45
|
+
static description: string;
|
|
46
|
+
static readonly cacheable = true;
|
|
47
|
+
static inputSchema(): {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly properties: {};
|
|
50
|
+
readonly additionalProperties: true;
|
|
51
|
+
};
|
|
52
|
+
static outputSchema(): {
|
|
53
|
+
readonly type: "object";
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly output: {
|
|
56
|
+
readonly type: "array";
|
|
57
|
+
readonly title: "Merged Array";
|
|
58
|
+
readonly description: "Array containing all input values in order";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly additionalProperties: false;
|
|
62
|
+
};
|
|
63
|
+
execute(input: Input, context: IExecuteContext): Promise<Output>;
|
|
64
|
+
}
|
|
65
|
+
export declare const merge: (input: MergeTaskInput, config?: TaskConfig) => Promise<{
|
|
66
|
+
output?: unknown[] | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
declare module "@workglow/task-graph" {
|
|
69
|
+
interface Workflow {
|
|
70
|
+
merge: CreateWorkflow<MergeTaskInput, MergeTaskOutput, TaskConfig>;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=MergeTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MergeTask.d.ts","sourceRoot":"","sources":["../../src/task/MergeTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,eAAe,EACf,IAAI,EACJ,UAAU,EAGX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAkB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;CAIkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;CAUiB,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAS,CACpB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,MAAM,SAAS,eAAe,GAAG,eAAe,EAChD,MAAM,SAAS,UAAU,GAAG,UAAU,CACtC,SAAQ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IACnC,OAAc,IAAI,SAAe;IACjC,OAAc,QAAQ,SAAa;IACnC,OAAc,KAAK,SAAW;IAC9B,OAAc,WAAW,SAAuD;IAChF,MAAM,CAAC,QAAQ,CAAC,SAAS,QAAQ;WAEnB,WAAW;;;;;WAIX,YAAY;;;;;;;;;;;IAIpB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CAWvE;AAID,eAAO,MAAM,KAAK,GAAI,OAAO,cAAc,EAAE,SAAQ,UAAe;;EAGnE,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;KACpE;CACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, Task, TaskConfig } from "@workglow/task-graph";
|
|
7
|
+
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
|
+
declare const inputSchema: {
|
|
9
|
+
readonly type: "object";
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly input: {
|
|
12
|
+
readonly title: "Single Input";
|
|
13
|
+
readonly description: "A single value to output";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
readonly additionalProperties: false;
|
|
17
|
+
};
|
|
18
|
+
declare const outputSchema: {
|
|
19
|
+
readonly type: "object";
|
|
20
|
+
readonly properties: {};
|
|
21
|
+
readonly additionalProperties: true;
|
|
22
|
+
};
|
|
23
|
+
export type SplitTaskInput = FromSchema<typeof inputSchema>;
|
|
24
|
+
export type SplitTaskOutput = FromSchema<typeof outputSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* SplitTask takes an array or single value as input and creates
|
|
27
|
+
* separate outputs for each element. Each output is named by its index (0, 1, 2, etc.).
|
|
28
|
+
* Useful for workflows that need to process array elements in parallel branches.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Accepts both arrays and single values as input
|
|
32
|
+
* - Creates one output per array element (output_0, output_1, etc.)
|
|
33
|
+
* - Single values are treated as a single-element array
|
|
34
|
+
* - Output count matches array length
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
* Input: { input: [1, 2, 3] }
|
|
38
|
+
* Output: { output_0: 1, output_1: 2, output_2: 3 }
|
|
39
|
+
*/
|
|
40
|
+
export declare class SplitTask<Input extends SplitTaskInput = SplitTaskInput, Output extends SplitTaskOutput = SplitTaskOutput, Config extends TaskConfig = TaskConfig> extends Task<Input, Output, Config> {
|
|
41
|
+
static type: string;
|
|
42
|
+
static category: string;
|
|
43
|
+
static title: string;
|
|
44
|
+
static description: string;
|
|
45
|
+
static hasDynamicSchemas: boolean;
|
|
46
|
+
static readonly cacheable = false;
|
|
47
|
+
static inputSchema(): {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly properties: {
|
|
50
|
+
readonly input: {
|
|
51
|
+
readonly title: "Single Input";
|
|
52
|
+
readonly description: "A single value to output";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
};
|
|
57
|
+
static outputSchema(): {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly properties: {};
|
|
60
|
+
readonly additionalProperties: true;
|
|
61
|
+
};
|
|
62
|
+
outputSchema(): DataPortSchema;
|
|
63
|
+
executeReactive(input: Input): Promise<Output>;
|
|
64
|
+
}
|
|
65
|
+
export declare const split: (input: SplitTaskInput, config?: TaskConfig) => Promise<{
|
|
66
|
+
[x: string]: unknown;
|
|
67
|
+
}>;
|
|
68
|
+
declare module "@workglow/task-graph" {
|
|
69
|
+
interface Workflow {
|
|
70
|
+
split: CreateWorkflow<SplitTaskInput, SplitTaskOutput, TaskConfig>;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=SplitTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitTask.d.ts","sourceRoot":"","sources":["../../src/task/SplitTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAA0B,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;;;;;CASkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;CAIiB,CAAC;AAEpC,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,SAAS,CACpB,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,MAAM,SAAS,eAAe,GAAG,eAAe,EAChD,MAAM,SAAS,UAAU,GAAG,UAAU,CACtC,SAAQ,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;IACnC,OAAc,IAAI,SAAe;IACjC,OAAc,QAAQ,SAAa;IACnC,OAAc,KAAK,SAAW;IAC9B,OAAc,WAAW,SACoD;IAC7E,MAAM,CAAC,iBAAiB,UAAQ;IAChC,MAAM,CAAC,QAAQ,CAAC,SAAS,SAAS;WAEpB,WAAW;;;;;;;;;;WAIX,YAAY;;;;;IAInB,YAAY,IAAI,cAAc;IAI/B,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;CAgBrD;AAID,eAAO,MAAM,KAAK,GAAI,OAAO,cAAc,EAAE,SAAQ,UAAe;;EAGnE,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;KACpE;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/tasks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.80",
|
|
5
5
|
"description": "Pre-built task implementations for Workglow, including common AI operations and utility functions.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"watch": "concurrently -c 'auto' 'bun:watch-*'",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@workglow/task-graph": "0.0.
|
|
34
|
-
"@workglow/util": "0.0.
|
|
35
|
-
"@workglow/job-queue": "0.0.
|
|
36
|
-
"@workglow/storage": "0.0.
|
|
33
|
+
"@workglow/task-graph": "0.0.80",
|
|
34
|
+
"@workglow/util": "0.0.80",
|
|
35
|
+
"@workglow/job-queue": "0.0.80",
|
|
36
|
+
"@workglow/storage": "0.0.80"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@workglow/task-graph": {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@workglow/job-queue": "0.0.
|
|
54
|
-
"@workglow/storage": "0.0.
|
|
55
|
-
"@workglow/task-graph": "0.0.
|
|
56
|
-
"@workglow/util": "0.0.
|
|
53
|
+
"@workglow/job-queue": "0.0.80",
|
|
54
|
+
"@workglow/storage": "0.0.80",
|
|
55
|
+
"@workglow/task-graph": "0.0.80",
|
|
56
|
+
"@workglow/util": "0.0.80"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchTask.d.ts","sourceRoot":"","sources":["../../src/task/FetchTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,kBAAkB,EAKnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CkB,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