@auth/surrealdb-adapter
Auth.js / NextAuth.js 的官方 SurrealDB 适配器。
安裝
npm install @auth/surrealdb-adapter surrealdb.js
AccountDoc<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
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;
};
類型宣告
userId
userId: T;
類型參數
類型參數 | 值 |
---|---|
T | string |
UserDoc
type UserDoc: Document & {
email: string;
};
類型宣告
email: string;
SurrealDBAdapter()
SurrealDBAdapter<T>(client): Adapter
類型參數
類型參數 |
---|
T |
參數
參數 | 類型 |
---|---|
client | Promise <WebSocketStrategy | HTTPStrategy <T >> |
回傳值
toId()
toId(surrealId): string
參數
參數 | 類型 |
---|---|
surrealId | string |
回傳值
string
toSurrealId()
toSurrealId(id): string
參數
參數 | 類型 |
---|---|
id | string |
回傳值
string