-
v7.18.0 Stable
released this
2026-02-17 01:58:31 +01:00 | 389 commits to main since this releaseAggregation Engine
New write-time incremental aggregation engine for analytics and financial reporting.
Features
- Aggregation operations: SUM, COUNT, AVG, MIN, MAX with GROUP BY
- Time windows: Hour, day, week, month, quarter, year, and custom intervals (ISO 8601)
- Write-time incremental: O(1) read performance — running totals maintained on every add/update/delete
- Unified API:
brain.find({ aggregate: 'name' })integrates with the existing query system - Materialization: Aggregate results auto-materialized as
NounType.Measuremententities, visible in OData, Sheets, SSE, and webhooks - Plugin acceleration:
'aggregation'provider key for native plugin implementations - Persistence: Definitions and state survive restarts; definition changes auto-detected via hash comparison
API
brain.defineAggregate({ name: 'monthly_spending', source: { type: NounType.Event, where: { domain: 'financial' } }, groupBy: ['category', { field: 'date', window: 'month' }], metrics: { total: { op: 'sum', field: 'amount' }, count: { op: 'count' }, average: { op: 'avg', field: 'amount' } } }) const results = await brain.find({ aggregate: 'monthly_spending', where: { category: 'food' } })New Exports
AggregationIndex,AggregateMaterializer,AggregateDefinition,AggregateMetricDef,AggregateSource,AggregateQueryParams,AggregateResult,AggregationOp,TimeWindowGranularity,GroupByDimension,AggregationProvider,MetricState,AggregateGroupStateDownloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads