@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
60 lines (59 loc) • 6.12 kB
TypeScript
/** Query key factory for organization queries, scoped per user. */
export declare const organizationQueryKeys: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization"];
readonly lists: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "list"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "list", NonNullable<TQuery> | null];
readonly details: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "detail"];
readonly detail: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "detail", NonNullable<TQuery> | null];
readonly fullDetails: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "fullDetails"];
readonly fullDetail: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "fullDetails", NonNullable<TQuery> | null];
/**
* Prefix for every active-organization cache entry (used for invalidation
* across slug-partitioned variants).
*/
readonly activeOrganizations: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "active"];
/**
* Cache entry for the currently active organization. Holds a {@link
* ListOrganization}-shaped value — distinct from `fullDetail`, which
* carries members and invitations — so `setActive`'s optimistic update
* (which can only produce a list-shaped org) doesn't corrupt the full
* cache.
*/
readonly activeOrganization: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "active", NonNullable<TQuery> | null];
readonly members: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "members"];
readonly lists: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "members", "list"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "members", "list", NonNullable<TQuery> | null];
/** The signed-in user's own role within an organization. */
readonly activeRole: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "members", "activeRole", NonNullable<TQuery> | null];
};
readonly invitations: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "invitations"];
readonly details: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "invitations", "detail"];
readonly detail: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "invitations", "detail", NonNullable<TQuery> | null];
readonly lists: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "invitations", "list"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "invitations", "list", NonNullable<TQuery> | null];
};
readonly userInvitations: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "userInvitations"];
readonly lists: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "userInvitations", "list"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "userInvitations", "list", NonNullable<TQuery> | null];
};
readonly permissions: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "permissions"];
readonly has: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "permissions", "has", NonNullable<TQuery> | null];
};
readonly roles: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "roles"];
readonly lists: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "roles", "list"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "roles", "list", NonNullable<TQuery> | null];
readonly details: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "roles", "detail"];
readonly detail: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "roles", "detail", NonNullable<TQuery> | null];
};
readonly teams: {
readonly all: (userId: string | undefined) => readonly ["auth", "user", string | undefined, "organization", "teams"];
readonly list: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "teams", "list", NonNullable<TQuery> | null];
readonly userList: <TQuery = undefined>(userId: string | undefined, query?: TQuery) => readonly ["auth", "user", string | undefined, "organization", "teams", "user-list", NonNullable<TQuery> | null];
readonly members: (userId: string | undefined, teamId?: string) => readonly ["auth", "user", string | undefined, "organization", "teams", "members", string | null];
};
};