2c34e1fb8a
https://github.com/user-attachments/assets/d6c565eb-9a29-4830-9396-5f979c8caa7b - Added a new component for manual trigger (mostly duplicated from previous one). Will remove the old one once all data are migrated - Updated schema output so the current item of the iterator can be typed Todo left: - migrate old triggers - add an util to search iterator output. Today current item fields will be displayed as not found - set new manual triggers for workflow runs
33 lines
792 B
TypeScript
33 lines
792 B
TypeScript
import { isDefined } from '@/utils';
|
|
import { CAPTURE_ALL_VARIABLE_TAG_INNER_REGEX } from '../constants/CaptureAllVariableTagInnerRegex';
|
|
|
|
export const extractRawVariableNamePart = ({
|
|
rawVariableName,
|
|
part,
|
|
}: {
|
|
rawVariableName: string;
|
|
part: 'stepId' | 'selectedField';
|
|
}) => {
|
|
const variableWithoutBrackets = rawVariableName.replace(
|
|
CAPTURE_ALL_VARIABLE_TAG_INNER_REGEX,
|
|
(_, variableName) => {
|
|
return variableName;
|
|
},
|
|
);
|
|
|
|
const parts = variableWithoutBrackets.split('.');
|
|
|
|
const extractedPart =
|
|
part === 'stepId'
|
|
? parts[0]
|
|
: part === 'selectedField'
|
|
? parts[parts.length - 1]
|
|
: null;
|
|
|
|
if (!isDefined(extractedPart)) {
|
|
throw new Error('Expected to find at least one splitted chunk.');
|
|
}
|
|
|
|
return extractedPart;
|
|
};
|