1 | /// <reference types="react" />
|
2 | import { Subscribable } from 'rxjs';
|
3 | import { ConfigurationUpdateParams } from 'sourcegraph/module/protocol';
|
4 | import { Controller } from './controller';
|
5 | import { QueryResult } from './graphql';
|
6 | import * as GQL from './schema/graphqlschema';
|
7 | import { ConfigurationCascadeOrError, ConfigurationSubject, ID, Settings } from './settings';
|
8 | /**
|
9 | * Description of the context in which extensions-client-common is running, and platform-specific hooks.
|
10 | */
|
11 | export interface Context<S extends ConfigurationSubject, C extends Settings> {
|
12 | /**
|
13 | * An observable that emits whenever the configuration cascade changes (including when any individual subject's
|
14 | * settings change).
|
15 | */
|
16 | readonly configurationCascade: Subscribable<ConfigurationCascadeOrError<S, C>>;
|
17 | /**
|
18 | * Updates the extension settings for extensionID and for the given subject.
|
19 | */
|
20 | updateExtensionSettings(subject: ID, args: {
|
21 | edit?: ConfigurationUpdateParams;
|
22 | } | {
|
23 | extensionID: string;
|
24 | enabled?: boolean;
|
25 | remove?: boolean;
|
26 | }): Subscribable<void>;
|
27 | /**
|
28 | * Sends a request to the Sourcegraph GraphQL API and returns the response.
|
29 | *
|
30 | * @param request The GraphQL request (query or mutation)
|
31 | * @param variables An object whose properties are GraphQL query name-value variable pairs
|
32 | * @return Observable that emits the result or an error if the HTTP request failed
|
33 | */
|
34 | queryGraphQL(request: string, variables?: {
|
35 | [name: string]: any;
|
36 | }): Subscribable<QueryResult<Pick<GQL.IQuery, 'extensionRegistry'>>>;
|
37 | /**
|
38 | * React components for icons. They are expected to size themselves appropriately with the surrounding DOM flow
|
39 | * content.
|
40 | */
|
41 | readonly icons: Record<'Loader' | 'Warning' | 'Menu' | 'CaretDown', React.ComponentType<{
|
42 | className: 'icon-inline' | string;
|
43 | onClick?: () => void;
|
44 | }>>;
|
45 | /**
|
46 | * Forces the currently displayed tooltip, if any, to update its contents.
|
47 | */
|
48 | forceUpdateTooltip(): void;
|
49 | /**
|
50 | * Experimental capabilities implemented by the client (that are not defined by the Sourcegraph extension API
|
51 | * specification). These capabilities are passed verbatim to extensions in the initialize request's
|
52 | * capabilities.experimental property.
|
53 | */
|
54 | experimentalClientCapabilities?: any;
|
55 | }
|
56 | /**
|
57 | * React partial props for components needing the extensions controller.
|
58 | */
|
59 | export interface ExtensionsProps<S extends ConfigurationSubject, C extends Settings> {
|
60 | extensions: Controller<S, C>;
|
61 | }
|