Skip to content

fix(adapter): transistion to surrealdb@^1.0.0 #11911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ccefb64
feat: transition from surrealdb.js beta to surrealdb@1.0.0
dvanmali Sep 26, 2024
b0a7bf9
fix: ensure correct adapter type is returned with verified is nulled …
dvanmali Sep 26, 2024
fd4690b
merge: fix conflicts from conflicts
dvanmali Sep 26, 2024
9756ad1
fix: remove log print on test
dvanmali Oct 2, 2024
14efdfe
feat: more AnyAuth login variables, support HTTP rpc connection, add …
dvanmali Oct 2, 2024
395f827
merge: with upstream/main
dvanmali Oct 2, 2024
1ee3a30
Merge branch 'main' of github.com:nextauthjs/next-auth
dvanmali Oct 2, 2024
d3aabc9
restore: changes
dvanmali Oct 2, 2024
34ebb2c
restore: changes
dvanmali Oct 2, 2024
bd1116b
doc: add all env variables available
dvanmali Oct 2, 2024
bc6b85c
fix: throw error not string
dvanmali Oct 2, 2024
36a9f2d
merge: upstream main
dvanmali Oct 9, 2024
c1af8dc
Merge branch 'main' into main
dvanmali Oct 25, 2024
102c8f0
Merge branch 'main' into main
dvanmali Nov 8, 2024
f15a43a
Merge branch 'main' into main
dvanmali Jan 14, 2025
1885d62
Merge branch 'main' into main
dvanmali Feb 10, 2025
59df6a3
Merge branch 'main' into main
dvanmali Mar 14, 2025
c5d2b61
Merge branch 'main' into main
ThangHuuVu May 10, 2025
5aade68
Merge branch 'main' into main
ThangHuuVu May 10, 2025
7c19313
merge: upstream
dvanmali May 12, 2025
89f9467
fix: uses surrealdb:^v1.3.0 for native reconnectivity, feat: add weba…
dvanmali May 13, 2025
293c64b
fix: creating user should use id() not randomUUID()
dvanmali May 13, 2025
fe650dd
fix: ignored files from prettier
dvanmali May 13, 2025
12c90ab
chore: upgrade lockfile as requested
dvanmali May 13, 2025
f7935b4
Merge branch 'main' into main
dvanmali May 13, 2025
5845c1f
Merge branch 'main' of github.com:nextauthjs/next-auth
dvanmali May 19, 2025
e0786c9
fix: tsc build errors
dvanmali May 19, 2025
7c27a9f
Merge branch 'main' of github.com:dvanmali/next-auth
dvanmali May 19, 2025
241426c
fix: tsc build errors
dvanmali May 19, 2025
c000302
Merge branch 'main' into main
dvanmali May 27, 2025
f27fa22
Merge branch 'main' into main
ndom91 Jun 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: tsc build errors
  • Loading branch information
dvanmali committed May 19, 2025
commit e0786c92f67474ecb39e9d2c73785dddba892c57
24 changes: 9 additions & 15 deletions packages/adapter-surrealdb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type VerificationTokenDoc = Document<RecordId<"verification_token">> & {
export type AuthenticatorDoc<T = RecordId<"user">> = Document<
RecordId<"authenticator">
> &
AdapterAuthenticator & {
Omit<AdapterAuthenticator, "userId"> & {
userId: T
counter: number
}
Expand Down Expand Up @@ -85,11 +85,7 @@ export const docToAuthenticator = (
doc: AuthenticatorDoc
): AdapterAuthenticator => ({
...doc,
id: doc.id.id.toString(),
userId:
doc.userId instanceof RecordId
? doc.userId.id.toString()
: doc.userId.id.id.toString(),
userId: doc.userId.id.toString(),
})

/** @internal */
Expand All @@ -111,13 +107,11 @@ export const docToSession = (
/** @internal */
// Convert DB object to Verification Token
export const docToVerificationToken = (
doc: Omit<VerificationTokenDoc, "id">
doc: VerificationTokenDoc
): VerificationToken => ({
...doc,
expires:
typeof doc?.expires === "string"
? new Date(Date.parse(doc.expires))
: (doc?.expires ?? null),
identifier: doc.identifier,
expires: doc.expires,
token: doc.token,
})

/** @internal */
Expand Down Expand Up @@ -441,7 +435,7 @@ export function SurrealDBAdapter(
verificationTokenDocs[0]
if (verificationTokenDoc.id) delete verificationTokenDoc.id
return docToVerificationToken(
verificationTokenDoc as Omit<VerificationTokenDoc, "id">
verificationTokenDoc as VerificationTokenDoc
)
}
} catch {}
Expand All @@ -467,7 +461,7 @@ export function SurrealDBAdapter(
const verificationTokenDoc: Partial<VerificationTokenDoc> = vt
if (verificationTokenDoc.id) delete verificationTokenDoc.id
return docToVerificationToken(
verificationTokenDoc as Omit<VerificationTokenDoc, "id">
verificationTokenDoc as VerificationTokenDoc
)
}
} else {
Expand Down Expand Up @@ -535,7 +529,7 @@ export function SurrealDBAdapter(

return authenticatorDocs.map((v) => docToAuthenticator(v))
} catch {}
return null
throw new Error("Verification Token not found")
},
async updateAuthenticatorCounter(
credentialId: AdapterAuthenticator["credentialID"],
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy