import { Octokit } from "@octokit/rest"; /** * Fetch GraphQL node IDs and thread resolution status for review comments. * * This function bridges the gap between GitHub's REST API and GraphQL API * to provide enhanced comment tracking capabilities. It maps REST comment IDs * to GraphQL thread IDs and tracks which threads are resolved. * * ## Why This Is Needed * * GitHub's REST API provides comment data but lacks some advanced features: * - No direct thread resolution status in comment objects * - No GraphQL node IDs for advanced operations * - Limited thread-level information * * The GraphQL API provides: * - Thread-level resolution status (`isResolved`) * - GraphQL node IDs for advanced operations * - Better thread management capabilities * * ## GraphQL Query Structure * * The query fetches review threads with: * - Thread ID (GraphQL node ID) * - Resolution status (`isResolved`) * - Associated comments with database IDs * - Pagination support for large PRs * * ## Mapping Strategy * * 1. **Fetch Threads**: Get all review threads for the PR * 2. **Map Comments**: Link REST comment IDs to GraphQL thread IDs * 3. **Track Resolution**: Record which threads are resolved * 4. **Early Exit**: Stop when all requested IDs are mapped * * ## Error Handling * * If GraphQL fails, the function returns empty maps rather than throwing. * This ensures the REST API fallback continues to work, though with * reduced functionality (no thread resolution status). * * @param octokit - GitHub API client instance * @param pr - Pull request information * @param pr.owner - Repository owner * @param pr.repo - Repository name * @param pr.number - Pull request number * @param commentIds - Array of REST comment IDs to fetch node IDs for * @returns Promise resolving to node ID map and resolved thread IDs * * @example * ```typescript * const { nodeIdMap, resolvedThreadIds } = await fetchReviewCommentNodeIds( * octokit, * { owner: 'owner', repo: 'repo', number: 123 }, * [12345, 12346] * ); * * // Check if a comment's thread is resolved * const threadId = nodeIdMap.get(12345); * const isResolved = resolvedThreadIds.has(threadId); * ``` */ export declare function fetchReviewCommentNodeIds(octokit: Octokit, pr: { owner: string; repo: string; number: number; }, commentIds: number[]): Promise<{ nodeIdMap: Map; resolvedThreadIds: Set; }>; //# sourceMappingURL=graphql-fetcher.d.ts.map