UNPKG

@better-auth-ui/core

Version:

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

81 lines (80 loc) 3.82 kB
/** * Hierarchical mutation key factory for every Better Auth mutation managed by * this library. * * Mutation keys are mostly used for `useIsMutating` and global * `MutationCache` observers (e.g. toast handling), so the keys are static * tuples rather than parameterised factories. Each grouping exposes an * `all` prefix so consumers can match a whole feature at once: * * ```ts * useIsMutating({ mutationKey: authMutationKeys.all }) * useIsMutating({ mutationKey: authMutationKeys.signIn.all }) * useIsMutating({ mutationKey: authMutationKeys.signIn.email }) * ``` * * This factory lives in `@better-auth-ui/core` so it can be shared across * framework packages (`@better-auth-ui/react`, a future `/solid` package, * etc.) — the mutation cache entries line up regardless of which framework * package the mutation options factory came from. * * Plugin-specific mutation keys live alongside their plugin (e.g. * `apiKeyMutationKeys`, `deviceAuthorizationMutationKeys`, * `organizationMutationKeys`, `passkeyMutationKeys`, `magicLinkMutationKeys`, * `multiSessionMutationKeys`, `usernameMutationKeys`, `deleteUserMutationKeys`). * User-initiated plugin sign-in strategies stay under the shared * `["auth", "signIn", ...]` namespace so * `useIsMutating({ mutationKey: authMutationKeys.signIn.all })` still * matches them. Background authentication work can use a separate key when it * must not put interactive sign-in controls into a pending state. * * For query keys, see `authQueryKeys` in `./auth-query-keys`. */ export declare const authMutationKeys: { /** Root key for every Better Auth mutation. */ readonly all: readonly ["auth"]; /** Sign-in mutations, grouped by strategy. */ readonly signIn: { /** Prefix matching every sign-in mutation (including plugin strategies). */ readonly all: readonly ["auth", "signIn"]; /** Key for `signIn.email`. */ readonly email: readonly ["auth", "signIn", "email"]; /** Key for `signIn.social`. */ readonly social: readonly ["auth", "signIn", "social"]; /** Key for `signIn.popup`. */ readonly popup: readonly ["auth", "signIn", "popup"]; }; /** Sign-up mutations, grouped by strategy. */ readonly signUp: { /** Prefix matching every sign-up mutation. */ readonly all: readonly ["auth", "signUp"]; /** Key for `signUp.email`. */ readonly email: readonly ["auth", "signUp", "email"]; }; /** Key for `signOut`. */ readonly signOut: readonly ["auth", "signOut"]; /** Key for `requestPasswordReset`. */ readonly requestPasswordReset: readonly ["auth", "requestPasswordReset"]; /** Key for `resetPassword`. */ readonly resetPassword: readonly ["auth", "resetPassword"]; /** Key for `sendVerificationEmail`. */ readonly sendVerificationEmail: readonly ["auth", "sendVerificationEmail"]; /** Key for `changeEmail`. */ readonly changeEmail: readonly ["auth", "changeEmail"]; /** Key for `changePassword`. */ readonly changePassword: readonly ["auth", "changePassword"]; /** Key for `linkSocial`. */ readonly linkSocial: readonly ["auth", "linkSocial"]; /** Key for `revokeSession`. */ readonly revokeSession: readonly ["auth", "revokeSession"]; /** Key for `revokeOtherSessions`. */ readonly revokeOtherSessions: readonly ["auth", "revokeOtherSessions"]; /** Key for `revokeSessions`. */ readonly revokeSessions: readonly ["auth", "revokeSessions"]; /** Key for `unlinkAccount`. */ readonly unlinkAccount: readonly ["auth", "unlinkAccount"]; /** Key for `updateSession`. */ readonly updateSession: readonly ["auth", "updateSession"]; /** Key for `updateUser`. */ readonly updateUser: readonly ["auth", "updateUser"]; };