@punks/backend-entity-manager 0.0.225 → 0.0.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,11 @@ import { EntityServiceLocator } from "../providers/services";
|
|
|
3
3
|
export declare class EntityEventsManager<TEntity, TEntityId> implements IEntityEventsManager<TEntity, TEntityId> {
|
|
4
4
|
private readonly entityName;
|
|
5
5
|
private readonly services;
|
|
6
|
+
private readonly logger;
|
|
6
7
|
constructor(entityName: string, services: EntityServiceLocator<TEntity, TEntityId>);
|
|
7
8
|
processEntityCreatedEvent(entity: TEntity): Promise<void>;
|
|
8
9
|
processEntityUpdatedEvent(entity: TEntity): Promise<void>;
|
|
9
10
|
processEntityDeletedEvent(id: TEntityId): Promise<void>;
|
|
10
11
|
private emitEntityEvent;
|
|
12
|
+
private buildEventName;
|
|
11
13
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -2154,6 +2154,7 @@ class EntityEventsManager {
|
|
|
2154
2154
|
constructor(entityName, services) {
|
|
2155
2155
|
this.entityName = entityName;
|
|
2156
2156
|
this.services = services;
|
|
2157
|
+
this.logger = Log.getLogger("EntityEventsManager");
|
|
2157
2158
|
}
|
|
2158
2159
|
async processEntityCreatedEvent(entity) {
|
|
2159
2160
|
this.services.resolveReplicaSyncManager().syncReplicas(entity);
|
|
@@ -2181,7 +2182,11 @@ class EntityEventsManager {
|
|
|
2181
2182
|
if (!eventEmitter) {
|
|
2182
2183
|
return;
|
|
2183
2184
|
}
|
|
2184
|
-
|
|
2185
|
+
this.logger.debug(`Event emitted: ${this.buildEventName(event)}`, payload);
|
|
2186
|
+
await eventEmitter.emit(this.buildEventName(event), payload);
|
|
2187
|
+
}
|
|
2188
|
+
buildEventName(event) {
|
|
2189
|
+
return `${this.entityName}.${event}`;
|
|
2185
2190
|
}
|
|
2186
2191
|
}
|
|
2187
2192
|
|