(
webhook: Record<string, unknown>,
workflow: Record<string, unknown>,
requestId: string,
options: { throwOnError?: boolean } = {}
)
| 123 | * Deployment outbox cleanup passes `throwOnError` so provider failures stay retryable. |
| 124 | */ |
| 125 | export async function cleanupExternalWebhook( |
| 126 | webhook: Record<string, unknown>, |
| 127 | workflow: Record<string, unknown>, |
| 128 | requestId: string, |
| 129 | options: { throwOnError?: boolean } = {} |
| 130 | ): Promise<void> { |
| 131 | const provider = webhook.provider as string |
| 132 | const handler = getProviderHandler(provider) |
| 133 | |
| 134 | if (!handler.deleteSubscription) { |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | try { |
| 139 | await handler.deleteSubscription({ webhook, workflow, requestId, strict: options.throwOnError }) |
| 140 | } catch (error) { |
| 141 | logger.warn(`[${requestId}] Error cleaning up external webhook (non-fatal)`, { |
| 142 | provider, |
| 143 | webhookId: webhook.id, |
| 144 | error: toError(error).message, |
| 145 | }) |
| 146 | if (options.throwOnError) { |
| 147 | throw error |
| 148 | } |
| 149 | } |
| 150 | } |
no test coverage detected