@nestjs/core 8.0.6 → 8.0.7

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 CHANGED
@@ -67,8 +67,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
67
67
 
68
68
  <table style="text-align:center;"><tr><td>
69
69
  <a href="https://careers.labster.com/departments/platform" target="_blank"><img src="https://nestjs.com/img/labster-logo.png" width="170" valign="middle" /></a></td><td>
70
- <a href="https://weld.so/" target="_blank"><img src="https://nestjs.com/img/weld-logo.svg" width="150" valign="middle" /></a></td><td>
71
- <a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td></tr></table>
70
+ <a href="https://weld.app/" target="_blank"><img src="https://nestjs.com/img/weld-logo.svg" width="150" valign="middle" /></a></td>
71
+ <td>
72
+ <a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td>
73
+ <td>
74
+ <a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/intrinisic-logo.png" width="210" valign="middle" /></a></td></</tr></table>
72
75
 
73
76
  #### Silver Sponsors
74
77
 
@@ -76,7 +79,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
76
79
  <a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
77
80
  <a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
78
81
  <a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
79
- <a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td><td>
82
+ <a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-roles-logo.svg" width="150" valign="middle" /></td><td>
80
83
  <a href="https://www.castlecraft.in" target="_blank"><img src="https://nestjs.com/img/castlecraft-logo.png" width="150" valign="middle" /></td></tr></table>
81
84
 
82
85
  #### Sponsors
@@ -6,9 +6,9 @@ import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-applicati
6
6
  * @publicApi
7
7
  */
8
8
  export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any, TResponse = any> implements HttpServer<TRequest, TResponse> {
9
- protected readonly instance: any;
9
+ protected instance?: any;
10
10
  protected httpServer: TServer;
11
- constructor(instance: any);
11
+ constructor(instance?: any);
12
12
  init(): Promise<void>;
13
13
  use(...args: any[]): any;
14
14
  get(handler: RequestHandler): any;
@@ -31,6 +31,7 @@ export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any,
31
31
  listen(port: string | number, hostname: string, callback?: () => void): any;
32
32
  getHttpServer(): TServer;
33
33
  setHttpServer(httpServer: TServer): void;
34
+ setInstance<T = any>(instance: T): void;
34
35
  getInstance<T = any>(): T;
35
36
  abstract close(): any;
36
37
  abstract initHttpServer(options: NestApplicationOptions): any;
@@ -46,6 +46,9 @@ class AbstractHttpAdapter {
46
46
  setHttpServer(httpServer) {
47
47
  this.httpServer = httpServer;
48
48
  }
49
+ setInstance(instance) {
50
+ this.instance = instance;
51
+ }
49
52
  getInstance() {
50
53
  return this.instance;
51
54
  }
@@ -32,7 +32,12 @@ function callOperator(instances, signal) {
32
32
  async function callBeforeAppShutdownHook(module, signal) {
33
33
  const providers = module.getNonAliasProviders();
34
34
  const [_, moduleClassHost] = providers.shift();
35
- const instances = [...module.controllers, ...providers];
35
+ const instances = [
36
+ ...module.controllers,
37
+ ...providers,
38
+ ...module.injectables,
39
+ ...module.middlewares,
40
+ ];
36
41
  const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
37
42
  await Promise.all(callOperator(nonTransientInstances, signal));
38
43
  const transientInstances = transient_instances_1.getTransientInstances(instances);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "8.0.6",
3
+ "version": "8.0.7",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -32,11 +32,11 @@
32
32
  "iterare": "1.2.1",
33
33
  "object-hash": "2.2.0",
34
34
  "path-to-regexp": "3.2.0",
35
- "tslib": "2.3.0",
35
+ "tslib": "2.3.1",
36
36
  "uuid": "8.3.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "8.0.6"
39
+ "@nestjs/common": "8.0.7"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^8.0.0",
@@ -112,7 +112,7 @@ class RouterExplorer {
112
112
  if (isVersioned &&
113
113
  routePathMetadata.versioningOptions.type !== version_type_enum_1.VersioningType.URI) {
114
114
  // All versioning (except for URI Versioning) is done via the "Version Filter"
115
- routeHandler = this.applyVersionFilter(routePathMetadata, routeHandler);
115
+ routeHandler = this.applyVersionFilter(router, routePathMetadata, routeHandler);
116
116
  }
117
117
  routePathMetadata.methodPath = path;
118
118
  const pathsToRegister = this.routePathFactory.create(routePathMetadata, requestMethod);
@@ -159,9 +159,16 @@ class RouterExplorer {
159
159
  return next();
160
160
  };
161
161
  }
162
- applyVersionFilter(routePathMetadata, handler) {
162
+ applyVersionFilter(router, routePathMetadata, handler) {
163
163
  const { versioningOptions } = routePathMetadata;
164
164
  const version = this.routePathFactory.getVersion(routePathMetadata);
165
+ if (router === null || router === void 0 ? void 0 : router.applyVersionFilter) {
166
+ return router.applyVersionFilter(handler, version, versioningOptions);
167
+ }
168
+ /**
169
+ * This can be removed in the next major release.
170
+ * Left for backward-compatibility.
171
+ */
165
172
  return (req, res, next) => {
166
173
  var _a, _b, _c, _d;
167
174
  if (version === version_options_interface_1.VERSION_NEUTRAL) {