UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

28 lines (27 loc) 2.46 kB
import { DataTag, QueryClient, QueryOptions } from '@tanstack/query-core'; import { APIError } from 'better-auth'; import { OrganizationAuthServer } from '../../../plugins/organization/server/organization-auth-server'; export type FullOrganizationData<TAuth extends OrganizationAuthServer = OrganizationAuthServer> = Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>; export type FullOrganizationParams<TAuth extends OrganizationAuthServer = OrganizationAuthServer> = Parameters<TAuth["api"]["getFullOrganization"]>[0]; /** * Query options factory for full organization details (members, invitations, etc.). * * @param auth - The Better Auth server instance. * @param userId - The signed-in user's ID. Used for cache partitioning so * the key matches the client-side `fullOrganizationOptions` for SSR hydration. * @param params - Parameters forwarded to `auth.api.getFullOrganization`. */ export declare function fullOrganizationOptions<TAuth extends OrganizationAuthServer>(auth: TAuth, userId: string, params: FullOrganizationParams<TAuth>): QueryOptions<Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>, APIError, Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>, readonly ["auth", "user", string | undefined, "organization", "fullDetails", { organizationId?: string | undefined; organizationSlug?: string | undefined; membersLimit?: string | number | undefined; } | null], never> & { queryKey: DataTag<readonly ["auth", "user", string | undefined, "organization", "fullDetails", { organizationId?: string | undefined; organizationSlug?: string | undefined; membersLimit?: string | number | undefined; } | null], Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>, APIError>; }; export declare const ensureFullOrganization: <TAuth extends OrganizationAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: FullOrganizationParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>>; export declare const prefetchFullOrganization: <TAuth extends OrganizationAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: FullOrganizationParams<TAuth>) => Promise<void>; export declare const fetchFullOrganization: <TAuth extends OrganizationAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: FullOrganizationParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["getFullOrganization"]>>>;