Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@next-auth/mongodb-adapter

Package Overview
Dependencies
288
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

27

dist/index.js

@@ -0,4 +1,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MongoDBAdapter = exports._id = exports.format = exports.defaultCollections = void 0;
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { ObjectId } from "mongodb";
export const defaultCollections = {
const mongodb_1 = require("mongodb");
exports.defaultCollections = {
Users: "users",

@@ -9,3 +12,3 @@ Accounts: "accounts",

};
export const format = {
exports.format = {
/** Takes a mongoDB object and returns a plain old JavaScript object */

@@ -46,13 +49,14 @@ from(object) {

/** Converts from string to ObjectId */
export function _id(hex) {
function _id(hex) {
if ((hex === null || hex === void 0 ? void 0 : hex.length) !== 24)
return new ObjectId();
return new ObjectId(hex);
return new mongodb_1.ObjectId();
return new mongodb_1.ObjectId(hex);
}
export function MongoDBAdapter(client, options = {}) {
exports._id = _id;
function MongoDBAdapter(client, options = {}) {
const { collections } = options;
const { from, to } = format;
const { from, to } = exports.format;
const db = (async () => {
const _db = (await client).db();
const c = { ...defaultCollections, ...collections };
const c = { ...exports.defaultCollections, ...collections };
return {

@@ -87,3 +91,3 @@ U: _db.collection(c.Users),

return null;
const user = await (await db).U.findOne({ _id: new ObjectId(account.userId) });
const user = await (await db).U.findOne({ _id: new mongodb_1.ObjectId(account.userId) });
if (!user)

@@ -120,3 +124,3 @@ return null;

return null;
const user = await (await db).U.findOne({ _id: new ObjectId(session.userId) });
const user = await (await db).U.findOne({ _id: new mongodb_1.ObjectId(session.userId) });
if (!user)

@@ -160,1 +164,2 @@ return null;

}
exports.MongoDBAdapter = MongoDBAdapter;
{
"name": "@next-auth/mongodb-adapter",
"version": "1.0.2",
"version": "1.0.3",
"description": "mongoDB adapter for next-auth.",

@@ -5,0 +5,0 @@ "homepage": "https://next-auth.js.org",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc