New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-source-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
366
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-mongodb - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

36

gatsby-node.js
"use strict";
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
var _extends2 = require("babel-runtime/helpers/extends");

@@ -13,7 +9,7 @@

var Db = require("mongodb").Db,
MongoClient = require("mongodb").MongoClient,
ObjectID = require("mongodb").ObjectID,
crypto = require("crypto"),
_ = require("lodash");
var Db = require(`mongodb`).Db,
MongoClient = require(`mongodb`).MongoClient,
ObjectID = require(`mongodb`).ObjectID,
crypto = require(`crypto`),
_ = require(`lodash`);

@@ -29,10 +25,10 @@ exports.sourceNodes = function (_ref, pluginOptions, done) {

var serverOptions = pluginOptions.server || {
address: "localhost",
address: `localhost`,
port: 27017
};
var dbName = pluginOptions.dbName || "local",
authUrlPart = "";
if (pluginOptions.auth) authUrlPart = pluginOptions.auth.user + ":" + pluginOptions.auth.password + "@";
var dbName = pluginOptions.dbName || `local`,
authUrlPart = ``;
if (pluginOptions.auth) authUrlPart = `${pluginOptions.auth.user}:${pluginOptions.auth.password}@`;
MongoClient.connect("mongodb://" + authUrlPart + serverOptions.address + ":" + serverOptions.port + "/" + dbName, function (err, db) {
MongoClient.connect(`mongodb://${authUrlPart}${serverOptions.address}:${serverOptions.port}/${dbName}`, function (err, db) {
// Establish connection to db

@@ -49,3 +45,3 @@ if (err) {

function createNodes(db, pluginOptions, dbName, createNode, done) {
var collectionName = pluginOptions.collection || "documents";
var collectionName = pluginOptions.collection || `documents`;
var collection = db.collection(collectionName);

@@ -66,9 +62,9 @@ var cursor = collection.find();

var node = (0, _extends3.default)({}, item, {
id: "" + id,
parent: "__" + collectionName + "__",
id: `${id}`,
parent: `__${collectionName}__`,
children: [],
internal: {
type: "mongodb" + caps(dbName) + caps(collectionName),
content: (0, _stringify2.default)(item),
contentDigest: crypto.createHash("md5").update((0, _stringify2.default)(item)).digest("hex")
type: `mongodb${caps(dbName)}${caps(collectionName)}`,
content: JSON.stringify(item),
contentDigest: crypto.createHash(`md5`).update(JSON.stringify(item)).digest(`hex`)
}

@@ -75,0 +71,0 @@ /* if (pluginOptions.map) {

"use strict";
var _defineProperty2 = require("babel-runtime/helpers/defineProperty");
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.export = function (node, key, text, createNode) {
var _mappingNode;
var str = _.isString(text) ? text : " ";
var id = "" + node.id + key + "MappingNode";
var mappingNode = (_mappingNode = {
var str = _.isString(text) ? text : ` `;
var id = `${node.id}${key}MappingNode`;
var mappingNode = {
id: id,
parent: node.id
}, (0, _defineProperty3.default)(_mappingNode, key, str), (0, _defineProperty3.default)(_mappingNode, "children", []), (0, _defineProperty3.default)(_mappingNode, "internal", {
type: _.camelCase(node.internal.type + " " + key + " MappingNode"),
mediaType: "text/x-markdown",
content: str,
contentDigest: crypto.createHash("md5").update((0, _stringify2.default)(str)).digest("hex")
}), _mappingNode);
parent: node.id,
[key]: str,
children: [],
internal: {
type: _.camelCase(`${node.internal.type} ${key} MappingNode`),
mediaType: `text/x-markdown`,
content: str,
contentDigest: crypto.createHash(`md5`).update(JSON.stringify(str)).digest(`hex`)
}
};

@@ -28,0 +19,0 @@ node.children = node.children.concat([mappingNode.id]);

{
"name": "gatsby-source-mongodb",
"version": "1.5.2",
"version": "1.5.3",
"description": "Stub description for gatsby-source-mongodb",

@@ -19,2 +19,3 @@ "main": "index.js",

"dependencies": {
"babel-runtime": "6.26.0",
"lodash": "^4.17.4",

@@ -21,0 +22,0 @@ "mongodb": "^2.2.30"

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc