Skip to main content
Version: Current

StreamStats

@rotorsoft/act-root


@rotorsoft/act-root / act/src / StreamStats

Type Alias: StreamStats<E>

StreamStats<E> = object

Defined in: libs/act/src/types/ports.ts:387

Per-stream aggregated stats returned by Store.query_stats.

head and tail follow the git-log convention, not the Unix head/tail convention:

  • head — the latest event (highest id), always present.
  • tail — the earliest event (lowest id), opt-in via QueryStatsOptions.tail.

head/tail never carry pii. query_stats is an operator-introspection surface with no actor context and no disclosure gate, so — like any un-gated read — it omits the pii sidecar on every adapter. Route pii through load (gated) instead.

Type Parameters​

E​

E extends Schemas = Schemas

Event schemas; defaults to Schemas when the caller does not narrow.

Properties​

count?​

readonly optional count?: number

Defined in: libs/act/src/types/ports.ts:390

Total non-excluded event count for the stream, when options.count is true.


readonly head: Committed<E, keyof E>

Defined in: libs/act/src/types/ports.ts:388

Latest non-excluded event for the stream.


names?​

readonly optional names?: Readonly<Partial<Record<EventName<E>, number>>>

Defined in: libs/act/src/types/ports.ts:391

Sparse map of event name → count of events with that name, when options.names is true. Keys are typed as EventName<E> so typos on lookup (e.g. stats.names?.["TicktOpened"]) fail at compile time when the caller narrows E. Empty object never returned — a stream with no matching events is absent from the result map entirely.


tail?​

readonly optional tail?: Committed<E, keyof E>

Defined in: libs/act/src/types/ports.ts:389

Earliest non-excluded event for the stream, when options.tail is true.