/**
 * Tags every Supabase call made inside `fn` with `source`.
 *
 * The Supabase JS query builder is a lazy thenable: it does not call `fetch`
 * until `.then()` is invoked (i.e. when the caller `await`s it). If we only
 * call `run(source, fn)` and return the builder, `.then()` fires *outside* the
 * AsyncLocalStorage context and `getSupabaseSource()` returns `undefined`.
 *
 * To fix this, we wrap the result in `Promise.resolve()` inside the `run()`
 * callback. This schedules the microtask (which calls `.then()` on the builder)
 * while still inside the async context, so the source label propagates through
 * to the actual fetch. For plain Promises and non-thenable values the behaviour
 * is unchanged.
 */
export declare function withSupabaseSource<T>(source: string, fn: () => T): Promise<Awaited<T>>;
export declare function getSupabaseSource(): string | undefined;
export declare function enableSupabaseInstrumentation(): void;
export declare function isSupabaseInstrumentationEnabled(): boolean;
export interface SupabaseCallInfo {
    url: string;
    method: string;
    status: number;
    ok: boolean;
    durationMs: number;
    source?: string;
    apikey?: string;
    error?: unknown;
}
export type SupabaseCallRecorder = (info: SupabaseCallInfo) => void;
export declare function setSupabaseCallRecorder(fn: SupabaseCallRecorder): void;
/** A Supabase call slower than this is flagged `slow` regardless of status. */
export declare const SLOW_THRESHOLD_MS = 5000;
/**
 * Parses a Supabase REST/RPC/Functions URL into a low-cardinality operation label.
 * Query strings are discarded so filter values never leak and cardinality
 * stays bounded. `/rest/v1/rpc/get_user_id` => `rpc:get_user_id`;
 * `/rest/v1/apps?...` => `GET apps`;
 * `/functions/v1/files/upload_link` => `POST functions:files/upload_link`.
 */
export declare function deriveSupabaseOperation(url: string, method: string): string;
/**
 * A `fetch` wrapper for supabase-js's `global.fetch`. Times the real request
 * (which runs regardless), captures the active source label, and hands the
 * result to the injected recorder. Returns the real Response / rethrows the
 * real error so supabase-js behavior is never altered. Calls `globalThis.fetch`
 * dynamically (not a captured ref) so it is testable and never self-recurses.
 */
export declare function createTimedFetch(): typeof fetch;
