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