@better-auth-ui/core 1.6.9 → 1.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/config/auth-config.d.ts +8 -8
  2. package/dist/config/index.d.ts +4 -4
  3. package/dist/create-auth-plugin-CnH7jMHA.js +199 -0
  4. package/dist/index.d.ts +11 -11
  5. package/dist/index.js +103 -11
  6. package/dist/lib/auth-plugin.d.ts +1 -1
  7. package/dist/lib/create-auth-plugin.d.ts +1 -1
  8. package/dist/lib/provider-names.d.ts +1 -1
  9. package/dist/lib/utils.d.ts +1 -1
  10. package/dist/plugins/api-key/api-key-plugin.d.ts +1 -1
  11. package/dist/plugins/delete-user/delete-user-plugin.d.ts +1 -1
  12. package/dist/plugins/magic-link/magic-link-plugin.d.ts +1 -1
  13. package/dist/plugins/multi-session/multi-session-plugin.d.ts +1 -1
  14. package/dist/plugins/organization/organization-plugin.d.ts +3 -3
  15. package/dist/plugins/passkey/passkey-plugin.d.ts +1 -1
  16. package/dist/plugins/theme/theme-plugin.d.ts +1 -1
  17. package/dist/plugins/username/username-plugin.d.ts +1 -1
  18. package/dist/plugins.d.ts +28 -28
  19. package/dist/plugins.js +360 -28
  20. package/package.json +2 -2
  21. package/dist/config/additional-fields-config.js +0 -39
  22. package/dist/config/auth-config.js +0 -34
  23. package/dist/config/avatar-config.js +0 -1
  24. package/dist/config/email-and-password-config.js +0 -1
  25. package/dist/config/index.js +0 -4
  26. package/dist/lib/auth-mutation-keys.js +0 -70
  27. package/dist/lib/auth-plugin.js +0 -1
  28. package/dist/lib/auth-query-keys.js +0 -42
  29. package/dist/lib/base-paths.js +0 -5
  30. package/dist/lib/create-auth-plugin.js +0 -23
  31. package/dist/lib/deep-partial.js +0 -1
  32. package/dist/lib/localization.js +0 -150
  33. package/dist/lib/provider-names.js +0 -50
  34. package/dist/lib/utils.js +0 -116
  35. package/dist/lib/view-paths.js +0 -13
  36. package/dist/plugins/api-key/api-key-localization.js +0 -24
  37. package/dist/plugins/api-key/api-key-mutation-keys.js +0 -11
  38. package/dist/plugins/api-key/api-key-plugin.js +0 -6
  39. package/dist/plugins/api-key/api-key-query-keys.js +0 -7
  40. package/dist/plugins/delete-user/delete-user-localization.js +0 -10
  41. package/dist/plugins/delete-user/delete-user-mutation-keys.js +0 -7
  42. package/dist/plugins/delete-user/delete-user-plugin.js +0 -6
  43. package/dist/plugins/magic-link/magic-link-localization.js +0 -8
  44. package/dist/plugins/magic-link/magic-link-mutation-keys.js +0 -17
  45. package/dist/plugins/magic-link/magic-link-plugin.js +0 -8
  46. package/dist/plugins/multi-session/multi-session-localization.js +0 -10
  47. package/dist/plugins/multi-session/multi-session-mutation-keys.js +0 -11
  48. package/dist/plugins/multi-session/multi-session-plugin.js +0 -5
  49. package/dist/plugins/multi-session/multi-session-query-keys.js +0 -7
  50. package/dist/plugins/organization/organization-localization.js +0 -114
  51. package/dist/plugins/organization/organization-mutation-keys.js +0 -40
  52. package/dist/plugins/organization/organization-plugin.js +0 -35
  53. package/dist/plugins/organization/organization-query-keys.js +0 -54
  54. package/dist/plugins/organization/organization-view-paths.js +0 -1
  55. package/dist/plugins/passkey/passkey-localization.js +0 -20
  56. package/dist/plugins/passkey/passkey-mutation-keys.js +0 -15
  57. package/dist/plugins/passkey/passkey-plugin.js +0 -5
  58. package/dist/plugins/passkey/passkey-query-keys.js +0 -7
  59. package/dist/plugins/theme/theme-localization.js +0 -12
  60. package/dist/plugins/theme/theme-plugin.js +0 -8
  61. package/dist/plugins/username/username-localization.js +0 -16
  62. package/dist/plugins/username/username-mutation-keys.js +0 -17
  63. package/dist/plugins/username/username-plugin.js +0 -36
