SingleStreamProjectionOptions
API reference for SingleStreamProjectionOptions
Interface: SingleStreamProjectionOptions<TDoc, TEvent>
Section titled “Interface: SingleStreamProjectionOptions<TDoc, TEvent>”Options for a single-stream projection. One read model document per stream, tracked by stream position.
Extends
Section titled “Extends”Type Parameters
Section titled “Type Parameters”TDoc
TEvent
Section titled “TEvent”TEvent extends Event
Properties
Section titled “Properties”canHandle
Section titled “canHandle”canHandle:
EventTypeOf<TEvent>[]
Event types this projection handles
evolve()
Section titled “evolve()”evolve: (
document,event) =>TDoc
Pure function: fold an event into the current document state
Parameters
Section titled “Parameters”document
Section titled “document”TDoc
ReadEvent<TEvent>
Returns
Section titled “Returns”TDoc
getDocumentId()?
Section titled “getDocumentId()?”
optionalgetDocumentId: (streamId) =>string
Derive the document key from the stream ID. Default: (streamId) => streamId
Parameters
Section titled “Parameters”streamId
Section titled “streamId”string
Returns
Section titled “Returns”string
initialState()
Section titled “initialState()”initialState: () =>
TDoc
Initial state for a new document
Returns
Section titled “Returns”TDoc
projectionName
Section titled “projectionName”projectionName:
string
Unique name for this projection (used for cursor tracking)
Inherited from
Section titled “Inherited from”InlineProjectionOptions.projectionName
store:
IReadModelStore
Read model store where projected data is written