@nestjs/core 8.1.1 → 8.2.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ <a name="8.2.0"></a>
7
+ # [8.2.0](https://github.com/nestjs/nest/compare/v8.1.2...v8.2.0) (2021-11-08)
8
+
9
+
10
+
11
+
12
+ **Note:** Version bump only for package @nestjs/core
package/Readme.md CHANGED
@@ -113,6 +113,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
113
113
  <td align="center" valign="middle"><a href="https://studyclerk.com/pay-for-research-paper" target="_blank"><img src="https://nestjs.com/img/studyclerk-logo.png" width="125" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://xyndata.com" target="_blank"><img src="https://nestjs.com/img/xyndata-logo.png" width="125" valign="middle" /></a></td></tr><tr>
114
114
  <td align="center" valign="middle"><a href="https://www.anonymistic.com/" target="_blank"><img src="https://nestjs.com/img/anonymistic-logo.png" width="125" valign="middle" /></a></td>
115
115
  <td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/naologic-logo.svg" width="125" valign="middle" /></a></td>
116
+ <td align="center" valign="middle"><a href="https://messaged.com/" target="_blank"><img src="https://nestjs.com/img/messaged-logo.png" width="50" valign="middle" /></a></td>
117
+ <td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/triplecore-logo.svg" width="50" valign="middle" /></a></td>
116
118
  </tr></table>
117
119
 
118
120
  ## Backers
@@ -10,7 +10,7 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasBeforeApplicationShutdownHook(instance) {
13
- return !shared_utils_1.isNil(instance.beforeApplicationShutdown);
13
+ return shared_utils_1.isFunction(instance.beforeApplicationShutdown);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
@@ -10,7 +10,7 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnAppBootstrapHook(instance) {
13
- return !shared_utils_1.isNil(instance.onApplicationBootstrap);
13
+ return shared_utils_1.isFunction(instance.onApplicationBootstrap);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
@@ -10,7 +10,7 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnAppShutdownHook(instance) {
13
- return !shared_utils_1.isNil(instance.onApplicationShutdown);
13
+ return shared_utils_1.isFunction(instance.onApplicationShutdown);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
@@ -10,7 +10,7 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnModuleDestroyHook(instance) {
13
- return !shared_utils_1.isNil(instance.onModuleDestroy);
13
+ return shared_utils_1.isFunction(instance.onModuleDestroy);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances onModuleDestroy hook
@@ -10,7 +10,7 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnModuleInitHook(instance) {
13
- return !shared_utils_1.isNil(instance.onModuleInit);
13
+ return shared_utils_1.isFunction(instance.onModuleInit);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
@@ -137,6 +137,7 @@ class Injector {
137
137
  }
138
138
  async resolveSingleParam(wrapper, param, dependencyContext, moduleRef, contextId = constants_2.STATIC_CONTEXT, inquirer, keyOrIndex) {
139
139
  if (shared_utils_1.isUndefined(param)) {
140
+ this.logger.log('Nest encountered an undefined dependency. This may be due to a circular import or a missing dependency declaration.');
140
141
  throw new undefined_dependency_exception_1.UndefinedDependencyException(wrapper.name, dependencyContext, moduleRef);
141
142
  }
142
143
  const token = this.resolveParamToken(wrapper, param);
@@ -290,11 +291,10 @@ class Injector {
290
291
  const { metatype, inject } = wrapper;
291
292
  const inquirerId = this.getInquirerId(inquirer);
292
293
  const instanceHost = targetMetatype.getInstanceByContextId(contextId, inquirerId);
293
- const isStatic = wrapper.isStatic(contextId, inquirer);
294
- const isInRequestScope = wrapper.isInRequestScope(contextId, inquirer);
295
- const isLazyTransient = wrapper.isLazyTransient(contextId, inquirer);
296
- const isExplicitlyRequested = wrapper.isExplicitlyRequested(contextId, inquirer);
297
- const isInContext = isStatic || isInRequestScope || isLazyTransient || isExplicitlyRequested;
294
+ const isInContext = wrapper.isStatic(contextId, inquirer) ||
295
+ wrapper.isInRequestScope(contextId, inquirer) ||
296
+ wrapper.isLazyTransient(contextId, inquirer) ||
297
+ wrapper.isExplicitlyRequested(contextId, inquirer);
298
298
  if (shared_utils_1.isNil(inject) && isInContext) {
299
299
  instanceHost.instance = wrapper.forwardRef
300
300
  ? Object.assign(instanceHost.instance, new metatype(...instances))
@@ -365,12 +365,12 @@ class Injector {
365
365
  return shared_utils_1.isFunction(token) ? token.name : token.toString();
366
366
  }
367
367
  printResolvingDependenciesLog(token, inquirer) {
368
- var _a;
368
+ var _a, _b, _c;
369
369
  if (!this.isDebugMode()) {
370
370
  return;
371
371
  }
372
372
  const tokenName = this.getTokenName(token);
373
- const dependentName = (_a = inquirer === null || inquirer === void 0 ? void 0 : inquirer.name) !== null && _a !== void 0 ? _a : 'unknown';
373
+ const dependentName = (_c = ((inquirer === null || inquirer === void 0 ? void 0 : inquirer.name) && ((_b = (_a = inquirer.name).toString) === null || _b === void 0 ? void 0 : _b.call(_a)))) !== null && _c !== void 0 ? _c : 'unknown';
374
374
  const isAlias = dependentName === tokenName;
375
375
  const messageToPrint = `Resolving dependency ${cli_colors_util_1.clc.cyanBright(tokenName)}${cli_colors_util_1.clc.green(' in the ')}${cli_colors_util_1.clc.yellow(dependentName)}${cli_colors_util_1.clc.green(` provider ${isAlias ? '(alias)' : ''}`)}`;
376
376
  this.logger.log(messageToPrint);
@@ -170,6 +170,9 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
170
170
  if ((_b = (_a = this.appOptions) === null || _a === void 0 ? void 0 : _a.autoFlushLogs) !== null && _b !== void 0 ? _b : true) {
171
171
  this.flushLogs();
172
172
  }
173
+ if (originalCallbackArgs[0] instanceof Error) {
174
+ return reject(originalCallbackArgs[0]);
175
+ }
173
176
  const address = this.httpServer.address();
174
177
  if (address) {
175
178
  this.httpServer.removeListener('error', errorHandler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "8.1.1",
3
+ "version": "8.2.2",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "uuid": "8.3.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "8.1.1"
39
+ "@nestjs/common": "8.2.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^8.0.0",