Skip to content

Commit ce38024

Browse files
committed
fix(triggers): package lemlist data, cleanup trigger outputs formatting, fix display name issues
1 parent b49ed2f commit ce38024

File tree

15 files changed

+225
-968
lines changed

15 files changed

+225
-968
lines changed

apps/sim/blocks/registry.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,26 @@ export const getBlock = (type: string): BlockConfig | undefined => {
313313
return registry[normalized]
314314
}
315315

316+
export const getLatestBlock = (baseType: string): BlockConfig | undefined => {
317+
const normalized = baseType.replace(/-/g, '_')
318+
319+
const versionedKeys = Object.keys(registry).filter((key) => {
320+
const match = key.match(new RegExp(`^${normalized}_v(\\d+)$`))
321+
return match !== null
322+
})
323+
324+
if (versionedKeys.length > 0) {
325+
const sorted = versionedKeys.sort((a, b) => {
326+
const versionA = Number.parseInt(a.match(/_v(\d+)$/)?.[1] || '0', 10)
327+
const versionB = Number.parseInt(b.match(/_v(\d+)$/)?.[1] || '0', 10)
328+
return versionB - versionA
329+
})
330+
return registry[sorted[0]]
331+
}
332+
333+
return registry[normalized]
334+
}
335+
316336
export const getBlockByToolName = (toolName: string): BlockConfig | undefined => {
317337
return Object.values(registry).find((block) => block.tools?.access?.includes(toolName))
318338
}

apps/sim/executor/utils/start-block.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,10 @@ function buildManualTriggerOutput(
378378
}
379379

380380
function buildIntegrationTriggerOutput(
381-
finalInput: unknown,
381+
_finalInput: unknown,
382382
workflowInput: unknown
383383
): NormalizedBlockOutput {
384-
const base: NormalizedBlockOutput = isPlainObject(workflowInput)
385-
? ({ ...(workflowInput as Record<string, unknown>) } as NormalizedBlockOutput)
386-
: {}
387-
388-
if (isPlainObject(finalInput)) {
389-
Object.assign(base, finalInput as Record<string, unknown>)
390-
base.input = { ...(finalInput as Record<string, unknown>) }
391-
} else {
392-
base.input = finalInput
393-
}
394-
395-
return mergeFilesIntoOutput(base, workflowInput)
384+
return isPlainObject(workflowInput) ? (workflowInput as NormalizedBlockOutput) : {}
396385
}
397386

398387
function extractSubBlocks(block: SerializedBlock): Record<string, unknown> | undefined {

apps/sim/lib/logs/get-trigger-options.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getBlock } from '@/blocks/registry'
1+
import { getLatestBlock } from '@/blocks/registry'
22
import { getAllTriggers } from '@/triggers'
33

44
export interface TriggerOption {
@@ -48,22 +48,13 @@ export function getTriggerOptions(): TriggerOption[] {
4848
continue
4949
}
5050

51-
const block = getBlock(provider)
52-
53-
if (block) {
54-
providerMap.set(provider, {
55-
value: provider,
56-
label: block.name, // Use block's display name (e.g., "Slack", "GitHub")
57-
color: block.bgColor || '#6b7280', // Use block's hex color, fallback to gray
58-
})
59-
} else {
60-
const label = formatProviderName(provider)
61-
providerMap.set(provider, {
62-
value: provider,
63-
label,
64-
color: '#6b7280', // gray fallback
65-
})
66-
}
51+
const block = getLatestBlock(provider)
52+
53+
providerMap.set(provider, {
54+
value: provider,
55+
label: block?.name || formatProviderName(provider),
56+
color: block?.bgColor || '#6b7280',
57+
})
6758
}
6859

6960
const integrationOptions = Array.from(providerMap.values()).sort((a, b) =>

0 commit comments

Comments
 (0)