[PR #6283] [MERGED] chore: hoist endpoint schemas #14814

Closed
opened 2026-04-13 09:39:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6283
Author: @jonathansamines
Created: 11/25/2025
Status: Merged
Merged: 12/4/2025
Merged by: @Bekacru

Base: canaryHead: chore/hoist-schemas


📝 Commits (10+)

  • 610b961 chore(scim): move scim routes to its own file
  • 5678ecc chore(scim): hoist endpoint schemas to module scope
  • 8f7f1a7 chore(sso): hoist endpoint schemas to module scope
  • 7d32f17 chore(expo): hoist endpoint schemas to module scope
  • 31c8203 chore(passkey): move passkey endpoints to its own file
  • ed3aead chore(passkey): hoist endpoint schemas to module scope
  • a3d568f chore(stripe): move endpoints to its own file
  • 8eaa0fe chore(stripe): hoist endpoint schemas to the module scope
  • b7f5eab chore(better-auth): move endpoints to its own file
  • 55a334d chore(better-auth): hoist admin endpoints to module scope

📊 Changes

52 files changed (+10314 additions, -9859 deletions)

View changed files

📝 packages/better-auth/src/api/routes/sign-up.ts (+3 -1)
📝 packages/better-auth/src/api/routes/update-user.ts (+8 -6)
📝 packages/better-auth/src/plugins/admin/admin.ts (+35 -1602)
packages/better-auth/src/plugins/admin/routes.ts (+1636 -0)
📝 packages/better-auth/src/plugins/api-key/routes/create-api-key.ts (+82 -83)
📝 packages/better-auth/src/plugins/api-key/routes/delete-api-key.ts (+8 -5)
📝 packages/better-auth/src/plugins/api-key/routes/get-api-key.ts (+7 -5)
📝 packages/better-auth/src/plugins/api-key/routes/update-api-key.ts (+82 -79)
📝 packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts (+13 -11)
📝 packages/better-auth/src/plugins/device-authorization/index.ts (+12 -818)
packages/better-auth/src/plugins/device-authorization/routes.ts (+817 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+29 -1147)
packages/better-auth/src/plugins/email-otp/otp-token.ts (+61 -0)
packages/better-auth/src/plugins/email-otp/routes.ts (+1023 -0)
packages/better-auth/src/plugins/email-otp/types.ts (+82 -0)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+13 -904)
packages/better-auth/src/plugins/generic-oauth/routes.ts (+744 -0)
packages/better-auth/src/plugins/generic-oauth/types.ts (+161 -0)
📝 packages/better-auth/src/plugins/jwt/index.ts (+12 -8)
📝 packages/better-auth/src/plugins/magic-link/index.ts (+58 -56)

...and 32 more files

📄 Description

Summary by cubic

Hoisted endpoint schemas to module scope and split routes into dedicated files across the codebase to improve readability, reuse, and OpenAPI consistency. No API changes; includes small fixes to email-otp and username.

  • Refactors

    • Moved endpoints from plugin index files into routes.ts (admin, device-authorization, email-otp, generic-oauth, phone-number, passkey, scim, stripe, expo), and slimmed index files to wiring/middleware.
    • Hoisted zod schemas into top-level constants for request bodies/queries across many endpoints (e.g., sign-up, update-user, API key CRUD/verify, device auth, email OTP, OAuth, JWT sign/verify, magic link, MCP, multi-session, OAuth proxy, OIDC, One Tap, one-time token, organization/team/member CRUD, phone-number flows, SIWE nonce, 2FA backup/OTP/TOTP, username, SSO).
    • Added small helpers/types where needed (email-otp types and otp-token helpers, SCIM AuthMiddleware type, Stripe referenceMiddleware).
  • Bug Fixes

    • Fixed email-otp regression.
    • Resolved a username naming inconsistency.

