@zeeshan60/event-processor 1.0.161 → 1.0.163
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 +4 -4
- package/dist/EventProcessorSDK.d.ts +12 -1
- package/dist/EventProcessorSDK.d.ts.map +1 -1
- package/dist/EventProcessorSDK.js +25 -0
- package/dist/EventProcessorSDK.js.map +1 -1
- package/dist/ExpenseAccountEventHandler.d.ts.map +1 -1
- package/dist/ExpenseAccountEventHandler.js +1 -0
- package/dist/ExpenseAccountEventHandler.js.map +1 -1
- package/dist/ExpenseEventHandler.d.ts +2 -1
- package/dist/ExpenseEventHandler.d.ts.map +1 -1
- package/dist/ExpenseEventHandler.js +103 -16
- package/dist/ExpenseEventHandler.js.map +1 -1
- package/dist/ExpenseEvents.d.ts +6 -8
- package/dist/ExpenseEvents.d.ts.map +1 -1
- package/dist/ExpenseEvents.js +3 -4
- package/dist/ExpenseEvents.js.map +1 -1
- package/dist/ReminderEventHandler.d.ts +38 -0
- package/dist/ReminderEventHandler.d.ts.map +1 -0
- package/dist/ReminderEventHandler.js +190 -0
- package/dist/ReminderEventHandler.js.map +1 -0
- package/dist/ReminderEvents.d.ts +50 -0
- package/dist/ReminderEvents.d.ts.map +1 -0
- package/dist/ReminderEvents.js +51 -0
- package/dist/ReminderEvents.js.map +1 -0
- package/dist/TransactionEventHandler.d.ts +2 -0
- package/dist/TransactionEventHandler.d.ts.map +1 -1
- package/dist/TransactionEventHandler.js +94 -6
- package/dist/TransactionEventHandler.js.map +1 -1
- package/dist/TransactionEvents.d.ts +6 -14
- package/dist/TransactionEvents.d.ts.map +1 -1
- package/dist/TransactionEvents.js +3 -8
- package/dist/TransactionEvents.js.map +1 -1
- package/dist/client/controllers/ExpenseController.d.ts +5 -1
- package/dist/client/controllers/ExpenseController.d.ts.map +1 -1
- package/dist/client/controllers/ExpenseController.js +64 -6
- package/dist/client/controllers/ExpenseController.js.map +1 -1
- package/dist/client/controllers/ReminderController.d.ts +10 -0
- package/dist/client/controllers/ReminderController.d.ts.map +1 -0
- package/dist/client/controllers/ReminderController.js +63 -0
- package/dist/client/controllers/ReminderController.js.map +1 -0
- package/dist/client/controllers/SuggestionController.js +1 -1
- package/dist/client/controllers/SuggestionController.js.map +1 -1
- package/dist/client/controllers/TransactionController.d.ts +5 -15
- package/dist/client/controllers/TransactionController.d.ts.map +1 -1
- package/dist/client/controllers/TransactionController.js +74 -74
- package/dist/client/controllers/TransactionController.js.map +1 -1
- package/dist/common/DomainEvents.d.ts +4 -0
- package/dist/common/DomainEvents.d.ts.map +1 -1
- package/dist/common/EventTypes.d.ts +3 -0
- package/dist/common/EventTypes.d.ts.map +1 -1
- package/dist/common/EventTypes.js +4 -0
- package/dist/common/EventTypes.js.map +1 -1
- package/dist/contracts/expenses/index.d.ts +2 -2
- package/dist/contracts/expenses/index.d.ts.map +1 -1
- package/dist/contracts/transactions/index.d.ts +2 -0
- package/dist/contracts/transactions/index.d.ts.map +1 -1
- package/dist/contracts/transactions/index.js.map +1 -1
- package/dist/converters/eventConverter.d.ts.map +1 -1
- package/dist/converters/eventConverter.js +7 -0
- package/dist/converters/eventConverter.js.map +1 -1
- package/dist/events.d.ts +4 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +6 -1
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/store/ReminderEventStore.d.ts +5 -0
- package/dist/store/ReminderEventStore.d.ts.map +1 -0
- package/dist/store/ReminderEventStore.js +3 -0
- package/dist/store/ReminderEventStore.js.map +1 -0
- package/dist/store/ReminderModelStore.d.ts +11 -0
- package/dist/store/ReminderModelStore.d.ts.map +1 -0
- package/dist/store/ReminderModelStore.js +5 -0
- package/dist/store/ReminderModelStore.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReminderEventHandler = void 0;
|
|
4
|
+
const NotificationEvents_1 = require("./NotificationEvents");
|
|
5
|
+
const EventTypes_1 = require("./common/EventTypes");
|
|
6
|
+
const BaseEventHandler_1 = require("./BaseEventHandler");
|
|
7
|
+
const BalanceUtil_1 = require("./utils/BalanceUtil");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const contracts_1 = require("./contracts");
|
|
10
|
+
class ReminderEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
11
|
+
constructor(modelStore, reminderEventStore, transactionModelStore, groupTransactionModelStore, friendModelStore, userModelStore, groupModelStore, currencyStore, notificationEventHandler, isClient, clientType, modelChangeEmitter, notificationPublisher, logger) {
|
|
12
|
+
super(isClient, clientType, modelChangeEmitter, logger);
|
|
13
|
+
this.modelStore = modelStore;
|
|
14
|
+
this.reminderEventStore = reminderEventStore;
|
|
15
|
+
this.transactionModelStore = transactionModelStore;
|
|
16
|
+
this.groupTransactionModelStore = groupTransactionModelStore;
|
|
17
|
+
this.friendModelStore = friendModelStore;
|
|
18
|
+
this.userModelStore = userModelStore;
|
|
19
|
+
this.groupModelStore = groupModelStore;
|
|
20
|
+
this.currencyStore = currencyStore;
|
|
21
|
+
this.notificationEventHandler = notificationEventHandler;
|
|
22
|
+
this.notificationPublisher = notificationPublisher;
|
|
23
|
+
}
|
|
24
|
+
getModelStore() {
|
|
25
|
+
return this.modelStore;
|
|
26
|
+
}
|
|
27
|
+
getEventStore() {
|
|
28
|
+
return this.reminderEventStore;
|
|
29
|
+
}
|
|
30
|
+
async handleEvent(event, _context) {
|
|
31
|
+
switch (event.eventType) {
|
|
32
|
+
case EventTypes_1.EventType.SETTLE_UP_REMINDER_TRIGGERED:
|
|
33
|
+
return await this.handleSettleUpReminderTriggered(event, _context);
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Unknown reminder event type: ${event.eventType}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async handleSettleUpReminderTriggered(event, context) {
|
|
39
|
+
this.logger.log("[debug] handleSettleUpReminderTriggered START", {
|
|
40
|
+
streamId: event.streamId,
|
|
41
|
+
userId: event.userId,
|
|
42
|
+
recipientUserId: event.recipientUserId,
|
|
43
|
+
groupId: event.groupId,
|
|
44
|
+
isClient: this.isClient,
|
|
45
|
+
});
|
|
46
|
+
const existingModel = await this.modelStore.getByStreamIdWhereDeletedIsFalse(event.streamId);
|
|
47
|
+
if (this.shouldSkipSave(existingModel, event)) {
|
|
48
|
+
this.logger.log("[debug] skipping save (already processed)");
|
|
49
|
+
return existingModel;
|
|
50
|
+
}
|
|
51
|
+
const updatedModel = event.apply(existingModel);
|
|
52
|
+
if (this.isNotAIClient()) {
|
|
53
|
+
await this.modelStore.save(updatedModel);
|
|
54
|
+
this.logger.log("[debug] model saved");
|
|
55
|
+
}
|
|
56
|
+
if (this.isClient) {
|
|
57
|
+
await this.reminderEventStore.addEvent(event);
|
|
58
|
+
this.modelChangeEmitter?.emit(event.eventMainType);
|
|
59
|
+
this.logger.log("[debug] client path done, event stored");
|
|
60
|
+
return updatedModel;
|
|
61
|
+
}
|
|
62
|
+
if (event.groupId) {
|
|
63
|
+
this.logger.log("[debug] routing to handleGroupReminder");
|
|
64
|
+
await this.handleGroupReminder(event, context);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.logger.log("[debug] routing to handleFriendReminder");
|
|
68
|
+
await this.handleFriendReminder(event, context);
|
|
69
|
+
}
|
|
70
|
+
return updatedModel;
|
|
71
|
+
}
|
|
72
|
+
async handleFriendReminder(event, context) {
|
|
73
|
+
if (!this.notificationPublisher) {
|
|
74
|
+
this.logger.log("[debug] handleFriendReminder: no notificationPublisher, returning");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const transactions = await this.transactionModelStore.findByUserIdAndRecipientUserIdWhereDeletedIsFalse(event.userId, event.recipientUserId);
|
|
78
|
+
this.logger.log("[debug] handleFriendReminder: transactions found", {
|
|
79
|
+
count: transactions.length,
|
|
80
|
+
});
|
|
81
|
+
if (transactions.length === 0)
|
|
82
|
+
return;
|
|
83
|
+
const balanceUtil = new BalanceUtil_1.BalanceUtil(this.userModelStore, this.currencyStore);
|
|
84
|
+
const balance = await balanceUtil.calculateBalance(transactions, event.recipientUserId);
|
|
85
|
+
this.logger.log("[debug] handleFriendReminder: balance calculated", {
|
|
86
|
+
hasMain: !!balance.main,
|
|
87
|
+
amount: balance.main?.amount,
|
|
88
|
+
isOwed: balance.main?.isOwed,
|
|
89
|
+
currency: balance.main?.currency,
|
|
90
|
+
});
|
|
91
|
+
if (!balance.main || balance.main.amount <= 0 || !balance.main.isOwed)
|
|
92
|
+
return;
|
|
93
|
+
const senderUser = await this.userModelStore.getByStreamIdWhereDeletedIsFalse(event.userId);
|
|
94
|
+
const senderName = senderUser?.displayName || "Someone";
|
|
95
|
+
const formattedAmount = balance.main.amount.toFixed(2);
|
|
96
|
+
const title = "Settle Up Reminder";
|
|
97
|
+
const body = `${senderName} is reminding you to settle up ${formattedAmount} ${balance.main.currency}`;
|
|
98
|
+
try {
|
|
99
|
+
await this.notificationPublisher.sendNotificationToUser(event.recipientUserId, { title, body });
|
|
100
|
+
await this.createNotificationEvent(event.recipientUserId, event.userId, title, body, event.streamId);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
this.logger.error("[ReminderEventHandler] Failed to send friend reminder notification", {
|
|
104
|
+
streamId: event.streamId,
|
|
105
|
+
recipientUserId: event.recipientUserId,
|
|
106
|
+
error: error instanceof Error ? error.message : String(error),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async handleGroupReminder(event, context) {
|
|
111
|
+
if (!this.notificationPublisher || !event.groupId)
|
|
112
|
+
return;
|
|
113
|
+
const groupModel = await this.groupModelStore.findByUserIdAndGroupIdAndDeletedIsFalse(event.userId, event.groupId);
|
|
114
|
+
if (!groupModel)
|
|
115
|
+
return;
|
|
116
|
+
const groupTransactions = await this.groupTransactionModelStore.findByUserIdAndGroupIdWhereDeletedIsFalse(event.userId, event.groupId);
|
|
117
|
+
if (groupTransactions.length === 0)
|
|
118
|
+
return;
|
|
119
|
+
const memberBalances = new Map();
|
|
120
|
+
for (const tx of groupTransactions) {
|
|
121
|
+
for (const owe of tx.whoOweYou) {
|
|
122
|
+
if (!memberBalances.has(owe.memberId)) {
|
|
123
|
+
memberBalances.set(owe.memberId, new Map());
|
|
124
|
+
}
|
|
125
|
+
const currencyMap = memberBalances.get(owe.memberId);
|
|
126
|
+
const existing = currencyMap.get(tx.currency) || 0;
|
|
127
|
+
currencyMap.set(tx.currency, existing + owe.amount);
|
|
128
|
+
}
|
|
129
|
+
for (const owe of tx.whoYouOwe) {
|
|
130
|
+
if (!memberBalances.has(owe.memberId)) {
|
|
131
|
+
memberBalances.set(owe.memberId, new Map());
|
|
132
|
+
}
|
|
133
|
+
const currencyMap = memberBalances.get(owe.memberId);
|
|
134
|
+
const existing = currencyMap.get(tx.currency) || 0;
|
|
135
|
+
currencyMap.set(tx.currency, existing - owe.amount);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const senderUser = await this.userModelStore.getByStreamIdWhereDeletedIsFalse(event.userId);
|
|
139
|
+
const senderName = senderUser?.displayName || "Someone";
|
|
140
|
+
const currencyRates = (await this.currencyStore.getCurrencyRates())?.rates ?? {};
|
|
141
|
+
for (const [memberId, currencyMap] of memberBalances) {
|
|
142
|
+
const memberUser = await this.userModelStore.getByStreamIdWhereDeletedIsFalse(memberId);
|
|
143
|
+
const memberCurrency = memberUser?.currency ?? "USD";
|
|
144
|
+
let totalOwed = 0;
|
|
145
|
+
for (const [currency, balance] of currencyMap) {
|
|
146
|
+
if (balance > 0) {
|
|
147
|
+
totalOwed += (0, contracts_1.convertCurrency)(balance, currency, memberCurrency, currencyRates);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (totalOwed <= 0)
|
|
151
|
+
continue;
|
|
152
|
+
const formattedAmount = totalOwed.toFixed(2);
|
|
153
|
+
const title = "Settle Up Reminder";
|
|
154
|
+
const body = `${senderName} is reminding you to settle up ${formattedAmount} ${memberCurrency} in ${groupModel.name}`;
|
|
155
|
+
try {
|
|
156
|
+
await this.notificationPublisher.sendNotificationToUser(memberId, {
|
|
157
|
+
title,
|
|
158
|
+
body,
|
|
159
|
+
});
|
|
160
|
+
await this.createNotificationEvent(memberId, event.userId, title, body, event.streamId);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
this.logger.error("[ReminderEventHandler] Failed to send group reminder notification", {
|
|
164
|
+
streamId: event.streamId,
|
|
165
|
+
memberId,
|
|
166
|
+
error: error instanceof Error ? error.message : String(error),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async createNotificationEvent(recipientUserId, createdBy, title, body, sourceId) {
|
|
172
|
+
const notificationEvent = new NotificationEvents_1.NotificationCreated({
|
|
173
|
+
eventId: (0, uuid_1.v4)(),
|
|
174
|
+
userId: recipientUserId,
|
|
175
|
+
streamId: (0, uuid_1.v4)(),
|
|
176
|
+
version: 1,
|
|
177
|
+
createdAt: Date.now(),
|
|
178
|
+
createdBy,
|
|
179
|
+
systemGenerated: true,
|
|
180
|
+
title,
|
|
181
|
+
body,
|
|
182
|
+
sourceEventType: EventTypes_1.EventType.SETTLE_UP_REMINDER_TRIGGERED,
|
|
183
|
+
sourceType: EventTypes_1.EventMainType.REMINDER,
|
|
184
|
+
sourceId,
|
|
185
|
+
});
|
|
186
|
+
await this.notificationEventHandler.handleBackendEvent(notificationEvent);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.ReminderEventHandler = ReminderEventHandler;
|
|
190
|
+
//# sourceMappingURL=ReminderEventHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReminderEventHandler.js","sourceRoot":"","sources":["../src/ReminderEventHandler.ts"],"names":[],"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
|
|
|
1
|
+
import { ReminderEvent } from "./common/DomainEvents";
|
|
2
|
+
import { Model, ModelProps } from "./common/Model";
|
|
3
|
+
export interface ReminderModelProps extends ModelProps {
|
|
4
|
+
recipientUserId: string;
|
|
5
|
+
groupId?: string;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
createdBy: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class ReminderModel implements ReminderModelProps {
|
|
10
|
+
userId: string;
|
|
11
|
+
streamId: string;
|
|
12
|
+
version: number;
|
|
13
|
+
deleted: boolean;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
synced: boolean;
|
|
16
|
+
recipientUserId: string;
|
|
17
|
+
groupId?: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
createdBy: string;
|
|
20
|
+
constructor(props: ReminderModelProps);
|
|
21
|
+
}
|
|
22
|
+
export interface SettleUpReminderTriggeredProps {
|
|
23
|
+
eventId: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
streamId: string;
|
|
26
|
+
version: number;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
createdBy: string;
|
|
29
|
+
systemGenerated: boolean;
|
|
30
|
+
skipNotify?: boolean;
|
|
31
|
+
recipientUserId: string;
|
|
32
|
+
groupId?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare class SettleUpReminderTriggered implements ReminderEvent {
|
|
35
|
+
readonly eventMainType: "reminder";
|
|
36
|
+
readonly eventType: "SettleUpReminderTriggered";
|
|
37
|
+
eventId: string;
|
|
38
|
+
userId: string;
|
|
39
|
+
streamId: string;
|
|
40
|
+
version: number;
|
|
41
|
+
createdAt: number;
|
|
42
|
+
createdBy: string;
|
|
43
|
+
systemGenerated: boolean;
|
|
44
|
+
skipNotify?: boolean;
|
|
45
|
+
recipientUserId: string;
|
|
46
|
+
groupId?: string;
|
|
47
|
+
constructor(props: SettleUpReminderTriggeredProps);
|
|
48
|
+
apply(_existing?: Model): ReminderModel;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMapping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,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEZ,KAAK,EAAE,8BAA8B;IAajD,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,aAAa;CAcxC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettleUpReminderTriggered = exports.ReminderModel = void 0;
|
|
4
|
+
const EventTypes_1 = require("./common/EventTypes");
|
|
5
|
+
class ReminderModel {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.userId = props.userId;
|
|
8
|
+
this.streamId = props.streamId;
|
|
9
|
+
this.version = props.version;
|
|
10
|
+
this.deleted = props.deleted;
|
|
11
|
+
this.updatedAt = props.updatedAt;
|
|
12
|
+
this.synced = props.synced ?? false;
|
|
13
|
+
this.recipientUserId = props.recipientUserId;
|
|
14
|
+
this.groupId = props.groupId;
|
|
15
|
+
this.createdAt = props.createdAt;
|
|
16
|
+
this.createdBy = props.createdBy;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ReminderModel = ReminderModel;
|
|
20
|
+
class SettleUpReminderTriggered {
|
|
21
|
+
constructor(props) {
|
|
22
|
+
this.eventMainType = EventTypes_1.EventMainType.REMINDER;
|
|
23
|
+
this.eventType = EventTypes_1.EventType.SETTLE_UP_REMINDER_TRIGGERED;
|
|
24
|
+
this.eventId = props.eventId;
|
|
25
|
+
this.userId = props.userId;
|
|
26
|
+
this.streamId = props.streamId;
|
|
27
|
+
this.version = props.version;
|
|
28
|
+
this.createdAt = props.createdAt;
|
|
29
|
+
this.createdBy = props.createdBy;
|
|
30
|
+
this.systemGenerated = props.systemGenerated;
|
|
31
|
+
this.skipNotify = props.skipNotify;
|
|
32
|
+
this.recipientUserId = props.recipientUserId;
|
|
33
|
+
this.groupId = props.groupId;
|
|
34
|
+
}
|
|
35
|
+
apply(_existing) {
|
|
36
|
+
return new ReminderModel({
|
|
37
|
+
streamId: this.streamId,
|
|
38
|
+
userId: this.userId,
|
|
39
|
+
version: this.version,
|
|
40
|
+
deleted: false,
|
|
41
|
+
updatedAt: this.createdAt,
|
|
42
|
+
synced: this.systemGenerated,
|
|
43
|
+
recipientUserId: this.recipientUserId,
|
|
44
|
+
groupId: this.groupId,
|
|
45
|
+
createdAt: this.createdAt,
|
|
46
|
+
createdBy: this.createdBy,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.SettleUpReminderTriggered = SettleUpReminderTriggered;
|
|
51
|
+
//# sourceMappingURL=ReminderEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReminderEvents.js","sourceRoot":"","sources":["../src/ReminderEvents.ts"],"names":[],"mappings":";;;AAEA,oDAA+D;AAS/D,MAAa,aAAa;IAYxB,YAAY,KAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,OAAO,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,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAzCD,8DAyCC"}
|
|
@@ -19,5 +19,7 @@ export declare class TransactionEventHandler extends BaseEventHandler<Transactio
|
|
|
19
19
|
getEventStore(): TransactionEventStore;
|
|
20
20
|
handleEvent(event: TransactionEvent, context?: LoggingContext, emitChanges?: boolean): Promise<TransactionModel>;
|
|
21
21
|
private createMirrorEvent;
|
|
22
|
+
bulkHandleClientEvents(events: TransactionEvent[]): Promise<TransactionModel[]>;
|
|
23
|
+
createBulkOperationSummary(userId: string, recipientUserId: string, count: number, operationType: "created" | "updated" | "deleted", bulkOperationId: string): Promise<void>;
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=TransactionEventHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionEventHandler.d.ts","sourceRoot":"","sources":["../src/TransactionEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAGrB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,GAAG,CAAC;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"TransactionEventHandler.d.ts","sourceRoot":"","sources":["../src/TransactionEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAGrB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,GAAG,CAAC;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAOtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAA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CAiFjB"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TransactionEventHandler = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const BaseEventHandler_1 = require("./BaseEventHandler");
|
|
6
|
+
const ActivityLogEvents_1 = require("./ActivityLogEvents");
|
|
6
7
|
const NotificationEvents_1 = require("./NotificationEvents");
|
|
7
8
|
const splitTypeUtils_1 = require("./utils/splitTypeUtils");
|
|
8
9
|
const uuid_1 = require("uuid");
|
|
@@ -38,7 +39,7 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
38
39
|
if (emitChanges) {
|
|
39
40
|
this.modelChangeEmitter?.emit(event.eventMainType);
|
|
40
41
|
}
|
|
41
|
-
if (this.activityEventHandler) {
|
|
42
|
+
if (this.activityEventHandler && !event.bulkOperationId) {
|
|
42
43
|
await this.activityEventHandler.createActivityLog(event, existingModel, model);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -61,9 +62,11 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
61
62
|
? existingMirrorModel.version + 1
|
|
62
63
|
: 1;
|
|
63
64
|
let mirrorEvent;
|
|
65
|
+
let bulkOpId;
|
|
64
66
|
switch (eventType) {
|
|
65
67
|
case EventTypes_1.EventType.TRANSACTION_CREATED: {
|
|
66
68
|
const txEvent = originalEvent;
|
|
69
|
+
bulkOpId = txEvent.bulkOperationId;
|
|
67
70
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
68
71
|
mirrorEvent = new _1.TransactionCreated({
|
|
69
72
|
eventId: (0, uuid_1.v4)(),
|
|
@@ -84,11 +87,13 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
84
87
|
streamId: mirrorStreamId,
|
|
85
88
|
version: mirrorVersion,
|
|
86
89
|
systemGenerated: true,
|
|
90
|
+
bulkOperationId: bulkOpId,
|
|
87
91
|
});
|
|
88
92
|
break;
|
|
89
93
|
}
|
|
90
94
|
case EventTypes_1.EventType.TRANSACTION_DELETED: {
|
|
91
95
|
const txEvent = originalEvent;
|
|
96
|
+
bulkOpId = txEvent.bulkOperationId;
|
|
92
97
|
mirrorEvent = new _1.TransactionDeleted({
|
|
93
98
|
eventId: (0, uuid_1.v4)(),
|
|
94
99
|
userId: transactionModel.recipientUserId,
|
|
@@ -97,11 +102,13 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
97
102
|
streamId: mirrorStreamId,
|
|
98
103
|
version: mirrorVersion,
|
|
99
104
|
systemGenerated: true,
|
|
105
|
+
bulkOperationId: bulkOpId,
|
|
100
106
|
});
|
|
101
107
|
break;
|
|
102
108
|
}
|
|
103
109
|
case EventTypes_1.EventType.TRANSACTION_UPDATED: {
|
|
104
110
|
const txEvent = originalEvent;
|
|
111
|
+
bulkOpId = txEvent.bulkOperationId;
|
|
105
112
|
const { amount, isOwed } = (0, splitTypeUtils_1.calculateMirrorAmountAndIsOwed)(txEvent.totalAmount, txEvent.amount, txEvent.splitType, txEvent.isOwed);
|
|
106
113
|
mirrorEvent = new _1.TransactionUpdated({
|
|
107
114
|
eventId: (0, uuid_1.v4)(),
|
|
@@ -118,6 +125,7 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
118
125
|
streamId: mirrorStreamId,
|
|
119
126
|
version: mirrorVersion,
|
|
120
127
|
systemGenerated: true,
|
|
128
|
+
bulkOperationId: bulkOpId,
|
|
121
129
|
});
|
|
122
130
|
break;
|
|
123
131
|
}
|
|
@@ -130,15 +138,15 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
130
138
|
}
|
|
131
139
|
const updatedModel = mirrorEvent.apply(existingMirrorModel);
|
|
132
140
|
await this.modelStore.save(updatedModel);
|
|
133
|
-
if (this.activityEventHandler) {
|
|
141
|
+
if (this.activityEventHandler && !bulkOpId) {
|
|
134
142
|
await this.activityEventHandler.createActivityLog(mirrorEvent, existingMirrorModel, updatedModel);
|
|
135
143
|
}
|
|
136
|
-
if (this.notificationPublisher && !
|
|
144
|
+
if (this.notificationPublisher && !bulkOpId) {
|
|
137
145
|
try {
|
|
138
146
|
const nameMap = {};
|
|
139
147
|
const recipientUserId = updatedModel.userId;
|
|
140
|
-
const actorUserId =
|
|
141
|
-
const friendModel = await this.friendModelStore.findByUserIdAndFriendIdAndDeletedIsFalse(recipientUserId,
|
|
148
|
+
const actorUserId = updatedModel.createdBy;
|
|
149
|
+
const friendModel = await this.friendModelStore.findByUserIdAndFriendIdAndDeletedIsFalse(recipientUserId, updatedModel.recipientUserId);
|
|
142
150
|
if (friendModel?.friendDisplayName) {
|
|
143
151
|
nameMap[actorUserId] = friendModel.friendDisplayName;
|
|
144
152
|
}
|
|
@@ -151,7 +159,7 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
151
159
|
streamId: (0, uuid_1.v4)(),
|
|
152
160
|
version: 1,
|
|
153
161
|
createdAt: Date.now(),
|
|
154
|
-
createdBy:
|
|
162
|
+
createdBy: updatedModel.createdBy,
|
|
155
163
|
systemGenerated: true,
|
|
156
164
|
title: payload.title,
|
|
157
165
|
body: payload.body,
|
|
@@ -175,6 +183,86 @@ class TransactionEventHandler extends BaseEventHandler_1.BaseEventHandler {
|
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
}
|
|
186
|
+
async bulkHandleClientEvents(events) {
|
|
187
|
+
this.logger.log(`[bulkHandleClientEvents] Processing ${events.length} transaction events in bulk`);
|
|
188
|
+
const models = [];
|
|
189
|
+
for (const event of events) {
|
|
190
|
+
const existingModel = await this.modelStore.getByStreamId(event.streamId);
|
|
191
|
+
const updatedModel = event.apply(existingModel);
|
|
192
|
+
models.push(updatedModel);
|
|
193
|
+
}
|
|
194
|
+
this.logger.log(`[bulkHandleClientEvents] Saving ${events.length} transaction events in bulk to Firestore`);
|
|
195
|
+
await this.eventStore.addEvents(events);
|
|
196
|
+
if (this.isNotAIClient()) {
|
|
197
|
+
this.logger.log(`[bulkHandleClientEvents] Saving ${models.length} transaction models in bulk (isNotAIClient=true)`);
|
|
198
|
+
await this.modelStore.saveAll(models);
|
|
199
|
+
}
|
|
200
|
+
this.logger.log(`[bulkHandleClientEvents] Bulk transaction operation completed successfully`);
|
|
201
|
+
return models;
|
|
202
|
+
}
|
|
203
|
+
async createBulkOperationSummary(userId, recipientUserId, count, operationType, bulkOperationId) {
|
|
204
|
+
const friendModel = await this.friendModelStore.findByUserIdAndFriendIdAndDeletedIsFalse(recipientUserId, userId);
|
|
205
|
+
const creatorName = friendModel?.friendDisplayName ?? "Someone";
|
|
206
|
+
const verb = operationType === "created"
|
|
207
|
+
? "added"
|
|
208
|
+
: operationType === "updated"
|
|
209
|
+
? "updated"
|
|
210
|
+
: "deleted";
|
|
211
|
+
const title = `${creatorName} ${verb} ${count} transactions`;
|
|
212
|
+
const body = `${count} transactions ${verb}`;
|
|
213
|
+
try {
|
|
214
|
+
if (this.notificationPublisher) {
|
|
215
|
+
const payload = {
|
|
216
|
+
title,
|
|
217
|
+
body,
|
|
218
|
+
sourceEventType: EventTypes_1.EventType.BULK_OPERATION,
|
|
219
|
+
sourceType: EventTypes_1.EventMainType.TRANSACTION,
|
|
220
|
+
sourceId: userId,
|
|
221
|
+
sourceListItemId: bulkOperationId,
|
|
222
|
+
};
|
|
223
|
+
await this.notificationPublisher.sendNotificationToUser(recipientUserId, payload);
|
|
224
|
+
const notificationEvent = new NotificationEvents_1.NotificationCreated({
|
|
225
|
+
eventId: (0, uuid_1.v4)(),
|
|
226
|
+
userId: recipientUserId,
|
|
227
|
+
streamId: (0, uuid_1.v4)(),
|
|
228
|
+
version: 1,
|
|
229
|
+
createdAt: Date.now(),
|
|
230
|
+
createdBy: userId,
|
|
231
|
+
systemGenerated: true,
|
|
232
|
+
title: payload.title,
|
|
233
|
+
body: payload.body,
|
|
234
|
+
sourceEventType: payload.sourceEventType,
|
|
235
|
+
sourceType: payload.sourceType,
|
|
236
|
+
sourceId: payload.sourceId,
|
|
237
|
+
sourceListItemId: payload.sourceListItemId,
|
|
238
|
+
});
|
|
239
|
+
await this.notificationEventHandler.handleBackendEvent(notificationEvent);
|
|
240
|
+
}
|
|
241
|
+
if (this.activityEventHandler) {
|
|
242
|
+
const logMessage = `${creatorName} ${verb} ${count} transactions`;
|
|
243
|
+
const activityEvent = new ActivityLogEvents_1.ActivityLogCreated({
|
|
244
|
+
eventId: (0, uuid_1.v4)(),
|
|
245
|
+
userId: recipientUserId,
|
|
246
|
+
activityByUid: userId,
|
|
247
|
+
sourceType: EventTypes_1.EventMainType.TRANSACTION,
|
|
248
|
+
sourceEventType: EventTypes_1.EventType.BULK_OPERATION,
|
|
249
|
+
sourceId: userId,
|
|
250
|
+
sourceListItemId: bulkOperationId,
|
|
251
|
+
logMessage,
|
|
252
|
+
date: Date.now(),
|
|
253
|
+
createdAt: Date.now(),
|
|
254
|
+
createdBy: userId,
|
|
255
|
+
streamId: (0, uuid_1.v4)(),
|
|
256
|
+
systemGenerated: true,
|
|
257
|
+
version: 1,
|
|
258
|
+
});
|
|
259
|
+
await this.activityEventHandler.handleBackendEvent(activityEvent);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
this.logger.error(`[createBulkOperationSummary] Failed for recipient ${recipientUserId}:`, error);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
178
266
|
}
|
|
179
267
|
exports.TransactionEventHandler = TransactionEventHandler;
|
|
180
268
|
//# sourceMappingURL=TransactionEventHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionEventHandler.js","sourceRoot":"","sources":["../src/TransactionEventHandler.ts"],"names":[],"mappings":";;;AAAA,wBAUW;AACX,yDAAsD;
|
|
1
|
+
{"version":3,"file":"TransactionEventHandler.js","sourceRoot":"","sources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MAAM;oBAChB,gBAAgB,EAAE,eAAe;oBACjC,UAAU;oBACV,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;oBAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;oBACrB,SAAS,EAAE,MAAM;oBACjB,QAAQ,EAAE,IAAA,SAAM,GAAE;oBAClB,eAAe,EAAE,IAAI;oBACrB,OAAO,EAAE,CAAC;iBACX,CAAC,CAAC;gBACH,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,qDAAqD,eAAe,GAAG,EACvE,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA9WD,0DA8WC"}
|
|
@@ -75,9 +75,6 @@ export interface TransactionModelProps extends ModelProps {
|
|
|
75
75
|
tags?: string[];
|
|
76
76
|
category?: string;
|
|
77
77
|
attachmentsUrls?: string[];
|
|
78
|
-
associatedExpenseAccountId?: string;
|
|
79
|
-
associatedExpenseId?: string;
|
|
80
|
-
associatedRecurringManagementId?: string;
|
|
81
78
|
synced: boolean;
|
|
82
79
|
}
|
|
83
80
|
export declare class TransactionModel implements TransactionModelProps {
|
|
@@ -105,9 +102,6 @@ export declare class TransactionModel implements TransactionModelProps {
|
|
|
105
102
|
tags?: string[];
|
|
106
103
|
category?: string;
|
|
107
104
|
attachmentsUrls?: string[];
|
|
108
|
-
associatedExpenseAccountId?: string;
|
|
109
|
-
associatedExpenseId?: string;
|
|
110
|
-
associatedRecurringManagementId?: string;
|
|
111
105
|
synced: boolean;
|
|
112
106
|
constructor(props: TransactionModelProps);
|
|
113
107
|
}
|
|
@@ -130,11 +124,11 @@ export interface TransactionCreatedProps {
|
|
|
130
124
|
streamId: string;
|
|
131
125
|
version: number;
|
|
132
126
|
systemGenerated: boolean;
|
|
133
|
-
skipNotify?: boolean;
|
|
134
127
|
recurringId?: string;
|
|
135
128
|
tags?: string[];
|
|
136
129
|
category?: string;
|
|
137
130
|
attachmentsUrls?: string[];
|
|
131
|
+
bulkOperationId?: string;
|
|
138
132
|
}
|
|
139
133
|
export declare class TransactionCreated implements TransactionEvent {
|
|
140
134
|
readonly eventMainType: "transaction";
|
|
@@ -157,11 +151,11 @@ export declare class TransactionCreated implements TransactionEvent {
|
|
|
157
151
|
streamId: string;
|
|
158
152
|
version: number;
|
|
159
153
|
systemGenerated: boolean;
|
|
160
|
-
skipNotify?: boolean;
|
|
161
154
|
recurringId?: string;
|
|
162
155
|
tags?: string[];
|
|
163
156
|
category?: string;
|
|
164
157
|
attachmentsUrls?: string[];
|
|
158
|
+
bulkOperationId?: string;
|
|
165
159
|
constructor(props: TransactionCreatedProps);
|
|
166
160
|
apply(_existing?: Model): TransactionModel;
|
|
167
161
|
activityLog(_existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
@@ -175,7 +169,7 @@ export interface TransactionDeletedProps {
|
|
|
175
169
|
createdAt: number;
|
|
176
170
|
createdBy: string;
|
|
177
171
|
systemGenerated: boolean;
|
|
178
|
-
|
|
172
|
+
bulkOperationId?: string;
|
|
179
173
|
}
|
|
180
174
|
export declare class TransactionDeleted implements TransactionEvent {
|
|
181
175
|
readonly eventMainType: "transaction";
|
|
@@ -187,7 +181,7 @@ export declare class TransactionDeleted implements TransactionEvent {
|
|
|
187
181
|
createdAt: number;
|
|
188
182
|
createdBy: string;
|
|
189
183
|
systemGenerated: boolean;
|
|
190
|
-
|
|
184
|
+
bulkOperationId?: string;
|
|
191
185
|
constructor(props: TransactionDeletedProps);
|
|
192
186
|
apply(existing?: Model): TransactionModel;
|
|
193
187
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
@@ -208,11 +202,11 @@ export interface TransactionUpdatedProps {
|
|
|
208
202
|
streamId: string;
|
|
209
203
|
version: number;
|
|
210
204
|
systemGenerated: boolean;
|
|
211
|
-
skipNotify?: boolean;
|
|
212
205
|
recurringId?: string;
|
|
213
206
|
tags?: string[];
|
|
214
207
|
category?: string;
|
|
215
208
|
attachmentsUrls?: string[];
|
|
209
|
+
bulkOperationId?: string;
|
|
216
210
|
}
|
|
217
211
|
export declare class TransactionUpdated implements TransactionEvent {
|
|
218
212
|
readonly eventMainType: "transaction";
|
|
@@ -231,11 +225,11 @@ export declare class TransactionUpdated implements TransactionEvent {
|
|
|
231
225
|
streamId: string;
|
|
232
226
|
version: number;
|
|
233
227
|
systemGenerated: boolean;
|
|
234
|
-
skipNotify?: boolean;
|
|
235
228
|
recurringId?: string;
|
|
236
229
|
tags?: string[];
|
|
237
230
|
category?: string;
|
|
238
231
|
attachmentsUrls?: string[];
|
|
232
|
+
bulkOperationId?: string;
|
|
239
233
|
constructor(props: TransactionUpdatedProps);
|
|
240
234
|
apply(existing?: Model): TransactionModel;
|
|
241
235
|
activityLog(existing?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
|
|
@@ -249,7 +243,6 @@ export interface TransactionSyncedProps {
|
|
|
249
243
|
createdAt: number;
|
|
250
244
|
createdBy: string;
|
|
251
245
|
systemGenerated: boolean;
|
|
252
|
-
skipNotify?: boolean;
|
|
253
246
|
}
|
|
254
247
|
export declare class TransactionSynced implements TransactionEvent {
|
|
255
248
|
readonly eventMainType: "transaction";
|
|
@@ -261,7 +254,6 @@ export declare class TransactionSynced implements TransactionEvent {
|
|
|
261
254
|
createdAt: number;
|
|
262
255
|
createdBy: string;
|
|
263
256
|
systemGenerated: boolean;
|
|
264
|
-
skipNotify?: boolean;
|
|
265
257
|
constructor(props: TransactionSyncedProps);
|
|
266
258
|
apply(existing?: Model): TransactionModel;
|
|
267
259
|
activityLog(): undefined;
|