@loopback/context
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -6,2 +6,10 @@ # Change Log | ||
## [3.5.1](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.5.0...@loopback/context@3.5.1) (2020-04-23) | ||
**Note:** Version bump only for package @loopback/context | ||
# [3.5.0](https://github.com/strongloop/loopback-next/compare/@loopback/context@3.4.0...@loopback/context@3.5.0) (2020-04-22) | ||
@@ -8,0 +16,0 @@ |
@@ -512,3 +512,6 @@ "use strict"; | ||
inspect(options = {}) { | ||
options = Object.assign({ includeInjections: false }, options); | ||
options = { | ||
includeInjections: false, | ||
...options, | ||
}; | ||
const json = this.toJSON(); | ||
@@ -515,0 +518,0 @@ if (options.includeInjections) { |
@@ -170,41 +170,30 @@ "use strict"; | ||
async processNotifications() { | ||
var e_1, _a; | ||
const events = this.notificationQueue; | ||
if (events == null) | ||
return; | ||
try { | ||
for (var events_2 = tslib_1.__asyncValues(events), events_2_1; events_2_1 = await events_2.next(), !events_2_1.done;) { | ||
const { type, binding, context, observers } = events_2_1.value; | ||
// The loop will happen asynchronously upon events | ||
try { | ||
// The execution of observers happen in the Promise micro-task queue | ||
await this.notifyObservers({ type, binding, context }, observers); | ||
this.pendingNotifications--; | ||
this._debug('Observers notified for %s of binding %s', type, binding.key); | ||
this.emitEvent('observersNotified', { type, binding, context }); | ||
for await (const { type, binding, context, observers } of events) { | ||
// The loop will happen asynchronously upon events | ||
try { | ||
// The execution of observers happen in the Promise micro-task queue | ||
await this.notifyObservers({ type, binding, context }, observers); | ||
this.pendingNotifications--; | ||
this._debug('Observers notified for %s of binding %s', type, binding.key); | ||
this.emitEvent('observersNotified', { type, binding, context }); | ||
} | ||
catch (err) { | ||
// Do not reduce the pending notification count so that errors | ||
// can be captured by waitUntilPendingNotificationsDone | ||
this._debug('Error caught from observers', err); | ||
// Errors caught from observers. | ||
if (this.listenerCount('error') > 0) { | ||
// waitUntilPendingNotificationsDone may be called | ||
this.emitError(err); | ||
} | ||
catch (err) { | ||
// Do not reduce the pending notification count so that errors | ||
// can be captured by waitUntilPendingNotificationsDone | ||
this._debug('Error caught from observers', err); | ||
// Errors caught from observers. | ||
if (this.listenerCount('error') > 0) { | ||
// waitUntilPendingNotificationsDone may be called | ||
this.emitError(err); | ||
} | ||
else { | ||
// Emit it to the current context. If no error listeners are | ||
// registered, crash the process. | ||
this.handleNotificationError(err); | ||
} | ||
else { | ||
// Emit it to the current context. If no error listeners are | ||
// registered, crash the process. | ||
this.handleNotificationError(err); | ||
} | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (events_2_1 && !events_2_1.done && (_a = events_2.return)) await _a.call(events_2); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
@@ -211,0 +200,0 @@ /** |
@@ -126,3 +126,3 @@ "use strict"; | ||
const cachedValue = (_a = this._cachedValues) === null || _a === void 0 ? void 0 : _a.get(binding); | ||
this.emit(event, Object.assign(Object.assign({}, ctxEvent), { cachedValue })); | ||
this.emit(event, { ...ctxEvent, cachedValue }); | ||
} | ||
@@ -129,0 +129,0 @@ else { |
@@ -543,3 +543,7 @@ "use strict"; | ||
var _a; | ||
options = Object.assign({ includeParent: true, includeInjections: false }, options); | ||
options = { | ||
includeParent: true, | ||
includeInjections: false, | ||
...options, | ||
}; | ||
const bindings = {}; | ||
@@ -546,0 +550,0 @@ for (const [k, v] of this.registry) { |
@@ -256,3 +256,6 @@ "use strict"; | ||
const forkedSession = resolution_session_1.ResolutionSession.fork(session); | ||
const options = Object.assign({ session: forkedSession }, injection.metadata); | ||
const options = { | ||
session: forkedSession, | ||
...injection.metadata, | ||
}; | ||
return function getter() { | ||
@@ -259,0 +262,0 @@ return ctx.get(bindingSelector, options); |
@@ -104,3 +104,6 @@ "use strict"; | ||
const key = injection.bindingSelector; | ||
const options = Object.assign({ session: s }, injection.metadata); | ||
const options = { | ||
session: s, | ||
...injection.metadata, | ||
}; | ||
return ctx.getValueOrPromise(key, options); | ||
@@ -107,0 +110,0 @@ } |
{ | ||
"name": "@loopback/context", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "LoopBack's container for Inversion of Control", | ||
@@ -21,3 +21,3 @@ "engines": { | ||
"dependencies": { | ||
"@loopback/metadata": "^2.1.0", | ||
"@loopback/metadata": "^2.1.1", | ||
"@types/debug": "^4.1.5", | ||
@@ -30,8 +30,8 @@ "debug": "^4.1.1", | ||
"devDependencies": { | ||
"@loopback/build": "^5.1.0", | ||
"@loopback/build": "^5.2.0", | ||
"@loopback/eslint-config": "^6.0.4", | ||
"@loopback/testlab": "^3.1.0", | ||
"@loopback/testlab": "^3.1.1", | ||
"@types/bluebird": "^3.5.30", | ||
"@types/node": "^10.17.21", | ||
"@types/uuid": "^7.0.2", | ||
"@types/uuid": "^7.0.3", | ||
"bluebird": "^3.7.2" | ||
@@ -61,3 +61,3 @@ }, | ||
}, | ||
"gitHead": "fa2fe1c81c7beb74eb7dfd0898e2b3f0b7c7f762" | ||
"gitHead": "11f282df0bbdf25c505a2131e6d82b85005a22a2" | ||
} |
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
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
13776
623163
Updated@loopback/metadata@^2.1.1