@onmax/nuxt-better-auth 0.0.2-alpha.3 → 0.0.2-alpha.31

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/module.d.mts +28 -1
  3. package/dist/module.json +2 -2
  4. package/dist/module.mjs +965 -313
  5. package/dist/runtime/app/components/BetterAuthState.vue +1 -0
  6. package/dist/runtime/app/composables/useAction.d.ts +2 -0
  7. package/dist/runtime/app/composables/useAction.js +6 -0
  8. package/dist/runtime/app/composables/useAuthAsyncData.d.ts +6 -0
  9. package/dist/runtime/app/composables/useAuthAsyncData.js +16 -0
  10. package/dist/runtime/app/composables/useAuthClientAction.d.ts +5 -0
  11. package/dist/runtime/app/composables/useAuthClientAction.js +15 -0
  12. package/dist/runtime/app/composables/useAuthRequestFetch.d.ts +11 -0
  13. package/dist/runtime/app/composables/useAuthRequestFetch.js +4 -0
  14. package/dist/runtime/app/composables/useSignIn.d.ts +16 -0
  15. package/dist/runtime/app/composables/useSignIn.js +8 -0
  16. package/dist/runtime/app/composables/useSignUp.d.ts +5 -0
  17. package/dist/runtime/app/composables/useSignUp.js +8 -0
  18. package/dist/runtime/app/composables/useUserSession.d.ts +14 -12
  19. package/dist/runtime/app/composables/useUserSession.js +162 -67
  20. package/dist/runtime/app/internal/auth-action-error.d.ts +3 -0
  21. package/dist/runtime/app/internal/auth-action-error.js +33 -0
  22. package/dist/runtime/app/internal/auth-action-handles.d.ts +18 -0
  23. package/dist/runtime/app/internal/auth-action-handles.js +105 -0
  24. package/dist/runtime/app/internal/redirect-helpers.d.ts +4 -0
  25. package/dist/runtime/app/internal/redirect-helpers.js +37 -0
  26. package/dist/runtime/app/internal/session-fetch.d.ts +12 -0
  27. package/dist/runtime/app/internal/session-fetch.js +56 -0
  28. package/dist/runtime/app/internal/utils.d.ts +1 -0
  29. package/dist/runtime/app/internal/utils.js +3 -0
  30. package/dist/runtime/app/internal/wrap-auth-method.d.ts +15 -0
  31. package/dist/runtime/app/internal/wrap-auth-method.js +66 -0
  32. package/dist/runtime/app/middleware/auth.global.js +73 -12
  33. package/dist/runtime/app/pages/__better-auth-devtools.vue +4 -10
  34. package/dist/runtime/app/plugins/session.client.js +1 -2
  35. package/dist/runtime/config.d.ts +66 -11
  36. package/dist/runtime/config.js +9 -2
  37. package/dist/runtime/server/api/_better-auth/_schema.js +2 -1
  38. package/dist/runtime/server/api/_better-auth/accounts.get.js +3 -2
  39. package/dist/runtime/server/api/_better-auth/config.get.d.ts +17 -11
  40. package/dist/runtime/server/api/_better-auth/config.get.js +17 -5
  41. package/dist/runtime/server/api/_better-auth/sessions.delete.js +3 -2
  42. package/dist/runtime/server/api/_better-auth/sessions.get.d.ts +3 -1
  43. package/dist/runtime/server/api/_better-auth/sessions.get.js +3 -2
  44. package/dist/runtime/server/api/_better-auth/users.get.js +3 -2
  45. package/dist/runtime/server/api/auth/[...all].js +1 -1
  46. package/dist/runtime/server/middleware/route-access.js +1 -0
  47. package/dist/runtime/server/tsconfig.json +9 -1
  48. package/dist/runtime/server/utils/auth.d.ts +5 -7
  49. package/dist/runtime/server/utils/auth.js +197 -17
  50. package/dist/runtime/server/utils/custom-secondary-storage.d.ts +6 -0
  51. package/dist/runtime/server/utils/custom-secondary-storage.js +8 -0
  52. package/dist/runtime/server/utils/session.d.ts +4 -8
  53. package/dist/runtime/server/utils/session.js +43 -4
  54. package/dist/runtime/server/virtual-modules.d.ts +22 -0
  55. package/dist/runtime/types/augment.d.ts +18 -2
  56. package/dist/runtime/types.d.ts +12 -13
  57. package/dist/types.d.mts +1 -1
  58. package/package.json +32 -42
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  ## Documentation
22
22
 
