MCPcopy Create free account
hub / github.com/CodeForBreakfast/eventsourcing / processListProjection

Function processListProjection

examples/todo-app/src/cli.ts:202–213  ·  view source on GitHub ↗
(projection: Readonly<Projection<TodoListProjection>>)

Source from the content-addressed store, hash-verified

200 );
201
202const processListProjection = (projection: Readonly<Projection<TodoListProjection>>) => {
203 const list = pipe(
204 projection.data,
205 Option.getOrElse(() => ({ todos: [] as const }))
206 );
207
208 return handleConditional(
209 list.todos,
210 formatTodoList(list.todos),
211 Console.log('No TODOs yet. Create one with: bun run src/cli.ts create "My task"')
212 );
213};
214
215const listTodos = () => pipe(loadTodoListProjection(), Effect.flatMap(processListProjection));
216

Callers

nothing calls this directly

Calls 2

handleConditionalFunction · 0.70
formatTodoListFunction · 0.70

Tested by

no test coverage detected