better-auth-studio 1.1.2-beta.2 → 1.1.2-beta.20

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.
Files changed (108) hide show
  1. package/README.md +48 -78
  2. package/data/default-geo.json +1 -1
  3. package/dist/adapters/astro.d.ts +1 -1
  4. package/dist/adapters/astro.js +13 -13
  5. package/dist/adapters/elysia.d.ts +2 -2
  6. package/dist/adapters/elysia.js +13 -13
  7. package/dist/adapters/express.d.ts +2 -2
  8. package/dist/adapters/express.js +4 -4
  9. package/dist/adapters/hono.d.ts +2 -2
  10. package/dist/adapters/hono.js +12 -12
  11. package/dist/adapters/nextjs.d.ts +1 -1
  12. package/dist/adapters/nextjs.js +10 -10
  13. package/dist/adapters/nuxt.d.ts +1 -1
  14. package/dist/adapters/nuxt.js +22 -22
  15. package/dist/adapters/remix.d.ts +1 -1
  16. package/dist/adapters/remix.js +13 -13
  17. package/dist/adapters/solid-start.d.ts +1 -1
  18. package/dist/adapters/solid-start.js +13 -13
  19. package/dist/adapters/svelte-kit.d.ts +2 -2
  20. package/dist/adapters/svelte-kit.js +13 -13
  21. package/dist/adapters/tanstack-start.d.ts +1 -1
  22. package/dist/adapters/tanstack-start.js +13 -13
  23. package/dist/add-svelte-kit-env-modules.js +11 -11
  24. package/dist/auth-adapter.d.ts +1 -1
  25. package/dist/auth-adapter.js +96 -96
  26. package/dist/cli/commands/init.js +57 -57
  27. package/dist/cli.js +75 -75
  28. package/dist/config.d.ts +5 -5
  29. package/dist/config.js +37 -37
  30. package/dist/core/handler.d.ts +1 -1
  31. package/dist/core/handler.js +116 -115
  32. package/dist/core/handler.js.map +1 -1
  33. package/dist/data.d.ts +2 -2
  34. package/dist/data.js +60 -60
  35. package/dist/geo-service.js +78 -78
  36. package/dist/get-tsconfig-info.js +4 -4
  37. package/dist/index.d.ts +8 -8
  38. package/dist/index.js +6 -6
  39. package/dist/providers/events/helpers.d.ts +2 -2
  40. package/dist/providers/events/helpers.d.ts.map +1 -1
  41. package/dist/providers/events/helpers.js +178 -154
  42. package/dist/providers/events/helpers.js.map +1 -1
  43. package/dist/public/assets/{main-BDJUrMKx.js → main-BeCk6LUx.js} +133 -133
  44. package/dist/public/assets/main-w2bJSKlF.css +1 -0
  45. package/dist/public/index.html +2 -2
  46. package/dist/routes/api-router.d.ts +3 -1
  47. package/dist/routes/api-router.d.ts.map +1 -1
  48. package/dist/routes/api-router.js +3 -3
  49. package/dist/routes/api-router.js.map +1 -1
  50. package/dist/routes.d.ts +6 -4
  51. package/dist/routes.d.ts.map +1 -1
  52. package/dist/routes.js +1333 -1277
  53. package/dist/routes.js.map +1 -1
  54. package/dist/studio.d.ts +3 -3
  55. package/dist/studio.d.ts.map +1 -1
  56. package/dist/studio.js +64 -65
  57. package/dist/studio.js.map +1 -1
  58. package/dist/types/events.d.ts +8 -7
  59. package/dist/types/events.d.ts.map +1 -1
  60. package/dist/types/events.js +165 -165
  61. package/dist/types/events.js.map +1 -1
  62. package/dist/types/handler.d.ts +14 -4
  63. package/dist/types/handler.d.ts.map +1 -1
  64. package/dist/types/handler.js.map +1 -1
  65. package/dist/utils/auth-callbacks-injector.d.ts +2 -2
  66. package/dist/utils/auth-callbacks-injector.js +27 -27
  67. package/dist/utils/auth-callbacks-wrapper.d.ts +3 -3
  68. package/dist/utils/auth-callbacks-wrapper.js +117 -107
  69. package/dist/utils/database-detection.d.ts +1 -1
  70. package/dist/utils/database-detection.js +44 -44
  71. package/dist/utils/database-hook-injector.d.ts +3 -3
  72. package/dist/utils/database-hook-injector.js +135 -131
  73. package/dist/utils/email-otp-hooks-injector.d.ts +28 -12
  74. package/dist/utils/email-otp-hooks-injector.js +104 -97
  75. package/dist/utils/event-ingestion.d.ts +5 -5
  76. package/dist/utils/event-ingestion.d.ts.map +1 -1
  77. package/dist/utils/event-ingestion.js +32 -12
  78. package/dist/utils/event-ingestion.js.map +1 -1
  79. package/dist/utils/hook-injector.d.ts +2 -2
  80. package/dist/utils/hook-injector.js +199 -199
  81. package/dist/utils/html-injector.d.ts +11 -2
  82. package/dist/utils/html-injector.d.ts.map +1 -1
  83. package/dist/utils/html-injector.js +40 -39
  84. package/dist/utils/html-injector.js.map +1 -1
  85. package/dist/utils/org-hooks-injector.d.ts +3 -3
  86. package/dist/utils/org-hooks-injector.js +63 -63
  87. package/dist/utils/org-hooks-wrapper.d.ts +41 -35
  88. package/dist/utils/org-hooks-wrapper.js +778 -658
  89. package/dist/utils/organization-hooks-wrapper.d.ts +23 -17
  90. package/dist/utils/organization-hooks-wrapper.js +325 -277
  91. package/dist/utils/package-json.js +11 -11
  92. package/dist/utils/paths.js +1 -1
  93. package/dist/utils/server-init.d.ts +1 -1
  94. package/dist/utils/server-init.js +25 -25
  95. package/dist/utils/session.d.ts +0 -1
  96. package/dist/utils/session.d.ts.map +1 -1
  97. package/dist/utils/session.js +19 -12
  98. package/dist/utils/session.js.map +1 -1
  99. package/dist/utils.js +24 -24
  100. package/package.json +25 -24
  101. package/public/assets/{main-BDJUrMKx.js → main-BeCk6LUx.js} +133 -133
  102. package/public/assets/main-w2bJSKlF.css +1 -0
  103. package/public/index.html +2 -2
  104. package/scripts/download-geolite2.js +8 -8
  105. package/scripts/generate-default-db.js +324 -324
  106. package/scripts/postinstall.js +25 -25
  107. package/dist/public/assets/main-CBA9bZ-w.css +0 -1
  108. package/public/assets/main-CBA9bZ-w.css +0 -1