package/dist/plugins.js CHANGED
@@ -1,28 +1,360 @@
1
- export * from "./plugins/api-key/api-key-localization";
2
- export * from "./plugins/api-key/api-key-mutation-keys";
3
- export * from "./plugins/api-key/api-key-plugin";
4
- export * from "./plugins/api-key/api-key-query-keys";
5
- export * from "./plugins/delete-user/delete-user-localization";
6
- export * from "./plugins/delete-user/delete-user-mutation-keys";
7
- export * from "./plugins/delete-user/delete-user-plugin";
8
- export * from "./plugins/magic-link/magic-link-localization";
9
- export * from "./plugins/magic-link/magic-link-mutation-keys";
10
- export * from "./plugins/magic-link/magic-link-plugin";
11
- export * from "./plugins/multi-session/multi-session-localization";
12
- export * from "./plugins/multi-session/multi-session-mutation-keys";
13
- export * from "./plugins/multi-session/multi-session-plugin";
14
- export * from "./plugins/multi-session/multi-session-query-keys";
15
- export * from "./plugins/organization/organization-localization";
16
- export * from "./plugins/organization/organization-mutation-keys";
17
- export * from "./plugins/organization/organization-plugin";
18
- export * from "./plugins/organization/organization-query-keys";
19
- export * from "./plugins/organization/organization-view-paths";
20
- export * from "./plugins/passkey/passkey-localization";
21
- export * from "./plugins/passkey/passkey-mutation-keys";
22
- export * from "./plugins/passkey/passkey-plugin";
23
- export * from "./plugins/passkey/passkey-query-keys";
24
- export * from "./plugins/theme/theme-localization";
25
- export * from "./plugins/theme/theme-plugin";
26
- export * from "./plugins/username/username-localization";
27
- export * from "./plugins/username/username-mutation-keys";
28
- export * from "./plugins/username/username-plugin";
1
+ import { n as e, r as t, t as n } from "./create-auth-plugin-CnH7jMHA.js";
2
+ //#region src/plugins/api-key/api-key-localization.ts
3
+ var r = {
4
+ apiKey: "API key",
5
+ apiKeys: "API keys",
6
+ apiKeysDescription: "Create an API key for programmatic access to your account.",
7
+ createApiKey: "Create API key",
8
+ noApiKeys: "No API keys",
9
+ name: "Name",
10
+ newApiKey: "New API key",
11
+ newApiKeyWarning: "This is the only time you'll see this API key. Copy and store it somewhere safe.",
12
+ deleteApiKey: "Delete API key",
13
+ deleteApiKeyWarning: "This action cannot be undone. Any service using this API key will stop working immediately.",
14
+ dismissNewKey: "I've saved my key"
15
+ }, i = {
16
+ all: ["auth", "apiKey"],
17
+ create: [
18
+ "auth",
19
+ "apiKey",
20
+ "create"
21
+ ],
22
+ delete: [
23
+ "auth",
24
+ "apiKey",
25
+ "delete"
26
+ ]
27
+ }, a = n("apiKey", (e = {}) => ({
28
+ localization: {
29
+ ...r,
30
+ ...e.localization
31
+ },
32
+ organization: e.organization ?? !1
33
+ })), o = {
34
+ all: (t) => [...e.user(t), "apiKey"],
35
+ lists: (e) => [...o.all(e), "list"],
36
+ list: (e, t) => [...o.lists(e), t ?? null]
37
+ }, s = {
38
+ deleteAccount: "Delete account",
39
+ deleteAccountDescription: "Permanently remove your account and all associated data. This cannot be undone.",
40
+ deleteUserVerificationSent: "Check your email to confirm account deletion.",
41
+ deleteUserSuccess: "Your account has been deleted."
42
+ }, c = { deleteUser: ["auth", "deleteUser"] }, l = n("deleteUser", (e = {}) => ({
43
+ localization: {
44
+ ...s,
45
+ ...e.localization
46
+ },
47
+ sendDeleteAccountVerification: e.sendDeleteAccountVerification ?? !1
48
+ })), u = {
49
+ magicLink: "Magic Link",
50
+ sendMagicLink: "Send Magic Link",
51
+ magicLinkSent: "Check your email for the magic link"
52
+ }, d = { signIn: [
53
+ "auth",
54
+ "signIn",
55
+ "magicLink"
56
+ ] }, f = n("magicLink", (e = {}) => ({
57
+ localization: {
58
+ ...u,
59
+ ...e.localization
60
+ },
61
+ viewPaths: { auth: { magicLink: e.path ?? "magic-link" } }
62
+ })), p = {
63
+ switchAccount: "Switch Account",
64
+ addAccount: "Add Account",
65
+ manageAccounts: "Manage accounts",
66
+ manageAccountsDescription: "Manage your accounts for secure access."
67
+ }, m = {
68
+ all: ["auth", "multiSession"],
69
+ revoke: [
70
+ "auth",
71
+ "multiSession",
72
+ "revoke"
73
+ ],
74
+ setActive: [
75
+ "auth",
76
+ "multiSession",
77
+ "setActive"
78
+ ]
79
+ }, h = n("multiSession", (e = {}) => ({ localization: {
80
+ ...p,
81
+ ...e.localization
82
+ } })), g = {
83
+ all: (t) => [...e.user(t), "multiSession"],
84
+ lists: (e) => [...g.all(e), "list"],
85
+ list: (e, t) => [...g.lists(e), t ?? null]
86
+ }, _ = {
87
+ accept: "Accept",
88
+ accepted: "Accepted",
89
+ actions: "Actions",
90
+ admin: "Admin",
91
+ all: "All",
92
+ canceled: "Canceled",
93
+ cancelInvitation: "Cancel invitation",
94
+ changeLogo: "Change logo",
95
+ changeMemberRole: "Change role",
96
+ clear: "Clear",
97
+ createOrganization: "Create organization",
98
+ deleteLogo: "Delete logo",
99
+ deleteOrganization: "Delete organization",
100
+ deleteOrganizationDescription: "Permanently delete this organization and all of its data. All members will lose access and this cannot be undone.",
101
+ invitations: "Invitations",
102
+ invitedAt: "Invited at",
103
+ inviteMember: "Invite member",
104
+ inviteMemberSuccess: "Member invited successfully",
105
+ inviteMemberDescription: "We'll email them a link to join this organization. Choose the role they'll have once they accept.",
106
+ leftOrganization: "You left the organization",
107
+ leaveOrganization: "Leave organization",
108
+ leaveOrganizationDescription: "Leave this organization and lose access to its data and resources. You'll need a new invitation to rejoin.",
109
+ logo: "Logo",
110
+ logoChangedSuccess: "Logo updated successfully",
111
+ logoDeletedSuccess: "Logo removed successfully",
112
+ manage: "Manage",
113
+ member: "Member",
114
+ memberRemoved: "Member removed",
115
+ memberRoleUpdated: "Member role updated",
116
+ members: "Members",
117
+ people: "People",
118
+ name: "Name",
119
+ namePlaceholder: "Enter the organization name",
120
+ noInvitations: "No invitations",
121
+ noOrganizations: "No organizations",
122
+ organization: "Organization",
123
+ organizationDeleted: "Organization deleted",
124
+ organizationInvitationsEmptyDescription: "Invite a teammate to collaborate in this organization.",
125
+ organizations: "Organizations",
126
+ organizationsDescription: "Create an organization to collaborate with others and manage shared access.",
127
+ organizationProfile: "Organization profile",
128
+ organizationUpdatedSuccess: "Organization updated successfully",
129
+ owner: "Owner",
130
+ pending: "Pending",
131
+ personalAccount: "Personal account",
132
+ rejected: "Rejected",
133
+ rejectInvitation: "Reject invitation",
134
+ removeMember: "Remove member",
135
+ removeMemberWarning: "Are you sure you want to remove this member from the organization? They will lose access immediately.",
136
+ role: "Role",
137
+ search: "Search...",
138
+ slug: "Slug",
139
+ slugPlaceholder: "organization-slug",
140
+ status: "Status",
141
+ uploadLogo: "Upload logo",
142
+ userInvitationsEmptyDescription: "Invitations to join an organization will show up here."
143
+ }, v = {
144
+ all: ["auth", "organization"],
145
+ create: [
146
+ "auth",
147
+ "organization",
148
+ "create"
149
+ ],
150
+ delete: [
151
+ "auth",
152
+ "organization",
153
+ "delete"
154
+ ],
155
+ update: [
156
+ "auth",
157
+ "organization",
158
+ "update"
159
+ ],
160
+ setActive: [
161
+ "auth",
162
+ "organization",
163
+ "setActive"
164
+ ],
165
+ inviteMember: [
166
+ "auth",
167
+ "organization",
168
+ "inviteMember"
169
+ ],
170
+ removeMember: [
171
+ "auth",
172
+ "organization",
173
+ "removeMember"
174
+ ],
175
+ leave: [
176
+ "auth",
177
+ "organization",
178
+ "leave"
179
+ ],
180
+ updateMemberRole: [
181
+ "auth",
182
+ "organization",
183
+ "updateMemberRole"
184
+ ],
185
+ acceptInvitation: [
186
+ "auth",
187
+ "organization",
188
+ "acceptInvitation"
189
+ ],
190
+ cancelInvitation: [
191
+ "auth",
192
+ "organization",
193
+ "cancelInvitation"
194
+ ],
195
+ rejectInvitation: [
196
+ "auth",
197
+ "organization",
198
+ "rejectInvitation"
199
+ ],
200
+ checkSlug: [
201
+ "auth",
202
+ "organization",
203
+ "checkSlug"
204
+ ]
205
+ }, y = n("organization", (e = {}) => {
206
+ let n = {
207
+ ..._,
208
+ ...e.localization
209
+ };
210
+ return {
211
+ slug: e.slug,
212
+ checkSlug: e.checkSlug ?? !0,
213
+ localization: n,
214
+ logo: {
215
+ ...t.avatar,
216
+ ...e.logo
217
+ },
218
+ roles: {
219
+ ...e.roles ?? {
220
+ owner: n.owner,
221
+ admin: n.admin,
222
+ member: n.member
223
+ },
224
+ ...e.additionalRoles
225
+ },
226
+ viewPaths: {
227
+ settings: { organizations: e.viewPaths?.settings?.organizations ?? "organizations" },
228
+ organization: {
229
+ settings: e.viewPaths?.organization?.settings ?? "settings",
230
+ people: e.viewPaths?.organization?.people ?? "people"
231
+ }
232
+ }
233
+ };
234
+ }), b = {
235
+ all: (t) => [...e.user(t), "organization"],
236
+ lists: (e) => [...b.all(e), "list"],
237
+ list: (e, t) => [...b.lists(e), t ?? null],
238
+ fullDetails: (e) => [...b.all(e), "fullDetails"],
239
+ fullDetail: (e, t) => [...b.fullDetails(e), t ?? null],
240
+ activeOrganizations: (e) => [...b.all(e), "active"],
241
+ activeOrganization: (e, t) => [...b.activeOrganizations(e), t ?? null],
242
+ members: {
243
+ all: (e) => [...b.all(e), "members"],
244
+ lists: (e) => [...b.members.all(e), "list"],
245
+ list: (e, t) => [...b.members.lists(e), t ?? null]
246
+ },
247
+ invitations: {
248
+ all: (e) => [...b.all(e), "invitations"],
249
+ lists: (e) => [...b.invitations.all(e), "list"],
250
+ list: (e, t) => [...b.invitations.lists(e), t ?? null]
251
+ },
252
+ userInvitations: {
253
+ all: (e) => [...b.all(e), "userInvitations"],
254
+ lists: (e) => [...b.userInvitations.all(e), "list"],
255
+ list: (e, t) => [...b.userInvitations.lists(e), t ?? null]
256
+ },
257
+ permissions: {
258
+ all: (e) => [...b.all(e), "permissions"],
259
+ has: (e, t) => [
260
+ ...b.permissions.all(e),
261
+ "has",
262
+ t ?? null
263
+ ]
264
+ }
265
+ }, x = {
266
+ passkey: "Passkey",
267
+ addPasskey: "Add passkey",
268
+ deletePasskey: "Delete passkey {{name}}",
269
+ deletePasskeyTitle: "Delete passkey",
270
+ deletePasskeyWarning: "This action cannot be undone. You will need to add this passkey again before you can use it to sign in.",
271
+ passkeys: "Passkeys",
272
+ passkeysDescription: "Create a passkey to securely access your account.",
273
+ noPasskeys: "No passkeys",
274
+ name: "Name"
275
+ }, S = {
276
+ signIn: [
277
+ "auth",
278
+ "signIn",
279
+ "passkey"
280
+ ],
281
+ addPasskey: [
282
+ "auth",
283
+ "passkey",
284
+ "addPasskey"
285
+ ],
286
+ deletePasskey: [
287
+ "auth",
288
+ "passkey",
289
+ "deletePasskey"
290
+ ]
291
+ }, C = n("passkey", (e = {}) => ({ localization: {
292
+ ...x,
293
+ ...e.localization
294
+ } })), w = {
295
+ all: (t) => [...e.user(t), "passkey"],
296
+ lists: (e) => [...w.all(e), "list"],
297
+ list: (e, t) => [...w.lists(e), t ?? null]
298
+ }, T = {
299
+ appearance: "Appearance",
300
+ theme: "Theme",
301
+ system: "System",
302
+ light: "Light",
303
+ dark: "Dark"
304
+ }, E = n("theme", (e) => ({
305
+ localization: {
306
+ ...T,
307
+ ...e.localization
308
+ },
309
+ theme: e.theme ?? "system",
310
+ setTheme: e.setTheme,
311
+ themes: e.themes ?? [
312
+ "system",
313
+ "light",
314
+ "dark"
315
+ ]
316
+ })), D = {
317
+ username: "Username",
318
+ usernamePlaceholder: "Enter your username",
319
+ usernameOrEmailPlaceholder: "Enter your username or email",
320
+ usernameAvailable: "Username is available",
321
+ usernameTaken: "Username is already taken. Please try another.",
322
+ displayUsername: "Display Username",
323
+ displayUsernamePlaceholder: "Enter your display username"
324
+ }, O = {
325
+ signIn: [
326
+ "auth",
327
+ "signIn",
328
+ "username"
329
+ ],
330
+ isUsernameAvailable: ["auth", "isUsernameAvailable"]
331
+ }, k = n("username", (e = {}) => {
332
+ let t = e.minUsernameLength ?? 3, n = e.maxUsernameLength ?? 30, r = {
333
+ ...D,
334
+ ...e.localization
335
+ };
336
+ return {
337
+ ...e,
338
+ minUsernameLength: t,
339
+ maxUsernameLength: n,
340
+ localization: r,
341
+ additionalFields: [{
342
+ name: "username",
343
+ type: "string",
344
+ label: r.username,
345
+ placeholder: r.usernamePlaceholder,
346
+ inputType: "input",
347
+ signUp: "above",
348
+ required: !0
349
+ }, ...e.displayUsername ? [{
350
+ name: "displayUsername",
351
+ type: "string",
352
+ label: r.displayUsername,
353
+ placeholder: r.displayUsernamePlaceholder,
354
+ inputType: "input",
355
+ signUp: "above"
356
+ }] : []]
357
+ };
358
+ });
359
+ //#endregion
360
+ export { r as apiKeyLocalization, i as apiKeyMutationKeys, a as apiKeyPlugin, o as apiKeyQueryKeys, s as deleteUserLocalization, c as deleteUserMutationKeys, l as deleteUserPlugin, u as magicLinkLocalization, d as magicLinkMutationKeys, f as magicLinkPlugin, p as multiSessionLocalization, m as multiSessionMutationKeys, h as multiSessionPlugin, g as multiSessionQueryKeys, _ as organizationLocalization, v as organizationMutationKeys, y as organizationPlugin, b as organizationQueryKeys, x as passkeyLocalization, S as passkeyMutationKeys, C as passkeyPlugin, w as passkeyQueryKeys, T as themeLocalization, E as themePlugin, D as usernameLocalization, O as usernameMutationKeys, k as usernamePlugin };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@better-auth-ui/core",
3
- "version": "1.6.9",
3
+ "version": "1.6.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "build": "tsc",
6
+ "build": "vite build",
7
7
  "test": "vitest"
