Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update async dependency and migrate code accordingly. #1407

Merged
merged 1 commit into from Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/waterline.js
Expand Up @@ -155,10 +155,10 @@ Waterline.prototype.initialize = function(options, cb) {
next(null, self.collections);
});
});
},
},//</loadCollections>

// Build up Collection Schemas
buildCollectionSchemas: ['loadCollections', function(next) {
buildCollectionSchemas: ['loadCollections', function(unused, next) {
var collections = self.collections;
var schemas = {};

Expand Down Expand Up @@ -188,10 +188,10 @@ Waterline.prototype.initialize = function(options, cb) {
});

next(null, schemas);
}],
}],//</buildCollectionSchemas>

// 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 = {};
Expand Down Expand Up @@ -232,8 +232,8 @@ Waterline.prototype.initialize = function(options, cb) {

nextItem();
});
}, next);
}]
}, next);//</async.each>
}]//<registerConnections>

}, function asyncCb(err) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion lib/waterline/model/lib/associationMethods/add.js
Expand Up @@ -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);
}]

Expand Down
8 changes: 4 additions & 4 deletions lib/waterline/model/lib/defaultMethods/save.js
Expand Up @@ -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());
Expand All @@ -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 = {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion lib/waterline/query/composite.js
Expand Up @@ -2,7 +2,6 @@
* Composite Queries
*/

var async = require('async');
var _ = require('@sailshq/lodash');
var usageError = require('../utils/usageError');
var utils = require('../utils/helpers');
Expand Down
4 changes: 2 additions & 2 deletions lib/waterline/utils/nestedOperations/update.js
Expand Up @@ -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);
}]

Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions test/unit/query/query.exec.js
Expand Up @@ -65,6 +65,7 @@ describe('Collection Query', function() {
var self = this;

async.auto({

objUsage: function (cb) {
query.find()
.exec({
Expand All @@ -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;
Expand Down