electron-builder-http
Advanced tools
Comparing version 19.23.0 to 19.27.4
/// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
import { RequestOptions } from "http"; | ||
import { OutgoingHttpHeaders, RequestOptions } from "http"; | ||
import { Transform } from "stream"; | ||
@@ -9,4 +9,4 @@ import { CancellationToken } from "./CancellationToken"; | ||
export { ProgressCallbackTransform, ProgressInfo } from "./ProgressCallbackTransform"; | ||
export interface RequestHeaders { | ||
[key: string]: any; | ||
export interface RequestHeaders extends OutgoingHttpHeaders { | ||
[key: string]: string; | ||
} | ||
@@ -22,3 +22,3 @@ export interface RequestOptionsEx extends RequestOptions { | ||
export interface DownloadOptions { | ||
readonly headers?: RequestHeaders | null; | ||
readonly headers?: OutgoingHttpHeaders | null; | ||
readonly skipDirCreation?: boolean; | ||
@@ -59,2 +59,3 @@ readonly sha2?: string | null; | ||
} | ||
export declare function configureRequestOptionsFromUrl(url: string, options: RequestOptions): RequestOptions; | ||
export declare class DigestTransform extends Transform { | ||
@@ -61,0 +62,0 @@ private readonly expected; |
@@ -40,2 +40,3 @@ "use strict"; | ||
exports.parseJson = parseJson; | ||
exports.configureRequestOptionsFromUrl = configureRequestOptionsFromUrl; | ||
exports.safeGetHeader = safeGetHeader; | ||
@@ -51,8 +52,4 @@ exports.configureRequestOptions = configureRequestOptions; | ||
var _debug2; | ||
var _debug2 = _interopRequireDefault(require("debug")); | ||
function _load_debug() { | ||
return _debug2 = _interopRequireDefault(require("debug")); | ||
} | ||
var _fsExtraP; | ||
@@ -78,3 +75,3 @@ | ||
const debug = (0, (_debug2 || _load_debug()).default)("electron-builder"); | ||
const debug = (0, _debug2.default)("electron-builder"); | ||
class HttpError extends Error { | ||
@@ -166,4 +163,3 @@ constructor(response) { | ||
if (redirectCount < this.maxRedirects) { | ||
const parsedUrl = (0, (_url || _load_url()).parse)(redirectUrl); | ||
this.doDownload(Object.assign({}, requestOptions, { hostname: parsedUrl.hostname, path: parsedUrl.path, port: parsedUrl.port == null ? undefined : parsedUrl.port }), destination, redirectCount++, options, callback, onCancel); | ||
this.doDownload(configureRequestOptionsFromUrl(redirectUrl, Object.assign({}, requestOptions)), destination, redirectCount++, options, callback, onCancel); | ||
} else { | ||
@@ -178,2 +174,5 @@ callback(new Error(`Too many redirects (> ${this.maxRedirects})`)); | ||
request.on("error", callback); | ||
request.on("aborted", () => { | ||
callback(new Error("Request has been aborted by the server")); | ||
}); | ||
onCancel(() => request.abort()); | ||
@@ -192,2 +191,16 @@ request.end(); | ||
exports.HttpExecutor = HttpExecutor; | ||
function configureRequestOptionsFromUrl(url, options) { | ||
const parsedUrl = (0, (_url || _load_url()).parse)(url); | ||
options.protocol = parsedUrl.protocol; | ||
options.hostname = parsedUrl.hostname; | ||
if (parsedUrl.port == null) { | ||
if (options.port != null) { | ||
delete options.port; | ||
} | ||
} else { | ||
options.port = parsedUrl.port; | ||
} | ||
options.path = parsedUrl.path; | ||
return options; | ||
} | ||
class DigestTransform extends (_stream || _load_stream()).Transform { | ||
@@ -194,0 +207,0 @@ constructor(expected, algorithm, encoding) { |
@@ -45,8 +45,7 @@ export declare type PublishProvider = "github" | "bintray" | "s3" | "generic"; | ||
/** | ||
* The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](module:electron-updater/out/AppUpdater.AppUpdater+setFeedURL). | ||
* The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update.md#appupdatersetfeedurloptions). | ||
*/ | ||
readonly token?: string | null; | ||
/** | ||
* Whether to use private github auto-update provider if `GH_TOKEN` environment variable is set. | ||
* @see https://github.com/electron-userland/electron-builder/wiki/Auto-Update#private-github-update-repo | ||
* Whether to use private github auto-update provider if `GH_TOKEN` environment variable is set. See [Private GitHub Update Repo](/auto-update.md#private-github-update-repo). | ||
*/ | ||
@@ -53,0 +52,0 @@ readonly private?: boolean | null; |
@@ -9,2 +9,5 @@ export interface VersionInfo { | ||
readonly path: string; | ||
packages?: { | ||
[arch: string]: string; | ||
} | null; | ||
githubArtifactName?: string | null; | ||
@@ -30,5 +33,5 @@ /** | ||
/** | ||
* The [staged rollout](https://github.com/electron-userland/electron-builder/wiki/Auto-Update#staged-rollouts) percentage, 0-100. | ||
* The [staged rollout](auto-update.md#staged-rollouts) percentage, 0-100. | ||
*/ | ||
readonly stagingPercentage?: number; | ||
} |
{ | ||
"name": "electron-builder-http", | ||
"version": "19.23.0", | ||
"version": "19.27.4", | ||
"main": "out/httpExecutor.js", | ||
@@ -14,3 +14,3 @@ "author": "Vladimir Krivosheev", | ||
"dependencies": { | ||
"debug": "^3.0.0", | ||
"debug": "^3.0.1", | ||
"fs-extra-p": "^4.4.0", | ||
@@ -17,0 +17,0 @@ "bluebird-lst": "^1.0.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82796
919
Updateddebug@^3.0.1