feat(adapter): Support supportsArrays option - #84
Open
Rebne wants to merge 3 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: 2ecd0f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Comment on lines
+25
to
+41
| test("accepts supportsArrays config", async () => { | ||
| const adapter = mikroOrmAdapter(orm, { | ||
| debugLogs: { | ||
| isRunningAdapterTests: true | ||
| }, | ||
| supportsArrays: true | ||
| })({}) | ||
|
|
||
| const user = randomUsers.createOne() | ||
| const actual = await adapter.create<UserInput, DatabaseUser>({ | ||
| model: "user", | ||
| data: user | ||
| }) | ||
|
|
||
| expect(actual).toMatchObject(user) | ||
| }) | ||
|
|
Owner
There was a problem hiding this comment.
I don't understand what's being tested here. From the description I'd say you should check that adapter has this option after it's being created. I think you can do it via:
expect(adapter.options?.adapterConfig.supportsArrays).toBe(true)
Comment on lines
+363
to
+387
| const users = await orm.em.find(entities.User, { | ||
| id: {$in: [user1.id, user2.id, user3.id]} | ||
| }) | ||
| const users: InstanceType<typeof entities.User>[] = await orm.em.find( | ||
| entities.User, | ||
| { | ||
| id: {$in: [user1.id, user2.id, user3.id]} | ||
| } | ||
| ) | ||
|
|
||
| expect(users.map(({emailVerified}) => emailVerified)).toMatchObject([ | ||
| expect(users.map(user => user.emailVerified)).toMatchObject([ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
==========================================
+ Coverage 92.51% 92.59% +0.07%
==========================================
Files 3 3
Lines 187 189 +2
Branches 47 49 +2
==========================================
+ Hits 173 175 +2
Misses 14 14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Rebne
force-pushed
the
feat/supports-arrays-option
branch
3 times, most recently
from
August 20, 2026 08:27
a181a73 to
50e550d
Compare
Rebne
force-pushed
the
feat/supports-arrays-option
branch
from
August 26, 2026 06:42
50e550d to
2ecd0f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Adds support for Better Auth's supportsArrays adapter capability flag in the MikroORM adapter.
Why
This adapter currently does not expose Better Auth’s supportsArrays capability, so Better Auth falls back to its default array serialization behavior.
For databases with native array support, that can lead to array fields being encoded twice. This PR adds support for passing supportsArrays through the MikroORM adapter so those setups can opt into the correct behavior.
Related issue
I ran into this while using Better Auth’s OAuth provider plugin, where several array-backed OAuth fields were being double-encoded when the adapter did not advertise native array support.
Changes
Checklist