MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / resolveAsGetter

Function resolveAsGetter

packages/context/src/inject.ts:430–447  ·  view source on GitHub ↗

* Resolver for `@inject.getter` * @param ctx * @param injection * @param session

(
  ctx: Context,
  injection: Readonly<Injection>,
  session: ResolutionSession,
)

Source from the content-addressed store, hash-verified

428 * @param session
429 */
430function resolveAsGetter(
431 ctx: Context,
432 injection: Readonly<Injection>,
433 session: ResolutionSession,
434) {
435 assertTargetType(injection, Function, 'Getter function');
436 const bindingSelector = injection.bindingSelector as BindingAddress;
437 const options: ResolutionOptions = {
438 // https://github.com/loopbackio/loopback-next/issues/9041
439 // We should start with a new session for `getter` resolution to avoid
440 // possible circular dependencies
441 session: undefined,
442 ...injection.metadata,
443 };
444 return function getter() {
445 return ctx.get(bindingSelector, options);
446 };
447}
448
449/**
450 * Resolver for `@inject.setter`

Callers

nothing calls this directly

Calls 2

assertTargetTypeFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected