UNPKG

@bitcobblers/wod-wiki-library

Version:

A specialized markdown-like workout syntax editor and runtime for defining workouts

54 lines (53 loc) 1.86 kB
import { ResultSpan } from '../ResultSpan'; import { IResultSpanAggregate } from './IResultSpanAggregate'; /** * Service class for aggregating statistics from ResultSpans using a collection * of IResultSpanAggregate implementations. */ export declare class ResultSpanAggregator { private _aggregators; /** * Creates a new instance of ResultSpanAggregator. * * @param aggregators - Optional initial collection of aggregators */ constructor(aggregators?: IResultSpanAggregate[]); /** * Gets the current collection of aggregators. */ get aggregators(): IResultSpanAggregate[]; /** * Adds an aggregator to the collection. * * @param aggregator - The aggregator to add * @returns This instance for method chaining */ addAggregator(aggregator: IResultSpanAggregate): ResultSpanAggregator; /** * Adds multiple aggregators to the collection. * * @param aggregators - The aggregators to add * @returns This instance for method chaining */ addAggregators(aggregators: IResultSpanAggregate[]): ResultSpanAggregator; /** * Removes an aggregator from the collection by its ID. * * @param id - The ID of the aggregator to remove * @returns This instance for method chaining */ removeAggregator(id: string): ResultSpanAggregator; /** * Clears all aggregators from the collection. * * @returns This instance for method chaining */ clearAggregators(): ResultSpanAggregator; /** * Processes a collection of ResultSpan objects using all registered aggregators. * * @param spans - Collection of ResultSpan objects to aggregate * @returns An object containing all aggregated statistics keyed by aggregator ID */ aggregate(spans: ResultSpan[]): Record<string, any>; }