diff --git a/src/sdk/builders/tasks/__tests__/newBuilders.test.ts b/src/sdk/builders/tasks/__tests__/newBuilders.test.ts index 391f7b0a..7ea2b2eb 100644 --- a/src/sdk/builders/tasks/__tests__/newBuilders.test.ts +++ b/src/sdk/builders/tasks/__tests__/newBuilders.test.ts @@ -5,6 +5,7 @@ import { humanTask } from "../humanTask"; import { httpPollTask } from "../httpPoll"; import { waitForWebhookTask } from "../waitForWebhook"; import { getDocumentTask } from "../getDocument"; +import { exclusiveJoinTask } from "../exclusiveJoin"; describe("startWorkflowTask", () => { it("Should generate a startWorkflow task with minimal args", () => { @@ -448,3 +449,24 @@ describe("getDocumentTask", () => { }); }); }); + +describe("exclusiveJoinTask", () => { + it("Should generate an exclusiveJoin task", () => { + const result = exclusiveJoinTask("exJoin", ["caseA", "caseB"]); + expect(result).toEqual({ + name: "exJoin", + taskReferenceName: "exJoin", + type: "EXCLUSIVE_JOIN", + joinOn: ["caseA", "caseB"], + defaultExclusiveJoinTask: undefined, + inputParameters: {}, + optional: undefined, + }); + }); + + it("Should set defaultExclusiveJoinTask and optional", () => { + const result = exclusiveJoinTask("exJoin", ["caseA"], ["defaultTask"], true); + expect(result.defaultExclusiveJoinTask).toEqual(["defaultTask"]); + expect(result.optional).toBe(true); + }); +}); diff --git a/src/sdk/builders/tasks/exclusiveJoin.ts b/src/sdk/builders/tasks/exclusiveJoin.ts new file mode 100644 index 00000000..3060196b --- /dev/null +++ b/src/sdk/builders/tasks/exclusiveJoin.ts @@ -0,0 +1,17 @@ +import type { WorkflowTask } from "../../../open-api"; +import { TaskType } from "../../../open-api"; + +export const exclusiveJoinTask = ( + taskReferenceName: string, + joinOn: string[], + defaultExclusiveJoinTask?: string[], + optional?: boolean +): WorkflowTask => ({ + name: taskReferenceName, + taskReferenceName, + type: TaskType.EXCLUSIVE_JOIN, + joinOn, + defaultExclusiveJoinTask, + inputParameters: {}, + optional, +}); diff --git a/src/sdk/builders/tasks/index.ts b/src/sdk/builders/tasks/index.ts index 2b296a95..8ef37ecb 100644 --- a/src/sdk/builders/tasks/index.ts +++ b/src/sdk/builders/tasks/index.ts @@ -2,6 +2,7 @@ export * from "./doWhile"; export * from "./dynamic"; export * from "./dynamicFork"; export * from "./event"; +export * from "./exclusiveJoin"; export * from "./forkJoin"; export * from "./getDocument"; export * from "./http";