Company: Quicksell_13nov
Difficulty: medium
Problem Description Implement an API endpoint that processes a batch of asynchronous tasks sequentially. To replicate the behavior of executing sequential Promises, the endpoint will receive a list of declarative task operations. The server must execute these tasks strictly one after another, waiting for each to complete (including any specified delay) before starting the next. If any task fails or specifies a failure action, the execution sequence must abort immediately, and the endpoint must return an error response. If all tasks succeed, the endpoint should return an array of their execution results, collected in the exact order the tasks were provided. Endpoints POST /api/tasks/run-sequentially Request Format The request body must be a JSON object containing the following properties: initialValue (integer, optional): The starting state/counter for the execution context (defaults to 1 ). tasks (array of objects, required): The list of tasks to execute. Each task object contains: act