1 | import { CancellationToken, UpdateFileInfo, UpdateInfo } from "builder-util-runtime";
|
2 | import { OutgoingHttpHeaders, RequestOptions } from "http";
|
3 | import { URL } from "url";
|
4 | import { ElectronHttpExecutor } from "../electronHttpExecutor";
|
5 | import { ResolvedUpdateFileInfo } from "../main";
|
6 | export type ProviderPlatform = "darwin" | "linux" | "win32";
|
7 | export interface ProviderRuntimeOptions {
|
8 | isUseMultipleRangeRequest: boolean;
|
9 | platform: ProviderPlatform;
|
10 | executor: ElectronHttpExecutor;
|
11 | }
|
12 | export declare abstract class Provider<T extends UpdateInfo> {
|
13 | private readonly runtimeOptions;
|
14 | private requestHeaders;
|
15 | protected readonly executor: ElectronHttpExecutor;
|
16 | protected constructor(runtimeOptions: ProviderRuntimeOptions);
|
17 | get isUseMultipleRangeRequest(): boolean;
|
18 | private getChannelFilePrefix;
|
19 | protected getDefaultChannelName(): string;
|
20 | protected getCustomChannelName(channel: string): string;
|
21 | get fileExtraDownloadHeaders(): OutgoingHttpHeaders | null;
|
22 | setRequestHeaders(value: OutgoingHttpHeaders | null): void;
|
23 | abstract getLatestVersion(): Promise<T>;
|
24 | abstract resolveFiles(updateInfo: T): Array<ResolvedUpdateFileInfo>;
|
25 | /**
|
26 | * Method to perform API request only to resolve update info, but not to download update.
|
27 | */
|
28 | protected httpRequest(url: URL, headers?: OutgoingHttpHeaders | null, cancellationToken?: CancellationToken): Promise<string | null>;
|
29 | protected createRequestOptions(url: URL, headers?: OutgoingHttpHeaders | null): RequestOptions;
|
30 | }
|
31 | export declare function findFile(files: Array<ResolvedUpdateFileInfo>, extension: string, not?: Array<string>): ResolvedUpdateFileInfo | null | undefined;
|
32 | export declare function parseUpdateInfo(rawData: string | null, channelFile: string, channelFileUrl: URL): UpdateInfo;
|
33 | export declare function getFileList(updateInfo: UpdateInfo): Array<UpdateFileInfo>;
|
34 | export declare function resolveFiles(updateInfo: UpdateInfo, baseUrl: URL, pathTransformer?: (p: string) => string): Array<ResolvedUpdateFileInfo>;
|