17 lines
417 B
TypeScript

import { Webhook } from './types.js';
export function validateWebhookUrl(url: string): boolean {
try {
const parsed = new URL(url);
return parsed.protocol === 'https:';
} catch {
return false;
}
}
export function getWebhookHealth(webhook: Webhook): 'healthy' | 'warning' | 'error' {
if (webhook.status === 'failed') return 'error';
if (!webhook.active) return 'warning';
return 'healthy';
}