UNPKG

1.66 kBTypeScriptView Raw
1import { Extension } from 'sourcegraph/module/client/extension';
2import { ErrorLike } from '../errors';
3import { ExtensionManifest } from '../schema/extension.schema';
4import * as GQL from '../schema/graphqlschema';
5import { Settings } from '../settings';
6/**
7 * Describes a configured extension.
8 *
9 * @template S the configuration subject type
10 * @template C the type of the extension's settings (overlaid on the base settings JSON Schema-derived type)
11 * @template RX the registry extension type
12 */
13export interface ConfiguredExtension<RX extends Pick<GQL.IRegistryExtension, 'id' | 'url' | 'viewerCanAdminister'> = Pick<GQL.IRegistryExtension, 'id' | 'url' | 'viewerCanAdminister'>> extends Extension {
14 /** The parsed extension manifest, null if there is none, or a parse error. */
15 manifest: ExtensionManifest | null | ErrorLike;
16 /** The raw extension manifest (JSON), or null if there is none. */
17 rawManifest: string | null;
18 /** The corresponding extension on the registry, if any. */
19 registryExtension?: RX;
20}
21/** Reports whether the given extension is enabled in the settings. */
22export declare function isExtensionEnabled(settings: Settings | ErrorLike | null, extensionID: string): boolean;
23/** Reports whether the given extension is mentioned (enabled or disabled) in the settings. */
24export declare function isExtensionAdded(settings: Settings | ErrorLike | null, extensionID: string): boolean;
25/**
26 * Shows a modal confirmation prompt to the user confirming whether to add an extension.
27 */
28export declare function confirmAddExtension(extensionID: string, extensionManifest?: ConfiguredExtension['manifest']): boolean;