import { AuthError, PostgrestError, Provider } from "@supabase/supabase-js";
import { Permission, Project } from "../data/types";
import { Permissions } from "../redux/reducers/projects";
import { SupabaseDatabase, SupabaseProject, SupabaseSession, SupabaseTeam, SupabaseUser, SupabaseUserProfile } from "./supabase-types";
/**
 * Error handling
 */
export interface CustomError {
    type: "custom-error";
    message: string;
}
export interface SupabaseError {
    type: "supabase-error";
    code?: string;
    message: string;
}
export declare function createSupabaseError(error: PostgrestError | AuthError | CustomError): SupabaseError;
export declare function isJWTError(error: any): error is AuthError;
export declare function isSupabaseError(error: any): error is SupabaseError;
/**
 * Authentication
 */
export declare function signInWithGoogleOAuth(): Promise<Provider | SupabaseError>;
/**
 * Users
 */
export declare function getSession(): Promise<SupabaseSession | null>;
export declare function getUser(jwt?: string): Promise<SupabaseUser | null>;
/**
 * Teams
 */
export declare function getTeam(): Promise<SupabaseTeam | SupabaseError>;
/**
 * User Profile
 */
export declare function getUserProfile(): Promise<SupabaseUserProfile | SupabaseError>;
export declare function setUserProfile(profile: SupabaseUserProfile): Promise<SupabaseUserProfile | SupabaseError>;
export declare function setUserProfileHasDismissedGettingStartedBanner({ id, hasDismissedGettingStartedBanner, }: {
    id: string;
    hasDismissedGettingStartedBanner: boolean;
}): Promise<SupabaseUserProfile | SupabaseError>;
export declare function setUserProfileHasOnboarded({ id, hasOnboarded, }: {
    id: string;
    hasOnboarded: boolean;
}): Promise<SupabaseUserProfile | SupabaseError>;
/**
 * Projects
 */
export declare function getRawSupabaseProject({ truncatedId, }: {
    truncatedId?: string;
}): Promise<SupabaseProject | SupabaseError | null>;
export interface ProjectMetadata {
    truncated_id: string;
    name: string;
    updated_at: string;
}
export declare function listSupabaseProjectsMetadata(): Promise<ProjectMetadata[] | SupabaseError | null>;
export declare function listSupabaseProjectPermissions(truncatedId: string): Promise<Permissions | SupabaseError>;
export declare function updateSupabaseProjectPermission({ truncatedId, definitionId, permission, }: {
    truncatedId: string;
    definitionId: string;
    permission: Permission;
}): Promise<void | SupabaseError>;
export declare function createProject({ id, teamId, project, name, }: {
    id: string;
    teamId: number;
    project: Project;
    name: string;
}): Promise<SupabaseProject | SupabaseError>;
export declare function duplicateProject({ id, truncatedIdToDuplicate, name, }: {
    id: string;
    truncatedIdToDuplicate: string;
    name: string;
}): Promise<SupabaseError | void>;
export declare function deleteProject({ truncatedId }: {
    truncatedId: string;
}): Promise<SupabaseError | void>;
export declare function updateSupabaseProjectMetadataRaw(truncatedId: string, supabaseUpdate: SupabaseDatabase["public"]["Tables"]["projects"]["Update"]): Promise<SupabaseError | void>;
export declare function updateSupabaseProjectRaw(id: string, update: {
    project: Project;
    commitVersion: number;
    opsTransactionId: string | null;
    schemaVersion: number;
}): Promise<SupabaseError | {
    subframe_import_alias: string;
}>;
export declare function updateSubframeImportAlias(id: string, alias: string): Promise<SupabaseError | void>;
//# sourceMappingURL=supabase-api.d.ts.map