UNPKG

deepsource-mcp-server

Version:
115 lines (114 loc) 3.65 kB
/** * @fileoverview Runs client for the DeepSource API * This module provides functionality for working with DeepSource analysis runs. */ import { BaseDeepSourceClient } from './base-client.js'; import { DeepSourceRun, RunFilterParams } from '../models/runs.js'; import { DeepSourceIssue } from '../models/issues.js'; import { PaginatedResponse } from '../utils/pagination/types.js'; import { BranchName } from '../types/branded.js'; /** * Response type for recent run issues query * @public */ export interface RecentRunIssuesResponse { run: DeepSourceRun | null; items: DeepSourceIssue[]; pageInfo: { hasNextPage: boolean; hasPreviousPage: boolean; startCursor?: string | null; endCursor?: string | null; }; totalCount: number; } /** * Client for interacting with DeepSource runs API * @class * @extends BaseDeepSourceClient * @public */ export declare class RunsClient extends BaseDeepSourceClient { /** * Fetches analysis runs from a DeepSource project with optional filtering * @param projectKey The project key to fetch runs for * @param params Optional filter parameters * @returns Promise that resolves to a paginated list of runs * @throws {ClassifiedError} When the API request fails * @public */ listRuns(projectKey: string, params?: RunFilterParams): Promise<PaginatedResponse<DeepSourceRun>>; /** * Fetches a specific run by identifier (runUid or commitOid) * @param runIdentifier The run UID or commit OID * @returns Promise that resolves to the run if found, null otherwise * @public */ getRun(runIdentifier: string): Promise<DeepSourceRun | null>; /** * Finds the most recent run for a specific branch * @param projectKey The project key * @param branchName The branch name to search for * @returns Promise that resolves to the most recent run if found, null otherwise * @public */ findMostRecentRunForBranch(projectKey: string, branchName: string): Promise<DeepSourceRun | null>; /** * Fetches issues from the most recent run on a specific branch * @param projectKey The project key * @param branchName The branch name * @returns Promise that resolves to recent run issues response * @public */ getRecentRunIssues(projectKey: string, branchName: BranchName, paginationParams?: { first?: number; after?: string; last?: number; before?: string; }): Promise<RecentRunIssuesResponse>; /** * Builds the GraphQL query for fetching runs * @private */ private static buildRunsQuery; /** * Builds GraphQL query for fetching a run by UID * @private */ private static buildRunByUidQuery; /** * Builds GraphQL query for fetching a run by commit OID * @private */ private static buildRunByCommitQuery; /** * Extracts runs from GraphQL response * @private */ private extractRunsFromResponse; /** * Extracts a single run from GraphQL response * @private */ private extractSingleRunFromResponse; /** * Maps a run node from GraphQL to DeepSourceRun * @private */ private static mapRunNode; /** * Builds GraphQL query for fetching run occurrences * @private */ private static buildRunOccurrencesQuery; /** * Extracts issues from run occurrences response * @private */ private extractIssuesFromRunResponse; /** * Handles errors during runs fetching * @private */ private handleRunsError; }