flexiblepersistence
Version:
A CQRS and Event Sourcing platform
35 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Event = void 0;
const directedEvent_1 = require("./directedEvent");
class Event extends directedEvent_1.DirectedEvent {
getConstructorName(object) {
let name = object.constructor.name;
if (name.includes('_'))
name = name.split('_')[1];
return name;
}
constructor(event) {
super(event);
this.operation = event.operation;
const tempName = event && event.content
? Array.isArray(event.content)
? event.content[0]
? this.getConstructorName(event.content[0])
: undefined
: this.getConstructorName(event.content)
: undefined;
if (tempName)
this.name = tempName;
if (event.name)
this.name = event.name;
}
getOperation() {
return this.operation;
}
getName() {
return this.name;
}
}
exports.Event = Event;
//# sourceMappingURL=event.js.map