File size: 600 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { isObject } from '@sniptt/guards';

import { WorkflowActionType } from '@/workflow/types/WorkflowActionType';
import {
  type IfElseStepInput,
  type ValidatableWorkflowStep,
} from '@/workflow/validation/types/workflow-validation.type';

export const isIfElseStepInput = (
  step: ValidatableWorkflowStep,
): step is ValidatableWorkflowStep & {
  settings: { input: Partial<IfElseStepInput> };
} => {
  const input = step.settings?.input;

  return (
    step.type === WorkflowActionType.IF_ELSE &&
    isObject(input) &&
    'branches' in input &&
    Array.isArray(input.branches)
  );
};