[PR #7362] [MERGED] feat(core): add version in AuthContext #7258

Closed
opened 2026-03-13 13:29:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7362
Author: @himself65
Created: 1/14/2026
Status: Merged
Merged: 1/14/2026
Merged by: @himself65

Base: canaryHead: himself65/2026/01/14/version


📝 Commits (5)

📊 Changes

11 files changed (+176 additions, -545 deletions)

View changed files

packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap (+0 -393)
📝 packages/better-auth/src/context/create-context.test.ts (+0 -7)
📝 packages/better-auth/src/context/create-context.ts (+3 -1)
📝 packages/core/src/context/endpoint-context.ts (+2 -2)
📝 packages/core/src/context/global.ts (+22 -8)
📝 packages/core/src/context/index.ts (+1 -0)
📝 packages/core/src/context/request-state.ts (+2 -2)
📝 packages/core/src/context/transaction.ts (+2 -2)
📝 packages/core/src/types/context.ts (+135 -130)
📝 packages/core/src/types/index.ts (+1 -0)
📝 packages/core/tsdown.config.ts (+8 -0)

📄 Description

Summary by cubic

Expose BetterAuth version at runtime and include it in AuthContext for easier debugging, telemetry, and cross-version safety.

  • New Features

    • AuthContext now includes version (and baseURL grouped under InfoContext).
    • Added getBetterAuthVersion() export.
    • Global context stores version and bumps epoch when multiple BetterAuth versions load in the same process.
  • Refactors

    • Introduced InfoContext and updated AuthContext to extend it (types-only restructure).
    • Inject BETTER_AUTH_VERSION from package.json via tsdown config.

Written for commit c75fd2afd3. Summary will update 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/7362 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/14/2026 **Status:** ✅ Merged **Merged:** 1/14/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2026/01/14/version` --- ### 📝 Commits (5) - [`49a1c71`](https://github.com/better-auth/better-auth/commit/49a1c71342186227089eb5f3307461b9b843e0a3) feat(core): add version in `AuthContext` - [`cca956e`](https://github.com/better-auth/better-auth/commit/cca956e6f9f149947b86aaf8e5936d993a7f9f5d) fix: type - [`3611788`](https://github.com/better-auth/better-auth/commit/36117888faf2c07ce0348d133c5bfef64b966a4b) remove test - [`3cdce1e`](https://github.com/better-auth/better-auth/commit/3cdce1e8696e85d3b266e33d22c51dd577cef2a3) fix: type - [`c75fd2a`](https://github.com/better-auth/better-auth/commit/c75fd2afd35bf68356648b8cf7c2627c8fbc7c87) feat: code ### 📊 Changes **11 files changed** (+176 additions, -545 deletions) <details> <summary>View changed files</summary> ➖ `packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap` (+0 -393) 📝 `packages/better-auth/src/context/create-context.test.ts` (+0 -7) 📝 `packages/better-auth/src/context/create-context.ts` (+3 -1) 📝 `packages/core/src/context/endpoint-context.ts` (+2 -2) 📝 `packages/core/src/context/global.ts` (+22 -8) 📝 `packages/core/src/context/index.ts` (+1 -0) 📝 `packages/core/src/context/request-state.ts` (+2 -2) 📝 `packages/core/src/context/transaction.ts` (+2 -2) 📝 `packages/core/src/types/context.ts` (+135 -130) 📝 `packages/core/src/types/index.ts` (+1 -0) 📝 `packages/core/tsdown.config.ts` (+8 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Expose BetterAuth version at runtime and include it in AuthContext for easier debugging, telemetry, and cross-version safety. - **New Features** - AuthContext now includes version (and baseURL grouped under InfoContext). - Added getBetterAuthVersion() export. - Global context stores version and bumps epoch when multiple BetterAuth versions load in the same process. - **Refactors** - Introduced InfoContext and updated AuthContext to extend it (types-only restructure). - Inject BETTER_AUTH_VERSION from package.json via tsdown config. <sup>Written for commit c75fd2afd35bf68356648b8cf7c2627c8fbc7c87. Summary will update 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-03-13 13:29:55 -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#7258