Skip to content

Commit

Permalink
refactor: rename some types
Browse files Browse the repository at this point in the history
  • Loading branch information
Devessier committed Nov 13, 2024
1 parent 898006f commit 845f0ec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Select, SelectOption } from '@/ui/input/components/Select';
import { WorkflowEditGenericFormBase } from '@/workflow/components/WorkflowEditGenericFormBase';
import { VariableTagInput } from '@/workflow/search-variables/components/VariableTagInput';
import { workflowIdState } from '@/workflow/states/workflowIdState';
import { WorkflowSendEmailStep } from '@/workflow/types/Workflow';
import { WorkflowSendEmailAction } from '@/workflow/types/Workflow';
import { useTheme } from '@emotion/react';
import { useEffect } from 'react';
import { Controller, useForm } from 'react-hook-form';
Expand All @@ -17,13 +17,13 @@ import { useDebouncedCallback } from 'use-debounce';

type WorkflowEditActionFormSendEmailProps =
| {
action: WorkflowSendEmailStep;
action: WorkflowSendEmailAction;
readonly: true;
}
| {
action: WorkflowSendEmailStep;
action: WorkflowSendEmailAction;
readonly?: false;
onActionUpdate: (action: WorkflowSendEmailStep) => void;
onActionUpdate: (action: WorkflowSendEmailAction) => void;
};

type SendEmailFormData = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ReactNode } from 'react';
import styled from '@emotion/styled';
import { useGetManyServerlessFunctions } from '@/settings/serverless-functions/hooks/useGetManyServerlessFunctions';
import { setNestedValue } from '@/workflow/utils/setNestedValue';
import { Select, SelectOption } from '@/ui/input/components/Select';
import { WorkflowEditGenericFormBase } from '@/workflow/components/WorkflowEditGenericFormBase';
import VariableTagInput from '@/workflow/search-variables/components/VariableTagInput';
import { WorkflowCodeStep } from '@/workflow/types/Workflow';
import { useTheme } from '@emotion/react';
import { IconCode, isDefined, HorizontalSeparator } from 'twenty-ui';
import { useDebouncedCallback } from 'use-debounce';
import { getDefaultFunctionInputFromInputSchema } from '@/workflow/utils/getDefaultFunctionInputFromInputSchema';
import { FunctionInput } from '@/workflow/types/FunctionInput';
import { WorkflowCodeAction } from '@/workflow/types/Workflow';
import { getDefaultFunctionInputFromInputSchema } from '@/workflow/utils/getDefaultFunctionInputFromInputSchema';
import { mergeDefaultFunctionInputAndFunctionInput } from '@/workflow/utils/mergeDefaultFunctionInputAndFunctionInput';
import { setNestedValue } from '@/workflow/utils/setNestedValue';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ReactNode } from 'react';
import { HorizontalSeparator, IconCode, isDefined } from 'twenty-ui';
import { useDebouncedCallback } from 'use-debounce';

const StyledContainer = styled.div`
display: inline-flex;
Expand Down Expand Up @@ -39,13 +39,13 @@ const StyledInputContainer = styled.div`

type WorkflowEditActionFormServerlessFunctionProps =
| {
action: WorkflowCodeStep;
action: WorkflowCodeAction;
readonly: true;
}
| {
action: WorkflowCodeStep;
action: WorkflowCodeAction;
readonly?: false;
onActionUpdate: (action: WorkflowCodeStep) => void;
onActionUpdate: (action: WorkflowCodeAction) => void;
};

export const WorkflowEditActionFormServerlessFunction = (
Expand Down
18 changes: 9 additions & 9 deletions packages/twenty-front/src/modules/workflow/types/Workflow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type BaseWorkflowStepSettings = {
type BaseWorkflowActionSettings = {
input: object;
outputSchema: object;
errorHandlingOptions: {
Expand All @@ -11,7 +11,7 @@ type BaseWorkflowStepSettings = {
};
};

export type WorkflowCodeStepSettings = BaseWorkflowStepSettings & {
export type WorkflowCodeActionSettings = BaseWorkflowActionSettings & {
input: {
serverlessFunctionId: string;
serverlessFunctionVersion: string;
Expand All @@ -21,7 +21,7 @@ export type WorkflowCodeStepSettings = BaseWorkflowStepSettings & {
};
};

export type WorkflowSendEmailStepSettings = BaseWorkflowStepSettings & {
export type WorkflowSendEmailActionSettings = BaseWorkflowActionSettings & {
input: {
connectedAccountId: string;
email: string;
Expand All @@ -30,23 +30,23 @@ export type WorkflowSendEmailStepSettings = BaseWorkflowStepSettings & {
};
};

type BaseWorkflowStep = {
type BaseWorkflowAction = {
id: string;
name: string;
valid: boolean;
};

export type WorkflowCodeStep = BaseWorkflowStep & {
export type WorkflowCodeAction = BaseWorkflowAction & {
type: 'CODE';
settings: WorkflowCodeStepSettings;
settings: WorkflowCodeActionSettings;
};

export type WorkflowSendEmailStep = BaseWorkflowStep & {
export type WorkflowSendEmailAction = BaseWorkflowAction & {
type: 'SEND_EMAIL';
settings: WorkflowSendEmailStepSettings;
settings: WorkflowSendEmailActionSettings;
};

export type WorkflowAction = WorkflowCodeStep | WorkflowSendEmailStep;
export type WorkflowAction = WorkflowCodeAction | WorkflowSendEmailAction;

export type WorkflowStep = WorkflowAction;

Expand Down

0 comments on commit 845f0ec

Please sign in to comment.