package/README.md CHANGED
@@ -1,67 +1,21 @@
1
- # Better Auth Studio
1
+ # Better Auth Studio
2
2
 
3
3
  > ⚠️ **Beta Version Notice**
4
- >
4
+ >
5
5
  > Better Auth Studio is currently in **beta** and in early development. You may encounter bugs or incomplete features. Please report any issues you find on our GitHub repository to help us improve the project. Your feedback is greatly appreciated!
6
6
 
7
-
8
7
  A web-based studio interface for managing Better Auth applications. Better Auth Studio provides a comprehensive dashboard for managing users, organizations, teams, and more.
9
8
 
10
- ## Preview
11
- A sneak peek of the studio dashboard and management interface.
12
-
13
- <div align="center">
14
- <table>
15
- <tr>
16
- <td width="50%">
17
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJI57TKc4BY9GjOlTtSmoRXCZJ2D50IWsLq6vd" alt="Better Auth Studio Preview 0" width="100%" />
18
- </td>
19
- <td width="50%">
20
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJ4L7IilBo7ItO3420CBLpvnPJlA6j5zaFYZbG" alt="Better Auth Studio Preview 4" width="100%" />
21
- </td>
22
- </tr>
23
- <tr>
24
- <td width="50%">
25
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJdiXpY6GJ15hUVAwrQyozdc6PpIXfSi7GWkeR" alt="Better Auth Studio Preview 2" width="100%" />
26
- </td>
27
- <td width="50%">
28
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJNAk2JU1Cviwfb1ltHVgPJF9BWxzE2m60rQaK" alt="Better Auth Studio Preview 6" width="100%" />
29
- </td>
30
- </tr>
31
- <tr>
32
- <td width="50%">
33
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJgSyVwl0dZe8UGVJLkR74CQXb9m1wzKIqhTME" alt="Better Auth Studio Preview 11" width="100%" />
34
- </td>
35
- <td width="50%">
36
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJODyqbs8p2EKCNef8H9XqPm4cIwjaQVRUAFg7" alt="Better Auth Studio Preview 8" width="100%" />
37
- </td>
38
- </tr>
39
- <tr>
40
- <td width="50%">
41
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJ2syhnQSdgJ9w13MfvHiGYPs07AkpWQSXm6Nj" alt="Better Auth Studio Preview 12" width="100%" />
42
- </td>
43
- <td width="50%">
44
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJcW7cwWXSlBtbRHTF15ujAQLPx3VpcKgMOz08" alt="Better Auth Studio Preview 3" width="100%" />
45
- </td>
46
- </tr>
47
- <tr>
48
- <td width="50%">
49
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJnAGpd3rzcKd2Hu4wkD0jJbApf78rC1VgZORT" alt="Better Auth Studio Preview 10" width="100%" />
50
- </td>
51
- <td width="50%">
52
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJK6lXYfaxUOknshdjxpSgwV6mq7DtH3aMZXWK" alt="Better Auth Studio Preview 13" width="100%" />
53
- </td>
54
- </tr>
55
- <tr>
56
- <td width="50%">
57
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJhZFdrWmjbSvOe01IQl7r68LUfVKuFcNqAydt" alt="Better Auth Studio Preview 14" width="100%" />
58
- </td>
59
- <td width="50%">
60
- <img src="https://gk6bju9ndq.ufs.sh/f/M5pOhOFFvHQJwnJFq9htT259fPAQY0eIdDmn7O4xVlGaCjZR" alt="Better Auth Studio Preview 5" width="100%" />
61
- </td>
62
- </tr>
63
- </table>
64
- </div>
9
+ ## ✨ Try Better Auth Studio Demo
10
+
11
+ You can try a live, demo version of Better Auth Studio here:
12
+
13
+ 👉 **[https://bt-nextjs.vercel.app/admin](https://bt-nextjs.vercel.app/admin)**
14
+
15
+ - **Login email:** `admin@test.com`
16
+ - **Password:** `admin@test.com`
17
+
18
+ This online demo lets you explore the admin studio UI. Please note this is a test environment.
65
19
 
66
20
  ## 🚀 Quick Start
67
21
 
@@ -88,24 +42,27 @@ pnpm add -g better-auth-studio
88
42
  Or use pnpx to run it without installation:
89
43
 
90
44
  ```bash
91
- pnpx better-auth-studio [cmd]
45
+ pnpx better-auth-studio [cmd]
92
46
  ```
93
47
 
94
48
  ### Basic Usage
95
49
 
96
50
  1. **Navigate to your Better Auth project directory**
51
+
97
52
  ```bash
98
53
  cd your-better-auth-project
99
54
  ```
100
55
 
101
56
  2. **Start the studio**
102
-
57
+
103
58
  If installed as dev dependency:
59
+
104
60
  ```bash
105
61
  pnpm better-auth-studio start
106
62
  ```
107
-
63
+
108
64
  Or with pnpx:
65
+
109
66
  ```bash
110
67
  pnpx better-auth-studio start
111
68
  ```
@@ -129,7 +86,7 @@ Before using Better Auth Studio, ensure you have:
129
86
  Better Auth Studio automatically detects and works with:
130
87
 
131
88
  - **Prisma** (`prismaAdapter`)
132
- - **Drizzle** (`drizzleAdapter`)
89
+ - **Drizzle** (`drizzleAdapter`)
133
90
  - **SQLite** (`new Database()` from better-sqlite3)
134
91
  - **PostgreSQL** (via Prisma or Drizzle)
135
92
  - **MySQL** (via Prisma or Drizzle)
@@ -137,6 +94,7 @@ Better Auth Studio automatically detects and works with:
137
94
  ### Example Configuration Files
138
95
 
139
96
  #### Prisma Setup
97
+
140
98
  ```typescript
141
99
  // auth.ts
142
100
  import { betterAuth } from "better-auth";
@@ -154,6 +112,7 @@ export const auth = betterAuth({
154
112
  ```
155
113
 
156
114
  #### Drizzle Setup
115
+
157
116
  ```typescript
158
117
  // auth.ts
159
118
  import { betterAuth } from "better-auth";
@@ -169,6 +128,7 @@ export const auth = betterAuth({
169
128
  ```
170
129
 
171
130
  #### SQLite Setup
131
+
172
132
  ```typescript
173
133
  // auth.ts
174
134
  import { betterAuth } from "better-auth";
@@ -183,9 +143,11 @@ export const auth = betterAuth({
183
143
  ## 🎯 Features
184
144
 
185
145
  ### 📊 Dashboard
146
+
186
147
  - **Overview statistics** - User, teams and organization counts data
187
148
 
188
149
  ### 👥 User Management
150
+
189
151
  - **View all users** - Paginated list with search and filtering
190
152
  - **Create users** - Add new users with email/password
191
153
  - **Edit users** - Update user information, email verification status
@@ -194,6 +156,7 @@ export const auth = betterAuth({
194
156
  - **User details** - View user profiles, and accounts
195
157
 
196
158
  ### 🏢 Organization Management
159
+
197
160
  - **View organizations** - List all organizations with pagination
198
161
  - **Create organizations** - Add new organizations with custom slugs
199
162
  - **Edit organizations** - Update organization details
@@ -203,6 +166,7 @@ export const auth = betterAuth({
203
166
  - **Bulk seeding** - Generate test organizations and teams
204
167
 
205
168
  ### ⚙️ Settings & Configuration
169
+
206
170
  - **Plugin status** - Check which Better Auth plugins are enabled
207
171
  - **Database configuration** - View current database adapter and settings
208
172
  - **Social providers** - Configure OAuth providers (GitHub, Google, etc.)
@@ -211,11 +175,13 @@ export const auth = betterAuth({
211
175
  ## 🛠️ Command Line Options
212
176
 
213
177
  ### Start Studio
178
+
214
179
  ```bash
215
180
  pnpx better-auth-studio start [options]
216
181
  ```
217
182
 
218
183
  **Options:**
184
+
219
185
  - `--port <number>` - Specify port (default: 3000)
220
186
  - `--host <string>` - Specify host (default: localhost)
221
187
  - `--no-open` - Don't automatically open browser
@@ -223,6 +189,7 @@ pnpx better-auth-studio start [options]
223
189
  - `--watch` - Watch for changes in auth config file and reload server automatically
224
190
 
225
191
  **Examples:**
192
+
226
193
  ```bash
227
194
  # Start on custom port (if installed as dev dependency)
228
195
  pnpm better-auth-studio start --port 3001
@@ -248,6 +215,7 @@ pnpx better-auth-studio start --port 3001 --watch --config ./src/auth.ts
248
215
  Specify a custom path to your auth config file when it's in a non-standard location or auto-detection fails.
249
216
 
250
217
  **Example:**
218
+
251
219
  ```bash
252
220
  # With relative path
253
221
  pnpm better-auth-studio start --config ./src/lib/auth.ts
@@ -263,6 +231,7 @@ pnpm better-auth-studio start --config /path/to/project/auth.ts
263
231
  Automatically reload the server when your `auth.ts` file changes. Perfect for development when iterating on your auth configuration.
264
232
 
265
233
  **Example:**
234
+
266
235
  ```bash
267
236
  # Start with watch mode enabled
268
237
  pnpx better-auth-studio start --watch
@@ -271,6 +240,7 @@ pnpx better-auth-studio start --watch
271
240
  **How it works:** Monitors your auth config file for changes, automatically restarts the server, and updates the browser UI via WebSocket - no manual refresh needed.
272
241
 
273
242
  ### Other Commands
243
+
274
244
  ```bash
275
245
  # Check version
276
246
  pnpx better-auth-studio --version
@@ -298,11 +268,13 @@ pnpm add better-auth-studio
298
268
  ### Setup
299
269
 
300
270
  **Step 1: Initialize configuration**
271
+
301
272
  ```bash
302
273
  pnpx better-auth-studio init
303
274
  ```
304
275
 
305
276
  This creates a `studio.config.ts` file:
277
+
306
278
  ```typescript
307
279
  import type { StudioConfig } from "better-auth-studio";
308
280
  import { auth } from "./lib/auth";
@@ -326,19 +298,14 @@ export default config;
326
298
  ### Next.js (App Router)
327
299
 
328
300
  The init command automatically creates `app/api/studio/[[...path]]/route.ts`:
301
+
329
302
  ```typescript
330
- import { createStudioHandler } from "better-auth-studio/nextjs";
303
+ import { betterAuthStudio } from "better-auth-studio/nextjs";
331
304
  import studioConfig from "@/studio.config";
332
305
 
333
- const handler = createStudioHandler(studioConfig);
306
+ const handler = betterAuthStudio(studioConfig);
334
307
 
335
- export {
336
- handler as GET,
337
- handler as POST,
338
- handler as PUT,
339
- handler as DELETE,
340
- handler as PATCH,
341
- };
308
+ export { handler as GET, handler as POST, handler as PUT, handler as DELETE, handler as PATCH };
342
309
  ```
343
310
 
344
311
  Access at `http://localhost:3000/api/studio`
@@ -346,6 +313,7 @@ Access at `http://localhost:3000/api/studio`
346
313
  ### Express
347
314
 
348
315
  Add the studio handler to your server:
316
+
349
317
  ```typescript
350
318
  import express from "express";
351
319
  import { toNodeHandler } from "better-auth/node";
@@ -366,17 +334,18 @@ Access at `http://localhost:3000/api/studio`
366
334
 
367
335
  ### Configuration Options
368
336
 
369
- | Option | Required | Description |
370
- |--------|----------|-------------|
371
- | `auth` | Yes | Your Better Auth instance |
372
- | `basePath` | Yes | URL path where studio is mounted |
373
- | `access.allowEmails` | No | Array of admin email addresses |
374
- | `access.roles` | No | Array of allowed user roles |
375
- | `metadata` | No | Custom branding (title, theme) |
337
+ | Option | Required | Description |
338
+ | -------------------- | -------- | -------------------------------- |
339
+ | `auth` | Yes | Your Better Auth instance |
340
+ | `basePath` | Yes | URL path where studio is mounted |
341
+ | `access.allowEmails` | No | Array of admin email addresses |
342
+ | `access.roles` | No | Array of allowed user roles |
343
+ | `metadata` | No | Custom branding (title, theme) |
376
344
 
377
345
  ## 📝 Development
378
346
 
379
347
  ### Running from Source
348
+
380
349
  ```bash
381
350
  # Clone the repository
382
351
  git clone https://github.com/Kinfe123/better-auth-studio.git
@@ -393,6 +362,7 @@ pnpm dev
393
362
  ```
394
363
 
395
364
  ### Contributing
365
+
396
366
  1. Fork the repository
397
367
  2. Create a feature branch
398
368
  3. Make your changes
@@ -1123,4 +1123,4 @@
1123
1123
  ],
