better-auth 1.6.11 → 1.6.12
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/dist/api/index.d.mts +8 -2
- package/dist/api/routes/callback.d.mts +1 -1
- package/dist/api/routes/callback.mjs +36 -40
- package/dist/api/routes/email-verification.d.mts +1 -0
- package/dist/api/routes/email-verification.mjs +4 -3
- package/dist/api/routes/session.mjs +14 -9
- package/dist/api/routes/sign-in.d.mts +1 -0
- package/dist/api/routes/sign-in.mjs +2 -1
- package/dist/api/routes/sign-up.d.mts +1 -0
- package/dist/api/routes/sign-up.mjs +9 -7
- package/dist/api/routes/update-user.mjs +4 -4
- package/dist/client/parser.mjs +0 -1
- package/dist/client/plugins/index.d.mts +3 -3
- package/dist/client/proxy.mjs +2 -1
- package/dist/context/helpers.mjs +3 -2
- package/dist/cookies/cookie-utils.d.mts +24 -1
- package/dist/cookies/cookie-utils.mjs +85 -22
- package/dist/cookies/index.d.mts +2 -3
- package/dist/cookies/index.mjs +39 -11
- package/dist/cookies/session-store.mjs +4 -23
- package/dist/db/get-migration.mjs +4 -4
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +3 -2
- package/dist/db/internal-adapter.mjs +37 -30
- package/dist/db/schema.d.mts +15 -2
- package/dist/db/schema.mjs +26 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/oauth2/errors.mjs +16 -1
- package/dist/oauth2/link-account.mjs +3 -3
- package/dist/oauth2/state.mjs +8 -2
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.mjs +11 -6
- package/dist/plugins/admin/admin.mjs +0 -4
- package/dist/plugins/admin/client.d.mts +1 -1
- package/dist/plugins/bearer/index.mjs +4 -9
- package/dist/plugins/captcha/index.mjs +2 -2
- package/dist/plugins/generic-oauth/index.d.mts +1 -1
- package/dist/plugins/generic-oauth/index.mjs +6 -6
- package/dist/plugins/generic-oauth/routes.mjs +34 -32
- package/dist/plugins/generic-oauth/types.d.mts +7 -0
- package/dist/plugins/last-login-method/client.mjs +2 -2
- package/dist/plugins/magic-link/index.mjs +0 -1
- package/dist/plugins/mcp/index.mjs +0 -4
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-proxy/index.mjs +44 -31
- package/dist/plugins/oauth-proxy/utils.mjs +3 -10
- package/dist/plugins/oidc-provider/index.mjs +0 -4
- package/dist/plugins/open-api/generator.mjs +16 -5
- package/dist/plugins/organization/adapter.mjs +61 -56
- package/dist/plugins/organization/client.d.mts +2 -1
- package/dist/plugins/organization/error-codes.d.mts +1 -0
- package/dist/plugins/organization/error-codes.mjs +2 -1
- package/dist/plugins/organization/routes/crud-invites.mjs +3 -0
- package/dist/plugins/two-factor/index.mjs +3 -2
- package/dist/plugins/username/index.d.mts +24 -2
- package/dist/plugins/username/index.mjs +49 -3
- package/dist/state.d.mts +2 -2
- package/dist/state.mjs +18 -4
- package/dist/test-utils/headers.mjs +2 -7
- package/dist/test-utils/test-instance.d.mts +24 -6
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/url.d.mts +2 -1
- package/dist/utils/url.mjs +9 -3
- package/package.json +15 -14
package/dist/utils/url.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { wildcardMatch } from "./wildcard.mjs";
|
|
|
2
2
|
import { env } from "@better-auth/core/env";
|
|
3
3
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
4
|
//#region src/utils/url.ts
|
|
5
|
+
const SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
5
6
|
/**
|
|
6
7
|
* Minimal loopback check for dev scheme inference only. Reachable from
|
|
7
8
|
* `client/config.ts` via `getBaseURL`, so we MUST NOT import the full
|
|
@@ -17,9 +18,14 @@ function isLoopbackForDevScheme(host) {
|
|
|
17
18
|
const hostname = host.replace(/:\d+$/, "").replace(/^\[|\]$/g, "").toLowerCase();
|
|
18
19
|
return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "::1" || hostname.startsWith("127.");
|
|
19
20
|
}
|
|
21
|
+
function trimTrailingSlashes(value) {
|
|
22
|
+
let end = value.length;
|
|
23
|
+
while (end > 0 && value.charCodeAt(end - 1) === SLASH_CHAR_CODE) end--;
|
|
24
|
+
return end === value.length ? value : value.slice(0, end);
|
|
25
|
+
}
|
|
20
26
|
function checkHasPath(url) {
|
|
21
27
|
try {
|
|
22
|
-
return (new URL(url).pathname
|
|
28
|
+
return (trimTrailingSlashes(new URL(url).pathname) || "/") !== "/";
|
|
23
29
|
} catch {
|
|
24
30
|
throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);
|
|
25
31
|
}
|
|
@@ -36,7 +42,7 @@ function assertHasProtocol(url) {
|
|
|
36
42
|
function withPath(url, path = "/api/auth") {
|
|
37
43
|
assertHasProtocol(url);
|
|
38
44
|
if (checkHasPath(url)) return url;
|
|
39
|
-
const trimmedUrl = url
|
|
45
|
+
const trimmedUrl = trimTrailingSlashes(url);
|
|
40
46
|
if (!path || path === "/") return trimmedUrl;
|
|
41
47
|
path = path.startsWith("/") ? path : `/${path}`;
|
|
42
48
|
return `${trimmedUrl}${path}`;
|
|
@@ -229,4 +235,4 @@ function resolveBaseURL(config, basePath, source, loadEnv, trustedProxyHeaders)
|
|
|
229
235
|
return getBaseURL(void 0, basePath, request, loadEnv, trustedProxyHeaders);
|
|
230
236
|
}
|
|
231
237
|
//#endregion
|
|
232
|
-
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL };
|
|
238
|
+
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.12",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -479,29 +479,29 @@
|
|
|
479
479
|
}
|
|
480
480
|
},
|
|
481
481
|
"dependencies": {
|
|
482
|
-
"@better-auth/utils": "0.4.
|
|
482
|
+
"@better-auth/utils": "0.4.1",
|
|
483
483
|
"@better-fetch/fetch": "1.1.21",
|
|
484
484
|
"@noble/ciphers": "^2.1.1",
|
|
485
485
|
"@noble/hashes": "^2.0.1",
|
|
486
486
|
"better-call": "1.3.5",
|
|
487
487
|
"defu": "^6.1.4",
|
|
488
488
|
"jose": "^6.1.3",
|
|
489
|
-
"kysely": "^0.28.17",
|
|
489
|
+
"kysely": "^0.28.17 || ^0.29.0",
|
|
490
490
|
"nanostores": "^1.1.1",
|
|
491
491
|
"zod": "^4.3.6",
|
|
492
|
-
"@better-auth/core": "1.6.
|
|
493
|
-
"@better-auth/drizzle-adapter": "1.6.
|
|
494
|
-
"@better-auth/
|
|
495
|
-
"@better-auth/
|
|
496
|
-
"@better-auth/
|
|
497
|
-
"@better-auth/prisma-adapter": "1.6.
|
|
498
|
-
"@better-auth/telemetry": "1.6.
|
|
492
|
+
"@better-auth/core": "1.6.12",
|
|
493
|
+
"@better-auth/drizzle-adapter": "1.6.12",
|
|
494
|
+
"@better-auth/memory-adapter": "1.6.12",
|
|
495
|
+
"@better-auth/mongo-adapter": "1.6.12",
|
|
496
|
+
"@better-auth/kysely-adapter": "1.6.12",
|
|
497
|
+
"@better-auth/prisma-adapter": "1.6.12",
|
|
498
|
+
"@better-auth/telemetry": "1.6.12"
|
|
499
499
|
},
|
|
500
500
|
"devDependencies": {
|
|
501
501
|
"@lynx-js/react": "^0.116.3",
|
|
502
|
-
"@sveltejs/kit": "^2.
|
|
503
|
-
"@tanstack/react-start": "^1.
|
|
504
|
-
"@tanstack/solid-start": "^1.
|
|
502
|
+
"@sveltejs/kit": "^2.60.1",
|
|
503
|
+
"@tanstack/react-start": "^1.168.4",
|
|
504
|
+
"@tanstack/solid-start": "^1.168.4",
|
|
505
505
|
"@types/bun": "^1.3.9",
|
|
506
506
|
"@types/google.accounts": "^0.0.18",
|
|
507
507
|
"@types/pg": "^8.16.0",
|
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
"happy-dom": "^20.8.9",
|
|
513
513
|
"listhen": "^1.9.0",
|
|
514
514
|
"msw": "^2.12.10",
|
|
515
|
-
"next": "^16.2.
|
|
515
|
+
"next": "^16.2.6",
|
|
516
516
|
"oauth2-mock-server": "^8.2.2",
|
|
517
517
|
"react": "^19.2.4",
|
|
518
518
|
"react-dom": "^19.2.4",
|
|
@@ -520,6 +520,7 @@
|
|
|
520
520
|
"tsdown": "0.21.1",
|
|
521
521
|
"type-fest": "^5.4.4",
|
|
522
522
|
"typescript": "^5.9.3",
|
|
523
|
+
"vite": "^7.3.2",
|
|
523
524
|
"vitest": "^4.1.5",
|
|
524
525
|
"vue": "^3.5.29"
|
|
525
526
|
},
|