import { a as AppStoreConnectClient, k as Build } from './index-BKUapQP2.cjs'; /** * Shared types for the pilot module's upload backends. */ type UploadBackend = "altool" | "transporter"; interface PilotUploadOptions { ipaPath: string; apiKeyId: string; apiIssuerId: string; apiPrivateKey: string; /** Apple target platform. Defaults to "ios". */ platform?: "ios" | "osx" | "appletvos"; /** Upload timeout in ms. Defaults to 30 min. */ timeout?: number; /** Stream callback for upload progress / log lines. */ onOutput?: (chunk: string) => void; /** * Which backend to use. Defaults to "auto": * - altool on macOS (requires Xcode CLI) * - transporter on Linux (requires Java + iTMSTransporter) */ backend?: UploadBackend | "auto"; } interface UploadResult { success: boolean; output: string; /** Which backend actually ran. Useful for logs/metrics. */ backend: UploadBackend; } /** * Upload a build to TestFlight via Apple's `altool` (macOS only). * * altool ships with Xcode command-line tools. It provides richer error * output than iTMSTransporter but is only available on macOS. */ declare function uploadWithAltool(options: PilotUploadOptions): Promise; /** * Upload a build to TestFlight via Apple's iTMSTransporter (Java). * * This path works on Linux (and macOS) and does NOT require Xcode. * It is the primary upload path for the ship worker LXC. * * iTMSTransporter reads the ASC API private key from a directory * named by API_PRIVATE_KEYS_DIR, looking for the file `AuthKey_.p8`. */ declare function uploadWithTransporter(options: PilotUploadOptions): Promise; /** * Classify upload failures into transient vs. permanent buckets. * * Apple's App Store Connect / iTMSTransporter backend is flaky: * the finalize step ("CHANGE UPLOAD STATE TO COMPLETE") periodically * returns 500, and the Java transporter surfaces various connection * errors during long uploads. These are all safe to retry — the IPA * is deterministic and Apple deduplicates on build number. * * Non-transient errors (invalid binary, duplicate build number, auth * failure) should NOT be retried — they will never succeed without * the caller taking some action. */ type TransientUploadError = "apple_5xx" | "finalize_failed" | "network_timeout" | "connection_reset" | "transporter_jvm_error"; /** * Returns the transient-error kind if the output matches any known * retry-worthy pattern, or `null` if the error is non-transient. */ declare function classifyUploadError(output: string): TransientUploadError | null; /** * Convenience: `true` if the upload should be retried. */ declare function isTransientUploadError(output: string): boolean; /** * Locate the iTMSTransporter binary on this host. * * Apple ships iTMSTransporter as a Java-based tool bundled with Xcode * on macOS, and as a standalone Linux distribution used by media * publishers for CI. Either works for uploading IPAs — same protocol, * same ASC API key format. * * Resolution order: * 1. ITMSTRANSPORTER_BIN env var (pinning for prod deployments) * 2. Well-known system paths for the host OS * 3. Throw with a clear install hint * * We deliberately do NOT auto-download Transporter. Apple's download * URL is not versioned and the license/redistribution story is fuzzy. * Prod hosts should install it once via apt/brew/manual, then pin via * env var so CI is reproducible. */ declare function resolveTransporter(): Promise; /** * Verify that Java is available on PATH. iTMSTransporter is a Java * application and won't run without a JRE. */ declare function verifyJava(): Promise<{ version: string; }>; interface PilotDistributeOptions { client: AppStoreConnectClient; buildId: string; groupNames?: string[]; changelog?: string; locale?: string; expirePreviousBuilds?: boolean; submitForReview?: boolean; } /** * Upload a build to TestFlight. * * Selects the upload backend based on the host OS: * - macOS → altool (ships with Xcode CLI) * - Linux → iTMSTransporter (standalone Java tool from Apple) * * Pass `backend` to force a specific path, e.g. for testing the * Linux path on a mac dev machine. */ declare function uploadToTestFlight(options: PilotUploadOptions): Promise; declare function waitForProcessing(client: AppStoreConnectClient, params: { bundleId: string; buildNumber: string; appVersion: string; timeout?: number; pollInterval?: number; }): Promise; declare function distributeToGroups(options: PilotDistributeOptions): Promise; declare function setChangelog(options: { client: AppStoreConnectClient; buildId: string; changelog: string; locale?: string; }): Promise; declare function expireBuild(client: AppStoreConnectClient, buildId: string): Promise; type index_PilotDistributeOptions = PilotDistributeOptions; type index_PilotUploadOptions = PilotUploadOptions; type index_TransientUploadError = TransientUploadError; type index_UploadBackend = UploadBackend; type index_UploadResult = UploadResult; declare const index_classifyUploadError: typeof classifyUploadError; declare const index_distributeToGroups: typeof distributeToGroups; declare const index_expireBuild: typeof expireBuild; declare const index_isTransientUploadError: typeof isTransientUploadError; declare const index_resolveTransporter: typeof resolveTransporter; declare const index_setChangelog: typeof setChangelog; declare const index_uploadToTestFlight: typeof uploadToTestFlight; declare const index_uploadWithAltool: typeof uploadWithAltool; declare const index_uploadWithTransporter: typeof uploadWithTransporter; declare const index_verifyJava: typeof verifyJava; declare const index_waitForProcessing: typeof waitForProcessing; declare namespace index { export { type index_PilotDistributeOptions as PilotDistributeOptions, type index_PilotUploadOptions as PilotUploadOptions, type index_TransientUploadError as TransientUploadError, type index_UploadBackend as UploadBackend, type index_UploadResult as UploadResult, index_classifyUploadError as classifyUploadError, index_distributeToGroups as distributeToGroups, index_expireBuild as expireBuild, index_isTransientUploadError as isTransientUploadError, index_resolveTransporter as resolveTransporter, index_setChangelog as setChangelog, index_uploadToTestFlight as uploadToTestFlight, index_uploadWithAltool as uploadWithAltool, index_uploadWithTransporter as uploadWithTransporter, index_verifyJava as verifyJava, index_waitForProcessing as waitForProcessing }; } export { type PilotDistributeOptions as P, type TransientUploadError as T, type UploadBackend as U, type PilotUploadOptions as a, type UploadResult as b, uploadWithAltool as c, distributeToGroups as d, expireBuild as e, uploadWithTransporter as f, classifyUploadError as g, isTransientUploadError as h, index as i, resolveTransporter as r, setChangelog as s, uploadToTestFlight as u, verifyJava as v, waitForProcessing as w };