Written for commit 47a7628624. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6283 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 11/25/2025 **Status:** ✅ Merged **Merged:** 12/4/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `chore/hoist-schemas` --- ### 📝 Commits (10+) - [`610b961`](https://github.com/better-auth/better-auth/commit/610b9613bda84531d7ff91581e2f2edcb45c3535) chore(scim): move scim routes to its own file - [`5678ecc`](https://github.com/better-auth/better-auth/commit/5678ecc937a4ad1406efc3e203a86cb782f33aab) chore(scim): hoist endpoint schemas to module scope - [`8f7f1a7`](https://github.com/better-auth/better-auth/commit/8f7f1a7e29fdeecc47cd894310f2410dfb27e139) chore(sso): hoist endpoint schemas to module scope - [`7d32f17`](https://github.com/better-auth/better-auth/commit/7d32f173c1ca94af00daf7f9fabfe6c677e5e254) chore(expo): hoist endpoint schemas to module scope - [`31c8203`](https://github.com/better-auth/better-auth/commit/31c8203a4ebc9a63b395d511baae11788839b6ba) chore(passkey): move passkey endpoints to its own file - [`ed3aead`](https://github.com/better-auth/better-auth/commit/ed3aead37f225b5920ebdfbdebe15c7ba2912574) chore(passkey): hoist endpoint schemas to module scope - [`a3d568f`](https://github.com/better-auth/better-auth/commit/a3d568f47b7fc6d1bca155b17ced0d24f85adfb8) chore(stripe): move endpoints to its own file - [`8eaa0fe`](https://github.com/better-auth/better-auth/commit/8eaa0fe0280d70f5625971500dfa2555ea00897b) chore(stripe): hoist endpoint schemas to the module scope - [`b7f5eab`](https://github.com/better-auth/better-auth/commit/b7f5eab5c6cc1b63544b9dc01ab490b2cf59663c) chore(better-auth): move endpoints to its own file - [`55a334d`](https://github.com/better-auth/better-auth/commit/55a334d0463ed1ec6ef4b1efe56b18506fd1e2ea) chore(better-auth): hoist admin endpoints to module scope ### 📊 Changes **52 files changed** (+10314 additions, -9859 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/sign-up.ts` (+3 -1) 📝 `packages/better-auth/src/api/routes/update-user.ts` (+8 -6) 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+35 -1602) ➕ `packages/better-auth/src/plugins/admin/routes.ts` (+1636 -0) 📝 `packages/better-auth/src/plugins/api-key/routes/create-api-key.ts` (+82 -83) 📝 `packages/better-auth/src/plugins/api-key/routes/delete-api-key.ts` (+8 -5) 📝 `packages/better-auth/src/plugins/api-key/routes/get-api-key.ts` (+7 -5) 📝 `packages/better-auth/src/plugins/api-key/routes/update-api-key.ts` (+82 -79) 📝 `packages/better-auth/src/plugins/api-key/routes/verify-api-key.ts` (+13 -11) 📝 `packages/better-auth/src/plugins/device-authorization/index.ts` (+12 -818) ➕ `packages/better-auth/src/plugins/device-authorization/routes.ts` (+817 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+29 -1147) ➕ `packages/better-auth/src/plugins/email-otp/otp-token.ts` (+61 -0) ➕ `packages/better-auth/src/plugins/email-otp/routes.ts` (+1023 -0) ➕ `packages/better-auth/src/plugins/email-otp/types.ts` (+82 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+13 -904) ➕ `packages/better-auth/src/plugins/generic-oauth/routes.ts` (+744 -0) ➕ `packages/better-auth/src/plugins/generic-oauth/types.ts` (+161 -0) 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+12 -8) 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+58 -56) _...and 32 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Hoisted endpoint schemas to module scope and split routes into dedicated files across the codebase to improve readability, reuse, and OpenAPI consistency. No API changes; includes small fixes to email-otp and username. - **Refactors** - Moved endpoints from plugin index files into routes.ts (admin, device-authorization, email-otp, generic-oauth, phone-number, passkey, scim, stripe, expo), and slimmed index files to wiring/middleware. - Hoisted zod schemas into top-level constants for request bodies/queries across many endpoints (e.g., sign-up, update-user, API key CRUD/verify, device auth, email OTP, OAuth, JWT sign/verify, magic link, MCP, multi-session, OAuth proxy, OIDC, One Tap, one-time token, organization/team/member CRUD, phone-number flows, SIWE nonce, 2FA backup/OTP/TOTP, username, SSO). - Added small helpers/types where needed (email-otp types and otp-token helpers, SCIM AuthMiddleware type, Stripe referenceMiddleware). - **Bug Fixes** - Fixed email-otp regression. - Resolved a username naming inconsistency. <sup>Written for commit 47a762862406a49ef6a938787e3ff346f7b3ac81. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:39:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14814