@contentgrowth/content-auth 0.5.6 → 0.6.0
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/backend/index.d.ts
CHANGED
|
@@ -829,6 +829,12 @@ interface AuthConfig {
|
|
|
829
829
|
database: D1Database | any;
|
|
830
830
|
secret: string;
|
|
831
831
|
baseUrl?: string;
|
|
832
|
+
/**
|
|
833
|
+
* Enable debug logging to see what config is passed to Better Auth.
|
|
834
|
+
* Useful for troubleshooting configuration issues.
|
|
835
|
+
* Default: false
|
|
836
|
+
*/
|
|
837
|
+
debug?: boolean;
|
|
832
838
|
/**
|
|
833
839
|
* Explicitly specify the database provider.
|
|
834
840
|
* Defaults to 'sqlite' (which works for D1).
|
package/dist/backend/index.js
CHANGED
|
@@ -360,6 +360,7 @@ var createAuth = (config) => {
|
|
|
360
360
|
database,
|
|
361
361
|
secret,
|
|
362
362
|
baseUrl,
|
|
363
|
+
debug = false,
|
|
363
364
|
provider: _,
|
|
364
365
|
useCloudflareNativeHashing = true,
|
|
365
366
|
emailVerification,
|
|
@@ -429,6 +430,38 @@ var createAuth = (config) => {
|
|
|
429
430
|
const sessionConfig = buildModelConfig(schemaMapping?.session);
|
|
430
431
|
const accountConfig = buildModelConfig(schemaMapping?.account);
|
|
431
432
|
const verificationConfig = buildModelConfig(schemaMapping?.verification);
|
|
433
|
+
if (debug) {
|
|
434
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
435
|
+
console.log("[ContentAuth-DEBUG] Configuration passed to content-auth:");
|
|
436
|
+
console.log("[ContentAuth-DEBUG] - baseUrl:", baseUrl);
|
|
437
|
+
console.log("[ContentAuth-DEBUG] - provider:", provider);
|
|
438
|
+
console.log("[ContentAuth-DEBUG] - useCloudflareNativeHashing:", useCloudflareNativeHashing);
|
|
439
|
+
console.log("[ContentAuth-DEBUG] - emailVerification:", JSON.stringify(emailVerification || "not configured"));
|
|
440
|
+
console.log("[ContentAuth-DEBUG] - turnstile:", turnstileConfig ? "configured" : "not configured");
|
|
441
|
+
console.log("[ContentAuth-DEBUG] - emailNormalization:", JSON.stringify(emailNormalization || "not configured"));
|
|
442
|
+
console.log("[ContentAuth-DEBUG] - signInTracking:", JSON.stringify(signInTracking || "not configured"));
|
|
443
|
+
console.log("[ContentAuth-DEBUG] - onSignup:", onSignup ? "provided" : "not provided");
|
|
444
|
+
console.log("[ContentAuth-DEBUG] - onSignin:", onSignin ? "provided" : "not provided");
|
|
445
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
446
|
+
console.log("[ContentAuth-DEBUG] Schema Mapping:");
|
|
447
|
+
console.log("[ContentAuth-DEBUG] - schemaMapping:", JSON.stringify(schemaMapping, null, 2));
|
|
448
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
449
|
+
console.log("[ContentAuth-DEBUG] Direct model configs passed:");
|
|
450
|
+
console.log("[ContentAuth-DEBUG] - user:", JSON.stringify(user, null, 2));
|
|
451
|
+
console.log("[ContentAuth-DEBUG] - session:", JSON.stringify(session || "not provided"));
|
|
452
|
+
console.log("[ContentAuth-DEBUG] - account:", JSON.stringify(account || "not provided"));
|
|
453
|
+
console.log("[ContentAuth-DEBUG] - verification:", JSON.stringify(verification || "not provided"));
|
|
454
|
+
console.log("[ContentAuth-DEBUG] - organization:", JSON.stringify(organization || "not provided"));
|
|
455
|
+
console.log("[ContentAuth-DEBUG] - member:", JSON.stringify(member || "not provided"));
|
|
456
|
+
console.log("[ContentAuth-DEBUG] - invitation:", JSON.stringify(invitation || "not provided"));
|
|
457
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
458
|
+
console.log("[ContentAuth-DEBUG] Built model configs (from schemaMapping):");
|
|
459
|
+
console.log("[ContentAuth-DEBUG] - userConfig:", JSON.stringify(userConfig, null, 2));
|
|
460
|
+
console.log("[ContentAuth-DEBUG] - sessionConfig:", JSON.stringify(sessionConfig || "not built"));
|
|
461
|
+
console.log("[ContentAuth-DEBUG] - accountConfig:", JSON.stringify(accountConfig || "not built"));
|
|
462
|
+
console.log("[ContentAuth-DEBUG] - verificationConfig:", JSON.stringify(verificationConfig || "not built"));
|
|
463
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
464
|
+
}
|
|
432
465
|
const userIdColumn = schemaMapping?.user?.fields?.id || "id";
|
|
433
466
|
const emailConfig = rest.emailAndPassword || { enabled: true };
|
|
434
467
|
const { emailAndPassword, hooks: userHooks, ...otherOptions } = rest;
|
|
@@ -569,6 +602,29 @@ var createAuth = (config) => {
|
|
|
569
602
|
hooks: contentAuthHooks,
|
|
570
603
|
...otherOptions
|
|
571
604
|
});
|
|
605
|
+
if (debug) {
|
|
606
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
607
|
+
console.log("[ContentAuth-DEBUG] Final config passed to betterAuth():");
|
|
608
|
+
console.log("[ContentAuth-DEBUG] - baseURL:", baseUrl);
|
|
609
|
+
console.log("[ContentAuth-DEBUG] - emailAndPassword:", JSON.stringify(emailPasswordOptions));
|
|
610
|
+
console.log("[ContentAuth-DEBUG] - emailVerification:", emailVerification ? "passed" : "not passed");
|
|
611
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
612
|
+
console.log("[ContentAuth-DEBUG] Merged model configs passed to betterAuth():");
|
|
613
|
+
const mergedUserConfig = userConfig || user ? { ...userConfig, ...user } : void 0;
|
|
614
|
+
console.log("[ContentAuth-DEBUG] - user:", JSON.stringify(mergedUserConfig, null, 2));
|
|
615
|
+
const mergedSessionConfig = sessionConfig || session ? { ...sessionConfig, ...session } : void 0;
|
|
616
|
+
console.log("[ContentAuth-DEBUG] - session:", JSON.stringify(mergedSessionConfig || "not passed"));
|
|
617
|
+
const mergedAccountConfig = accountConfig || account ? { ...accountConfig, ...account } : void 0;
|
|
618
|
+
console.log("[ContentAuth-DEBUG] - account:", JSON.stringify(mergedAccountConfig || "not passed"));
|
|
619
|
+
const mergedVerificationConfig = verificationConfig || verification ? { ...verificationConfig, ...verification } : void 0;
|
|
620
|
+
console.log("[ContentAuth-DEBUG] - verification:", JSON.stringify(mergedVerificationConfig || "not passed"));
|
|
621
|
+
console.log("[ContentAuth-DEBUG] - organization:", organization ? "passed" : "not passed");
|
|
622
|
+
console.log("[ContentAuth-DEBUG] - member:", member ? "passed" : "not passed");
|
|
623
|
+
console.log("[ContentAuth-DEBUG] - invitation:", invitation ? "passed" : "not passed");
|
|
624
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
625
|
+
console.log("[ContentAuth-DEBUG] Other options passed to betterAuth():", Object.keys(otherOptions).join(", "));
|
|
626
|
+
console.log("[ContentAuth-DEBUG] ========================================");
|
|
627
|
+
}
|
|
572
628
|
return auth;
|
|
573
629
|
};
|
|
574
630
|
var authMiddleware = (auth) => {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentgrowth/content-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages. Includes custom schema mapping, Turnstile bot protection, and email normalization.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|