diff --git a/lib/waterline.js b/lib/waterline.js index 0222db523..350bdb1c7 100644 --- a/lib/waterline.js +++ b/lib/waterline.js @@ -155,10 +155,10 @@ Waterline.prototype.initialize = function(options, cb) { next(null, self.collections); }); }); - }, + },// // Build up Collection Schemas - buildCollectionSchemas: ['loadCollections', function(next) { + buildCollectionSchemas: ['loadCollections', function(unused, next) { var collections = self.collections; var schemas = {}; @@ -188,10 +188,10 @@ Waterline.prototype.initialize = function(options, cb) { }); next(null, schemas); - }], + }],// // Register the Connections with an adapter - registerConnections: ['buildCollectionSchemas', function(next, results) { + registerConnections: ['buildCollectionSchemas', function(results, next) { async.each(_.keys(self.connections), function(item, nextItem) { var connection = self.connections[item]; var config = {}; @@ -232,8 +232,8 @@ Waterline.prototype.initialize = function(options, cb) { nextItem(); }); - }, next); - }] + }, next);// + }]// }, function asyncCb(err) { if (err) { diff --git a/lib/waterline/model/lib/associationMethods/add.js b/lib/waterline/model/lib/associationMethods/add.js index 7c081e9d7..a10df4974 100644 --- a/lib/waterline/model/lib/associationMethods/add.js +++ b/lib/waterline/model/lib/associationMethods/add.js @@ -347,7 +347,7 @@ Add.prototype.createManyToMany = function(collection, attribute, pk, key, cb) { }); }, - createRecord: ['validateAssociation', 'validateRecord', function(next) { + createRecord: ['validateAssociation', 'validateRecord', function(unused, next) { collection.create(_values, next); }] diff --git a/lib/waterline/model/lib/defaultMethods/save.js b/lib/waterline/model/lib/defaultMethods/save.js index 5f597ee43..3b13dd3c2 100644 --- a/lib/waterline/model/lib/defaultMethods/save.js +++ b/lib/waterline/model/lib/defaultMethods/save.js @@ -79,7 +79,7 @@ module.exports = function(context, proto, options, cb) { }, // Update The Current Record - updateRecord: ['compareModelValues', function(next) { + updateRecord: ['compareModelValues', function(unused, next) { // Shallow clone proto.toObject() to remove all the functions var data = _.clone(proto.toObject()); @@ -93,7 +93,7 @@ module.exports = function(context, proto, options, cb) { // Build a set of associations to add and remove. // These are populated from using model[associationKey].add() and // model[associationKey].remove(). - buildAssociationOperations: ['compareModelValues', function(next) { + buildAssociationOperations: ['compareModelValues', function(unused, next) { // Build a dictionary to hold operations based on association key var operations = { @@ -124,7 +124,7 @@ module.exports = function(context, proto, options, cb) { }], // Create new associations for each association key - addAssociations: ['buildAssociationOperations', 'updateRecord', function(next, results) { + addAssociations: ['buildAssociationOperations', 'updateRecord', function(results, next) { var keys = results.buildAssociationOperations.addKeys; return new addAssociation(context, proto, keys, function(err, failedTransactions) { if (err) return next(err); @@ -142,7 +142,7 @@ module.exports = function(context, proto, options, cb) { // Run after the addAssociations so that the connection pools don't get exhausted. // Once transactions are ready we can remove this restriction as they will be run on the same // connection. - removeAssociations: ['buildAssociationOperations', 'addAssociations', function(next, results) { + removeAssociations: ['buildAssociationOperations', 'addAssociations', function(results, next) { var keys = results.buildAssociationOperations.removeKeys; return new removeAssociation(context, proto, keys, function(err, failedTransactions) { if (err) return next(err); diff --git a/lib/waterline/query/composite.js b/lib/waterline/query/composite.js index 14a9d34d5..57d8cc13b 100644 --- a/lib/waterline/query/composite.js +++ b/lib/waterline/query/composite.js @@ -2,7 +2,6 @@ * Composite Queries */ -var async = require('async'); var _ = require('@sailshq/lodash'); var usageError = require('../utils/usageError'); var utils = require('../utils/helpers'); diff --git a/lib/waterline/utils/nestedOperations/update.js b/lib/waterline/utils/nestedOperations/update.js index 9a46451fe..a58acb192 100644 --- a/lib/waterline/utils/nestedOperations/update.js +++ b/lib/waterline/utils/nestedOperations/update.js @@ -181,13 +181,13 @@ function sync(parents, operations, cb) { }, // For each parent, unlink all the associations currently set - unlink: ['update', function(next) { + unlink: ['update', function(unused, next) { unlinkRunner.call(self, parents, operations, next); }], // For each parent found, link any associations passed in by either creating // the new record or linking an existing record - link: ['unlink', function(next) { + link: ['unlink', function(unused, next) { linkRunner.call(self, parents, operations, next); }] diff --git a/package.json b/package.json index 43738c67e..f48397eac 100644 --- a/package.json +++ b/package.json @@ -22,12 +22,12 @@ } ], "dependencies": { + "@sailshq/lodash": "^3.10.2", "anchor": "~0.11.2", - "async": "1.5.2", + "async": "2.0.1", "bluebird": "3.2.1", "deep-diff": "0.3.4", "flaverr": "^1.0.0", - "@sailshq/lodash": "^3.10.2", "prompt": "1.0.0", "switchback": "2.0.1", "waterline-criteria": "1.0.1", diff --git a/test/unit/query/query.exec.js b/test/unit/query/query.exec.js index 91c9846c9..8373fc755 100644 --- a/test/unit/query/query.exec.js +++ b/test/unit/query/query.exec.js @@ -65,6 +65,7 @@ describe('Collection Query', function() { var self = this; async.auto({ + objUsage: function (cb) { query.find() .exec({ @@ -74,9 +75,11 @@ describe('Collection Query', function() { error: cb }); }, + cbUsage: function (cb) { query.find().exec(cb); } + }, function asyncComplete (err, async_data) { // Save results for use below self._error = err;