better-auth 1.6.26 → 1.6.28
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/adapters/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +16 -13
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +59 -46
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +137 -132
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +76 -69
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +45 -41
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +12 -9
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +6 -3
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +12 -11
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +20 -18
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +7 -6
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +33 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +12 -11
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_MESSAGE_TYPE, POPUP_MARKER_COOKIE } from "./constants.mjs";
|
|
2
2
|
import { OAUTH_POPUP_ERROR_CODES } from "./error-codes.mjs";
|
|
3
3
|
import { OAuthPopupData, OAuthPopupMessage } from "./types.mjs";
|
|
4
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
5
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
6
|
+
import * as _$better_call0 from "better-call";
|
|
4
7
|
import * as z from "zod";
|
|
8
|
+
|
|
5
9
|
//#region src/plugins/oauth-popup/index.d.ts
|
|
6
10
|
declare module "@better-auth/core" {
|
|
7
11
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -28,13 +32,13 @@ declare const oauthPopup: () => {
|
|
|
28
32
|
id: "oauth-popup";
|
|
29
33
|
version: string;
|
|
30
34
|
$ERROR_CODES: {
|
|
31
|
-
POPUP_SIGN_IN_FAILED:
|
|
32
|
-
POPUP_BLOCKED:
|
|
33
|
-
POPUP_CLOSED:
|
|
34
|
-
POPUP_TIMEOUT:
|
|
35
|
+
POPUP_SIGN_IN_FAILED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_SIGN_IN_FAILED">;
|
|
36
|
+
POPUP_BLOCKED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_BLOCKED">;
|
|
37
|
+
POPUP_CLOSED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_CLOSED">;
|
|
38
|
+
POPUP_TIMEOUT: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_TIMEOUT">;
|
|
35
39
|
};
|
|
36
40
|
endpoints: {
|
|
37
|
-
oauthPopupStart:
|
|
41
|
+
oauthPopupStart: _$better_call0.StrictEndpoint<"/oauth-popup/start", {
|
|
38
42
|
method: "GET";
|
|
39
43
|
query: z.ZodObject<{
|
|
40
44
|
provider: z.ZodString;
|
|
@@ -54,10 +58,10 @@ declare const oauthPopup: () => {
|
|
|
54
58
|
};
|
|
55
59
|
hooks: {
|
|
56
60
|
after: {
|
|
57
|
-
matcher(context:
|
|
58
|
-
handler: (inputContext:
|
|
61
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
62
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
59
63
|
}[];
|
|
60
64
|
};
|
|
61
65
|
};
|
|
62
66
|
//#endregion
|
|
63
|
-
export { OAUTH_POPUP_COMPLETE_SCRIPT,
|
|
67
|
+
export { OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_SCRIPT_CSP_HASH, oauthPopup };
|
|
@@ -225,4 +225,4 @@ const oauthPopup = () => {
|
|
|
225
225
|
};
|
|
226
226
|
};
|
|
227
227
|
//#endregion
|
|
228
|
-
export { OAUTH_POPUP_COMPLETE_SCRIPT,
|
|
228
|
+
export { OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_SCRIPT_CSP_HASH, oauthPopup };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAUTH_POPUP_MESSAGE_TYPE } from "./constants.mjs";
|
|
2
|
+
|
|
2
3
|
//#region src/plugins/oauth-popup/types.d.ts
|
|
3
4
|
/** OAuth error relayed to the opener when the flow fails. */
|
|
4
5
|
interface OAuthPopupError {
|
|
@@ -26,4 +27,4 @@ interface OAuthPopupData extends OAuthPopupMessage {
|
|
|
26
27
|
targetOrigin: string;
|
|
27
28
|
}
|
|
28
29
|
//#endregion
|
|
29
|
-
export { OAuthPopupData,
|
|
30
|
+
export { OAuthPopupData, OAuthPopupMessage };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
1
2
|
import { SecretConfig } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
2
4
|
import * as z from "zod";
|
|
5
|
+
|
|
3
6
|
//#region src/plugins/oauth-proxy/index.d.ts
|
|
4
7
|
declare module "@better-auth/core" {
|
|
5
8
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -55,14 +58,14 @@ declare const oAuthProxy: <O extends OAuthProxyOptions>(opts?: O) => {
|
|
|
55
58
|
version: string;
|
|
56
59
|
options: NoInfer<O>;
|
|
57
60
|
endpoints: {
|
|
58
|
-
oAuthProxy:
|
|
61
|
+
oAuthProxy: _$better_call0.StrictEndpoint<"/oauth-proxy-callback", {
|
|
59
62
|
method: "GET";
|
|
60
63
|
operationId: string;
|
|
61
64
|
query: z.ZodObject<{
|
|
62
65
|
callbackURL: z.ZodString;
|
|
63
66
|
profile: z.ZodOptional<z.ZodString>;
|
|
64
67
|
}, z.core.$strip>;
|
|
65
|
-
use: (
|
|
68
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
|
|
66
69
|
metadata: {
|
|
67
70
|
openapi: {
|
|
68
71
|
operationId: string;
|
|
@@ -97,12 +100,12 @@ declare const oAuthProxy: <O extends OAuthProxyOptions>(opts?: O) => {
|
|
|
97
100
|
};
|
|
98
101
|
hooks: {
|
|
99
102
|
before: {
|
|
100
|
-
matcher(context:
|
|
101
|
-
handler: (inputContext:
|
|
103
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
104
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
102
105
|
}[];
|
|
103
106
|
after: {
|
|
104
|
-
matcher(context:
|
|
105
|
-
handler: (inputContext:
|
|
107
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
108
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
106
109
|
}[];
|
|
107
110
|
};
|
|
108
111
|
};
|
|
@@ -11,7 +11,7 @@ import { PACKAGE_VERSION } from "../../version.mjs";
|
|
|
11
11
|
import { parseJSON } from "../../client/parser.mjs";
|
|
12
12
|
import { checkSkipProxy, resolveCurrentURL, stripTrailingSlash } from "./utils.mjs";
|
|
13
13
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
14
|
-
import { defu
|
|
14
|
+
import { defu } from "defu";
|
|
15
15
|
import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
|
|
16
16
|
import * as z from "zod";
|
|
17
17
|
//#region src/plugins/oauth-proxy/index.ts
|
|
@@ -150,7 +150,7 @@ const oAuthProxy = (opts) => {
|
|
|
150
150
|
return context.path === "/callback/:id";
|
|
151
151
|
},
|
|
152
152
|
handler: createAuthMiddleware(async (ctx) => {
|
|
153
|
-
const callbackParams = defu
|
|
153
|
+
const callbackParams = defu(ctx.query, ctx.body);
|
|
154
154
|
const state = callbackParams.state;
|
|
155
155
|
if (!state || typeof state !== "string") return;
|
|
156
156
|
let statePackage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody } from "./types.mjs";
|
|
2
2
|
import { oidcProvider } from "./index.mjs";
|
|
3
|
+
|
|
3
4
|
//#region src/plugins/oidc-provider/client.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* @deprecated Use `@better-auth/oauth-provider` instead. This plugin will be removed in the next major version.
|
|
@@ -12,4 +13,4 @@ declare const oidcClient: () => {
|
|
|
12
13
|
};
|
|
13
14
|
type OidcClientPlugin = ReturnType<typeof oidcClient>;
|
|
14
15
|
//#endregion
|
|
15
|
-
export {
|
|
16
|
+
export { OidcClientPlugin, oidcClient };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
2
2
|
import { schema } from "./schema.mjs";
|
|
3
3
|
import { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody } from "./types.mjs";
|
|
4
|
-
import "../index.mjs";
|
|
5
4
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
5
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
6
|
+
import * as _$better_call0 from "better-call";
|
|
6
7
|
import { OpenAPIParameter } from "better-call";
|
|
7
8
|
import * as z from "zod";
|
|
9
|
+
|
|
8
10
|
//#region src/plugins/oidc-provider/index.d.ts
|
|
9
11
|
declare module "@better-auth/core" {
|
|
10
12
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -39,21 +41,21 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
39
41
|
hooks: {
|
|
40
42
|
after: {
|
|
41
43
|
matcher(): true;
|
|
42
|
-
handler: (inputContext:
|
|
44
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<Response | {
|
|
43
45
|
redirect: boolean;
|
|
44
46
|
url: string;
|
|
45
|
-
} | undefined
|
|
47
|
+
} | undefined>>;
|
|
46
48
|
}[];
|
|
47
49
|
};
|
|
48
50
|
endpoints: {
|
|
49
|
-
getOpenIdConfig:
|
|
51
|
+
getOpenIdConfig: _$better_call0.StrictEndpoint<"/.well-known/openid-configuration", {
|
|
50
52
|
method: "GET";
|
|
51
53
|
operationId: string;
|
|
52
54
|
metadata: {
|
|
53
55
|
readonly scope: "server";
|
|
54
56
|
};
|
|
55
57
|
}, OIDCMetadata>;
|
|
56
|
-
oAuth2authorize:
|
|
58
|
+
oAuth2authorize: _$better_call0.StrictEndpoint<"/oauth2/authorize", {
|
|
57
59
|
method: "GET";
|
|
58
60
|
operationId: string;
|
|
59
61
|
query: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
@@ -80,14 +82,14 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
80
82
|
redirect: boolean;
|
|
81
83
|
url: string;
|
|
82
84
|
}>;
|
|
83
|
-
oAuthConsent:
|
|
85
|
+
oAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/consent", {
|
|
84
86
|
method: "POST";
|
|
85
87
|
operationId: string;
|
|
86
88
|
body: z.ZodObject<{
|
|
87
89
|
accept: z.ZodBoolean;
|
|
88
90
|
consent_code: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
89
91
|
}, z.core.$strip>;
|
|
90
|
-
use: (
|
|
92
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
91
93
|
session: {
|
|
92
94
|
session: Record<string, any> & {
|
|
93
95
|
id: string;
|
|
@@ -109,7 +111,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
109
111
|
image?: string | null | undefined;
|
|
110
112
|
};
|
|
111
113
|
};
|
|
112
|
-
}
|
|
114
|
+
}>>[];
|
|
113
115
|
metadata: {
|
|
114
116
|
openapi: {
|
|
115
117
|
description: string;
|
|
@@ -159,7 +161,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
159
161
|
}, {
|
|
160
162
|
redirectURI: string;
|
|
161
163
|
}>;
|
|
162
|
-
oAuth2token:
|
|
164
|
+
oAuth2token: _$better_call0.StrictEndpoint<"/oauth2/token", {
|
|
163
165
|
method: "POST";
|
|
164
166
|
operationId: string;
|
|
165
167
|
body: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
@@ -181,7 +183,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
181
183
|
scope: string;
|
|
182
184
|
id_token: string | undefined;
|
|
183
185
|
}>;
|
|
184
|
-
oAuth2userInfo:
|
|
186
|
+
oAuth2userInfo: _$better_call0.StrictEndpoint<"/oauth2/userinfo", {
|
|
185
187
|
method: "GET";
|
|
186
188
|
operationId: string;
|
|
187
189
|
metadata: {
|
|
@@ -273,7 +275,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
273
275
|
*
|
|
274
276
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/oidc-provider#api-method-oauth2-register)
|
|
275
277
|
*/
|
|
276
|
-
registerOAuthApplication:
|
|
278
|
+
registerOAuthApplication: _$better_call0.StrictEndpoint<"/oauth2/register", {
|
|
277
279
|
method: "POST";
|
|
278
280
|
body: z.ZodObject<{
|
|
279
281
|
redirect_uris: z.ZodArray<z.ZodString>;
|
|
@@ -413,9 +415,9 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
413
415
|
client_secret?: string | undefined;
|
|
414
416
|
client_id: string;
|
|
415
417
|
}>;
|
|
416
|
-
getOAuthClient:
|
|
418
|
+
getOAuthClient: _$better_call0.StrictEndpoint<"/oauth2/client/:id", {
|
|
417
419
|
method: "GET";
|
|
418
|
-
use: (
|
|
420
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
419
421
|
session: {
|
|
420
422
|
session: Record<string, any> & {
|
|
421
423
|
id: string;
|
|
@@ -437,7 +439,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
437
439
|
image?: string | null | undefined;
|
|
438
440
|
};
|
|
439
441
|
};
|
|
440
|
-
}
|
|
442
|
+
}>>[];
|
|
441
443
|
metadata: {
|
|
442
444
|
openapi: {
|
|
443
445
|
description: string;
|
|
@@ -486,7 +488,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
486
488
|
*
|
|
487
489
|
* @see [OpenID Connect RP-Initiated Logout Spec](https://openid.net/specs/openid-connect-rpinitiated-1_0.html)
|
|
488
490
|
*/
|
|
489
|
-
endSession:
|
|
491
|
+
endSession: _$better_call0.StrictEndpoint<"/oauth2/endsession", {
|
|
490
492
|
method: ("GET" | "POST")[];
|
|
491
493
|
query: z.ZodOptional<z.ZodObject<{
|
|
492
494
|
id_token_hint: z.ZodOptional<z.ZodString>;
|
|
@@ -512,7 +514,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
512
514
|
scope: "server";
|
|
513
515
|
};
|
|
514
516
|
}, {
|
|
515
|
-
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") |
|
|
517
|
+
status: ("OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | _$better_call0.Status;
|
|
516
518
|
body: ({
|
|
517
519
|
message?: string;
|
|
518
520
|
code?: string;
|
|
@@ -687,7 +689,7 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
687
689
|
allowPlainCodeChallengeMethod: boolean;
|
|
688
690
|
generateClientId?: (() => string) | undefined;
|
|
689
691
|
generateClientSecret?: (() => string) | undefined;
|
|
690
|
-
getAdditionalUserInfoClaim?: ((user:
|
|
692
|
+
getAdditionalUserInfoClaim?: ((user: _$_better_auth_core_db0.User & Record<string, any>, scopes: string[], client: Client) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
691
693
|
trustedClients?: Client[] | undefined;
|
|
692
694
|
storeClientSecret: "plain" | "hashed" | "encrypted" | {
|
|
693
695
|
hash: (clientSecret: string) => Promise<string>;
|
|
@@ -700,4 +702,4 @@ declare const oidcProvider: (options: OIDCOptions) => {
|
|
|
700
702
|
};
|
|
701
703
|
};
|
|
702
704
|
//#endregion
|
|
703
|
-
export {
|
|
705
|
+
export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody, getClient, getMetadata, oidcProvider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
-
import "../../types/index.mjs";
|
|
4
3
|
import { OAuthApplication, schema } from "./schema.mjs";
|
|
4
|
+
|
|
5
5
|
//#region src/plugins/oidc-provider/types.d.ts
|
|
6
6
|
interface OIDCOptions {
|
|
7
7
|
/** @internal */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BetterAuthClientOptions, ClientFetchOption, ClientStore } from "@better-auth/core";
|
|
2
|
+
import * as _$_better_fetch_fetch0 from "@better-fetch/fetch";
|
|
2
3
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/one-tap/client.d.ts
|
|
4
6
|
declare global {
|
|
5
7
|
interface Window {
|
|
@@ -160,7 +162,7 @@ declare const oneTapClient: (options: GoogleOneTapOptions) => {
|
|
|
160
162
|
id: string;
|
|
161
163
|
name: string;
|
|
162
164
|
hooks: {
|
|
163
|
-
onResponse(ctx:
|
|
165
|
+
onResponse(ctx: _$_better_fetch_fetch0.ResponseContext): Promise<void>;
|
|
164
166
|
};
|
|
165
167
|
}[];
|
|
166
168
|
getActions: ($fetch: BetterFetch, _$store: ClientStore, _options: BetterAuthClientOptions | undefined) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as _$better_call0 from "better-call";
|
|
1
2
|
import * as z from "zod";
|
|
3
|
+
|
|
2
4
|
//#region src/plugins/one-tap/index.d.ts
|
|
3
5
|
declare module "@better-auth/core" {
|
|
4
6
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -26,7 +28,7 @@ declare const oneTap: (options?: OneTapOptions | undefined) => {
|
|
|
26
28
|
id: "one-tap";
|
|
27
29
|
version: string;
|
|
28
30
|
endpoints: {
|
|
29
|
-
oneTapCallback:
|
|
31
|
+
oneTapCallback: _$better_call0.StrictEndpoint<"/one-tap/callback", {
|
|
30
32
|
method: "POST";
|
|
31
33
|
body: z.ZodObject<{
|
|
32
34
|
idToken: z.ZodString;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OneTimeTokenOptions, oneTimeToken } from "./index.mjs";
|
|
2
|
+
|
|
2
3
|
//#region src/plugins/one-time-token/client.d.ts
|
|
3
4
|
declare const oneTimeTokenClient: () => {
|
|
4
5
|
id: "one-time-token";
|
|
@@ -6,4 +7,4 @@ declare const oneTimeTokenClient: () => {
|
|
|
6
7
|
$InferServerPlugin: ReturnType<typeof oneTimeToken>;
|
|
7
8
|
};
|
|
8
9
|
//#endregion
|
|
9
|
-
export {
|
|
10
|
+
export { oneTimeTokenClient };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Session, User } from "../../types/models.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
+
|
|
5
6
|
//#region src/plugins/one-time-token/index.d.ts
|
|
6
7
|
declare module "@better-auth/core" {
|
|
7
8
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -66,9 +67,9 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
66
67
|
*
|
|
67
68
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/one-time-token#api-method-one-time-token-generate)
|
|
68
69
|
*/
|
|
69
|
-
generateOneTimeToken:
|
|
70
|
+
generateOneTimeToken: _$better_call0.StrictEndpoint<"/one-time-token/generate", {
|
|
70
71
|
method: "GET";
|
|
71
|
-
use: (
|
|
72
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
72
73
|
session: {
|
|
73
74
|
session: Record<string, any> & {
|
|
74
75
|
id: string;
|
|
@@ -90,7 +91,7 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
90
91
|
image?: string | null | undefined;
|
|
91
92
|
};
|
|
92
93
|
};
|
|
93
|
-
}
|
|
94
|
+
}>>[];
|
|
94
95
|
}, {
|
|
95
96
|
token: string;
|
|
96
97
|
}>;
|
|
@@ -109,7 +110,7 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
109
110
|
*
|
|
110
111
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/one-time-token#api-method-one-time-token-verify)
|
|
111
112
|
*/
|
|
112
|
-
verifyOneTimeToken:
|
|
113
|
+
verifyOneTimeToken: _$better_call0.StrictEndpoint<"/one-time-token/verify", {
|
|
113
114
|
method: "POST";
|
|
114
115
|
body: z.ZodObject<{
|
|
115
116
|
token: z.ZodString;
|
|
@@ -122,7 +123,7 @@ declare const oneTimeToken: (options?: OneTimeTokenOptions | undefined) => {
|
|
|
122
123
|
hooks: {
|
|
123
124
|
after: {
|
|
124
125
|
matcher: () => true;
|
|
125
|
-
handler: (inputContext:
|
|
126
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
126
127
|
}[];
|
|
127
128
|
};
|
|
128
129
|
options: OneTimeTokenOptions | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthContext, BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBFieldAttributeConfig, DBFieldType } from "@better-auth/core/db";
|
|
3
3
|
import { OpenAPIParameter, OpenAPISchemaType } from "better-call";
|
|
4
|
+
|
|
4
5
|
//#region src/plugins/open-api/generator.d.ts
|
|
5
6
|
interface Path {
|
|
6
7
|
get?: OpenAPIOperation | undefined;
|
|
@@ -2,7 +2,7 @@ import { db_exports } from "../../db/index.mjs";
|
|
|
2
2
|
import { getEndpoints } from "../../api/index.mjs";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#region src/plugins/open-api/generator.ts
|
|
5
|
-
const OPEN_API_SCHEMA_TYPES =
|
|
5
|
+
const OPEN_API_SCHEMA_TYPES = new Set([
|
|
6
6
|
"string",
|
|
7
7
|
"number",
|
|
8
8
|
"boolean",
|
|
@@ -47,7 +47,7 @@ function withDescription(schema, zodType) {
|
|
|
47
47
|
function addNullType(schema) {
|
|
48
48
|
if (schema.type) {
|
|
49
49
|
const type = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
50
|
-
const nullableType = Array.from(
|
|
50
|
+
const nullableType = Array.from(new Set([...type, "null"]));
|
|
51
51
|
return {
|
|
52
52
|
...schema,
|
|
53
53
|
type: nullableType
|
|
@@ -134,7 +134,7 @@ function mergeObjectSchemas(left, right, description) {
|
|
|
134
134
|
if (properties[key] !== void 0 && !areSchemasEqual(properties[key], value)) return;
|
|
135
135
|
properties[key] = value;
|
|
136
136
|
}
|
|
137
|
-
const required = Array.from(
|
|
137
|
+
const required = Array.from(new Set([...left.required || [], ...right.required || []]));
|
|
138
138
|
const leftAdditionalProperties = left.additionalProperties;
|
|
139
139
|
const rightAdditionalProperties = right.additionalProperties;
|
|
140
140
|
if (!areSchemaMembersCompatible(leftAdditionalProperties, rightAdditionalProperties)) return;
|
|
@@ -166,7 +166,7 @@ function getRequestBody(options) {
|
|
|
166
166
|
* Paths that accept `user.additionalFields` and plugin user schema fields via
|
|
167
167
|
* `parseUserInput`. Their static OpenAPI request bodies need those fields merged in.
|
|
168
168
|
*/
|
|
169
|
-
const USER_INPUT_BODY_PATHS =
|
|
169
|
+
const USER_INPUT_BODY_PATHS = new Set(["/sign-up/email", "/update-user"]);
|
|
170
170
|
function dbFieldToRequestBodyProperty(field) {
|
|
171
171
|
if (field.type === "date") return {
|
|
172
172
|
type: "string",
|
|
@@ -399,7 +399,7 @@ async function generator(ctx, options) {
|
|
|
399
399
|
const components = { schemas: { ...Object.entries(tables).reduce((acc, [key, value]) => {
|
|
400
400
|
const modelName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
401
401
|
const fields = value.fields;
|
|
402
|
-
const required =
|
|
402
|
+
const required = new Set(["id"]);
|
|
403
403
|
const properties = { id: {
|
|
404
404
|
type: "string",
|
|
405
405
|
readOnly: true
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator } from "./generator.mjs";
|
|
2
2
|
import { LiteralString } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/open-api/index.d.ts
|
|
4
6
|
declare module "@better-auth/core" {
|
|
5
7
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -42,7 +44,7 @@ declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
|
42
44
|
id: "open-api";
|
|
43
45
|
version: string;
|
|
44
46
|
endpoints: {
|
|
45
|
-
generateOpenAPISchema:
|
|
47
|
+
generateOpenAPISchema: _$better_call0.StrictEndpoint<"/open-api/generate-schema", {
|
|
46
48
|
method: "GET";
|
|
47
49
|
}, {
|
|
48
50
|
openapi: string;
|
|
@@ -82,7 +84,7 @@ declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
|
82
84
|
}[];
|
|
83
85
|
paths: Record<string, Path>;
|
|
84
86
|
}>;
|
|
85
|
-
openAPIReference:
|
|
87
|
+
openAPIReference: _$better_call0.StrictEndpoint<LiteralString | "/reference", {
|
|
86
88
|
method: "GET";
|
|
87
89
|
metadata: {
|
|
88
90
|
readonly scope: "server";
|
|
@@ -92,4 +94,4 @@ declare const openAPI: <O extends OpenAPIOptions>(options?: O | undefined) => {
|
|
|
92
94
|
options: NoInfer<O>;
|
|
93
95
|
};
|
|
94
96
|
//#endregion
|
|
95
|
-
export { type FieldSchema, type OpenAPIModelSchema, OpenAPIOptions,
|
|
97
|
+
export { type FieldSchema, type OpenAPIModelSchema, OpenAPIOptions, OpenAPIParameter, OpenAPISchema, type Path, generator, openAPI };
|