diff --git a/src/routes/lovable/email/queue/process.ts b/src/routes/lovable/email/queue/process.ts index c424679..4608eec 100644 --- a/src/routes/lovable/email/queue/process.ts +++ b/src/routes/lovable/email/queue/process.ts @@ -2,11 +2,6 @@ import { sendLovableEmail } from '@lovable.dev/email-js' import { createClient } from '@supabase/supabase-js' import { createFileRoute } from '@tanstack/react-router' -// The email infra tables (email_send_log, email_send_state, etc.) are not in -// the generated Database types, so we use an untyped client throughout this -// route. Tables are created by the email infra migration. -type AnyClient = ReturnType> - const MAX_RETRIES = 5 const DEFAULT_BATCH_SIZE = 10 const DEFAULT_SEND_DELAY_MS = 200 @@ -42,7 +37,7 @@ function getRetryAfterSeconds(error: unknown): number { // Move a message to the dead letter queue and log the reason. async function moveToDlq( - supabase: AnyClient, + supabase: ReturnType, queue: string, msg: { msg_id: number; message: Record }, reason: string @@ -94,7 +89,7 @@ export const Route = createFileRoute("/lovable/email/queue/process")({ return Response.json({ error: 'Forbidden' }, { status: 403 }) } - const supabase = createClient(supabaseUrl, supabaseServiceKey) + const supabase = createClient(supabaseUrl, supabaseServiceKey) // 1. Check rate-limit cooldown and read queue config const { data: state } = await supabase