import { HttpClient } from '..'; import { IGraphRequestModel, IGraphResponse, ILogger } from '../../model/'; import { XrayScanProgress } from './XrayScanProgress'; export declare class XrayScanClient { private readonly httpClient; private readonly endPoint; private readonly logger; private static readonly SLEEP_INTERVAL_MILLISECONDS; private static readonly MAX_ATTEMPTS; constructor(httpClient: HttpClient, endPoint: string, logger: ILogger); graph(request: IGraphRequestModel, progress: XrayScanProgress, checkCanceled: () => void, projectKey: string | undefined, watches: string[] | undefined, multiScanId?: string, technologies?: string[], sleepIntervalMilliseconds?: number): Promise; /** * * Send 'POST /scan/graph' request to Xray. * * @param request - The Graph to scan * @param projectKey - Project key or undefined * @param watches - List of Watches or undefined * @returns the graph response. * @throws an exception if an unexpected response received from Xray. */ private postScanGraph; /** * Get URL for "POST scan/graph" (Xray: api/v1/scan/graph, XSC: api/v1/sca/scan/graph). * If no project key provided - /scan/graph * If project key was provided - /scan/graph?project= * If watches provided - /scan/graph?watch=&watch= * If multiScanId provided - /scan/graph?multi_scan_id= * If technologies provided - /scan/graph?tech=&tech= * @param projectKey - Project key or undefined * @param watches - List of Watches or undefined * @param multiScanId - Multi scan ID or undefined * @param technologies - List of technologies or undefined * @returns URL for "POST /scan/graph" */ private getUrl; /** * * Sends 'GET /scan/graph?...' requests to Xray and waits for 200 response. * If 202 response is received, it updates the progress and waits sleepIntervalMilliseconds. * If any other response received, it throws an error. * * @param scanId - The scan ID received from Xray, after running a 'POST scan/graph' request * @param progress - The progress that will be updated after every 202 response from Xray * @param checkCanceled - Function that may stop the scan if it throws an exception * @param includeVulnerabilities - True if no context (project or watches) is provided * @param sleepIntervalMilliseconds - Sleep interval in milliseconds between attepts * @returns the graph response * @throws an exception if an unexpected response received from Xray or if checkCanceled threw an exception */ private getScanGraphResults; private delay; }