@itzworking/events-manager 0.0.111 → 0.0.113
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.
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itzworking/events-manager",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.113",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@aws-sdk/client-eventbridge": "3.x",
|
|
9
|
-
"@itzworking/decorated-class": "0.0.
|
|
10
|
-
"@itzworking/powertools": "0.0.
|
|
9
|
+
"@itzworking/decorated-class": "0.0.113",
|
|
10
|
+
"@itzworking/powertools": "0.0.113",
|
|
11
11
|
"uuid": "10.x"
|
|
12
12
|
},
|
|
13
13
|
"type": "commonjs",
|
|
@@ -2,6 +2,6 @@ import { DecoratedClass } from "@itzworking/decorated-class";
|
|
|
2
2
|
import { ApplicationEventDetailMetadata } from "./application-event-detail-metadata";
|
|
3
3
|
export declare class ApplicationEventDetail<T extends DecoratedClass> extends DecoratedClass {
|
|
4
4
|
metadata: ApplicationEventDetailMetadata;
|
|
5
|
-
|
|
5
|
+
data?: T;
|
|
6
6
|
constructor(props?: any);
|
|
7
7
|
}
|
|
@@ -7,7 +7,9 @@ const application_event_detail_metadata_1 = require("./application-event-detail-
|
|
|
7
7
|
class ApplicationEventDetail extends decorated_class_1.DecoratedClass {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
|
-
|
|
10
|
+
if (!(props === null || props === void 0 ? void 0 : props.metadata)) {
|
|
11
|
+
this.metadata = new application_event_detail_metadata_1.ApplicationEventDetailMetadata(props === null || props === void 0 ? void 0 : props.metadata);
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
exports.ApplicationEventDetail = ApplicationEventDetail;
|
|
@@ -21,5 +23,5 @@ tslib_1.__decorate([
|
|
|
21
23
|
tslib_1.__decorate([
|
|
22
24
|
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.Object),
|
|
23
25
|
tslib_1.__metadata("design:type", Object)
|
|
24
|
-
], ApplicationEventDetail.prototype, "
|
|
26
|
+
], ApplicationEventDetail.prototype, "data", void 0);
|
|
25
27
|
//# sourceMappingURL=application-event-detail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-event-detail.js","sourceRoot":"","sources":["../../../../libs/events-manager/src/application-event-detail.ts"],"names":[],"mappings":";;;;AAAA,iEAKqC;AACrC,2FAAqF;AAErF,MAAa,sBAEX,SAAQ,gCAAc;IAUtB,YAAY,KAAW;QACrB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,IAAI,kEAA8B,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"application-event-detail.js","sourceRoot":"","sources":["../../../../libs/events-manager/src/application-event-detail.ts"],"names":[],"mappings":";;;;AAAA,iEAKqC;AACrC,2FAAqF;AAErF,MAAa,sBAEX,SAAQ,gCAAc;IAUtB,YAAY,KAAW;QACrB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAA,EAAE,CAAC;YACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,kEAA8B,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;CACF;AAlBD,wDAkBC;AAXC;IAJC,yBAAO;IACP,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,EAAE;QAC/B,UAAU,EAAE,kEAA8B;KAC3C,CAAC;sCACQ,kEAA8B;wDAAC;AAGzC;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,CAAC;;oDACvB"}
|
package/src/events-manager.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare class EventsManagerClass {
|
|
|
4
4
|
readonly eventBusName: string;
|
|
5
5
|
readonly eventSource: string;
|
|
6
6
|
constructor();
|
|
7
|
-
publishEvent<T extends DecoratedClass>(entityClass: new (props?: any) => T, eventName: string,
|
|
7
|
+
publishEvent<T extends DecoratedClass>(entityClass: new (props?: any) => T, eventName: string, data: T): Promise<import("@aws-sdk/client-eventbridge").PutEventsCommandOutput>;
|
|
8
8
|
}
|
|
9
9
|
export declare const EventsManager: EventsManagerClass;
|
|
10
10
|
export {};
|
package/src/events-manager.js
CHANGED
|
@@ -35,14 +35,14 @@ class EventsManagerClass {
|
|
|
35
35
|
eventSource: this.eventSource,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
publishEvent(entityClass, eventName,
|
|
38
|
+
publishEvent(entityClass, eventName, data) {
|
|
39
39
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
powertools_1.logger.debug("Publishing event", {
|
|
41
41
|
eventName,
|
|
42
42
|
entityClass: entityClass.name,
|
|
43
43
|
});
|
|
44
44
|
const applicationEventDetail = new application_event_detail_1.ApplicationEventDetail({
|
|
45
|
-
|
|
45
|
+
data: data instanceof entityClass ? data : new entityClass(data),
|
|
46
46
|
});
|
|
47
47
|
try {
|
|
48
48
|
decorated_class_1.validator.validate(applicationEventDetail);
|