feat: enforce @/ alias for imports and fix all relative parent imports (#16787)
## Summary This PR enforces the use of `@/` alias for imports instead of relative parent imports (`../`). ## Changes ### ESLint Configuration - Added `no-restricted-imports` pattern in `eslint.config.react.mjs` to block `../*` imports with the message "Relative parent imports are not allowed. Use @/ alias instead." - Removed the non-working `import/no-relative-parent-imports` rule (doesn't work properly in ESLint flat config) ### VS Code Settings - Added `javascript.preferences.importModuleSpecifier: non-relative` to `.vscode/settings.json` (TypeScript setting was already there) ### Code Fixes - Fixed **941 relative parent imports** across **706 files** in `packages/twenty-front` - All `../` imports converted to use `@/` alias ## Why - Consistent import style across the codebase - Easier to move files without breaking imports - Better IDE support for auto-imports - Clearer understanding of where imports come from
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '../../../workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
import { useCreateStep } from '../useCreateStep';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
import { useCreateStep } from '@/workflow/workflow-steps/hooks/useCreateStep';
|
||||
|
||||
const mockGetUpdatableWorkflowVersion = jest.fn();
|
||||
const mockCreateWorkflowVersionStep = jest.fn().mockResolvedValue({
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import React from 'react';
|
||||
import { useDeleteStep } from '@/workflow/workflow-steps/hooks/useDeleteStep';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '../../../workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
|
||||
const mockDeleteWorkflowVersionStep = jest.fn();
|
||||
const mockGetUpdatableWorkflowVersion = jest.fn();
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { useDuplicateStep } from '@/workflow/workflow-steps/hooks/useDuplicateStep';
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '../../../workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext';
|
||||
|
||||
const mockGetUpdatableWorkflowVersion = jest.fn();
|
||||
const mockDuplicateWorkflowVersionStep = jest.fn().mockResolvedValue({
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { useUpdateAgentLabel } from '../useUpdateAgentLabel';
|
||||
import { useUpdateAgentLabel } from '@/workflow/workflow-steps/hooks/useUpdateAgentLabel';
|
||||
|
||||
const mockUpdateAgent = jest.fn();
|
||||
const mockUseFindOneAgentQuery = jest.fn();
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/ho
|
||||
import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun';
|
||||
import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { getStepInfoHistoryItem } from '../utils/getStepInfoHistoryItem';
|
||||
import { getStepInfoHistoryItem } from '@/workflow/workflow-steps/utils/getStepInfoHistoryItem';
|
||||
|
||||
export const useWorkflowRunStepInfo = ({ stepId }: { stepId: string }) => {
|
||||
const workflowRunId = useWorkflowRunIdOrThrow();
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { type WorkflowStep } from '@/workflow/types/Workflow';
|
||||
import { getIsDescendantOfIterator } from '../getIsDescendantOfIterator';
|
||||
import { getIsDescendantOfIterator } from '@/workflow/workflow-steps/utils/getIsDescendantOfIterator';
|
||||
|
||||
describe('getIsDescendantOfIterator', () => {
|
||||
const iteratorStep: WorkflowStep = {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { type WorkflowStep } from '@/workflow/types/Workflow';
|
||||
import { type WorkflowRunStepInfo, StepStatus } from 'twenty-shared/workflow';
|
||||
import { getStepInfoHistoryItem } from '../getStepInfoHistoryItem';
|
||||
import { getStepInfoHistoryItem } from '@/workflow/workflow-steps/utils/getStepInfoHistoryItem';
|
||||
|
||||
describe('getStepInfoHistoryItem', () => {
|
||||
const iteratorStep: WorkflowStep = {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { type WorkflowStep } from '@/workflow/types/Workflow';
|
||||
import { getPreviousSteps } from '../getWorkflowPreviousSteps';
|
||||
import { getPreviousSteps } from '@/workflow/workflow-steps/utils/getWorkflowPreviousSteps';
|
||||
|
||||
describe('getWorkflowPreviousSteps', () => {
|
||||
describe('using a simple workflow', () => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { type WorkflowRunFlow } from '@/workflow/types/Workflow';
|
||||
import { StepStatus, TRIGGER_STEP_ID } from 'twenty-shared/workflow';
|
||||
import { getWorkflowRunStepContext } from '../getWorkflowRunStepContext';
|
||||
import { getWorkflowRunStepContext } from '@/workflow/workflow-steps/utils/getWorkflowRunStepContext';
|
||||
|
||||
const mockFlow = {
|
||||
trigger: {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { getWorkflowRunStepExecutionStatus } from '../getWorkflowRunStepExecutionStatus';
|
||||
import { getWorkflowRunStepExecutionStatus } from '@/workflow/workflow-steps/utils/getWorkflowRunStepExecutionStatus';
|
||||
import { StepStatus } from 'twenty-shared/workflow';
|
||||
|
||||
describe('getWorkflowRunStepExecutionStatus', () => {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-perm
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { type ObjectPermission } from '~/generated/graphql';
|
||||
import { filterBySearchQuery } from '~/utils/filterBySearchQuery';
|
||||
import { CRUD_PERMISSIONS } from '../constants/WorkflowAiAgentCrudPermissions';
|
||||
import { CRUD_PERMISSIONS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentCrudPermissions';
|
||||
import { WorkflowAiAgentPermissionsPermissionRow } from './WorkflowAiAgentPermissionsPermissionRow';
|
||||
import { StyledLabel, StyledList } from './WorkflowAiAgentPermissionsStyles';
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
import { RightDrawerSkeletonLoader } from '~/loading/components/RightDrawerSkeletonLoader';
|
||||
import { WORKFLOW_AI_AGENT_TAB_LIST_COMPONENT_ID } from '../constants/WorkflowAiAgentTabListComponentId';
|
||||
import { WORKFLOW_AI_AGENT_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentTabListComponentId';
|
||||
import { WorkflowAiAgentPromptTab } from './WorkflowAiAgentPromptTab';
|
||||
|
||||
export type WorkflowAiAgentTabId =
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorato
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionCreateRecord } from '../WorkflowEditActionCreateRecord';
|
||||
import { WorkflowEditActionCreateRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateRecord';
|
||||
|
||||
const meta: Meta<typeof WorkflowEditActionCreateRecord> = {
|
||||
title: 'Modules/Workflow/Actions/CreateRecord/EditAction',
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { allMockPersonRecords } from '~/testing/mock-data/people';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionDeleteRecord } from '../WorkflowEditActionDeleteRecord';
|
||||
import { WorkflowEditActionDeleteRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionDeleteRecord';
|
||||
|
||||
const DEFAULT_ACTION = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import {
|
||||
mockedConnectedAccounts,
|
||||
} from '~/testing/mock-data/connected-accounts';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionSendEmail } from '../WorkflowEditActionSendEmail';
|
||||
import { WorkflowEditActionSendEmail } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionSendEmail';
|
||||
|
||||
const DEFAULT_ACTION: WorkflowSendEmailAction = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { allMockPersonRecords } from '~/testing/mock-data/people';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionUpdateRecord } from '../WorkflowEditActionUpdateRecord';
|
||||
import { WorkflowEditActionUpdateRecord } from '@/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionUpdateRecord';
|
||||
|
||||
const DEFAULT_ACTION = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorato
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionFilter } from '../WorkflowEditActionFilter';
|
||||
import { WorkflowEditActionFilter } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilter';
|
||||
|
||||
const DEFAULT_ACTION: WorkflowFilterAction = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorato
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { getWorkflowNodeIdMock } from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionFilterBody } from '../WorkflowEditActionFilterBody';
|
||||
import { WorkflowEditActionFilterBody } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilterBody';
|
||||
|
||||
const DEFAULT_ACTION: WorkflowFilterAction = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterAddFilterRuleSelect } from '../WorkflowStepFilterAddFilterRuleSelect';
|
||||
import { WorkflowStepFilterAddFilterRuleSelect } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterAddFilterRuleSelect';
|
||||
|
||||
const STEP_FILTER_GROUP: StepFilterGroup = {
|
||||
id: 'filter-group-1',
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterAddRootStepFilterButton } from '../WorkflowStepFilterAddRootStepFilterButton';
|
||||
import { WorkflowStepFilterAddRootStepFilterButton } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterAddRootStepFilterButton';
|
||||
|
||||
const meta: Meta<typeof WorkflowStepFilterAddRootStepFilterButton> = {
|
||||
title:
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterColumn } from '../WorkflowStepFilterColumn';
|
||||
import { WorkflowStepFilterColumn } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterColumn';
|
||||
|
||||
const STEP_FILTER_GROUP: StepFilterGroup = {
|
||||
id: 'filter-group-1',
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterFieldSelect } from '../WorkflowStepFilterFieldSelect';
|
||||
import { WorkflowStepFilterFieldSelect } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterFieldSelect';
|
||||
|
||||
const DEFAULT_STEP_FILTER: StepFilter = {
|
||||
id: 'filter-1',
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterLogicalOperatorCell } from '../WorkflowStepFilterLogicalOperatorCell';
|
||||
import { WorkflowStepFilterLogicalOperatorCell } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterLogicalOperatorCell';
|
||||
|
||||
const AND_STEP_FILTER_GROUP: StepFilterGroup = {
|
||||
id: 'filter-group-1',
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowStepFilterValueInput } from '../WorkflowStepFilterValueInput';
|
||||
import { WorkflowStepFilterValueInput } from '@/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowStepFilterValueInput';
|
||||
|
||||
const TEXT_FILTER: StepFilter = {
|
||||
id: 'filter-1',
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/work
|
||||
import { useContext } from 'react';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { WorkflowStepFilterContext } from '../states/context/WorkflowStepFilterContext';
|
||||
import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/workflow-actions/filter-action/states/context/WorkflowStepFilterContext';
|
||||
|
||||
export const useRemoveStepFilter = () => {
|
||||
const { onFilterSettingsUpdate } = useContext(WorkflowStepFilterContext);
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { ComponentDecorator } from 'twenty-ui/testing';
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
|
||||
import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/WorkflowStepActionDrawerDecorator';
|
||||
import { WorkflowEditActionFormFieldSettings } from '../WorkflowEditActionFormFieldSettings';
|
||||
import { WorkflowEditActionFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFieldSettings';
|
||||
|
||||
const meta: Meta<typeof WorkflowEditActionFormFieldSettings> = {
|
||||
title: 'Modules/Workflow/Actions/Form/WorkflowEditActionFormFieldSettings',
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import { WorkflowStepActionDrawerDecorator } from '~/testing/decorators/Workflow
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { WorkspaceDecorator } from '~/testing/decorators/WorkspaceDecorator';
|
||||
import { graphqlMocks } from '~/testing/graphqlMocks';
|
||||
import { WorkflowEditActionFormFiller } from '../WorkflowEditActionFormFiller';
|
||||
import { WorkflowEditActionFormFiller } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormFiller';
|
||||
|
||||
const meta: Meta<typeof WorkflowEditActionFormFiller> = {
|
||||
title: 'Modules/Workflow/Actions/Form/WorkflowEditActionFormFiller',
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, within } from '@storybook/test';
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
import { WorkflowFormEmptyMessage } from '../WorkflowFormEmptyMessage';
|
||||
import { WorkflowFormEmptyMessage } from '@/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormEmptyMessage';
|
||||
|
||||
const meta: Meta<typeof WorkflowFormEmptyMessage> = {
|
||||
title: 'Modules/Workflow/Actions/Form/WorkflowFormEmptyMessage',
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { v4 } from 'uuid';
|
||||
import { getDefaultFormFieldSettings } from '../getDefaultFormFieldSettings';
|
||||
import { getDefaultFormFieldSettings } from '@/workflow/workflow-steps/workflow-actions/form-action/utils/getDefaultFormFieldSettings';
|
||||
|
||||
jest.mock('uuid', () => ({
|
||||
v4: jest.fn(() => 'test-uuid-123'),
|
||||
|
||||
+6
-6
@@ -21,12 +21,12 @@ import { IconPlayerPlay, IconSettings } from 'twenty-ui/display';
|
||||
import {
|
||||
HTTP_METHODS,
|
||||
JSON_RESPONSE_PLACEHOLDER,
|
||||
} from '../constants/HttpRequest';
|
||||
import { WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID } from '../constants/WorkflowHttpRequestTabListComponentId';
|
||||
import { useHttpRequestForm } from '../hooks/useHttpRequestForm';
|
||||
import { useHttpRequestOutputSchema } from '../hooks/useHttpRequestOutputSchema';
|
||||
import { useTestHttpRequest } from '../hooks/useTestHttpRequest';
|
||||
import { WorkflowHttpRequestTabId } from '../types/WorkflowHttpRequestTabId';
|
||||
} from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
import { WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/WorkflowHttpRequestTabListComponentId';
|
||||
import { useHttpRequestForm } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useHttpRequestForm';
|
||||
import { useHttpRequestOutputSchema } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useHttpRequestOutputSchema';
|
||||
import { useTestHttpRequest } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest';
|
||||
import { WorkflowHttpRequestTabId } from '@/workflow/workflow-steps/workflow-actions/http-request-action/types/WorkflowHttpRequestTabId';
|
||||
import { BodyInput } from './BodyInput';
|
||||
import { HttpRequestExecutionResult } from './HttpRequestExecutionResult';
|
||||
import { HttpRequestTestVariableInput } from './HttpRequestTestVariableInput';
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import {
|
||||
getWorkflowNodeIdMock,
|
||||
MOCKED_STEP_ID,
|
||||
} from '~/testing/mock-data/workflow';
|
||||
import { WorkflowEditActionHttpRequest } from '../WorkflowEditActionHttpRequest';
|
||||
import { WorkflowEditActionHttpRequest } from '@/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest';
|
||||
|
||||
const DEFAULT_ACTION: WorkflowHttpRequestAction = {
|
||||
id: getWorkflowNodeIdMock(),
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { type WorkflowHttpRequestAction } from '@/workflow/types/Workflow';
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { useHttpRequestForm } from '../useHttpRequestForm';
|
||||
import { useHttpRequestForm } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useHttpRequestForm';
|
||||
|
||||
describe('useHttpRequestForm', () => {
|
||||
const mockAction: WorkflowHttpRequestAction = {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { act, renderHook } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
import { resolveInput } from 'twenty-shared/utils';
|
||||
import { useTestHttpRequest } from '../useTestHttpRequest';
|
||||
import { useTestHttpRequest } from '@/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest';
|
||||
|
||||
// Mock Apollo Client
|
||||
jest.mock('@apollo/client', () => ({
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { useDebouncedCallback } from 'use-debounce';
|
||||
import {
|
||||
type HttpRequestBody,
|
||||
type HttpRequestFormData,
|
||||
} from '../constants/HttpRequest';
|
||||
} from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
|
||||
export type UseHttpRequestFormParams = {
|
||||
action: WorkflowHttpRequestAction;
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ import { parseAndValidateVariableFriendlyStringifiedJson } from '@/workflow/util
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { useState } from 'react';
|
||||
import { type BaseOutputSchemaV2 } from 'twenty-shared/workflow';
|
||||
import { convertOutputSchemaToJson } from '../utils/convertOutputSchemaToJson';
|
||||
import { getHttpRequestOutputSchema } from '../utils/getHttpRequestOutputSchema';
|
||||
import { convertOutputSchemaToJson } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/convertOutputSchemaToJson';
|
||||
import { getHttpRequestOutputSchema } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/getHttpRequestOutputSchema';
|
||||
|
||||
type UseHttpRequestOutputSchemaProps = {
|
||||
action: WorkflowHttpRequestAction;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { type BaseOutputSchemaV2 } from 'twenty-shared/workflow';
|
||||
import { convertOutputSchemaToJson } from '../convertOutputSchemaToJson';
|
||||
import { convertOutputSchemaToJson } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/convertOutputSchemaToJson';
|
||||
|
||||
describe('convertOutputSchemaToJson', () => {
|
||||
it('should convert simple object schema to JSON', () => {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { BODY_TYPES } from '../../constants/HttpRequest';
|
||||
import { getBodyTypeFromHeaders } from '../getBodyTypeFromHeaders';
|
||||
import { BODY_TYPES } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
import { getBodyTypeFromHeaders } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/getBodyTypeFromHeaders';
|
||||
|
||||
describe('getBodyTypeFromHeaders', () => {
|
||||
describe('when headers is undefined or null', () => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { getHttpRequestOutputSchema } from '../getHttpRequestOutputSchema';
|
||||
import { getHttpRequestOutputSchema } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/getHttpRequestOutputSchema';
|
||||
|
||||
describe('getHttpRequestOutputSchema', () => {
|
||||
it('should return empty object for null input', () => {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { type HttpRequestBody } from '../../constants/HttpRequest';
|
||||
import { hasNonStringValues } from '../hasNonStringValues';
|
||||
import { type HttpRequestBody } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
import { hasNonStringValues } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/hasNonStringValues';
|
||||
|
||||
describe('hasNonStringValues', () => {
|
||||
it('should return true for empty object', () => {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { type HttpMethodWithBody } from '../../constants/HttpRequest';
|
||||
import { isMethodWithBody } from '../isMethodWithBody';
|
||||
import { type HttpMethodWithBody } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
import { isMethodWithBody } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/isMethodWithBody';
|
||||
|
||||
describe('isMethodWithBody', () => {
|
||||
it('should return false for null input', () => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { parseHttpJsonBodyWithoutVariablesOrThrow } from '../parseHttpJsonBodyWithoutVariablesOrThrow';
|
||||
import { parseHttpJsonBodyWithoutVariablesOrThrow } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/parseHttpJsonBodyWithoutVariablesOrThrow';
|
||||
|
||||
describe('parseHttpJsonBodyWithoutVariablesOrThrow', () => {
|
||||
it('should parse valid JSON without variables', () => {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { type HttpRequestBody } from '../../constants/HttpRequest';
|
||||
import { shouldDisplayRawJsonByDefault } from '../shouldDisplayRawJsonByDefault';
|
||||
import { type HttpRequestBody } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest';
|
||||
import { shouldDisplayRawJsonByDefault } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/shouldDisplayRawJsonByDefault';
|
||||
|
||||
describe('shouldDisplayRawJsonByDefault', () => {
|
||||
describe('when defaultValue is undefined', () => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { AUTO_SET_HEADER_KEYS } from '../constants/AutoSetHeaderKeys';
|
||||
import { AUTO_SET_HEADER_KEYS } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/AutoSetHeaderKeys';
|
||||
|
||||
export const isAutoSetHeaderKey = (key: string): boolean => {
|
||||
return AUTO_SET_HEADER_KEYS.includes(key.trim().toLowerCase());
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { getActionHeaderTypeOrThrow } from '../getActionHeaderTypeOrThrow';
|
||||
import { getActionHeaderTypeOrThrow } from '@/workflow/workflow-steps/workflow-actions/utils/getActionHeaderTypeOrThrow';
|
||||
|
||||
describe('getActionHeaderTypeOrThrow', () => {
|
||||
it('should return "Core" for CODE action type', () => {
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
import { AI_ACTIONS } from '../../constants/AiActions';
|
||||
import { CORE_ACTIONS } from '../../constants/CoreActions';
|
||||
import { HUMAN_INPUT_ACTIONS } from '../../constants/HumanInputActions';
|
||||
import { RECORD_ACTIONS } from '../../constants/RecordActions';
|
||||
import { getActionIcon } from '../getActionIcon';
|
||||
import { AI_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/AiActions';
|
||||
import { CORE_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/CoreActions';
|
||||
import { HUMAN_INPUT_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/HumanInputActions';
|
||||
import { RECORD_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/constants/RecordActions';
|
||||
import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon';
|
||||
|
||||
describe('getActionIcon', () => {
|
||||
it('should return correct icon for all action types', () => {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { type WorkflowActionType } from '@/workflow/types/Workflow';
|
||||
import { type Theme } from '@emotion/react';
|
||||
import { COLOR_LIGHT, GRAY_SCALE_LIGHT } from 'twenty-ui/theme';
|
||||
import { getActionIconColorOrThrow } from '../getActionIconColorOrThrow';
|
||||
import { getActionIconColorOrThrow } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIconColorOrThrow';
|
||||
|
||||
const mockTheme: Theme = {
|
||||
color: {
|
||||
|
||||
Reference in New Issue
Block a user