1124
1124
  "totalRanges": 255,
1125
1125
  "countries": 12
1126
- }
1126
+ }
@@ -1,4 +1,4 @@
1
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { StudioConfig } from "../types/handler.js";
2
2
  /**
3
3
  * Astro adapter for Better Auth Studio
4
4
  *
@@ -1,5 +1,5 @@
1
- import { handleStudioRequest } from '../core/handler.js';
2
- import { injectEventHooks } from '../utils/hook-injector.js';
1
+ import { handleStudioRequest } from "../core/handler.js";
2
+ import { injectEventHooks } from "../utils/hook-injector.js";
3
3
  /**
4
4
  * Astro adapter for Better Auth Studio
5
5
  *
@@ -28,10 +28,10 @@ export function betterAuthStudio(config) {
28
28
  return universalToResponse(universalRes);
29
29
  }
30
30
  catch (error) {
31
- console.error('Studio handler error:', error);
32
- return new Response(JSON.stringify({ error: 'Internal server error' }), {
31
+ console.error("Studio handler error:", error);
32
+ return new Response(JSON.stringify({ error: "Internal server error" }), {
33
33
  status: 500,
34
- headers: { 'Content-Type': 'application/json' },
34
+ headers: { "Content-Type": "application/json" },
35
35
  });
36
36
  }
37
37
  };
@@ -40,16 +40,16 @@ async function convertAstroToUniversal(ctx, config) {
40
40
  const request = ctx.request;
41
41
  let body;
42
42
  const method = request.method;
43
- if (method !== 'GET' && method !== 'HEAD') {
44
- const contentType = request.headers.get('content-type') || '';
45
- if (contentType.includes('application/json')) {
43
+ if (method !== "GET" && method !== "HEAD") {
44
+ const contentType = request.headers.get("content-type") || "";
45
+ if (contentType.includes("application/json")) {
46
46
  try {
47
47
  body = await request.json();
48
48
  }
49
49
  catch { }
50
50
  }
51
- else if (contentType.includes('application/x-www-form-urlencoded') ||
52
- contentType.includes('multipart/form-data')) {
51
+ else if (contentType.includes("application/x-www-form-urlencoded") ||
52
+ contentType.includes("multipart/form-data")) {
53
53
  try {
54
54
  const formData = await request.formData();
55
55
  body = Object.fromEntries(formData.entries());
@@ -75,12 +75,12 @@ async function convertAstroToUniversal(ctx, config) {
75
75
  request.headers.forEach((value, key) => {
76
76
  headers[key] = value;
77
77
  });
78
- const basePath = config.basePath || '/api/studio';
79
- const normalizedBasePath = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
78
+ const basePath = config.basePath || "/api/studio";
79
+ const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
80
80
  const url = new URL(request.url);
81
81
  let path = url.pathname;
82
82
  if (path.startsWith(normalizedBasePath)) {
83
- path = path.slice(normalizedBasePath.length) || '/';
83
+ path = path.slice(normalizedBasePath.length) || "/";
84
84
  }
85
85
  const pathWithQuery = path + url.search;
86
86
  return {
@@ -1,5 +1,5 @@
1
- import type { Context } from 'elysia';
2
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { Context } from "elysia";
2
+ import type { StudioConfig } from "../types/handler.js";
3
3
  /**
4
4
  * Elysia adapter for Better Auth Studio
5
5
  */
