[PR #5058] [MERGED] refactor: move BetterAuthAdvancedOptions to core #5746

Closed
opened 2026-03-13 12:34:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5058
Author: @himself65
Created: 10/2/2025
Status: Merged
Merged: 10/2/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/02/type


📝 Commits (2)

  • a3ad471 fix: deprecate options.advanced.generateId type
  • 3776fbc refactor: move BetterAuthAdvancedOptions to core

📊 Changes

7 files changed (+161 additions, -137 deletions)

View changed files

📝 packages/better-auth/src/init.ts (+2 -2)
📝 packages/better-auth/src/types/options.ts (+8 -133)
📝 packages/core/src/db/type.ts (+22 -0)
📝 packages/core/src/index.ts (+3 -1)
📝 packages/core/src/types/helper.ts (+5 -0)
📝 packages/core/src/types/index.ts (+2 -1)
packages/core/src/types/init-options.ts (+119 -0)

📄 Description

Please note that this PR removes options.generateId from the type.


Summary by cubic

Moved BetterAuthAdvancedOptions (and GenerateIdFn) to @better-auth/core to centralize shared types and make plugin/adapter reuse easier. Also removed advanced.generateId from the public type; use advanced.database.generateId instead.

  • Refactors

    • Added core/types/init-options.ts with BetterAuthAdvancedOptions and GenerateIdFn; re-exported from core.
    • Introduced Models union and helper types (LiteralUnion) in core; added BetterAuthMutators hook.
    • better-auth now imports BetterAuthAdvancedOptions from core and forbids advanced.generateId.
    • init uses GenerateIdFn from core when calling a custom generator.
  • Migration

    • Replace advanced.generateId with advanced.database.generateId.
    • Type errors will guide updates; behavior unchanged if you already use database.generateId.

🔄 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/5058 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/2/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/02/type` --- ### 📝 Commits (2) - [`a3ad471`](https://github.com/better-auth/better-auth/commit/a3ad4719bd7c09b0218f0804af7c2decd0152f2b) fix: deprecate `options.advanced.generateId` type - [`3776fbc`](https://github.com/better-auth/better-auth/commit/3776fbc7c6f5712f698664e70e309a342c963eff) refactor: move `BetterAuthAdvancedOptions` to core ### 📊 Changes **7 files changed** (+161 additions, -137 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/init.ts` (+2 -2) 📝 `packages/better-auth/src/types/options.ts` (+8 -133) 📝 `packages/core/src/db/type.ts` (+22 -0) 📝 `packages/core/src/index.ts` (+3 -1) 📝 `packages/core/src/types/helper.ts` (+5 -0) 📝 `packages/core/src/types/index.ts` (+2 -1) ➕ `packages/core/src/types/init-options.ts` (+119 -0) </details> ### 📄 Description Please note that this PR removes `options.generateId` from the type. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Moved BetterAuthAdvancedOptions (and GenerateIdFn) to @better-auth/core to centralize shared types and make plugin/adapter reuse easier. Also removed advanced.generateId from the public type; use advanced.database.generateId instead. - **Refactors** - Added core/types/init-options.ts with BetterAuthAdvancedOptions and GenerateIdFn; re-exported from core. - Introduced Models union and helper types (LiteralUnion) in core; added BetterAuthMutators hook. - better-auth now imports BetterAuthAdvancedOptions from core and forbids advanced.generateId. - init uses GenerateIdFn from core when calling a custom generator. - **Migration** - Replace advanced.generateId with advanced.database.generateId. - Type errors will guide updates; behavior unchanged if you already use database.generateId. <!-- 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-03-13 12:34:06 -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#5746