Skip to content

Commit 5ee731e

Browse files
committed
chore: update deps + fix linting + .npmrc
1 parent 6d23c2e commit 5ee731e

33 files changed

+350
-203
lines changed

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

common/models/acl.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -600,19 +600,22 @@ module.exports = function(ACL) {
600600
break;
601601
case ACL.USER:
602602
this.userModel.findOne(
603-
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb);
603+
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb
604+
);
604605
break;
605606
case ACL.APP:
606607
this.applicationModel.findOne(
607-
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb);
608+
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb
609+
);
608610
break;
609611
default:
610612
// try resolving a user model with a name matching the principalType
611613
var userModel = this.registry.findModel(type);
612614
if (userModel) {
613615
userModel.findOne(
614616
{where: {or: [{username: id}, {email: id}, {id: id}]}},
615-
cb);
617+
cb
618+
);
616619
} else {
617620
process.nextTick(function() {
618621
var err = new Error(g.f('Invalid principal type: %s', type));

common/models/change.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ module.exports = function(Change) {
502502
async.each(
503503
changes,
504504
function(c, next) { c.rectify(next); },
505-
cb);
505+
cb
506+
);
506507
});
507508
};
508509

@@ -691,8 +692,10 @@ module.exports = function(Change) {
691692
conflict.SourceModel.updateLastChange(
692693
conflict.modelId,
693694
{prev: targetChange.rev},
694-
cb);
695-
});
695+
cb
696+
);
697+
}
698+
);
696699
};
697700

