QueryStatsOptions
@rotorsoft/act-root / act/src / QueryStatsOptions
Type Alias: QueryStatsOptions<E>
QueryStatsOptions<
E> =object
Defined in: libs/act/src/types/ports.ts:369
Options for Store.query_stats. All stat fields default to
false except head, which is always returned.
Cost model: With no opt-in flags (or tail alone), each requested
stat resolves via an index-backed lookup โ O(K) cost where K is the
number of matched streams. Setting count and/or names triggers a
full event scan over the matched streams (O(N) where N is total events);
both share the same scan and so requesting one is the same cost as
requesting both.
Type Parametersโ
Eโ
Event schemas; defaults to Schemas. When the caller
narrows E, exclude is type-checked against the schema's event names
โ typos like ["TOMBSTON_EVENT"] fail at compile time.
Propertiesโ
after?โ
readonlyoptionalafter?:string
Defined in: libs/act/src/types/ports.ts:375
Keyset pagination cursor: return only streams whose
name sorts strictly after this value (lexicographic). Pass the last
stream name from the previous page to fetch the next. Pairs with
limit; the result Map preserves stream-name order so the next
cursor is [...result.keys()].at(-1).
before?โ
readonlyoptionalbefore?:number
Defined in: libs/act/src/types/ports.ts:374
Time-travel cutoff: only consider events with
id < before. Omitted = current state. Useful for "what did this
stream look like at event N?" historical queries without changing
the call shape. Cheap on both code paths (cheap-heads path narrows
the index scan; full-scan path adds a WHERE id < ? predicate).
count?โ
readonlyoptionalcount?:boolean
Defined in: libs/act/src/types/ports.ts:371
Include the total non-excluded event count per stream. Triggers full scan.
exclude?โ
readonlyoptionalexclude?:ReadonlyArray<EventName<E>>
Defined in: libs/act/src/types/ports.ts:373
Event names to skip โ e.g.
[TOMBSTONE_EVENT, SNAP_EVENT] to ignore framework markers. Applies
to all returned stats (head, tail, count, names) consistently.
limit?โ
readonlyoptionallimit?:number
Defined in: libs/act/src/types/ports.ts:376
Maximum number of streams to return. Defaults to
unbounded (every matching stream) โ unlike QueryStreams.limit,
which defaults to 100. Omitting it preserves the historical
"return everything" behavior; set it (with after) to page through
large stream sets a bounded chunk at a time.
names?โ
readonlyoptionalnames?:boolean
Defined in: libs/act/src/types/ports.ts:372
Include a name โ count map per stream. Triggers
full scan (shares cost with count).
tail?โ
readonlyoptionaltail?:boolean
Defined in: libs/act/src/types/ports.ts:370
Include the earliest non-excluded event per stream.
Cheap when alone (indexed); free when count/names also set
(already scanning).