UNPKG

cnpmcore

Version:

Private NPM Registry for Enterprise

33 lines (32 loc) 1.52 kB
import { type ImplDecorator, HttpClient, Logger } from 'egg'; import type { BinaryName, BinaryTaskConfig } from '../../../../config/binaries.ts'; import type { BinaryType } from '../../enum/Binary.ts'; declare const platforms: readonly ["darwin", "linux", "win32"]; export interface BinaryItem { name: string; isDir: boolean; url: string; size: string | number; date: string; ignoreDownloadStatuses?: number[]; } export interface FetchResult { items: BinaryItem[]; nextParams?: any; } export declare const BINARY_ADAPTER_ATTRIBUTE: unique symbol; export declare abstract class AbstractBinary { protected logger: Logger; protected httpclient: HttpClient; abstract initFetch(binaryName: BinaryName): Promise<void>; abstract fetch(dir: string, binaryName: BinaryName, lastData?: Record<string, unknown>): Promise<FetchResult | undefined>; finishFetch(_success: boolean, _binaryName: BinaryName): Promise<void>; protected requestXml(url: string): Promise<string>; protected requestJSON<T = any>(url: string, requestHeaders?: Record<string, string>): Promise<T>; protected listNodeABIVersions(): Promise<number[]>; protected listNodePlatforms(): readonly ["darwin", "linux", "win32"]; protected listNodeArchs(binaryConfig?: BinaryTaskConfig): Record<string, readonly string[]>; protected listNodeLibcs(): Record<(typeof platforms)[number], string[]>; } export declare const BinaryAdapter: ImplDecorator<AbstractBinary, typeof BinaryType>; export {};