better-auth 0.4.9-beta.4 → 0.4.9-beta.5
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/drizzle.d.ts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +5 -5
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/client.js +7 -3
- package/dist/{index-Do85clFc.d.ts → index-x0qUJonH.d.ts} +1 -1
- package/dist/{index-DJvDzGCt.d.ts → index-xf537-bb.d.ts} +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +5 -5
- package/dist/react.d.ts +1 -1
- package/dist/react.js +7 -3
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/solid.js +7 -3
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +7 -3
- package/dist/types.d.ts +5 -3
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +7 -3
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-
|
|
1
|
+
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-xf537-bb.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -67,7 +67,7 @@ var csrfMiddleware = createAuthMiddleware(
|
|
|
67
67
|
if (ctx.context.trustedOrigins.includes(url.origin)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const csrfToken = ctx.
|
|
70
|
+
const csrfToken = ctx.headers?.get("x-auth-csrf-token");
|
|
71
71
|
if (!csrfToken) {
|
|
72
72
|
throw new APIError2("UNAUTHORIZED", {
|
|
73
73
|
message: "CSRF Token is required"
|
|
@@ -1026,9 +1026,8 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1026
1026
|
if (callbackURL?.includes("http")) {
|
|
1027
1027
|
const callbackOrigin = new URL(callbackURL).origin;
|
|
1028
1028
|
if (!trustedOrigins.includes(callbackOrigin)) {
|
|
1029
|
-
logger.error("
|
|
1030
|
-
callbackURL
|
|
1031
|
-
trustedOrigins
|
|
1029
|
+
logger.error("Unknown origin in callback URL", {
|
|
1030
|
+
callbackURL
|
|
1032
1031
|
});
|
|
1033
1032
|
throw new APIError4("FORBIDDEN", {
|
|
1034
1033
|
message: "Invalid callback URL"
|
|
@@ -1038,7 +1037,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1038
1037
|
if (currentURL !== ctx.context.baseURL) {
|
|
1039
1038
|
const currentURLOrigin = new URL(currentURL).origin;
|
|
1040
1039
|
if (!trustedOrigins.includes(currentURLOrigin)) {
|
|
1041
|
-
logger.error("
|
|
1040
|
+
logger.error("Unknown origin in current URL", {
|
|
1042
1041
|
currentURL,
|
|
1043
1042
|
trustedOrigins
|
|
1044
1043
|
});
|
|
@@ -1047,6 +1046,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1047
1046
|
});
|
|
1048
1047
|
}
|
|
1049
1048
|
}
|
|
1049
|
+
ctx.setHeader("x-auth-redirect", "true");
|
|
1050
1050
|
});
|
|
1051
1051
|
|
|
1052
1052
|
// src/api/routes/sign-in.ts
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CfnyN34h.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-x0qUJonH.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-x0qUJonH.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-xf537-bb.js';
|
|
9
9
|
import '../types-IzAbV4nB.js';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/
|
|
|
6
6
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
7
7
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
8
8
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-xf537-bb.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
package/dist/client.js
CHANGED
|
@@ -56,6 +56,10 @@ var redirectPlugin = {
|
|
|
56
56
|
name: "Redirect",
|
|
57
57
|
hooks: {
|
|
58
58
|
onSuccess(context) {
|
|
59
|
+
const header = context.response?.headers.get("x-auth-redirect");
|
|
60
|
+
if (!header) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
59
63
|
if (context.data?.url && context.data?.redirect) {
|
|
60
64
|
if (typeof window !== "undefined") {
|
|
61
65
|
window.location.href = context.data.url;
|
|
@@ -114,9 +118,9 @@ var csrfPlugin = {
|
|
|
114
118
|
);
|
|
115
119
|
}
|
|
116
120
|
const csrfToken = data?.csrfToken;
|
|
117
|
-
options.
|
|
118
|
-
...options
|
|
119
|
-
csrfToken
|
|
121
|
+
options.headers = {
|
|
122
|
+
...options.headers,
|
|
123
|
+
"x-auth-csrf-token": csrfToken
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
options.credentials = "include";
|
|
@@ -5,7 +5,7 @@ import { P as Prettify } from './helper-DPDj8Nix.js';
|
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CfnyN34h.js';
|
|
6
6
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
7
7
|
import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
|
8
|
-
import { H as HookEndpointContext, g as AuthContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext, g as AuthContext } from './index-xf537-bb.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -67,7 +67,7 @@ var csrfMiddleware = createAuthMiddleware(
|
|
|
67
67
|
if (ctx.context.trustedOrigins.includes(url.origin)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const csrfToken = ctx.
|
|
70
|
+
const csrfToken = ctx.headers?.get("x-auth-csrf-token");
|
|
71
71
|
if (!csrfToken) {
|
|
72
72
|
throw new APIError2("UNAUTHORIZED", {
|
|
73
73
|
message: "CSRF Token is required"
|
|
@@ -851,14 +851,14 @@ function getCookies(options) {
|
|
|
851
851
|
}
|
|
852
852
|
},
|
|
853
853
|
csrfToken: {
|
|
854
|
-
|
|
854
|
+
// __Host- prefix is only allowed on the top level domain
|
|
855
|
+
name: `${secureCookiePrefix ? "__Host-" : ""}${cookiePrefix}.csrf_token`,
|
|
855
856
|
options: {
|
|
856
857
|
httpOnly: true,
|
|
857
858
|
sameSite,
|
|
858
859
|
path: "/",
|
|
859
860
|
secure: !!secureCookiePrefix,
|
|
860
|
-
maxAge: 60 * 60 * 24 * 7
|
|
861
|
-
...crossSubdomainEnabled ? { domain } : {}
|
|
861
|
+
maxAge: 60 * 60 * 24 * 7
|
|
862
862
|
}
|
|
863
863
|
},
|
|
864
864
|
state: {
|
|
@@ -1132,9 +1132,8 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1132
1132
|
if (callbackURL?.includes("http")) {
|
|
1133
1133
|
const callbackOrigin = new URL(callbackURL).origin;
|
|
1134
1134
|
if (!trustedOrigins.includes(callbackOrigin)) {
|
|
1135
|
-
logger.error("
|
|
1136
|
-
callbackURL
|
|
1137
|
-
trustedOrigins
|
|
1135
|
+
logger.error("Unknown origin in callback URL", {
|
|
1136
|
+
callbackURL
|
|
1138
1137
|
});
|
|
1139
1138
|
throw new APIError4("FORBIDDEN", {
|
|
1140
1139
|
message: "Invalid callback URL"
|
|
@@ -1144,7 +1143,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1144
1143
|
if (currentURL !== ctx.context.baseURL) {
|
|
1145
1144
|
const currentURLOrigin = new URL(currentURL).origin;
|
|
1146
1145
|
if (!trustedOrigins.includes(currentURLOrigin)) {
|
|
1147
|
-
logger.error("
|
|
1146
|
+
logger.error("Unknown origin in current URL", {
|
|
1148
1147
|
currentURL,
|
|
1149
1148
|
trustedOrigins
|
|
1150
1149
|
});
|
|
@@ -1153,6 +1152,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
1153
1152
|
});
|
|
1154
1153
|
}
|
|
1155
1154
|
}
|
|
1155
|
+
ctx.setHeader("x-auth-redirect", "true");
|
|
1156
1156
|
});
|
|
1157
1157
|
|
|
1158
1158
|
// src/api/routes/sign-in.ts
|
package/dist/next-js.d.ts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-
|
|
1
|
+
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, j as genericOAuth, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-x0qUJonH.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
|
-
import { H as HookEndpointContext } from './index-
|
|
4
|
-
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { H as HookEndpointContext } from './index-xf537-bb.js';
|
|
4
|
+
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-xf537-bb.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
package/dist/plugins.js
CHANGED
|
@@ -947,9 +947,8 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
947
947
|
if (callbackURL?.includes("http")) {
|
|
948
948
|
const callbackOrigin = new URL(callbackURL).origin;
|
|
949
949
|
if (!trustedOrigins.includes(callbackOrigin)) {
|
|
950
|
-
logger.error("
|
|
951
|
-
callbackURL
|
|
952
|
-
trustedOrigins
|
|
950
|
+
logger.error("Unknown origin in callback URL", {
|
|
951
|
+
callbackURL
|
|
953
952
|
});
|
|
954
953
|
throw new APIError3("FORBIDDEN", {
|
|
955
954
|
message: "Invalid callback URL"
|
|
@@ -959,7 +958,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
959
958
|
if (currentURL !== ctx.context.baseURL) {
|
|
960
959
|
const currentURLOrigin = new URL(currentURL).origin;
|
|
961
960
|
if (!trustedOrigins.includes(currentURLOrigin)) {
|
|
962
|
-
logger.error("
|
|
961
|
+
logger.error("Unknown origin in current URL", {
|
|
963
962
|
currentURL,
|
|
964
963
|
trustedOrigins
|
|
965
964
|
});
|
|
@@ -968,6 +967,7 @@ var redirectURLMiddleware = createAuthMiddleware(async (ctx) => {
|
|
|
968
967
|
});
|
|
969
968
|
}
|
|
970
969
|
}
|
|
970
|
+
ctx.setHeader("x-auth-redirect", "true");
|
|
971
971
|
});
|
|
972
972
|
|
|
973
973
|
// src/api/routes/sign-in.ts
|
|
@@ -2953,7 +2953,7 @@ var csrfMiddleware = createAuthMiddleware(
|
|
|
2953
2953
|
if (ctx.context.trustedOrigins.includes(url.origin)) {
|
|
2954
2954
|
return;
|
|
2955
2955
|
}
|
|
2956
|
-
const csrfToken = ctx.
|
|
2956
|
+
const csrfToken = ctx.headers?.get("x-auth-csrf-token");
|
|
2957
2957
|
if (!csrfToken) {
|
|
2958
2958
|
throw new APIError11("UNAUTHORIZED", {
|
|
2959
2959
|
message: "CSRF Token is required"
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { useStore } from '@nanostores/react';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-xf537-bb.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/react.js
CHANGED
|
@@ -59,6 +59,10 @@ var redirectPlugin = {
|
|
|
59
59
|
name: "Redirect",
|
|
60
60
|
hooks: {
|
|
61
61
|
onSuccess(context) {
|
|
62
|
+
const header = context.response?.headers.get("x-auth-redirect");
|
|
63
|
+
if (!header) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
62
66
|
if (context.data?.url && context.data?.redirect) {
|
|
63
67
|
if (typeof window !== "undefined") {
|
|
64
68
|
window.location.href = context.data.url;
|
|
@@ -117,9 +121,9 @@ var csrfPlugin = {
|
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
const csrfToken = data?.csrfToken;
|
|
120
|
-
options.
|
|
121
|
-
...options
|
|
122
|
-
csrfToken
|
|
124
|
+
options.headers = {
|
|
125
|
+
...options.headers,
|
|
126
|
+
"x-auth-csrf-token": csrfToken
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
129
|
options.credentials = "include";
|
package/dist/solid-start.d.ts
CHANGED
package/dist/solid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Accessor } from 'solid-js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-xf537-bb.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/solid.js
CHANGED
|
@@ -59,6 +59,10 @@ var redirectPlugin = {
|
|
|
59
59
|
name: "Redirect",
|
|
60
60
|
hooks: {
|
|
61
61
|
onSuccess(context) {
|
|
62
|
+
const header = context.response?.headers.get("x-auth-redirect");
|
|
63
|
+
if (!header) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
62
66
|
if (context.data?.url && context.data?.redirect) {
|
|
63
67
|
if (typeof window !== "undefined") {
|
|
64
68
|
window.location.href = context.data.url;
|
|
@@ -117,9 +121,9 @@ var csrfPlugin = {
|
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
const csrfToken = data?.csrfToken;
|
|
120
|
-
options.
|
|
121
|
-
...options
|
|
122
|
-
csrfToken
|
|
124
|
+
options.headers = {
|
|
125
|
+
...options.headers,
|
|
126
|
+
"x-auth-csrf-token": csrfToken
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
129
|
options.credentials = "include";
|
package/dist/svelte-kit.d.ts
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as nanostores from 'nanostores';
|
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-xf537-bb.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/svelte.js
CHANGED
|
@@ -56,6 +56,10 @@ var redirectPlugin = {
|
|
|
56
56
|
name: "Redirect",
|
|
57
57
|
hooks: {
|
|
58
58
|
onSuccess(context) {
|
|
59
|
+
const header = context.response?.headers.get("x-auth-redirect");
|
|
60
|
+
if (!header) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
59
63
|
if (context.data?.url && context.data?.redirect) {
|
|
60
64
|
if (typeof window !== "undefined") {
|
|
61
65
|
window.location.href = context.data.url;
|
|
@@ -114,9 +118,9 @@ var csrfPlugin = {
|
|
|
114
118
|
);
|
|
115
119
|
}
|
|
116
120
|
const csrfToken = data?.csrfToken;
|
|
117
|
-
options.
|
|
118
|
-
...options
|
|
119
|
-
csrfToken
|
|
121
|
+
options.headers = {
|
|
122
|
+
...options.headers,
|
|
123
|
+
"x-auth-csrf-token": csrfToken
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
options.credentials = "include";
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-
|
|
2
|
-
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-
|
|
1
|
+
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-xf537-bb.js';
|
|
2
|
+
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-xf537-bb.js';
|
|
3
3
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, S as StripEmptyObjects, L as LiteralString } from './helper-DPDj8Nix.js';
|
|
4
4
|
export { D as DeepPartial, a as LiteralUnion, R as RequiredKeysOf, W as WithoutEmpty } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { S as Session, U as User } from './types-IzAbV4nB.js';
|
|
@@ -108,7 +108,9 @@ interface ClientOptions {
|
|
|
108
108
|
}
|
|
109
109
|
type InferClientAPI<O extends ClientOptions> = InferRoutes<O["plugins"] extends Array<any> ? (O["plugins"] extends Array<infer Pl> ? UnionToIntersection<Pl extends {
|
|
110
110
|
$InferServerPlugin: infer Plug;
|
|
111
|
-
} ? Plug extends
|
|
111
|
+
} ? Plug extends {
|
|
112
|
+
endpoints: infer Endpoints;
|
|
113
|
+
} ? Endpoints : {} : {}> : {}) & Auth["api"] : Auth["api"], O>;
|
|
112
114
|
type InferActions<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends BetterAuthClientPlugin ? Plugin["getActions"] extends ($fetch: BetterFetch) => infer Actions ? Actions : {} : {}> : {};
|
|
113
115
|
/**
|
|
114
116
|
* signals are just used to recall a computed value.
|
package/dist/vue.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Ref, DeepReadonly } from 'vue';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-xf537-bb.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/vue.js
CHANGED
|
@@ -59,6 +59,10 @@ var redirectPlugin = {
|
|
|
59
59
|
name: "Redirect",
|
|
60
60
|
hooks: {
|
|
61
61
|
onSuccess(context) {
|
|
62
|
+
const header = context.response?.headers.get("x-auth-redirect");
|
|
63
|
+
if (!header) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
62
66
|
if (context.data?.url && context.data?.redirect) {
|
|
63
67
|
if (typeof window !== "undefined") {
|
|
64
68
|
window.location.href = context.data.url;
|
|
@@ -117,9 +121,9 @@ var csrfPlugin = {
|
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
const csrfToken = data?.csrfToken;
|
|
120
|
-
options.
|
|
121
|
-
...options
|
|
122
|
-
csrfToken
|
|
124
|
+
options.headers = {
|
|
125
|
+
...options.headers,
|
|
126
|
+
"x-auth-csrf-token": csrfToken
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
129
|
options.credentials = "include";
|