import { ComponentDetails } from 'jfrog-client-js' ; import Set from 'typescript-collections/dist/lib/Set' ; import * as vscode from 'vscode' ; import { ConnectionManager } from '../connect/connectionManager' ; import { ConnectionUtils } from '../connect/connectionUtils' ; import { ExtensionComponent } from '../extensionComponent' ; import { LogManager } from '../log/logManager' ; import { ScanCacheManager } from '../scanCache/scanCacheManager' ; import { AbstractScanLogic } from './abstractScanLogic' ; import { ComponentSummaryScanLogic } from './componentSummaryScanLogic' ; import { GraphScanLogic } from './graphScanLogic' ; /**
 * Provides the scan logic type - "summary/component" or "scan/graph" according to the Xray version.
 */ export class ScanLogicManager implements ExtensionComponent { constructor ( protected _connectionManager , protected _scanCacheManager , protected _logManager ) { } activate ( ) { return this ; } public async scanAndCache ( progress , componentsToScan , checkCanceled ) { const totalComponents = componentsToScan . size ( ) ; if ( totalComponents === 0 ) { return ; } let scanGraphSupported = await ConnectionUtils . testXrayVersionForScanGraph ( this . _connectionManager . createJfrogClient ( ) , this . _logManager ) ; let scanLogic = scanGraphSupported ? new GraphScanLogic ( this . _connectionManager , this . _scanCacheManager ) : new ComponentSummaryScanLogic ( this . _connectionManager , this . _scanCacheManager ) ; await scanLogic . scanAndCache ( progress , componentsToScan , checkCanceled ) ; } }