import { AttachmentsApi } from 'qase-api-client'; import { Attachment } from '../../models'; import { LoggerInterface } from '../../utils/logger'; export interface AttachmentUploadOptions { /** How many batches may be uploaded at the same time. Defaults to 4, clamped to 1..16. */ concurrency?: number | undefined; /** Per-request timeout in seconds. Defaults to 120. */ timeout?: number | undefined; } export declare class AttachmentService { private readonly logger; private readonly attachmentClient; private readonly concurrency; /** Pacing is off until the API actually pushes back with a 429. */ private rateLimited; private consecutiveSuccesses; private cooldownUntil; private readonly timeout; private readonly httpAgent; private readonly httpsAgent; constructor(logger: LoggerInterface, attachmentClient: AttachmentsApi, options?: AttachmentUploadOptions); /** * Axios options for one upload attempt. After a connection-level failure the pooled * socket is suspect, so that attempt gets a throwaway agent instead. */ private requestOptions; uploadAttachment(projectCode: string, attachment: Attachment): Promise; uploadAttachments(projectCode: string, attachments: Attachment[], uploadEnabled: boolean): Promise; uploadAttachmentsMapped(projectCode: string, attachments: readonly (Attachment | null | undefined)[], uploadEnabled: boolean): Promise>; /** * Sleeps between batches only while the API is rate limiting us. When no 429 has been * seen, batches follow each other immediately — pacing costs real time in CI and buys * nothing against connection resets. */ private pace; /** Blocks until the window requested by the last 429 (via Retry-After) has passed. */ private awaitCooldown; private noteRateLimited; private noteSuccess; private uploadBatch; private groupIntoBatches; private uploadWithRetry; private getRetryAfter; private isRetryableNetworkError; private delay; private ensureAttachmentSize; private prepareAttachmentData; }