@nestjs/core 10.2.4 → 10.2.5

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.
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "10.2.4",
3
+ "version": "10.2.5",
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.5"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^10.0.0",