Skip to content
Effect Days 2026 Get your ticket

Event

7 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

Signature

declare function make<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;
}): Event<Tag, Payload, Success, Error>

Guards

isEvent

Added in v1.0.0 Source

Signature

declare function isEvent(u: unknown): u is Event<any, any, any, any>

Models

Event

Added in v1.0.0 Source

Event interface

Added in v1.0.0 Source

Represents an event in an EventLog.

Signature

interface Event<out Tag extends string, in out Payload extends Schema.Schema.Any = typeof Schema.Void, in out Success extends Schema.Schema.Any = typeof Schema.Void, in out Error extends Schema.Schema.All = typeof Schema.Never> {
readonly [TypeId]: typeof TypeId;
readonly error: Error;
readonly payload: Payload;
readonly payloadMsgPack: schema<Payload>;
readonly primaryKey: (payload: Type<Payload>) => string;
readonly success: Success;
readonly tag: Tag;
}

EventHandler interface

Added in v1.0.0 Source

Signature

interface EventHandler<in out Tag extends string> {
readonly _: typeof _;
readonly tag: Tag;
}

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