Events
Events are immutable, past-tense facts — the record of something that happened. An event declaration defines the event type’s name and properties. Properties use concepts or primitives.
Syntax
Section titled “Syntax”event <Name> <property> <Type> ...Example
Section titled “Example”event InvoiceRegistered invoiceId InvoiceId customerId CustomerId invoiceNumber InvoiceNumber lines InvoiceLine[] currency CurrencyCode registeredAt DateTime status InvoiceStatusType modifiers
Section titled “Type modifiers”| Modifier | Syntax | Example |
|---|---|---|
| Collection | <Type>[] | lines InvoiceLine[] |
| Optional | <Type>? | note String? |
Guidance
Section titled “Guidance”- Name events in the past tense and make them self-describing:
InvoiceRegistered, neverCreated. - One purpose per event. If an event needs a nullable property to cover two situations, model the second situation as its own event.
- Compliance is inherited. A property typed with a
@piiconcept is PII — nothing extra to declare on the event. - The event-source identity is not an event property; it travels in the event context. Commands bind it when they produce events.