import 'reflect-metadata'; import type { Constructor } from '@cratis/fundamentals'; /** * Makes a reactor or reducer method a batch method and declares one event type it observes. Apply it once per event * type; it is the TypeScript equivalent of the C# `[Observes]` attribute. * * A batch method receives an {@link EventBatch} of every event of the types it observes, in sequence order, and a * {@link BatchContext} describing the page. Each event type reaches exactly one method of an observer: a batch method * or a per-event method, never both. * * @param eventType - The event constructor observed by this method. The event type must be registered with the owning event store. * @returns A method decorator for legacy and standard TypeScript decorators. * * @example * ```typescript * @reactor() * class Users { * @observes(UserRegistered) * @observes(UserRenamed) * async index(batch: EventBatch, context: BatchContext): Promise { * // ... * } * } * ``` */ export declare function observes(eventType: Constructor): MethodDecorator & ((value: Function, context: ClassMethodDecoratorContext) => void); /** * Gets the event constructors a batch method observes, without inheriting metadata. * @param method - The method. * @returns The observed event constructors, or an empty array when the method is not a batch method. */ export declare function getObservedEventTypes(method: Function): readonly Constructor[]; /** * Checks whether a method is a batch method, that is decorated with {@link observes}. * @param method - The method. * @returns True when it is a batch method. */ export declare function isBatchMethod(method: Function): boolean; //# sourceMappingURL=observes.d.ts.map