cqrsProjection()
Derive a projection from declared CQRS event deps. Reducer failures become
graph-visible error DATA facts on the returned errors node.
Import
Section titled “Import”import { cqrsProjection } from "@graphrefly/ts/cqrs";Signature
Section titled “Signature”function cqrsProjection( graph: Graph, source: Pick<CqrsBundle<unknown, TEvent>, "events">, opts: CqrsProjectionOptions<TState, TEvent>,): CqrsProjection<TState>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
graph | Graph | Graph that owns the created nodes or projector. |
source | Pick<CqrsBundle<unknown, TEvent>, "events"> | Source node that provides graph-visible input. |
opts | CqrsProjectionOptions<TState, TEvent> | Options that configure the helper. |
Returns
Section titled “Returns”A CqrsProjection<TState> value.
Example
Section titled “Example”import { cqrsProjection } from "@graphrefly/ts/cqrs";Source
Section titled “Source”packages/ts/src/cqrs/index.ts