23
- **[nuxt-better-auth.onmax.me](https://nuxt-better-auth.onmax.me/)**
23
+ **[better-auth.nuxt.dev](https://better-auth.nuxt.dev/)**
24
24
 
25
25
  ## License
26
26
 
package/dist/module.d.mts CHANGED
@@ -1,9 +1,31 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import { Nuxt } from '@nuxt/schema';
2
3
  import { BetterAuthModuleOptions } from '../dist/runtime/config.js';
3
4
  export { BetterAuthModuleOptions, defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
4
5
  import { BetterAuthOptions } from 'better-auth';
5
- export { Auth, AuthMeta, AuthMode, AuthRouteRules, AuthSession, AuthUser, InferSession, InferUser, RequireSessionOptions, ServerAuthContext, UserMatch } from '../dist/runtime/types.js';
6
+ export { AppSession, Auth, AuthActionError, AuthMeta, AuthMode, AuthRouteRules, AuthSession, AuthSocialProviderId, AuthUser, InferSession, InferUser, RequireSessionOptions, ServerAuthContext, UserMatch } from '../dist/runtime/types.js';
6
7
 
8
+ type DbDialect = 'sqlite' | 'postgresql' | 'mysql';
9
+
10
+ interface BetterAuthDatabaseProviderBuildContext {
11
+ hubDialect: DbDialect;
12
+ usePlural: boolean;
13
+ camelCase: boolean;
14
+ }
15
+ interface BetterAuthDatabaseProviderSetupContext {
16
+ nuxt: Nuxt;
17
+ options: BetterAuthModuleOptions;
18
+ clientOnly: boolean;
19
+ }
20
+ interface BetterAuthDatabaseProviderEnabledContext extends BetterAuthDatabaseProviderSetupContext {
21
+ hasHubDbAvailable: boolean;
22
+ }
23
+ interface BetterAuthDatabaseProviderDefinition {
24
+ buildDatabaseCode: (ctx: BetterAuthDatabaseProviderBuildContext) => string;
25
+ setup?: (ctx: BetterAuthDatabaseProviderSetupContext) => void | Promise<void>;
26
+ isEnabled?: (ctx: BetterAuthDatabaseProviderEnabledContext) => boolean;
27
+ priority?: number;
28
+ }
7
29
  declare module '@nuxt/schema' {
8
30
  interface NuxtHooks {
9
31
  /**
@@ -12,6 +34,11 @@ declare module '@nuxt/schema' {
12
34
  * @param config - Partial config to merge into the auth options
13
35
  */
14
36
  'better-auth:config:extend': (config: Partial<BetterAuthOptions>) => void | Promise<void>;
37
+ /**
38
+ * Register or override Better Auth database providers.
39
+ * Providers are auto-selected via `isEnabled` + `priority`.
40
+ */
41
+ 'better-auth:database:providers': (providers: Record<string, BetterAuthDatabaseProviderDefinition>) => void | Promise<void>;
15
42
  }
16
43
  }
17
44
 
package/dist/module.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@onmax/nuxt-better-auth",
3
+ "version": "0.0.2-alpha.31",
3
4
  "configKey": "auth",
4
5
  "compatibility": {
5
- "nuxt": ">=3.0.0"
6
+ "nuxt": ">=4.0.0"
6
7
  },
7
- "version": "0.0.2-alpha.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"