@better-auth/core 1.3.26 → 1.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.turbo/turbo-build.log +60 -9
  2. package/build.config.ts +7 -0
  3. package/dist/db/adapter/index.cjs +2 -0
  4. package/dist/db/adapter/index.d.cts +14 -0
  5. package/dist/db/adapter/index.d.mts +14 -0
  6. package/dist/db/adapter/index.d.ts +14 -0
  7. package/dist/db/adapter/index.mjs +1 -0
  8. package/dist/db/index.cjs +89 -0
  9. package/dist/db/index.d.cts +16 -107
  10. package/dist/db/index.d.mts +16 -107
  11. package/dist/db/index.d.ts +16 -107
  12. package/dist/db/index.mjs +69 -0
  13. package/dist/env/index.cjs +312 -0
  14. package/dist/env/index.d.cts +36 -0
  15. package/dist/env/index.d.mts +36 -0
  16. package/dist/env/index.d.ts +36 -0
  17. package/dist/env/index.mjs +297 -0
  18. package/dist/error/index.cjs +44 -0
  19. package/dist/error/index.d.cts +33 -0
  20. package/dist/error/index.d.mts +33 -0
  21. package/dist/error/index.d.ts +33 -0
  22. package/dist/error/index.mjs +41 -0
  23. package/dist/index.d.cts +179 -1
  24. package/dist/index.d.mts +179 -1
  25. package/dist/index.d.ts +179 -1
  26. package/dist/middleware/index.cjs +25 -0
  27. package/dist/middleware/index.d.cts +14 -0
  28. package/dist/middleware/index.d.mts +14 -0
  29. package/dist/middleware/index.d.ts +14 -0
  30. package/dist/middleware/index.mjs +21 -0
  31. package/dist/oauth2/index.cjs +368 -0
  32. package/dist/oauth2/index.d.cts +100 -0
  33. package/dist/oauth2/index.d.mts +100 -0
  34. package/dist/oauth2/index.d.ts +100 -0
  35. package/dist/oauth2/index.mjs +357 -0
  36. package/dist/shared/core.BJPBStdk.d.ts +1693 -0
  37. package/dist/shared/core.Bl6TpxyD.d.mts +181 -0
  38. package/dist/shared/core.Bqe5IGAi.d.ts +13 -0
  39. package/dist/shared/core.BwoNUcJQ.d.cts +53 -0
  40. package/dist/shared/core.BwoNUcJQ.d.mts +53 -0
  41. package/dist/shared/core.BwoNUcJQ.d.ts +53 -0
  42. package/dist/shared/core.CajxAutx.d.cts +143 -0
  43. package/dist/shared/core.CajxAutx.d.mts +143 -0
  44. package/dist/shared/core.CajxAutx.d.ts +143 -0
  45. package/dist/shared/core.CkkLHQWc.d.mts +1693 -0
  46. package/dist/shared/core.DkdZ1o38.d.ts +181 -0
  47. package/dist/shared/core.Dl-70uns.d.cts +84 -0
  48. package/dist/shared/core.Dl-70uns.d.mts +84 -0
  49. package/dist/shared/core.Dl-70uns.d.ts +84 -0
  50. package/dist/shared/core.DyEdx0m7.d.cts +181 -0
  51. package/dist/shared/core.E9DfzGLz.d.mts +13 -0
  52. package/dist/shared/core.HqYn20Fi.d.cts +13 -0
  53. package/dist/shared/core.gYIBmdi1.d.cts +1693 -0
  54. package/dist/social-providers/index.cjs +2793 -0
  55. package/dist/social-providers/index.d.cts +3903 -0
  56. package/dist/social-providers/index.d.mts +3903 -0
  57. package/dist/social-providers/index.d.ts +3903 -0
  58. package/dist/social-providers/index.mjs +2743 -0
  59. package/dist/utils/index.cjs +7 -0
  60. package/dist/utils/index.d.cts +10 -0
  61. package/dist/utils/index.d.mts +10 -0
  62. package/dist/utils/index.d.ts +10 -0
  63. package/dist/utils/index.mjs +5 -0
  64. package/package.json +109 -2
  65. package/src/db/adapter/index.ts +448 -0
  66. package/src/db/index.ts +13 -0
  67. package/src/db/plugin.ts +11 -0
  68. package/src/db/schema/account.ts +34 -0
  69. package/src/db/schema/rate-limit.ts +21 -0
  70. package/src/db/schema/session.ts +17 -0
  71. package/src/db/schema/shared.ts +7 -0
  72. package/src/db/schema/user.ts +16 -0
  73. package/src/db/schema/verification.ts +15 -0
  74. package/src/db/type.ts +50 -0
  75. package/src/env/color-depth.ts +172 -0
  76. package/src/env/env-impl.ts +123 -0
  77. package/src/env/index.ts +23 -0
  78. package/src/env/logger.test.ts +33 -0
  79. package/src/env/logger.ts +145 -0
  80. package/src/error/codes.ts +31 -0
  81. package/src/error/index.ts +11 -0
  82. package/src/index.ts +1 -1
  83. package/src/middleware/index.ts +33 -0
  84. package/src/oauth2/client-credentials-token.ts +102 -0
  85. package/src/oauth2/create-authorization-url.ts +85 -0
  86. package/src/oauth2/index.ts +22 -0
  87. package/src/oauth2/oauth-provider.ts +194 -0
  88. package/src/oauth2/refresh-access-token.ts +124 -0
  89. package/src/oauth2/utils.ts +36 -0
  90. package/src/oauth2/validate-authorization-code.ts +156 -0
  91. package/src/social-providers/apple.ts +213 -0
  92. package/src/social-providers/atlassian.ts +130 -0
  93. package/src/social-providers/cognito.ts +269 -0
  94. package/src/social-providers/discord.ts +172 -0
  95. package/src/social-providers/dropbox.ts +112 -0
  96. package/src/social-providers/facebook.ts +204 -0
  97. package/src/social-providers/figma.ts +115 -0
  98. package/src/social-providers/github.ts +154 -0
  99. package/src/social-providers/gitlab.ts +152 -0
  100. package/src/social-providers/google.ts +171 -0
  101. package/src/social-providers/huggingface.ts +116 -0
  102. package/src/social-providers/index.ts +118 -0
  103. package/src/social-providers/kakao.ts +178 -0
  104. package/src/social-providers/kick.ts +95 -0
  105. package/src/social-providers/line.ts +169 -0
  106. package/src/social-providers/linear.ts +120 -0
  107. package/src/social-providers/linkedin.ts +110 -0
  108. package/src/social-providers/microsoft-entra-id.ts +243 -0
  109. package/src/social-providers/naver.ts +112 -0
  110. package/src/social-providers/notion.ts +106 -0
  111. package/src/social-providers/paypal.ts +261 -0
  112. package/src/social-providers/reddit.ts +122 -0
  113. package/src/social-providers/roblox.ts +110 -0
  114. package/src/social-providers/salesforce.ts +157 -0
  115. package/src/social-providers/slack.ts +114 -0
  116. package/src/social-providers/spotify.ts +93 -0
  117. package/src/social-providers/tiktok.ts +211 -0
  118. package/src/social-providers/twitch.ts +111 -0
  119. package/src/social-providers/twitter.ts +194 -0
  120. package/src/social-providers/vk.ts +128 -0
  121. package/src/social-providers/zoom.ts +218 -0
  122. package/src/types/context.ts +313 -0
  123. package/src/types/cookie.ts +7 -0
  124. package/src/types/helper.ts +5 -0
  125. package/src/types/index.ts +20 -1
  126. package/src/types/init-options.ts +1161 -0
  127. package/src/types/plugin-client.ts +69 -0
  128. package/src/types/plugin.ts +134 -0
  129. package/src/utils/error-codes.ts +51 -0
  130. package/src/utils/index.ts +1 -0
