import { concat, Observable, of } from 'rxjs'; import { ActionStream } from './ActionStream'; import { ReadModelAction } from './ReadModelAction'; export class SimpleActionStream extends Observable implements ActionStream { public static of(events: Action[] = []) { return new this(of(...events)); } constructor(private readonly events$: Observable) { super(events$.subscribe.bind(events$)); } public append(eventstream: ActionStream): this { const combined$ = concat(this.events$, eventstream); return new SimpleActionStream(combined$) as any; } }