projection
@rotorsoft/act-root / act/src / projection
Function: projection()
Call Signatureโ
projection<
TEvents>(target):ProjectionBuilder<TEvents,string>
Defined in: libs/act/src/builders/projection-builder.ts:263
Creates a new projection builder with a static target stream.
All handlers inherit the target resolver automatically. Enables .batch()
for bulk event processing in a single transaction.
Type Parametersโ
TEventsโ
TEvents extends Schemas = { }
Parametersโ
targetโ
string
Static target stream for all handlers
Returnsโ
ProjectionBuilder<TEvents, string>
Call Signatureโ
projection<
TEvents>(target?):object
Defined in: libs/act/src/builders/projection-builder.ts:271
Creates a new projection builder without a default target.
Use per-handler .to() to route events to different streams.
Type Parametersโ
TEventsโ
TEvents extends Schemas = { }
Parametersโ
target?โ
undefined
Returnsโ
buildโ
build: () =>
Projection<TEvents>
Builds and returns the Projection data structure.
Returnsโ
Projection<TEvents>
eventsโ
readonlyevents:EventRegister<TEvents>
The registered event schemas and their reaction maps.
onโ
on: <
TKey,TData>(entry) =>object
Begins defining a projection handler for a specific event.
Pass a { EventName: schema } record โ use shorthand { EventName }
when the variable name matches the event name. The key becomes the
event name, the value the Zod schema.
Type Parametersโ
TKeyโ
TKey extends string
TDataโ
TData extends Schema
Parametersโ
entryโ
EventEntry<TKey, TData>
Returnsโ
object
doโ
do: (
handler) =>DoResult<TEvents,TKey,TData,undefined>
Parametersโ
handlerโ
(event, stream) => Promise<void>
Returnsโ
DoResult<TEvents, TKey, TData, undefined>