Skip to main content
Module

x/windmill_helpers/supabase.ts>refreshAndRetryIfExpired

A repository that contains utils functions used by windmill deno scripts
Latest
function refreshAndRetryIfExpired
import { refreshAndRetryIfExpired } from "https://deno.land/x/windmill_helpers@v1.1.1/supabase.ts";

Executes a Supabase query. If possible and needed, refreshes the session and retries once.

Parameters

auth: Resource<"supabase">

Windmill resource representing Supabase credentials (project URL and API key).

token: { access: string; refresh: string; expires_at?: number; } | undefined

Supabase access_token and refresh_token. expires_at (optional) is a UNIX timestamp in seconds.

fn: (client: SupabaseClient) => Promise<{ data: any; error?: any; }>

A function that returns a Supabase query.

Returns

Promise<{ data: any; error?: any; token?: { access: string; refresh: string; expires_at?: number; }; }>

The result of the query appended by the used tokens.