Skip to content

feat(adapters): add defineAdapter for uniform framework integrations#71

Open
johnstonmatt wants to merge 2 commits into
mainfrom
FUNC-655/defineAdapter-for-uniform-integrations
Open

feat(adapters): add defineAdapter for uniform framework integrations#71
johnstonmatt wants to merge 2 commits into
mainfrom
FUNC-655/defineAdapter-for-uniform-integrations

Conversation

@johnstonmatt
Copy link
Copy Markdown
Contributor

@johnstonmatt johnstonmatt commented May 26, 2026

This pull request introduces a new, unified adapter pattern for Supabase server framework integrations, specifically refactoring and enhancing the Elysia and H3 adapters, and updating the package exports to expose a shared adapter interface. The main changes add a dual-form withSupabase API to both Elysia and H3 adapters, allowing either plugin/middleware or direct route handler usage, and ensure consistent error handling and context reuse across frameworks. Comprehensive tests are added for the new handler form in Elysia, H3, and Hono. Package exports are updated to expose the new core adapter interface.

Adapter architecture and API improvements

  • Refactored the Elysia (src/adapters/elysia/plugin.ts) and H3 (src/adapters/h3/middleware.ts) adapters to use a new defineAdapter utility from core/adapters, enabling a unified, dual-form withSupabase API. This API supports both plugin/middleware form and direct route handler form, with consistent error handling and context reuse. [1] [2] [3] [4] [5] [6]

  • Enhanced documentation in both adapters to clearly explain the new dual-form API, usage patterns, and error handling expectations. [1] [2] [3]

Testing enhancements

  • Added comprehensive tests for the new two-argument (dual-form) withSupabase handler usage in Elysia (plugin.test.ts), H3 (middleware.test.ts), and Hono (middleware.test.ts), covering context reuse, error propagation, and direct Web Fetch compatibility. [1] [2] [3]

Package and export updates

  • Updated jsr.json and package.json to export the new core/adapters interface, making the adapter utility available for framework integrations. [1] [2]

Documentation and changelog

  • Minor formatting fixes in CHANGELOG.md for consistency.

References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

@johnstonmatt johnstonmatt requested review from a team as code owners May 26, 2026 16:28
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@71

commit: 37ee19a

JSR rejects destructured exports and exports without explicit type
annotations in the public API. Return `withSupabase` directly from
`defineAdapter` (instead of `{ withSupabase }`) and annotate each
adapter's exported `withSupabase` with `AdapterWithSupabase<...>`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant