Configuration for the schema validation.
A map of event names to standard-schema-compliant schemas.
Compatible with libraries such as Zod, ArkType, Valibot, and others
that implement the StandardSchemaV1 specification.
OptionalshouldValidateListeners?: booleanWhether to validate event data in listener functions when events are received,
in addition to validating on dispatch.
When true, listeners will receive validated event data that conforms to the schema.
A middleware plugin that wraps an IEventBusAdapter.
IMPORT_PATH: "@daiso-tech/core/event-bus/plugins"
Creates a plugin that validates event data against a schema map.
On
dispatch, the event data is validated against the schema associated with the event name in the providedeventMapSchema. If no schema is defined for the event name, the data passes through without validation.When
shouldValidateListenersistrue(default), listener functions are also wrapped to validate event data before it reaches the listener. A WeakMap is used to track original-to-wrapped listener mappings so thatremoveListenercorrectly removes the wrapped listener.