@opentelemetry/context-async-hooks
Advanced tools
Comparing version 0.10.3-canary.0 to 0.11.0
@@ -20,2 +20,3 @@ "use strict"; | ||
const events_1 = require("events"); | ||
const kOtListeners = Symbol('OtListeners'); | ||
const ADD_LISTENER_METHODS = [ | ||
@@ -65,5 +66,5 @@ 'addListener', | ||
const ee = target; | ||
if (ee.__ot_listeners !== undefined) | ||
if (ee[kOtListeners] !== undefined) | ||
return target; | ||
ee.__ot_listeners = {}; | ||
ee[kOtListeners] = {}; | ||
// patch methods that add a listener to propagate context | ||
@@ -96,7 +97,7 @@ ADD_LISTENER_METHODS.forEach(methodName => { | ||
return function (event, listener) { | ||
if (ee.__ot_listeners === undefined || | ||
ee.__ot_listeners[event] === undefined) { | ||
var _a; | ||
const events = (_a = ee[kOtListeners]) === null || _a === void 0 ? void 0 : _a[event]; | ||
if (events === undefined) { | ||
return original.call(this, event, listener); | ||
} | ||
const events = ee.__ot_listeners[event]; | ||
const patchedListener = events.get(listener); | ||
@@ -114,7 +115,6 @@ return original.call(this, event, patchedListener || listener); | ||
return function (event) { | ||
if (ee.__ot_listeners === undefined || | ||
ee.__ot_listeners[event] === undefined) { | ||
return original.call(this, event); | ||
var _a; | ||
if (((_a = ee[kOtListeners]) === null || _a === void 0 ? void 0 : _a[event]) !== undefined) { | ||
delete ee[kOtListeners][event]; | ||
} | ||
delete ee.__ot_listeners[event]; | ||
return original.call(this, event); | ||
@@ -133,8 +133,8 @@ }; | ||
return function (event, listener) { | ||
if (ee.__ot_listeners === undefined) | ||
ee.__ot_listeners = {}; | ||
let listeners = ee.__ot_listeners[event]; | ||
if (ee[kOtListeners] === undefined) | ||
ee[kOtListeners] = {}; | ||
let listeners = ee[kOtListeners][event]; | ||
if (listeners === undefined) { | ||
listeners = new WeakMap(); | ||
ee.__ot_listeners[event] = listeners; | ||
ee[kOtListeners][event] = listeners; | ||
} | ||
@@ -141,0 +141,0 @@ const patchedListener = contextManager.bind(listener, context); |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.10.3-canary.0+f4f2f84"; | ||
export declare const VERSION = "0.11.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.10.3-canary.0+f4f2f84'; | ||
exports.VERSION = '0.11.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/context-async-hooks", | ||
"version": "0.10.3-canary.0+f4f2f84", | ||
"version": "0.11.0", | ||
"description": "OpenTelemetry AsyncHooks-based Context Manager", | ||
@@ -45,3 +45,3 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@types/mocha": "8.0.0", | ||
"@types/mocha": "8.0.2", | ||
"@types/node": "14.0.27", | ||
@@ -59,5 +59,5 @@ "@types/shimmer": "1.0.1", | ||
"dependencies": { | ||
"@opentelemetry/context-base": "^0.10.3-canary.0+f4f2f84" | ||
"@opentelemetry/context-base": "^0.11.0" | ||
}, | ||
"gitHead": "f4f2f84bc087389b3206a2e17837b7b0b95fb2f2" | ||
"gitHead": "15174c6647ab9863dfc1424412fa60f2fddb3351" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
39977
+ Added@opentelemetry/context-base@0.11.0(transitive)
- Removed@opentelemetry/context-base@0.10.3-canary.0(transitive)