@sussudio/platform
Version:
Internal APIs for VS Code's service injection the base services.
138 lines (136 loc) • 5.6 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 { CancellationToken } from '@sussudio/base/common/cancellation.mjs';
import { IPager } from '@sussudio/base/common/paging.mjs';
import { URI } from '@sussudio/base/common/uri.mjs';
import { IConfigurationService } from '../../configuration/common/configuration.mjs';
import { IEnvironmentService } from '../../environment/common/environment.mjs';
import {
IExtensionGalleryService,
IExtensionInfo,
IGalleryExtension,
IGalleryExtensionVersion,
InstallOperation,
IQueryOptions,
IExtensionsControlManifest,
ITranslation,
StatisticType,
IExtensionQueryOptions,
} from './extensionManagement.mjs';
import { IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.mjs';
import { IFileService } from '../../files/common/files.mjs';
import { ILogService } from '../../log/common/log.mjs';
import { IProductService } from '../../product/common/productService.mjs';
import { IRequestService } from '../../request/common/request.mjs';
import { IStorageService } from '../../storage/common/storage.mjs';
import { ITelemetryService } from '../../telemetry/common/telemetry.mjs';
interface IRawGalleryExtensionFile {
readonly assetType: string;
readonly source: string;
}
interface IRawGalleryExtensionProperty {
readonly key: string;
readonly value: string;
}
export interface IRawGalleryExtensionVersion {
readonly version: string;
readonly lastUpdated: string;
readonly assetUri: string;
readonly fallbackAssetUri: string;
readonly files: IRawGalleryExtensionFile[];
readonly properties?: IRawGalleryExtensionProperty[];
readonly targetPlatform?: string;
}
export declare function sortExtensionVersions(
versions: IRawGalleryExtensionVersion[],
preferredTargetPlatform: TargetPlatform,
): IRawGalleryExtensionVersion[];
declare abstract class AbstractExtensionGalleryService implements IExtensionGalleryService {
private readonly requestService;
private readonly logService;
private readonly environmentService;
private readonly telemetryService;
private readonly fileService;
private readonly productService;
private readonly configurationService;
readonly _serviceBrand: undefined;
private readonly extensionsGalleryUrl;
private readonly extensionsGallerySearchUrl;
private readonly extensionsControlUrl;
private readonly commonHeadersPromise;
constructor(
storageService: IStorageService | undefined,
requestService: IRequestService,
logService: ILogService,
environmentService: IEnvironmentService,
telemetryService: ITelemetryService,
fileService: IFileService,
productService: IProductService,
configurationService: IConfigurationService,
);
private api;
isEnabled(): boolean;
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;
getExtensions(
extensionInfos: ReadonlyArray<IExtensionInfo>,
options: IExtensionQueryOptions,
token: CancellationToken,
): Promise<IGalleryExtension[]>;
getCompatibleExtension(
extension: IGalleryExtension,
includePreRelease: boolean,
targetPlatform: TargetPlatform,
): Promise<IGalleryExtension | null>;
isExtensionCompatible(
extension: IGalleryExtension,
includePreRelease: boolean,
targetPlatform: TargetPlatform,
): Promise<boolean>;
private isValidVersion;
query(options: IQueryOptions, token: CancellationToken): Promise<IPager<IGalleryExtension>>;
private queryGalleryExtensions;
private toGalleryExtensionWithCriteria;
private queryRawGalleryExtensions;
reportStatistic(publisher: string, name: string, version: string, type: StatisticType): Promise<void>;
download(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void>;
downloadSignatureArchive(extension: IGalleryExtension, location: URI): Promise<void>;
getReadme(extension: IGalleryExtension, token: CancellationToken): Promise<string>;
getManifest(extension: IGalleryExtension, token: CancellationToken): Promise<IExtensionManifest | null>;
private getManifestFromRawExtensionVersion;
getCoreTranslation(extension: IGalleryExtension, languageId: string): Promise<ITranslation | null>;
getChangelog(extension: IGalleryExtension, token: CancellationToken): Promise<string>;
getAllCompatibleVersions(
extension: IGalleryExtension,
includePreRelease: boolean,
targetPlatform: TargetPlatform,
): Promise<IGalleryExtensionVersion[]>;
private getAsset;
private getEngine;
getExtensionsControlManifest(): Promise<IExtensionsControlManifest>;
}
export declare class ExtensionGalleryService extends AbstractExtensionGalleryService {
constructor(
storageService: IStorageService,
requestService: IRequestService,
logService: ILogService,
environmentService: IEnvironmentService,
telemetryService: ITelemetryService,
fileService: IFileService,
productService: IProductService,
configurationService: IConfigurationService,
);
}
export declare class ExtensionGalleryServiceWithNoStorageService extends AbstractExtensionGalleryService {
constructor(
requestService: IRequestService,
logService: ILogService,
environmentService: IEnvironmentService,
telemetryService: ITelemetryService,
fileService: IFileService,
productService: IProductService,
configurationService: IConfigurationService,
);
}
export {};