Skip to content

Commit

Permalink
Update wl-criteria dep, pin versions of all deps from outside the pro…
Browse files Browse the repository at this point in the history
…ject (and a few other trivial formatting/code-convention tweaks).
  • Loading branch information
mikermcneil committed Feb 5, 2016
1 parent 71c3365 commit 9e938ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
3 changes: 3 additions & 0 deletions lib/aggregates.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

var Errors = require('waterline-errors').adapter;




/**
* Process Aggregates
*
Expand Down
27 changes: 14 additions & 13 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
* Module dependencies
*/

var _ = require('lodash'),
fs = require('fs-extra'),
util = require('util'),
async = require('async'),
waterlineCriteria = require('waterline-criteria'),
Aggregate = require('./aggregates'),
Errors = require('waterline-errors').adapter;
var _ = require('lodash');
var fsx = require('fs-extra');
var util = require('util');
var async = require('async');
var waterlineCriteria = require('waterline-criteria');
var Aggregate = require('./aggregates');
var Errors = require('waterline-errors').adapter;


/**
* A File-Backed Datastore
Expand Down Expand Up @@ -158,8 +159,8 @@ Database.prototype.write = function(collectionName, cb) {
var schema = this.schema;
var counters = this.counters;

fs.createFileSync(this.filePath);
fs.outputJsonSync(self.filePath, { data: data, schema: schema, counters: counters });
fsx.createFileSync(this.filePath);
fsx.outputJsonSync(self.filePath, { data: data, schema: schema, counters: counters });

cb();
};
Expand All @@ -176,10 +177,10 @@ Database.prototype.read = function(cb) {

if(!this.filePath) return cb(new Error('No filePath was configured for this collection'));

var exists = fs.existsSync(this.filePath);
var exists = fsx.existsSync(this.filePath);

if(!exists) {
fs.createFileSync(this.filePath);
fsx.createFileSync(this.filePath);
return cb(null, { data: {}, schema: {}, counters: {} });
}

Expand All @@ -190,7 +191,7 @@ Database.prototype.read = function(cb) {
counters: self.counters
});

var data = fs.readFileSync(this.filePath, { encoding: 'utf8' });
var data = fsx.readFileSync(this.filePath, { encoding: 'utf8' });

if(!data) return cb(null, { data: {}, schema: {}, counters: {} });

Expand Down Expand Up @@ -645,7 +646,7 @@ Database.prototype.enforceUniqueness = function(collectionName, values, pkValueO
}
}

// Does it look like a "uniqueness violation"?
// Does it look like a 'uniqueness violation'?
if (values[attrName] === this.data[collectionName][index][attrName]) {

// It isn't actually a uniquness violation if the record
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {
"lodash": "~2.4.1",
"waterline-criteria": "~0.11.0",
"lodash": "2.4.1",
"waterline-criteria": "~1.0.0",
"waterline-errors": "~0.10.0",
"fs-extra": "~0.8.1",
"fs-extra": "0.8.1",
"async": "~0.2.9",
"waterline-cursor": "~0.0.5"
},
Expand Down

1 comment on commit 9e938ce

@mikermcneil
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bumps the wl-criteria to 1.0.0 to pick up the improvement from balderdashy/waterline-criteria#26.

See balderdashy/sails#3543 (comment) for more background info.

While this will certainly change behavior, the changes are just to make date filtering work as expected, so this should be a patch release. However, waiting to do a release with this until we've used it a bit and are sure there aren't any unexpected changes.

Please sign in to comment.