@@ -1,5 +1,5 @@
1
- import { handleStudioRequest } from '../core/handler.js';
2
- import { injectEventHooks } from '../utils/hook-injector.js';
1
+ import { handleStudioRequest } from "../core/handler.js";
2
+ import { injectEventHooks } from "../utils/hook-injector.js";
3
3
  /**
4
4
  * Elysia adapter for Better Auth Studio
5
5
  */
@@ -14,28 +14,28 @@ export function betterAuthStudio(config) {
14
14
  return sendElysiaResponse(context, universalRes);
15
15
  }
16
16
  catch (error) {
17
- console.error('Studio handler error:', error);
17
+ console.error("Studio handler error:", error);
18
18
  context.set.status = 500;
19
- return { error: 'Internal server error' };
19
+ return { error: "Internal server error" };
20
20
  }
21
21
  };
22
22
  }
23
23
  async function convertElysiaToUniversal(context) {
24
24
  let body;
25
25
  const method = context.request.method;
26
- if (method !== 'GET' && method !== 'HEAD') {
26
+ if (method !== "GET" && method !== "HEAD") {
27
27
  const elysiaBody = context.body ?? context.query ?? undefined;
28
28
  if (elysiaBody !== undefined) {
29
29
  body = elysiaBody;
30
30
  }
31
31
  else {
32
- const contentType = context.request.headers.get('content-type') || '';
32
+ const contentType = context.request.headers.get("content-type") || "";
33
33
  try {
34
- if (contentType.includes('application/json')) {
34
+ if (contentType.includes("application/json")) {
35
35
  body = await context.request.json();
36
36
  }
37
- else if (contentType.includes('application/x-www-form-urlencoded') ||
38
- contentType.includes('multipart/form-data')) {
37
+ else if (contentType.includes("application/x-www-form-urlencoded") ||
38
+ contentType.includes("multipart/form-data")) {
39
39
  const formData = await context.request.formData();
40
40
  body = Object.fromEntries(formData.entries());
41
41
  }
@@ -78,9 +78,9 @@ function sendElysiaResponse(context, universal) {
78
78
  headers: universal.headers,
79
79
  });
80
80
  }
81
- else if (typeof universal.body === 'string') {
82
- const contentType = universal.headers['content-type'] || universal.headers['Content-Type'] || '';
83
- if (contentType.includes('application/json')) {
81
+ else if (typeof universal.body === "string") {
82
+ const contentType = universal.headers["content-type"] || universal.headers["Content-Type"] || "";
83
+ if (contentType.includes("application/json")) {
84
84
  try {
85
85
  return JSON.parse(universal.body);
86
86
  }
@@ -88,7 +88,7 @@ function sendElysiaResponse(context, universal) {
88
88
  return universal.body;
89
89
  }
90
90
  }
91
- else if (contentType.includes('text/html')) {
91
+ else if (contentType.includes("text/html")) {
92
92
  return new Response(universal.body, {
93
93
  status: universal.status,
94
94
  headers: universal.headers,
@@ -1,5 +1,5 @@
1
- import type { Router as ExpressRouter } from 'express';
2
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { Router as ExpressRouter } from "express";
2
+ import type { StudioConfig } from "../types/handler.js";
3
3
  /**
4
4
  * Express adapter for Better Auth Studio
5
5
  */
@@ -1,6 +1,6 @@
1
- import { Router } from 'express';
2
- import { handleStudioRequest } from '../core/handler.js';
3
- import { injectEventHooks } from '../utils/hook-injector.js';
1
+ import { Router } from "express";
2
+ import { handleStudioRequest } from "../core/handler.js";
3
+ import { injectEventHooks } from "../utils/hook-injector.js";
4
4
  /**
5
5
  * Express adapter for Better Auth Studio
6
6
  */
@@ -9,7 +9,7 @@ export function betterAuthStudio(config) {
9
9
  injectEventHooks(config.auth, config.events);
10
10
  }
11
11
  const router = Router();
12
- router.all('*', async (req, res, next) => {
12
+ router.all("*", async (req, res, next) => {
13
13
  try {
14
14
  const universalReq = convertExpressToUniversal(req);
15
15
  const universalRes = await handleStudioRequest(universalReq, config);
@@ -1,5 +1,5 @@
1
- import type { Context } from 'hono';
2
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { Context } from "hono";
2
+ import type { StudioConfig } from "../types/handler.js";
3
3
  /**
4
4
  * Hono adapter for Better Auth Studio
5
5
  */
@@ -1,5 +1,5 @@
1
- import { handleStudioRequest } from '../core/handler.js';
2
- import { injectEventHooks } from '../utils/hook-injector.js';
1
+ import { handleStudioRequest } from "../core/handler.js";
2
+ import { injectEventHooks } from "../utils/hook-injector.js";
3
3
  /**
4
4
  * Hono adapter for Better Auth Studio
5
5
  */
@@ -14,23 +14,23 @@ export function betterAuthStudio(config) {
14
14
  return sendHonoResponse(c, universalRes);
15
15
  }
16
16
  catch (error) {
17
- console.error('Studio handler error:', error);
18
- return c.json({ error: 'Internal server error' }, 500);
17
+ console.error("Studio handler error:", error);
18
+ return c.json({ error: "Internal server error" }, 500);
19
19
  }
20
20
  };
21
21
  }
22
22
  async function convertHonoToUniversal(c) {
23
23
  let body;
24
24
  const method = c.req.method;
25
- if (method !== 'GET' && method !== 'HEAD') {
26
- const contentType = c.req.header('content-type') || '';
27
- if (contentType.includes('application/json')) {
25
+ if (method !== "GET" && method !== "HEAD") {
26
+ const contentType = c.req.header("content-type") || "";
27
+ if (contentType.includes("application/json")) {
28
28
  try {
29
29
  body = await c.req.json();
30
30
  }
31
31
  catch { }
32
32
  }
33
- else if (contentType.includes('application/x-www-form-urlencoded')) {
33
+ else if (contentType.includes("application/x-www-form-urlencoded")) {
34
34
  try {
35
35
  body = await c.req.parseBody();
36
36
  }
@@ -58,9 +58,9 @@ function sendHonoResponse(c, universal) {
58
58
  if (Buffer.isBuffer(universal.body)) {
59
59
  return c.body(universal.body);
60
60
  }
61
- else if (typeof universal.body === 'string') {
62
- const contentType = universal.headers['content-type'] || universal.headers['Content-Type'] || '';
63
- if (contentType.includes('application/json')) {
61
+ else if (typeof universal.body === "string") {
62
+ const contentType = universal.headers["content-type"] || universal.headers["Content-Type"] || "";
63
+ if (contentType.includes("application/json")) {
64
64
  try {
65
65
  return c.json(JSON.parse(universal.body));
66
66
  }
@@ -68,7 +68,7 @@ function sendHonoResponse(c, universal) {
68
68
  return c.text(universal.body);
69
69
  }
70
70
  }
71
- else if (contentType.includes('text/html')) {
71
+ else if (contentType.includes("text/html")) {
72
72
  return c.html(universal.body);
73
73
  }
74
74
  else {
@@ -1,3 +1,3 @@
1
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { StudioConfig } from "../types/handler.js";
2
2
  export declare function betterAuthStudio(config: StudioConfig): (request: Request) => Promise<Response>;
3
3
  //# sourceMappingURL=nextjs.d.ts.map
@@ -1,9 +1,9 @@
1
- import { handleStudioRequest } from '../core/handler.js';
2
- import { injectEventHooks } from '../utils/hook-injector.js';
1
+ import { handleStudioRequest } from "../core/handler.js";
2
+ import { injectEventHooks } from "../utils/hook-injector.js";
3
3
  function getUrlFromRequest(req) {
4
4
  const nextUrl = req.nextUrl;
5
- if (nextUrl && typeof nextUrl.pathname === 'string') {
6
- return nextUrl.pathname + (nextUrl.search || '');
5
+ if (nextUrl && typeof nextUrl.pathname === "string") {
6
+ return nextUrl.pathname + (nextUrl.search || "");
7
7
  }
8
8
  const url = new URL(req.url);
9
9
  return url.pathname + url.search;
@@ -19,19 +19,19 @@ export function betterAuthStudio(config) {
19
19
  return universalToResponse(universalResponse);
20
20
  }
21
21
  catch (error) {
22
- console.error('Studio handler error:', error);
23
- return new Response(JSON.stringify({ error: 'Internal server error' }), {
22
+ console.error("Studio handler error:", error);
23
+ return new Response(JSON.stringify({ error: "Internal server error" }), {
24
24
  status: 500,
25
- headers: { 'Content-Type': 'application/json' },
25
+ headers: { "Content-Type": "application/json" },
26
26
  });
27
27
  }
28
28
  };
29
29
  }
30
30
  async function requestToUniversal(req) {
31
31
  let body;
32
- if (req.method !== 'GET' && req.method !== 'HEAD') {
33
- const contentType = req.headers.get('content-type') || '';
34
- if (contentType.includes('application/json')) {
32
+ if (req.method !== "GET" && req.method !== "HEAD") {
33
+ const contentType = req.headers.get("content-type") || "";
34
+ if (contentType.includes("application/json")) {
35
35
  try {
36
36
  body = await req.json();
37
37
  }
@@ -1,4 +1,4 @@
1
- import type { StudioConfig } from '../types/handler.js';
1
+ import type { StudioConfig } from "../types/handler.js";
2
2
  /**
3
3
  * Nuxt adapter for Better Auth Studio
4
4
  *