@better-auth/core 1.4.6 → 1.4.7-beta.3
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/.turbo/turbo-build.log +23 -23
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.mjs +11 -6
- package/dist/async_hooks/index.d.mts +6 -2
- package/dist/async_hooks/index.mjs +19 -2
- package/dist/{index-Da4Ujjef.d.mts → async_hooks/pure.index.d.mts} +2 -2
- package/dist/async_hooks/pure.index.mjs +34 -0
- package/dist/context/index.d.mts +2 -2
- package/dist/context/index.mjs +1 -3
- package/dist/{context-su4uu82y.mjs → context-DblZrIwO.mjs} +1 -1
- package/dist/db/adapter/index.d.mts +1 -1
- package/dist/db/adapter/index.mjs +4 -4
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/env/index.d.mts +1 -1
- package/dist/env/index.mjs +1 -1
- package/dist/error/index.mjs +3 -3
- package/dist/{error-CMXuwPsa.mjs → error-CzMAIrPb.mjs} +1 -1
- package/dist/{index-D6KwwQy5.d.mts → index-NeeRjOR2.d.mts} +8 -8
- package/dist/index.d.mts +1 -1
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/oauth2/index.mjs +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.mjs +5 -5
- package/dist/utils/index.mjs +2 -2
- package/dist/{utils-BqQC77zO.mjs → utils-NloIXYE0.mjs} +1 -1
- package/package.json +11 -4
- package/src/api/index.ts +62 -9
- package/src/async_hooks/index.ts +0 -30
- package/src/async_hooks/pure.index.ts +46 -0
- package/src/context/endpoint-context.ts +2 -2
- package/src/context/request-state.ts +2 -2
- package/src/context/transaction.ts +2 -2
- package/src/db/adapter/index.ts +1 -1
- package/src/social-providers/facebook.ts +1 -1
- package/src/types/context.ts +1 -1
- package/tsdown.config.ts +2 -0
- package/dist/async_hooks-CrTStdt6.mjs +0 -45
- package/src/async_hooks/convex.spec.ts +0 -12
- /package/dist/{env-D6s-lvJz.mjs → env-DbssmzoK.mjs} +0 -0
- /package/dist/{get-tables-BGfrxIVZ.mjs → get-tables-DeuRhD_P.mjs} +0 -0
- /package/dist/{index-D4vfN5ui.d.mts → index-BRBu0-5h.d.mts} +0 -0
- /package/dist/{oauth2-7k48hhcV.mjs → oauth2-D2y9ALiO.mjs} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.
|
|
2
|
+
> @better-auth/core@1.4.7-beta.3 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
|
-
[34mℹ[39m tsdown [2mv0.17.
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.17.2[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
6
6
|
[34mℹ[39m config file: [4m/home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts[24m
|
|
7
|
-
[34mℹ[39m entry: [34msrc/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts[39m
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/async_hooks/pure.index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 80.
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 80.69 kB[22m [2m│ gzip: 10.32 kB[22m
|
|
11
11
|
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m 38.13 kB[22m [2m│ gzip: 7.79 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.66 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
13
|
-
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m
|
|
14
|
-
[34mℹ[39m [2mdist/[22m[
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 1.23 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1masync_hooks/index.mjs[22m [2m 1.03 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1masync_hooks/pure.index.mjs[22m [2m 0.99 kB[22m [2m│ gzip: 0.49 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.70 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
15
17
|
[34mℹ[39m [2mdist/[22m[1moauth2/index.mjs[22m [2m 0.61 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
16
18
|
[34mℹ[39m [2mdist/[22m[1menv/index.mjs[22m [2m 0.44 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
17
19
|
[34mℹ[39m [2mdist/[22m[1mutils/index.mjs[22m [2m 0.24 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
18
20
|
[34mℹ[39m [2mdist/[22m[1merror/index.mjs[22m [2m 0.19 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22m[1masync_hooks/index.mjs[22m [2m 0.14 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
20
21
|
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
21
|
-
[34mℹ[39m [2mdist/[22moauth2-
|
|
22
|
-
[34mℹ[39m [2mdist/[22menv-
|
|
23
|
-
[34mℹ[39m [2mdist/[22mget-tables-
|
|
24
|
-
[34mℹ[39m [2mdist/[22mcontext-
|
|
25
|
-
[34mℹ[39m [2mdist/[22merror-
|
|
26
|
-
[34mℹ[39m [2mdist/[
|
|
27
|
-
[34mℹ[39m [2mdist/[22mutils-BqQC77zO.mjs [2m 1.10 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22moauth2-D2y9ALiO.mjs [2m 9.19 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22menv-DbssmzoK.mjs [2m 7.67 kB[22m [2m│ gzip: 2.54 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22mget-tables-DeuRhD_P.mjs [2m 6.67 kB[22m [2m│ gzip: 1.29 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22mcontext-DblZrIwO.mjs [2m 3.89 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22merror-CzMAIrPb.mjs [2m 1.77 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22mutils-NloIXYE0.mjs [2m 1.10 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
28
28
|
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.88 kB[22m [2m│ gzip: 1.19 kB[22m
|
|
29
|
-
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.02 kB[22m [2m│ gzip: 0.
|
|
29
|
+
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.02 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
30
30
|
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 1.84 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
31
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
32
32
|
[34mℹ[39m [2mdist/[22m[32m[1mutils/index.d.mts[22m[39m [2m 1.19 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
33
33
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/index.d.mts[22m[39m [2m 1.04 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.86 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
35
|
-
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
36
36
|
[34mℹ[39m [2mdist/[22m[32m[1menv/index.d.mts[22m[39m [2m 0.59 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
37
37
|
[34mℹ[39m [2mdist/[22m[32m[1mapi/index.d.mts[22m[39m [2m 0.26 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
38
|
-
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.
|
|
39
|
-
[34mℹ[39m [2mdist/[22m[
|
|
40
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
41
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
42
|
-
[34mℹ[39m 32 files, total:
|
|
43
|
-
[32m✔[39m Build complete in [
|
|
38
|
+
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
39
|
+
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/pure.index.d.mts[22m[39m [2m 0.22 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
40
|
+
[34mℹ[39m [2mdist/[22m[32mindex-NeeRjOR2.d.mts[39m [2m218.68 kB[22m [2m│ gzip: 34.40 kB[22m
|
|
41
|
+
[34mℹ[39m [2mdist/[22m[32mindex-BRBu0-5h.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
42
|
+
[34mℹ[39m 32 files, total: 393.46 kB
|
|
43
|
+
[32m✔[39m Build complete in [32m4810ms[39m
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-NeeRjOR2.mjs";
|
|
2
2
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../async_hooks-CrTStdt6.mjs";
|
|
3
|
-
import { f as runWithEndpointContext } from "../context-su4uu82y.mjs";
|
|
1
|
+
import { f as runWithEndpointContext } from "../context-DblZrIwO.mjs";
|
|
4
2
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
5
3
|
|
|
6
4
|
//#region src/api/index.ts
|
|
@@ -16,12 +14,19 @@ const createAuthMiddleware = createMiddleware.create({ use: [optionsMiddleware,
|
|
|
16
14
|
return {};
|
|
17
15
|
})] });
|
|
18
16
|
const use = [optionsMiddleware];
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
function createAuthEndpoint(pathOrOptions, handlerOrOptions, handlerOrNever) {
|
|
18
|
+
const path = typeof pathOrOptions === "string" ? pathOrOptions : void 0;
|
|
19
|
+
const options = typeof handlerOrOptions === "object" ? handlerOrOptions : pathOrOptions;
|
|
20
|
+
const handler = typeof handlerOrOptions === "function" ? handlerOrOptions : handlerOrNever;
|
|
21
|
+
if (path) return createEndpoint(path, {
|
|
21
22
|
...options,
|
|
22
23
|
use: [...options?.use || [], ...use]
|
|
23
24
|
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
24
|
-
|
|
25
|
+
return createEndpoint({
|
|
26
|
+
...options,
|
|
27
|
+
use: [...options?.use || [], ...use]
|
|
28
|
+
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
29
|
+
}
|
|
25
30
|
|
|
26
31
|
//#endregion
|
|
27
32
|
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/async_hooks/index.d.ts
|
|
4
|
+
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/async_hooks/index.ts
|
|
2
|
+
const AsyncLocalStoragePromise = import(
|
|
3
|
+
/* @vite-ignore */
|
|
4
|
+
/* webpackIgnore: true */
|
|
5
|
+
"node:async_hooks"
|
|
6
|
+
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
7
|
+
if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
|
|
8
|
+
if (typeof window !== "undefined") return null;
|
|
9
|
+
console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
|
|
10
|
+
console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
|
|
11
|
+
console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
|
|
12
|
+
throw err;
|
|
13
|
+
});
|
|
14
|
+
async function getAsyncLocalStorage() {
|
|
15
|
+
const mod = await AsyncLocalStoragePromise;
|
|
16
|
+
if (mod === null) throw new Error("getAsyncLocalStorage is only available in server code");
|
|
17
|
+
else return mod;
|
|
18
|
+
}
|
|
3
19
|
|
|
20
|
+
//#endregion
|
|
4
21
|
export { getAsyncLocalStorage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
|
|
3
|
-
//#region src/async_hooks/index.d.ts
|
|
3
|
+
//#region src/async_hooks/pure.index.d.ts
|
|
4
4
|
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { getAsyncLocalStorage
|
|
6
|
+
export { getAsyncLocalStorage };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/async_hooks/pure.index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Due to the lack of AsyncLocalStorage in some environments (like Convex),
|
|
4
|
+
*
|
|
5
|
+
* We assume serverless functions are short-lived and single-threaded, so we can use a simple polyfill.
|
|
6
|
+
*/
|
|
7
|
+
var AsyncLocalStoragePolyfill = class {
|
|
8
|
+
#current = void 0;
|
|
9
|
+
run(store, fn) {
|
|
10
|
+
const prev = this.#current;
|
|
11
|
+
this.#current = store;
|
|
12
|
+
const result = fn();
|
|
13
|
+
if (result instanceof Promise) return result.finally(() => {
|
|
14
|
+
this.#current = prev;
|
|
15
|
+
});
|
|
16
|
+
this.#current = prev;
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
getStore() {
|
|
20
|
+
return this.#current;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const AsyncLocalStoragePromise = Promise.resolve().then(() => {
|
|
24
|
+
if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
|
|
25
|
+
return AsyncLocalStoragePolyfill;
|
|
26
|
+
});
|
|
27
|
+
async function getAsyncLocalStorage() {
|
|
28
|
+
const mod = await AsyncLocalStoragePromise;
|
|
29
|
+
if (mod === null) throw new Error("getAsyncLocalStorage is only available in server code");
|
|
30
|
+
else return mod;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { getAsyncLocalStorage };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-
|
|
2
|
-
import {
|
|
1
|
+
import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-NeeRjOR2.mjs";
|
|
2
|
+
import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
3
|
import { EndpointContext, InputContext } from "better-call";
|
|
4
4
|
|
|
5
5
|
//#region src/context/endpoint-context.d.ts
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../async_hooks-CrTStdt6.mjs";
|
|
3
|
-
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-su4uu82y.mjs";
|
|
1
|
+
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-DblZrIwO.mjs";
|
|
4
2
|
|
|
5
3
|
export { defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $n as JoinOption, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, _r as initGetIdField, ar as createAdapterFactory, br as initGetDefaultModelName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, gr as initGetModelName, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetFieldName, xr as initGetDefaultFieldName, yr as initGetFieldAttributes } from "../../index-
|
|
1
|
+
import { $n as JoinOption, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, _r as initGetIdField, ar as createAdapterFactory, br as initGetDefaultModelName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, gr as initGetModelName, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetFieldName, xr as initGetDefaultFieldName, yr as initGetFieldAttributes } from "../../index-NeeRjOR2.mjs";
|
|
2
2
|
export { AdapterConfig, AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CreateAdapterOptions, CreateCustomAdapter, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, createAdapter, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, withApplyDefault };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as getAuthTables } from "../../get-tables-
|
|
2
|
-
import { i as logger, n as createLogger, o as getColorDepth, t as TTY_COLORS } from "../../env-
|
|
3
|
-
import { n as safeJSONParse, r as generateId } from "../../utils-
|
|
4
|
-
import { t as BetterAuthError } from "../../error-
|
|
1
|
+
import { t as getAuthTables } from "../../get-tables-DeuRhD_P.mjs";
|
|
2
|
+
import { i as logger, n as createLogger, o as getColorDepth, t as TTY_COLORS } from "../../env-DbssmzoK.mjs";
|
|
3
|
+
import { n as safeJSONParse, r as generateId } from "../../utils-NloIXYE0.mjs";
|
|
4
|
+
import { t as BetterAuthError } from "../../error-CzMAIrPb.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/db/adapter/get-default-model-name.ts
|
|
7
7
|
const initGetDefaultModelName = ({ usePlural, schema }) => {
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ar as verificationSchema, Br as BetterAuthPluginDBSchema, Cr as BetterAuthDbSchema, Dr as Primitive, Er as FieldType, Fr as sessionSchema, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as RateLimit, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as rateLimitSchema, Mr as userSchema, Nr as coreSchema, Or as getAuthTables, Pr as Session, Rr as Account, Sr as AuthPluginSchema, Tr as FieldAttributeConfig, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as User, kr as Verification, qr as ModelNames, wr as FieldAttribute, zr as accountSchema } from "../index-
|
|
1
|
+
import { Ar as verificationSchema, Br as BetterAuthPluginDBSchema, Cr as BetterAuthDbSchema, Dr as Primitive, Er as FieldType, Fr as sessionSchema, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as RateLimit, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as rateLimitSchema, Mr as userSchema, Nr as coreSchema, Or as getAuthTables, Pr as Session, Rr as Account, Sr as AuthPluginSchema, Tr as FieldAttributeConfig, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as User, kr as Verification, qr as ModelNames, wr as FieldAttribute, zr as accountSchema } from "../index-NeeRjOR2.mjs";
|
|
2
2
|
export { Account, AuthPluginSchema, BaseModelNames, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, ModelNames, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/db/index.mjs
CHANGED
package/dist/env/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-
|
|
1
|
+
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-BRBu0-5h.mjs";
|
|
2
2
|
export { ENV, EnvObject, InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
package/dist/env/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-
|
|
1
|
+
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-DbssmzoK.mjs";
|
|
2
2
|
|
|
3
3
|
export { ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
package/dist/error/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../env-
|
|
2
|
-
import "../utils-
|
|
3
|
-
import { n as BASE_ERROR_CODES, t as BetterAuthError } from "../error-
|
|
1
|
+
import "../env-DbssmzoK.mjs";
|
|
2
|
+
import "../utils-NloIXYE0.mjs";
|
|
3
|
+
import { n as BASE_ERROR_CODES, t as BetterAuthError } from "../error-CzMAIrPb.mjs";
|
|
4
4
|
|
|
5
5
|
export { BASE_ERROR_CODES, BetterAuthError };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as Logger, o as createLogger } from "./index-
|
|
1
|
+
import { i as Logger, o as createLogger } from "./index-BRBu0-5h.mjs";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from "@better-fetch/fetch";
|
|
4
4
|
import * as jose0 from "jose";
|
|
5
5
|
import * as better_call0 from "better-call";
|
|
6
|
-
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
|
|
6
|
+
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware, StrictEndpoint } from "better-call";
|
|
7
7
|
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
9
|
import { DatabaseSync } from "node:sqlite";
|
|
@@ -924,7 +924,7 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
924
924
|
where: Where[];
|
|
925
925
|
update: Record<string, any>;
|
|
926
926
|
}) => Promise<number>;
|
|
927
|
-
delete: <
|
|
927
|
+
delete: <_T>(data: {
|
|
928
928
|
model: string;
|
|
929
929
|
where: Where[];
|
|
930
930
|
}) => Promise<void>;
|
|
@@ -7461,7 +7461,7 @@ type BetterAuthOptions = {
|
|
|
7461
7461
|
type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOptions> = EndpointContext<string, any> & {
|
|
7462
7462
|
context: AuthContext<Options>;
|
|
7463
7463
|
};
|
|
7464
|
-
interface InternalAdapter<
|
|
7464
|
+
interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions> {
|
|
7465
7465
|
createOAuthUser(user: Omit<User, "id" | "createdAt" | "updatedAt">, account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<{
|
|
7466
7466
|
user: User;
|
|
7467
7467
|
account: Account;
|
|
@@ -7744,10 +7744,10 @@ declare const createAuthMiddleware: {
|
|
|
7744
7744
|
responseHeaders?: Headers | undefined;
|
|
7745
7745
|
}>) => Promise<R_1>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R_1>;
|
|
7746
7746
|
};
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
type AuthEndpoint = ReturnType<typeof createAuthEndpoint
|
|
7747
|
+
type EndpointHandler<Path extends string, Options extends EndpointOptions, R> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
7748
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(path: Path, options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
7749
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
7750
|
+
type AuthEndpoint<Path extends string, Opts extends EndpointOptions, R> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
7751
7751
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
7752
7752
|
//#endregion
|
|
7753
7753
|
export { AccountStatus as $, JoinOption as $n, GoogleProfile as $t, PolarOptions as A, createAuthorizationCodeRequest as An, verificationSchema as Ar, linear as At, LineIdTokenPayload as B, OAuth2Tokens as Bn, BetterAuthPluginDBSchema as Br, TwitchOptions as Bt, SocialProviderListEnum as C, atlassian as Cn, BetterAuthDbSchema as Cr, gitlab as Ct, VercelOptions as D, apple as Dn, Primitive$1 as Dr, LinearOptions as Dt, socialProviders as E, AppleProfile as En, FieldType as Er, linkedin as Et, PayPalTokenResponse as F, createRefreshAccessTokenRequest as Fn, sessionSchema as Fr, DropboxProfile as Ft, NaverProfile as G, CustomAdapter as Gn, DBFieldType as Gr, spotify as Gt, LineUserInfo as H, OAuthProvider as Hn, BetterAuthDBSchema as Hr, twitch as Ht, paypal as I, refreshAccessToken as In, RateLimit as Ir, dropbox as It, KakaoProfile as J, DBAdapterFactoryConfig as Jn, SecondaryStorage as Jr, slack as Jt, naver as K, DBAdapter as Kn, DBPrimitive as Kr, SlackOptions as Kt, PaybinOptions as L, createAuthorizationURL as Ln, rateLimitSchema as Lr, TwitterOption as Lt, polar as M, validateToken as Mn, userSchema as Mr, KickProfile as Mt, PayPalOptions as N, generateCodeChallenge as Nn, coreSchema as Nr, kick as Nt, VercelProfile as O, getApplePublicKey as On, getAuthTables as Or, LinearProfile as Ot, PayPalProfile as P, getOAuth2Tokens as Pn, Session as Pr, DropboxOptions as Pt, notion as Q, JoinConfig as Qn, GoogleOptions as Qt, PaybinProfile as R, clientCredentialsToken as Rn, Account as Rr, TwitterProfile as Rt, SocialProviderList as S, AtlassianProfile as Sn, AuthPluginSchema as Sr, GitlabProfile as St, socialProviderList as T, AppleOptions as Tn, FieldAttributeConfig as Tr, LinkedInProfile as Tt, line as U, ProviderOptions as Un, DBFieldAttribute as Ur, SpotifyOptions as Ut, LineOptions as V, OAuth2UserInfo as Vn, BaseModelNames as Vr, TwitchProfile as Vt, NaverOptions as W, CleanedWhere as Wn, DBFieldAttributeConfig as Wr, SpotifyProfile as Wt, NotionOptions as X, DBAdapterSchemaCreation as Xn, HuggingFaceProfile as Xt, kakao as Y, DBAdapterInstance as Yn, HuggingFaceOptions as Yt, NotionProfile as Z, DBTransactionAdapter as Zn, huggingface as Zt, BetterAuthRateLimitOptions as _, CognitoOptions as _n, initGetIdField as _r, reddit as _t, optionsMiddleware as a, GithubOptions as an, createAdapterFactory as ar, zoom as at, HookEndpointContext as b, getCognitoPublicKey as bn, initGetDefaultModelName as br, tiktok as bt, BetterAuthClientPlugin as c, FigmaOptions as cn, AdapterFactoryCustomizeAdapterCreator as cr, vk as ct, ClientStore as d, FacebookOptions as dn, CreateAdapterOptions as dr, salesforce as dt, getGooglePublicKey as en, Where as er, LoginType as et, AuthContext as f, FacebookProfile as fn, CreateCustomAdapter as fr, RobloxOptions as ft, BetterAuthOptions as g, discord as gn, initGetModelName as gr, RedditProfile as gt, BetterAuthAdvancedOptions as h, DiscordProfile as hn, Prettify as hr, RedditOptions as ht, createAuthMiddleware as i, microsoft as in, createAdapter as ir, ZoomProfile as it, PolarProfile as j, validateAuthorizationCode as jn, User as jr, KickOptions as jt, vercel as k, BetterAuthCookies as kn, Verification as kr, LinearUser as kt, ClientAtomListener as l, FigmaProfile as ln, AdapterFactoryOptions as lr, SalesforceOptions as lt, InternalAdapter as m, DiscordOptions as mn, LiteralUnion as mr, roblox as mt, AuthMiddleware as n, MicrosoftEntraIDProfile as nn, withApplyDefault as nr, PronounOption as nt, StandardSchemaV1$1 as o, GithubProfile as on, AdapterConfig as or, VkOption as ot, GenericEndpointContext as p, facebook as pn, LiteralString as pr, RobloxProfile as pt, KakaoOptions as q, DBAdapterDebugLogOption as qn, ModelNames as qr, SlackProfile as qt, createAuthEndpoint as r, MicrosoftOptions as rn, AdapterFactory as rr, ZoomOptions as rt, BetterAuthClientOptions as s, github as sn, AdapterFactoryConfig as sr, VkProfile as st, AuthEndpoint as t, google as tn, deepmerge as tr, PhoneNumber as tt, ClientFetchOption as u, figma as un, AdapterTestDebugLogs as ur, SalesforceProfile as ut, GenerateIdFn as v, CognitoProfile as vn, initGetFieldName as vr, TiktokOptions as vt, SocialProviders as w, AppleNonConformUser as wn, FieldAttribute as wr, LinkedInOptions as wt, SocialProvider as x, AtlassianOptions as xn, initGetDefaultFieldName as xr, GitlabOptions as xt, BetterAuthPlugin as y, cognito as yn, initGetFieldAttributes as yr, TiktokProfile as yt, paybin as z, createClientCredentialsTokenRequest as zn, accountSchema as zr, twitter as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, hr as Prettify, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralUnion, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralString, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-
|
|
1
|
+
import { _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, hr as Prettify, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralUnion, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralString, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-NeeRjOR2.mjs";
|
|
2
2
|
export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, StandardSchemaV1 };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-
|
|
1
|
+
import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-NeeRjOR2.mjs";
|
|
2
2
|
export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
package/dist/oauth2/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as refreshAccessToken, c as getOAuth2Tokens, i as createRefreshAccessTokenRequest, l as clientCredentialsToken, n as validateAuthorizationCode, o as createAuthorizationURL, r as validateToken, s as generateCodeChallenge, t as createAuthorizationCodeRequest, u as createClientCredentialsTokenRequest } from "../oauth2-
|
|
1
|
+
import { a as refreshAccessToken, c as getOAuth2Tokens, i as createRefreshAccessTokenRequest, l as clientCredentialsToken, n as validateAuthorizationCode, o as createAuthorizationURL, r as validateToken, s as generateCodeChallenge, t as createAuthorizationCodeRequest, u as createClientCredentialsTokenRequest } from "../oauth2-D2y9ALiO.mjs";
|
|
2
2
|
|
|
3
3
|
export { clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-
|
|
1
|
+
import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-NeeRjOR2.mjs";
|
|
2
2
|
export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VercelOptions, VercelProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vercel, vk, zoom };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as logger } from "../env-
|
|
2
|
-
import "../utils-
|
|
3
|
-
import { t as BetterAuthError } from "../error-
|
|
4
|
-
import { a as refreshAccessToken, c as getOAuth2Tokens, n as validateAuthorizationCode, o as createAuthorizationURL, s as generateCodeChallenge } from "../oauth2-
|
|
1
|
+
import { i as logger } from "../env-DbssmzoK.mjs";
|
|
2
|
+
import "../utils-NloIXYE0.mjs";
|
|
3
|
+
import { t as BetterAuthError } from "../error-CzMAIrPb.mjs";
|
|
4
|
+
import { a as refreshAccessToken, c as getOAuth2Tokens, n as validateAuthorizationCode, o as createAuthorizationURL, s as generateCodeChallenge } from "../oauth2-D2y9ALiO.mjs";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { base64 } from "@better-auth/utils/base64";
|
|
7
7
|
import { betterFetch } from "@better-fetch/fetch";
|
|
@@ -484,7 +484,7 @@ const facebook = (options) => {
|
|
|
484
484
|
});
|
|
485
485
|
if (nonce && jwtClaims.nonce !== nonce) return false;
|
|
486
486
|
return !!jwtClaims;
|
|
487
|
-
} catch
|
|
487
|
+
} catch {
|
|
488
488
|
return false;
|
|
489
489
|
}
|
|
490
490
|
return true;
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../env-
|
|
2
|
-
import { i as defineErrorCodes, n as safeJSONParse, r as generateId, t as capitalizeFirstLetter } from "../utils-
|
|
1
|
+
import "../env-DbssmzoK.mjs";
|
|
2
|
+
import { i as defineErrorCodes, n as safeJSONParse, r as generateId, t as capitalizeFirstLetter } from "../utils-NloIXYE0.mjs";
|
|
3
3
|
|
|
4
4
|
export { capitalizeFirstLetter, defineErrorCodes, generateId, safeJSONParse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7-beta.3",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
"./async_hooks": {
|
|
26
26
|
"dev-source": "./src/async_hooks/index.ts",
|
|
27
27
|
"types": "./dist/async_hooks/index.d.mts",
|
|
28
|
+
"node": "./dist/async_hooks/index.mjs",
|
|
29
|
+
"deno": "./dist/async_hooks/index.mjs",
|
|
30
|
+
"bun": "./dist/async_hooks/index.mjs",
|
|
31
|
+
"edge": "./dist/async_hooks/pure.index.mjs",
|
|
32
|
+
"workerd": "./dist/async_hooks/index.mjs",
|
|
33
|
+
"browser": "./dist/async_hooks/pure.index.mjs",
|
|
28
34
|
"default": "./dist/async_hooks/index.mjs"
|
|
29
35
|
},
|
|
30
36
|
"./context": {
|
|
@@ -107,12 +113,12 @@
|
|
|
107
113
|
},
|
|
108
114
|
"devDependencies": {
|
|
109
115
|
"@better-auth/utils": "0.3.0",
|
|
110
|
-
"@better-fetch/fetch": "1.1.
|
|
116
|
+
"@better-fetch/fetch": "1.1.21",
|
|
111
117
|
"better-call": "1.1.5",
|
|
112
118
|
"jose": "^6.1.0",
|
|
113
119
|
"kysely": "^0.28.5",
|
|
114
120
|
"nanostores": "^1.0.1",
|
|
115
|
-
"tsdown": "^0.17.
|
|
121
|
+
"tsdown": "^0.17.2"
|
|
116
122
|
},
|
|
117
123
|
"dependencies": {
|
|
118
124
|
"@standard-schema/spec": "^1.0.0",
|
|
@@ -120,7 +126,7 @@
|
|
|
120
126
|
},
|
|
121
127
|
"peerDependencies": {
|
|
122
128
|
"@better-auth/utils": "0.3.0",
|
|
123
|
-
"@better-fetch/fetch": "1.1.
|
|
129
|
+
"@better-fetch/fetch": "1.1.21",
|
|
124
130
|
"better-call": "1.1.5",
|
|
125
131
|
"jose": "^6.1.0",
|
|
126
132
|
"kysely": "^0.28.5",
|
|
@@ -130,6 +136,7 @@
|
|
|
130
136
|
"build": "tsdown",
|
|
131
137
|
"dev": "tsdown --watch",
|
|
132
138
|
"lint:package": "publint run --strict",
|
|
139
|
+
"lint:types": "attw --profile esm-only --pack .",
|
|
133
140
|
"typecheck": "tsc --project tsconfig.json",
|
|
134
141
|
"test": "vitest",
|
|
135
142
|
"coverage": "vitest run --coverage"
|
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
EndpointContext,
|
|
3
|
+
EndpointOptions,
|
|
4
|
+
StrictEndpoint,
|
|
5
|
+
} from "better-call";
|
|
2
6
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
3
7
|
import { runWithEndpointContext } from "../context";
|
|
4
8
|
import type { AuthContext } from "../types";
|
|
@@ -29,17 +33,62 @@ export const createAuthMiddleware = createMiddleware.create({
|
|
|
29
33
|
|
|
30
34
|
const use = [optionsMiddleware];
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
type EndpointHandler<
|
|
33
37
|
Path extends string,
|
|
34
|
-
|
|
38
|
+
Options extends EndpointOptions,
|
|
39
|
+
R,
|
|
40
|
+
> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
41
|
+
|
|
42
|
+
export function createAuthEndpoint<
|
|
43
|
+
Path extends string,
|
|
44
|
+
Options extends EndpointOptions,
|
|
35
45
|
R,
|
|
36
46
|
>(
|
|
37
47
|
path: Path,
|
|
38
|
-
options:
|
|
39
|
-
handler:
|
|
40
|
-
)
|
|
48
|
+
options: Options,
|
|
49
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
50
|
+
): StrictEndpoint<Path, Options, R>;
|
|
51
|
+
|
|
52
|
+
export function createAuthEndpoint<
|
|
53
|
+
Path extends string,
|
|
54
|
+
Options extends EndpointOptions,
|
|
55
|
+
R,
|
|
56
|
+
>(
|
|
57
|
+
options: Options,
|
|
58
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
59
|
+
): StrictEndpoint<Path, Options, R>;
|
|
60
|
+
|
|
61
|
+
export function createAuthEndpoint<
|
|
62
|
+
Path extends string,
|
|
63
|
+
Opts extends EndpointOptions,
|
|
64
|
+
R,
|
|
65
|
+
>(
|
|
66
|
+
pathOrOptions: Path | Opts,
|
|
67
|
+
handlerOrOptions: EndpointHandler<Path, Opts, R> | Opts,
|
|
68
|
+
handlerOrNever?: any,
|
|
69
|
+
) {
|
|
70
|
+
const path: Path | undefined =
|
|
71
|
+
typeof pathOrOptions === "string" ? pathOrOptions : undefined;
|
|
72
|
+
const options: Opts =
|
|
73
|
+
typeof handlerOrOptions === "object"
|
|
74
|
+
? handlerOrOptions
|
|
75
|
+
: (pathOrOptions as Opts);
|
|
76
|
+
const handler: EndpointHandler<Path, Opts, R> =
|
|
77
|
+
typeof handlerOrOptions === "function" ? handlerOrOptions : handlerOrNever;
|
|
78
|
+
|
|
79
|
+
if (path) {
|
|
80
|
+
return createEndpoint(
|
|
81
|
+
path,
|
|
82
|
+
{
|
|
83
|
+
...options,
|
|
84
|
+
use: [...(options?.use || []), ...use],
|
|
85
|
+
},
|
|
86
|
+
// todo: prettify the code, we want to call `runWithEndpointContext` to top level
|
|
87
|
+
async (ctx) => runWithEndpointContext(ctx as any, () => handler(ctx)),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
41
91
|
return createEndpoint(
|
|
42
|
-
path,
|
|
43
92
|
{
|
|
44
93
|
...options,
|
|
45
94
|
use: [...(options?.use || []), ...use],
|
|
@@ -47,7 +96,11 @@ export const createAuthEndpoint = <
|
|
|
47
96
|
// todo: prettify the code, we want to call `runWithEndpointContext` to top level
|
|
48
97
|
async (ctx) => runWithEndpointContext(ctx as any, () => handler(ctx)),
|
|
49
98
|
);
|
|
50
|
-
}
|
|
99
|
+
}
|
|
51
100
|
|
|
52
|
-
export type AuthEndpoint
|
|
101
|
+
export type AuthEndpoint<
|
|
102
|
+
Path extends string,
|
|
103
|
+
Opts extends EndpointOptions,
|
|
104
|
+
R,
|
|
105
|
+
> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
53
106
|
export type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
package/src/async_hooks/index.ts
CHANGED
|
@@ -1,34 +1,7 @@
|
|
|
1
1
|
import type { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { env } from "../env";
|
|
3
2
|
|
|
4
3
|
export type { AsyncLocalStorage };
|
|
5
4
|
|
|
6
|
-
/**
|
|
7
|
-
* Due to the lack of AsyncLocalStorage in some environments (like Convex),
|
|
8
|
-
*
|
|
9
|
-
* We assume serverless functions are short-lived and single-threaded, so we can use a simple polyfill.
|
|
10
|
-
*/
|
|
11
|
-
class AsyncLocalStoragePolyfill<T> {
|
|
12
|
-
#current: T | undefined = undefined;
|
|
13
|
-
|
|
14
|
-
run(store: T, fn: () => unknown): unknown {
|
|
15
|
-
const prev = this.#current;
|
|
16
|
-
this.#current = store;
|
|
17
|
-
const result = fn();
|
|
18
|
-
if (result instanceof Promise) {
|
|
19
|
-
return result.finally(() => {
|
|
20
|
-
this.#current = prev;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
this.#current = prev;
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getStore(): T | undefined {
|
|
28
|
-
return this.#current;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
5
|
const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage | null> =
|
|
33
6
|
import(
|
|
34
7
|
/* @vite-ignore */
|
|
@@ -43,9 +16,6 @@ const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage | null> =
|
|
|
43
16
|
if (typeof window !== "undefined") {
|
|
44
17
|
return null;
|
|
45
18
|
}
|
|
46
|
-
if (env["CONVEX_CLOUD_URL"] || env["CONVEX_SITE_URL"]) {
|
|
47
|
-
return AsyncLocalStoragePolyfill;
|
|
48
|
-
}
|
|
49
19
|
console.warn(
|
|
50
20
|
"[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.",
|
|
51
21
|
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Due to the lack of AsyncLocalStorage in some environments (like Convex),
|
|
5
|
+
*
|
|
6
|
+
* We assume serverless functions are short-lived and single-threaded, so we can use a simple polyfill.
|
|
7
|
+
*/
|
|
8
|
+
class AsyncLocalStoragePolyfill<T> {
|
|
9
|
+
#current: T | undefined = undefined;
|
|
10
|
+
|
|
11
|
+
run(store: T, fn: () => unknown): unknown {
|
|
12
|
+
const prev = this.#current;
|
|
13
|
+
this.#current = store;
|
|
14
|
+
const result = fn();
|
|
15
|
+
if (result instanceof Promise) {
|
|
16
|
+
return result.finally(() => {
|
|
17
|
+
this.#current = prev;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
this.#current = prev;
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getStore(): T | undefined {
|
|
25
|
+
return this.#current;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const AsyncLocalStoragePromise: Promise<typeof AsyncLocalStorage | null> =
|
|
30
|
+
Promise.resolve().then(() => {
|
|
31
|
+
if ("AsyncLocalStorage" in globalThis) {
|
|
32
|
+
return (globalThis as any).AsyncLocalStorage;
|
|
33
|
+
}
|
|
34
|
+
return AsyncLocalStoragePolyfill;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export async function getAsyncLocalStorage(): Promise<
|
|
38
|
+
typeof AsyncLocalStorage
|
|
39
|
+
> {
|
|
40
|
+
const mod = await AsyncLocalStoragePromise;
|
|
41
|
+
if (mod === null) {
|
|
42
|
+
throw new Error("getAsyncLocalStorage is only available in server code");
|
|
43
|
+
} else {
|
|
44
|
+
return mod;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
1
3
|
import type { EndpointContext, InputContext } from "better-call";
|
|
2
|
-
import type { AsyncLocalStorage } from "../async_hooks";
|
|
3
|
-
import { getAsyncLocalStorage } from "../async_hooks";
|
|
4
4
|
import type { AuthContext } from "../types";
|
|
5
5
|
|
|
6
6
|
export type AuthEndpointContext = Partial<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AsyncLocalStorage } from "
|
|
2
|
-
import { getAsyncLocalStorage } from "
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
3
|
|
|
4
4
|
export type RequestStateWeakMap = WeakMap<object, any>;
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AsyncLocalStorage } from "
|
|
2
|
-
import { getAsyncLocalStorage } from "
|
|
1
|
+
import type { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
2
|
+
import { getAsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
3
|
import type { DBAdapter, DBTransactionAdapter } from "../db/adapter";
|
|
4
4
|
|
|
5
5
|
let currentAdapterAsyncStorage: AsyncLocalStorage<DBTransactionAdapter> | null =
|
package/src/db/adapter/index.ts
CHANGED
|
@@ -424,7 +424,7 @@ export type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
424
424
|
where: Where[];
|
|
425
425
|
update: Record<string, any>;
|
|
426
426
|
}) => Promise<number>;
|
|
427
|
-
delete: <
|
|
427
|
+
delete: <_T>(data: { model: string; where: Where[] }) => Promise<void>;
|
|
428
428
|
deleteMany: (data: { model: string; where: Where[] }) => Promise<number>;
|
|
429
429
|
/**
|
|
430
430
|
* Execute multiple operations in a transaction.
|
package/src/types/context.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type GenericEndpointContext<
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export interface InternalAdapter<
|
|
27
|
-
|
|
27
|
+
_Options extends BetterAuthOptions = BetterAuthOptions,
|
|
28
28
|
> {
|
|
29
29
|
createOAuthUser(
|
|
30
30
|
user: Omit<User, "id" | "createdAt" | "updatedAt">,
|
package/tsdown.config.ts
CHANGED
|
@@ -8,6 +8,7 @@ export default defineConfig({
|
|
|
8
8
|
"./src/db/index.ts",
|
|
9
9
|
"./src/db/adapter/index.ts",
|
|
10
10
|
"./src/async_hooks/index.ts",
|
|
11
|
+
"./src/async_hooks/pure.index.ts",
|
|
11
12
|
"./src/context/index.ts",
|
|
12
13
|
"./src/env/index.ts",
|
|
13
14
|
"./src/oauth2/index.ts",
|
|
@@ -16,5 +17,6 @@ export default defineConfig({
|
|
|
16
17
|
"./src/utils/index.ts",
|
|
17
18
|
"./src/error/index.ts",
|
|
18
19
|
],
|
|
20
|
+
external: ["@better-auth/core/async_hooks"],
|
|
19
21
|
clean: true,
|
|
20
22
|
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { c as env } from "./env-D6s-lvJz.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/async_hooks/index.ts
|
|
4
|
-
/**
|
|
5
|
-
* Due to the lack of AsyncLocalStorage in some environments (like Convex),
|
|
6
|
-
*
|
|
7
|
-
* We assume serverless functions are short-lived and single-threaded, so we can use a simple polyfill.
|
|
8
|
-
*/
|
|
9
|
-
var AsyncLocalStoragePolyfill = class {
|
|
10
|
-
#current = void 0;
|
|
11
|
-
run(store, fn) {
|
|
12
|
-
const prev = this.#current;
|
|
13
|
-
this.#current = store;
|
|
14
|
-
const result = fn();
|
|
15
|
-
if (result instanceof Promise) return result.finally(() => {
|
|
16
|
-
this.#current = prev;
|
|
17
|
-
});
|
|
18
|
-
this.#current = prev;
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
getStore() {
|
|
22
|
-
return this.#current;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const AsyncLocalStoragePromise = import(
|
|
26
|
-
/* @vite-ignore */
|
|
27
|
-
/* webpackIgnore: true */
|
|
28
|
-
"node:async_hooks"
|
|
29
|
-
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
30
|
-
if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
|
|
31
|
-
if (typeof window !== "undefined") return null;
|
|
32
|
-
if (env["CONVEX_CLOUD_URL"] || env["CONVEX_SITE_URL"]) return AsyncLocalStoragePolyfill;
|
|
33
|
-
console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
|
|
34
|
-
console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
|
|
35
|
-
console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
|
|
36
|
-
throw err;
|
|
37
|
-
});
|
|
38
|
-
async function getAsyncLocalStorage() {
|
|
39
|
-
const mod = await AsyncLocalStoragePromise;
|
|
40
|
-
if (mod === null) throw new Error("getAsyncLocalStorage is only available in server code");
|
|
41
|
-
else return mod;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { getAsyncLocalStorage as t };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { expect, test, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
vi.mock(import("node:async_hooks"), () => {
|
|
4
|
-
throw new Error("Doesn't work with convex");
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test("should work with convex", async () => {
|
|
8
|
-
vi.stubEnv("CONVEX_CLOUD_URL", "https://convex.com");
|
|
9
|
-
vi.stubEnv("CONVEX_SITE_URL", "http://test.com");
|
|
10
|
-
const { getAsyncLocalStorage } = await import(".");
|
|
11
|
-
await expect(getAsyncLocalStorage()).to.resolves.toBeDefined();
|
|
12
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|