@loopback/context
Advanced tools
Comparing version 3.5.1 to 3.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.6.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.5.1...@loopback/context@3.6.0) (2020-04-29) | ||
### Features | ||
* **context:** add `BindingKey.generate` to generate unique binding keys ([9478d31](https://github.com/strongloop/loopback-next/commit/9478d319a472e1dca4122a29dbb414ce1525bdb0)) | ||
## [3.5.1](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.5.0...@loopback/context@3.5.1) (2020-04-23) | ||
@@ -8,0 +19,0 @@ |
@@ -57,2 +57,7 @@ export declare type BindingAddress<T = unknown> = string | BindingKey<T>; | ||
static buildKeyForConfig<T>(key?: BindingAddress): BindingAddress<T>; | ||
/** | ||
* Generate a unique binding key with `uuid` | ||
* @param namespace - Namespace for the binding | ||
*/ | ||
static generate<T>(namespace?: string): BindingKey<T>; | ||
} |
@@ -7,2 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const uuid_1 = require("uuid"); | ||
class BindingKey { | ||
@@ -99,2 +100,11 @@ constructor(key, propertyPath) { | ||
} | ||
/** | ||
* Generate a unique binding key with `uuid` | ||
* @param namespace - Namespace for the binding | ||
*/ | ||
static generate(namespace = '') { | ||
const prefix = namespace ? `${namespace}.` : ''; | ||
const uuid = uuid_1.v4(); | ||
return BindingKey.create(`${prefix}${uuid}`); | ||
} | ||
} | ||
@@ -101,0 +111,0 @@ exports.BindingKey = BindingKey; |
{ | ||
"name": "@loopback/context", | ||
"version": "3.5.1", | ||
"version": "3.6.0", | ||
"description": "LoopBack's container for Inversion of Control", | ||
@@ -21,3 +21,3 @@ "engines": { | ||
"dependencies": { | ||
"@loopback/metadata": "^2.1.1", | ||
"@loopback/metadata": "^2.1.2", | ||
"@types/debug": "^4.1.5", | ||
@@ -30,5 +30,5 @@ "debug": "^4.1.1", | ||
"devDependencies": { | ||
"@loopback/build": "^5.2.0", | ||
"@loopback/eslint-config": "^6.0.4", | ||
"@loopback/testlab": "^3.1.1", | ||
"@loopback/build": "^5.3.0", | ||
"@loopback/eslint-config": "^6.0.5", | ||
"@loopback/testlab": "^3.1.2", | ||
"@types/bluebird": "^3.5.30", | ||
@@ -61,3 +61,3 @@ "@types/node": "^10.17.21", | ||
}, | ||
"gitHead": "11f282df0bbdf25c505a2131e6d82b85005a22a2" | ||
"gitHead": "9ecee6fc8648b8f0999be6c13934d4756e9b0ddc" | ||
} |
@@ -6,2 +6,3 @@ // Copyright IBM Corp. 2018,2020. All Rights Reserved. | ||
import {v4} from 'uuid'; | ||
export type BindingAddress<T = unknown> = string | BindingKey<T>; | ||
@@ -123,2 +124,12 @@ | ||
} | ||
/** | ||
* Generate a unique binding key with `uuid` | ||
* @param namespace - Namespace for the binding | ||
*/ | ||
static generate<T>(namespace = ''): BindingKey<T> { | ||
const prefix = namespace ? `${namespace}.` : ''; | ||
const uuid = v4(); | ||
return BindingKey.create(`${prefix}${uuid}`); | ||
} | ||
} |
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
624580
13801
Updated@loopback/metadata@^2.1.2