better-auth 0.4.3-beta.1 → 0.4.4-beta.1
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/.DS_Store +0 -0
- 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 +40 -87
- package/dist/cli.js +36 -85
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-CmVVvxZr.d.ts → index-ClXwCXhZ.d.ts} +1 -1
- package/dist/{index-CBfuy92d.d.ts → index-OZLnPypp.d.ts} +12 -30
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -104
- 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 +40 -87
- package/dist/react.d.ts +1 -1
- package/dist/social.js +34 -83
- 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 +2 -1
package/dist/.DS_Store
CHANGED
|
Binary file
|
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-OZLnPypp.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -454,94 +454,45 @@ var github = (options) => {
|
|
|
454
454
|
import { parseJWT as parseJWT2 } from "oslo/jwt";
|
|
455
455
|
|
|
456
456
|
// src/utils/logger.ts
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
467
|
-
const year = date.getFullYear();
|
|
468
|
-
const month = pad(date.getMonth() + 1);
|
|
469
|
-
const day = pad(date.getDate());
|
|
470
|
-
const hours = pad(date.getHours());
|
|
471
|
-
const minutes = pad(date.getMinutes());
|
|
472
|
-
const seconds = pad(date.getSeconds());
|
|
473
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
474
|
-
};
|
|
475
|
-
var colorize = (text, color) => {
|
|
476
|
-
const colors = {
|
|
477
|
-
reset: "\x1B[0m",
|
|
478
|
-
green: "\x1B[32m",
|
|
479
|
-
yellow: "\x1B[33m",
|
|
480
|
-
red: "\x1B[31m",
|
|
481
|
-
blue: "\x1B[34m",
|
|
482
|
-
cyan: "\x1B[36m"
|
|
483
|
-
};
|
|
484
|
-
return `${colors[color]}${text}${colors.reset}`;
|
|
485
|
-
};
|
|
486
|
-
var defaultFormat = (level, message, timestamp, libraryName, ...args) => {
|
|
487
|
-
let formattedLevel = level.toUpperCase();
|
|
488
|
-
let colorizedMessage = message;
|
|
489
|
-
switch (level) {
|
|
490
|
-
case "debug":
|
|
491
|
-
formattedLevel = colorize(formattedLevel, "cyan");
|
|
492
|
-
break;
|
|
493
|
-
case "info":
|
|
494
|
-
formattedLevel = colorize(formattedLevel, "blue");
|
|
495
|
-
break;
|
|
496
|
-
case "success":
|
|
497
|
-
formattedLevel = colorize(`\u2713 ${formattedLevel}`, "green");
|
|
498
|
-
colorizedMessage = colorize(message, "green");
|
|
499
|
-
break;
|
|
500
|
-
case "warn":
|
|
501
|
-
formattedLevel = colorize(formattedLevel, "yellow");
|
|
502
|
-
break;
|
|
503
|
-
case "error":
|
|
504
|
-
formattedLevel = colorize(formattedLevel, "red");
|
|
505
|
-
break;
|
|
457
|
+
import { createConsola } from "consola";
|
|
458
|
+
var consola = createConsola({
|
|
459
|
+
formatOptions: {
|
|
460
|
+
date: false,
|
|
461
|
+
colors: true,
|
|
462
|
+
compact: true
|
|
463
|
+
},
|
|
464
|
+
defaults: {
|
|
465
|
+
tag: "Better Auth"
|
|
506
466
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
function createLogger(options = {}) {
|
|
510
|
-
const {
|
|
511
|
-
disabled = false,
|
|
512
|
-
minLevel = "info",
|
|
513
|
-
customFormat = defaultFormat
|
|
514
|
-
} = options;
|
|
515
|
-
const loggerFunction = (level) => {
|
|
516
|
-
return (message, ...args) => {
|
|
517
|
-
if (disabled) return;
|
|
518
|
-
if (LOG_LEVELS[level] >= LOG_LEVELS[minLevel]) {
|
|
519
|
-
const timestamp = formatDate(/* @__PURE__ */ new Date());
|
|
520
|
-
const formattedMessage = customFormat(
|
|
521
|
-
level,
|
|
522
|
-
message,
|
|
523
|
-
timestamp,
|
|
524
|
-
LIBRARY_NAME,
|
|
525
|
-
...args
|
|
526
|
-
);
|
|
527
|
-
console.log(formattedMessage);
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
};
|
|
467
|
+
});
|
|
468
|
+
var createLogger = (options) => {
|
|
531
469
|
return {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
break: () => {
|
|
535
|
-
console.log("\n");
|
|
470
|
+
log: (...args) => {
|
|
471
|
+
!options?.disabled && consola.log("", ...args);
|
|
536
472
|
},
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
options.
|
|
473
|
+
error: (...args) => {
|
|
474
|
+
!options?.disabled && consola.error("", ...args);
|
|
475
|
+
},
|
|
476
|
+
warn: (...args) => {
|
|
477
|
+
!options?.disabled && consola.warn("", ...args);
|
|
478
|
+
},
|
|
479
|
+
info: (...args) => {
|
|
480
|
+
!options?.disabled && consola.info("", ...args);
|
|
481
|
+
},
|
|
482
|
+
debug: (...args) => {
|
|
483
|
+
!options?.disabled && consola.debug("", ...args);
|
|
484
|
+
},
|
|
485
|
+
box: (...args) => {
|
|
486
|
+
!options?.disabled && consola.box("", ...args);
|
|
487
|
+
},
|
|
488
|
+
success: (...args) => {
|
|
489
|
+
!options?.disabled && consola.success("", ...args);
|
|
490
|
+
},
|
|
491
|
+
break: (...args) => {
|
|
492
|
+
!options?.disabled && console.log("\n");
|
|
542
493
|
}
|
|
543
494
|
};
|
|
544
|
-
}
|
|
495
|
+
};
|
|
545
496
|
var logger = createLogger();
|
|
546
497
|
|
|
547
498
|
// src/social-providers/google.ts
|
|
@@ -869,20 +820,22 @@ import { APIError as APIError2 } from "better-call";
|
|
|
869
820
|
|
|
870
821
|
// src/utils/date.ts
|
|
871
822
|
var getDate = (span, unit = "ms") => {
|
|
872
|
-
|
|
873
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
823
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
874
824
|
};
|
|
875
825
|
|
|
876
826
|
// src/cookies/index.ts
|
|
877
827
|
import { TimeSpan } from "oslo";
|
|
878
828
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
879
829
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
880
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
830
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
881
831
|
await ctx.setSignedCookie(
|
|
882
832
|
ctx.context.authCookies.sessionToken.name,
|
|
883
833
|
sessionToken,
|
|
884
834
|
ctx.context.secret,
|
|
885
|
-
|
|
835
|
+
{
|
|
836
|
+
...options,
|
|
837
|
+
...overrides
|
|
838
|
+
}
|
|
886
839
|
);
|
|
887
840
|
if (dontRememberMe) {
|
|
888
841
|
await ctx.setSignedCookie(
|
package/dist/cli.js
CHANGED
|
@@ -10,94 +10,45 @@ import { Command } from "commander";
|
|
|
10
10
|
import { loadConfig } from "c12";
|
|
11
11
|
|
|
12
12
|
// src/utils/logger.ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
23
|
-
const year = date.getFullYear();
|
|
24
|
-
const month = pad(date.getMonth() + 1);
|
|
25
|
-
const day = pad(date.getDate());
|
|
26
|
-
const hours = pad(date.getHours());
|
|
27
|
-
const minutes = pad(date.getMinutes());
|
|
28
|
-
const seconds = pad(date.getSeconds());
|
|
29
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
30
|
-
};
|
|
31
|
-
var colorize = (text, color) => {
|
|
32
|
-
const colors = {
|
|
33
|
-
reset: "\x1B[0m",
|
|
34
|
-
green: "\x1B[32m",
|
|
35
|
-
yellow: "\x1B[33m",
|
|
36
|
-
red: "\x1B[31m",
|
|
37
|
-
blue: "\x1B[34m",
|
|
38
|
-
cyan: "\x1B[36m"
|
|
39
|
-
};
|
|
40
|
-
return `${colors[color]}${text}${colors.reset}`;
|
|
41
|
-
};
|
|
42
|
-
var defaultFormat = (level, message, timestamp, libraryName, ...args) => {
|
|
43
|
-
let formattedLevel = level.toUpperCase();
|
|
44
|
-
let colorizedMessage = message;
|
|
45
|
-
switch (level) {
|
|
46
|
-
case "debug":
|
|
47
|
-
formattedLevel = colorize(formattedLevel, "cyan");
|
|
48
|
-
break;
|
|
49
|
-
case "info":
|
|
50
|
-
formattedLevel = colorize(formattedLevel, "blue");
|
|
51
|
-
break;
|
|
52
|
-
case "success":
|
|
53
|
-
formattedLevel = colorize(`\u2713 ${formattedLevel}`, "green");
|
|
54
|
-
colorizedMessage = colorize(message, "green");
|
|
55
|
-
break;
|
|
56
|
-
case "warn":
|
|
57
|
-
formattedLevel = colorize(formattedLevel, "yellow");
|
|
58
|
-
break;
|
|
59
|
-
case "error":
|
|
60
|
-
formattedLevel = colorize(formattedLevel, "red");
|
|
61
|
-
break;
|
|
13
|
+
import { createConsola } from "consola";
|
|
14
|
+
var consola = createConsola({
|
|
15
|
+
formatOptions: {
|
|
16
|
+
date: false,
|
|
17
|
+
colors: true,
|
|
18
|
+
compact: true
|
|
19
|
+
},
|
|
20
|
+
defaults: {
|
|
21
|
+
tag: "Better Auth"
|
|
62
22
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function createLogger(options = {}) {
|
|
66
|
-
const {
|
|
67
|
-
disabled = false,
|
|
68
|
-
minLevel = "info",
|
|
69
|
-
customFormat = defaultFormat
|
|
70
|
-
} = options;
|
|
71
|
-
const loggerFunction = (level) => {
|
|
72
|
-
return (message, ...args) => {
|
|
73
|
-
if (disabled) return;
|
|
74
|
-
if (LOG_LEVELS[level] >= LOG_LEVELS[minLevel]) {
|
|
75
|
-
const timestamp = formatDate(/* @__PURE__ */ new Date());
|
|
76
|
-
const formattedMessage = customFormat(
|
|
77
|
-
level,
|
|
78
|
-
message,
|
|
79
|
-
timestamp,
|
|
80
|
-
LIBRARY_NAME,
|
|
81
|
-
...args
|
|
82
|
-
);
|
|
83
|
-
console.log(formattedMessage);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
};
|
|
23
|
+
});
|
|
24
|
+
var createLogger = (options) => {
|
|
87
25
|
return {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
26
|
+
log: (...args) => {
|
|
27
|
+
!options?.disabled && consola.log("", ...args);
|
|
28
|
+
},
|
|
29
|
+
error: (...args) => {
|
|
30
|
+
!options?.disabled && consola.error("", ...args);
|
|
31
|
+
},
|
|
32
|
+
warn: (...args) => {
|
|
33
|
+
!options?.disabled && consola.warn("", ...args);
|
|
34
|
+
},
|
|
35
|
+
info: (...args) => {
|
|
36
|
+
!options?.disabled && consola.info("", ...args);
|
|
37
|
+
},
|
|
38
|
+
debug: (...args) => {
|
|
39
|
+
!options?.disabled && consola.debug("", ...args);
|
|
92
40
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
options.
|
|
41
|
+
box: (...args) => {
|
|
42
|
+
!options?.disabled && consola.box("", ...args);
|
|
43
|
+
},
|
|
44
|
+
success: (...args) => {
|
|
45
|
+
!options?.disabled && consola.success("", ...args);
|
|
46
|
+
},
|
|
47
|
+
break: (...args) => {
|
|
48
|
+
!options?.disabled && console.log("\n");
|
|
98
49
|
}
|
|
99
50
|
};
|
|
100
|
-
}
|
|
51
|
+
};
|
|
101
52
|
var logger = createLogger();
|
|
102
53
|
|
|
103
54
|
// src/cli/get-config.ts
|
|
@@ -155,6 +106,7 @@ function getPathAliases(cwd) {
|
|
|
155
106
|
}
|
|
156
107
|
return result;
|
|
157
108
|
} catch (error) {
|
|
109
|
+
console.error(error);
|
|
158
110
|
throw new BetterAuthError("Error parsing tsconfig.json");
|
|
159
111
|
}
|
|
160
112
|
}
|
|
@@ -186,7 +138,6 @@ async function getConfig({
|
|
|
186
138
|
try {
|
|
187
139
|
let configFile = null;
|
|
188
140
|
if (configPath) {
|
|
189
|
-
const alias = getPathAliases(cwd);
|
|
190
141
|
const { config } = await loadConfig({
|
|
191
142
|
configFile: path.join(cwd, configPath),
|
|
192
143
|
dotenv: true,
|
|
@@ -784,7 +735,7 @@ var migrate = new Command("migrate").option(
|
|
|
784
735
|
spinner.stop();
|
|
785
736
|
logger.info(`\u{1F511} The migration will affect the following:`);
|
|
786
737
|
for (const table of [...toBeCreated, ...toBeAdded]) {
|
|
787
|
-
|
|
738
|
+
console.log(
|
|
788
739
|
"->",
|
|
789
740
|
chalk.magenta(Object.keys(table.fields).join(", ")),
|
|
790
741
|
chalk.white("fields on"),
|
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-ClXwCXhZ.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-ClXwCXhZ.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-OZLnPypp.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-OZLnPypp.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
|
@@ -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-OZLnPypp.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -118,21 +118,17 @@ declare function createCookieGetter(options: BetterAuthOptions): (cookieName: st
|
|
|
118
118
|
};
|
|
119
119
|
type BetterAuthCookies = ReturnType<typeof getCookies>;
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
type LogFunction = (message: any, ...args: any[]) => void;
|
|
123
|
-
type LoggerOptions = {
|
|
121
|
+
declare const createLogger: (options?: {
|
|
124
122
|
disabled?: boolean;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
success:
|
|
133
|
-
|
|
134
|
-
error: LogFunction;
|
|
135
|
-
setMinLevel: (level: LogLevel) => void;
|
|
123
|
+
}) => {
|
|
124
|
+
log: (...args: any[]) => void;
|
|
125
|
+
error: (...args: any[]) => void;
|
|
126
|
+
warn: (...args: any[]) => void;
|
|
127
|
+
info: (...args: any[]) => void;
|
|
128
|
+
debug: (...args: any[]) => void;
|
|
129
|
+
box: (...args: any[]) => void;
|
|
130
|
+
success: (...args: any[]) => void;
|
|
131
|
+
break: (...args: any[]) => void;
|
|
136
132
|
};
|
|
137
133
|
|
|
138
134
|
declare const init: (options: BetterAuthOptions) => Promise<AuthContext>;
|
|
@@ -1016,22 +1012,8 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
1016
1012
|
userAgent?: string | undefined;
|
|
1017
1013
|
} | null>;
|
|
1018
1014
|
findSession: (sessionId: string) => Promise<{
|
|
1019
|
-
session:
|
|
1020
|
-
|
|
1021
|
-
userId: string;
|
|
1022
|
-
expiresAt: Date;
|
|
1023
|
-
ipAddress?: string | undefined;
|
|
1024
|
-
userAgent?: string | undefined;
|
|
1025
|
-
};
|
|
1026
|
-
user: {
|
|
1027
|
-
id: string;
|
|
1028
|
-
email: string;
|
|
1029
|
-
emailVerified: boolean;
|
|
1030
|
-
name: string;
|
|
1031
|
-
createdAt: Date;
|
|
1032
|
-
updatedAt: Date;
|
|
1033
|
-
image?: string | undefined;
|
|
1034
|
-
};
|
|
1015
|
+
session: Session;
|
|
1016
|
+
user: User;
|
|
1035
1017
|
} | null>;
|
|
1036
1018
|
updateSession: (sessionId: string, session: Partial<Session>) => Promise<{
|
|
1037
1019
|
id: string;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -454,94 +454,45 @@ var github = (options) => {
|
|
|
454
454
|
import { parseJWT as parseJWT2 } from "oslo/jwt";
|
|
455
455
|
|
|
456
456
|
// src/utils/logger.ts
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
467
|
-
const year = date.getFullYear();
|
|
468
|
-
const month = pad(date.getMonth() + 1);
|
|
469
|
-
const day = pad(date.getDate());
|
|
470
|
-
const hours = pad(date.getHours());
|
|
471
|
-
const minutes = pad(date.getMinutes());
|
|
472
|
-
const seconds = pad(date.getSeconds());
|
|
473
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
474
|
-
};
|
|
475
|
-
var colorize = (text, color) => {
|
|
476
|
-
const colors = {
|
|
477
|
-
reset: "\x1B[0m",
|
|
478
|
-
green: "\x1B[32m",
|
|
479
|
-
yellow: "\x1B[33m",
|
|
480
|
-
red: "\x1B[31m",
|
|
481
|
-
blue: "\x1B[34m",
|
|
482
|
-
cyan: "\x1B[36m"
|
|
483
|
-
};
|
|
484
|
-
return `${colors[color]}${text}${colors.reset}`;
|
|
485
|
-
};
|
|
486
|
-
var defaultFormat = (level, message, timestamp, libraryName, ...args) => {
|
|
487
|
-
let formattedLevel = level.toUpperCase();
|
|
488
|
-
let colorizedMessage = message;
|
|
489
|
-
switch (level) {
|
|
490
|
-
case "debug":
|
|
491
|
-
formattedLevel = colorize(formattedLevel, "cyan");
|
|
492
|
-
break;
|
|
493
|
-
case "info":
|
|
494
|
-
formattedLevel = colorize(formattedLevel, "blue");
|
|
495
|
-
break;
|
|
496
|
-
case "success":
|
|
497
|
-
formattedLevel = colorize(`\u2713 ${formattedLevel}`, "green");
|
|
498
|
-
colorizedMessage = colorize(message, "green");
|
|
499
|
-
break;
|
|
500
|
-
case "warn":
|
|
501
|
-
formattedLevel = colorize(formattedLevel, "yellow");
|
|
502
|
-
break;
|
|
503
|
-
case "error":
|
|
504
|
-
formattedLevel = colorize(formattedLevel, "red");
|
|
505
|
-
break;
|
|
457
|
+
import { createConsola } from "consola";
|
|
458
|
+
var consola = createConsola({
|
|
459
|
+
formatOptions: {
|
|
460
|
+
date: false,
|
|
461
|
+
colors: true,
|
|
462
|
+
compact: true
|
|
463
|
+
},
|
|
464
|
+
defaults: {
|
|
465
|
+
tag: "Better Auth"
|
|
506
466
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
function createLogger(options = {}) {
|
|
510
|
-
const {
|
|
511
|
-
disabled = false,
|
|
512
|
-
minLevel = "info",
|
|
513
|
-
customFormat = defaultFormat
|
|
514
|
-
} = options;
|
|
515
|
-
const loggerFunction = (level) => {
|
|
516
|
-
return (message, ...args) => {
|
|
517
|
-
if (disabled) return;
|
|
518
|
-
if (LOG_LEVELS[level] >= LOG_LEVELS[minLevel]) {
|
|
519
|
-
const timestamp = formatDate(/* @__PURE__ */ new Date());
|
|
520
|
-
const formattedMessage = customFormat(
|
|
521
|
-
level,
|
|
522
|
-
message,
|
|
523
|
-
timestamp,
|
|
524
|
-
LIBRARY_NAME,
|
|
525
|
-
...args
|
|
526
|
-
);
|
|
527
|
-
console.log(formattedMessage);
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
};
|
|
467
|
+
});
|
|
468
|
+
var createLogger = (options) => {
|
|
531
469
|
return {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
470
|
+
log: (...args) => {
|
|
471
|
+
!options?.disabled && consola.log("", ...args);
|
|
472
|
+
},
|
|
473
|
+
error: (...args) => {
|
|
474
|
+
!options?.disabled && consola.error("", ...args);
|
|
475
|
+
},
|
|
476
|
+
warn: (...args) => {
|
|
477
|
+
!options?.disabled && consola.warn("", ...args);
|
|
478
|
+
},
|
|
479
|
+
info: (...args) => {
|
|
480
|
+
!options?.disabled && consola.info("", ...args);
|
|
481
|
+
},
|
|
482
|
+
debug: (...args) => {
|
|
483
|
+
!options?.disabled && consola.debug("", ...args);
|
|
536
484
|
},
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
options.
|
|
485
|
+
box: (...args) => {
|
|
486
|
+
!options?.disabled && consola.box("", ...args);
|
|
487
|
+
},
|
|
488
|
+
success: (...args) => {
|
|
489
|
+
!options?.disabled && consola.success("", ...args);
|
|
490
|
+
},
|
|
491
|
+
break: (...args) => {
|
|
492
|
+
!options?.disabled && console.log("\n");
|
|
542
493
|
}
|
|
543
494
|
};
|
|
544
|
-
}
|
|
495
|
+
};
|
|
545
496
|
var logger = createLogger();
|
|
546
497
|
|
|
547
498
|
// src/social-providers/google.ts
|
|
@@ -869,8 +820,7 @@ import { APIError as APIError2 } from "better-call";
|
|
|
869
820
|
|
|
870
821
|
// src/utils/date.ts
|
|
871
822
|
var getDate = (span, unit = "ms") => {
|
|
872
|
-
|
|
873
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
823
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
874
824
|
};
|
|
875
825
|
|
|
876
826
|
// src/cookies/index.ts
|
|
@@ -879,7 +829,7 @@ function getCookies(options) {
|
|
|
879
829
|
const secure = options.advanced?.useSecureCookies !== void 0 ? options.advanced?.useSecureCookies : options.baseURL?.startsWith("https://") || process.env.NODE_ENV === "production";
|
|
880
830
|
const secureCookiePrefix = secure ? "__Secure-" : "";
|
|
881
831
|
const cookiePrefix = "better-auth";
|
|
882
|
-
const sessionMaxAge = new TimeSpan(7, "d").seconds();
|
|
832
|
+
const sessionMaxAge = options.session?.expiresIn || new TimeSpan(7, "d").seconds();
|
|
883
833
|
const crossSubdomainEnabled = !!options.advanced?.crossSubDomainCookies?.enabled;
|
|
884
834
|
const domain = crossSubdomainEnabled ? options.advanced?.crossSubDomainCookies?.domain || (options.baseURL ? new URL(options.baseURL).hostname : void 0) : void 0;
|
|
885
835
|
if (crossSubdomainEnabled && !domain) {
|
|
@@ -983,12 +933,15 @@ function createCookieGetter(options) {
|
|
|
983
933
|
}
|
|
984
934
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
985
935
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
986
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
936
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
987
937
|
await ctx.setSignedCookie(
|
|
988
938
|
ctx.context.authCookies.sessionToken.name,
|
|
989
939
|
sessionToken,
|
|
990
940
|
ctx.context.secret,
|
|
991
|
-
|
|
941
|
+
{
|
|
942
|
+
...options,
|
|
943
|
+
...overrides
|
|
944
|
+
}
|
|
992
945
|
);
|
|
993
946
|
if (dontRememberMe) {
|
|
994
947
|
await ctx.setSignedCookie(
|
|
@@ -3805,42 +3758,54 @@ var createInternalAdapter = (adapter, ctx) => {
|
|
|
3805
3758
|
* set the session to expire in 1 day.
|
|
3806
3759
|
* The cookie will be set to expire at the end of the session
|
|
3807
3760
|
*/
|
|
3808
|
-
expiresAt: dontRememberMe ? getDate(
|
|
3761
|
+
expiresAt: dontRememberMe ? getDate(60 * 60 * 24, "sec") : getDate(sessionExpiration, "sec"),
|
|
3809
3762
|
ipAddress: headers?.get("x-forwarded-for") || "",
|
|
3810
3763
|
userAgent: headers?.get("user-agent") || ""
|
|
3811
3764
|
};
|
|
3812
3765
|
const session = await createWithHooks(data, "session");
|
|
3813
3766
|
if (secondaryStorage && session) {
|
|
3767
|
+
const user = await adapter.findOne({
|
|
3768
|
+
model: tables.user.tableName,
|
|
3769
|
+
where: [{ field: "id", value: userId }]
|
|
3770
|
+
});
|
|
3814
3771
|
secondaryStorage.set(
|
|
3815
3772
|
session.id,
|
|
3816
|
-
JSON.stringify(
|
|
3773
|
+
JSON.stringify({
|
|
3774
|
+
session,
|
|
3775
|
+
user
|
|
3776
|
+
}),
|
|
3817
3777
|
sessionExpiration
|
|
3818
3778
|
);
|
|
3819
3779
|
}
|
|
3820
3780
|
return session;
|
|
3821
3781
|
},
|
|
3822
3782
|
findSession: async (sessionId) => {
|
|
3823
|
-
let session = null;
|
|
3824
3783
|
if (secondaryStorage) {
|
|
3825
3784
|
const sessionStringified = await secondaryStorage.get(sessionId);
|
|
3826
3785
|
if (sessionStringified) {
|
|
3827
3786
|
const s = JSON.parse(sessionStringified);
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3787
|
+
return {
|
|
3788
|
+
session: {
|
|
3789
|
+
...s.session,
|
|
3790
|
+
expiresAt: new Date(s.session.expiresAt)
|
|
3791
|
+
},
|
|
3792
|
+
user: {
|
|
3793
|
+
...s.user,
|
|
3794
|
+
createdAt: new Date(s.user.createdAt),
|
|
3795
|
+
updatedAt: new Date(s.user.updatedAt)
|
|
3796
|
+
}
|
|
3831
3797
|
};
|
|
3832
3798
|
}
|
|
3833
|
-
} else {
|
|
3834
|
-
session = await adapter.findOne({
|
|
3835
|
-
model: tables.session.tableName,
|
|
3836
|
-
where: [
|
|
3837
|
-
{
|
|
3838
|
-
value: sessionId,
|
|
3839
|
-
field: "id"
|
|
3840
|
-
}
|
|
3841
|
-
]
|
|
3842
|
-
});
|
|
3843
3799
|
}
|
|
3800
|
+
const session = await adapter.findOne({
|
|
3801
|
+
model: tables.session.tableName,
|
|
3802
|
+
where: [
|
|
3803
|
+
{
|
|
3804
|
+
value: sessionId,
|
|
3805
|
+
field: "id"
|
|
3806
|
+
}
|
|
3807
|
+
]
|
|
3808
|
+
});
|
|
3844
3809
|
if (!session) {
|
|
3845
3810
|
return null;
|
|
3846
3811
|
}
|
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-ClXwCXhZ.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-OZLnPypp.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-OZLnPypp.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
package/dist/plugins.js
CHANGED
|
@@ -394,94 +394,45 @@ var github = (options) => {
|
|
|
394
394
|
import { parseJWT as parseJWT2 } from "oslo/jwt";
|
|
395
395
|
|
|
396
396
|
// src/utils/logger.ts
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
407
|
-
const year = date.getFullYear();
|
|
408
|
-
const month = pad(date.getMonth() + 1);
|
|
409
|
-
const day = pad(date.getDate());
|
|
410
|
-
const hours = pad(date.getHours());
|
|
411
|
-
const minutes = pad(date.getMinutes());
|
|
412
|
-
const seconds = pad(date.getSeconds());
|
|
413
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
414
|
-
};
|
|
415
|
-
var colorize = (text, color) => {
|
|
416
|
-
const colors = {
|
|
417
|
-
reset: "\x1B[0m",
|
|
418
|
-
green: "\x1B[32m",
|
|
419
|
-
yellow: "\x1B[33m",
|
|
420
|
-
red: "\x1B[31m",
|
|
421
|
-
blue: "\x1B[34m",
|
|
422
|
-
cyan: "\x1B[36m"
|
|
423
|
-
};
|
|
424
|
-
return `${colors[color]}${text}${colors.reset}`;
|
|
425
|
-
};
|
|
426
|
-
var defaultFormat = (level, message, timestamp, libraryName, ...args) => {
|
|
427
|
-
let formattedLevel = level.toUpperCase();
|
|
428
|
-
let colorizedMessage = message;
|
|
429
|
-
switch (level) {
|
|
430
|
-
case "debug":
|
|
431
|
-
formattedLevel = colorize(formattedLevel, "cyan");
|
|
432
|
-
break;
|
|
433
|
-
case "info":
|
|
434
|
-
formattedLevel = colorize(formattedLevel, "blue");
|
|
435
|
-
break;
|
|
436
|
-
case "success":
|
|
437
|
-
formattedLevel = colorize(`\u2713 ${formattedLevel}`, "green");
|
|
438
|
-
colorizedMessage = colorize(message, "green");
|
|
439
|
-
break;
|
|
440
|
-
case "warn":
|
|
441
|
-
formattedLevel = colorize(formattedLevel, "yellow");
|
|
442
|
-
break;
|
|
443
|
-
case "error":
|
|
444
|
-
formattedLevel = colorize(formattedLevel, "red");
|
|
445
|
-
break;
|
|
397
|
+
import { createConsola } from "consola";
|
|
398
|
+
var consola = createConsola({
|
|
399
|
+
formatOptions: {
|
|
400
|
+
date: false,
|
|
401
|
+
colors: true,
|
|
402
|
+
compact: true
|
|
403
|
+
},
|
|
404
|
+
defaults: {
|
|
405
|
+
tag: "Better Auth"
|
|
446
406
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
function createLogger(options = {}) {
|
|
450
|
-
const {
|
|
451
|
-
disabled = false,
|
|
452
|
-
minLevel = "info",
|
|
453
|
-
customFormat = defaultFormat
|
|
454
|
-
} = options;
|
|
455
|
-
const loggerFunction = (level) => {
|
|
456
|
-
return (message, ...args) => {
|
|
457
|
-
if (disabled) return;
|
|
458
|
-
if (LOG_LEVELS[level] >= LOG_LEVELS[minLevel]) {
|
|
459
|
-
const timestamp = formatDate(/* @__PURE__ */ new Date());
|
|
460
|
-
const formattedMessage = customFormat(
|
|
461
|
-
level,
|
|
462
|
-
message,
|
|
463
|
-
timestamp,
|
|
464
|
-
LIBRARY_NAME,
|
|
465
|
-
...args
|
|
466
|
-
);
|
|
467
|
-
console.log(formattedMessage);
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
};
|
|
407
|
+
});
|
|
408
|
+
var createLogger = (options) => {
|
|
471
409
|
return {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
break: () => {
|
|
475
|
-
console.log("\n");
|
|
410
|
+
log: (...args) => {
|
|
411
|
+
!options?.disabled && consola.log("", ...args);
|
|
476
412
|
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
options.
|
|
413
|
+
error: (...args) => {
|
|
414
|
+
!options?.disabled && consola.error("", ...args);
|
|
415
|
+
},
|
|
416
|
+
warn: (...args) => {
|
|
417
|
+
!options?.disabled && consola.warn("", ...args);
|
|
418
|
+
},
|
|
419
|
+
info: (...args) => {
|
|
420
|
+
!options?.disabled && consola.info("", ...args);
|
|
421
|
+
},
|
|
422
|
+
debug: (...args) => {
|
|
423
|
+
!options?.disabled && consola.debug("", ...args);
|
|
424
|
+
},
|
|
425
|
+
box: (...args) => {
|
|
426
|
+
!options?.disabled && consola.box("", ...args);
|
|
427
|
+
},
|
|
428
|
+
success: (...args) => {
|
|
429
|
+
!options?.disabled && consola.success("", ...args);
|
|
430
|
+
},
|
|
431
|
+
break: (...args) => {
|
|
432
|
+
!options?.disabled && console.log("\n");
|
|
482
433
|
}
|
|
483
434
|
};
|
|
484
|
-
}
|
|
435
|
+
};
|
|
485
436
|
var logger = createLogger();
|
|
486
437
|
|
|
487
438
|
// src/social-providers/google.ts
|
|
@@ -809,20 +760,22 @@ import { APIError } from "better-call";
|
|
|
809
760
|
|
|
810
761
|
// src/utils/date.ts
|
|
811
762
|
var getDate = (span, unit = "ms") => {
|
|
812
|
-
|
|
813
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
763
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
814
764
|
};
|
|
815
765
|
|
|
816
766
|
// src/cookies/index.ts
|
|
817
767
|
import { TimeSpan } from "oslo";
|
|
818
768
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
819
769
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
820
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
770
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
821
771
|
await ctx.setSignedCookie(
|
|
822
772
|
ctx.context.authCookies.sessionToken.name,
|
|
823
773
|
sessionToken,
|
|
824
774
|
ctx.context.secret,
|
|
825
|
-
|
|
775
|
+
{
|
|
776
|
+
...options,
|
|
777
|
+
...overrides
|
|
778
|
+
}
|
|
826
779
|
);
|
|
827
780
|
if (dontRememberMe) {
|
|
828
781
|
await ctx.setSignedCookie(
|
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-OZLnPypp.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/social.js
CHANGED
|
@@ -349,94 +349,45 @@ var github = (options) => {
|
|
|
349
349
|
import { parseJWT as parseJWT2 } from "oslo/jwt";
|
|
350
350
|
|
|
351
351
|
// src/utils/logger.ts
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const pad = (num) => num.toString().padStart(2, "0");
|
|
362
|
-
const year = date.getFullYear();
|
|
363
|
-
const month = pad(date.getMonth() + 1);
|
|
364
|
-
const day = pad(date.getDate());
|
|
365
|
-
const hours = pad(date.getHours());
|
|
366
|
-
const minutes = pad(date.getMinutes());
|
|
367
|
-
const seconds = pad(date.getSeconds());
|
|
368
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
369
|
-
};
|
|
370
|
-
var colorize = (text, color) => {
|
|
371
|
-
const colors = {
|
|
372
|
-
reset: "\x1B[0m",
|
|
373
|
-
green: "\x1B[32m",
|
|
374
|
-
yellow: "\x1B[33m",
|
|
375
|
-
red: "\x1B[31m",
|
|
376
|
-
blue: "\x1B[34m",
|
|
377
|
-
cyan: "\x1B[36m"
|
|
378
|
-
};
|
|
379
|
-
return `${colors[color]}${text}${colors.reset}`;
|
|
380
|
-
};
|
|
381
|
-
var defaultFormat = (level, message, timestamp, libraryName, ...args) => {
|
|
382
|
-
let formattedLevel = level.toUpperCase();
|
|
383
|
-
let colorizedMessage = message;
|
|
384
|
-
switch (level) {
|
|
385
|
-
case "debug":
|
|
386
|
-
formattedLevel = colorize(formattedLevel, "cyan");
|
|
387
|
-
break;
|
|
388
|
-
case "info":
|
|
389
|
-
formattedLevel = colorize(formattedLevel, "blue");
|
|
390
|
-
break;
|
|
391
|
-
case "success":
|
|
392
|
-
formattedLevel = colorize(`\u2713 ${formattedLevel}`, "green");
|
|
393
|
-
colorizedMessage = colorize(message, "green");
|
|
394
|
-
break;
|
|
395
|
-
case "warn":
|
|
396
|
-
formattedLevel = colorize(formattedLevel, "yellow");
|
|
397
|
-
break;
|
|
398
|
-
case "error":
|
|
399
|
-
formattedLevel = colorize(formattedLevel, "red");
|
|
400
|
-
break;
|
|
352
|
+
import { createConsola } from "consola";
|
|
353
|
+
var consola = createConsola({
|
|
354
|
+
formatOptions: {
|
|
355
|
+
date: false,
|
|
356
|
+
colors: true,
|
|
357
|
+
compact: true
|
|
358
|
+
},
|
|
359
|
+
defaults: {
|
|
360
|
+
tag: "Better Auth"
|
|
401
361
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
function createLogger(options = {}) {
|
|
405
|
-
const {
|
|
406
|
-
disabled = false,
|
|
407
|
-
minLevel = "info",
|
|
408
|
-
customFormat = defaultFormat
|
|
409
|
-
} = options;
|
|
410
|
-
const loggerFunction = (level) => {
|
|
411
|
-
return (message, ...args) => {
|
|
412
|
-
if (disabled) return;
|
|
413
|
-
if (LOG_LEVELS[level] >= LOG_LEVELS[minLevel]) {
|
|
414
|
-
const timestamp = formatDate(/* @__PURE__ */ new Date());
|
|
415
|
-
const formattedMessage = customFormat(
|
|
416
|
-
level,
|
|
417
|
-
message,
|
|
418
|
-
timestamp,
|
|
419
|
-
LIBRARY_NAME,
|
|
420
|
-
...args
|
|
421
|
-
);
|
|
422
|
-
console.log(formattedMessage);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
};
|
|
362
|
+
});
|
|
363
|
+
var createLogger = (options) => {
|
|
426
364
|
return {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
break: () => {
|
|
430
|
-
console.log("\n");
|
|
365
|
+
log: (...args) => {
|
|
366
|
+
!options?.disabled && consola.log("", ...args);
|
|
431
367
|
},
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
options.
|
|
368
|
+
error: (...args) => {
|
|
369
|
+
!options?.disabled && consola.error("", ...args);
|
|
370
|
+
},
|
|
371
|
+
warn: (...args) => {
|
|
372
|
+
!options?.disabled && consola.warn("", ...args);
|
|
373
|
+
},
|
|
374
|
+
info: (...args) => {
|
|
375
|
+
!options?.disabled && consola.info("", ...args);
|
|
376
|
+
},
|
|
377
|
+
debug: (...args) => {
|
|
378
|
+
!options?.disabled && consola.debug("", ...args);
|
|
379
|
+
},
|
|
380
|
+
box: (...args) => {
|
|
381
|
+
!options?.disabled && consola.box("", ...args);
|
|
382
|
+
},
|
|
383
|
+
success: (...args) => {
|
|
384
|
+
!options?.disabled && consola.success("", ...args);
|
|
385
|
+
},
|
|
386
|
+
break: (...args) => {
|
|
387
|
+
!options?.disabled && console.log("\n");
|
|
437
388
|
}
|
|
438
389
|
};
|
|
439
|
-
}
|
|
390
|
+
};
|
|
440
391
|
var logger = createLogger();
|
|
441
392
|
|
|
442
393
|
// src/social-providers/google.ts
|
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-OZLnPypp.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-OZLnPypp.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-OZLnPypp.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-OZLnPypp.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-OZLnPypp.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4-beta.1",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"c12": "^1.11.2",
|
|
82
82
|
"chalk": "^5.3.0",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
|
+
"consola": "^3.2.3",
|
|
84
85
|
"defu": "^6.1.4",
|
|
85
86
|
"kysely": "^0.27.4",
|
|
86
87
|
"nanoid": "^5.0.7",
|