import type { InboundQueueMessage } from "./src/lib/email/inbound"; import type { WebhookRetryMessage } from "./src/lib/email/webhooks"; export function isInboundQueueMessage(payload: unknown): payload is InboundQueueMessage { return ( typeof payload === "object" && payload !== null && "rawR2Key" in payload && "from" in payload && "to" in payload ); } export function isWebhookRetryMessage(payload: unknown): payload is WebhookRetryMessage { return ( typeof payload === "object" && payload !== null && (payload as { kind?: unknown }).kind === "webhook.retry" && typeof (payload as { deliveryId?: unknown }).deliveryId === "string" ); }