@opentelemetry/context-base
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -19,3 +19,3 @@ "use strict"; | ||
*/ | ||
class Context { | ||
var Context = /** @class */ (function () { | ||
/** | ||
@@ -26,9 +26,9 @@ * Construct a new context which inherits values from an optional parent context. | ||
*/ | ||
constructor(parentContext) { | ||
function Context(parentContext) { | ||
this._currentContext = parentContext ? new Map(parentContext) : new Map(); | ||
} | ||
/** Get a key to uniquely identify a context value */ | ||
static createKey(description) { | ||
Context.createKey = function (description) { | ||
return Symbol(description); | ||
} | ||
}; | ||
/** | ||
@@ -39,5 +39,5 @@ * Get a value from the context. | ||
*/ | ||
getValue(key) { | ||
Context.prototype.getValue = function (key) { | ||
return this._currentContext.get(key); | ||
} | ||
}; | ||
/** | ||
@@ -50,7 +50,7 @@ * Create a new context which inherits from this context and has | ||
*/ | ||
setValue(key, value) { | ||
const context = new Context(this._currentContext); | ||
Context.prototype.setValue = function (key, value) { | ||
var context = new Context(this._currentContext); | ||
context._currentContext.set(key, value); | ||
return context; | ||
} | ||
}; | ||
/** | ||
@@ -62,18 +62,19 @@ * Return a new context which inherits from this context but does | ||
*/ | ||
deleteValue(key) { | ||
const context = new Context(this._currentContext); | ||
Context.prototype.deleteValue = function (key) { | ||
var context = new Context(this._currentContext); | ||
context._currentContext.delete(key); | ||
return context; | ||
} | ||
} | ||
}; | ||
/** The root context is used as the default parent context when there is no active context */ | ||
Context.ROOT_CONTEXT = new Context(); | ||
/** | ||
* This is another identifier to the root context which allows developers to easily search the | ||
* codebase for direct uses of context which need to be removed in later PRs. | ||
* | ||
* It's existence is temporary and it should be removed when all references are fixed. | ||
*/ | ||
Context.TODO = Context.ROOT_CONTEXT; | ||
return Context; | ||
}()); | ||
exports.Context = Context; | ||
/** The root context is used as the default parent context when there is no active context */ | ||
Context.ROOT_CONTEXT = new Context(); | ||
/** | ||
* This is another identifier to the root context which allows developers to easily search the | ||
* codebase for direct uses of context which need to be removed in later PRs. | ||
* | ||
* It's existence is temporary and it should be removed when all references are fixed. | ||
*/ | ||
Context.TODO = Context.ROOT_CONTEXT; | ||
//# sourceMappingURL=context.js.map |
@@ -19,21 +19,24 @@ "use strict"; | ||
exports.NoopContextManager = void 0; | ||
const context_1 = require("./context"); | ||
class NoopContextManager { | ||
active() { | ||
var context_1 = require("./context"); | ||
var NoopContextManager = /** @class */ (function () { | ||
function NoopContextManager() { | ||
} | ||
NoopContextManager.prototype.active = function () { | ||
return context_1.Context.ROOT_CONTEXT; | ||
} | ||
with(context, fn) { | ||
}; | ||
NoopContextManager.prototype.with = function (context, fn) { | ||
return fn(); | ||
} | ||
bind(target, context) { | ||
}; | ||
NoopContextManager.prototype.bind = function (target, context) { | ||
return target; | ||
} | ||
enable() { | ||
}; | ||
NoopContextManager.prototype.enable = function () { | ||
return this; | ||
} | ||
disable() { | ||
}; | ||
NoopContextManager.prototype.disable = function () { | ||
return this; | ||
} | ||
} | ||
}; | ||
return NoopContextManager; | ||
}()); | ||
exports.NoopContextManager = NoopContextManager; | ||
//# sourceMappingURL=NoopContextManager.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.10.1"; | ||
export declare const VERSION = "0.10.2"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.10.1'; | ||
exports.VERSION = '0.10.2'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/context-base", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "OpenTelemetry Base Context Manager", | ||
@@ -48,3 +48,3 @@ "main": "build/src/index.js", | ||
"@types/mocha": "8.0.0", | ||
"@types/node": "14.0.25", | ||
"@types/node": "14.0.27", | ||
"codecov": "3.7.2", | ||
@@ -59,3 +59,3 @@ "gts": "2.0.2", | ||
}, | ||
"gitHead": "03981e4299282d0611d1255ab0076368d5830753" | ||
"gitHead": "b247e69034a7888a842fe75e0a5ff06f8bea44a8" | ||
} |
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
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
28201
262