@zeeshan60/event-processor 1.0.11 → 1.0.13
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 +4 -4
- package/dist/ActivityEventHandler.d.ts.map +1 -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 +22 -18
- package/dist/EventProcessorSDK.d.ts.map +1 -1
- package/dist/EventProcessorSDK.js +15 -4
- package/dist/FriendEventHandler.d.ts +4 -12
- package/dist/FriendEventHandler.d.ts.map +1 -1
- package/dist/FriendEventHandler.js +22 -54
- 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 +7 -7
- package/dist/GroupEventHandler.d.ts.map +1 -1
- package/dist/GroupEventHandler.js +21 -12
- 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 +7 -7
- package/dist/GroupTransactionEventHandler.d.ts.map +1 -1
- package/dist/GroupTransactionEventHandler.js +23 -16
- package/dist/GroupTransactionEvents.d.ts +22 -4
- package/dist/GroupTransactionEvents.d.ts.map +1 -1
- package/dist/GroupTransactionEvents.js +39 -21
- package/dist/TransactionEventHandler.d.ts +2 -5
- package/dist/TransactionEventHandler.d.ts.map +1 -1
- package/dist/TransactionEventHandler.js +29 -13
- 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 +3 -11
- package/dist/UserEventHandler.d.ts.map +1 -1
- package/dist/UserEventHandler.js +64 -62
- package/dist/UserEvents.d.ts +20 -3
- package/dist/UserEvents.d.ts.map +1 -1
- package/dist/UserEvents.js +53 -18
- package/dist/__tests__/e2e/setup/firebaseEmulator.d.ts +3 -0
- package/dist/__tests__/e2e/setup/firebaseEmulator.d.ts.map +1 -0
- package/dist/__tests__/e2e/setup/firebaseEmulator.js +87 -0
- package/dist/__tests__/e2e/setup/firestoreStores.d.ts +28 -0
- package/dist/__tests__/e2e/setup/firestoreStores.d.ts.map +1 -0
- package/dist/__tests__/e2e/setup/firestoreStores.js +276 -0
- package/dist/__tests__/e2e/setup/firestoreTestHelpers.d.ts +15 -0
- package/dist/__tests__/e2e/setup/firestoreTestHelpers.d.ts.map +1 -0
- package/dist/__tests__/e2e/setup/firestoreTestHelpers.js +167 -0
- package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMFriendEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMFriendEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts +3 -2
- package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMFriendModelStore.js +9 -0
- package/dist/__tests__/test-helpers/IMGroupEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMGroupEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMUserEventStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMUserEventStore.d.ts.map +1 -1
- package/dist/__tests__/test-helpers/IMUserModelStore.d.ts +2 -2
- package/dist/__tests__/test-helpers/IMUserModelStore.d.ts.map +1 -1
- 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 +12 -0
- package/dist/client/controllers/FriendController.d.ts.map +1 -0
- package/dist/client/controllers/FriendController.js +122 -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 +94 -7
- package/dist/client/handlers/UIEventHandler.d.ts +1 -1
- package/dist/client/handlers/UIEventHandler.d.ts.map +1 -1
- package/dist/client/handlers/UIEventHandler.js +4 -2
- 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/EventBus.d.ts +2 -2
- package/dist/common/EventBus.d.ts.map +1 -1
- package/dist/common/EventBusSingleton.d.ts +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 +67 -50
- package/dist/events.d.ts +29 -29
- package/dist/events.d.ts.map +1 -1
- package/dist/index.d.ts +18 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/store/ActivityLogEventStore.d.ts +1 -1
- package/dist/store/ActivityLogEventStore.d.ts.map +1 -1
- package/dist/store/ActivityLogModelStore.d.ts +2 -2
- package/dist/store/ActivityLogModelStore.d.ts.map +1 -1
- package/dist/store/FriendEventStore.d.ts +1 -1
- package/dist/store/FriendEventStore.d.ts.map +1 -1
- package/dist/store/FriendModelStore.d.ts +3 -2
- package/dist/store/FriendModelStore.d.ts.map +1 -1
- package/dist/store/GroupEventStore.d.ts +1 -1
- package/dist/store/GroupEventStore.d.ts.map +1 -1
- package/dist/store/GroupModelStore.d.ts +2 -2
- package/dist/store/GroupModelStore.d.ts.map +1 -1
- package/dist/store/GroupTransactionEventStore.d.ts +1 -1
- package/dist/store/GroupTransactionEventStore.d.ts.map +1 -1
- package/dist/store/GroupTransactionModelStore.d.ts +2 -2
- package/dist/store/GroupTransactionModelStore.d.ts.map +1 -1
- package/dist/store/ModelStore.d.ts +1 -1
- package/dist/store/ModelStore.d.ts.map +1 -1
- package/dist/store/TransactionEventStore.d.ts +1 -1
- package/dist/store/TransactionEventStore.d.ts.map +1 -1
- package/dist/store/TransactionModelStore.d.ts +2 -2
- package/dist/store/TransactionModelStore.d.ts.map +1 -1
- package/dist/store/UserEventStore.d.ts +1 -1
- package/dist/store/UserEventStore.d.ts.map +1 -1
- package/dist/store/UserModelStore.d.ts +2 -2
- package/dist/store/UserModelStore.d.ts.map +1 -1
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GroupTransactionEvent } from
|
|
2
|
-
import { Model } from
|
|
3
|
-
import { ActivityLogCreatedProps } from
|
|
4
|
-
import { SplitType } from
|
|
1
|
+
import { GroupTransactionEvent } from "./common/DomainEvents";
|
|
2
|
+
import { Model } from "./common/Model";
|
|
3
|
+
import { ActivityLogCreatedProps } from "./ActivityLogEvents";
|
|
4
|
+
import { SplitType } from "./TransactionEvents";
|
|
5
5
|
export interface MemberPayment {
|
|
6
6
|
memberId: string;
|
|
7
7
|
paid: number;
|
|
@@ -26,6 +26,7 @@ export interface GroupTransactionModel extends Model {
|
|
|
26
26
|
updatedBy: string;
|
|
27
27
|
}
|
|
28
28
|
export interface GroupTransactionCreatedProps {
|
|
29
|
+
eventId: string;
|
|
29
30
|
userId: string;
|
|
30
31
|
groupId: string;
|
|
31
32
|
transactionId: string;
|
|
@@ -43,6 +44,7 @@ export interface GroupTransactionCreatedProps {
|
|
|
43
44
|
systemGenerated: boolean;
|
|
44
45
|
}
|
|
45
46
|
export declare class GroupTransactionCreated implements GroupTransactionEvent {
|
|
47
|
+
eventId: string;
|
|
46
48
|
userId: string;
|
|
47
49
|
groupId: string;
|
|
48
50
|
transactionId: string;
|
|
@@ -63,6 +65,7 @@ export declare class GroupTransactionCreated implements GroupTransactionEvent {
|
|
|
63
65
|
activityLog(_existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
64
66
|
}
|
|
65
67
|
export interface GroupTransactionDescriptionChangedProps {
|
|
68
|
+
eventId: string;
|
|
66
69
|
userId: string;
|
|
67
70
|
description?: string;
|
|
68
71
|
createdAt: Date;
|
|
@@ -72,6 +75,7 @@ export interface GroupTransactionDescriptionChangedProps {
|
|
|
72
75
|
systemGenerated: boolean;
|
|
73
76
|
}
|
|
74
77
|
export declare class GroupTransactionDescriptionChanged implements GroupTransactionEvent {
|
|
78
|
+
eventId: string;
|
|
75
79
|
userId: string;
|
|
76
80
|
description?: string;
|
|
77
81
|
createdAt: Date;
|
|
@@ -84,6 +88,7 @@ export declare class GroupTransactionDescriptionChanged implements GroupTransact
|
|
|
84
88
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
85
89
|
}
|
|
86
90
|
export interface GroupTransactionNotesChangedProps {
|
|
91
|
+
eventId: string;
|
|
87
92
|
userId: string;
|
|
88
93
|
notes?: string;
|
|
89
94
|
createdAt: Date;
|
|
@@ -93,6 +98,7 @@ export interface GroupTransactionNotesChangedProps {
|
|
|
93
98
|
systemGenerated: boolean;
|
|
94
99
|
}
|
|
95
100
|
export declare class GroupTransactionNotesChanged implements GroupTransactionEvent {
|
|
101
|
+
eventId: string;
|
|
96
102
|
userId: string;
|
|
97
103
|
notes?: string;
|
|
98
104
|
createdAt: Date;
|
|
@@ -105,6 +111,7 @@ export declare class GroupTransactionNotesChanged implements GroupTransactionEve
|
|
|
105
111
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
106
112
|
}
|
|
107
113
|
export interface GroupTransactionTotalAmountChangedProps {
|
|
114
|
+
eventId: string;
|
|
108
115
|
userId: string;
|
|
109
116
|
totalAmount: number;
|
|
110
117
|
createdAt: Date;
|
|
@@ -114,6 +121,7 @@ export interface GroupTransactionTotalAmountChangedProps {
|
|
|
114
121
|
systemGenerated: boolean;
|
|
115
122
|
}
|
|
116
123
|
export declare class GroupTransactionTotalAmountChanged implements GroupTransactionEvent {
|
|
124
|
+
eventId: string;
|
|
117
125
|
userId: string;
|
|
118
126
|
totalAmount: number;
|
|
119
127
|
createdAt: Date;
|
|
@@ -126,6 +134,7 @@ export declare class GroupTransactionTotalAmountChanged implements GroupTransact
|
|
|
126
134
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
127
135
|
}
|
|
128
136
|
export interface GroupTransactionCurrencyChangedProps {
|
|
137
|
+
eventId: string;
|
|
129
138
|
userId: string;
|
|
130
139
|
currency: string;
|
|
131
140
|
createdAt: Date;
|
|
@@ -135,6 +144,7 @@ export interface GroupTransactionCurrencyChangedProps {
|
|
|
135
144
|
systemGenerated: boolean;
|
|
136
145
|
}
|
|
137
146
|
export declare class GroupTransactionCurrencyChanged implements GroupTransactionEvent {
|
|
147
|
+
eventId: string;
|
|
138
148
|
userId: string;
|
|
139
149
|
currency: string;
|
|
140
150
|
createdAt: Date;
|
|
@@ -147,6 +157,7 @@ export declare class GroupTransactionCurrencyChanged implements GroupTransaction
|
|
|
147
157
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
148
158
|
}
|
|
149
159
|
export interface GroupTransactionSplitTypeChangedProps {
|
|
160
|
+
eventId: string;
|
|
150
161
|
userId: string;
|
|
151
162
|
splitType: SplitType;
|
|
152
163
|
createdAt: Date;
|
|
@@ -156,6 +167,7 @@ export interface GroupTransactionSplitTypeChangedProps {
|
|
|
156
167
|
systemGenerated: boolean;
|
|
157
168
|
}
|
|
158
169
|
export declare class GroupTransactionSplitTypeChanged implements GroupTransactionEvent {
|
|
170
|
+
eventId: string;
|
|
159
171
|
userId: string;
|
|
160
172
|
splitType: SplitType;
|
|
161
173
|
createdAt: Date;
|
|
@@ -168,6 +180,7 @@ export declare class GroupTransactionSplitTypeChanged implements GroupTransactio
|
|
|
168
180
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
169
181
|
}
|
|
170
182
|
export interface GroupTransactionDateChangedProps {
|
|
183
|
+
eventId: string;
|
|
171
184
|
userId: string;
|
|
172
185
|
transactionDate: Date;
|
|
173
186
|
createdAt: Date;
|
|
@@ -177,6 +190,7 @@ export interface GroupTransactionDateChangedProps {
|
|
|
177
190
|
systemGenerated: boolean;
|
|
178
191
|
}
|
|
179
192
|
export declare class GroupTransactionDateChanged implements GroupTransactionEvent {
|
|
193
|
+
eventId: string;
|
|
180
194
|
userId: string;
|
|
181
195
|
transactionDate: Date;
|
|
182
196
|
createdAt: Date;
|
|
@@ -189,6 +203,7 @@ export declare class GroupTransactionDateChanged implements GroupTransactionEven
|
|
|
189
203
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
190
204
|
}
|
|
191
205
|
export interface GroupTransactionSplitDetailsChangedProps {
|
|
206
|
+
eventId: string;
|
|
192
207
|
userId: string;
|
|
193
208
|
totalAmount: number;
|
|
194
209
|
splitType: SplitType;
|
|
@@ -200,6 +215,7 @@ export interface GroupTransactionSplitDetailsChangedProps {
|
|
|
200
215
|
systemGenerated: boolean;
|
|
201
216
|
}
|
|
202
217
|
export declare class GroupTransactionSplitDetailsChanged implements GroupTransactionEvent {
|
|
218
|
+
eventId: string;
|
|
203
219
|
userId: string;
|
|
204
220
|
totalAmount: number;
|
|
205
221
|
splitType: SplitType;
|
|
@@ -214,6 +230,7 @@ export declare class GroupTransactionSplitDetailsChanged implements GroupTransac
|
|
|
214
230
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
215
231
|
}
|
|
216
232
|
export interface GroupTransactionDeletedProps {
|
|
233
|
+
eventId: string;
|
|
217
234
|
userId: string;
|
|
218
235
|
createdAt: Date;
|
|
219
236
|
createdBy: string;
|
|
@@ -222,6 +239,7 @@ export interface GroupTransactionDeletedProps {
|
|
|
222
239
|
systemGenerated: boolean;
|
|
223
240
|
}
|
|
224
241
|
export declare class GroupTransactionDeleted implements GroupTransactionEvent {
|
|
242
|
+
eventId: string;
|
|
225
243
|
userId: string;
|
|
226
244
|
createdAt: Date;
|
|
227
245
|
createdBy: string;
|
|
@@ -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,wBAAwB;IACrC,OAAO,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAsB,SAAQ,KAAK;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,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Ac9C,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,
|
|
@@ -1,8 +1,5 @@
|
|
|
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;
|
|
@@ -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,EACjB,MAAM,GAAG,CAAC;AACX,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS9D,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;IAGjD,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;YA6BvD,iBAAiB;CAgLlC"}
|
|
@@ -21,25 +21,35 @@ class TransactionEventHandler {
|
|
|
21
21
|
const existingModel = await this.modelStore.getByStreamIdWhereDeletedIsFalse(event.streamId);
|
|
22
22
|
const model = event.apply(existingModel);
|
|
23
23
|
await this.modelStore.save(model);
|
|
24
|
-
if (
|
|
25
|
-
await this.
|
|
24
|
+
if (_1.residence.isClient) {
|
|
25
|
+
await this.eventStore.addEvent(event);
|
|
26
|
+
if (this.activityEventHandler) {
|
|
27
|
+
await this.activityEventHandler.createActivityLog(event, existingModel, model);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
await this.createMirrorEvent(event, model);
|
|
26
32
|
}
|
|
27
|
-
await this.createMirrorEvent(event, model);
|
|
28
33
|
return model;
|
|
29
34
|
}
|
|
30
35
|
async createMirrorEvent(originalEvent, transactionModel) {
|
|
31
36
|
const eventType = originalEvent.constructor.name;
|
|
32
37
|
const recipientUserModel = await this.txUserModelStore.getByStreamId(transactionModel.recipientUserId);
|
|
33
|
-
|
|
38
|
+
(0, userPathUtils_1.getUserEventPath)(recipientUserModel, transactionModel.recipientUserId);
|
|
34
39
|
const existingMirrorModel = await this.modelStore.findByUserAndLogicalTransactionId(transactionModel.recipientUserId, transactionModel.userId, transactionModel.logicalTransactionId);
|
|
35
|
-
const mirrorStreamId = existingMirrorModel
|
|
36
|
-
|
|
40
|
+
const mirrorStreamId = existingMirrorModel
|
|
41
|
+
? existingMirrorModel.streamId
|
|
42
|
+
: (0, uuid_1.v4)();
|
|
43
|
+
const mirrorVersion = existingMirrorModel
|
|
44
|
+
? existingMirrorModel.version + 1
|
|
45
|
+
: 1;
|
|
37
46
|
let mirrorEvent;
|
|
38
47
|
switch (eventType) {
|
|
39
|
-
case
|
|
48
|
+
case "TransactionCreated": {
|
|
40
49
|
const txEvent = originalEvent;
|
|
41
50
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
42
51
|
mirrorEvent = new _1.TransactionCreated({
|
|
52
|
+
eventId: (0, uuid_1.v4)(),
|
|
43
53
|
userId: transactionModel.recipientUserId,
|
|
44
54
|
recipientUserId: transactionModel.userId,
|
|
45
55
|
logicalTransactionId: txEvent.logicalTransactionId,
|
|
@@ -60,9 +70,10 @@ class TransactionEventHandler {
|
|
|
60
70
|
});
|
|
61
71
|
break;
|
|
62
72
|
}
|
|
63
|
-
case
|
|
73
|
+
case "TransactionDeleted": {
|
|
64
74
|
const txEvent = originalEvent;
|
|
65
75
|
mirrorEvent = new _1.TransactionDeleted({
|
|
76
|
+
eventId: (0, uuid_1.v4)(),
|
|
66
77
|
userId: transactionModel.recipientUserId,
|
|
67
78
|
createdAt: txEvent.createdAt,
|
|
68
79
|
createdBy: txEvent.createdBy,
|
|
@@ -72,9 +83,10 @@ class TransactionEventHandler {
|
|
|
72
83
|
});
|
|
73
84
|
break;
|
|
74
85
|
}
|
|
75
|
-
case
|
|
86
|
+
case "DescriptionChanged": {
|
|
76
87
|
const txEvent = originalEvent;
|
|
77
88
|
mirrorEvent = new _1.DescriptionChanged({
|
|
89
|
+
eventId: (0, uuid_1.v4)(),
|
|
78
90
|
userId: transactionModel.recipientUserId,
|
|
79
91
|
description: txEvent.description,
|
|
80
92
|
createdAt: txEvent.createdAt,
|
|
@@ -85,9 +97,10 @@ class TransactionEventHandler {
|
|
|
85
97
|
});
|
|
86
98
|
break;
|
|
87
99
|
}
|
|
88
|
-
case
|
|
100
|
+
case "TotalAmountChanged": {
|
|
89
101
|
const txEvent = originalEvent;
|
|
90
102
|
mirrorEvent = new _1.TotalAmountChanged({
|
|
103
|
+
eventId: (0, uuid_1.v4)(),
|
|
91
104
|
userId: transactionModel.recipientUserId,
|
|
92
105
|
totalAmount: txEvent.totalAmount,
|
|
93
106
|
createdAt: txEvent.createdAt,
|
|
@@ -98,10 +111,11 @@ class TransactionEventHandler {
|
|
|
98
111
|
});
|
|
99
112
|
break;
|
|
100
113
|
}
|
|
101
|
-
case
|
|
114
|
+
case "SplitTypeChanged": {
|
|
102
115
|
const txEvent = originalEvent;
|
|
103
116
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
104
117
|
mirrorEvent = new _1.SplitTypeChanged({
|
|
118
|
+
eventId: (0, uuid_1.v4)(),
|
|
105
119
|
userId: transactionModel.recipientUserId,
|
|
106
120
|
splitType: (0, splitTypeUtils_1.reverseSplitType)(txEvent.splitType),
|
|
107
121
|
totalAmount: txEvent.totalAmount,
|
|
@@ -115,9 +129,10 @@ class TransactionEventHandler {
|
|
|
115
129
|
});
|
|
116
130
|
break;
|
|
117
131
|
}
|
|
118
|
-
case
|
|
132
|
+
case "CurrencyChanged": {
|
|
119
133
|
const txEvent = originalEvent;
|
|
120
134
|
mirrorEvent = new _1.CurrencyChanged({
|
|
135
|
+
eventId: (0, uuid_1.v4)(),
|
|
121
136
|
userId: transactionModel.recipientUserId,
|
|
122
137
|
currency: txEvent.currency,
|
|
123
138
|
createdAt: txEvent.createdAt,
|
|
@@ -128,9 +143,10 @@ class TransactionEventHandler {
|
|
|
128
143
|
});
|
|
129
144
|
break;
|
|
130
145
|
}
|
|
131
|
-
case
|
|
146
|
+
case "TransactionDateChanged": {
|
|
132
147
|
const txEvent = originalEvent;
|
|
133
148
|
mirrorEvent = new _1.TransactionDateChanged({
|
|
149
|
+
eventId: (0, uuid_1.v4)(),
|
|
134
150
|
userId: transactionModel.recipientUserId,
|
|
135
151
|
transactionDate: txEvent.transactionDate,
|
|
136
152
|
createdAt: txEvent.createdAt,
|