Skip to content

SingleStreamProjectionOptions

API reference for SingleStreamProjectionOptions

@delta-base/toolkit


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.

TDoc

TEvent extends Event

canHandle: EventTypeOf<TEvent>[]

Event types this projection handles


evolve: (document, event) => TDoc

Pure function: fold an event into the current document state

TDoc

ReadEvent<TEvent>

TDoc


optional getDocumentId: (streamId) => string

Derive the document key from the stream ID. Default: (streamId) => streamId

string

string


initialState: () => TDoc

Initial state for a new document

TDoc


projectionName: string

Unique name for this projection (used for cursor tracking)

InlineProjectionOptions.projectionName


store: IReadModelStore

Read model store where projected data is written

InlineProjectionOptions.store