import type { RuntimeEventBus } from '../runtime/events/index.js'; /** * WebhookNotifier, sends HTTP POST notifications to configured webhook URLs. * * Defaults to ntfy.sh-compatible format: plain text body, no auth required. * Works with any service that accepts a plain POST with a text/plain body, * including ntfy.sh, generic webhooks, and custom endpoints. * * Usage: * const notifier = new WebhookNotifier(['https://ntfy.sh/my-topic']); * notifier.attachToRuntimeBus(runtimeBus); */ export declare class WebhookNotifier { private urls; private unsubscribers; private readonly timeoutMs; private readonly maxConcurrent; private readonly maxBodyBytes; private readonly signingSecret?; /** * Bypass test suppression for every delivery from this instance. Intended * only for tests that specifically exercise the real HTTP delivery layer * (e.g. the SSRF filter tests, which need a real `fetch` attempt to * distinguish "blocked" from "not blocked"). Every other caller should * leave this unset so `bun test` never fires a real webhook. */ private readonly force; constructor(urls?: string[], options?: WebhookNotifierOptions); /** * Create a WebhookNotifier from a list of URLs (e.g. from persisted config). */ static fromConfig(urls: string[]): WebhookNotifier; /** Add a webhook URL. Ignores duplicates. Throws on invalid URL. */ addUrl(url: string): void; /** Remove a webhook URL. */ removeUrl(url: string): boolean; /** Replace all webhook URLs. */ setUrls(urls: string[]): void; /** Get a copy of all configured webhook URLs. */ getUrls(): string[]; /** Returns true if at least one URL is configured. */ isConfigured(): boolean; /** * Send a plain-text notification to all configured webhooks. * * Uses ntfy.sh format by default: POST with text/plain body. * URLs are delivered with bounded concurrency; individual failures are * logged and returned but do not throw, remaining URLs still receive the notification. */ send(text: string): Promise; /** * Send a test notification to all configured webhooks. */ test(): Promise; attachToRuntimeBus(bus: RuntimeEventBus): void; /** Remove all webhook subscriptions. */ detach(): void; private postOne; private sendRuntimeNotification; } export interface WebhookNotifierOptions { timeoutMs?: number | undefined; maxConcurrent?: number | undefined; maxBodyBytes?: number | undefined; signingSecret?: string | Uint8Array | undefined; /** * Bypass test suppression for every delivery from this instance. Only * tests that exercise the real HTTP delivery layer itself should set this *, everything else should be left unset so `bun test` never sends a real * webhook request. */ force?: boolean | undefined; } export interface WebhookNotifierDeliveryResult { readonly url: string; readonly ok: boolean; readonly error?: string | undefined; } export interface WebhookNotifierSendResult { readonly attempted: number; readonly delivered: number; readonly failed: number; readonly results: readonly WebhookNotifierDeliveryResult[]; } //# sourceMappingURL=webhooks.d.ts.map