handzon-core 0.12.0 → 0.12.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handzon-core",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Core framework for Handzon — layouts, components, content + AI libs, and server runtime (handlers, DB, auth, migration runner) consumed by Handzon scaffolds.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -56,6 +56,12 @@ function resolveAuthUrl(): string | undefined {
56
56
  return undefined;
57
57
  }
58
58
 
59
+ function resolveAuthPrefix(): string {
60
+ const base = import.meta.env.BASE_URL;
61
+ const normalizedBase = base === "/" ? "" : base.replace(/\/$/, "");
62
+ return `${normalizedBase}/api/auth`;
63
+ }
64
+
59
65
  export function createAuthConfig({ db }: AuthConfigOptions) {
60
66
  // Auth.js v5 reads `AUTH_URL` from process.env on each request, so
61
67
  // we resolve once and write it back. Idempotent: if AUTH_URL was
@@ -73,6 +79,11 @@ export function createAuthConfig({ db }: AuthConfigOptions) {
73
79
  return defineConfig({ providers: [] });
74
80
  }
75
81
  return defineConfig({
82
+ // auth-astro defaults to /api/auth, but Astro apps mounted with
83
+ // `base` receive requests at /<base>/api/auth. Use the same base
84
+ // that powers app links and API calls so the catch-all auth route
85
+ // returns a Response instead of falling through with undefined.
86
+ prefix: resolveAuthPrefix(),
76
87
  adapter: DrizzleAdapter(db, {
77
88
  usersTable: users,
78
89
  accountsTable: accounts,