Skip to content

Commit c5abed3

Browse files
committed
restore constants file
1 parent 56dae41 commit c5abed3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

apps/sim/triggers/constants.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
/**
2+
* System subblock IDs that are part of the trigger UI infrastructure
3+
* and should NOT be aggregated into triggerConfig or validated as user fields.
4+
*
5+
* These subblocks provide UI/UX functionality but aren't configuration data.
6+
*/
7+
export const SYSTEM_SUBBLOCK_IDS: string[] = [
8+
'triggerCredentials', // OAuth credentials subblock
9+
'triggerInstructions', // Setup instructions text
10+
'webhookUrlDisplay', // Webhook URL display
11+
'samplePayload', // Example payload display
12+
'setupScript', // Setup script code (e.g., Apps Script)
13+
'scheduleInfo', // Schedule status display (next run, last run)
14+
]
15+
16+
/**
17+
* Trigger-related subblock IDs that represent runtime metadata. They should remain
18+
* in the workflow state but must not be modified or cleared by diff operations.
19+
*
20+
* Note: 'triggerConfig' is included because it's an aggregate of individual trigger
21+
* field subblocks. Those individual fields are compared separately, so comparing
22+
* triggerConfig would be redundant. Additionally, the client populates triggerConfig
23+
* with default values from the trigger definition on load, which aren't present in
24+
* the deployed state, causing false positive change detection.
25+
*/
26+
export const TRIGGER_RUNTIME_SUBBLOCK_IDS: string[] = [
27+
'webhookId',
28+
'triggerPath',
29+
'triggerConfig',
30+
'triggerId',
31+
]
32+
33+
/**
34+
* Maximum number of consecutive failures before a trigger (schedule/webhook) is auto-disabled.
35+
* This prevents runaway errors from continuously executing failing workflows.
36+
*/
37+
export const MAX_CONSECUTIVE_FAILURES = 100
38+
139
/**
240
* Set of webhook provider names that use polling-based triggers.
341
* Mirrors the `polling: true` flag on TriggerConfig entries.

0 commit comments

Comments
 (0)