better-auth 1.8.0-beta.2 → 1.8.0-beta.4
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 +5 -10
- package/dist/api/dispatch.d.mts +3 -5
- package/dist/api/dispatch.mjs +7 -5
- package/dist/api/index.d.mts +506 -508
- package/dist/api/index.mjs +35 -34
- package/dist/api/middlewares/authorization.d.mts +15 -12
- package/dist/api/middlewares/authorization.mjs +2 -1
- package/dist/api/middlewares/index.d.mts +2 -1
- package/dist/api/middlewares/origin-check.d.mts +4 -7
- package/dist/api/routes/account.d.mts +11 -15
- package/dist/api/routes/account.mjs +7 -4
- package/dist/api/routes/callback.d.mts +2 -5
- package/dist/api/routes/callback.mjs +4 -2
- package/dist/api/routes/email-verification.d.mts +7 -12
- package/dist/api/routes/error.d.mts +2 -5
- package/dist/api/routes/index.d.mts +2 -1
- package/dist/api/routes/ok.d.mts +2 -5
- package/dist/api/routes/password.d.mts +8 -11
- package/dist/api/routes/password.mjs +3 -2
- package/dist/api/routes/session.d.mts +26 -29
- package/dist/api/routes/sign-in.d.mts +4 -6
- package/dist/api/routes/sign-out.d.mts +2 -5
- package/dist/api/routes/sign-up.d.mts +4 -6
- package/dist/api/routes/update-session.d.mts +4 -6
- package/dist/api/routes/update-user.d.mts +14 -16
- package/dist/api/routes/update-user.mjs +1 -1
- package/dist/api/state/oauth.d.mts +0 -3
- package/dist/api/state/oauth.mjs +2 -1
- package/dist/auth/full.d.mts +3 -4
- package/dist/auth/minimal.d.mts +3 -3
- package/dist/client/broadcast-channel.d.mts +6 -7
- package/dist/client/config.d.mts +15 -19
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +3 -5
- package/dist/client/focus-manager.d.mts +4 -5
- package/dist/client/index.d.mts +8 -7
- package/dist/client/lynx/index.d.mts +6 -7
- package/dist/client/lynx/index.mjs +3 -2
- package/dist/client/lynx/lynx-store.d.mts +3 -4
- package/dist/client/online-manager.d.mts +4 -5
- package/dist/client/parser.d.mts +9 -5
- package/dist/client/parser.mjs +1 -11
- package/dist/client/path-to-object.d.mts +13 -14
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +2 -4
- package/dist/client/query.d.mts +4 -6
- package/dist/client/react/index.d.mts +6 -7
- package/dist/client/react/index.mjs +3 -2
- package/dist/client/react/react-store.d.mts +3 -4
- package/dist/client/session-atom.d.mts +4 -4
- package/dist/client/session-refresh.d.mts +3 -5
- package/dist/client/solid/index.d.mts +6 -7
- package/dist/client/solid/index.mjs +3 -2
- package/dist/client/svelte/index.d.mts +6 -7
- package/dist/client/svelte/index.mjs +3 -2
- package/dist/client/types.d.mts +11 -11
- package/dist/client/vanilla.d.mts +4 -5
- package/dist/client/vanilla.mjs +3 -2
- package/dist/client/vue/index.d.mts +6 -7
- package/dist/client/vue/index.mjs +16 -9
- package/dist/context/create-context.mjs +7 -7
- package/dist/context/helpers.mjs +9 -7
- package/dist/context/secret-utils.mjs +3 -3
- package/dist/cookies/cookie-utils.d.mts +13 -13
- package/dist/cookies/cookie-utils.mjs +1 -3
- package/dist/cookies/index.d.mts +17 -18
- package/dist/cookies/index.mjs +11 -7
- package/dist/cookies/jwt.mjs +2 -1
- package/dist/cookies/session-store.d.mts +6 -5
- package/dist/cookies/session-store.mjs +3 -2
- package/dist/crypto/buffer.d.mts +2 -3
- package/dist/crypto/index.d.mts +9 -16
- package/dist/crypto/index.mjs +2 -1
- package/dist/crypto/jwt.d.mts +5 -7
- package/dist/crypto/jwt.mjs +2 -1
- package/dist/crypto/password.d.mts +1 -5
- package/dist/crypto/random.d.mts +2 -3
- package/dist/db/adapter-base.d.mts +2 -4
- package/dist/db/adapter-kysely.d.mts +2 -4
- package/dist/db/field-converter.d.mts +3 -5
- package/dist/db/field.d.mts +11 -12
- package/dist/db/get-migration.d.mts +4 -8
- package/dist/db/get-migration.mjs +22 -22
- package/dist/db/get-schema.d.mts +2 -4
- package/dist/db/internal-adapter.d.mts +2 -4
- package/dist/db/internal-adapter.mjs +6 -4
- package/dist/db/revoke-unproven-account-access.d.mts +3 -4
- package/dist/db/schema.d.mts +15 -16
- package/dist/db/schema.mjs +6 -3
- package/dist/db/to-zod.d.mts +5 -9
- package/dist/db/with-hooks.d.mts +3 -5
- package/dist/index.d.mts +4 -3
- package/dist/integrations/next-js.d.mts +7 -11
- package/dist/integrations/node.d.mts +5 -7
- package/dist/integrations/node.mjs +4 -2
- package/dist/integrations/solid-start.d.mts +2 -3
- package/dist/integrations/svelte-kit.d.mts +6 -14
- package/dist/integrations/tanstack-start-solid.d.mts +4 -8
- package/dist/integrations/tanstack-start.d.mts +4 -8
- package/dist/oauth2/link-account.d.mts +5 -11
- package/dist/oauth2/link-account.mjs +12 -6
- package/dist/oauth2/state.d.mts +5 -7
- package/dist/oauth2/state.mjs +1 -1
- package/dist/oauth2/utils.d.mts +4 -6
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +4 -6
- package/dist/plugins/access/index.mjs +1 -2
- package/dist/plugins/access/types.d.mts +12 -14
- package/dist/plugins/additional-fields/client.d.mts +2 -4
- package/dist/plugins/admin/access/index.mjs +1 -2
- package/dist/plugins/admin/access/statement.d.mts +7 -7
- package/dist/plugins/admin/admin.d.mts +124 -129
- package/dist/plugins/admin/admin.mjs +4 -4
- package/dist/plugins/admin/client.d.mts +33 -32
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +26 -28
- package/dist/plugins/admin/error-codes.mjs +2 -1
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/index.mjs +1 -2
- package/dist/plugins/admin/routes.mjs +1 -0
- package/dist/plugins/admin/schema.d.mts +3 -4
- package/dist/plugins/admin/types.d.mts +8 -8
- package/dist/plugins/anonymous/client.d.mts +10 -12
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -13
- package/dist/plugins/anonymous/index.d.mts +17 -21
- package/dist/plugins/anonymous/schema.d.mts +2 -3
- package/dist/plugins/anonymous/types.d.mts +5 -6
- package/dist/plugins/bearer/index.d.mts +7 -11
- package/dist/plugins/captcha/constants.d.mts +2 -3
- package/dist/plugins/captcha/index.d.mts +6 -9
- package/dist/plugins/captcha/types.d.mts +11 -13
- package/dist/plugins/custom-session/client.d.mts +2 -4
- package/dist/plugins/custom-session/index.d.mts +10 -16
- package/dist/plugins/device-authorization/client.d.mts +2 -4
- package/dist/plugins/device-authorization/index.d.mts +39 -44
- package/dist/plugins/device-authorization/index.mjs +9 -8
- package/dist/plugins/device-authorization/routes.d.mts +11 -9
- package/dist/plugins/device-authorization/routes.mjs +6 -5
- package/dist/plugins/device-authorization/schema.d.mts +2 -3
- package/dist/plugins/email-otp/client.d.mts +5 -7
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -8
- package/dist/plugins/email-otp/index.d.mts +69 -76
- package/dist/plugins/email-otp/otp-token.mjs +19 -7
- package/dist/plugins/email-otp/types.d.mts +2 -4
- package/dist/plugins/generic-oauth/index.d.mts +9 -13
- package/dist/plugins/generic-oauth/index.mjs +6 -4
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -1
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +5 -1
- package/dist/plugins/generic-oauth/providers/index.d.mts +2 -1
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/line.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/okta.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/patreon.mjs +2 -2
- package/dist/plugins/generic-oauth/providers/slack.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/slack.mjs +5 -2
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +3 -5
- package/dist/plugins/generic-oauth/types.d.mts +6 -7
- package/dist/plugins/haveibeenpwned/index.d.mts +7 -11
- package/dist/plugins/index.d.mts +4 -1
- package/dist/plugins/jwt/client.d.mts +2 -3
- package/dist/plugins/jwt/index.d.mts +11 -14
- package/dist/plugins/jwt/index.mjs +1 -1
- package/dist/plugins/jwt/schema.d.mts +2 -3
- package/dist/plugins/jwt/sign.d.mts +9 -8
- package/dist/plugins/jwt/types.d.mts +7 -8
- package/dist/plugins/jwt/utils.d.mts +6 -9
- package/dist/plugins/jwt/verify.d.mts +2 -4
- package/dist/plugins/last-login-method/client.d.mts +3 -4
- package/dist/plugins/last-login-method/index.d.mts +5 -9
- package/dist/plugins/last-login-method/index.mjs +1 -1
- package/dist/plugins/magic-link/client.d.mts +2 -4
- package/dist/plugins/magic-link/index.d.mts +7 -10
- package/dist/plugins/magic-link/index.mjs +20 -17
- package/dist/plugins/multi-session/client.d.mts +3 -5
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -6
- package/dist/plugins/multi-session/index.d.mts +10 -14
- package/dist/plugins/oauth-popup/client.d.mts +11 -17
- package/dist/plugins/oauth-popup/client.mjs +6 -4
- package/dist/plugins/oauth-popup/constants.d.mts +5 -6
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -9
- package/dist/plugins/oauth-popup/index.d.mts +11 -15
- package/dist/plugins/oauth-popup/index.mjs +8 -7
- package/dist/plugins/oauth-popup/types.d.mts +4 -6
- package/dist/plugins/oauth-proxy/index.d.mts +11 -15
- package/dist/plugins/oauth-proxy/index.mjs +10 -7
- package/dist/plugins/one-tap/client.d.mts +6 -9
- package/dist/plugins/one-tap/index.d.mts +4 -7
- package/dist/plugins/one-time-token/client.d.mts +2 -3
- package/dist/plugins/one-time-token/index.d.mts +8 -10
- package/dist/plugins/open-api/generator.d.mts +8 -8
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -7
- package/dist/plugins/organization/access/index.mjs +1 -2
- package/dist/plugins/organization/access/statement.d.mts +8 -8
- package/dist/plugins/organization/adapter.d.mts +60 -87
- package/dist/plugins/organization/adapter.mjs +14 -10
- package/dist/plugins/organization/client.d.mts +108 -107
- package/dist/plugins/organization/client.mjs +9 -5
- package/dist/plugins/organization/error-codes.d.mts +61 -64
- package/dist/plugins/organization/has-permission.d.mts +2 -4
- 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 +20 -20
- package/dist/plugins/organization/organization.mjs +13 -8
- package/dist/plugins/organization/permission.d.mts +4 -5
- package/dist/plugins/organization/routes/crud-access-control.d.mts +28 -28
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +21 -18
- package/dist/plugins/organization/routes/crud-members.d.mts +53 -56
- package/dist/plugins/organization/routes/crud-members.mjs +23 -21
- package/dist/plugins/organization/routes/crud-org.d.mts +63 -65
- package/dist/plugins/organization/routes/crud-org.mjs +4 -2
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -66
- package/dist/plugins/organization/routes/crud-team.mjs +4 -2
- package/dist/plugins/organization/schema.d.mts +33 -33
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +16 -17
- package/dist/plugins/phone-number/client.d.mts +14 -16
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -17
- package/dist/plugins/phone-number/index.d.mts +48 -54
- package/dist/plugins/phone-number/schema.d.mts +2 -3
- package/dist/plugins/phone-number/types.d.mts +4 -5
- package/dist/plugins/siwe/client.d.mts +2 -4
- package/dist/plugins/siwe/index.d.mts +7 -9
- package/dist/plugins/siwe/index.mjs +1 -1
- package/dist/plugins/siwe/parse-message.mjs +1 -3
- package/dist/plugins/siwe/schema.d.mts +3 -4
- package/dist/plugins/siwe/types.d.mts +4 -4
- package/dist/plugins/test-utils/auth-helpers.mjs +4 -2
- package/dist/plugins/test-utils/index.d.mts +3 -5
- package/dist/plugins/test-utils/types.d.mts +7 -7
- package/dist/plugins/two-factor/backup-codes/index.d.mts +11 -14
- package/dist/plugins/two-factor/backup-codes/index.mjs +12 -6
- package/dist/plugins/two-factor/client.d.mts +16 -19
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/constant.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +15 -18
- package/dist/plugins/two-factor/index.d.mts +31 -35
- package/dist/plugins/two-factor/index.mjs +6 -3
- package/dist/plugins/two-factor/otp/index.d.mts +5 -8
- package/dist/plugins/two-factor/otp/index.mjs +159 -154
- package/dist/plugins/two-factor/schema.d.mts +2 -3
- package/dist/plugins/two-factor/totp/index.d.mts +7 -10
- package/dist/plugins/two-factor/totp/index.mjs +164 -148
- package/dist/plugins/two-factor/types.d.mts +6 -7
- package/dist/plugins/username/client.d.mts +12 -14
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +11 -14
- package/dist/plugins/username/index.d.mts +26 -31
- package/dist/plugins/username/index.mjs +5 -18
- package/dist/plugins/username/schema.d.mts +7 -10
- package/dist/state.d.mts +4 -5
- package/dist/test-utils/headers.d.mts +2 -3
- package/dist/test-utils/http-test-instance.d.mts +26 -29
- package/dist/test-utils/test-instance.d.mts +7 -6
- package/dist/test-utils/test-instance.mjs +4 -2
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +4 -6
- package/dist/types/auth.d.mts +2 -4
- package/dist/types/helper.d.mts +11 -12
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +4 -5
- package/dist/types/plugins.d.mts +7 -8
- package/dist/utils/hide-metadata.d.mts +2 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/is-api-error.mjs +1 -2
- package/dist/utils/time.d.mts +4 -4
- package/dist/utils/url.d.mts +13 -15
- package/dist/utils/wildcard.mjs +5 -3
- package/package.json +12 -12
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Prettify
|
|
2
|
-
import { Session
|
|
1
|
+
import { Prettify } from "../../types/helper.mjs";
|
|
2
|
+
import { Session, User } from "../../types/models.mjs";
|
|
3
|
+
import "../../types/index.mjs";
|
|
3
4
|
import { BetterAuthOptions, GenericEndpointContext } from "@better-auth/core";
|
|
4
|
-
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
5
|
-
import * as _$better_call0 from "better-call";
|
|
6
5
|
import * as z from "zod";
|
|
7
|
-
|
|
8
6
|
//#region src/api/routes/session.d.ts
|
|
9
|
-
declare const getSession: <Option extends BetterAuthOptions>() =>
|
|
7
|
+
export declare const getSession: <Option extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/get-session", {
|
|
10
8
|
method: ("GET" | "POST")[];
|
|
11
9
|
operationId: string;
|
|
12
10
|
query: z.ZodOptional<z.ZodObject<{
|
|
@@ -42,8 +40,8 @@ declare const getSession: <Option extends BetterAuthOptions>() => _$better_call0
|
|
|
42
40
|
};
|
|
43
41
|
};
|
|
44
42
|
}, {
|
|
45
|
-
session: Session
|
|
46
|
-
user: User
|
|
43
|
+
session: Session<Option["session"], Option["plugins"]>;
|
|
44
|
+
user: User<Option["user"], Option["plugins"]>;
|
|
47
45
|
} | null>;
|
|
48
46
|
/**
|
|
49
47
|
* Whether the deployment keeps sessions in a durable server-side store
|
|
@@ -55,13 +53,13 @@ declare const getSession: <Option extends BetterAuthOptions>() => _$better_call0
|
|
|
55
53
|
* stateless / DB-less deployments). Pass the result as `disableCookieCache` so a
|
|
56
54
|
* revoked-but-cached session cannot authorize a sensitive action.
|
|
57
55
|
*/
|
|
58
|
-
declare const isStateful: (ctx: GenericEndpointContext) => boolean;
|
|
59
|
-
declare const getSessionFromCtx: <U extends Record<string, any> = Record<string, any>, S extends Record<string, any> = Record<string, any>>(ctx: GenericEndpointContext, config?: {
|
|
56
|
+
export declare const isStateful: (ctx: GenericEndpointContext) => boolean;
|
|
57
|
+
export declare const getSessionFromCtx: <U extends Record<string, any> = Record<string, any>, S extends Record<string, any> = Record<string, any>>(ctx: GenericEndpointContext, config?: {
|
|
60
58
|
disableCookieCache?: boolean;
|
|
61
59
|
disableRefresh?: boolean;
|
|
62
60
|
} | undefined) => Promise<{
|
|
63
|
-
session: S & Session
|
|
64
|
-
user: U & User
|
|
61
|
+
session: S & Session;
|
|
62
|
+
user: U & User;
|
|
65
63
|
} | null>;
|
|
66
64
|
/**
|
|
67
65
|
* Reads the session from the source that can authorize sensitive work.
|
|
@@ -70,7 +68,7 @@ declare const getSessionFromCtx: <U extends Record<string, any> = Record<string,
|
|
|
70
68
|
* earlier hook may have populated `ctx.context.session` from cookie cache.
|
|
71
69
|
* Stateless deployments keep the signed cookie as the session record.
|
|
72
70
|
*/
|
|
73
|
-
declare const getAuthoritativeSessionFromCtx: <U extends Record<string, any> = Record<string, any>, S extends Record<string, any> = Record<string, any>>(ctx: GenericEndpointContext) => Promise<{
|
|
71
|
+
export declare const getAuthoritativeSessionFromCtx: <U extends Record<string, any> = Record<string, any>, S extends Record<string, any> = Record<string, any>>(ctx: GenericEndpointContext) => Promise<{
|
|
74
72
|
session: S & {
|
|
75
73
|
id: string;
|
|
76
74
|
createdAt: Date;
|
|
@@ -94,7 +92,7 @@ declare const getAuthoritativeSessionFromCtx: <U extends Record<string, any> = R
|
|
|
94
92
|
/**
|
|
95
93
|
* The middleware forces the endpoint to require a valid session.
|
|
96
94
|
*/
|
|
97
|
-
declare const sessionMiddleware:
|
|
95
|
+
export declare const sessionMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
98
96
|
session: {
|
|
99
97
|
session: Record<string, any> & {
|
|
100
98
|
id: string;
|
|
@@ -121,7 +119,7 @@ declare const sessionMiddleware: _$better_call0.Middleware<_$better_call0.Middle
|
|
|
121
119
|
* This middleware forces the endpoint to require a valid authoritative session.
|
|
122
120
|
* This should be used for sensitive operations like password changes, account deletion, etc.
|
|
123
121
|
*/
|
|
124
|
-
declare const sensitiveSessionMiddleware:
|
|
122
|
+
export declare const sensitiveSessionMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
125
123
|
session: {
|
|
126
124
|
session: Record<string, any> & {
|
|
127
125
|
id: string;
|
|
@@ -148,7 +146,7 @@ declare const sensitiveSessionMiddleware: _$better_call0.Middleware<_$better_cal
|
|
|
148
146
|
* This middleware allows you to call the endpoint on the client if session is valid.
|
|
149
147
|
* However, if called on the server, no session is required.
|
|
150
148
|
*/
|
|
151
|
-
declare const requestOnlySessionMiddleware:
|
|
149
|
+
export declare const requestOnlySessionMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
152
150
|
session: {
|
|
153
151
|
session: Record<string, any> & {
|
|
154
152
|
id: string;
|
|
@@ -178,7 +176,7 @@ declare const requestOnlySessionMiddleware: _$better_call0.Middleware<_$better_c
|
|
|
178
176
|
* Session freshness check will be skipped if the session config's freshAge
|
|
179
177
|
* is set to 0
|
|
180
178
|
*/
|
|
181
|
-
declare const freshSessionMiddleware:
|
|
179
|
+
export declare const freshSessionMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
182
180
|
session: {
|
|
183
181
|
session: Record<string, any> & {
|
|
184
182
|
id: string;
|
|
@@ -204,10 +202,10 @@ declare const freshSessionMiddleware: _$better_call0.Middleware<_$better_call0.M
|
|
|
204
202
|
/**
|
|
205
203
|
* user active sessions list
|
|
206
204
|
*/
|
|
207
|
-
declare const listSessions: <Option extends BetterAuthOptions>() =>
|
|
205
|
+
export declare const listSessions: <Option extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/list-sessions", {
|
|
208
206
|
method: "GET";
|
|
209
207
|
operationId: string;
|
|
210
|
-
use:
|
|
208
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
211
209
|
session: {
|
|
212
210
|
session: Record<string, any> & {
|
|
213
211
|
id: string;
|
|
@@ -252,7 +250,7 @@ declare const listSessions: <Option extends BetterAuthOptions>() => _$better_cal
|
|
|
252
250
|
};
|
|
253
251
|
};
|
|
254
252
|
};
|
|
255
|
-
}, Prettify
|
|
253
|
+
}, Prettify<{
|
|
256
254
|
id: string;
|
|
257
255
|
createdAt: Date;
|
|
258
256
|
updatedAt: Date;
|
|
@@ -261,16 +259,16 @@ declare const listSessions: <Option extends BetterAuthOptions>() => _$better_cal
|
|
|
261
259
|
token: string;
|
|
262
260
|
ipAddress?: string | null | undefined;
|
|
263
261
|
userAgent?: string | null | undefined;
|
|
264
|
-
} &
|
|
262
|
+
} & import("@better-auth/core/db").InferDBFieldsFromOptions<Option["session"]> & import("@better-auth/core/db").InferDBFieldsFromPlugins<"session", Option["plugins"]> extends (infer T) ? { [K in keyof T]: T[K]; } : never>[]>;
|
|
265
263
|
/**
|
|
266
264
|
* revoke a single session
|
|
267
265
|
*/
|
|
268
|
-
declare const revokeSession:
|
|
266
|
+
export declare const revokeSession: import("better-call").StrictEndpoint<"/revoke-session", {
|
|
269
267
|
method: "POST";
|
|
270
268
|
body: z.ZodObject<{
|
|
271
269
|
token: z.ZodString;
|
|
272
270
|
}, z.core.$strip>;
|
|
273
|
-
use:
|
|
271
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
274
272
|
session: {
|
|
275
273
|
session: Record<string, any> & {
|
|
276
274
|
id: string;
|
|
@@ -340,9 +338,9 @@ declare const revokeSession: _$better_call0.StrictEndpoint<"/revoke-session", {
|
|
|
340
338
|
/**
|
|
341
339
|
* revoke all user sessions
|
|
342
340
|
*/
|
|
343
|
-
declare const revokeSessions:
|
|
341
|
+
export declare const revokeSessions: import("better-call").StrictEndpoint<"/revoke-sessions", {
|
|
344
342
|
method: "POST";
|
|
345
|
-
use:
|
|
343
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
346
344
|
session: {
|
|
347
345
|
session: Record<string, any> & {
|
|
348
346
|
id: string;
|
|
@@ -393,10 +391,10 @@ declare const revokeSessions: _$better_call0.StrictEndpoint<"/revoke-sessions",
|
|
|
393
391
|
}, {
|
|
394
392
|
status: boolean;
|
|
395
393
|
}>;
|
|
396
|
-
declare const revokeOtherSessions:
|
|
394
|
+
export declare const revokeOtherSessions: import("better-call").StrictEndpoint<"/revoke-other-sessions", {
|
|
397
395
|
method: "POST";
|
|
398
396
|
requireHeaders: true;
|
|
399
|
-
use:
|
|
397
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
400
398
|
session: {
|
|
401
399
|
session: Record<string, any> & {
|
|
402
400
|
id: string;
|
|
@@ -446,5 +444,4 @@ declare const revokeOtherSessions: _$better_call0.StrictEndpoint<"/revoke-other-
|
|
|
446
444
|
}, {
|
|
447
445
|
status: boolean;
|
|
448
446
|
}>;
|
|
449
|
-
//#endregion
|
|
450
|
-
export { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware };
|
|
447
|
+
//#endregion
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { User } from "@better-auth/core/db";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
3
|
import * as z from "zod";
|
|
5
|
-
|
|
6
4
|
//#region src/api/routes/sign-in.d.ts
|
|
7
5
|
declare const socialSignInBodySchema: z.ZodObject<{
|
|
8
6
|
callbackURL: z.ZodOptional<z.ZodString>;
|
|
@@ -30,7 +28,7 @@ declare const socialSignInBodySchema: z.ZodObject<{
|
|
|
30
28
|
additionalParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
29
|
additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
32
30
|
}, z.core.$strip>;
|
|
33
|
-
declare const signInSocial: <O extends BetterAuthOptions>() =>
|
|
31
|
+
export declare const signInSocial: <O extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/sign-in/social", {
|
|
34
32
|
method: "POST";
|
|
35
33
|
operationId: string;
|
|
36
34
|
body: z.ZodObject<{
|
|
@@ -112,10 +110,10 @@ declare const signInSocial: <O extends BetterAuthOptions>() => _$better_call0.St
|
|
|
112
110
|
url: undefined;
|
|
113
111
|
user: User<O["user"], O["plugins"]>;
|
|
114
112
|
}>;
|
|
115
|
-
declare const signInEmail: <O extends BetterAuthOptions>() =>
|
|
113
|
+
export declare const signInEmail: <O extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/sign-in/email", {
|
|
116
114
|
method: "POST";
|
|
117
115
|
operationId: string;
|
|
118
|
-
use:
|
|
116
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>[];
|
|
119
117
|
cloneRequest: true;
|
|
120
118
|
body: z.ZodObject<{
|
|
121
119
|
email: z.ZodString;
|
|
@@ -183,4 +181,4 @@ declare const signInEmail: <O extends BetterAuthOptions>() => _$better_call0.Str
|
|
|
183
181
|
user: User<O["user"], O["plugins"]>;
|
|
184
182
|
}>;
|
|
185
183
|
//#endregion
|
|
186
|
-
export {
|
|
184
|
+
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as _$better_call0 from "better-call";
|
|
2
1
|
import * as z from "zod";
|
|
3
|
-
|
|
4
2
|
//#region src/api/routes/sign-out.d.ts
|
|
5
|
-
declare const signOut:
|
|
3
|
+
export declare const signOut: import("better-call").StrictEndpoint<"/sign-out", {
|
|
6
4
|
method: "POST";
|
|
7
5
|
body: z.ZodOptional<z.ZodObject<{
|
|
8
6
|
callbackURL: z.ZodOptional<z.ZodString>;
|
|
@@ -47,5 +45,4 @@ declare const signOut: _$better_call0.StrictEndpoint<"/sign-out", {
|
|
|
47
45
|
url: string | undefined;
|
|
48
46
|
redirect: boolean | undefined;
|
|
49
47
|
}>;
|
|
50
|
-
//#endregion
|
|
51
|
-
export { signOut };
|
|
48
|
+
//#endregion
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { AdditionalUserFieldsInput, User } from "../../types/models.mjs";
|
|
2
|
+
import "../../types/index.mjs";
|
|
2
3
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
|
|
6
5
|
//#region src/api/routes/sign-up.d.ts
|
|
7
|
-
declare const signUpEmail: <O extends BetterAuthOptions>() =>
|
|
6
|
+
export declare const signUpEmail: <O extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/sign-up/email", {
|
|
8
7
|
method: "POST";
|
|
9
8
|
operationId: string;
|
|
10
|
-
use:
|
|
9
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>[];
|
|
11
10
|
body: z.ZodIntersection<z.ZodObject<{
|
|
12
11
|
name: z.ZodString;
|
|
13
12
|
email: z.ZodEmail;
|
|
@@ -155,5 +154,4 @@ declare const signUpEmail: <O extends BetterAuthOptions>() => _$better_call0.Str
|
|
|
155
154
|
token: string;
|
|
156
155
|
user: User<O["user"], O["plugins"]>;
|
|
157
156
|
}>;
|
|
158
|
-
//#endregion
|
|
159
|
-
export { signUpEmail };
|
|
157
|
+
//#endregion
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AdditionalSessionFieldsInput } from "../../types/models.mjs";
|
|
2
|
+
import "../../types/index.mjs";
|
|
2
3
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
|
|
6
5
|
//#region src/api/routes/update-session.d.ts
|
|
7
|
-
declare const updateSession: <O extends BetterAuthOptions>() =>
|
|
6
|
+
export declare const updateSession: <O extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/update-session", {
|
|
8
7
|
method: "POST";
|
|
9
8
|
operationId: string;
|
|
10
9
|
body: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
11
|
-
use:
|
|
10
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
12
11
|
session: {
|
|
13
12
|
session: Record<string, any> & {
|
|
14
13
|
id: string;
|
|
@@ -70,5 +69,4 @@ declare const updateSession: <O extends BetterAuthOptions>() => _$better_call0.S
|
|
|
70
69
|
userAgent?: string | null | undefined;
|
|
71
70
|
};
|
|
72
71
|
}>;
|
|
73
|
-
//#endregion
|
|
74
|
-
export { updateSession };
|
|
72
|
+
//#endregion
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { AdditionalUserFieldsInput } from "../../types/models.mjs";
|
|
2
|
+
import "../../types/index.mjs";
|
|
2
3
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
-
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
|
|
6
5
|
//#region src/api/routes/update-user.d.ts
|
|
7
|
-
declare const updateUser: <O extends BetterAuthOptions>() =>
|
|
6
|
+
export declare const updateUser: <O extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/update-user", {
|
|
8
7
|
method: "POST";
|
|
9
8
|
operationId: string;
|
|
10
9
|
body: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
11
|
-
use:
|
|
10
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
12
11
|
session: {
|
|
13
12
|
session: Record<string, any> & {
|
|
14
13
|
id: string;
|
|
@@ -84,7 +83,7 @@ declare const updateUser: <O extends BetterAuthOptions>() => _$better_call0.Stri
|
|
|
84
83
|
}, {
|
|
85
84
|
status: boolean;
|
|
86
85
|
}>;
|
|
87
|
-
declare const changePassword:
|
|
86
|
+
export declare const changePassword: import("better-call").StrictEndpoint<"/change-password", {
|
|
88
87
|
method: "POST";
|
|
89
88
|
operationId: string;
|
|
90
89
|
body: z.ZodObject<{
|
|
@@ -92,7 +91,7 @@ declare const changePassword: _$better_call0.StrictEndpoint<"/change-password",
|
|
|
92
91
|
currentPassword: z.ZodString;
|
|
93
92
|
revokeOtherSessions: z.ZodOptional<z.ZodBoolean>;
|
|
94
93
|
}, z.core.$strip>;
|
|
95
|
-
use:
|
|
94
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
96
95
|
session: {
|
|
97
96
|
session: Record<string, any> & {
|
|
98
97
|
id: string;
|
|
@@ -200,12 +199,12 @@ declare const changePassword: _$better_call0.StrictEndpoint<"/change-password",
|
|
|
200
199
|
image?: string | null | undefined;
|
|
201
200
|
};
|
|
202
201
|
}>;
|
|
203
|
-
declare const setPassword:
|
|
202
|
+
export declare const setPassword: import("better-call").StrictEndpoint<string, {
|
|
204
203
|
method: "POST";
|
|
205
204
|
body: z.ZodObject<{
|
|
206
205
|
newPassword: z.ZodString;
|
|
207
206
|
}, z.core.$strip>;
|
|
208
|
-
use:
|
|
207
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
209
208
|
session: {
|
|
210
209
|
session: Record<string, any> & {
|
|
211
210
|
id: string;
|
|
@@ -231,9 +230,9 @@ declare const setPassword: _$better_call0.StrictEndpoint<string, {
|
|
|
231
230
|
}, {
|
|
232
231
|
status: boolean;
|
|
233
232
|
}>;
|
|
234
|
-
declare const deleteUser:
|
|
233
|
+
export declare const deleteUser: import("better-call").StrictEndpoint<"/delete-user", {
|
|
235
234
|
method: "POST";
|
|
236
|
-
use:
|
|
235
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
237
236
|
session: {
|
|
238
237
|
session: Record<string, any> & {
|
|
239
238
|
id: string;
|
|
@@ -318,13 +317,13 @@ declare const deleteUser: _$better_call0.StrictEndpoint<"/delete-user", {
|
|
|
318
317
|
success: boolean;
|
|
319
318
|
message: string;
|
|
320
319
|
}>;
|
|
321
|
-
declare const deleteUserCallback:
|
|
320
|
+
export declare const deleteUserCallback: import("better-call").StrictEndpoint<"/delete-user/callback", {
|
|
322
321
|
method: "GET";
|
|
323
322
|
query: z.ZodObject<{
|
|
324
323
|
token: z.ZodString;
|
|
325
324
|
callbackURL: z.ZodOptional<z.ZodString>;
|
|
326
325
|
}, z.core.$strip>;
|
|
327
|
-
use:
|
|
326
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>[];
|
|
328
327
|
metadata: {
|
|
329
328
|
openapi: {
|
|
330
329
|
description: string;
|
|
@@ -358,13 +357,13 @@ declare const deleteUserCallback: _$better_call0.StrictEndpoint<"/delete-user/ca
|
|
|
358
357
|
success: boolean;
|
|
359
358
|
message: string;
|
|
360
359
|
}>;
|
|
361
|
-
declare const changeEmail:
|
|
360
|
+
export declare const changeEmail: import("better-call").StrictEndpoint<"/change-email", {
|
|
362
361
|
method: "POST";
|
|
363
362
|
body: z.ZodObject<{
|
|
364
363
|
newEmail: z.ZodEmail;
|
|
365
364
|
callbackURL: z.ZodOptional<z.ZodString>;
|
|
366
365
|
}, z.core.$strip>;
|
|
367
|
-
use:
|
|
366
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
368
367
|
session: {
|
|
369
368
|
session: Record<string, any> & {
|
|
370
369
|
id: string;
|
|
@@ -424,5 +423,4 @@ declare const changeEmail: _$better_call0.StrictEndpoint<"/change-email", {
|
|
|
424
423
|
}, {
|
|
425
424
|
status: boolean;
|
|
426
425
|
}>;
|
|
427
|
-
//#endregion
|
|
428
|
-
export { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser };
|
|
426
|
+
//#endregion
|
|
@@ -309,7 +309,7 @@ const deleteUser = createAuthEndpoint("/delete-user", {
|
|
|
309
309
|
await ctx.context.internalAdapter.createVerificationValue({
|
|
310
310
|
value: session.user.id,
|
|
311
311
|
identifier: `delete-account-${token}`,
|
|
312
|
-
expiresAt: new Date(Date.now() + (ctx.context.options.user.deleteUser?.deleteTokenExpiresIn ||
|
|
312
|
+
expiresAt: new Date(Date.now() + (ctx.context.options.user.deleteUser?.deleteTokenExpiresIn || 86400) * 1e3)
|
|
313
313
|
});
|
|
314
314
|
const url = `${ctx.context.baseURL}/delete-user/callback?token=${token}&callbackURL=${encodeURIComponent(ctx.body.callbackURL || "/")}`;
|
|
315
315
|
await ctx.context.runInBackgroundOrAwait(ctx.context.options.user.deleteUser.sendDeleteAccountVerification({
|
|
@@ -34,9 +34,6 @@ type OAuthState = {
|
|
|
34
34
|
* {@link OAuthState.serverContext}.
|
|
35
35
|
*/
|
|
36
36
|
declare const getOAuthState: <T extends Record<string, unknown> = Record<string, unknown>>() => Promise<(OAuthState & T) | null>;
|
|
37
|
-
/**
|
|
38
|
-
* @internal Read accumulated server context to embed during state generation.
|
|
39
|
-
*/
|
|
40
37
|
/**
|
|
41
38
|
* Attaches server-trusted data to the current OAuth flow so it survives the
|
|
42
39
|
* provider redirect. Call this from a `before` hook on an OAuth sign-in path
|
package/dist/api/state/oauth.mjs
CHANGED
|
@@ -29,8 +29,9 @@ const { get: getOAuthServerContext, set: setOAuthServerContext } = defineRequest
|
|
|
29
29
|
* stored as `unknown`, so narrow their shape when reading them back.
|
|
30
30
|
*/
|
|
31
31
|
const addOAuthServerContext = async (values) => {
|
|
32
|
+
const current = await getOAuthServerContext();
|
|
32
33
|
await setOAuthServerContext({
|
|
33
|
-
...
|
|
34
|
+
...current ?? {},
|
|
34
35
|
...values
|
|
35
36
|
});
|
|
36
37
|
};
|
package/dist/auth/full.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Auth } from "../types/auth.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
-
|
|
4
4
|
//#region src/auth/full.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Better Auth initializer for full mode (with Kysely)
|
|
@@ -23,6 +23,5 @@ import { BetterAuthOptions } from "@better-auth/core";
|
|
|
23
23
|
* database: drizzleAdapter(db, { provider: "pg" }),
|
|
24
24
|
* });
|
|
25
25
|
*/
|
|
26
|
-
declare const betterAuth: <Options extends BetterAuthOptions>(options: Options & {}) => Auth<Options>;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { betterAuth };
|
|
26
|
+
export declare const betterAuth: <Options extends BetterAuthOptions>(options: Options & {}) => Auth<Options>;
|
|
27
|
+
//#endregion
|
package/dist/auth/minimal.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Auth } from "../types/auth.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
|
-
|
|
4
4
|
//#region src/auth/minimal.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Better Auth initializer for minimal mode (without Kysely)
|
|
7
7
|
*/
|
|
8
|
-
declare const betterAuth: <Options extends BetterAuthOptions>(options: Options & {}) => Auth<Options>;
|
|
8
|
+
export declare const betterAuth: <Options extends BetterAuthOptions>(options: Options & {}) => Auth<Options>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export {
|
|
10
|
+
export type { BetterAuthOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/client/broadcast-channel.d.ts
|
|
2
|
-
interface BroadcastMessage {
|
|
2
|
+
export interface BroadcastMessage {
|
|
3
3
|
event?: "session" | undefined;
|
|
4
4
|
data?: {
|
|
5
5
|
trigger?: "signout" | "getSession" | "updateUser";
|
|
@@ -7,13 +7,12 @@ interface BroadcastMessage {
|
|
|
7
7
|
clientId: string;
|
|
8
8
|
timestamp: number;
|
|
9
9
|
}
|
|
10
|
-
type BroadcastListener = (message: BroadcastMessage) => void;
|
|
11
|
-
declare const kBroadcastChannel: unique symbol;
|
|
12
|
-
interface BroadcastChannel {
|
|
10
|
+
export type BroadcastListener = (message: BroadcastMessage) => void;
|
|
11
|
+
export declare const kBroadcastChannel: unique symbol;
|
|
12
|
+
export interface BroadcastChannel {
|
|
13
13
|
post(message: Record<string, unknown>): void;
|
|
14
14
|
subscribe(listener: BroadcastListener): () => void;
|
|
15
15
|
setup(): () => void;
|
|
16
16
|
}
|
|
17
|
-
declare function getGlobalBroadcastChannel(name?: string): BroadcastChannel;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { BroadcastChannel, BroadcastListener, BroadcastMessage, getGlobalBroadcastChannel, kBroadcastChannel };
|
|
17
|
+
export declare function getGlobalBroadcastChannel(name?: string): BroadcastChannel;
|
|
18
|
+
//#endregion
|
package/dist/client/config.d.mts
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
import { SessionData } from "./session-atom.mjs";
|
|
2
2
|
import { BetterAuthClientOptions, ClientAtomListener } from "@better-auth/core";
|
|
3
|
-
import * as _$nanostores from "nanostores";
|
|
4
3
|
import { WritableAtom } from "nanostores";
|
|
5
|
-
import * as _$_better_fetch_fetch0 from "@better-fetch/fetch";
|
|
6
|
-
|
|
7
4
|
//#region src/client/config.d.ts
|
|
8
|
-
declare const getClientConfig: (options?: BetterAuthClientOptions | undefined, loadEnv?: boolean | undefined) => {
|
|
5
|
+
export declare const getClientConfig: (options?: BetterAuthClientOptions | undefined, loadEnv?: boolean | undefined) => {
|
|
9
6
|
readonly baseURL: string;
|
|
10
7
|
pluginsActions: Record<string, any>;
|
|
11
8
|
pluginsAtoms: Record<string, WritableAtom<any>>;
|
|
12
9
|
pluginPathMethods: Record<string, "GET" | "POST">;
|
|
13
10
|
atomListeners: ClientAtomListener[];
|
|
14
11
|
hydrateSession: (sessionData: SessionData | null) => void;
|
|
15
|
-
$sessionSignal:
|
|
16
|
-
$fetch:
|
|
17
|
-
plugins: (
|
|
12
|
+
$sessionSignal: import("nanostores").PreinitializedWritableAtom<boolean> & object;
|
|
13
|
+
$fetch: import("@better-fetch/fetch").BetterFetch<{
|
|
14
|
+
plugins: (import("@better-fetch/fetch").BetterFetchPlugin<Record<string, any>> | {
|
|
18
15
|
id: string;
|
|
19
16
|
name: string;
|
|
20
17
|
hooks: {
|
|
21
|
-
onSuccess(context:
|
|
18
|
+
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
|
|
22
19
|
};
|
|
23
20
|
} | {
|
|
24
21
|
id: string;
|
|
25
22
|
name: string;
|
|
26
23
|
hooks: {
|
|
27
|
-
onSuccess: ((context:
|
|
28
|
-
onError: ((context:
|
|
29
|
-
onRequest: (<T extends Record<string, any>>(context:
|
|
30
|
-
onResponse: ((context:
|
|
24
|
+
onSuccess: ((context: import("@better-fetch/fetch").SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
25
|
+
onError: ((context: import("@better-fetch/fetch").ErrorContext) => Promise<void> | void) | undefined;
|
|
26
|
+
onRequest: (<T extends Record<string, any>>(context: import("@better-fetch/fetch").RequestContext<T>) => Promise<import("@better-fetch/fetch").RequestContext | void> | import("@better-fetch/fetch").RequestContext | void) | undefined;
|
|
27
|
+
onResponse: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
|
|
31
28
|
};
|
|
32
29
|
})[];
|
|
33
30
|
cache?: RequestCache | undefined;
|
|
@@ -42,12 +39,12 @@ declare const getClientConfig: (options?: BetterAuthClientOptions | undefined, l
|
|
|
42
39
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
43
40
|
signal?: AbortSignal | null;
|
|
44
41
|
window?: null | undefined;
|
|
45
|
-
onRetry?: ((response:
|
|
42
|
+
onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
|
|
46
43
|
hookOptions?: {
|
|
47
44
|
cloneResponse?: boolean;
|
|
48
45
|
} | undefined;
|
|
49
46
|
timeout?: number | undefined;
|
|
50
|
-
customFetchImpl:
|
|
47
|
+
customFetchImpl: import("@better-fetch/fetch").FetchEsque;
|
|
51
48
|
baseURL: string;
|
|
52
49
|
throw?: boolean | undefined;
|
|
53
50
|
auth?: ({
|
|
@@ -73,10 +70,10 @@ declare const getClientConfig: (options?: BetterAuthClientOptions | undefined, l
|
|
|
73
70
|
params?: any;
|
|
74
71
|
duplex?: "full" | "half" | undefined;
|
|
75
72
|
jsonParser: (text: string) => Promise<any> | any;
|
|
76
|
-
retry?:
|
|
73
|
+
retry?: import("@better-fetch/fetch").RetryOptions | undefined;
|
|
77
74
|
retryAttempt?: number | undefined;
|
|
78
|
-
output?: (
|
|
79
|
-
errorSchema?:
|
|
75
|
+
output?: (import("@better-fetch/fetch").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
76
|
+
errorSchema?: import("@better-fetch/fetch").StandardSchemaV1 | undefined;
|
|
80
77
|
disableValidation?: boolean | undefined;
|
|
81
78
|
disableSignal?: boolean | undefined;
|
|
82
79
|
}, unknown, unknown, {}>;
|
|
@@ -86,5 +83,4 @@ declare const getClientConfig: (options?: BetterAuthClientOptions | undefined, l
|
|
|
86
83
|
atoms: Record<string, WritableAtom<any>>;
|
|
87
84
|
};
|
|
88
85
|
};
|
|
89
|
-
//#endregion
|
|
90
|
-
export { getClientConfig };
|
|
86
|
+
//#endregion
|
package/dist/client/config.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { getBaseURL } from "../utils/url.mjs";
|
|
|
2
2
|
import { parseJSON } from "./parser.mjs";
|
|
3
3
|
import { redirectPlugin } from "./fetch-plugins.mjs";
|
|
4
4
|
import { getSessionAtom, hydrateSessionAtom } from "./session-atom.mjs";
|
|
5
|
-
import { defu } from "defu";
|
|
5
|
+
import { defu as defu$1 } from "defu";
|
|
6
6
|
import { createFetch } from "@better-fetch/fetch";
|
|
7
7
|
//#region src/client/config.ts
|
|
8
8
|
const resolvePublicAuthUrl = (basePath) => {
|
|
@@ -93,7 +93,7 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
93
93
|
},
|
|
94
94
|
atoms: pluginsAtoms
|
|
95
95
|
};
|
|
96
|
-
for (const plugin of plugins) if (plugin.getActions) pluginsActions = defu(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
|
|
96
|
+
for (const plugin of plugins) if (plugin.getActions) pluginsActions = defu$1(plugin.getActions?.($fetch, $store, options) ?? {}, pluginsActions);
|
|
97
97
|
return {
|
|
98
98
|
get baseURL() {
|
|
99
99
|
return baseURL;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Store, StoreValue } from "nanostores";
|
|
2
|
-
|
|
3
2
|
//#region src/client/equality.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Deep structural equality for JSON-serializable values.
|
|
6
5
|
* Handles: primitives, null, arrays, and plain objects.
|
|
7
6
|
* Short-circuits on referential equality at every recursion level.
|
|
8
7
|
*/
|
|
9
|
-
declare function isJsonEqual(a: unknown, b: unknown): boolean;
|
|
8
|
+
export declare function isJsonEqual(a: unknown, b: unknown): boolean;
|
|
10
9
|
/**
|
|
11
10
|
* Attach an equality gate to a nanostores atom via `onSet`.
|
|
12
11
|
* When `isEqual(currentValue, newValue)` returns true, the `set()` call
|
|
@@ -14,6 +13,5 @@ declare function isJsonEqual(a: unknown, b: unknown): boolean;
|
|
|
14
13
|
*
|
|
15
14
|
* Returns the unsubscribe function from `onSet`.
|
|
16
15
|
*/
|
|
17
|
-
declare function withEquality<S extends Store>(store: S, isEqual: (a: StoreValue<S>, b: StoreValue<S>) => boolean): () => void;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { isJsonEqual, withEquality };
|
|
16
|
+
export declare function withEquality<S extends Store>(store: S, isEqual: (a: StoreValue<S>, b: StoreValue<S>) => boolean): () => void;
|
|
17
|
+
//#endregion
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
//#region src/client/focus-manager.d.ts
|
|
2
|
-
type FocusListener = (focused: boolean) => void;
|
|
3
|
-
declare const kFocusManager: unique symbol;
|
|
4
|
-
interface FocusManager {
|
|
2
|
+
export type FocusListener = (focused: boolean) => void;
|
|
3
|
+
export declare const kFocusManager: unique symbol;
|
|
4
|
+
export interface FocusManager {
|
|
5
5
|
setFocused(focused: boolean): void;
|
|
6
6
|
subscribe(listener: FocusListener): () => void;
|
|
7
7
|
setup(): () => void;
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { FocusListener, FocusManager, kFocusManager };
|
|
9
|
+
//#endregion
|