MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / resolve

Function resolve

examples/context/src/custom-inject-resolve.ts:21–30  ·  view source on GitHub ↗
(
  ctx: Context,
  injection: Readonly<Injection>,
  session: ResolutionSession,
)

Source from the content-addressed store, hash-verified

19 * @param session Current resolution session
20 */
21const resolve: ResolverFunction = (
22 ctx: Context,
23 injection: Readonly<Injection>,
24 session: ResolutionSession,
25) => {
26 console.log('Context: %s Binding: %s', ctx.name, session.currentBinding!.key);
27 const targetName = ResolutionSession.describeInjection(injection).targetName;
28 console.log('Injection: %s', targetName);
29 return injection.member === 'prefix' ? new Date().toISOString() : 'John';
30};
31
32/**
33 * A class with dependency injection

Callers 15

greetMethod · 0.70
getAppFunction · 0.50
getAppAndClientFunction · 0.50
booter.unit.tsFile · 0.50
existsMethod · 0.50
getAppAndClientFunction · 0.50
authenticateMethod · 0.50
closeWsHttpServerMethod · 0.50
closeWsServerMethod · 0.50

Calls 2

describeInjectionMethod · 0.80
logMethod · 0.65

Tested by 4

getAppFunction · 0.40
getAppAndClientFunction · 0.40
getAppAndClientFunction · 0.40
createWsClientFunction · 0.40