mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
8 Commits
@auth/svel
...
@auth/mikr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65f4b9c942 | ||
|
|
1d29b0d220 | ||
|
|
cd92aa0c82 | ||
|
|
d414e01181 | ||
|
|
43deda5bfb | ||
|
|
7e79d8c509 | ||
|
|
ab051162a7 | ||
|
|
87298a0150 |
10
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
10
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
@@ -21,19 +21,19 @@ body:
|
||||
multiple: true
|
||||
options:
|
||||
- "Custom adapter"
|
||||
- "@next-auth/dgraph-adapter"
|
||||
- "@next-auth/dynamodb-adapter"
|
||||
- "@auth/dgraph-adapter"
|
||||
- "@auth/dynamodb-adapter"
|
||||
- "@next-auth/fauna-adapter"
|
||||
- "@next-auth/firebase-adapter"
|
||||
- "@next-auth/mikro-orm-adapter"
|
||||
- "@next-auth/mongodb-adapter"
|
||||
- "@auth/mikro-orm-adapter"
|
||||
- "@auth/mongodb-adapter"
|
||||
- "@next-auth/neo4j-adapter"
|
||||
- "@next-auth/pouchdb-adapter"
|
||||
- "@auth/prisma-adapter"
|
||||
- "@next-auth/sequelize-adapter"
|
||||
- "@next-auth/supabase-adapter"
|
||||
- "@auth/typeorm-adapter"
|
||||
- "@next-auth/upstash-redis-adapter"
|
||||
- "@auth/upstash-redis-adapter"
|
||||
- "@next-auth/xata-adapter"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
10
.github/issue-labeler.yml
vendored
10
.github/issue-labeler.yml
vendored
@@ -1,10 +1,10 @@
|
||||
# https://github.com/github/issue-labeler#basic-examples
|
||||
|
||||
dgraph:
|
||||
- "@next-auth/dgraph-adapter"
|
||||
- "@auth/dgraph-adapter"
|
||||
|
||||
dynamodb:
|
||||
- "@next-auth/dynamodb-adapter"
|
||||
- "@auth/dynamodb-adapter"
|
||||
|
||||
fauna:
|
||||
- "@next-auth/fauna-adapter"
|
||||
@@ -13,10 +13,10 @@ firebase:
|
||||
- "@next-auth/firebase-adapter"
|
||||
|
||||
mikro-orm:
|
||||
- "@next-auth/mikro-orm-adapter"
|
||||
- "@auth/mikro-orm-adapter"
|
||||
|
||||
mongodb:
|
||||
- "@next-auth/mongodb-adapter"
|
||||
- "@auth/mongodb-adapter"
|
||||
|
||||
neo4j:
|
||||
- "@next-auth/neo4j-adapter"
|
||||
@@ -37,7 +37,7 @@ typeorm:
|
||||
- "@auth/typeorm-adapter"
|
||||
|
||||
upstash-redis:
|
||||
- "@next-auth/upstash-redis-adapter"
|
||||
- "@auth/upstash-redis-adapter"
|
||||
|
||||
xata:
|
||||
- "@next-auth/xata-adapter"
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,6 +38,7 @@ packages/next-auth/next
|
||||
packages/*/*.js
|
||||
packages/*/*.d.ts
|
||||
packages/*/*.d.ts.map
|
||||
packages/*/lib
|
||||
|
||||
# Development app
|
||||
apps/dev/src/css
|
||||
|
||||
@@ -96,7 +96,7 @@ For this tutorial, we're going to use the **MongoDB** adapter, but any of the ot
|
||||
First, let's start by installing the adapter package:
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
npm install -D @next-auth/mongodb-adapter mongodb
|
||||
npm install -D @auth/mongodb-adapter mongodb
|
||||
```
|
||||
|
||||
and create a simple MongoDB client:
|
||||
@@ -142,7 +142,7 @@ And now let's reference this new adapter from our Auth.js configuration file:
|
||||
```diff title="pages/api/auth/[...nextauth].ts"
|
||||
import NextAuth from "next-auth"
|
||||
import EmailProvider from "next-auth/providers/email"
|
||||
+ import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
|
||||
+ import { MongoDBAdapter } from "@auth/mongodb-adapter"
|
||||
+ import clientPromise from "../../../lib/mongodb/client"
|
||||
|
||||
export default NextAuth({
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
</a>
|
||||
<h3 align="center"><b>Dgraph Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||
<p align="center" style="align: center;">
|
||||
<a href="https://npm.im/@next-auth/dgraph-adapter">
|
||||
<a href="https://npm.im/@auth/dgraph-adapter">
|
||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||
</a>
|
||||
<a href="https://npm.im/@next-auth/dgraph-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/dgraph-adapter?color=green&label=@next-auth/dgraph-adapter&style=flat-square">
|
||||
<a href="https://npm.im/@auth/dgraph-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dgraph-adapter?color=green&label=@auth/dgraph-adapter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.npmtrends.com/@next-auth/dgraph-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@next-auth/dgraph-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||
<a href="https://www.npmtrends.com/@auth/dgraph-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@auth/dgraph-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" />
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
{
|
||||
"name": "@next-auth/dgraph-adapter",
|
||||
"version": "1.0.6",
|
||||
"description": "Dgraph adapter for next-auth.",
|
||||
"name": "@auth/dgraph-adapter",
|
||||
"version": "1.0.0",
|
||||
"description": "Dgraph 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": "Arnaud Derbey <arnaud@derbey.dev>",
|
||||
"contributors": [],
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"index.d.ts"
|
||||
"contributors": [
|
||||
"Balázs Orbán <info@balazsorban.com>"
|
||||
],
|
||||
"type": "module",
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.d.ts*",
|
||||
"lib",
|
||||
"src"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
}
|
||||
},
|
||||
"license": "ISC",
|
||||
"keywords": [
|
||||
"next-auth",
|
||||
@@ -29,10 +40,6 @@
|
||||
"build": "tsc",
|
||||
"test": "./tests/test.sh"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"next-auth": "^4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next-auth/adapter-test": "workspace:*",
|
||||
"@next-auth/tsconfig": "workspace:*",
|
||||
@@ -40,12 +47,12 @@
|
||||
"@types/jsonwebtoken": "^8.5.5",
|
||||
"@types/node-fetch": "^2.5.11",
|
||||
"jest": "^27.4.3",
|
||||
"next-auth": "workspace:*",
|
||||
"ts-jest": "^27.0.3"
|
||||
"ts-jest": "^27.0.3",
|
||||
"undici": "5.22.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"node-fetch": "^2.6.1"
|
||||
"@auth/core": "workspace:*",
|
||||
"jsonwebtoken": "^8.5.1"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@next-auth/adapter-test/jest"
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
* ## Installation
|
||||
*
|
||||
* ```bash npm2yarn2pnpm
|
||||
* npm install next-auth @next-auth/dgraph-adapter
|
||||
* npm install next-auth @auth/dgraph-adapter
|
||||
* ```
|
||||
*
|
||||
* @module @next-auth/dgraph-adapter
|
||||
* @module @auth/dgraph-adapter
|
||||
*/
|
||||
import { client as dgraphClient } from "./client"
|
||||
import { format } from "./utils"
|
||||
import type { Adapter } from "next-auth/adapters"
|
||||
import type { DgraphClientParams } from "./client"
|
||||
import * as defaultFragments from "./graphql/fragments"
|
||||
import { client as dgraphClient } from "./lib/client"
|
||||
import { format } from "./lib/utils"
|
||||
import type { Adapter } from "@auth/core/adapters"
|
||||
import type { DgraphClientParams } from "./lib/client"
|
||||
import * as defaultFragments from "./lib/graphql/fragments"
|
||||
|
||||
export type { DgraphClientParams, DgraphClientError } from "./client"
|
||||
export type { DgraphClientParams, DgraphClientError } from "./lib/client"
|
||||
|
||||
/** This is the interface of the Dgraph adapter options. */
|
||||
export interface DgraphAdapterOptions {
|
||||
@@ -28,7 +28,7 @@ export interface DgraphAdapterOptions {
|
||||
* The GraphQL {@link https://dgraph.io/docs/query-language/fragments/ Fragments} you can supply to the adapter
|
||||
* to define how the shapes of the `user`, `account`, `session`, `verificationToken` entities look.
|
||||
*
|
||||
* By default the adapter will uses the [default defined fragments](https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-dgraph/src/graphql/fragments.ts)
|
||||
* By default the adapter will uses the [default defined fragments](https://github.com/nextauthjs/next-auth/blob/main/packages/adapter-dgraph/src/lib/graphql/fragments.ts)
|
||||
* , this config option allows to extend them.
|
||||
*/
|
||||
fragments?: {
|
||||
@@ -48,7 +48,7 @@ export { format }
|
||||
*
|
||||
* ```ts title="pages/api/auth/[...nextauth].js"
|
||||
* import NextAuth from "next-auth"
|
||||
* import { DgraphAdapter } from "@next-auth/dgraph-adapter"
|
||||
* import { DgraphAdapter } from "@auth/dgraph-adapter"
|
||||
*
|
||||
* export default NextAuth({
|
||||
* providers: [],
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import * as jwt from "jsonwebtoken"
|
||||
import fetch from "node-fetch"
|
||||
|
||||
import type { HeadersInit } from "node-fetch"
|
||||
|
||||
export interface DgraphClientParams {
|
||||
endpoint: string
|
||||
@@ -1,12 +1,14 @@
|
||||
import { DgraphAdapter, format } from "../src"
|
||||
import { client as dgraphClient } from "../src/client"
|
||||
import * as fragments from "../src/graphql/fragments"
|
||||
import { client as dgraphClient } from "../src/lib/client"
|
||||
import * as fragments from "../src/lib/graphql/fragments"
|
||||
import { runBasicTests } from "@next-auth/adapter-test"
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
import type { DgraphClientParams } from "../src"
|
||||
|
||||
globalThis.fetch ??= require("undici").fetch
|
||||
|
||||
const params: DgraphClientParams = {
|
||||
endpoint: "http://localhost:8080/graphql",
|
||||
authToken: "test",
|
||||
|
||||
@@ -21,7 +21,7 @@ dgraph/standalone
|
||||
|
||||
echo "Waiting 15 sec for db to start..." && sleep 15
|
||||
|
||||
head -n -1 src/graphql/schema.gql > tests/test.schema.gql
|
||||
head -n -1 src/lib/graphql/schema.gql > tests/test.schema.gql
|
||||
PUBLIC_KEY=$(sed 's/$/\\n/' tests/public.key | tr -d '\n')
|
||||
echo "# Dgraph.Authorization {\"VerificationKey\":\"$PUBLIC_KEY\",\"Namespace\":\"https://dgraph.io/jwt/claims\",\"Header\":\"Authorization\",\"Algo\":\"RS256\"}" >> tests/test.schema.gql
|
||||
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
@@ -8,14 +8,14 @@
|
||||
</a>
|
||||
<h3 align="center"><b>DynamoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||
<p align="center" style="align: center;">
|
||||
<a href="https://npm.im/@next-auth/dynamodb-adapter">
|
||||
<a href="https://npm.im/@auth/dynamodb-adapter">
|
||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||
</a>
|
||||
<a href="https://npm.im/@next-auth/dynamodb-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/dynamodb-adapter?color=green&label=@next-auth/dynamodb-adapter&style=flat-square">
|
||||
<a href="https://npm.im/@auth/dynamodb-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dynamodb-adapter?color=green&label=@auth/dynamodb-adapter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.npmtrends.com/@next-auth/dynamodb-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@next-auth/dynamodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||
<a href="https://www.npmtrends.com/@auth/dynamodb-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@auth/dynamodb-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" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@next-auth/dynamodb-adapter",
|
||||
"name": "@auth/dynamodb-adapter",
|
||||
"repository": "https://github.com/nextauthjs/next-auth",
|
||||
"version": "3.0.2",
|
||||
"version": "1.0.0",
|
||||
"description": "AWS DynamoDB adapter for next-auth.",
|
||||
"keywords": [
|
||||
"next-auth",
|
||||
@@ -9,18 +9,10 @@
|
||||
"oauth",
|
||||
"dynamodb"
|
||||
],
|
||||
"type": "module",
|
||||
"types": "./index.d.ts",
|
||||
"homepage": "https://authjs.dev",
|
||||
"bugs": {
|
||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
}
|
||||
},
|
||||
"private": false,
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -32,19 +24,27 @@
|
||||
"clean": "rm -rf index.*",
|
||||
"build": "pnpm clean && tsc"
|
||||
},
|
||||
"author": "Pol Marnette",
|
||||
"contributors": [
|
||||
"Balázs Orbán <info@balazsorban.com>"
|
||||
],
|
||||
"license": "ISC",
|
||||
"type": "module",
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
"README.md",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"index.d.ts.map",
|
||||
"*.js",
|
||||
"*.d.ts*",
|
||||
"src"
|
||||
],
|
||||
"author": "Pol Marnette",
|
||||
"license": "ISC",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
}
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@aws-sdk/client-dynamodb": "^3.36.1",
|
||||
"@aws-sdk/lib-dynamodb": "^3.36.1",
|
||||
"next-auth": "^4"
|
||||
"@aws-sdk/lib-dynamodb": "^3.36.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aws-sdk/client-dynamodb": "^3.36.1",
|
||||
@@ -52,11 +52,9 @@
|
||||
"@next-auth/adapter-test": "workspace:*",
|
||||
"@next-auth/tsconfig": "workspace:*",
|
||||
"@shelf/jest-dynamodb": "^2.1.0",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"jest": "^27.4.3",
|
||||
"next-auth": "workspace:*"
|
||||
"jest": "^27.4.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": "^9.0.0"
|
||||
"@auth/core": "workspace:*"
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,11 @@
|
||||
* ## Installation
|
||||
*
|
||||
* ```bash npm2yarn2pnpm
|
||||
* npm install next-auth @next-auth/dynamodb-adapter
|
||||
* npm install next-auth @auth/dynamodb-adapter
|
||||
* ```
|
||||
*
|
||||
* @module @next-auth/dynamodb-adapter
|
||||
* @module @auth/dynamodb-adapter
|
||||
*/
|
||||
import { v4 as uuid } from "uuid"
|
||||
|
||||
import type {
|
||||
BatchWriteCommandInput,
|
||||
@@ -26,7 +25,7 @@ import type {
|
||||
AdapterAccount,
|
||||
AdapterUser,
|
||||
VerificationToken,
|
||||
} from "next-auth/adapters"
|
||||
} from "@auth/core/adapters"
|
||||
|
||||
export interface DynamoDBAdapterOptions {
|
||||
tableName?: string
|
||||
@@ -53,7 +52,7 @@ export interface DynamoDBAdapterOptions {
|
||||
* import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb"
|
||||
* import NextAuth from "next-auth";
|
||||
* import Providers from "next-auth/providers";
|
||||
* import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter"
|
||||
* import { DynamoDBAdapter } from "@auth/dynamodb-adapter"
|
||||
*
|
||||
* const config: DynamoDBClientConfig = {
|
||||
* credentials: {
|
||||
@@ -187,7 +186,7 @@ export function DynamoDBAdapter(
|
||||
async createUser(data) {
|
||||
const user: AdapterUser = {
|
||||
...(data as any),
|
||||
id: uuid(),
|
||||
id: crypto.randomUUID(),
|
||||
}
|
||||
|
||||
await client.put({
|
||||
@@ -312,7 +311,7 @@ export function DynamoDBAdapter(
|
||||
async linkAccount(data) {
|
||||
const item = {
|
||||
...data,
|
||||
id: uuid(),
|
||||
id: crypto.randomUUID(),
|
||||
[pk]: `USER#${data.userId}`,
|
||||
[sk]: `ACCOUNT#${data.provider}#${data.providerAccountId}`,
|
||||
[GSI1PK]: `ACCOUNT#${data.provider}`,
|
||||
@@ -376,7 +375,7 @@ export function DynamoDBAdapter(
|
||||
},
|
||||
async createSession(data) {
|
||||
const session = {
|
||||
id: uuid(),
|
||||
id: crypto.randomUUID(),
|
||||
...data,
|
||||
}
|
||||
await client.put({
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
{
|
||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
||||
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": ".",
|
||||
"allowJs": true,
|
||||
"baseUrl": ".",
|
||||
"isolatedModules": true,
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": ".",
|
||||
"rootDir": "src",
|
||||
"skipDefaultLibCheck": true,
|
||||
"strictNullChecks": true,
|
||||
"stripInternal": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true
|
||||
},
|
||||
"exclude": ["tests", "dist", "jest.config.js", "jest-dynamodb-config.js"]
|
||||
}
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"*.js",
|
||||
"*.d.ts",
|
||||
]
|
||||
}
|
||||
1
packages/adapter-mikro-orm/.npmrc
Normal file
1
packages/adapter-mikro-orm/.npmrc
Normal file
@@ -0,0 +1 @@
|
||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||
@@ -8,14 +8,14 @@
|
||||
</a>
|
||||
<h3 align="center"><b>MikroORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||
<p align="center" style="align: center;">
|
||||
<a href="https://npm.im/@next-auth/mikro-orm-adapter">
|
||||
<a href="https://npm.im/@auth/mikro-orm-adapter">
|
||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||
</a>
|
||||
<a href="https://npm.im/@next-auth/mikro-orm-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/mikro-orm-adapter?color=green&label=@next-auth/mikro-orm-adapter&style=flat-square">
|
||||
<a href="https://npm.im/@auth/mikro-orm-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mikro-orm-adapter?color=green&label=@auth/mikro-orm-adapter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.npmtrends.com/@next-auth/mikro-orm-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@next-auth/mikro-orm-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||
<a href="https://www.npmtrends.com/@auth/mikro-orm-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@auth/mikro-orm-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" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@next-auth/mikro-orm-adapter",
|
||||
"version": "3.0.1",
|
||||
"description": "MikroORM adapter for next-auth.",
|
||||
"name": "@auth/mikro-orm-adapter",
|
||||
"version": "1.0.0",
|
||||
"description": "MikroORM adapter for Auth.js",
|
||||
"homepage": "https://authjs.dev",
|
||||
"repository": "https://github.com/nextauthjs/next-auth",
|
||||
"bugs": {
|
||||
@@ -11,7 +11,20 @@
|
||||
"contributors": [
|
||||
"Balázs Orbán <info@balazsorban.com>"
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.d.ts*",
|
||||
"lib",
|
||||
"src"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
}
|
||||
},
|
||||
"license": "ISC",
|
||||
"keywords": [
|
||||
"next-auth",
|
||||
@@ -27,27 +40,20 @@
|
||||
"test": "jest --runInBand",
|
||||
"build": "tsc"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@mikro-orm/core": "^5",
|
||||
"next-auth": "^4"
|
||||
"@mikro-orm/core": "^5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mikro-orm/core": "^5",
|
||||
"@mikro-orm/sqlite": "^5",
|
||||
"@next-auth/adapter-test": "workspace:*",
|
||||
"@next-auth/tsconfig": "workspace:*",
|
||||
"@types/uuid": ">=8",
|
||||
"jest": "^29",
|
||||
"next-auth": "workspace:*"
|
||||
"jest": "^29"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": "^9"
|
||||
"@auth/core": "workspace:*"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@next-auth/adapter-test/jest"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@
|
||||
* ## Installation
|
||||
*
|
||||
* ```bash npm2yarn2pnpm
|
||||
* npm install next-auth @next-auth/dynamodb-adapter @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
|
||||
* npm install @mikro-orm/core @auth/mikro-orm-adapter
|
||||
* ```
|
||||
*
|
||||
* @module @next-auth/dynamodb-adapter
|
||||
* @module @auth/mikro-orm-adapter
|
||||
*/
|
||||
import type {
|
||||
Connection,
|
||||
@@ -20,11 +20,11 @@ import type {
|
||||
Options as ORMOptions,
|
||||
} from "@mikro-orm/core"
|
||||
|
||||
import type { Adapter } from "next-auth/adapters"
|
||||
import type { Adapter } from "@auth/core/adapters"
|
||||
|
||||
import { MikroORM, wrap } from "@mikro-orm/core"
|
||||
|
||||
import * as defaultEntities from "./entities"
|
||||
import * as defaultEntities from "./lib/entities"
|
||||
|
||||
export { defaultEntities }
|
||||
|
||||
@@ -35,7 +35,7 @@ export { defaultEntities }
|
||||
*
|
||||
* ```typescript title="pages/api/auth/[...nextauth].ts"
|
||||
* import NextAuth from "next-auth"
|
||||
* import { MikroOrmAdapter } from "@next-auth/mikro-orm-adapter"
|
||||
* import { MikroOrmAdapter } from "@auth/mikro-orm-adapter"
|
||||
*
|
||||
* export default NextAuth({
|
||||
* adapter: MikroOrmAdapter({
|
||||
@@ -67,7 +67,7 @@ export { defaultEntities }
|
||||
* Property,
|
||||
* Unique,
|
||||
* } from "@mikro-orm/core"
|
||||
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
|
||||
* import { defaultEntities } from "@auth/mikro-orm-adapter"
|
||||
*
|
||||
* const { Account, Session } = defaultEntities
|
||||
*
|
||||
@@ -124,7 +124,7 @@ export { defaultEntities }
|
||||
*
|
||||
* ```typescript title="config/mikro-orm.ts"
|
||||
* import { Options } from "@mikro-orm/core";
|
||||
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
|
||||
* import { defaultEntities } from "@auth/mikro-orm-adapter"
|
||||
*
|
||||
* const config: Options = {
|
||||
* ...
|
||||
@@ -186,7 +186,6 @@ export function MikroOrmAdapter<
|
||||
* Method used in testing. You won't need to call this in your app.
|
||||
* @internal
|
||||
*/
|
||||
// @ts-expect-error
|
||||
async __disconnect() {
|
||||
const em = await getEM()
|
||||
await em.getConnection().close()
|
||||
@@ -240,6 +239,7 @@ export function MikroOrmAdapter<
|
||||
|
||||
return wrap(user).toObject()
|
||||
},
|
||||
// @ts-expect-error
|
||||
async linkAccount(data) {
|
||||
const em = await getEM()
|
||||
const user = await em.findOne(UserModel, { id: data.userId })
|
||||
@@ -251,6 +251,7 @@ export function MikroOrmAdapter<
|
||||
|
||||
return wrap(account).toObject()
|
||||
},
|
||||
// @ts-expect-error
|
||||
async unlinkAccount(provider_providerAccountId) {
|
||||
const em = await getEM()
|
||||
const account = await em.findOne(AccountModel, {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { v4 as randomUUID } from "uuid"
|
||||
|
||||
import {
|
||||
Property,
|
||||
Unique,
|
||||
@@ -16,8 +14,7 @@ import type {
|
||||
AdapterAccount,
|
||||
AdapterSession,
|
||||
VerificationToken as AdapterVerificationToken,
|
||||
} from "next-auth/adapters"
|
||||
import type { ProviderType } from "next-auth/providers"
|
||||
} from "@auth/core/adapters"
|
||||
|
||||
type RemoveIndex<T> = {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
@@ -27,7 +24,7 @@ type RemoveIndex<T> = {
|
||||
@Entity()
|
||||
export class User implements RemoveIndex<AdapterUser> {
|
||||
@PrimaryKey()
|
||||
id: string = randomUUID()
|
||||
id: string = crypto.randomUUID()
|
||||
|
||||
@Property({ type: types.string, nullable: true })
|
||||
name?: string
|
||||
@@ -63,7 +60,7 @@ export class User implements RemoveIndex<AdapterUser> {
|
||||
export class Session implements AdapterSession {
|
||||
@PrimaryKey()
|
||||
@Property({ type: types.string })
|
||||
id: string = randomUUID()
|
||||
id: string = crypto.randomUUID()
|
||||
|
||||
@ManyToOne({
|
||||
entity: "User",
|
||||
@@ -88,7 +85,7 @@ export class Session implements AdapterSession {
|
||||
export class Account implements RemoveIndex<AdapterAccount> {
|
||||
@PrimaryKey()
|
||||
@Property({ type: types.string })
|
||||
id: string = randomUUID()
|
||||
id: string = crypto.randomUUID()
|
||||
|
||||
@ManyToOne({
|
||||
entity: "User",
|
||||
@@ -101,7 +98,7 @@ export class Account implements RemoveIndex<AdapterAccount> {
|
||||
userId!: string
|
||||
|
||||
@Property({ type: types.string })
|
||||
type!: ProviderType
|
||||
type!: AdapterAccount["type"]
|
||||
|
||||
@Property({ type: types.string })
|
||||
provider!: string
|
||||
@@ -13,13 +13,15 @@ import {
|
||||
Options,
|
||||
types,
|
||||
} from "@mikro-orm/core"
|
||||
import { randomUUID, runBasicTests } from "@next-auth/adapter-test"
|
||||
import { runBasicTests } from "@next-auth/adapter-test"
|
||||
|
||||
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||
|
||||
@Entity()
|
||||
export class User implements defaultEntities.User {
|
||||
@PrimaryKey()
|
||||
@Property({ type: types.string })
|
||||
id: string = randomUUID()
|
||||
id: string = crypto.randomUUID()
|
||||
|
||||
@Property({ type: types.string, nullable: true })
|
||||
name?: string
|
||||
@@ -60,7 +62,7 @@ export class User implements defaultEntities.User {
|
||||
export class VeryImportantEntity {
|
||||
@PrimaryKey()
|
||||
@Property({ type: types.string })
|
||||
id: string = randomUUID()
|
||||
id: string = crypto.randomUUID()
|
||||
|
||||
@Property({ type: types.boolean })
|
||||
important = true
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
{
|
||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
||||
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"baseUrl": ".",
|
||||
"isolatedModules": true,
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": ".",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"stripInternal": true
|
||||
"skipDefaultLibCheck": true,
|
||||
"strictNullChecks": true,
|
||||
"stripInternal": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["dist", "test", "node_modules"]
|
||||
}
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"*.js",
|
||||
"*.d.ts",
|
||||
]
|
||||
}
|
||||
@@ -8,14 +8,14 @@
|
||||
</a>
|
||||
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||
<p align="center" style="align: center;">
|
||||
<a href="https://npm.im/@next-auth/mongodb-adapter">
|
||||
<a href="https://npm.im/@auth/mongodb-adapter">
|
||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||
</a>
|
||||
<a href="https://npm.im/@next-auth/mongodb-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/mongodb-adapter?color=green&label=@next-auth/mongodb-adapter&style=flat-square">
|
||||
<a href="https://npm.im/@auth/mongodb-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mongodb-adapter?color=green&label=@auth/mongodb-adapter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.npmtrends.com/@next-auth/mongodb-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@next-auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||
<a href="https://www.npmtrends.com/@auth/mongodb-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@auth/mongodb-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" />
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
{
|
||||
"name": "@next-auth/mongodb-adapter",
|
||||
"version": "1.1.3",
|
||||
"description": "mongoDB adapter for next-auth.",
|
||||
"name": "@auth/mongodb-adapter",
|
||||
"version": "1.0.0",
|
||||
"description": "MongoDB 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": "Balázs Orbán <info@balazsorban.com>",
|
||||
"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",
|
||||
@@ -26,20 +38,17 @@
|
||||
"test:watch": "./tests/test.sh -w",
|
||||
"build": "tsc"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@auth/core": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"mongodb": "^5 || ^4",
|
||||
"next-auth": "^4"
|
||||
"mongodb": "^5 || ^4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next-auth/adapter-test": "workspace:*",
|
||||
"@next-auth/tsconfig": "workspace:*",
|
||||
"jest": "^27.4.3",
|
||||
"mongodb": "^5.1.0",
|
||||
"next-auth": "workspace:*"
|
||||
"mongodb": "^5.1.0"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@next-auth/adapter-test/jest"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* ## Installation
|
||||
*
|
||||
* ```bash npm2yarn2pnpm
|
||||
* npm install next-auth @next-auth/mongodb-adapter mongodb
|
||||
* npm install @auth/mongodb-adapter mongodb
|
||||
* ```
|
||||
*
|
||||
* @module @next-auth/mongodb-adapter
|
||||
* @module @auth/mongodb-adapter
|
||||
*/
|
||||
import { ObjectId } from "mongodb"
|
||||
|
||||
@@ -22,7 +22,7 @@ import type {
|
||||
AdapterAccount,
|
||||
AdapterSession,
|
||||
VerificationToken,
|
||||
} from "next-auth/adapters"
|
||||
} from "@auth/core/adapters"
|
||||
import type { MongoClient } from "mongodb"
|
||||
|
||||
/** This is the interface of the MongoDB adapter options. */
|
||||
@@ -132,7 +132,7 @@ export function _id(hex?: string) {
|
||||
*
|
||||
* ```js
|
||||
* import NextAuth from "next-auth"
|
||||
* import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
|
||||
* import { MongoDBAdapter } from "@auth/mongodb-adapter"
|
||||
* import clientPromise from "../../../lib/mongodb"
|
||||
*
|
||||
* // For more information on each option (and a full list of options) go to
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
1
packages/adapter-upstash-redis/.npmrc
Normal file
1
packages/adapter-upstash-redis/.npmrc
Normal file
@@ -0,0 +1 @@
|
||||
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||
@@ -8,14 +8,14 @@
|
||||
</a>
|
||||
<h3 align="center"><b>Upstash Redis Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||
<p align="center" style="align: center;">
|
||||
<a href="https://npm.im/@next-auth/upstash-redis-adapter">
|
||||
<a href="https://npm.im/@auth/upstash-redis-adapter">
|
||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||
</a>
|
||||
<a href="https://npm.im/@next-auth/upstash-redis-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/upstash-redis-adapter?color=green&label=@next-auth/upstash-redis-adapter&style=flat-square">
|
||||
<a href="https://npm.im/@auth/upstash-redis-adapter">
|
||||
<img alt="npm" src="https://img.shields.io/npm/v/@auth/upstash-redis-adapter?color=green&label=@auth/upstash-redis-adapter&style=flat-square">
|
||||
</a>
|
||||
<a href="https://www.npmtrends.com/@next-auth/upstash-redis-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@next-auth/upstash-redis-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||
<a href="https://www.npmtrends.com/@auth/upstash-redis-adapter">
|
||||
<img src="https://img.shields.io/npm/dm/@auth/upstash-redis-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" />
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
{
|
||||
"name": "@next-auth/upstash-redis-adapter",
|
||||
"version": "3.0.4",
|
||||
"description": "Upstash adapter for next-auth. It uses Upstash's connectionless (HTTP based) Redis client.",
|
||||
"name": "@auth/upstash-redis-adapter",
|
||||
"version": "1.0.0",
|
||||
"description": "Upstash 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/kay-is",
|
||||
"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",
|
||||
@@ -25,13 +37,11 @@
|
||||
"test": "jest",
|
||||
"build": "tsc"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@auth/core": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@upstash/redis": "^1.0.1",
|
||||
"next-auth": "^4"
|
||||
"@upstash/redis": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next-auth/adapter-test": "workspace:*",
|
||||
@@ -43,9 +53,6 @@
|
||||
"jest": "^27.4.3",
|
||||
"next-auth": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@next-auth/adapter-test/jest"
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* ## Installation
|
||||
*
|
||||
* ```bash npm2yarn2pnpm
|
||||
* npm install @upstash/redis @next-auth/upstash-redis-adapter
|
||||
* npm install @upstash/redis @auth/upstash-redis-adapter
|
||||
* ```
|
||||
*
|
||||
* @module @next-auth/upstash-redis-adapter
|
||||
* @module @auth/upstash-redis-adapter
|
||||
*/
|
||||
import type {
|
||||
Adapter,
|
||||
@@ -20,11 +20,9 @@ import type {
|
||||
AdapterAccount,
|
||||
AdapterSession,
|
||||
VerificationToken,
|
||||
} from "next-auth/adapters"
|
||||
} from "@auth/core/adapters"
|
||||
import type { Redis } from "@upstash/redis"
|
||||
|
||||
import { v4 as uuid } from "uuid"
|
||||
|
||||
/** This is the interface of the Upstash Redis adapter options. */
|
||||
export interface UpstashRedisAdapterOptions {
|
||||
/**
|
||||
@@ -93,7 +91,7 @@ export function hydrateDates(json: object) {
|
||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||
* import NextAuth from "next-auth"
|
||||
* import GoogleProvider from "next-auth/providers/google"
|
||||
* import { UpstashRedisAdapter } from "@next-auth/upstash-redis-adapter"
|
||||
* import { UpstashRedisAdapter } from "@auth/upstash-redis-adapter"
|
||||
* import upstashRedisClient from "@upstash/redis"
|
||||
*
|
||||
* const redis = upstashRedisClient(
|
||||
@@ -217,7 +215,7 @@ export function UpstashRedisAdapter(
|
||||
|
||||
return {
|
||||
async createUser(user) {
|
||||
const id = uuid()
|
||||
const id = crypto.randomUUID()
|
||||
// TypeScript thinks the emailVerified field is missing
|
||||
// but all fields are copied directly from user, so it's there
|
||||
return await setUser(id, { ...user, id })
|
||||
|
||||
@@ -4,6 +4,8 @@ import { runBasicTests } from "@next-auth/adapter-test"
|
||||
import { hydrateDates, UpstashRedisAdapter } from "../src"
|
||||
import "dotenv/config"
|
||||
|
||||
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||
|
||||
if (!process.env.UPSTASH_REDIS_URL || !process.env.UPSTASH_REDIS_KEY) {
|
||||
test("Skipping UpstashRedisAdapter tests, since required environment variables aren't available", () => {
|
||||
expect(true).toBe(true)
|
||||
@@ -27,6 +29,7 @@ const client = new Redis({
|
||||
runBasicTests({
|
||||
adapter: UpstashRedisAdapter(client, { baseKeyPrefix: "testApp:" }),
|
||||
db: {
|
||||
disconnect: client.flushdb,
|
||||
async user(id: string) {
|
||||
const data = await client.get<object>(`testApp:user:${id}`)
|
||||
if (!data) return null
|
||||
@@ -48,7 +51,7 @@ runBasicTests({
|
||||
},
|
||||
async verificationToken(where) {
|
||||
const data = await client.get<object>(
|
||||
`testApp:user:token:${where.identifier}`
|
||||
`testApp:user:token:${where.identifier}:${where.token}`
|
||||
)
|
||||
if (!data) return null
|
||||
return hydrateDates(data)
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
}
|
||||
37
pnpm-lock.yaml
generated
37
pnpm-lock.yaml
generated
@@ -251,6 +251,7 @@ importers:
|
||||
|
||||
packages/adapter-dgraph:
|
||||
specifiers:
|
||||
'@auth/core': workspace:*
|
||||
'@next-auth/adapter-test': workspace:*
|
||||
'@next-auth/tsconfig': workspace:*
|
||||
'@types/jest': ^26.0.24
|
||||
@@ -258,12 +259,11 @@ importers:
|
||||
'@types/node-fetch': ^2.5.11
|
||||
jest: ^27.4.3
|
||||
jsonwebtoken: ^8.5.1
|
||||
next-auth: workspace:*
|
||||
node-fetch: ^2.6.1
|
||||
ts-jest: ^27.0.3
|
||||
undici: 5.22.1
|
||||
dependencies:
|
||||
'@auth/core': link:../core
|
||||
jsonwebtoken: 8.5.1
|
||||
node-fetch: 2.6.7
|
||||
devDependencies:
|
||||
'@next-auth/adapter-test': link:../adapter-test
|
||||
'@next-auth/tsconfig': link:../tsconfig
|
||||
@@ -271,31 +271,27 @@ importers:
|
||||
'@types/jsonwebtoken': 8.5.8
|
||||
'@types/node-fetch': 2.6.2
|
||||
jest: 27.5.1
|
||||
next-auth: link:../next-auth
|
||||
ts-jest: 27.1.5_lvqy56smyn5gszh3zmisfmhukm
|
||||
undici: 5.22.1
|
||||
|
||||
packages/adapter-dynamodb:
|
||||
specifiers:
|
||||
'@auth/core': workspace:*
|
||||
'@aws-sdk/client-dynamodb': ^3.36.1
|
||||
'@aws-sdk/lib-dynamodb': ^3.36.1
|
||||
'@next-auth/adapter-test': workspace:*
|
||||
'@next-auth/tsconfig': workspace:*
|
||||
'@shelf/jest-dynamodb': ^2.1.0
|
||||
'@types/uuid': ^9.0.0
|
||||
jest: ^27.4.3
|
||||
next-auth: workspace:*
|
||||
uuid: ^9.0.0
|
||||
dependencies:
|
||||
uuid: 9.0.0
|
||||
'@auth/core': link:../core
|
||||
devDependencies:
|
||||
'@aws-sdk/client-dynamodb': 3.113.0
|
||||
'@aws-sdk/lib-dynamodb': 3.113.0_eb2z3hhrjl3qvyc6ecmpo2nhva
|
||||
'@next-auth/adapter-test': link:../adapter-test
|
||||
'@next-auth/tsconfig': link:../tsconfig
|
||||
'@shelf/jest-dynamodb': 2.2.4_qsruu6yolbxs4rh6ixjhkibvwu
|
||||
'@types/uuid': 9.0.0
|
||||
jest: 27.5.1
|
||||
next-auth: link:../next-auth
|
||||
|
||||
packages/adapter-fauna:
|
||||
specifiers:
|
||||
@@ -331,38 +327,35 @@ importers:
|
||||
|
||||
packages/adapter-mikro-orm:
|
||||
specifiers:
|
||||
'@auth/core': workspace:*
|
||||
'@mikro-orm/core': ^5
|
||||
'@mikro-orm/sqlite': ^5
|
||||
'@next-auth/adapter-test': workspace:*
|
||||
'@next-auth/tsconfig': workspace:*
|
||||
'@types/uuid': '>=8'
|
||||
jest: ^29
|
||||
next-auth: workspace:*
|
||||
uuid: ^9
|
||||
dependencies:
|
||||
uuid: 9.0.0
|
||||
'@auth/core': link:../core
|
||||
devDependencies:
|
||||
'@mikro-orm/core': 5.2.1_@mikro-orm+sqlite@5.2.1
|
||||
'@mikro-orm/sqlite': 5.2.1_@mikro-orm+core@5.2.1
|
||||
'@next-auth/adapter-test': link:../adapter-test
|
||||
'@next-auth/tsconfig': link:../tsconfig
|
||||
'@types/uuid': 8.3.4
|
||||
jest: 29.3.0
|
||||
next-auth: link:../next-auth
|
||||
|
||||
packages/adapter-mongodb:
|
||||
specifiers:
|
||||
'@auth/core': workspace:*
|
||||
'@next-auth/adapter-test': workspace:*
|
||||
'@next-auth/tsconfig': workspace:*
|
||||
jest: ^27.4.3
|
||||
mongodb: ^5.1.0
|
||||
next-auth: workspace:*
|
||||
dependencies:
|
||||
'@auth/core': link:../core
|
||||
devDependencies:
|
||||
'@next-auth/adapter-test': link:../adapter-test
|
||||
'@next-auth/tsconfig': link:../tsconfig
|
||||
jest: 27.5.1
|
||||
mongodb: 5.1.0
|
||||
next-auth: link:../next-auth
|
||||
|
||||
packages/adapter-neo4j:
|
||||
specifiers:
|
||||
@@ -504,6 +497,7 @@ importers:
|
||||
|
||||
packages/adapter-upstash-redis:
|
||||
specifiers:
|
||||
'@auth/core': workspace:*
|
||||
'@next-auth/adapter-test': workspace:*
|
||||
'@next-auth/tsconfig': workspace:*
|
||||
'@types/uuid': ^8.3.3
|
||||
@@ -512,9 +506,8 @@ importers:
|
||||
isomorphic-fetch: 3.0.0
|
||||
jest: ^27.4.3
|
||||
next-auth: workspace:*
|
||||
uuid: ^8.3.2
|
||||
dependencies:
|
||||
uuid: 8.3.2
|
||||
'@auth/core': link:../core
|
||||
devDependencies:
|
||||
'@next-auth/adapter-test': link:../adapter-test
|
||||
'@next-auth/tsconfig': link:../tsconfig
|
||||
@@ -11445,10 +11438,6 @@ packages:
|
||||
resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==}
|
||||
dev: true
|
||||
|
||||
/@types/uuid/9.0.0:
|
||||
resolution: {integrity: sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==}
|
||||
dev: true
|
||||
|
||||
/@types/validator/13.7.3:
|
||||
resolution: {integrity: sha512-DNviAE5OUcZ5s+XEQHRhERLg8fOp8gSgvyJ4aaFASx5wwaObm+PBwTIMXiOFm1QrSee5oYwEAYb7LMzX2O88gA==}
|
||||
dev: true
|
||||
|
||||
22
turbo.json
22
turbo.json
@@ -47,7 +47,7 @@
|
||||
"e2e": {
|
||||
"outputs": ["playwright-report/**"]
|
||||
},
|
||||
"@next-auth/upstash-redis-adapter#test": {
|
||||
"@auth/upstash-redis-adapter#test": {
|
||||
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
||||
},
|
||||
"docs#dev": {
|
||||
@@ -55,18 +55,18 @@
|
||||
"@auth/core#build",
|
||||
"@auth/prisma-adapter#build",
|
||||
"@auth/sveltekit#build",
|
||||
"@next-auth/dgraph-adapter#build",
|
||||
"@next-auth/dynamodb-adapter#build",
|
||||
"@auth/dgraph-adapter#build",
|
||||
"@auth/dynamodb-adapter#build",
|
||||
"@next-auth/fauna-adapter#build",
|
||||
"@next-auth/firebase-adapter#build",
|
||||
"@next-auth/mikro-orm-adapter#build",
|
||||
"@next-auth/mongodb-adapter#build",
|
||||
"@auth/mikro-orm-adapter#build",
|
||||
"@auth/mongodb-adapter#build",
|
||||
"@next-auth/neo4j-adapter#build",
|
||||
"@next-auth/pouchdb-adapter#build",
|
||||
"@next-auth/sequelize-adapter#build",
|
||||
"@next-auth/supabase-adapter#build",
|
||||
"@auth/typeorm-adapter#build",
|
||||
"@next-auth/upstash-redis-adapter#build",
|
||||
"@auth/upstash-redis-adapter#build",
|
||||
"@next-auth/xata-adapter#build",
|
||||
"^build",
|
||||
"next-auth#build"
|
||||
@@ -78,18 +78,18 @@
|
||||
"@auth/core#build",
|
||||
"@auth/prisma-adapter#build",
|
||||
"@auth/sveltekit#build",
|
||||
"@next-auth/dgraph-adapter#build",
|
||||
"@next-auth/dynamodb-adapter#build",
|
||||
"@auth/dgraph-adapter#build",
|
||||
"@auth/dynamodb-adapter#build",
|
||||
"@next-auth/fauna-adapter#build",
|
||||
"@next-auth/firebase-adapter#build",
|
||||
"@next-auth/mikro-orm-adapter#build",
|
||||
"@next-auth/mongodb-adapter#build",
|
||||
"@auth/mikro-orm-adapter#build",
|
||||
"@auth/mongodb-adapter#build",
|
||||
"@next-auth/neo4j-adapter#build",
|
||||
"@next-auth/pouchdb-adapter#build",
|
||||
"@next-auth/sequelize-adapter#build",
|
||||
"@next-auth/supabase-adapter#build",
|
||||
"@auth/typeorm-adapter#build",
|
||||
"@next-auth/upstash-redis-adapter#build",
|
||||
"@auth/upstash-redis-adapter#build",
|
||||
"@next-auth/xata-adapter#build",
|
||||
"^build",
|
||||
"next-auth#build"
|
||||
|
||||
Reference in New Issue
Block a user