Summary
switchTask() hardcodes evaluatorType: "value-param". The SwitchTaskDef interface
and the server both support "javascript" as an evaluator type, but there is no way to
use a JavaScript expression for SWITCH via the builder API.
Server baseline
Conductor 3.32.0-rc.9
Evidence
// switch.ts
export const switchTask = (
taskReferenceName: string,
expression: string,
...
): SwitchTaskDef => ({
evaluatorType: "value-param", // hardcoded — no parameter to change this
inputParameters: { switchCaseValue: expression },
expression: "switchCaseValue",
...
});
But SwitchTaskDef is typed as:
evaluatorType: "value-param" | "javascript"; // server supports both
Users who need a JavaScript evaluator (arbitrary expression like
$.input.age >= 18 ? 'adult' : 'minor') must construct SwitchTaskDef manually,
bypassing the builder entirely.
Proposed fix
Add an optional evaluatorType parameter:
export const switchTask = (
taskReferenceName: string,
expression: string,
decisionCases: Record<string, TaskDefTypes[]> = {},
defaultCase: TaskDefTypes[] = [],
evaluatorType: "value-param" | "javascript" = "value-param",
optional?: boolean
): SwitchTaskDef => ({
name: taskReferenceName,
taskReferenceName,
decisionCases,
evaluatorType,
inputParameters: evaluatorType === "value-param"
? { switchCaseValue: expression }
: {},
expression: evaluatorType === "value-param" ? "switchCaseValue" : expression,
defaultCase,
type: TaskType.SWITCH,
optional,
});
Related
Discovered during systematic SDK audit against Conductor OSS 3.32.0-rc.9.
Summary
switchTask()hardcodesevaluatorType: "value-param". TheSwitchTaskDefinterfaceand the server both support
"javascript"as an evaluator type, but there is no way touse a JavaScript expression for SWITCH via the builder API.
Server baseline
Conductor 3.32.0-rc.9
Evidence
But
SwitchTaskDefis typed as:Users who need a JavaScript evaluator (arbitrary expression like
$.input.age >= 18 ? 'adult' : 'minor') must constructSwitchTaskDefmanually,bypassing the builder entirely.
Proposed fix
Add an optional
evaluatorTypeparameter:Related
Discovered during systematic SDK audit against Conductor OSS 3.32.0-rc.9.