mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
24 Commits
@auth/core
...
@auth/supa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c9dfff45f | ||
|
|
ef50916ec2 | ||
|
|
8e771a2993 | ||
|
|
06a7149b66 | ||
|
|
662e0942cb | ||
|
|
91c71a175b | ||
|
|
3b8c75297b | ||
|
|
5d06fa5852 | ||
|
|
e7a52077c5 | ||
|
|
6e4516a9f8 | ||
|
|
8a0b11fcd6 | ||
|
|
f925e0c2a5 | ||
|
|
de4e20cc04 | ||
|
|
65f4b9c942 | ||
|
|
1d29b0d220 | ||
|
|
cd92aa0c82 | ||
|
|
d414e01181 | ||
|
|
43deda5bfb | ||
|
|
7e79d8c509 | ||
|
|
ab051162a7 | ||
|
|
87298a0150 | ||
|
|
d6abccd9a0 | ||
|
|
2f35daae37 | ||
|
|
a0f3b04c43 |
24
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
24
.github/ISSUE_TEMPLATE/3_bug_adapter.yml
vendored
@@ -21,20 +21,20 @@ body:
|
|||||||
multiple: true
|
multiple: true
|
||||||
options:
|
options:
|
||||||
- "Custom adapter"
|
- "Custom adapter"
|
||||||
- "@next-auth/dgraph-adapter"
|
- "@auth/dgraph-adapter"
|
||||||
- "@next-auth/dynamodb-adapter"
|
- "@auth/dynamodb-adapter"
|
||||||
- "@next-auth/fauna-adapter"
|
- "@auth/fauna-adapter"
|
||||||
- "@next-auth/firebase-adapter"
|
- "@auth/firebase-adapter"
|
||||||
- "@next-auth/mikro-orm-adapter"
|
- "@auth/mikro-orm-adapter"
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@auth/neo4j-adapter"
|
||||||
- "@next-auth/pouchdb-adapter"
|
- "@auth/pouchdb-adapter"
|
||||||
- "@auth/prisma-adapter"
|
- "@auth/prisma-adapter"
|
||||||
- "@next-auth/sequelize-adapter"
|
- "@auth/sequelize-adapter"
|
||||||
- "@next-auth/supabase-adapter"
|
- "@auth/supabase-adapter"
|
||||||
- "@auth/typeorm-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/upstash-redis-adapter"
|
||||||
- "@next-auth/xata-adapter"
|
- "@auth/xata-adapter"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
|||||||
24
.github/issue-labeler.yml
vendored
24
.github/issue-labeler.yml
vendored
@@ -1,43 +1,43 @@
|
|||||||
# https://github.com/github/issue-labeler#basic-examples
|
# https://github.com/github/issue-labeler#basic-examples
|
||||||
|
|
||||||
dgraph:
|
dgraph:
|
||||||
- "@next-auth/dgraph-adapter"
|
- "@auth/dgraph-adapter"
|
||||||
|
|
||||||
dynamodb:
|
dynamodb:
|
||||||
- "@next-auth/dynamodb-adapter"
|
- "@auth/dynamodb-adapter"
|
||||||
|
|
||||||
fauna:
|
fauna:
|
||||||
- "@next-auth/fauna-adapter"
|
- "@auth/fauna-adapter"
|
||||||
|
|
||||||
firebase:
|
firebase:
|
||||||
- "@next-auth/firebase-adapter"
|
- "@auth/firebase-adapter"
|
||||||
|
|
||||||
mikro-orm:
|
mikro-orm:
|
||||||
- "@next-auth/mikro-orm-adapter"
|
- "@auth/mikro-orm-adapter"
|
||||||
|
|
||||||
mongodb:
|
mongodb:
|
||||||
- "@next-auth/mongodb-adapter"
|
- "@auth/mongodb-adapter"
|
||||||
|
|
||||||
neo4j:
|
neo4j:
|
||||||
- "@next-auth/neo4j-adapter"
|
- "@auth/neo4j-adapter"
|
||||||
|
|
||||||
pouchdb:
|
pouchdb:
|
||||||
- "@next-auth/pouchdb-adapter"
|
- "@auth/pouchdb-adapter"
|
||||||
|
|
||||||
prisma:
|
prisma:
|
||||||
- "@auth/prisma-adapter"
|
- "@auth/prisma-adapter"
|
||||||
|
|
||||||
sequelize:
|
sequelize:
|
||||||
- "@next-auth/sequelize-adapter"
|
- "@auth/sequelize-adapter"
|
||||||
|
|
||||||
supabase:
|
supabase:
|
||||||
- "@next-auth/supabase-adapter"
|
- "@auth/supabase-adapter"
|
||||||
|
|
||||||
typeorm:
|
typeorm:
|
||||||
- "@auth/typeorm-adapter"
|
- "@auth/typeorm-adapter"
|
||||||
|
|
||||||
upstash-redis:
|
upstash-redis:
|
||||||
- "@next-auth/upstash-redis-adapter"
|
- "@auth/upstash-redis-adapter"
|
||||||
|
|
||||||
xata:
|
xata:
|
||||||
- "@next-auth/xata-adapter"
|
- "@auth/xata-adapter"
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,6 +38,7 @@ packages/next-auth/next
|
|||||||
packages/*/*.js
|
packages/*/*.js
|
||||||
packages/*/*.d.ts
|
packages/*/*.d.ts
|
||||||
packages/*/*.d.ts.map
|
packages/*/*.d.ts.map
|
||||||
|
packages/*/lib
|
||||||
|
|
||||||
# Development app
|
# Development app
|
||||||
apps/dev/src/css
|
apps/dev/src/css
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next-auth/fauna-adapter": "workspace:*",
|
"@auth/fauna-adapter": "workspace:*",
|
||||||
"@auth/prisma-adapter": "workspace:*",
|
"@auth/prisma-adapter": "workspace:*",
|
||||||
"@next-auth/supabase-adapter": "workspace:*",
|
"@auth/supabase-adapter": "workspace:*",
|
||||||
"@auth/typeorm-adapter": "workspace:*",
|
"@auth/typeorm-adapter": "workspace:*",
|
||||||
"@prisma/client": "^3",
|
"@prisma/client": "^3",
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import WorkOS from "next-auth/providers/workos"
|
|||||||
|
|
||||||
// // Fauna
|
// // Fauna
|
||||||
// import { Client as FaunaClient } from "faunadb"
|
// import { Client as FaunaClient } from "faunadb"
|
||||||
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
|
// import { FaunaAdapter } from "@auth/fauna-adapter"
|
||||||
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
||||||
// const client = globalThis.fauna || new FaunaClient(opts)
|
// const client = globalThis.fauna || new FaunaClient(opts)
|
||||||
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
||||||
@@ -60,7 +60,7 @@ import WorkOS from "next-auth/providers/workos"
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
// // Supabase
|
// // Supabase
|
||||||
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
|
// import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
// const adapter = SupabaseAdapter({
|
// const adapter = SupabaseAdapter({
|
||||||
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
||||||
@@ -78,45 +78,130 @@ export const authOptions: NextAuthOptions = {
|
|||||||
credentials: { password: { label: "Password", type: "password" } },
|
credentials: { password: { label: "Password", type: "password" } },
|
||||||
async authorize(credentials) {
|
async authorize(credentials) {
|
||||||
if (credentials.password !== "pw") return null
|
if (credentials.password !== "pw") return null
|
||||||
return { name: "Fill Murray", email: "bill@fillmurray.com", image: "https://www.fillmurray.com/64/64", id: "1", foo: "" }
|
return {
|
||||||
|
name: "Fill Murray",
|
||||||
|
email: "bill@fillmurray.com",
|
||||||
|
image: "https://www.fillmurray.com/64/64",
|
||||||
|
id: "1",
|
||||||
|
foo: "",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Apple({ clientId: process.env.APPLE_ID, clientSecret: process.env.APPLE_SECRET }),
|
Apple({
|
||||||
Auth0({ clientId: process.env.AUTH0_ID, clientSecret: process.env.AUTH0_SECRET, issuer: process.env.AUTH0_ISSUER }),
|
clientId: process.env.APPLE_ID,
|
||||||
|
clientSecret: process.env.APPLE_SECRET,
|
||||||
|
}),
|
||||||
|
Auth0({
|
||||||
|
clientId: process.env.AUTH0_ID,
|
||||||
|
clientSecret: process.env.AUTH0_SECRET,
|
||||||
|
issuer: process.env.AUTH0_ISSUER,
|
||||||
|
}),
|
||||||
AzureAD({
|
AzureAD({
|
||||||
clientId: process.env.AZURE_AD_CLIENT_ID,
|
clientId: process.env.AZURE_AD_CLIENT_ID,
|
||||||
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
|
||||||
tenantId: process.env.AZURE_AD_TENANT_ID,
|
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
}),
|
}),
|
||||||
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
|
AzureB2C({
|
||||||
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
|
clientId: process.env.AZURE_B2C_ID,
|
||||||
|
clientSecret: process.env.AZURE_B2C_SECRET,
|
||||||
|
issuer: process.env.AZURE_B2C_ISSUER,
|
||||||
|
}),
|
||||||
|
BoxyHQSAML({
|
||||||
|
issuer: "https://jackson-demo.boxyhq.com",
|
||||||
|
clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com",
|
||||||
|
clientSecret: "dummy",
|
||||||
|
}),
|
||||||
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
||||||
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
|
Discord({
|
||||||
DuendeIDS6({ clientId: "interactive.confidential", clientSecret: "secret", issuer: "https://demo.duendesoftware.com" }),
|
clientId: process.env.DISCORD_ID,
|
||||||
Facebook({ clientId: process.env.FACEBOOK_ID, clientSecret: process.env.FACEBOOK_SECRET }),
|
clientSecret: process.env.DISCORD_SECRET,
|
||||||
Foursquare({ clientId: process.env.FOURSQUARE_ID, clientSecret: process.env.FOURSQUARE_SECRET }),
|
}),
|
||||||
Freshbooks({ clientId: process.env.FRESHBOOKS_ID, clientSecret: process.env.FRESHBOOKS_SECRET }),
|
DuendeIDS6({
|
||||||
GitHub({ clientId: process.env.GITHUB_ID, clientSecret: process.env.GITHUB_SECRET }),
|
clientId: "interactive.confidential",
|
||||||
Gitlab({ clientId: process.env.GITLAB_ID, clientSecret: process.env.GITLAB_SECRET }),
|
clientSecret: "secret",
|
||||||
Google({ clientId: process.env.GOOGLE_ID, clientSecret: process.env.GOOGLE_SECRET }),
|
issuer: "https://demo.duendesoftware.com",
|
||||||
|
}),
|
||||||
|
Facebook({
|
||||||
|
clientId: process.env.FACEBOOK_ID,
|
||||||
|
clientSecret: process.env.FACEBOOK_SECRET,
|
||||||
|
}),
|
||||||
|
Foursquare({
|
||||||
|
clientId: process.env.FOURSQUARE_ID,
|
||||||
|
clientSecret: process.env.FOURSQUARE_SECRET,
|
||||||
|
}),
|
||||||
|
Freshbooks({
|
||||||
|
clientId: process.env.FRESHBOOKS_ID,
|
||||||
|
clientSecret: process.env.FRESHBOOKS_SECRET,
|
||||||
|
}),
|
||||||
|
GitHub({
|
||||||
|
clientId: process.env.GITHUB_ID,
|
||||||
|
clientSecret: process.env.GITHUB_SECRET,
|
||||||
|
}),
|
||||||
|
Gitlab({
|
||||||
|
clientId: process.env.GITLAB_ID,
|
||||||
|
clientSecret: process.env.GITLAB_SECRET,
|
||||||
|
}),
|
||||||
|
Google({
|
||||||
|
clientId: process.env.GOOGLE_ID,
|
||||||
|
clientSecret: process.env.GOOGLE_SECRET,
|
||||||
|
}),
|
||||||
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
|
// IDS4({ clientId: process.env.IDS4_ID, clientSecret: process.env.IDS4_SECRET, issuer: process.env.IDS4_ISSUER }),
|
||||||
Instagram({ clientId: process.env.INSTAGRAM_ID, clientSecret: process.env.INSTAGRAM_SECRET }),
|
Instagram({
|
||||||
|
clientId: process.env.INSTAGRAM_ID,
|
||||||
|
clientSecret: process.env.INSTAGRAM_SECRET,
|
||||||
|
}),
|
||||||
// Keycloak({ clientId: process.env.KEYCLOAK_ID, clientSecret: process.env.KEYCLOAK_SECRET, issuer: process.env.KEYCLOAK_ISSUER }),
|
// Keycloak({ clientId: process.env.KEYCLOAK_ID, clientSecret: process.env.KEYCLOAK_SECRET, issuer: process.env.KEYCLOAK_ISSUER }),
|
||||||
Line({ clientId: process.env.LINE_ID, clientSecret: process.env.LINE_SECRET }),
|
Line({
|
||||||
LinkedIn({ clientId: process.env.LINKEDIN_ID, clientSecret: process.env.LINKEDIN_SECRET }),
|
clientId: process.env.LINE_ID,
|
||||||
Mailchimp({ clientId: process.env.MAILCHIMP_ID, clientSecret: process.env.MAILCHIMP_SECRET }),
|
clientSecret: process.env.LINE_SECRET,
|
||||||
|
}),
|
||||||
|
LinkedIn({
|
||||||
|
clientId: process.env.LINKEDIN_ID,
|
||||||
|
clientSecret: process.env.LINKEDIN_SECRET,
|
||||||
|
}),
|
||||||
|
Mailchimp({
|
||||||
|
clientId: process.env.MAILCHIMP_ID,
|
||||||
|
clientSecret: process.env.MAILCHIMP_SECRET,
|
||||||
|
}),
|
||||||
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
// Okta({ clientId: process.env.OKTA_ID, clientSecret: process.env.OKTA_SECRET, issuer: process.env.OKTA_ISSUER }),
|
||||||
Osu({ clientId: process.env.OSU_CLIENT_ID, clientSecret: process.env.OSU_CLIENT_SECRET }),
|
Osu({
|
||||||
Patreon({ clientId: process.env.PATREON_ID, clientSecret: process.env.PATREON_SECRET }),
|
clientId: process.env.OSU_CLIENT_ID,
|
||||||
Slack({ clientId: process.env.SLACK_ID, clientSecret: process.env.SLACK_SECRET }),
|
clientSecret: process.env.OSU_CLIENT_SECRET,
|
||||||
Spotify({ clientId: process.env.SPOTIFY_ID, clientSecret: process.env.SPOTIFY_SECRET }),
|
}),
|
||||||
Trakt({ clientId: process.env.TRAKT_ID, clientSecret: process.env.TRAKT_SECRET }),
|
Patreon({
|
||||||
Twitch({ clientId: process.env.TWITCH_ID, clientSecret: process.env.TWITCH_SECRET }),
|
clientId: process.env.PATREON_ID,
|
||||||
Twitter({ clientId: process.env.TWITTER_ID, clientSecret: process.env.TWITTER_SECRET }),
|
clientSecret: process.env.PATREON_SECRET,
|
||||||
|
}),
|
||||||
|
Slack({
|
||||||
|
clientId: process.env.SLACK_ID,
|
||||||
|
clientSecret: process.env.SLACK_SECRET,
|
||||||
|
}),
|
||||||
|
Spotify({
|
||||||
|
clientId: process.env.SPOTIFY_ID,
|
||||||
|
clientSecret: process.env.SPOTIFY_SECRET,
|
||||||
|
}),
|
||||||
|
Trakt({
|
||||||
|
clientId: process.env.TRAKT_ID,
|
||||||
|
clientSecret: process.env.TRAKT_SECRET,
|
||||||
|
}),
|
||||||
|
Twitch({
|
||||||
|
clientId: process.env.TWITCH_ID,
|
||||||
|
clientSecret: process.env.TWITCH_SECRET,
|
||||||
|
}),
|
||||||
|
Twitter({
|
||||||
|
clientId: process.env.TWITTER_ID,
|
||||||
|
clientSecret: process.env.TWITTER_SECRET,
|
||||||
|
}),
|
||||||
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
|
// TwitterLegacy({ clientId: process.env.TWITTER_LEGACY_ID, clientSecret: process.env.TWITTER_LEGACY_SECRET }),
|
||||||
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
|
Vk({ clientId: process.env.VK_ID, clientSecret: process.env.VK_SECRET }),
|
||||||
Wikimedia({ clientId: process.env.WIKIMEDIA_ID, clientSecret: process.env.WIKIMEDIA_SECRET }),
|
Wikimedia({
|
||||||
WorkOS({ clientId: process.env.WORKOS_ID, clientSecret: process.env.WORKOS_SECRET }),
|
clientId: process.env.WIKIMEDIA_ID,
|
||||||
|
clientSecret: process.env.WIKIMEDIA_SECRET,
|
||||||
|
}),
|
||||||
|
WorkOS({
|
||||||
|
clientId: process.env.WORKOS_ID,
|
||||||
|
clientSecret: process.env.WORKOS_SECRET,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@auth/core": "workspace:*",
|
"@auth/core": "workspace:*",
|
||||||
"@next-auth/fauna-adapter": "workspace:*",
|
"@auth/fauna-adapter": "workspace:*",
|
||||||
"@auth/prisma-adapter": "workspace:*",
|
"@auth/prisma-adapter": "workspace:*",
|
||||||
"@next-auth/supabase-adapter": "workspace:*",
|
"@auth/supabase-adapter": "workspace:*",
|
||||||
"@auth/typeorm-adapter": "workspace:*",
|
"@auth/typeorm-adapter": "workspace:*",
|
||||||
"@prisma/client": "^3",
|
"@prisma/client": "^3",
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import WorkOS from "@auth/core/providers/workos"
|
|||||||
|
|
||||||
// // Fauna
|
// // Fauna
|
||||||
// import { Client as FaunaClient } from "faunadb"
|
// import { Client as FaunaClient } from "faunadb"
|
||||||
// import { FaunaAdapter } from "@next-auth/fauna-adapter"
|
// import { FaunaAdapter } from "@auth/fauna-adapter"
|
||||||
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
// const opts = { secret: process.env.FAUNA_SECRET, domain: process.env.FAUNA_DOMAIN }
|
||||||
// const client = globalThis.fauna || new FaunaClient(opts)
|
// const client = globalThis.fauna || new FaunaClient(opts)
|
||||||
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
// if (process.env.NODE_ENV !== "production") globalThis.fauna = client
|
||||||
@@ -64,7 +64,7 @@ import WorkOS from "@auth/core/providers/workos"
|
|||||||
// })
|
// })
|
||||||
|
|
||||||
// // Supabase
|
// // Supabase
|
||||||
// import { SupabaseAdapter } from "@next-auth/supabase-adapter"
|
// import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
// const adapter = SupabaseAdapter({
|
// const adapter = SupabaseAdapter({
|
||||||
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
// url: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
||||||
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
// secret: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
||||||
@@ -94,7 +94,11 @@ export const authConfig: AuthConfig = {
|
|||||||
tenantId: process.env.AZURE_AD_TENANT_ID,
|
tenantId: process.env.AZURE_AD_TENANT_ID,
|
||||||
}),
|
}),
|
||||||
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
|
AzureB2C({ clientId: process.env.AZURE_B2C_ID, clientSecret: process.env.AZURE_B2C_SECRET, issuer: process.env.AZURE_B2C_ISSUER }),
|
||||||
BeyondIdentity({ clientId: process.env.BEYOND_IDENTITY_CLIENT_ID, clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET, issuer: process.env.BEYOND_IDENTITY_ISSUER }),
|
BeyondIdentity({
|
||||||
|
clientId: process.env.BEYOND_IDENTITY_CLIENT_ID,
|
||||||
|
clientSecret: process.env.BEYOND_IDENTITY_CLIENT_SECRET,
|
||||||
|
issuer: process.env.BEYOND_IDENTITY_ISSUER,
|
||||||
|
}),
|
||||||
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
|
BoxyHQSAML({ issuer: "https://jackson-demo.boxyhq.com", clientId: "tenant=boxyhq.com&product=saml-demo.boxyhq.com", clientSecret: "dummy" }),
|
||||||
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
// Cognito({ clientId: process.env.COGNITO_ID, clientSecret: process.env.COGNITO_SECRET, issuer: process.env.COGNITO_ISSUER }),
|
||||||
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
|
Discord({ clientId: process.env.DISCORD_ID, clientSecret: process.env.DISCORD_SECRET }),
|
||||||
|
|||||||
@@ -91,12 +91,12 @@ Finally, we'll need to set up a database adapter to store verification tokens th
|
|||||||
|
|
||||||
An **Adapter** in Auth.js connects your application to whatever database or backend system you want to use to store data for users, their accounts, sessions, etc...
|
An **Adapter** in Auth.js connects your application to whatever database or backend system you want to use to store data for users, their accounts, sessions, etc...
|
||||||
|
|
||||||
For this tutorial, we're going to use the **MongoDB** adapter, other any of the other adapters will work just fine.
|
For this tutorial, we're going to use the **MongoDB** adapter, but any of the other adapters will work just fine.
|
||||||
|
|
||||||
First, let's start by installing the adapter package:
|
First, let's start by installing the adapter package:
|
||||||
|
|
||||||
```bash npm2yarn2pnpm
|
```bash npm2yarn2pnpm
|
||||||
npm install -D @next-auth/mongodb-adapter mongodb
|
npm install -D @auth/mongodb-adapter mongodb
|
||||||
```
|
```
|
||||||
|
|
||||||
and create a simple MongoDB client:
|
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"
|
```diff title="pages/api/auth/[...nextauth].ts"
|
||||||
import NextAuth from "next-auth"
|
import NextAuth from "next-auth"
|
||||||
import EmailProvider from "next-auth/providers/email"
|
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"
|
+ import clientPromise from "../../../lib/mongodb/client"
|
||||||
|
|
||||||
export default NextAuth({
|
export default NextAuth({
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Dgraph Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Dgraph Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/dgraph-adapter">
|
<a href="https://npm.im/@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">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dgraph-adapter?color=green&label=@auth/dgraph-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/dgraph-adapter">
|
<a href="https://www.npmtrends.com/@auth/dgraph-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/dgraph-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/dgraph-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<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",
|
"name": "@auth/dgraph-adapter",
|
||||||
"version": "1.0.6",
|
"version": "1.0.0",
|
||||||
"description": "Dgraph adapter for next-auth.",
|
"description": "Dgraph adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "Arnaud Derbey <arnaud@derbey.dev>",
|
"author": "Arnaud Derbey <arnaud@derbey.dev>",
|
||||||
"contributors": [],
|
"contributors": [
|
||||||
"main": "dist/index.js",
|
"Balázs Orbán <info@balazsorban.com>"
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"index.d.ts"
|
|
||||||
],
|
],
|
||||||
|
"type": "module",
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts*",
|
||||||
|
"lib",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"import": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -29,10 +40,6 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "./tests/test.sh"
|
"test": "./tests/test.sh"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
|
||||||
"jsonwebtoken": "^8.5.1",
|
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
@@ -40,12 +47,12 @@
|
|||||||
"@types/jsonwebtoken": "^8.5.5",
|
"@types/jsonwebtoken": "^8.5.5",
|
||||||
"@types/node-fetch": "^2.5.11",
|
"@types/node-fetch": "^2.5.11",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*",
|
"ts-jest": "^27.0.3",
|
||||||
"ts-jest": "^27.0.3"
|
"undici": "5.22.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jsonwebtoken": "^8.5.1",
|
"@auth/core": "workspace:*",
|
||||||
"node-fetch": "^2.6.1"
|
"jsonwebtoken": "^8.5.1"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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 { client as dgraphClient } from "./lib/client"
|
||||||
import { format } from "./utils"
|
import { format } from "./lib/utils"
|
||||||
import type { Adapter } from "next-auth/adapters"
|
import type { Adapter } from "@auth/core/adapters"
|
||||||
import type { DgraphClientParams } from "./client"
|
import type { DgraphClientParams } from "./lib/client"
|
||||||
import * as defaultFragments from "./graphql/fragments"
|
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. */
|
/** This is the interface of the Dgraph adapter options. */
|
||||||
export interface DgraphAdapterOptions {
|
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
|
* 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.
|
* 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.
|
* , this config option allows to extend them.
|
||||||
*/
|
*/
|
||||||
fragments?: {
|
fragments?: {
|
||||||
@@ -48,7 +48,7 @@ export { format }
|
|||||||
*
|
*
|
||||||
* ```ts title="pages/api/auth/[...nextauth].js"
|
* ```ts title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { DgraphAdapter } from "@next-auth/dgraph-adapter"
|
* import { DgraphAdapter } from "@auth/dgraph-adapter"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
* providers: [],
|
* providers: [],
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import * as jwt from "jsonwebtoken"
|
import * as jwt from "jsonwebtoken"
|
||||||
import fetch from "node-fetch"
|
|
||||||
|
|
||||||
import type { HeadersInit } from "node-fetch"
|
|
||||||
|
|
||||||
export interface DgraphClientParams {
|
export interface DgraphClientParams {
|
||||||
endpoint: string
|
endpoint: string
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import { DgraphAdapter, format } from "../src"
|
import { DgraphAdapter, format } from "../src"
|
||||||
import { client as dgraphClient } from "../src/client"
|
import { client as dgraphClient } from "../src/lib/client"
|
||||||
import * as fragments from "../src/graphql/fragments"
|
import * as fragments from "../src/lib/graphql/fragments"
|
||||||
import { runBasicTests } from "@next-auth/adapter-test"
|
import { runBasicTests } from "@next-auth/adapter-test"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
|
|
||||||
import type { DgraphClientParams } from "../src"
|
import type { DgraphClientParams } from "../src"
|
||||||
|
|
||||||
|
globalThis.fetch ??= require("undici").fetch
|
||||||
|
|
||||||
const params: DgraphClientParams = {
|
const params: DgraphClientParams = {
|
||||||
endpoint: "http://localhost:8080/graphql",
|
endpoint: "http://localhost:8080/graphql",
|
||||||
authToken: "test",
|
authToken: "test",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ dgraph/standalone
|
|||||||
|
|
||||||
echo "Waiting 15 sec for db to start..." && sleep 15
|
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')
|
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
|
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": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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>
|
</a>
|
||||||
<h3 align="center"><b>DynamoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>DynamoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/dynamodb-adapter">
|
<a href="https://npm.im/@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">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/dynamodb-adapter?color=green&label=@auth/dynamodb-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/dynamodb-adapter">
|
<a href="https://www.npmtrends.com/@auth/dynamodb-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/dynamodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/dynamodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<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",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"version": "3.0.2",
|
"version": "1.0.0",
|
||||||
"description": "AWS DynamoDB adapter for next-auth.",
|
"description": "AWS DynamoDB adapter for next-auth.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -9,18 +9,10 @@
|
|||||||
"oauth",
|
"oauth",
|
||||||
"dynamodb"
|
"dynamodb"
|
||||||
],
|
],
|
||||||
"type": "module",
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"types": "./index.d.ts",
|
|
||||||
"import": "./index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"private": false,
|
"private": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@@ -32,19 +24,27 @@
|
|||||||
"clean": "rm -rf index.*",
|
"clean": "rm -rf index.*",
|
||||||
"build": "pnpm clean && tsc"
|
"build": "pnpm clean && tsc"
|
||||||
},
|
},
|
||||||
|
"author": "Pol Marnette",
|
||||||
|
"contributors": [
|
||||||
|
"Balázs Orbán <info@balazsorban.com>"
|
||||||
|
],
|
||||||
|
"license": "ISC",
|
||||||
|
"type": "module",
|
||||||
|
"types": "./index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"*.js",
|
||||||
"index.js",
|
"*.d.ts*",
|
||||||
"index.d.ts",
|
|
||||||
"index.d.ts.map",
|
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"author": "Pol Marnette",
|
"exports": {
|
||||||
"license": "ISC",
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"import": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@aws-sdk/client-dynamodb": "^3.36.1",
|
"@aws-sdk/client-dynamodb": "^3.36.1",
|
||||||
"@aws-sdk/lib-dynamodb": "^3.36.1",
|
"@aws-sdk/lib-dynamodb": "^3.36.1"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aws-sdk/client-dynamodb": "^3.36.1",
|
"@aws-sdk/client-dynamodb": "^3.36.1",
|
||||||
@@ -52,11 +52,9 @@
|
|||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"@shelf/jest-dynamodb": "^2.1.0",
|
"@shelf/jest-dynamodb": "^2.1.0",
|
||||||
"@types/uuid": "^9.0.0",
|
"jest": "^27.4.3"
|
||||||
"jest": "^27.4.3",
|
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uuid": "^9.0.0"
|
"@auth/core": "workspace:*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,12 +9,11 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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 {
|
import type {
|
||||||
BatchWriteCommandInput,
|
BatchWriteCommandInput,
|
||||||
@@ -26,7 +25,7 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
|
|
||||||
export interface DynamoDBAdapterOptions {
|
export interface DynamoDBAdapterOptions {
|
||||||
tableName?: string
|
tableName?: string
|
||||||
@@ -53,7 +52,7 @@ export interface DynamoDBAdapterOptions {
|
|||||||
* import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb"
|
* import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb"
|
||||||
* import NextAuth from "next-auth";
|
* import NextAuth from "next-auth";
|
||||||
* import Providers from "next-auth/providers";
|
* import Providers from "next-auth/providers";
|
||||||
* import { DynamoDBAdapter } from "@next-auth/dynamodb-adapter"
|
* import { DynamoDBAdapter } from "@auth/dynamodb-adapter"
|
||||||
*
|
*
|
||||||
* const config: DynamoDBClientConfig = {
|
* const config: DynamoDBClientConfig = {
|
||||||
* credentials: {
|
* credentials: {
|
||||||
@@ -187,7 +186,7 @@ export function DynamoDBAdapter(
|
|||||||
async createUser(data) {
|
async createUser(data) {
|
||||||
const user: AdapterUser = {
|
const user: AdapterUser = {
|
||||||
...(data as any),
|
...(data as any),
|
||||||
id: uuid(),
|
id: crypto.randomUUID(),
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.put({
|
await client.put({
|
||||||
@@ -312,7 +311,7 @@ export function DynamoDBAdapter(
|
|||||||
async linkAccount(data) {
|
async linkAccount(data) {
|
||||||
const item = {
|
const item = {
|
||||||
...data,
|
...data,
|
||||||
id: uuid(),
|
id: crypto.randomUUID(),
|
||||||
[pk]: `USER#${data.userId}`,
|
[pk]: `USER#${data.userId}`,
|
||||||
[sk]: `ACCOUNT#${data.provider}#${data.providerAccountId}`,
|
[sk]: `ACCOUNT#${data.provider}#${data.providerAccountId}`,
|
||||||
[GSI1PK]: `ACCOUNT#${data.provider}`,
|
[GSI1PK]: `ACCOUNT#${data.provider}`,
|
||||||
@@ -376,7 +375,7 @@ export function DynamoDBAdapter(
|
|||||||
},
|
},
|
||||||
async createSession(data) {
|
async createSession(data) {
|
||||||
const session = {
|
const session = {
|
||||||
id: uuid(),
|
id: crypto.randomUUID(),
|
||||||
...data,
|
...data,
|
||||||
}
|
}
|
||||||
await client.put({
|
await client.put({
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"allowJs": true,
|
||||||
"outDir": ".",
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
|
"rootDir": "src",
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"declaration": true
|
"declaration": true
|
||||||
},
|
},
|
||||||
"exclude": ["tests", "dist", "jest.config.js", "jest-dynamodb-config.js"]
|
"include": [
|
||||||
}
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts",
|
||||||
|
]
|
||||||
|
}
|
||||||
1
packages/adapter-fauna/.npmrc
Normal file
1
packages/adapter-fauna/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Fauna Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Fauna Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/fauna-adapter">
|
<a href="https://npm.im/@auth/fauna-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/fauna-adapter">
|
<a href="https://npm.im/@auth/fauna-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/fauna-adapter?color=green&label=@next-auth/fauna-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/fauna-adapter?color=green&label=@auth/fauna-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/fauna-adapter">
|
<a href="https://www.npmtrends.com/@auth/fauna-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/fauna-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/fauna-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/fauna-adapter",
|
"name": "@auth/fauna-adapter",
|
||||||
"version": "1.0.4",
|
"version": "1.0.0",
|
||||||
"description": "Fauna Adapter for NextAuth",
|
"description": "Fauna Adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"README.md"
|
|
||||||
],
|
|
||||||
"author": "Bhanu Teja P",
|
"author": "Bhanu Teja P",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
"Nico Domino <yo@ndo.dev>",
|
||||||
"name": "Nico Domino",
|
"Balázs Orbán <info@balazsorban.com>"
|
||||||
"email": "yo@ndo.dev"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Balázs Orbán",
|
|
||||||
"email": "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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -41,19 +43,20 @@
|
|||||||
"migrate": "fauna-schema-migrate generate",
|
"migrate": "fauna-schema-migrate generate",
|
||||||
"test": "./tests/test.sh"
|
"test": "./tests/test.sh"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@auth/core": "workspace:*"
|
||||||
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"faunadb": "^4.3.0",
|
"faunadb": "^4.3.0"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fauna-labs/fauna-schema-migrate": "^2.1.3",
|
"@fauna-labs/fauna-schema-migrate": "^2.1.3",
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"faunadb": "^4.3.0",
|
"faunadb": "^4.3.0",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install next-auth @next-auth/fauna-adapter faunadb
|
* npm install @auth/fauna-adapter faunadb
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/fauna-adapter
|
* @module @auth/fauna-adapter
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
Client as FaunaClient,
|
Client as FaunaClient,
|
||||||
@@ -44,7 +44,7 @@ import {
|
|||||||
AdapterSession,
|
AdapterSession,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
|
|
||||||
export const collections = {
|
export const collections = {
|
||||||
Users: Collection("users"),
|
Users: Collection("users"),
|
||||||
@@ -137,7 +137,7 @@ export function query(f: FaunaClient, format: (...args: any) => any) {
|
|||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { Client as FaunaClient } from "faunadb"
|
* import { Client as FaunaClient } from "faunadb"
|
||||||
* import { FaunaAdapter } from "@next-auth/fauna-adapter"
|
* import { FaunaAdapter } from "@auth/fauna-adapter"
|
||||||
*
|
*
|
||||||
* const client = new FaunaClient({
|
* const client = new FaunaClient({
|
||||||
* secret: "secret",
|
* secret: "secret",
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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-firebase/.npmrc
Normal file
1
packages/adapter-firebase/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Firebase Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Firebase Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/firebase-adapter">
|
<a href="https://npm.im/@auth/firebase-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/firebase-adapter">
|
<a href="https://npm.im/@auth/firebase-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/firebase-adapter?color=green&label=@next-auth/firebase-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/firebase-adapter?color=green&label=@auth/firebase-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/firebase-adapter">
|
<a href="https://www.npmtrends.com/@auth/firebase-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/firebase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/firebase-adapter",
|
"name": "@auth/firebase-adapter",
|
||||||
"version": "2.0.1",
|
"version": "1.0.0",
|
||||||
"description": "Firebase adapter for next-auth.",
|
"description": "Firebase adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -13,17 +13,18 @@
|
|||||||
"Alex Meuer <github@alexmeuer.com>"
|
"Alex Meuer <github@alexmeuer.com>"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts*",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
"import": "./index.js"
|
"import": "./index.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"src",
|
|
||||||
"*.js",
|
|
||||||
"*.d.ts*"
|
|
||||||
],
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -40,16 +41,17 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "firebase emulators:exec --only firestore --project next-auth-test 'jest -c tests/jest.config.js'"
|
"test": "firebase emulators:exec --only firestore --project next-auth-test 'jest -c tests/jest.config.js'"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@auth/core": "workspace:*"
|
||||||
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"firebase-admin": "^11.4.1",
|
"firebase-admin": "^11.4.1"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"firebase-admin": "^11.4.1",
|
"firebase-admin": "^11.4.1",
|
||||||
"firebase-tools": "^11.16.1",
|
"firebase-tools": "^11.16.1",
|
||||||
"jest": "^29.3.1",
|
"jest": "^29.3.1"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install next-auth @next-auth/firebase-adapter firebase-admin
|
* npm install @auth/firebase-adapter firebase-admin
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/firebase-adapter
|
* @module @auth/firebase-adapter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { type AppOptions, getApps, initializeApp } from "firebase-admin/app"
|
import { type AppOptions, getApps, initializeApp } from "firebase-admin/app"
|
||||||
@@ -33,7 +33,7 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
|
|
||||||
/** Configure the Firebase Adapter. */
|
/** Configure the Firebase Adapter. */
|
||||||
export interface FirebaseAdapterConfig extends AppOptions {
|
export interface FirebaseAdapterConfig extends AppOptions {
|
||||||
@@ -52,7 +52,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
|
|||||||
* @example
|
* @example
|
||||||
* ```ts title="pages/api/auth/[...nextauth].ts"
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
|
* import { FirestoreAdapter } from "@auth/firebase-adapter"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
* adapter: FirestoreAdapter({ namingStrategy: "snake_case" })
|
* adapter: FirestoreAdapter({ namingStrategy: "snake_case" })
|
||||||
@@ -78,7 +78,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
|
|||||||
* @example
|
* @example
|
||||||
* ```ts title="pages/api/auth/[...nextauth].ts"
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
|
* import { FirestoreAdapter } from "@auth/firebase-adapter"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
* adapter: FirestoreAdapter(),
|
* adapter: FirestoreAdapter(),
|
||||||
@@ -95,7 +95,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
|
|||||||
* @example
|
* @example
|
||||||
* ```ts title="pages/api/auth/[...nextauth].ts"
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
|
* import { FirestoreAdapter } from "@auth/firebase-adapter"
|
||||||
* import { cert } from "firebase-admin/app"
|
* import { cert } from "firebase-admin/app"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
@@ -125,7 +125,7 @@ export interface FirebaseAdapterConfig extends AppOptions {
|
|||||||
* @example
|
* @example
|
||||||
* ```ts title="pages/api/auth/[...nextauth].ts"
|
* ```ts title="pages/api/auth/[...nextauth].ts"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { FirestoreAdapter } from "@next-auth/firebase-adapter"
|
* import { FirestoreAdapter } from "@auth/firebase-adapter"
|
||||||
* import { firestore } from "lib/firestore"
|
* import { firestore } from "lib/firestore"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
@@ -428,7 +428,7 @@ export function collectionsFactory(
|
|||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```ts title="lib/firestore.ts"
|
* ```ts title="lib/firestore.ts"
|
||||||
* import { initFirestore } from "@next-auth/firebase-adapter"
|
* import { initFirestore } from "@auth/firebase-adapter"
|
||||||
* import { cert } from "firebase-admin/app"
|
* import { cert } from "firebase-admin/app"
|
||||||
*
|
*
|
||||||
* export const firestore = initFirestore({
|
* export const firestore = initFirestore({
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true,
|
"allowJs": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
"src/**/*"
|
"src/**/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"tests"
|
"*.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>
|
</a>
|
||||||
<h3 align="center"><b>MikroORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>MikroORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/mikro-orm-adapter">
|
<a href="https://npm.im/@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">
|
<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>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/mikro-orm-adapter">
|
<a href="https://www.npmtrends.com/@auth/mikro-orm-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/mikro-orm-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/mikro-orm-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<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",
|
"name": "@auth/mikro-orm-adapter",
|
||||||
"version": "3.0.1",
|
"version": "1.0.0",
|
||||||
"description": "MikroORM adapter for next-auth.",
|
"description": "MikroORM adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -11,7 +11,20 @@
|
|||||||
"contributors": [
|
"contributors": [
|
||||||
"Balázs Orbán <info@balazsorban.com>"
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -27,27 +40,20 @@
|
|||||||
"test": "jest --runInBand",
|
"test": "jest --runInBand",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"README.md",
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@mikro-orm/core": "^5",
|
"@mikro-orm/core": "^5"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@mikro-orm/core": "^5",
|
"@mikro-orm/core": "^5",
|
||||||
"@mikro-orm/sqlite": "^5",
|
"@mikro-orm/sqlite": "^5",
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"@types/uuid": ">=8",
|
"jest": "^29"
|
||||||
"jest": "^29",
|
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uuid": "^9"
|
"@auth/core": "workspace:*"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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 {
|
import type {
|
||||||
Connection,
|
Connection,
|
||||||
@@ -20,11 +20,11 @@ import type {
|
|||||||
Options as ORMOptions,
|
Options as ORMOptions,
|
||||||
} from "@mikro-orm/core"
|
} 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 { MikroORM, wrap } from "@mikro-orm/core"
|
||||||
|
|
||||||
import * as defaultEntities from "./entities"
|
import * as defaultEntities from "./lib/entities"
|
||||||
|
|
||||||
export { defaultEntities }
|
export { defaultEntities }
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ export { defaultEntities }
|
|||||||
*
|
*
|
||||||
* ```typescript title="pages/api/auth/[...nextauth].ts"
|
* ```typescript title="pages/api/auth/[...nextauth].ts"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { MikroOrmAdapter } from "@next-auth/mikro-orm-adapter"
|
* import { MikroOrmAdapter } from "@auth/mikro-orm-adapter"
|
||||||
*
|
*
|
||||||
* export default NextAuth({
|
* export default NextAuth({
|
||||||
* adapter: MikroOrmAdapter({
|
* adapter: MikroOrmAdapter({
|
||||||
@@ -67,7 +67,7 @@ export { defaultEntities }
|
|||||||
* Property,
|
* Property,
|
||||||
* Unique,
|
* Unique,
|
||||||
* } from "@mikro-orm/core"
|
* } from "@mikro-orm/core"
|
||||||
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
|
* import { defaultEntities } from "@auth/mikro-orm-adapter"
|
||||||
*
|
*
|
||||||
* const { Account, Session } = defaultEntities
|
* const { Account, Session } = defaultEntities
|
||||||
*
|
*
|
||||||
@@ -124,7 +124,7 @@ export { defaultEntities }
|
|||||||
*
|
*
|
||||||
* ```typescript title="config/mikro-orm.ts"
|
* ```typescript title="config/mikro-orm.ts"
|
||||||
* import { Options } from "@mikro-orm/core";
|
* import { Options } from "@mikro-orm/core";
|
||||||
* import { defaultEntities } from "@next-auth/mikro-orm-adapter"
|
* import { defaultEntities } from "@auth/mikro-orm-adapter"
|
||||||
*
|
*
|
||||||
* const config: Options = {
|
* const config: Options = {
|
||||||
* ...
|
* ...
|
||||||
@@ -186,7 +186,6 @@ export function MikroOrmAdapter<
|
|||||||
* Method used in testing. You won't need to call this in your app.
|
* Method used in testing. You won't need to call this in your app.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
// @ts-expect-error
|
|
||||||
async __disconnect() {
|
async __disconnect() {
|
||||||
const em = await getEM()
|
const em = await getEM()
|
||||||
await em.getConnection().close()
|
await em.getConnection().close()
|
||||||
@@ -240,6 +239,7 @@ export function MikroOrmAdapter<
|
|||||||
|
|
||||||
return wrap(user).toObject()
|
return wrap(user).toObject()
|
||||||
},
|
},
|
||||||
|
// @ts-expect-error
|
||||||
async linkAccount(data) {
|
async linkAccount(data) {
|
||||||
const em = await getEM()
|
const em = await getEM()
|
||||||
const user = await em.findOne(UserModel, { id: data.userId })
|
const user = await em.findOne(UserModel, { id: data.userId })
|
||||||
@@ -251,6 +251,7 @@ export function MikroOrmAdapter<
|
|||||||
|
|
||||||
return wrap(account).toObject()
|
return wrap(account).toObject()
|
||||||
},
|
},
|
||||||
|
// @ts-expect-error
|
||||||
async unlinkAccount(provider_providerAccountId) {
|
async unlinkAccount(provider_providerAccountId) {
|
||||||
const em = await getEM()
|
const em = await getEM()
|
||||||
const account = await em.findOne(AccountModel, {
|
const account = await em.findOne(AccountModel, {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { v4 as randomUUID } from "uuid"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Property,
|
Property,
|
||||||
Unique,
|
Unique,
|
||||||
@@ -16,8 +14,7 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken as AdapterVerificationToken,
|
VerificationToken as AdapterVerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { ProviderType } from "next-auth/providers"
|
|
||||||
|
|
||||||
type RemoveIndex<T> = {
|
type RemoveIndex<T> = {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
@@ -27,7 +24,7 @@ type RemoveIndex<T> = {
|
|||||||
@Entity()
|
@Entity()
|
||||||
export class User implements RemoveIndex<AdapterUser> {
|
export class User implements RemoveIndex<AdapterUser> {
|
||||||
@PrimaryKey()
|
@PrimaryKey()
|
||||||
id: string = randomUUID()
|
id: string = crypto.randomUUID()
|
||||||
|
|
||||||
@Property({ type: types.string, nullable: true })
|
@Property({ type: types.string, nullable: true })
|
||||||
name?: string
|
name?: string
|
||||||
@@ -63,7 +60,7 @@ export class User implements RemoveIndex<AdapterUser> {
|
|||||||
export class Session implements AdapterSession {
|
export class Session implements AdapterSession {
|
||||||
@PrimaryKey()
|
@PrimaryKey()
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
id: string = randomUUID()
|
id: string = crypto.randomUUID()
|
||||||
|
|
||||||
@ManyToOne({
|
@ManyToOne({
|
||||||
entity: "User",
|
entity: "User",
|
||||||
@@ -88,7 +85,7 @@ export class Session implements AdapterSession {
|
|||||||
export class Account implements RemoveIndex<AdapterAccount> {
|
export class Account implements RemoveIndex<AdapterAccount> {
|
||||||
@PrimaryKey()
|
@PrimaryKey()
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
id: string = randomUUID()
|
id: string = crypto.randomUUID()
|
||||||
|
|
||||||
@ManyToOne({
|
@ManyToOne({
|
||||||
entity: "User",
|
entity: "User",
|
||||||
@@ -101,7 +98,7 @@ export class Account implements RemoveIndex<AdapterAccount> {
|
|||||||
userId!: string
|
userId!: string
|
||||||
|
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
type!: ProviderType
|
type!: AdapterAccount["type"]
|
||||||
|
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
provider!: string
|
provider!: string
|
||||||
@@ -13,13 +13,15 @@ import {
|
|||||||
Options,
|
Options,
|
||||||
types,
|
types,
|
||||||
} from "@mikro-orm/core"
|
} 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()
|
@Entity()
|
||||||
export class User implements defaultEntities.User {
|
export class User implements defaultEntities.User {
|
||||||
@PrimaryKey()
|
@PrimaryKey()
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
id: string = randomUUID()
|
id: string = crypto.randomUUID()
|
||||||
|
|
||||||
@Property({ type: types.string, nullable: true })
|
@Property({ type: types.string, nullable: true })
|
||||||
name?: string
|
name?: string
|
||||||
@@ -60,7 +62,7 @@ export class User implements defaultEntities.User {
|
|||||||
export class VeryImportantEntity {
|
export class VeryImportantEntity {
|
||||||
@PrimaryKey()
|
@PrimaryKey()
|
||||||
@Property({ type: types.string })
|
@Property({ type: types.string })
|
||||||
id: string = randomUUID()
|
id: string = crypto.randomUUID()
|
||||||
|
|
||||||
@Property({ type: types.boolean })
|
@Property({ type: types.boolean })
|
||||||
important = true
|
important = true
|
||||||
|
|||||||
@@ -1,13 +1,27 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
"allowJs": true,
|
||||||
"emitDecoratorMetadata": true,
|
"baseUrl": ".",
|
||||||
"esModuleInterop": true,
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "dist",
|
"skipDefaultLibCheck": true,
|
||||||
"stripInternal": true
|
"strictNullChecks": true,
|
||||||
|
"stripInternal": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declaration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": [
|
||||||
"exclude": ["dist", "test", "node_modules"]
|
"src/**/*",
|
||||||
}
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts",
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>MongoDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/mongodb-adapter">
|
<a href="https://npm.im/@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">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/mongodb-adapter?color=green&label=@auth/mongodb-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/mongodb-adapter">
|
<a href="https://www.npmtrends.com/@auth/mongodb-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/mongodb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<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",
|
"name": "@auth/mongodb-adapter",
|
||||||
"version": "1.1.3",
|
"version": "1.0.0",
|
||||||
"description": "mongoDB adapter for next-auth.",
|
"description": "MongoDB adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "Balázs Orbán <info@balazsorban.com>",
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -26,20 +38,17 @@
|
|||||||
"test:watch": "./tests/test.sh -w",
|
"test:watch": "./tests/test.sh -w",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"mongodb": "^5 || ^4",
|
"mongodb": "^5 || ^4"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"mongodb": "^5.1.0",
|
"mongodb": "^5.1.0"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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"
|
import { ObjectId } from "mongodb"
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { MongoClient } from "mongodb"
|
import type { MongoClient } from "mongodb"
|
||||||
|
|
||||||
/** This is the interface of the MongoDB adapter options. */
|
/** This is the interface of the MongoDB adapter options. */
|
||||||
@@ -132,7 +132,7 @@ export function _id(hex?: string) {
|
|||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { MongoDBAdapter } from "@next-auth/mongodb-adapter"
|
* import { MongoDBAdapter } from "@auth/mongodb-adapter"
|
||||||
* import clientPromise from "../../../lib/mongodb"
|
* import clientPromise from "../../../lib/mongodb"
|
||||||
*
|
*
|
||||||
* // For more information on each option (and a full list of options) go to
|
* // 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": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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>
|
</a>
|
||||||
<h3 align="center"><b>Neo4j Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Neo4j Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/neo4j-adapter">
|
<a href="https://npm.im/@auth/neo4j-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/neo4j-adapter">
|
<a href="https://npm.im/@auth/neo4j-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/neo4j-adapter?color=green&label=@next-auth/neo4j-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/neo4j-adapter?color=green&label=@auth/neo4j-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/neo4j-adapter">
|
<a href="https://www.npmtrends.com/@auth/neo4j-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/neo4j-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/neo4j-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/neo4j-adapter",
|
"name": "@auth/neo4j-adapter",
|
||||||
"version": "1.0.6",
|
"version": "1.0.0",
|
||||||
"description": "neo4j adapter for next-auth.",
|
"description": "neo4j adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
@@ -11,7 +11,19 @@
|
|||||||
"contributors": [
|
"contributors": [
|
||||||
"Balázs Orbán <info@balazsorban.com>"
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -28,24 +40,18 @@
|
|||||||
"test": "./tests/test.sh",
|
"test": "./tests/test.sh",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"README.md",
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"neo4j-driver": "^4.0.0 || ^5.7.0",
|
"neo4j-driver": "^4.0.0 || ^5.7.0"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"@types/uuid": "^8.3.3",
|
"@types/uuid": "^8.3.3",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"neo4j-driver": "^5.7.0",
|
"neo4j-driver": "^5.7.0"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uuid": "^8.3.2"
|
"@auth/core": "workspace:*"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
|
|||||||
@@ -9,17 +9,13 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install next-auth @next-auth/neo4j-adapter neo4j-driver
|
* npm install @auth/neo4j-adapter neo4j-driver
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/neo4j-adapter
|
* @module @auth/neo4j-adapter
|
||||||
*/
|
*/
|
||||||
import type { Session } from "neo4j-driver"
|
import { type Session, isInt, integer } from "neo4j-driver"
|
||||||
import type { Adapter } from "next-auth/adapters"
|
import type { Adapter } from "@auth/core/adapters"
|
||||||
import { v4 as uuid } from "uuid"
|
|
||||||
|
|
||||||
import { client, format } from "./utils"
|
|
||||||
export { format }
|
|
||||||
|
|
||||||
/** This is the interface of the Neo4j adapter options. The Neo4j adapter takes a {@link https://neo4j.com/docs/bolt/current/driver-api/#driver-session Neo4j session} as its only argument. */
|
/** This is the interface of the Neo4j adapter options. The Neo4j adapter takes a {@link https://neo4j.com/docs/bolt/current/driver-api/#driver-session Neo4j session} as its only argument. */
|
||||||
export interface Neo4jOptions extends Session {}
|
export interface Neo4jOptions extends Session {}
|
||||||
@@ -31,7 +27,7 @@ export interface Neo4jOptions extends Session {}
|
|||||||
*
|
*
|
||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import neo4j from "neo4j-driver"
|
* import neo4j from "neo4j-driver"
|
||||||
* import { Neo4jAdapter } from "@next-auth/neo4j-adapter"
|
* import { Neo4jAdapter } from "@auth/neo4j-adapter"
|
||||||
*
|
*
|
||||||
* const driver = neo4j.driver(
|
* const driver = neo4j.driver(
|
||||||
* "bolt://localhost",
|
* "bolt://localhost",
|
||||||
@@ -134,7 +130,7 @@ export function Neo4jAdapter(session: Session): Adapter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
async createUser(data) {
|
async createUser(data) {
|
||||||
const user: any = { id: uuid(), ...data }
|
const user = { id: crypto.randomUUID(), ...data }
|
||||||
await write(`CREATE (u:User $data)`, user)
|
await write(`CREATE (u:User $data)`, user)
|
||||||
return user
|
return user
|
||||||
},
|
},
|
||||||
@@ -288,3 +284,69 @@ export function Neo4jAdapter(session: Session): Adapter {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/honeinc/is-iso-date/blob/master/index.js
|
||||||
|
const isoDateRE =
|
||||||
|
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
|
||||||
|
|
||||||
|
function isDate(value: any) {
|
||||||
|
return value && isoDateRE.test(value) && !isNaN(Date.parse(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
export const format = {
|
||||||
|
/** Takes a plain old JavaScript object and turns it into a Neo4j compatible object */
|
||||||
|
to(object: Record<string, any>) {
|
||||||
|
const newObject: Record<string, unknown> = {}
|
||||||
|
for (const key in object) {
|
||||||
|
const value = object[key]
|
||||||
|
if (value instanceof Date) newObject[key] = value.toISOString()
|
||||||
|
else newObject[key] = value
|
||||||
|
}
|
||||||
|
return newObject
|
||||||
|
},
|
||||||
|
/** Takes a Neo4j object and returns a plain old JavaScript object */
|
||||||
|
from<T = Record<string, unknown>>(object?: Record<string, any>): T | null {
|
||||||
|
const newObject: Record<string, unknown> = {}
|
||||||
|
if (!object) return null
|
||||||
|
for (const key in object) {
|
||||||
|
const value = object[key]
|
||||||
|
if (isDate(value)) {
|
||||||
|
newObject[key] = new Date(value)
|
||||||
|
} else if (isInt(value)) {
|
||||||
|
if (integer.inSafeRange(value)) newObject[key] = value.toNumber()
|
||||||
|
else newObject[key] = value.toString()
|
||||||
|
} else {
|
||||||
|
newObject[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newObject as T
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function client(session: Session) {
|
||||||
|
return {
|
||||||
|
/** Reads values from the database */
|
||||||
|
async read<T>(statement: string, values?: any): Promise<T | null> {
|
||||||
|
const result = await session.readTransaction((tx) =>
|
||||||
|
tx.run(statement, values)
|
||||||
|
)
|
||||||
|
|
||||||
|
return format.from<T>(result?.records[0]?.get(0)) ?? null
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Reads/writes values from/to the database.
|
||||||
|
* Properties are available under `$data`
|
||||||
|
*/
|
||||||
|
async write<T extends Record<string, any>>(
|
||||||
|
statement: string,
|
||||||
|
values: T
|
||||||
|
): Promise<any> {
|
||||||
|
const result = await session.writeTransaction((tx) =>
|
||||||
|
tx.run(statement, { data: format.to(values) })
|
||||||
|
)
|
||||||
|
|
||||||
|
return format.from<T>(result?.records[0]?.toObject())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
import type { Session } from "neo4j-driver"
|
|
||||||
import { isInt, integer } from "neo4j-driver"
|
|
||||||
|
|
||||||
// https://github.com/honeinc/is-iso-date/blob/master/index.js
|
|
||||||
const isoDateRE =
|
|
||||||
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
|
|
||||||
|
|
||||||
function isDate(value: any) {
|
|
||||||
return value && isoDateRE.test(value) && !isNaN(Date.parse(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
export const format = {
|
|
||||||
/** Takes a plain old JavaScript object and turns it into a Neo4j compatible object */
|
|
||||||
to(object: Record<string, any>) {
|
|
||||||
const newObject: Record<string, unknown> = {}
|
|
||||||
for (const key in object) {
|
|
||||||
const value = object[key]
|
|
||||||
if (value instanceof Date) newObject[key] = value.toISOString()
|
|
||||||
else newObject[key] = value
|
|
||||||
}
|
|
||||||
return newObject
|
|
||||||
},
|
|
||||||
/** Takes a Neo4j object and returns a plain old JavaScript object */
|
|
||||||
from<T = Record<string, unknown>>(object?: Record<string, any>): T | null {
|
|
||||||
const newObject: Record<string, unknown> = {}
|
|
||||||
if (!object) return null
|
|
||||||
for (const key in object) {
|
|
||||||
const value = object[key]
|
|
||||||
if (isDate(value)) {
|
|
||||||
newObject[key] = new Date(value)
|
|
||||||
} else if (isInt(value)) {
|
|
||||||
if (integer.inSafeRange(value)) newObject[key] = value.toNumber()
|
|
||||||
else newObject[key] = value.toString()
|
|
||||||
} else {
|
|
||||||
newObject[key] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newObject as T
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
export function client(session: Session) {
|
|
||||||
return {
|
|
||||||
/** Reads values from the database */
|
|
||||||
async read<T>(statement: string, values?: any): Promise<T | null> {
|
|
||||||
const result = await session.readTransaction((tx) =>
|
|
||||||
tx.run(statement, values)
|
|
||||||
)
|
|
||||||
|
|
||||||
return format.from<T>(result?.records[0]?.get(0)) ?? null
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Reads/writes values from/to the database.
|
|
||||||
* Properties are available under `$data`
|
|
||||||
*/
|
|
||||||
async write<T extends Record<string, any>>(
|
|
||||||
statement: string,
|
|
||||||
values: T
|
|
||||||
): Promise<any> {
|
|
||||||
const result = await session.writeTransaction((tx) =>
|
|
||||||
tx.run(statement, { data: format.to(values) })
|
|
||||||
)
|
|
||||||
|
|
||||||
return format.from<T>(result?.records[0]?.toObject())
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,8 @@ import statements from "./resources/statements"
|
|||||||
|
|
||||||
import { Neo4jAdapter, format } from "../src"
|
import { Neo4jAdapter, format } from "../src"
|
||||||
|
|
||||||
|
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||||
|
|
||||||
const driver = neo4j.driver(
|
const driver = neo4j.driver(
|
||||||
"bolt://localhost",
|
"bolt://localhost",
|
||||||
neo4j.auth.basic("neo4j", "password")
|
neo4j.auth.basic("neo4j", "password")
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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>
|
</a>
|
||||||
<h3 align="center"><b>PouchDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>PouchDB Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/pouchdb-adapter">
|
<a href="https://npm.im/@auth/pouchdb-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/pouchdb-adapter">
|
<a href="https://npm.im/@auth/pouchdb-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/pouchdb-adapter?color=green&label=@next-auth/pouchdb-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/pouchdb-adapter?color=green&label=@auth/pouchdb-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/pouchdb-adapter">
|
<a href="https://www.npmtrends.com/@auth/pouchdb-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/pouchdb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/pouchdb-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/pouchdb-adapter",
|
"name": "@auth/pouchdb-adapter",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "PouchDB adapter for next-auth.",
|
"description": "PouchDB adapter for next-auth.",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
@@ -38,19 +38,17 @@
|
|||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"next-auth": "^4",
|
|
||||||
"pouchdb": "^8.0.1",
|
"pouchdb": "^8.0.1",
|
||||||
"pouchdb-find": "^8.0.1"
|
"pouchdb-find": "^8.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ulid": "2.3.0"
|
"@auth/core": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"@types/pouchdb": "^6.4.0",
|
"@types/pouchdb": "^6.4.0",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*",
|
|
||||||
"pouchdb": "^8.0.1",
|
"pouchdb": "^8.0.1",
|
||||||
"pouchdb-adapter-memory": "^8.0.1",
|
"pouchdb-adapter-memory": "^8.0.1",
|
||||||
"pouchdb-find": "^8.0.1"
|
"pouchdb-find": "^8.0.1"
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install next-auth pouchdb pouchdb-find @next-auth/pouchdb-adapter
|
* npm install pouchdb pouchdb-find @auth/pouchdb-adapter
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/pouchdb-adapter
|
* @module @auth/pouchdb-adapter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@@ -21,8 +21,7 @@ import type {
|
|||||||
AdapterSession,
|
AdapterSession,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import { ulid } from "ulid"
|
|
||||||
|
|
||||||
type PrefixConfig = Record<
|
type PrefixConfig = Record<
|
||||||
"user" | "account" | "session" | "verificationToken",
|
"user" | "account" | "session" | "verificationToken",
|
||||||
@@ -99,7 +98,7 @@ export interface PouchDBAdapterOptions {
|
|||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import GoogleProvider from "next-auth/providers/google"
|
* import GoogleProvider from "next-auth/providers/google"
|
||||||
* import { PouchDBAdapter } from "@next-auth/pouchdb-adapter"
|
* import { PouchDBAdapter } from "@auth/pouchdb-adapter"
|
||||||
* import PouchDB from "pouchdb"
|
* import PouchDB from "pouchdb"
|
||||||
*
|
*
|
||||||
* // Setup your PouchDB instance and database
|
* // Setup your PouchDB instance and database
|
||||||
@@ -154,7 +153,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
async createUser(user) {
|
async createUser(user) {
|
||||||
const doc = { ...user, _id: [userPrefix, ulid()].join("_") }
|
const doc = { ...user, _id: [userPrefix, crypto.randomUUID()].join("_") }
|
||||||
await pouchdb.put(doc)
|
await pouchdb.put(doc)
|
||||||
return { ...user, id: doc._id }
|
return { ...user, id: doc._id }
|
||||||
},
|
},
|
||||||
@@ -220,7 +219,10 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
|
|||||||
async deleteUser(id) {},
|
async deleteUser(id) {},
|
||||||
|
|
||||||
async linkAccount(account) {
|
async linkAccount(account) {
|
||||||
const doc = { ...account, _id: [accountPrefix, ulid()].join("_") }
|
const doc = {
|
||||||
|
...account,
|
||||||
|
_id: [accountPrefix, crypto.randomUUID()].join("_"),
|
||||||
|
}
|
||||||
await (pouchdb as unknown as PouchDB.Database<AdapterAccount>).put(doc)
|
await (pouchdb as unknown as PouchDB.Database<AdapterAccount>).put(doc)
|
||||||
|
|
||||||
return { ...account, id: doc._id }
|
return { ...account, id: doc._id }
|
||||||
@@ -245,7 +247,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
|
|||||||
|
|
||||||
async createSession(data) {
|
async createSession(data) {
|
||||||
const doc = {
|
const doc = {
|
||||||
_id: [sessionPrefix, ulid()].join("_"),
|
_id: [sessionPrefix, crypto.randomUUID()].join("_"),
|
||||||
...data,
|
...data,
|
||||||
}
|
}
|
||||||
await (pouchdb as unknown as PouchDB.Database<AdapterSession>).put(doc)
|
await (pouchdb as unknown as PouchDB.Database<AdapterSession>).put(doc)
|
||||||
@@ -317,7 +319,7 @@ export function PouchDBAdapter(options: PouchDBAdapterOptions): Adapter {
|
|||||||
|
|
||||||
async createVerificationToken(data) {
|
async createVerificationToken(data) {
|
||||||
await (pouchdb as unknown as PouchDB.Database<VerificationToken>).put({
|
await (pouchdb as unknown as PouchDB.Database<VerificationToken>).put({
|
||||||
_id: [verificationTokenPrefix, ulid()].join("_"),
|
_id: [verificationTokenPrefix, crypto.randomUUID()].join("_"),
|
||||||
...data,
|
...data,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ import {
|
|||||||
import PouchDB from "pouchdb"
|
import PouchDB from "pouchdb"
|
||||||
import find from "pouchdb-find"
|
import find from "pouchdb-find"
|
||||||
import memoryAdapter from "pouchdb-adapter-memory"
|
import memoryAdapter from "pouchdb-adapter-memory"
|
||||||
import { ulid } from "ulid"
|
|
||||||
import {
|
import {
|
||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
|
|
||||||
|
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||||
|
|
||||||
// pouchdb setup
|
// pouchdb setup
|
||||||
PouchDB.plugin(memoryAdapter).plugin(find)
|
PouchDB.plugin(memoryAdapter).plugin(find)
|
||||||
@@ -31,7 +32,7 @@ PouchDB.on("destroyed", function () {
|
|||||||
const disconnect = async () => {
|
const disconnect = async () => {
|
||||||
if (!pouchdbIsDestroyed) await pouchdb.destroy()
|
if (!pouchdbIsDestroyed) await pouchdb.destroy()
|
||||||
}
|
}
|
||||||
pouchdb = new PouchDB(ulid(), { adapter: "memory" })
|
pouchdb = new PouchDB(crypto.randomUUID(), { adapter: "memory" })
|
||||||
|
|
||||||
// Basic tests
|
// Basic tests
|
||||||
runBasicTests({
|
runBasicTests({
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"allowJs": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"baseUrl": ".",
|
||||||
"outDir": ".",
|
"isolatedModules": true,
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
|
"rootDir": "src",
|
||||||
"skipDefaultLibCheck": true,
|
"skipDefaultLibCheck": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"declaration": true
|
"declaration": true
|
||||||
},
|
},
|
||||||
"exclude": ["tests", "jest.config.js"]
|
"include": [
|
||||||
}
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts",
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Sequelize Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Sequelize Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/sequelize-adapter">
|
<a href="https://npm.im/@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">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/sequelize-adapter?color=green&label=@auth/sequelize-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/sequelize-adapter">
|
<a href="https://www.npmtrends.com/@auth/sequelize-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/sequelize-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/sequelize-adapter",
|
"name": "@auth/sequelize-adapter",
|
||||||
"version": "1.0.8",
|
"version": "1.0.0",
|
||||||
"description": "Sequelize adapter for next-auth.",
|
"description": "Sequelize adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "github.com/luke-j",
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -21,22 +33,19 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test:wip": "jest",
|
"test": "jest",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"next-auth": "^4",
|
|
||||||
"sequelize": "^6.6.5"
|
"sequelize": "^6.6.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
"@next-auth/tsconfig": "workspace:*",
|
"@next-auth/tsconfig": "workspace:*",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*",
|
|
||||||
"sequelize": "^6.6.5"
|
"sequelize": "^6.6.5"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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 {
|
import type {
|
||||||
Adapter,
|
Adapter,
|
||||||
@@ -20,13 +20,14 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import { Sequelize, Model, ModelCtor } from "sequelize"
|
import { Sequelize, Model, ModelCtor } from "sequelize"
|
||||||
import * as defaultModels from "./models"
|
import * as defaultModels from "./models"
|
||||||
|
|
||||||
export { defaultModels as models }
|
export { defaultModels as models }
|
||||||
|
|
||||||
// @see https://sequelize.org/master/manual/typescript.html
|
// @see https://sequelize.org/master/manual/typescript.html
|
||||||
|
//@ts-expect-error
|
||||||
interface AccountInstance
|
interface AccountInstance
|
||||||
extends Model<AdapterAccount, Partial<AdapterAccount>>,
|
extends Model<AdapterAccount, Partial<AdapterAccount>>,
|
||||||
AdapterAccount {}
|
AdapterAccount {}
|
||||||
@@ -70,7 +71,7 @@ export interface SequelizeAdapterOptions {
|
|||||||
*
|
*
|
||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
|
* import SequelizeAdapter from "@auth/sequelize-adapter"
|
||||||
* import { Sequelize } from "sequelize"
|
* import { Sequelize } from "sequelize"
|
||||||
*
|
*
|
||||||
* // https://sequelize.org/master/manual/getting-started.html#connecting-to-a-database
|
* // https://sequelize.org/master/manual/getting-started.html#connecting-to-a-database
|
||||||
@@ -93,7 +94,7 @@ export interface SequelizeAdapterOptions {
|
|||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import SequelizeAdapter from "@next-auth/sequelize-adapter"
|
* import SequelizeAdapter from "@auth/sequelize-adapter"
|
||||||
* import Sequelize from 'sequelize'
|
* import Sequelize from 'sequelize'
|
||||||
*
|
*
|
||||||
* const sequelize = new Sequelize("sqlite::memory:")
|
* const sequelize = new Sequelize("sqlite::memory:")
|
||||||
@@ -117,7 +118,7 @@ export interface SequelizeAdapterOptions {
|
|||||||
*
|
*
|
||||||
* ```js
|
* ```js
|
||||||
* import NextAuth from "next-auth"
|
* 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"
|
* import Sequelize, { DataTypes } from "sequelize"
|
||||||
*
|
*
|
||||||
* const sequelize = new Sequelize("sqlite::memory:")
|
* const sequelize = new Sequelize("sqlite::memory:")
|
||||||
@@ -218,6 +219,7 @@ export default function SequelizeAdapter(
|
|||||||
await sync()
|
await sync()
|
||||||
|
|
||||||
const accountInstance = await Account.findOne({
|
const accountInstance = await Account.findOne({
|
||||||
|
// @ts-expect-error
|
||||||
where: { provider, providerAccountId },
|
where: { provider, providerAccountId },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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-supabase/.npmrc
Normal file
1
packages/adapter-supabase/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Supabase Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Supabase Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/supabase-adapter">
|
<a href="https://npm.im/@auth/supabase-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/supabase-adapter">
|
<a href="https://npm.im/@auth/supabase-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/supabase-adapter?color=green&label=@next-auth/supabase-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/supabase-adapter?color=green&label=@auth/supabase-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/supabase-adapter">
|
<a href="https://www.npmtrends.com/@auth/supabase-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/supabase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/supabase-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/supabase-adapter",
|
"name": "@auth/supabase-adapter",
|
||||||
"version": "0.2.1",
|
"version": "0.1.1",
|
||||||
"description": "Supabase adapter for next-auth.",
|
"description": "Supabase adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "Martin Sonnberger <martin.sonnberger@icloud.com>",
|
"author": "Martin Sonnberger <martin.sonnberger@icloud.com>",
|
||||||
"main": "dist/index.js",
|
"type": "module",
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts*",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"import": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
"next.js",
|
"next.js",
|
||||||
@@ -23,18 +35,19 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "./tests/test.sh"
|
"test": "./tests/test.sh"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@auth/core": "workspace:*"
|
||||||
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5"
|
||||||
"next-auth": "^4.18.7"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:^0.0.0",
|
"@next-auth/adapter-test": "workspace:^0.0.0",
|
||||||
"@next-auth/tsconfig": "workspace:^0.0.0",
|
"@next-auth/tsconfig": "workspace:^0.0.0",
|
||||||
"@supabase/supabase-js": "^2.0.5",
|
"@supabase/supabase-js": "^2.0.5",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3"
|
||||||
"next-auth": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
export type Json =
|
|
||||||
| string
|
|
||||||
| number
|
|
||||||
| boolean
|
|
||||||
| null
|
|
||||||
| { [key: string]: Json }
|
|
||||||
| Json[]
|
|
||||||
|
|
||||||
export interface Database {
|
|
||||||
next_auth: {
|
|
||||||
Tables: {
|
|
||||||
accounts: {
|
|
||||||
Row: {
|
|
||||||
id: string
|
|
||||||
type: string | null
|
|
||||||
provider: string | null
|
|
||||||
providerAccountId: string | null
|
|
||||||
refresh_token: string | null
|
|
||||||
access_token: string | null
|
|
||||||
expires_at: number | null
|
|
||||||
token_type: string | null
|
|
||||||
scope: string | null
|
|
||||||
id_token: string | null
|
|
||||||
session_state: string | null
|
|
||||||
oauth_token_secret: string | null
|
|
||||||
oauth_token: string | null
|
|
||||||
userId: string | null
|
|
||||||
}
|
|
||||||
Insert: {
|
|
||||||
id?: string
|
|
||||||
type?: string | null
|
|
||||||
provider?: string | null
|
|
||||||
providerAccountId?: string | null
|
|
||||||
refresh_token?: string | null
|
|
||||||
access_token?: string | null
|
|
||||||
expires_at?: number | null
|
|
||||||
token_type?: string | null
|
|
||||||
scope?: string | null
|
|
||||||
id_token?: string | null
|
|
||||||
session_state?: string | null
|
|
||||||
oauth_token_secret?: string | null
|
|
||||||
oauth_token?: string | null
|
|
||||||
userId?: string | null
|
|
||||||
}
|
|
||||||
Update: {
|
|
||||||
id?: string
|
|
||||||
type?: string | null
|
|
||||||
provider?: string | null
|
|
||||||
providerAccountId?: string | null
|
|
||||||
refresh_token?: string | null
|
|
||||||
access_token?: string | null
|
|
||||||
expires_at?: number | null
|
|
||||||
token_type?: string | null
|
|
||||||
scope?: string | null
|
|
||||||
id_token?: string | null
|
|
||||||
session_state?: string | null
|
|
||||||
oauth_token_secret?: string | null
|
|
||||||
oauth_token?: string | null
|
|
||||||
userId?: string | null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sessions: {
|
|
||||||
Row: {
|
|
||||||
expires: string | null
|
|
||||||
sessionToken: string | null
|
|
||||||
userId: string | null
|
|
||||||
id: string
|
|
||||||
}
|
|
||||||
Insert: {
|
|
||||||
expires?: string | null
|
|
||||||
sessionToken?: string | null
|
|
||||||
userId?: string | null
|
|
||||||
id?: string
|
|
||||||
}
|
|
||||||
Update: {
|
|
||||||
expires?: string | null
|
|
||||||
sessionToken?: string | null
|
|
||||||
userId?: string | null
|
|
||||||
id?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
users: {
|
|
||||||
Row: {
|
|
||||||
name: string | null
|
|
||||||
email: string | null
|
|
||||||
emailVerified: string | null
|
|
||||||
image: string | null
|
|
||||||
id: string
|
|
||||||
}
|
|
||||||
Insert: {
|
|
||||||
name?: string | null
|
|
||||||
email?: string | null
|
|
||||||
emailVerified?: string | null
|
|
||||||
image?: string | null
|
|
||||||
id?: string
|
|
||||||
}
|
|
||||||
Update: {
|
|
||||||
name?: string | null
|
|
||||||
email?: string | null
|
|
||||||
emailVerified?: string | null
|
|
||||||
image?: string | null
|
|
||||||
id?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
verification_tokens: {
|
|
||||||
Row: {
|
|
||||||
id: number
|
|
||||||
identifier: string | null
|
|
||||||
token: string | null
|
|
||||||
expires: string | null
|
|
||||||
}
|
|
||||||
Insert: {
|
|
||||||
id?: number
|
|
||||||
identifier?: string | null
|
|
||||||
token?: string | null
|
|
||||||
expires?: string | null
|
|
||||||
}
|
|
||||||
Update: {
|
|
||||||
id?: number
|
|
||||||
identifier?: string | null
|
|
||||||
token?: string | null
|
|
||||||
expires?: string | null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Views: {
|
|
||||||
[_ in never]: never
|
|
||||||
}
|
|
||||||
Functions: {
|
|
||||||
uid: {
|
|
||||||
Args: Record<PropertyKey, never>
|
|
||||||
Returns: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Enums: {
|
|
||||||
[_ in never]: never
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,19 +9,18 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* npm install @supabase/supabase-js next-auth @next-auth/supabase-adapter
|
* npm install @supabase/supabase-js @auth/supabase-adapter
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/supabase-adapter
|
* @module @auth/supabase-adapter
|
||||||
*/
|
*/
|
||||||
import { createClient } from "@supabase/supabase-js"
|
import { createClient } from "@supabase/supabase-js"
|
||||||
import { Database } from "./database.types"
|
|
||||||
import {
|
import {
|
||||||
Adapter,
|
Adapter,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
|
|
||||||
function isDate(date: any) {
|
function isDate(date: any) {
|
||||||
return (
|
return (
|
||||||
@@ -61,7 +60,7 @@ export interface SupabaseAdapterOptions {
|
|||||||
* :::note
|
* :::note
|
||||||
* This adapter is developed by the community and not officially maintained or supported by Supabase. It uses the Supabase Database to store user and session data in a separate `next_auth` schema. It is a standalone Auth server that does not interface with Supabase Auth and therefore provides a different feature set.
|
* This adapter is developed by the community and not officially maintained or supported by Supabase. It uses the Supabase Database to store user and session data in a separate `next_auth` schema. It is a standalone Auth server that does not interface with Supabase Auth and therefore provides a different feature set.
|
||||||
*
|
*
|
||||||
* If you’re looking for an officially maintained Auth server with additional features like [built-in email server](https://supabase.com/docs/guides/auth/auth-email#configure-email-settings?utm_source=authjs-docs&medium=referral&campaign=authjs), [phone auth](https://supabase.com/docs/guides/auth/auth-twilio?utm_source=authjs-docs&medium=referral&campaign=authjs), and [Multi Factor Authentication (MFA / 2FA)](https://supabase.com/contact/mfa?utm_source=authjs-docs&medium=referral&campaign=authjs), please use [Supabase Auth](https://supabase.com/auth) with the [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs?utm_source=authjs-docs&medium=referral&campaign=authjs).
|
* If you're looking for an officially maintained Auth server with additional features like [built-in email server](https://supabase.com/docs/guides/auth/auth-email#configure-email-settings?utm_source=authjs-docs&medium=referral&campaign=authjs), [phone auth](https://supabase.com/docs/guides/auth/auth-twilio?utm_source=authjs-docs&medium=referral&campaign=authjs), and [Multi Factor Authentication (MFA / 2FA)](https://supabase.com/contact/mfa?utm_source=authjs-docs&medium=referral&campaign=authjs), please use [Supabase Auth](https://supabase.com/auth) with the [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs?utm_source=authjs-docs&medium=referral&campaign=authjs).
|
||||||
* :::
|
* :::
|
||||||
*
|
*
|
||||||
* ## Setup
|
* ## Setup
|
||||||
@@ -72,7 +71,7 @@ export interface SupabaseAdapterOptions {
|
|||||||
*
|
*
|
||||||
* ```js title="pages/api/auth/[...nextauth].js"
|
* ```js title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { SupabaseAdapter } from "@next-auth/supabase-adapter"
|
* import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
*
|
*
|
||||||
* // For more information on each option (and a full list of options) go to
|
* // For more information on each option (and a full list of options) go to
|
||||||
* // https://authjs.dev/reference/configuration/auth-config
|
* // https://authjs.dev/reference/configuration/auth-config
|
||||||
@@ -224,7 +223,7 @@ export interface SupabaseAdapterOptions {
|
|||||||
*
|
*
|
||||||
* ```js title="pages/api/auth/[...nextauth].js"
|
* ```js title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import { SupabaseAdapter } from "@next-auth/supabase-adapter"
|
* import { SupabaseAdapter } from "@auth/supabase-adapter"
|
||||||
* import jwt from "jsonwebtoken"
|
* import jwt from "jsonwebtoken"
|
||||||
*
|
*
|
||||||
* // For more information on each option (and a full list of options) go to
|
* // For more information on each option (and a full list of options) go to
|
||||||
@@ -350,9 +349,7 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
|
|||||||
const { url, secret } = options
|
const { url, secret } = options
|
||||||
const supabase = createClient<Database, "next_auth">(url, secret, {
|
const supabase = createClient<Database, "next_auth">(url, secret, {
|
||||||
db: { schema: "next_auth" },
|
db: { schema: "next_auth" },
|
||||||
global: {
|
global: { headers: { "X-Client-Info": "@auth/supabase-adapter" } },
|
||||||
headers: { "X-Client-Info": "@next-auth/supabase-adapter@0.1.0" },
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
async createUser(user) {
|
async createUser(user) {
|
||||||
@@ -463,7 +460,7 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
user: format<AdapterUser>(
|
user: format<AdapterUser>(
|
||||||
user as Database["next_auth"]["Tables"]["users"]["Row"]
|
user as Database["next_auth"]["Tables"]["users"]["Row"][]
|
||||||
),
|
),
|
||||||
session: format<AdapterSession>(session),
|
session: format<AdapterSession>(session),
|
||||||
}
|
}
|
||||||
@@ -524,3 +521,135 @@ export function SupabaseAdapter(options: SupabaseAdapterOptions): Adapter {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Database {
|
||||||
|
next_auth: {
|
||||||
|
Tables: {
|
||||||
|
accounts: {
|
||||||
|
Row: {
|
||||||
|
id: string
|
||||||
|
type: string | null
|
||||||
|
provider: string | null
|
||||||
|
providerAccountId: string | null
|
||||||
|
refresh_token: string | null
|
||||||
|
access_token: string | null
|
||||||
|
expires_at: number | null
|
||||||
|
token_type: string | null
|
||||||
|
scope: string | null
|
||||||
|
id_token: string | null
|
||||||
|
session_state: string | null
|
||||||
|
oauth_token_secret: string | null
|
||||||
|
oauth_token: string | null
|
||||||
|
userId: string | null
|
||||||
|
}
|
||||||
|
Insert: {
|
||||||
|
id?: string
|
||||||
|
type?: string | null
|
||||||
|
provider?: string | null
|
||||||
|
providerAccountId?: string | null
|
||||||
|
refresh_token?: string | null
|
||||||
|
access_token?: string | null
|
||||||
|
expires_at?: number | null
|
||||||
|
token_type?: string | null
|
||||||
|
scope?: string | null
|
||||||
|
id_token?: string | null
|
||||||
|
session_state?: string | null
|
||||||
|
oauth_token_secret?: string | null
|
||||||
|
oauth_token?: string | null
|
||||||
|
userId?: string | null
|
||||||
|
}
|
||||||
|
Update: {
|
||||||
|
id?: string
|
||||||
|
type?: string | null
|
||||||
|
provider?: string | null
|
||||||
|
providerAccountId?: string | null
|
||||||
|
refresh_token?: string | null
|
||||||
|
access_token?: string | null
|
||||||
|
expires_at?: number | null
|
||||||
|
token_type?: string | null
|
||||||
|
scope?: string | null
|
||||||
|
id_token?: string | null
|
||||||
|
session_state?: string | null
|
||||||
|
oauth_token_secret?: string | null
|
||||||
|
oauth_token?: string | null
|
||||||
|
userId?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sessions: {
|
||||||
|
Row: {
|
||||||
|
expires: string | null
|
||||||
|
sessionToken: string | null
|
||||||
|
userId: string | null
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
Insert: {
|
||||||
|
expires?: string | null
|
||||||
|
sessionToken?: string | null
|
||||||
|
userId?: string | null
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
Update: {
|
||||||
|
expires?: string | null
|
||||||
|
sessionToken?: string | null
|
||||||
|
userId?: string | null
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
users: {
|
||||||
|
Row: {
|
||||||
|
name: string | null
|
||||||
|
email: string | null
|
||||||
|
emailVerified: string | null
|
||||||
|
image: string | null
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
Insert: {
|
||||||
|
name?: string | null
|
||||||
|
email?: string | null
|
||||||
|
emailVerified?: string | null
|
||||||
|
image?: string | null
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
Update: {
|
||||||
|
name?: string | null
|
||||||
|
email?: string | null
|
||||||
|
emailVerified?: string | null
|
||||||
|
image?: string | null
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
verification_tokens: {
|
||||||
|
Row: {
|
||||||
|
id: number
|
||||||
|
identifier: string | null
|
||||||
|
token: string | null
|
||||||
|
expires: string | null
|
||||||
|
}
|
||||||
|
Insert: {
|
||||||
|
id?: number
|
||||||
|
identifier?: string | null
|
||||||
|
token?: string | null
|
||||||
|
expires?: string | null
|
||||||
|
}
|
||||||
|
Update: {
|
||||||
|
id?: number
|
||||||
|
identifier?: string | null
|
||||||
|
token?: string | null
|
||||||
|
expires?: string | null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Views: {
|
||||||
|
[_ in never]: never
|
||||||
|
}
|
||||||
|
Functions: {
|
||||||
|
uid: {
|
||||||
|
Args: Record<PropertyKey, never>
|
||||||
|
Returns: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Enums: {
|
||||||
|
[_ in never]: never
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import type {
|
|||||||
AdapterSession,
|
AdapterSession,
|
||||||
AdapterUser,
|
AdapterUser,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { Account } from "next-auth"
|
import type { Account } from "@auth/core/types"
|
||||||
|
|
||||||
const url = process.env.SUPABASE_URL ?? "http://localhost:54321"
|
const url = process.env.SUPABASE_URL ?? "http://localhost:54321"
|
||||||
const secret =
|
const secret =
|
||||||
|
|||||||
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>
|
</a>
|
||||||
<h3 align="center"><b>Upstash Redis Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Upstash Redis Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<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" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/upstash-redis-adapter">
|
<a href="https://npm.im/@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">
|
<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>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/upstash-redis-adapter">
|
<a href="https://www.npmtrends.com/@auth/upstash-redis-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/upstash-redis-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/upstash-redis-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<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",
|
"name": "@auth/upstash-redis-adapter",
|
||||||
"version": "3.0.4",
|
"version": "1.0.0",
|
||||||
"description": "Upstash adapter for next-auth. It uses Upstash's connectionless (HTTP based) Redis client.",
|
"description": "Upstash adapter for Auth.js.",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "github.com/kay-is",
|
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -25,13 +37,11 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@upstash/redis": "^1.0.1",
|
"@upstash/redis": "^1.0.1"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:*",
|
"@next-auth/adapter-test": "workspace:*",
|
||||||
@@ -43,9 +53,6 @@
|
|||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*"
|
"next-auth": "workspace:*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"uuid": "^8.3.2"
|
|
||||||
},
|
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "@next-auth/adapter-test/jest"
|
"preset": "@next-auth/adapter-test/jest"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* ## Installation
|
* ## Installation
|
||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```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 {
|
import type {
|
||||||
Adapter,
|
Adapter,
|
||||||
@@ -20,11 +20,9 @@ import type {
|
|||||||
AdapterAccount,
|
AdapterAccount,
|
||||||
AdapterSession,
|
AdapterSession,
|
||||||
VerificationToken,
|
VerificationToken,
|
||||||
} from "next-auth/adapters"
|
} from "@auth/core/adapters"
|
||||||
import type { Redis } from "@upstash/redis"
|
import type { Redis } from "@upstash/redis"
|
||||||
|
|
||||||
import { v4 as uuid } from "uuid"
|
|
||||||
|
|
||||||
/** This is the interface of the Upstash Redis adapter options. */
|
/** This is the interface of the Upstash Redis adapter options. */
|
||||||
export interface UpstashRedisAdapterOptions {
|
export interface UpstashRedisAdapterOptions {
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +91,7 @@ export function hydrateDates(json: object) {
|
|||||||
* ```javascript title="pages/api/auth/[...nextauth].js"
|
* ```javascript title="pages/api/auth/[...nextauth].js"
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import GoogleProvider from "next-auth/providers/google"
|
* 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"
|
* import upstashRedisClient from "@upstash/redis"
|
||||||
*
|
*
|
||||||
* const redis = upstashRedisClient(
|
* const redis = upstashRedisClient(
|
||||||
@@ -217,7 +215,7 @@ export function UpstashRedisAdapter(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
async createUser(user) {
|
async createUser(user) {
|
||||||
const id = uuid()
|
const id = crypto.randomUUID()
|
||||||
// TypeScript thinks the emailVerified field is missing
|
// TypeScript thinks the emailVerified field is missing
|
||||||
// but all fields are copied directly from user, so it's there
|
// but all fields are copied directly from user, so it's there
|
||||||
return await setUser(id, { ...user, id })
|
return await setUser(id, { ...user, id })
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { runBasicTests } from "@next-auth/adapter-test"
|
|||||||
import { hydrateDates, UpstashRedisAdapter } from "../src"
|
import { hydrateDates, UpstashRedisAdapter } from "../src"
|
||||||
import "dotenv/config"
|
import "dotenv/config"
|
||||||
|
|
||||||
|
globalThis.crypto ??= require("node:crypto").webcrypto
|
||||||
|
|
||||||
if (!process.env.UPSTASH_REDIS_URL || !process.env.UPSTASH_REDIS_KEY) {
|
if (!process.env.UPSTASH_REDIS_URL || !process.env.UPSTASH_REDIS_KEY) {
|
||||||
test("Skipping UpstashRedisAdapter tests, since required environment variables aren't available", () => {
|
test("Skipping UpstashRedisAdapter tests, since required environment variables aren't available", () => {
|
||||||
expect(true).toBe(true)
|
expect(true).toBe(true)
|
||||||
@@ -27,6 +29,7 @@ const client = new Redis({
|
|||||||
runBasicTests({
|
runBasicTests({
|
||||||
adapter: UpstashRedisAdapter(client, { baseKeyPrefix: "testApp:" }),
|
adapter: UpstashRedisAdapter(client, { baseKeyPrefix: "testApp:" }),
|
||||||
db: {
|
db: {
|
||||||
|
disconnect: client.flushdb,
|
||||||
async user(id: string) {
|
async user(id: string) {
|
||||||
const data = await client.get<object>(`testApp:user:${id}`)
|
const data = await client.get<object>(`testApp:user:${id}`)
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
@@ -48,7 +51,7 @@ runBasicTests({
|
|||||||
},
|
},
|
||||||
async verificationToken(where) {
|
async verificationToken(where) {
|
||||||
const data = await client.get<object>(
|
const data = await client.get<object>(
|
||||||
`testApp:user:token:${where.identifier}`
|
`testApp:user:token:${where.identifier}:${where.token}`
|
||||||
)
|
)
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
return hydrateDates(data)
|
return hydrateDates(data)
|
||||||
|
|||||||
@@ -1,8 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"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-xata/.npmrc
Normal file
1
packages/adapter-xata/.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
</a>
|
</a>
|
||||||
<h3 align="center"><b>Xata Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
<h3 align="center"><b>Xata Adapter</b> - NextAuth.js / Auth.js</a></h3>
|
||||||
<p align="center" style="align: center;">
|
<p align="center" style="align: center;">
|
||||||
<a href="https://npm.im/@next-auth/xata-adapter">
|
<a href="https://npm.im/@auth/xata-adapter">
|
||||||
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
<img src="https://img.shields.io/badge/TypeScript-blue?style=flat-square" alt="TypeScript" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://npm.im/@next-auth/xata-adapter">
|
<a href="https://npm.im/@auth/xata-adapter">
|
||||||
<img alt="npm" src="https://img.shields.io/npm/v/@next-auth/xata-adapter?color=green&label=@next-auth/xata-adapter&style=flat-square">
|
<img alt="npm" src="https://img.shields.io/npm/v/@auth/xata-adapter?color=green&label=@auth/xata-adapter&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.npmtrends.com/@next-auth/xata-adapter">
|
<a href="https://www.npmtrends.com/@auth/xata-adapter">
|
||||||
<img src="https://img.shields.io/npm/dm/@next-auth/xata-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
<img src="https://img.shields.io/npm/dm/@auth/xata-adapter?label=%20downloads&style=flat-square" alt="Downloads" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/nextauthjs/next-auth/stargazers">
|
<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" />
|
<img src="https://img.shields.io/github/stars/nextauthjs/next-auth?style=flat-square" alt="Github Stars" />
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-auth/xata-adapter",
|
"name": "@auth/xata-adapter",
|
||||||
"version": "0.2.2",
|
"version": "0.1.0",
|
||||||
"description": "Xata adapter for next-auth.",
|
"description": "Xata adapter for Auth.js",
|
||||||
"homepage": "https://authjs.dev",
|
"homepage": "https://authjs.dev",
|
||||||
"repository": "https://github.com/nextauthjs/next-auth",
|
"repository": "https://github.com/nextauthjs/next-auth",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nextauthjs/next-auth/issues"
|
"url": "https://github.com/nextauthjs/next-auth/issues"
|
||||||
},
|
},
|
||||||
"author": "Tejas Kumar",
|
"author": "Tejas Kumar",
|
||||||
"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",
|
"license": "ISC",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"next-auth",
|
"next-auth",
|
||||||
@@ -24,19 +36,16 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"files": [
|
"dependencies": {
|
||||||
"README.md",
|
"@auth/core": "workspace:*"
|
||||||
"dist"
|
},
|
||||||
],
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@xata.io/client": ">=0.13.0",
|
"@xata.io/client": ">=0.13.0"
|
||||||
"next-auth": "^4"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next-auth/adapter-test": "workspace:^0.0.0",
|
"@next-auth/adapter-test": "workspace:^0.0.0",
|
||||||
"@next-auth/tsconfig": "workspace:^0.0.0",
|
"@next-auth/tsconfig": "workspace:^0.0.0",
|
||||||
"jest": "^27.4.3",
|
"jest": "^27.4.3",
|
||||||
"next-auth": "workspace:*",
|
|
||||||
"@xata.io/client": "^0.13.0",
|
"@xata.io/client": "^0.13.0",
|
||||||
"typescript": "^4.7.4"
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* ```bash npm2yarn2pnpm
|
* ```bash npm2yarn2pnpm
|
||||||
* # Install Auth.js and the Xata adapter
|
* # Install Auth.js and the Xata adapter
|
||||||
* npm install next-auth @next-auth/xata-adapter
|
* npm install @auth/xata-adapter
|
||||||
*
|
*
|
||||||
* # Install the Xata CLI globally if you don't already have it
|
* # Install the Xata CLI globally if you don't already have it
|
||||||
* npm install --location=global @xata.io/cli
|
* npm install --location=global @xata.io/cli
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
* xata auth login
|
* xata auth login
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @module @next-auth/xata-adapter
|
* @module @auth/xata-adapter
|
||||||
*/
|
*/
|
||||||
import type { Adapter } from "next-auth/adapters"
|
import type { Adapter } from "@auth/core/adapters"
|
||||||
|
|
||||||
import type { XataClient } from "./xata"
|
import type { XataClient } from "./xata"
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ import type { XataClient } from "./xata"
|
|||||||
* ```diff
|
* ```diff
|
||||||
* import NextAuth from "next-auth"
|
* import NextAuth from "next-auth"
|
||||||
* import GoogleProvider from "next-auth/providers/google"
|
* import GoogleProvider from "next-auth/providers/google"
|
||||||
* +import { XataAdapter } from "@next-auth/xata-adapter"
|
* +import { XataAdapter } from "@auth/xata-adapter"
|
||||||
* +import { XataClient } from "../../../xata" // or wherever you've chosen to create the client
|
* +import { XataClient } from "../../../xata" // or wherever you've chosen to create the client
|
||||||
*
|
*
|
||||||
* +const client = new XataClient()
|
* +const client = new XataClient()
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
{
|
{
|
||||||
"extends": "@next-auth/tsconfig/tsconfig.adapters.json",
|
"extends": "@next-auth/tsconfig/tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"isolatedModules": true,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": ".",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "dist"
|
"skipDefaultLibCheck": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"stripInternal": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"declaration": true
|
||||||
},
|
},
|
||||||
"include": ["."],
|
"include": [
|
||||||
"exclude": ["tests", "dist", "jest.config.js"]
|
"src/**/*"
|
||||||
}
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.d.ts",
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@auth/sveltekit",
|
"name": "@auth/sveltekit",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"description": "Authentication for SvelteKit.",
|
"description": "Authentication for SvelteKit.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"authentication",
|
"authentication",
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export async function signIn<
|
|||||||
const data = await res.clone().json()
|
const data = await res.clone().json()
|
||||||
const error = new URL(data.url).searchParams.get("error")
|
const error = new URL(data.url).searchParams.get("error")
|
||||||
|
|
||||||
if (redirect || !isSupportingReturn || !error) {
|
if (redirect || !isSupportingReturn) {
|
||||||
// TODO: Do not redirect for Credentials and Email providers by default in next major
|
// TODO: Do not redirect for Credentials and Email providers by default in next major
|
||||||
window.location.href = data.url ?? callbackUrl
|
window.location.href = data.url ?? callbackUrl
|
||||||
// If url contains a hash, the browser does not reload the page. We reload manually
|
// If url contains a hash, the browser does not reload the page. We reload manually
|
||||||
|
|||||||
96
pnpm-lock.yaml
generated
96
pnpm-lock.yaml
generated
@@ -54,10 +54,10 @@ importers:
|
|||||||
apps/dev/nextjs:
|
apps/dev/nextjs:
|
||||||
specifiers:
|
specifiers:
|
||||||
'@auth/core': workspace:*
|
'@auth/core': workspace:*
|
||||||
|
'@auth/fauna-adapter': workspace:*
|
||||||
'@auth/prisma-adapter': workspace:*
|
'@auth/prisma-adapter': workspace:*
|
||||||
|
'@auth/supabase-adapter': workspace:*
|
||||||
'@auth/typeorm-adapter': workspace:*
|
'@auth/typeorm-adapter': workspace:*
|
||||||
'@next-auth/fauna-adapter': workspace:*
|
|
||||||
'@next-auth/supabase-adapter': workspace:*
|
|
||||||
'@playwright/test': 1.29.2
|
'@playwright/test': 1.29.2
|
||||||
'@prisma/client': ^3
|
'@prisma/client': ^3
|
||||||
'@supabase/supabase-js': ^2.0.5
|
'@supabase/supabase-js': ^2.0.5
|
||||||
@@ -78,10 +78,10 @@ importers:
|
|||||||
typeorm: 0.3.7
|
typeorm: 0.3.7
|
||||||
dependencies:
|
dependencies:
|
||||||
'@auth/core': link:../../../packages/core
|
'@auth/core': link:../../../packages/core
|
||||||
|
'@auth/fauna-adapter': link:../../../packages/adapter-fauna
|
||||||
'@auth/prisma-adapter': link:../../../packages/adapter-prisma
|
'@auth/prisma-adapter': link:../../../packages/adapter-prisma
|
||||||
|
'@auth/supabase-adapter': link:../../../packages/adapter-supabase
|
||||||
'@auth/typeorm-adapter': link:../../../packages/adapter-typeorm
|
'@auth/typeorm-adapter': link:../../../packages/adapter-typeorm
|
||||||
'@next-auth/fauna-adapter': link:../../../packages/adapter-fauna
|
|
||||||
'@next-auth/supabase-adapter': link:../../../packages/adapter-supabase
|
|
||||||
'@prisma/client': 3.15.2_prisma@3.15.2
|
'@prisma/client': 3.15.2_prisma@3.15.2
|
||||||
'@supabase/supabase-js': 2.0.5
|
'@supabase/supabase-js': 2.0.5
|
||||||
faunadb: 4.6.0
|
faunadb: 4.6.0
|
||||||
@@ -104,10 +104,10 @@ importers:
|
|||||||
|
|
||||||
apps/dev/nextjs-v4:
|
apps/dev/nextjs-v4:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/fauna-adapter': workspace:*
|
||||||
'@auth/prisma-adapter': workspace:*
|
'@auth/prisma-adapter': workspace:*
|
||||||
|
'@auth/supabase-adapter': workspace:*
|
||||||
'@auth/typeorm-adapter': workspace:*
|
'@auth/typeorm-adapter': workspace:*
|
||||||
'@next-auth/fauna-adapter': workspace:*
|
|
||||||
'@next-auth/supabase-adapter': workspace:*
|
|
||||||
'@prisma/client': ^3
|
'@prisma/client': ^3
|
||||||
'@supabase/supabase-js': ^2.0.5
|
'@supabase/supabase-js': ^2.0.5
|
||||||
'@types/jsonwebtoken': ^8.5.5
|
'@types/jsonwebtoken': ^8.5.5
|
||||||
@@ -125,10 +125,10 @@ importers:
|
|||||||
sqlite3: ^5.0.8
|
sqlite3: ^5.0.8
|
||||||
typeorm: 0.3.7
|
typeorm: 0.3.7
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@auth/fauna-adapter': link:../../../packages/adapter-fauna
|
||||||
'@auth/prisma-adapter': link:../../../packages/adapter-prisma
|
'@auth/prisma-adapter': link:../../../packages/adapter-prisma
|
||||||
|
'@auth/supabase-adapter': link:../../../packages/adapter-supabase
|
||||||
'@auth/typeorm-adapter': link:../../../packages/adapter-typeorm
|
'@auth/typeorm-adapter': link:../../../packages/adapter-typeorm
|
||||||
'@next-auth/fauna-adapter': link:../../../packages/adapter-fauna
|
|
||||||
'@next-auth/supabase-adapter': link:../../../packages/adapter-supabase
|
|
||||||
'@prisma/client': 3.15.2_prisma@3.15.2
|
'@prisma/client': 3.15.2_prisma@3.15.2
|
||||||
'@supabase/supabase-js': 2.0.5
|
'@supabase/supabase-js': 2.0.5
|
||||||
faunadb: 4.6.0
|
faunadb: 4.6.0
|
||||||
@@ -251,6 +251,7 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-dgraph:
|
packages/adapter-dgraph:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/jest': ^26.0.24
|
'@types/jest': ^26.0.24
|
||||||
@@ -258,12 +259,11 @@ importers:
|
|||||||
'@types/node-fetch': ^2.5.11
|
'@types/node-fetch': ^2.5.11
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
jsonwebtoken: ^8.5.1
|
jsonwebtoken: ^8.5.1
|
||||||
next-auth: workspace:*
|
|
||||||
node-fetch: ^2.6.1
|
|
||||||
ts-jest: ^27.0.3
|
ts-jest: ^27.0.3
|
||||||
|
undici: 5.22.1
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
jsonwebtoken: 8.5.1
|
jsonwebtoken: 8.5.1
|
||||||
node-fetch: 2.6.7
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
@@ -271,137 +271,128 @@ importers:
|
|||||||
'@types/jsonwebtoken': 8.5.8
|
'@types/jsonwebtoken': 8.5.8
|
||||||
'@types/node-fetch': 2.6.2
|
'@types/node-fetch': 2.6.2
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
ts-jest: 27.1.5_lvqy56smyn5gszh3zmisfmhukm
|
ts-jest: 27.1.5_lvqy56smyn5gszh3zmisfmhukm
|
||||||
|
undici: 5.22.1
|
||||||
|
|
||||||
packages/adapter-dynamodb:
|
packages/adapter-dynamodb:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@aws-sdk/client-dynamodb': ^3.36.1
|
'@aws-sdk/client-dynamodb': ^3.36.1
|
||||||
'@aws-sdk/lib-dynamodb': ^3.36.1
|
'@aws-sdk/lib-dynamodb': ^3.36.1
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@shelf/jest-dynamodb': ^2.1.0
|
'@shelf/jest-dynamodb': ^2.1.0
|
||||||
'@types/uuid': ^9.0.0
|
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
|
||||||
uuid: ^9.0.0
|
|
||||||
dependencies:
|
dependencies:
|
||||||
uuid: 9.0.0
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@aws-sdk/client-dynamodb': 3.113.0
|
'@aws-sdk/client-dynamodb': 3.113.0
|
||||||
'@aws-sdk/lib-dynamodb': 3.113.0_eb2z3hhrjl3qvyc6ecmpo2nhva
|
'@aws-sdk/lib-dynamodb': 3.113.0_eb2z3hhrjl3qvyc6ecmpo2nhva
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@shelf/jest-dynamodb': 2.2.4_qsruu6yolbxs4rh6ixjhkibvwu
|
'@shelf/jest-dynamodb': 2.2.4_qsruu6yolbxs4rh6ixjhkibvwu
|
||||||
'@types/uuid': 9.0.0
|
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-fauna:
|
packages/adapter-fauna:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@fauna-labs/fauna-schema-migrate': ^2.1.3
|
'@fauna-labs/fauna-schema-migrate': ^2.1.3
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
faunadb: ^4.3.0
|
faunadb: ^4.3.0
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@fauna-labs/fauna-schema-migrate': 2.2.1_faunadb@4.6.0
|
'@fauna-labs/fauna-schema-migrate': 2.2.1_faunadb@4.6.0
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
faunadb: 4.6.0
|
faunadb: 4.6.0
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-firebase:
|
packages/adapter-firebase:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
firebase-admin: ^11.4.1
|
firebase-admin: ^11.4.1
|
||||||
firebase-tools: ^11.16.1
|
firebase-tools: ^11.16.1
|
||||||
jest: ^29.3.1
|
jest: ^29.3.1
|
||||||
next-auth: workspace:*
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
firebase-admin: 11.4.1
|
firebase-admin: 11.4.1
|
||||||
firebase-tools: 11.16.1
|
firebase-tools: 11.16.1
|
||||||
jest: 29.3.1
|
jest: 29.3.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-mikro-orm:
|
packages/adapter-mikro-orm:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@mikro-orm/core': ^5
|
'@mikro-orm/core': ^5
|
||||||
'@mikro-orm/sqlite': ^5
|
'@mikro-orm/sqlite': ^5
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/uuid': '>=8'
|
|
||||||
jest: ^29
|
jest: ^29
|
||||||
next-auth: workspace:*
|
|
||||||
uuid: ^9
|
|
||||||
dependencies:
|
dependencies:
|
||||||
uuid: 9.0.0
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@mikro-orm/core': 5.2.1_@mikro-orm+sqlite@5.2.1
|
'@mikro-orm/core': 5.2.1_@mikro-orm+sqlite@5.2.1
|
||||||
'@mikro-orm/sqlite': 5.2.1_@mikro-orm+core@5.2.1
|
'@mikro-orm/sqlite': 5.2.1_@mikro-orm+core@5.2.1
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@types/uuid': 8.3.4
|
|
||||||
jest: 29.3.0
|
jest: 29.3.0
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-mongodb:
|
packages/adapter-mongodb:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
mongodb: ^5.1.0
|
mongodb: ^5.1.0
|
||||||
next-auth: workspace:*
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
mongodb: 5.1.0
|
mongodb: 5.1.0
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-neo4j:
|
packages/adapter-neo4j:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/uuid': ^8.3.3
|
'@types/uuid': ^8.3.3
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
neo4j-driver: ^5.7.0
|
neo4j-driver: ^5.7.0
|
||||||
next-auth: workspace:*
|
|
||||||
uuid: ^8.3.2
|
|
||||||
dependencies:
|
dependencies:
|
||||||
uuid: 8.3.2
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@types/uuid': 8.3.4
|
'@types/uuid': 8.3.4
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
neo4j-driver: 5.7.0
|
neo4j-driver: 5.7.0
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-pouchdb:
|
packages/adapter-pouchdb:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/pouchdb': ^6.4.0
|
'@types/pouchdb': ^6.4.0
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
|
||||||
pouchdb: ^8.0.1
|
pouchdb: ^8.0.1
|
||||||
pouchdb-adapter-memory: ^8.0.1
|
pouchdb-adapter-memory: ^8.0.1
|
||||||
pouchdb-find: ^8.0.1
|
pouchdb-find: ^8.0.1
|
||||||
ulid: 2.3.0
|
|
||||||
dependencies:
|
dependencies:
|
||||||
ulid: 2.3.0
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@types/pouchdb': 6.4.0
|
'@types/pouchdb': 6.4.0
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
pouchdb: 8.0.1
|
pouchdb: 8.0.1
|
||||||
pouchdb-adapter-memory: 8.0.1
|
pouchdb-adapter-memory: 8.0.1
|
||||||
pouchdb-find: 8.0.1
|
pouchdb-find: 8.0.1
|
||||||
@@ -427,31 +418,33 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-sequelize:
|
packages/adapter-sequelize:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
|
||||||
sequelize: ^6.6.5
|
sequelize: ^6.6.5
|
||||||
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
sequelize: 6.21.0
|
sequelize: 6.21.0
|
||||||
|
|
||||||
packages/adapter-supabase:
|
packages/adapter-supabase:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:^0.0.0
|
'@next-auth/adapter-test': workspace:^0.0.0
|
||||||
'@next-auth/tsconfig': workspace:^0.0.0
|
'@next-auth/tsconfig': workspace:^0.0.0
|
||||||
'@supabase/supabase-js': ^2.0.5
|
'@supabase/supabase-js': ^2.0.5
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@supabase/supabase-js': 2.0.5
|
'@supabase/supabase-js': 2.0.5
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
|
|
||||||
packages/adapter-test:
|
packages/adapter-test:
|
||||||
specifiers:
|
specifiers:
|
||||||
@@ -504,6 +497,7 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-upstash-redis:
|
packages/adapter-upstash-redis:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:*
|
'@next-auth/adapter-test': workspace:*
|
||||||
'@next-auth/tsconfig': workspace:*
|
'@next-auth/tsconfig': workspace:*
|
||||||
'@types/uuid': ^8.3.3
|
'@types/uuid': ^8.3.3
|
||||||
@@ -512,9 +506,8 @@ importers:
|
|||||||
isomorphic-fetch: 3.0.0
|
isomorphic-fetch: 3.0.0
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
next-auth: workspace:*
|
||||||
uuid: ^8.3.2
|
|
||||||
dependencies:
|
dependencies:
|
||||||
uuid: 8.3.2
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
@@ -527,18 +520,19 @@ importers:
|
|||||||
|
|
||||||
packages/adapter-xata:
|
packages/adapter-xata:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@auth/core': workspace:*
|
||||||
'@next-auth/adapter-test': workspace:^0.0.0
|
'@next-auth/adapter-test': workspace:^0.0.0
|
||||||
'@next-auth/tsconfig': workspace:^0.0.0
|
'@next-auth/tsconfig': workspace:^0.0.0
|
||||||
'@xata.io/client': ^0.13.0
|
'@xata.io/client': ^0.13.0
|
||||||
jest: ^27.4.3
|
jest: ^27.4.3
|
||||||
next-auth: workspace:*
|
|
||||||
typescript: ^4.7.4
|
typescript: ^4.7.4
|
||||||
|
dependencies:
|
||||||
|
'@auth/core': link:../core
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@next-auth/adapter-test': link:../adapter-test
|
'@next-auth/adapter-test': link:../adapter-test
|
||||||
'@next-auth/tsconfig': link:../tsconfig
|
'@next-auth/tsconfig': link:../tsconfig
|
||||||
'@xata.io/client': 0.13.4_typescript@4.7.4
|
'@xata.io/client': 0.13.4_typescript@4.7.4
|
||||||
jest: 27.5.1
|
jest: 27.5.1
|
||||||
next-auth: link:../next-auth
|
|
||||||
typescript: 4.7.4
|
typescript: 4.7.4
|
||||||
|
|
||||||
packages/core:
|
packages/core:
|
||||||
@@ -11445,10 +11439,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==}
|
resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@types/uuid/9.0.0:
|
|
||||||
resolution: {integrity: sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@types/validator/13.7.3:
|
/@types/validator/13.7.3:
|
||||||
resolution: {integrity: sha512-DNviAE5OUcZ5s+XEQHRhERLg8fOp8gSgvyJ4aaFASx5wwaObm+PBwTIMXiOFm1QrSee5oYwEAYb7LMzX2O88gA==}
|
resolution: {integrity: sha512-DNviAE5OUcZ5s+XEQHRhERLg8fOp8gSgvyJ4aaFASx5wwaObm+PBwTIMXiOFm1QrSee5oYwEAYb7LMzX2O88gA==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -32417,11 +32407,6 @@ packages:
|
|||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ulid/2.3.0:
|
|
||||||
resolution: {integrity: sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==}
|
|
||||||
hasBin: true
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ultrahtml/1.2.0:
|
/ultrahtml/1.2.0:
|
||||||
resolution: {integrity: sha512-vxZM2yNvajRmCj/SknRYGNXk2tqiy6kRNvZjJLaleG3zJbSh/aNkOqD1/CVzypw8tyHyhpzYuwQgMMhUB4ZVNQ==}
|
resolution: {integrity: sha512-vxZM2yNvajRmCj/SknRYGNXk2tqiy6kRNvZjJLaleG3zJbSh/aNkOqD1/CVzypw8tyHyhpzYuwQgMMhUB4ZVNQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -32988,6 +32973,7 @@ packages:
|
|||||||
/uuid/9.0.0:
|
/uuid/9.0.0:
|
||||||
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
|
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
dev: true
|
||||||
|
|
||||||
/v8-compile-cache/2.3.0:
|
/v8-compile-cache/2.3.0:
|
||||||
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
|
resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==}
|
||||||
|
|||||||
50
turbo.json
50
turbo.json
@@ -47,7 +47,7 @@
|
|||||||
"e2e": {
|
"e2e": {
|
||||||
"outputs": ["playwright-report/**"]
|
"outputs": ["playwright-report/**"]
|
||||||
},
|
},
|
||||||
"@next-auth/upstash-redis-adapter#test": {
|
"@auth/upstash-redis-adapter#test": {
|
||||||
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
"env": ["UPSTASH_REDIS_KEY", "UPSTASH_REDIS_URL"]
|
||||||
},
|
},
|
||||||
"docs#dev": {
|
"docs#dev": {
|
||||||
@@ -55,19 +55,19 @@
|
|||||||
"@auth/core#build",
|
"@auth/core#build",
|
||||||
"@auth/prisma-adapter#build",
|
"@auth/prisma-adapter#build",
|
||||||
"@auth/sveltekit#build",
|
"@auth/sveltekit#build",
|
||||||
"@next-auth/dgraph-adapter#build",
|
"@auth/dgraph-adapter#build",
|
||||||
"@next-auth/dynamodb-adapter#build",
|
"@auth/dynamodb-adapter#build",
|
||||||
"@next-auth/fauna-adapter#build",
|
"@auth/fauna-adapter#build",
|
||||||
"@next-auth/firebase-adapter#build",
|
"@auth/firebase-adapter#build",
|
||||||
"@next-auth/mikro-orm-adapter#build",
|
"@auth/mikro-orm-adapter#build",
|
||||||
"@next-auth/mongodb-adapter#build",
|
"@auth/mongodb-adapter#build",
|
||||||
"@next-auth/neo4j-adapter#build",
|
"@auth/neo4j-adapter#build",
|
||||||
"@next-auth/pouchdb-adapter#build",
|
"@auth/pouchdb-adapter#build",
|
||||||
"@next-auth/sequelize-adapter#build",
|
"@auth/sequelize-adapter#build",
|
||||||
"@next-auth/supabase-adapter#build",
|
"@auth/supabase-adapter#build",
|
||||||
"@auth/typeorm-adapter#build",
|
"@auth/typeorm-adapter#build",
|
||||||
"@next-auth/upstash-redis-adapter#build",
|
"@auth/upstash-redis-adapter#build",
|
||||||
"@next-auth/xata-adapter#build",
|
"@auth/xata-adapter#build",
|
||||||
"^build",
|
"^build",
|
||||||
"next-auth#build"
|
"next-auth#build"
|
||||||
],
|
],
|
||||||
@@ -78,19 +78,19 @@
|
|||||||
"@auth/core#build",
|
"@auth/core#build",
|
||||||
"@auth/prisma-adapter#build",
|
"@auth/prisma-adapter#build",
|
||||||
"@auth/sveltekit#build",
|
"@auth/sveltekit#build",
|
||||||
"@next-auth/dgraph-adapter#build",
|
"@auth/dgraph-adapter#build",
|
||||||
"@next-auth/dynamodb-adapter#build",
|
"@auth/dynamodb-adapter#build",
|
||||||
"@next-auth/fauna-adapter#build",
|
"@auth/fauna-adapter#build",
|
||||||
"@next-auth/firebase-adapter#build",
|
"@auth/firebase-adapter#build",
|
||||||
"@next-auth/mikro-orm-adapter#build",
|
"@auth/mikro-orm-adapter#build",
|
||||||
"@next-auth/mongodb-adapter#build",
|
"@auth/mongodb-adapter#build",
|
||||||
"@next-auth/neo4j-adapter#build",
|
"@auth/neo4j-adapter#build",
|
||||||
"@next-auth/pouchdb-adapter#build",
|
"@auth/pouchdb-adapter#build",
|
||||||
"@next-auth/sequelize-adapter#build",
|
"@auth/sequelize-adapter#build",
|
||||||
"@next-auth/supabase-adapter#build",
|
"@auth/supabase-adapter#build",
|
||||||
"@auth/typeorm-adapter#build",
|
"@auth/typeorm-adapter#build",
|
||||||
"@next-auth/upstash-redis-adapter#build",
|
"@auth/upstash-redis-adapter#build",
|
||||||
"@next-auth/xata-adapter#build",
|
"@auth/xata-adapter#build",
|
||||||
"^build",
|
"^build",
|
||||||
"next-auth#build"
|
"next-auth#build"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user