API Reference
cqrsProjection()
Derive a projection from declared CQRS event deps. Reducer failures become graph-visible error DATA facts on the returned errors node.
Import
import { cqrsProjection } from "@graphrefly/ts/cqrs";
Signature
function cqrsProjection(
graph: Graph,
source: Pick<CqrsBundle<unknown, TEvent>, "events">,
opts: CqrsProjectionOptions<TState, TEvent>,
): CqrsProjection<TState>
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
A CqrsProjection<TState> value.
Example
import { cqrsProjection } from "@graphrefly/ts/cqrs";
Source
packages/ts/src/cqrs/index.ts