@sussudio/platform
Version:
Internal APIs for VS Code's service injection the base services.
69 lines (67 loc) • 3.3 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from '@sussudio/base/common/event.mjs';
import { IConfigurationService } from '../../configuration/common/configuration.mjs';
import { IEnvironmentMainService } from '../../environment/electron-main/environmentMainService.mjs';
import { ILifecycleMainService } from '../../lifecycle/electron-main/lifecycleMainService.mjs';
import { ILogService } from '../../log/common/log.mjs';
import { IProductService } from '../../product/common/productService.mjs';
import { IRequestService } from '../../request/common/request.mjs';
import { AvailableForDownload, IUpdateService, State, UpdateType } from '../common/update.mjs';
export declare function createUpdateURL(platform: string, quality: string, productService: IProductService): string;
export type UpdateNotAvailableClassification = {
owner: 'joaomoreno';
explicit: {
classification: 'SystemMetaData';
purpose: 'FeatureInsight';
isMeasurement: true;
comment: 'Whether the user has manually checked for updates, or this was an automatic check.';
};
comment: "This is used to understand how often VS Code pings the update server for an update and there's none available.";
};
export declare abstract class AbstractUpdateService implements IUpdateService {
private readonly lifecycleMainService;
protected configurationService: IConfigurationService;
private readonly environmentMainService;
protected requestService: IRequestService;
protected logService: ILogService;
protected readonly productService: IProductService;
readonly _serviceBrand: undefined;
protected url: string | undefined;
private _state;
private readonly _onStateChange;
readonly onStateChange: Event<State>;
get state(): State;
protected setState(state: State): void;
constructor(
lifecycleMainService: ILifecycleMainService,
configurationService: IConfigurationService,
environmentMainService: IEnvironmentMainService,
requestService: IRequestService,
logService: ILogService,
productService: IProductService,
);
/**
* This must be called before any other call. This is a performance
* optimization, to avoid using extra CPU cycles before first window open.
* https://github.com/microsoft/vscode/issues/89784
*/
initialize(): Promise<void>;
protected getUpdateMode(): 'none' | 'manual' | 'start' | 'default';
private getProductQuality;
private scheduleCheckForUpdates;
checkForUpdates(explicit: boolean): Promise<void>;
downloadUpdate(): Promise<void>;
protected doDownloadUpdate(state: AvailableForDownload): Promise<void>;
applyUpdate(): Promise<void>;
protected doApplyUpdate(): Promise<void>;
quitAndInstall(): Promise<void>;
isLatestVersion(): Promise<boolean | undefined>;
_applySpecificUpdate(packagePath: string): Promise<void>;
protected getUpdateType(): UpdateType;
protected doQuitAndInstall(): void;
protected abstract buildUpdateFeedUrl(quality: string): string | undefined;
protected abstract doCheckForUpdates(context: any): void;
}