import { PlywoodRequester } from 'plywood-base-api' ; import { $ , retryRequesterFactory , verboseRequesterFactory , concurrentLimitRequesterFactory } from 'plywood' ; import { druidRequesterFactory , DruidRequestDecorator } from 'plywood-druid-requester' ; export interface ProperDruidRequesterOptions { druidHost ? : string ; retry ? : number ; timeout ? : number ; verbose ? : boolean ; concurrentLimit ? : number ; requestDecorator ? : DruidRequestDecorator ; socksHost ? : string ; socksUsername ? : string ; socksPassword ? : string ; } export function properDruidRequesterFactory ( options ) { let { druidHost , retry , timeout , verbose , concurrentLimit , requestDecorator , socksHost , socksUsername , socksPassword } = options ; let druidRequester = druidRequesterFactory ( { host : druidHost , timeout : timeout || 30000 , requestDecorator , socksHost , socksUsername , socksPassword } ) ; if ( retry ) { druidRequester = retryRequesterFactory ( { requester : druidRequester , retry : retry , delay : 500 , retryOnTimeout : false } ) ; } if ( verbose ) { druidRequester = verboseRequesterFactory ( { requester : druidRequester } ) ; } if ( concurrentLimit ) { druidRequester = concurrentLimitRequesterFactory ( { requester : druidRequester , concurrentLimit : concurrentLimit } ) ; } return druidRequester ; }