UNPKG

tdpw

Version:

CLI tool for uploading Playwright test reports to TestDino platform with TestDino storage support

162 lines 4.06 kB
/** * Cache API client extension for TestDino API */ import type { Config } from '../config'; /** * Cache submission response from TestDino API */ export interface CacheSubmissionResponse { success: boolean; cacheId: string; message?: string | undefined; } /** * Cache retrieval options */ export interface CacheRetrievalOptions { cacheId: string; shardIndex?: number; forAllShards?: boolean; } /** * Cache retrieval response - Default (no query params) */ export interface CacheRetrievalResponse { success: boolean; message: string; data?: { cacheId: string; pipelineId: string; commit: string; cache: { branch: string; commit: string; repository: string; ci: { provider: string; pipelineId: string; buildNumber: string; }; failures: Array<{ file: string; testTitle: string; }>; shardInfo?: { isSharded: boolean; shardIndex: number; shardTotal: number; }; shardTotal?: number; shards?: Array<{ shardIndex: number; failures: Array<{ file: string; testTitle: string; }>; }>; }; }; } /** * Cache payload structure matching new API specification */ export interface CachePayload { cacheId: string; pipelineId: string; commit: string; branch: string; repository: string; ci: { provider: string; pipelineId: string; buildNumber: string; }; isSharded: boolean; shardIndex: number | null; shardTotal: number | null; failures: Array<{ file: string; testTitle: string; }>; summary: { total: number; passed: number; failed: number; skipped: number; duration: number; }; timestamp: string; } /** * Cache API client for submitting test metadata to TestDino */ export declare class CacheApiClient { private readonly baseUrl; private readonly apiKey; constructor(config: Config); /** * Submit cache data to TestDino API with retry logic */ submitCacheData(payload: CachePayload): Promise<CacheSubmissionResponse>; /** * Single attempt to submit cache data */ private submitCacheDataAttempt; /** * Headers for API requests */ private getHeaders; /** * Handle HTTP error responses */ private handleHttpError; /** * Parse and validate API response */ private parseResponse; /** * Test if cache API endpoint is available (health check) */ testCacheEndpoint(): Promise<boolean>; /** * Mock cache submission for development/testing */ mockCacheSubmission(payload: CachePayload): Promise<CacheSubmissionResponse>; /** * Retrieve cache data for a specific cache ID */ retrieveCache(options: CacheRetrievalOptions): Promise<CacheRetrievalResponse>; /** * Handle retrieval errors with appropriate messages */ private handleRetrievalError; /** * Get cache data for specific cache ID (simplified for last-failed command) */ getCacheData(cacheId: string, options?: { branch?: string; commit?: string; shard?: number; }): Promise<{ cacheId: string; failures: Array<{ file: string; testTitle: string; }>; branch: string; repository: string; } | null>; /** * Get latest cache data (with optional branch filter) */ getLatestCacheData(branch?: string): Promise<{ cacheId: string; failures: Array<{ file: string; testTitle: string; }>; branch: string; repository: string; } | null>; } //# sourceMappingURL=cache-api.d.ts.map