domain-objects
Version:
A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.
22 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DomainEvent = void 0;
const DomainObject_1 = require("./DomainObject");
/**
* In Domain Driven Design, an Event is a type of Domain Object for which:
* - properties are immutable (e.g., something happened)
* - identity does matter
* - i.e., it is uniquely identified by what happened and to what
* - i.e., if you change the uniquely identifying properties (when or to what) of an event, it will be considered a new event
* - i.e., not all properties on the event uniquely identify the event
*
* The purpose of a Domain Event is to represent interesting things that happen in the domain.
*
* For example,
* - An `ItemViewedEvent { itemUuid, customerUuid, occurredAt }` is an event. Changing when it `occurredAt` which `customerUuid` did it or which `itemUuid` it happened to would result in a new event.
* - A `PowerSupplyMeasuredEvent { batteryUuid, current, voltage, temperature, occurredAt }` is an event. Changing when it `occurredAt` or which `batteryUuid` it occurred to would result in a new event. Note: changing the `current`, `voltage`, or `temperature` would _not_ result in a new event though, since only one measurement can be made at a time for a `batteryUuid`
*/
class DomainEvent extends DomainObject_1.DomainObject {
}
exports.DomainEvent = DomainEvent;
//# sourceMappingURL=DomainEvent.js.map