@nestjs/core 6.11.7 → 6.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -1
- package/hooks/before-app-shutdown.hook.js +4 -2
- package/hooks/on-app-bootstrap.hook.js +5 -2
- package/hooks/on-app-shutdown.hook.js +5 -2
- package/hooks/on-module-destroy.hook.js +5 -2
- package/hooks/on-module-init.hook.js +5 -2
- package/package.json +2 -2
- package/router/router-execution-context.js +1 -1
package/Readme.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/
|
|
12
|
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
13
|
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
14
|
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
|
15
15
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
@@ -30,14 +30,16 @@ function callOperator(instances, signal) {
|
|
|
30
30
|
*/
|
|
31
31
|
async function callBeforeAppShutdownHook(module, signal) {
|
|
32
32
|
const providers = module.getNonAliasProviders();
|
|
33
|
-
const [_,
|
|
33
|
+
const [_, moduleClassHost] = providers.shift();
|
|
34
34
|
const instances = [...module.controllers, ...providers];
|
|
35
35
|
const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
|
|
36
36
|
await Promise.all(callOperator(nonTransientInstances, signal));
|
|
37
37
|
const transientInstances = transient_instances_1.getTransientInstances(instances);
|
|
38
38
|
await Promise.all(callOperator(transientInstances, signal));
|
|
39
|
+
const moduleClassInstance = moduleClassHost.instance;
|
|
39
40
|
if (moduleClassInstance &&
|
|
40
|
-
hasBeforeApplicationShutdownHook(moduleClassInstance)
|
|
41
|
+
hasBeforeApplicationShutdownHook(moduleClassInstance) &&
|
|
42
|
+
moduleClassHost.isDependencyTreeStatic()) {
|
|
41
43
|
await moduleClassInstance.beforeApplicationShutdown(signal);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -31,7 +31,7 @@ async function callModuleBootstrapHook(module) {
|
|
|
31
31
|
const providers = module.getNonAliasProviders();
|
|
32
32
|
// Module (class) instance is the first element of the providers array
|
|
33
33
|
// Lifecycle hook has to be called once all classes are properly initialized
|
|
34
|
-
const [_,
|
|
34
|
+
const [_, moduleClassHost] = providers.shift();
|
|
35
35
|
const instances = [
|
|
36
36
|
...module.controllers,
|
|
37
37
|
...providers,
|
|
@@ -43,7 +43,10 @@ async function callModuleBootstrapHook(module) {
|
|
|
43
43
|
const transientInstances = transient_instances_1.getTransientInstances(instances);
|
|
44
44
|
await Promise.all(callOperator(transientInstances));
|
|
45
45
|
// Call the instance itself
|
|
46
|
-
|
|
46
|
+
const moduleClassInstance = moduleClassHost.instance;
|
|
47
|
+
if (moduleClassInstance &&
|
|
48
|
+
hasOnAppBootstrapHook(moduleClassInstance) &&
|
|
49
|
+
moduleClassHost.isDependencyTreeStatic()) {
|
|
47
50
|
await moduleClassInstance.onApplicationBootstrap();
|
|
48
51
|
}
|
|
49
52
|
}
|
|
@@ -31,7 +31,7 @@ async function callAppShutdownHook(module, signal) {
|
|
|
31
31
|
const providers = module.getNonAliasProviders();
|
|
32
32
|
// Module (class) instance is the first element of the providers array
|
|
33
33
|
// Lifecycle hook has to be called once all classes are properly initialized
|
|
34
|
-
const [_,
|
|
34
|
+
const [_, moduleClassHost] = providers.shift();
|
|
35
35
|
const instances = [
|
|
36
36
|
...module.controllers,
|
|
37
37
|
...providers,
|
|
@@ -43,7 +43,10 @@ async function callAppShutdownHook(module, signal) {
|
|
|
43
43
|
const transientInstances = transient_instances_1.getTransientInstances(instances);
|
|
44
44
|
await Promise.all(callOperator(transientInstances, signal));
|
|
45
45
|
// Call the instance itself
|
|
46
|
-
|
|
46
|
+
const moduleClassInstance = moduleClassHost.instance;
|
|
47
|
+
if (moduleClassInstance &&
|
|
48
|
+
hasOnAppShutdownHook(moduleClassInstance) &&
|
|
49
|
+
moduleClassHost.isDependencyTreeStatic()) {
|
|
47
50
|
await moduleClassInstance.onApplicationShutdown(signal);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
@@ -31,7 +31,7 @@ async function callModuleDestroyHook(module) {
|
|
|
31
31
|
const providers = module.getNonAliasProviders();
|
|
32
32
|
// Module (class) instance is the first element of the providers array
|
|
33
33
|
// Lifecycle hook has to be called once all classes are properly destroyed
|
|
34
|
-
const [_,
|
|
34
|
+
const [_, moduleClassHost] = providers.shift();
|
|
35
35
|
const instances = [
|
|
36
36
|
...module.controllers,
|
|
37
37
|
...providers,
|
|
@@ -43,7 +43,10 @@ async function callModuleDestroyHook(module) {
|
|
|
43
43
|
const transientInstances = transient_instances_1.getTransientInstances(instances);
|
|
44
44
|
await Promise.all(callOperator(transientInstances));
|
|
45
45
|
// Call the module instance itself
|
|
46
|
-
|
|
46
|
+
const moduleClassInstance = moduleClassHost.instance;
|
|
47
|
+
if (moduleClassInstance &&
|
|
48
|
+
hasOnModuleDestroyHook(moduleClassInstance) &&
|
|
49
|
+
moduleClassHost.isDependencyTreeStatic()) {
|
|
47
50
|
await moduleClassInstance.onModuleDestroy();
|
|
48
51
|
}
|
|
49
52
|
}
|
|
@@ -31,7 +31,7 @@ async function callModuleInitHook(module) {
|
|
|
31
31
|
const providers = module.getNonAliasProviders();
|
|
32
32
|
// Module (class) instance is the first element of the providers array
|
|
33
33
|
// Lifecycle hook has to be called once all classes are properly initialized
|
|
34
|
-
const [_,
|
|
34
|
+
const [_, moduleClassHost] = providers.shift();
|
|
35
35
|
const instances = [
|
|
36
36
|
...module.controllers,
|
|
37
37
|
...providers,
|
|
@@ -43,7 +43,10 @@ async function callModuleInitHook(module) {
|
|
|
43
43
|
const transientInstances = transient_instances_1.getTransientInstances(instances);
|
|
44
44
|
await Promise.all(callOperator(transientInstances));
|
|
45
45
|
// Call the instance itself
|
|
46
|
-
|
|
46
|
+
const moduleClassInstance = moduleClassHost.instance;
|
|
47
|
+
if (moduleClassInstance &&
|
|
48
|
+
hasOnModuleInitHook(moduleClassInstance) &&
|
|
49
|
+
moduleClassHost.isDependencyTreeStatic()) {
|
|
47
50
|
await moduleClassInstance.onModuleInit();
|
|
48
51
|
}
|
|
49
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.8",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@nuxtjs/opencollective": "0.2.2",
|
|
31
31
|
"fast-safe-stringify": "2.0.7",
|
|
32
32
|
"iterare": "1.2.0",
|
|
33
|
-
"object-hash": "2.0.
|
|
33
|
+
"object-hash": "2.0.3",
|
|
34
34
|
"path-to-regexp": "3.2.0",
|
|
35
35
|
"tslib": "1.10.0",
|
|
36
36
|
"uuid": "3.4.0"
|
|
@@ -156,7 +156,7 @@ class RouterExecutionContext {
|
|
|
156
156
|
await this.responseController.render(result, res, renderTemplate);
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
if (redirectResponse && redirectResponse.url) {
|
|
159
|
+
if (redirectResponse && typeof redirectResponse.url === 'string') {
|
|
160
160
|
return async (result, res) => {
|
|
161
161
|
await this.responseController.redirect(result, res, redirectResponse);
|
|
162
162
|
};
|