@workglow/task-graph 0.0.123 → 0.0.124

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/node.js CHANGED
@@ -948,7 +948,8 @@ class TaskRunner {
948
948
  this.task.setInput(overrides);
949
949
  const schema = this.task.constructor.inputSchema();
950
950
  this.task.runInputData = await resolveSchemaInputs(this.task.runInputData, schema, { registry: this.registry });
951
- const isValid = await this.task.validateInput(this.task.runInputData);
951
+ const inputs = this.task.runInputData;
952
+ const isValid = await this.task.validateInput(inputs);
952
953
  if (!isValid) {
953
954
  throw new TaskInvalidInputError("Invalid input data");
954
955
  }
@@ -956,7 +957,6 @@ class TaskRunner {
956
957
  await this.handleAbort();
957
958
  throw new TaskAbortedError("Promise for task created and aborted before run");
958
959
  }
959
- const inputs = this.task.runInputData;
960
960
  let outputs;
961
961
  const isStreamable = isTaskStreamable(this.task);
962
962
  if (this.task.cacheable) {
@@ -1001,11 +1001,12 @@ class TaskRunner {
1001
1001
  this.task.runInputData = await resolveSchemaInputs(this.task.runInputData, schema, { registry: this.registry });
1002
1002
  await this.handleStartReactive();
1003
1003
  try {
1004
- const isValid = await this.task.validateInput(this.task.runInputData);
1004
+ const inputs = this.task.runInputData;
1005
+ const isValid = await this.task.validateInput(inputs);
1005
1006
  if (!isValid) {
1006
1007
  throw new TaskInvalidInputError("Invalid input data");
1007
1008
  }
1008
- const resultReactive = await this.executeTaskReactive(this.task.runInputData, this.task.runOutputData);
1009
+ const resultReactive = await this.executeTaskReactive(inputs, this.task.runOutputData);
1009
1010
  this.task.runOutputData = resultReactive;
1010
1011
  await this.handleCompleteReactive();
1011
1012
  } catch (err) {
@@ -1198,7 +1199,7 @@ class TaskRunner {
1198
1199
  this.task.emit("start");
1199
1200
  this.task.emit("status", this.task.status);
1200
1201
  }
1201
- updateProgress = async (task, progress, message, ...args) => {};
1202
+ updateProgress = async (_task, _progress, _message, ..._args) => {};
1202
1203
  async handleStartReactive() {
1203
1204
  this.reactiveRunning = true;
1204
1205
  }
@@ -1306,11 +1307,7 @@ var init_TaskRunner = __esm(() => {
1306
1307
 
1307
1308
  // src/task/Task.ts
1308
1309
  import { compileSchema } from "@workglow/util/schema";
1309
- import {
1310
- deepEqual,
1311
- EventEmitter as EventEmitter3,
1312
- uuid4 as uuid42
1313
- } from "@workglow/util";
1310
+ import { deepEqual, EventEmitter as EventEmitter3, uuid4 as uuid42 } from "@workglow/util";
1314
1311
 
1315
1312
  class Task {
1316
1313
  static type = "Task";
@@ -1677,6 +1674,9 @@ class Task {
1677
1674
  return this.constructor.getInputSchemaNode();
1678
1675
  }
1679
1676
  async validateInput(input) {
1677
+ if (typeof input !== "object" || input === null) {
1678
+ throw new TaskInvalidInputError("Input must be an object");
1679
+ }
1680
1680
  const ctor = this.constructor;
1681
1681
  let schemaNode;
1682
1682
  if (ctor.hasDynamicSchemas) {
@@ -6916,4 +6916,4 @@ export {
6916
6916
  ConditionalTask
6917
6917
  };
6918
6918
 
6919
- //# debugId=411C07B0A5E826F264756E2164756E21
6919
+ //# debugId=E5A646FA7909390A64756E2164756E21