src/vs/platform/update/common/update.ts

127 LOC · 127 covered · 0 uncovered · 1 ranges · 46 concepts · 1 introducers · 36 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the filesrc/vs/workbench/contrib/update/common/updateUtils.ts · 227 LOCcommon/updateUtils.tsupdateUtils.test|title=UpdateUtils formatBytes rounds to one decimal place correctly|occurrence=1 · 0 introduced LOCupdateUtils.test|title=U…updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 4 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 7 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 1 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 1 introduced LOCupdateUtils.ts ×1updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for unparseable versions|occurrence=1 · 0 introduced LOCupdateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when new version is undefined|occurrence=1, updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when previous version is undefined|occurrence=1 · 0 introduced LOCupdateUtils.test|title=U…updateUtils.ts ×2 · 4 introduced LOCupdateUtils.ts ×2updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for patch-only change|occurrence=1, updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for identical versions|occurrence=1, +2 · 0 introduced LOCupdateUtils.test|title=U…updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×2 · 7 introduced LOCupdateUtils.ts ×2updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×2 · 4 introduced LOCupdateUtils.ts ×2updateUtils.ts ×2 · 11 introduced LOCupdateUtils.ts ×2updateUtils.ts ×1 · 4 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×3 · 4 introduced LOCupdateUtils.ts ×3updateUtils.ts ×1 · 2 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×2 · 5 introduced LOCupdateUtils.ts ×2updateUtils.ts ×2 · 3 introduced LOCupdateUtils.ts ×2updateUtils.ts ×2 · 2 introduced LOCupdateUtils.ts ×2updateUtils.ts ×1 · 1 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 6 introduced LOCupdateUtils.ts ×1updateUtils.ts ×1 · 3 introduced LOCupdateUtils.ts ×1updateUtils.ts ×13 · 208 introduced LOCupdateUtils.ts ×13updateUtils.test|title=UpdateUtils computeDownloadSpeed computes correct download speed in bytes per second|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadSpeed computes correct download speed in bytes per second|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for invalid or incomplete input|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for invalid or incomplete input|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for zero downloaded bytes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for zero downloaded bytes|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for zero or negative elapsed time|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadSpeed returns undefined for zero or negative elapsed time|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining computes correct time remaining|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining computes correct time remaining|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining returns 0 when download is complete or over-downloaded|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining returns 0 when download is complete or over-downloaded|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining returns undefined for invalid or incomplete input|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeDownloadTimeRemaining returns undefined for invalid or incomplete input|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeProgressPercent clamps to 0-100 range|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeProgressPercent clamps to 0-100 range|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeProgressPercent computes correct percentage|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeProgressPercent computes correct percentage|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeProgressPercent handles invalid values|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeProgressPercent handles invalid values|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns minor .0 version when major differs|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns minor .0 version when major differs|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns minor .0 version when minor differs|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns minor .0 version when minor differs|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns target version as-is when same minor|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns target version as-is when same minor|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns undefined for invalid versions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils computeUpdateInfoVersion returns undefined for invalid versions|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatBytes formats bytes for values less than 1 KB|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatBytes formats bytes for values less than 1 KB|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatBytes formats gigabytes for values >= 1 GB|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatBytes formats gigabytes for values >= 1 GB|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatBytes formats kilobytes for values between 1 KB and 1 MB|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatBytes formats kilobytes for values between 1 KB and 1 MB|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatBytes formats megabytes for values between 1 MB and 1 GB|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatBytes formats megabytes for values between 1 MB and 1 GB|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatBytes rounds to one decimal place correctly|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatBytes rounds to one decimal place correctly|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatDate formats a timestamp as a readable date|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatDate formats a timestamp as a readable date|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatTimeRemaining formats fractional hours for values >= 1 hour|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatTimeRemaining formats fractional hours for values >= 1 hour|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatTimeRemaining formats minutes for values between 1 minute and 1 hour|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatTimeRemaining formats minutes for values between 1 minute and 1 hour|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils formatTimeRemaining formats seconds for values less than 1 minute|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils formatTimeRemaining formats seconds for values less than 1 minute|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils getUpdateInfoUrl constructs correct URL for .0 versions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils getUpdateInfoUrl constructs correct URL for .0 versions|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils getUpdateInfoUrl constructs correct URL for patch versions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils getUpdateInfoUrl constructs correct URL for patch versions|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for identical versions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for identical versions|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for patch-only change|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for patch-only change|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for unparseable versions|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false for unparseable versions|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when both versions are undefined|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when both versions are undefined|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when new version is undefined|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when new version is undefined|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when previous version is undefined|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns false when previous version is undefined|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns true for major version change|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns true for major version change|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns true for minor version change|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils isMajorMinorVersionChange returns true for minor version change|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils tryParseDate parses valid ISO date strings|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils tryParseDate parses valid ISO date strings|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils tryParseDate returns undefined for invalid date strings|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils tryParseDate returns undefined for invalid date strings|occurrence=1updateUtils.test|title=U…updateUtils.test|title=UpdateUtils tryParseDate returns undefined for undefined input|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/contrib/update/test/common/updateUtils.test|title=UpdateUtils tryParseDate returns undefined for undefined input|occurrence=1updateUtils.test|title=U…Focused file · src/vs/platform/update/common/update.ts · 127 LOCcommon/update.ts

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- updateUtils.ts ×13
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { Event } from '../../../base/common/event.js';
7 > import { upcast } from '../../../base/common/types.js';
8 > import { createDecorator } from '../../instantiation/common/instantiation.js';
9 >
10 > export interface IUpdate {
11 > version: string; // Build commit ID
12 > productVersion?: string; // Product version like 1.2.3
13 > timestamp?: number;
14 > url?: string;
15 > sha256hash?: string;
16 > }
17 >
18 > /**
19 > * Updates are run as a state machine:
20 > *
21 > * Uninitialized
22 > * ↓
23 > * Idle
24 > * ↓ ↑
25 > * Checking for Updates → Available for Download
26 > * ↓ ↓
27 > * ← Overwriting
28 > * Downloading ↑
29 > * → Ready
30 > * ↓ ↑
31 > * Downloaded → Updating
32 > *
33 > * Available: There is an update available for download (linux, darwin on metered connection).
34 > * Ready: Code will be updated as soon as it restarts (win32, darwin).
35 > * Downloaded: There is an update ready to be installed in the background (win32).
36 > * Overwriting: A newer update is being downloaded to replace the pending update (darwin).
37 > * Cancelling: Updates are being disabled at runtime; in-flight/pending work is being torn down before Disabled.
38 > */
39 >
40 > export const enum StateType {
41 > Uninitialized = 'uninitialized',
42 > Idle = 'idle',
43 > Disabled = 'disabled',
44 > CheckingForUpdates = 'checking for updates',
45 > AvailableForDownload = 'available for download',
46 > Downloading = 'downloading',
47 > Downloaded = 'downloaded',
48 > Updating = 'updating',
49 > Ready = 'ready',
50 > Overwriting = 'overwriting',
51 > Cancelling = 'cancelling',
52 > Restarting = 'restarting',
53 > }
54 >
55 > export const enum UpdateType {
56 > Setup,
57 > Archive,
58 > Snap
59 > }
60 >
61 > export const enum DisablementReason {
62 > NotBuilt,
63 > DisabledByEnvironment,
64 > ManuallyDisabled,
65 > Policy,
66 > MissingConfiguration,
67 > InvalidConfiguration,
68 > RunningAsAdmin,
69 > }
70 >
71 > export type Uninitialized = { type: StateType.Uninitialized };
72 > export type Disabled = { type: StateType.Disabled; reason: DisablementReason };
73 > export type Idle = { type: StateType.Idle; updateType: UpdateType; error?: string; notAvailable?: boolean };
74 > export type CheckingForUpdates = { type: StateType.CheckingForUpdates; explicit: boolean };
75 > export type AvailableForDownload = { type: StateType.AvailableForDownload; update: IUpdate; canInstall?: boolean };
76 > export type Downloading = { type: StateType.Downloading; update?: IUpdate; explicit: boolean; overwrite: boolean; downloadedBytes?: number; totalBytes?: number; startTime?: number };
77 > export type Downloaded = { type: StateType.Downloaded; update: IUpdate; explicit: boolean; overwrite: boolean };
78 > export type Updating = { type: StateType.Updating; update: IUpdate; currentProgress?: number; maxProgress?: number; explicit: boolean };
79 > export type Ready = { type: StateType.Ready; update: IUpdate; explicit: boolean; overwrite: boolean };
80 > export type Overwriting = { type: StateType.Overwriting; update: IUpdate; explicit: boolean };
81 > export type Cancelling = { type: StateType.Cancelling };
82 > export type Restarting = { type: StateType.Restarting; update: IUpdate };
83 >
84 > export type State = Uninitialized | Disabled | Idle | CheckingForUpdates | AvailableForDownload | Downloading | Downloaded | Updating | Ready | Overwriting | Cancelling | Restarting;
85 >
86 > export const State = {
87 > Uninitialized: upcast<Uninitialized>({ type: StateType.Uninitialized }),
88 > Disabled: (reason: DisablementReason): Disabled => ({ type: StateType.Disabled, reason }),
89 > Idle: (updateType: UpdateType, error?: string, notAvailable?: boolean): Idle => ({ type: StateType.Idle, updateType, error, notAvailable }),
90 > CheckingForUpdates: (explicit: boolean): CheckingForUpdates => ({ type: StateType.CheckingForUpdates, explicit }),
91 > AvailableForDownload: (update: IUpdate, canInstall?: boolean): AvailableForDownload => ({ type: StateType.AvailableForDownload, update, canInstall }),
92 > Downloading: (update: IUpdate | undefined, explicit: boolean, overwrite: boolean, downloadedBytes?: number, totalBytes?: number, startTime?: number): Downloading => ({ type: StateType.Downloading, update, explicit, overwrite, downloadedBytes, totalBytes, startTime }),
93 > Downloaded: (update: IUpdate, explicit: boolean, overwrite: boolean): Downloaded => ({ type: StateType.Downloaded, update, explicit, overwrite }),
94 > Updating: (update: IUpdate, explicit: boolean, currentProgress?: number, maxProgress?: number): Updating => ({ type: StateType.Updating, update, explicit, currentProgress, maxProgress }),
95 > Ready: (update: IUpdate, explicit: boolean, overwrite: boolean): Ready => ({ type: StateType.Ready, update, explicit, overwrite }),
96 > Overwriting: (update: IUpdate, explicit: boolean): Overwriting => ({ type: StateType.Overwriting, update, explicit }),
97 > Cancelling: upcast<Cancelling>({ type: StateType.Cancelling }),
98 > Restarting: (update: IUpdate): Restarting => ({ type: StateType.Restarting, update }),
99 > };
100 >
101 > export interface IAutoUpdater extends Event.NodeEventEmitter {
102 > setFeedURL(url: string): void;
103 > checkForUpdates(): void;
104 > applyUpdate?(): Promise<void>;
105 > quitAndInstall(): void;
106 > }
107 >
108 > export const IUpdateService = createDecorator<IUpdateService>('updateService');
109 >
110 > export interface IUpdateService {
111 > readonly _serviceBrand: undefined;
112 >
113 > readonly onStateChange: Event<State>;
114 > readonly state: State;
115 >
116 > checkForUpdates(explicit: boolean): Promise<void>;
117 > downloadUpdate(explicit: boolean): Promise<void>;
118 > applyUpdate(): Promise<void>;
119 > quitAndInstall(): Promise<void>;
120 >
121 > /**
122 > * @deprecated This method should not be used any more. It will be removed in a future release.
123 > */
124 > isLatestVersion(): Promise<boolean | undefined>;
125 > _applySpecificUpdate(packagePath: string): Promise<void>;
126 > setInternalOrg(internalOrg: string | undefined): Promise<void>;
127 > }