How to use the @loopback/context.inject function in @loopback/context

To help you get started, we’ve selected a few @loopback/context examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / boot / src / booters / interceptor.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public interceptorConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set InterceptorProvider Booter Options if passed in via bootConfig
      Object.assign({}, InterceptorProviderDefaults, interceptorConfig),
    );
  }
github strongloop / loopback-next / packages / authentication / src / __tests__ / fixtures / services / basic-auth-user-service.ts View on Github external
constructor(
    @inject(USER_REPO)
    private userRepository: UserRepository,
    @inject(AuthenticationBindings.USER_PROFILE_FACTORY)
    public userProfileFactory: UserProfileFactory,
  ) {}
github strongloop / loopback-next / examples / log-extension / src / __tests__ / acceptance / log.extension.acceptance.ts View on Github external
constructor(
        @inject(SequenceActions.FIND_ROUTE) protected findRoute: FindRoute,
        @inject(SequenceActions.PARSE_PARAMS)
        protected parseParams: ParseParams,
        @inject(SequenceActions.INVOKE_METHOD) protected invoke: InvokeMethod,
        @inject(SequenceActions.SEND) protected send: Send,
        @inject(SequenceActions.REJECT) protected reject: Reject,
        @inject(EXAMPLE_LOG_BINDINGS.LOG_ACTION) protected logger: LogFn,
      ) {}
github gobackhuoxing / first-web-game-lb4 / firstgame / src / sequence.ts View on Github external
constructor(
    @inject(SequenceActions.FIND_ROUTE) protected findRoute: FindRoute,
    @inject(SequenceActions.PARSE_PARAMS) protected parseParams: ParseParams,
    @inject(SequenceActions.INVOKE_METHOD) protected invoke: InvokeMethod,
    @inject(SequenceActions.SEND) public send: Send,
    @inject(SequenceActions.REJECT) public reject: Reject,
    //add
    @inject(AuthenticationBindings.AUTH_ACTION)
    protected authenticateRequest: AuthenticateFn,
  ) {}
github strongloop / loopback-next / packages / core / src / extension-point.ts View on Github external
export function extensions(extensionPointName?: string) {
  return inject('', {decorator: '@extensions'}, (ctx, injection, session) => {
    extensionPointName =
      extensionPointName ??
      inferExtensionPointName(injection.target, session.currentBinding);

    const bindingFilter = extensionFilter(extensionPointName);
    return createViewGetter(
      ctx,
      bindingFilter,
      injection.metadata.bindingComparator,
      session,
    );
  });
}
github strongloop / loopback-next / packages / rest-explorer / src / rest-explorer.controller.ts View on Github external
constructor(
    @inject(RestBindings.CONFIG, {optional: true})
    restConfig: RestServerConfig = {},
    @inject(RestExplorerBindings.CONFIG, {optional: true})
    explorerConfig: RestExplorerConfig = {},
    @inject(RestBindings.BASE_PATH) private serverBasePath: string,
    @inject(RestBindings.SERVER) private restServer: RestServer,
    @inject(RestBindings.Http.CONTEXT) private requestContext: RequestContext,
  ) {
    this.useSelfHostedSpec = explorerConfig.useSelfHostedSpec !== false;
    this.openApiSpecUrl = this.getOpenApiSpecUrl(restConfig);
  }
github strongloop / loopback-next / packages / rest-explorer / src / rest-explorer.controller.ts View on Github external
constructor(
    @inject(RestBindings.CONFIG, {optional: true})
    restConfig: RestServerConfig = {},
    @inject(RestExplorerBindings.CONFIG, {optional: true})
    explorerConfig: RestExplorerConfig = {},
    @inject(RestBindings.BASE_PATH) private serverBasePath: string,
    @inject(RestBindings.SERVER) private restServer: RestServer,
    @inject(RestBindings.Http.CONTEXT) private requestContext: RequestContext,
  ) {
    this.useSelfHostedSpec = explorerConfig.useSelfHostedSpec !== false;
    this.openApiSpecUrl = this.getOpenApiSpecUrl(restConfig);
  }
github strongloop / loopback-next / packages / boot / src / booters / application-metadata.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) public app: Application,
    @inject(BootBindings.PROJECT_ROOT) private projectRoot: string,
  ) {}
github sourcefuse / loopback4-starter / src / controllers / ping.controller.ts View on Github external
  constructor(@inject(RestBindings.Http.REQUEST) private req: Request) {}