[PR #7157] [MERGED] chore(core): add hasPlugin API in AuthContext #7106

Closed
opened 2026-03-13 13:24:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7157
Author: @Paola3stefania
Created: 1/6/2026
Status: Merged
Merged: 1/7/2026
Merged by: @himself65

Base: canaryHead: feat/context-has-plugin


📝 Commits (10+)

📊 Changes

4 files changed (+84 additions, -11 deletions)

View changed files

📝 packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap (+1 -0)
📝 packages/better-auth/src/context/create-context.test.ts (+49 -0)
📝 packages/better-auth/src/context/create-context.ts (+10 -7)
📝 packages/core/src/types/context.ts (+24 -4)

📄 Description

Summary by cubic

Added a hasPlugin method to the auth context to check if a plugin is enabled by ID. This makes conditional logic simpler.

  • New Features
    • Context: hasPlugin(pluginId): boolean with Set-based lookup.
    • Shared getPlugin helper in createAuthContext; widened plugin ID typing to accept LiteralString in getPlugin/hasPlugin.
    • Tests cover enabled, disabled, no plugins, and multiple plugins.

Written for commit 7de0dd4cd9. 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/7157 **Author:** [@Paola3stefania](https://github.com/Paola3stefania) **Created:** 1/6/2026 **Status:** ✅ Merged **Merged:** 1/7/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/context-has-plugin` --- ### 📝 Commits (10+) - [`e162e93`](https://github.com/better-auth/better-auth/commit/e162e935057eab7acd5269482ab60cf4e0fe73fa) feat: has plugin - [`dc65786`](https://github.com/better-auth/better-auth/commit/dc65786598dd6561dae7bfc0113dee7d8a306e01) sanp - [`8fd2fe9`](https://github.com/better-auth/better-auth/commit/8fd2fe92b7e946324c201c1d779a08aa3d01c102) refactor - [`46e3b13`](https://github.com/better-auth/better-auth/commit/46e3b130833ccfff2c0b860981d8315a7e6678c8) make lint happy - [`19c77d4`](https://github.com/better-auth/better-auth/commit/19c77d4d61be44329979897e4c16e820bbceb7d8) fix set agaiin - [`726298f`](https://github.com/better-auth/better-auth/commit/726298fca6f47492f2cbed43836318a544b3809c) Merge branch 'canary' into feat/context-has-plugin - [`f1b8f13`](https://github.com/better-auth/better-auth/commit/f1b8f136ca89e6c53c9d6b1d4994f3ee85c0a279) Merge branch 'canary' into feat/context-has-plugin - [`f615e73`](https://github.com/better-auth/better-auth/commit/f615e73fd7f01791e449b8eebc42db101763891c) fix: type - [`ae5c73a`](https://github.com/better-auth/better-auth/commit/ae5c73ab074a8ccf4b59ab98b4ba5c239db34983) fix: type - [`7de0dd4`](https://github.com/better-auth/better-auth/commit/7de0dd4cd9454f7cf6dc3517d1197a1c38950a63) fix: type ### 📊 Changes **4 files changed** (+84 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap` (+1 -0) 📝 `packages/better-auth/src/context/create-context.test.ts` (+49 -0) 📝 `packages/better-auth/src/context/create-context.ts` (+10 -7) 📝 `packages/core/src/types/context.ts` (+24 -4) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added a hasPlugin method to the auth context to check if a plugin is enabled by ID. This makes conditional logic simpler. - **New Features** - Context: hasPlugin(pluginId): boolean with Set-based lookup. - Shared getPlugin helper in createAuthContext; widened plugin ID typing to accept LiteralString in getPlugin/hasPlugin. - Tests cover enabled, disabled, no plugins, and multiple plugins. <sup>Written for commit 7de0dd4cd9454f7cf6dc3517d1197a1c38950a63. 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:24:19 -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#7106