Skip to content

Commit b607feb

Browse files
committed
improvement(triggers): move TRIGGER_TYPES to a dependency-free module
1 parent 8fc4c1a commit b607feb

6 files changed

Lines changed: 23 additions & 26 deletions

File tree

‎apps/sim/lib/execution/files.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '@/lib/uploads/utils/file-utils'
1717
import { workflowFileInputSchema } from '@/lib/workflows/input-file-schema'
1818
import { isFileFieldType } from '@/lib/workflows/input-format'
19-
import { TRIGGER_TYPES } from '@/lib/workflows/triggers/triggers'
19+
import { TRIGGER_TYPES } from '@/lib/workflows/triggers/types'
2020
import type { InputFormatField } from '@/lib/workflows/types'
2121
import type { UserFile } from '@/executor/types'
2222
import type { SerializedBlock } from '@/serializer/types'

‎apps/sim/lib/workflows/blocks/block-outputs.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ import {
66
import { getJevAnswerOutput } from '@/lib/workflows/blocks/jev-outputs'
77
import { normalizeInputFormatValue } from '@/lib/workflows/input-format'
88
import { containsReference } from '@/lib/workflows/sanitization/references'
9-
import {
10-
classifyStartBlockType,
11-
StartBlockPath,
12-
TRIGGER_TYPES,
13-
} from '@/lib/workflows/triggers/triggers'
9+
import { classifyStartBlockType, StartBlockPath } from '@/lib/workflows/triggers/triggers'
10+
import { TRIGGER_TYPES } from '@/lib/workflows/triggers/types'
1411
import {
1512
type InputFormatField,
1613
START_BLOCK_RESERVED_FIELDS,

‎apps/sim/lib/workflows/blocks/block-reference-tags.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getEffectiveBlockOutputPaths } from '@/lib/workflows/blocks/block-outputs'
22
import { hasTriggerCapability } from '@/lib/workflows/triggers/trigger-utils'
3-
import { TRIGGER_TYPES } from '@/lib/workflows/triggers/triggers'
3+
import { TRIGGER_TYPES } from '@/lib/workflows/triggers/types'
44
import { getBlock } from '@/blocks'
55
import { isHumanInTheLoopBlock, normalizeName } from '@/executor/constants'
66

‎apps/sim/lib/workflows/diff/diff-engine.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ vi.mock('@/lib/workflows/subblocks/visibility', () => ({
6060
}))
6161

6262
vi.mock('@/lib/workflows/triggers/triggers', () => ({
63-
TRIGGER_TYPES: {},
6463
classifyStartBlockType: () => null,
6564
StartBlockPath: {},
6665
getTriggerOutputs: () => ({}),

‎apps/sim/lib/workflows/triggers/triggers.ts‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
import { isRecordLike } from '@sim/utils/object'
2+
import { TRIGGER_TYPES, type TriggerType } from '@/lib/workflows/triggers/types'
23
import { getBlock } from '@/blocks'
34
import type { BlockState } from '@/stores/workflows/workflow/types'
45

5-
/**
6-
* Unified trigger type definitions
7-
*/
8-
export const TRIGGER_TYPES = {
9-
INPUT: 'input_trigger',
10-
MANUAL: 'manual_trigger',
11-
CHAT: 'chat_trigger',
12-
API: 'api_trigger',
13-
WEBHOOK: 'webhook',
14-
GENERIC_WEBHOOK: 'generic_webhook',
15-
SCHEDULE: 'schedule',
16-
SIM: 'sim_workspace_event',
17-
START: 'start_trigger',
18-
STARTER: 'starter', // Legacy
19-
} as const
20-
21-
export type TriggerType = (typeof TRIGGER_TYPES)[keyof typeof TRIGGER_TYPES]
22-
236
export enum StartBlockPath {
247
UNIFIED = 'unified_start',
258
LEGACY_STARTER = 'legacy_starter',
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Unified trigger type definitions. Kept dependency-free so callers that only need the
3+
* constants (e.g. execution file handling in background tasks) never load the block registry.
4+
*/
5+
export const TRIGGER_TYPES = {
6+
INPUT: 'input_trigger',
7+
MANUAL: 'manual_trigger',
8+
CHAT: 'chat_trigger',
9+
API: 'api_trigger',
10+
WEBHOOK: 'webhook',
11+
GENERIC_WEBHOOK: 'generic_webhook',
12+
SCHEDULE: 'schedule',
13+
SIM: 'sim_workspace_event',
14+
START: 'start_trigger',
15+
STARTER: 'starter', // Legacy
16+
} as const
17+
18+
export type TriggerType = (typeof TRIGGER_TYPES)[keyof typeof TRIGGER_TYPES]

0 commit comments

Comments
 (0)