Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.aggregateName = this.name;
}
const publishEvent = ctx => event => {
ctx.broker.broadcast(event.type, event);
};
this.eventStore = createEventStore({
storage: this.storage,
publishEvent: publishEvent(this),
});
if (this.settings.aggregate) {
this.aggregate = this.settings.aggregate;
delete this.settings.aggregate;
this.commandHandler = commandHandler({
eventStore: this.eventStore,
aggregates: [this.aggregate],
// snapshotAdapter
});
this.metadata.aggregate = true;
this.metadata.commands = Object.keys(this.aggregate.commands).map(
name => name
);
this.metadata.projection = Object.keys(this.aggregate.projection).map(
name => name
);
this.metadata.events = Object.keys(this.aggregate.events).map(
name => this.aggregate.events[name]
);
}
},