@event-nest/core 0.0.3 → 1.0.0
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/README.md +7 -7
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -97,8 +97,8 @@ import { AggregateRoot, AggregateRootName, EventProcessor, StoredEvent } from "@
|
|
|
97
97
|
|
|
98
98
|
@AggregateRootName("User")
|
|
99
99
|
export class User extends AggregateRoot {
|
|
100
|
-
private
|
|
101
|
-
private
|
|
100
|
+
private name: string;
|
|
101
|
+
private email: string;
|
|
102
102
|
|
|
103
103
|
private constructor(id: string) {
|
|
104
104
|
super(id);
|
|
@@ -126,13 +126,13 @@ export class User extends AggregateRoot {
|
|
|
126
126
|
|
|
127
127
|
@EventProcessor(UserCreatedEvent)
|
|
128
128
|
private processUserCreatedEvent = (event: UserCreatedEvent) => {
|
|
129
|
-
this.
|
|
130
|
-
this.
|
|
129
|
+
this.name = event.name;
|
|
130
|
+
this.email = event.email;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
@EventProcessor(UserUpdatedEvent)
|
|
134
134
|
private processUserUpdatedEvent = (event: UserUpdatedEvent) => {
|
|
135
|
-
this.
|
|
135
|
+
this.name = event.newName;
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
}
|
|
@@ -203,12 +203,12 @@ import { AggregateRootAwareEvent, DomainEventSubscription, OnDomainEvent } from
|
|
|
203
203
|
@Injectable()
|
|
204
204
|
@DomainEventSubscription(UserCreatedEvent, UserUpdatedEvent)
|
|
205
205
|
export class UserEventSubscription implements OnDomainEvent<UserCreatedEvent | UserUpdatedEvent> {
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
onDomainEvent(event: AggregateRootAwareEvent<UserCreatedEvent | UserUpdatedEvent>): Promise<unknown> {
|
|
208
208
|
//Here you can create/update your read model based on the event and your custom logic.
|
|
209
209
|
return Promise.resolve(undefined);
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
}
|
|
213
213
|
```
|
|
214
214
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-nest/core",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Nick Tsitlakidis",
|
|
6
6
|
"description": "Event sourcing module for NestJS. It provides a set of decorators and interfaces to help you build your event sourcing application.",
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
"cqrs",
|
|
11
11
|
"ddd"
|
|
12
12
|
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/NickTsitlakidis/event-nest.git"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">= 16"
|
|
19
|
+
},
|
|
13
20
|
"type": "commonjs",
|
|
14
21
|
"peerDependencies": {
|
|
15
22
|
"@nestjs/common": "^9.0.0",
|