• Generates a URL for fetching JSON data from JDispatcher based on a job ID.

    Parameters

    • jobId: string

      The job ID used to construct the URL, expected to conform to JobIdValidable constraints.

    Returns string

    • The URL pointing to the JSON result for the given job ID.

    getJdispatcherJsonURL

    • Throws an error if the job ID does not match the pattern validation.

    Constructs a URL for JDispatcher JSON results based on the job ID format:

    • Mock job ID 'mock_jobid-I20200317-103136-0485-5599422-np2' returns a static test URL.
    • Job IDs ending in '-np2' use the development server (wwwdev.ebi.ac.uk).
    • Other job IDs (e.g., ending in '-p1m' or '-p2m') use the production server (www.ebi.ac.uk). The tool name is extracted from the first part of the job ID (before the first '-'). Job IDs should ideally match the pattern defined in jobIdDefaults (/([a-z_])-([A-Z0-9])-\d*-\d*-\d*-(np2|p1m|p2m)$/), with a length between 35 and 60 characters.

    JobIdValidable - Interface defining job ID validation constraints.

    // Valid development job ID
    console.log(getJdispatcherJsonURL('ncbiblast-I20200317-103136-0485-5599422-np2'));
    // Outputs: "https://wwwdev.ebi.ac.uk/Tools/services/rest/ncbiblast/result/ncbiblast-I20200317-103136-0485-5599422-np2/json"

    // Valid production job ID
    console.log(getJdispatcherJsonURL('ncbiblast-I20200317-103136-0485-5599422-p1m'));
    // Outputs: "https://www.ebi.ac.uk/Tools/services/rest/ncbiblast/result/ncbiblast-I20200317-103136-0485-5599422-p1m/json"

    // Mock job ID
    console.log(getJdispatcherJsonURL('mock_jobid-I20200317-103136-0485-5599422-np2'));
    // Outputs: "https://raw.githubusercontent.com/ebi-jdispatcher/jdispatcher-viewers/master/src/testdata/ncbiblast.json"