@better-auth/core 1.4.6-beta.2 → 1.4.6-beta.4
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 +31 -30
- package/dist/api/index.d.mts +1 -2
- package/dist/api/index.mjs +3 -2
- package/dist/async_hooks/index.d.mts +1 -1
- package/dist/async_hooks/index.mjs +2 -1
- package/dist/async_hooks-CrTStdt6.mjs +45 -0
- package/dist/context/index.d.mts +2 -3
- package/dist/context/index.mjs +3 -2
- package/dist/{context-DgQ9XGBl.mjs → context-su4uu82y.mjs} +1 -1
- package/dist/db/adapter/index.d.mts +2 -3
- package/dist/db/adapter/index.mjs +955 -1
- package/dist/db/index.d.mts +2 -3
- package/dist/db/index.mjs +2 -1
- package/dist/env/index.d.mts +1 -1
- package/dist/env/index.mjs +1 -1
- package/dist/error/index.mjs +3 -2
- package/dist/{error-BhAKg8LX.mjs → error-CMXuwPsa.mjs} +1 -1
- package/dist/get-tables-BGfrxIVZ.mjs +252 -0
- package/dist/{index-D_XSRX55.d.mts → index-Bp1Bfmzt.d.mts} +307 -32
- package/dist/{index-DgwIISs7.d.mts → index-Da4Ujjef.d.mts} +0 -1
- package/dist/index.d.mts +2 -3
- package/dist/oauth2/index.d.mts +1 -2
- package/dist/oauth2/index.mjs +1 -1
- package/dist/social-providers/index.d.mts +2 -3
- package/dist/social-providers/index.mjs +22 -8
- package/dist/utils/index.d.mts +10 -1
- package/dist/utils/index.mjs +3 -2
- package/dist/utils-BqQC77zO.mjs +43 -0
- package/package.json +8 -6
- package/src/async_hooks/convex.spec.ts +12 -0
- package/src/async_hooks/index.ts +60 -25
- package/src/db/adapter/factory.ts +1368 -0
- package/src/db/adapter/get-default-field-name.ts +59 -0
- package/src/db/adapter/get-default-model-name.ts +51 -0
- package/src/db/adapter/get-field-attributes.ts +62 -0
- package/src/db/adapter/get-field-name.ts +43 -0
- package/src/db/adapter/get-id-field.ts +141 -0
- package/src/db/adapter/get-model-name.ts +36 -0
- package/src/db/adapter/index.ts +12 -0
- package/src/db/adapter/types.ts +161 -0
- package/src/db/adapter/utils.ts +61 -0
- package/src/db/get-tables.ts +276 -0
- package/src/db/index.ts +2 -0
- package/src/db/test/get-tables.test.ts +62 -0
- package/src/env/logger.ts +4 -6
- package/src/oauth2/oauth-provider.ts +1 -1
- package/src/social-providers/google.ts +46 -17
- package/src/types/context.ts +10 -0
- package/src/types/helper.ts +4 -0
- package/src/types/init-options.ts +24 -24
- package/src/utils/id.ts +5 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/json.ts +25 -0
- package/src/utils/string.ts +3 -0
- package/dist/async_hooks-BfRfbd1J.mjs +0 -18
- package/dist/utils-C5EN75oV.mjs +0 -7
- /package/dist/{env-8yWFh7b8.mjs → env-D6s-lvJz.mjs} +0 -0
- /package/dist/{index-X1Fs3IbM.d.mts → index-D4vfN5ui.d.mts} +0 -0
- /package/dist/{oauth2-B2XPHgx5.mjs → oauth2-7k48hhcV.mjs} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { logger } from "../env";
|
|
2
|
+
|
|
3
|
+
export function safeJSONParse<T>(data: unknown): T | null {
|
|
4
|
+
function reviver(_: string, value: any): any {
|
|
5
|
+
if (typeof value === "string") {
|
|
6
|
+
const iso8601Regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
7
|
+
if (iso8601Regex.test(value)) {
|
|
8
|
+
const date = new Date(value);
|
|
9
|
+
if (!isNaN(date.getTime())) {
|
|
10
|
+
return date;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
if (typeof data !== "string") {
|
|
18
|
+
return data as T;
|
|
19
|
+
}
|
|
20
|
+
return JSON.parse(data, reviver);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
logger.error("Error parsing JSON", { error: e });
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
|
|
9
|
-
console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
|
|
10
|
-
console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
|
|
11
|
-
throw err;
|
|
12
|
-
});
|
|
13
|
-
async function getAsyncLocalStorage() {
|
|
14
|
-
return AsyncLocalStoragePromise;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { getAsyncLocalStorage as t };
|
package/dist/utils-C5EN75oV.mjs
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|