feat: introduce @auth/sequelize-adapter (#7806)

Database adapters are not dependent on Next.js features, so it makes sense to republish them under the `@auth/*` scope.

This PR is part of a series to convert adapters, using `@auth/core` for types.

BREAKING CHANGE:
If you are coming from the previous adapter, change your `package.json`:

```diff
-  "@next-auth/sequelize-adapter": "0.0.0",
+  "@auth/sequelize-adapter": "0.0.0",
```

And run `npm install`, `yarn install` or `pnpm install` respectively.

**Note:** This packages is published as ESM-only
This commit is contained in:
Balázs Orbán
2023-06-14 13:38:15 +02:00
committed by GitHub
parent e7a52077c5
commit 5d06fa5852
8 changed files with 59 additions and 32 deletions

View File

@@ -30,7 +30,7 @@ body:
- "@auth/neo4j-adapter"
- "@auth/pouchdb-adapter"
- "@auth/prisma-adapter"
- "@next-auth/sequelize-adapter"
- "@auth/sequelize-adapter"
- "@next-auth/supabase-adapter"
- "@auth/typeorm-adapter"
- "@auth/upstash-redis-adapter"

View File

@@ -28,7 +28,7 @@ prisma:
- "@auth/prisma-adapter"
sequelize:
- "@next-auth/sequelize-adapter"
- "@auth/sequelize-adapter"
supabase:
- "@next-auth/supabase-adapter"

View File

@@ -8,14 +8,14 @@
</a>
<h3 align="center"><b>Sequelize Adapter</b> - NextAuth.js / Auth.js</a></h3>
<p align="center" style="align: center;">
<a href="https://npm.im/@next-auth/sequelize-adapter">
<a href="https://npm.im/@auth/sequelize-adapter">
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
</a>
<a href="https://npm.im/@next-auth/sequelize-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/sequelize-adapter?color=green&label=@next-auth/sequelize-adapter&style=flat-square">
<a href="https://npm.im/@auth/sequelize-adapter">
<img alt="npm" src="https://img.shields.io/npm/v/@auth/sequelize-adapter?color=green&label=@auth/sequelize-adapter&style=flat-square">
</a>
<a href="https://www.npmtrends.com/@next-auth/sequelize-adapter">
<img src="https://img.shields.io/npm/dm/@next-auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
<a href="https://www.npmtrends.com/@auth/sequelize-adapter">
<img src="https://img.shields.io/npm/dm/@auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
</a>
<a href="https://github.com/nextauthjs/next-auth/stargazers">
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

View File

@@ -1,14 +1,26 @@
{
"name": "@next-auth/sequelize-adapter",
"version": "1.0.8",
"description": "Sequelize adapter for next-auth.",
"name": "@auth/sequelize-adapter",
"version": "0.0.0.",
"description": "Sequelize adapter for Auth.js",
"homepage": "https://authjs.dev",
"repository": "https://github.com/nextauthjs/next-auth",
"bugs": {
"url": "https://github.com/nextauthjs/next-auth/issues"
},
"author": "github.com/luke-j",
"main": "dist/index.js",
"type": "module",
"types": "./index.d.ts",
"files": [
"*.js",
"*.d.ts*",
"src"
],
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js"
}
},
"license": "ISC",
"keywords": [
"next-auth",
@@ -21,25 +33,22 @@
"access": "public"
},
"scripts": {
"test:wip": "jest",
"test": "jest",
"build": "tsc"
},
"files": [
"README.md",
"dist"
],
"dependencies": {
"@auth/core": "workspace:*"
},
"peerDependencies": {
"next-auth": "^4",
"sequelize": "^6.6.5"
},
"devDependencies": {
"@next-auth/adapter-test": "workspace:*",
"@next-auth/tsconfig": "workspace:*",
"jest": "^27.4.3",
"next-auth": "workspace:*",
"sequelize": "^6.6.5"
},
"jest": {
"preset": "@next-auth/adapter-test/jest"
}
}
}

View File

@@ -9,10 +9,10 @@
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install next-auth @next-auth/sequelize-adapter sequelize
* npm install next-auth @auth/sequelize-adapter sequelize
* ```
*
* @module @next-auth/sequelize-adapter
* @module @auth/sequelize-adapter
*/
import type {
Adapter,
@@ -70,7 +70,7 @@ export interface SequelizeAdapterOptions {
*
* ```javascript title="pages/api/auth/[...nextauth].js"
* import NextAuth from "next-auth"
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
* import SequelizeAdapter from "@auth/sequelize-adapter"
* import { Sequelize } from "sequelize"
*
* // https://sequelize.org/master/manual/getting-started.html#connecting-to-a-database
@@ -93,7 +93,7 @@ export interface SequelizeAdapterOptions {
*
* ```js
* import NextAuth from "next-auth"
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
* import SequelizeAdapter from "@auth/sequelize-adapter"
* import Sequelize from 'sequelize'
*
* const sequelize = new Sequelize("sqlite::memory:")
@@ -117,7 +117,7 @@ export interface SequelizeAdapterOptions {
*
* ```js
* import NextAuth from "next-auth"
* import SequelizeAdapter, { models } from "@next-auth/sequelize-adapter"
* import SequelizeAdapter, { models } from "@auth/sequelize-adapter"
* import Sequelize, { DataTypes } from "sequelize"
*
* const sequelize = new Sequelize("sqlite::memory:")

View File

@@ -1,8 +1,25 @@
{
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
"extends": "@next-auth/tsconfig/tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"isolatedModules": true,
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "node",
"outDir": ".",
"rootDir": "src",
"outDir": "dist"
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"stripInternal": true,
"declarationMap": true,
"declaration": true
},
"exclude": ["tests", "dist", "jest.config.js"]
}
"include": [
"src/**/*"
],
"exclude": [
"*.js",
"*.d.ts",
]
}

5
pnpm-lock.yaml generated
View File

@@ -418,16 +418,17 @@ importers:
packages/adapter-sequelize:
specifiers:
'@auth/core': workspace:*
'@next-auth/adapter-test': workspace:*
'@next-auth/tsconfig': workspace:*
jest: ^27.4.3
next-auth: workspace:*
sequelize: ^6.6.5
dependencies:
'@auth/core': link:../core
devDependencies:
'@next-auth/adapter-test': link:../adapter-test
'@next-auth/tsconfig': link:../tsconfig
jest: 27.5.1
next-auth: link:../next-auth
sequelize: 6.21.0
packages/adapter-supabase:

View File

@@ -63,7 +63,7 @@
"@auth/mongodb-adapter#build",
"@auth/neo4j-adapter#build",
"@auth/pouchdb-adapter#build",
"@next-auth/sequelize-adapter#build",
"@auth/sequelize-adapter#build",
"@next-auth/supabase-adapter#build",
"@auth/typeorm-adapter#build",
"@auth/upstash-redis-adapter#build",
@@ -86,7 +86,7 @@
"@auth/mongodb-adapter#build",
"@auth/neo4j-adapter#build",
"@auth/pouchdb-adapter#build",
"@next-auth/sequelize-adapter#build",
"@auth/sequelize-adapter#build",
"@next-auth/supabase-adapter#build",
"@auth/typeorm-adapter#build",
"@auth/upstash-redis-adapter#build",