@auth/surrealdb-adapter
Official SurrealDB adapter for Auth.js / NextAuth.js.
Installation
npm install @auth/surrealdb-adapter surrealdb.jsAccountDoc<T>
type AccountDoc<T>: {
  access_token: string;
  expires_at: number;
  id: string;
  provider: string;
  providerAccountId: string;
  refresh_token: string;
  type: Extract<ProviderType, "oauth" | "oidc" | "email" | "webauthn">;
  userId: T;
};Type parameters
| Type parameter | Value | 
|---|---|
| T | string | 
Type declaration
access_token?
optional access_token: string;expires_at?
optional expires_at: number;id
id: string;provider
provider: string;providerAccountId
providerAccountId: string;refresh_token?
optional refresh_token: string;type
type: Extract<ProviderType, "oauth" | "oidc" | "email" | "webauthn">;userId
userId: T;SessionDoc<T>
type SessionDoc<T>: Document & {
  userId: T;
};Type declaration
userId
userId: T;Type parameters
| Type parameter | Value | 
|---|---|
| T | string | 
UserDoc
type UserDoc: Document & {
  email: string;
};Type declaration
email: string;SurrealDBAdapter()
SurrealDBAdapter<T>(client): AdapterType parameters
| Type parameter | 
|---|
| T | 
Parameters
| Parameter | Type | 
|---|---|
| client | Promise<WebSocketStrategy|HTTPStrategy<T>> | 
Returns
toId()
toId(surrealId): stringParameters
| Parameter | Type | 
|---|---|
| surrealId | string | 
Returns
string
toSurrealId()
toSurrealId(id): stringParameters
| Parameter | Type | 
|---|---|
| id | string | 
Returns
string