import { OrgFormationError } from '../org-formation-error' ; import { GenericTaskRunner , ITaskRunnerDelegates } from '~core/generic-task-runner' ; import { IGenericTask } from '~plugin/plugin-binder' ; export class DefaultTaskRunner { public static async RunTasks ( tasks , logicalName , logVerbose , maxConcurrentTasks , failedTasksTolerance ) { if ( maxConcurrentTasks === undefined ) { throw new OrgFormationError ( 'maxConcurrentTasks must not be undefined' ) ; } if ( failedTasksTolerance === undefined ) { throw new OrgFormationError ( 'failedTasksTolerance must not be undefined' ) ; } const delegate = { getName : task => `Workload ${ task . logicalName } in ${ task . accountId }/${ task . region }` , getVerb : task => `${ task . action === 'Delete' ? 'deleted' : 'updated' }` , maxConcurrentTasks , failedTasksTolerance , logVerbose , } ; await GenericTaskRunner . RunTasks < IGenericTask > ( tasks , delegate ) ; } }