()
| 161 | * This includes both dedicated trigger blocks and tools with trigger capabilities |
| 162 | */ |
| 163 | export function getAllTriggerBlocks(): TriggerInfo[] { |
| 164 | const allBlocks = getAllBlocks() |
| 165 | const triggers: TriggerInfo[] = [] |
| 166 | |
| 167 | for (const block of allBlocks) { |
| 168 | // Skip hidden blocks |
| 169 | if (block.hideFromToolbar) continue |
| 170 | |
| 171 | // Check if it's a core trigger block (category: 'triggers') |
| 172 | if (block.category === 'triggers') { |
| 173 | triggers.push({ |
| 174 | id: block.type, |
| 175 | name: block.name, |
| 176 | description: block.description, |
| 177 | icon: block.icon, |
| 178 | color: block.bgColor, |
| 179 | category: 'core', |
| 180 | enableTriggerMode: hasTriggerCapability(block), |
| 181 | }) |
| 182 | } |
| 183 | // Check if it's a tool with trigger capability (has trigger-config subblock) |
| 184 | else if (hasTriggerCapability(block)) { |
| 185 | triggers.push({ |
| 186 | id: block.type, |
| 187 | name: block.name, |
| 188 | description: block.description.replace(' or trigger workflows from ', ', trigger from '), |
| 189 | icon: block.icon, |
| 190 | color: block.bgColor, |
| 191 | category: 'integration', |
| 192 | enableTriggerMode: true, |
| 193 | }) |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // Sort: core triggers first, then integration triggers, alphabetically within each category |
| 198 | return triggers.sort((a, b) => { |
| 199 | if (a.category !== b.category) { |
| 200 | return a.category === 'core' ? -1 : 1 |
| 201 | } |
| 202 | return a.name.localeCompare(b.name) |
| 203 | }) |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Check if a block has trigger capability (contains trigger mode subblocks) |
nothing calls this directly
no test coverage detected