This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { blue, bold, cyan, green, yellow } from 'kleur'; | |
import { clear, log } from 'node:console'; | |
import { createReadStream } from 'node:fs'; | |
import { join } from 'node:path'; | |
import { PassThrough, Readable } from 'node:stream'; | |
clear(); | |
// const path = join(__dirname, '../files/13KB.pdf'); | |
// const path = join(__dirname, '../files/1MB.pdf'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compose a projection. | |
// - Tell what type of state the projection maintains (List<WizardActivity>) | |
var projection = Compose<List<WizardActivity>>.Projection() | |
.Initialize(() => new List<WizardActivity>()) // How do you want to initialize the state when you run the projection? | |
// When a wizard was started we want to know about it. | |
.When<WizardStarted>((@event, state) => | |
{ | |
var activity = new WizardActivity(@event.CorrelationId.Value, @event.TimeStamp); | |
if (!state.Contains(activity)) | |
state.Add(activity); |