698701
/**
@@ -724,7 +727,8 @@ module.exports = function(Change) {
724727
}
725728
var inst = new conflict.SourceModel(
726729
target.toObject(),
727-
{persisted: true});
730+
{persisted: true}
731+
);
728732
inst.save(done);
729733
});
730734

common/models/key-value-model.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ function throwNotAttached(modelName, methodName) {
226226
'The %s method has not been setup. ' +
227227
'The {{KeyValueModel}} has not been correctly attached ' +
228228
'to a {{DataSource}}!',
229-
modelName, methodName, methodName));
229+
modelName, methodName, methodName
230+
));
230231
}
231232

232233
function convertNullToNotFoundError(ctx, cb) {

common/models/scope.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ module.exports = function(Scope) {
4747
if (callback) callback(err);
4848
} else {
4949
aclModel.checkPermission(
50-
aclModel.SCOPE, scope.id, model, property, accessType, callback);
50+
aclModel.SCOPE, scope.id, model, property, accessType, callback
51+
);
5152
}
5253
});
5354
};

common/models/user.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,9 @@ module.exports = function(User) {
744744
if (!confirmMethod) {
745745
throw new Error(
746746
'Cannot build user verification URL, ' +
747-
'the default confirm method is not public. ' +
748-
'Please provide the URL in verifyOptions.verifyHref.');
747+
'the default confirm method is not public. ' +
748+
'Please provide the URL in verifyOptions.verifyHref.'
749+
);
749750
}
750751

751752
const urlPath = joinUrlPath(
@@ -1315,7 +1316,8 @@ module.exports = function(User) {
13151316
// This is a programmer's error, use the default status code 500
13161317
return next(new Error(
13171318
'Invalid use of "options.setPassword". Only "password" can be ' +
1318-
'changed when using this option.'));
1319+
'changed when using this option.'
1320+
));
13191321
}
13201322

13211323
return next();
@@ -1327,7 +1329,8 @@ module.exports = function(User) {
13271329

13281330
const err = new Error(
13291331
'Changing user password via patch/replace API is not allowed. ' +
1330-
'Use changePassword() or setPassword() instead.');
1332+
'Use changePassword() or setPassword() instead.'
1333+
);
13311334
err.statusCode = 401;
13321335
err.code = 'PASSWORD_CHANGE_NOT_ALLOWED';
13331336
next(err);

lib/application.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ app.enableAuth = function(options) {
357357
var Model = app.registry.findModel(m);
358358
if (!Model) {
359359
throw new Error(
360-
g.f('Authentication requires model %s to be defined.', m));
360+
g.f('Authentication requires model %s to be defined.', m)
361+
);
361362
}
362363

363364
if (Model.dataSource || Model.app) return;
@@ -483,15 +484,17 @@ app._verifyAuthModelRelations = function() {
483484
'custom User subclass, but does not fix AccessToken relations ' +
484485
'to use this new model.\n' +
485486
'Learn more at http://ibm.biz/setup-loopback-auth',
486-
Model.modelName, userName, userName);
487+
Model.modelName, userName, userName
488+
);
487489
return;
488490
}
489491

490492
console.warn(
491493
'The model %j does not have "belongsTo User-like model" relation ' +
492494
'configured.\n' +
493495
'Learn more at http://ibm.biz/setup-loopback-auth',
494-
Model.modelName);
496+
Model.modelName
497+
);
495498
}
496499

497500
function verifyUserRelations(Model) {
@@ -504,7 +507,8 @@ app._verifyAuthModelRelations = function() {
504507
'The app configuration follows the multiple user models setup ' +
505508
'as described in http://ibm.biz/setup-loopback-auth',
506509
'The built-in role resolver $owner is not currently compatible ' +
507-
'with this configuration and should not be used in production.');
510+
'with this configuration and should not be used in production.'
511+
);
508512
}
509513
return;
510514
}
@@ -520,21 +524,24 @@ app._verifyAuthModelRelations = function() {
520524
'AccessToken subclass, but does not fix User relations to use this ' +
521525
'new model.\n' +
522526
'Learn more at http://ibm.biz/setup-loopback-auth',
523-
Model.modelName, accessTokenName, accessTokenName);
527+
Model.modelName, accessTokenName, accessTokenName
528+
);
524529
return;
525530
}
526531

527532
console.warn(
528533
'The model %j does not have "hasMany AccessToken-like models" relation ' +
529534
'configured.\n' +
530535
'Learn more at http://ibm.biz/setup-loopback-auth',
531-
Model.modelName);
536+
Model.modelName
537+
);
532538
}
533539
};
534540

535541
app.boot = function(options) {
536542
throw new Error(
537-
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead'));
543+
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead')
544+
);
538545
};
539546

540547
function dataSourcesFromConfig(name, config, connectorRegistry, registry) {

lib/builtin-models.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,58 @@ module.exports = function(registry) {
1212

1313
registry.KeyValueModel = createModel(
1414
require('../common/models/key-value-model.json'),
15-
require('../common/models/key-value-model.js'));
15+
require('../common/models/key-value-model.js')
16+
);
1617

1718
registry.Email = createModel(
1819
require('../common/models/email.json'),
19-
require('../common/models/email.js'));
20+
require('../common/models/email.js')
21+
);
2022

2123
registry.Application = createModel(
2224
require('../common/models/application.json'),
23-
require('../common/models/application.js'));
25+
require('../common/models/application.js')
26+
);
2427

2528
registry.AccessToken = createModel(
2629
require('../common/models/access-token.json'),
27-
require('../common/models/access-token.js'));
30+
require('../common/models/access-token.js')
31+
);
2832

2933
registry.User = createModel(
3034
require('../common/models/user.json'),
31-
require('../common/models/user.js'));
35+
require('../common/models/user.js')
36+
);
3237

3338
registry.RoleMapping = createModel(
3439
require('../common/models/role-mapping.json'),
35-
require('../common/models/role-mapping.js'));
40+
require('../common/models/role-mapping.js')
41+
);
3642

3743
registry.Role = createModel(
3844
require('../common/models/role.json'),
39-
require('../common/models/role.js'));
45+
require('../common/models/role.js')
46+
);
4047

4148
registry.ACL = createModel(
4249
require('../common/models/acl.json'),
43-
require('../common/models/acl.js'));
50+
require('../common/models/acl.js')
51+
);
4452

4553
registry.Scope = createModel(
4654
require('../common/models/scope.json'),
47-
require('../common/models/scope.js'));
55+
require('../common/models/scope.js')
56+
);
4857

4958
registry.Change = createModel(
5059
require('../common/models/change.json'),
51-
require('../common/models/change.js'));
60+
require('../common/models/change.js')
61+
);
5262

5363
registry.Checkpoint = createModel(
5464
require('../common/models/checkpoint.json'),
55-
require('../common/models/checkpoint.js'));
65+
require('../common/models/checkpoint.js')
66+
);
5667

5768
function createModel(definitionJson, customizeFn) {
5869
// Clone the JSON definition to allow applications

lib/current-context.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ module.exports = function(loopback) {
1515
throw new Error(g.f(
1616
'%s was removed in version 3.0. See %s for more details.',
1717
'loopback.getCurrentContext()',
18-
'http://loopback.io/doc/en/lb2/Using-current-context.html'));
18+
'http://loopback.io/doc/en/lb2/Using-current-context.html'
19+
));
1920
};
2021

2122
loopback.runInContext = function(fn) {
2223
throw new Error(g.f(
2324
'%s was removed in version 3.0. See %s for more details.',
2425
'loopback.runInContext()',
25-
'http://loopback.io/doc/en/lb2/Using-current-context.html'));
26+
'http://loopback.io/doc/en/lb2/Using-current-context.html'
27+
));
2628
};
2729

2830
loopback.createContext = function(scopeName) {
2931
throw new Error(g.f(
3032
'%s was removed in version 3.0. See %s for more details.',
3133
'loopback.createContext()',
32-
'http://loopback.io/doc/en/lb2/Using-current-context.html'));
34+
'http://loopback.io/doc/en/lb2/Using-current-context.html'
35+
));
3336
};
3437
};

lib/model.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,13 @@ module.exports = function(registry) {
251251
if ('injectOptionsFromRemoteContext' in options) {
252252
console.warn(g.f(
253253
'%s is using model setting %s which is no longer available.',
254-
typeName, 'injectOptionsFromRemoteContext'));
254+
typeName, 'injectOptionsFromRemoteContext'
255+
));
255256
console.warn(g.f(
256257
'Please rework your app to use the offical solution for injecting ' +
257258
'"options" argument from request context,\nsee %s',
258-
'http://loopback.io/doc/en/lb3/Using-current-context.html'));
259+
'http://loopback.io/doc/en/lb3/Using-current-context.html'
260+
));
259261
}
260262

261263
// resolve relation functions

lib/persisted-model.js

+18-9
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,8 @@ module.exports = function(registry) {
12311231
function(filter, pagingCallback) {
12321232
sourceModel.changes(since.source, filter, pagingCallback);
12331233
},
1234-
debug.enabled ? log : cb);
1234+
debug.enabled ? log : cb
1235+
);
12351236

12361237
function log(err, result) {
12371238
if (err) return cb(err);
@@ -1248,7 +1249,8 @@ module.exports = function(registry) {
12481249
function(smallArray, chunkCallback) {
12491250
return targetModel.diff(since.target, smallArray, chunkCallback);
12501251
},
1251-
debug.enabled ? log : cb);
1252+
debug.enabled ? log : cb
1253+
);
12521254

12531255
function log(err, result) {
12541256
if (err) return cb(err);
@@ -1276,7 +1278,8 @@ module.exports = function(registry) {
12761278
function(smallArray, chunkCallback) {
12771279
return sourceModel.createUpdates(smallArray, chunkCallback);
12781280
},
1279-
cb);
1281+
cb
1282+
);
12801283
} else {
12811284
// nothing to replicate
12821285
done();
@@ -1308,7 +1311,8 @@ module.exports = function(registry) {
13081311
return cb();
13091312
}
13101313
cb(err);
1311-
});
1314+
}
1315+
);
13121316
}
13131317

13141318
function checkpoints() {
@@ -1526,14 +1530,16 @@ module.exports = function(registry) {
15261530
return cb(new Error(
15271531
g.f('Cannot apply bulk updates, ' +
15281532
'the connector does not correctly report ' +
1529-
'the number of updated records.')));
1533+
'the number of updated records.')
1534+
));
15301535

15311536
default:
15321537
debug('%s.updateAll modified unexpected number of instances: %j',
15331538
Model.modelName, count);
15341539
return cb(new Error(
15351540
g.f('Bulk update failed, the connector has modified unexpected ' +
1536-
'number of records: %s', JSON.stringify(count))));
1541+
'number of records: %s', JSON.stringify(count))
1542+
));
15371543
}
15381544
});
15391545
}
@@ -1608,14 +1614,16 @@ module.exports = function(registry) {
16081614
return cb(new Error(
16091615
g.f('Cannot apply bulk updates, ' +
16101616
'the connector does not correctly report ' +
1611-
'the number of deleted records.')));
1617+
'the number of deleted records.')
1618+
));
16121619

16131620
default:
16141621
debug('%s.deleteAll modified unexpected number of instances: %j',
16151622
Model.modelName, count);
16161623
return cb(new Error(
16171624
g.f('Bulk update failed, the connector has deleted unexpected ' +
1618-
'number of records: %s', JSON.stringify(count))));
1625+
'number of records: %s', JSON.stringify(count))
1626+
));
16191627
}
16201628
});
16211629
}
@@ -1770,7 +1778,8 @@ module.exports = function(registry) {
17701778
const additionalChangeModelProperties =
17711779
this.settings.additionalChangeModelProperties || {};
17721780

1773-
this.Change = BaseChangeModel.extend(this.modelName + '-change',
1781+
this.Change = BaseChangeModel.extend(
1782+
this.modelName + '-change',
17741783
additionalChangeModelProperties,
17751784
{trackModel: this}
17761785
);

0 commit comments

Comments
 (0)