( events: string[] )
| 49 | * Returns an array of invalid event names. |
| 50 | */ |
| 51 | export async function validateWebhookEvents( |
| 52 | events: string[] |
| 53 | ): Promise<string[]> { |
| 54 | const validEvents = await getWebhookEvents(); |
| 55 | |
| 56 | // If we couldn't fetch valid events, skip validation |
| 57 | if (validEvents.length === 0) { |
| 58 | return []; |
| 59 | } |
| 60 | |
| 61 | const validSet = new Set(validEvents); |
| 62 | return events.filter(e => !validSet.has(e)); |
| 63 | } |
no test coverage detected