@arque/core
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -17,4 +17,5 @@ /// <reference types="node" /> | ||
}; | ||
type ExtractEventType<T> = T extends Event<infer TType, unknown> ? TType : never; | ||
export type EventHandler<TEvent extends Event = Event, TState = unknown> = { | ||
type: TEvent['type']; | ||
type: ExtractEventType<TEvent>; | ||
handle(ctx: { | ||
@@ -28,2 +29,8 @@ readonly aggregate: { | ||
}; | ||
export type ProjectionEventHandler<TEvent extends Event = Event, TState = unknown> = { | ||
type: ExtractEventType<TEvent>; | ||
handle(ctx: { | ||
readonly state: TState; | ||
}, event: TEvent): void | Promise<void>; | ||
}; | ||
export type Command<TType extends number = number, TArgs extends Array<unknown> = Array<unknown>> = { | ||
@@ -34,4 +41,5 @@ type: TType; | ||
export type GeneratedEvent<TEvent extends Event> = Pick<TEvent, 'type' | 'body'> & Partial<Pick<TEvent, 'meta'>>; | ||
type ExtractCommandType<T> = T extends Command<infer TType, unknown[]> ? TType : never; | ||
export type CommandHandler<TCommand extends Command = Command, TEvent extends Event = Event, TState = unknown> = { | ||
type: TCommand['type']; | ||
type: ExtractCommandType<TCommand>; | ||
handle(ctx: { | ||
@@ -45,7 +53,2 @@ readonly aggregate: { | ||
}; | ||
export type ProjectionEventHandler<TEvent extends Event = Event, TState = unknown> = { | ||
type: TEvent['type']; | ||
handle(ctx: { | ||
readonly state: TState; | ||
}, event: TEvent): void | Promise<void>; | ||
}; | ||
export {}; |
{ | ||
"name": "@arque/core", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "`arque` core library", | ||
@@ -34,3 +34,3 @@ "author": "ScaleForge", | ||
}, | ||
"gitHead": "639987e593873721588b31f9d1550b6bcb14df12" | ||
"gitHead": "47cbd0b684e2fa261e7ce7ac1c1bdc262c926406" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41768
712