UNPKG

@othree.io/chisel

Version:

Event sourcing made easy

8 lines 868 B
import { CalculateNewState, LoadState } from './event-source'; import { Optional } from '@othree.io/optional'; import { Command, CommandResult, ChiselEvent, InternalTriggeredEvent } from './types'; export type HandleCommand<AggregateRoot> = (state: AggregateRoot, command: Command) => Promise<Optional<ChiselEvent | Array<ChiselEvent>>>; export type PublishEvent<AggregateRoot> = (event: InternalTriggeredEvent, state: AggregateRoot) => Promise<Optional<boolean>>; export type Handle<AggregateRoot> = (command: Command) => Promise<Optional<CommandResult<AggregateRoot>>>; export declare const handle: <AggregateRoot>(loadState: LoadState<AggregateRoot>) => (handleCommand: HandleCommand<AggregateRoot>) => (calculateNewState: CalculateNewState<AggregateRoot>) => (publishEvent: PublishEvent<AggregateRoot>) => Handle<AggregateRoot>; //# sourceMappingURL=actor.d.ts.map