import { AvailabilityTestConfig } from 'common' ; import { IOrchestrationFunctionContext , Task } from 'durable-functions/lib/src/classes' ; import { Logger } from 'logger' ; import { ActivityAction } from '../contracts/activity-actions' ; import { WebApiConfig } from '../controllers/web-api-config' ; import { ActivityActionDispatcher } from './activity-action-dispatcher' ; import { OrchestrationLogger } from './orchestration-logger' ; import { OrchestrationSteps } from './orchestration-steps' ; import { ScanWaitOrchestrator } from './scan-wait-orchestrator' ; export type OrchestrationStepsFactory = typeof createOrchestrationSteps ; export function * createOrchestrationSteps ( orchestrationContext , availabilityTestConfig , logger , createActivityActionDispatcher = ( context , orchLogger ) => new ActivityActionDispatcher ( context , orchLogger ) ) { const orchestrationLogger = new OrchestrationLogger ( orchestrationContext , logger ) ; const activityActionDispatcher = createActivityActionDispatcher ( orchestrationContext , orchestrationLogger ) ; const scanWaitOrchestrator = new ScanWaitOrchestrator ( orchestrationContext , activityActionDispatcher , orchestrationLogger ) ; const webApiConfig = ( yield * activityActionDispatcher . callActivity ( ActivityAction . getWebApiConfig ) ) as WebApiConfig ; return new OrchestrationSteps ( orchestrationContext , availabilityTestConfig , orchestrationLogger , activityActionDispatcher , scanWaitOrchestrator , webApiConfig ) ; }