File size: 646 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 { isNonEmptyArray, isObject } from '@sniptt/guards';

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

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

  return (
    step.type === WorkflowActionType.ITERATOR &&
    isObject(input) &&
    'initialLoopStepIds' in input &&
    isNonEmptyArray(input.initialLoopStepIds)
  );
};