8
8
  },
9
9
  "files": [
@@ -1,39 +0,0 @@
1
- /**
2
- * Convert a raw form value into the JS value Better Auth expects.
3
- * Returns `null` for blank input (explicit clear), `undefined` when omitted
4
- * or unparseable. Booleans always return `true`/`false`.
5
- */
6
- export function parseAdditionalFieldValue(field, raw) {
7
- if (field.type === "boolean") {
8
- // FormData: checked checkbox/switch sends "on"; unchecked sends nothing.
9
- return raw === "on" || raw === "true";
10
- }
11
- if (raw == null)
12
- return undefined;
13
- if (raw === "")
14
- return null;
15
- if (field.type === "number") {
16
- const parsed = Number(raw);
17
- return Number.isNaN(parsed) ? undefined : parsed;
18
- }
19
- if (field.type === "date") {
20
- const parsed = new Date(raw);
21
- return Number.isNaN(parsed.getTime()) ? undefined : parsed;
22
- }
23
- return raw;
24
- }
25
- /** Resolve the effective `inputType`, defaulting based on `field.type`. */
26
- export function resolveInputType(field) {
27
- if (field.inputType)
28
- return field.inputType;
29
- switch (field.type) {
30
- case "number":
31
- return "number";
32
- case "boolean":
33
- return "switch";
34
- case "date":
35
- return "date";
36
- default:
37
- return "input";
38
- }
39
- }
@@ -1,34 +0,0 @@
1
- import { basePaths } from "../lib/base-paths";
2
- import { localization } from "../lib/localization";
3
- import { resizeAvatar } from "../lib/utils";
4
- import { viewPaths } from "../lib/view-paths";
5
- export const defaultAuthConfig = {
6
- avatar: {
7
- enabled: true,
8
- resize: resizeAvatar,
9
- size: 256,
10
- extension: "png"
11
- },
12
- basePaths,
13
- baseURL: "",
14
- emailAndPassword: {
15
- enabled: true,
16
- forgotPassword: true,
17
- name: true,
18
- rememberMe: false,
19
- minPasswordLength: 8,
20
- maxPasswordLength: 128
21
- },
22
- plugins: [],
23
- redirectTo: "/",
24
- viewPaths,
25
- localization,
26
- navigate: ({ to, replace }) => {
27
- if (replace) {
28
- window.location.replace(to);
29
- }
30
- else {
31
- window.location.href = to;
32
- }
33
- }
34
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export * from "./additional-fields-config";
2
- export * from "./auth-config";
3
- export * from "./avatar-config";
4
- export * from "./email-and-password-config";
@@ -1,70 +0,0 @@
1
- /**
2
- * Hierarchical mutation key factory for every Better Auth mutation managed by
3
- * this library.
4
- *
5
- * Mutation keys are mostly used for `useIsMutating` and global
6
- * `MutationCache` observers (e.g. toast handling), so the keys are static
7
- * tuples rather than parameterised factories. Each grouping exposes an
8
- * `all` prefix so consumers can match a whole feature at once:
9
- *
10
- * ```ts
11
- * useIsMutating({ mutationKey: authMutationKeys.all })
12
- * useIsMutating({ mutationKey: authMutationKeys.signIn.all })
13
- * useIsMutating({ mutationKey: authMutationKeys.signIn.email })
14
- * ```
15
- *
16
- * This factory lives in `@better-auth-ui/core` so it can be shared across
17
- * framework packages (`@better-auth-ui/react`, a future `/solid` package,
18
- * etc.) — the mutation cache entries line up regardless of which framework
19
- * package the mutation options factory came from.
20
- *
21
- * Plugin-specific mutation keys live alongside their plugin (e.g.
22
- * `apiKeyMutationKeys`, `organizationMutationKeys`, `passkeyMutationKeys`,
23
- * `magicLinkMutationKeys`, `multiSessionMutationKeys`, `usernameMutationKeys`,
24
- * `deleteUserMutationKeys`). Plugin-contributed sign-in strategies stay
25
- * under the shared `["auth", "signIn", ...]` namespace so
26
- * `useIsMutating({ mutationKey: authMutationKeys.signIn.all })` still
27
- * matches them.
28
- *
29
- * For query keys, see `authQueryKeys` in `./auth-query-keys`.
30
- */
31
- export const authMutationKeys = {
32
- /** Root key for every Better Auth mutation. */
33
- all: ["auth"],
34
- /** Sign-in mutations, grouped by strategy. */
35
- signIn: {
36
- /** Prefix matching every sign-in mutation (including plugin strategies). */
37
- all: ["auth", "signIn"],
38
- /** Key for `signIn.email`. */
39
- email: ["auth", "signIn", "email"],
40
- /** Key for `signIn.social`. */
41
- social: ["auth", "signIn", "social"]
42
- },
43
- /** Sign-up mutations, grouped by strategy. */
44
- signUp: {
45
- /** Prefix matching every sign-up mutation. */
46
- all: ["auth", "signUp"],
47
- /** Key for `signUp.email`. */
48
- email: ["auth", "signUp", "email"]
49
- },
50
- /** Key for `signOut`. */
51
- signOut: ["auth", "signOut"],
52
- /** Key for `requestPasswordReset`. */
53
- requestPasswordReset: ["auth", "requestPasswordReset"],
54
- /** Key for `resetPassword`. */
55
- resetPassword: ["auth", "resetPassword"],
56
- /** Key for `sendVerificationEmail`. */
57
- sendVerificationEmail: ["auth", "sendVerificationEmail"],
58
- /** Key for `changeEmail`. */
59
- changeEmail: ["auth", "changeEmail"],
60
- /** Key for `changePassword`. */
61
- changePassword: ["auth", "changePassword"],
62
- /** Key for `linkSocial`. */
63
- linkSocial: ["auth", "linkSocial"],
64
- /** Key for `revokeSession`. */
65
- revokeSession: ["auth", "revokeSession"],
66
- /** Key for `unlinkAccount`. */
67
- unlinkAccount: ["auth", "unlinkAccount"],
68
- /** Key for `updateUser`. */
69
- updateUser: ["auth", "updateUser"]
70
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- /**
2
- * Hierarchical query key factory for every Better Auth query managed by
3
- * this library.
4
- *
5
- * Keys are nested — higher-level keys are valid prefixes of their
6
- * descendants — so a single call can invalidate a whole subtree:
7
- *
8
- * ```ts
9
- * queryClient.invalidateQueries({ queryKey: authQueryKeys.all })
10
- * queryClient.invalidateQueries({ queryKey: authQueryKeys.user(userId) })
11
- * queryClient.invalidateQueries({ queryKey: authQueryKeys.session })
12
- * ```
13
- *
14
- * This factory lives in `@better-auth-ui/core` so it can be shared across
15
- * framework packages (`@better-auth-ui/react`, a future `/solid` package,
16
- * etc.) and across client- and server-side query variants — the cache
17
- * entries line up regardless of which query options factory produced them.
18
- *
19
- * Plugin-specific query keys live alongside their plugin (e.g.
20
- * `apiKeyQueryKeys`, `organizationQueryKeys`, `passkeyQueryKeys`,
21
- * `multiSessionQueryKeys`) and chain off `authQueryKeys.user(userId)` so
22
- * everything still sits under the shared `["auth", "user", userId, ...]`
23
- * subtree.
24
- *
25
- * For mutation keys, see `authMutationKeys` in `./auth-mutation-keys`.
26
- */
27
- export const authQueryKeys = {
28
- /** Root key for every Better Auth query. */
29
- all: ["auth"],
30
- /** Key for the current `getSession` query. */
31
- session: ["auth", "getSession"],
32
- /** Prefix for every per-user query. */
33
- users: () => [...authQueryKeys.all, "user"],
34
- /** Prefix for every query scoped to a specific user. */
35
- user: (userId) => [...authQueryKeys.users(), userId],
36
- /** Key for `accountInfo` for the given user. */
37
- accountInfo: (userId, query) => [...authQueryKeys.user(userId), "accountInfo", query ?? null],
38
- /** Key for `listAccounts` for the given user. */
39
- listAccounts: (userId, query) => [...authQueryKeys.user(userId), "listAccounts", query ?? null],
40
- /** Key for `listSessions` for the given user. */
41
- listSessions: (userId, query) => [...authQueryKeys.user(userId), "listSessions", query ?? null]
42
- };
@@ -1,5 +0,0 @@
1
- export const basePaths = {
2
- auth: "/auth",
3
- settings: "/settings",
4
- organization: "/organization"
5
- };
@@ -1,23 +0,0 @@
1
- /**
2
- * Creates a plugin factory and attaches its `id` as a static property so
3
- * consumers (e.g. `useAuthPlugin`) can look it up without invoking the
4
- * factory.
5
- *
6
- * @example
7
- * ```ts
8
- * export const themePlugin = createAuthPlugin(
9
- * "theme",
10
- * (options: ThemePluginOptions) => ({
11
- * setTheme: options.setTheme,
12
- * themes: options.themes ?? ["system", "light", "dark"]
13
- * })
14
- * )
15
- * ```
16
- */
17
- export function createAuthPlugin(id, factory) {
18
- const wrapped = (...args) => ({
19
- ...factory(...args),
20
- id
21
- });
22
- return Object.assign(wrapped, { id });
23
- }
@@ -1 +0,0 @@
1
- export {};