/** * Webhook Dispatcher * * Dispatches webhook POST requests when collection events occur. * Supports HMAC-SHA256 signature verification and configurable retries. */ import type { CollectionConfig, WebhookConfig, WebhookEvent, WebhookPayload } from '@momentumcms/core'; /** * Sign a webhook payload with HMAC-SHA256. * Returns the hex-encoded signature. */ declare function signPayload(payload: string, secret: string): string; /** * Check if a webhook URL is safe to call. * Blocks private IP ranges, localhost, and non-http(s) protocols to prevent SSRF. * Set MOMENTUM_ALLOW_PRIVATE_WEBHOOKS=true to allow localhost/private IPs (e.g. for testing). */ declare function isAllowedWebhookUrl(url: string): boolean; /** * Send a single webhook request with retry support. * Runs in the background (fire-and-forget). */ declare function sendWebhook(webhook: WebhookConfig, payload: WebhookPayload, attempt?: number): Promise; /** * Dispatch webhooks for a collection event. * Runs all matching webhooks in parallel, fire-and-forget. */ declare function dispatchWebhooks(webhooks: WebhookConfig[], event: WebhookEvent, payload: WebhookPayload): void; /** * Register webhook hooks for all collections that have webhook configs. * Call this during server initialization, before initializeMomentumAPI(). */ export declare function registerWebhookHooks(collections: CollectionConfig[]): void; export { sendWebhook, dispatchWebhooks, signPayload, isAllowedWebhookUrl };