/** * Shared Source Adapter Utilities - SMI-879 * * Consolidates duplicated code patterns from GitHub, GitLab, and RawUrl adapters. * Provides common utilities for content decoding, error handling, and response processing. */ /** * Standard skill file paths to search for */ export declare const SKILL_FILE_PATHS: string[]; /** * Decode base64 encoded content (used by GitHub and GitLab APIs) * * Previously duplicated in: * - GitHubSourceAdapter.ts:356-367 * - GitLabSourceAdapter.ts:376-386 * * @param content - The encoded content string * @param encoding - The encoding type ('base64' or 'text') * @returns Decoded string content */ export declare function decodeBase64Content(content: string, encoding: string): string; /** * Check if an HTTP status code indicates a rate limit error * * @param status - HTTP status code * @returns true if rate limit error */ export declare function isRateLimitStatus(status: number): boolean; /** * Check if an HTTP status code indicates a server error (retryable) * * @param status - HTTP status code * @returns true if server error */ export declare function isServerError(status: number): boolean; /** * Check if an HTTP status code indicates not found * * @param status - HTTP status code * @returns true if not found */ export declare function isNotFoundStatus(status: number): boolean; /** * Handle API response errors with proper error wrapping * * Previously duplicated error handling in: * - GitHubSourceAdapter.ts:166-170, 309-313 * - GitLabSourceAdapter.ts:164-168, 324-328 * - RawUrlSourceAdapter.ts:113-114, 248-249 * * @param response - Fetch Response object * @param context - Context for error message (e.g., "GitHub API", "GitLab API") * @throws ApiError with appropriate code and context */ export declare function handleApiError(response: Response, context: string, options?: { url?: string; }): Promise; /** * Check response and throw appropriate error if not OK * * @param response - Fetch Response object * @param context - Context for error message * @throws ApiError if response is not OK */ export declare function assertResponseOk(response: Response, context: string, options?: { url?: string; }): Promise; /** * Parse rate limit headers from response * * @param response - Fetch Response object * @returns Rate limit info or null if not available */ export declare function parseRateLimitHeaders(response: Response): { remaining: number | null; limit: number | null; reset: Date | null; }; /** * Map common repository fields from API response * * @param source - Source type ('github' | 'gitlab') * @param item - API response item * @returns Normalized repository object */ export interface NormalizedRepository { id: string; name: string; fullName: string; url: string; description: string | null; stars: number; language: string | null; updatedAt: string; isPrivate: boolean; defaultBranch: string; } /** * Extract default branch from repository data * * @param item - API response with branch info * @param defaultValue - Default value if not found */ export declare function extractDefaultBranch(item: { default_branch?: string; defaultBranch?: string; }, defaultValue?: string): string; /** * Build pagination parameters for API requests * * @param page - Page number (1-indexed) * @param perPage - Items per page * @returns URL search params string */ export declare function buildPaginationParams(page: number, perPage: number): string; /** * Safely parse JSON response with error handling * * @param response - Fetch Response object * @param context - Context for error message * @returns Parsed JSON data */ export declare function parseJsonResponse(response: Response, context: string): Promise; //# sourceMappingURL=shared.d.ts.map