Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-04-24 23:05:03 +00:00
parent 7701011bc7
commit 74f7a69991
6 changed files with 13 additions and 9 deletions

View file

@ -20,8 +20,9 @@ function randomHex(bytes: number): string {
.join(""); .join("");
} }
// deno-lint-ignore no-explicit-any
async function getDecryptedSecret( async function getDecryptedSecret(
admin: ReturnType<typeof createClient>, admin: any,
secretId: string, secretId: string,
): Promise<string | null> { ): Promise<string | null> {
const { data, error } = await admin const { data, error } = await admin

View file

@ -19,8 +19,9 @@ function jsonResponse(body: unknown, status = 200): Response {
}); });
} }
// deno-lint-ignore no-explicit-any
async function getDecryptedSecret( async function getDecryptedSecret(
admin: ReturnType<typeof createClient>, admin: any,
secretId: string, secretId: string,
): Promise<string | null> { ): Promise<string | null> {
const { data, error } = await admin const { data, error } = await admin

View file

@ -13,8 +13,9 @@ function jsonResponse(body: unknown, status = 200): Response {
}); });
} }
// deno-lint-ignore no-explicit-any
async function getDecryptedSecret( async function getDecryptedSecret(
admin: ReturnType<typeof createClient>, admin: any,
secretId: string, secretId: string,
): Promise<string | null> { ): Promise<string | null> {
const { data, error } = await admin const { data, error } = await admin

View file

@ -3,9 +3,7 @@
// valida com cron-parser, gera human_readable em pt-BR via cronstrue. // valida com cron-parser, gera human_readable em pt-BR via cronstrue.
import { corsHeaders } from "../_shared/cors.ts"; import { corsHeaders } from "../_shared/cors.ts";
import { createClient } from "npm:@supabase/supabase-js@2"; import { createClient } from "npm:@supabase/supabase-js@2";
// @ts-expect-error remote esm
import cronParser from "https://esm.sh/cron-parser@4.9.0"; import cronParser from "https://esm.sh/cron-parser@4.9.0";
// @ts-expect-error remote esm
import cronstrue from "https://esm.sh/cronstrue@2.50.0/i18n"; import cronstrue from "https://esm.sh/cronstrue@2.50.0/i18n";
const LOVABLE_API_KEY = Deno.env.get("LOVABLE_API_KEY")!; const LOVABLE_API_KEY = Deno.env.get("LOVABLE_API_KEY")!;

View file

@ -315,7 +315,8 @@ function jsonResponse(status: number, body: unknown) {
} }
async function failJob( async function failJob(
supabase: ReturnType<typeof createClient>, // deno-lint-ignore no-explicit-any
supabase: any,
agent: { id: string }, agent: { id: string },
jobId: string | null, jobId: string | null,
message: string, message: string,
@ -330,7 +331,8 @@ async function failJob(
} }
async function scheduleRetry( async function scheduleRetry(
supabase: ReturnType<typeof createClient>, // deno-lint-ignore no-explicit-any
supabase: any,
agent: { id: string }, agent: { id: string },
jobId: string, jobId: string,
message: string, message: string,
@ -341,8 +343,8 @@ async function scheduleRetry(
.eq("id", jobId) .eq("id", jobId)
.single(); .single();
const attempt = job?.attempt ?? 1; const attempt: number = (job?.attempt as number | undefined) ?? 1;
const max = job?.max_attempts ?? 5; const max: number = (job?.max_attempts as number | undefined) ?? 5;
if (attempt >= max) { if (attempt >= max) {
await failJob(supabase, agent, jobId, `Max attempts reached. Last error: ${message}`); await failJob(supabase, agent, jobId, `Max attempts reached. Last error: ${message}`);

View file

@ -96,6 +96,7 @@ Deno.serve(async (req) => {
// Carrega nome do cliente para a notificação (best-effort) // Carrega nome do cliente para a notificação (best-effort)
async function loadFullName(): Promise<string> { async function loadFullName(): Promise<string> {
if (!agent) return "—";
const { data } = await supabase const { data } = await supabase
.from("profiles") .from("profiles")
.select("full_name") .select("full_name")