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

Function cleanupExternalWebhooksForWorkflow

apps/sim/lib/workflows/lifecycle.ts:52–86  ·  view source on GitHub ↗
(
  workflowId: string,
  requestId: string
)

Source from the content-addressed store, hash-verified

50}
51
52async function cleanupExternalWebhooksForWorkflow(
53 workflowId: string,
54 requestId: string
55): Promise<void> {
56 try {
57 const { cleanupExternalWebhook } = await import('@/lib/webhooks/provider-subscriptions')
58 const webhooksToCleanup = await db
59 .select({
60 webhook: webhook,
61 workflow: {
62 id: workflow.id,
63 userId: workflow.userId,
64 workspaceId: workflow.workspaceId,
65 },
66 })
67 .from(webhook)
68 .innerJoin(workflow, eq(webhook.workflowId, workflow.id))
69 .where(eq(webhook.workflowId, workflowId))
70
71 for (const webhookData of webhooksToCleanup) {
72 try {
73 await cleanupExternalWebhook(webhookData.webhook, webhookData.workflow, requestId)
74 } catch (error) {
75 logger.warn(
76 `[${requestId}] Failed to cleanup external webhook ${webhookData.webhook.id} for workflow ${workflowId}`,
77 { error }
78 )
79 }
80 }
81 } catch (error) {
82 logger.warn(`[${requestId}] Error during external webhook cleanup for workflow ${workflowId}`, {
83 error,
84 })
85 }
86}
87
88export async function archiveWorkflow(
89 workflowId: string,

Callers 1

archiveWorkflowFunction · 0.85

Calls 3

cleanupExternalWebhookFunction · 0.85
warnMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected