Socket
Socket
Sign inDemoInstall

cosa

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cosa - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

26

lib/model.js

@@ -11,3 +11,3 @@ const assign = require('object-assign');

const errors = require('./errors');
const { pathEq, complement, pathOr, pick } = require('omnibelt');
const { pathEq, complement, pathOr, pick, omit } = require('omnibelt');

@@ -24,2 +24,3 @@ const { buildPropertySchema } = require('./utils');

const isNotVirtual = complement(pathEq([ 'type' ], 'virtual'));
const removeMeta = omit(['__modified', '__original']);
const onlyJoiOptions = pick(['abortEarly', 'convert', 'allowUnknown', 'skipFunctions', 'stripUnknown']);

@@ -131,7 +132,6 @@ const defaultJoiOptions = {

}
const value = await context._validate(obj, options);
obj = EJSON.serialize(value);
obj = await context._validate(obj, options);
const original = obj.__original;
delete obj.__modified;
delete obj.__original;
obj = removeMeta(obj);
obj = EJSON.serialize(obj);
const newEtag = etag(JSON.stringify(obj));

@@ -246,5 +246,5 @@ const collection = definition.collection;

let json = clone(this.toObject());
delete json.__modified;
delete json.__original;
let json = removeMeta(this.toObject());
json = clone(json); // not 100% sure we need to clone
if (options.virtuals) {

@@ -258,11 +258,5 @@ addVirtuals(definition, json);

if (options.exclude) {
options.exclude.forEach((prop) => {
delete json[prop];
});
json = omit(options.exclude, json);
} else if (options.include) {
const newJson = {};
options.include.forEach((prop) => {
newJson[prop] = json[prop];
});
json = newJson;
json = pick(options.include, json);
}

@@ -269,0 +263,0 @@ if (options.transform) {

{
"name": "cosa",
"version": "3.0.7",
"version": "3.0.8",
"description": "Cosa Models for MongoDB",

@@ -44,3 +44,3 @@ "main": "lib/index.js",

"@hapi/joi": "^15.0.0",
"mongodb": "~3.2.3",
"mongodb": "~3.2.4",
"mongodb-extended-json": "~1.10.1",

@@ -47,0 +47,0 @@ "object-assign": "^4.1.1",

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