@nestjs/core 10.2.4 → 10.2.6

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
@@ -89,7 +89,9 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
89
89
 
90
90
  <table style="text-align:center;"><tr>
91
91
  <td><a href="https://n.inc" target="_blank"><img src="https://nestjs.com/img/n-inc-logo.svg" width="120" valign="middle" /></td>
92
- <td><a href="https://twistag.com/" target="_blank"><img src="https://nestjs.com/img/twistag-logo.png" width="120" valign="middle" /></td></tr>
92
+ <td><a href="https://twistag.com/" target="_blank"><img src="https://nestjs.com/img/twistag-logo.png" width="120" valign="middle" /></td>
93
+ <td><a href="https://immediateedgeapp.org/" target="_blank"><img src="https://nestjs.com/img/immediate-edge-logo.png" width="120" valign="middle" /></td>
94
+ </tr>
93
95
  </table>
94
96
 
95
97
  #### Sponsors
@@ -116,6 +118,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
116
118
  <td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
117
119
  <td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/julienferand-logo.jpeg" width="65" valign="middle" /></a></td>
118
120
  <td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/tripoffice-logo.png" width="140" valign="middle" /></a></td>
121
+ <td align="center" valign="middle"><a href="https://solcellsforetag.se/" target="_blank"><img src="https://nestjs.com/img/solcellsforetag-logo.svg" width="140" valign="middle" /></a></td>
119
122
  </tr></table>
120
123
 
121
124
  ## Backers
@@ -124,9 +127,9 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
124
127
 
125
128
  ## Stay in touch
126
129
 
