import { Binding , Component , ControllerClass , CoreBindings , inject , ProviderMap , } from '@loopback/core' ; import { Class , Model , Repository } from '@loopback/repository' ; import { RestApplication } from '@loopback/rest' ; import { BearerVerifierBindings , BearerVerifierComponent , BearerVerifierConfig , BearerVerifierType , CoreComponent , IServiceConfig , SECURITY_SCHEME_SPEC , ServiceSequence , } from '@sourceloop/core' ; import { AuthenticationComponent } from 'loopback4-authentication' ; import { AuthorizationBindings , AuthorizationComponent , } from 'loopback4-authorization' ; import { VideoChatArchiveController } from './controllers/video-chat-archive.controller' ; import { VideoChatSessionController } from './controllers/video-chat-session.controller' ; import { MeetLinkGeneratorProvider , ServiceBindings , VideoChatBindings , } from './keys' ; import { AuditLogs } from './models/audit-logs.model' ; import { VideoChatSession } from './models/video-chat-session.model' ; import { VonageProvider } from './providers/vonage/vonage.provider' ; import { VonageService } from './providers/vonage/vonage.service' ; import { SessionAttendeesRepository } from './repositories' ; import { AuditLogsRepository } from './repositories/audit-logs.repository' ; import { VideoChatSessionRepository } from './repositories/video-chat-session.repository' ; import { ChatArchiveService , ChatSessionService , MeetingLinkIdGeneratorProvider , } from './services' ; export class VideoConfServiceComponent implements Component { constructor ( @ inject ( CoreBindings . APPLICATION_INSTANCE ) private readonly application , @ inject ( VideoChatBindings . Config , { optional : true } ) private readonly videChatConfig ? ) { this . bindings = [ ] ; this . providers = { } ; this . application . component ( CoreComponent ) ; this . application . api ( { openapi : '3.0.0' , info : { title : 'Video Conferencing Service' , version : '1.0.0' , } , paths : { } , components : { securitySchemes : SECURITY_SCHEME_SPEC , } , servers : [ { url : '/' } ] , } ) ; this . bindings . push ( Binding . bind ( ServiceBindings . SessionChatService ) . toClass ( ChatSessionService ) , Binding . bind ( ServiceBindings . ArchiveChatService ) . toClass ( ChatArchiveService ) ) ; this . application . service ( VonageService ) ; if ( ! this . videChatConfig ?. useCustomSequence ) { this . setupSequence ( this . bindings ) ; } this . repositories = [ AuditLogsRepository , VideoChatSessionRepository , SessionAttendeesRepository , ] ; this . models = [ AuditLogs , VideoChatSession ] ; this . providers = { [ VideoChatBindings . VideoChatProvider . key ] : VonageProvider , [ MeetLinkGeneratorProvider . key ] : MeetingLinkIdGeneratorProvider , } ; this . controllers = [ VideoChatArchiveController , VideoChatSessionController ] ; } providers ? : ProviderMap = { } ; bindings ? : Binding [ ] = [ ] ; /**
     * An optional list of Repository classes to bind for dependency injection
     * via `app.repository()` API.
     */ repositories ? : Class < Repository < Model > > [ ] ; /**
     * An optional list of Model classes to bind for dependency injection
     * via `app.model()` API.
     */ models ? : Class < Model > [ ] ; /**
     * An array of controller classes
     */ controllers ? : ControllerClass [ ] ; param bindings setupSequence ( bindings ) { this . application . sequence ( ServiceSequence ) ; this . application . component ( AuthenticationComponent ) ; this . application . bind ( BearerVerifierBindings . Config ) . to ( { authServiceUrl : '' , type : BearerVerifierType . service , } as BearerVerifierConfig ) ; this . application . component ( BearerVerifierComponent ) ; this . application . bind ( AuthorizationBindings . CONFIG ) . to ( { allowAlwaysPaths : [ '/explorer' ] , } ) ; this . application . component ( AuthorizationComponent ) ; } }