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

sails-disk

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-disk - npm Package Compare versions

Comparing version 0.10.0-rc3 to 0.10.0-rc4

.travis.yml

2

lib/adapter.js

@@ -92,2 +92,4 @@ /*---------------------------------------------------------------

adapter.createEach = adapter.create;
/**

@@ -94,0 +96,0 @@ * Grab the connection object for a connection name

33

lib/database.js

@@ -330,15 +330,25 @@ /**

// Check Uniqueness Constraints
var errors = this.uniqueConstraint(collectionName, values);
if(errors && errors.length > 0) return cb(errors);
var self = this;
// Auto-Increment any values
values = this.autoIncrement(collectionName, values);
values = this.serializeValues(collectionName, values);
function addRecord(record) {
if (!this.data[collectionName]) return cb(Errors.CollectionNotRegistered);
this.data[collectionName].push(values);
// Check Uniqueness Constraints
var errors = self.uniqueConstraint(collectionName, record);
if(errors && errors.length > 0) return cb(errors);
// Auto-Increment any values
record = self.autoIncrement(collectionName, record);
record = self.serializeValues(collectionName, record);
if (!self.data[collectionName]) return cb(Errors.CollectionNotRegistered);
self.data[collectionName].push(record);
}
var originalValues = _.clone(values);
if(!Array.isArray(values)) values = [values];
values.forEach(addRecord);
this.write(collectionName, function() {
cb(null, values);
cb(null, Array.isArray(originalValues) ? values : values[0]);
});

@@ -387,5 +397,8 @@ };

var result = self.data[collectionName][resultSet.indices[0]];
var records = _.reject(self.data[collectionName], result);
var errors = [];
_.each(uniqueAttrs, function(uniqueAttr) {
if (result[uniqueAttr] != values[uniqueAttr]) {
// look for matching values in all records. note: this is case sensitive.
if (!!~_.pluck(records, uniqueAttr).indexOf(values[uniqueAttr])) {
errors.push(new Error('Uniqueness check failed on attribute: ' + uniqueAttr + ' with value: ' + values[uniqueAttr]));

@@ -392,0 +405,0 @@ }

{
"name": "sails-disk",
"version": "0.10.0-rc3",
"version": "0.10.0-rc4",
"description": "Persistent local-disk adapter for Sails.js / Waterline",

@@ -32,3 +32,3 @@ "main": "lib/adapter.js",

"lodash": "~2.4.1",
"waterline-criteria": "~0.10.2",
"waterline-criteria": "~0.10.3",
"waterline-errors": "~0.10.0",

@@ -47,3 +47,2 @@ "fs-extra": "~0.8.1",

"semantic",
"migratable",
"queryable",

@@ -50,0 +49,0 @@ "associations"

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