feat: add defineTrigger and defineAction
This commit is contained in:
@@ -69,7 +69,7 @@ function generateValidationSchema(substeps: ISubstep[]) {
|
||||
}
|
||||
|
||||
// if the field depends on another field, add the dependsOn required validation
|
||||
if (dependsOn?.length > 0) {
|
||||
if (Array.isArray(dependsOn) && dependsOn.length > 0) {
|
||||
for (const dependsOnKey of dependsOn) {
|
||||
const missingDependencyValueMessage = `We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ type RawOption = {
|
||||
};
|
||||
|
||||
const optionGenerator = (options: RawOption[]): IFieldDropdownOption[] => options?.map(({ name, value }) => ({ label: name as string, value: value }));
|
||||
const getOption = (options: IFieldDropdownOption[], value: string) => options?.find(option => option.value === value);
|
||||
const getOption = (options: IFieldDropdownOption[], value?: string | boolean) => options?.find(option => option.value === value);
|
||||
|
||||
export default function InputCreator(props: InputCreatorProps): React.ReactElement {
|
||||
const {
|
||||
|
@@ -4,13 +4,13 @@ import { useFormContext } from 'react-hook-form';
|
||||
import set from 'lodash/set';
|
||||
import type { UseFormReturn } from 'react-hook-form';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import type { IField, IFieldDropdown, IJSONObject } from '@automatisch/types';
|
||||
import type { IField, IFieldDropdownSource, IJSONObject } from '@automatisch/types';
|
||||
|
||||
import { GET_DATA } from 'graphql/queries/get-data';
|
||||
|
||||
const variableRegExp = /({.*?})/g;
|
||||
|
||||
function computeArguments(args: IFieldDropdown["source"]["arguments"], getValues: UseFormReturn["getValues"]): IJSONObject {
|
||||
function computeArguments(args: IFieldDropdownSource["arguments"], getValues: UseFormReturn["getValues"]): IJSONObject {
|
||||
const initialValue = {};
|
||||
return args.reduce(
|
||||
(result, { name, value }) => {
|
||||
|
Reference in New Issue
Block a user