export function validateJiraWebhook(body) { if (!body || typeof body !== 'object') { return { valid: false, error: 'Payload must be a JSON object' }; } if (!body.issue?.key || typeof body.issue.key !== 'string') { return { valid: false, error: 'Missing or invalid issue.key' }; } if (!body.issue.fields || typeof body.issue.fields !== 'object') { return { valid: false, error: 'Missing issue.fields' }; } return { valid: true, issueKey: body.issue.key }; } export function validateSupportWebhook(body) { const base = validateJiraWebhook(body); if (!base.valid) { return base; } if (!body.webhookEvent || typeof body.webhookEvent !== 'string') { return { valid: false, error: 'Missing or invalid webhookEvent' }; } return { valid: true, issueKey: base.issueKey }; }