@auth/surrealdb-adapter
Auth.js / NextAuth.js 的官方 SurrealDB 适配器。
安装
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;
};类型参数
| 类型参数 | 值 |
|---|---|
T | string |
类型声明
access_token?
optional access_token: string;expires_at?
optional expires_at: number;id
id: string;提供商
provider: string;providerAccountId
providerAccountId: string;refresh_token?
optional refresh_token: string;类型
type: Extract<ProviderType, "oauth" | "oidc" | "email" | "webauthn">;userId
userId: T;SessionDoc<T>
type SessionDoc<T>: Document & {
userId: T;
};类型声明
userId
userId: T;类型参数
| 类型参数 | 值 |
|---|---|
T | string |
UserDoc
type UserDoc: Document & {
email: string;
};类型声明
电子邮件
email: string;SurrealDBAdapter()
SurrealDBAdapter<T>(client): Adapter类型参数
| 类型参数 |
|---|
T |
参数
| 参数 | 类型 |
|---|---|
客户端 | Promise<WebSocketStrategy | HTTPStrategy<T>> |
返回值
toId()
toId(surrealId): string参数
| 参数 | 类型 |
|---|---|
surrealId | string |
返回值
string
toSurrealId()
toSurrealId(id): string参数
| 参数 | 类型 |
|---|---|
id | string |
返回值
string