Time series property - how to efficiently count number of data points in Typescript?

I am writing a ts function to populate a column in an object table. This function needs to return the number of elements between Timestamp start and end in my timeseries property foo.

Is there a way to calculate this count using a server side function?

Detail:
The NumericTimeSeriesAggregations type that is returned by calling aggregate on a TSP only defines one function - mean, via NumericTimeSeriesAggregationResult.

So the only way I’ve found of doing this is the following:

const allPointsArray = await obj.foo.timeRange({ min: start, max: end }).points().all(); 
const count = allPointsArray.length;

This times out for anything except a small number of objects and a small date range. The return type of overEntireRange is the same so the time range limitation doesn’t change things. The python API also makes me bring back all the data as a dataframe (same problem).