127
- - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
130
+ - Author - [Kamil Myśliwiec](https://x.com/kammysliwiec)
128
131
  - Website - [https://nestjs.com](https://nestjs.com/)
129
- - Twitter - [@nestframework](https://twitter.com/nestframework)
132
+ - X - [@nestframework](https://x.com/nestframework)
130
133
 
131
134
  ## License
132
135
 
@@ -8,8 +8,9 @@ const discovery_service_1 = require("./discovery-service");
8
8
  /**
9
9
  * @publicApi
10
10
  */
11
- let DiscoveryModule = exports.DiscoveryModule = class DiscoveryModule {
11
+ let DiscoveryModule = class DiscoveryModule {
12
12
  };
13
+ exports.DiscoveryModule = DiscoveryModule;
13
14
  exports.DiscoveryModule = DiscoveryModule = tslib_1.__decorate([
14
15
  (0, common_1.Module)({
15
16
  providers: [metadata_scanner_1.MetadataScanner, discovery_service_1.DiscoveryService],
@@ -9,7 +9,7 @@ const discoverable_meta_host_collection_1 = require("./discoverable-meta-host-co
9
9
  /**
10
10
  * @publicApi
11
11
  */
12
- let DiscoveryService = exports.DiscoveryService = class DiscoveryService {
12
+ let DiscoveryService = class DiscoveryService {
13
13
  constructor(modulesContainer) {
14
14
  this.modulesContainer = modulesContainer;
15
15
  }
@@ -91,6 +91,7 @@ let DiscoveryService = exports.DiscoveryService = class DiscoveryService {
91
91
  return moduleRefs.filter(({ metatype }) => include.some(item => item === metatype));
92
92
  }
93
93
  };
94
+ exports.DiscoveryService = DiscoveryService;
94
95
  exports.DiscoveryService = DiscoveryService = tslib_1.__decorate([
95
96
  (0, common_1.Injectable)(),
96
97
  tslib_1.__metadata("design:paramtypes", [modules_container_1.ModulesContainer])
@@ -11,7 +11,7 @@ const ReflectorAliasProvider = {
11
11
  provide: services_1.Reflector.name,
12
12
  useExisting: services_1.Reflector,
13
13
  };
14
- let InternalCoreModule = exports.InternalCoreModule = InternalCoreModule_1 = class InternalCoreModule {
14
+ let InternalCoreModule = InternalCoreModule_1 = class InternalCoreModule {
15
15
  static register(providers) {
16
16
  return {
17
17
  module: InternalCoreModule_1,
@@ -20,6 +20,7 @@ let InternalCoreModule = exports.InternalCoreModule = InternalCoreModule_1 = cla
20
20
  };
21
21
  }
22
22
  };
23
+ exports.InternalCoreModule = InternalCoreModule;
23
24
  exports.InternalCoreModule = InternalCoreModule = InternalCoreModule_1 = tslib_1.__decorate([
24
25
  (0, common_1.Global)(),
25
26
  (0, common_1.Module)({
@@ -99,8 +99,8 @@ export declare abstract class ModuleRef extends AbstractInstanceResolver {
99
99
  abstract resolve<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol, contextId?: {
100
100
  id: number;
101
101
  }, options?: ModuleRefGetOrResolveOpts): Promise<TResult | Array<TResult>>;
102
- abstract create<T = any>(type: Type<T>): Promise<T>;
102
+ abstract create<T = any>(type: Type<T>, contextId?: ContextId): Promise<T>;
103
103
  introspect<T = any>(token: Type<T> | string | symbol): IntrospectionResult;
104
104
  registerRequestByContextId<T = any>(request: T, contextId: ContextId): void;
105
- protected instantiateClass<T = any>(type: Type<T>, moduleRef: Module): Promise<T>;
105
+ protected instantiateClass<T = any>(type: Type<T>, moduleRef: Module, contextId?: ContextId): Promise<T>;
106
106
  }
@@ -34,7 +34,7 @@ class ModuleRef extends abstract_instance_resolver_1.AbstractInstanceResolver {
34
34
  registerRequestByContextId(request, contextId) {
35
35
  this.container.registerRequestProvider(request, contextId);
36
36
  }
37
- async instantiateClass(type, moduleRef) {
37
+ async instantiateClass(type, moduleRef, contextId) {
38
38
  const wrapper = new instance_wrapper_1.InstanceWrapper({
39
39
  name: type && type.name,
40
40
  metatype: type,
@@ -46,12 +46,12 @@ class ModuleRef extends abstract_instance_resolver_1.AbstractInstanceResolver {
46
46
  return new Promise(async (resolve, reject) => {
47
47
  try {
48
48
  const callback = async (instances) => {
49
- const properties = await this.injector.resolveProperties(wrapper, moduleRef);
49
+ const properties = await this.injector.resolveProperties(wrapper, moduleRef, undefined, contextId);
50
50
  const instance = new type(...instances);
51
51
  this.injector.applyProperties(instance, properties);
52
52
  resolve(instance);
53
53
  };
54
- await this.injector.resolveConstructorParams(wrapper, moduleRef, undefined, callback);
54
+ await this.injector.resolveConstructorParams(wrapper, moduleRef, undefined, callback, contextId);
55
55
  }
56
56
  catch (err) {
57
57
  reject(err);
@@ -398,11 +398,11 @@ class Module {
398
398
  options.each ??= false;
399
399
  return this.resolvePerContext(typeOrToken, self, contextId, options);
400
400
  }
401
- async create(type) {
401
+ async create(type, contextId) {
402
402
  if (!(type && (0, shared_utils_1.isFunction)(type) && type.prototype)) {
403
403
  throw new exceptions_1.InvalidClassException(type);
404
404
  }
405
- return this.instantiateClass(type, self);
405
+ return this.instantiateClass(type, self, contextId);
406
406
  }
407
407
  };
408
408
  }
@@ -51,7 +51,7 @@ class RoutesMapper {
51
51
  const concatPaths = (acc, currentValue) => acc.concat(currentValue);
52
52
  const toUndefinedIfNeural = (version) => version === interfaces_1.VERSION_NEUTRAL ? undefined : version;
53
53
  const toRouteInfo = (item, prefix) => item.path
54
- ?.map(p => {
54
+ ?.flatMap(p => {
55
55
  let endpointPath = modulePath ?? '';
56
56
  endpointPath += this.normalizeGlobalPath(prefix) + (0, shared_utils_1.addLeadingSlash)(p);
57
57
  const routeInfo = {
@@ -69,8 +69,7 @@ class RoutesMapper {
69
69
  routeInfo.version = toUndefinedIfNeural(version);
70
70
  }
71
71
  return routeInfo;
72
- })
73
- .flat();
72
+ });
74
73
  return []
75
74
  .concat(routePath)
76
75
  .map(routePath => controllerPaths
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "10.2.4",
3
+ "version": "10.2.6",
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.4"
39
+ "@nestjs/common": "10.2.6"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^10.0.0",
@@ -13,7 +13,7 @@ exports.targetModulesByContainer = new WeakMap();
13
13
  /**
14
14
  * @publicApi
15
15
  */
16
- let RouterModule = exports.RouterModule = RouterModule_1 = class RouterModule {
16
+ let RouterModule = RouterModule_1 = class RouterModule {
17
17
  constructor(modulesContainer, routes) {
18
18
  this.modulesContainer = modulesContainer;
19
19
  this.routes = routes;
@@ -72,6 +72,7 @@ let RouterModule = exports.RouterModule = RouterModule_1 = class RouterModule {
72
72
  moduleClassSet.add(moduleRef);
73
73
  }
74
74
  };
75
+ exports.RouterModule = RouterModule;
75
76
  exports.RouterModule = RouterModule = RouterModule_1 = tslib_1.__decorate([
76
77
  (0, common_1.Module)({}),
77
78
  tslib_1.__param(1, (0, common_1.Inject)(exports.ROUTES)),