import { Context } from '@azure/functions' ; import { Container } from 'inversify' ; import { BaseTelemetryProperties , ContextAwareLogger , loggerTypes } from 'logger' ; import { ProcessEntryPointBase } from '../process-entry-point-base' ; import { Newable } from './web-api-ioc-types' ; import { WebController } from './web-controller' ; export class WebControllerDispatcher extends ProcessEntryPointBase { constructor ( private readonly processLifeCycleContainer ) { super ( processLifeCycleContainer ) ; } public async processRequest ( container , controllerType , context , ... args ) { const logger = container . get ( ContextAwareLogger ) ; await logger . setup ( ) ; const controller = container . get ( controllerType ) as WebController ; return controller . invoke ( context , ... args ) ; } protected async runCustomAction ( container , ... args ) { } protected getTelemetryBaseProperties ( ) { const currentProcess = this . processLifeCycleContainer . get ( loggerTypes . Process ) ; return { source : 'azure-function' , serverInstanceId : currentProcess . env . WEBSITE_INSTANCE_ID , } ; } }