@nuxtjs/better-auth 0.3.1 → 0.3.3
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.
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +297 -93
- package/dist/runtime/app/composables/runWithSessionRefresh.js +2 -1
- package/dist/runtime/app/composables/useAuthRequestFetch.d.ts +1 -1
- package/dist/runtime/app/composables/useAuthRequestFetch.js +22 -2
- package/dist/runtime/app/composables/useSignIn.d.ts +1 -4
- package/dist/runtime/app/composables/useUserSession.js +33 -8
- package/dist/runtime/app/internal/redirect-helpers.js +22 -1
- package/dist/runtime/app/internal/session-fetch.d.ts +1 -0
- package/dist/runtime/app/internal/session-fetch.js +22 -8
- package/dist/runtime/app/internal/wrap-auth-method.d.ts +3 -2
- package/dist/runtime/app/internal/wrap-auth-method.js +9 -7
- package/dist/runtime/app/plugins/session.client.js +2 -1
- package/dist/runtime/app/plugins/session.server.js +8 -3
- package/dist/runtime/composables.d.ts +2 -0
- package/dist/runtime/internal/auth-route-rules.d.ts +3 -0
- package/dist/runtime/internal/auth-route-rules.js +10 -0
- package/dist/runtime/server/internal/cookie-headers.d.ts +3 -0
- package/dist/runtime/server/internal/cookie-headers.js +30 -0
- package/dist/runtime/server/internal/nitro2.d.ts +4 -2
- package/dist/runtime/server/internal/nitro2.js +2 -2
- package/dist/runtime/server/internal/nitro3.d.ts +2 -1
- package/dist/runtime/server/internal/nitro3.js +5 -32
- package/dist/runtime/server/middleware/route-access.js +7 -4
- package/dist/runtime/server/tsconfig.json +10 -3
- package/dist/runtime/server/utils/auth.js +11 -2
- package/dist/runtime/server/utils/session.js +34 -32
- package/dist/runtime/test-utils/e2e.d.ts +18 -0
- package/dist/runtime/test-utils/e2e.js +48 -0
- package/dist/runtime/test-utils/module.d.ts +6 -0
- package/dist/runtime/test-utils/module.js +18 -0
- package/dist/runtime/test-utils/runtime.d.ts +25 -0
- package/dist/runtime/test-utils/runtime.js +56 -0
- package/dist/runtime/test-utils/server/handler.d.ts +2 -0
- package/dist/runtime/test-utils/server/handler.js +34 -0
- package/dist/runtime/test-utils/server/plugin.d.ts +23 -0
- package/dist/runtime/test-utils/server/plugin.js +2 -0
- package/dist/runtime/types.d.ts +1 -1
- package/dist/types.d.mts +2 -8
- package/package.json +30 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Max
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -12,6 +12,13 @@ Use this module if you want Better Auth in a Nuxt app and you want the Nuxt-spec
|
|
|
12
12
|
- generated `server/auth.config.ts` and `app/auth.config.ts`
|
|
13
13
|
- optional NuxtHub database integration and schema generation
|
|
14
14
|
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Nuxt 4.0 or newer
|
|
18
|
+
- Node.js `^22.19.0`, `^24.11.0`, or `>=26.0.0`
|
|
19
|
+
- A Better Auth 1.x version that satisfies this package's peer dependency range
|
|
20
|
+
- NuxtHub 0.10.5 or newer when using the optional NuxtHub integration
|
|
21
|
+
|
|
15
22
|
## Install the module
|
|
16
23
|
|
|
17
24
|
For the fastest path in a Nuxt app:
|
|
@@ -59,9 +66,14 @@ Useful commands:
|
|
|
59
66
|
- `pnpm dev` to run the playground
|
|
60
67
|
- `pnpm dev:docs` to run the docs site
|
|
61
68
|
- `pnpm lint` to lint the repo
|
|
69
|
+
- `pnpm typecheck` to check module types
|
|
70
|
+
- `pnpm prepack` to build the publishable package
|
|
62
71
|
- `pnpm test` to run the test suite
|
|
72
|
+
- `BETTER_AUTH_SECRET=ci-test-secret-12345678901234567890 pnpm dev:build` to build the playground with a test secret for local verification only
|
|
63
73
|
- `pnpm build:docs` to build the docs site
|
|
64
74
|
|
|
75
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the complete local CI sequence and pull request guidelines.
|
|
76
|
+
|
|
65
77
|
## License
|
|
66
78
|
|
|
67
79
|
[MIT](https://github.com/nuxt-modules/better-auth/blob/main/LICENSE)
|
package/dist/module.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { Nuxt } from '@nuxt/schema';
|
|
3
3
|
import { BetterAuthModuleOptions } from '../dist/runtime/config.js';
|
|
4
|
-
export { BetterAuthModuleOptions, defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
|
|
4
|
+
export { BetterAuthModuleOptions, BetterAuthModuleOptions as ModuleOptions, defineClientAuth, defineServerAuth } from '../dist/runtime/config.js';
|
|
5
5
|
import { BetterAuthPlugin } from 'better-auth';
|
|
6
|
-
export { AppSession, Auth, AuthActionError, AuthMeta, AuthMode, AuthRouteRules, AuthSession, AuthSocialProviderId, AuthUser, InferSession, InferUser, RequireSessionOptions, ServerAuthContext, UserMatch } from '../dist/runtime/types.js';
|
|
6
|
+
export { AppSession, Auth, AuthActionError, AuthMeta, AuthMode, AuthRouteRules, AuthSession, AuthSocialProviderId, AuthUser, ClientAuthSession, InferSession, InferUser, RequireSessionOptions, ServerAuthContext, UserMatch } from '../dist/runtime/types.js';
|
|
7
7
|
|
|
8
8
|
type DbDialect = 'sqlite' | 'postgresql' | 'mysql';
|
|
9
9
|
|