@zeeshan60/event-processor 1.0.12 → 1.0.14
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/dist/ActivityEventHandler.d.ts +5 -4
- package/dist/ActivityEventHandler.d.ts.map +1 -1
- package/dist/ActivityEventHandler.js +14 -1
- package/dist/ActivityLogEvents.d.ts +4 -2
- package/dist/ActivityLogEvents.d.ts.map +1 -1
- package/dist/ActivityLogEvents.js +1 -0
- package/dist/EventProcessorSDK.d.ts +47 -18
- package/dist/EventProcessorSDK.d.ts.map +1 -1
- package/dist/EventProcessorSDK.js +90 -5
- package/dist/FriendEventHandler.d.ts +5 -12
- package/dist/FriendEventHandler.d.ts.map +1 -1
- package/dist/FriendEventHandler.js +71 -60
- package/dist/FriendEvents.d.ts +13 -3
- package/dist/FriendEvents.d.ts.map +1 -1
- package/dist/FriendEvents.js +16 -7
- package/dist/GroupEventHandler.d.ts +8 -7
- package/dist/GroupEventHandler.d.ts.map +1 -1
- package/dist/GroupEventHandler.js +107 -26
- package/dist/GroupEvents.d.ts +15 -3
- package/dist/GroupEvents.d.ts.map +1 -1
- package/dist/GroupEvents.js +25 -13
- package/dist/GroupTransactionEventHandler.d.ts +8 -7
- package/dist/GroupTransactionEventHandler.d.ts.map +1 -1
- package/dist/GroupTransactionEventHandler.js +69 -24
- package/dist/GroupTransactionEvents.d.ts +22 -4
- package/dist/GroupTransactionEvents.d.ts.map +1 -1
- package/dist/GroupTransactionEvents.js +39 -21
- package/dist/ModelChangeEmitter.d.ts +15 -0
- package/dist/ModelChangeEmitter.d.ts.map +1 -0
- package/dist/ModelChangeEmitter.js +31 -0
- package/dist/TransactionEventHandler.d.ts +3 -5
- package/dist/TransactionEventHandler.d.ts.map +1 -1
- package/dist/TransactionEventHandler.js +49 -15
- package/dist/TransactionEvents.d.ts +24 -8
- package/dist/TransactionEvents.d.ts.map +1 -1
- package/dist/TransactionEvents.js +38 -22
- package/dist/UserEventHandler.d.ts +4 -11
- package/dist/UserEventHandler.d.ts.map +1 -1
- package/dist/UserEventHandler.js +86 -61
- package/dist/UserEvents.d.ts +20 -3
- package/dist/UserEvents.d.ts.map +1 -1
- package/dist/UserEvents.js +53 -18
- package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMActivityLogEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMActivityLogModelStore.js +1 -3
- package/dist/__tests__/test-helpers/IMFriendEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMFriendEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMFriendEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts +4 -3
- package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMFriendModelStore.js +10 -3
- package/dist/__tests__/test-helpers/IMGroupEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMGroupEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupModelStore.js +1 -3
- package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.js +1 -3
- package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMTransactionEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMTransactionModelStore.js +1 -3
- package/dist/__tests__/test-helpers/IMUserEventStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMUserEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMUserEventStore.js +1 -3
- package/dist/__tests__/test-helpers/IMUserModelStore.d.ts +3 -3
- package/dist/__tests__/test-helpers/IMUserModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMUserModelStore.js +1 -3
- package/dist/__tests__/test-helpers/MockFirebaseAdapter.d.ts +2 -1
- package/dist/__tests__/test-helpers/MockFirebaseAdapter.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/MockFirebaseAdapter.js +5 -1
- package/dist/client/controllers/FriendController.d.ts +13 -0
- package/dist/client/controllers/FriendController.d.ts.map +1 -0
- package/dist/client/controllers/FriendController.js +133 -0
- package/dist/client/controllers/UserController.d.ts +6 -5
- package/dist/client/controllers/UserController.d.ts.map +1 -1
- package/dist/client/controllers/UserController.js +89 -22
- package/dist/client/handlers/UIEventHandler.d.ts +4 -22
- package/dist/client/handlers/UIEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UIEventHandler.js +59 -38
- package/dist/client/handlers/UIFriendEventHandler.d.ts +6 -6
- package/dist/client/handlers/UIFriendEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UIGroupEventHandler.d.ts +7 -7
- package/dist/client/handlers/UIGroupEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UIGroupTransactionEventHandler.d.ts +7 -7
- package/dist/client/handlers/UIGroupTransactionEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UITransactionEventHandler.d.ts +5 -5
- package/dist/client/handlers/UITransactionEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UIUserEventHandler.d.ts +4 -4
- package/dist/client/handlers/UIUserEventHandler.d.ts.map +1 -1
- package/dist/common/DomainEvents.d.ts +1 -1
- package/dist/common/DomainEvents.d.ts.map +1 -1
- package/dist/common/DomainEvents.js +37 -37
- package/dist/common/Event.d.ts +3 -2
- package/dist/common/Event.d.ts.map +1 -1
- package/dist/common/Model.d.ts.map +1 -1
- package/dist/common/index.d.ts +2 -2
- package/dist/contracts/common/index.d.ts.map +1 -1
- package/dist/contracts/expenses/index.d.ts.map +1 -1
- package/dist/contracts/friends/index.d.ts.map +1 -1
- package/dist/contracts/groups/index.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/shared/index.d.ts.map +1 -1
- package/dist/contracts/transactions/index.d.ts.map +1 -1
- package/dist/contracts/users/index.d.ts +15 -0
- package/dist/contracts/users/index.d.ts.map +1 -0
- package/dist/contracts/users/index.js +2 -0
- package/dist/converters/eventConverter.d.ts +3 -3
- package/dist/converters/eventConverter.d.ts.map +1 -1
- package/dist/converters/eventConverter.js +93 -51
- package/dist/events.d.ts +29 -29
- package/dist/events.d.ts.map +1 -1
- package/dist/index.d.ts +15 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -4
- package/dist/store/ActivityLogEventStore.d.ts +3 -3
- package/dist/store/ActivityLogEventStore.d.ts.map +1 -1
- package/dist/store/ActivityLogEventStore.js +0 -4
- package/dist/store/ActivityLogModelStore.d.ts +6 -6
- package/dist/store/ActivityLogModelStore.d.ts.map +1 -1
- package/dist/store/ActivityLogModelStore.js +0 -5
- package/dist/store/FriendEventStore.d.ts +3 -3
- package/dist/store/FriendEventStore.d.ts.map +1 -1
- package/dist/store/FriendEventStore.js +0 -4
- package/dist/store/FriendModelStore.d.ts +11 -10
- package/dist/store/FriendModelStore.d.ts.map +1 -1
- package/dist/store/FriendModelStore.js +0 -5
- package/dist/store/GroupEventStore.d.ts +3 -3
- package/dist/store/GroupEventStore.d.ts.map +1 -1
- package/dist/store/GroupEventStore.js +0 -4
- package/dist/store/GroupModelStore.d.ts +8 -8
- package/dist/store/GroupModelStore.d.ts.map +1 -1
- package/dist/store/GroupModelStore.js +0 -5
- package/dist/store/GroupTransactionEventStore.d.ts +3 -3
- package/dist/store/GroupTransactionEventStore.d.ts.map +1 -1
- package/dist/store/GroupTransactionEventStore.js +0 -4
- package/dist/store/GroupTransactionModelStore.d.ts +8 -8
- package/dist/store/GroupTransactionModelStore.d.ts.map +1 -1
- package/dist/store/GroupTransactionModelStore.js +0 -5
- package/dist/store/ModelStore.d.ts +5 -5
- package/dist/store/ModelStore.d.ts.map +1 -1
- package/dist/store/ModelStore.js +0 -4
- package/dist/store/TransactionEventStore.d.ts +3 -3
- package/dist/store/TransactionEventStore.d.ts.map +1 -1
- package/dist/store/TransactionEventStore.js +0 -4
- package/dist/store/TransactionModelStore.d.ts +8 -8
- package/dist/store/TransactionModelStore.d.ts.map +1 -1
- package/dist/store/TransactionModelStore.js +0 -5
- package/dist/store/UserEventStore.d.ts +3 -3
- package/dist/store/UserEventStore.d.ts.map +1 -1
- package/dist/store/UserEventStore.js +0 -4
- package/dist/store/UserModelStore.d.ts +9 -9
- package/dist/store/UserModelStore.d.ts.map +1 -1
- package/dist/store/UserModelStore.js +0 -5
- package/dist/utils/splitTypeUtils.d.ts +1 -1
- package/dist/utils/splitTypeUtils.d.ts.map +1 -1
- package/dist/utils/userPathUtils.d.ts +1 -1
- package/dist/utils/userPathUtils.d.ts.map +1 -1
- package/dist/utils/userPathUtils.js +3 -3
- package/package.json +1 -1
- package/dist/adapters/FirebaseAdminAdapter.d.ts +0 -8
- package/dist/adapters/FirebaseAdminAdapter.d.ts.map +0 -1
- package/dist/adapters/FirebaseAdminAdapter.js +0 -21
- package/dist/adapters/FirebaseClientAdapter.d.ts +0 -8
- package/dist/adapters/FirebaseClientAdapter.d.ts.map +0 -1
- package/dist/adapters/FirebaseClientAdapter.js +0 -22
- package/dist/client/handlers/UIActivityEventHandler.d.ts +0 -12
- package/dist/client/handlers/UIActivityEventHandler.d.ts.map +0 -1
- package/dist/client/handlers/UIActivityEventHandler.js +0 -14
- package/dist/common/EventBus.d.ts +0 -12
- package/dist/common/EventBus.d.ts.map +0 -1
- package/dist/common/EventBus.js +0 -26
- package/dist/common/EventBusSingleton.d.ts +0 -4
- package/dist/common/EventBusSingleton.d.ts.map +0 -1
- package/dist/common/EventBusSingleton.js +0 -18
- package/dist/config/environment.d.ts +0 -25
- package/dist/config/environment.d.ts.map +0 -1
- package/dist/config/environment.js +0 -77
- package/dist/controllers/UIEventHandler.d.ts +0 -25
- package/dist/controllers/UIEventHandler.d.ts.map +0 -1
- package/dist/controllers/UIEventHandler.js +0 -50
- package/dist/controllers/UserController.d.ts +0 -9
- package/dist/controllers/UserController.d.ts.map +0 -1
- package/dist/controllers/UserController.js +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupTransactionEvents.d.ts","sourceRoot":"","sources":["../src/GroupTransactionEvents.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"GroupTransactionEvents.d.ts","sourceRoot":"","sources":["../src/GroupTransactionEvents.ts"],"names":[],"mappings":"AACA,OAAO,EACH,qBAAqB,EAExB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAc,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAw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,uBAAwB,YAAW,qBAAqB;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;gBAEpB,KAAK,EAAE,4BAA4B;IAU/C,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,qBAAqB;IAc9C,WAAW,CACP,QAAQ,CAAC,EAAE,KAAK,EAChB,SAAS,CAAC,EAAE,MAAM,GACnB,uBAAuB,GAAG,SAAS;CAyBzC"}
|
|
@@ -5,6 +5,7 @@ const ActivityLogEvents_1 = require("./ActivityLogEvents");
|
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
class GroupTransactionCreated {
|
|
7
7
|
constructor(props) {
|
|
8
|
+
this.eventId = props.eventId;
|
|
8
9
|
this.userId = props.userId;
|
|
9
10
|
this.groupId = props.groupId;
|
|
10
11
|
this.transactionId = props.transactionId;
|
|
@@ -46,10 +47,11 @@ class GroupTransactionCreated {
|
|
|
46
47
|
if (!this.userId) {
|
|
47
48
|
return undefined;
|
|
48
49
|
}
|
|
49
|
-
const actor = actorName ??
|
|
50
|
-
const desc = this.description ??
|
|
50
|
+
const actor = actorName ?? "You";
|
|
51
|
+
const desc = this.description ?? "transaction";
|
|
51
52
|
const logMessage = `${actor} created transaction "${desc}" for ${this.totalAmount} ${this.currency}`;
|
|
52
53
|
return {
|
|
54
|
+
eventId: (0, uuid_1.v4)(),
|
|
53
55
|
userId: this.userId,
|
|
54
56
|
activityByUid: this.createdBy,
|
|
55
57
|
sourceStreamId: this.streamId,
|
|
@@ -67,6 +69,7 @@ class GroupTransactionCreated {
|
|
|
67
69
|
exports.GroupTransactionCreated = GroupTransactionCreated;
|
|
68
70
|
class GroupTransactionDescriptionChanged {
|
|
69
71
|
constructor(props) {
|
|
72
|
+
this.eventId = props.eventId;
|
|
70
73
|
this.userId = props.userId;
|
|
71
74
|
this.description = props.description;
|
|
72
75
|
this.createdAt = props.createdAt;
|
|
@@ -77,7 +80,7 @@ class GroupTransactionDescriptionChanged {
|
|
|
77
80
|
}
|
|
78
81
|
apply(existing) {
|
|
79
82
|
if (!existing) {
|
|
80
|
-
throw new Error(
|
|
83
|
+
throw new Error("GroupTransaction must exist to change description");
|
|
81
84
|
}
|
|
82
85
|
const existingTx = existing;
|
|
83
86
|
return {
|
|
@@ -93,11 +96,12 @@ class GroupTransactionDescriptionChanged {
|
|
|
93
96
|
return undefined;
|
|
94
97
|
}
|
|
95
98
|
const existingTx = existing;
|
|
96
|
-
const actor = actorName ??
|
|
97
|
-
const oldDesc = existingTx.description ??
|
|
98
|
-
const newDesc = this.description ??
|
|
99
|
+
const actor = actorName ?? "You";
|
|
100
|
+
const oldDesc = existingTx.description ?? "transaction";
|
|
101
|
+
const newDesc = this.description ?? "transaction";
|
|
99
102
|
const logMessage = `${actor} changed transaction description from "${oldDesc}" to "${newDesc}"`;
|
|
100
103
|
return {
|
|
104
|
+
eventId: (0, uuid_1.v4)(),
|
|
101
105
|
userId: existingTx.userId,
|
|
102
106
|
activityByUid: this.createdBy,
|
|
103
107
|
sourceStreamId: this.streamId,
|
|
@@ -115,6 +119,7 @@ class GroupTransactionDescriptionChanged {
|
|
|
115
119
|
exports.GroupTransactionDescriptionChanged = GroupTransactionDescriptionChanged;
|
|
116
120
|
class GroupTransactionNotesChanged {
|
|
117
121
|
constructor(props) {
|
|
122
|
+
this.eventId = props.eventId;
|
|
118
123
|
this.userId = props.userId;
|
|
119
124
|
this.notes = props.notes;
|
|
120
125
|
this.createdAt = props.createdAt;
|
|
@@ -125,7 +130,7 @@ class GroupTransactionNotesChanged {
|
|
|
125
130
|
}
|
|
126
131
|
apply(existing) {
|
|
127
132
|
if (!existing) {
|
|
128
|
-
throw new Error(
|
|
133
|
+
throw new Error("GroupTransaction must exist to change notes");
|
|
129
134
|
}
|
|
130
135
|
const existingTx = existing;
|
|
131
136
|
return {
|
|
@@ -141,9 +146,10 @@ class GroupTransactionNotesChanged {
|
|
|
141
146
|
return undefined;
|
|
142
147
|
}
|
|
143
148
|
const existingTx = existing;
|
|
144
|
-
const actor = actorName ??
|
|
149
|
+
const actor = actorName ?? "You";
|
|
145
150
|
const logMessage = `${actor} updated transaction notes`;
|
|
146
151
|
return {
|
|
152
|
+
eventId: (0, uuid_1.v4)(),
|
|
147
153
|
userId: existingTx.userId,
|
|
148
154
|
activityByUid: this.createdBy,
|
|
149
155
|
sourceStreamId: this.streamId,
|
|
@@ -161,6 +167,7 @@ class GroupTransactionNotesChanged {
|
|
|
161
167
|
exports.GroupTransactionNotesChanged = GroupTransactionNotesChanged;
|
|
162
168
|
class GroupTransactionTotalAmountChanged {
|
|
163
169
|
constructor(props) {
|
|
170
|
+
this.eventId = props.eventId;
|
|
164
171
|
this.userId = props.userId;
|
|
165
172
|
this.totalAmount = props.totalAmount;
|
|
166
173
|
this.createdAt = props.createdAt;
|
|
@@ -171,7 +178,7 @@ class GroupTransactionTotalAmountChanged {
|
|
|
171
178
|
}
|
|
172
179
|
apply(existing) {
|
|
173
180
|
if (!existing) {
|
|
174
|
-
throw new Error(
|
|
181
|
+
throw new Error("GroupTransaction must exist to change total amount");
|
|
175
182
|
}
|
|
176
183
|
const existingTx = existing;
|
|
177
184
|
return {
|
|
@@ -187,9 +194,10 @@ class GroupTransactionTotalAmountChanged {
|
|
|
187
194
|
return undefined;
|
|
188
195
|
}
|
|
189
196
|
const existingTx = existing;
|
|
190
|
-
const actor = actorName ??
|
|
197
|
+
const actor = actorName ?? "You";
|
|
191
198
|
const logMessage = `${actor} changed amount from ${existingTx.totalAmount} ${existingTx.currency} to ${this.totalAmount} ${existingTx.currency}`;
|
|
192
199
|
return {
|
|
200
|
+
eventId: (0, uuid_1.v4)(),
|
|
193
201
|
userId: existingTx.userId,
|
|
194
202
|
activityByUid: this.createdBy,
|
|
195
203
|
sourceStreamId: this.streamId,
|
|
@@ -207,6 +215,7 @@ class GroupTransactionTotalAmountChanged {
|
|
|
207
215
|
exports.GroupTransactionTotalAmountChanged = GroupTransactionTotalAmountChanged;
|
|
208
216
|
class GroupTransactionCurrencyChanged {
|
|
209
217
|
constructor(props) {
|
|
218
|
+
this.eventId = props.eventId;
|
|
210
219
|
this.userId = props.userId;
|
|
211
220
|
this.currency = props.currency;
|
|
212
221
|
this.createdAt = props.createdAt;
|
|
@@ -217,7 +226,7 @@ class GroupTransactionCurrencyChanged {
|
|
|
217
226
|
}
|
|
218
227
|
apply(existing) {
|
|
219
228
|
if (!existing) {
|
|
220
|
-
throw new Error(
|
|
229
|
+
throw new Error("GroupTransaction must exist to change currency");
|
|
221
230
|
}
|
|
222
231
|
const existingTx = existing;
|
|
223
232
|
return {
|
|
@@ -233,9 +242,10 @@ class GroupTransactionCurrencyChanged {
|
|
|
233
242
|
return undefined;
|
|
234
243
|
}
|
|
235
244
|
const existingTx = existing;
|
|
236
|
-
const actor = actorName ??
|
|
245
|
+
const actor = actorName ?? "You";
|
|
237
246
|
const logMessage = `${actor} changed currency from ${existingTx.currency} to ${this.currency}`;
|
|
238
247
|
return {
|
|
248
|
+
eventId: (0, uuid_1.v4)(),
|
|
239
249
|
userId: existingTx.userId,
|
|
240
250
|
activityByUid: this.createdBy,
|
|
241
251
|
sourceStreamId: this.streamId,
|
|
@@ -253,6 +263,7 @@ class GroupTransactionCurrencyChanged {
|
|
|
253
263
|
exports.GroupTransactionCurrencyChanged = GroupTransactionCurrencyChanged;
|
|
254
264
|
class GroupTransactionSplitTypeChanged {
|
|
255
265
|
constructor(props) {
|
|
266
|
+
this.eventId = props.eventId;
|
|
256
267
|
this.userId = props.userId;
|
|
257
268
|
this.splitType = props.splitType;
|
|
258
269
|
this.createdAt = props.createdAt;
|
|
@@ -263,7 +274,7 @@ class GroupTransactionSplitTypeChanged {
|
|
|
263
274
|
}
|
|
264
275
|
apply(existing) {
|
|
265
276
|
if (!existing) {
|
|
266
|
-
throw new Error(
|
|
277
|
+
throw new Error("GroupTransaction must exist to change split type");
|
|
267
278
|
}
|
|
268
279
|
const existingTx = existing;
|
|
269
280
|
return {
|
|
@@ -279,9 +290,10 @@ class GroupTransactionSplitTypeChanged {
|
|
|
279
290
|
return undefined;
|
|
280
291
|
}
|
|
281
292
|
const existingTx = existing;
|
|
282
|
-
const actor = actorName ??
|
|
293
|
+
const actor = actorName ?? "You";
|
|
283
294
|
const logMessage = `${actor} changed split type from ${existingTx.splitType} to ${this.splitType}`;
|
|
284
295
|
return {
|
|
296
|
+
eventId: (0, uuid_1.v4)(),
|
|
285
297
|
userId: existingTx.userId,
|
|
286
298
|
activityByUid: this.createdBy,
|
|
287
299
|
sourceStreamId: this.streamId,
|
|
@@ -299,6 +311,7 @@ class GroupTransactionSplitTypeChanged {
|
|
|
299
311
|
exports.GroupTransactionSplitTypeChanged = GroupTransactionSplitTypeChanged;
|
|
300
312
|
class GroupTransactionDateChanged {
|
|
301
313
|
constructor(props) {
|
|
314
|
+
this.eventId = props.eventId;
|
|
302
315
|
this.userId = props.userId;
|
|
303
316
|
this.transactionDate = props.transactionDate;
|
|
304
317
|
this.createdAt = props.createdAt;
|
|
@@ -309,7 +322,7 @@ class GroupTransactionDateChanged {
|
|
|
309
322
|
}
|
|
310
323
|
apply(existing) {
|
|
311
324
|
if (!existing) {
|
|
312
|
-
throw new Error(
|
|
325
|
+
throw new Error("GroupTransaction must exist to change transaction date");
|
|
313
326
|
}
|
|
314
327
|
const existingTx = existing;
|
|
315
328
|
return {
|
|
@@ -325,9 +338,10 @@ class GroupTransactionDateChanged {
|
|
|
325
338
|
return undefined;
|
|
326
339
|
}
|
|
327
340
|
const existingTx = existing;
|
|
328
|
-
const actor = actorName ??
|
|
341
|
+
const actor = actorName ?? "You";
|
|
329
342
|
const logMessage = `${actor} changed transaction date from ${existingTx.transactionDate.toLocaleDateString()} to ${this.transactionDate.toLocaleDateString()}`;
|
|
330
343
|
return {
|
|
344
|
+
eventId: (0, uuid_1.v4)(),
|
|
331
345
|
userId: existingTx.userId,
|
|
332
346
|
activityByUid: this.createdBy,
|
|
333
347
|
sourceStreamId: this.streamId,
|
|
@@ -345,6 +359,7 @@ class GroupTransactionDateChanged {
|
|
|
345
359
|
exports.GroupTransactionDateChanged = GroupTransactionDateChanged;
|
|
346
360
|
class GroupTransactionSplitDetailsChanged {
|
|
347
361
|
constructor(props) {
|
|
362
|
+
this.eventId = props.eventId;
|
|
348
363
|
this.userId = props.userId;
|
|
349
364
|
this.totalAmount = props.totalAmount;
|
|
350
365
|
this.splitType = props.splitType;
|
|
@@ -357,7 +372,7 @@ class GroupTransactionSplitDetailsChanged {
|
|
|
357
372
|
}
|
|
358
373
|
apply(existing) {
|
|
359
374
|
if (!existing) {
|
|
360
|
-
throw new Error(
|
|
375
|
+
throw new Error("GroupTransaction must exist to change split details");
|
|
361
376
|
}
|
|
362
377
|
const existingTx = existing;
|
|
363
378
|
return {
|
|
@@ -375,9 +390,10 @@ class GroupTransactionSplitDetailsChanged {
|
|
|
375
390
|
return undefined;
|
|
376
391
|
}
|
|
377
392
|
const existingTx = existing;
|
|
378
|
-
const actor = actorName ??
|
|
393
|
+
const actor = actorName ?? "You";
|
|
379
394
|
const logMessage = `${actor} updated transaction split details`;
|
|
380
395
|
return {
|
|
396
|
+
eventId: (0, uuid_1.v4)(),
|
|
381
397
|
userId: existingTx.userId,
|
|
382
398
|
activityByUid: this.createdBy,
|
|
383
399
|
sourceStreamId: this.streamId,
|
|
@@ -395,6 +411,7 @@ class GroupTransactionSplitDetailsChanged {
|
|
|
395
411
|
exports.GroupTransactionSplitDetailsChanged = GroupTransactionSplitDetailsChanged;
|
|
396
412
|
class GroupTransactionDeleted {
|
|
397
413
|
constructor(props) {
|
|
414
|
+
this.eventId = props.eventId;
|
|
398
415
|
this.userId = props.userId;
|
|
399
416
|
this.createdAt = props.createdAt;
|
|
400
417
|
this.createdBy = props.createdBy;
|
|
@@ -404,7 +421,7 @@ class GroupTransactionDeleted {
|
|
|
404
421
|
}
|
|
405
422
|
apply(existing) {
|
|
406
423
|
if (!existing) {
|
|
407
|
-
throw new Error(
|
|
424
|
+
throw new Error("GroupTransaction must exist to delete");
|
|
408
425
|
}
|
|
409
426
|
const existingTx = existing;
|
|
410
427
|
return {
|
|
@@ -420,10 +437,11 @@ class GroupTransactionDeleted {
|
|
|
420
437
|
return undefined;
|
|
421
438
|
}
|
|
422
439
|
const existingTx = existing;
|
|
423
|
-
const actor = actorName ??
|
|
424
|
-
const desc = existingTx.description ??
|
|
440
|
+
const actor = actorName ?? "You";
|
|
441
|
+
const desc = existingTx.description ?? "transaction";
|
|
425
442
|
const logMessage = `${actor} deleted transaction "${desc}"`;
|
|
426
443
|
return {
|
|
444
|
+
eventId: (0, uuid_1.v4)(),
|
|
427
445
|
userId: existingTx.userId,
|
|
428
446
|
activityByUid: this.createdBy,
|
|
429
447
|
sourceStreamId: this.streamId,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Model } from "./common/Model";
|
|
2
|
+
import { Subscription, Observable } from "rxjs";
|
|
3
|
+
export interface ModelChange {
|
|
4
|
+
modelType: string;
|
|
5
|
+
model: Model;
|
|
6
|
+
}
|
|
7
|
+
export declare class ModelChangeEmitter {
|
|
8
|
+
private subject;
|
|
9
|
+
subscribe(next: (change: ModelChange) => void, error?: (error: Error) => void): Subscription;
|
|
10
|
+
asObservable(): Observable<ModelChange>;
|
|
11
|
+
emit(modelType: string, model: Model): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
hasListeners(): boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ModelChangeEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelChangeEmitter.d.ts","sourceRoot":"","sources":["../src/ModelChangeEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAW,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEzD,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,OAAO,CAA8B;IAE7C,SAAS,CACL,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,EACnC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAC/B,YAAY;IAIf,YAAY,IAAI,UAAU,CAAC,WAAW,CAAC;IAIvC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAW3C,KAAK,IAAI,IAAI;IAKb,YAAY,IAAI,OAAO;CAG1B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModelChangeEmitter = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
class ModelChangeEmitter {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.subject = new rxjs_1.Subject();
|
|
8
|
+
}
|
|
9
|
+
subscribe(next, error) {
|
|
10
|
+
return this.subject.subscribe({ next, error });
|
|
11
|
+
}
|
|
12
|
+
asObservable() {
|
|
13
|
+
return this.subject.asObservable();
|
|
14
|
+
}
|
|
15
|
+
emit(modelType, model) {
|
|
16
|
+
try {
|
|
17
|
+
this.subject.next({ modelType, model });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error(`Error in ModelChangeEmitter listener for ${modelType}:`, error);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
clear() {
|
|
24
|
+
this.subject.complete();
|
|
25
|
+
this.subject = new rxjs_1.Subject();
|
|
26
|
+
}
|
|
27
|
+
hasListeners() {
|
|
28
|
+
return this.subject.observed;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ModelChangeEmitter = ModelChangeEmitter;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { TransactionModel,
|
|
2
|
-
import {
|
|
3
|
-
import { TransactionEventStore } from '.';
|
|
4
|
-
import { UserModelStore } from '.';
|
|
5
|
-
import { ActivityEventHandler } from './ActivityEventHandler';
|
|
1
|
+
import { TransactionEvent, TransactionEventStore, TransactionModel, TransactionModelStore, UserModelStore } from ".";
|
|
2
|
+
import { ActivityEventHandler } from "./ActivityEventHandler";
|
|
6
3
|
export declare class TransactionEventHandler {
|
|
7
4
|
private modelStore;
|
|
8
5
|
private eventStore;
|
|
9
6
|
private txUserModelStore;
|
|
10
7
|
private activityEventHandler?;
|
|
11
8
|
constructor(modelStore: TransactionModelStore, eventStore: TransactionEventStore, txUserModelStore: UserModelStore, activityEventHandler?: ActivityEventHandler | undefined);
|
|
9
|
+
private shouldSkipSave;
|
|
12
10
|
handleEvent(event: TransactionEvent): Promise<TransactionModel>;
|
|
13
11
|
private createMirrorEvent;
|
|
14
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionEventHandler.d.ts","sourceRoot":"","sources":["../src/TransactionEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TransactionEventHandler.d.ts","sourceRoot":"","sources":["../src/TransactionEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EAEjB,MAAM,GAAG,CAAC;AACX,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAU9D,qBAAa,uBAAuB;IAE5B,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,oBAAoB,CAAC;gBAHrB,UAAU,EAAE,qBAAqB,EACjC,UAAU,EAAE,qBAAqB,EACjC,gBAAgB,EAAE,cAAc,EAChC,oBAAoB,CAAC,EAAE,oBAAoB,YAAA;IAGvD,OAAO,CAAC,cAAc;IAahB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAqCvD,iBAAiB;CAwLlC"}
|
|
@@ -6,6 +6,7 @@ const DomainEvents_1 = require("./common/DomainEvents");
|
|
|
6
6
|
const splitTypeUtils_1 = require("./utils/splitTypeUtils");
|
|
7
7
|
const userPathUtils_1 = require("./utils/userPathUtils");
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
|
+
const EventProcessorSDK_1 = require("./EventProcessorSDK");
|
|
9
10
|
class TransactionEventHandler {
|
|
10
11
|
constructor(modelStore, eventStore, txUserModelStore, activityEventHandler) {
|
|
11
12
|
this.modelStore = modelStore;
|
|
@@ -13,6 +14,13 @@ class TransactionEventHandler {
|
|
|
13
14
|
this.txUserModelStore = txUserModelStore;
|
|
14
15
|
this.activityEventHandler = activityEventHandler;
|
|
15
16
|
}
|
|
17
|
+
shouldSkipSave(existingModel, updatedModel) {
|
|
18
|
+
if (!existingModel) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return (existingModel.streamId === updatedModel.streamId &&
|
|
22
|
+
existingModel.version === updatedModel.version);
|
|
23
|
+
}
|
|
16
24
|
async handleEvent(event) {
|
|
17
25
|
const eventType = event.constructor.name;
|
|
18
26
|
if (!(0, DomainEvents_1.isValidTransactionEventType)(eventType)) {
|
|
@@ -20,26 +28,41 @@ class TransactionEventHandler {
|
|
|
20
28
|
}
|
|
21
29
|
const existingModel = await this.modelStore.getByStreamIdWhereDeletedIsFalse(event.streamId);
|
|
22
30
|
const model = event.apply(existingModel);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
if (!this.shouldSkipSave(existingModel, model)) {
|
|
32
|
+
await this.modelStore.save(model);
|
|
33
|
+
if ((0, EventProcessorSDK_1.isSDKInitialized)()) {
|
|
34
|
+
EventProcessorSDK_1.EventProcessorSDK.getInstance().emitModelChange("TransactionModel", model);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (_1.residence.isClient) {
|
|
38
|
+
await this.eventStore.addEvent(event);
|
|
39
|
+
if (this.activityEventHandler) {
|
|
40
|
+
await this.activityEventHandler.createActivityLog(event, existingModel, model);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
await this.createMirrorEvent(event, model);
|
|
26
45
|
}
|
|
27
|
-
await this.createMirrorEvent(event, model);
|
|
28
46
|
return model;
|
|
29
47
|
}
|
|
30
48
|
async createMirrorEvent(originalEvent, transactionModel) {
|
|
31
49
|
const eventType = originalEvent.constructor.name;
|
|
32
50
|
const recipientUserModel = await this.txUserModelStore.getByStreamId(transactionModel.recipientUserId);
|
|
33
|
-
|
|
51
|
+
(0, userPathUtils_1.getUserEventPath)(recipientUserModel, transactionModel.recipientUserId);
|
|
34
52
|
const existingMirrorModel = await this.modelStore.findByUserAndLogicalTransactionId(transactionModel.recipientUserId, transactionModel.userId, transactionModel.logicalTransactionId);
|
|
35
|
-
const mirrorStreamId = existingMirrorModel
|
|
36
|
-
|
|
53
|
+
const mirrorStreamId = existingMirrorModel
|
|
54
|
+
? existingMirrorModel.streamId
|
|
55
|
+
: (0, uuid_1.v4)();
|
|
56
|
+
const mirrorVersion = existingMirrorModel
|
|
57
|
+
? existingMirrorModel.version + 1
|
|
58
|
+
: 1;
|
|
37
59
|
let mirrorEvent;
|
|
38
60
|
switch (eventType) {
|
|
39
|
-
case
|
|
61
|
+
case "TransactionCreated": {
|
|
40
62
|
const txEvent = originalEvent;
|
|
41
63
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
42
64
|
mirrorEvent = new _1.TransactionCreated({
|
|
65
|
+
eventId: (0, uuid_1.v4)(),
|
|
43
66
|
userId: transactionModel.recipientUserId,
|
|
44
67
|
recipientUserId: transactionModel.userId,
|
|
45
68
|
logicalTransactionId: txEvent.logicalTransactionId,
|
|
@@ -60,9 +83,10 @@ class TransactionEventHandler {
|
|
|
60
83
|
});
|
|
61
84
|
break;
|
|
62
85
|
}
|
|
63
|
-
case
|
|
86
|
+
case "TransactionDeleted": {
|
|
64
87
|
const txEvent = originalEvent;
|
|
65
88
|
mirrorEvent = new _1.TransactionDeleted({
|
|
89
|
+
eventId: (0, uuid_1.v4)(),
|
|
66
90
|
userId: transactionModel.recipientUserId,
|
|
67
91
|
createdAt: txEvent.createdAt,
|
|
68
92
|
createdBy: txEvent.createdBy,
|
|
@@ -72,9 +96,10 @@ class TransactionEventHandler {
|
|
|
72
96
|
});
|
|
73
97
|
break;
|
|
74
98
|
}
|
|
75
|
-
case
|
|
99
|
+
case "DescriptionChanged": {
|
|
76
100
|
const txEvent = originalEvent;
|
|
77
101
|
mirrorEvent = new _1.DescriptionChanged({
|
|
102
|
+
eventId: (0, uuid_1.v4)(),
|
|
78
103
|
userId: transactionModel.recipientUserId,
|
|
79
104
|
description: txEvent.description,
|
|
80
105
|
createdAt: txEvent.createdAt,
|
|
@@ -85,9 +110,10 @@ class TransactionEventHandler {
|
|
|
85
110
|
});
|
|
86
111
|
break;
|
|
87
112
|
}
|
|
88
|
-
case
|
|
113
|
+
case "TotalAmountChanged": {
|
|
89
114
|
const txEvent = originalEvent;
|
|
90
115
|
mirrorEvent = new _1.TotalAmountChanged({
|
|
116
|
+
eventId: (0, uuid_1.v4)(),
|
|
91
117
|
userId: transactionModel.recipientUserId,
|
|
92
118
|
totalAmount: txEvent.totalAmount,
|
|
93
119
|
createdAt: txEvent.createdAt,
|
|
@@ -98,10 +124,11 @@ class TransactionEventHandler {
|
|
|
98
124
|
});
|
|
99
125
|
break;
|
|
100
126
|
}
|
|
101
|
-
case
|
|
127
|
+
case "SplitTypeChanged": {
|
|
102
128
|
const txEvent = originalEvent;
|
|
103
129
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
104
130
|
mirrorEvent = new _1.SplitTypeChanged({
|
|
131
|
+
eventId: (0, uuid_1.v4)(),
|
|
105
132
|
userId: transactionModel.recipientUserId,
|
|
106
133
|
splitType: (0, splitTypeUtils_1.reverseSplitType)(txEvent.splitType),
|
|
107
134
|
totalAmount: txEvent.totalAmount,
|
|
@@ -115,9 +142,10 @@ class TransactionEventHandler {
|
|
|
115
142
|
});
|
|
116
143
|
break;
|
|
117
144
|
}
|
|
118
|
-
case
|
|
145
|
+
case "CurrencyChanged": {
|
|
119
146
|
const txEvent = originalEvent;
|
|
120
147
|
mirrorEvent = new _1.CurrencyChanged({
|
|
148
|
+
eventId: (0, uuid_1.v4)(),
|
|
121
149
|
userId: transactionModel.recipientUserId,
|
|
122
150
|
currency: txEvent.currency,
|
|
123
151
|
createdAt: txEvent.createdAt,
|
|
@@ -128,9 +156,10 @@ class TransactionEventHandler {
|
|
|
128
156
|
});
|
|
129
157
|
break;
|
|
130
158
|
}
|
|
131
|
-
case
|
|
159
|
+
case "TransactionDateChanged": {
|
|
132
160
|
const txEvent = originalEvent;
|
|
133
161
|
mirrorEvent = new _1.TransactionDateChanged({
|
|
162
|
+
eventId: (0, uuid_1.v4)(),
|
|
134
163
|
userId: transactionModel.recipientUserId,
|
|
135
164
|
transactionDate: txEvent.transactionDate,
|
|
136
165
|
createdAt: txEvent.createdAt,
|
|
@@ -146,7 +175,12 @@ class TransactionEventHandler {
|
|
|
146
175
|
}
|
|
147
176
|
await this.eventStore.addEvent(mirrorEvent);
|
|
148
177
|
const updatedModel = mirrorEvent.apply(existingMirrorModel);
|
|
149
|
-
|
|
178
|
+
if (!this.shouldSkipSave(existingMirrorModel, updatedModel)) {
|
|
179
|
+
await this.modelStore.save(updatedModel);
|
|
180
|
+
if ((0, EventProcessorSDK_1.isSDKInitialized)()) {
|
|
181
|
+
EventProcessorSDK_1.EventProcessorSDK.getInstance().emitModelChange("TransactionModel", updatedModel);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
150
184
|
if (this.activityEventHandler) {
|
|
151
185
|
await this.activityEventHandler.createActivityLog(mirrorEvent, existingMirrorModel, updatedModel);
|
|
152
186
|
}
|