import type { CloudConstructor, FileManagerConstructor, ICloud, IFileManager, IHost, IImage, IModule, ImageConstructor, ModuleConstructor, WatchConstructor } from './index'; import type { ExternalAsset, IFileThread } from './asset'; import type { CacheOptions } from './core'; import type { QueryResult } from './db'; import type { ITransformSeries, OutV3, TransformSeriesConstructor } from './document'; import type { IHttpMemoryCache } from './filemanager'; import type { HttpAgentSettings, HttpProtocolVersion, HttpRequestClient, InternetProtocolVersion } from './http'; import type { CloneObjectOptions, GetFunctionsOptions } from './module'; import type { LogFailOptions, LogType, LogValue } from './logger'; import type { HostConfig, OpenOptions, ProxySettings } from './request'; import type { DbCoerceSettings, DnsLookupSettings, HttpMemorySettings, HttpSettings, ImageModule } from './settings'; import type { Readable, Writable } from 'stream'; import type { OutgoingHttpHeaders } from 'http'; import type { LookupFunction } from 'net'; // @ts-ignore import type { BytesOptions } from 'bytes'; type CpuUsage = NodeJS.CpuUsage; export interface IModuleLibV4 { isString(value: unknown): value is string; isObject(value: unknown): value is T; isPlainObject(value: unknown): value is T; escapePattern(value: unknown, lookBehind?: boolean): string; generateUUID(format?: string, dictionary?: string): string; validateUUID(value: unknown): boolean; cloneObject(data: T, options?: boolean | WeakSet | CloneObjectOptions): T; coerceObject(data: T, parseString?: FunctionType | boolean, cache?: boolean): T; asFunction | T>>(value: unknown, sync?: boolean): Null; isFileHTTP(value: string | URL): boolean; isFileUNC(value: string | URL): boolean; isPathUNC(value: string | URL): boolean; toTimeMs(hrtime: HighResolutionTime, format?: boolean): NumString; renameExt(value: string, ext: string, when?: string): string; existsSafe(value: string, isFile?: boolean): boolean; readFileSafe(value: string, encoding: BufferEncoding | "buffer", cache?: boolean): Null; getFunctions(values: unknown[], absolute?: boolean | GetFunctionsOptions, sync?: boolean, outFailed?: string[]): T[]; formatSize(value: NumString, options?: BytesOptions): NumString; hasSameStat(src: string, dest: string, keepEmpty?: boolean): boolean; hasSize(value: string, keepEmpty?: boolean): boolean; getSize(value: string, diskUsed?: boolean): number; byteLength(value: BufferContent, encoding?: BufferEncoding): number; cleanupStream(target: Readable | Writable, pathname?: string): void; allSettled(values: readonly (U | PromiseLike)[], rejected?: LogValue, options?: LogFailOptions | LogType): Promise[]>; } export interface IModuleCompatV4 extends IModule { set startCPU(value); get startCPU(): Null; } export interface ModuleCompatV4Constructor extends ModuleConstructor, IModuleLibV4 { readonly prototype: IModuleCompatV4; new(...args: unknown[]): IModuleCompatV4; } export interface IFileManagerCompatV4 extends IFileManager { archiving: boolean; cacheHttpRequest: boolean | FirstOf; cacheHttpRequestBuffer: IHttpMemoryCache; fetchTimeout: number; httpProxy: Null; acceptEncoding: boolean; keepAliveTimeout: number; addDns(hostname: string, address: string, family?: NumString): void; lookupDns(hostname: string): LookupFunction; getHttpProxy(uri: string, localhost?: boolean): Null; getHttpHeaders(uri: string): Undef; createHttpRequest(uri: string | URL, options?: OpenOptions): HostConfig; getHttpClient(uri: string | URL, options: OpenOptions): HttpRequestClient; set httpVersion(value); get httpVersion(): Null; set ipVersion(value); get ipVersion(): InternetProtocolVersion; } export interface FileManagerCompatV4Constructor extends FileManagerConstructor { fromHttpStatusCode(value: NumString): string; resetHttpHost(version?: HttpProtocolVersion): void; defineHttpBuffer(options: HttpMemorySettings): void; defineHttpSettings(options: HttpSettings): void; defineHttpAgent(options: HttpAgentSettings): void; defineDnsLookup(options: DnsLookupSettings, clear?: boolean): void; clearDnsLookup(): void; getAria2Path(): string; clearHttpBuffer(percent?: number, limit?: number): void; readonly prototype: IFileManagerCompatV4; new(...args: unknown[]): IFileManagerCompatV4; } export interface ImageCompatV4Constructor extends ImageConstructor { using(this: T, instance: IImage, data: IFileThread, command: string): Promise; } export interface ICloudCompatV4 extends ICloud { getDatabaseResult(service: string, credential: unknown, queryString: string, options?: CacheOptions | boolean | string): Undef; setDatabaseResult(service: string, credential: unknown, queryString: string, result: unknown, options?: CacheOptions | string): QueryResult; hasDatabaseCache(service: string, sessionKey?: string): boolean; hasDatabaseCoerce(service: string, component: keyof DbCoerceSettings, credential?: unknown): boolean; } export interface CloudCompatV4Constructor extends CloudConstructor { readonly prototype: ICloudCompatV4; new(...args: unknown[]): ICloudCompatV4; } export interface WatchCompatV4Constructor, U extends ExternalAsset = ExternalAsset> extends WatchConstructor { readCACert(value: string, cache?: boolean): string; readTLSKey(value: string, cache?: boolean): string; readTLSCert(value: string, cache?: boolean): string; isCert(value: string): boolean; parseExpires(value: NumString, start?: number): number; } export interface ITransformSeriesCompatV4 extends ITransformSeries, PropertyAction {} export interface TransformSeriesCompatV4Constructor extends TransformSeriesConstructor { readonly prototype: ITransformSeriesCompatV4; new(...args: unknown[]): ITransformSeriesCompatV4; }