@better-auth/core 1.6.3 → 1.6.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/dist/context/global.mjs
CHANGED
|
@@ -40,12 +40,12 @@ const initGetIdField = ({ usePlural, schema, disableIdGeneration, options, custo
|
|
|
40
40
|
if (useUUIDs) {
|
|
41
41
|
if (shouldGenerateId && !forceAllowId) return value;
|
|
42
42
|
if (disableIdGeneration) return void 0;
|
|
43
|
-
if (supportsUUIDs) return void 0;
|
|
44
43
|
if (forceAllowId && typeof value === "string") if (/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) return value;
|
|
45
44
|
else {
|
|
46
45
|
const stack = (/* @__PURE__ */ new Error()).stack?.split("\n").filter((_, i) => i !== 1).join("\n").replace("Error:", "");
|
|
47
46
|
logger.warn("[Adapter Factory] - Invalid UUID value for field `id` provided when `forceAllowId` is true. Generating a new UUID.", stack);
|
|
48
47
|
}
|
|
48
|
+
if (supportsUUIDs) return void 0;
|
|
49
49
|
if (typeof value !== "string" && !supportsUUIDs) return crypto.randomUUID();
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ATTR_HTTP_RESPONSE_STATUS_CODE } from "./attributes.mjs";
|
|
2
2
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
3
3
|
//#region src/instrumentation/tracer.ts
|
|
4
|
-
const tracer = trace.getTracer("better-auth", "1.6.
|
|
4
|
+
const tracer = trace.getTracer("better-auth", "1.6.4");
|
|
5
5
|
/**
|
|
6
6
|
* Better-auth uses `throw ctx.redirect(url)` for flow control (e.g. OAuth
|
|
7
7
|
* callbacks). These are APIErrors with 3xx status codes and should not be
|
package/package.json
CHANGED
|
@@ -108,8 +108,6 @@ export const initGetIdField = ({
|
|
|
108
108
|
// if it's generated by us, then we should return the value as is.
|
|
109
109
|
if (shouldGenerateId && !forceAllowId) return value;
|
|
110
110
|
if (disableIdGeneration) return undefined;
|
|
111
|
-
// if DB will handle UUID generation, then we should return undefined.
|
|
112
|
-
if (supportsUUIDs) return undefined;
|
|
113
111
|
// if forceAllowId is true, it means we should be using the ID provided during the adapter call.
|
|
114
112
|
if (forceAllowId && typeof value === "string") {
|
|
115
113
|
const uuidRegex =
|
|
@@ -129,6 +127,8 @@ export const initGetIdField = ({
|
|
|
129
127
|
);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
130
|
+
// if DB will handle UUID generation, then we should return undefined.
|
|
131
|
+
if (supportsUUIDs) return undefined;
|
|
132
132
|
// if the value is not a string, and the database doesn't support generating it's own UUIDs, then we should be generating the UUID.
|
|
133
133
|
if (typeof value !== "string" && !supportsUUIDs) {
|
|
134
134
|
return crypto.randomUUID();
|