Skip to content
PACKAGES

cqrsProjection()

Derive a projection from declared CQRS event deps. Reducer failures become graph-visible error DATA facts on the returned errors node.

import { cqrsProjection } from "@graphrefly/ts/cqrs";
function cqrsProjection(
graph: Graph,
source: Pick<CqrsBundle<unknown, TEvent>, "events">,
opts: CqrsProjectionOptions<TState, TEvent>,
): CqrsProjection<TState>
ParameterTypeDescription
graphGraphGraph that owns the created nodes or projector.
sourcePick<CqrsBundle<unknown, TEvent>, "events">Source node that provides graph-visible input.
optsCqrsProjectionOptions<TState, TEvent>Options that configure the helper.

A CqrsProjection<TState> value.

import { cqrsProjection } from "@graphrefly/ts/cqrs";

packages/ts/src/cqrs/index.ts