EventLog
Client
makeClient
Added in v1.0.0
Source
Signature
declare function makeClient<Groups extends Any>(schema: EventLogSchema<Groups>): Effect<<Tag extends string>(event: Tag, payload: Type<PayloadSchema<Extract<Events<Groups>, { readonly tag: Tag;}>>>) => Effect<Type<SuccessSchema<Extract<Events<Groups>, { readonly tag: Tag;}>>>, EventJournalError | Type<ErrorSchema<Extract<Events<Groups>, { readonly tag: Tag;}>>>>, never, EventLog>Compaction
groupCompaction
Added in v1.0.0
Source
Signature
declare function groupCompaction<Events extends Any, R>(group: EventGroup<Events>, effect: (options: { readonly entries: Array<Entry>; readonly events: Array<TaggedPayload<Events>>; readonly primaryKey: string; readonly write: <Tag extends string>(tag: Tag, payload: Type<PayloadSchema<Extract<Events, { readonly tag: Tag; }>>>) => Effect<void>;}) => Effect<void, never, R>): Layer<never, never, EventJournal | R | Identity | Context<Events>>Handlers
Signature
declare function group<Events extends Any, Return>(group: EventGroup<Events>, f: (handlers: Handlers<never, Events>) => ValidateReturn<Return>): Layer<ToService<Events>, Error<Return>, Exclude<Context<Return>, Scope>>Represents a handled EventGroup.
Signature
interface Handlers<R, Events extends Event.Any = never> extends Pipeable { readonly [HandlersTypeId]: { _Endpoints: Covariant<Events>; }; readonly context: Context<any>; readonly group: AnyWithProps; readonly handlers: Record.ReadonlyRecord<string, Handlers.Item<R>>; handle<Tag extends string, R1>(name: Tag, handler: (options: { readonly conflicts: Array<{ readonly entry: Entry; readonly payload: Type<PayloadSchema<Extract<Events, { readonly tag: Tag; }>>>; }>; readonly entry: Entry; readonly payload: Type<PayloadSchema<Extract<Events, { readonly tag: Tag; }>>>; }) => Effect<Type<SuccessSchema<Extract<Events, { readonly tag: Tag; }>>>, Type<ErrorSchema<Extract<Events, { readonly tag: Tag; }>>>, R1>): Handlers<R | R1, Exclude<Events, { readonly tag: Tag; }>>;}HandlersTypeId
Added in v1.0.0
Source
Signature
declare const HandlersTypeId: unique symbolHandlersTypeId type
Added in v1.0.0
Source
Signature
type HandlersTypeId = typeof HandlersTypeIdLayers
Signature
declare function layer<Groups extends Any>(_schema: EventLogSchema<Groups>): Layer<EventLog, never, EventJournal | Identity | ToService<Groups>>layerEventLog
Added in v1.0.0
Source
Signature
declare const layerEventLog: Layer.Layer<EventLog, never, EventJournal | Identity>layerIdentityKvs
Added in v1.0.0
Source
Generates a random Identity and stores it in a KeyValueStore.
Signature
declare function layerIdentityKvs(options: { readonly key: string;}): Layer<Identity, any, KeyValueStore>Signature
declare class Registry extends any { constructor(); static layer: Layer<unknown, never, never>;}Reactivity
groupReactivity
Added in v1.0.0
Source
Signature
declare function groupReactivity<Events extends Any>(group: EventGroup<Events>, keys: readonly Array<string> | { [Tag in string]: readonly Array<string> }): Layer<never, never, EventJournal | Identity>Schema
EventLogSchema interface
Added in v1.0.0
Source
Signature
interface EventLogSchema<Groups extends EventGroup.Any> { constructor(_: never); readonly [SchemaTypeId]: typeof SchemaTypeId; readonly groups: readonly Array<Groups>;}isEventLogSchema
Added in v1.0.0
Source
Signature
declare function isEventLogSchema(u: unknown): u is EventLogSchema<any>Signature
declare function schema<Groups extends readonly Array<Any>>(...groups: Groups): EventLogSchema<Groups[number]>SchemaTypeId
Added in v1.0.0
Source
Signature
declare const SchemaTypeId: unique symbolSchemaTypeId type
Added in v1.0.0
Source
Signature
type SchemaTypeId = typeof SchemaTypeId