better-auth 0.4.7-beta.2 → 0.4.7
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 +10 -3
- package/dist/cli.js +99 -0
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-CDrw7P9R.d.ts → index-BLNnHUb3.d.ts} +42 -24
- package/dist/{index-DR0wOL8N.d.ts → index-xf_fyhlx.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -3
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/react.d.ts +1 -1
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.ts +1 -1
- package/package.json +7 -2
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-BLNnHUb3.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -2689,6 +2689,13 @@ var router = (ctx, options) => {
|
|
|
2689
2689
|
return res;
|
|
2690
2690
|
},
|
|
2691
2691
|
onError(e) {
|
|
2692
|
+
if (options.onAPIError?.throw) {
|
|
2693
|
+
throw e;
|
|
2694
|
+
}
|
|
2695
|
+
if (options.onAPIError?.onError) {
|
|
2696
|
+
options.onAPIError.onError(e, ctx);
|
|
2697
|
+
return;
|
|
2698
|
+
}
|
|
2692
2699
|
const log = options.logger?.verboseLogging ? logger : void 0;
|
|
2693
2700
|
if (options.logger?.disabled !== true) {
|
|
2694
2701
|
if (e instanceof APIError10) {
|
|
@@ -2700,7 +2707,7 @@ var router = (ctx, options) => {
|
|
|
2700
2707
|
if (typeof e === "object" && e !== null && "message" in e) {
|
|
2701
2708
|
const errorMessage = e.message;
|
|
2702
2709
|
if (!errorMessage || typeof errorMessage !== "string") {
|
|
2703
|
-
|
|
2710
|
+
logger?.error(e);
|
|
2704
2711
|
return;
|
|
2705
2712
|
}
|
|
2706
2713
|
if (errorMessage.includes("no such table")) {
|
|
@@ -2722,10 +2729,10 @@ var router = (ctx, options) => {
|
|
|
2722
2729
|
)} to create the tables. There are missing tables in your MySQL database.`
|
|
2723
2730
|
);
|
|
2724
2731
|
} else {
|
|
2725
|
-
|
|
2732
|
+
logger?.error(e);
|
|
2726
2733
|
}
|
|
2727
2734
|
} else {
|
|
2728
|
-
|
|
2735
|
+
logger?.error(e);
|
|
2729
2736
|
}
|
|
2730
2737
|
}
|
|
2731
2738
|
}
|
package/dist/cli.js
CHANGED
|
@@ -68,10 +68,108 @@ var BetterAuthError = class extends Error {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
// src/cli/utils/add-svelte-kit-env-modules.ts
|
|
72
|
+
function addSvelteKitEnvModules(aliases) {
|
|
73
|
+
aliases["$env/dynamic/private"] = createDataUriModule(
|
|
74
|
+
createDynamicEnvModule()
|
|
75
|
+
);
|
|
76
|
+
aliases["$env/dynamic/public"] = createDataUriModule(
|
|
77
|
+
createDynamicEnvModule()
|
|
78
|
+
);
|
|
79
|
+
aliases["$env/static/private"] = createDataUriModule(
|
|
80
|
+
createStaticEnvModule(filterPrivateEnv("PUBLIC_", ""))
|
|
81
|
+
);
|
|
82
|
+
aliases["$env/static/public"] = createDataUriModule(
|
|
83
|
+
createStaticEnvModule(filterPublicEnv("PUBLIC_", ""))
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function createDataUriModule(module) {
|
|
87
|
+
return `data:text/javascript;charset=utf-8,${encodeURIComponent(module)}`;
|
|
88
|
+
}
|
|
89
|
+
function createStaticEnvModule(env) {
|
|
90
|
+
const declarations = Object.keys(env).filter((k) => validIdentifier.test(k) && !reserved.has(k)).map((k) => `export const ${k} = ${JSON.stringify(env[k])};`);
|
|
91
|
+
return `
|
|
92
|
+
${declarations.join("\n")}
|
|
93
|
+
// jiti dirty hack: .unknown
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
function createDynamicEnvModule() {
|
|
97
|
+
return `
|
|
98
|
+
export const env = process.env;
|
|
99
|
+
// jiti dirty hack: .unknown
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
function filterPrivateEnv(publicPrefix, privatePrefix) {
|
|
103
|
+
return Object.fromEntries(
|
|
104
|
+
Object.entries(process.env).filter(
|
|
105
|
+
([k]) => k.startsWith(privatePrefix) && (publicPrefix === "" || !k.startsWith(publicPrefix))
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function filterPublicEnv(publicPrefix, privatePrefix) {
|
|
110
|
+
return Object.fromEntries(
|
|
111
|
+
Object.entries(process.env).filter(
|
|
112
|
+
([k]) => k.startsWith(publicPrefix) && (privatePrefix === "" || !k.startsWith(privatePrefix))
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
var validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
117
|
+
var reserved = /* @__PURE__ */ new Set([
|
|
118
|
+
"do",
|
|
119
|
+
"if",
|
|
120
|
+
"in",
|
|
121
|
+
"for",
|
|
122
|
+
"let",
|
|
123
|
+
"new",
|
|
124
|
+
"try",
|
|
125
|
+
"var",
|
|
126
|
+
"case",
|
|
127
|
+
"else",
|
|
128
|
+
"enum",
|
|
129
|
+
"eval",
|
|
130
|
+
"null",
|
|
131
|
+
"this",
|
|
132
|
+
"true",
|
|
133
|
+
"void",
|
|
134
|
+
"with",
|
|
135
|
+
"await",
|
|
136
|
+
"break",
|
|
137
|
+
"catch",
|
|
138
|
+
"class",
|
|
139
|
+
"const",
|
|
140
|
+
"false",
|
|
141
|
+
"super",
|
|
142
|
+
"throw",
|
|
143
|
+
"while",
|
|
144
|
+
"yield",
|
|
145
|
+
"delete",
|
|
146
|
+
"export",
|
|
147
|
+
"import",
|
|
148
|
+
"public",
|
|
149
|
+
"return",
|
|
150
|
+
"static",
|
|
151
|
+
"switch",
|
|
152
|
+
"typeof",
|
|
153
|
+
"default",
|
|
154
|
+
"extends",
|
|
155
|
+
"finally",
|
|
156
|
+
"package",
|
|
157
|
+
"private",
|
|
158
|
+
"continue",
|
|
159
|
+
"debugger",
|
|
160
|
+
"function",
|
|
161
|
+
"arguments",
|
|
162
|
+
"interface",
|
|
163
|
+
"protected",
|
|
164
|
+
"implements",
|
|
165
|
+
"instanceof"
|
|
166
|
+
]);
|
|
167
|
+
|
|
71
168
|
// src/cli/get-config.ts
|
|
72
169
|
var possiblePaths = ["auth.ts", "auth.tsx"];
|
|
73
170
|
possiblePaths = [
|
|
74
171
|
...possiblePaths,
|
|
172
|
+
...possiblePaths.map((it) => `lib/server${it}`),
|
|
75
173
|
...possiblePaths.map((it) => `lib/${it}`),
|
|
76
174
|
...possiblePaths.map((it) => `utils/${it}`)
|
|
77
175
|
];
|
|
@@ -104,6 +202,7 @@ function getPathAliases(cwd) {
|
|
|
104
202
|
result[alias[0]] = "../";
|
|
105
203
|
}
|
|
106
204
|
}
|
|
205
|
+
addSvelteKitEnvModules(result);
|
|
107
206
|
return result;
|
|
108
207
|
} catch (error) {
|
|
109
208
|
console.error(error);
|
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, j as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, j as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin } from '../index-xf_fyhlx.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-xf_fyhlx.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-BLNnHUb3.js';
|
|
9
9
|
import * as better_call from 'better-call';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { O as OAuth2Tokens, U as User } from '../types-IzAbV4nB.js';
|
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-BLNnHUb3.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
|
@@ -970,6 +970,24 @@ interface BetterAuthOptions {
|
|
|
970
970
|
};
|
|
971
971
|
};
|
|
972
972
|
};
|
|
973
|
+
/**
|
|
974
|
+
* API error handling
|
|
975
|
+
*/
|
|
976
|
+
onAPIError?: {
|
|
977
|
+
/**
|
|
978
|
+
* Throw an error on API error
|
|
979
|
+
*
|
|
980
|
+
* @default false
|
|
981
|
+
*/
|
|
982
|
+
throw?: boolean;
|
|
983
|
+
/**
|
|
984
|
+
* Custom error handler
|
|
985
|
+
*
|
|
986
|
+
* @param error
|
|
987
|
+
* @param ctx - Auth context
|
|
988
|
+
*/
|
|
989
|
+
onError?: (error: unknown, ctx: AuthContext) => void | Promise<void>;
|
|
990
|
+
};
|
|
973
991
|
}
|
|
974
992
|
|
|
975
993
|
declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
@@ -1100,12 +1118,12 @@ declare const signInOAuth: {
|
|
|
1100
1118
|
/**
|
|
1101
1119
|
* OAuth2 provider to use`
|
|
1102
1120
|
*/
|
|
1103
|
-
provider: z.ZodEnum<["github", ...("
|
|
1121
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1104
1122
|
}, "strip", z.ZodTypeAny, {
|
|
1105
|
-
provider: "
|
|
1123
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1106
1124
|
callbackURL?: string | undefined;
|
|
1107
1125
|
}, {
|
|
1108
|
-
provider: "
|
|
1126
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1109
1127
|
callbackURL?: string | undefined;
|
|
1110
1128
|
}>;
|
|
1111
1129
|
}>]>(...ctx: C): Promise<C extends [{
|
|
@@ -1139,12 +1157,12 @@ declare const signInOAuth: {
|
|
|
1139
1157
|
/**
|
|
1140
1158
|
* OAuth2 provider to use`
|
|
1141
1159
|
*/
|
|
1142
|
-
provider: z.ZodEnum<["github", ...("
|
|
1160
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1143
1161
|
}, "strip", z.ZodTypeAny, {
|
|
1144
|
-
provider: "
|
|
1162
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1145
1163
|
callbackURL?: string | undefined;
|
|
1146
1164
|
}, {
|
|
1147
|
-
provider: "
|
|
1165
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1148
1166
|
callbackURL?: string | undefined;
|
|
1149
1167
|
}>;
|
|
1150
1168
|
};
|
|
@@ -2341,12 +2359,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2341
2359
|
}>>;
|
|
2342
2360
|
body: zod.ZodObject<{
|
|
2343
2361
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2344
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2362
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2345
2363
|
}, "strip", zod.ZodTypeAny, {
|
|
2346
|
-
provider: "
|
|
2364
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2347
2365
|
callbackURL?: string | undefined;
|
|
2348
2366
|
}, {
|
|
2349
|
-
provider: "
|
|
2367
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2350
2368
|
callbackURL?: string | undefined;
|
|
2351
2369
|
}>;
|
|
2352
2370
|
}>]>(...ctx: C_1): Promise<C_1 extends [{
|
|
@@ -2370,12 +2388,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2370
2388
|
}>>;
|
|
2371
2389
|
body: zod.ZodObject<{
|
|
2372
2390
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2373
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2391
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2374
2392
|
}, "strip", zod.ZodTypeAny, {
|
|
2375
|
-
provider: "
|
|
2393
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2376
2394
|
callbackURL?: string | undefined;
|
|
2377
2395
|
}, {
|
|
2378
|
-
provider: "
|
|
2396
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2379
2397
|
callbackURL?: string | undefined;
|
|
2380
2398
|
}>;
|
|
2381
2399
|
};
|
|
@@ -3430,12 +3448,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3430
3448
|
}>>;
|
|
3431
3449
|
body: zod.ZodObject<{
|
|
3432
3450
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3433
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3451
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3434
3452
|
}, "strip", zod.ZodTypeAny, {
|
|
3435
|
-
provider: "
|
|
3453
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3436
3454
|
callbackURL?: string | undefined;
|
|
3437
3455
|
}, {
|
|
3438
|
-
provider: "
|
|
3456
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3439
3457
|
callbackURL?: string | undefined;
|
|
3440
3458
|
}>;
|
|
3441
3459
|
}>]>(...ctx: C_1): Promise<C_1 extends [{
|
|
@@ -3459,12 +3477,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3459
3477
|
}>>;
|
|
3460
3478
|
body: zod.ZodObject<{
|
|
3461
3479
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3462
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3480
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3463
3481
|
}, "strip", zod.ZodTypeAny, {
|
|
3464
|
-
provider: "
|
|
3482
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3465
3483
|
callbackURL?: string | undefined;
|
|
3466
3484
|
}, {
|
|
3467
|
-
provider: "
|
|
3485
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3468
3486
|
callbackURL?: string | undefined;
|
|
3469
3487
|
}>;
|
|
3470
3488
|
};
|
|
@@ -4521,12 +4539,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4521
4539
|
}>>;
|
|
4522
4540
|
body: zod.ZodObject<{
|
|
4523
4541
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4524
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4542
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4525
4543
|
}, "strip", zod.ZodTypeAny, {
|
|
4526
|
-
provider: "
|
|
4544
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4527
4545
|
callbackURL?: string | undefined;
|
|
4528
4546
|
}, {
|
|
4529
|
-
provider: "
|
|
4547
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4530
4548
|
callbackURL?: string | undefined;
|
|
4531
4549
|
}>;
|
|
4532
4550
|
}>]>(...ctx: C): Promise<C extends [{
|
|
@@ -4550,12 +4568,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4550
4568
|
}>>;
|
|
4551
4569
|
body: zod.ZodObject<{
|
|
4552
4570
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4553
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4571
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4554
4572
|
}, "strip", zod.ZodTypeAny, {
|
|
4555
|
-
provider: "
|
|
4573
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4556
4574
|
callbackURL?: string | undefined;
|
|
4557
4575
|
}, {
|
|
4558
|
-
provider: "
|
|
4576
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4559
4577
|
callbackURL?: string | undefined;
|
|
4560
4578
|
}>;
|
|
4561
4579
|
};
|
|
@@ -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-BLNnHUb3.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
|
@@ -2795,6 +2795,13 @@ var router = (ctx, options) => {
|
|
|
2795
2795
|
return res;
|
|
2796
2796
|
},
|
|
2797
2797
|
onError(e) {
|
|
2798
|
+
if (options.onAPIError?.throw) {
|
|
2799
|
+
throw e;
|
|
2800
|
+
}
|
|
2801
|
+
if (options.onAPIError?.onError) {
|
|
2802
|
+
options.onAPIError.onError(e, ctx);
|
|
2803
|
+
return;
|
|
2804
|
+
}
|
|
2798
2805
|
const log = options.logger?.verboseLogging ? logger : void 0;
|
|
2799
2806
|
if (options.logger?.disabled !== true) {
|
|
2800
2807
|
if (e instanceof APIError10) {
|
|
@@ -2806,7 +2813,7 @@ var router = (ctx, options) => {
|
|
|
2806
2813
|
if (typeof e === "object" && e !== null && "message" in e) {
|
|
2807
2814
|
const errorMessage = e.message;
|
|
2808
2815
|
if (!errorMessage || typeof errorMessage !== "string") {
|
|
2809
|
-
|
|
2816
|
+
logger?.error(e);
|
|
2810
2817
|
return;
|
|
2811
2818
|
}
|
|
2812
2819
|
if (errorMessage.includes("no such table")) {
|
|
@@ -2828,10 +2835,10 @@ var router = (ctx, options) => {
|
|
|
2828
2835
|
)} to create the tables. There are missing tables in your MySQL database.`
|
|
2829
2836
|
);
|
|
2830
2837
|
} else {
|
|
2831
|
-
|
|
2838
|
+
logger?.error(e);
|
|
2832
2839
|
}
|
|
2833
2840
|
} else {
|
|
2834
|
-
|
|
2841
|
+
logger?.error(e);
|
|
2835
2842
|
}
|
|
2836
2843
|
}
|
|
2837
2844
|
}
|
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, 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, 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-xf_fyhlx.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-BLNnHUb3.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-BLNnHUb3.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
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-BLNnHUb3.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
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-BLNnHUb3.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
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-BLNnHUb3.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
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-BLNnHUb3.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-BLNnHUb3.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';
|
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-BLNnHUb3.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.4.7
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/better-auth/better-auth",
|
|
9
|
+
"directory": "packages/better-auth"
|
|
10
|
+
},
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"module": "./dist/index.js",
|
|
8
13
|
"bin": "./dist/cli.js",
|
|
@@ -78,7 +83,7 @@
|
|
|
78
83
|
"@simplewebauthn/browser": "^10.0.0",
|
|
79
84
|
"@simplewebauthn/server": "^10.0.1",
|
|
80
85
|
"better-call": "0.2.6",
|
|
81
|
-
"c12": "^
|
|
86
|
+
"c12": "^2.0.1",
|
|
82
87
|
"chalk": "^5.3.0",
|
|
83
88
|
"commander": "^12.1.0",
|
|
84
89
|
"consola": "^3.2.3",
|