Skip to main content

Function: aggregate()

aggregate<T, U>(stream, config): Stream<U>

Defined in: packages/core/src/graph/transforms.ts:81

Fold an array stream into a single value.

const total = aggregate(rowsStream, { fold: (acc, row) => acc + row.score, init: 0, }); // Stream

Takes an array input (one .process() call → one array → one folded output). Streaming / tumbling windows across sourceRowIds are a follow-on — not in this task's scope, since the A4 runtime doesn't model multi-row streams.

Type Parameters

T

T

U

U

Parameters

stream

Stream<readonly T[]>

config

fold

(acc, row) => U

init

U

Returns

Stream<U>