import type { SuiteResult } from './types'; export type WebhookFormat = 'slack' | 'teams' | 'discord' | 'generic'; export type WebhookEvent = 'on_failure' | 'on_regression' | 'on_success' | 'on_complete'; export type NotificationType = 'slack' | 'teams' | 'discord' | 'email' | 'pagerduty' | 'http' | 'generic'; export interface WebhookConfig { url: string; format?: WebhookFormat; headers?: Record; } export interface EmailNotificationConfig { type: 'email'; to: string | string[]; from?: string; subject_prefix?: string; smtp?: { host: string; port: number; secure?: boolean; auth?: { user: string; pass: string; }; }; on: WebhookEvent[]; } export interface PagerDutyNotificationConfig { type: 'pagerduty'; routing_key: string; severity?: 'critical' | 'error' | 'warning' | 'info'; on: WebhookEvent[]; } export interface HttpNotificationConfig { type: 'http'; url: string; method?: 'POST' | 'PUT' | 'PATCH'; headers?: Record; on: WebhookEvent[]; } export interface SlackNotificationConfig { type: 'slack'; webhook_url: string; channel?: string; on: WebhookEvent[]; } export type NotificationConfig = EmailNotificationConfig | PagerDutyNotificationConfig | HttpNotificationConfig | SlackNotificationConfig; export interface NotificationHubConfig { notifications: NotificationConfig[]; } export interface WebhooksConfig { on_failure?: WebhookConfig; on_regression?: WebhookConfig; on_success?: WebhookConfig; on_complete?: WebhookConfig; } export interface WebhookPayload { event: WebhookEvent; suite: string; passed: number; failed: number; total: number; duration_ms: number; timestamp: string; failures?: Array<{ name: string; error?: string; }>; regressions?: string[]; } /** * Build a webhook payload from suite results. */ export declare function buildPayload(event: WebhookEvent, result: SuiteResult, extra?: { regressions?: string[]; }): WebhookPayload; /** * Format a payload for a specific webhook platform. */ export declare function formatWebhookPayload(payload: WebhookPayload, format: WebhookFormat): string; /** * Send a webhook notification (returns the response status). */ export declare function sendWebhook(config: WebhookConfig, payload: WebhookPayload): Promise<{ success: boolean; status?: number; error?: string; }>; /** * Trigger webhooks based on suite results and configured events. */ export declare function triggerWebhooks(webhooks: WebhooksConfig, result: SuiteResult, extra?: { regressions?: string[]; }): Promise; /** * Build a PagerDuty Events API v2 payload. */ export declare function buildPagerDutyPayload(payload: WebhookPayload, routingKey: string, severity?: PagerDutyNotificationConfig['severity']): object; /** * Build an email body from a webhook payload. */ export declare function buildEmailBody(payload: WebhookPayload): { subject: string; text: string; html: string; }; /** * Send a notification via a specific channel. */ export declare function sendNotification(config: NotificationConfig, payload: WebhookPayload): Promise<{ success: boolean; type: string; error?: string; }>; /** * Trigger all configured notifications based on events. */ export declare function triggerNotifications(hub: NotificationHubConfig, result: SuiteResult, extra?: { regressions?: string[]; }): Promise>; //# sourceMappingURL=webhooks.d.ts.map