Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loopback/context

Package Overview
Dependencies
Maintainers
8
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/context - npm Package Compare versions

Comparing version 3.9.0 to 3.9.1

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## [3.9.1](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.9.0...@loopback/context@3.9.1) (2020-06-23)
### Bug Fixes
* set node version to >=10.16 to support events.once ([e39da1c](https://github.com/strongloop/loopback-next/commit/e39da1ca47728eafaf83c10ce35b09b03b6a4edc))
* **context:** cache binding value or promise as-is to avoid racing condition ([38b9b96](https://github.com/strongloop/loopback-next/commit/38b9b968e5b0c033d9a1f4a304c4cebbb345fac7))
# [3.9.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.8.2...@loopback/context@3.9.0) (2020-06-11)

@@ -8,0 +20,0 @@

22

dist/binding.js

@@ -199,14 +199,12 @@ "use strict";

this._cache = new WeakMap();
return value_promise_1.transformValueOrPromise(result, val => {
if (this.scope === BindingScope.SINGLETON) {
// Cache the value
this._cache.set(ctx.getOwnerContext(this.key), val);
}
else if (this.scope === BindingScope.CONTEXT) {
// Cache the value at the current context
this._cache.set(ctx, val);
}
// Do not cache for `TRANSIENT`
return val;
});
if (this.scope === BindingScope.SINGLETON) {
// Cache the value
this._cache.set(ctx.getOwnerContext(this.key), result);
}
else if (this.scope === BindingScope.CONTEXT) {
// Cache the value at the current context
this._cache.set(ctx, result);
}
// Do not cache for `TRANSIENT`
return result;
}

@@ -213,0 +211,0 @@ /**

@@ -413,3 +413,3 @@ "use strict";

const currentBindings = this.tagIndexer.findByTagIndex(tag);
const parentBindings = this._parent && ((_a = this._parent) === null || _a === void 0 ? void 0 : _a._findByTagIndex(tag));
const parentBindings = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._findByTagIndex(tag);
return this._mergeWithParent(currentBindings, parentBindings);

@@ -416,0 +416,0 @@ }

{
"name": "@loopback/context",
"version": "3.9.0",
"version": "3.9.1",
"description": "Facilities to manage artifacts and their dependencies in your Node.js applications. The module exposes TypeScript/JavaScript APIs and decorators to register artifacts, declare dependencies, and resolve artifacts by keys. It also serves as an IoC container to support dependency injection",

@@ -8,3 +8,3 @@ "main": "dist/index.js",

"engines": {
"node": ">=10"
"node": ">=10.16"
},

@@ -27,3 +27,3 @@ "scripts": {

"dependencies": {
"@loopback/metadata": "^2.2.0",
"@loopback/metadata": "^2.2.1",
"@types/debug": "^4.1.5",

@@ -37,5 +37,5 @@ "debug": "^4.1.1",

"devDependencies": {
"@loopback/build": "^5.4.3",
"@loopback/eslint-config": "^8.0.1",
"@loopback/testlab": "^3.1.7",
"@loopback/build": "^6.0.0",
"@loopback/eslint-config": "^8.0.2",
"@loopback/testlab": "^3.1.8",
"@types/bluebird": "^3.5.32",

@@ -66,3 +66,3 @@ "@types/node": "^10.17.26",

},
"gitHead": "f31b7e6de5a405a015cdd774f63d699b35d943cc"
"gitHead": "9ccb0b7ae75727ec9b90c5bba18885edb3f93a92"
}

@@ -313,3 +313,3 @@ // Copyright IBM Corp. 2017,2020. All Rights Reserved.

private _cache: WeakMap<Context, T>;
private _cache: WeakMap<Context, ValueOrPromise<T>>;
private _getValue?: ValueFactory<T>;

@@ -363,14 +363,12 @@

// Initialize the cache as a weakmap keyed by context
if (!this._cache) this._cache = new WeakMap<Context, T>();
return transformValueOrPromise(result, val => {
if (this.scope === BindingScope.SINGLETON) {
// Cache the value
this._cache.set(ctx.getOwnerContext(this.key)!, val);
} else if (this.scope === BindingScope.CONTEXT) {
// Cache the value at the current context
this._cache.set(ctx, val);
}
// Do not cache for `TRANSIENT`
return val;
});
if (!this._cache) this._cache = new WeakMap<Context, ValueOrPromise<T>>();
if (this.scope === BindingScope.SINGLETON) {
// Cache the value
this._cache.set(ctx.getOwnerContext(this.key)!, result);
} else if (this.scope === BindingScope.CONTEXT) {
// Cache the value at the current context
this._cache.set(ctx, result);
}
// Do not cache for `TRANSIENT`
return result;
}

@@ -377,0 +375,0 @@

@@ -539,3 +539,3 @@ // Copyright IBM Corp. 2017,2020. All Rights Reserved.

const currentBindings = this.tagIndexer.findByTagIndex(tag);
const parentBindings = this._parent && this._parent?._findByTagIndex(tag);
const parentBindings = this._parent?._findByTagIndex(tag);
return this._mergeWithParent(currentBindings, parentBindings);

@@ -542,0 +542,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc