@workglow/tasks 0.0.100 → 0.0.102

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 CHANGED
@@ -35,8 +35,8 @@ import { Workflow, fetch, debugLog, delay } from "@workglow/tasks";
35
35
  // Simple workflow example (fluent API)
36
36
  const workflow = new Workflow()
37
37
  .fetch({ url: "https://api.example.com/data", response_type: "json" })
38
- .debugLog({ log_level: "info" })
39
- .delay({ delay: 1000 });
38
+ .debugLog(undefined, { log_level: "info" })
39
+ .delay(undefined, { delay: 1000 });
40
40
 
41
41
  const results = await workflow.run();
42
42
  ```
@@ -50,12 +50,9 @@ const fetchResult = await new FetchUrlTask({
50
50
  response_type: "json",
51
51
  }).run();
52
52
 
53
- await new DebugLogTask({
54
- console: fetchResult.json,
55
- log_level: "info",
56
- }).run();
53
+ await new DebugLogTask({ console: fetchResult.json }, { log_level: "info" }).run();
57
54
 
58
- await new DelayTask({ delay: 1000 }).run();
55
+ await new DelayTask({}, { delay: 1000 }).run();
59
56
  ```
60
57
 
61
58
  ```typescript
@@ -65,10 +62,7 @@ const data = await fetch({
65
62
  url: "https://example.com/readme.txt",
66
63
  response_type: "text",
67
64
  });
68
- await debugLog({
69
- console: data.text,
70
- log_level: "info",
71
- });
65
+ await debugLog({ console: data.text }, { log_level: "info" });
72
66
  ```
73
67
 
74
68
  ## Available Tasks
@@ -138,33 +132,33 @@ Provides console logging functionality with multiple log levels for debugging ta
138
132
 
139
133
  **Input Schema:**
140
134
 
141
- - `console` (any, optional): The message/data to log
135
+ - Any inputs are accepted and passed through to outputs unchanged.
136
+
137
+ **Config Schema:**
138
+
142
139
  - `log_level` (string, optional): Log level ("dir", "log", "debug", "info", "warn", "error"). Default: "log"
143
140
 
144
141
  **Output Schema:**
145
142
 
146
- - `console` (any): The logged message (passed through)
143
+ - All inputs passed through unchanged.
147
144
 
148
145
  **Examples:**
149
146
 
150
147
  ```typescript
151
148
  // Basic logging
152
- await new DebugLogTask({
153
- console: "Processing user data",
154
- log_level: "info",
155
- }).run();
149
+ await new DebugLogTask({ console: "Processing user data" }, { log_level: "info" }).run();
156
150
 
157
151
  // Object inspection with dir
158
- await new DebugLogTask({
159
- console: { user: { id: 1, name: "John" }, status: "active" },
160
- log_level: "dir",
161
- }).run();
152
+ await new DebugLogTask(
153
+ { console: { user: { id: 1, name: "John" }, status: "active" } },
154
+ { log_level: "dir" }
155
+ ).run();
162
156
 
163
157
  // In workflow with data flow
164
158
  const workflow = new Workflow()
165
159
  .fetch({ url: "https://api.example.com/data" })
166
- .debugLog({ log_level: "dir" }) // Logs the fetched data
167
- .delay({ delay: 1000 });
160
+ .debugLog(undefined, { log_level: "dir" }) // Logs the fetched data
161
+ .delay(undefined, { delay: 1000 });
168
162
  ```
169
163
 
170
164
  **Features:**
@@ -180,31 +174,34 @@ Introduces timed delays in workflows with progress tracking and cancellation sup
180
174
 
181
175
  **Input Schema:**
182
176
 
177
+ - Any inputs are accepted and passed through to outputs unchanged.
178
+
179
+ **Config Schema:**
180
+
183
181
  - `delay` (number, optional): Delay duration in milliseconds. Default: 1
184
- - `pass_through` (any, optional): Data to pass through to the output
185
182
 
186
183
  **Output Schema:**
187
184
 
188
- - Returns the `pass_through` data unchanged
185
+ - All inputs passed through unchanged.
189
186
 
190
187
  **Examples:**
191
188
 
192
189
  ```typescript
193
190
  // Simple delay
194
- await Delay({ delay: 5000 }); // 5 second delay
191
+ await new DelayTask({}, { delay: 5000 }).run(); // 5 second delay
195
192
 
196
193
  // Delay with data pass-through
197
- const result = await new DelayTask({
198
- delay: 3000,
199
- pass_through: { message: "Data preserved through delay" },
200
- }).run();
194
+ const result = await new DelayTask(
195
+ { message: "Data preserved through delay" },
196
+ { delay: 3000 }
197
+ ).run();
201
198
  console.log(result); // { message: "Data preserved through delay" }
202
199
 
203
200
  // In workflow
204
201
  const workflow = new Workflow()
205
202
  .fetch({ url: "https://api.example.com/data" })
206
- .delay({ delay: 2000 }) // 2 second delay
207
- .debugLog({ log_level: "info" });
203
+ .delay(undefined, { delay: 2000 }) // 2 second delay
204
+ .debugLog(undefined, { log_level: "info" });
208
205
  ```
209
206
 
210
207
  **Features:**
@@ -212,7 +209,7 @@ const workflow = new Workflow()
212
209
  - Progress tracking for delays over 100ms
213
210
  - Cancellation support via AbortSignal
214
211
  - Chunked delay execution for responsiveness
215
- - Data pass-through capability
212
+ - All inputs passed through to outputs
216
213
 
217
214
  ### JavaScriptTask
218
215
 
@@ -413,9 +410,7 @@ const linearWorkflow = await new JsonTask({
413
410
  {
414
411
  id: "log-data",
415
412
  type: "DebugLogTask",
416
- input: {
417
- log_level: "info",
418
- },
413
+ config: { log_level: "info" },
419
414
  dependencies: {
420
415
  console: { id: "fetch-data", output: "json" },
421
416
  },
@@ -423,7 +418,7 @@ const linearWorkflow = await new JsonTask({
423
418
  {
424
419
  id: "delay",
425
420
  type: "DelayTask",
426
- input: { delay: 1000 },
421
+ config: { delay: 1000 },
427
422
  },
428
423
  ]),
429
424
  }).run();
@@ -470,7 +465,7 @@ const complexWorkflow = await new JsonTask({
470
465
  {
471
466
  id: "log-result",
472
467
  type: "DebugLogTask",
473
- input: { log_level: "dir" },
468
+ config: { log_level: "dir" },
474
469
  dependencies: {
475
470
  console: { id: "combine-data", output: "output" },
476
471
  },
@@ -583,8 +578,8 @@ const workflow = new Workflow()
583
578
  .javaScript({
584
579
  code: "return input.json.filter(item => item.status === 'active');",
585
580
  })
586
- .debugLog({ log_level: "info" })
587
- .delay({ delay: 500 })
581
+ .debugLog(undefined, { log_level: "info" })
582
+ .delay(undefined, { delay: 500 })
588
583
  .lambda(
589
584
  {},
590
585
  {