Merge pull request #1673 from strongloop/upgrade-deps
Upgrade dependencies to their latest versions
This commit is contained in:
commit
8684df62a6
|
@ -25,7 +25,7 @@ function KeyValueMemoryConnector(settings, dataSource) {
|
|||
this._store = Object.create(null);
|
||||
|
||||
this._setupRegularCleanup();
|
||||
};
|
||||
}
|
||||
util.inherits(KeyValueMemoryConnector, Connector);
|
||||
|
||||
KeyValueMemoryConnector.prototype._setupRegularCleanup = function() {
|
||||
|
|
|
@ -272,7 +272,7 @@ Memory.prototype.create = function create(model, data, options, callback) {
|
|||
return process.nextTick(function() {
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
}
|
||||
self.saveToFile(id, callback);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -71,7 +71,7 @@ function DateString(value) {
|
|||
});
|
||||
|
||||
this.when = value;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of DateString in its original form.
|
||||
|
|
|
@ -38,7 +38,7 @@ exports.nearFilter = function nearFilter(where) {
|
|||
key: clauseKey,
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
var nearResults = [];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function KeyValueAccessObject() {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = KeyValueAccessObject;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ function normalizeType(type) {
|
|||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
function extendScopeMethods(definition, scopeMethods, ext) {
|
||||
var customMethods = [];
|
||||
|
@ -87,7 +87,7 @@ function extendScopeMethods(definition, scopeMethods, ext) {
|
|||
var relation = new relationClass(definition, this);
|
||||
return relationMethod.apply(relation, arguments);
|
||||
};
|
||||
};
|
||||
}
|
||||
for (var key in ext) {
|
||||
var relationMethod = ext[key];
|
||||
var method = scopeMethods[key] = createFunc(definition, relationMethod);
|
||||
|
@ -98,7 +98,7 @@ function extendScopeMethods(definition, scopeMethods, ext) {
|
|||
}
|
||||
}
|
||||
return [].concat(customMethods || []);
|
||||
};
|
||||
}
|
||||
|
||||
function bindRelationMethods(relation, relationMethod, definition) {
|
||||
var methods = definition.methods || {};
|
||||
|
@ -106,7 +106,7 @@ function bindRelationMethods(relation, relationMethod, definition) {
|
|||
if (typeof methods[m] !== 'function') return;
|
||||
relationMethod[m] = methods[m].bind(relation);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function preventFkOverride(inst, data, fkProp) {
|
||||
if (!fkProp) return undefined;
|
||||
|
@ -766,7 +766,7 @@ RelationDefinition.hasMany = function hasMany(modelFrom, modelToRef, params) {
|
|||
if (typeof method === 'function' && method.shared === true) {
|
||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Mix the property and scoped methods into the prototype class
|
||||
defineScope(modelFrom.prototype, params.through || modelTo, relationName, function() {
|
||||
|
@ -2583,7 +2583,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelToRef, param
|
|||
if (typeof method === 'function' && method.shared === true) {
|
||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Mix the property and scoped methods into the prototype class
|
||||
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
||||
|
@ -2715,7 +2715,7 @@ EmbedsMany.prototype.findById = function(fkId, options, cb) {
|
|||
process.nextTick(function() {
|
||||
cb(null, item);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return item; // sync
|
||||
};
|
||||
|
@ -2897,7 +2897,7 @@ EmbedsMany.prototype.at = function(index, cb) {
|
|||
process.nextTick(function() {
|
||||
cb(null, item);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return item; // sync
|
||||
};
|
||||
|
@ -3198,7 +3198,7 @@ RelationDefinition.referencesMany = function referencesMany(modelFrom, modelToRe
|
|||
if (typeof method === 'function' && method.shared === true) {
|
||||
modelFrom.prototype['__' + methodName + '__' + relationName] = method;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Mix the property and scoped methods into the prototype class
|
||||
var scopeDefinition = defineScope(modelFrom.prototype, modelTo, relationName, function() {
|
||||
|
|
|
@ -104,7 +104,7 @@ ScopeDefinition.prototype.related = function(receiver, scopeParams, condOrRefres
|
|||
// The filter applied on relatedModel
|
||||
var queryRelated = filter.scope;
|
||||
delete params.include.scope;
|
||||
};
|
||||
}
|
||||
|
||||
targetModel.find(params, options, function(err, data) {
|
||||
if (!err && saveOnCache) {
|
||||
|
|
14
lib/utils.js
14
lib/utils.js
|
@ -610,7 +610,7 @@ function sortObjectsByIds(idName, ids, objects, strict) {
|
|||
});
|
||||
|
||||
return heading.concat(tailing);
|
||||
};
|
||||
}
|
||||
|
||||
function createPromiseCallback() {
|
||||
var cb;
|
||||
|
@ -624,6 +624,12 @@ function createPromiseCallback() {
|
|||
return cb;
|
||||
}
|
||||
|
||||
function isBsonType(value) {
|
||||
// bson@1.x stores _bsontype on ObjectID instance, bson@4.x on prototype
|
||||
return value.hasOwnProperty('_bsontype') ||
|
||||
value.constructor.prototype.hasOwnProperty('_bsontype');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dedupe an array
|
||||
* @param {Array} an array
|
||||
|
@ -636,7 +642,7 @@ function uniq(a) {
|
|||
}
|
||||
assert(Array.isArray(a), 'array argument is required');
|
||||
var comparableA = a.map(
|
||||
item => item.hasOwnProperty('_bsontype') ? item.toString() : item
|
||||
item => isBsonType(item) ? item.toString() : item
|
||||
);
|
||||
for (var i = 0, n = comparableA.length; i < n; i++) {
|
||||
if (comparableA.indexOf(comparableA[i]) === i) {
|
||||
|
@ -719,7 +725,7 @@ function findIndexOf(arr, target, isEqual) {
|
|||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (isEqual(arr[i], target)) { return i; }
|
||||
};
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -735,7 +741,7 @@ function collectTargetIds(targetData, idPropertyName) {
|
|||
for (var i = 0; i < targetData.length; i++) {
|
||||
var targetId = targetData[i][idPropertyName];
|
||||
targetIds.push(targetId);
|
||||
};
|
||||
}
|
||||
var IdQuery = {
|
||||
inq: uniq(targetIds),
|
||||
};
|
||||
|
|
12
package.json
12
package.json
|
@ -36,20 +36,20 @@
|
|||
"devDependencies": {
|
||||
"@types/node": "^10.0.8",
|
||||
"async-iterators": "^0.2.2",
|
||||
"bson": "^1.0.4",
|
||||
"bson": "^4.0.1",
|
||||
"coveralls": "^3.0.1",
|
||||
"eslint": "^5.1.0",
|
||||
"eslint-config-loopback": "^11.0.0",
|
||||
"eslint-config-loopback": "^12.1.0",
|
||||
"loopback-connector-throwing": "file:./test/fixtures/loopback-connector-throwing",
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^12.0.2",
|
||||
"nyc": "^13.1.0",
|
||||
"should": "^8.4.0",
|
||||
"typescript": "^2.8.3"
|
||||
"typescript": "^3.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^2.6.0",
|
||||
"debug": "^3.1.0",
|
||||
"depd": "^1.0.0",
|
||||
"debug": "^4.1.0",
|
||||
"depd": "^2.0.0",
|
||||
"inflection": "^1.6.0",
|
||||
"lodash": "^4.17.4",
|
||||
"loopback-connector": "^4.4.0",
|
||||
|
|
|
@ -119,7 +119,7 @@ describe('async observer', function() {
|
|||
function call(ctx, next) {
|
||||
notifications.push('call');
|
||||
process.nextTick(next);
|
||||
};
|
||||
}
|
||||
|
||||
TestModel.observe('event', call);
|
||||
TestModel.removeObserver('event', call);
|
||||
|
@ -137,7 +137,7 @@ describe('async observer', function() {
|
|||
function call(ctx, next) {
|
||||
notifications.push('call');
|
||||
process.nextTick(next);
|
||||
};
|
||||
}
|
||||
|
||||
TestModel.observe('event', call);
|
||||
TestModel.observe('event', call);
|
||||
|
|
|
@ -521,7 +521,7 @@ describe('basic-querying', function() {
|
|||
for (var ix = 0; ix < users.length; ix++) {
|
||||
users[ix].name.should.be.oneOf(['John Lennon', 'Stuart Sutcliffe', 'Paul McCartney']);
|
||||
users[ix].vip.should.be.true();
|
||||
};
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -577,7 +577,7 @@ function testOrm(dataSource) {
|
|||
|
||||
function done() {
|
||||
if (--wait === 0) test.done();
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
it('should return type of property', function(test) {
|
||||
|
|
|
@ -426,7 +426,7 @@ describe('default scope', function() {
|
|||
exists.should.be.false;
|
||||
done();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
before(function(done) {
|
||||
db.automigrate(setupProducts.bind(null, ids, done));
|
||||
|
|
|
@ -15,7 +15,7 @@ function ContextRecorder(initialValue) {
|
|||
return new ContextRecorder(initialValue);
|
||||
}
|
||||
this.records = initialValue;
|
||||
};
|
||||
}
|
||||
|
||||
ContextRecorder.prototype.recordAndNext = function(transformFm) {
|
||||
var self = this;
|
||||
|
|
|
@ -13,7 +13,7 @@ function HookMonitor(opts) {
|
|||
|
||||
this.options = opts || {};
|
||||
this.names = [];
|
||||
};
|
||||
}
|
||||
|
||||
HookMonitor.prototype.install = function(ObservedModel, hookNames) {
|
||||
var monitor = this;
|
||||
|
|
|
@ -11,7 +11,7 @@ function givenCacheItem(dataSourceFactory) {
|
|||
value: 'Any',
|
||||
};
|
||||
return givenModel(dataSourceFactory, 'CacheItem', modelProperties);
|
||||
};
|
||||
}
|
||||
|
||||
function givenModel(dataSourceFactory, modelName,
|
||||
modelProperties, options) {
|
||||
|
@ -20,7 +20,7 @@ function givenModel(dataSourceFactory, modelName,
|
|||
const p = 'deleteAll' in dataSource.connector ?
|
||||
Model.deleteAll() : Promise.resolve();
|
||||
return p.then(() => Model);
|
||||
};
|
||||
}
|
||||
|
||||
function givenKeys(Model, keys, cb) {
|
||||
var p = Promise.all(
|
||||
|
@ -32,7 +32,7 @@ function givenKeys(Model, keys, cb) {
|
|||
p = p.then(function(r) { cb(null, r); }, cb);
|
||||
}
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
||||
function delay(ms) {
|
||||
return new Promise((resolve) => {
|
||||
|
|
|
@ -65,6 +65,6 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
|||
function setupCacheItem() {
|
||||
return helpers.givenCacheItem(dataSourceFactory)
|
||||
.then(ModelCtor => CacheItem = ModelCtor);
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -102,6 +102,6 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
|||
function setupCacheItem() {
|
||||
return helpers.givenCacheItem(dataSourceFactory)
|
||||
.then(ModelCtor => CacheItem = ModelCtor);
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ module.exports = function(dataSourceFactory, connectorCapabilities) {
|
|||
function setupCacheItem() {
|
||||
return helpers.givenCacheItem(dataSourceFactory)
|
||||
.then(ModelCtor => CacheItem = ModelCtor);
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ describe('relations', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
describe('find over related model with options', function() {
|
||||
|
|
Loading…
Reference in New Issue