Fix assert unreachable, remove unused variables (#13753)
Small code cleanup
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
|
||||
it('throws when argument is not never', () => {
|
||||
expect(() => {
|
||||
assertUnreachable(42 as never);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it('throws with the provided error message when argument is not never', () => {
|
||||
expect(() => {
|
||||
assertUnreachable(42 as never, 'Custom error!');
|
||||
}).toThrow('Custom error!');
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
export const assertUnreachable = (x: never, errorMessage?: string): never => {
|
||||
throw new Error(errorMessage ?? "Didn't expect to get here.");
|
||||
};
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/types/WorkflowDiagram';
|
||||
import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWorkflowNodeIconKey';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
import { useIcons } from 'twenty-ui/display';
|
||||
|
||||
const StyledStepNodeLabelIconContainer = styled.div`
|
||||
|
||||
+1
-2
@@ -1,12 +1,11 @@
|
||||
import { WorkflowTrigger } from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { splitWorkflowTriggerEventName } from '@/workflow/utils/splitWorkflowTriggerEventName';
|
||||
import { WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/types/WorkflowDiagram';
|
||||
import { DATABASE_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/DatabaseTriggerTypes';
|
||||
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
|
||||
import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon';
|
||||
import { Node } from '@xyflow/react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const getWorkflowDiagramTriggerNode = ({
|
||||
trigger,
|
||||
|
||||
+1
-2
@@ -3,7 +3,6 @@ import {
|
||||
WorkflowRunStepStatus,
|
||||
WorkflowTrigger,
|
||||
} from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { getStepDefinitionOrThrow } from '@/workflow/utils/getStepDefinitionOrThrow';
|
||||
import { WorkflowEditActionAiAgent } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent';
|
||||
import { WorkflowActionServerlessFunction } from '@/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionServerlessFunction';
|
||||
@@ -19,7 +18,7 @@ import { WorkflowEditTriggerCronForm } from '@/workflow/workflow-trigger/compone
|
||||
import { WorkflowEditTriggerDatabaseEventForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerDatabaseEventForm';
|
||||
import { WorkflowEditTriggerManualForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerManualForm';
|
||||
import { WorkflowEditTriggerWebhookForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type WorkflowRunStepNodeDetailProps = {
|
||||
stepId: string;
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import { WorkflowAction, WorkflowTrigger } from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { getStepDefinitionOrThrow } from '@/workflow/utils/getStepDefinitionOrThrow';
|
||||
import { WorkflowEditActionAiAgent } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent';
|
||||
import { WorkflowActionServerlessFunction } from '@/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowActionServerlessFunction';
|
||||
@@ -15,7 +14,7 @@ import { WorkflowEditTriggerCronForm } from '@/workflow/workflow-trigger/compone
|
||||
import { WorkflowEditTriggerDatabaseEventForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerDatabaseEventForm';
|
||||
import { WorkflowEditTriggerManualForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerManualForm';
|
||||
import { WorkflowEditTriggerWebhookForm } from '@/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type WorkflowStepDetailProps = {
|
||||
stepId: string;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { CronTriggerInterval } from '@/workflow/workflow-trigger/constants/CronTriggerIntervalOptions';
|
||||
import { WorkflowCronTrigger } from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { CronTriggerInterval } from '@/workflow/workflow-trigger/constants/CronTriggerIntervalOptions';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
const DEFAULT_CRON_PATTERN = '0 */1 * * *'; // Every hour
|
||||
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ import {
|
||||
WorkflowManualTriggerAvailability,
|
||||
WorkflowManualTriggerSettings,
|
||||
} from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
export const getManualTriggerDefaultSettings = ({
|
||||
availability,
|
||||
|
||||
+1
-2
@@ -4,11 +4,10 @@ import {
|
||||
WorkflowTrigger,
|
||||
WorkflowTriggerType,
|
||||
} from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { DATABASE_TRIGGER_TYPES } from '@/workflow/workflow-trigger/constants/DatabaseTriggerTypes';
|
||||
import { getManualTriggerDefaultSettings } from '@/workflow/workflow-trigger/utils/getManualTriggerDefaultSettings';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { getRootStepIds } from '@/workflow/workflow-trigger/utils/getRootStepIds';
|
||||
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
// TODO: This needs to be migrated to the server
|
||||
export const getTriggerDefaultDefinition = ({
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { WorkflowWebhookTrigger } from '@/workflow/types/Workflow';
|
||||
import { assertUnreachable } from '@/workflow/utils/assertUnreachable';
|
||||
import { WebhookHttpMethods } from '@/workflow/workflow-trigger/constants/WebhookTriggerHttpMethodOptions';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
export const getWebhookTriggerDefaultSettings = (
|
||||
webhookHttpMethods: WebhookHttpMethods,
|
||||
|
||||
Reference in New Issue
Block a user