What problem does it solve?
Developers extending Webiny's API need a consistent, correct way to react to lifecycle events (before/after create, update, delete) and to define their own domain events without scattering business logic across handlers. This Skill provides the exact implementation pattern, naming conventions, and DI wiring required to do it correctly.
Core Features & Use Cases
- EventHandler Implementation: Build thin before/after event handlers that delegate to injected services or UseCases, with mandatory model filtering for CMS handlers.
- Custom Domain Events: Define event payloads in abstractions.ts, event classes extending DomainEvent in events.ts, and publish them from UseCases via EventPublisher.
- External Event Reactions: Implement handler abstractions from other packages (e.g., EntryAfterDeleteEventHandler) to react to CMS or platform events.
- Use Case: When a CMS entry of model "order" is deleted, implement an EntryAfterDeleteEventHandler that filters by modelId and calls an injected CleanupService to remove related records.
Quick Start
Implement a Webiny EventHandler that reacts after a CMS entry is created for my custom model and delegates the work to an injected service.