@nestjs/core 10.2.7 → 10.2.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.
@@ -43,11 +43,11 @@ class DiscoverableMetaHostCollection {
43
43
  }
44
44
  static getProvidersByMetaKey(hostContainerRef, metaKey) {
45
45
  const wrappersByMetaKey = this.providersByMetaKey.get(hostContainerRef);
46
- return wrappersByMetaKey.get(metaKey);
46
+ return wrappersByMetaKey?.get(metaKey) ?? new Set();
47
47
  }
48
48
  static getControllersByMetaKey(hostContainerRef, metaKey) {
49
49
  const wrappersByMetaKey = this.controllersByMetaKey.get(hostContainerRef);
50
- return wrappersByMetaKey.get(metaKey);
50
+ return wrappersByMetaKey?.get(metaKey) ?? new Set();
51
51
  }
52
52
  static inspectInstanceWrapper(hostContainerRef, instanceWrapper, wrapperByMetaKeyMap) {
53
53
  const metaKey = DiscoverableMetaHostCollection.getMetaKeyByInstanceWrapper(instanceWrapper);
@@ -16,20 +16,27 @@ const getInstanceName = (instance) => {
16
16
  return instance?.name;
17
17
  };
18
18
  /**
19
- * Returns the name of the dependency
19
+ * Returns the name of the dependency.
20
20
  * Tries to get the class name, otherwise the string value
21
- * (= injection token). As fallback it returns '+'
21
+ * (= injection token). As fallback to any falsy value for `dependency`, it
22
+ * returns `fallbackValue`
22
23
  * @param dependency The name of the dependency to be displayed
24
+ * @param fallbackValue The fallback value if the dependency is falsy
25
+ * @param disambiguated Whether dependency's name is disambiguated with double quotes
23
26
  */
24
- const getDependencyName = (dependency) =>
27
+ const getDependencyName = (dependency, fallbackValue, disambiguated = true) =>
25
28
  // use class name
26
29
  getInstanceName(dependency) ||
27
30
  // use injection token (symbol)
28
31
  ((0, shared_utils_1.isSymbol)(dependency) && dependency.toString()) ||
29
32
  // use string directly
30
- dependency ||
33
+ (dependency
34
+ ? disambiguated
35
+ ? `"${dependency}"`
36
+ : dependency
37
+ : undefined) ||
31
38
  // otherwise
32
- '+';
39
+ fallbackValue;
33
40
  /**
34
41
  * Returns the name of the module
35
42
  * Tries to get the class name. As fallback it returns 'current'.
@@ -38,9 +45,9 @@ getInstanceName(dependency) ||
38
45
  const getModuleName = (module) => (module && getInstanceName(module.metatype)) || 'current';
39
46
  const stringifyScope = (scope) => (scope || []).map(getInstanceName).join(' -> ');
40
47
  const UNKNOWN_DEPENDENCIES_MESSAGE = (type, unknownDependencyContext, module) => {
41
- const { index, name = 'dependency', dependencies, key, } = unknownDependencyContext;
48
+ const { index, name, dependencies, key } = unknownDependencyContext;
42
49
  const moduleName = getModuleName(module);
43
- const dependencyName = getDependencyName(name);
50
+ const dependencyName = getDependencyName(name, 'dependency');
44
51
  const potentialSolutions =
45
52
  // If module's name is well defined
46
53
  moduleName !== 'current'
@@ -66,7 +73,7 @@ Potential solutions:
66
73
  message += `. Please make sure that the "${key.toString()}" property is available in the current context.${potentialSolutions}`;
67
74
  return message;
68
75
  }
69
- const dependenciesName = (dependencies || []).map(getDependencyName);
76
+ const dependenciesName = (dependencies || []).map(dependencyName => getDependencyName(dependencyName, '+', false));
70
77
  dependenciesName[index] = '?';
71
78
  message += ` (`;
72
79
  message += dependenciesName.join(', ');
@@ -50,8 +50,7 @@ class RoutesMapper {
50
50
  const modulePath = this.getModulePath(moduleRef?.metatype);
51
51
  const concatPaths = (acc, currentValue) => acc.concat(currentValue);
52
52
  const toUndefinedIfNeural = (version) => version === interfaces_1.VERSION_NEUTRAL ? undefined : version;
53
- const toRouteInfo = (item, prefix) => item.path
54
- ?.flatMap(p => {
53
+ const toRouteInfo = (item, prefix) => item.path?.flatMap(p => {
55
54
  let endpointPath = modulePath ?? '';
56
55
  endpointPath += this.normalizeGlobalPath(prefix) + (0, shared_utils_1.addLeadingSlash)(p);
57
56
  const routeInfo = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "10.2.7",
3
+ "version": "10.2.8",
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
  "uid": "2.0.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "10.2.7"
39
+ "@nestjs/common": "10.2.8"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^10.0.0",