GraphReFlyTS

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

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.

Returns

A CqrsProjection<TState> value.

Example

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

Source

packages/ts/src/cqrs/index.ts