@workglow/tasks 0.0.99 → 0.0.101
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 +35 -40
- package/dist/browser.js +56 -32
- package/dist/browser.js.map +8 -8
- package/dist/bun.js +56 -32
- package/dist/bun.js.map +8 -8
- package/dist/node.js +56 -32
- package/dist/node.js.map +8 -8
- package/dist/task/DebugLogTask.d.ts +23 -49
- package/dist/task/DebugLogTask.d.ts.map +1 -1
- package/dist/task/DelayTask.d.ts +16 -29
- package/dist/task/DelayTask.d.ts.map +1 -1
- package/dist/task/InputTask.d.ts +1 -3
- package/dist/task/InputTask.d.ts.map +1 -1
- package/dist/task/LambdaTask.d.ts +36 -2
- package/dist/task/LambdaTask.d.ts.map +1 -1
- package/dist/task/OutputTask.d.ts +1 -3
- package/dist/task/OutputTask.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/node.js
CHANGED
|
@@ -1379,7 +1379,7 @@ class ArrayTask extends GraphAsTask {
|
|
|
1379
1379
|
const inputObject = Object.fromEntries(arrayInputs);
|
|
1380
1380
|
const combinations = this.generateCombinations(inputObject, inputIds);
|
|
1381
1381
|
const tasks = combinations.map((combination) => {
|
|
1382
|
-
const { id,
|
|
1382
|
+
const { id, title, ...rest } = this.config;
|
|
1383
1383
|
const task = new this.constructor({ ...this.defaults, ...this.runInputData, ...combination }, { ...rest, id: `${id}_${uuid4()}` });
|
|
1384
1384
|
return task;
|
|
1385
1385
|
});
|
|
@@ -1452,16 +1452,13 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
// src/task/DebugLogTask.ts
|
|
1455
|
-
import { CreateWorkflow as CreateWorkflow13, Task as Task11, Workflow as Workflow14 } from "@workglow/task-graph";
|
|
1455
|
+
import { CreateWorkflow as CreateWorkflow13, Task as Task11, TaskConfigSchema, Workflow as Workflow14 } from "@workglow/task-graph";
|
|
1456
1456
|
var log_levels = ["dir", "log", "debug", "info", "warn", "error"];
|
|
1457
1457
|
var DEFAULT_LOG_LEVEL = "log";
|
|
1458
|
-
var
|
|
1458
|
+
var debugLogTaskConfigSchema = {
|
|
1459
1459
|
type: "object",
|
|
1460
1460
|
properties: {
|
|
1461
|
-
|
|
1462
|
-
title: "Message",
|
|
1463
|
-
description: "The message to log"
|
|
1464
|
-
},
|
|
1461
|
+
...TaskConfigSchema["properties"],
|
|
1465
1462
|
log_level: {
|
|
1466
1463
|
type: "string",
|
|
1467
1464
|
enum: log_levels,
|
|
@@ -1472,15 +1469,15 @@ var inputSchema12 = {
|
|
|
1472
1469
|
},
|
|
1473
1470
|
additionalProperties: false
|
|
1474
1471
|
};
|
|
1472
|
+
var inputSchema12 = {
|
|
1473
|
+
type: "object",
|
|
1474
|
+
properties: {},
|
|
1475
|
+
additionalProperties: true
|
|
1476
|
+
};
|
|
1475
1477
|
var outputSchema12 = {
|
|
1476
1478
|
type: "object",
|
|
1477
|
-
properties: {
|
|
1478
|
-
|
|
1479
|
-
title: "Messages",
|
|
1480
|
-
description: "The messages logged by the task"
|
|
1481
|
-
}
|
|
1482
|
-
},
|
|
1483
|
-
additionalProperties: false
|
|
1479
|
+
properties: {},
|
|
1480
|
+
additionalProperties: true
|
|
1484
1481
|
};
|
|
1485
1482
|
|
|
1486
1483
|
class DebugLogTask extends Task11 {
|
|
@@ -1489,6 +1486,10 @@ class DebugLogTask extends Task11 {
|
|
|
1489
1486
|
static title = "Debug Log";
|
|
1490
1487
|
static description = "Logs messages to the console with configurable log levels for debugging task graphs";
|
|
1491
1488
|
static cacheable = false;
|
|
1489
|
+
static passthroughInputsToOutputs = true;
|
|
1490
|
+
static configSchema() {
|
|
1491
|
+
return debugLogTaskConfigSchema;
|
|
1492
|
+
}
|
|
1492
1493
|
static inputSchema() {
|
|
1493
1494
|
return inputSchema12;
|
|
1494
1495
|
}
|
|
@@ -1496,13 +1497,14 @@ class DebugLogTask extends Task11 {
|
|
|
1496
1497
|
return outputSchema12;
|
|
1497
1498
|
}
|
|
1498
1499
|
async executeReactive(input, output) {
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1500
|
+
const log_level = this.config.log_level ?? DEFAULT_LOG_LEVEL;
|
|
1501
|
+
const inputRecord = input;
|
|
1502
|
+
if (log_level === "dir") {
|
|
1503
|
+
console.dir(inputRecord, { depth: null });
|
|
1502
1504
|
} else {
|
|
1503
|
-
console[log_level](
|
|
1505
|
+
console[log_level](inputRecord);
|
|
1504
1506
|
}
|
|
1505
|
-
output
|
|
1507
|
+
Object.assign(output, inputRecord);
|
|
1506
1508
|
return output;
|
|
1507
1509
|
}
|
|
1508
1510
|
}
|
|
@@ -1516,24 +1518,27 @@ import {
|
|
|
1516
1518
|
CreateWorkflow as CreateWorkflow14,
|
|
1517
1519
|
Task as Task12,
|
|
1518
1520
|
TaskAbortedError as TaskAbortedError3,
|
|
1521
|
+
TaskConfigSchema as TaskConfigSchema2,
|
|
1519
1522
|
Workflow as Workflow15
|
|
1520
1523
|
} from "@workglow/task-graph";
|
|
1521
1524
|
import { sleep } from "@workglow/util";
|
|
1522
|
-
var
|
|
1525
|
+
var delayTaskConfigSchema = {
|
|
1523
1526
|
type: "object",
|
|
1524
1527
|
properties: {
|
|
1528
|
+
...TaskConfigSchema2["properties"],
|
|
1525
1529
|
delay: {
|
|
1526
1530
|
type: "number",
|
|
1527
1531
|
title: "Delay (ms)",
|
|
1528
1532
|
default: 1
|
|
1529
|
-
},
|
|
1530
|
-
pass_through: {
|
|
1531
|
-
title: "Pass Through",
|
|
1532
|
-
description: "Pass through data to the output"
|
|
1533
1533
|
}
|
|
1534
1534
|
},
|
|
1535
1535
|
additionalProperties: false
|
|
1536
1536
|
};
|
|
1537
|
+
var inputSchema13 = {
|
|
1538
|
+
type: "object",
|
|
1539
|
+
properties: {},
|
|
1540
|
+
additionalProperties: true
|
|
1541
|
+
};
|
|
1537
1542
|
var outputSchema13 = {
|
|
1538
1543
|
type: "object",
|
|
1539
1544
|
properties: {},
|
|
@@ -1545,6 +1550,11 @@ class DelayTask extends Task12 {
|
|
|
1545
1550
|
static category = "Utility";
|
|
1546
1551
|
static title = "Delay";
|
|
1547
1552
|
static description = "Delays execution for a specified duration with progress tracking";
|
|
1553
|
+
static cacheable = false;
|
|
1554
|
+
static passthroughInputsToOutputs = true;
|
|
1555
|
+
static configSchema() {
|
|
1556
|
+
return delayTaskConfigSchema;
|
|
1557
|
+
}
|
|
1548
1558
|
static inputSchema() {
|
|
1549
1559
|
return inputSchema13;
|
|
1550
1560
|
}
|
|
@@ -1552,7 +1562,7 @@ class DelayTask extends Task12 {
|
|
|
1552
1562
|
return outputSchema13;
|
|
1553
1563
|
}
|
|
1554
1564
|
async execute(input, executeContext) {
|
|
1555
|
-
const delay =
|
|
1565
|
+
const delay = this.config.delay ?? 1;
|
|
1556
1566
|
if (delay > 100) {
|
|
1557
1567
|
const iterations = Math.min(100, Math.floor(delay / 16));
|
|
1558
1568
|
const chunkSize = delay / iterations;
|
|
@@ -1566,10 +1576,10 @@ class DelayTask extends Task12 {
|
|
|
1566
1576
|
} else {
|
|
1567
1577
|
await sleep(delay);
|
|
1568
1578
|
}
|
|
1569
|
-
return input
|
|
1579
|
+
return input;
|
|
1570
1580
|
}
|
|
1571
1581
|
}
|
|
1572
|
-
var delay = (input, config = {}) => {
|
|
1582
|
+
var delay = (input, config = { delay: 1 }) => {
|
|
1573
1583
|
const task = new DelayTask({}, config);
|
|
1574
1584
|
return task.run(input);
|
|
1575
1585
|
};
|
|
@@ -1599,10 +1609,10 @@ class InputTask extends Task13 {
|
|
|
1599
1609
|
};
|
|
1600
1610
|
}
|
|
1601
1611
|
inputSchema() {
|
|
1602
|
-
return this.config?.
|
|
1612
|
+
return this.config?.inputSchema ?? this.constructor.inputSchema();
|
|
1603
1613
|
}
|
|
1604
1614
|
outputSchema() {
|
|
1605
|
-
return this.config?.
|
|
1615
|
+
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
1606
1616
|
}
|
|
1607
1617
|
async execute(input) {
|
|
1608
1618
|
return input;
|
|
@@ -6232,9 +6242,19 @@ import {
|
|
|
6232
6242
|
CreateWorkflow as CreateWorkflow18,
|
|
6233
6243
|
DATAFLOW_ALL_PORTS,
|
|
6234
6244
|
Task as Task15,
|
|
6245
|
+
TaskConfigSchema as TaskConfigSchema3,
|
|
6235
6246
|
TaskConfigurationError as TaskConfigurationError3,
|
|
6236
6247
|
Workflow as Workflow19
|
|
6237
6248
|
} from "@workglow/task-graph";
|
|
6249
|
+
var lambdaTaskConfigSchema = {
|
|
6250
|
+
type: "object",
|
|
6251
|
+
properties: {
|
|
6252
|
+
...TaskConfigSchema3["properties"],
|
|
6253
|
+
execute: {},
|
|
6254
|
+
executeReactive: {}
|
|
6255
|
+
},
|
|
6256
|
+
additionalProperties: false
|
|
6257
|
+
};
|
|
6238
6258
|
var inputSchema16 = {
|
|
6239
6259
|
type: "object",
|
|
6240
6260
|
properties: {
|
|
@@ -6262,6 +6282,9 @@ class LambdaTask extends Task15 {
|
|
|
6262
6282
|
static description = "A task that wraps a provided function and its input";
|
|
6263
6283
|
static category = "Hidden";
|
|
6264
6284
|
static cacheable = true;
|
|
6285
|
+
static configSchema() {
|
|
6286
|
+
return lambdaTaskConfigSchema;
|
|
6287
|
+
}
|
|
6265
6288
|
static inputSchema() {
|
|
6266
6289
|
return inputSchema16;
|
|
6267
6290
|
}
|
|
@@ -6374,10 +6397,10 @@ class OutputTask extends Task17 {
|
|
|
6374
6397
|
};
|
|
6375
6398
|
}
|
|
6376
6399
|
inputSchema() {
|
|
6377
|
-
return this.config?.
|
|
6400
|
+
return this.config?.inputSchema ?? this.constructor.inputSchema();
|
|
6378
6401
|
}
|
|
6379
6402
|
outputSchema() {
|
|
6380
|
-
return this.config?.
|
|
6403
|
+
return this.config?.outputSchema ?? this.constructor.outputSchema();
|
|
6381
6404
|
}
|
|
6382
6405
|
async execute(input2) {
|
|
6383
6406
|
return input2;
|
|
@@ -7734,6 +7757,7 @@ export {
|
|
|
7734
7757
|
mcpPromptGet,
|
|
7735
7758
|
mcpList,
|
|
7736
7759
|
mcpClientFactory5 as mcpClientFactory,
|
|
7760
|
+
lambdaTaskConfigSchema,
|
|
7737
7761
|
lambda,
|
|
7738
7762
|
json,
|
|
7739
7763
|
javaScript,
|
|
@@ -7782,4 +7806,4 @@ export {
|
|
|
7782
7806
|
ArrayTask
|
|
7783
7807
|
};
|
|
7784
7808
|
|
|
7785
|
-
//# debugId=
|
|
7809
|
+
//# debugId=E30DF588408576C064756E2164756E21
|