import { Connection, Logger, PollingClient } from '@salesforce/core'; import { SfdxFileFormat } from '../convert/types'; import { ComponentSet } from '../collections/componentSet'; import { AsyncResult, MetadataRequestStatus, MetadataTransferResult } from './types'; export type MetadataTransferOptions = { usernameOrConnection: string | Connection; components?: ComponentSet; apiVersion?: string; id?: string; }; export declare abstract class MetadataTransfer { protected components?: ComponentSet; protected logger: Logger; protected canceled: boolean; protected mdapiTempDir?: string; private transferId; private event; private usernameOrConnection; private apiVersion?; private consecutiveErrorRetries; private errorRetryLimit; private errorRetryLimitExceeded; constructor({ usernameOrConnection, components, apiVersion, id }: Options); get id(): Options['id']; /** * Send the metadata transfer request to the org. * * @returns AsyncResult from the deploy or retrieve response. */ start(): Promise; /** * Poll for the status of the metadata transfer request. * Default frequency is 100 ms. * Default timeout is 60 minutes. * * @param options Polling options; frequency, timeout, polling function. * @returns The result of the deploy or retrieve. */ pollStatus(options?: Partial): Promise; /** * Poll for the status of the metadata transfer request. * Default frequency is based on the number of SourceComponents, n, in the transfer, it ranges from 100ms -> n * Default timeout is 60 minutes. * * @param frequency Polling frequency in milliseconds. * @param timeout Polling timeout in seconds. * @returns The result of the deploy or retrieve. */ pollStatus(frequency?: number, timeout?: number): Promise; onUpdate(subscriber: (result: Status) => void): void; onFinish(subscriber: (result: Result) => void): void; onCancel(subscriber: (result: Status | undefined) => void): void; onError(subscriber: (result: Error) => void): void; protected maybeSaveTempDirectory(target: SfdxFileFormat, cs?: ComponentSet): Promise; protected getConnection(): Promise; private isRetryableError; private poll; abstract checkStatus(): Promise; abstract cancel(): Promise; protected abstract pre(): Promise; protected abstract post(result: Status): Promise; } /** there's an options object OR 2 raw number param, there's defaults including freq based on the CS size */ export declare const normalizePollingInputs: (frequencyOrOptions?: number | Partial, timeout?: number, componentSetSize?: number) => Pick; /** based on the size of the components, pick a reasonable polling frequency */ export declare const calculatePollingFrequency: (size: number) => number; /** * Calculate the maximum number of consecutive retryable errors allowed during polling. * This limit prevents infinite loops from repeated network/server errors while allowing * normal status polling to continue indefinitely (until timeout). * * Default is 1000 consecutive errors, which can be overridden via SF_METADATA_POLL_ERROR_RETRY_LIMIT. * * @param logger Logger instance for logging when env var override is used * @returns The maximum number of consecutive errors to tolerate */ export declare const calculateErrorRetryLimit: (logger: Logger) => number;