[PR #3265] [CLOSED] update(create-adapter): Fix bug, improve maintainability & testability #30327

Closed
opened 2026-04-17 21:26:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3265
Author: @ping-maxwell
Created: 7/5/2025
Status: Closed

Base: canaryHead: update/create-adapter-maintainability


📝 Commits (10+)

  • 93517dc update(create-adapter): Fix bug, improve maintainability & testability
  • db899e4 update: improve tests & add more checks in transformInput
  • f076fb8 revert json & jsonb
  • 85f85f8 chore: fix type err
  • 839ca6b chore: lint
  • 375fff5 fix(org): use correct slug lookup when setting active org
  • e37e673 docs: adding reference to surrealdb adapter rewrite (#3754)
  • 2afdd69 chore(demo): replace isLoading using useTransition (#3775)
  • 669ce3e fix(reddit): refresh access token should use basic auth (#3753)
  • 1932d04 docs: unify component implementations for consistency (#3799)

📊 Changes

65 files changed (+2956 additions, -1815 deletions)

View changed files

.changeset/kind-rice-poke.md (+5 -0)
.changeset/old-planets-camp.md (+5 -0)
📝 .github/workflows/ci.yml (+1 -2)
📝 demo/nextjs/app/client-test/page.tsx (+19 -21)
📝 demo/nextjs/app/dashboard/user-card.tsx (+21 -19)
📝 demo/nextjs/app/features.tsx (+0 -22)
📝 demo/nextjs/components/sign-in.tsx (+11 -11)
📝 docs/app/docs/[[...slug]]/page.client.tsx (+5 -8)
📝 docs/components/generate-apple-jwt.tsx (+45 -42)
📝 docs/components/landing/section-svg.tsx (+8 -17)
📝 docs/content/docs/adapters/community-adapters.mdx (+1 -0)
📝 docs/content/docs/adapters/mssql.mdx (+16 -12)
📝 docs/content/docs/adapters/mysql.mdx (+16 -12)
📝 docs/content/docs/adapters/postgresql.mdx (+16 -12)
📝 docs/content/docs/adapters/prisma.mdx (+16 -12)
📝 docs/content/docs/adapters/sqlite.mdx (+16 -12)
📝 docs/content/docs/guides/create-a-db-adapter.mdx (+26 -0)
📝 docs/content/docs/plugins/oidc-provider.mdx (+26 -3)
📝 docs/content/docs/plugins/stripe.mdx (+26 -1)
docs/public/images/guides/create-a-db-adapter/data-translation-dark.png (+0 -0)

...and 45 more files

📄 Description

  • Fixed transformInput to incorrectly transforms string arrays
  • Added supportsArrays and supportsNumbers in the adapter config. I realized I needed this when developing the Redis adapter.
  • Made create adapter config’s supportNumber, supportString, etc all required, rather than using defaults which could be incorrect, this requires the adapter maintainer to think about all of the types their database supports.
  • Moved a lot of the logic in the create-adapter out to it’s separate files to allow the createAdapter code to be less dense and drastically make it easier to read & maintain.
    • Also added tests for some of it's logic - such as transformInput
  • Improved/updated the create-a-database-adapter docs

🔄 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/3265 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 7/5/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `update/create-adapter-maintainability` --- ### 📝 Commits (10+) - [`93517dc`](https://github.com/better-auth/better-auth/commit/93517dcc8ca2d99b14be342732cca35a8bddb768) update(create-adapter): Fix bug, improve maintainability & testability - [`db899e4`](https://github.com/better-auth/better-auth/commit/db899e40ea8726578d2b4f9cc676a937cfc56d52) update: improve tests & add more checks in transformInput - [`f076fb8`](https://github.com/better-auth/better-auth/commit/f076fb8fadfa44fadd53350ce9dfd756c3ea7028) revert json & jsonb - [`85f85f8`](https://github.com/better-auth/better-auth/commit/85f85f8f27175152b6700dd1e4216161520010b5) chore: fix type err - [`839ca6b`](https://github.com/better-auth/better-auth/commit/839ca6ba21d7f959aaeaf21310a8348a997048cd) chore: lint - [`375fff5`](https://github.com/better-auth/better-auth/commit/375fff5ac15b18b1e205c3cff6903a6ac609d2ec) fix(org): use correct slug lookup when setting active org - [`e37e673`](https://github.com/better-auth/better-auth/commit/e37e673e0417b2e8cbe0fc6b6f9b7932bc53b0b5) docs: adding reference to surrealdb adapter rewrite (#3754) - [`2afdd69`](https://github.com/better-auth/better-auth/commit/2afdd69e957564312fb1d3d2007ddcda07ccc3b5) chore(demo): replace isLoading using `useTransition` (#3775) - [`669ce3e`](https://github.com/better-auth/better-auth/commit/669ce3e6b737ce7c1a9ce982bf092f00d7373fbc) fix(reddit): refresh access token should use `basic` auth (#3753) - [`1932d04`](https://github.com/better-auth/better-auth/commit/1932d04c5a5be9180dab446e32b4ee1d5f788d24) docs: unify component implementations for consistency (#3799) ### 📊 Changes **65 files changed** (+2956 additions, -1815 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/kind-rice-poke.md` (+5 -0) ➕ `.changeset/old-planets-camp.md` (+5 -0) 📝 `.github/workflows/ci.yml` (+1 -2) 📝 `demo/nextjs/app/client-test/page.tsx` (+19 -21) 📝 `demo/nextjs/app/dashboard/user-card.tsx` (+21 -19) 📝 `demo/nextjs/app/features.tsx` (+0 -22) 📝 `demo/nextjs/components/sign-in.tsx` (+11 -11) 📝 `docs/app/docs/[[...slug]]/page.client.tsx` (+5 -8) 📝 `docs/components/generate-apple-jwt.tsx` (+45 -42) 📝 `docs/components/landing/section-svg.tsx` (+8 -17) 📝 `docs/content/docs/adapters/community-adapters.mdx` (+1 -0) 📝 `docs/content/docs/adapters/mssql.mdx` (+16 -12) 📝 `docs/content/docs/adapters/mysql.mdx` (+16 -12) 📝 `docs/content/docs/adapters/postgresql.mdx` (+16 -12) 📝 `docs/content/docs/adapters/prisma.mdx` (+16 -12) 📝 `docs/content/docs/adapters/sqlite.mdx` (+16 -12) 📝 `docs/content/docs/guides/create-a-db-adapter.mdx` (+26 -0) 📝 `docs/content/docs/plugins/oidc-provider.mdx` (+26 -3) 📝 `docs/content/docs/plugins/stripe.mdx` (+26 -1) ➕ `docs/public/images/guides/create-a-db-adapter/data-translation-dark.png` (+0 -0) _...and 45 more files_ </details> ### 📄 Description - Fixed `transformInput` to incorrectly transforms string arrays - Added `supportsArrays` and `supportsNumbers` in the adapter config. I realized I needed this when developing the Redis adapter. - Made create adapter config’s `supportNumber`, `supportString`, etc all required, rather than using defaults which could be incorrect, this requires the adapter maintainer to think about all of the types their database supports. - Moved a lot of the logic in the create-adapter out to it’s separate files to allow the createAdapter code to be less dense and drastically make it easier to read & maintain. - Also added tests for some of it's logic - such as `transformInput` - Improved/updated the create-a-database-adapter docs --- <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-17 21:26: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#30327