MCPcopy Index your code
hub / github.com/simstudioai/sim / dispatchSimEvent

Function dispatchSimEvent

apps/sim/lib/workspace-events/emitter.ts:45–72  ·  view source on GitHub ↗
(
  subscription: SimSubscription,
  payload: SimEventPayload
)

Source from the content-addressed store, hash-verified

43 * module stays cheap for the execution logger to import.
44 */
45export async function dispatchSimEvent(
46 subscription: SimSubscription,
47 payload: SimEventPayload
48): Promise<void> {
49 const requestId = generateShortId()
50 try {
51 const { processPolledWebhookEvent } = await import('@/lib/webhooks/processor')
52 const result = await processPolledWebhookEvent(
53 subscription.webhook,
54 subscription.workflow,
55 payload,
56 requestId
57 )
58
59 if (!result.success) {
60 logger.error(
61 `[${requestId}] Failed to fire sim trigger for workflow ${subscription.workflow.id}:`,
62 result.statusCode,
63 result.error
64 )
65 }
66 } catch (error) {
67 logger.error(
68 `[${requestId}] Error firing sim trigger for workflow ${subscription.workflow.id}:`,
69 error
70 )
71 }
72}
73
74/** Workflow-scope filter shared by all event kinds. Empty selection watches every workflow. */
75function matchesWorkflowScope(config: SimSubscriptionConfig, sourceWorkflowId: string): boolean {

Callers 3

checkWatchedWorkflowFunction · 0.90

Calls 3

generateShortIdFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected