@better-auth/core 1.5.6 → 1.6.0-beta.0
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 +42 -13
- package/dist/api/index.mjs +0 -4
- package/dist/async_hooks/index.d.mts +1 -2
- package/dist/async_hooks/index.mjs +0 -2
- package/dist/async_hooks/pure.index.d.mts +1 -2
- package/dist/async_hooks/pure.index.mjs +0 -2
- package/dist/context/endpoint-context.d.mts +2 -3
- package/dist/context/endpoint-context.mjs +0 -3
- package/dist/context/global.d.mts +1 -2
- package/dist/context/global.mjs +1 -3
- package/dist/context/index.mjs +1 -2
- package/dist/context/request-state.d.mts +1 -2
- package/dist/context/request-state.mjs +0 -3
- package/dist/context/transaction.d.mts +1 -2
- package/dist/context/transaction.mjs +0 -3
- package/dist/db/adapter/factory.d.mts +1 -2
- package/dist/db/adapter/factory.mjs +3 -7
- package/dist/db/adapter/get-default-field-name.d.mts +1 -2
- package/dist/db/adapter/get-default-field-name.mjs +0 -3
- package/dist/db/adapter/get-default-model-name.d.mts +1 -2
- package/dist/db/adapter/get-default-model-name.mjs +0 -3
- package/dist/db/adapter/get-field-attributes.d.mts +1 -2
- package/dist/db/adapter/get-field-attributes.mjs +0 -3
- package/dist/db/adapter/get-field-name.d.mts +1 -2
- package/dist/db/adapter/get-field-name.mjs +0 -3
- package/dist/db/adapter/get-id-field.d.mts +1 -2
- package/dist/db/adapter/get-id-field.mjs +0 -4
- package/dist/db/adapter/get-model-name.d.mts +1 -2
- package/dist/db/adapter/get-model-name.mjs +0 -3
- package/dist/db/adapter/index.d.mts +9 -2
- package/dist/db/adapter/index.mjs +0 -3
- package/dist/db/adapter/types.d.mts +1 -2
- package/dist/db/adapter/utils.d.mts +1 -2
- package/dist/db/adapter/utils.mjs +0 -2
- package/dist/db/get-tables.d.mts +1 -2
- package/dist/db/get-tables.mjs +0 -2
- package/dist/db/index.mjs +1 -2
- package/dist/db/plugin.d.mts +1 -2
- package/dist/db/schema/account.d.mts +1 -2
- package/dist/db/schema/account.mjs +0 -3
- package/dist/db/schema/rate-limit.d.mts +1 -2
- package/dist/db/schema/rate-limit.mjs +0 -3
- package/dist/db/schema/session.d.mts +1 -2
- package/dist/db/schema/session.mjs +0 -3
- package/dist/db/schema/shared.d.mts +1 -2
- package/dist/db/schema/shared.mjs +0 -3
- package/dist/db/schema/user.d.mts +1 -2
- package/dist/db/schema/user.mjs +0 -3
- package/dist/db/schema/verification.d.mts +1 -2
- package/dist/db/schema/verification.mjs +0 -3
- package/dist/db/type.d.mts +1 -2
- package/dist/env/color-depth.d.mts +1 -2
- package/dist/env/color-depth.mjs +0 -3
- package/dist/env/env-impl.d.mts +1 -2
- package/dist/env/env-impl.mjs +0 -2
- package/dist/env/index.mjs +1 -2
- package/dist/env/logger.d.mts +1 -2
- package/dist/env/logger.mjs +0 -3
- package/dist/error/codes.d.mts +1 -2
- package/dist/error/codes.mjs +0 -3
- package/dist/error/index.d.mts +1 -2
- package/dist/error/index.mjs +0 -3
- package/dist/index.mjs +1 -1
- package/dist/instrumentation/attributes.d.mts +1 -2
- package/dist/instrumentation/attributes.mjs +0 -3
- package/dist/instrumentation/index.mjs +1 -2
- package/dist/instrumentation/tracer.d.mts +1 -2
- package/dist/instrumentation/tracer.mjs +29 -16
- package/dist/oauth2/client-credentials-token.d.mts +1 -2
- package/dist/oauth2/client-credentials-token.mjs +0 -3
- package/dist/oauth2/create-authorization-url.d.mts +1 -2
- package/dist/oauth2/create-authorization-url.mjs +0 -3
- package/dist/oauth2/index.mjs +1 -2
- package/dist/oauth2/oauth-provider.d.mts +1 -2
- package/dist/oauth2/refresh-access-token.d.mts +1 -2
- package/dist/oauth2/refresh-access-token.mjs +0 -3
- package/dist/oauth2/utils.d.mts +1 -2
- package/dist/oauth2/utils.mjs +0 -3
- package/dist/oauth2/validate-authorization-code.d.mts +1 -2
- package/dist/oauth2/validate-authorization-code.mjs +0 -4
- package/dist/oauth2/verify.d.mts +1 -2
- package/dist/oauth2/verify.mjs +0 -4
- package/dist/social-providers/apple.d.mts +1 -2
- package/dist/social-providers/apple.mjs +0 -4
- package/dist/social-providers/atlassian.d.mts +1 -2
- package/dist/social-providers/atlassian.mjs +0 -5
- package/dist/social-providers/cognito.d.mts +1 -2
- package/dist/social-providers/cognito.mjs +0 -5
- package/dist/social-providers/discord.d.mts +1 -2
- package/dist/social-providers/discord.mjs +0 -4
- package/dist/social-providers/dropbox.d.mts +1 -2
- package/dist/social-providers/dropbox.mjs +0 -4
- package/dist/social-providers/facebook.d.mts +1 -2
- package/dist/social-providers/facebook.mjs +0 -4
- package/dist/social-providers/figma.d.mts +1 -2
- package/dist/social-providers/figma.mjs +0 -5
- package/dist/social-providers/github.d.mts +1 -2
- package/dist/social-providers/github.mjs +0 -5
- package/dist/social-providers/gitlab.d.mts +1 -2
- package/dist/social-providers/gitlab.mjs +0 -4
- package/dist/social-providers/google.d.mts +1 -2
- package/dist/social-providers/google.mjs +0 -5
- package/dist/social-providers/huggingface.d.mts +1 -2
- package/dist/social-providers/huggingface.mjs +0 -4
- package/dist/social-providers/index.d.mts +1 -2
- package/dist/social-providers/index.mjs +0 -3
- package/dist/social-providers/kakao.d.mts +1 -2
- package/dist/social-providers/kakao.mjs +0 -4
- package/dist/social-providers/kick.d.mts +1 -2
- package/dist/social-providers/kick.mjs +0 -4
- package/dist/social-providers/line.d.mts +1 -2
- package/dist/social-providers/line.mjs +0 -4
- package/dist/social-providers/linear.d.mts +1 -2
- package/dist/social-providers/linear.mjs +0 -4
- package/dist/social-providers/linkedin.d.mts +1 -2
- package/dist/social-providers/linkedin.mjs +0 -4
- package/dist/social-providers/microsoft-entra-id.d.mts +1 -2
- package/dist/social-providers/microsoft-entra-id.mjs +0 -5
- package/dist/social-providers/naver.d.mts +1 -2
- package/dist/social-providers/naver.mjs +0 -4
- package/dist/social-providers/notion.d.mts +1 -2
- package/dist/social-providers/notion.mjs +0 -4
- package/dist/social-providers/paybin.d.mts +1 -2
- package/dist/social-providers/paybin.mjs +0 -5
- package/dist/social-providers/paypal.d.mts +1 -2
- package/dist/social-providers/paypal.mjs +0 -5
- package/dist/social-providers/polar.d.mts +1 -2
- package/dist/social-providers/polar.mjs +0 -4
- package/dist/social-providers/railway.d.mts +1 -2
- package/dist/social-providers/railway.mjs +0 -4
- package/dist/social-providers/reddit.d.mts +1 -2
- package/dist/social-providers/reddit.mjs +0 -4
- package/dist/social-providers/roblox.d.mts +1 -2
- package/dist/social-providers/roblox.mjs +0 -4
- package/dist/social-providers/salesforce.d.mts +1 -2
- package/dist/social-providers/salesforce.mjs +0 -5
- package/dist/social-providers/slack.d.mts +1 -2
- package/dist/social-providers/slack.mjs +0 -4
- package/dist/social-providers/spotify.d.mts +1 -2
- package/dist/social-providers/spotify.mjs +0 -4
- package/dist/social-providers/tiktok.d.mts +1 -2
- package/dist/social-providers/tiktok.mjs +0 -4
- package/dist/social-providers/twitch.d.mts +1 -2
- package/dist/social-providers/twitch.mjs +0 -5
- package/dist/social-providers/twitter.d.mts +1 -2
- package/dist/social-providers/twitter.mjs +0 -4
- package/dist/social-providers/vercel.d.mts +1 -2
- package/dist/social-providers/vercel.mjs +0 -4
- package/dist/social-providers/vk.d.mts +1 -2
- package/dist/social-providers/vk.mjs +0 -4
- package/dist/social-providers/wechat.d.mts +1 -2
- package/dist/social-providers/wechat.mjs +0 -3
- package/dist/social-providers/zoom.d.mts +1 -2
- package/dist/social-providers/zoom.mjs +0 -4
- package/dist/types/context.d.mts +3 -5
- package/dist/types/cookie.d.mts +1 -2
- package/dist/types/helper.d.mts +1 -2
- package/dist/types/init-options.d.mts +14 -6
- package/dist/types/plugin-client.d.mts +2 -2
- package/dist/types/plugin.d.mts +6 -3
- package/dist/types/secret.d.mts +1 -2
- package/dist/utils/db.d.mts +1 -2
- package/dist/utils/db.mjs +0 -2
- package/dist/utils/deprecate.d.mts +1 -2
- package/dist/utils/deprecate.mjs +0 -2
- package/dist/utils/error-codes.d.mts +1 -2
- package/dist/utils/error-codes.mjs +0 -2
- package/dist/utils/fetch-metadata.d.mts +1 -2
- package/dist/utils/fetch-metadata.mjs +0 -2
- package/dist/utils/id.d.mts +1 -2
- package/dist/utils/id.mjs +0 -3
- package/dist/utils/ip.d.mts +1 -2
- package/dist/utils/ip.mjs +0 -3
- package/dist/utils/json.d.mts +1 -2
- package/dist/utils/json.mjs +0 -4
- package/dist/utils/string.d.mts +1 -2
- package/dist/utils/string.mjs +0 -2
- package/dist/utils/url.d.mts +1 -2
- package/dist/utils/url.mjs +0 -2
- package/package.json +11 -9
- package/src/api/index.ts +151 -41
- package/src/context/endpoint-context.ts +2 -1
- package/src/db/adapter/factory.ts +2 -0
- package/src/db/adapter/index.ts +8 -0
- package/src/instrumentation/tracer.ts +40 -12
- package/src/social-providers/index.ts +0 -2
- package/src/types/context.ts +2 -3
- package/src/types/init-options.ts +13 -4
- package/src/types/plugin-client.ts +1 -0
- package/src/types/plugin.ts +15 -1
- package/dist/api/index.mjs.map +0 -1
- package/dist/async_hooks/index.mjs.map +0 -1
- package/dist/async_hooks/pure.index.mjs.map +0 -1
- package/dist/context/endpoint-context.mjs.map +0 -1
- package/dist/context/global.mjs.map +0 -1
- package/dist/context/request-state.mjs.map +0 -1
- package/dist/context/transaction.mjs.map +0 -1
- package/dist/db/adapter/factory.mjs.map +0 -1
- package/dist/db/adapter/get-default-field-name.mjs.map +0 -1
- package/dist/db/adapter/get-default-model-name.mjs.map +0 -1
- package/dist/db/adapter/get-field-attributes.mjs.map +0 -1
- package/dist/db/adapter/get-field-name.mjs.map +0 -1
- package/dist/db/adapter/get-id-field.mjs.map +0 -1
- package/dist/db/adapter/get-model-name.mjs.map +0 -1
- package/dist/db/adapter/index.mjs.map +0 -1
- package/dist/db/adapter/utils.mjs.map +0 -1
- package/dist/db/get-tables.mjs.map +0 -1
- package/dist/db/schema/account.mjs.map +0 -1
- package/dist/db/schema/rate-limit.mjs.map +0 -1
- package/dist/db/schema/session.mjs.map +0 -1
- package/dist/db/schema/shared.mjs.map +0 -1
- package/dist/db/schema/user.mjs.map +0 -1
- package/dist/db/schema/verification.mjs.map +0 -1
- package/dist/env/color-depth.mjs.map +0 -1
- package/dist/env/env-impl.mjs.map +0 -1
- package/dist/env/logger.mjs.map +0 -1
- package/dist/error/codes.mjs.map +0 -1
- package/dist/error/index.mjs.map +0 -1
- package/dist/instrumentation/attributes.mjs.map +0 -1
- package/dist/instrumentation/tracer.mjs.map +0 -1
- package/dist/oauth2/client-credentials-token.mjs.map +0 -1
- package/dist/oauth2/create-authorization-url.mjs.map +0 -1
- package/dist/oauth2/refresh-access-token.mjs.map +0 -1
- package/dist/oauth2/utils.mjs.map +0 -1
- package/dist/oauth2/validate-authorization-code.mjs.map +0 -1
- package/dist/oauth2/verify.mjs.map +0 -1
- package/dist/social-providers/apple.mjs.map +0 -1
- package/dist/social-providers/atlassian.mjs.map +0 -1
- package/dist/social-providers/cognito.mjs.map +0 -1
- package/dist/social-providers/discord.mjs.map +0 -1
- package/dist/social-providers/dropbox.mjs.map +0 -1
- package/dist/social-providers/facebook.mjs.map +0 -1
- package/dist/social-providers/figma.mjs.map +0 -1
- package/dist/social-providers/github.mjs.map +0 -1
- package/dist/social-providers/gitlab.mjs.map +0 -1
- package/dist/social-providers/google.mjs.map +0 -1
- package/dist/social-providers/huggingface.mjs.map +0 -1
- package/dist/social-providers/index.mjs.map +0 -1
- package/dist/social-providers/kakao.mjs.map +0 -1
- package/dist/social-providers/kick.mjs.map +0 -1
- package/dist/social-providers/line.mjs.map +0 -1
- package/dist/social-providers/linear.mjs.map +0 -1
- package/dist/social-providers/linkedin.mjs.map +0 -1
- package/dist/social-providers/microsoft-entra-id.mjs.map +0 -1
- package/dist/social-providers/naver.mjs.map +0 -1
- package/dist/social-providers/notion.mjs.map +0 -1
- package/dist/social-providers/paybin.mjs.map +0 -1
- package/dist/social-providers/paypal.mjs.map +0 -1
- package/dist/social-providers/polar.mjs.map +0 -1
- package/dist/social-providers/railway.mjs.map +0 -1
- package/dist/social-providers/reddit.mjs.map +0 -1
- package/dist/social-providers/roblox.mjs.map +0 -1
- package/dist/social-providers/salesforce.mjs.map +0 -1
- package/dist/social-providers/slack.mjs.map +0 -1
- package/dist/social-providers/spotify.mjs.map +0 -1
- package/dist/social-providers/tiktok.mjs.map +0 -1
- package/dist/social-providers/twitch.mjs.map +0 -1
- package/dist/social-providers/twitter.mjs.map +0 -1
- package/dist/social-providers/vercel.mjs.map +0 -1
- package/dist/social-providers/vk.mjs.map +0 -1
- package/dist/social-providers/wechat.mjs.map +0 -1
- package/dist/social-providers/zoom.mjs.map +0 -1
- package/dist/utils/db.mjs.map +0 -1
- package/dist/utils/deprecate.mjs.map +0 -1
- package/dist/utils/error-codes.mjs.map +0 -1
- package/dist/utils/fetch-metadata.mjs.map +0 -1
- package/dist/utils/id.mjs.map +0 -1
- package/dist/utils/ip.mjs.map +0 -1
- package/dist/utils/json.mjs.map +0 -1
- package/dist/utils/string.mjs.map +0 -1
- package/dist/utils/url.mjs.map +0 -1
- package/src/context/request-state.test.ts +0 -94
- package/src/db/adapter/get-id-field.test.ts +0 -222
- package/src/db/test/get-tables.test.ts +0 -116
- package/src/env/logger.test.ts +0 -34
- package/src/instrumentation/instrumentation.test.ts +0 -139
- package/src/oauth2/refresh-access-token.test.ts +0 -90
- package/src/oauth2/validate-token.test.ts +0 -229
- package/src/utils/deprecate.test.ts +0 -71
- package/src/utils/fetch-metadata.test.ts +0 -28
- package/src/utils/ip.test.ts +0 -255
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
2
2
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
3
|
-
import "../oauth2/index.mjs";
|
|
4
3
|
import { betterFetch } from "@better-fetch/fetch";
|
|
5
|
-
|
|
6
4
|
//#region src/social-providers/tiktok.ts
|
|
7
5
|
const tiktok = (options) => {
|
|
8
6
|
const tokenEndpoint = "https://open.tiktokapis.com/v2/oauth/token/";
|
|
@@ -58,7 +56,5 @@ const tiktok = (options) => {
|
|
|
58
56
|
options
|
|
59
57
|
};
|
|
60
58
|
};
|
|
61
|
-
|
|
62
59
|
//#endregion
|
|
63
60
|
export { tiktok };
|
|
64
|
-
//# sourceMappingURL=tiktok.mjs.map
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { logger } from "../env/logger.mjs";
|
|
2
|
-
import "../env/index.mjs";
|
|
3
2
|
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
4
3
|
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
5
4
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
6
|
-
import "../oauth2/index.mjs";
|
|
7
5
|
import { decodeJwt } from "jose";
|
|
8
|
-
|
|
9
6
|
//#region src/social-providers/twitch.ts
|
|
10
7
|
const twitch = (options) => {
|
|
11
8
|
const tokenEndpoint = "https://id.twitch.tv/oauth2/token";
|
|
@@ -74,7 +71,5 @@ const twitch = (options) => {
|
|
|
74
71
|
options
|
|
75
72
|
};
|
|
76
73
|
};
|
|
77
|
-
|
|
78
74
|
//#endregion
|
|
79
75
|
export { twitch };
|
|
80
|
-
//# sourceMappingURL=twitch.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
2
|
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
3
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
-
import "../oauth2/index.mjs";
|
|
5
4
|
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
-
|
|
7
5
|
//#region src/social-providers/twitter.ts
|
|
8
6
|
const twitter = (options) => {
|
|
9
7
|
const tokenEndpoint = "https://api.x.com/2/oauth2/token";
|
|
@@ -83,7 +81,5 @@ const twitter = (options) => {
|
|
|
83
81
|
options
|
|
84
82
|
};
|
|
85
83
|
};
|
|
86
|
-
|
|
87
84
|
//#endregion
|
|
88
85
|
export { twitter };
|
|
89
|
-
//# sourceMappingURL=twitter.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { BetterAuthError } from "../error/index.mjs";
|
|
2
2
|
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
3
3
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
-
import "../oauth2/index.mjs";
|
|
5
4
|
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
-
|
|
7
5
|
//#region src/social-providers/vercel.ts
|
|
8
6
|
const vercel = (options) => {
|
|
9
7
|
return {
|
|
@@ -56,7 +54,5 @@ const vercel = (options) => {
|
|
|
56
54
|
options
|
|
57
55
|
};
|
|
58
56
|
};
|
|
59
|
-
|
|
60
57
|
//#endregion
|
|
61
58
|
export { vercel };
|
|
62
|
-
//# sourceMappingURL=vercel.mjs.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
2
|
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
3
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
-
import "../oauth2/index.mjs";
|
|
5
4
|
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
-
|
|
7
5
|
//#region src/social-providers/vk.ts
|
|
8
6
|
const vk = (options) => {
|
|
9
7
|
const tokenEndpoint = "https://id.vk.com/oauth2/auth";
|
|
@@ -79,7 +77,5 @@ const vk = (options) => {
|
|
|
79
77
|
options
|
|
80
78
|
};
|
|
81
79
|
};
|
|
82
|
-
|
|
83
80
|
//#endregion
|
|
84
81
|
export { vk };
|
|
85
|
-
//# sourceMappingURL=vk.mjs.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
|
-
|
|
3
2
|
//#region src/social-providers/wechat.ts
|
|
4
3
|
const wechat = (options) => {
|
|
5
4
|
return {
|
|
@@ -78,7 +77,5 @@ const wechat = (options) => {
|
|
|
78
77
|
options
|
|
79
78
|
};
|
|
80
79
|
};
|
|
81
|
-
|
|
82
80
|
//#endregion
|
|
83
81
|
export { wechat };
|
|
84
|
-
//# sourceMappingURL=wechat.mjs.map
|
|
@@ -160,5 +160,4 @@ declare const zoom: (userOptions: ZoomOptions) => {
|
|
|
160
160
|
} | null>;
|
|
161
161
|
};
|
|
162
162
|
//#endregion
|
|
163
|
-
export { AccountStatus, LoginType, PhoneNumber, PronounOption, ZoomOptions, ZoomProfile, zoom };
|
|
164
|
-
//# sourceMappingURL=zoom.d.mts.map
|
|
163
|
+
export { AccountStatus, LoginType, PhoneNumber, PronounOption, ZoomOptions, ZoomProfile, zoom };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { generateCodeChallenge } from "../oauth2/utils.mjs";
|
|
2
2
|
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
3
|
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
-
import "../oauth2/index.mjs";
|
|
5
4
|
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
-
|
|
7
5
|
//#region src/social-providers/zoom.ts
|
|
8
6
|
const zoom = (userOptions) => {
|
|
9
7
|
const options = {
|
|
@@ -67,7 +65,5 @@ const zoom = (userOptions) => {
|
|
|
67
65
|
}
|
|
68
66
|
};
|
|
69
67
|
};
|
|
70
|
-
|
|
71
68
|
//#endregion
|
|
72
69
|
export { zoom };
|
|
73
|
-
//# sourceMappingURL=zoom.mjs.map
|
package/dist/types/context.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ type InferPluginOptions<O extends BetterAuthOptions, ID extends BetterAuthPlugin
|
|
|
35
35
|
*
|
|
36
36
|
* const createMyPlugin = <Options extends MyPluginOptions>(options?: Options) => ({
|
|
37
37
|
* id: 'my-plugin',
|
|
38
|
+
* version: '1.0.0',
|
|
38
39
|
* options,
|
|
39
40
|
* } satisfies BetterAuthPlugin);
|
|
40
41
|
*
|
|
@@ -49,9 +50,7 @@ type InferPluginOptions<O extends BetterAuthOptions, ID extends BetterAuthPlugin
|
|
|
49
50
|
*/
|
|
50
51
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {}
|
|
51
52
|
type BetterAuthPluginRegistryIdentifier = keyof BetterAuthPluginRegistry<unknown, unknown>;
|
|
52
|
-
type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOptions> = EndpointContext<string, any
|
|
53
|
-
context: AuthContext<Options>;
|
|
54
|
-
};
|
|
53
|
+
type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOptions> = EndpointContext<string, any, any, any, any, any, any, AuthContext<Options>>;
|
|
55
54
|
interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions> {
|
|
56
55
|
createOAuthUser(user: Omit<User, "id" | "createdAt" | "updatedAt">, account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<{
|
|
57
56
|
user: User;
|
|
@@ -273,5 +272,4 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
|
|
|
273
272
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => Awaitable<unknown>;
|
|
274
273
|
};
|
|
275
274
|
//#endregion
|
|
276
|
-
export { AuthContext, BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, InfoContext, InternalAdapter, PluginContext };
|
|
277
|
-
//# sourceMappingURL=context.d.mts.map
|
|
275
|
+
export { AuthContext, BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, GenericEndpointContext, InfoContext, InternalAdapter, PluginContext };
|
package/dist/types/cookie.d.mts
CHANGED
package/dist/types/helper.d.mts
CHANGED
|
@@ -7,5 +7,4 @@ type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (Base
|
|
|
7
7
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
8
8
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { Awaitable, AwaitableFunction, LiteralString, LiteralUnion, Prettify, Primitive, UnionToIntersection };
|
|
11
|
-
//# sourceMappingURL=helper.d.mts.map
|
|
10
|
+
export { Awaitable, AwaitableFunction, LiteralString, LiteralUnion, Prettify, Primitive, UnionToIntersection };
|
|
@@ -165,7 +165,9 @@ type BetterAuthAdvancedOptions = {
|
|
|
165
165
|
ipv6Subnet?: 128 | 64 | 48 | 32;
|
|
166
166
|
} | undefined;
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* Force cookies to always use the `Secure` attribute. By default,
|
|
169
|
+
* cookies are secure in production environments. Set this to `true`
|
|
170
|
+
* to enforce secure cookies in all environments.
|
|
169
171
|
*
|
|
170
172
|
* @default false
|
|
171
173
|
*/
|
|
@@ -314,9 +316,11 @@ type BetterAuthAdvancedOptions = {
|
|
|
314
316
|
};
|
|
315
317
|
type BetterAuthOptions = {
|
|
316
318
|
/**
|
|
317
|
-
* The name of
|
|
319
|
+
* The name of your application. Used as a display name in contexts
|
|
320
|
+
* where your app needs to be identified — for example, as the default
|
|
321
|
+
* issuer name in authenticator apps when users set up 2FA/TOTP.
|
|
318
322
|
*
|
|
319
|
-
*
|
|
323
|
+
* Can also be set via the `APP_NAME` environment variable.
|
|
320
324
|
*
|
|
321
325
|
* @default "Better Auth"
|
|
322
326
|
*/
|
|
@@ -1010,7 +1014,12 @@ type BetterAuthOptions = {
|
|
|
1010
1014
|
storeInDatabase?: boolean;
|
|
1011
1015
|
}) | undefined;
|
|
1012
1016
|
/**
|
|
1013
|
-
*
|
|
1017
|
+
* Additional trusted origins. By default, Better Auth trusts your
|
|
1018
|
+
* app's {@link baseURL}. Use this option to allow additional origins
|
|
1019
|
+
* (e.g. a separate frontend domain).
|
|
1020
|
+
*
|
|
1021
|
+
* Can be a static array, a function that returns origins dynamically,
|
|
1022
|
+
* or use wildcard patterns (e.g. `"https://*.example.com"`).
|
|
1014
1023
|
*
|
|
1015
1024
|
* @param request - The request object.
|
|
1016
1025
|
* It'll be undefined if no request was
|
|
@@ -1346,5 +1355,4 @@ type BetterAuthOptions = {
|
|
|
1346
1355
|
};
|
|
1347
1356
|
};
|
|
1348
1357
|
//#endregion
|
|
1349
|
-
export { BaseURLConfig, BetterAuthAdvancedOptions, BetterAuthDBOptions, BetterAuthOptions, BetterAuthRateLimitOptions, BetterAuthRateLimitRule, BetterAuthRateLimitStorage, DynamicBaseURLConfig, GenerateIdFn, StoreIdentifierOption };
|
|
1350
|
-
//# sourceMappingURL=init-options.d.mts.map
|
|
1358
|
+
export { BaseURLConfig, BetterAuthAdvancedOptions, BetterAuthDBOptions, BetterAuthOptions, BetterAuthRateLimitOptions, BetterAuthRateLimitRule, BetterAuthRateLimitStorage, DynamicBaseURLConfig, GenerateIdFn, StoreIdentifierOption };
|
|
@@ -66,6 +66,7 @@ interface BetterAuthClientOptions {
|
|
|
66
66
|
}
|
|
67
67
|
interface BetterAuthClientPlugin {
|
|
68
68
|
id: LiteralString;
|
|
69
|
+
version?: string | undefined;
|
|
69
70
|
/**
|
|
70
71
|
* only used for type inference. don't pass the
|
|
71
72
|
* actual plugin
|
|
@@ -109,5 +110,4 @@ interface BetterAuthClientPlugin {
|
|
|
109
110
|
}>;
|
|
110
111
|
}
|
|
111
112
|
//#endregion
|
|
112
|
-
export { BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener, ClientFetchOption, ClientStore };
|
|
113
|
-
//# sourceMappingURL=plugin-client.d.mts.map
|
|
113
|
+
export { BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener, ClientFetchOption, ClientStore };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -9,7 +9,10 @@ import { Migration } from "kysely";
|
|
|
9
9
|
|
|
10
10
|
//#region src/types/plugin.d.ts
|
|
11
11
|
type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
12
|
-
type HookEndpointContext = Partial<EndpointContext<string, any
|
|
12
|
+
type HookEndpointContext = Partial<EndpointContext<string, any, any, any, any, any, any, AuthContext & {
|
|
13
|
+
returned?: unknown | undefined;
|
|
14
|
+
responseHeaders?: Headers | undefined;
|
|
15
|
+
}> & Omit<InputContext<string, any, any, any, any, any>, "method">> & {
|
|
13
16
|
path?: string;
|
|
14
17
|
context: AuthContext & {
|
|
15
18
|
returned?: unknown | undefined;
|
|
@@ -25,6 +28,7 @@ type BetterAuthPluginErrorCodePart = {
|
|
|
25
28
|
};
|
|
26
29
|
type BetterAuthPlugin = BetterAuthPluginErrorCodePart & {
|
|
27
30
|
id: LiteralString;
|
|
31
|
+
version?: string | undefined;
|
|
28
32
|
/**
|
|
29
33
|
* The init function is called when the plugin is initialized.
|
|
30
34
|
* You can return a new context or modify the existing context.
|
|
@@ -120,5 +124,4 @@ type BetterAuthPlugin = BetterAuthPluginErrorCodePart & {
|
|
|
120
124
|
};
|
|
121
125
|
};
|
|
122
126
|
//#endregion
|
|
123
|
-
export { BetterAuthPlugin, BetterAuthPluginErrorCodePart, HookEndpointContext };
|
|
124
|
-
//# sourceMappingURL=plugin.d.mts.map
|
|
127
|
+
export { BetterAuthPlugin, BetterAuthPluginErrorCodePart, HookEndpointContext };
|
package/dist/types/secret.d.mts
CHANGED
package/dist/utils/db.d.mts
CHANGED
|
@@ -6,5 +6,4 @@ import { DBFieldAttribute } from "../db/type.mjs";
|
|
|
6
6
|
*/
|
|
7
7
|
declare function filterOutputFields<T extends Record<string, unknown> | null>(data: T, additionalFields: Record<string, DBFieldAttribute> | undefined): T;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { filterOutputFields };
|
|
10
|
-
//# sourceMappingURL=db.d.mts.map
|
|
9
|
+
export { filterOutputFields };
|
package/dist/utils/db.mjs
CHANGED
|
@@ -6,5 +6,4 @@ import { InternalLogger } from "../env/logger.mjs";
|
|
|
6
6
|
*/
|
|
7
7
|
declare function deprecate<T extends (...args: any[]) => any>(fn: T, message: string, logger?: InternalLogger): T;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { deprecate };
|
|
10
|
-
//# sourceMappingURL=deprecate.d.mts.map
|
|
9
|
+
export { deprecate };
|
package/dist/utils/deprecate.mjs
CHANGED
|
@@ -10,5 +10,4 @@ type RawError<K extends string = string> = {
|
|
|
10
10
|
};
|
|
11
11
|
declare function defineErrorCodes<const T extends Record<string, string>, R extends { [K in keyof T & string]: RawError<K> }>(codes: ValidateErrorCodes<T>): R;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { RawError, defineErrorCodes };
|
|
14
|
-
//# sourceMappingURL=error-codes.d.mts.map
|
|
13
|
+
export { RawError, defineErrorCodes };
|
package/dist/utils/id.d.mts
CHANGED
package/dist/utils/id.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { createRandomStringGenerator } from "@better-auth/utils/random";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/id.ts
|
|
4
3
|
const generateId = (size) => {
|
|
5
4
|
return createRandomStringGenerator("a-z", "A-Z", "0-9")(size || 32);
|
|
6
5
|
};
|
|
7
|
-
|
|
8
6
|
//#endregion
|
|
9
7
|
export { generateId };
|
|
10
|
-
//# sourceMappingURL=id.mjs.map
|
package/dist/utils/ip.d.mts
CHANGED
|
@@ -51,5 +51,4 @@ declare function normalizeIP(ip: string, options?: NormalizeIPOptions): string;
|
|
|
51
51
|
*/
|
|
52
52
|
declare function createRateLimitKey(ip: string, path: string): string;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { createRateLimitKey, isValidIP, normalizeIP };
|
|
55
|
-
//# sourceMappingURL=ip.d.mts.map
|
|
54
|
+
export { createRateLimitKey, isValidIP, normalizeIP };
|
package/dist/utils/ip.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/ip.ts
|
|
4
3
|
/**
|
|
5
4
|
* Checks if an IP is valid IPv4 or IPv6
|
|
@@ -113,7 +112,5 @@ function normalizeIP(ip, options = {}) {
|
|
|
113
112
|
function createRateLimitKey(ip, path) {
|
|
114
113
|
return `${ip}|${path}`;
|
|
115
114
|
}
|
|
116
|
-
|
|
117
115
|
//#endregion
|
|
118
116
|
export { createRateLimitKey, isValidIP, normalizeIP };
|
|
119
|
-
//# sourceMappingURL=ip.mjs.map
|
package/dist/utils/json.d.mts
CHANGED
package/dist/utils/json.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { logger } from "../env/logger.mjs";
|
|
2
|
-
import "../env/index.mjs";
|
|
3
|
-
|
|
4
2
|
//#region src/utils/json.ts
|
|
5
3
|
const iso8601Regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
6
4
|
function reviveDate(value) {
|
|
@@ -39,7 +37,5 @@ function safeJSONParse(data) {
|
|
|
39
37
|
return null;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
//#endregion
|
|
44
41
|
export { safeJSONParse };
|
|
45
|
-
//# sourceMappingURL=json.mjs.map
|
package/dist/utils/string.d.mts
CHANGED
package/dist/utils/string.mjs
CHANGED
package/dist/utils/url.d.mts
CHANGED
package/dist/utils/url.mjs
CHANGED
|
@@ -27,7 +27,5 @@ function normalizePathname(requestUrl, basePath) {
|
|
|
27
27
|
if (pathname.startsWith(basePath + "/")) return pathname.slice(basePath.length).replace(/\/+$/, "") || "/";
|
|
28
28
|
return pathname;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
//#endregion
|
|
32
31
|
export { normalizePathname };
|
|
33
|
-
//# sourceMappingURL=url.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-beta.0",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
|
+
"sideEffects": false,
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|
|
24
|
-
"src"
|
|
25
|
+
"src",
|
|
26
|
+
"!src/**/*.test.ts"
|
|
25
27
|
],
|
|
26
28
|
"main": "./dist/index.mjs",
|
|
27
29
|
"module": "./dist/index.mjs",
|
|
@@ -143,23 +145,23 @@
|
|
|
143
145
|
"zod": "^4.3.6"
|
|
144
146
|
},
|
|
145
147
|
"devDependencies": {
|
|
146
|
-
"@better-auth/utils": "0.
|
|
148
|
+
"@better-auth/utils": "0.4.0",
|
|
147
149
|
"@better-fetch/fetch": "1.1.21",
|
|
148
150
|
"@opentelemetry/api": "^1.9.0",
|
|
149
151
|
"@opentelemetry/sdk-trace-base": "^1.30.0",
|
|
150
152
|
"@opentelemetry/sdk-trace-node": "^1.30.0",
|
|
151
|
-
"better-call": "
|
|
153
|
+
"better-call": "2.0.3",
|
|
152
154
|
"@cloudflare/workers-types": "^4.20250121.0",
|
|
153
155
|
"jose": "^6.1.3",
|
|
154
|
-
"kysely": "^0.28.
|
|
156
|
+
"kysely": "^0.28.14",
|
|
155
157
|
"nanostores": "^1.1.1",
|
|
156
|
-
"tsdown": "0.21.
|
|
158
|
+
"tsdown": "0.21.1"
|
|
157
159
|
},
|
|
158
160
|
"peerDependencies": {
|
|
159
|
-
"@better-auth/utils": "0.
|
|
161
|
+
"@better-auth/utils": "0.4.0",
|
|
160
162
|
"@better-fetch/fetch": "1.1.21",
|
|
161
163
|
"@opentelemetry/api": "^1.9.0",
|
|
162
|
-
"better-call": "
|
|
164
|
+
"better-call": "2.0.3",
|
|
163
165
|
"@cloudflare/workers-types": ">=4",
|
|
164
166
|
"jose": "^6.1.0",
|
|
165
167
|
"kysely": "^0.28.5",
|
|
@@ -173,7 +175,7 @@
|
|
|
173
175
|
"scripts": {
|
|
174
176
|
"build": "tsdown",
|
|
175
177
|
"dev": "tsdown --watch",
|
|
176
|
-
"lint:package": "publint run --strict",
|
|
178
|
+
"lint:package": "publint run --strict --pack false",
|
|
177
179
|
"lint:types": "attw --profile esm-only --pack .",
|
|
178
180
|
"typecheck": "tsc --project tsconfig.json",
|
|
179
181
|
"test": "vitest",
|