Merge pull request #4283 from strongloop/fix-comma-dangle
chore: fix eslint violations
This commit is contained in:
commit
b848bd9d9f
|
@ -233,7 +233,7 @@ module.exports = function(AccessToken) {
|
||||||
try {
|
try {
|
||||||
assert(
|
assert(
|
||||||
this.created && typeof this.created.getTime === 'function',
|
this.created && typeof this.created.getTime === 'function',
|
||||||
'token.created must be a valid Date'
|
'token.created must be a valid Date',
|
||||||
);
|
);
|
||||||
assert(this.ttl !== 0, 'token.ttl must be not be 0');
|
assert(this.ttl !== 0, 'token.ttl must be not be 0');
|
||||||
assert(this.ttl, 'token.ttl must exist');
|
assert(this.ttl, 'token.ttl must exist');
|
||||||
|
|
|
@ -607,12 +607,12 @@ module.exports = function(ACL) {
|
||||||
break;
|
break;
|
||||||
case ACL.USER:
|
case ACL.USER:
|
||||||
this.userModel.findOne(
|
this.userModel.findOne(
|
||||||
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb
|
{where: {or: [{username: id}, {email: id}, {id: id}]}}, cb,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case ACL.APP:
|
case ACL.APP:
|
||||||
this.applicationModel.findOne(
|
this.applicationModel.findOne(
|
||||||
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb
|
{where: {or: [{name: id}, {email: id}, {id: id}]}}, cb,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -621,7 +621,7 @@ module.exports = function(ACL) {
|
||||||
if (userModel) {
|
if (userModel) {
|
||||||
userModel.findOne(
|
userModel.findOne(
|
||||||
{where: {or: [{username: id}, {email: id}, {id: id}]}},
|
{where: {or: [{username: id}, {email: id}, {id: id}]}},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
|
|
|
@ -216,7 +216,7 @@ module.exports = function(Change) {
|
||||||
function(err, checkpoint) {
|
function(err, checkpoint) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
doRectify(checkpoint, rev);
|
doRectify(checkpoint, rev);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ module.exports = function(Change) {
|
||||||
async.each(
|
async.each(
|
||||||
changes,
|
changes,
|
||||||
function(c, next) { c.rectify(next); },
|
function(c, next) { c.rectify(next); },
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -692,9 +692,9 @@ module.exports = function(Change) {
|
||||||
conflict.SourceModel.updateLastChange(
|
conflict.SourceModel.updateLastChange(
|
||||||
conflict.modelId,
|
conflict.modelId,
|
||||||
{prev: targetChange.rev},
|
{prev: targetChange.rev},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ module.exports = function(Change) {
|
||||||
}
|
}
|
||||||
const inst = new conflict.SourceModel(
|
const inst = new conflict.SourceModel(
|
||||||
target.toObject(),
|
target.toObject(),
|
||||||
{persisted: true}
|
{persisted: true},
|
||||||
);
|
);
|
||||||
inst.save(done);
|
inst.save(done);
|
||||||
});
|
});
|
||||||
|
|
|
@ -226,7 +226,7 @@ function throwNotAttached(modelName, methodName) {
|
||||||
'The %s method has not been setup. ' +
|
'The %s method has not been setup. ' +
|
||||||
'The {{KeyValueModel}} has not been correctly attached ' +
|
'The {{KeyValueModel}} has not been correctly attached ' +
|
||||||
'to a {{DataSource}}!',
|
'to a {{DataSource}}!',
|
||||||
modelName, methodName, methodName
|
modelName, methodName, methodName,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ module.exports = function(Role) {
|
||||||
if (promise && typeof promise.then === 'function') {
|
if (promise && typeof promise.then === 'function') {
|
||||||
promise.then(
|
promise.then(
|
||||||
function(result) { callback(null, result); },
|
function(result) { callback(null, result); },
|
||||||
callback
|
callback,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return callback.promise;
|
return callback.promise;
|
||||||
|
|
|
@ -47,7 +47,7 @@ module.exports = function(Scope) {
|
||||||
if (callback) callback(err);
|
if (callback) callback(err);
|
||||||
} else {
|
} else {
|
||||||
aclModel.checkPermission(
|
aclModel.checkPermission(
|
||||||
aclModel.SCOPE, scope.id, model, property, accessType, callback
|
aclModel.SCOPE, scope.id, model, property, accessType, callback,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -766,14 +766,14 @@ module.exports = function(User) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Cannot build user verification URL, ' +
|
'Cannot build user verification URL, ' +
|
||||||
'the default confirm method is not public. ' +
|
'the default confirm method is not public. ' +
|
||||||
'Please provide the URL in verifyOptions.verifyHref.'
|
'Please provide the URL in verifyOptions.verifyHref.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const urlPath = joinUrlPath(
|
const urlPath = joinUrlPath(
|
||||||
verifyOptions.restApiRoot,
|
verifyOptions.restApiRoot,
|
||||||
userModel.http.path,
|
userModel.http.path,
|
||||||
confirmMethod.http.path
|
confirmMethod.http.path,
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyOptions.verifyHref =
|
verifyOptions.verifyHref =
|
||||||
|
@ -1148,7 +1148,7 @@ module.exports = function(User) {
|
||||||
'{{(`include=user`)}}\n\n'),
|
'{{(`include=user`)}}\n\n'),
|
||||||
},
|
},
|
||||||
http: {verb: 'post'},
|
http: {verb: 'post'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UserModel.remoteMethod(
|
UserModel.remoteMethod(
|
||||||
|
@ -1167,7 +1167,7 @@ module.exports = function(User) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
http: {verb: 'all'},
|
http: {verb: 'all'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UserModel.remoteMethod(
|
UserModel.remoteMethod(
|
||||||
|
@ -1179,7 +1179,7 @@ module.exports = function(User) {
|
||||||
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
|
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
|
||||||
],
|
],
|
||||||
http: {verb: 'post'},
|
http: {verb: 'post'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UserModel.remoteMethod(
|
UserModel.remoteMethod(
|
||||||
|
@ -1192,7 +1192,7 @@ module.exports = function(User) {
|
||||||
{arg: 'redirect', type: 'string'},
|
{arg: 'redirect', type: 'string'},
|
||||||
],
|
],
|
||||||
http: {verb: 'get', path: '/confirm'},
|
http: {verb: 'get', path: '/confirm'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UserModel.remoteMethod(
|
UserModel.remoteMethod(
|
||||||
|
@ -1203,7 +1203,7 @@ module.exports = function(User) {
|
||||||
{arg: 'options', type: 'object', required: true, http: {source: 'body'}},
|
{arg: 'options', type: 'object', required: true, http: {source: 'body'}},
|
||||||
],
|
],
|
||||||
http: {verb: 'post', path: '/reset'},
|
http: {verb: 'post', path: '/reset'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
UserModel.remoteMethod(
|
UserModel.remoteMethod(
|
||||||
|
@ -1217,7 +1217,7 @@ module.exports = function(User) {
|
||||||
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
|
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
|
||||||
],
|
],
|
||||||
http: {verb: 'POST', path: '/change-password'},
|
http: {verb: 'POST', path: '/change-password'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const setPasswordScopes = UserModel.settings.restrictResetPasswordTokenScope ?
|
const setPasswordScopes = UserModel.settings.restrictResetPasswordTokenScope ?
|
||||||
|
@ -1234,7 +1234,7 @@ module.exports = function(User) {
|
||||||
],
|
],
|
||||||
accessScopes: setPasswordScopes,
|
accessScopes: setPasswordScopes,
|
||||||
http: {verb: 'POST', path: '/reset-password'},
|
http: {verb: 'POST', path: '/reset-password'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function getUserIdFromRequestContext(ctx) {
|
function getUserIdFromRequestContext(ctx) {
|
||||||
|
@ -1337,7 +1337,7 @@ module.exports = function(User) {
|
||||||
// This is a programmer's error, use the default status code 500
|
// This is a programmer's error, use the default status code 500
|
||||||
return next(new Error(
|
return next(new Error(
|
||||||
'Invalid use of "options.setPassword". Only "password" can be ' +
|
'Invalid use of "options.setPassword". Only "password" can be ' +
|
||||||
'changed when using this option.'
|
'changed when using this option.',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1350,7 +1350,7 @@ module.exports = function(User) {
|
||||||
|
|
||||||
const err = new Error(
|
const err = new Error(
|
||||||
'Changing user password via patch/replace API is not allowed. ' +
|
'Changing user password via patch/replace API is not allowed. ' +
|
||||||
'Use changePassword() or setPassword() instead.'
|
'Use changePassword() or setPassword() instead.',
|
||||||
);
|
);
|
||||||
err.statusCode = 401;
|
err.statusCode = 401;
|
||||||
err.code = 'PASSWORD_CHANGE_NOT_ALLOWED';
|
err.code = 'PASSWORD_CHANGE_NOT_ALLOWED';
|
||||||
|
|
|
@ -359,7 +359,7 @@ app.enableAuth = function(options) {
|
||||||
const Model = app.registry.findModel(m);
|
const Model = app.registry.findModel(m);
|
||||||
if (!Model) {
|
if (!Model) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
g.f('Authentication requires model %s to be defined.', m)
|
g.f('Authentication requires model %s to be defined.', m),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ app.enableAuth = function(options) {
|
||||||
e.code = messages[errStatusCode].code || messages[403].code;
|
e.code = messages[errStatusCode].code || messages[403].code;
|
||||||
next(e);
|
next(e);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
@ -486,7 +486,7 @@ app._verifyAuthModelRelations = function() {
|
||||||
'custom User subclass, but does not fix AccessToken relations ' +
|
'custom User subclass, but does not fix AccessToken relations ' +
|
||||||
'to use this new model.\n' +
|
'to use this new model.\n' +
|
||||||
'Learn more at http://ibm.biz/setup-loopback-auth',
|
'Learn more at http://ibm.biz/setup-loopback-auth',
|
||||||
Model.modelName, userName, userName
|
Model.modelName, userName, userName,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -495,7 +495,7 @@ app._verifyAuthModelRelations = function() {
|
||||||
'The model %j does not have "belongsTo User-like model" relation ' +
|
'The model %j does not have "belongsTo User-like model" relation ' +
|
||||||
'configured.\n' +
|
'configured.\n' +
|
||||||
'Learn more at http://ibm.biz/setup-loopback-auth',
|
'Learn more at http://ibm.biz/setup-loopback-auth',
|
||||||
Model.modelName
|
Model.modelName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ app._verifyAuthModelRelations = function() {
|
||||||
'The app configuration follows the multiple user models setup ' +
|
'The app configuration follows the multiple user models setup ' +
|
||||||
'as described in http://ibm.biz/setup-loopback-auth',
|
'as described in http://ibm.biz/setup-loopback-auth',
|
||||||
'The built-in role resolver $owner is not currently compatible ' +
|
'The built-in role resolver $owner is not currently compatible ' +
|
||||||
'with this configuration and should not be used in production.'
|
'with this configuration and should not be used in production.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -526,7 +526,7 @@ app._verifyAuthModelRelations = function() {
|
||||||
'AccessToken subclass, but does not fix User relations to use this ' +
|
'AccessToken subclass, but does not fix User relations to use this ' +
|
||||||
'new model.\n' +
|
'new model.\n' +
|
||||||
'Learn more at http://ibm.biz/setup-loopback-auth',
|
'Learn more at http://ibm.biz/setup-loopback-auth',
|
||||||
Model.modelName, accessTokenName, accessTokenName
|
Model.modelName, accessTokenName, accessTokenName,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -535,14 +535,14 @@ app._verifyAuthModelRelations = function() {
|
||||||
'The model %j does not have "hasMany AccessToken-like models" relation ' +
|
'The model %j does not have "hasMany AccessToken-like models" relation ' +
|
||||||
'configured.\n' +
|
'configured.\n' +
|
||||||
'Learn more at http://ibm.biz/setup-loopback-auth',
|
'Learn more at http://ibm.biz/setup-loopback-auth',
|
||||||
Model.modelName
|
Model.modelName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
app.boot = function(options) {
|
app.boot = function(options) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead')
|
g.f('{{`app.boot`}} was removed, use the new module {{loopback-boot}} instead'),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ function configureModel(ModelCtor, config, app) {
|
||||||
assert(
|
assert(
|
||||||
dataSource instanceof DataSource,
|
dataSource instanceof DataSource,
|
||||||
ModelCtor.modelName + ' is referencing a dataSource that does not exist: "' +
|
ModelCtor.modelName + ' is referencing a dataSource that does not exist: "' +
|
||||||
config.dataSource + '"'
|
config.dataSource + '"',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,57 +12,57 @@ module.exports = function(registry) {
|
||||||
|
|
||||||
registry.KeyValueModel = createModel(
|
registry.KeyValueModel = createModel(
|
||||||
require('../common/models/key-value-model.json'),
|
require('../common/models/key-value-model.json'),
|
||||||
require('../common/models/key-value-model.js')
|
require('../common/models/key-value-model.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Email = createModel(
|
registry.Email = createModel(
|
||||||
require('../common/models/email.json'),
|
require('../common/models/email.json'),
|
||||||
require('../common/models/email.js')
|
require('../common/models/email.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Application = createModel(
|
registry.Application = createModel(
|
||||||
require('../common/models/application.json'),
|
require('../common/models/application.json'),
|
||||||
require('../common/models/application.js')
|
require('../common/models/application.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.AccessToken = createModel(
|
registry.AccessToken = createModel(
|
||||||
require('../common/models/access-token.json'),
|
require('../common/models/access-token.json'),
|
||||||
require('../common/models/access-token.js')
|
require('../common/models/access-token.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.User = createModel(
|
registry.User = createModel(
|
||||||
require('../common/models/user.json'),
|
require('../common/models/user.json'),
|
||||||
require('../common/models/user.js')
|
require('../common/models/user.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.RoleMapping = createModel(
|
registry.RoleMapping = createModel(
|
||||||
require('../common/models/role-mapping.json'),
|
require('../common/models/role-mapping.json'),
|
||||||
require('../common/models/role-mapping.js')
|
require('../common/models/role-mapping.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Role = createModel(
|
registry.Role = createModel(
|
||||||
require('../common/models/role.json'),
|
require('../common/models/role.json'),
|
||||||
require('../common/models/role.js')
|
require('../common/models/role.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.ACL = createModel(
|
registry.ACL = createModel(
|
||||||
require('../common/models/acl.json'),
|
require('../common/models/acl.json'),
|
||||||
require('../common/models/acl.js')
|
require('../common/models/acl.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Scope = createModel(
|
registry.Scope = createModel(
|
||||||
require('../common/models/scope.json'),
|
require('../common/models/scope.json'),
|
||||||
require('../common/models/scope.js')
|
require('../common/models/scope.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Change = createModel(
|
registry.Change = createModel(
|
||||||
require('../common/models/change.json'),
|
require('../common/models/change.json'),
|
||||||
require('../common/models/change.js')
|
require('../common/models/change.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.Checkpoint = createModel(
|
registry.Checkpoint = createModel(
|
||||||
require('../common/models/checkpoint.json'),
|
require('../common/models/checkpoint.json'),
|
||||||
require('../common/models/checkpoint.js')
|
require('../common/models/checkpoint.js'),
|
||||||
);
|
);
|
||||||
|
|
||||||
function createModel(definitionJson, customizeFn) {
|
function createModel(definitionJson, customizeFn) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ module.exports = function(loopback) {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'%s was removed in version 3.0. See %s for more details.',
|
'%s was removed in version 3.0. See %s for more details.',
|
||||||
'loopback.getCurrentContext()',
|
'loopback.getCurrentContext()',
|
||||||
'http://loopback.io/doc/en/lb2/Using-current-context.html'
|
'http://loopback.io/doc/en/lb2/Using-current-context.html',
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module.exports = function(loopback) {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'%s was removed in version 3.0. See %s for more details.',
|
'%s was removed in version 3.0. See %s for more details.',
|
||||||
'loopback.runInContext()',
|
'loopback.runInContext()',
|
||||||
'http://loopback.io/doc/en/lb2/Using-current-context.html'
|
'http://loopback.io/doc/en/lb2/Using-current-context.html',
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ module.exports = function(loopback) {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'%s was removed in version 3.0. See %s for more details.',
|
'%s was removed in version 3.0. See %s for more details.',
|
||||||
'loopback.createContext()',
|
'loopback.createContext()',
|
||||||
'http://loopback.io/doc/en/lb2/Using-current-context.html'
|
'http://loopback.io/doc/en/lb2/Using-current-context.html',
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -206,7 +206,7 @@ module.exports = function(registry) {
|
||||||
const sharedClass = ModelCtor.sharedClass = new SharedClass(
|
const sharedClass = ModelCtor.sharedClass = new SharedClass(
|
||||||
ModelCtor.modelName,
|
ModelCtor.modelName,
|
||||||
ModelCtor,
|
ModelCtor,
|
||||||
remotingOptions
|
remotingOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
// before remote hook
|
// before remote hook
|
||||||
|
@ -250,12 +250,12 @@ module.exports = function(registry) {
|
||||||
if ('injectOptionsFromRemoteContext' in options) {
|
if ('injectOptionsFromRemoteContext' in options) {
|
||||||
console.warn(g.f(
|
console.warn(g.f(
|
||||||
'%s is using model setting %s which is no longer available.',
|
'%s is using model setting %s which is no longer available.',
|
||||||
typeName, 'injectOptionsFromRemoteContext'
|
typeName, 'injectOptionsFromRemoteContext',
|
||||||
));
|
));
|
||||||
console.warn(g.f(
|
console.warn(g.f(
|
||||||
'Please rework your app to use the offical solution for injecting ' +
|
'Please rework your app to use the offical solution for injecting ' +
|
||||||
'"options" argument from request context,\nsee %s',
|
'"options" argument from request context,\nsee %s',
|
||||||
'http://loopback.io/doc/en/lb3/Using-current-context.html'
|
'http://loopback.io/doc/en/lb3/Using-current-context.html',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ module.exports = function(registry) {
|
||||||
}
|
}
|
||||||
assert(
|
assert(
|
||||||
typeof method === 'object',
|
typeof method === 'object',
|
||||||
'method is a required argument and must be a RemoteMethod object'
|
'method is a required argument and must be a RemoteMethod object',
|
||||||
);
|
);
|
||||||
|
|
||||||
const ACL = Model._ACL();
|
const ACL = Model._ACL();
|
||||||
|
|
|
@ -72,7 +72,7 @@ module.exports = function(registry) {
|
||||||
g.f('Cannot call %s.%s().' +
|
g.f('Cannot call %s.%s().' +
|
||||||
' The %s method has not been setup.' +
|
' The %s method has not been setup.' +
|
||||||
' The {{PersistedModel}} has not been correctly attached to a {{DataSource}}!',
|
' The {{PersistedModel}} has not been correctly attached to a {{DataSource}}!',
|
||||||
modelName, methodName, methodName)
|
modelName, methodName, methodName),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,7 +1214,7 @@ module.exports = function(registry) {
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
changeTrackingEnabled,
|
changeTrackingEnabled,
|
||||||
'You must enable change tracking before replicating'
|
'You must enable change tracking before replicating',
|
||||||
);
|
);
|
||||||
|
|
||||||
let diff, updates, newSourceCp, newTargetCp;
|
let diff, updates, newSourceCp, newTargetCp;
|
||||||
|
@ -1236,7 +1236,7 @@ module.exports = function(registry) {
|
||||||
function(filter, pagingCallback) {
|
function(filter, pagingCallback) {
|
||||||
sourceModel.changes(since.source, filter, pagingCallback);
|
sourceModel.changes(since.source, filter, pagingCallback);
|
||||||
},
|
},
|
||||||
debug.enabled ? log : cb
|
debug.enabled ? log : cb,
|
||||||
);
|
);
|
||||||
|
|
||||||
function log(err, result) {
|
function log(err, result) {
|
||||||
|
@ -1254,7 +1254,7 @@ module.exports = function(registry) {
|
||||||
function(smallArray, chunkCallback) {
|
function(smallArray, chunkCallback) {
|
||||||
return targetModel.diff(since.target, smallArray, chunkCallback);
|
return targetModel.diff(since.target, smallArray, chunkCallback);
|
||||||
},
|
},
|
||||||
debug.enabled ? log : cb
|
debug.enabled ? log : cb,
|
||||||
);
|
);
|
||||||
|
|
||||||
function log(err, result) {
|
function log(err, result) {
|
||||||
|
@ -1283,7 +1283,7 @@ module.exports = function(registry) {
|
||||||
function(smallArray, chunkCallback) {
|
function(smallArray, chunkCallback) {
|
||||||
return sourceModel.createUpdates(smallArray, chunkCallback);
|
return sourceModel.createUpdates(smallArray, chunkCallback);
|
||||||
},
|
},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// nothing to replicate
|
// nothing to replicate
|
||||||
|
@ -1316,7 +1316,7 @@ module.exports = function(registry) {
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,7 +1347,7 @@ module.exports = function(registry) {
|
||||||
|
|
||||||
const conflicts = diff.conflicts.map(function(change) {
|
const conflicts = diff.conflicts.map(function(change) {
|
||||||
return new Change.Conflict(
|
return new Change.Conflict(
|
||||||
change.modelId, sourceModel, targetModel
|
change.modelId, sourceModel, targetModel,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1535,7 +1535,7 @@ module.exports = function(registry) {
|
||||||
return cb(new Error(
|
return cb(new Error(
|
||||||
g.f('Cannot apply bulk updates, ' +
|
g.f('Cannot apply bulk updates, ' +
|
||||||
'the connector does not correctly report ' +
|
'the connector does not correctly report ' +
|
||||||
'the number of updated records.')
|
'the number of updated records.'),
|
||||||
));
|
));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1543,7 +1543,7 @@ module.exports = function(registry) {
|
||||||
Model.modelName, count);
|
Model.modelName, count);
|
||||||
return cb(new Error(
|
return cb(new Error(
|
||||||
g.f('Bulk update failed, the connector has modified unexpected ' +
|
g.f('Bulk update failed, the connector has modified unexpected ' +
|
||||||
'number of records: %s', JSON.stringify(count))
|
'number of records: %s', JSON.stringify(count)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1619,7 +1619,7 @@ module.exports = function(registry) {
|
||||||
return cb(new Error(
|
return cb(new Error(
|
||||||
g.f('Cannot apply bulk updates, ' +
|
g.f('Cannot apply bulk updates, ' +
|
||||||
'the connector does not correctly report ' +
|
'the connector does not correctly report ' +
|
||||||
'the number of deleted records.')
|
'the number of deleted records.'),
|
||||||
));
|
));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1627,7 +1627,7 @@ module.exports = function(registry) {
|
||||||
Model.modelName, count);
|
Model.modelName, count);
|
||||||
return cb(new Error(
|
return cb(new Error(
|
||||||
g.f('Bulk update failed, the connector has deleted unexpected ' +
|
g.f('Bulk update failed, the connector has deleted unexpected ' +
|
||||||
'number of records: %s', JSON.stringify(count))
|
'number of records: %s', JSON.stringify(count)),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1663,7 +1663,7 @@ module.exports = function(registry) {
|
||||||
}
|
}
|
||||||
assert(
|
assert(
|
||||||
dataSource.connector.name,
|
dataSource.connector.name,
|
||||||
'Model.getSourceId: cannot get id without dataSource.connector.name'
|
'Model.getSourceId: cannot get id without dataSource.connector.name',
|
||||||
);
|
);
|
||||||
const id = [dataSource.connector.name, this.modelName].join('-');
|
const id = [dataSource.connector.name, this.modelName].join('-');
|
||||||
cb(null, id);
|
cb(null, id);
|
||||||
|
@ -1786,7 +1786,7 @@ module.exports = function(registry) {
|
||||||
this.Change = BaseChangeModel.extend(
|
this.Change = BaseChangeModel.extend(
|
||||||
this.modelName + '-change',
|
this.modelName + '-change',
|
||||||
additionalChangeModelProperties,
|
additionalChangeModelProperties,
|
||||||
{trackModel: this}
|
{trackModel: this},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.dataSource) {
|
if (this.dataSource) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ Registry.prototype.configureModel = function(ModelCtor, config) {
|
||||||
g.warn(
|
g.warn(
|
||||||
'The configuration of `%s` is missing {{`dataSource`}} property.\n' +
|
'The configuration of `%s` is missing {{`dataSource`}} property.\n' +
|
||||||
'Use `null` or `false` to mark models not attached to any data source.',
|
'Use `null` or `false` to mark models not attached to any data source.',
|
||||||
modelName
|
modelName,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ Registry.prototype.configureModel = function(ModelCtor, config) {
|
||||||
if (hasNewMethods && hasDescendants) {
|
if (hasNewMethods && hasDescendants) {
|
||||||
g.warn(
|
g.warn(
|
||||||
'Child models of `%s` will not inherit newly defined remote methods %s.',
|
'Child models of `%s` will not inherit newly defined remote methods %s.',
|
||||||
modelName, newMethodNames
|
modelName, newMethodNames,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ function createPromiseCallback() {
|
||||||
function throwPromiseNotDefined() {
|
function throwPromiseNotDefined() {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Your Node runtime does support ES6 Promises. ' +
|
'Your Node runtime does support ES6 Promises. ' +
|
||||||
'Set "global.Promise" to your preferred implementation of promises.'
|
'Set "global.Promise" to your preferred implementation of promises.',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ module.exports = function() {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'%s middleware was removed in version 3.0. See %s for more details.',
|
'%s middleware was removed in version 3.0. See %s for more details.',
|
||||||
'loopback#context',
|
'loopback#context',
|
||||||
'http://loopback.io/doc/en/lb2/Using-current-context.html'
|
'http://loopback.io/doc/en/lb2/Using-current-context.html',
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@ function rest() {
|
||||||
throw new Error(g.f(
|
throw new Error(g.f(
|
||||||
'%s was removed in version 3.0. See %s for more details.',
|
'%s was removed in version 3.0. See %s for more details.',
|
||||||
'remoting.context option',
|
'remoting.context option',
|
||||||
'http://loopback.io/doc/en/lb2/Using-current-context.html'
|
'http://loopback.io/doc/en/lb2/Using-current-context.html',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ function rewriteUserLiteral(req, currentUserLiteral, next) {
|
||||||
debug(
|
debug(
|
||||||
'URL %s matches current-user literal %s,' +
|
'URL %s matches current-user literal %s,' +
|
||||||
' but no (valid) access token was provided.',
|
' but no (valid) access token was provided.',
|
||||||
req.url, currentUserLiteral
|
req.url, currentUserLiteral,
|
||||||
);
|
);
|
||||||
|
|
||||||
const e = new Error(g.f('Authorization Required'));
|
const e = new Error(g.f('Authorization Required'));
|
||||||
|
|
|
@ -75,11 +75,11 @@ describe('access control - integration', function() {
|
||||||
lt.it.shouldBeDeniedWhenCalledByUser(CURRENT_USER, 'GET', urlForUser);
|
lt.it.shouldBeDeniedWhenCalledByUser(CURRENT_USER, 'GET', urlForUser);
|
||||||
|
|
||||||
lt.it.shouldBeAllowedWhenCalledAnonymously(
|
lt.it.shouldBeAllowedWhenCalledAnonymously(
|
||||||
'POST', '/api/users', newUserData()
|
'POST', '/api/users', newUserData(),
|
||||||
);
|
);
|
||||||
|
|
||||||
lt.it.shouldBeAllowedWhenCalledByUser(
|
lt.it.shouldBeAllowedWhenCalledByUser(
|
||||||
CURRENT_USER, 'POST', '/api/users', newUserData()
|
CURRENT_USER, 'POST', '/api/users', newUserData(),
|
||||||
);
|
);
|
||||||
|
|
||||||
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users/logout');
|
lt.it.shouldBeAllowedWhenCalledByUser(CURRENT_USER, 'POST', '/api/users/logout');
|
||||||
|
|
|
@ -144,7 +144,7 @@ describe('loopback.token(options)', function() {
|
||||||
const app = createTestApp(
|
const app = createTestApp(
|
||||||
this.token,
|
this.token,
|
||||||
{token: {searchDefaultTokenKeys: false}},
|
{token: {searchDefaultTokenKeys: false}},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
const agent = request.agent(app);
|
const agent = request.agent(app);
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ describe('AccessToken', function() {
|
||||||
param: function(name) { return this._params[name]; },
|
param: function(name) { return this._params[name]; },
|
||||||
header: function(name) { return this.headers[name]; },
|
header: function(name) { return this.headers[name]; },
|
||||||
},
|
},
|
||||||
opts
|
opts,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -573,7 +573,7 @@ describe('authorized roles propagation in RemotingContext', function() {
|
||||||
$everyone: true,
|
$everyone: true,
|
||||||
$authenticated: true,
|
$authenticated: true,
|
||||||
myRole: true,
|
myRole: true,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -591,7 +591,7 @@ describe('authorized roles propagation in RemotingContext', function() {
|
||||||
{
|
{
|
||||||
$everyone: true,
|
$everyone: true,
|
||||||
myRole: true,
|
myRole: true,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -610,7 +610,7 @@ describe('authorized roles propagation in RemotingContext', function() {
|
||||||
const ctx = models.MyTestModel.lastRemotingContext;
|
const ctx = models.MyTestModel.lastRemotingContext;
|
||||||
expect(ctx.args.options.authorizedRoles).to.eql(
|
expect(ctx.args.options.authorizedRoles).to.eql(
|
||||||
// '$everyone' is not expected as default permission is DENY
|
// '$everyone' is not expected as default permission is DENY
|
||||||
{myRole: true}
|
{myRole: true},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -245,7 +245,7 @@ describe('app', function() {
|
||||||
expect(steps).to.eql(['/scope', '/scope/item']);
|
expect(steps).to.eql(['/scope', '/scope/item']);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ describe('app', function() {
|
||||||
expect(steps).to.eql(['/a', '/b']);
|
expect(steps).to.eql(['/a', '/b']);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ describe('app', function() {
|
||||||
expect(steps).to.eql(['/a', '/b', '/scope']);
|
expect(steps).to.eql(['/a', '/b', '/scope']);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ describe('app', function() {
|
||||||
{
|
{
|
||||||
phase: 'initial',
|
phase: 'initial',
|
||||||
paths: ['/scope', /^\/(a|b)/],
|
paths: ['/scope', /^\/(a|b)/],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
async.eachSeries(
|
async.eachSeries(
|
||||||
|
@ -574,7 +574,7 @@ describe('app', function() {
|
||||||
expect(steps).to.eql(['/a', '/b', '/scope']);
|
expect(steps).to.eql(['/a', '/b', '/scope']);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -719,14 +719,14 @@ describe('app', function() {
|
||||||
const Book = app.registry.createModel(
|
const Book = app.registry.createModel(
|
||||||
'Book',
|
'Book',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'books'}
|
{plural: 'books'},
|
||||||
);
|
);
|
||||||
app.model(Book, {dataSource: 'db'});
|
app.model(Book, {dataSource: 'db'});
|
||||||
|
|
||||||
const Page = app.registry.createModel(
|
const Page = app.registry.createModel(
|
||||||
'Page',
|
'Page',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'pages'}
|
{plural: 'pages'},
|
||||||
);
|
);
|
||||||
app.model(Page, {dataSource: 'db'});
|
app.model(Page, {dataSource: 'db'});
|
||||||
|
|
||||||
|
@ -1089,11 +1089,11 @@ describe('app', function() {
|
||||||
const UserAccount = app.registry.createModel(
|
const UserAccount = app.registry.createModel(
|
||||||
'UserAccount',
|
'UserAccount',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
const UserRole = app.registry.createModel(
|
const UserRole = app.registry.createModel(
|
||||||
'UserRole',
|
'UserRole',
|
||||||
{name: 'string'}
|
{name: 'string'},
|
||||||
);
|
);
|
||||||
app.model(UserAccount, {dataSource: 'db'});
|
app.model(UserAccount, {dataSource: 'db'});
|
||||||
app.model(UserRole, {dataSource: 'db'});
|
app.model(UserRole, {dataSource: 'db'});
|
||||||
|
|
|
@ -222,7 +222,7 @@ describe('Change', function() {
|
||||||
change = ch;
|
change = ch;
|
||||||
|
|
||||||
done(err);
|
done(err);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ describe('OptionsFromRemotingContext', function() {
|
||||||
Category = app.registry.createModel(
|
Category = app.registry.createModel(
|
||||||
'Category',
|
'Category',
|
||||||
{name: String},
|
{name: String},
|
||||||
{forceId: false, replaceOnPUT: true}
|
{forceId: false, replaceOnPUT: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.model(Category, {dataSource: 'db'});
|
app.model(Category, {dataSource: 'db'});
|
||||||
|
@ -288,7 +288,7 @@ describe('OptionsFromRemotingContext', function() {
|
||||||
Category = app.registry.createModel(
|
Category = app.registry.createModel(
|
||||||
'Category',
|
'Category',
|
||||||
{name: String},
|
{name: String},
|
||||||
{forceId: false, replaceOnPUT: true}
|
{forceId: false, replaceOnPUT: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.model(Category, {dataSource: 'db'});
|
app.model(Category, {dataSource: 'db'});
|
||||||
|
@ -333,7 +333,7 @@ describe('OptionsFromRemotingContext', function() {
|
||||||
Category = app.registry.createModel(
|
Category = app.registry.createModel(
|
||||||
'Category',
|
'Category',
|
||||||
{name: String},
|
{name: String},
|
||||||
{forceId: false, replaceOnPUT: true}
|
{forceId: false, replaceOnPUT: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.model(Category, {dataSource: 'db'});
|
app.model(Category, {dataSource: 'db'});
|
||||||
|
@ -364,7 +364,7 @@ describe('OptionsFromRemotingContext', function() {
|
||||||
Product = app.registry.createModel(
|
Product = app.registry.createModel(
|
||||||
'Product',
|
'Product',
|
||||||
{name: String},
|
{name: String},
|
||||||
{forceId: false, replaceOnPUT: true}
|
{forceId: false, replaceOnPUT: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
Product.createOptionsFromRemotingContext = function(ctx) {
|
Product.createOptionsFromRemotingContext = function(ctx) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ _beforeEach.givenModel = function(modelName, attrs, optionalHandler) {
|
||||||
' without attached dataSource');
|
' without attached dataSource');
|
||||||
assert(
|
assert(
|
||||||
typeof model.create === 'function',
|
typeof model.create === 'function',
|
||||||
modelName + ' does not have a create method'
|
modelName + ' does not have a create method',
|
||||||
);
|
);
|
||||||
|
|
||||||
model.create(attrs, function(err, result) {
|
model.create(attrs, function(err, result) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('hidden properties', function() {
|
||||||
const Product = this.Product = loopback.PersistedModel.extend(
|
const Product = this.Product = loopback.PersistedModel.extend(
|
||||||
'product',
|
'product',
|
||||||
{},
|
{},
|
||||||
{hidden: ['secret']}
|
{hidden: ['secret']},
|
||||||
);
|
);
|
||||||
Product.attachTo(loopback.memory());
|
Product.attachTo(loopback.memory());
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('loopback application', function() {
|
||||||
expect(res).to.match(/\nX$/);
|
expect(res).to.match(/\nX$/);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ describe('loopback', function() {
|
||||||
{
|
{
|
||||||
returns: {arg: 'stats', type: 'array'},
|
returns: {arg: 'stats', type: 'array'},
|
||||||
http: {path: '/info', verb: 'get'},
|
http: {path: '/info', verb: 'get'},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(Product.stats.returns.arg, 'stats');
|
assert.equal(Product.stats.returns.arg, 'stats');
|
||||||
|
|
|
@ -613,7 +613,7 @@ describe.onServer('Remote Methods', function() {
|
||||||
// should match the given property
|
// should match the given property
|
||||||
assert(
|
assert(
|
||||||
p.type.name === o.name ||
|
p.type.name === o.name ||
|
||||||
p.type.name === o
|
p.type.name === o,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -706,7 +706,7 @@ describe.onServer('Remote Methods', function() {
|
||||||
const remoteMethod = {name: methodName};
|
const remoteMethod = {name: methodName};
|
||||||
assert.equal(
|
assert.equal(
|
||||||
User._getAccessTypeForMethod(remoteMethod),
|
User._getAccessTypeForMethod(remoteMethod),
|
||||||
expectedAccessType
|
expectedAccessType,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,7 +101,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
},
|
},
|
||||||
function onError(err) {
|
function onError(err) {
|
||||||
expect(err).to.have.property('code', 'LOGIN_FAILED');
|
expect(err).to.have.property('code', 'LOGIN_FAILED');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -285,7 +285,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
describe('role.users()', function() {
|
describe('role.users()', function() {
|
||||||
it('returns users when using custom user principalType', function() {
|
it('returns users when using custom user principalType', function() {
|
||||||
return userRole.principals.create(
|
return userRole.principals.create(
|
||||||
{principalType: OneUser.modelName, principalId: userFromOneModel.id}
|
{principalType: OneUser.modelName, principalId: userFromOneModel.id},
|
||||||
)
|
)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return userRole.users({where: {principalType: OneUser.modelName}});
|
return userRole.users({where: {principalType: OneUser.modelName}});
|
||||||
|
@ -298,7 +298,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
|
|
||||||
it('returns empty array when using invalid principalType', function() {
|
it('returns empty array when using invalid principalType', function() {
|
||||||
return userRole.principals.create(
|
return userRole.principals.create(
|
||||||
{principalType: 'invalidModelName', principalId: userFromOneModel.id}
|
{principalType: 'invalidModelName', principalId: userFromOneModel.id},
|
||||||
)
|
)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return userRole.users({where: {principalType: 'invalidModelName'}});
|
return userRole.users({where: {principalType: 'invalidModelName'}});
|
||||||
|
@ -312,7 +312,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
describe('principal.user()', function() {
|
describe('principal.user()', function() {
|
||||||
it('returns the correct user instance', function() {
|
it('returns the correct user instance', function() {
|
||||||
return userRole.principals.create(
|
return userRole.principals.create(
|
||||||
{principalType: OneUser.modelName, principalId: userFromOneModel.id}
|
{principalType: OneUser.modelName, principalId: userFromOneModel.id},
|
||||||
).then(function(principal) {
|
).then(function(principal) {
|
||||||
return principal.user();
|
return principal.user();
|
||||||
}).then(function(user) {
|
}).then(function(user) {
|
||||||
|
@ -322,7 +322,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
|
|
||||||
it('returns null when created with invalid principalType', function() {
|
it('returns null when created with invalid principalType', function() {
|
||||||
return userRole.principals.create(
|
return userRole.principals.create(
|
||||||
{principalType: 'invalidModelName', principalId: userFromOneModel.id}
|
{principalType: 'invalidModelName', principalId: userFromOneModel.id},
|
||||||
).then(function(principal) {
|
).then(function(principal) {
|
||||||
return principal.user();
|
return principal.user();
|
||||||
}).then(function(user) {
|
}).then(function(user) {
|
||||||
|
@ -346,7 +346,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
|
|
||||||
it('supports getRoles()', function() {
|
it('supports getRoles()', function() {
|
||||||
return Role.getRoles(
|
return Role.getRoles(
|
||||||
userOneBaseContext
|
userOneBaseContext,
|
||||||
).then(function(roles) {
|
).then(function(roles) {
|
||||||
expect(roles).to.eql([
|
expect(roles).to.eql([
|
||||||
Role.AUTHENTICATED,
|
Role.AUTHENTICATED,
|
||||||
|
@ -487,7 +487,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
// with any belongsTo relation allowing to resolve truthy
|
// with any belongsTo relation allowing to resolve truthy
|
||||||
const Message = createModelWithOptions(
|
const Message = createModelWithOptions(
|
||||||
'ModelWithAllRelations',
|
'ModelWithAllRelations',
|
||||||
{ownerRelations: true}
|
{ownerRelations: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
const messages = [
|
const messages = [
|
||||||
|
@ -587,7 +587,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
const Model = app.registry.createModel(
|
const Model = app.registry.createModel(
|
||||||
name,
|
name,
|
||||||
{content: String, senderType: String},
|
{content: String, senderType: String},
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
app.model(Model, {dataSource: 'db'});
|
app.model(Model, {dataSource: 'db'});
|
||||||
return Model;
|
return Model;
|
||||||
|
@ -616,7 +616,7 @@ describe('Multiple users with custom principalType', function() {
|
||||||
function onError(err) {
|
function onError(err) {
|
||||||
expect(err).to.have.property('statusCode', 400);
|
expect(err).to.have.property('statusCode', 400);
|
||||||
expect(err).to.have.property('code', 'INVALID_PRINCIPAL_TYPE');
|
expect(err).to.have.property('code', 'INVALID_PRINCIPAL_TYPE');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -661,11 +661,11 @@ describe('relations - integration', function() {
|
||||||
|
|
||||||
const product = app.registry.createModel(
|
const product = app.registry.createModel(
|
||||||
'product',
|
'product',
|
||||||
{id: 'string', name: 'string'}
|
{id: 'string', name: 'string'},
|
||||||
);
|
);
|
||||||
const category = app.registry.createModel(
|
const category = app.registry.createModel(
|
||||||
'category',
|
'category',
|
||||||
{id: 'string', name: 'string'}
|
{id: 'string', name: 'string'},
|
||||||
);
|
);
|
||||||
app.model(product, {dataSource: 'db'});
|
app.model(product, {dataSource: 'db'});
|
||||||
app.model(category, {dataSource: 'db'});
|
app.model(category, {dataSource: 'db'});
|
||||||
|
@ -786,13 +786,13 @@ describe('relations - integration', function() {
|
||||||
const group = app.registry.createModel(
|
const group = app.registry.createModel(
|
||||||
'group',
|
'group',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'groups'}
|
{plural: 'groups'},
|
||||||
);
|
);
|
||||||
app.model(group, {dataSource: 'db'});
|
app.model(group, {dataSource: 'db'});
|
||||||
|
|
||||||
const poster = app.registry.createModel(
|
const poster = app.registry.createModel(
|
||||||
'poster',
|
'poster',
|
||||||
{url: 'string'}
|
{url: 'string'},
|
||||||
);
|
);
|
||||||
app.model(poster, {dataSource: 'db'});
|
app.model(poster, {dataSource: 'db'});
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ describe('relations - integration', function() {
|
||||||
.send({url: 'http://image.url'})
|
.send({url: 'http://image.url'})
|
||||||
.expect(200, function(err, res) {
|
.expect(200, function(err, res) {
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{url: 'http://image.url'}
|
{url: 'http://image.url'},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -838,7 +838,7 @@ describe('relations - integration', function() {
|
||||||
|
|
||||||
expect(res.body.name).to.be.equal('Group 1');
|
expect(res.body.name).to.be.equal('Group 1');
|
||||||
expect(res.body.poster).to.be.eql(
|
expect(res.body.poster).to.be.eql(
|
||||||
{url: 'http://image.url'}
|
{url: 'http://image.url'},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -853,7 +853,7 @@ describe('relations - integration', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{url: 'http://image.url'}
|
{url: 'http://image.url'},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -880,7 +880,7 @@ describe('relations - integration', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{url: 'http://changed.url'}
|
{url: 'http://changed.url'},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -903,13 +903,13 @@ describe('relations - integration', function() {
|
||||||
const todoList = app.registry.createModel(
|
const todoList = app.registry.createModel(
|
||||||
'todoList',
|
'todoList',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'todo-lists'}
|
{plural: 'todo-lists'},
|
||||||
);
|
);
|
||||||
app.model(todoList, {dataSource: 'db'});
|
app.model(todoList, {dataSource: 'db'});
|
||||||
|
|
||||||
const todoItem = app.registry.createModel(
|
const todoItem = app.registry.createModel(
|
||||||
'todoItem',
|
'todoItem',
|
||||||
{content: 'string'}, {forceId: false}
|
{content: 'string'}, {forceId: false},
|
||||||
);
|
);
|
||||||
app.model(todoItem, {dataSource: 'db'});
|
app.model(todoItem, {dataSource: 'db'});
|
||||||
|
|
||||||
|
@ -1021,7 +1021,7 @@ describe('relations - integration', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{content: 'Todo 3', id: 3}
|
{content: 'Todo 3', id: 3},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -1090,19 +1090,19 @@ describe('relations - integration', function() {
|
||||||
before(function defineProductAndCategoryModels() {
|
before(function defineProductAndCategoryModels() {
|
||||||
const recipe = app.registry.createModel(
|
const recipe = app.registry.createModel(
|
||||||
'recipe',
|
'recipe',
|
||||||
{name: 'string'}
|
{name: 'string'},
|
||||||
);
|
);
|
||||||
app.model(recipe, {dataSource: 'db'});
|
app.model(recipe, {dataSource: 'db'});
|
||||||
|
|
||||||
const ingredient = app.registry.createModel(
|
const ingredient = app.registry.createModel(
|
||||||
'ingredient',
|
'ingredient',
|
||||||
{name: 'string'}
|
{name: 'string'},
|
||||||
);
|
);
|
||||||
app.model(ingredient, {dataSource: 'db'});
|
app.model(ingredient, {dataSource: 'db'});
|
||||||
|
|
||||||
const photo = app.registry.createModel(
|
const photo = app.registry.createModel(
|
||||||
'photo',
|
'photo',
|
||||||
{name: 'string'}
|
{name: 'string'},
|
||||||
);
|
);
|
||||||
app.model(photo, {dataSource: 'db'});
|
app.model(photo, {dataSource: 'db'});
|
||||||
|
|
||||||
|
@ -1259,7 +1259,7 @@ describe('relations - integration', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{name: 'Butter', id: test.ingredient3}
|
{name: 'Butter', id: test.ingredient3},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -1335,7 +1335,7 @@ describe('relations - integration', function() {
|
||||||
this.put(url)
|
this.put(url)
|
||||||
.expect(200, function(err, res) {
|
.expect(200, function(err, res) {
|
||||||
expect(res.body).to.be.eql(
|
expect(res.body).to.be.eql(
|
||||||
{name: 'Sugar', id: test.ingredient2}
|
{name: 'Sugar', id: test.ingredient2},
|
||||||
);
|
);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
@ -1445,35 +1445,35 @@ describe('relations - integration', function() {
|
||||||
const Book = app.registry.createModel(
|
const Book = app.registry.createModel(
|
||||||
'Book',
|
'Book',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'books'}
|
{plural: 'books'},
|
||||||
);
|
);
|
||||||
app.model(Book, {dataSource: 'db'});
|
app.model(Book, {dataSource: 'db'});
|
||||||
|
|
||||||
const Page = app.registry.createModel(
|
const Page = app.registry.createModel(
|
||||||
'Page',
|
'Page',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'pages'}
|
{plural: 'pages'},
|
||||||
);
|
);
|
||||||
app.model(Page, {dataSource: 'db'});
|
app.model(Page, {dataSource: 'db'});
|
||||||
|
|
||||||
const Image = app.registry.createModel(
|
const Image = app.registry.createModel(
|
||||||
'Image',
|
'Image',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'images'}
|
{plural: 'images'},
|
||||||
);
|
);
|
||||||
app.model(Image, {dataSource: 'db'});
|
app.model(Image, {dataSource: 'db'});
|
||||||
|
|
||||||
const Note = app.registry.createModel(
|
const Note = app.registry.createModel(
|
||||||
'Note',
|
'Note',
|
||||||
{text: 'string'},
|
{text: 'string'},
|
||||||
{plural: 'notes'}
|
{plural: 'notes'},
|
||||||
);
|
);
|
||||||
app.model(Note, {dataSource: 'db'});
|
app.model(Note, {dataSource: 'db'});
|
||||||
|
|
||||||
const Chapter = app.registry.createModel(
|
const Chapter = app.registry.createModel(
|
||||||
'Chapter',
|
'Chapter',
|
||||||
{name: 'string'},
|
{name: 'string'},
|
||||||
{plural: 'chapters'}
|
{plural: 'chapters'},
|
||||||
);
|
);
|
||||||
app.model(Chapter, {dataSource: 'db'});
|
app.model(Chapter, {dataSource: 'db'});
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ describe('Replication over REST', function() {
|
||||||
const conflict = new LocalConflict(
|
const conflict = new LocalConflict(
|
||||||
conflictedCarId,
|
conflictedCarId,
|
||||||
LocalCar,
|
LocalCar,
|
||||||
RemoteCar
|
RemoteCar,
|
||||||
);
|
);
|
||||||
conflict.resolveUsingSource(expectHttpError(401, done));
|
conflict.resolveUsingSource(expectHttpError(401, done));
|
||||||
});
|
});
|
||||||
|
@ -202,7 +202,7 @@ describe('Replication over REST', function() {
|
||||||
const conflict = new RemoteConflict(
|
const conflict = new RemoteConflict(
|
||||||
conflictedCarId,
|
conflictedCarId,
|
||||||
RemoteCar,
|
RemoteCar,
|
||||||
LocalCar
|
LocalCar,
|
||||||
);
|
);
|
||||||
conflict.resolveUsingSource(expectHttpError(401, done));
|
conflict.resolveUsingSource(expectHttpError(401, done));
|
||||||
});
|
});
|
||||||
|
@ -218,7 +218,7 @@ describe('Replication over REST', function() {
|
||||||
const conflict = new LocalConflict(
|
const conflict = new LocalConflict(
|
||||||
conflictedCarId,
|
conflictedCarId,
|
||||||
LocalCar,
|
LocalCar,
|
||||||
RemoteCar
|
RemoteCar,
|
||||||
);
|
);
|
||||||
conflict.resolveUsingSource(done);
|
conflict.resolveUsingSource(done);
|
||||||
});
|
});
|
||||||
|
@ -228,7 +228,7 @@ describe('Replication over REST', function() {
|
||||||
const conflict = new RemoteConflict(
|
const conflict = new RemoteConflict(
|
||||||
conflictedCarId,
|
conflictedCarId,
|
||||||
RemoteCar,
|
RemoteCar,
|
||||||
LocalCar
|
LocalCar,
|
||||||
);
|
);
|
||||||
conflict.resolveUsingSource(expectHttpError(401, done));
|
conflict.resolveUsingSource(expectHttpError(401, done));
|
||||||
});
|
});
|
||||||
|
@ -407,7 +407,7 @@ describe('Replication over REST', function() {
|
||||||
LocalUser.updateAll(
|
LocalUser.updateAll(
|
||||||
{id: aliceId},
|
{id: aliceId},
|
||||||
{fullname: 'Alice Smith'},
|
{fullname: 'Alice Smith'},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -611,7 +611,7 @@ describe('Replication over REST', function() {
|
||||||
serverCars = cars.map(carToString);
|
serverCars = cars.map(carToString);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
|
@ -631,7 +631,7 @@ describe('Replication over REST', function() {
|
||||||
clientCars = cars.map(carToString);
|
clientCars = cars.map(carToString);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe('Replication / Change APIs', function() {
|
||||||
SourceModel = this.SourceModel = PersistedModel.extend(
|
SourceModel = this.SourceModel = PersistedModel.extend(
|
||||||
'SourceModel-' + tid,
|
'SourceModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
SourceModel.attachTo(dataSource);
|
SourceModel.attachTo(dataSource);
|
||||||
|
@ -38,7 +38,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel = this.TargetModel = PersistedModel.extend(
|
TargetModel = this.TargetModel = PersistedModel.extend(
|
||||||
'TargetModel-' + tid,
|
'TargetModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
// NOTE(bajtos) At the moment, all models share the same Checkpoint
|
// NOTE(bajtos) At the moment, all models share the same Checkpoint
|
||||||
|
@ -85,7 +85,7 @@ describe('Replication / Change APIs', function() {
|
||||||
Model = this.Model = PersistedModel.extend(
|
Model = this.Model = PersistedModel.extend(
|
||||||
'Model-' + tid,
|
'Model-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true, changeCleanupInterval: -1}
|
{trackChanges: true, changeCleanupInterval: -1},
|
||||||
);
|
);
|
||||||
|
|
||||||
Model.attachTo(dataSource);
|
Model.attachTo(dataSource);
|
||||||
|
@ -105,7 +105,7 @@ describe('Replication / Change APIs', function() {
|
||||||
Model = this.Model = PersistedModel.extend(
|
Model = this.Model = PersistedModel.extend(
|
||||||
'Model-' + tid,
|
'Model-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true, changeCleanupInterval: 10000}
|
{trackChanges: true, changeCleanupInterval: 10000},
|
||||||
);
|
);
|
||||||
|
|
||||||
Model.attachTo(dataSource);
|
Model.attachTo(dataSource);
|
||||||
|
@ -542,7 +542,7 @@ describe('Replication / Change APIs', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
|
@ -586,7 +586,7 @@ describe('Replication / Change APIs', function() {
|
||||||
expect(changes).to.have.length(0);
|
expect(changes).to.have.length(0);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -609,7 +609,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
'1',
|
'1',
|
||||||
{name: '3rd-party'},
|
{name: '3rd-party'},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 2.x connectors require `options`
|
// 2.x connectors require `options`
|
||||||
|
@ -618,7 +618,7 @@ describe('Replication / Change APIs', function() {
|
||||||
'1',
|
'1',
|
||||||
{name: '3rd-party'},
|
{name: '3rd-party'},
|
||||||
{}, // options
|
{}, // options
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -633,7 +633,7 @@ describe('Replication / Change APIs', function() {
|
||||||
|
|
||||||
// resolve the conflict using ours
|
// resolve the conflict using ours
|
||||||
conflicts[0].resolve(next);
|
conflicts[0].resolve(next);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ describe('Replication / Change APIs', function() {
|
||||||
connector.create(
|
connector.create(
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
{id: '1', name: '3rd-party'},
|
{id: '1', name: '3rd-party'},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 2.x connectors require `options`
|
// 2.x connectors require `options`
|
||||||
|
@ -662,7 +662,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
{id: '1', name: '3rd-party'},
|
{id: '1', name: '3rd-party'},
|
||||||
{}, // options
|
{}, // options
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -677,7 +677,7 @@ describe('Replication / Change APIs', function() {
|
||||||
|
|
||||||
// resolve the conflict using ours
|
// resolve the conflict using ours
|
||||||
conflicts[0].resolve(next);
|
conflicts[0].resolve(next);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
'1',
|
'1',
|
||||||
{name: '3rd-party'},
|
{name: '3rd-party'},
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 2.x connectors require `options`
|
// 2.x connectors require `options`
|
||||||
|
@ -710,7 +710,7 @@ describe('Replication / Change APIs', function() {
|
||||||
'1',
|
'1',
|
||||||
{name: '3rd-party'},
|
{name: '3rd-party'},
|
||||||
{}, // options
|
{}, // options
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -725,7 +725,7 @@ describe('Replication / Change APIs', function() {
|
||||||
|
|
||||||
// resolve the conflict using ours
|
// resolve the conflict using ours
|
||||||
conflicts[0].resolve(next);
|
conflicts[0].resolve(next);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ describe('Replication / Change APIs', function() {
|
||||||
connector.destroy(
|
connector.destroy(
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
'1',
|
'1',
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// 2.x connectors require `options`
|
// 2.x connectors require `options`
|
||||||
|
@ -756,7 +756,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel.modelName,
|
TargetModel.modelName,
|
||||||
'1',
|
'1',
|
||||||
{}, // options
|
{}, // options
|
||||||
cb
|
cb,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1078,7 +1078,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function(err) {
|
function(err) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
assertChangeRecordedForId(inst.id, done);
|
assertChangeRecordedForId(inst.id, done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1116,7 +1116,7 @@ describe('Replication / Change APIs', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
assertChangeRecordedForId(inst.id, done);
|
assertChangeRecordedForId(inst.id, done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1153,7 +1153,7 @@ describe('Replication / Change APIs', function() {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
|
|
||||||
assertChangeRecordedForId(inst.id, done);
|
assertChangeRecordedForId(inst.id, done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1249,7 +1249,7 @@ describe('Replication / Change APIs', function() {
|
||||||
AnotherModel = this.AnotherModel = PersistedModel.extend(
|
AnotherModel = this.AnotherModel = PersistedModel.extend(
|
||||||
'AnotherModel-' + tid,
|
'AnotherModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
// NOTE(bajtos) At the moment, all models share the same Checkpoint
|
// NOTE(bajtos) At the moment, all models share the same Checkpoint
|
||||||
|
@ -1409,7 +1409,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function resolveUsingOurs(conflict, cb) {
|
function resolveUsingOurs(conflict, cb) {
|
||||||
conflict.resolveUsingSource(cb);
|
conflict.resolveUsingSource(cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1421,7 +1421,7 @@ describe('Replication / Change APIs', function() {
|
||||||
.to.equal(ClientB.modelName);
|
.to.equal(ClientB.modelName);
|
||||||
conflict.resolveUsingTarget(cb);
|
conflict.resolveUsingTarget(cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function resolveManually(conflict, cb) {
|
function resolveManually(conflict, cb) {
|
||||||
conflict.resolveManually({name: 'manual'}, cb);
|
conflict.resolveManually({name: 'manual'}, cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1439,7 +1439,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function resolveUsingOurs(conflict, cb) {
|
function resolveUsingOurs(conflict, cb) {
|
||||||
conflict.resolveUsingSource(cb);
|
conflict.resolveUsingSource(cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ describe('Replication / Change APIs', function() {
|
||||||
.to.equal(ClientB.modelName);
|
.to.equal(ClientB.modelName);
|
||||||
conflict.resolveUsingTarget(cb);
|
conflict.resolveUsingTarget(cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1460,7 +1460,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function resolveManually(conflict, cb) {
|
function resolveManually(conflict, cb) {
|
||||||
conflict.resolveManually(null, cb);
|
conflict.resolveManually(null, cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1469,7 +1469,7 @@ describe('Replication / Change APIs', function() {
|
||||||
function resolveManually(conflict, cb) {
|
function resolveManually(conflict, cb) {
|
||||||
conflict.resolveManually({name: 'manual'}, cb);
|
conflict.resolveManually({name: 'manual'}, cb);
|
||||||
},
|
},
|
||||||
done
|
done,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1613,7 +1613,7 @@ describe('Replication / Change APIs', function() {
|
||||||
OptionsSourceModel = PersistedModel.extend(
|
OptionsSourceModel = PersistedModel.extend(
|
||||||
'OptionsSourceModel-' + tid,
|
'OptionsSourceModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
OptionsSourceModel.attachTo(dataSource);
|
OptionsSourceModel.attachTo(dataSource);
|
||||||
|
@ -1698,7 +1698,7 @@ describe('Replication / Change APIs', function() {
|
||||||
SourceModel = this.SourceModel = PersistedModel.extend(
|
SourceModel = this.SourceModel = PersistedModel.extend(
|
||||||
'SourceModel-' + tid,
|
'SourceModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true, replicationChunkSize: 1}
|
{trackChanges: true, replicationChunkSize: 1},
|
||||||
);
|
);
|
||||||
|
|
||||||
SourceModel.attachTo(dataSource);
|
SourceModel.attachTo(dataSource);
|
||||||
|
@ -1706,7 +1706,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel = this.TargetModel = PersistedModel.extend(
|
TargetModel = this.TargetModel = PersistedModel.extend(
|
||||||
'TargetModel-' + tid,
|
'TargetModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true, replicationChunkSize: 1}
|
{trackChanges: true, replicationChunkSize: 1},
|
||||||
);
|
);
|
||||||
|
|
||||||
const TargetChange = TargetModel.Change;
|
const TargetChange = TargetModel.Change;
|
||||||
|
@ -1746,7 +1746,7 @@ describe('Replication / Change APIs', function() {
|
||||||
SourceModel = this.SourceModel = PersistedModel.extend(
|
SourceModel = this.SourceModel = PersistedModel.extend(
|
||||||
'SourceModel-' + tid,
|
'SourceModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
SourceModel.attachTo(dataSource);
|
SourceModel.attachTo(dataSource);
|
||||||
|
@ -1754,7 +1754,7 @@ describe('Replication / Change APIs', function() {
|
||||||
TargetModel = this.TargetModel = PersistedModel.extend(
|
TargetModel = this.TargetModel = PersistedModel.extend(
|
||||||
'TargetModel-' + tid,
|
'TargetModel-' + tid,
|
||||||
{id: {id: true, type: String, defaultFn: 'guid'}},
|
{id: {id: true, type: String, defaultFn: 'guid'}},
|
||||||
{trackChanges: true}
|
{trackChanges: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
const TargetChange = TargetModel.Change;
|
const TargetChange = TargetModel.Change;
|
||||||
|
@ -1960,7 +1960,7 @@ describe('Replication / Change APIs with custom change properties', function() {
|
||||||
{
|
{
|
||||||
trackChanges: true,
|
trackChanges: true,
|
||||||
additionalChangeModelProperties: {customProperty: {type: 'string'}},
|
additionalChangeModelProperties: {customProperty: {type: 'string'}},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
SourceModel.createChangeFilter = function(since, modelFilter) {
|
SourceModel.createChangeFilter = function(since, modelFilter) {
|
||||||
|
@ -1991,7 +1991,7 @@ describe('Replication / Change APIs with custom change properties', function() {
|
||||||
{
|
{
|
||||||
trackChanges: true,
|
trackChanges: true,
|
||||||
additionalChangeModelProperties: {customProperty: {type: 'string'}},
|
additionalChangeModelProperties: {customProperty: {type: 'string'}},
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const ChangeModelForTarget = TargetModel.Change;
|
const ChangeModelForTarget = TargetModel.Change;
|
||||||
|
@ -2031,7 +2031,7 @@ describe('Replication / Change APIs with custom change properties', function() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2043,7 +2043,7 @@ describe('Replication / Change APIs with custom change properties', function() {
|
||||||
expect(changes).to.have.length(1);
|
expect(changes).to.have.length(1);
|
||||||
expect(changes[0]).to.have.property('customProperty', '123');
|
expect(changes[0]).to.have.property('customProperty', '123');
|
||||||
done();
|
done();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ describe('role-mapping model', function() {
|
||||||
expect(user.id).to.equal(oneUser.id);
|
expect(user.id).to.equal(oneUser.id);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ describe('role-mapping model', function() {
|
||||||
expect(app.id).to.equal(anApp.id);
|
expect(app.id).to.equal(anApp.id);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ describe('role-mapping model', function() {
|
||||||
expect(role.id).to.equal(aRole.id);
|
expect(role.id).to.equal(aRole.id);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ describe('role model', function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -224,7 +224,7 @@ describe('role model', function() {
|
||||||
// but the matchin role object instead
|
// but the matchin role object instead
|
||||||
assert(!!inRole);
|
assert(!!inRole);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -235,7 +235,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(!inRole);
|
assert(!inRole);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -246,7 +246,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(!inRole);
|
assert(!inRole);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -260,7 +260,7 @@ describe('role model', function() {
|
||||||
role.id,
|
role.id,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -275,7 +275,7 @@ describe('role model', function() {
|
||||||
role.name,
|
role.name,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -288,7 +288,7 @@ describe('role model', function() {
|
||||||
Role.EVERYONE,
|
Role.EVERYONE,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -301,7 +301,7 @@ describe('role model', function() {
|
||||||
Role.EVERYONE,
|
Role.EVERYONE,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -314,7 +314,7 @@ describe('role model', function() {
|
||||||
Role.EVERYONE,
|
Role.EVERYONE,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
|
@ -400,7 +400,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(!!inRole);
|
assert(!!inRole);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -411,7 +411,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(!inRole);
|
assert(!inRole);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -425,7 +425,7 @@ describe('role model', function() {
|
||||||
role.id,
|
role.id,
|
||||||
]);
|
]);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
], done);
|
], done);
|
||||||
|
@ -469,7 +469,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(yes);
|
assert(yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -480,7 +480,7 @@ describe('role model', function() {
|
||||||
if (err) next(err);
|
if (err) next(err);
|
||||||
assert(yes);
|
assert(yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -491,7 +491,7 @@ describe('role model', function() {
|
||||||
if (err) next(err);
|
if (err) next(err);
|
||||||
assert(!yes);
|
assert(!yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -502,7 +502,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(!yes);
|
assert(!yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -513,7 +513,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(yes);
|
assert(yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -524,7 +524,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(yes);
|
assert(yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -535,7 +535,7 @@ describe('role model', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
assert(yes);
|
assert(yes);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -668,7 +668,7 @@ describe('role model', function() {
|
||||||
},
|
},
|
||||||
// passing {ownerRelations: true} will enable the new $owner role resolver
|
// passing {ownerRelations: true} will enable the new $owner role resolver
|
||||||
// and hence resolve false when no belongsTo relation is defined
|
// and hence resolve false when no belongsTo relation is defined
|
||||||
{ownerRelations: true}
|
{ownerRelations: true},
|
||||||
);
|
);
|
||||||
app.model(Album, {dataSource: 'db'});
|
app.model(Album, {dataSource: 'db'});
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ describe('role model', function() {
|
||||||
// with any belongsTo relation allowing to resolve truthy
|
// with any belongsTo relation allowing to resolve truthy
|
||||||
const Message = givenModelWithSenderReceiverRelations(
|
const Message = givenModelWithSenderReceiverRelations(
|
||||||
'ModelWithAllRelations',
|
'ModelWithAllRelations',
|
||||||
{ownerRelations: true}
|
{ownerRelations: true},
|
||||||
);
|
);
|
||||||
|
|
||||||
return givenUsers()
|
return givenUsers()
|
||||||
|
@ -729,7 +729,7 @@ describe('role model', function() {
|
||||||
// with a specified list of belongsTo relations allowing to resolve truthy
|
// with a specified list of belongsTo relations allowing to resolve truthy
|
||||||
const Message = givenModelWithSenderReceiverRelations(
|
const Message = givenModelWithSenderReceiverRelations(
|
||||||
'ModelWithCoercedRelations',
|
'ModelWithCoercedRelations',
|
||||||
{ownerRelations: ['receiver']}
|
{ownerRelations: ['receiver']},
|
||||||
);
|
);
|
||||||
|
|
||||||
return givenUsers()
|
return givenUsers()
|
||||||
|
@ -806,7 +806,7 @@ describe('role model', function() {
|
||||||
const Model = app.registry.createModel(
|
const Model = app.registry.createModel(
|
||||||
name,
|
name,
|
||||||
{content: String},
|
{content: String},
|
||||||
options
|
options,
|
||||||
);
|
);
|
||||||
app.model(Model, {dataSource: 'db'});
|
app.model(Model, {dataSource: 'db'});
|
||||||
return Model;
|
return Model;
|
||||||
|
@ -1091,7 +1091,7 @@ describe('role model', function() {
|
||||||
function(err, p) {
|
function(err, p) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
callback(p);
|
callback(p);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(callback) {
|
function(callback) {
|
||||||
|
@ -1100,7 +1100,7 @@ describe('role model', function() {
|
||||||
function(err, p) {
|
function(err, p) {
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
callback(p);
|
callback(p);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}],
|
}],
|
||||||
function(err, principles) {
|
function(err, principles) {
|
||||||
|
|
|
@ -88,7 +88,7 @@ describe('User.password', () => {
|
||||||
},
|
},
|
||||||
function onError(err) {
|
function onError(err) {
|
||||||
expect(err.message).to.match(/Invalid use.*options.setPassword/);
|
expect(err.message).to.match(/Invalid use.*options.setPassword/);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ describe('User.password', () => {
|
||||||
function patchNameAndPasswordDirectly() {
|
function patchNameAndPasswordDirectly() {
|
||||||
return testUser.patchAttributes(
|
return testUser.patchAttributes(
|
||||||
{password: 'new-pass', name: 'New Name'},
|
{password: 'new-pass', name: 'New Name'},
|
||||||
{setPassword: true}
|
{setPassword: true},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -96,7 +96,7 @@ describe('User', function() {
|
||||||
// create 2 users: with and without verified email
|
// create 2 users: with and without verified email
|
||||||
return Promise.map(
|
return Promise.map(
|
||||||
[validCredentials, validCredentialsEmailVerified],
|
[validCredentials, validCredentialsEmailVerified],
|
||||||
credentials => User.create(credentials)
|
credentials => User.create(credentials),
|
||||||
).then(users => {
|
).then(users => {
|
||||||
validCredentialsUser = user = users[0];
|
validCredentialsUser = user = users[0];
|
||||||
validCredentialsEmailVerifiedUser = users[1];
|
validCredentialsEmailVerifiedUser = users[1];
|
||||||
|
@ -147,7 +147,7 @@ describe('User', function() {
|
||||||
expect(err.statusCode).to.equal(422);
|
expect(err.statusCode).to.equal(422);
|
||||||
expect(err.details.context).to.equal(User.modelName);
|
expect(err.details.context).to.equal(User.modelName);
|
||||||
expect(err.details.codes.email).to.deep.equal(['presence']);
|
expect(err.details.codes.email).to.deep.equal(['presence']);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ describe('User', function() {
|
||||||
expect(err.statusCode).to.equal(422);
|
expect(err.statusCode).to.equal(422);
|
||||||
expect(err.details.context).to.equal(User.modelName);
|
expect(err.details.context).to.equal(User.modelName);
|
||||||
expect(err.details.codes.email).to.deep.equal(['presence']);
|
expect(err.details.codes.email).to.deep.equal(['presence']);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ describe('User', function() {
|
||||||
code: 'PASSWORD_TOO_LONG',
|
code: 'PASSWORD_TOO_LONG',
|
||||||
statusCode: 422,
|
statusCode: 422,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ describe('User', function() {
|
||||||
code: 'PASSWORD_TOO_LONG',
|
code: 'PASSWORD_TOO_LONG',
|
||||||
statusCode: 422,
|
statusCode: 422,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1014,7 +1014,7 @@ describe('User', function() {
|
||||||
userId: validCredentialsUser.pk,
|
userId: validCredentialsUser.pk,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1498,7 +1498,7 @@ describe('User', function() {
|
||||||
code: 'INVALID_PASSWORD',
|
code: 'INVALID_PASSWORD',
|
||||||
statusCode: 400,
|
statusCode: 400,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1514,7 +1514,7 @@ describe('User', function() {
|
||||||
code: 'USER_NOT_FOUND',
|
code: 'USER_NOT_FOUND',
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1602,7 +1602,7 @@ describe('User', function() {
|
||||||
code: 'USER_NOT_FOUND',
|
code: 'USER_NOT_FOUND',
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2639,7 +2639,7 @@ describe('User', function() {
|
||||||
function(err, userInstance) {
|
function(err, userInstance) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
assertNoAccessTokens(done);
|
assertNoAccessTokens(done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2757,7 +2757,7 @@ describe('User', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
userPartial = partialInstance;
|
userPartial = partialInstance;
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function loginPartiallUser(next) {
|
function loginPartiallUser(next) {
|
||||||
|
@ -2773,7 +2773,7 @@ describe('User', function() {
|
||||||
function(err, info) {
|
function(err, info) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function verifyTokensOfPartialUser(next) {
|
function verifyTokensOfPartialUser(next) {
|
||||||
|
@ -2793,7 +2793,7 @@ describe('User', function() {
|
||||||
function(err, userInstance) {
|
function(err, userInstance) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
assertPreservedTokens(done);
|
assertPreservedTokens(done);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2829,9 +2829,9 @@ describe('User', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -2870,7 +2870,7 @@ describe('User', function() {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
userSpecial = specialInstance;
|
userSpecial = specialInstance;
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function loginSpecialUser(next) {
|
function loginSpecialUser(next) {
|
||||||
|
@ -2885,7 +2885,7 @@ describe('User', function() {
|
||||||
{email: 'superspecial@example.com'}, function(err, info) {
|
{email: 'superspecial@example.com'}, function(err, info) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
next();
|
next();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function verifyTokensOfSpecialUser(next) {
|
function verifyTokensOfSpecialUser(next) {
|
||||||
|
|
Loading…
Reference in New Issue