import { spawnSync } from "node:child_process"; import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; import type { ArkValidator } from "./schema/index.js"; export type HttpRuntime = "node" | "bun"; type RequestArgs = { method: "GET" | "POST" | "DELETE"; path: string; token?: string; body?: unknown; retryCount?: number; acceptedStatuses?: number[]; } | { method: "GET" | "POST" | "DELETE"; url: string; token?: string; body?: unknown; retryCount?: number; acceptedStatuses?: number[]; }; type FormRequestArgs = { method: "POST"; path: string; token?: string; form: FormData; retryCount?: number; } | { method: "POST"; url: string; token?: string; form: FormData; retryCount?: number; }; type TextRequestArgs = { path: string; token?: string; } | { url: string; token?: string; }; type BinaryUploadArgs = { url: string; bytes: Uint8Array; contentType?: string; retryCount?: number; }; type DownloadZipArgs = { slug: string; ownerHandle?: string; version?: string; token?: string; }; type HttpClientDeps = { runtime: HttpRuntime; fetchImpl: typeof fetch; setTimeoutImpl: typeof setTimeout; clearTimeoutImpl: typeof clearTimeout; spawnSyncImpl: typeof spawnSync; mkdirImpl: typeof mkdir; mkdtempImpl: typeof mkdtemp; readFileImpl: typeof readFile; rmImpl: typeof rm; writeFileImpl: typeof writeFile; tmpdirPath: string; now: () => number; random: () => number; env: NodeJS.ProcessEnv; configureDispatcher: boolean; }; export type HttpClientOptions = Partial> & { runtime?: HttpRuntime; }; type HttpClient = { apiRequest(registry: string, args: RequestArgs): Promise; apiRequest(registry: string, args: RequestArgs, schema: ArkValidator): Promise; apiRequestForm(registry: string, args: FormRequestArgs): Promise; apiRequestForm(registry: string, args: FormRequestArgs, schema: ArkValidator): Promise; fetchText(registry: string, args: TextRequestArgs): Promise; fetchBinary(registry: string, args: TextRequestArgs): Promise; uploadBinary(args: BinaryUploadArgs, schema?: ArkValidator): Promise; downloadZip(registry: string, args: DownloadZipArgs): Promise; }; export declare function detectHttpRuntime(processVersions?: NodeJS.ProcessVersions | undefined): HttpRuntime; export declare function shouldUseProxyFromEnv(env?: NodeJS.ProcessEnv): boolean; export declare function registryUrl(path: string, registry: string): URL; export declare function createHttpClient(options?: HttpClientOptions): HttpClient; export declare function apiRequest(registry: string, args: RequestArgs): Promise; export declare function apiRequest(registry: string, args: RequestArgs, schema: ArkValidator): Promise; export declare function apiRequestForm(registry: string, args: FormRequestArgs): Promise; export declare function apiRequestForm(registry: string, args: FormRequestArgs, schema: ArkValidator): Promise; export declare function fetchText(registry: string, args: TextRequestArgs): Promise; export declare function fetchBinary(registry: string, args: TextRequestArgs): Promise; export declare function uploadBinary(args: BinaryUploadArgs): Promise; export declare function uploadBinary(args: BinaryUploadArgs, schema: ArkValidator): Promise; export declare function downloadZip(registry: string, args: DownloadZipArgs): Promise>; export {};