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 0.10.0 to 0.10.1

2

package.json
{
"name": "xpress-mongo",
"version": "0.10.0",
"version": "0.10.1",
"description": "Light Weight ODM for mongoDb",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -465,3 +465,5 @@ "use strict";

else {
// Resolve
resolve(res.connection);
// Run Watch Event
inbuilt_1.RunOnEvent("watch", this, changes);

@@ -488,4 +490,6 @@ }

this.$setOriginal(this.data);
// resolve
resolve(res);
// Run on created event
inbuilt_1.RunOnEvent("created", this);
return resolve(res);
});

@@ -1110,8 +1114,10 @@ }

throw Error(`${modelName}.on("${event}") is deprecated. Use "deleted" instead.`);
const handlerIsFunction = typeof functionOrFunctions === "function";
// Validate events that must be a function
if (["deleted", "created"].includes(event) && typeof functionOrFunctions !== "function") {
if (["deleted", "created"].includes(event) && !handlerIsFunction) {
throw Error(`${modelName}.on("${event}") event must be type of Function.`);
}
const handlerIsObject = typeof functionOrFunctions === "object";
// watch when not using dot notation must be an object
if (event === "watch" && typeof functionOrFunctions !== "object") {
if (event === "watch" && !handlerIsObject) {
throw Error(`${modelName}.on("watch") event must be type of Object.`);

@@ -1123,2 +1129,5 @@ }

if (event.includes(".")) {
if (!handlerIsFunction) {
throw Error(`Event handler for DOT notated events must be a function. {event:"${event}"}`);
}
// Split .

@@ -1128,3 +1137,3 @@ const dots = event.split(".");

if (dots.length > 2) {
throw Error(`Model events supports only first level Field names when using dot notation. {event:"${event}"}`);
throw Error(`Model events supports only first level Field names when using DOT notation. {event:"${event}"}`);
}

@@ -1135,3 +1144,3 @@ else if (dots.length === 2) {

if (!["create", "update", "watch"].includes(main)) {
throw Error(`${modelName}.on("${main}") does not support dot notation. {event:"${event}"}`);
throw Error(`${modelName}.on("${main}") does not support DOT notation. {event:"${event}"}`);
}

@@ -1144,3 +1153,8 @@ }

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

@@ -1147,0 +1161,0 @@ /**

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