Skip to content
需要从 NextAuth.js v4 升级到最新版本吗?请查阅 版本升级指南
API 参考手册@auth/typeorm-adapter

@auth/typeorm-adapter

Official TypeORM adapter for Auth.js / NextAuth.js.

Installation

npm install @auth/typeorm-adapter typeorm

TypeORMAdapterOptions

This is the interface for the TypeORM adapter options.

Properties

entities?

optional entities: entities;

The TypeORM entities to create the database tables from.


Entities

type Entities: typeof entities;

entities

const entities: entities = defaultEntities;

TypeORMAdapter()

TypeORMAdapter(dataSource, options?): Adapter

Parameters

ParameterType
dataSourcestring | DataSourceOptions
options?TypeORMAdapterOptions

Returns

Adapter


getManager()

getManager(options): Promise<EntityManager>

Parameters

ParameterType
optionsObject
options.dataSourcestring | DataSourceOptions
options.entitiesentities

Returns

Promise<EntityManager>