import { ErrorCodes, GenericErrorTypes } from './constants'; import { BundleFiles, SupportedFiles } from './interfaces/files.interface'; import { AnalysisResult, ReportResult } from './interfaces/analysis-result.interface'; import { AnalysisContext, AnalysisOptions, ReportOptions, ScmReportOptions } from './interfaces/analysis-options.interface'; type ResultSuccess = { type: 'success'; value: T; }; export type ResultError = { type: 'error'; error: { statusCode: E; statusText: string; apiName: string; detail?: string | undefined; }; }; export type Result = ResultSuccess | ResultError; export interface ConnectionOptions { baseURL: string; sessionToken: string; source: string; requestId?: string; org?: string; orgId?: string; extraHeaders?: { [key: string]: string; }; } type StartSessionResponseDto = { readonly draftToken: string; readonly loginURL: string; }; interface StartSessionOptions { readonly authHost: string; readonly source: string; } export declare function compressAndEncode(payload: unknown): Promise; /** * @deprecated This legacy authentication helper is kept for compatibility only and is not used by current internal consumers. */ export declare function startSession(options: StartSessionOptions): StartSessionResponseDto; export declare function getVerifyCallbackUrl(authHost: string): string; export type IpFamily = 6 | undefined; /** * @deprecated This legacy authentication helper is kept for compatibility only and is not used by current internal consumers. * * Dispatches a FORCED IPv6 request to test client's ISP and network capability. * * @return {number} IP family number used by the client. */ export declare function getIpFamily(authHost: string): Promise; type CheckSessionErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.loginInProgress; interface CheckSessionOptions { readonly authHost: string; readonly draftToken: string; readonly ipFamily?: IpFamily; } /** * @deprecated This legacy authentication helper is kept for compatibility only and is not used by current internal consumers. */ export declare function checkSession(options: CheckSessionOptions): Promise>; export interface FilterArgs { extraHeaders: Record; attempts: number; baseURL: string; source: string; requestId?: string; orgId?: string; } export declare function getFilters({ baseURL, orgId, attempts, source, extraHeaders, requestId, }: FilterArgs): Promise>; export type RemoteBundle = { readonly bundleHash: string; readonly missingFiles: string[]; }; export type CreateBundleErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.bigPayload | ErrorCodes.badRequest | ErrorCodes.notFound; interface CreateBundleOptions extends ConnectionOptions { files: BundleFiles; } export declare function createBundle(options: CreateBundleOptions): Promise>; export type CheckBundleErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.notFound; interface CheckBundleOptions extends ConnectionOptions { bundleHash: string; } export declare function checkBundle(options: CheckBundleOptions): Promise>; export type ExtendBundleErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.badRequest | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.bigPayload | ErrorCodes.notFound; interface ExtendBundleOptions extends ConnectionOptions { readonly bundleHash: string; readonly files: BundleFiles; readonly removedFiles?: string[]; } export declare function extendBundle(options: ExtendBundleOptions): Promise>; export declare enum AnalysisStatus { waiting = "WAITING", fetching = "FETCHING", analyzing = "ANALYZING", done = "DONE", failed = "FAILED", complete = "COMPLETE" } export type AnalysisResponseProgress = { readonly status: AnalysisStatus.waiting | AnalysisStatus.fetching | AnalysisStatus.analyzing | AnalysisStatus.done; readonly progress: number; }; export type AnalysisFailedResponse = { readonly status: AnalysisStatus.failed; }; export type GetAnalysisResponseDto = AnalysisResult | AnalysisFailedResponse | AnalysisResponseProgress; export type GetAnalysisErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.badRequest | ErrorCodes.notFound; export interface GetAnalysisOptions extends ConnectionOptions, AnalysisOptions, AnalysisContext { bundleHash: string; } export declare function getAnalysis(options: GetAnalysisOptions): Promise>; export type ReportErrorCodes = GenericErrorTypes | ErrorCodes.unauthorizedUser | ErrorCodes.unauthorizedBundleAccess | ErrorCodes.badRequest | ErrorCodes.notFound; export interface UploadReportOptions extends GetAnalysisOptions { report: ReportOptions; } export interface ScmUploadReportOptions extends ConnectionOptions, AnalysisOptions, AnalysisContext, ScmReportOptions { } export interface GetReportOptions extends ConnectionOptions { pollId: string; } export type InitUploadResponseDto = { reportId: string; }; export type InitScmUploadResponseDto = { testId: string; }; export type UploadReportResponseDto = ReportResult | AnalysisFailedResponse | AnalysisResponseProgress; /** * Trigger a file-based test with reporting. */ export declare function initReport(options: UploadReportOptions): Promise>; /** * Retrieve a file-based test with reporting. */ export declare function getReport(options: GetReportOptions): Promise>; /** * Trigger an SCM-based test with reporting. */ export declare function initScmReport(options: ScmUploadReportOptions): Promise>; /** * Fetch an SCM-based test with reporting. */ export declare function getScmReport(options: GetReportOptions): Promise>; export {};