Hi! ?
For the needs of stellar-oc-multisig I wrote a JavaScript module that enable advanced calls to Horizon. It automatically iterate over pages until a limit, a condition or the end is met. It also accept an optional filtering function which allow for a broad range of complex queries like combining conditions on date, on memo value, on operations type and so on. The valid results are compounded and returned as an array of records.
A 'breaker' function can be passed in order to define a condition that stop the process of fetching new records. As this function iterate over each fetched record, it can also be used to process the records on-the-fly in case waiting for the whole query to resolve is not a desirable option.
The loopcall method take a callbuilder as argument and should work with any type of call. If you want to know more, please check the commented code.
Please let me know about your experience with it. I'm willing to publish it as a npm module if you want me to do so.