docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a batch processing utility that fetches data from multiple API endpoints simultaneously and reports on the success or failure of each request.
Your utility should accept a list of API endpoint configurations and process all requests concurrently, tracking which ones succeed and which ones fail. The processor should:
Accept an array of request configuration objects, where each object contains:
url: The API endpoint URL (string)id: A unique identifier for the request (string)Make concurrent requests to all endpoints
Wait for all requests to complete, regardless of success or failure
Return a structured report containing:
successful: An array of objects with id and data properties for successful requestsfailed: An array of objects with id and error properties for failed requestssummary: An object with successCount and failureCount properties/**
* Processes multiple API requests concurrently and returns a report of results
*
* @param {Array<{url: string, id: string}>} requests - Array of request configurations
* @returns {Promise<{successful: Array, failed: Array, summary: {successCount: number, failureCount: number}}>}
*/
async function processBatch(requests) {
// IMPLEMENTATION HERE
}
module.exports = { processBatch };Provides promise settlement tracking functionality
Provides HTTP request capabilities