Globalize current-context deprecation messages
This commit is contained in:
parent
ca28e7ff9e
commit
b08a1cfba3
|
@ -7,6 +7,7 @@ var juggler = require('loopback-datasource-juggler');
|
|||
var remoting = require('strong-remoting');
|
||||
var LoopBackContext = require('loopback-context');
|
||||
var deprecated = require('depd')('loopback');
|
||||
var g = require('strong-globalize')();
|
||||
|
||||
module.exports = function(loopback) {
|
||||
|
||||
|
@ -20,9 +21,9 @@ module.exports = function(loopback) {
|
|||
// NOTE(bajtos) LoopBackContext.getCurrentContext is overriden whenever
|
||||
// the context changes, therefore we cannot simply assign
|
||||
// LoopBackContext.getCurrentContext() to loopback.getCurrentContext()
|
||||
deprecated('loopback.getCurrentContext() is deprecated. See ' +
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' +
|
||||
'for more details.');
|
||||
deprecated(g.f('%s is deprecated. See %s for more details.',
|
||||
'loopback.getCurrentContext()',
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
|
||||
return LoopBackContext.getCurrentContext();
|
||||
};
|
||||
|
||||
|
@ -45,9 +46,9 @@ module.exports = function(loopback) {
|
|||
* When no value is provided, then the default global context is used.
|
||||
*/
|
||||
loopback.runInContext = function(fn, ctx) {
|
||||
deprecated('loopback.runInContext() is deprecated. See ' +
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' +
|
||||
'for more details.');
|
||||
deprecated(g.f('%s is deprecated. See %s for more details.',
|
||||
'loopback.runInContext()',
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
|
||||
return LoopBackContext.runInContext(fn, ctx);
|
||||
};
|
||||
|
||||
|
@ -69,9 +70,9 @@ module.exports = function(loopback) {
|
|||
* @return {ChainedContext} The new context object.
|
||||
*/
|
||||
loopback.createContext = function(scopeName) {
|
||||
deprecated('loopback.createContext() is deprecated. See ' +
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' +
|
||||
'for more details.');
|
||||
deprecated(g.f('%s is deprecated. See %s for more details.',
|
||||
'loopback.createContext()',
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
|
||||
return LoopBackContext.createContext(scopeName);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
// License text available at https://opensource.org/licenses/MIT
|
||||
|
||||
var deprecated = require('depd')('loopback');
|
||||
var g = require('strong-globalize')();
|
||||
var perRequestContext = require('loopback-context').perRequest;
|
||||
|
||||
module.exports = function() {
|
||||
deprecated('loopback#context middleware is deprecated. See ' +
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context ' +
|
||||
'for more details.');
|
||||
deprecated(g.f('%s middleware is deprecated. See %s for more details.',
|
||||
'loopback#context',
|
||||
'https://docs.strongloop.com/display/APIC/Using%20current%20context'));
|
||||
return perRequestContext.apply(this, arguments);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue