better-auth-studio 1.1.3-beta.5 → 1.1.3-beta.51
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/README.md +108 -16
- package/dist/adapters/astro.d.ts +0 -1
- package/dist/adapters/astro.js +5 -2
- package/dist/adapters/elysia.d.ts +0 -1
- package/dist/adapters/elysia.js +7 -33
- package/dist/adapters/express.d.ts +0 -1
- package/dist/adapters/express.js +4 -1
- package/dist/adapters/hono.d.ts +0 -1
- package/dist/adapters/hono.js +7 -27
- package/dist/adapters/nextjs.d.ts +0 -1
- package/dist/adapters/nextjs.js +5 -2
- package/dist/adapters/nuxt.d.ts +0 -1
- package/dist/adapters/nuxt.js +5 -2
- package/dist/adapters/remix.d.ts +0 -1
- package/dist/adapters/remix.js +5 -2
- package/dist/adapters/solid-start.d.ts +0 -1
- package/dist/adapters/solid-start.js +5 -2
- package/dist/adapters/svelte-kit.d.ts +0 -1
- package/dist/adapters/svelte-kit.js +5 -2
- package/dist/adapters/tanstack-start.d.ts +0 -1
- package/dist/adapters/tanstack-start.js +5 -2
- package/dist/add-svelte-kit-env-modules.d.ts +0 -1
- package/dist/add-svelte-kit-env-modules.js +0 -1
- package/dist/auth-adapter.d.ts +5 -2
- package/dist/auth-adapter.js +29 -3
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +6 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -1
- package/dist/core/handler.d.ts +0 -1
- package/dist/core/handler.js +36 -5
- package/dist/data.d.ts +0 -1
- package/dist/data.js +69 -14
- package/dist/geo-service.d.ts +0 -1
- package/dist/geo-service.js +0 -1
- package/dist/get-tsconfig-info.d.ts +0 -1
- package/dist/get-tsconfig-info.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/providers/events/helpers.d.ts +3 -2
- package/dist/providers/events/helpers.js +303 -93
- package/dist/public/assets/main-C-R_HO98.css +1 -0
- package/dist/public/assets/main-MRP9atW1.js +1267 -0
- package/dist/public/index.html +2 -2
- package/dist/public/shaders.png +0 -0
- package/dist/routes/api-router.d.ts +2 -3
- package/dist/routes/api-router.js +0 -1
- package/dist/routes.d.ts +2 -3
- package/dist/routes.js +785 -157
- package/dist/studio.d.ts +0 -1
- package/dist/studio.js +6 -4
- package/dist/types/events.d.ts +0 -1
- package/dist/types/events.js +34 -99
- package/dist/types/handler.d.ts +12 -2
- package/dist/types/handler.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/utils/access-rules.d.ts +19 -0
- package/dist/utils/access-rules.js +126 -0
- package/dist/utils/auth-callbacks-injector.d.ts +0 -1
- package/dist/utils/auth-callbacks-injector.js +0 -1
- package/dist/utils/database-detection.d.ts +0 -1
- package/dist/utils/database-detection.js +33 -4
- package/dist/utils/event-ingestion.d.ts +0 -1
- package/dist/utils/event-ingestion.js +1 -1
- package/dist/utils/hook-injector.d.ts +0 -1
- package/dist/utils/hook-injector.js +35 -34
- package/dist/utils/html-injector.d.ts +1 -7
- package/dist/utils/html-injector.js +15 -1
- package/dist/utils/org-hooks-injector.d.ts +0 -1
- package/dist/utils/org-hooks-injector.js +0 -1
- package/dist/utils/package-json.d.ts +1 -1
- package/dist/utils/package-json.js +21 -1
- package/dist/utils/paths.d.ts +0 -1
- package/dist/utils/paths.js +0 -1
- package/dist/utils/reason-messages.d.ts +5 -0
- package/dist/utils/reason-messages.js +32 -0
- package/dist/utils/session.d.ts +0 -1
- package/dist/utils/session.js +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -1
- package/package.json +3 -4
- package/dist/adapters/astro.d.ts.map +0 -1
- package/dist/adapters/astro.js.map +0 -1
- package/dist/adapters/elysia.d.ts.map +0 -1
- package/dist/adapters/elysia.js.map +0 -1
- package/dist/adapters/express.d.ts.map +0 -1
- package/dist/adapters/express.js.map +0 -1
- package/dist/adapters/hono.d.ts.map +0 -1
- package/dist/adapters/hono.js.map +0 -1
- package/dist/adapters/nextjs.d.ts.map +0 -1
- package/dist/adapters/nextjs.js.map +0 -1
- package/dist/adapters/nuxt.d.ts.map +0 -1
- package/dist/adapters/nuxt.js.map +0 -1
- package/dist/adapters/remix.d.ts.map +0 -1
- package/dist/adapters/remix.js.map +0 -1
- package/dist/adapters/solid-start.d.ts.map +0 -1
- package/dist/adapters/solid-start.js.map +0 -1
- package/dist/adapters/svelte-kit.d.ts.map +0 -1
- package/dist/adapters/svelte-kit.js.map +0 -1
- package/dist/adapters/tanstack-start.d.ts.map +0 -1
- package/dist/adapters/tanstack-start.js.map +0 -1
- package/dist/add-svelte-kit-env-modules.d.ts.map +0 -1
- package/dist/add-svelte-kit-env-modules.js.map +0 -1
- package/dist/auth-adapter.d.ts.map +0 -1
- package/dist/auth-adapter.js.map +0 -1
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/core/handler.d.ts.map +0 -1
- package/dist/core/handler.js.map +0 -1
- package/dist/data.d.ts.map +0 -1
- package/dist/data.js.map +0 -1
- package/dist/geo-service.d.ts.map +0 -1
- package/dist/geo-service.js.map +0 -1
- package/dist/get-tsconfig-info.d.ts.map +0 -1
- package/dist/get-tsconfig-info.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/providers/events/helpers.d.ts.map +0 -1
- package/dist/providers/events/helpers.js.map +0 -1
- package/dist/public/assets/main-BeTtwdv9.js +0 -1216
- package/dist/public/assets/main-Dx_SZlEy.css +0 -1
- package/dist/routes/api-router.d.ts.map +0 -1
- package/dist/routes/api-router.js.map +0 -1
- package/dist/routes.d.ts.map +0 -1
- package/dist/routes.js.map +0 -1
- package/dist/studio.d.ts.map +0 -1
- package/dist/studio.js.map +0 -1
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js.map +0 -1
- package/dist/types/handler.d.ts.map +0 -1
- package/dist/types/handler.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/auth-callbacks-injector.d.ts.map +0 -1
- package/dist/utils/auth-callbacks-injector.js.map +0 -1
- package/dist/utils/auth-callbacks-wrapper.d.ts +0 -7
- package/dist/utils/auth-callbacks-wrapper.d.ts.map +0 -1
- package/dist/utils/auth-callbacks-wrapper.js +0 -133
- package/dist/utils/auth-callbacks-wrapper.js.map +0 -1
- package/dist/utils/database-detection.d.ts.map +0 -1
- package/dist/utils/database-detection.js.map +0 -1
- package/dist/utils/database-hook-injector.d.ts +0 -3
- package/dist/utils/database-hook-injector.d.ts.map +0 -1
- package/dist/utils/database-hook-injector.js +0 -145
- package/dist/utils/database-hook-injector.js.map +0 -1
- package/dist/utils/email-otp-hooks-injector.d.ts +0 -45
- package/dist/utils/email-otp-hooks-injector.d.ts.map +0 -1
- package/dist/utils/email-otp-hooks-injector.js +0 -141
- package/dist/utils/email-otp-hooks-injector.js.map +0 -1
- package/dist/utils/event-ingestion.d.ts.map +0 -1
- package/dist/utils/event-ingestion.js.map +0 -1
- package/dist/utils/hook-injector.d.ts.map +0 -1
- package/dist/utils/hook-injector.js.map +0 -1
- package/dist/utils/html-injector.d.ts.map +0 -1
- package/dist/utils/html-injector.js.map +0 -1
- package/dist/utils/org-hooks-injector.d.ts.map +0 -1
- package/dist/utils/org-hooks-injector.js.map +0 -1
- package/dist/utils/org-hooks-wrapper.d.ts +0 -80
- package/dist/utils/org-hooks-wrapper.d.ts.map +0 -1
- package/dist/utils/org-hooks-wrapper.js +0 -807
- package/dist/utils/org-hooks-wrapper.js.map +0 -1
- package/dist/utils/organization-hooks-wrapper.d.ts +0 -44
- package/dist/utils/organization-hooks-wrapper.d.ts.map +0 -1
- package/dist/utils/organization-hooks-wrapper.js +0 -345
- package/dist/utils/organization-hooks-wrapper.js.map +0 -1
- package/dist/utils/package-json.d.ts.map +0 -1
- package/dist/utils/package-json.js.map +0 -1
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/server-init.d.ts +0 -10
- package/dist/utils/server-init.d.ts.map +0 -1
- package/dist/utils/server-init.js +0 -40
- package/dist/utils/server-init.js.map +0 -1
- package/dist/utils/session.d.ts.map +0 -1
- package/dist/utils/session.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
- package/public/assets/main-BeTtwdv9.js +0 -1216
- package/public/assets/main-Dx_SZlEy.css +0 -1
- package/public/favicon.svg +0 -6
- package/public/index.html +0 -14
- package/public/logo.png +0 -0
- package/public/vite.svg +0 -5
- package/scripts/download-geolite2.js +0 -42
- package/scripts/generate-default-db.js +0 -462
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
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.
|
|
8
8
|
|
|
9
|
+
## Demo Snapshot
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
9
13
|
## ✨ Try Better Auth Studio Demo
|
|
10
14
|
|
|
11
15
|
You can try a live, demo version of Better Auth Studio here:
|
|
@@ -21,11 +25,11 @@ This online demo lets you explore the admin studio UI. Please note this is a tes
|
|
|
21
25
|
|
|
22
26
|
### Hosted Version
|
|
23
27
|
|
|
24
|
-
For the hosted version
|
|
28
|
+
For the hosted version: **[better-auth.build](https://better-auth.build)**
|
|
25
29
|
|
|
26
30
|
### Installation
|
|
27
31
|
|
|
28
|
-
📖 **[Documentation](https://better-auth
|
|
32
|
+
📖 **[Documentation](https://better-auth.studio)**
|
|
29
33
|
|
|
30
34
|
**Recommended: Install as a dev dependency** (for project-specific versions):
|
|
31
35
|
|
|
@@ -77,7 +81,7 @@ Before using Better Auth Studio, ensure you have:
|
|
|
77
81
|
|
|
78
82
|
- **Node.js** (v18 or higher)
|
|
79
83
|
- **A Better Auth project** with a valid `auth.ts` configuration file
|
|
80
|
-
- **Database setup** (Prisma, Drizzle, or SQLite)
|
|
84
|
+
- **Database setup** (Prisma, Drizzle, Kysely, or SQLite)
|
|
81
85
|
|
|
82
86
|
## 🔧 Configuration
|
|
83
87
|
|
|
@@ -87,9 +91,10 @@ Better Auth Studio automatically detects and works with:
|
|
|
87
91
|
|
|
88
92
|
- **Prisma** (`prismaAdapter`)
|
|
89
93
|
- **Drizzle** (`drizzleAdapter`)
|
|
94
|
+
- **Kysely** (`database: { db, type }`)
|
|
90
95
|
- **SQLite** (`new Database()` from better-sqlite3)
|
|
91
|
-
- **PostgreSQL** (via Prisma or
|
|
92
|
-
- **MySQL** (via Prisma or
|
|
96
|
+
- **PostgreSQL** (via Prisma, Drizzle, or Kysely)
|
|
97
|
+
- **MySQL** (via Prisma, Drizzle, or Kysely)
|
|
93
98
|
|
|
94
99
|
### Example Configuration Files
|
|
95
100
|
|
|
@@ -127,6 +132,31 @@ export const auth = betterAuth({
|
|
|
127
132
|
});
|
|
128
133
|
```
|
|
129
134
|
|
|
135
|
+
#### Kysely Setup
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
// auth.ts
|
|
139
|
+
import { betterAuth } from "better-auth";
|
|
140
|
+
import { Kysely, PostgresDialect } from "kysely";
|
|
141
|
+
import { Pool } from "pg";
|
|
142
|
+
|
|
143
|
+
const db = new Kysely<any>({
|
|
144
|
+
dialect: new PostgresDialect({
|
|
145
|
+
pool: new Pool({
|
|
146
|
+
connectionString: process.env.DATABASE_URL,
|
|
147
|
+
}),
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export const auth = betterAuth({
|
|
152
|
+
database: {
|
|
153
|
+
db,
|
|
154
|
+
type: "postgres", // or "mysql", "sqlite", "mssql"
|
|
155
|
+
},
|
|
156
|
+
// ... other config
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
130
160
|
#### SQLite Setup
|
|
131
161
|
|
|
132
162
|
```typescript
|
|
@@ -154,7 +184,7 @@ export const auth = betterAuth({
|
|
|
154
184
|
- **Delete users** - Remove users from the system
|
|
155
185
|
- **Bulk operations** - Seed multiple test users
|
|
156
186
|
- **User details** - View user profiles, and accounts
|
|
157
|
-
- **Last seen** - When events are enabled, the studio injects an optional `lastSeenAt` field on the user model and updates it on each sign-in or session creation. Run your database migration (e.g. `prisma migrate dev
|
|
187
|
+
- **Last seen** - When events are enabled, the studio injects an optional `lastSeenAt` field on the user model and updates it on each sign-in or session creation. Run your database migration (e.g. `prisma migrate dev`, Drizzle push, or a Kysely migration) to add the `lastSeenAt` column to the user table.
|
|
158
188
|
|
|
159
189
|
### 🏢 Organization Management
|
|
160
190
|
|
|
@@ -183,12 +213,14 @@ pnpx better-auth-studio start [options]
|
|
|
183
213
|
|
|
184
214
|
**Options:**
|
|
185
215
|
|
|
186
|
-
- `--port <number>` - Specify port (default:
|
|
216
|
+
- `--port <number>` - Specify port (default: 3002)
|
|
187
217
|
- `--host <string>` - Specify host (default: localhost)
|
|
188
218
|
- `--no-open` - Don't automatically open browser
|
|
189
219
|
- `--config <path>` - Path to auth config file (default: auto-detect)
|
|
190
220
|
- `--watch` - Watch for changes in auth config file and reload server automatically
|
|
191
221
|
|
|
222
|
+
`3002` is just the standalone Studio default so it does not clash with apps that already use `3000`. You can run Studio on `3000`, `4000`, or any other free port.
|
|
223
|
+
|
|
192
224
|
**Examples:**
|
|
193
225
|
|
|
194
226
|
```bash
|
|
@@ -266,6 +298,62 @@ pnpm add better-auth-studio
|
|
|
266
298
|
|
|
267
299
|
> **Note:** The CLI usage (standalone studio) can be installed as a dev dependency, but self-hosting requires it in `dependencies` for production deployments.
|
|
268
300
|
|
|
301
|
+
### Docker (Standalone Self-Host)
|
|
302
|
+
|
|
303
|
+
If you want to run Better Auth Studio in its own container, this repository includes a Docker setup for the standalone CLI server.
|
|
304
|
+
|
|
305
|
+
This mode is useful when:
|
|
306
|
+
|
|
307
|
+
- you want a separate admin container
|
|
308
|
+
- your Better Auth app already lives in its own repository
|
|
309
|
+
- you want Docker-managed `node_modules` and package-manager cache volumes
|
|
310
|
+
|
|
311
|
+
> **Important:** The standalone container still needs your Better Auth project mounted into it, because Studio loads your real `auth.ts` and `studio.config.*` files at runtime.
|
|
312
|
+
|
|
313
|
+
Build the image from this repository:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
docker build -t better-auth-studio:self-host .
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Run it with Docker Compose:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
HOST_PROJECT_PATH=/absolute/path/to/your-better-auth-project \
|
|
323
|
+
CONFIG_PATH=./auth.ts \
|
|
324
|
+
docker compose -f docker/compose.yml up --build
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
If your auth config is not at the project root, pass it explicitly:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
HOST_PROJECT_PATH=/absolute/path/to/your-better-auth-project \
|
|
331
|
+
CONFIG_PATH=./src/lib/auth.ts \
|
|
332
|
+
docker compose -f docker/compose.yml up --build
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
If you already used the older filename, `docker/docker-compose.self-host.yml` still works too.
|
|
336
|
+
|
|
337
|
+
What the container does:
|
|
338
|
+
|
|
339
|
+
- mounts your Better Auth project into `/workspace`
|
|
340
|
+
- installs project dependencies into Docker volumes on first boot
|
|
341
|
+
- starts `better-auth-studio start --host 0.0.0.0 --port 3002 --no-open`
|
|
342
|
+
|
|
343
|
+
Useful environment variables:
|
|
344
|
+
|
|
345
|
+
- `HOST_PROJECT_PATH` - absolute path to your Better Auth project on the host machine
|
|
346
|
+
- `CONFIG_PATH` - optional auth config path inside the mounted project, for example `./src/lib/auth.ts`
|
|
347
|
+
- `PORT` - studio port, defaults to `3002`
|
|
348
|
+
- `WATCH` - set to `true` to enable watch mode
|
|
349
|
+
- `AUTO_INSTALL` - set to `false` if your container/project already has dependencies installed
|
|
350
|
+
- `PROJECT_INSTALL_CMD` - optional custom install command for non-standard setups
|
|
351
|
+
- `GEO_DB_PATH` - optional GeoLite database path inside the mounted project
|
|
352
|
+
|
|
353
|
+
If you change the Studio port, make sure your Better Auth config also trusts that origin when needed. The examples usually include both `http://localhost:3000` and `http://localhost:3002` for that reason.
|
|
354
|
+
|
|
355
|
+
If you already embed Studio in your server with the framework adapters below, that remains the recommended production setup. The Docker flow is mainly for running the standalone Studio server in a containerized environment.
|
|
356
|
+
|
|
269
357
|
### Setup
|
|
270
358
|
|
|
271
359
|
**Step 1: Initialize configuration**
|
|
@@ -290,6 +378,8 @@ const config: StudioConfig = {
|
|
|
290
378
|
access: {
|
|
291
379
|
roles: ["admin"],
|
|
292
380
|
allowEmails: ["admin@example.com"],
|
|
381
|
+
allowIpAddresses: ["127.0.0.1", "::1", "192.168.*"],
|
|
382
|
+
blockIpAddresses: ["203.0.113.45"],
|
|
293
383
|
},
|
|
294
384
|
};
|
|
295
385
|
|
|
@@ -335,15 +425,17 @@ Access at `http://localhost:3000/api/studio`
|
|
|
335
425
|
|
|
336
426
|
### Configuration Options
|
|
337
427
|
|
|
338
|
-
| Option
|
|
339
|
-
|
|
|
340
|
-
| `auth`
|
|
341
|
-
| `basePath`
|
|
342
|
-
| `access.allowEmails`
|
|
343
|
-
| `access.roles`
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
428
|
+
| Option | Required | Description |
|
|
429
|
+
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
430
|
+
| `auth` | Yes | Your Better Auth instance |
|
|
431
|
+
| `basePath` | Yes | URL path where studio is mounted |
|
|
432
|
+
| `access.allowEmails` | No | Array of admin email addresses |
|
|
433
|
+
| `access.roles` | No | Array of allowed user roles |
|
|
434
|
+
| `access.allowIpAddresses` | No | IP allowlist for Studio requests. Supports exact IPs and wildcard patterns (example: `192.168.*`) |
|
|
435
|
+
| `access.blockIpAddresses` | No | IP blocklist for Studio requests. Supports exact IPs and wildcard patterns |
|
|
436
|
+
| `ipAddress` | No | IP geolocation for Events/Sessions: `provider` ("ipinfo" \| "ipapi"), `apiToken`, `baseUrl`, optional `endpoint` (ipinfo: "lite" \| "lookup") |
|
|
437
|
+
| `lastSeenAt` | No | Enable last-seen tracking: `{ enabled: true, columnName?: string }` |
|
|
438
|
+
| `metadata` | No | Custom branding (title, theme) |
|
|
347
439
|
|
|
348
440
|
## 📝 Development
|
|
349
441
|
|
package/dist/adapters/astro.d.ts
CHANGED
package/dist/adapters/astro.js
CHANGED
|
@@ -93,9 +93,12 @@ async function convertAstroToUniversal(ctx, config) {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
function universalToResponse(res) {
|
|
96
|
+
const headers = new Headers(res.headers);
|
|
97
|
+
res.setCookies?.forEach((cookie) => {
|
|
98
|
+
headers.append("Set-Cookie", cookie);
|
|
99
|
+
});
|
|
96
100
|
return new Response(res.body, {
|
|
97
101
|
status: res.status,
|
|
98
|
-
headers
|
|
102
|
+
headers,
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
|
-
//# sourceMappingURL=astro.js.map
|
package/dist/adapters/elysia.js
CHANGED
|
@@ -70,38 +70,12 @@ async function convertElysiaToUniversal(context) {
|
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
function sendElysiaResponse(context, universal) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const headers = new Headers(universal.headers);
|
|
74
|
+
universal.setCookies?.forEach((cookie) => {
|
|
75
|
+
headers.append("Set-Cookie", cookie);
|
|
76
|
+
});
|
|
77
|
+
return new Response(universal.body, {
|
|
78
|
+
status: universal.status,
|
|
79
|
+
headers,
|
|
76
80
|
});
|
|
77
|
-
if (Buffer.isBuffer(universal.body)) {
|
|
78
|
-
return new Response(universal.body, {
|
|
79
|
-
status: universal.status,
|
|
80
|
-
headers: universal.headers,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else if (typeof universal.body === "string") {
|
|
84
|
-
const contentType = universal.headers["content-type"] || universal.headers["Content-Type"] || "";
|
|
85
|
-
if (contentType.includes("application/json")) {
|
|
86
|
-
try {
|
|
87
|
-
return JSON.parse(universal.body);
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
return universal.body;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else if (contentType.includes("text/html")) {
|
|
94
|
-
return new Response(universal.body, {
|
|
95
|
-
status: universal.status,
|
|
96
|
-
headers: universal.headers,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return universal.body;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
return String(universal.body);
|
|
105
|
-
}
|
|
106
81
|
}
|
|
107
|
-
//# sourceMappingURL=elysia.js.map
|
package/dist/adapters/express.js
CHANGED
|
@@ -28,6 +28,7 @@ function convertExpressToUniversal(req) {
|
|
|
28
28
|
url: req.originalUrl,
|
|
29
29
|
method: req.method,
|
|
30
30
|
headers: req.headers,
|
|
31
|
+
ip: req.ip,
|
|
31
32
|
body: req.body,
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -36,6 +37,9 @@ function sendExpressResponse(res, universal) {
|
|
|
36
37
|
Object.entries(universal.headers).forEach(([key, value]) => {
|
|
37
38
|
res.setHeader(key, value);
|
|
38
39
|
});
|
|
40
|
+
if (universal.setCookies?.length) {
|
|
41
|
+
res.setHeader("Set-Cookie", universal.setCookies);
|
|
42
|
+
}
|
|
39
43
|
if (Buffer.isBuffer(universal.body)) {
|
|
40
44
|
res.end(universal.body);
|
|
41
45
|
}
|
|
@@ -43,4 +47,3 @@ function sendExpressResponse(res, universal) {
|
|
|
43
47
|
res.send(universal.body);
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
|
-
//# sourceMappingURL=express.js.map
|
package/dist/adapters/hono.d.ts
CHANGED
package/dist/adapters/hono.js
CHANGED
|
@@ -53,32 +53,12 @@ async function convertHonoToUniversal(c) {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function sendHonoResponse(c, universal) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const headers = new Headers(universal.headers);
|
|
57
|
+
universal.setCookies?.forEach((cookie) => {
|
|
58
|
+
headers.append("Set-Cookie", cookie);
|
|
59
|
+
});
|
|
60
|
+
return new Response(universal.body, {
|
|
61
|
+
status: universal.status,
|
|
62
|
+
headers,
|
|
59
63
|
});
|
|
60
|
-
if (Buffer.isBuffer(universal.body)) {
|
|
61
|
-
return c.body(universal.body);
|
|
62
|
-
}
|
|
63
|
-
else if (typeof universal.body === "string") {
|
|
64
|
-
const contentType = universal.headers["content-type"] || universal.headers["Content-Type"] || "";
|
|
65
|
-
if (contentType.includes("application/json")) {
|
|
66
|
-
try {
|
|
67
|
-
return c.json(JSON.parse(universal.body));
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
return c.text(universal.body);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else if (contentType.includes("text/html")) {
|
|
74
|
-
return c.html(universal.body);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return c.text(universal.body);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
return c.text(String(universal.body));
|
|
82
|
-
}
|
|
83
64
|
}
|
|
84
|
-
//# sourceMappingURL=hono.js.map
|
package/dist/adapters/nextjs.js
CHANGED
|
@@ -52,9 +52,12 @@ async function requestToUniversal(req) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
function universalToResponse(res) {
|
|
55
|
+
const headers = new Headers(res.headers);
|
|
56
|
+
res.setCookies?.forEach((cookie) => {
|
|
57
|
+
headers.append("Set-Cookie", cookie);
|
|
58
|
+
});
|
|
55
59
|
return new Response(res.body, {
|
|
56
60
|
status: res.status,
|
|
57
|
-
headers
|
|
61
|
+
headers,
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
|
-
//# sourceMappingURL=nextjs.js.map
|
package/dist/adapters/nuxt.d.ts
CHANGED
package/dist/adapters/nuxt.js
CHANGED
|
@@ -112,9 +112,12 @@ function getRequestURL(event) {
|
|
|
112
112
|
function universalToResponse(res) {
|
|
113
113
|
// Simply return a Response object - Nuxt/h3 will handle it properly
|
|
114
114
|
// Nuxt will handle client disconnections automatically
|
|
115
|
+
const headers = new Headers(res.headers);
|
|
116
|
+
res.setCookies?.forEach((cookie) => {
|
|
117
|
+
headers.append("Set-Cookie", cookie);
|
|
118
|
+
});
|
|
115
119
|
return new Response(res.body, {
|
|
116
120
|
status: res.status,
|
|
117
|
-
headers
|
|
121
|
+
headers,
|
|
118
122
|
});
|
|
119
123
|
}
|
|
120
|
-
//# sourceMappingURL=nuxt.js.map
|
package/dist/adapters/remix.d.ts
CHANGED
package/dist/adapters/remix.js
CHANGED
|
@@ -96,9 +96,12 @@ async function convertRemixToUniversal({ request }, config) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
function universalToResponse(res) {
|
|
99
|
+
const headers = new Headers(res.headers);
|
|
100
|
+
res.setCookies?.forEach((cookie) => {
|
|
101
|
+
headers.append("Set-Cookie", cookie);
|
|
102
|
+
});
|
|
99
103
|
return new Response(res.body, {
|
|
100
104
|
status: res.status,
|
|
101
|
-
headers
|
|
105
|
+
headers,
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
|
-
//# sourceMappingURL=remix.js.map
|
|
@@ -94,9 +94,12 @@ async function convertSolidStartToUniversal(event, config) {
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
function universalToResponse(res) {
|
|
97
|
+
const headers = new Headers(res.headers);
|
|
98
|
+
res.setCookies?.forEach((cookie) => {
|
|
99
|
+
headers.append("Set-Cookie", cookie);
|
|
100
|
+
});
|
|
97
101
|
return new Response(res.body, {
|
|
98
102
|
status: res.status,
|
|
99
|
-
headers
|
|
103
|
+
headers,
|
|
100
104
|
});
|
|
101
105
|
}
|
|
102
|
-
//# sourceMappingURL=solid-start.js.map
|
|
@@ -106,9 +106,12 @@ async function convertSvelteKitToUniversal(event, config) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
function universalToResponse(res) {
|
|
109
|
+
const headers = new Headers(res.headers);
|
|
110
|
+
res.setCookies?.forEach((cookie) => {
|
|
111
|
+
headers.append("Set-Cookie", cookie);
|
|
112
|
+
});
|
|
109
113
|
return new Response(res.body, {
|
|
110
114
|
status: res.status,
|
|
111
|
-
headers
|
|
115
|
+
headers,
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
|
-
//# sourceMappingURL=svelte-kit.js.map
|
|
@@ -100,9 +100,12 @@ async function convertTanStackStartToUniversal(request, config) {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
function universalToResponse(res) {
|
|
103
|
+
const headers = new Headers(res.headers);
|
|
104
|
+
res.setCookies?.forEach((cookie) => {
|
|
105
|
+
headers.append("Set-Cookie", cookie);
|
|
106
|
+
});
|
|
103
107
|
return new Response(res.body, {
|
|
104
108
|
status: res.status,
|
|
105
|
-
headers
|
|
109
|
+
headers,
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
|
-
//# sourceMappingURL=tanstack-start.js.map
|
package/dist/auth-adapter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type InternalAdapter } from "better-auth";
|
|
2
2
|
type OptionalFields<T> = {
|
|
3
3
|
[K in keyof T]?: T[K];
|
|
4
4
|
};
|
|
@@ -8,6 +8,10 @@ export interface AuthAdapter extends UserInternalAdapter {
|
|
|
8
8
|
createAccount: (data: any) => Promise<any>;
|
|
9
9
|
createVerification: (data: any) => Promise<any>;
|
|
10
10
|
createOrganization: (data: any) => Promise<any>;
|
|
11
|
+
count?: (options: {
|
|
12
|
+
model: string;
|
|
13
|
+
where?: any;
|
|
14
|
+
}) => Promise<number>;
|
|
11
15
|
create?: (...args: any[]) => Promise<any>;
|
|
12
16
|
update?: (...args: any[]) => Promise<any>;
|
|
13
17
|
delete?: (...args: any[]) => Promise<any>;
|
|
@@ -34,4 +38,3 @@ export declare function createMockSession(adapter: AuthAdapter, userId: string,
|
|
|
34
38
|
export declare function createMockAccount(adapter: AuthAdapter, userId: string, index: number, providerId?: string): Promise<any>;
|
|
35
39
|
export declare function createMockVerification(adapter: AuthAdapter, _userId: string, index: number): Promise<any>;
|
|
36
40
|
export {};
|
|
37
|
-
//# sourceMappingURL=auth-adapter.d.ts.map
|
package/dist/auth-adapter.js
CHANGED
|
@@ -102,8 +102,14 @@ export async function getAuthAdapter(configPath) {
|
|
|
102
102
|
image: data.image || `https://api.dicebear.com/7.x/avataaars/svg?seed=${data.email}`,
|
|
103
103
|
},
|
|
104
104
|
});
|
|
105
|
-
const hashedPassword = await hashPassword(data.password);
|
|
106
105
|
if (data.password) {
|
|
106
|
+
let hashedPassword = data.password;
|
|
107
|
+
try {
|
|
108
|
+
hashedPassword = await hashPassword(data.password);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
console.log({ err });
|
|
112
|
+
}
|
|
107
113
|
try {
|
|
108
114
|
await adapter.create({
|
|
109
115
|
model: "account",
|
|
@@ -117,7 +123,9 @@ export async function getAuthAdapter(configPath) {
|
|
|
117
123
|
},
|
|
118
124
|
});
|
|
119
125
|
}
|
|
120
|
-
catch (_accountError) {
|
|
126
|
+
catch (_accountError) {
|
|
127
|
+
console.log({ _accountError });
|
|
128
|
+
}
|
|
121
129
|
}
|
|
122
130
|
return user;
|
|
123
131
|
},
|
|
@@ -193,6 +201,25 @@ export async function getAuthAdapter(configPath) {
|
|
|
193
201
|
return [];
|
|
194
202
|
}
|
|
195
203
|
},
|
|
204
|
+
count: async (options) => {
|
|
205
|
+
try {
|
|
206
|
+
if (typeof adapter.count === "function") {
|
|
207
|
+
return await adapter.count(options);
|
|
208
|
+
}
|
|
209
|
+
if (typeof adapter.findMany === "function") {
|
|
210
|
+
const rows = await adapter.findMany({
|
|
211
|
+
model: options.model,
|
|
212
|
+
where: options.where,
|
|
213
|
+
limit: 100000,
|
|
214
|
+
});
|
|
215
|
+
return Array.isArray(rows) ? rows.length : 0;
|
|
216
|
+
}
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
catch (_error) {
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
196
223
|
findMany: async (options) => {
|
|
197
224
|
try {
|
|
198
225
|
if (typeof adapter.findMany === "function") {
|
|
@@ -488,4 +515,3 @@ export async function createMockVerification(adapter, _userId, index) {
|
|
|
488
515
|
};
|
|
489
516
|
return await adapter.createVerification(verificationData);
|
|
490
517
|
}
|
|
491
|
-
//# sourceMappingURL=auth-adapter.js.map
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -281,6 +281,12 @@ program
|
|
|
281
281
|
else if (content.includes("prismaAdapter")) {
|
|
282
282
|
databaseInfo = "Prisma";
|
|
283
283
|
}
|
|
284
|
+
else if (content.includes("kyselyAdapter") ||
|
|
285
|
+
content.includes("Kysely") ||
|
|
286
|
+
content.includes('from "kysely"') ||
|
|
287
|
+
content.includes("from 'kysely'")) {
|
|
288
|
+
databaseInfo = "Kysely";
|
|
289
|
+
}
|
|
284
290
|
else if (authConfig.database.adapter && authConfig.database.provider) {
|
|
285
291
|
const adapter = authConfig.database.adapter;
|
|
286
292
|
const adapterName = adapter.charAt(0).toUpperCase() + adapter.slice(1);
|
|
@@ -364,4 +370,3 @@ program
|
|
|
364
370
|
}
|
|
365
371
|
});
|
|
366
372
|
program.parse();
|
|
367
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
package/dist/core/handler.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export declare function initializeEventIngestionAndHooks(config: StudioConfig):
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function handleStudioRequest(request: UniversalRequest, config: StudioConfig): Promise<UniversalResponse>;
|
|
11
11
|
export declare function getAuthAdapter(auth: any): Promise<any>;
|
|
12
|
-
//# sourceMappingURL=handler.d.ts.map
|