package/dist/db/index.mjs CHANGED
@@ -1 +1,70 @@
1
+ import * as z from 'zod';
1
2
 
3
+ const coreSchema = z.object({
4
+ id: z.string(),
5
+ createdAt: z.date().default(() => /* @__PURE__ */ new Date()),
6
+ updatedAt: z.date().default(() => /* @__PURE__ */ new Date())
7
+ });
8
+
9
+ const userSchema = coreSchema.extend({
10
+ email: z.string().transform((val) => val.toLowerCase()),
11
+ emailVerified: z.boolean().default(false),
12
+ name: z.string(),
13
+ image: z.string().nullish()
14
+ });
15
+
16
+ const accountSchema = coreSchema.extend({
17
+ providerId: z.string(),
18
+ accountId: z.string(),
19
+ userId: z.coerce.string(),
20
+ accessToken: z.string().nullish(),
21
+ refreshToken: z.string().nullish(),
22
+ idToken: z.string().nullish(),
23
+ /**
24
+ * Access token expires at
25
+ */
26
+ accessTokenExpiresAt: z.date().nullish(),
27
+ /**
28
+ * Refresh token expires at
29
+ */
30
+ refreshTokenExpiresAt: z.date().nullish(),
31
+ /**
32
+ * The scopes that the user has authorized
33
+ */
34
+ scope: z.string().nullish(),
35
+ /**
36
+ * Password is only stored in the credential provider
37
+ */
38
+ password: z.string().nullish()
39
+ });
40
+
41
+ const sessionSchema = coreSchema.extend({
42
+ userId: z.coerce.string(),
43
+ expiresAt: z.date(),
44
+ token: z.string(),
45
+ ipAddress: z.string().nullish(),
46
+ userAgent: z.string().nullish()
47
+ });
48
+
49
+ const verificationSchema = coreSchema.extend({
50
+ value: z.string(),
51
+ expiresAt: z.date(),
52
+ identifier: z.string()
53
+ });
54
+
55
+ const rateLimitSchema = z.object({
56
+ /**
57
+ * The key to use for rate limiting
58
+ */
59
+ key: z.string(),
60
+ /**
61
+ * The number of requests made
62
+ */
63
+ count: z.number(),
64
+ /**
65
+ * The last request time in milliseconds
66
+ */
67
+ lastRequest: z.number()
68
+ });
69
+
70
+ export { accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
@@ -0,0 +1,312 @@
1
+ 'use strict';
2
+
3
+ const _envShim = /* @__PURE__ */ Object.create(null);
4
+ const _getEnv = (useShim) => globalThis.process?.env || //@ts-expect-error
5
+ globalThis.Deno?.env.toObject() || //@ts-expect-error
6
+ globalThis.__env__ || (useShim ? _envShim : globalThis);
7
+ const env = new Proxy(_envShim, {
8
+ get(_, prop) {
9
+ const env2 = _getEnv();
10
+ return env2[prop] ?? _envShim[prop];
11
+ },
12
+ has(_, prop) {
13
+ const env2 = _getEnv();
14
+ return prop in env2 || prop in _envShim;
15
+ },
16
+ set(_, prop, value) {
17
+ const env2 = _getEnv(true);
18
+ env2[prop] = value;
19
+ return true;
20
+ },
21
+ deleteProperty(_, prop) {
22
+ if (!prop) {
23
+ return false;
24
+ }
25
+ const env2 = _getEnv(true);
26
+ delete env2[prop];
27
+ return true;
28
+ },
29
+ ownKeys() {
30
+ const env2 = _getEnv(true);
31
+ return Object.keys(env2);
32
+ }
33
+ });
34
+ function toBoolean(val) {
35
+ return val ? val !== "false" : false;
36
+ }
37
+ const nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
38
+ const isProduction = nodeENV === "production";
39
+ const isDevelopment = nodeENV === "dev" || nodeENV === "development";
40
+ const isTest = () => nodeENV === "test" || toBoolean(env.TEST);
41
+ function getEnvVar(key, fallback) {
42
+ if (typeof process !== "undefined" && process.env) {
43
+ return process.env[key] ?? fallback;
44
+ }
45
+ if (typeof Deno !== "undefined") {
46
+ return Deno.env.get(key) ?? fallback;
47
+ }
48
+ if (typeof Bun !== "undefined") {
49
+ return Bun.env[key] ?? fallback;
50
+ }
51
+ return fallback;
52
+ }
53
+ function getBooleanEnvVar(key, fallback = true) {
54
+ const value = getEnvVar(key);
55
+ if (!value) return fallback;
56
+ return value !== "0" && value.toLowerCase() !== "false" && value !== "";
57
+ }
58
+ const ENV = Object.freeze({
59
+ get BETTER_AUTH_SECRET() {
60
+ return getEnvVar("BETTER_AUTH_SECRET");
61
+ },
62
+ get AUTH_SECRET() {
63
+ return getEnvVar("AUTH_SECRET");
64
+ },
65
+ get BETTER_AUTH_TELEMETRY() {
66
+ return getEnvVar("BETTER_AUTH_TELEMETRY");
67
+ },
68
+ get BETTER_AUTH_TELEMETRY_ID() {
69
+ return getEnvVar("BETTER_AUTH_TELEMETRY_ID");
70
+ },
71
+ get NODE_ENV() {
72
+ return getEnvVar("NODE_ENV", "development");
73
+ },
74
+ get PACKAGE_VERSION() {
75
+ return getEnvVar("PACKAGE_VERSION", "0.0.0");
76
+ },
77
+ get BETTER_AUTH_TELEMETRY_ENDPOINT() {
78
+ return getEnvVar(
79
+ "BETTER_AUTH_TELEMETRY_ENDPOINT",
80
+ "https://telemetry.better-auth.com/v1/track"
81
+ );
82
+ }
83
+ });
84
+
85
+ const COLORS_2 = 1;
86
+ const COLORS_16 = 4;
87
+ const COLORS_256 = 8;
88
+ const COLORS_16m = 24;
89
+ const TERM_ENVS = {
90
+ eterm: COLORS_16,
91
+ cons25: COLORS_16,
92
+ console: COLORS_16,
93
+ cygwin: COLORS_16,
94
+ dtterm: COLORS_16,
95
+ gnome: COLORS_16,
96
+ hurd: COLORS_16,
97
+ jfbterm: COLORS_16,
98
+ konsole: COLORS_16,
99
+ kterm: COLORS_16,
100
+ mlterm: COLORS_16,
101
+ mosh: COLORS_16m,
102
+ putty: COLORS_16,
103
+ st: COLORS_16,
104
+ // http://lists.schmorp.de/pipermail/rxvt-unicode/2016q2/002261.html
105
+ "rxvt-unicode-24bit": COLORS_16m,
106
+ // https://bugs.launchpad.net/terminator/+bug/1030562
107
+ terminator: COLORS_16m,
108
+ "xterm-kitty": COLORS_16m
109
+ };
110
+ const CI_ENVS_MAP = new Map(
111
+ Object.entries({
112
+ APPVEYOR: COLORS_256,
113
+ BUILDKITE: COLORS_256,
114
+ CIRCLECI: COLORS_16m,
115
+ DRONE: COLORS_256,
116
+ GITEA_ACTIONS: COLORS_16m,
117
+ GITHUB_ACTIONS: COLORS_16m,
118
+ GITLAB_CI: COLORS_256,
119
+ TRAVIS: COLORS_256
120
+ })
121
+ );
122
+ const TERM_ENVS_REG_EXP = [
123
+ /ansi/,
124
+ /color/,
125
+ /linux/,
126
+ /direct/,
127
+ /^con[0-9]*x[0-9]/,
128
+ /^rxvt/,
129
+ /^screen/,
130
+ /^xterm/,
131
+ /^vt100/,
132
+ /^vt220/
133
+ ];
134
+ function getColorDepth() {
135
+ if (getEnvVar("FORCE_COLOR") !== void 0) {
136
+ switch (getEnvVar("FORCE_COLOR")) {
137
+ case "":
138
+ case "1":
139
+ case "true":
140
+ return COLORS_16;
141
+ case "2":
142
+ return COLORS_256;
143
+ case "3":
144
+ return COLORS_16m;
145
+ default:
146
+ return COLORS_2;
147
+ }
148
+ }
149
+ if (getEnvVar("NODE_DISABLE_COLORS") !== void 0 && getEnvVar("NODE_DISABLE_COLORS") !== "" || // See https://no-color.org/
150
+ getEnvVar("NO_COLOR") !== void 0 && getEnvVar("NO_COLOR") !== "" || // The "dumb" special terminal, as defined by terminfo, doesn't support
151
+ // ANSI color control codes.
152
+ // See https://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials
153
+ getEnvVar("TERM") === "dumb") {
154
+ return COLORS_2;
155
+ }
156
+ if (getEnvVar("TMUX")) {
157
+ return COLORS_16m;
158
+ }
159
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
160
+ return COLORS_16;
161
+ }
162
+ if ("CI" in env) {
163
+ for (const { 0: envName, 1: colors } of CI_ENVS_MAP) {
164
+ if (envName in env) {
165
+ return colors;
166
+ }
167
+ }
168
+ if (getEnvVar("CI_NAME") === "codeship") {
169
+ return COLORS_256;
170
+ }
171
+ return COLORS_2;
172
+ }
173
+ if ("TEAMCITY_VERSION" in env) {
174
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(
175
+ getEnvVar("TEAMCITY_VERSION")
176
+ ) !== null ? COLORS_16 : COLORS_2;
177
+ }
178
+ switch (getEnvVar("TERM_PROGRAM")) {
179
+ case "iTerm.app":
180
+ if (!getEnvVar("TERM_PROGRAM_VERSION") || /^[0-2]\./.exec(getEnvVar("TERM_PROGRAM_VERSION")) !== null) {
181
+ return COLORS_256;
182
+ }
183
+ return COLORS_16m;
184
+ case "HyperTerm":
185
+ case "MacTerm":
186
+ return COLORS_16m;
187
+ case "Apple_Terminal":
188
+ return COLORS_256;
189
+ }
190
+ if (getEnvVar("COLORTERM") === "truecolor" || getEnvVar("COLORTERM") === "24bit") {
191
+ return COLORS_16m;
192
+ }
193
+ if (getEnvVar("TERM")) {
194
+ if (/truecolor/.exec(getEnvVar("TERM")) !== null) {
195
+ return COLORS_16m;
196
+ }
197
+ if (/^xterm-256/.exec(getEnvVar("TERM")) !== null) {
198
+ return COLORS_256;
199
+ }
200
+ const termEnv = getEnvVar("TERM").toLowerCase();
201
+ if (TERM_ENVS[termEnv]) {
202
+ return TERM_ENVS[termEnv];
203
+ }
204
+ if (TERM_ENVS_REG_EXP.some((term) => term.exec(termEnv) !== null)) {
205
+ return COLORS_16;
206
+ }
207
+ }
208
+ if (getEnvVar("COLORTERM")) {
209
+ return COLORS_16;
210
+ }
211
+ return COLORS_2;
212
+ }
213
+
214
+ const TTY_COLORS = {
215
+ reset: "\x1B[0m",
216
+ bright: "\x1B[1m",
217
+ dim: "\x1B[2m",
218
+ undim: "\x1B[22m",
219
+ underscore: "\x1B[4m",
220
+ blink: "\x1B[5m",
221
+ reverse: "\x1B[7m",
222
+ hidden: "\x1B[8m",
223
+ fg: {
224
+ black: "\x1B[30m",
225
+ red: "\x1B[31m",
226
+ green: "\x1B[32m",
227
+ yellow: "\x1B[33m",
228
+ blue: "\x1B[34m",
229
+ magenta: "\x1B[35m",
230
+ cyan: "\x1B[36m",
231
+ white: "\x1B[37m"
232
+ },
233
+ bg: {
234
+ black: "\x1B[40m",
235
+ red: "\x1B[41m",
236
+ green: "\x1B[42m",
237
+ yellow: "\x1B[43m",
238
+ blue: "\x1B[44m",
239
+ magenta: "\x1B[45m",
240
+ cyan: "\x1B[46m",
241
+ white: "\x1B[47m"
242
+ }
243
+ };
244
+ const levels = ["info", "success", "warn", "error", "debug"];
245
+ function shouldPublishLog(currentLogLevel, logLevel) {
246
+ return levels.indexOf(logLevel) <= levels.indexOf(currentLogLevel);
247
+ }
248
+ const levelColors = {
249
+ info: TTY_COLORS.fg.blue,
250
+ success: TTY_COLORS.fg.green,
251
+ warn: TTY_COLORS.fg.yellow,
252
+ error: TTY_COLORS.fg.red,
253
+ debug: TTY_COLORS.fg.magenta
254
+ };
255
+ const formatMessage = (level, message, colorsEnabled) => {
256
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
257
+ if (colorsEnabled) {
258
+ return `${TTY_COLORS.dim}${timestamp}${TTY_COLORS.reset} ${levelColors[level]}${level.toUpperCase()}${TTY_COLORS.reset} ${TTY_COLORS.bright}[Better Auth]:${TTY_COLORS.reset} ${message}`;
259
+ }
260
+ return `${timestamp} ${level.toUpperCase()} [Better Auth]: ${message}`;
261
+ };
262
+ const createLogger = (options) => {
263
+ const enabled = options?.disabled !== true;
264
+ const logLevel = options?.level ?? "error";
265
+ const isDisableColorsSpecified = options?.disableColors !== void 0;
266
+ const colorsEnabled = isDisableColorsSpecified ? !options.disableColors : getColorDepth() !== 1;
267
+ const LogFunc = (level, message, args = []) => {
268
+ if (!enabled || !shouldPublishLog(logLevel, level)) {
269
+ return;
270
+ }
271
+ const formattedMessage = formatMessage(level, message, colorsEnabled);
272
+ if (!options || typeof options.log !== "function") {
273
+ if (level === "error") {
274
+ console.error(formattedMessage, ...args);
275
+ } else if (level === "warn") {
276
+ console.warn(formattedMessage, ...args);
277
+ } else {
278
+ console.log(formattedMessage, ...args);
279
+ }
280
+ return;
281
+ }
282
+ options.log(level === "success" ? "info" : level, message, ...args);
283
+ };
284
+ const logger2 = Object.fromEntries(
285
+ levels.map((level) => [
286
+ level,
287
+ (...[message, ...args]) => LogFunc(level, message, args)
288
+ ])
289
+ );
290
+ return {
291
+ ...logger2,
292
+ get level() {
293
+ return logLevel;
294
+ }
295
+ };
296
+ };
297
+ const logger = createLogger();
298
+
299
+ exports.ENV = ENV;
300
+ exports.TTY_COLORS = TTY_COLORS;
301
+ exports.createLogger = createLogger;
302
+ exports.env = env;
303
+ exports.getBooleanEnvVar = getBooleanEnvVar;
304
+ exports.getColorDepth = getColorDepth;
305
+ exports.getEnvVar = getEnvVar;
306
+ exports.isDevelopment = isDevelopment;
307
+ exports.isProduction = isProduction;
308
+ exports.isTest = isTest;
309
+ exports.levels = levels;
310
+ exports.logger = logger;
311
+ exports.nodeENV = nodeENV;
312
+ exports.shouldPublishLog = shouldPublishLog;
@@ -0,0 +1,36 @@
1
+ export { I as InternalLogger, d as LogHandlerParams, b as LogLevel, L as Logger, T as TTY_COLORS, c as createLogger, a as levels, l as logger, s as shouldPublishLog } from '../shared/core.BwoNUcJQ.cjs';
2
+
3
+ type EnvObject = Record<string, string | undefined>;
4
+ declare const env: EnvObject;
5
+ declare const nodeENV: string;
6
+ /** Detect if `NODE_ENV` environment variable is `production` */
7
+ declare const isProduction: boolean;
8
+ /** Detect if `NODE_ENV` environment variable is `dev` or `development` */
9
+ declare const isDevelopment: boolean;
10
+ /** Detect if `NODE_ENV` environment variable is `test` */
11
+ declare const isTest: () => boolean;
12
+ /**
13
+ * Get environment variable with fallback
14
+ */
15
+ declare function getEnvVar<Fallback extends string>(key: string, fallback?: Fallback): Fallback extends string ? string : string | undefined;
16
+ /**
17
+ * Get boolean environment variable
18
+ */
19
+ declare function getBooleanEnvVar(key: string, fallback?: boolean): boolean;
20
+ /**
21
+ * Common environment variables used in Better Auth
22
+ */
23
+ declare const ENV: Readonly<{
24
+ readonly BETTER_AUTH_SECRET: string;
25
+ readonly AUTH_SECRET: string;
26
+ readonly BETTER_AUTH_TELEMETRY: string;
27
+ readonly BETTER_AUTH_TELEMETRY_ID: string;
28
+ readonly NODE_ENV: string;
29
+ readonly PACKAGE_VERSION: string;
30
+ readonly BETTER_AUTH_TELEMETRY_ENDPOINT: string;
31
+ }>;
32
+
33
+ declare function getColorDepth(): number;
34
+
35
+ export { ENV, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
36
+ export type { EnvObject };
@@ -0,0 +1,36 @@
1
+ export { I as InternalLogger, d as LogHandlerParams, b as LogLevel, L as Logger, T as TTY_COLORS, c as createLogger, a as levels, l as logger, s as shouldPublishLog } from '../shared/core.BwoNUcJQ.mjs';
2
+
3
+ type EnvObject = Record<string, string | undefined>;
4
+ declare const env: EnvObject;
5
+ declare const nodeENV: string;
6
+ /** Detect if `NODE_ENV` environment variable is `production` */
7
+ declare const isProduction: boolean;
8
+ /** Detect if `NODE_ENV` environment variable is `dev` or `development` */
9
+ declare const isDevelopment: boolean;
10
+ /** Detect if `NODE_ENV` environment variable is `test` */
11
+ declare const isTest: () => boolean;
12
+ /**
13
+ * Get environment variable with fallback
14
+ */
15
+ declare function getEnvVar<Fallback extends string>(key: string, fallback?: Fallback): Fallback extends string ? string : string | undefined;
16
+ /**
17
+ * Get boolean environment variable
18
+ */
19
+ declare function getBooleanEnvVar(key: string, fallback?: boolean): boolean;
20
+ /**
21
+ * Common environment variables used in Better Auth
22
+ */
23
+ declare const ENV: Readonly<{
24
+ readonly BETTER_AUTH_SECRET: string;
25
+ readonly AUTH_SECRET: string;
26
+ readonly BETTER_AUTH_TELEMETRY: string;
27
+ readonly BETTER_AUTH_TELEMETRY_ID: string;
28
+ readonly NODE_ENV: string;
29
+ readonly PACKAGE_VERSION: string;
30
+ readonly BETTER_AUTH_TELEMETRY_ENDPOINT: string;
31
+ }>;
32
+
33
+ declare function getColorDepth(): number;
34
+
35
+ export { ENV, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
36
+ export type { EnvObject };
@@ -0,0 +1,36 @@
1
+ export { I as InternalLogger, d as LogHandlerParams, b as LogLevel, L as Logger, T as TTY_COLORS, c as createLogger, a as levels, l as logger, s as shouldPublishLog } from '../shared/core.BwoNUcJQ.js';
2
+
3
+ type EnvObject = Record<string, string | undefined>;
4
+ declare const env: EnvObject;
5
+ declare const nodeENV: string;
6
+ /** Detect if `NODE_ENV` environment variable is `production` */
7
+ declare const isProduction: boolean;
8
+ /** Detect if `NODE_ENV` environment variable is `dev` or `development` */
9
+ declare const isDevelopment: boolean;
10
+ /** Detect if `NODE_ENV` environment variable is `test` */
11
+ declare const isTest: () => boolean;
12
+ /**
13
+ * Get environment variable with fallback
14
+ */
15
+ declare function getEnvVar<Fallback extends string>(key: string, fallback?: Fallback): Fallback extends string ? string : string | undefined;
16
+ /**
17
+ * Get boolean environment variable
18
+ */
19
+ declare function getBooleanEnvVar(key: string, fallback?: boolean): boolean;
20
+ /**
21
+ * Common environment variables used in Better Auth
22
+ */
23
+ declare const ENV: Readonly<{
24
+ readonly BETTER_AUTH_SECRET: string;
25
+ readonly AUTH_SECRET: string;
26
+ readonly BETTER_AUTH_TELEMETRY: string;
27
+ readonly BETTER_AUTH_TELEMETRY_ID: string;
28
+ readonly NODE_ENV: string;
29
+ readonly PACKAGE_VERSION: string;
30
+ readonly BETTER_AUTH_TELEMETRY_ENDPOINT: string;
31
+ }>;
32
+
33
+ declare function getColorDepth(): number;
34
+
35
+ export { ENV, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
36
+ export type { EnvObject };