@loopback/core
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [2.13.0](https://github.com/strongloop/loopback-next/compare/@loopback/core@2.12.0...@loopback/core@2.13.0) (2020-11-18) | ||
### Bug Fixes | ||
* re-export generateUniqueId in index.ts ([e392056](https://github.com/strongloop/loopback-next/commit/e392056471cb06c603ed9313e78886fe606e34a9)), closes [#6767](https://github.com/strongloop/loopback-next/issues/6767) | ||
### Features | ||
* **core:** allow parameter injection for lifecycle methods ([d5351fd](https://github.com/strongloop/loopback-next/commit/d5351fdc81422a523dc2fd78017bda0ef4dbadfd)) | ||
# [2.12.0](https://github.com/strongloop/loopback-next/compare/@loopback/core@2.11.0...@loopback/core@2.12.0) (2020-11-05) | ||
@@ -8,0 +24,0 @@ |
@@ -10,3 +10,2 @@ "use strict"; | ||
const context_1 = require("@loopback/context"); | ||
const unique_id_1 = require("@loopback/context/dist/unique-id"); | ||
const assert_1 = tslib_1.__importDefault(require("assert")); | ||
@@ -268,3 +267,3 @@ const debug_1 = tslib_1.__importDefault(require("debug")); | ||
fn.name || '<onInit>', | ||
unique_id_1.generateUniqueId(), | ||
context_1.generateUniqueId(), | ||
].join('.'); | ||
@@ -314,3 +313,3 @@ return this.bind(key) | ||
fn.name || '<onStart>', | ||
unique_id_1.generateUniqueId(), | ||
context_1.generateUniqueId(), | ||
].join('.'); | ||
@@ -359,3 +358,3 @@ return this.bind(key) | ||
fn.name || '<onStop>', | ||
unique_id_1.generateUniqueId(), | ||
context_1.generateUniqueId(), | ||
].join('.'); | ||
@@ -362,0 +361,0 @@ return this.bind(key) |
@@ -1,2 +0,2 @@ | ||
import { Binding, ContextView } from '@loopback/context'; | ||
import { Binding, Context, ContextView } from '@loopback/context'; | ||
import { LifeCycleObserver } from './lifecycle'; | ||
@@ -34,5 +34,6 @@ /** | ||
export declare class LifeCycleObserverRegistry implements LifeCycleObserver { | ||
protected readonly context: Context; | ||
protected readonly observersView: ContextView<LifeCycleObserver>; | ||
protected readonly options: LifeCycleObserverOptions; | ||
constructor(observersView: ContextView<LifeCycleObserver>, options?: LifeCycleObserverOptions); | ||
constructor(context: Context, observersView: ContextView<LifeCycleObserver>, options?: LifeCycleObserverOptions); | ||
setOrderedGroups(groups: string[]): void; | ||
@@ -39,0 +40,0 @@ /** |
@@ -19,6 +19,7 @@ "use strict"; | ||
let LifeCycleObserverRegistry = class LifeCycleObserverRegistry { | ||
constructor(observersView, options = { | ||
constructor(context, observersView, options = { | ||
parallel: true, | ||
orderedGroups: exports.DEFAULT_ORDERED_GROUPS, | ||
}) { | ||
this.context = context; | ||
this.observersView = observersView; | ||
@@ -114,3 +115,7 @@ this.options = options; | ||
if (typeof observer[event] === 'function') { | ||
await observer[event](); | ||
// Supply `undefined` for legacy callback function expected by | ||
// DataSource.stop() | ||
await context_1.invokeMethod(observer, event, this.context, [undefined], { | ||
skipInterceptors: true, | ||
}); | ||
} | ||
@@ -176,7 +181,9 @@ } | ||
LifeCycleObserverRegistry = tslib_1.__decorate([ | ||
tslib_1.__param(0, context_1.inject.view(lifecycle_1.lifeCycleObserverFilter)), | ||
tslib_1.__param(1, context_1.inject(keys_1.CoreBindings.LIFE_CYCLE_OBSERVER_OPTIONS, { optional: true })), | ||
tslib_1.__metadata("design:paramtypes", [context_1.ContextView, Object]) | ||
tslib_1.__param(0, context_1.inject.context()), | ||
tslib_1.__param(1, context_1.inject.view(lifecycle_1.lifeCycleObserverFilter)), | ||
tslib_1.__param(2, context_1.inject(keys_1.CoreBindings.LIFE_CYCLE_OBSERVER_OPTIONS, { optional: true })), | ||
tslib_1.__metadata("design:paramtypes", [context_1.Context, | ||
context_1.ContextView, Object]) | ||
], LifeCycleObserverRegistry); | ||
exports.LifeCycleObserverRegistry = LifeCycleObserverRegistry; | ||
//# sourceMappingURL=lifecycle-registry.js.map |
@@ -10,11 +10,11 @@ import { Binding, BindingSpec, BindingTagFilter, Constructor, ValueOrPromise } from '@loopback/context'; | ||
*/ | ||
init?(): ValueOrPromise<void>; | ||
init?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
/** | ||
* The method to be invoked during `start` | ||
*/ | ||
start?(): ValueOrPromise<void>; | ||
start?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
/** | ||
* The method to be invoked during `stop` | ||
*/ | ||
stop?(): ValueOrPromise<void>; | ||
stop?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
} | ||
@@ -21,0 +21,0 @@ /** |
{ | ||
"name": "@loopback/core", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "Define and implement core constructs such as Application and Component", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@loopback/context": "^3.13.0", | ||
"@loopback/context": "^3.13.1", | ||
"debug": "^4.2.0", | ||
@@ -33,5 +33,5 @@ "tslib": "^2.0.3" | ||
"devDependencies": { | ||
"@loopback/build": "^6.2.6", | ||
"@loopback/eslint-config": "^10.0.2", | ||
"@loopback/testlab": "^3.2.8", | ||
"@loopback/build": "^6.2.7", | ||
"@loopback/eslint-config": "^10.0.3", | ||
"@loopback/testlab": "^3.2.9", | ||
"@types/debug": "^4.1.5", | ||
@@ -51,3 +51,3 @@ "@types/node": "^10.17.35" | ||
}, | ||
"gitHead": "f47fad3f4669c3ceae5e0927dc6098da18df864d" | ||
"gitHead": "3fd1434d6a2addb3c77759a0893bd7cf00e84b67" | ||
} |
@@ -14,2 +14,3 @@ // Copyright IBM Corp. 2017,2020. All Rights Reserved. | ||
DynamicValueProviderClass, | ||
generateUniqueId, | ||
Interceptor, | ||
@@ -22,3 +23,2 @@ InterceptorBindingOptions, | ||
} from '@loopback/context'; | ||
import {generateUniqueId} from '@loopback/context/dist/unique-id'; | ||
import assert from 'assert'; | ||
@@ -25,0 +25,0 @@ import debugFactory from 'debug'; |
@@ -8,4 +8,6 @@ // Copyright IBM Corp. 2018,2020. All Rights Reserved. | ||
Binding, | ||
Context, | ||
ContextView, | ||
inject, | ||
invokeMethod, | ||
sortBindingsByPhase, | ||
@@ -53,2 +55,4 @@ } from '@loopback/context'; | ||
constructor( | ||
@inject.context() | ||
protected readonly context: Context, | ||
@inject.view(lifeCycleObserverFilter) | ||
@@ -185,3 +189,7 @@ protected readonly observersView: ContextView<LifeCycleObserver>, | ||
if (typeof observer[event] === 'function') { | ||
await observer[event]!(); | ||
// Supply `undefined` for legacy callback function expected by | ||
// DataSource.stop() | ||
await invokeMethod(observer, event, this.context, [undefined], { | ||
skipInterceptors: true, | ||
}); | ||
} | ||
@@ -188,0 +196,0 @@ } |
@@ -25,11 +25,11 @@ // Copyright IBM Corp. 2018,2020. All Rights Reserved. | ||
*/ | ||
init?(): ValueOrPromise<void>; | ||
init?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
/** | ||
* The method to be invoked during `start` | ||
*/ | ||
start?(): ValueOrPromise<void>; | ||
start?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
/** | ||
* The method to be invoked during `stop` | ||
*/ | ||
stop?(): ValueOrPromise<void>; | ||
stop?(...injectedArgs: unknown[]): ValueOrPromise<void>; | ||
} | ||
@@ -36,0 +36,0 @@ |
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
212941
4144
Updated@loopback/context@^3.13.1