Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/open-api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export enum TaskType {
CALL_MCP_TOOL = "CALL_MCP_TOOL",
LIST_MCP_TOOLS = "LIST_MCP_TOOLS",
PULL_WORKFLOW_MESSAGES = "PULL_WORKFLOW_MESSAGES",
NOOP = "NOOP",
}

export enum ServiceType {
Expand All @@ -102,7 +103,8 @@ export type TaskDefTypes =
| TerminateTaskDef
| JoinTaskDef
| WaitTaskDef
| PullWorkflowMessagesTaskDef;
| PullWorkflowMessagesTaskDef
| NoopTaskDef;

export interface DoWhileTaskDef extends CommonTaskDef {
inputParameters: Record<string, unknown>;
Expand Down Expand Up @@ -214,6 +216,12 @@ export interface SetVariableTaskDef extends CommonTaskDef {
optional?: boolean;
}

export interface NoopTaskDef extends CommonTaskDef {
type: TaskType.NOOP;
inputParameters: Record<string, unknown>;
optional?: boolean;
}

export interface SimpleTaskDef extends CommonTaskDef {
type: TaskType.SIMPLE;
inputParameters?: Record<string, unknown>;
Expand Down
21 changes: 21 additions & 0 deletions src/sdk/builders/tasks/__tests__/factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { inlineTask } from "../inline";
import { joinTask } from "../join";
import { jsonJqTask } from "../jsonJq";
import { kafkaPublishTask } from "../kafkaPublish";
import { noopTask } from "../noop";
import { setVariableTask } from "../setVariable";
import { subWorkflowTask } from "../subWorkflow";
import { switchTask } from "../switch";
Expand Down Expand Up @@ -269,6 +270,26 @@ describe("kafkaPublishTask", () => {
});
});

describe("noopTask", () => {
it("Should generate a NOOP task", () => {
expect(noopTask("noopRef")).toEqual({
name: "noopRef",
taskReferenceName: "noopRef",
type: "NOOP",
inputParameters: {},
});
});

it("Should set optional when given", () => {
expect(noopTask("noopRef", true).optional).toBe(true);
});

it("Should be usable as a workflow task", () => {
const wf = workflow("wf", [noopTask("noopRef")]);
expect(wf.tasks[0].type).toBe("NOOP");
});
});

describe("setVariableTask", () => {
it("Should generate setVariableTask", () => {
const tname = "setVariableTask";
Expand Down
1 change: 1 addition & 0 deletions src/sdk/builders/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from "./inline";
export * from "./join";
export * from "./jsonJq";
export * from "./kafkaPublish";
export * from "./noop";
export * from "./setVariable";
export * from "./simple";
export * from "./startWorkflow";
Expand Down
12 changes: 12 additions & 0 deletions src/sdk/builders/tasks/noop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { TaskType, NoopTaskDef } from "../../../open-api";

export const noopTask = (
taskReferenceName: string,
optional?: boolean
): NoopTaskDef => ({
name: taskReferenceName,
taskReferenceName,
type: TaskType.NOOP,
inputParameters: {},
optional,
});