UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

74 lines (72 loc) 3.08 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { URI } from '@sussudio/base/common/uri.mjs'; import { IHeaders } from '@sussudio/base/parts/request/common/request.mjs'; import { IConfigurationService } from '../../configuration/common/configuration.mjs'; import { IEnvironmentService } from '../../environment/common/environment.mjs'; import { IFileService } from '../../files/common/files.mjs'; import { IProductService } from '../../product/common/productService.mjs'; import { IStorageService } from '../../storage/common/storage.mjs'; export declare const WEB_EXTENSION_RESOURCE_END_POINT = 'web-extension-resource'; export declare const IExtensionResourceLoaderService: import('../../instantiation/common/instantiation.mjs').ServiceIdentifier<IExtensionResourceLoaderService>; /** * A service useful for reading resources from within extensions. */ export interface IExtensionResourceLoaderService { readonly _serviceBrand: undefined; /** * Read a certain resource within an extension. */ readExtensionResource(uri: URI): Promise<string>; /** * Returns whether the gallery provides extension resources. */ readonly supportsExtensionGalleryResources: boolean; /** * Computes the URL of a extension gallery resource. Returns `undefined` if gallery does not provide extension resources. */ getExtensionGalleryResourceURL( galleryExtension: { publisher: string; name: string; version: string; }, path?: string, ): URI | undefined; } export declare abstract class AbstractExtensionResourceLoaderService implements IExtensionResourceLoaderService { protected readonly _fileService: IFileService; private readonly _storageService; private readonly _productService; private readonly _environmentService; private readonly _configurationService; readonly _serviceBrand: undefined; private readonly _webExtensionResourceEndPoint; private readonly _extensionGalleryResourceUrlTemplate; private readonly _extensionGalleryAuthority; constructor( _fileService: IFileService, _storageService: IStorageService, _productService: IProductService, _environmentService: IEnvironmentService, _configurationService: IConfigurationService, ); get supportsExtensionGalleryResources(): boolean; getExtensionGalleryResourceURL( galleryExtension: { publisher: string; name: string; version: string; }, path?: string, ): URI | undefined; abstract readExtensionResource(uri: URI): Promise<string>; protected isExtensionGalleryResource(uri: URI): boolean | '' | undefined; protected getExtensionGalleryRequestHeaders(): Promise<IHeaders>; private _serviceMachineIdPromise; private _getServiceMachineId; private _getExtensionGalleryAuthority; protected _isWebExtensionResourceEndPoint(uri: URI): boolean; }