UNPKG

@better-auth-ui/core

Version:

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

17 lines (16 loc) 2.15 kB
import { MutationOptions } from '@tanstack/query-core'; import { BetterFetchError } from 'better-auth/client'; import { OrganizationRolesAuthClient } from './organization-auth-client'; type RoleMethod = "createRole" | "updateRole" | "deleteRole"; type RoleParams<TAuthClient extends OrganizationRolesAuthClient, TMethod extends RoleMethod> = NonNullable<Parameters<TAuthClient["organization"][TMethod]>[0]>; export type CreateRoleParams<TAuthClient extends OrganizationRolesAuthClient = OrganizationRolesAuthClient> = RoleParams<TAuthClient, "createRole">; export type UpdateRoleParams<TAuthClient extends OrganizationRolesAuthClient = OrganizationRolesAuthClient> = RoleParams<TAuthClient, "updateRole">; export type DeleteRoleParams<TAuthClient extends OrganizationRolesAuthClient = OrganizationRolesAuthClient> = RoleParams<TAuthClient, "deleteRole">; type PublicMutationOptions<T> = Omit<T, "mutationKey" | "mutationFn" | "meta">; export declare const createRoleOptions: <T extends OrganizationRolesAuthClient>(authClient: T, userId?: string, organizationId?: string) => MutationOptions<Awaited<ReturnType<T["organization"]["createRole"]>>, BetterFetchError, RoleParams<T, "createRole">, unknown>; export declare const updateRoleOptions: <T extends OrganizationRolesAuthClient>(authClient: T, userId?: string, organizationId?: string) => MutationOptions<Awaited<ReturnType<T["organization"]["updateRole"]>>, BetterFetchError, RoleParams<T, "updateRole">, unknown>; export declare const deleteRoleOptions: <T extends OrganizationRolesAuthClient>(authClient: T, userId?: string, organizationId?: string) => MutationOptions<Awaited<ReturnType<T["organization"]["deleteRole"]>>, BetterFetchError, RoleParams<T, "deleteRole">, unknown>; export type CreateRoleOptions<T extends OrganizationRolesAuthClient> = PublicMutationOptions<ReturnType<typeof createRoleOptions<T>>>; export type UpdateRoleOptions<T extends OrganizationRolesAuthClient> = PublicMutationOptions<ReturnType<typeof updateRoleOptions<T>>>; export type DeleteRoleOptions<T extends OrganizationRolesAuthClient> = PublicMutationOptions<ReturnType<typeof deleteRoleOptions<T>>>; export {};