Socket
Socket
Sign inDemoInstall

@loopback/context

Package Overview
Dependencies
Maintainers
17
Versions
195
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 0.4.0 to 0.5.0

17

CHANGELOG.md

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

<a name="0.5.0"></a>
# [0.5.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@0.4.0...@loopback/context@0.5.0) (2018-03-29)
### Bug Fixes
* **context:** disable deep clone of injection metadata ([7d8a84c](https://github.com/strongloop/loopback-next/commit/7d8a84c))
### BREAKING CHANGES
* **context:** the `metadata` parameter of `@inject` is no longer
cloned deeply. It's still cloned shallowly.
<a name="0.4.0"></a>

@@ -8,0 +25,0 @@ # [0.4.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@0.3.0...@loopback/context@0.4.0) (2018-03-23)

10

dist/src/inject.js

@@ -51,3 +51,6 @@ "use strict";

resolve,
});
},
// Do not deep clone the spec as only metadata is mutable and it's
// shallowly cloned
{ cloneInputSpec: false });
paramDecorator(target, member, methodDescriptorOrParameterIndex);

@@ -73,3 +76,6 @@ }

resolve,
});
},
// Do not deep clone the spec as only metadata is mutable and it's
// shallowly cloned
{ cloneInputSpec: false });
propDecorator(target, member);

@@ -76,0 +82,0 @@ }

8

package.json
{
"name": "@loopback/context",
"version": "0.4.0",
"version": "0.5.0",
"description": "LoopBack's container for Inversion of Control",

@@ -23,3 +23,3 @@ "engines": {

"dependencies": {
"@loopback/metadata": "^0.3.1",
"@loopback/metadata": "^0.4.0",
"debug": "^3.1.0",

@@ -29,4 +29,4 @@ "uuid": "^3.2.1"

"devDependencies": {
"@loopback/build": "^0.3.3",
"@loopback/testlab": "^0.4.1",
"@loopback/build": "^0.4.0",
"@loopback/testlab": "^0.5.0",
"@types/bluebird": "^3.5.18",

@@ -33,0 +33,0 @@ "@types/debug": "^0.0.30",

@@ -10,4 +10,6 @@ # @loopback/context

The `@loopback/context` package exposes TypeScript/JavaScript APIs and
decorators to register artifacts, declare dependencies, and resolve artifacts
by keys. The `Context` also serves as an [IoC container](https://en.wikipedia.org/wiki/Inversion_of_control) to support [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection).
decorators to register artifacts, declare dependencies, and resolve artifacts by
keys. The `Context` also serves as an
[IoC container](https://en.wikipedia.org/wiki/Inversion_of_control) to support
[dependency injection](https://en.wikipedia.org/wiki/Dependency_injection).

@@ -25,9 +27,10 @@ `Context` and `Binding` are the two core concepts. A context is a registry of

- Allow contexts to form a hierarchy to share or override bindings.
- Track bindings and injections during resolution to detect circular dependencies.
- Track bindings and injections during resolution to detect circular
dependencies.
## Installation
```sh
npm install --save @loopback/context
```
$ npm install --save @loopback/context
```

@@ -47,2 +50,3 @@ ## Basic use

The binding can also be located asynchronously:
```ts

@@ -65,4 +69,4 @@ const helloVal = await ctx.get('hello');

// injecting the value bound to `greeting` using context
@inject('greeting') private greeting: string) {
}
@inject('greeting') private greeting: string,
) {}

@@ -79,3 +83,3 @@ greet(name) {

// Get an instance of HelloController
const helloController: HelloController = await ctx.get('HelloController');
const helloController = await ctx.get<HelloController>('HelloController');
// helloController now has the `greeting` property injected with `Hello`

@@ -88,3 +92,4 @@ console.log(helloController.greet('John')); // => Hello, John

For additional information, please refer to the [Context page](http://loopback.io/doc/en/lb4/Context.html).
For additional information, please refer to the
[Context page](http://loopback.io/doc/en/lb4/Context.html).

@@ -102,3 +107,4 @@ ## Contributions

See [all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).
See
[all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

@@ -105,0 +111,0 @@ ## License

@@ -109,10 +109,16 @@ // Copyright IBM Corp. 2017,2018. All Rights Reserved.

Injection
>(PARAMETERS_KEY, {
target,
member,
methodDescriptorOrParameterIndex,
bindingKey,
metadata,
resolve,
});
>(
PARAMETERS_KEY,
{
target,
member,
methodDescriptorOrParameterIndex,
bindingKey,
metadata,
resolve,
},
// Do not deep clone the spec as only metadata is mutable and it's
// shallowly cloned
{cloneInputSpec: false},
);
paramDecorator(target, member!, methodDescriptorOrParameterIndex);

@@ -140,10 +146,16 @@ } else if (member) {

Injection
>(PROPERTIES_KEY, {
target,
member,
methodDescriptorOrParameterIndex,
bindingKey,
metadata,
resolve,
});
>(
PROPERTIES_KEY,
{
target,
member,
methodDescriptorOrParameterIndex,
bindingKey,
metadata,
resolve,
},
// Do not deep clone the spec as only metadata is mutable and it's
// shallowly cloned
{cloneInputSpec: false},
);
propDecorator(target, member!);

@@ -150,0 +162,0 @@ } else {

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

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

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