Skip to content

EventGroup

6 exports Added in v1.0.0 Source

Constructors

empty

Added in v1.0.0 Source

An EventGroup is a collection of Events. You can use an EventGroup to represent a portion of your domain.

The events can be implemented later using the EventLog.group api.

Signature

declare const empty: EventGroup<never>;

Guards

isEventGroup

Added in v1.0.0 Source

Signature

declare function isEventGroup(u: unknown): u is Any;

Models

EventGroup

Added in v1.0.0 Source

EventGroup interface

Added in v1.0.0 Source

An EventGroup is a collection of Events. You can use an EventGroup to represent a portion of your domain.

The events can be implemented later using the EventLogBuilder.group api.

Signature

interface EventGroup<out Events extends Event.Any = never> extends Pipeable {
  constructor(_: never);
  readonly [TypeId]: typeof TypeId;
  readonly events: Record.ReadonlyRecord<string, Events>;
  add<
    Tag extends string,
    Payload extends Any = Void,
    Success extends Any = Void,
    Error extends All = Never,
  >(options: {
    readonly error?: Error;
    readonly payload?: Payload;
    readonly primaryKey: (payload: Type<Payload>) => string;
    readonly success?: Success;
    readonly tag: Tag;
  }): EventGroup<Events | Event<Tag, Payload, Success, Error>>;
  addError<Error extends Any>(error: Error): EventGroup<AddError<Events, Error>>;
}

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;