(webhookConfig: TT.WebhookConfig)
| 16 | let WEBHOOK_URI: string | undefined |
| 17 | |
| 18 | export const setupWebhook = (webhookConfig: TT.WebhookConfig) => { |
| 19 | if (!webhookConfig.url) { |
| 20 | return |
| 21 | } |
| 22 | // set webhook uri |
| 23 | WEBHOOK_URI = webhookConfig.url |
| 24 | |
| 25 | // set webhook event triggers |
| 26 | const events = webhookConfig.events as TT.WebhookConfigEvents |
| 27 | for (const eventName of Object.keys(events || {})) { |
| 28 | WEBHOOK_EVENTS[eventName] = events[eventName] |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | const callWebhookEndpoint = async <B>(bodyObject: B): Promise<void> => { |
| 33 | if (!WEBHOOK_URI) { |
no outgoing calls
no test coverage detected