import { BootMixin } from '@loopback/boot' ; import { ApplicationConfig } from '@loopback/core' ; import { RepositoryMixin } from '@loopback/repository' ; import { RestApplication } from '@loopback/rest' ; import { RestExplorerBindings , RestExplorerComponent , } from '@loopback/rest-explorer' ; import { ServiceMixin } from '@loopback/service-proxy' ; import { AuthenticationComponent , Strategies } from 'loopback4-authentication' ; import { AuthorizationBindings , AuthorizationComponent , } from 'loopback4-authorization' ; import * as path from 'path' ; import { BearerTokenVerifyProvider } from './bearer-token-verifier.provider' ; import { MySequence } from './sequence' ; import { NotificationServiceComponent } from '../component' ; import { NotificationDbDataSource } from './datasources/notification-db.datasource' ; import { NotificationDbCacheDataSource } from './datasources/notification-cache.datasource' ; import { NotificationBindings } from 'loopback4-notifications' ; import { ChannelManagerMockProvider , PubNubMockProvider , SnsMockProvider , } from './fixture' ; import { NotifServiceBindings } from '../keys' ; export { ApplicationConfig } ; export class NotificationApplication extends BootMixin ( ServiceMixin ( RepositoryMixin ( RestApplication ) ) ) { constructor ( options = { } ) { super ( options ) ; this . sequence ( MySequence ) ; this . static ( '/' , path . join ( __dirname , '../public' ) ) ; this . bind ( RestExplorerBindings . CONFIG ) . to ( { path : '/explorer' , } ) ; this . component ( RestExplorerComponent ) ; this . component ( NotificationServiceComponent ) ; this . component ( AuthenticationComponent ) ; this . dataSource ( NotificationDbDataSource ) ; this . dataSource ( NotificationDbCacheDataSource ) ; this . bind ( Strategies . Passport . BEARER_TOKEN_VERIFIER ) . toProvider ( BearerTokenVerifyProvider ) ; this . bind ( AuthorizationBindings . CONFIG ) . to ( { allowAlwaysPaths : [ '/explorer' ] , } ) ; this . component ( AuthorizationComponent ) ; this . bind ( NotificationBindings . NotificationProvider ) . toProvider ( SnsMockProvider ) ; this . bind ( NotificationBindings . PushProvider ) . toProvider ( PubNubMockProvider ) ; this . bind ( NotifServiceBindings . ChannelManager ) . toProvider ( ChannelManagerMockProvider ) ; this . projectRoot = __dirname ; this . bootOptions = { controllers : { dirs : [ 'controllers' ] , extensions : [ '.controller.js' ] , nested : true , } , repositories : { dirs : [ 'repositories' ] , extensions : [ '.repository.js' ] , nested : true , } , } ; } }