Skip to content

Commit 662e094

Browse files
feat: introduce @auth/xata-adapter (#7808)
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. If you are coming from the previous adapter, change your `package.json`: ```diff - "@next-auth/xata-adapter": "0.0.0", + "@auth/xata-adapter": "0.0.0", ``` And run `npm install`, `yarn install` or `pnpm install` respectively. **Note:** This packages is published as ESM-only
1 parent 91c71a1 commit 662e094

File tree

8 files changed

+58
-32
lines changed

8 files changed

+58
-32
lines changed

.github/ISSUE_TEMPLATE/3_bug_adapter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ body:
3434
- "@next-auth/supabase-adapter"
3535
- "@auth/typeorm-adapter"
3636
- "@auth/upstash-redis-adapter"
37-
- "@next-auth/xata-adapter"
37+
- "@auth/xata-adapter"
3838
validations:
3939
required: true
4040
- type: textarea

.github/issue-labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ upstash-redis:
4040
- "@auth/upstash-redis-adapter"
4141

4242
xata:
43-
- "@next-auth/xata-adapter"
43+
- "@auth/xata-adapter"

packages/adapter-xata/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
</a>
99
<h3 align="center"><b>Xata Adapter</b> - NextAuth.js / Auth.js</a></h3>
1010
<p align="center" style="align: center;">
11-
<a href="https://npm.im/@next-auth/xata-adapter">
11+
<a href="https://npm.im/@auth/xata-adapter">
1212
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
1313
</a>
14-
<a href="https://npm.im/@next-auth/xata-adapter">
15-
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/xata-adapter?color=green&label=@next-auth/xata-adapter&style=flat-square">
14+
<a href="https://npm.im/@auth/xata-adapter">
15+
<img alt="npm" src="https://img.shields.io/npm/v/@auth/xata-adapter?color=green&label=@auth/xata-adapter&style=flat-square">
1616
</a>
17-
<a href="https://www.npmtrends.com/@next-auth/xata-adapter">
18-
<img src="https://img.shields.io/npm/dm/@next-auth/xata-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
17+
<a href="https://www.npmtrends.com/@auth/xata-adapter">
18+
<img src="https://img.shields.io/npm/dm/@auth/xata-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
1919
</a>
2020
<a href="https://github.com/nextauthjs/next-auth/stargazers">
2121
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />

packages/adapter-xata/package.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
{
2-
"name": "@next-auth/xata-adapter",
3-
"version": "0.2.2",
4-
"description": "Xata adapter for next-auth.",
2+
"name": "@auth/xata-adapter",
3+
"version": "0.0.0",
4+
"description": "Xata adapter for Auth.js",
55
"homepage": "https://authjs.dev",
66
"repository": "https://github.com/nextauthjs/next-auth",
77
"bugs": {
88
"url": "https://github.com/nextauthjs/next-auth/issues"
99
},
1010
"author": "Tejas Kumar",
11-
"main": "dist/index.js",
11+
"type": "module",
12+
"types": "./index.d.ts",
13+
"files": [
14+
"*.js",
15+
"*.d.ts*",
16+
"src"
17+
],
18+
"exports": {
19+
".": {
20+
"types": "./index.d.ts",
21+
"import": "./index.js"
22+
}
23+
},
1224
"license": "ISC",
1325
"keywords": [
1426
"next-auth",
@@ -24,23 +36,20 @@
2436
"build": "tsc",
2537
"test": "jest"
2638
},
27-
"files": [
28-
"README.md",
29-
"dist"
30-
],
39+
"dependencies": {
40+
"@auth/core": "workspace:*"
41+
},
3142
"peerDependencies": {
32-
"@xata.io/client": ">=0.13.0",
33-
"next-auth": "^4"
43+
"@xata.io/client": ">=0.13.0"
3444
},
3545
"devDependencies": {
3646
"@next-auth/adapter-test": "workspace:^0.0.0",
3747
"@next-auth/tsconfig": "workspace:^0.0.0",
3848
"jest": "^27.4.3",
39-
"next-auth": "workspace:*",
4049
"@xata.io/client": "^0.13.0",
4150
"typescript": "^4.7.4"
4251
},
4352
"jest": {
4453
"preset": "@next-auth/adapter-test/jest"
4554
}
46-
}
55+
}

packages/adapter-xata/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* ```bash npm2yarn2pnpm
1212
* # Install Auth.js and the Xata adapter
13-
* npm install next-auth @next-auth/xata-adapter
13+
* npm install @auth/xata-adapter
1414
*
1515
* # Install the Xata CLI globally if you don't already have it
1616
* npm install --location=global @xata.io/cli
@@ -19,9 +19,9 @@
1919
* xata auth login
2020
* ```
2121
*
22-
* @module @next-auth/xata-adapter
22+
* @module @auth/xata-adapter
2323
*/
24-
import type { Adapter } from "next-auth/adapters"
24+
import type { Adapter } from "@auth/core/adapters"
2525

2626
import type { XataClient } from "./xata"
2727

@@ -220,7 +220,7 @@ import type { XataClient } from "./xata"
220220
* ```diff
221221
* import NextAuth from "next-auth"
222222
* import GoogleProvider from "next-auth/providers/google"
223-
* +import { XataAdapter } from "@next-auth/xata-adapter"
223+
* +import { XataAdapter } from "@auth/xata-adapter"
224224
* +import { XataClient } from "../../../xata" // or wherever you've chosen to create the client
225225
*
226226
* +const client = new XataClient()

packages/adapter-xata/tsconfig.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
{
2-
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
2+
"extends": "@next-auth/tsconfig/tsconfig.base.json",
33
"compilerOptions": {
4+
"allowJs": true,
5+
"baseUrl": ".",
6+
"isolatedModules": true,
7+
"target": "ES2020",
8+
"module": "ESNext",
9+
"moduleResolution": "node",
10+
"outDir": ".",
411
"rootDir": "src",
5-
"outDir": "dist"
12+
"skipDefaultLibCheck": true,
13+
"strictNullChecks": true,
14+
"stripInternal": true,
15+
"declarationMap": true,
16+
"declaration": true
617
},
7-
"include": ["."],
8-
"exclude": ["tests", "dist", "jest.config.js"]
9-
}
18+
"include": [
19+
"src/**/*"
20+
],
21+
"exclude": [
22+
"*.js",
23+
"*.d.ts",
24+
]
25+
}

pnpm-lock.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@next-auth/supabase-adapter#build",
6868
"@auth/typeorm-adapter#build",
6969
"@auth/upstash-redis-adapter#build",
70-
"@next-auth/xata-adapter#build",
70+
"@auth/xata-adapter#build",
7171
"^build",
7272
"next-auth#build"
7373
],
@@ -90,7 +90,7 @@
9090
"@next-auth/supabase-adapter#build",
9191
"@auth/typeorm-adapter#build",
9292
"@auth/upstash-redis-adapter#build",
93-
"@next-auth/xata-adapter#build",
93+
"@auth/xata-adapter#build",
9494
"^build",
9595
"next-auth#build"
9696
],

0 commit comments

Comments
 (0)