export class HerokuEndpointResolver { private static totalEndpoints = 2 ; private static patternId = "${id}" ; public static resolve ( url ) { const now = new Date ( ) ; const endPointId = HerokuEndpointResolver . endPointID ( HerokuEndpointResolver . totalEndpoints , now ) ; return url . replace ( HerokuEndpointResolver . patternId , ( "0" + endPointId ) . slice ( - 2 ) ) ; } private static endPointID ( serversInCluster , date ) { const worldHour = date . getUTCHours ( ) ; return Math . floor ( worldHour / ( 24 / serversInCluster ) ) + 1 ; } }