MCPcopy
hub / github.com/nestjs/nest / loadMiddleware

Method loadMiddleware

packages/core/injector/injector.ts:225–244  ·  view source on GitHub ↗
(
    wrapper: InstanceWrapper,
    collection: Map<InjectionToken, InstanceWrapper>,
    moduleRef: Module,
    contextId = STATIC_CONTEXT,
    inquirer?: InstanceWrapper,
  )

Source from the content-addressed store, hash-verified

223 }
224
225 public async loadMiddleware(
226 wrapper: InstanceWrapper,
227 collection: Map<InjectionToken, InstanceWrapper>,
228 moduleRef: Module,
229 contextId = STATIC_CONTEXT,
230 inquirer?: InstanceWrapper,
231 ) {
232 const { metatype, token } = wrapper;
233 const targetWrapper = collection.get(token)!;
234 if (!isUndefined(targetWrapper.instance)) {
235 return;
236 }
237 targetWrapper.instance = Object.create(metatype!.prototype);
238 await this.loadInstance(
239 wrapper,
240 collection,
241 moduleRef,
242 this.createResolutionContext(contextId, inquirer || wrapper),
243 );
244 }
245
246 public async loadController(
247 wrapper: InstanceWrapper<Controller>,

Callers 2

injector.spec.tsFile · 0.80

Calls 5

loadInstanceMethod · 0.95
isUndefinedFunction · 0.90
getMethod · 0.65
createMethod · 0.65

Tested by

no test coverage detected