zipkin-context-cls
Advanced tools
Comparing version 0.14.2 to 0.15.0
@@ -1,7 +0,9 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
var _require = require('continuation-local-storage'), | ||
@@ -11,3 +13,5 @@ createNamespace = _require.createNamespace, | ||
module.exports = function () { | ||
module.exports = | ||
/*#__PURE__*/ | ||
function () { | ||
function CLSContext() { | ||
@@ -19,3 +23,5 @@ var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'zipkin'; | ||
this._session = getNamespace(namespace) || createNamespace(namespace); | ||
var defaultContext = this._session.createContext(); | ||
this._session.enter(defaultContext); | ||
@@ -25,3 +31,3 @@ } | ||
_createClass(CLSContext, [{ | ||
key: 'setContext', | ||
key: "setContext", | ||
value: function setContext(ctx) { | ||
@@ -31,5 +37,6 @@ this._session.set('zipkin', ctx); | ||
}, { | ||
key: 'getContext', | ||
key: "getContext", | ||
value: function getContext() { | ||
var currentCtx = this._session.get('zipkin'); | ||
if (currentCtx != null) { | ||
@@ -42,12 +49,14 @@ return currentCtx; | ||
}, { | ||
key: 'scoped', | ||
key: "scoped", | ||
value: function scoped(callable) { | ||
var result = void 0; | ||
var result; | ||
this._session.run(function () { | ||
result = callable(); | ||
}); | ||
return result; | ||
} | ||
}, { | ||
key: 'letContext', | ||
key: "letContext", | ||
value: function letContext(ctx, callable) { | ||
@@ -58,2 +67,3 @@ var _this = this; | ||
_this.setContext(ctx); | ||
return callable(); | ||
@@ -60,0 +70,0 @@ }); |
{ | ||
"name": "zipkin-context-cls", | ||
"version": "0.14.2", | ||
"version": "0.15.0", | ||
"description": "A Context API implementation that uses continuation-local-storage under the hood", | ||
@@ -8,3 +8,3 @@ "main": "lib/CLSContext.js", | ||
"build": "babel src -d lib", | ||
"test": "mocha --require ../../test/helper.js", | ||
"test": "mocha --exit --require ../../test/helper.js", | ||
"prepublish": "npm run build" | ||
@@ -19,5 +19,7 @@ }, | ||
"devDependencies": { | ||
"babel-cli": "^6.23.0", | ||
"mocha": "^3.2.0" | ||
} | ||
"@babel/cli": "7.1.5", | ||
"@babel/core": "7.1.5", | ||
"mocha": "^5.2.0" | ||
}, | ||
"gitHead": "efd22b807a6d6056a319d9468231480e7a58a402" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7591
7
142
3