Socket
Socket
Sign inDemoInstall

viewmodel

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewmodel - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

4

lib/databases/couchdb.js

@@ -327,2 +327,6 @@ 'use strict';

case 'delete':
if (!vm.has('_rev')) {
return callback(null);
}
var obj = vm.toJSON();

@@ -329,0 +333,0 @@ this.db.remove(obj._id, obj._rev, function(err) {

@@ -367,2 +367,5 @@ 'use strict';

case 'delete':
if (!vm.has('_version')) {
return callback(null);
}
self.client.delete({

@@ -369,0 +372,0 @@ index: self.index,

12

lib/databases/mongodb.js

@@ -187,10 +187,6 @@ 'use strict';

case 'delete':
var currentHash = vm.get('_hash');
obj = vm.toJSON();
obj._id = obj.id;
var query = { _id: obj._id };
if (currentHash) {
query._hash = currentHash;
if (!vm.has('_hash')) {
return callback(null);
}
this.collection.remove(query, { safe: true }, function(err, modifiedCount) {
this.collection.remove({ _id: vm.id, _hash: vm.get('_hash') }, { safe: true }, function(err, modifiedCount) {
if (isNew) {

@@ -205,3 +201,3 @@ if (modifiedCount && modifiedCount.result && modifiedCount.result.n === 0) {

}
callback(err, vm);
callback(err);
});

@@ -208,0 +204,0 @@ break;

@@ -326,2 +326,6 @@ 'use strict';

case 'delete':
if (!vm.has('_hash')) {
return callback(null);
}
this.client.watch(prefixedId, function (err) {

@@ -353,5 +357,3 @@ if (err) {

}
vm.actionOnCommit = 'update';
callback(err, vm);
callback(err);
});

@@ -358,0 +360,0 @@ });

@@ -143,14 +143,10 @@ 'use strict';

case 'delete':
var currentHash = vm.get('_hash');
obj = vm.toJSON();
obj._id = obj.id;
var query = { _id: obj._id };
if (currentHash) {
query._hash = currentHash;
if (!vm.has('_hash')) {
return callback(null);
}
this.collection.remove(query, { safe: true }, function(err, modifiedCount) {
this.collection.remove({ _id: vm.id, _hash: vm.get('_hash') }, { safe: true }, function(err, modifiedCount) {
if (modifiedCount === 0) {
return callback(new ConcurrencyError());
}
callback(err, vm);
callback(err);
});

@@ -157,0 +153,0 @@ break;

{
"author": "adrai",
"name": "viewmodel",
"version": "1.5.0",
"version": "1.5.1",
"private": false,

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

@@ -1,2 +0,2 @@

## [v1.5.0](https://github.com/adrai/node-viewmodel/compare/v1.4.2...v1.5.0)
## [v1.5.1](https://github.com/adrai/node-viewmodel/compare/v1.4.2...v1.5.1)
- catch concurrency error on destroy commit

@@ -3,0 +3,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