diff --git a/.vscode/launch.json b/.vscode/launch.json index 6e0a114c..ee000517 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", - "args": ["--extensionDevelopmentPath=${workspaceRoot}"], + "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--enable-proposed-api=sourcegraph.sourcegraph"], "stopOnEntry": false, "sourceMaps": true, "outFiles": ["${workspaceRoot}/out/**/*.js"], diff --git a/package.json b/package.json index 55a8d9a2..a0a16882 100644 --- a/package.json +++ b/package.json @@ -10,15 +10,15 @@ "type": "git", "url": "https://github.com/sourcegraph/sourcegraph-vscode.git" }, + "enableProposedApi": true, "engines": { - "vscode": "^1.11.0" + "vscode": "^1.27.1" }, "categories": [ "Other" ], "activationEvents": [ - "onCommand:extension.open", - "onCommand:extension.search" + "*" ], "main": "./out/extension", "contributes": { @@ -51,11 +51,18 @@ "title": "Sourcegraph extension configuration", "properties": { "sourcegraph.url": { - "type": [ - "string" - ], + "type": "string", "default": "https://sourcegraph.com", "description": "The base URL of the Sourcegraph instance to use." + }, + "sourcegraph.accessToken": { + "type": "string", + "description": "An access token for your account on the Sourcegraph instance configured in `sourcegraph.url`. You do not need to provide an access token unless you have `\"sourcegraph.discussionsPreviewEnabled\": true` in your settings." + }, + "sourcegraph.discussionsPreviewEnabled": { + "type": "boolean", + "default": false, + "description": "Enables Sourcegraph discussions (preview)" } } } @@ -90,7 +97,8 @@ "build": "tsc -p .", "watch": "tsc -w -p .", "postinstall": "node ./node_modules/vscode/bin/install", - "test": "node ./node_modules/vscode/bin/test" + "test": "node ./node_modules/vscode/bin/test", + "graphql": "get-graphql-schema https://sourcegraph.com/.api/graphql --json | gql2ts -n SourcegraphGQL -o src/typings/SourcegraphGQL.d.ts && prettier src/typings/SourcegraphGQL.d.ts --write" }, "devDependencies": { "@commitlint/cli": "^7.0.0", @@ -101,7 +109,10 @@ "@types/execa": "^0.9.0", "@types/mocha": "^2.2.32", "@types/node": "^10.3.3", + "@types/node-fetch": "^2.1.2", "@types/opn": "^5.1.0", + "get-graphql-schema": "^2.1.1", + "gql2ts": "^1.8.2", "husky": "^0.14.3", "mocha": "^5.2.0", "prettier": "1.13.7", @@ -114,6 +125,7 @@ }, "dependencies": { "execa": "^0.6.3", + "node-fetch": "^2.2.0", "opn": "^5.0.0" } } diff --git a/src/comments.ts b/src/comments.ts new file mode 100644 index 00000000..17c83955 --- /dev/null +++ b/src/comments.ts @@ -0,0 +1,299 @@ +import vscode from 'vscode' +import { repoInfo } from './git' +import { gql, mutateGraphQL, queryGraphQL } from './graphql' +import { log } from './log' + +export function activateComments(context: vscode.ExtensionContext): void { + if (!vscode.workspace.getConfiguration('sourcegraph').get('discussionsPreviewEnabled')) { + return + } + log.appendLine('Discussions preview is enabled') + const commentProvider = new CommentProvider() + context.subscriptions.push(vscode.workspace.registerDocumentCommentProvider(commentProvider)) +} + +class CommentProvider implements vscode.DocumentCommentProvider { + public async provideDocumentComments( + document: vscode.TextDocument, + token: vscode.CancellationToken + ): Promise { + let threads: vscode.CommentThread[] = [] + try { + threads = await provideDocumentComments(document) + } catch (e) { + log.appendLine(`provideDocumentComments ${e}`) + } + + // commentingRanges are the ranges where the user can create a new comment. + // For now, this is the entire document. In the future we may wish to limit this + // in certain ways (e.g. not comment on lines which don't blame to a git revision that has been pushed to a remote). + const lastLine = document.lineCount - 1 + const commentingRanges = [new vscode.Range(0, 0, lastLine, document.lineAt(lastLine).range.end.character)] + + return { threads, commentingRanges } + } + + public async createNewCommentThread( + document: vscode.TextDocument, + range: vscode.Range, + text: string, + token: vscode.CancellationToken + ): Promise { + return await createNewCommentThread(document, range, text) + } + + public async replyToCommentThread( + document: vscode.TextDocument, + range: vscode.Range, + commentThread: vscode.CommentThread, + text: string, + token: vscode.CancellationToken + ): Promise { + return await replyToCommentThread(document, range, commentThread, text) + } + + private didChangeCommentThreads = new vscode.EventEmitter() + + public onDidChangeCommentThreads = this.didChangeCommentThreads.event +} + +async function provideDocumentComments(document: vscode.TextDocument): Promise { + log.appendLine(`provideDocumentComments ${document.uri}`) + const [remoteUrl, branch, path] = await repoInfo(document.fileName) + if (!remoteUrl) { + throw new Error('Git repository has no remote url configured') + } + const data = await queryGraphQL( + gql` + query DiscussionThreads( + $targetRepositoryGitCloneURL: String! + $targetRepositoryPath: String! + $relativeRev: String! + ) { + discussionThreads( + first: 10000 + targetRepositoryGitCloneURL: $targetRepositoryGitCloneURL + targetRepositoryPath: $targetRepositoryPath + ) { + totalCount + pageInfo { + hasNextPage + } + nodes { + ...DiscussionThreadFields + } + } + } + ${discussionThreadFieldsFragment} + `, + { + targetRepositoryGitCloneURL: remoteUrl, + targetRepositoryPath: path, + relativeRev: branch, + } + ) + + if (!data.discussionThreads || !data.discussionThreads.nodes) { + throw new Error(`Invalid GraphQL response for DiscussionThreads`) + } + + const threads: vscode.CommentThread[] = [] + for (const thread of data.discussionThreads.nodes) { + if (thread.target.__typename !== 'DiscussionThreadTargetRepo') { + continue + } + // TODO: this assumes there is no diff between the document state and the revision + const sel = thread.target.relativeSelection + if (sel) { + const range = new vscode.Range(sel.startLine, sel.startCharacter, sel.endLine, sel.endCharacter) + threads.push(discussionToCommentThread(document, range, thread)) + } + } + + return threads +} + +async function createNewCommentThread( + document: vscode.TextDocument, + range: vscode.Range, + text: string +): Promise { + log.appendLine(`createNewCommentThread ${document.uri} ${range}`) + const [remoteUrl, branch, path] = await repoInfo(document.fileName) + if (!remoteUrl) { + throw new Error('Git repository has no remote url configured') + } + + const selection = getSelection(document, range) + const input: SourcegraphGQL.IDiscussionThreadCreateInput = { + title: text, + contents: text, + targetRepo: { + repositoryGitCloneURL: remoteUrl, + path, + branch, + selection, + }, + } + + const data = await mutateGraphQL( + gql` + mutation CreateThread($input: DiscussionThreadCreateInput!, $relativeRev: String!) { + discussions { + createThread(input: $input) { + ...DiscussionThreadFields + } + } + } + ${discussionThreadFieldsFragment} + `, + { input, relativeRev: branch } + ) + + if (!data.discussions || !data.discussions.createThread) { + throw new Error(`Invalid GraphQL response for CreateThread`) + } + + return discussionToCommentThread(document, range, data.discussions.createThread) +} + +async function replyToCommentThread( + document: vscode.TextDocument, + range: vscode.Range, + thread: vscode.CommentThread, + text: string +): Promise { + const [, branch] = await repoInfo(document.fileName) + const data = await mutateGraphQL( + gql` + mutation AddCommentToThread($threadID: ID!, $contents: String!, $relativeRev: String!) { + discussions { + addCommentToThread(threadID: $threadID, contents: $contents) { + ...DiscussionThreadFields + } + } + } + ${discussionThreadFieldsFragment} + `, + { threadID: thread.threadId, contents: text, relativeRev: branch } + ) + + if (!data.discussions || !data.discussions.addCommentToThread) { + throw new Error(`Invalid GraphQL response for AddCommentToThread`) + } + + return discussionToCommentThread(document, range, data.discussions.addCommentToThread) +} +function discussionToCommentThread( + document: vscode.TextDocument, + range: vscode.Range, + thread: SourcegraphGQL.IDiscussionThread +): vscode.CommentThread { + const comments = thread.comments.nodes.map(comment => ({ + commentId: comment.id, + body: new vscode.MarkdownString(comment.contents), + userName: comment.author.username, + gravatar: comment.author.avatarURL || '', + })) + + return { + threadId: thread.id, + resource: document.uri, + range, + comments, + } +} + +function getSelection( + document: vscode.TextDocument, + range: vscode.Range +): SourcegraphGQL.IDiscussionThreadTargetRepoSelectionInput { + const beforeRange = new vscode.Range(range.start.line - 3, 0, range.start.line - 1, 0) + const linesBefore = getLines(document, beforeRange) + + const lines = getLines(document, range) + + const afterRange = new vscode.Range(range.end.line + 1, 0, range.end.line + 3, 0) + const linesAfter = getLines(document, afterRange) + + return { + startLine: range.start.line, + startCharacter: range.start.character, + endLine: range.end.line, + endCharacter: range.end.character, + linesBefore, + lines, + linesAfter, + } +} + +function getLines(document: vscode.TextDocument, range: vscode.Range): string[] { + const lines: string[] = [] + for (let i = range.start.line; i <= range.end.line; i++) { + if (i >= 0 && i < document.lineCount) { + lines.push(document.lineAt(i).text) + } + } + return lines +} + +const discussionThreadFieldsFragment = gql` + fragment DiscussionThreadFields on DiscussionThread { + id + author { + ...UserFields + } + comments { + totalCount + nodes { + id + author { + ...UserFields + } + contents + } + } + title + target { + __typename + ... on DiscussionThreadTargetRepo { + repository { + name + } + path + relativePath(rev: $relativeRev) + branch { + displayName + } + revision { + displayName + } + selection { + startLine + startCharacter + endLine + endCharacter + linesBefore + lines + linesAfter + } + relativeSelection(rev: $relativeRev) { + startLine + startCharacter + endLine + endCharacter + } + } + } + inlineURL + createdAt + updatedAt + archivedAt + } + + fragment UserFields on User { + displayName + username + avatarURL + } +` diff --git a/src/config.ts b/src/config.ts index 5e2bd58b..46d46694 100644 --- a/src/config.ts +++ b/src/config.ts @@ -7,3 +7,7 @@ export function getSourcegraphUrl(): string { } return url } + +export function getAccessToken(): string | undefined { + return vscode.workspace.getConfiguration('sourcegraph').get('accessToken') +} diff --git a/src/extension.ts b/src/extension.ts index 911f1122..21d88883 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,5 +1,6 @@ import opn from 'opn' import * as vscode from 'vscode' +import { activateComments } from './comments' import { getSourcegraphUrl } from './config' import { repoInfo } from './git' @@ -82,6 +83,7 @@ export function activate(context: vscode.ExtensionContext): void { // Register our extension commands (see package.json). context.subscriptions.push(vscode.commands.registerCommand('extension.open', handleCommandErrors(openCommand))) context.subscriptions.push(vscode.commands.registerCommand('extension.search', handleCommandErrors(searchCommand))) + activateComments(context) } export function deactivate(): void { diff --git a/src/graphql.ts b/src/graphql.ts new file mode 100644 index 00000000..31221701 --- /dev/null +++ b/src/graphql.ts @@ -0,0 +1,68 @@ +import { default as fetch, Headers, RequestInit } from 'node-fetch' +import { getAccessToken, getSourcegraphUrl } from './config' + +export const graphQLContent = Symbol('graphQLContent') +export interface GraphQLDocument { + [graphQLContent]: string +} + +/** + * Use this template string tag for all GraphQL queries + */ +export const gql = (template: TemplateStringsArray, ...substitutions: any[]): GraphQLDocument => ({ + [graphQLContent]: String.raw(template, ...substitutions.map(s => s[graphQLContent] || s)), +}) + +export async function queryGraphQL( + graphQLDocument: GraphQLDocument, + variables: { [name: string]: any } +): Promise { + return requestGraphQL(graphQLDocument, variables) as Promise +} + +export async function mutateGraphQL( + graphQLDocument: GraphQLDocument, + variables: { [name: string]: any } +): Promise { + return requestGraphQL(graphQLDocument, variables) as Promise +} + +async function requestGraphQL( + graphQLDocument: GraphQLDocument, + variables: { [name: string]: any } +): Promise { + const headers = new Headers() + headers.append('User-Agent', 'Sourcegraph for Visual Studio Code') + + const accessToken = getAccessToken() + if (accessToken) { + headers.append('Authorization', `token ${accessToken}`) + } + + const query = graphQLDocument[graphQLContent] + const nameMatch = query.match(/^\s*(?:query|mutation)\s+(\w+)/) + const graphqlUrl = getSourcegraphUrl() + '/.api/graphql' + (nameMatch ? '?' + nameMatch[1] : '') + const init: RequestInit = { + method: 'POST', + headers, + body: JSON.stringify({ query, variables }), + } + const resp = await fetch(graphqlUrl, init) + + const contentType = resp.headers.get('Content-Type') || '' + if (!contentType.includes('json')) { + const responseText = await resp.text() + throw Object.assign(new Error(`Sourcegraph API Error ${resp.status} ${resp.statusText}: ${responseText}`), { + responseText, + }) + } + + const response = await resp.json() + if (response.errors && response.errors.length > 0) { + const multierror = response.errors.map((e: any) => e.message).join('\n') + throw Object.assign(new Error(`Sourcegraph API Error ${resp.status} ${resp.statusText}: ${multierror}`), { + response, + }) + } + return response.data +} diff --git a/src/typings/SourcegraphGQL.d.ts b/src/typings/SourcegraphGQL.d.ts new file mode 100644 index 00000000..44e862f5 --- /dev/null +++ b/src/typings/SourcegraphGQL.d.ts @@ -0,0 +1,7397 @@ +// tslint:disable +// graphql typescript definitions + +declare namespace SourcegraphGQL { + interface IGraphQLResponseRoot { + data?: IQuery | IMutation + errors?: Array + } + + interface IGraphQLResponseError { + /** Required for all errors */ + message: string + locations?: Array + /** 7.2.2 says 'GraphQL servers may provide additional entries to error' */ + [propName: string]: any + } + + interface IGraphQLResponseErrorLocation { + line: number + column: number + } + + /** + * A query. + */ + interface IQuery { + __typename: 'Query' + + /** + * The root of the query. + * @deprecated "this will be removed." + */ + root: IQuery + + /** + * Looks up a node by ID. + */ + node: Node | null + + /** + * Looks up a repository by name. + */ + repository: IRepository | null + + /** + * List all repositories. + */ + repositories: IRepositoryConnection + + /** + * Looks up a Phabricator repository by name. + */ + phabricatorRepo: IPhabricatorRepo | null + + /** + * The current user. + */ + currentUser: IUser | null + + /** + * Looks up a user by username. + */ + user: IUser | null + + /** + * List all users. + */ + users: IUserConnection + + /** + * Looks up an organization by name. + */ + organization: IOrg | null + + /** + * List all organizations. + */ + organizations: IOrgConnection + + /** + * Lists discussion threads. + */ + discussionThreads: IDiscussionThreadConnection + + /** + * Lists discussion comments. + */ + discussionComments: IDiscussionCommentConnection + + /** + * Renders Markdown to HTML. The returned HTML is already sanitized and + * escaped and thus is always safe to render. + */ + renderMarkdown: string + + /** + * Looks up an instance of a type that implements ConfigurationSubject. + */ + configurationSubject: ConfigurationSubject | null + + /** + * The configuration for the viewer. + */ + viewerConfiguration: IConfigurationCascade + + /** + * The configuration for clients. + */ + clientConfiguration: IClientConfigurationDetails + + /** + * Runs a search. + */ + search: ISearch | null + + /** + * The search scopes. + */ + searchScopes: Array + + /** + * All saved queries configured for the current user, merged from all configurations. + */ + savedQueries: Array + + /** + * All repository groups for the current user, merged from all configurations. + */ + repoGroups: Array + + /** + * The current site. + */ + site: ISite + + /** + * Retrieve responses to surveys. + */ + surveyResponses: ISurveyResponseConnection + + /** + * The extension registry. + */ + extensionRegistry: IExtensionRegistry + + /** + * Queries that are only used on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + dotcom: IDotcomQuery + } + + interface INodeOnQueryArguments { + id: string + } + + interface IRepositoryOnQueryArguments { + /** + * The name, for example "github.com/gorilla/mux". + */ + name?: string | null + + /** + * An alias for name. DEPRECATED: use name instead. + */ + uri?: string | null + } + + interface IRepositoriesOnQueryArguments { + /** + * Returns the first n repositories from the list. + */ + first?: number | null + + /** + * Return repositories whose names match the query. + */ + query?: string | null + + /** + * Include enabled repositories. + * @default true + */ + enabled?: boolean | null + + /** + * Include disabled repositories. + * @default false + */ + disabled?: boolean | null + + /** + * Include cloned repositories. + * @default true + */ + cloned?: boolean | null + + /** + * Include repositories that are currently being cloned. + * @default true + */ + cloneInProgress?: boolean | null + + /** + * Include repositories that are not yet cloned and for which cloning is not in progress. + * @default true + */ + notCloned?: boolean | null + + /** + * Include repositories that have a text search index. + * @default true + */ + indexed?: boolean | null + + /** + * Include repositories that do not have a text search index. + * @default true + */ + notIndexed?: boolean | null + + /** + * Filter for repositories that have been indexed for cross-repository code intelligence. + * @default false + */ + ciIndexed?: boolean | null + + /** + * Filter for repositories that have not been indexed for cross-repository code intelligence. + * @default false + */ + notCIIndexed?: boolean | null + + /** + * Sort field. + * @default "REPO_URI" + */ + orderBy?: RepoOrderBy | null + + /** + * Sort direction. + * @default false + */ + descending?: boolean | null + } + + interface IPhabricatorRepoOnQueryArguments { + /** + * The name, for example "github.com/gorilla/mux". + */ + name?: string | null + + /** + * An alias for name. DEPRECATED: use name instead. + */ + uri?: string | null + } + + interface IUserOnQueryArguments { + username: string + } + + interface IUsersOnQueryArguments { + /** + * Returns the first n users from the list. + */ + first?: number | null + + /** + * Return users whose usernames or display names match the query. + */ + query?: string | null + + /** + * Return only users with the given tag. + */ + tag?: string | null + + /** + * Returns users who have been active in a given period of time. + */ + activePeriod?: UserActivePeriod | null + } + + interface IOrganizationOnQueryArguments { + name: string + } + + interface IOrganizationsOnQueryArguments { + /** + * Returns the first n organizations from the list. + */ + first?: number | null + + /** + * Return organizations whose names or display names match the query. + */ + query?: string | null + } + + interface IDiscussionThreadsOnQueryArguments { + /** + * Returns the first n threads from the list. + */ + first?: number | null + + /** + * Return discussion threads matching the query. + */ + query?: string | null + + /** + * When present, lists only the thread with this ID. + */ + threadID?: string | null + + /** + * When present, lists only the threads created by this author. + */ + authorUserID?: string | null + + /** + * When present, lists only the threads whose target is a repository with this ID. + * + * Only one of 'targetRepositoryID', 'targetRepositoryName', or 'targetRepositoryGitCloneURL' may be specified. + */ + targetRepositoryID?: string | null + + /** + * When present, lists only the threads whose target is a repository with this name. + * + * Only one of 'targetRepositoryID', 'targetRepositoryName', or 'targetRepositoryGitCloneURL' may be specified. + */ + targetRepositoryName?: string | null + + /** + * When present, lists only the threads whose target is a repository with this Git clone URL. + * + * Only one of 'targetRepositoryID', 'targetRepositoryName', or 'targetRepositoryGitCloneURL' may be specified. + */ + targetRepositoryGitCloneURL?: string | null + + /** + * When present, lists only the threads whose target is a repository with this file path. + * + * If the path ends with "/**", any path below that is matched. + */ + targetRepositoryPath?: string | null + } + + interface IDiscussionCommentsOnQueryArguments { + /** + * Returns the first n comments from the list. + */ + first?: number | null + + /** + * When present, lists only the comments created by this author. + */ + authorUserID?: string | null + } + + interface IRenderMarkdownOnQueryArguments { + markdown: string + options?: IMarkdownOptions | null + } + + interface IConfigurationSubjectOnQueryArguments { + id: string + } + + interface ISearchOnQueryArguments { + /** + * The search query (such as "foo" or "repo:myrepo foo"). + * @default "" + */ + query?: string | null + } + + interface ISurveyResponsesOnQueryArguments { + /** + * Returns the first n survey responses from the list. + */ + first?: number | null + } + + /** + * An object with an ID. + */ + type Node = + | IRepository + | IGitCommit + | IUser + | IOrg + | IOrganizationInvitation + | IAccessToken + | IExternalAccount + | IPackage + | IDependency + | IGitRef + | IRegistryExtension + | IProductSubscription + | IProductLicense + + /** + * An object with an ID. + */ + interface INode { + __typename: 'Node' + + /** + * The ID of the node. + */ + id: string + } + + /** + * A repository is a Git source control repository that is mirrored from some origin code host. + */ + interface IRepository { + __typename: 'Repository' + + /** + * The repository's unique ID. + */ + id: string + + /** + * The repository's name, as a path with one or more components. It conventionally consists of + * the repository's hostname and path (joined by "/"), minus any suffixes (such as ".git"). + * + * Examples: + * + * - github.com/foo/bar + * - my-code-host.example.com/myrepo + * - myrepo + */ + name: string + + /** + * An alias for name. + * @deprecated "use name instead" + */ + uri: string + + /** + * The repository's description. + */ + description: string + + /** + * The primary programming language in the repository. + */ + language: string + + /** + * Whether the repository is enabled. A disabled repository should only be accessible to site admins. + * + * NOTE: Disabling a repository does not provide any additional security. This field is merely a + * guideline to UI implementations. + */ + enabled: boolean + + /** + * The date when this repository was created on Sourcegraph. + */ + createdAt: string + + /** + * The date when this repository's metadata was last updated on Sourcegraph. + */ + updatedAt: string | null + + /** + * Returns information about the given commit in the repository, or null if no commit exists with the given rev. + */ + commit: IGitCommit | null + + /** + * Information and status related to mirroring, if this repository is a mirror of another repository (e.g., on + * some code host). In this case, the remote source repository is external to Sourcegraph and the mirror is + * maintained by the Sourcegraph site (not the other way around). + */ + mirrorInfo: IMirrorRepositoryInfo + + /** + * Information about this repository from the external service that it originates from (such as GitHub, GitLab, + * Phabricator, etc.). + */ + externalRepository: IExternalRepository | null + + /** + * Whether the repository is currently being cloned. + * @deprecated "use Repository.mirrorInfo.cloneInProgress instead" + */ + cloneInProgress: boolean + + /** + * The commit that was last indexed for cross-references, if any. + */ + lastIndexedRevOrLatest: IGitCommit | null + + /** + * Information about the text search index for this repository, or null if text search indexing + * is not enabled or supported for this repository. + */ + textSearchIndex: IRepositoryTextSearchIndex | null + + /** + * The URL to this repository. + */ + url: string + + /** + * The URLs to this repository on external services associated with it. + */ + externalURLs: Array + + /** + * The repository's default Git branch (HEAD symbolic ref). If the repository is currently being cloned or is + * empty, this field will be null. + */ + defaultBranch: IGitRef | null + + /** + * The repository's Git refs. + */ + gitRefs: IGitRefConnection + + /** + * The repository's Git branches. + */ + branches: IGitRefConnection + + /** + * The repository's Git tags. + */ + tags: IGitRefConnection + + /** + * A Git comparison in this repository between a base and head commit. + */ + comparison: IRepositoryComparison + + /** + * The repository's contributors. + */ + contributors: IRepositoryContributorConnection + + /** + * The repository's symbols (e.g., functions, variables, types, classes, etc.) on the default branch. + * + * The result may be stale if a new commit was just pushed to this repository's default branch and it has not + * yet been processed. Use Repository.commit.tree.symbols to retrieve symbols for a specific revision. + */ + symbols: ISymbolConnection + + /** + * Packages defined in this repository, as returned by LSP workspace/xpackages requests to this repository's + * language servers (running against a recent commit on its default branch). + * + * The result may be stale if a new commit was just pushed to this repository's default branch and it has not + * yet been processed. Use Repository.commit.packages to retrieve packages for a specific revision. + */ + packages: IPackageConnection + + /** + * Dependencies of this repository, as returned by LSP workspace/xreferences requests to this repository's + * language servers (running against a recent commit on its default branch). + * + * The result may be stale if a new commit was just pushed to this repository's default branch and it has not + * yet been processed. Use Repository.commit.dependencies to retrieve dependencies for a specific revision. + */ + dependencies: IDependencyConnection + + /** + * The total ref list. + */ + listTotalRefs: ITotalRefList + + /** + * Link to another Sourcegraph instance location where this repository is located. + */ + redirectURL: string | null + + /** + * Whether the viewer has admin privileges on this repository. + */ + viewerCanAdminister: boolean + } + + interface ICommitOnRepositoryArguments { + /** + * The Git revision specifier (revspec) for the commit. + */ + rev: string + + /** + * Optional input revspec used to construct non-canonical URLs and other "friendly" field values. Used by + * clients that must ensure consistency of revision resolution within a session/request (so they use full + * SHAs) but also preserve the user input rev (for user friendliness). + */ + inputRevspec?: string | null + } + + interface IGitRefsOnRepositoryArguments { + /** + * Returns the first n Git refs from the list. + */ + first?: number | null + + /** + * Return Git refs whose names match the query. + */ + query?: string | null + + /** + * Return only Git refs of the given type. + * + * Known issue: It is only supported to retrieve Git branch and tag refs, not + * other Git refs. + */ + type?: GitRefType | null + + /** + * Ordering for Git refs in the list. + */ + orderBy?: GitRefOrder | null + } + + interface IBranchesOnRepositoryArguments { + /** + * Returns the first n Git branches from the list. + */ + first?: number | null + + /** + * Return Git branches whose names match the query. + */ + query?: string | null + + /** + * Ordering for Git branches in the list. + */ + orderBy?: GitRefOrder | null + } + + interface ITagsOnRepositoryArguments { + /** + * Returns the first n Git tags from the list. + */ + first?: number | null + + /** + * Return Git tags whose names match the query. + */ + query?: string | null + } + + interface IComparisonOnRepositoryArguments { + /** + * The base of the diff ("old" or "left-hand side"), or "HEAD" if not specified. + */ + base?: string | null + + /** + * The head of the diff ("new" or "right-hand side"), or "HEAD" if not specified. + */ + head?: string | null + } + + interface IContributorsOnRepositoryArguments { + /** + * The Git revision range to compute contributors in. + */ + revisionRange?: string | null + + /** + * The date after which to count contributions. + */ + after?: string | null + + /** + * Return contributors to files in this path. + */ + path?: string | null + + /** + * Returns the first n contributors from the list. + */ + first?: number | null + } + + interface ISymbolsOnRepositoryArguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + interface IPackagesOnRepositoryArguments { + /** + * Returns the first n packages from the list. + */ + first?: number | null + + /** + * Return packages matching the query. + */ + query?: string | null + } + + interface IDependenciesOnRepositoryArguments { + /** + * Returns the first n dependencies from the list. + */ + first?: number | null + + /** + * Return dependencies matching the query. + */ + query?: string | null + } + + /** + * A Git commit. + */ + interface IGitCommit { + __typename: 'GitCommit' + + /** + * The globally addressable ID for this commit. + */ + id: string + + /** + * The repository that contains this commit. + */ + repository: IRepository + + /** + * This commit's Git object ID (OID), a 40-character SHA-1 hash. + */ + oid: any + + /** + * The abbreviated form of this commit's OID. + */ + abbreviatedOID: string + + /** + * This commit's author. + */ + author: ISignature + + /** + * This commit's committer, if any. + */ + committer: ISignature | null + + /** + * The full commit message. + */ + message: string + + /** + * The first line of the commit message. + */ + subject: string + + /** + * The contents of the commit message after the first line. + */ + body: string | null + + /** + * Parent commits of this commit. + */ + parents: Array + + /** + * The URL to this commit (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this commit (using an immutable revision specifier). + */ + canonicalURL: string + + /** + * The URLs to this commit on its repository's external services. + */ + externalURLs: Array + + /** + * The Git tree in this commit at the given path. + */ + tree: IGitTree | null + + /** + * The Git blob in this commit at the given path. + */ + blob: IGitBlob | null + + /** + * The file at the given path for this commit. + * + * See "File" documentation for the difference between this field and the "blob" field. + */ + file: File2 | null + + /** + * Lists the programming languages present in the tree at this commit. + */ + languages: Array + + /** + * The log of commits consisting of this commit and its ancestors. + */ + ancestors: IGitCommitConnection + + /** + * Returns the number of commits that this commit is behind and ahead of revspec. + */ + behindAhead: IBehindAheadCounts + + /** + * Symbols defined as of this commit. (All symbols, not just symbols that were newly defined in this commit.) + */ + symbols: ISymbolConnection + + /** + * Packages defined in this repository as of this commit, as returned by LSP workspace/xpackages + * requests to this repository's language servers. + */ + packages: IPackageConnection + + /** + * Dependencies of this repository as of this commit, as returned by LSP workspace/xreferences + * requests to this repository's language servers. + */ + dependencies: IDependencyConnection + } + + interface ITreeOnGitCommitArguments { + /** + * The path of the tree. + * @default "" + */ + path?: string | null + + /** + * Whether to recurse into sub-trees. If true, it overrides the value of the "recursive" parameter on all of + * GitTree's fields. + * + * DEPRECATED: Use the "recursive" parameter on GitTree's fields instead. + * @default false + */ + recursive?: boolean | null + } + + interface IBlobOnGitCommitArguments { + path: string + } + + interface IFileOnGitCommitArguments { + path: string + } + + interface IAncestorsOnGitCommitArguments { + /** + * Returns the first n commits from the list. + */ + first?: number | null + + /** + * Return commits that match the query. + */ + query?: string | null + + /** + * Return commits that affect the path. + */ + path?: string | null + } + + interface IBehindAheadOnGitCommitArguments { + revspec: string + } + + interface ISymbolsOnGitCommitArguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + interface IPackagesOnGitCommitArguments { + /** + * Returns the first n packages from the list. + */ + first?: number | null + + /** + * Return packages matching the query. + */ + query?: string | null + } + + interface IDependenciesOnGitCommitArguments { + /** + * Returns the first n dependencies from the list. + */ + first?: number | null + + /** + * Return dependencies matching the query. + */ + query?: string | null + } + + /** + * A signature. + */ + interface ISignature { + __typename: 'Signature' + + /** + * The person. + */ + person: IPerson + + /** + * The date. + */ + date: string + } + + /** + * A person. + */ + interface IPerson { + __typename: 'Person' + + /** + * The name. + */ + name: string + + /** + * The email. + */ + email: string + + /** + * The name if set; otherwise the email username. + */ + displayName: string + + /** + * The avatar URL. + */ + avatarURL: string + + /** + * The corresponding user account for this person, if one exists. + */ + user: IUser | null + } + + /** + * A user. + */ + interface IUser { + __typename: 'User' + + /** + * The unique ID for the user. + */ + id: string + + /** + * The user's username. + */ + username: string + + /** + * The unique numeric ID for the user. + * @deprecated "use id instead" + */ + sourcegraphID: number + + /** + * The user's primary email address. + * + * Only the user and site admins can access this field. + * @deprecated "use emails instead" + */ + email: string + + /** + * The display name chosen by the user. + */ + displayName: string | null + + /** + * The URL of the user's avatar image. + */ + avatarURL: string | null + + /** + * The URL to the user's profile on Sourcegraph. + */ + url: string + + /** + * The URL to the user's settings. + */ + settingsURL: string + + /** + * The date when the user account was created on Sourcegraph. + */ + createdAt: string + + /** + * The date when the user account was last updated on Sourcegraph. + */ + updatedAt: string | null + + /** + * Whether the user is a site admin. + * + * Only the user and site admins can access this field. + */ + siteAdmin: boolean + + /** + * The latest settings for the user. + * + * Only the user and site admins can access this field. + */ + latestSettings: ISettings | null + + /** + * The configuration cascade including this subject and all applicable subjects whose configuration is lower + * precedence than this subject. + */ + configurationCascade: IConfigurationCascade + + /** + * The organizations that this user is a member of. + */ + organizations: IOrgConnection + + /** + * This user's organization memberships. + */ + organizationMemberships: IOrganizationMembershipConnection + + /** + * Tags associated with the user. These are used for internal site management and feature selection. + * + * Only the user and site admins can access this field. + */ + tags: Array + + /** + * The user's usage activity on Sourcegraph. + * + * Only the user and site admins can access this field. + */ + activity: IUserActivity + + /** + * The user's email addresses. + * + * Only the user and site admins can access this field. + */ + emails: Array + + /** + * The user's access tokens (which grant to the holder the privileges of the user). This consists + * of all access tokens whose subject is this user. + * + * Only the user and site admins can access this field. + */ + accessTokens: IAccessTokenConnection + + /** + * A list of external accounts that are associated with the user. + */ + externalAccounts: IExternalAccountConnection + + /** + * The user's currently active session. + * + * Only the currently authenticated user can access this field. Site admins are not able to access sessions for + * other users. + */ + session: ISession + + /** + * Whether the viewer has admin privileges on this user. The user has admin privileges on their own user, and + * site admins have admin privileges on all users. + */ + viewerCanAdminister: boolean + + /** + * The user's survey responses. + * + * Only the user and site admins can access this field. + */ + surveyResponses: Array + + /** + * The URL to view this user's customer information (for Sourcegraph.com site admins). + * + * Only Sourcegraph.com site admins may query this field. + * + * FOR INTERNAL USE ONLY. + */ + urlForSiteAdminBilling: string | null + } + + interface IAccessTokensOnUserArguments { + /** + * Returns the first n access tokens from the list. + */ + first?: number | null + } + + interface IExternalAccountsOnUserArguments { + /** + * Returns the first n external accounts from the list. + */ + first?: number | null + } + + /** + * ConfigurationSubject is something that can have configuration. + */ + type ConfigurationSubject = IUser | IOrg | ISite + + /** + * ConfigurationSubject is something that can have configuration. + */ + interface IConfigurationSubject { + __typename: 'ConfigurationSubject' + + /** + * The ID. + */ + id: string + + /** + * The latest settings. + */ + latestSettings: ISettings | null + + /** + * The URL to the settings. + */ + settingsURL: string + + /** + * Whether the viewer can modify the subject's configuration. + */ + viewerCanAdminister: boolean + + /** + * The configuration cascade including this subject and all applicable subjects whose configuration is lower + * precedence than this subject. + */ + configurationCascade: IConfigurationCascade + } + + /** + * Settings is a version of a configuration settings file. + */ + interface ISettings { + __typename: 'Settings' + + /** + * The ID. + */ + id: number + + /** + * The configuration. + */ + configuration: IConfiguration + + /** + * The subject that these settings are for. + */ + subject: ConfigurationSubject + + /** + * The author. + */ + author: IUser + + /** + * The time when this was created. + */ + createdAt: string + + /** + * The contents. + * @deprecated "use configuration.contents instead" + */ + contents: string + } + + /** + * Configuration contains settings from (possibly) multiple settings files. + */ + interface IConfiguration { + __typename: 'Configuration' + + /** + * The raw JSON contents, encoded as a string. + */ + contents: string + + /** + * Error and warning messages about the configuration. + */ + messages: Array + } + + /** + * The configurations for all of the relevant configuration subjects, plus the merged configuration. + */ + interface IConfigurationCascade { + __typename: 'ConfigurationCascade' + + /** + * The other configuration subjects that are applied with lower precedence than this subject to + * form the final configuration. For example, a user in 2 organizations would have the following + * configuration subjects: site (global settings), org 1, org 2, and the user. + */ + subjects: Array + + /** + * The effective configuration, merged from all of the subjects. + */ + merged: IConfiguration + } + + /** + * A list of organizations. + */ + interface IOrgConnection { + __typename: 'OrgConnection' + + /** + * A list of organizations. + */ + nodes: Array + + /** + * The total count of organizations in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + } + + /** + * An organization, which is a group of users. + */ + interface IOrg { + __typename: 'Org' + + /** + * The unique ID for the organization. + */ + id: string + + /** + * The organization's name. This is unique among all organizations on this Sourcegraph site. + */ + name: string + + /** + * The organization's chosen display name. + */ + displayName: string | null + + /** + * The date when the organization was created, in RFC 3339 format. + */ + createdAt: string + + /** + * A list of users who are members of this organization. + */ + members: IUserConnection + + /** + * The latest settings for the organization. + * + * Only organization members and site admins can access this field. + */ + latestSettings: ISettings | null + + /** + * The configuration cascade including this subject and all applicable subjects whose configuration is lower + * precedence than this subject. + */ + configurationCascade: IConfigurationCascade + + /** + * A pending invitation for the viewer to join this organization, if any. + */ + viewerPendingInvitation: IOrganizationInvitation | null + + /** + * Whether the viewer has admin privileges on this organization. Currently, all of an organization's members + * have admin privileges on the organization. + */ + viewerCanAdminister: boolean + + /** + * Whether the viewer is a member of this organization. + */ + viewerIsMember: boolean + + /** + * The URL to the organization. + */ + url: string + + /** + * The URL to the organization's settings. + */ + settingsURL: string + } + + /** + * A list of users. + */ + interface IUserConnection { + __typename: 'UserConnection' + + /** + * A list of users. + */ + nodes: Array + + /** + * The total count of users in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * Pagination information. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo. + */ + interface IPageInfo { + __typename: 'PageInfo' + + /** + * Whether there is a next page of nodes in the connection. + */ + hasNextPage: boolean + } + + /** + * An invitation to join an organization as a member. + */ + interface IOrganizationInvitation { + __typename: 'OrganizationInvitation' + + /** + * The ID of the invitation. + */ + id: string + + /** + * The organization that the invitation is for. + */ + organization: IOrg + + /** + * The user who sent the invitation. + */ + sender: IUser + + /** + * The user who received the invitation. + */ + recipient: IUser + + /** + * The date when this invitation was created. + */ + createdAt: string + + /** + * The most recent date when a notification was sent to the recipient about this invitation. + */ + notifiedAt: string | null + + /** + * The date when this invitation was responded to by the recipient. + */ + respondedAt: string | null + + /** + * The recipient's response to this invitation, or no response (null). + */ + responseType: OrganizationInvitationResponseType | null + + /** + * The URL where the recipient can respond to the invitation when pending, or null if not pending. + */ + respondURL: string | null + + /** + * The date when this invitation was revoked. + */ + revokedAt: string | null + } + + /** + * The recipient's possible responses to an invitation to join an organization as a member. + */ + const enum OrganizationInvitationResponseType { + /** + * The invitation was accepted by the recipient. + */ + ACCEPT = 'ACCEPT', + + /** + * The invitation was rejected by the recipient. + */ + REJECT = 'REJECT', + } + + /** + * A list of organization memberships. + */ + interface IOrganizationMembershipConnection { + __typename: 'OrganizationMembershipConnection' + + /** + * A list of organization memberships. + */ + nodes: Array + + /** + * The total count of organization memberships in the connection. This total count may be larger than the number + * of nodes in this object when the result is paginated. + */ + totalCount: number + } + + /** + * An organization membership. + */ + interface IOrganizationMembership { + __typename: 'OrganizationMembership' + + /** + * The organization. + */ + organization: IOrg + + /** + * The user. + */ + user: IUser + + /** + * The time when this was created. + */ + createdAt: string + + /** + * The time when this was updated. + */ + updatedAt: string + } + + /** + * UserActivity describes a user's activity on the site. + */ + interface IUserActivity { + __typename: 'UserActivity' + + /** + * The number of search queries that the user has performed. + */ + searchQueries: number + + /** + * The number of page views that the user has performed. + */ + pageViews: number + + /** + * The number of code intelligence actions that the user has performed. + */ + codeIntelligenceActions: number + + /** + * The last time the user was active (any action, any platform). + */ + lastActiveTime: string | null + + /** + * The last time the user was active on a code host integration. + */ + lastActiveCodeHostIntegrationTime: string | null + } + + /** + * A user's email address. + */ + interface IUserEmail { + __typename: 'UserEmail' + + /** + * The email address. + */ + email: string + + /** + * Whether the email address has been verified by the user. + */ + verified: boolean + + /** + * Whether the email address is pending verification. + */ + verificationPending: boolean + + /** + * The user associated with this email address. + */ + user: IUser + + /** + * Whether the viewer has privileges to manually mark this email address as verified (without the user going + * through the normal verification process). Only site admins have this privilege. + */ + viewerCanManuallyVerify: boolean + } + + /** + * A list of access tokens. + */ + interface IAccessTokenConnection { + __typename: 'AccessTokenConnection' + + /** + * A list of access tokens. + */ + nodes: Array + + /** + * The total count of access tokens in the connection. This total count may be larger than the number of nodes + * in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * An access token that grants to the holder the privileges of the user who created it. + */ + interface IAccessToken { + __typename: 'AccessToken' + + /** + * The unique ID for the access token. + */ + id: string + + /** + * The user whose privileges the access token grants. + */ + subject: IUser + + /** + * The scopes that define the allowed set of operations that can be performed using this access token. + */ + scopes: Array + + /** + * A user-supplied descriptive note for the access token. + */ + note: string + + /** + * The user who created the access token. This is either the subject user (if the access token + * was created by the same user) or a site admin (who can create access tokens for any user). + */ + creator: IUser + + /** + * The date when the access token was created. + */ + createdAt: string + + /** + * The date when the access token was last used to authenticate a request. + */ + lastUsedAt: string | null + } + + /** + * A list of external accounts. + */ + interface IExternalAccountConnection { + __typename: 'ExternalAccountConnection' + + /** + * A list of external accounts. + */ + nodes: Array + + /** + * The total count of external accounts in the connection. This total count may be larger than the number of nodes + * in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * An external account associated with a user. + */ + interface IExternalAccount { + __typename: 'ExternalAccount' + + /** + * The unique ID for the external account. + */ + id: string + + /** + * The user on Sourcegraph. + */ + user: IUser + + /** + * The type of the external service where the external account resides. + */ + serviceType: string + + /** + * An identifier for the external service where the external account resides. + */ + serviceID: string + + /** + * An identifier for the client of the external service where the external account resides. This distinguishes + * among multiple authentication providers that access the same service with different parameters. + */ + clientID: string + + /** + * An identifier for the external account (typically equal to or derived from the ID on the external service). + */ + accountID: string + + /** + * The creation date of this external account on Sourcegraph. + */ + createdAt: string + + /** + * The last-updated date of this external account on Sourcegraph. + */ + updatedAt: string + + /** + * A URL that, when visited, re-initiates the authentication process. + */ + refreshURL: string | null + + /** + * Provider-specific data about the external account. + * + * Only site admins may query this field. + */ + accountData: any | null + } + + /** + * An active user session. + */ + interface ISession { + __typename: 'Session' + + /** + * Whether the user can sign out of this session on Sourcegraph. + */ + canSignOut: boolean + } + + /** + * An individual response to a user satisfaction (NPS) survey. + */ + interface ISurveyResponse { + __typename: 'SurveyResponse' + + /** + * The unique ID of the survey response + */ + id: string + + /** + * The user who submitted the survey (if they were authenticated at the time). + */ + user: IUser | null + + /** + * The email that the user manually entered (if they were NOT authenticated at the time). + */ + email: string | null + + /** + * User's likelihood of recommending Sourcegraph to a friend, from 0-10. + */ + score: number + + /** + * The answer to "What is the most important reason for the score you gave". + */ + reason: string | null + + /** + * The answer to "What can Sourcegraph do to provide a better product" + */ + better: string | null + + /** + * The time when this response was created. + */ + createdAt: string + } + + /** + * A URL to a resource on an external service, such as the URL to a repository on its external (origin) code host. + */ + interface IExternalLink { + __typename: 'ExternalLink' + + /** + * The URL to the resource. + */ + url: string + + /** + * The type of external service, such as "github", or null if unknown/unrecognized. This is used solely for + * displaying an icon that represents the service. + */ + serviceType: string | null + } + + /** + * A Git tree in a repository. + */ + interface IGitTree { + __typename: 'GitTree' + + /** + * The full path (relative to the root) of this tree. + */ + path: string + + /** + * Whether this tree is the root (top-level) tree. + */ + isRoot: boolean + + /** + * The base name (i.e., last path component only) of this tree. + */ + name: string + + /** + * True because this is a directory. (The value differs for other TreeEntry interface implementations, such as + * File.) + */ + isDirectory: boolean + + /** + * The Git commit containing this tree. + */ + commit: IGitCommit + + /** + * The repository containing this tree. + */ + repository: IRepository + + /** + * The URL to this tree (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this tree (using an immutable revision specifier). + */ + canonicalURL: string + + /** + * The URLs to this tree on external services. + */ + externalURLs: Array + + /** + * Submodule metadata if this tree points to a submodule + */ + submodule: ISubmodule | null + + /** + * A list of directories in this tree. + */ + directories: Array + + /** + * A list of files in this tree. + */ + files: Array + + /** + * A list of entries in this tree. + */ + entries: Array + + /** + * Symbols defined in this tree. + */ + symbols: ISymbolConnection + + /** + * Whether this tree entry is a single child + */ + isSingleChild: boolean + } + + interface IDirectoriesOnGitTreeArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. + * @default false + */ + recursive?: boolean | null + } + + interface IFilesOnGitTreeArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. + * @default false + */ + recursive?: boolean | null + } + + interface IEntriesOnGitTreeArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. If true, implies recursiveSingleChild. + * @default false + */ + recursive?: boolean | null + + /** + * Recurse into sub-trees of single-child directories. If true, we return a flat list of + * every directory that is a single child, and any directories or files that are + * nested in a single child. + * @default false + */ + recursiveSingleChild?: boolean | null + } + + interface ISymbolsOnGitTreeArguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + interface IIsSingleChildOnGitTreeArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. + * @default false + */ + recursive?: boolean | null + } + + /** + * A file, directory, or other tree entry. + */ + type TreeEntry = IGitTree | IGitBlob + + /** + * A file, directory, or other tree entry. + */ + interface ITreeEntry { + __typename: 'TreeEntry' + + /** + * The full path (relative to the repository root) of this tree entry. + */ + path: string + + /** + * The base name (i.e., file name only) of this tree entry. + */ + name: string + + /** + * Whether this tree entry is a directory. + */ + isDirectory: boolean + + /** + * The URL to this tree entry (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this tree entry (using an immutable revision specifier). + */ + canonicalURL: string + + /** + * The URLs to this tree entry on external services. + */ + externalURLs: Array + + /** + * Symbols defined in this file or directory. + */ + symbols: ISymbolConnection + + /** + * Submodule metadata if this tree points to a submodule + */ + submodule: ISubmodule | null + + /** + * Whether this tree entry is a single child + */ + isSingleChild: boolean + } + + interface ISymbolsOnTreeEntryArguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + interface IIsSingleChildOnTreeEntryArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. + * @default false + */ + recursive?: boolean | null + } + + /** + * A list of symbols. + */ + interface ISymbolConnection { + __typename: 'SymbolConnection' + + /** + * A list of symbols. + */ + nodes: Array + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A code symbol (e.g., a function, variable, type, class, etc.). + * + * It is derived from symbols as defined in the Language Server Protocol (see + * https://microsoft.github.io/language-server-protocol/specification#workspace_symbol). + */ + interface ISymbol { + __typename: 'Symbol' + + /** + * The name of the symbol. + */ + name: string + + /** + * The name of the symbol that contains this symbol, if any. This field's value is not guaranteed to be + * structured in such a way that callers can infer a hierarchy of symbols. + */ + containerName: string | null + + /** + * The kind of the symbol. + */ + kind: SymbolKind + + /** + * The programming language of the symbol. + */ + language: string + + /** + * The location where this symbol is defined. + */ + location: ILocation + + /** + * The URL to this symbol (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this symbol (using an immutable revision specifier). + */ + canonicalURL: string + } + + /** + * All possible kinds of symbols. This set matches that of the Language Server Protocol + * (https://microsoft.github.io/language-server-protocol/specification#workspace_symbol). + */ + const enum SymbolKind { + UNKNOWN = 'UNKNOWN', + FILE = 'FILE', + MODULE = 'MODULE', + NAMESPACE = 'NAMESPACE', + PACKAGE = 'PACKAGE', + CLASS = 'CLASS', + METHOD = 'METHOD', + PROPERTY = 'PROPERTY', + FIELD = 'FIELD', + CONSTRUCTOR = 'CONSTRUCTOR', + ENUM = 'ENUM', + INTERFACE = 'INTERFACE', + FUNCTION = 'FUNCTION', + VARIABLE = 'VARIABLE', + CONSTANT = 'CONSTANT', + STRING = 'STRING', + NUMBER = 'NUMBER', + BOOLEAN = 'BOOLEAN', + ARRAY = 'ARRAY', + OBJECT = 'OBJECT', + KEY = 'KEY', + NULL = 'NULL', + ENUMMEMBER = 'ENUMMEMBER', + STRUCT = 'STRUCT', + EVENT = 'EVENT', + OPERATOR = 'OPERATOR', + TYPEPARAMETER = 'TYPEPARAMETER', + } + + /** + * A location inside a resource (in a repository at a specific commit). + */ + interface ILocation { + __typename: 'Location' + + /** + * The file that this location refers to. + */ + resource: IGitBlob + + /** + * The range inside the file that this location refers to. + */ + range: IRange | null + + /** + * The URL to this location (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this location (using an immutable revision specifier). + */ + canonicalURL: string + } + + /** + * A Git blob in a repository. + */ + interface IGitBlob { + __typename: 'GitBlob' + + /** + * The full path (relative to the repository root) of this blob. + */ + path: string + + /** + * The base name (i.e., file name only) of this blob's path. + */ + name: string + + /** + * False because this is a blob (file), not a directory. + */ + isDirectory: boolean + + /** + * The content of this blob. + */ + content: string + + /** + * Whether or not it is binary. + */ + binary: boolean + + /** + * The blob contents rendered as rich HTML, or an empty string if it is not a supported + * rich file type. + * + * This HTML string is already escaped and thus is always safe to render. + */ + richHTML: string + + /** + * The Git commit containing this blob. + */ + commit: IGitCommit + + /** + * The repository containing this Git blob. + */ + repository: IRepository + + /** + * The URL to this blob (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this blob (using an immutable revision specifier). + */ + canonicalURL: string + + /** + * The URLs to this blob on its repository's external services. + */ + externalURLs: Array + + /** + * Blame the blob. + */ + blame: Array + + /** + * Highlight the blob contents. + */ + highlight: IHighlightedFile + + /** + * Returns dependency references for the blob. + */ + dependencyReferences: IDependencyReferences + + /** + * Submodule metadata if this tree points to a submodule + */ + submodule: ISubmodule | null + + /** + * Symbols defined in this blob. + */ + symbols: ISymbolConnection + + /** + * Always false, since a blob is a file, not directory. + */ + isSingleChild: boolean + } + + interface IBlameOnGitBlobArguments { + startLine: number + endLine: number + } + + interface IHighlightOnGitBlobArguments { + disableTimeout: boolean + isLightTheme: boolean + } + + interface IDependencyReferencesOnGitBlobArguments { + Language: string + Line: number + Character: number + } + + interface ISymbolsOnGitBlobArguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + interface IIsSingleChildOnGitBlobArguments { + /** + * Returns the first n files in the tree. + */ + first?: number | null + + /** + * Recurse into sub-trees. + * @default false + */ + recursive?: boolean | null + + /** + * Recurse into sub-trees of single-child directories + * @default false + */ + recursiveSingleChild?: boolean | null + } + + /** + * A file. + * + * In a future version of Sourcegraph, a repository's files may be distinct from a repository's blobs + * (for example, to support searching/browsing generated files that aren't committed and don't exist + * as Git blobs). Clients should generally use the GitBlob concrete type and GitCommit.blobs (not + * GitCommit.files), unless they explicitly want to opt-in to different behavior in the future. + * + * INTERNAL: This is temporarily named File2 during a migration. Do not refer to the name File2 in + * any API clients as the name will change soon. + */ + type File2 = IGitBlob + + /** + * A file. + * + * In a future version of Sourcegraph, a repository's files may be distinct from a repository's blobs + * (for example, to support searching/browsing generated files that aren't committed and don't exist + * as Git blobs). Clients should generally use the GitBlob concrete type and GitCommit.blobs (not + * GitCommit.files), unless they explicitly want to opt-in to different behavior in the future. + * + * INTERNAL: This is temporarily named File2 during a migration. Do not refer to the name File2 in + * any API clients as the name will change soon. + */ + interface IFile2 { + __typename: 'File2' + + /** + * The full path (relative to the root) of this file. + */ + path: string + + /** + * The base name (i.e., file name only) of this file. + */ + name: string + + /** + * False because this is a file, not a directory. + */ + isDirectory: boolean + + /** + * The content of this file. + */ + content: string + + /** + * Whether or not it is binary. + */ + binary: boolean + + /** + * The file rendered as rich HTML, or an empty string if it is not a supported + * rich file type. + * + * This HTML string is already escaped and thus is always safe to render. + */ + richHTML: string + + /** + * The URL to this file (using the input revision specifier, which may not be immutable). + */ + url: string + + /** + * The canonical URL to this file (using an immutable revision specifier). + */ + canonicalURL: string + + /** + * The URLs to this file on external services. + */ + externalURLs: Array + + /** + * Highlight the file. + */ + highlight: IHighlightedFile + + /** + * Returns dependency references for the file. + */ + dependencyReferences: IDependencyReferences + + /** + * Symbols defined in this file. + */ + symbols: ISymbolConnection + } + + interface IHighlightOnFile2Arguments { + disableTimeout: boolean + isLightTheme: boolean + } + + interface IDependencyReferencesOnFile2Arguments { + Language: string + Line: number + Character: number + } + + interface ISymbolsOnFile2Arguments { + /** + * Returns the first n symbols from the list. + */ + first?: number | null + + /** + * Return symbols matching the query. + */ + query?: string | null + } + + /** + * A highlighted file. + */ + interface IHighlightedFile { + __typename: 'HighlightedFile' + + /** + * Whether or not it was aborted. + */ + aborted: boolean + + /** + * The HTML. + */ + html: string + } + + /** + * Dependency references. + */ + interface IDependencyReferences { + __typename: 'DependencyReferences' + + /** + * The dependency reference data. + */ + dependencyReferenceData: IDependencyReferencesData + + /** + * The repository data. + */ + repoData: IRepoDataMap + } + + /** + * Dependency references data. + */ + interface IDependencyReferencesData { + __typename: 'DependencyReferencesData' + + /** + * The references. + */ + references: Array + + /** + * The location. + */ + location: IDepLocation + } + + /** + * A dependency reference. + */ + interface IDependencyReference { + __typename: 'DependencyReference' + + /** + * The dependency data. + */ + dependencyData: string + + /** + * The repository ID. + */ + repoId: number + + /** + * The hints. + */ + hints: string + } + + /** + * A dependency location. + */ + interface IDepLocation { + __typename: 'DepLocation' + + /** + * The location. + */ + location: string + + /** + * The symbol. + */ + symbol: string + } + + /** + * A repository data map. + */ + interface IRepoDataMap { + __typename: 'RepoDataMap' + + /** + * The repositories. + */ + repos: Array + + /** + * The repository IDs. + */ + repoIds: Array + } + + /** + * A hunk. + */ + interface IHunk { + __typename: 'Hunk' + + /** + * The startLine. + */ + startLine: number + + /** + * The endLine. + */ + endLine: number + + /** + * The startByte. + */ + startByte: number + + /** + * The endByte. + */ + endByte: number + + /** + * The rev. + */ + rev: string + + /** + * The author. + */ + author: ISignature + + /** + * The message. + */ + message: string + + /** + * The commit that contains the hunk. + */ + commit: IGitCommit + } + + /** + * A Git submodule + */ + interface ISubmodule { + __typename: 'Submodule' + + /** + * The remote repository URL of the submodule. + */ + url: string + + /** + * The commit of the submodule. + */ + commit: string + + /** + * The path to which the submodule is checked out. + */ + path: string + } + + /** + * A range inside a file. The start position is inclusive, and the end position is exclusive. + */ + interface IRange { + __typename: 'Range' + + /** + * The start position of the range (inclusive). + */ + start: IPosition + + /** + * The end position of the range (exclusive). + */ + end: IPosition + } + + /** + * A zero-based position inside a file. + */ + interface IPosition { + __typename: 'Position' + + /** + * The line number (zero-based) of the position. + */ + line: number + + /** + * The character offset (zero-based) in the line of the position. + */ + character: number + } + + /** + * File is temporarily preserved for backcompat with browser extension search API client code. + */ + interface IFile { + __typename: 'File' + + /** + * The full path (relative to the repository root) of this file. + */ + path: string + + /** + * The base name (i.e., file name only) of this file's path. + */ + name: string + + /** + * Whether this is a directory. + */ + isDirectory: boolean + + /** + * The URL to this file on Sourcegraph. + */ + url: string + + /** + * The repository that contains this file. + */ + repository: IRepository + } + + /** + * A list of Git commits. + */ + interface IGitCommitConnection { + __typename: 'GitCommitConnection' + + /** + * A list of Git commits. + */ + nodes: Array + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A set of Git behind/ahead counts for one commit relative to another. + */ + interface IBehindAheadCounts { + __typename: 'BehindAheadCounts' + + /** + * The number of commits behind the other commit. + */ + behind: number + + /** + * The number of commits ahead of the other commit. + */ + ahead: number + } + + /** + * A list of packages. + */ + interface IPackageConnection { + __typename: 'PackageConnection' + + /** + * A list of packages. + */ + nodes: Array + + /** + * The total count of packages in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A package represents a grouping of code that is returned by a language server in response to a + * workspace/xpackages request. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + interface IPackage { + __typename: 'Package' + + /** + * The ID of the package. + */ + id: string + + /** + * The repository commit that defines the package. + */ + definingCommit: IGitCommit + + /** + * The programming language used to define the package. + */ + language: string + + /** + * The package descriptor, as returned by the language server's workspace/xpackages LSP method. The attribute + * names and values are defined by each language server and should generally be considered opaque. + * + * The ordering is not meaningful. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + data: Array + + /** + * This package's dependencies, as returned by the language server's workspace/xpackages LSP method. + * + * The ordering is not meaningful. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + dependencies: Array + + /** + * The list of references (from only this repository at the definingCommit) to definitions in this package. + * + * If this operation is not supported (by the language server), this field's value will be null. + */ + internalReferences: IReferenceConnection | null + + /** + * The list of references (from other repositories' packages) to definitions in this package. Currently this + * lists packages that refer to this package, NOT individual call/reference sites within those referencing + * packages (unlike internalReferences, which does list individual call sites). If this operation is not + * supported (by the language server), this field's value will be null. + * + * EXPERIMENTAL: This field is experimental. It is subject to change. Please report any issues you see, and + * contact support for help. + */ + externalReferences: IReferenceConnection | null + } + + /** + * A key-value pair. + */ + interface IKeyValue { + __typename: 'KeyValue' + + /** + * The key. + */ + key: string + + /** + * The value, which can be of any type. + */ + value: any + } + + /** + * A dependency represents a dependency relationship between two units of code. It is derived from data returned by + * a language server in response to a workspace/xreferences request. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + interface IDependency { + __typename: 'Dependency' + + /** + * The ID of the dependency. + */ + id: string + + /** + * The repository commit that depends on the unit of code described by this resolver's other fields. + */ + dependingCommit: IGitCommit + + /** + * The programming language of the dependency. + */ + language: string + + /** + * The dependency attributes, as returned by the language server's workspace/xdependencies LSP method. The + * attribute names and values are defined by each language server and should generally be considered opaque. + * They generally overlap with the package descriptor's fields in the Package type. + * + * The ordering is not meaningful. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + data: Array + + /** + * Hints that can be passed to workspace/xreferences to speed up retrieval of references to this dependency. + * These hints are returned by the language server's workspace/xdependencies LSP method. The attribute names and + * values are defined by each language server and should generally be considered opaque. + * + * The ordering is not meaningful. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + hints: Array + + /** + * The list of references (in the depending commit's code files) to definitions in this dependency. + * + * If this operation is not supported (by the language server), this field's value will be null. + * + * EXPERIMENTAL: This field is experimental. It is subject to change. Please report any issues you see, and + * contact support for help. + */ + references: IReferenceConnection | null + } + + /** + * A list of code references (e.g., function calls, variable references, package import statements, etc.), as + * returned by language server(s) over LSP. + * + * NOTE: The actual references (which would be expected to be available in the "nodes" field) are not exposed. This + * is because currently there are no API consumers that need them. In the future, they will be available here, but + * in the meantime, consumers can provide the searchQuery to the Query.search GraphQL resolver to retrieve + * references. + */ + interface IReferenceConnection { + __typename: 'ReferenceConnection' + + /** + * The total count of references in this connection. If an exact count is not available, then this field's value + * will be null; consult the approximateCount field instead. + */ + totalCount: number | null + + /** + * The approximate count of references in this connection. If counting is not supported, then this field's value + * will be null. + */ + approximateCount: IApproximateCount | null + + /** + * The search query (for Sourcegraph search) that matches references in this connection. + * + * The query string does not include any repo:REPO@REV tokens (even if this connection would seem to warrant + * the inclusion of such tokens). Therefore, clients must add those tokens if they wish to constrain the search + * to only certain repositories and revisions. (This is so that clients can use the nice revision instead of the + * 40-character Git commit SHA if desired.) + */ + queryString: string + + /** + * The symbol descriptor query to pass to language servers in the LSP workspace/xreferences request to retrieve + * all references in this connection. This is derived from the attributes data of this connection's subject + * (e.g., Package.data or Dependency.data). The attribute names and values are defined by each language server + * and should generally be considered opaque. + * + * The ordering is not meaningful. + * + * See https://github.com/sourcegraph/language-server-protocol/blob/master/extension-workspace-references.md. + */ + symbolDescriptor: Array + } + + /** + * An approximate count. To display this to the user, use ApproximateCount.label as the number and use + * ApproximateCount.count to determine whether to pluralize the noun (if any) adjacent to the label. + */ + interface IApproximateCount { + __typename: 'ApproximateCount' + + /** + * The count, which may be inexact. This number is always the prefix of the label field. + */ + count: number + + /** + * Whether the count finished and is exact. + */ + exact: boolean + + /** + * A textual label that approximates the count (e.g., "99+" if the counting is cut off at 99). + */ + label: string + } + + /** + * A list of dependencies. + */ + interface IDependencyConnection { + __typename: 'DependencyConnection' + + /** + * A list of dependencies. + */ + nodes: Array + + /** + * The total count of dependencies in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * Information and status about the mirroring of a repository. In this case, the remote source repository + * is external to Sourcegraph and the mirror is maintained by the Sourcegraph site (not the other way + * around). + */ + interface IMirrorRepositoryInfo { + __typename: 'MirrorRepositoryInfo' + + /** + * The URL of the remote source repository. + */ + remoteURL: string + + /** + * Whether the clone of the repository has begun but not yet completed. + */ + cloneInProgress: boolean + + /** + * A single line of text that contains progress information for the running clone command. + * The format of the progress text is not specified. + * It is intended to be displayed directly to a user. + * e.g. + * "Receiving objects: 95% (2041/2148), 292.01 KiB | 515.00 KiB/s" + * "Resolving deltas: 9% (117/1263)" + */ + cloneProgress: string | null + + /** + * Whether the repository has ever been successfully cloned. + */ + cloned: boolean + + /** + * When the repository was last successfully updated from the remote source repository.. + */ + updatedAt: string | null + } + + /** + * A repository on an external service (such as GitHub, GitLab, Phabricator, etc.). + */ + interface IExternalRepository { + __typename: 'ExternalRepository' + + /** + * The repository's ID on the external service. + * + * Example: For GitHub, this is the GitHub GraphQL API's node ID for the repository. + */ + id: string + + /** + * The type of external service where this repository resides. + * + * Example: "github", "gitlab", etc. + */ + serviceType: string + + /** + * The particular instance of the external service where this repository resides. Its value is + * opaque but typically consists of the canonical base URL to the service. + * + * Example: For GitHub.com, this is "https://github.com/". + */ + serviceID: string + } + + /** + * Information about a repository's text search index. + */ + interface IRepositoryTextSearchIndex { + __typename: 'RepositoryTextSearchIndex' + + /** + * The indexed repository. + */ + repository: IRepository + + /** + * The status of the text search index, if available. + */ + status: IRepositoryTextSearchIndexStatus | null + + /** + * Git refs in the repository that are configured for text search indexing. + */ + refs: Array + } + + /** + * The status of a repository's text search index. + */ + interface IRepositoryTextSearchIndexStatus { + __typename: 'RepositoryTextSearchIndexStatus' + + /** + * The date that the index was last updated. + */ + updatedAt: string + + /** + * The byte size of the original content. + */ + contentByteSize: number + + /** + * The number of files in the original content. + */ + contentFilesCount: number + + /** + * The byte size of the index. + */ + indexByteSize: number + + /** + * The number of index shards. + */ + indexShardsCount: number + } + + /** + * A Git ref (usually a branch) in a repository that is configured to be indexed for text search. + */ + interface IRepositoryTextSearchIndexedRef { + __typename: 'RepositoryTextSearchIndexedRef' + + /** + * The Git ref (usually a branch) that is configured to be indexed for text search. To find the specific commit + * SHA that was indexed, use RepositoryTextSearchIndexedRef.indexedCommit; this field's ref target resolves to + * the current target, not the target at the time of indexing. + */ + ref: IGitRef + + /** + * Whether a text search index exists for this ref. + */ + indexed: boolean + + /** + * Whether the text search index is of the current commit for the Git ref. If false, the index is stale. + */ + current: boolean + + /** + * The indexed Git commit (which may differ from the ref's current target if the index is out of date). If + * indexed is false, this field's value is null. + */ + indexedCommit: IGitObject | null + } + + /** + * A Git ref. + */ + interface IGitRef { + __typename: 'GitRef' + + /** + * The globally addressable ID for the Git ref. + */ + id: string + + /** + * The full ref name (e.g., "refs/heads/mybranch" or "refs/tags/mytag"). + */ + name: string + + /** + * An unambiguous short name for the ref. + */ + abbrevName: string + + /** + * The display name of the ref. For branches ("refs/heads/foo"), this is the branch + * name ("foo"). + * + * As a special case, for GitHub pull request refs of the form refs/pull/NUMBER/head, + * this is "#NUMBER". + */ + displayName: string + + /** + * The prefix of the ref, either "", "refs/", "refs/heads/", "refs/pull/", or + * "refs/tags/". This prefix is always a prefix of the ref's name. + */ + prefix: string + + /** + * The type of this Git ref. + */ + type: GitRefType + + /** + * The object that the ref points to. + */ + target: IGitObject + + /** + * The associated repository. + */ + repository: IRepository + + /** + * The URL to this Git ref. + */ + url: string + } + + /** + * All possible types of Git refs. + */ + const enum GitRefType { + /** + * A Git branch (in refs/heads/). + */ + GIT_BRANCH = 'GIT_BRANCH', + + /** + * A Git tag (in refs/tags/). + */ + GIT_TAG = 'GIT_TAG', + + /** + * A Git ref that is neither a branch nor tag. + */ + GIT_REF_OTHER = 'GIT_REF_OTHER', + } + + /** + * A Git object. + */ + interface IGitObject { + __typename: 'GitObject' + + /** + * This object's OID. + */ + oid: any + + /** + * The abbreviated form of this object's OID. + */ + abbreviatedOID: string + + /** + * The commit object, if it is a commit and it exists; otherwise null. + */ + commit: IGitCommit | null + + /** + * The Git object's type. + */ + type: GitObjectType + } + + /** + * All possible types of Git objects. + */ + const enum GitObjectType { + /** + * A Git commit object. + */ + GIT_COMMIT = 'GIT_COMMIT', + + /** + * A Git tag object. + */ + GIT_TAG = 'GIT_TAG', + + /** + * A Git tree object. + */ + GIT_TREE = 'GIT_TREE', + + /** + * A Git blob object. + */ + GIT_BLOB = 'GIT_BLOB', + + /** + * A Git object of unknown type. + */ + GIT_UNKNOWN = 'GIT_UNKNOWN', + } + + /** + * Ordering options for Git refs. + */ + const enum GitRefOrder { + /** + * By the authored or committed at date, whichever is more recent. + */ + AUTHORED_OR_COMMITTED_AT = 'AUTHORED_OR_COMMITTED_AT', + } + + /** + * A list of Git refs. + */ + interface IGitRefConnection { + __typename: 'GitRefConnection' + + /** + * A list of Git refs. + */ + nodes: Array + + /** + * The total count of Git refs in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * The differences between two Git commits in a repository. + */ + interface IRepositoryComparison { + __typename: 'RepositoryComparison' + + /** + * The range that this comparison represents. + */ + range: IGitRevisionRange + + /** + * The commits in the comparison range, excluding the base and including the head. + */ + commits: IGitCommitConnection + + /** + * The file diffs for each changed file. + */ + fileDiffs: IFileDiffConnection + } + + interface ICommitsOnRepositoryComparisonArguments { + /** + * Return the first n commits from the list. + */ + first?: number | null + } + + interface IFileDiffsOnRepositoryComparisonArguments { + /** + * Return the first n file diffs from the list. + */ + first?: number | null + } + + /** + * A Git revision range of the form "base..head" or "base...head". Other revision + * range formats are not supported. + */ + interface IGitRevisionRange { + __typename: 'GitRevisionRange' + + /** + * The Git revision range expression of the form "base..head" or "base...head". + */ + expr: string + + /** + * The base (left-hand side) of the range. + */ + base: GitRevSpec + + /** + * The base's revspec as an expression. + */ + baseRevSpec: IGitRevSpecExpr + + /** + * The head (right-hand side) of the range. + */ + head: GitRevSpec + + /** + * The head's revspec as an expression. + */ + headRevSpec: IGitRevSpecExpr + + /** + * The merge-base of the base and head revisions, if this is a "base...head" + * revision range. If this is a "base..head" revision range, then this field is null. + */ + mergeBase: IGitObject | null + } + + /** + * A Git revspec. + */ + type GitRevSpec = IGitRef | IGitRevSpecExpr | IGitObject + + /** + * A Git revspec expression that (possibly) resolves to a Git revision. + */ + interface IGitRevSpecExpr { + __typename: 'GitRevSpecExpr' + + /** + * The original Git revspec expression. + */ + expr: string + + /** + * The Git object that the revspec resolves to, or null otherwise. + */ + object: IGitObject | null + } + + /** + * A list of file diffs. + */ + interface IFileDiffConnection { + __typename: 'FileDiffConnection' + + /** + * A list of file diffs. + */ + nodes: Array + + /** + * The total count of file diffs in the connection, if available. This total count may be larger than the number + * of nodes in this object when the result is paginated. + */ + totalCount: number | null + + /** + * Pagination information. + */ + pageInfo: IPageInfo + + /** + * The diff stat for the file diffs in this object, which may be a subset of the entire diff if the result is + * paginated. + */ + diffStat: IDiffStat + + /** + * The raw diff for the file diffs in this object, which may be a subset of the entire diff if the result is + * paginated. + */ + rawDiff: string + } + + /** + * A diff for a single file. + */ + interface IFileDiff { + __typename: 'FileDiff' + + /** + * The old (original) path of the file, or null if the file was added. + */ + oldPath: string | null + + /** + * The old file, or null if the file was created (oldFile.path == oldPath). + */ + oldFile: File2 | null + + /** + * The new (changed) path of the file, or null if the file was deleted. + */ + newPath: string | null + + /** + * The new file, or null if the file was deleted (newFile.path == newPath). + */ + newFile: File2 | null + + /** + * The old file (if the file was deleted) and otherwise the new file. This file field is typically used by + * clients that want to show a "View" link to the file. + */ + mostRelevantFile: File2 + + /** + * Hunks that were changed from old to new. + */ + hunks: Array + + /** + * The diff stat for the whole file. + */ + stat: IDiffStat + + /** + * FOR INTERNAL USE ONLY. + * + * An identifier for the file diff that is unique among all other file diffs in the list that + * contains it. + */ + internalID: string + } + + /** + * A changed region ("hunk") in a file diff. + */ + interface IFileDiffHunk { + __typename: 'FileDiffHunk' + + /** + * The range of the old file that the hunk applies to. + */ + oldRange: IFileDiffHunkRange + + /** + * Whether the old file had a trailing newline. + */ + oldNoNewlineAt: boolean + + /** + * The range of the new file that the hunk applies to. + */ + newRange: IFileDiffHunkRange + + /** + * The diff hunk section heading, if any. + */ + section: string | null + + /** + * The hunk body, with lines prefixed with '-', '+', or ' '. + */ + body: string + } + + /** + * A hunk range in one side (old/new) of a diff. + */ + interface IFileDiffHunkRange { + __typename: 'FileDiffHunkRange' + + /** + * The first line that the hunk applies to. + */ + startLine: number + + /** + * The number of lines that the hunk applies to. + */ + lines: number + } + + /** + * Statistics about a diff. + */ + interface IDiffStat { + __typename: 'DiffStat' + + /** + * Number of additions. + */ + added: number + + /** + * Number of changes. + */ + changed: number + + /** + * Number of deletions. + */ + deleted: number + } + + /** + * A list of contributors to a repository. + */ + interface IRepositoryContributorConnection { + __typename: 'RepositoryContributorConnection' + + /** + * A list of contributors to a repository. + */ + nodes: Array + + /** + * The total count of contributors in the connection, if available. This total count may be larger than the + * number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A contributor to a repository. + */ + interface IRepositoryContributor { + __typename: 'RepositoryContributor' + + /** + * The personal information for the contributor. + */ + person: IPerson + + /** + * The number of contributions made by this contributor. + */ + count: number + + /** + * The repository in which the contributions occurred. + */ + repository: IRepository + + /** + * Commits by the contributor. + */ + commits: IGitCommitConnection + } + + interface ICommitsOnRepositoryContributorArguments { + /** + * Return the first n commits. + */ + first?: number | null + } + + /** + * A total ref list. + */ + interface ITotalRefList { + __typename: 'TotalRefList' + + /** + * The repositories. + */ + repositories: Array + + /** + * The total. + */ + total: number + } + + /** + * RepoOrderBy enumerates the ways a repositories-list result set can + * be ordered. + */ + const enum RepoOrderBy { + REPO_URI = 'REPO_URI', + REPO_CREATED_AT = 'REPO_CREATED_AT', + } + + /** + * A list of repositories. + */ + interface IRepositoryConnection { + __typename: 'RepositoryConnection' + + /** + * A list of repositories. + */ + nodes: Array + + /** + * The total count of repositories in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + * + * In some cases, the total count can't be computed quickly; if so, it is null. Pass + * precise: true to always compute total counts even if it takes a while. + */ + totalCount: number | null + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + interface ITotalCountOnRepositoryConnectionArguments { + /** + * @default false + */ + precise?: boolean | null + } + + /** + * A Phabricator repository. + */ + interface IPhabricatorRepo { + __typename: 'PhabricatorRepo' + + /** + * The canonical repo path (e.g. "github.com/gorilla/mux"). + */ + name: string + + /** + * An alias for name. + * @deprecated "use name instead" + */ + uri: string + + /** + * The unique Phabricator identifier for the repo, like "MUX" + */ + callsign: string + + /** + * The URL to the phabricator instance (e.g. http://phabricator.sgdev.org) + */ + url: string + } + + /** + * A period of time in which a set of users have been active. + */ + const enum UserActivePeriod { + /** + * Since today at 00:00 UTC. + */ + TODAY = 'TODAY', + + /** + * Since the latest Monday at 00:00 UTC. + */ + THIS_WEEK = 'THIS_WEEK', + + /** + * Since the first day of the current month at 00:00 UTC. + */ + THIS_MONTH = 'THIS_MONTH', + + /** + * All time. + */ + ALL_TIME = 'ALL_TIME', + } + + /** + * A list of discussion threads. + */ + interface IDiscussionThreadConnection { + __typename: 'DiscussionThreadConnection' + + /** + * A list of discussion threads. + */ + nodes: Array + + /** + * The total count of discussion threads in the connection. This total + * count may be larger than the number of nodes in this object when the + * result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A discussion thread around some target (e.g. a file in a repo). + */ + interface IDiscussionThread { + __typename: 'DiscussionThread' + + /** + * The discussion thread ID (globally unique). + */ + id: string + + /** + * The user who authored this discussion thread. + */ + author: IUser + + /** + * The title of the thread. + * + * Note: the contents of the thread (its 'body') is always the first comment + * in the thread. It is always present, even if the user e.g. input no content. + */ + title: string + + /** + * The target of this discussion thread. + */ + target: DiscussionThreadTarget + + /** + * The URL at which this thread can be viewed inline (i.e. in the file blob view). + * + * This will be null if the thread target is not DiscussionThreadTargetRepo + * OR if it was created without a path string. + */ + inlineURL: string | null + + /** + * The date when the discussion thread was created. + */ + createdAt: string + + /** + * The date when the discussion thread was last updated. + */ + updatedAt: string + + /** + * The date when the discussion thread was archived (or null if it has not). + */ + archivedAt: string | null + + /** + * The comments in the discussion thread. + */ + comments: IDiscussionCommentConnection + } + + interface ICommentsOnDiscussionThreadArguments { + /** + * Returns the first n comments from the list. + */ + first?: number | null + } + + /** + * The target of a discussion thread. Today, the only possible target is a + * repository. In the future, this may be extended to include other targets such + * as user profiles, extensions, etc. Clients should ignore target types they + * do not understand gracefully. + */ + type DiscussionThreadTarget = IDiscussionThreadTargetRepo + + /** + * A discussion thread that is centered around: + * + * - A repository. + * - A directory inside a repository. + * - A file inside a repository. + * - A selection inside a file inside a repository. + * + */ + interface IDiscussionThreadTargetRepo { + __typename: 'DiscussionThreadTargetRepo' + + /** + * The repository in which the thread was created. + */ + repository: IRepository + + /** + * The path (relative to the repository root) of the file or directory that + * the thread is referencing, if any. If the path is null, the thread is not + * talking about a specific path but rather just the repository generally. + */ + path: string | null + + /** + * The branch or other human-readable Git ref (e.g. "HEAD~2", but not exact + * Git revision), that the thread was referencing, if any. + * + * TODO(slimsag:discussions): Consider renaming this to e.g. "ref" or + * something else which properly communicates "this can be any Git + * branch/tag/abbreviated revision/ref *except* an absolute Git revision" + */ + branch: IGitRef | null + + /** + * The exact revision that the thread was referencing, if any. + */ + revision: IGitRef | null + + /** + * The selection that the thread was referencing, if any. + */ + selection: IDiscussionThreadTargetRepoSelection | null + + /** + * Where the path would be relative to the given Git revision specifier + * (branch/commit/etc). i.e., accounting for file renames, deletions, etc. + * + * null is returned if there is no path relative to the specified revision, + * e.g. if the file was deleted or the path field was null. + */ + relativePath: string | null + + /** + * Where the selection would be relative to the given Git revision specifier + * (branch/commit/etc). + * + * The implementation relies on a hueristic which is generally good enough, + * but under certain circumstances may not be as accurate as e.g. determining + * this placement by walking through the Git history. + * + * If determining the relative placement is not possible (file was renamed + * or removed, the selection no longer exists in the file, or the hueristic + * failed) null is returned and it should be assumed the selection does not + * exist in this revision. + */ + relativeSelection: IDiscussionSelectionRange | null + } + + interface IRelativePathOnDiscussionThreadTargetRepoArguments { + rev: string + } + + interface IRelativeSelectionOnDiscussionThreadTargetRepoArguments { + rev: string + } + + /** + * A selection within a file. + */ + interface IDiscussionThreadTargetRepoSelection { + __typename: 'DiscussionThreadTargetRepoSelection' + + /** + * The line that the selection started on (zero-based, inclusive). + */ + startLine: number + + /** + * The character (not byte) of the start line that the selection began on (zero-based, inclusive). + */ + startCharacter: number + + /** + * The line that the selection ends on (zero-based, exclusive). + */ + endLine: number + + /** + * The character (not byte) of the end line that the selection ended on (zero-based, exclusive). + */ + endCharacter: number + + /** + * The literal textual (UTF-8) lines before the line the selection started + * on. + * + * This is an arbitrary number of lines, and may be zero lines, but typically 3. + */ + linesBefore: Array + + /** + * The literal textual (UTF-8) lines of the selection. i.e. all lines + * startLine through endLine. + */ + lines: Array + + /** + * The literal textual (UTF-8) lines after the line the selection ended on. + * + * This is an arbitrary number of lines, and may be zero lines, but typically 3. + */ + linesAfter: Array + } + + /** + * An object defining a selection range within e.g. a file. + */ + interface IDiscussionSelectionRange { + __typename: 'DiscussionSelectionRange' + + /** + * The line that the selection started on (zero-based, inclusive). + */ + startLine: number + + /** + * The character (not byte) of the start line that the selection began on (zero-based, inclusive). + */ + startCharacter: number + + /** + * The line that the selection ends on (zero-based, exclusive). + */ + endLine: number + + /** + * The character (not byte) of the end line that the selection ended on (zero-based, exclusive). + */ + endCharacter: number + } + + /** + * A list of discussion comments. + */ + interface IDiscussionCommentConnection { + __typename: 'DiscussionCommentConnection' + + /** + * A list of discussion comments. + */ + nodes: Array + + /** + * The total count of discussion comments in the connection. This total + * count may be larger than the number of nodes in this object when the + * result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A comment made within a discussion thread. + */ + interface IDiscussionComment { + __typename: 'DiscussionComment' + + /** + * The discussion comment ID (globally unique). + */ + id: string + + /** + * The discussion thread the comment was made in. + */ + thread: IDiscussionThread + + /** + * The user who authored this discussion thread. + */ + author: IUser + + /** + * The actual markdown contents of the comment. + * + * If the comment was created without any contents (after trimming whitespace) + * then the title of the thread will be returned. + */ + contents: string + + /** + * The markdown contents rendered as an HTML string. It is already sanitized + * and escaped and thus is always safe to render. + * + * If the comment was created without any contents (after trimming whitespace) + * then the title of the thread will be returned. + */ + html: string + + /** + * The URL at which this thread can be viewed inline (i.e. in the file blob view). + * + * This will be null if the thread was created without a path string. + */ + inlineURL: string | null + + /** + * The date when the discussion thread was created. + */ + createdAt: string + + /** + * The date when the discussion thread was last updated. + */ + updatedAt: string + + /** + * Reports filed by users about this comment. Only admins will receive a non + * empty list of reports. + * + * When discussions.abuseProtection in the site config is set to false, this + * will always be an empty list. + */ + reports: Array + + /** + * Whether or not the comment can be reported. + * + * This is always false when discussions.abuseProtection in the site config is set to false. + */ + canReport: boolean + + /** + * Whether or not the comment can be deleted. + */ + canDelete: boolean + + /** + * Whether or not the comment can have its reports be cleared. + * + * This is always false when discussions.abuseProtection in the site config is set to false. + */ + canClearReports: boolean + } + + interface IHtmlOnDiscussionCommentArguments { + options?: IMarkdownOptions | null + } + + /** + * Describes options for rendering Markdown. + */ + interface IMarkdownOptions { + /** + * TODO(slimsag:discussions): add option for controlling relative links + * A dummy null value (empty input types are not allowed yet). + */ + alwaysNil?: string | null + } + + /** + * Configuration details for the browser extension, editor extensions, etc. + */ + interface IClientConfigurationDetails { + __typename: 'ClientConfigurationDetails' + + /** + * The list of phabricator/gitlab/bitbucket/etc instance URLs that specifies which pages the content script will be injected into. + */ + contentScriptUrls: Array + + /** + * Returns details about the parent Sourcegraph instance. + */ + parentSourcegraph: IParentSourcegraphDetails + } + + /** + * Parent Sourcegraph instance + */ + interface IParentSourcegraphDetails { + __typename: 'ParentSourcegraphDetails' + + /** + * Sourcegraph instance URL. + */ + url: string + } + + /** + * A search. + */ + interface ISearch { + __typename: 'Search' + + /** + * The results. + */ + results: ISearchResults + + /** + * The suggestions. + */ + suggestions: Array + + /** + * A subset of results (excluding actual search results) which are heavily + * cached and thus quicker to query. Useful for e.g. querying sparkline + * data. + */ + stats: ISearchResultsStats + } + + interface ISuggestionsOnSearchArguments { + first?: number | null + } + + /** + * Search results. + */ + interface ISearchResults { + __typename: 'SearchResults' + + /** + * The results. Inside each SearchResult there may be multiple matches, e.g. + * a FileMatch may contain multiple line matches. + */ + results: Array + + /** + * The total number of results, taking into account the SearchResult type. + * This is different than the length of the results array in that e.g. the + * results array may contain two file matches and this resultCount would + * report 6 ("3 line matches per file"). + * + * Typically, 'approximateResultCount', not this field, is shown to users. + */ + resultCount: number + + /** + * The approximate number of results. This is like the length of the results + * array, except it can indicate the number of results regardless of whether + * or not the limit was hit. Currently, this is represented as e.g. "5+" + * results. + * + * This string is typically shown to users to indicate the true result count. + */ + approximateResultCount: string + + /** + * Whether or not the results limit was hit. + */ + limitHit: boolean + + /** + * Integers representing the sparkline for the search results. + */ + sparkline: Array + + /** + * Repositories that were eligible to be searched. + */ + repositories: Array + + /** + * Repositories that were actually searched. Excludes repositories that would have been searched but were not + * because a timeout or error occurred while performing the search, or because the result limit was already + * reached. + */ + repositoriesSearched: Array + + /** + * Indexed repositories searched. This is a subset of repositoriesSearched. + */ + indexedRepositoriesSearched: Array + + /** + * Repositories that are busy cloning onto gitserver. + */ + cloning: Array + + /** + * Repositories or commits that do not exist. + */ + missing: Array + + /** + * Repositories or commits which we did not manage to search in time. Trying + * again usually will work. + */ + timedout: Array + + /** + * True if indexed search is enabled but was not available during this search. + */ + indexUnavailable: boolean + + /** + * An alert message that should be displayed before any results. + */ + alert: ISearchAlert | null + + /** + * The time it took to generate these results. + */ + elapsedMilliseconds: number + + /** + * Dynamic filters generated by the search results + */ + dynamicFilters: Array + } + + /** + * A search result. + */ + type SearchResult = IFileMatch | ICommitSearchResult | IRepository + + /** + * A file match. + */ + interface IFileMatch { + __typename: 'FileMatch' + + /** + * The file containing the match. + * + * KNOWN ISSUE: This file's "commit" field contains incomplete data. + * + * KNOWN ISSUE: This field's type should be File! not GitBlob!. + */ + file: IGitBlob + + /** + * The repository containing the file match. + */ + repository: IRepository + + /** + * The resource. + * @deprecated "use the file field instead" + */ + resource: string + + /** + * The symbols found in this file that match the query. + */ + symbols: Array + + /** + * The line matches. + */ + lineMatches: Array + + /** + * Whether or not the limit was hit. + */ + limitHit: boolean + } + + /** + * A line match. + */ + interface ILineMatch { + __typename: 'LineMatch' + + /** + * The preview. + */ + preview: string + + /** + * The line number. + */ + lineNumber: number + + /** + * Tuples of [offset, length] measured in characters (not bytes). + */ + offsetAndLengths: Array> + + /** + * Whether or not the limit was hit. + */ + limitHit: boolean + } + + /** + * A search result that is a Git commit. + */ + interface ICommitSearchResult { + __typename: 'CommitSearchResult' + + /** + * The commit that matched the search query. + */ + commit: IGitCommit + + /** + * The ref names of the commit. + */ + refs: Array + + /** + * The refs by which this commit was reached. + */ + sourceRefs: Array + + /** + * The matching portion of the commit message, if any. + */ + messagePreview: IHighlightedString | null + + /** + * The matching portion of the diff, if any. + */ + diffPreview: IHighlightedString | null + } + + /** + * A string that has highlights (e.g, query matches). + */ + interface IHighlightedString { + __typename: 'HighlightedString' + + /** + * The full contents of the string. + */ + value: string + + /** + * Highlighted matches of the query in the preview string. + */ + highlights: Array + } + + /** + * A highlighted region in a string (e.g., matched by a query). + */ + interface IHighlight { + __typename: 'Highlight' + + /** + * The 1-indexed line number. + */ + line: number + + /** + * The 1-indexed character on the line. + */ + character: number + + /** + * The length of the highlight, in characters (on the same line). + */ + length: number + } + + /** + * A search-related alert message. + */ + interface ISearchAlert { + __typename: 'SearchAlert' + + /** + * The title. + */ + title: string + + /** + * The description. + */ + description: string | null + + /** + * "Did you mean: ____" query proposals + */ + proposedQueries: Array | null + } + + /** + * A search query description. + */ + interface ISearchQueryDescription { + __typename: 'SearchQueryDescription' + + /** + * The description. + */ + description: string | null + + /** + * The query. + */ + query: string + } + + /** + * A search filter. + */ + interface ISearchFilter { + __typename: 'SearchFilter' + + /** + * The value. + */ + value: string + + /** + * The string to be displayed in the UI. + */ + label: string + + /** + * Number of matches for a given filter. + */ + count: number + + /** + * Whether the results returned are incomplete. + */ + limitHit: boolean + + /** + * The kind of filter. Should be "file" or "repo". + */ + kind: string + } + + /** + * A search suggestion. + */ + type SearchSuggestion = IRepository | IFile | ISymbol + + /** + * Statistics about search results. + */ + interface ISearchResultsStats { + __typename: 'SearchResultsStats' + + /** + * The approximate number of results returned. + */ + approximateResultCount: string + + /** + * The sparkline. + */ + sparkline: Array + } + + /** + * A search scope. + */ + interface ISearchScope { + __typename: 'SearchScope' + + /** + * A unique identifier for the search scope. + * If set, a scoped search page is available at https://[sourcegraph-hostname]/search/scope/ID, where ID is this value. + */ + id: string | null + + /** + * The name. + */ + name: string + + /** + * The value. + */ + value: string + + /** + * A description for this search scope, which will appear on the scoped search page. + */ + description: string | null + } + + /** + * A saved search query, defined in configuration. + */ + interface ISavedQuery { + __typename: 'SavedQuery' + + /** + * The unique ID of the saved query. + */ + id: string + + /** + * The subject whose configuration this saved query was defined in. + */ + subject: ConfigurationSubject + + /** + * The unique key of this saved query (unique only among all other saved + * queries of the same subject). + */ + key: string | null + + /** + * The 0-indexed index of this saved query in the subject's configuration. + */ + index: number + + /** + * The description. + */ + description: string + + /** + * The query. + */ + query: string + + /** + * Whether or not to show on the homepage. + */ + showOnHomepage: boolean + + /** + * Whether or not to notify. + */ + notify: boolean + + /** + * Whether or not to notify on Slack. + */ + notifySlack: boolean + } + + /** + * A group of repositories. + */ + interface IRepoGroup { + __typename: 'RepoGroup' + + /** + * The name. + */ + name: string + + /** + * The repositories. + */ + repositories: Array + } + + /** + * A site is an installation of Sourcegraph that consists of one or more + * servers that share the same configuration and database. + * + * The site is a singleton; the API only ever returns the single global site. + */ + interface ISite { + __typename: 'Site' + + /** + * The site's opaque GraphQL ID. This is NOT the "site ID" as it is referred to elsewhere; + * use the siteID field for that. (GraphQL node types conventionally have an id field of type + * ID! that globally identifies the node.) + */ + id: string + + /** + * The site ID. + */ + siteID: string + + /** + * The site's configuration. Only visible to site admins. + */ + configuration: ISiteConfiguration + + /** + * The site's latest site-wide settings (which are the lowest-precedence + * in the configuration cascade for a user). + */ + latestSettings: ISettings | null + + /** + * Deprecated settings specified in the site configuration "settings" field. These are distinct from a site's + * latestSettings (which are stored in the DB) and are applied at the lowest level of precedence. + */ + deprecatedSiteConfigurationSettings: string | null + + /** + * The configuration cascade including this subject and all applicable subjects whose configuration is lower + * precedence than this subject. + */ + configurationCascade: IConfigurationCascade + + /** + * The URL to the site's settings. + */ + settingsURL: string + + /** + * Whether the viewer can reload the site (with the reloadSite mutation). + */ + canReloadSite: boolean + + /** + * Whether the viewer can modify the subject's configuration. + */ + viewerCanAdminister: boolean + + /** + * Lists all language servers. + */ + langServers: Array + + /** + * The language server for a given language (if exists, otherwise null) + */ + langServer: ILangServer | null + + /** + * The status of language server management capabilities. + * + * Only site admins may view this field. + */ + languageServerManagementStatus: ILanguageServerManagementStatus | null + + /** + * A list of all access tokens on this site. + */ + accessTokens: IAccessTokenConnection + + /** + * A list of all authentication providers. + */ + authProviders: IAuthProviderConnection + + /** + * A list of all user external accounts on this site. + */ + externalAccounts: IExternalAccountConnection + + /** + * The name of the Sourcegraph product that is used on this site ("Sourcegraph Server" or "Sourcegraph Data + * Center" when running in production). + */ + productName: string + + /** + * The build version of the Sourcegraph software that is running on this site (of the form + * NNNNN_YYYY-MM-DD_XXXXX, like 12345_2018-01-01_abcdef). + */ + buildVersion: string + + /** + * The product version of the Sourcegraph software that is running on this site. + */ + productVersion: string + + /** + * Information about software updates for the version of Sourcegraph that this site is running. + */ + updateCheck: IUpdateCheck + + /** + * Whether the site needs to be configured to add repositories. + */ + needsRepositoryConfiguration: boolean + + /** + * Whether the site has zero access-enabled repositories. + */ + noRepositoriesEnabled: boolean + + /** + * Whether the site configuration has validation problems or deprecation notices. + */ + configurationNotice: boolean + + /** + * Whether the site has code intelligence. This field will be expanded in the future to describe + * more about the code intelligence available (languages supported, etc.). It is subject to + * change without notice. + */ + hasCodeIntelligence: boolean + + /** + * Whether the site is using an external authentication service such as OIDC or SAML. + */ + externalAuthEnabled: boolean + + /** + * Whether we want to show built-in searches on the saved searches page + */ + disableBuiltInSearches: boolean + + /** + * Whether the server sends emails to users to verify email addresses. If false, then site admins must manually + * verify users' email addresses. + */ + sendsEmailVerificationEmails: boolean + + /** + * Information about this site's product subscription status. + */ + productSubscription: IProductSubscriptionStatus + + /** + * The activity. + */ + activity: ISiteActivity + } + + interface ILangServerOnSiteArguments { + language: string + } + + interface IAccessTokensOnSiteArguments { + /** + * Returns the first n access tokens from the list. + */ + first?: number | null + } + + interface IExternalAccountsOnSiteArguments { + /** + * Returns the first n external accounts from the list. + */ + first?: number | null + + /** + * Include only external accounts associated with this user. + */ + user?: string | null + + /** + * Include only external accounts with this service type. + */ + serviceType?: string | null + + /** + * Include only external accounts with this service ID. + */ + serviceID?: string | null + + /** + * Include only external accounts with this client ID. + */ + clientID?: string | null + } + + interface IActivityOnSiteArguments { + /** + * Days of history. + */ + days?: number | null + + /** + * Weeks of history. + */ + weeks?: number | null + + /** + * Months of history. + */ + months?: number | null + } + + /** + * The configuration for a site. + */ + interface ISiteConfiguration { + __typename: 'SiteConfiguration' + + /** + * The effective configuration JSON. This will lag behind the pendingContents + * if the site configuration was updated but the server has not yet restarted. + */ + effectiveContents: string + + /** + * The pending configuration JSON, which will become effective after the next + * server restart. This is set if the site configuration has been updated since + * the server started. + */ + pendingContents: string | null + + /** + * Messages describing validation problems or usage of deprecated configuration in the configuration JSON + * (pendingContents if it exists, otherwise effectiveContents). This includes both JSON Schema validation + * problems and other messages that perform more advanced checks on the configuration (that can't be expressed + * in the JSON Schema). + */ + validationMessages: Array + + /** + * Whether the viewer can update the site configuration (using the + * updateSiteConfiguration mutation). + */ + canUpdate: boolean + + /** + * The source of the configuration as a human-readable description, + * referring to either the on-disk file path or the SOURCEGRAPH_CONFIG + * env var. + */ + source: string + } + + /** + * A language server. + */ + interface ILangServer { + __typename: 'LangServer' + + /** + * "go", "java", "typescript", etc. + */ + language: string + + /** + * "Go", "Java", "TypeScript", "PHP", etc. + */ + displayName: string + + /** + * Whether or not this language server should be considered experimental. + * + * Has no effect on behavior, only effects how the language server is presented e.g. in the UI. + */ + experimental: boolean + + /** + * URL to the language server's homepage, if available. + */ + homepageURL: string | null + + /** + * URL to the language server's open/known issues, if available. + */ + issuesURL: string | null + + /** + * URL to the language server's documentation, if available. + */ + docsURL: string | null + + /** + * Whether or not we are running in Data Center mode. + */ + dataCenter: boolean + + /** + * Whether or not this is a custom language server (i.e. one that does not + * come built in with Sourcegraph). + */ + custom: boolean + + /** + * The current configuration state of the language server. + * + * For custom language servers, this field is never LANG_SERVER_STATE_NONE. + */ + state: LangServerState + + /** + * Whether or not the language server is being downloaded, starting, restarting. + * + * Always false in Data Center and for custom language servers. + */ + pending: boolean + + /** + * Whether or not the language server is being downloaded. + * + * Always false in Data Center and for custom language servers. + */ + downloading: boolean + + /** + * Whether or not the current user can enable the language server or not. + * + * Always false in Data Center. + */ + canEnable: boolean + + /** + * Whether or not the current user can disable the language server or not. + * + * Always false in Data Center. + */ + canDisable: boolean + + /** + * Whether or not the current user can restart the language server or not. + * + * Always false in Data Center and for custom language servers. + */ + canRestart: boolean + + /** + * Whether or not the current user can update the language server or not. + * + * Always false in Data Center and for custom language servers. + */ + canUpdate: boolean + + /** + * Indicates whether or not the language server is healthy or + * unhealthy. Examples include: + * + * Healthy: + * - Server is running, experiencing no issues. + * - Server is not running, currently being downloaded. + * - Server is not running, currently starting or restarting. + * + * Unhealthy: + * - Server is running, experiencing restarts / OOMs often. + * - Server is not running, an error is preventing startup. + * + * The value is true ("healthy") if the language server is not enabled. + * + * Always false in Data Center and for custom language servers. + */ + healthy: boolean + } + + /** + * The possible configuration states of a language server. + */ + const enum LangServerState { + /** + * The language server is neither enabled nor disabled. When a repo for this + * language is visited by any user, it will be enabled. + */ + LANG_SERVER_STATE_NONE = 'LANG_SERVER_STATE_NONE', + + /** + * The language server was enabled by a plain user or admin user. + */ + LANG_SERVER_STATE_ENABLED = 'LANG_SERVER_STATE_ENABLED', + + /** + * The language server was disabled by an admin user. + */ + LANG_SERVER_STATE_DISABLED = 'LANG_SERVER_STATE_DISABLED', + } + + /** + * Status about management capabilities for language servers. + */ + interface ILanguageServerManagementStatus { + __typename: 'LanguageServerManagementStatus' + + /** + * Whether this site can manage (enable/disable/restart/update) language servers on its own. + * + * Even if this field's value is true, individual language servers may not be manageable. Clients must check the + * LangServer.canXyz fields. + * + * Always false on Data Center. + */ + siteCanManage: boolean + + /** + * The reason why the site can't manage language servers, if siteCanManage == false. + */ + reason: string | null + } + + /** + * A list of authentication providers. + */ + interface IAuthProviderConnection { + __typename: 'AuthProviderConnection' + + /** + * A list of authentication providers. + */ + nodes: Array + + /** + * The total count of authentication providers in the connection. This total count may be larger than the number of nodes + * in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A provider of user authentication, such as an external single-sign-on service (e.g., using OpenID + * Connect or SAML). + */ + interface IAuthProvider { + __typename: 'AuthProvider' + + /** + * The type of the auth provider. + */ + serviceType: string + + /** + * An identifier for the service that the auth provider represents. + */ + serviceID: string + + /** + * An identifier for the client of the service that the auth provider represents. + */ + clientID: string + + /** + * The human-readable name of the provider. + */ + displayName: string + + /** + * Whether this auth provider is the builtin username-password auth provider. + */ + isBuiltin: boolean + + /** + * A URL that, when visited, initiates the authentication process for this auth provider. + */ + authenticationURL: string | null + } + + /** + * Information about software updates for Sourcegraph. + */ + interface IUpdateCheck { + __typename: 'UpdateCheck' + + /** + * Whether an update check is currently in progress. + */ + pending: boolean + + /** + * When the last update check was completed, or null if no update check has + * been completed (or performed) yet. + */ + checkedAt: string | null + + /** + * If an error occurred during the last update check, this message describes + * the error. + */ + errorMessage: string | null + + /** + * If an update is available, the version string of the updated version. + */ + updateVersionAvailable: string | null + } + + /** + * Information about this site's product subscription (which enables access to and renewals of a product license). + */ + interface IProductSubscriptionStatus { + __typename: 'ProductSubscriptionStatus' + + /** + * The full name of the product in use, such as "Sourcegraph Enterprise". + */ + fullProductName: string + + /** + * The actual total number of users on this Sourcegraph site. + */ + actualUserCount: number + + /** + * The product license associated with this subscription, if any. + */ + license: IProductLicenseInfo | null + } + + /** + * Information about this site's product license (which activates certain Sourcegraph features). + */ + interface IProductLicenseInfo { + __typename: 'ProductLicenseInfo' + + /** + * The full name of the product that this license is for. To get the product name for the current + * Sourcegraph site, use ProductSubscriptionStatus.fullProductName instead (to handle cases where there is + * no license). + */ + fullProductName: string + + /** + * Tags indicating the product plan and features activated by this license. + */ + tags: Array + + /** + * The number of users allowed by this license. + */ + userCount: number + + /** + * The date when this license expires. + */ + expiresAt: string + } + + /** + * SiteActivity describes a site's aggregate activity level. + */ + interface ISiteActivity { + __typename: 'SiteActivity' + + /** + * Recent daily active users. + */ + daus: Array + + /** + * Recent weekly active users. + */ + waus: Array + + /** + * Recent monthly active users. + */ + maus: Array + } + + /** + * SiteActivityPeriod describes a site's activity level for a given timespan. + */ + interface ISiteActivityPeriod { + __typename: 'SiteActivityPeriod' + + /** + * The time when this started. + */ + startTime: string + + /** + * The user count. + */ + userCount: number + + /** + * The registered user count. + */ + registeredUserCount: number + + /** + * The anonymous user count. + */ + anonymousUserCount: number + + /** + * The count of registered users that have been active on a code host integration. + * Excludes anonymous users. + */ + integrationUserCount: number + } + + /** + * A list of survey responses + */ + interface ISurveyResponseConnection { + __typename: 'SurveyResponseConnection' + + /** + * A list of survey responses. + */ + nodes: Array + + /** + * The total count of survey responses in the connection. This total count may be larger + * than the number of nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * The count of survey responses submitted since 30 calendar days ago at 00:00 UTC. + */ + last30DaysCount: number + + /** + * The average score of survey responses in the connection submitted since 30 calendar days ago at 00:00 UTC. + */ + averageScore: number + + /** + * The net promoter score (NPS) of survey responses in the connection submitted since 30 calendar days ago at 00:00 UTC. + * Return value is a signed integer, scaled from -100 (all detractors) to +100 (all promoters). + * + * See https://en.wikipedia.org/wiki/Net_Promoter for explanation. + */ + netPromoterScore: number + } + + /** + * An extension registry. + */ + interface IExtensionRegistry { + __typename: 'ExtensionRegistry' + + /** + * Find an extension by its extension ID (which is the concatenation of the publisher name, a slash ("/"), and the + * extension name). + * + * To find an extension by its GraphQL ID, use Query.node. + */ + extension: IRegistryExtension | null + + /** + * A list of extensions published in the extension registry. + */ + extensions: IRegistryExtensionConnection + + /** + * A list of publishers with at least 1 extension in the registry. + */ + publishers: IRegistryPublisherConnection + + /** + * A list of publishers that the viewer may publish extensions as. + */ + viewerPublishers: Array + + /** + * The extension ID prefix for extensions that are published in the local extension registry. This is the + * hostname (and port, if non-default HTTP/HTTPS) of the Sourcegraph "appURL" site configuration property. + * + * It is null if extensions published on this Sourcegraph site do not have an extension ID prefix. + * + * Examples: "sourcegraph.example.com/", "sourcegraph.example.com:1234/" + */ + localExtensionIDPrefix: string | null + } + + interface IExtensionOnExtensionRegistryArguments { + extensionID: string + } + + interface IExtensionsOnExtensionRegistryArguments { + /** + * Returns the first n extensions from the list. + */ + first?: number | null + + /** + * Returns only extensions from this publisher. + */ + publisher?: string | null + + /** + * Returns only extensions matching the query. + */ + query?: string | null + + /** + * Include extensions from the local registry. + * @default true + */ + local?: boolean | null + + /** + * Include extensions from remote registries. + * @default true + */ + remote?: boolean | null + + /** + * Sorts the list of extension results such that the extensions with these IDs are first in the result set. + * + * Typically, the client passes the list of added and enabled extension IDs in this parameter so that the + * results include those extensions first (which is typically what the user prefers). + */ + prioritizeExtensionIDs?: Array | null + } + + interface IPublishersOnExtensionRegistryArguments { + /** + * Return the first n publishers from the list. + */ + first?: number | null + } + + /** + * An extension's listing in the extension registry. + */ + interface IRegistryExtension { + __typename: 'RegistryExtension' + + /** + * The unique, opaque, permanent ID of the extension. Do not display this ID to the user; display + * RegistryExtension.extensionID instead (it is friendlier and still unique, but it can be renamed). + */ + id: string + + /** + * The UUID of the extension. This identifies the extension externally (along with the origin). The UUID maps + * 1-to-1 to RegistryExtension.id. + */ + uuid: string + + /** + * The publisher of the extension. If this extension is from a remote registry, the publisher may be null. + */ + publisher: RegistryPublisher | null + + /** + * The qualified, unique name that refers to this extension, consisting of the registry name (if non-default), + * publisher's name, and the extension's name, all joined by "/" (for example, "acme-corp/my-extension-name"). + */ + extensionID: string + + /** + * The extension ID without the registry name. + */ + extensionIDWithoutRegistry: string + + /** + * The name of the extension (not including the publisher's name). + */ + name: string + + /** + * The extension manifest, or null if none is set. + */ + manifest: IExtensionManifest | null + + /** + * The date when this extension was created on the registry. + */ + createdAt: string | null + + /** + * The date when this extension was last updated on the registry. + */ + updatedAt: string | null + + /** + * The URL to the extension on this Sourcegraph site. + */ + url: string + + /** + * The URL to the extension on the extension registry where it lives (if this is a remote + * extension). If this extension is local, then this field's value is null. + */ + remoteURL: string | null + + /** + * The name of this extension's registry. + */ + registryName: string + + /** + * Whether the registry extension is published on this Sourcegraph site. + */ + isLocal: boolean + + /** + * Whether the viewer has admin privileges on this registry extension. + */ + viewerCanAdminister: boolean + } + + /** + * A publisher of a registry extension. + */ + type RegistryPublisher = IUser | IOrg + + /** + * A description of the extension, how to run or access it, and when to activate it. + */ + interface IExtensionManifest { + __typename: 'ExtensionManifest' + + /** + * The raw JSON contents of the manifest. + */ + raw: string + + /** + * The title specified in the manifest, if any. + */ + title: string | null + + /** + * The description specified in the manifest, if any. + */ + description: string | null + + /** + * The URL to the bundled JavaScript source code for the extension, if any. + */ + bundleURL: string | null + } + + /** + * A list of registry extensions. + */ + interface IRegistryExtensionConnection { + __typename: 'RegistryExtensionConnection' + + /** + * A list of registry extensions. + */ + nodes: Array + + /** + * The total count of registry extensions in the connection. This total count may be larger than the number of + * nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + + /** + * The URL to this list, or null if none exists. + */ + url: string | null + + /** + * Errors that occurred while communicating with remote registries to obtain the list of extensions. + * + * In order to be able to return local extensions even when the remote registry is unreachable, errors are + * recorded here instead of in the top-level GraphQL errors list. + */ + error: string | null + } + + /** + * A list of publishers of extensions in the registry. + */ + interface IRegistryPublisherConnection { + __typename: 'RegistryPublisherConnection' + + /** + * A list of publishers. + */ + nodes: Array + + /** + * The total count of publishers in the connection. This total count may be larger than the number of + * nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * Mutations that are only used on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + interface IDotcomQuery { + __typename: 'DotcomQuery' + + /** + * A list of product subscriptions. + * + * FOR INTERNAL USE ONLY. + */ + productSubscriptions: IProductSubscriptionConnection + + /** + * A list of product licenses. + * + * Only Sourcegraph.com site admins may perform this query. + * + * FOR INTERNAL USE ONLY. + */ + productLicenses: IProductLicenseConnection + + /** + * A list of product pricing plans for Sourcegraph. + */ + productPlans: Array + } + + interface IProductSubscriptionsOnDotcomQueryArguments { + /** + * Returns the first n product subscriptions from the list. + */ + first?: number | null + + /** + * Returns only product subscriptions for the given account. + * + * Only Sourcegraph.com site admins may perform this query with account == null. + */ + account?: string | null + } + + interface IProductLicensesOnDotcomQueryArguments { + /** + * Returns the first n product subscriptions from the list. + */ + first?: number | null + + /** + * Returns only product subscriptions whose license key contains this substring. + */ + licenseKeySubstring?: string | null + + /** + * Returns only product licenses associated with the given subscription + */ + productSubscriptionID?: string | null + } + + /** + * A list of product subscriptions. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductSubscriptionConnection { + __typename: 'ProductSubscriptionConnection' + + /** + * A list of product subscriptions. + */ + nodes: Array + + /** + * The total count of product subscriptions in the connection. This total count may be larger than the number of + * nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A product subscription that was created on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductSubscription { + __typename: 'ProductSubscription' + + /** + * The unique ID of this product subscription. + */ + id: string + + /** + * A name for the product subscription derived from its ID. The name is not guaranteed to be unique. + */ + name: string + + /** + * The user (i.e., customer) to whom this subscription is granted, or null if the account has been deleted. + */ + account: IUser | null + + /** + * The product and pricing plan that this subscription entitles the account to, or null if there is none. + */ + plan: IProductPlan | null + + /** + * The user count that this subscription entitles the account to, or null if there is none. + */ + userCount: number | null + + /** + * The date when the subscription expires. + */ + expiresAt: string | null + + /** + * A list of billing-related events related to this product subscription. + */ + events: Array + + /** + * The currently active product license associated with this product subscription, if any. + */ + activeLicense: IProductLicense | null + + /** + * A list of product licenses associated with this product subscription. + * + * Only Sourcegraph.com site admins may list inactive product licenses (other viewers should use + * ProductSubscription.activeLicense). + */ + productLicenses: IProductLicenseConnection + + /** + * The date when this product subscription was created. + */ + createdAt: string + + /** + * Whether this product subscription was archived. + */ + isArchived: boolean + + /** + * The URL to view this product subscription. + */ + url: string + + /** + * The URL to view this product subscription in the site admin area. + * + * Only Sourcegraph.com site admins may query this field. + */ + urlForSiteAdmin: string | null + + /** + * The URL to view this product subscription's billing information (for site admins). + * + * Only Sourcegraph.com site admins may query this field. + */ + urlForSiteAdminBilling: string | null + } + + interface IProductLicensesOnProductSubscriptionArguments { + /** + * Returns the first n product licenses from the list. + */ + first?: number | null + } + + /** + * A product pricing plan for Sourcegraph. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductPlan { + __typename: 'ProductPlan' + + /** + * The billing system's unique ID of this pricing plan. + */ + billingID: string + + /** + * The internal name of the pricing plan (e.g., "enterprise-starter"). This is not displayed on the page but may + * be shown in the URL. + */ + name: string + + /** + * The title of the pricing plan (e.g., "Enterprise Starter"). This is displayed to the user and should be + * human-readable. + */ + title: string + + /** + * The full product name of this plan's offering (e.g., "Sourcegraph Enterprise Starter"). + */ + fullProductName: string + + /** + * The price (in USD cents) for one user for a year. + */ + pricePerUserPerYear: number + } + + /** + * An event related to a product subscription. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductSubscriptionEvent { + __typename: 'ProductSubscriptionEvent' + + /** + * The unique ID of the event. + */ + id: string + + /** + * The date when the event occurred. + */ + date: string + + /** + * The title of the event. + */ + title: string + + /** + * A description of the event. + */ + description: string | null + + /** + * A URL where the user can see more information about the event. + */ + url: string | null + } + + /** + * A product license that was created on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductLicense { + __typename: 'ProductLicense' + + /** + * The unique ID of this product license. + */ + id: string + + /** + * The product subscription associated with this product license. + */ + subscription: IProductSubscription + + /** + * Information about this product license. + */ + info: IProductLicenseInfo | null + + /** + * The license key. + */ + licenseKey: string + + /** + * The date when this product license was created. + */ + createdAt: string + } + + /** + * A list of product licenses. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductLicenseConnection { + __typename: 'ProductLicenseConnection' + + /** + * A list of product licenses. + */ + nodes: Array + + /** + * The total count of product licenses in the connection. This total count may be larger than the number of + * nodes in this object when the result is paginated. + */ + totalCount: number + + /** + * Pagination information. + */ + pageInfo: IPageInfo + } + + /** + * A mutation. + */ + interface IMutation { + __typename: 'Mutation' + + /** + * Updates the user profile information for the user with the given ID. + * + * Only the user and site admins may perform this mutation. + */ + updateUser: IEmptyResponse + + /** + * Creates an organization. The caller is added as a member of the newly created organization. + * + * Only authenticated users may perform this mutation. + */ + createOrganization: IOrg + + /** + * Updates an organization. + * + * Only site admins and any member of the organization may perform this mutation. + */ + updateOrganization: IOrg + + /** + * Deletes an organization. Only site admins may perform this mutation. + */ + deleteOrganization: IEmptyResponse | null + + /** + * Adds a repository on a code host that is already present in the site configuration. The name (which may + * consist of one or more path components) of the repository must be recognized by an already configured code + * host, or else Sourcegraph won't know how to clone it. + * + * The newly added repository is not enabled (unless the code host's configuration specifies that it should be + * enabled). The caller must explicitly enable it with setRepositoryEnabled. + * + * If the repository already exists, it is returned. + * + * To add arbitrary repositories (that don't need to reside on an already configured code host), use the site + * configuration "repos.list" property. + * + * As a special case, GitHub.com public repositories may be added by using a name of the form + * "github.com/owner/repo". If there is no GitHub personal access token for github.com configured, the site may + * experience problems with github.com repositories due to the low default github.com API rate limit (60 + * requests per hour). + * + * Only site admins may perform this mutation. + */ + addRepository: IRepository + + /** + * Enables or disables a repository. A disabled repository is only + * accessible to site admins and never appears in search results. + * + * Only site admins may perform this mutation. + */ + setRepositoryEnabled: IEmptyResponse | null + + /** + * Enables or disables all site repositories. + * + * Only site admins may perform this mutation. + */ + setAllRepositoriesEnabled: IEmptyResponse | null + + /** + * Tests the connection to a mirror repository's original source repository. This is an + * expensive and slow operation, so it should only be used for interactive diagnostics. + * + * Only site admins may perform this mutation. + */ + checkMirrorRepositoryConnection: ICheckMirrorRepositoryConnectionResult + + /** + * Schedule the mirror repository to be updated from its original source repository. Updating + * occurs automatically, so this should not normally be needed. + * + * Only site admins may perform this mutation. + */ + updateMirrorRepository: IEmptyResponse + + /** + * Schedules all repositories to be updated from their original source repositories. Updating + * occurs automatically, so this should not normally be needed. + * + * Only site admins may perform this mutation. + */ + updateAllMirrorRepositories: IEmptyResponse + + /** + * Deletes a repository and all data associated with it, irreversibly. + * + * If the repository was added because it was present in the site configuration (directly, + * or because it originated from a configured code host), then it will be re-added during + * the next sync. If you intend to make the repository inaccessible to users and not searchable, + * use setRepositoryEnabled to disable the repository instead of deleteRepository. + * + * Only site admins may perform this mutation. + */ + deleteRepository: IEmptyResponse | null + + /** + * Creates a new user account. + * + * Only site admins may perform this mutation. + */ + createUser: ICreateUserResult + + /** + * Randomize a user's password so that they need to reset it before they can sign in again. + * + * Only site admins may perform this mutation. + */ + randomizeUserPassword: IRandomizeUserPasswordResult + + /** + * Adds an email address to the user's account. The email address will be marked as unverified until the user + * has followed the email verification process. + * + * Only the user and site admins may perform this mutation. + */ + addUserEmail: IEmptyResponse + + /** + * Removes an email address from the user's account. + * + * Only the user and site admins may perform this mutation. + */ + removeUserEmail: IEmptyResponse + + /** + * Manually set the verification status of a user's email, without going through the normal verification process + * (of clicking on a link in the email with a verification code). + * + * Only site admins may perform this mutation. + */ + setUserEmailVerified: IEmptyResponse + + /** + * Deletes a user account. Only site admins may perform this mutation. + */ + deleteUser: IEmptyResponse | null + + /** + * Updates the current user's password. The oldPassword arg must match the user's current password. + */ + updatePassword: IEmptyResponse | null + + /** + * Creates an access token that grants the privileges of the specified user (referred to as the access token's + * "subject" user after token creation). The result is the access token value, which the caller is responsible + * for storing (it is not accessible by Sourcegraph after creation). + * + * The supported scopes are: + * + * - "user:all": Full control of all resources accessible to the user account. + * - "site-admin:sudo": Ability to perform any action as any other user. (Only site admins may create tokens + * with this scope.) + * + * Only the user or site admins may perform this mutation. + */ + createAccessToken: ICreateAccessTokenResult + + /** + * Deletes and immediately revokes the specified access token, specified by either its ID or by the token + * itself. + * + * Only site admins or the user who owns the token may perform this mutation. + */ + deleteAccessToken: IEmptyResponse + + /** + * Deletes the association between an external account and its Sourcegraph user. It does NOT delete the external + * account on the external service where it resides. + * + * Only site admins or the user who is associated with the external account may perform this mutation. + */ + deleteExternalAccount: IEmptyResponse + + /** + * Invite the user with the given username to join the organization. The invited user account must already + * exist. + * + * Only site admins and any organization member may perform this mutation. + */ + inviteUserToOrganization: IInviteUserToOrganizationResult + + /** + * Accept or reject an existing organization invitation. + * + * Only the recipient of the invitation may perform this mutation. + */ + respondToOrganizationInvitation: IEmptyResponse + + /** + * Resend the notification about an organization invitation to the recipient. + * + * Only site admins and any member of the organization may perform this mutation. + */ + resendOrganizationInvitationNotification: IEmptyResponse + + /** + * Revoke an existing organization invitation. + * + * If the invitation has been accepted or rejected, it may no longer be revoked. After an + * invitation is revoked, the recipient may not accept or reject it. Both cases yield an error. + * + * Only site admins and any member of the organization may perform this mutation. + */ + revokeOrganizationInvitation: IEmptyResponse + + /** + * Immediately add a user as a member to the organization, without sending an invitation email. + * + * Only site admins may perform this mutation. Organization members may use the inviteUserToOrganization + * mutation to invite users. + */ + addUserToOrganization: IEmptyResponse + + /** + * Removes a user as a member from an organization. + * + * Only site admins and any member of the organization may perform this mutation. + */ + removeUserFromOrganization: IEmptyResponse | null + + /** + * Adds or removes a tag on a user. + * + * Tags are used internally by Sourcegraph as feature flags for experimental features. + * + * Only site admins may perform this mutation. + */ + setTag: IEmptyResponse + + /** + * Adds a Phabricator repository to Sourcegraph. + */ + addPhabricatorRepo: IEmptyResponse | null + + /** + * Resolves a revision for a given diff from Phabricator. + */ + resolvePhabricatorDiff: IGitCommit | null + + /** + * Logs a user event. + */ + logUserEvent: IEmptyResponse | null + + /** + * Sends a test notification for the saved search. Be careful: this will send a notifcation (email and other + * types of notifications, if configured) to all subscribers of the saved search, which could be bothersome. + * + * Only subscribers to this saved search may perform this action. + */ + sendSavedSearchTestNotification: IEmptyResponse | null + + /** + * All mutations that update configuration settings are under this field. + */ + configurationMutation: IConfigurationMutation | null + + /** + * Updates the site configuration. Returns whether or not a restart is + * needed for the update to be applied. + */ + updateSiteConfiguration: boolean + + /** + * Manages language servers. + */ + langServers: ILangServersMutation | null + + /** + * Manages discussions. + */ + discussions: IDiscussionsMutation | null + + /** + * Sets whether the user with the specified user ID is a site admin. + */ + setUserIsSiteAdmin: IEmptyResponse | null + + /** + * Reloads the site by restarting the server. This is not supported for all deployment + * types. This may cause downtime. + */ + reloadSite: IEmptyResponse | null + + /** + * Submits a user satisfaction (NPS) survey. + */ + submitSurvey: IEmptyResponse | null + + /** + * Manages the extension registry. + */ + extensionRegistry: IExtensionRegistryMutation + + /** + * Mutations that are only used on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + dotcom: IDotcomMutation + } + + interface IUpdateUserOnMutationArguments { + user: string + username?: string | null + displayName?: string | null + avatarURL?: string | null + } + + interface ICreateOrganizationOnMutationArguments { + name: string + displayName?: string | null + } + + interface IUpdateOrganizationOnMutationArguments { + id: string + displayName?: string | null + } + + interface IDeleteOrganizationOnMutationArguments { + organization: string + } + + interface IAddRepositoryOnMutationArguments { + name: string + } + + interface ISetRepositoryEnabledOnMutationArguments { + repository: string + enabled: boolean + } + + interface ISetAllRepositoriesEnabledOnMutationArguments { + enabled: boolean + } + + interface ICheckMirrorRepositoryConnectionOnMutationArguments { + /** + * The ID of the existing repository whose mirror to check. + */ + repository?: string | null + + /** + * The name of a repository whose mirror to check. If the name is provided, the repository need not be added + * to the site (but the site configuration must define a code host that knows how to handle the name). + */ + name?: string | null + } + + interface IUpdateMirrorRepositoryOnMutationArguments { + /** + * The mirror repository to update. + */ + repository: string + } + + interface IDeleteRepositoryOnMutationArguments { + repository: string + } + + interface ICreateUserOnMutationArguments { + /** + * The new user's username. + */ + username: string + + /** + * The new user's optional email address. If given, it is marked as verified. + */ + email?: string | null + } + + interface IRandomizeUserPasswordOnMutationArguments { + user: string + } + + interface IAddUserEmailOnMutationArguments { + user: string + email: string + } + + interface IRemoveUserEmailOnMutationArguments { + user: string + email: string + } + + interface ISetUserEmailVerifiedOnMutationArguments { + user: string + email: string + verified: boolean + } + + interface IDeleteUserOnMutationArguments { + user: string + } + + interface IUpdatePasswordOnMutationArguments { + oldPassword: string + newPassword: string + } + + interface ICreateAccessTokenOnMutationArguments { + user: string + scopes: Array + note: string + } + + interface IDeleteAccessTokenOnMutationArguments { + byID?: string | null + byToken?: string | null + } + + interface IDeleteExternalAccountOnMutationArguments { + externalAccount: string + } + + interface IInviteUserToOrganizationOnMutationArguments { + organization: string + username: string + } + + interface IRespondToOrganizationInvitationOnMutationArguments { + /** + * The organization invitation. + */ + organizationInvitation: string + + /** + * The response to the invitation. + */ + responseType: OrganizationInvitationResponseType + } + + interface IResendOrganizationInvitationNotificationOnMutationArguments { + /** + * The organization invitation. + */ + organizationInvitation: string + } + + interface IRevokeOrganizationInvitationOnMutationArguments { + /** + * The organization invitation. + */ + organizationInvitation: string + } + + interface IAddUserToOrganizationOnMutationArguments { + organization: string + username: string + } + + interface IRemoveUserFromOrganizationOnMutationArguments { + user: string + organization: string + } + + interface ISetTagOnMutationArguments { + /** + * The ID of the user whose tags to set. + * + * (This parameter is named "node" to make it easy to support tagging other types of nodes + * other than users in the future.) + */ + node: string + + /** + * The tag to set. + */ + tag: string + + /** + * The desired state of the tag on the user (whether to add or remove): true to add, false to + * remove. + */ + present: boolean + } + + interface IAddPhabricatorRepoOnMutationArguments { + /** + * The callsign, for example "MUX". + */ + callsign: string + + /** + * The name, for example "github.com/gorilla/mux". + */ + name?: string | null + + /** + * An alias for name. DEPRECATED: use name instead. + */ + uri?: string | null + + /** + * The URL to the phabricator instance (e.g. http://phabricator.sgdev.org). + */ + url: string + } + + interface IResolvePhabricatorDiffOnMutationArguments { + /** + * The name of the repository that the diff is based on. + */ + repoName: string + + /** + * The ID of the diff on Phabricator. + */ + diffID: string + + /** + * The base revision this diff is based on. + */ + baseRev: string + + /** + * The raw contents of the diff from Phabricator. + * Required if Sourcegraph doesn't have a Conduit API token. + */ + patch?: string | null + + /** + * The description of the diff. This will be used as the commit message. + */ + description?: string | null + + /** + * The name of author of the diff. + */ + authorName?: string | null + + /** + * The author's email. + */ + authorEmail?: string | null + + /** + * When the diff was created. + */ + date?: string | null + } + + interface ILogUserEventOnMutationArguments { + event: UserEvent + userCookieID: string + } + + interface ISendSavedSearchTestNotificationOnMutationArguments { + /** + * ID of the saved search. + */ + id: string + } + + interface IConfigurationMutationOnMutationArguments { + input: IConfigurationMutationGroupInput + } + + interface IUpdateSiteConfigurationOnMutationArguments { + input: string + } + + interface ISetUserIsSiteAdminOnMutationArguments { + userID: string + siteAdmin: boolean + } + + interface ISubmitSurveyOnMutationArguments { + input: ISurveySubmissionInput + } + + /** + * Represents a null return value. + */ + interface IEmptyResponse { + __typename: 'EmptyResponse' + + /** + * A dummy null value. + */ + alwaysNil: string | null + } + + /** + * The result for Mutation.checkMirrorRepositoryConnection. + */ + interface ICheckMirrorRepositoryConnectionResult { + __typename: 'CheckMirrorRepositoryConnectionResult' + + /** + * The error message encountered during the update operation, if any. If null, then + * the connection check succeeded. + */ + error: string | null + } + + /** + * The result for Mutation.createUser. + */ + interface ICreateUserResult { + __typename: 'CreateUserResult' + + /** + * The new user. + */ + user: IUser + + /** + * The reset password URL that the new user must visit to sign into their account. If the builtin + * username-password authentication provider is not enabled, this field's value is null. + */ + resetPasswordURL: string | null + } + + /** + * The result for Mutation.randomizeUserPassword. + */ + interface IRandomizeUserPasswordResult { + __typename: 'RandomizeUserPasswordResult' + + /** + * The reset password URL that the user must visit to sign into their account again. If the builtin + * username-password authentication provider is not enabled, this field's value is null. + */ + resetPasswordURL: string | null + } + + /** + * The result for Mutation.createAccessToken. + */ + interface ICreateAccessTokenResult { + __typename: 'CreateAccessTokenResult' + + /** + * The ID of the newly created access token. + */ + id: string + + /** + * The secret token value that is used to authenticate API clients. The caller is responsible for storing this + * value. + */ + token: string + } + + /** + * The result of Mutation.inviteUserToOrganization. + */ + interface IInviteUserToOrganizationResult { + __typename: 'InviteUserToOrganizationResult' + + /** + * Whether an invitation email was sent. If emails are not enabled on this site or if the user has no verified + * email address, an email will not be sent. + */ + sentInvitationEmail: boolean + + /** + * The URL that the invited user can visit to accept or reject the invitation. + */ + invitationURL: string + } + + /** + * A user event. + */ + const enum UserEvent { + PAGEVIEW = 'PAGEVIEW', + SEARCHQUERY = 'SEARCHQUERY', + CODEINTEL = 'CODEINTEL', + CODEINTELINTEGRATION = 'CODEINTELINTEGRATION', + } + + /** + * Input for Mutation.configuration, which contains fields that all configuration + * mutations need. + */ + interface IConfigurationMutationGroupInput { + /** + * The subject whose configuration to mutate (organization, user, etc.). + */ + subject: string + + /** + * The ID of the last-known configuration known to the client, or null if + * there is none. This field is used to prevent race conditions when there + * are concurrent editors. + */ + lastID?: number | null + } + + /** + * Mutations that update configuration settings. These mutations are grouped + * together because they: + * + * - are all versioned to avoid race conditions with concurrent editors + * - all apply to a specific configuration subject + * + * Grouping them lets us extract those common parameters to the + * Mutation.configuration field. + */ + interface IConfigurationMutation { + __typename: 'ConfigurationMutation' + + /** + * Edit a single property in the configuration object. + */ + editConfiguration: IUpdateConfigurationPayload | null + + /** + * Overwrite the contents to the new contents provided. + */ + overwriteConfiguration: IUpdateConfigurationPayload | null + + /** + * Create a saved query. + */ + createSavedQuery: ISavedQuery + + /** + * Update the saved query with the given ID in the configuration. + */ + updateSavedQuery: ISavedQuery + + /** + * Delete the saved query with the given ID in the configuration. + */ + deleteSavedQuery: IEmptyResponse | null + } + + interface IEditConfigurationOnConfigurationMutationArguments { + /** + * The configuration edit to apply. + */ + edit: IConfigurationEdit + } + + interface IOverwriteConfigurationOnConfigurationMutationArguments { + contents?: string | null + } + + interface ICreateSavedQueryOnConfigurationMutationArguments { + description: string + query: string + + /** + * @default false + */ + showOnHomepage?: boolean | null + + /** + * @default false + */ + notify?: boolean | null + + /** + * @default false + */ + notifySlack?: boolean | null + + /** + * @default false + */ + disableSubscriptionNotifications?: boolean | null + } + + interface IUpdateSavedQueryOnConfigurationMutationArguments { + id: string + description?: string | null + query?: string | null + + /** + * @default false + */ + showOnHomepage?: boolean | null + + /** + * @default false + */ + notify?: boolean | null + + /** + * @default false + */ + notifySlack?: boolean | null + } + + interface IDeleteSavedQueryOnConfigurationMutationArguments { + id: string + + /** + * @default false + */ + disableSubscriptionNotifications?: boolean | null + } + + /** + * An edit to a (nested) configuration property's value. + */ + interface IConfigurationEdit { + /** + * The key path of the property to update. + * + * Inserting into an existing array is not yet supported. + */ + keyPath: Array + + /** + * The new JSON-encoded value to insert. If the field's value is not set, the property is removed. (This is + * different from the field's value being the JSON null value.) + * + * When the value is a non-primitive type, it must be specified using a GraphQL variable, not an inline literal, + * or else the GraphQL parser will return an error. + */ + value?: any | null + + /** + * Whether to treat the value as a JSONC-encoded string, which makes it possible to perform a configuration edit + * that preserves (or adds/removes) comments. + * @default false + */ + valueIsJSONCEncodedString?: boolean | null + } + + /** + * A segment of a key path that locates a nested JSON value in a root JSON value. Exactly one field in each + * KeyPathSegment must be non-null. + * + * For example, in {"a": [0, {"b": 3}]}, the value 3 is located at the key path ["a", 1, "b"]. + */ + interface IKeyPathSegment { + /** + * The name of the property in the object at this location to descend into. + */ + property?: string | null + + /** + * The index of the array at this location to descend into. + */ + index?: number | null + } + + /** + * The payload for ConfigurationMutation.updateConfiguration. + */ + interface IUpdateConfigurationPayload { + __typename: 'UpdateConfigurationPayload' + + /** + * An empty response. + */ + empty: IEmptyResponse | null + } + + /** + * Mutations for language servers. + */ + interface ILangServersMutation { + __typename: 'LangServersMutation' + + /** + * Enables the language server for the given language. + * + * Any user can perform this mutation, unless the language has been + * explicitly disabled. + */ + enable: IEmptyResponse | null + + /** + * Disables the language server for the given language. + * + * Only admins can perform this action. After disabling, it is impossible + * for plain users to enable the language server for this language (until an + * admin re-enables it). + */ + disable: IEmptyResponse | null + + /** + * Restarts the language server for the given language. + * + * Only admins can perform this action. + */ + restart: IEmptyResponse | null + + /** + * Updates the language server for the given language. + * + * Only admins can perform this action. + */ + update: IEmptyResponse | null + } + + interface IEnableOnLangServersMutationArguments { + language: string + } + + interface IDisableOnLangServersMutationArguments { + language: string + } + + interface IRestartOnLangServersMutationArguments { + language: string + } + + interface IUpdateOnLangServersMutationArguments { + language: string + } + + /** + * Mutations for discussions. + */ + interface IDiscussionsMutation { + __typename: 'DiscussionsMutation' + + /** + * Creates a new thread. Returns the new thread. + */ + createThread: IDiscussionThread + + /** + * Updates an existing thread. Returns the updated thread. + * + * Returns null if the thread was deleted. + */ + updateThread: IDiscussionThread | null + + /** + * Adds a new comment to a thread. Returns the updated thread. + */ + addCommentToThread: IDiscussionThread + + /** + * Updates an existing comment. Returns the updated thread. + */ + updateComment: IDiscussionThread + } + + interface ICreateThreadOnDiscussionsMutationArguments { + input: IDiscussionThreadCreateInput + } + + interface IUpdateThreadOnDiscussionsMutationArguments { + input: IDiscussionThreadUpdateInput + } + + interface IAddCommentToThreadOnDiscussionsMutationArguments { + threadID: string + contents: string + } + + interface IUpdateCommentOnDiscussionsMutationArguments { + input: IDiscussionCommentUpdateInput + } + + /** + * Describes the creation of a new thread around some target (e.g. a file in a repo). + */ + interface IDiscussionThreadCreateInput { + /** + * The title of the thread's first comment (i.e. the threads title). + */ + title: string + + /** + * The contents of the thread's first comment (i.e. the threads comment). + */ + contents: string + + /** + * The target repo of this discussion thread. This is nullable so that in + * the future more target types may be added. + */ + targetRepo?: IDiscussionThreadTargetRepoInput | null + } + + /** + * A discussion thread that is centered around: + * + * - A repository. + * - A directory inside a repository. + * - A file inside a repository. + * - A selection inside a file inside a repository. + * + */ + interface IDiscussionThreadTargetRepoInput { + /** + * The repository in which the thread was created. + * + * One of 'repositoryID', 'repositoryGitCloneURL', or 'repositoryName' must be specified. + */ + repositoryID?: string | null + + /** + * The repository in which the thread was created. + * + * One of 'repositoryID', 'repositoryGitCloneURL', or 'repositoryName' must be specified. + */ + repositoryName?: string | null + + /** + * The repository in which the thread was created. + * + * One of 'repositoryID', 'repositoryGitCloneURL', or 'repositoryName' must be specified. + */ + repositoryGitCloneURL?: string | null + + /** + * The path (relative to the repository root) of the file or directory that + * the thread is referencing, if any. If the path is null, the thread is not + * talking about a specific path but rather just the repository generally. + */ + path?: string | null + + /** + * The branch or other human-readable Git ref (e.g. "HEAD~2", but not exact + * Git revision), that the thread was referencing, if any. + */ + branch?: string | null + + /** + * The exact Git object ID (OID / 40-character SHA-1 hash) which the thread + * was referencing, if any. + */ + revision?: any | null + + /** + * The selection that the thread was referencing, if any. + */ + selection?: IDiscussionThreadTargetRepoSelectionInput | null + } + + /** + * A selection within a file. + */ + interface IDiscussionThreadTargetRepoSelectionInput { + /** + * The line that the selection started on (zero-based, inclusive). + */ + startLine: number + + /** + * The character (not byte) of the start line that the selection began on (zero-based, inclusive). + */ + startCharacter: number + + /** + * The line that the selection ends on (zero-based, exclusive). + */ + endLine: number + + /** + * The character (not byte) of the end line that the selection ended on (zero-based, exclusive). + */ + endCharacter: number + + /** + * The literal textual (UTF-8) lines before the line the selection started + * on. + * + * This is an arbitrary number of lines, and may be zero lines, but typically 3. + * + * If null, this information will be gathered from the repository itself + * automatically. This will result in an error if the selection is invalid or + * the DiscussionThreadTargetRepoInput specified an invalid path or + * branch/revision. + */ + linesBefore?: Array | null + + /** + * The literal textual (UTF-8) lines of the selection. i.e. all lines + * startLine through endLine. + * + * If null, this information will be gathered from the repository itself + * automatically. This will result in an error if the selection is invalid or + * the DiscussionThreadTargetRepoInput specified an invalid path or + * branch/revision. + */ + lines?: Array | null + + /** + * The literal textual (UTF-8) lines after the line the selection ended on. + * + * This is an arbitrary number of lines, and may be zero lines, but typically 3. + * + * If null, this information will be gathered from the repository itself + * automatically. This will result in an error if the selection is invalid or + * the DiscussionThreadTargetRepoInput specified an invalid path or + * branch/revision. + */ + linesAfter?: Array | null + } + + /** + * Describes an update mutation to an existing thread. + */ + interface IDiscussionThreadUpdateInput { + /** + * The ID of the thread to update. + */ + ThreadID: string + + /** + * When non-null, indicates that the thread should be archived. + */ + Archive?: boolean | null + + /** + * When non-null, indicates that the thread should be deleted. Only admins + * can perform this action. + */ + Delete?: boolean | null + } + + /** + * Describes an update mutation to an existing comment in a thread. + */ + interface IDiscussionCommentUpdateInput { + /** + * The ID of the comment to update. + */ + commentID: string + + /** + * When non-null, indicates that the thread should be deleted. Only admins + * can perform this action. + */ + delete?: boolean | null + + /** + * When non-null, reports the comment with the specified reason. + * + * An error will be returned if the comment's canReport field is false. + */ + report?: string | null + + /** + * When non-null, indicates that the reports on the thread should be + * cleared. Only admins can perform this action. + * + * An error will be returned if the comment's canClearReports field is false. + */ + clearReports?: boolean | null + } + + /** + * Input for a user satisfaction (NPS) survey submission. + */ + interface ISurveySubmissionInput { + /** + * User-provided email address, if there is no currently authenticated user. If there is, this value + * will not be used. + */ + email?: string | null + + /** + * User's likelihood of recommending Sourcegraph to a friend, from 0-10. + */ + score: number + + /** + * The answer to "What is the most important reason for the score you gave". + */ + reason?: string | null + + /** + * The answer to "What can Sourcegraph do to provide a better product" + */ + better?: string | null + } + + /** + * Mutations for the extension registry. + */ + interface IExtensionRegistryMutation { + __typename: 'ExtensionRegistryMutation' + + /** + * Create a new extension in the extension registry. + */ + createExtension: IExtensionRegistryCreateExtensionResult + + /** + * Update an extension in the extension registry. + * + * Only authorized extension publishers may perform this mutation. + */ + updateExtension: IExtensionRegistryUpdateExtensionResult + + /** + * Delete an extension from the extension registry. + * + * Only authorized extension publishers may perform this mutation. + */ + deleteExtension: IEmptyResponse + + /** + * Publish an extension in the extension registry, creating it (if it doesn't yet exist) or updating it (if it + * does). + * + * This is a helper that wraps multiple other GraphQL mutations to expose a single API for publishing an + * extension. + */ + publishExtension: IExtensionRegistryCreateExtensionResult + } + + interface ICreateExtensionOnExtensionRegistryMutationArguments { + /** + * The ID of the extension's publisher (a user or organization). + */ + publisher: string + + /** + * The name of the extension. + */ + name: string + } + + interface IUpdateExtensionOnExtensionRegistryMutationArguments { + /** + * The extension to update. + */ + extension: string + + /** + * The new name for the extension, or null to leave unchanged. + */ + name?: string | null + } + + interface IDeleteExtensionOnExtensionRegistryMutationArguments { + /** + * The ID of the extension to delete. + */ + extension: string + } + + interface IPublishExtensionOnExtensionRegistryMutationArguments { + /** + * The extension ID of the extension to publish. If a host prefix (e.g., "sourcegraph.example.com/") is + * needed and it is not included, it is automatically prepended. + * + * Examples: "alice/myextension", "acmecorp/myextension" + */ + extensionID: string + + /** + * The extension manifest (as JSON). + */ + manifest: string + + /** + * The bundled JavaScript source of the extension. + */ + bundle?: string | null + + /** + * The source map of the extension's JavaScript bundle, if any. + * + * The JavaScript bundle's "//# sourceMappingURL=" directive, if any, is ignored. When the bundle is served, + * the source map provided here is referenced instead. + */ + sourceMap?: string | null + + /** + * Force publish even if there are warnings (such as invalid JSON warnings). + * @default false + */ + force?: boolean | null + } + + /** + * The result of Mutation.extensionRegistry.createExtension. + */ + interface IExtensionRegistryCreateExtensionResult { + __typename: 'ExtensionRegistryCreateExtensionResult' + + /** + * The newly created extension. + */ + extension: IRegistryExtension + } + + /** + * The result of Mutation.extensionRegistry.updateExtension. + */ + interface IExtensionRegistryUpdateExtensionResult { + __typename: 'ExtensionRegistryUpdateExtensionResult' + + /** + * The newly updated extension. + */ + extension: IRegistryExtension + } + + /** + * Mutations that are only used on Sourcegraph.com. + * + * FOR INTERNAL USE ONLY. + */ + interface IDotcomMutation { + __typename: 'DotcomMutation' + + /** + * Set or unset a user's associated billing information. + * + * Only Sourcegraph.com site admins may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + setUserBilling: IEmptyResponse + + /** + * Creates new product subscription for an account. + * + * Only Sourcegraph.com site admins may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + createProductSubscription: IProductSubscription + + /** + * Set or unset a product subscription's associated billing system subscription. + * + * Only Sourcegraph.com site admins may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + setProductSubscriptionBilling: IEmptyResponse + + /** + * Generates and signs a new product license and associates it with an existing product subscription. The + * product license key is signed with Sourcegraph.com's private key and is verifiable with the corresponding + * public key. + * + * Only Sourcegraph.com site admins may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + generateProductLicenseForSubscription: IProductLicense + + /** + * Creates a new product subscription and bills the associated payment method. + * + * Only Sourcegraph.com authenticated users may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + createPaidProductSubscription: ICreatePaidProductSubscriptionResult + + /** + * Archives an existing product subscription. + * + * Only Sourcegraph.com site admins may perform this mutation. + * + * FOR INTERNAL USE ONLY. + */ + archiveProductSubscription: IEmptyResponse + } + + interface ISetUserBillingOnDotcomMutationArguments { + /** + * The user to update. + */ + user: string + + /** + * The billing customer ID (on the billing system) to associate this user with. If null, the association is + * removed (i.e., the user is unlinked from the billing customer record). + */ + billingCustomerID?: string | null + } + + interface ICreateProductSubscriptionOnDotcomMutationArguments { + /** + * The ID of the user (i.e., customer) to whom this product subscription is assigned. + */ + accountID: string + } + + interface ISetProductSubscriptionBillingOnDotcomMutationArguments { + /** + * The product subscription to update. + */ + id: string + + /** + * The billing subscription ID (on the billing system) to associate this product subscription with. If null, + * the association is removed (i.e., the subscription is unlinked from billing). + */ + billingSubscriptionID?: string | null + } + + interface IGenerateProductLicenseForSubscriptionOnDotcomMutationArguments { + /** + * The product subscription to associate with the license. + */ + productSubscriptionID: string + + /** + * The license to generate. + */ + license: IProductLicenseInput + } + + interface ICreatePaidProductSubscriptionOnDotcomMutationArguments { + /** + * The ID of the user (i.e., customer) to whom the product subscription is assigned. + * + * Only Sourcegraph.com site admins may perform this mutation for an accountID != the user ID of the + * authenticated user. + */ + accountID: string + + /** + * The details of the product subscription. + */ + productSubscription: IProductSubscriptionInput + + /** + * The token that represents the payment method used to purchase this product subscription. + */ + paymentToken: string + } + + interface IArchiveProductSubscriptionOnDotcomMutationArguments { + id: string + } + + /** + * An input type that describes a product license to be generated and signed. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductLicenseInput { + /** + * The tags that indicate which features are activated by this license. + */ + tags: Array + + /** + * The number of users for which this product subscription is valid. + */ + userCount: number + + /** + * The expiration date of this product license, expressed as the number of seconds since the epoch. + */ + expiresAt: number + } + + /** + * An input type that describes a product subscription to be purchased. + * + * FOR INTERNAL USE ONLY. + */ + interface IProductSubscriptionInput { + /** + * The name of the subscription's plan (ProductPlan.name). + */ + plan: string + + /** + * This subscription's user count. + */ + userCount: number + + /** + * The non-authoritative price (in USD cents) that the client computed. The server MUST independently compute + * the price given this input object's other properties. If the prices differ (which indicates a bug or a + * malicious client), then the server MUST abort and return an error. + */ + totalPriceNonAuthoritative: number + } + + /** + * The result of Mutation.dotcom.createPaidProductSubscription. + * + * FOR INTERNAL USE ONLY. + */ + interface ICreatePaidProductSubscriptionResult { + __typename: 'CreatePaidProductSubscriptionResult' + + /** + * The newly created product subscription. + */ + productSubscription: IProductSubscription + } + + /** + * A deployment configuration. + */ + interface IDeploymentConfiguration { + __typename: 'DeploymentConfiguration' + + /** + * The email. + */ + email: string | null + + /** + * The site ID. + */ + siteID: string | null + } + + /** + * A diff between two diffable Git objects. + */ + interface IDiff { + __typename: 'Diff' + + /** + * The diff's repository. + */ + repository: IRepository + + /** + * The revision range of the diff. + */ + range: IGitRevisionRange + } + + /** + * A search result that is a diff between two diffable Git objects. + */ + interface IDiffSearchResult { + __typename: 'DiffSearchResult' + + /** + * The diff that matched the search query. + */ + diff: IDiff + + /** + * The matching portion of the diff. + */ + preview: IHighlightedString + } + + /** + * The result of Mutation.extensionRegistry.publishExtension. + */ + interface IExtensionRegistryPublishExtensionResult { + __typename: 'ExtensionRegistryPublishExtensionResult' + + /** + * The extension that was just published. + */ + extension: IRegistryExtension + } + + /** + * Ref fields. + */ + interface IRefFields { + __typename: 'RefFields' + + /** + * The ref location. + */ + refLocation: IRefLocation | null + + /** + * The URI. + */ + uri: IURI | null + } + + /** + * A ref location. + */ + interface IRefLocation { + __typename: 'RefLocation' + + /** + * The starting line number. + */ + startLineNumber: number + + /** + * The starting column. + */ + startColumn: number + + /** + * The ending line number. + */ + endLineNumber: number + + /** + * The ending column. + */ + endColumn: number + } + + /** + * A URI. + */ + interface IURI { + __typename: 'URI' + + /** + * The host. + */ + host: string + + /** + * The fragment. + */ + fragment: string + + /** + * The path. + */ + path: string + + /** + * The query. + */ + query: string + + /** + * The scheme. + */ + scheme: string + } +} + +// tslint:enable diff --git a/src/typings/vscode.proposed.d.ts b/src/typings/vscode.proposed.d.ts new file mode 100644 index 00000000..9d84d2fc --- /dev/null +++ b/src/typings/vscode.proposed.d.ts @@ -0,0 +1,843 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// This is the place for API experiments and proposals. + +declare module 'vscode' { + export namespace window { + export function sampleFunction(): Thenable + } + + export namespace languages { + /** + * + */ + export function changeLanguage(document: TextDocument, languageId: string): Thenable + } + + //#region Joh - read/write in chunks + + export interface FileSystemProvider { + open?(resource: Uri): number | Thenable + close?(fd: number): void | Thenable + read?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable + write?(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable + } + + //#endregion + + //#region Rob: search provider + + /** + * The parameters of a query for text search. + */ + export interface TextSearchQuery { + /** + * The text pattern to search for. + */ + pattern: string + + /** + * Whether or not `pattern` should be interpreted as a regular expression. + */ + isRegExp?: boolean + + /** + * Whether or not the search should be case-sensitive. + */ + isCaseSensitive?: boolean + + /** + * Whether or not to search for whole word matches only. + */ + isWordMatch?: boolean + } + + /** + * A file glob pattern to match file paths against. + * TODO@roblou - merge this with the GlobPattern docs/definition in vscode.d.ts. + * @see [GlobPattern](#GlobPattern) + */ + export type GlobString = string + + /** + * Options common to file and text search + */ + export interface SearchOptions { + /** + * The root folder to search within. + */ + folder: Uri + + /** + * Files that match an `includes` glob pattern should be included in the search. + */ + includes: GlobString[] + + /** + * Files that match an `excludes` glob pattern should be excluded from the search. + */ + excludes: GlobString[] + + /** + * Whether external files that exclude files, like .gitignore, should be respected. + * See the vscode setting `"search.useIgnoreFiles"`. + */ + useIgnoreFiles: boolean + + /** + * Whether symlinks should be followed while searching. + * See the vscode setting `"search.followSymlinks"`. + */ + followSymlinks: boolean + } + + /** + * Options to specify the size of the result text preview. + * These options don't affect the size of the match itself, just the amount of preview text. + */ + export interface TextSearchPreviewOptions { + /** + * The maximum number of lines in the preview. + * Only search providers that support multiline search will ever return more than one line in the match. + */ + maxLines: number + + /** + * The maximum number of characters included before the start of the match. + */ + leadingChars: number + + /** + * The maximum number of characters included per line. + */ + totalChars: number + } + + /** + * Options that apply to text search. + */ + export interface TextSearchOptions extends SearchOptions { + /** + * The maximum number of results to be returned. + */ + maxResults: number + + /** + * Options to specify the size of the result text preview. + */ + previewOptions?: TextSearchPreviewOptions + + /** + * Exclude files larger than `maxFileSize` in bytes. + */ + maxFileSize?: number + + /** + * Interpret files using this encoding. + * See the vscode setting `"files.encoding"` + */ + encoding?: string + } + + /** + * The parameters of a query for file search. + */ + export interface FileSearchQuery { + /** + * The search pattern to match against file paths. + */ + pattern: string + } + + /** + * Options that apply to file search. + */ + export interface FileSearchOptions extends SearchOptions { + /** + * The maximum number of results to be returned. + */ + maxResults: number + } + + /** + * Options that apply to requesting the file index. + */ + export interface FileIndexOptions extends SearchOptions {} + + /** + * A preview of the text result. + */ + export interface TextSearchResultPreview { + /** + * The matching line of text, or a portion of the matching line that contains the match. + * For now, this can only be a single line. + */ + text: string + + /** + * The Range within `text` corresponding to the text of the match. + */ + match: Range + } + + /** + * A match from a text search + */ + export interface TextSearchResult { + /** + * The uri for the matching document. + */ + uri: Uri + + /** + * The range of the match within the document. + */ + range: Range + + /** + * A preview of the text result. + */ + preview: TextSearchResultPreview + } + + /** + * A FileIndexProvider provides a list of files in the given folder. VS Code will filter that list for searching with quickopen or from other extensions. + * + * A FileIndexProvider is the simpler of two ways to implement file search in VS Code. Use a FileIndexProvider if you are able to provide a listing of all files + * in a folder, and want VS Code to filter them according to the user's search query. + * + * The FileIndexProvider will be invoked once when quickopen is opened, and VS Code will filter the returned list. It will also be invoked when + * `workspace.findFiles` is called. + * + * If a [`FileSearchProvider`](#FileSearchProvider) is registered for the scheme, that provider will be used instead. + */ + export interface FileIndexProvider { + /** + * Provide the set of files in the folder. + * @param options A set of options to consider while searching. + * @param token A cancellation token. + */ + provideFileIndex(options: FileIndexOptions, token: CancellationToken): Thenable + } + + /** + * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickopen or other extensions. + * + * A FileSearchProvider is the more powerful of two ways to implement file search in VS Code. Use a FileSearchProvider if you wish to search within a folder for + * all files that match the user's query. + * + * The FileSearchProvider will be invoked on every keypress in quickopen. When `workspace.findFiles` is called, it will be invoked with an empty query string, + * and in that case, every file in the folder should be returned. + * + * @see [FileIndexProvider](#FileIndexProvider) + */ + export interface FileSearchProvider { + /** + * Provide the set of files that match a certain file path pattern. + * @param query The parameters for this query. + * @param options A set of options to consider while searching files. + * @param progress A progress callback that must be invoked for all results. + * @param token A cancellation token. + */ + provideFileSearchResults( + query: FileSearchQuery, + options: FileSearchOptions, + token: CancellationToken + ): Thenable + } + + /** + * A TextSearchProvider provides search results for text results inside files in the workspace. + */ + export interface TextSearchProvider { + /** + * Provide results that match the given text pattern. + * @param query The parameters for this query. + * @param options A set of options to consider while searching. + * @param progress A progress callback that must be invoked for all results. + * @param token A cancellation token. + */ + provideTextSearchResults( + query: TextSearchQuery, + options: TextSearchOptions, + progress: Progress, + token: CancellationToken + ): Thenable + } + + /** + * Options that can be set on a findTextInFiles search. + */ + export interface FindTextInFilesOptions { + /** + * A [glob pattern](#GlobPattern) that defines the files to search for. The glob pattern + * will be matched against the file paths of files relative to their workspace. Use a [relative pattern](#RelativePattern) + * to restrict the search results to a [workspace folder](#WorkspaceFolder). + */ + include?: GlobPattern + + /** + * A [glob pattern](#GlobPattern) that defines files and folders to exclude. The glob pattern + * will be matched against the file paths of resulting matches relative to their workspace. When `undefined` only default excludes will + * apply, when `null` no excludes will apply. + */ + exclude?: GlobPattern | null + + /** + * The maximum number of results to search for + */ + maxResults?: number + + /** + * Whether external files that exclude files, like .gitignore, should be respected. + * See the vscode setting `"search.useIgnoreFiles"`. + */ + useIgnoreFiles?: boolean + + /** + * Whether symlinks should be followed while searching. + * See the vscode setting `"search.followSymlinks"`. + */ + followSymlinks?: boolean + + /** + * Interpret files using this encoding. + * See the vscode setting `"files.encoding"` + */ + encoding?: string + + /** + * Options to specify the size of the result text preview. + */ + previewOptions?: TextSearchPreviewOptions + } + + export namespace workspace { + /** + * DEPRECATED + */ + export function registerSearchProvider(): Disposable + + /** + * Register a file index provider. + * + * Only one provider can be registered per scheme. + * + * @param scheme The provider will be invoked for workspace folders that have this file scheme. + * @param provider The provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. + */ + export function registerFileIndexProvider(scheme: string, provider: FileIndexProvider): Disposable + + /** + * Register a search provider. + * + * Only one provider can be registered per scheme. + * + * @param scheme The provider will be invoked for workspace folders that have this file scheme. + * @param provider The provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. + */ + export function registerFileSearchProvider(scheme: string, provider: FileSearchProvider): Disposable + + /** + * Register a text search provider. + * + * Only one provider can be registered per scheme. + * + * @param scheme The provider will be invoked for workspace folders that have this file scheme. + * @param provider The provider. + * @return A [disposable](#Disposable) that unregisters this provider when being disposed. + */ + export function registerTextSearchProvider(scheme: string, provider: TextSearchProvider): Disposable + + /** + * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace. + * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. + * @param callback A callback, called for each result + * @param token A token that can be used to signal cancellation to the underlying search engine. + * @return A thenable that resolves when the search is complete. + */ + export function findTextInFiles( + query: TextSearchQuery, + callback: (result: TextSearchResult) => void, + token?: CancellationToken + ): Thenable + + /** + * Search text in files across all [workspace folders](#workspace.workspaceFolders) in the workspace. + * @param query The query parameters for the search - the search string, whether it's case-sensitive, or a regex, or matches whole words. + * @param options An optional set of query options. Include and exclude patterns, maxResults, etc. + * @param callback A callback, called for each result + * @param token A token that can be used to signal cancellation to the underlying search engine. + * @return A thenable that resolves when the search is complete. + */ + export function findTextInFiles( + query: TextSearchQuery, + options: FindTextInFilesOptions, + callback: (result: TextSearchResult) => void, + token?: CancellationToken + ): Thenable + } + + //#endregion + + //#region Joao: diff command + + /** + * The contiguous set of modified lines in a diff. + */ + export interface LineChange { + readonly originalStartLineNumber: number + readonly originalEndLineNumber: number + readonly modifiedStartLineNumber: number + readonly modifiedEndLineNumber: number + } + + export namespace commands { + /** + * Registers a diff information command that can be invoked via a keyboard shortcut, + * a menu item, an action, or directly. + * + * Diff information commands are different from ordinary [commands](#commands.registerCommand) as + * they only execute when there is an active diff editor when the command is called, and the diff + * information has been computed. Also, the command handler of an editor command has access to + * the diff information. + * + * @param command A unique identifier for the command. + * @param callback A command handler function with access to the [diff information](#LineChange). + * @param thisArg The `this` context used when invoking the handler function. + * @return Disposable which unregisters this command on disposal. + */ + export function registerDiffInformationCommand( + command: string, + callback: (diff: LineChange[], ...args: any[]) => any, + thisArg?: any + ): Disposable + } + + //#endregion + + //#region Joh: decorations + + //todo@joh -> make class + export interface DecorationData { + letter?: string + title?: string + color?: ThemeColor + priority?: number + bubble?: boolean + source?: string // hacky... we should remove it and use equality under the hood + } + + export interface SourceControlResourceDecorations { + source?: string + letter?: string + color?: ThemeColor + } + + export interface DecorationProvider { + onDidChangeDecorations: Event + provideDecoration(uri: Uri, token: CancellationToken): ProviderResult + } + + export namespace window { + export function registerDecorationProvider(provider: DecorationProvider): Disposable + } + + //#endregion + + //#region André: debug + + /** + * Represents a debug adapter executable and optional arguments passed to it. + */ + export class DebugAdapterExecutable { + /** + * The command path of the debug adapter executable. + * A command must be either an absolute path or the name of an executable looked up via the PATH environment variable. + * The special value 'node' will be mapped to VS Code's built-in node runtime. + */ + readonly command: string + + /** + * Optional arguments passed to the debug adapter executable. + */ + readonly args: string[] + + /** + * Create a new debug adapter specification. + */ + constructor(command: string, args?: string[]) + } + + export interface DebugConfigurationProvider { + /** + * This optional method is called just before a debug adapter is started to determine its executable path and arguments. + * Registering more than one debugAdapterExecutable for a type results in an error. + * @param folder The workspace folder from which the configuration originates from or undefined for a folderless setup. + * @param token A cancellation token. + * @return a [debug adapter's executable and optional arguments](#DebugAdapterExecutable) or undefined. + */ + debugAdapterExecutable?( + folder: WorkspaceFolder | undefined, + token?: CancellationToken + ): ProviderResult + } + + //#endregion + + //#region Rob, Matt: logging + + /** + * The severity level of a log message + */ + export enum LogLevel { + Trace = 1, + Debug = 2, + Info = 3, + Warning = 4, + Error = 5, + Critical = 6, + Off = 7, + } + + export namespace env { + /** + * Current logging level. + */ + export const logLevel: LogLevel + + /** + * An [event](#Event) that fires when the log level has changed. + */ + export const onDidChangeLogLevel: Event + } + + //#endregion + + //#region Joao: SCM validation + + /** + * Represents the validation type of the Source Control input. + */ + export enum SourceControlInputBoxValidationType { + /** + * Something not allowed by the rules of a language or other means. + */ + Error = 0, + + /** + * Something suspicious but allowed. + */ + Warning = 1, + + /** + * Something to inform about but not a problem. + */ + Information = 2, + } + + export interface SourceControlInputBoxValidation { + /** + * The validation message to display. + */ + readonly message: string + + /** + * The validation type. + */ + readonly type: SourceControlInputBoxValidationType + } + + /** + * Represents the input box in the Source Control viewlet. + */ + export interface SourceControlInputBox { + /** + * A validation function for the input box. It's possible to change + * the validation provider simply by setting this property to a different function. + */ + validateInput?( + value: string, + cursorPosition: number + ): ProviderResult + } + + //#endregion + + //#region Joao: SCM selected provider + + export interface SourceControl { + /** + * Whether the source control is selected. + */ + readonly selected: boolean + + /** + * An event signaling when the selection state changes. + */ + readonly onDidChangeSelection: Event + } + + //#endregion + + //#region Comments + /** + * Comments provider related APIs are still in early stages, they may be changed significantly during our API experiments. + */ + + interface CommentInfo { + threads: CommentThread[] + commentingRanges?: Range[] + } + + export enum CommentThreadCollapsibleState { + /** + * Determines an item is collapsed + */ + Collapsed = 0, + /** + * Determines an item is expanded + */ + Expanded = 1, + } + + interface CommentThread { + threadId: string + resource: Uri + range: Range + comments: Comment[] + collapsibleState?: CommentThreadCollapsibleState + } + + interface Comment { + commentId: string + body: MarkdownString + userName: string + gravatar: string + command?: Command + } + + export interface CommentThreadChangedEvent { + /** + * Added comment threads. + */ + readonly added: CommentThread[] + + /** + * Removed comment threads. + */ + readonly removed: CommentThread[] + + /** + * Changed comment threads. + */ + readonly changed: CommentThread[] + } + + interface DocumentCommentProvider { + provideDocumentComments(document: TextDocument, token: CancellationToken): Promise + createNewCommentThread( + document: TextDocument, + range: Range, + text: string, + token: CancellationToken + ): Promise + replyToCommentThread( + document: TextDocument, + range: Range, + commentThread: CommentThread, + text: string, + token: CancellationToken + ): Promise + onDidChangeCommentThreads: Event + } + + interface WorkspaceCommentProvider { + provideWorkspaceComments(token: CancellationToken): Promise + onDidChangeCommentThreads: Event + } + + namespace workspace { + export function registerDocumentCommentProvider(provider: DocumentCommentProvider): Disposable + export function registerWorkspaceCommentProvider(provider: WorkspaceCommentProvider): Disposable + } + //#endregion + + //#region Terminal + + export interface Terminal { + /** + * Fires when the terminal's pty slave pseudo-device is written to. In other words, this + * provides access to the raw data stream from the process running within the terminal, + * including VT sequences. + */ + onDidWriteData: Event + } + + /** + * Represents the dimensions of a terminal. + */ + export interface TerminalDimensions { + /** + * The number of columns in the terminal. + */ + readonly columns: number + + /** + * The number of rows in the terminal. + */ + readonly rows: number + } + + /** + * Represents a terminal without a process where all interaction and output in the terminal is + * controlled by an extension. This is similar to an output window but has the same VT sequence + * compatility as the regular terminal. + * + * Note that an instance of [Terminal](#Terminal) will be created when a TerminalRenderer is + * created with all its APIs available for use by extensions. When using the Terminal object + * of a TerminalRenderer it acts just like normal only the extension that created the + * TerminalRenderer essentially acts as a process. For example when an + * [Terminal.onDidWriteData](#Terminal.onDidWriteData) listener is registered, that will fire + * when [TerminalRenderer.write](#TerminalRenderer.write) is called. Similarly when + * [Terminal.sendText](#Terminal.sendText) is triggered that will fire the + * [TerminalRenderer.onDidAcceptInput](#TerminalRenderer.onDidAcceptInput) event. + * + * **Example:** Create a terminal renderer, show it and write hello world in red + * ```typescript + * const renderer = window.createTerminalRenderer('foo'); + * renderer.terminal.then(t => t.show()); + * renderer.write('\x1b[31mHello world\x1b[0m'); + * ``` + */ + export interface TerminalRenderer { + /** + * The name of the terminal, this will appear in the terminal selector. + */ + name: string + + /** + * The dimensions of the terminal, the rows and columns of the terminal can only be set to + * a value smaller than the maximum value, if this is undefined the terminal will auto fit + * to the maximum value [maximumDimensions](TerminalRenderer.maximumDimensions). + * + * **Example:** Override the dimensions of a TerminalRenderer to 20 columns and 10 rows + * ```typescript + * terminalRenderer.dimensions = { + * cols: 20, + * rows: 10 + * }; + * ``` + */ + dimensions: TerminalDimensions | undefined + + /** + * The maximum dimensions of the terminal, this will be undefined immediately after a + * terminal renderer is created and also until the terminal becomes visible in the UI. + * Listen to [onDidChangeMaximumDimensions](TerminalRenderer.onDidChangeMaximumDimensions) + * to get notified when this value changes. + */ + readonly maximumDimensions: TerminalDimensions | undefined + + /** + * The corressponding [Terminal](#Terminal) for this TerminalRenderer. + */ + readonly terminal: Terminal + + /** + * Write text to the terminal. Unlike [Terminal.sendText](#Terminal.sendText) which sends + * text to the underlying _process_, this will write the text to the terminal itself. + * + * **Example:** Write red text to the terminal + * ```typescript + * terminalRenderer.write('\x1b[31mHello world\x1b[0m'); + * ``` + * + * **Example:** Move the cursor to the 10th row and 20th column and write an asterisk + * ```typescript + * terminalRenderer.write('\x1b[10;20H*'); + * ``` + * + * @param text The text to write. + */ + write(text: string): void + + /** + * An event which fires on keystrokes in the terminal or when an extension calls + * [Terminal.sendText](#Terminal.sendText). Keystrokes are converted into their + * corresponding VT sequence representation. + * + * **Example:** Simulate interaction with the terminal from an outside extension or a + * workbench command such as `workbench.action.terminal.runSelectedText` + * ```typescript + * const terminalRenderer = window.createTerminalRenderer('test'); + * terminalRenderer.onDidAcceptInput(data => { + * cosole.log(data); // 'Hello world' + * }); + * terminalRenderer.terminal.then(t => t.sendText('Hello world')); + * ``` + */ + readonly onDidAcceptInput: Event + + /** + * An event which fires when the [maximum dimensions](#TerminalRenderer.maimumDimensions) of + * the terminal renderer change. + */ + readonly onDidChangeMaximumDimensions: Event + } + + export namespace window { + /** + * The currently active terminal or `undefined`. The active terminal is the one that + * currently has focus or most recently had focus. + */ + export const activeTerminal: Terminal | undefined + + /** + * An [event](#Event) which fires when the [active terminal](#window.activeTerminal) + * has changed. *Note* that the event also fires when the active terminal changes + * to `undefined`. + */ + export const onDidChangeActiveTerminal: Event + + /** + * Create a [TerminalRenderer](#TerminalRenderer). + * + * @param name The name of the terminal renderer, this shows up in the terminal selector. + */ + export function createTerminalRenderer(name: string): TerminalRenderer + } + + //#endregion + + //#region Joh -> exclusive document filters + + export interface DocumentFilter { + exclusive?: boolean + } + + //#endregion + + //#region mjbvz,joh: https://github.com/Microsoft/vscode/issues/43768 + export interface FileRenameEvent { + readonly oldUri: Uri + readonly newUri: Uri + } + + export interface FileWillRenameEvent { + readonly oldUri: Uri + readonly newUri: Uri + waitUntil(thenable: Thenable): void + } + + export namespace workspace { + export const onWillRenameFile: Event + export const onDidRenameFile: Event + } + //#endregion +} diff --git a/yarn.lock b/yarn.lock index 354c4db3..c89e8ac1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -139,6 +139,36 @@ dependencies: find-up "^2.1.0" +"@gql2ts/from-query@^1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@gql2ts/from-query/-/from-query-1.9.0.tgz#ae92a4fa3df005df57eb835b371d7964644b9beb" + integrity sha512-hfH2Oq3ikHu+zKE4b9kdGbzEqFiX+VxIg0nhgpY5iUgl975cAtTFhAdwfzr/jKdZhC9Ad5dE1CPrjEA+G7hzMg== + dependencies: + "@gql2ts/language-typescript" "^1.9.0" + "@gql2ts/util" "^1.9.0" + +"@gql2ts/from-schema@^1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@gql2ts/from-schema/-/from-schema-1.10.1.tgz#f8bb1f9525d5731163b16f5bcf300f87ef560273" + integrity sha512-atYXxY8WBBfK39fEbdwx3CgqRYYUR10a1hGPIwVcvEuNYIlAnIUR1drVbmC3higwMbAyHGkMxDPJ9Us7tnNz6w== + dependencies: + "@gql2ts/language-typescript" "^1.9.0" + "@gql2ts/util" "^1.9.0" + dedent "^0.7.0" + +"@gql2ts/language-typescript@^1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@gql2ts/language-typescript/-/language-typescript-1.9.0.tgz#c521e800817d1341552e9c684bca6b64b0abb46f" + integrity sha512-d3OlIFMjKoXH+VukXD7+pQRLgrP3NkXDQbCWSGonIl5mpRQ5aO5I8Fo53cMZQ9xCjj1Y5Vg24wtZOuY8spc6Ag== + dependencies: + "@gql2ts/util" "^1.9.0" + humps "^2.0.0" + +"@gql2ts/util@^1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@gql2ts/util/-/util-1.9.0.tgz#d07a54832757d2f2d1fc9891e5b0e3e3b4886c6a" + integrity sha512-mkHar7AdyShUFJE6Mlke1tUbb+lPCK1EozZeAhCuRrhQ5aCCBAG6RxzNUYX1Q2jeGeyU0WRAtQu1oE/GoIsNXA== + "@marionebl/sander@^0.6.0": version "0.6.1" resolved "https://registry.yarnpkg.com/@marionebl/sander/-/sander-0.6.1.tgz#1958965874f24bc51be48875feb50d642fc41f7b" @@ -278,6 +308,11 @@ tslint-config-prettier "^1.6.0" tslint-react "^3.2.0" +"@types/chalk@^0.4.31": + version "0.4.31" + resolved "https://registry.yarnpkg.com/@types/chalk/-/chalk-0.4.31.tgz#a31d74241a6b1edbb973cf36d97a2896834a51f9" + integrity sha1-ox10JBprHtu5c8822XooloNKUfk= + "@types/execa@^0.9.0": version "0.9.0" resolved "https://registry.yarnpkg.com/@types/execa/-/execa-0.9.0.tgz#9b025d2755f17e80beaf9368c3f4f319d8b0fb93" @@ -285,16 +320,45 @@ dependencies: "@types/node" "*" +"@types/graphql@^0.8.6": + version "0.8.6" + resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.8.6.tgz#b34fb880493ba835b0c067024ee70130d6f9bb68" + integrity sha1-s0+4gEk7qDWwwGcCTucBMNb5u2g= + +"@types/minimist@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" + integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= + "@types/mocha@^2.2.32": version "2.2.48" resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.48.tgz#3523b126a0b049482e1c3c11877460f76622ffab" integrity sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw== +"@types/node-fetch@^1.6.7": + version "1.6.9" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-1.6.9.tgz#a750fb0f4cf2960bf72b462e4c86908022dd69c5" + integrity sha512-n2r6WLoY7+uuPT7pnEtKJCmPUGyJ+cbyBR8Avnu4+m1nzz7DwBVuyIvvlBzCZ/nrpC7rIgb3D6pNavL7rFEa9g== + dependencies: + "@types/node" "*" + +"@types/node-fetch@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.1.2.tgz#8c5da14d70321e4c4ecd5db668e3f93cf6c7399f" + integrity sha512-XroxUzLpKuL+CVkQqXlffRkEPi4Gh3Oui/mWyS7ztKiyqVxiU+h3imCW5I2NQmde5jK+3q++36/Q96cyRWsweg== + dependencies: + "@types/node" "*" + "@types/node@*", "@types/node@^10.3.3": version "10.11.4" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.11.4.tgz#e8bd933c3f78795d580ae41d86590bfc1f4f389d" integrity sha512-ojnbBiKkZFYRfQpmtnnWTMw+rzGp/JiystjluW9jgN3VzRwilXddJ6aGQ9V/7iuDG06SBgn7ozW9k3zcAnYjYQ== +"@types/node@^7.0.4": + version "7.0.71" + resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.71.tgz#256bad647718bcdaed64c006687917d4d320aee1" + integrity sha512-wpTYiRPPsjw/wiwlmP11mnln9be499B58XwoGsCy2hT8jSrRj7DE84FiIu3TBAQZ7L1ky1ibz5J9AG2YN1qZlQ== + "@types/opn@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@types/opn/-/opn-5.1.0.tgz#bff7bc371677f4bdbb37884400e03fd81f743927" @@ -1144,7 +1208,7 @@ commander@2.15.1: resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== -commander@^2.11.0, commander@^2.12.1, commander@^2.8.1: +commander@^2.11.0, commander@^2.12.1, commander@^2.8.1, commander@^2.9.0: version "2.18.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.18.0.tgz#2bf063ddee7c7891176981a2cc798e5754bc6970" integrity sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ== @@ -1437,7 +1501,7 @@ debug@^4.0.0: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -1467,6 +1531,11 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= + deep-assign@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-1.0.0.tgz#b092743be8427dc621ea0067cdec7e70dd19f37b" @@ -2383,6 +2452,21 @@ get-caller-file@^1.0.1: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== +get-graphql-schema@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/get-graphql-schema/-/get-graphql-schema-2.1.1.tgz#d5d1b983481d014493bb4259c6edb0bd7dd74b4b" + integrity sha1-1dG5g0gdAUSTu0JZxu2wvX3XS0s= + dependencies: + "@types/chalk" "^0.4.31" + "@types/graphql" "^0.8.6" + "@types/minimist" "^1.2.0" + "@types/node" "^7.0.4" + "@types/node-fetch" "^1.6.7" + chalk "^1.1.3" + graphql "^0.9.1" + minimist "^1.2.0" + node-fetch "^1.6.3" + get-stdin@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" @@ -2581,11 +2665,36 @@ got@^6.7.1: unzip-response "^2.0.1" url-parse-lax "^1.0.0" +gql2ts@^1.8.2: + version "1.10.1" + resolved "https://registry.yarnpkg.com/gql2ts/-/gql2ts-1.10.1.tgz#aae1a1312744f7c9b36abf78437413ea317f6a71" + integrity sha512-Kwa1Db1e3qGediBi1A5wX98UBKmvUklsQgfLwk7J8bj9RQ4AkAwTToFvUmKhflKTZndAtQbdOJWwm5cmgXsLYA== + dependencies: + "@gql2ts/from-query" "^1.9.0" + "@gql2ts/from-schema" "^1.10.1" + "@gql2ts/util" "^1.9.0" + commander "^2.9.0" + graphql ">= 0.10 <15" + graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@~4.1.11: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" integrity sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg= +"graphql@>= 0.10 <15": + version "14.0.2" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.0.2.tgz#7dded337a4c3fd2d075692323384034b357f5650" + integrity sha512-gUC4YYsaiSJT1h40krG3J+USGlwhzNTXSb4IOZljn9ag5Tj+RkoXrWp+Kh7WyE3t1NCfab5kzCuxBIvOMERMXw== + dependencies: + iterall "^1.2.2" + +graphql@^0.9.1: + version "0.9.6" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.9.6.tgz#514421e9d225c29dfc8fd305459abae58815ef2c" + integrity sha1-UUQh6dIlwp38j9MFRZq65YgV7yw= + dependencies: + iterall "^1.0.0" + growl@1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" @@ -2826,6 +2935,11 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +humps@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/humps/-/humps-2.0.1.tgz#dd02ea6081bd0568dc5d073184463957ba9ef9aa" + integrity sha1-3QLqYIG9BWjcXQcxhEY5V7qe+ao= + husky@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" @@ -2876,7 +2990,7 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -3310,6 +3424,11 @@ issue-parser@^3.0.0: lodash.isstring "^4.0.1" lodash.uniqby "^4.7.0" +iterall@^1.0.0, iterall@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" + integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA== + java-properties@^0.2.9: version "0.2.10" resolved "https://registry.yarnpkg.com/java-properties/-/java-properties-0.2.10.tgz#2551560c25fa1ad94d998218178f233ad9b18f60" @@ -3562,11 +3681,6 @@ lockfile@^1.0.4: dependencies: signal-exit "^3.0.2" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -3575,33 +3689,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@*, lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= - lodash._reinterpolate@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" @@ -3677,11 +3769,6 @@ lodash.pick@4.4.0: resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= -lodash.restparam@*: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= - lodash.snakecase@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d" @@ -4228,7 +4315,7 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-fetch@^1.7.3: +node-fetch@^1.6.3, node-fetch@^1.7.3: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== @@ -4236,7 +4323,7 @@ node-fetch@^1.7.3: encoding "^0.1.11" is-stream "^1.0.1" -node-fetch@^2.1.1: +node-fetch@^2.1.1, node-fetch@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.2.0.tgz#4ee79bde909262f9775f731e3656d0db55ced5b5" integrity sha512-OayFWziIxiHY8bCUyLX6sTpDH8Jsbp4FfYd1j1f7vZyfgkcOnAyM4oQR16f8a0s7Gl/viMGRey8eScYk4V4EZA== @@ -5345,7 +5432,7 @@ readable-stream@~1.1.10: isarray "0.0.1" string_decoder "~0.10.x" -readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: +readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=