import { W as WorkflowStatus, B as BaseNotifierOptions, P as ProviderOptions, N as Notifier } from '../types-DjSWix07.js'; import { W as WorkflowIR } from '../url-CKfrOJ3y.js'; import 'awaitly'; /** * Webhook Adapter * * Platform-specific adapter for generic HTTP webhooks. * Handles only webhook-specific payload formatting and API calls. */ /** * Webhook payload structure. */ interface WebhookPayload { /** Event type (e.g., "workflow.update", "workflow.complete") */ event: string; /** Timestamp of the event */ timestamp: string; /** Workflow title */ title: string; /** Workflow status (for finalize events) */ status?: WorkflowStatus | "running"; /** Diagram SVG URL (from Kroki or mermaid.ink) */ diagramUrl?: string; /** Kroki SVG URL for visualization. Prefer diagramUrl. */ krokiUrl?: string; /** Diagram provider used ("kroki" or "mermaid-ink") */ diagramProvider?: string; /** Raw Mermaid diagram text */ mermaid?: string; /** The workflow IR */ ir: WorkflowIR; /** Additional metadata */ metadata?: Record; /** Message ID for updates */ messageId?: string; } /** * Webhook Notifier * * Generic HTTP webhook notifier for pushing workflow visualizations * to custom dashboards or services. */ /** * Options for webhook notifier. */ interface WebhookNotifierOptions extends BaseNotifierOptions { /** Webhook URL to POST to */ url: string; /** Optional headers to include in requests */ headers?: Record; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; /** Whether to include raw mermaid text (default: false) */ includeMermaid?: boolean; /** Whether to include diagram URL (default: true). Prefer includeDiagramUrl. */ includeKrokiUrl?: boolean; /** Whether to include diagram URL (default: true) */ includeDiagramUrl?: boolean; /** * Diagram rendering provider configuration. * REQUIRED - no silent default to prevent surprise network calls. */ diagramProvider: ProviderOptions; } /** * Create a webhook notifier. * * @param options - Webhook configuration * @returns A Notifier instance * * @example * ```typescript * import { createWebhookNotifier } from 'awaitly-visualizer/notifiers/webhook'; * * // Using Kroki (default) * const webhook = createWebhookNotifier({ * url: 'https://my-dashboard.com/workflow-events', * headers: { 'X-API-Key': 'secret' }, * diagramProvider: { provider: 'kroki' }, * }); * * // Using mermaid.ink with dark theme * const webhookDark = createWebhookNotifier({ * url: 'https://my-dashboard.com/workflow-events', * diagramProvider: { * provider: 'mermaid-ink', * theme: 'dark', * bgColor: '1b1b1f', * }, * }); * * // One-time notification * await webhook.notify(workflowIR, { title: 'Order Processing' }); * * // Live updates * const live = webhook.createLive({ title: 'Order #123' }); * workflow.on('event', (e) => live.update(e)); * await live.finalize(); * ``` */ declare function createWebhookNotifier(options: WebhookNotifierOptions): Notifier; export { type WebhookNotifierOptions, type WebhookPayload, createWebhookNotifier };