Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xpress-mongo

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xpress-mongo - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

5

package.json
{
"name": "xpress-mongo",
"version": "2.2.1",
"version": "2.3.0",
"description": "Light Weight ODM for mongoDb NodeJs",

@@ -35,4 +35,5 @@ "main": "index.js",

"joi": "^17.5.0",
"lodash": "^4.17.21",
"mongodb": "4.2.2",
"object-collection": "^2.0.0",
"object-collection": "^2.1.5",
"uuid": "^8.3.2"

@@ -39,0 +40,0 @@ },

@@ -1,6 +0,5 @@

/// <reference types="lodash" />
declare const _default: import("lodash").LoDashStatic;
import _ = require("object-collection/lodash");
/**
* Get Lodash
*/
export = _default;
export = _;

4

src/Lodash.js
"use strict";
const ObjectCollection = require("object-collection");
module.exports = ObjectCollection.getLodash();
const _ = require("object-collection/lodash");
module.exports = _;
import ObjectCollection = require("object-collection");
import { AggregateOptions, AggregationCursor, Collection, DeleteResult, Filter, FindCursor, FindOptions, InsertOneOptions, InsertOneResult, ObjectId, UpdateFilter, UpdateOptions, UpdateResult } from "mongodb";
import { PaginationData, StringToAnyObject, XMongoSchema, XMongoSchemaFn, XMongoStrictConfig } from "./CustomTypes";
/**
* Get Lodash
*/
declare type FunctionWithRawArgument = (raw: Collection) => FindCursor | AggregationCursor;

@@ -5,0 +8,0 @@ /**

@@ -11,7 +11,4 @@ "use strict";

const joi_1 = __importDefault(require("joi"));
const lodash_1 = __importDefault(require("object-collection/lodash"));
/**
* Get Lodash
*/
const _ = ObjectCollection.getLodash();
/**
* @class

@@ -140,3 +137,3 @@ */

get(key, $default) {
return _.get(this.data, key, $default);
return lodash_1.default.get(this.data, key, $default);
}

@@ -152,7 +149,7 @@ /**

for (const property in key) {
_.set(this.data, property, key[property]);
lodash_1.default.set(this.data, property, key[property]);
}
}
else if (typeof key === "string") {
_.set(this.data, key, value);
lodash_1.default.set(this.data, key, value);
}

@@ -169,3 +166,3 @@ return this;

has(key, value = undefined) {
const has = _.has(this.data, key);
const has = lodash_1.default.has(this.data, key);
if (has && value !== undefined) {

@@ -221,3 +218,3 @@ const realValue = this.get(key);

// Find in data
return _.find(data, value);
return lodash_1.default.find(data, value);
}

@@ -273,3 +270,3 @@ /**

$setOriginal(data) {
data = _.cloneDeep(data);
data = lodash_1.default.cloneDeep(data);
Object.defineProperty(this, "original", {

@@ -511,3 +508,3 @@ value: data,

// Set original to this.
_.merge(this.original, $set);
lodash_1.default.merge(this.original, $set);
}

@@ -835,5 +832,5 @@ catch (e) {

*/
let options = _.cloneDeep(config.options || {});
let options = lodash_1.default.cloneDeep(config.options || {});
if (extend.hasOwnProperty("options"))
options = _.cloneDeep(extend.options);
options = lodash_1.default.cloneDeep(extend.options);
/**

@@ -843,3 +840,3 @@ * Get Relationship where query.

*/
let where = _.clone(config.where);
let where = lodash_1.default.clone(config.where);
if (typeof where === "object" && Object.keys(where).length) {

@@ -866,3 +863,5 @@ /**

model = model[0]();
let relatedData = await model.native().findOne(where, options);
let relatedData = await model
.native()
.findOne(where, options);
if (cast && relatedData)

@@ -1056,3 +1055,3 @@ relatedData = model.use(relatedData);

static async countAggregate(query = [], options) {
query = _.cloneDeep(query);
query = lodash_1.default.cloneDeep(query);
query.push({ $count: "count_aggregate" });

@@ -1104,3 +1103,3 @@ const data = await this.native().aggregate(query, options).toArray();

static async paginateAggregate(page = 1, perPage = 20, query = [], options = {}) {
query = _.cloneDeep(query);
query = lodash_1.default.cloneDeep(query);
page = Number(page);

@@ -1247,6 +1246,6 @@ perPage = Number(perPage);

if (handlerIsObject) {
_.merge(this.events, _.extend({}, { [event]: functionOrFunctions }));
lodash_1.default.merge(this.events, lodash_1.default.extend({}, { [event]: functionOrFunctions }));
}
else {
_.merge(this.events, _.set({}, event, functionOrFunctions));
lodash_1.default.merge(this.events, lodash_1.default.set({}, event, functionOrFunctions));
}

@@ -1406,3 +1405,3 @@ }

else if (Array.isArray(query)) {
this.meta.findQuery = _.pick(this.data, query);
this.meta.findQuery = lodash_1.default.pick(this.data, query);
}

@@ -1409,0 +1408,0 @@ // if object, populate object with fields and value.

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