Class SupabaseClient<Database, SchemaNameOrClientOptions, SchemaName, Schema, ClientOptions>

Supabase Client.

An isomorphic Javascript client for interacting with Postgres.

Type Parameters

  • Database = any

  • SchemaNameOrClientOptions extends string & keyof Omit<Database, "__InternalSupabase"> | {
        PostgrestVersion: string;
    } = "public" extends keyof Omit<Database, "__InternalSupabase"> ? "public" : string & keyof Omit<Database, "__InternalSupabase">

  • SchemaName extends string & keyof Omit<Database, "__InternalSupabase"> = SchemaNameOrClientOptions extends string & keyof Omit<Database, "__InternalSupabase"> ? SchemaNameOrClientOptions : "public" extends keyof Omit<Database, "__InternalSupabase"> ? "public" : string & keyof Omit<Omit<Database, "__InternalSupabase">, "__InternalSupabase">

  • Schema extends Omit<Database, "__InternalSupabase">[SchemaName] extends GenericSchema ? Omit<Database, "__InternalSupabase">[SchemaName] : never = Omit<Database, "__InternalSupabase">[SchemaName] extends GenericSchema ? Omit<Database, "__InternalSupabase">[SchemaName] : never

  • ClientOptions extends {
        PostgrestVersion: string;
    } = SchemaNameOrClientOptions extends string & keyof Omit<Database, "__InternalSupabase"> ? Database extends {
        __InternalSupabase: {
            PostgrestVersion: string;
        };
    } ? Database["__InternalSupabase"] : {
        PostgrestVersion: "12";
    } : SchemaNameOrClientOptions extends {
        PostgrestVersion: string;
    } ? SchemaNameOrClientOptions : never

Hierarchy

  • SupabaseClient

Constructors

  • Create a new client for use in the browser.

    Type Parameters

    • Database = any

    • SchemaNameOrClientOptions extends string | {
          PostgrestVersion: string;
      } = "public" extends Exclude<keyof Database, "__InternalSupabase"> ? "public" : string & Exclude<keyof Database, "__InternalSupabase">

    • SchemaName extends string = SchemaNameOrClientOptions extends string & Exclude<keyof Database, "__InternalSupabase"> ? SchemaNameOrClientOptions : "public" extends Exclude<keyof Database, "__InternalSupabase"> ? "public" : string & Exclude<Exclude<keyof Database, "__InternalSupabase">, "__InternalSupabase">

    • Schema extends GenericSchema = Omit<Database, "__InternalSupabase">[SchemaName] extends GenericSchema ? any[any] : never

    • ClientOptions extends {
          PostgrestVersion: string;
      } = SchemaNameOrClientOptions extends string & Exclude<keyof Database, "__InternalSupabase"> ? Database extends {
          __InternalSupabase: {
              PostgrestVersion: string;
          };
      } ? Database["__InternalSupabase"] : {
          PostgrestVersion: "12";
      } : SchemaNameOrClientOptions extends {
          PostgrestVersion: string;
      } ? SchemaNameOrClientOptions : never

    Parameters

    • supabaseUrl: string

      The unique Supabase URL which is supplied when you create a new project in your project dashboard.

    • supabaseKey: string

      The unique Supabase Key which is supplied when you create a new project in your project dashboard.

    • Optional options: SupabaseClientOptions<SchemaName>

    Returns SupabaseClient<Database, SchemaNameOrClientOptions, SchemaName, Schema, ClientOptions>

Properties

accessToken?: (() => Promise<null | string>)

Type declaration

    • (): Promise<null | string>
    • Returns Promise<null | string>

auth: SupabaseAuthClient

Supabase Auth allows you to create and manage user sessions for access to data that is secured by access policies.

authUrl: URL
changedAccessToken?: string
fetch?: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)

Type declaration

    • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
    • Parameters

      • input: RequestInfo | URL
      • Optional init: RequestInit

      Returns Promise<Response>

functionsUrl: URL
headers: Record<string, string>
realtime: RealtimeClient
realtimeUrl: URL
rest: default<Database, ClientOptions, SchemaName, Omit<Database, "__InternalSupabase">[SchemaName] extends GenericSchema ? any[any] : any>
storage: StorageClient

Supabase Storage allows you to manage user-generated content, such as photos or videos.

storageKey: string
storageUrl: URL
supabaseKey: string

The unique Supabase Key which is supplied when you create a new project in your project dashboard.

supabaseUrl: string

The unique Supabase URL which is supplied when you create a new project in your project dashboard.

Accessors

  • get functions(): FunctionsClient
  • Supabase Functions allows you to deploy and invoke edge functions.

    Returns FunctionsClient

Methods

  • Parameters

    • __namedParameters: SupabaseAuthClientOptions
    • Optional headers: Record<string, string>
    • Optional fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>)
        • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optional init: RequestInit

          Returns Promise<Response>

    Returns SupabaseAuthClient

  • Perform a query on a table or a view.

    Type Parameters

    Parameters

    • relation: TableName

      The table or view name to query

    Returns default<ClientOptions, Schema, Table, TableName, Table extends {
        Relationships: R;
    } ? R : unknown>

  • Perform a query on a table or a view.

    Type Parameters

    Parameters

    • relation: ViewName

      The table or view name to query

    Returns default<ClientOptions, Schema, View, ViewName, View extends {
        Relationships: R;
    } ? R : unknown>

  • Unsubscribes and removes all Realtime channels from Realtime client.

    Returns Promise<("error" | "ok" | "timed out")[]>

  • Unsubscribes and removes Realtime channel from Realtime client.

    Parameters

    Returns Promise<"error" | "ok" | "timed out">

  • Perform a function call.

    Type Parameters

    Parameters

    • fn: FnName

      The function name to call

    • args: Fn["Args"] = {}

      The arguments to pass to the function call

    • options: {
          count?: "exact" | "planned" | "estimated";
          get?: boolean;
          head?: boolean;
      } = {}

      Named parameters

      • Optional count?: "exact" | "planned" | "estimated"

        Count algorithm to use to count rows returned by the function. Only applicable for set-returning functions.

        "exact": Exact but slow count algorithm. Performs a COUNT(*) under the hood.

        "planned": Approximated but fast count algorithm. Uses the Postgres statistics under the hood.

        "estimated": Uses exact count for low numbers and planned count for high numbers.

      • Optional get?: boolean

        When set to true, the function will be called with read-only access mode.

      • Optional head?: boolean

        When set to true, data will not be returned. Useful if you only need the count.

    Returns default<ClientOptions, Schema, Fn["Returns"] extends any[] ? any[any][number] extends Record<string, unknown> ? any[any] : never : never, Fn["Returns"], FnName, null, "RPC">

  • Select a schema to query or perform an function (rpc) call.

    The schema needs to be on the list of exposed schemas inside Supabase.

    Type Parameters

    • DynamicSchema extends string

    Parameters

    • schema: DynamicSchema

      The schema to query

    Returns default<Database, ClientOptions, DynamicSchema, Database[DynamicSchema] extends GenericSchema ? any[any] : any>

Generated using TypeDoc