builder-util-runtime
- Version 9.2.5-alpha.2
- Published
- 151 kB
- 2 dependencies
- MIT license
Install
npm i builder-util-runtime
yarn add builder-util-runtime
pnpm add builder-util-runtime
Overview
HTTP utilities. Used by [electron-builder](https://github.com/electron-userland/electron-builder).
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Variables
variable CURRENT_APP_INSTALLER_FILE_NAME
const CURRENT_APP_INSTALLER_FILE_NAME: string;
variable CURRENT_APP_PACKAGE_FILE_NAME
const CURRENT_APP_PACKAGE_FILE_NAME: string;
Functions
function asArray
asArray: <T>(v: null | undefined | T | Array<T>) => Array<T>;
function configureRequestOptions
configureRequestOptions: ( options: RequestOptions, token?: string | null, method?: 'GET' | 'DELETE' | 'PUT' | 'POST') => RequestOptions;
function configureRequestOptionsFromUrl
configureRequestOptionsFromUrl: ( url: string, options: RequestOptions) => RequestOptions;
function configureRequestUrl
configureRequestUrl: (url: URL, options: RequestOptions) => void;
function createHttpError
createHttpError: ( response: IncomingMessage, description?: any | null) => HttpError;
function getS3LikeProviderBaseUrl
getS3LikeProviderBaseUrl: (configuration: PublishConfiguration) => string;
function githubUrl
githubUrl: (options: GithubOptions, defaultHost?: string) => string;
function newError
newError: (message: string, code: string) => Error;
function parseDn
parseDn: (seq: string) => Map<string, string>;
function parseJson
parseJson: (result: Promise<string | null>) => Promise<any>;
function parseXml
parseXml: (data: string) => XElement;
function safeGetHeader
safeGetHeader: (response: any, headerKey: string) => any;
function safeStringifyJson
safeStringifyJson: (data: any, skippedNames?: Set<string>) => string;
Classes
class CancellationError
class CancellationError extends Error {}
constructor
constructor();
class CancellationToken
class CancellationToken extends EventEmitter {}
constructor
constructor(parent?: CancellationToken);
property cancelled
readonly cancelled: boolean;
method cancel
cancel: () => void;
method createPromise
createPromise: <R>( callback: ( resolve: (thenableOrResult: R | PromiseLike<R>) => void, reject: (error: Error) => void, onCancel: (callback: () => void) => void ) => void) => Promise<R>;
method dispose
dispose: () => void;
class DigestTransform
class DigestTransform extends Transform {}
constructor
constructor( expected: string, algorithm?: string, encoding?: BinaryToTextEncoding);
property actual
readonly actual: string;
property expected
readonly expected: string;
property isValidateOnEnd
isValidateOnEnd: boolean;
method validate
validate: () => null;
class HttpError
class HttpError extends Error {}
constructor
constructor(statusCode: number, message?: string, description?: any);
property description
readonly description: any;
property statusCode
readonly statusCode: number;
method isServerError
isServerError: () => boolean;
class HttpExecutor
abstract class HttpExecutor<T extends Request> {}
property maxRedirects
protected readonly maxRedirects: number;
method addErrorAndTimeoutHandlers
addErrorAndTimeoutHandlers: ( request: any, reject: (error: Error) => void, timeout?: number) => void;
method addRedirectHandlers
protected addRedirectHandlers: ( request: any, options: RequestOptions, reject: (error: Error) => void, redirectCount: number, handler: (options: RequestOptions) => void) => void;
method createMaxRedirectError
protected createMaxRedirectError: () => Error;
method createRequest
abstract createRequest: ( options: RequestOptions, callback: (response: any) => void) => T;
method doApiRequest
doApiRequest: ( options: RequestOptions, cancellationToken: CancellationToken, requestProcessor: (request: T, reject: (error: Error) => void) => void, redirectCount?: number) => Promise<string>;
method doDownload
protected doDownload: ( requestOptions: RequestOptions, options: DownloadCallOptions, redirectCount: number) => void;
method downloadToBuffer
downloadToBuffer: (url: URL, options: DownloadOptions) => Promise<Buffer>;
method prepareRedirectUrlOptions
static prepareRedirectUrlOptions: ( redirectUrl: string, options: RequestOptions) => RequestOptions;
method request
request: ( options: RequestOptions, cancellationToken?: CancellationToken, data?: { [name: string]: any }) => Promise<string | null>;
method retryOnServerError
static retryOnServerError: ( task: () => Promise<any>, maxRetries?: number) => Promise<any>;
class ProgressCallbackTransform
class ProgressCallbackTransform extends Transform {}
constructor
constructor( total: number, cancellationToken: CancellationToken, onProgress: (info: ProgressInfo) => any);
class UUID
class UUID {}
constructor
constructor(uuid: any);
property OID
static readonly OID: Buffer;
method check
static check: ( uuid: Buffer | string, offset?: number) => | false | { version: undefined; variant: string; format: string } | { version: number; variant: string; format: string };
method inspect
inspect: () => string;
method parse
static parse: (input: string) => Buffer;
method toString
toString: () => string;
method v5
static v5: (name: string | Buffer, namespace: Buffer) => any;
class XElement
class XElement {}
constructor
constructor(name: string);
property attributes
attributes: { [key: string]: string };
property elements
elements: XElement[];
property isCData
isCData: boolean;
property name
readonly name: string;
property value
value: string;
method attribute
attribute: (name: string) => string;
method element
element: ( name: string, ignoreCase?: boolean, errorIfMissed?: string | null) => XElement;
method elementOrNull
elementOrNull: (name: string, ignoreCase?: boolean) => XElement | null;
method elementValueOrEmpty
elementValueOrEmpty: (name: string, ignoreCase?: boolean) => string;
method getElements
getElements: (name: string, ignoreCase?: boolean) => XElement[];
method removeAttribute
removeAttribute: (name: string) => void;
Interfaces
interface BaseS3Options
interface BaseS3Options extends PublishConfiguration {}
property acl
readonly acl?: 'private' | 'public-read' | null;
The ACL. Set to
null
to not [add](https://github.com/electron-userland/electron-builder/issues/1822).public-read
property channel
channel?: string | null;
The update channel. latest
property path
readonly path?: string | null;
The directory path. /
interface BitbucketOptions
interface BitbucketOptions extends PublishConfiguration {}
Bitbucket options. https://bitbucket.org/ Define
BITBUCKET_TOKEN
environment variable.For converting an app password to a usable token, you can utilize this
convertAppPassword(owner: string, appPassword: string) {const base64encodedData = Buffer.from(`${owner}:${appPassword.trim()}`).toString("base64")return `Basic ${base64encodedData}`}
property channel
readonly channel?: string | null;
The channel. latest
property owner
readonly owner: string;
Repository owner
property provider
readonly provider: 'bitbucket';
The provider. Must be
bitbucket
.
property slug
readonly slug: string;
Repository slug/name
property token
readonly token?: string | null;
The [app password](https://bitbucket.org/account/settings/app-passwords) to support auto-update from private bitbucket repositories.
property username
readonly username?: string | null;
The user name to support auto-update from private bitbucket repositories.
interface BlockMap
interface BlockMap {}
interface BlockMapDataHolder
interface BlockMapDataHolder {}
property blockMapSize
blockMapSize?: number;
The block map file size. Used when block map data is embedded into the file (appimage, windows web installer package). This information can be obtained from the file itself, but it requires additional HTTP request, so, to reduce request count, block map size is specified in the update metadata too.
property isAdminRightsRequired
readonly isAdminRightsRequired?: boolean;
property sha512
readonly sha512: string;
The file checksum.
property size
size?: number;
The file size. Used to verify downloaded size (save one HTTP request to get length). Also used when block map data is embedded into the file (appimage, windows web installer package).
interface CustomPublishOptions
interface CustomPublishOptions extends PublishConfiguration {}
property provider
readonly provider: 'custom';
The provider. Must be
custom
.
property updateProvider
updateProvider?: new ( options: CustomPublishOptions, updater: any, runtimeOptions: any) => any;
The Provider to provide UpdateInfo regarding available updates. Required to use custom providers with electron-updater.
index signature
[index: string]: any;
interface DownloadOptions
interface DownloadOptions {}
property cancellationToken
readonly cancellationToken: CancellationToken;
property headers
readonly headers?: OutgoingHttpHeaders | null;
property onProgress
onProgress?: (progress: ProgressInfo) => void;
property sha2
readonly sha2?: string | null;
property sha512
readonly sha512?: string | null;
interface GenericServerOptions
interface GenericServerOptions extends PublishConfiguration {}
Generic (any HTTP(S) server) options. In all publish options [File Macros](/file-patterns#file-macros) are supported.
property channel
readonly channel?: string | null;
The channel. latest
property provider
readonly provider: 'generic';
The provider. Must be
generic
.
property url
readonly url: string;
The base url. e.g.
https://bucket_name.s3.amazonaws.com
.
property useMultipleRangeRequest
readonly useMultipleRangeRequest?: boolean;
Whether to use multiple range requests for differential update. Defaults to
true
ifurl
doesn't contains3.amazonaws.com
.
interface GithubOptions
interface GithubOptions extends PublishConfiguration {}
[GitHub](https://help.github.com/articles/about-releases/) options.
GitHub [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) is required. You can generate by going to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). The access token should have the repo scope/permission. Define
GH_TOKEN
environment variable.
property channel
readonly channel?: string | null;
The channel. latest
property host
readonly host?: string | null;
The host (including the port if need). github.com
property owner
readonly owner?: string | null;
The owner.
property private
readonly private?: boolean | null;
Whether to use private github auto-update provider if
GH_TOKEN
environment variable is defined. See [Private GitHub Update Repo](/auto-update#private-github-update-repo).
property protocol
readonly protocol?: 'https' | 'http' | null;
The protocol. GitHub Publisher supports only
https
. https
property provider
readonly provider: 'github';
The provider. Must be
github
.
property releaseType
releaseType?: 'draft' | 'prerelease' | 'release' | null;
The type of release. By default
draft
release will be created.Also you can set release type using environment variable. If
EP_DRAFT
is set totrue
—draft
, ifEP_PRE_RELEASE
is set totrue
—prerelease
. draft
property repo
readonly repo?: string | null;
The repository name. [Detected automatically](#github-repository-and-bintray-package).
property token
readonly token?: string | null;
The access token to support auto-update from private github repositories. Never specify it in the configuration files. Only for [setFeedURL](/auto-update#appupdatersetfeedurloptions).
property vPrefixedTagName
readonly vPrefixedTagName?: boolean;
Whether to use
v
-prefixed tag name. true
interface KeygenOptions
interface KeygenOptions extends PublishConfiguration {}
Keygen options. https://keygen.sh/ Define
KEYGEN_TOKEN
environment variable.
property account
readonly account: string;
Keygen account's UUID
property channel
readonly channel?: 'stable' | 'rc' | 'beta' | 'alpha' | 'dev' | null;
The channel. stable
property platform
readonly platform?: string | null;
The target Platform. Is set programmatically explicitly during publishing.
property product
readonly product: string;
Keygen product's UUID
property provider
readonly provider: 'keygen';
The provider. Must be
keygen
.
interface PackageFileInfo
interface PackageFileInfo extends BlockMapDataHolder {}
property path
readonly path: string;
interface ProgressInfo
interface ProgressInfo {}
property bytesPerSecond
bytesPerSecond: number;
property delta
delta: number;
property percent
percent: number;
property total
total: number;
property transferred
transferred: number;
interface PublishConfiguration
interface PublishConfiguration {}
property provider
readonly provider: PublishProvider;
The provider.
property publishAutoUpdate
readonly publishAutoUpdate?: boolean;
Whether to publish auto update info files.
Auto update relies only on the first provider in the list (you can specify several publishers). Thus, probably, there`s no need to upload the metadata files for the other configured providers. But by default will be uploaded.
true
property publisherName
publisherName?: Array<string> | null;
win-only
property requestHeaders
readonly requestHeaders?: OutgoingHttpHeaders;
Any custom request headers
property timeout
readonly timeout?: number | null;
Request timeout in milliseconds. (Default is 2 minutes; O is ignored)
120000
property updaterCacheDirName
readonly updaterCacheDirName?: string | null;
win-only
interface ReleaseNoteInfo
interface ReleaseNoteInfo {}
interface RequestHeaders
interface RequestHeaders extends OutgoingHttpHeaders {}
index signature
[key: string]: OutgoingHttpHeader | undefined;
interface S3Options
interface S3Options extends BaseS3Options {}
[Amazon S3](https://aws.amazon.com/s3/) options. AWS credentials are required, please see [getting your credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html). Define
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
[environment variables](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html). Or in the [~/.aws/credentials](http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html).Example configuration:
{"build":"publish": {"provider": "s3","bucket": "bucket-name"}}}
property accelerate
readonly accelerate?: boolean;
If set to true, this will enable the s3 accelerated endpoint These endpoints have a particular format of: ${bucketname}.s3-accelerate.amazonaws.com
property acl
readonly acl?: 'private' | 'public-read' | null;
The ACL. Set to
null
to not [add](https://github.com/electron-userland/electron-builder/issues/1822).Please see [required permissions for the S3 provider](https://github.com/electron-userland/electron-builder/issues/1618#issuecomment-314679128).
public-read
property bucket
readonly bucket: string;
The bucket name.
property encryption
readonly encryption?: 'AES256' | 'aws:kms' | null;
Server-side encryption algorithm to use for the object.
property endpoint
readonly endpoint?: string | null;
The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like
https://{service}.{region}.amazonaws.com
.
property provider
readonly provider: 's3';
The provider. Must be
s3
.
property region
region?: string | null;
The region. Is determined and set automatically when publishing.
property storageClass
readonly storageClass?: 'STANDARD' | 'REDUCED_REDUNDANCY' | 'STANDARD_IA' | null;
The type of storage to use for the object. STANDARD
interface SnapStoreOptions
interface SnapStoreOptions extends PublishConfiguration {}
[Snap Store](https://snapcraft.io/) options. To publish directly to Snapcraft, see Snapcraft authentication options for local or CI/CD authentication options.
interface SpacesOptions
interface SpacesOptions extends BaseS3Options {}
[DigitalOcean Spaces](https://www.digitalocean.com/community/tutorials/an-introduction-to-digitalocean-spaces) options. Access key is required, define
DO_KEY_ID
andDO_SECRET_KEY
environment variables.
interface UpdateFileInfo
interface UpdateFileInfo extends BlockMapDataHolder {}
property url
url: string;
interface UpdateInfo
interface UpdateInfo {}
property files
readonly files: Array<UpdateFileInfo>;
property minimumSystemVersion
readonly minimumSystemVersion?: string;
The minimum version of system required for the app to run. Sample value: macOS
23.1.0
, Windows10.0.22631
. Same with os.release() value, this is a kernel version.
property path
readonly path: string;
Deprecated
property releaseDate
releaseDate: string;
The release date.
property releaseName
releaseName?: string | null;
The release name.
property releaseNotes
releaseNotes?: string | Array<ReleaseNoteInfo> | null;
The release notes. List if
updater.fullChangelog
is set totrue
,string
otherwise.
property sha512
readonly sha512: string;
Deprecated
property stagingPercentage
readonly stagingPercentage?: number;
The [staged rollout](/auto-update#staged-rollouts) percentage, 0-100.
property version
readonly version: string;
The version.
interface WindowsUpdateInfo
interface WindowsUpdateInfo extends UpdateInfo {}
Type Aliases
type AllPublishOptions
type AllPublishOptions = | string | GithubOptions | S3Options | SpacesOptions | GenericServerOptions | CustomPublishOptions | KeygenOptions | SnapStoreOptions | BitbucketOptions;
type PublishProvider
type PublishProvider = | 'github' | 's3' | 'spaces' | 'generic' | 'custom' | 'snapStore' | 'keygen' | 'bitbucket';
Package Files (10)
Dependencies (2)
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/builder-util-runtime
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/builder-util-runtime)
- HTML<a href="https://www.jsdocs.io/package/builder-util-runtime"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5082 ms. - Missing or incorrect documentation? Open an issue for this package.