@zeeshan60/event-processor 1.0.0 → 1.0.2

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.
@@ -0,0 +1,348 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserConvertedToPlaceholder = exports.PlaceholderUserMerged = exports.UserDeleted = exports.UserDisplayNameChanged = exports.UserPhoneNumberChanged = exports.UserCurrencyChanged = exports.PlaceholderUserCreated = exports.UserCreated = exports.UserEventType = void 0;
4
+ const ActivityLogEvents_1 = require("./ActivityLogEvents");
5
+ const uuid_1 = require("uuid");
6
+ // User Event Types
7
+ var UserEventType;
8
+ (function (UserEventType) {
9
+ UserEventType["USER_CREATED"] = "USER_CREATED";
10
+ UserEventType["PLACEHOLDER_USER_CREATED"] = "PLACEHOLDER_USER_CREATED";
11
+ UserEventType["USER_DELETED"] = "USER_DELETED";
12
+ UserEventType["CURRENCY_CHANGED"] = "CURRENCY_CHANGED";
13
+ UserEventType["PHONE_NUMBER_CHANGED"] = "PHONE_NUMBER_CHANGED";
14
+ UserEventType["DISPLAY_NAME_CHANGED"] = "DISPLAY_NAME_CHANGED";
15
+ UserEventType["PLACEHOLDER_USER_MERGED"] = "PLACEHOLDER_USER_MERGED";
16
+ UserEventType["USER_CONVERTED_TO_PLACEHOLDER"] = "USER_CONVERTED_TO_PLACEHOLDER";
17
+ })(UserEventType || (exports.UserEventType = UserEventType = {}));
18
+ class UserCreated {
19
+ constructor(props) {
20
+ this.userId = props.userId;
21
+ this.firebaseUid = props.firebaseUid;
22
+ this.displayName = props.displayName;
23
+ this.phoneNumber = props.phoneNumber;
24
+ this.email = props.email;
25
+ this.photoUrl = props.photoUrl;
26
+ this.emailVerified = props.emailVerified;
27
+ this.createdAt = props.createdAt;
28
+ this.createdBy = props.createdBy;
29
+ this.streamId = props.streamId;
30
+ this.version = props.version;
31
+ }
32
+ apply(_existing) {
33
+ if (!this.userId) {
34
+ throw new Error('userId is required for UserModel');
35
+ }
36
+ return {
37
+ streamId: this.streamId,
38
+ userId: this.userId,
39
+ uid: this.firebaseUid,
40
+ displayName: this.displayName,
41
+ phoneNumber: this.phoneNumber,
42
+ email: this.email,
43
+ photoUrl: this.photoUrl,
44
+ currency: undefined,
45
+ emailVerified: this.emailVerified,
46
+ isPlaceholder: false,
47
+ createdAt: this.createdAt,
48
+ updatedAt: this.createdAt,
49
+ createdBy: this.createdBy,
50
+ updatedBy: this.createdBy,
51
+ version: this.version,
52
+ deleted: false,
53
+ };
54
+ }
55
+ activityLog(_existing, actorName) {
56
+ if (!this.userId) {
57
+ return undefined;
58
+ }
59
+ const actor = actorName ?? 'You';
60
+ const possessive = actor === 'You' ? 'your' : `${actor}'s`;
61
+ const logMessage = `${actor} created ${possessive} profile as "${this.displayName}"`;
62
+ return {
63
+ userId: this.userId,
64
+ activityByUid: this.createdBy,
65
+ sourceStreamId: this.streamId,
66
+ sourceType: ActivityLogEvents_1.SourceType.User,
67
+ logMessage,
68
+ date: this.createdAt,
69
+ createdAt: this.createdAt,
70
+ createdBy: this.createdBy,
71
+ streamId: (0, uuid_1.v4)(),
72
+ version: 1,
73
+ };
74
+ }
75
+ }
76
+ exports.UserCreated = UserCreated;
77
+ class PlaceholderUserCreated {
78
+ constructor(props) {
79
+ this.userId = props.userId;
80
+ this.displayName = props.displayName;
81
+ this.phoneNumber = props.phoneNumber;
82
+ this.email = props.email;
83
+ this.createdAt = props.createdAt;
84
+ this.createdBy = props.createdBy;
85
+ this.streamId = props.streamId;
86
+ this.version = props.version;
87
+ }
88
+ apply(_existing) {
89
+ if (!this.userId) {
90
+ throw new Error('userId is required for UserModel');
91
+ }
92
+ return {
93
+ streamId: this.streamId,
94
+ userId: this.userId,
95
+ uid: undefined,
96
+ displayName: this.displayName,
97
+ phoneNumber: this.phoneNumber,
98
+ email: this.email,
99
+ photoUrl: undefined,
100
+ currency: undefined,
101
+ emailVerified: false,
102
+ isPlaceholder: true,
103
+ createdAt: this.createdAt,
104
+ updatedAt: this.createdAt,
105
+ createdBy: this.createdBy,
106
+ updatedBy: this.createdBy,
107
+ version: this.version,
108
+ deleted: false,
109
+ };
110
+ }
111
+ }
112
+ exports.PlaceholderUserCreated = PlaceholderUserCreated;
113
+ class UserCurrencyChanged {
114
+ constructor(props) {
115
+ this.userId = props.userId;
116
+ this.currency = props.currency;
117
+ this.createdAt = props.createdAt;
118
+ this.createdBy = props.createdBy;
119
+ this.streamId = props.streamId;
120
+ this.version = props.version;
121
+ }
122
+ apply(existing) {
123
+ if (!existing) {
124
+ throw new Error('User must exist to change currency');
125
+ }
126
+ const existingUser = existing;
127
+ return {
128
+ ...existingUser,
129
+ currency: this.currency,
130
+ updatedAt: this.createdAt,
131
+ updatedBy: this.createdBy,
132
+ version: this.version,
133
+ };
134
+ }
135
+ activityLog(existing, actorName) {
136
+ if (!existing) {
137
+ return undefined;
138
+ }
139
+ const existingUser = existing;
140
+ const actor = actorName ?? 'You';
141
+ const possessive = actor === 'You' ? 'your' : `${actor}'s`;
142
+ const oldValue = existingUser.currency ?? '';
143
+ const newValue = this.currency ?? '';
144
+ const logMessage = `${actor} changed ${possessive} currency from ${oldValue} to ${newValue}`;
145
+ return {
146
+ userId: existingUser.userId,
147
+ activityByUid: this.createdBy,
148
+ sourceStreamId: this.streamId,
149
+ sourceType: ActivityLogEvents_1.SourceType.User,
150
+ logMessage,
151
+ date: this.createdAt,
152
+ createdAt: this.createdAt,
153
+ createdBy: this.createdBy,
154
+ streamId: (0, uuid_1.v4)(),
155
+ version: 1,
156
+ };
157
+ }
158
+ }
159
+ exports.UserCurrencyChanged = UserCurrencyChanged;
160
+ class UserPhoneNumberChanged {
161
+ constructor(props) {
162
+ this.userId = props.userId;
163
+ this.phoneNumber = props.phoneNumber;
164
+ this.createdAt = props.createdAt;
165
+ this.createdBy = props.createdBy;
166
+ this.streamId = props.streamId;
167
+ this.version = props.version;
168
+ }
169
+ apply(existing) {
170
+ if (!existing) {
171
+ throw new Error('User must exist to change phone number');
172
+ }
173
+ const existingUser = existing;
174
+ return {
175
+ ...existingUser,
176
+ phoneNumber: this.phoneNumber,
177
+ updatedAt: this.createdAt,
178
+ updatedBy: this.createdBy,
179
+ version: this.version,
180
+ };
181
+ }
182
+ activityLog(existing, actorName) {
183
+ if (!existing) {
184
+ return undefined;
185
+ }
186
+ const existingUser = existing;
187
+ const actor = actorName ?? 'You';
188
+ const possessive = actor === 'You' ? 'your' : `${actor}'s`;
189
+ let logMessage;
190
+ if (existingUser.phoneNumber && this.phoneNumber) {
191
+ logMessage = `${actor} changed ${possessive} phone number from ${existingUser.phoneNumber} to ${this.phoneNumber}`;
192
+ }
193
+ else if (this.phoneNumber) {
194
+ logMessage = `${actor} added ${possessive} phone number ${this.phoneNumber}`;
195
+ }
196
+ else {
197
+ logMessage = `${actor} removed ${possessive} phone number`;
198
+ }
199
+ return {
200
+ userId: existingUser.userId,
201
+ activityByUid: this.createdBy,
202
+ sourceStreamId: this.streamId,
203
+ sourceType: ActivityLogEvents_1.SourceType.User,
204
+ logMessage,
205
+ date: this.createdAt,
206
+ createdAt: this.createdAt,
207
+ createdBy: this.createdBy,
208
+ streamId: (0, uuid_1.v4)(),
209
+ version: 1,
210
+ };
211
+ }
212
+ }
213
+ exports.UserPhoneNumberChanged = UserPhoneNumberChanged;
214
+ class UserDisplayNameChanged {
215
+ constructor(props) {
216
+ this.userId = props.userId;
217
+ this.displayName = props.displayName;
218
+ this.createdAt = props.createdAt;
219
+ this.createdBy = props.createdBy;
220
+ this.streamId = props.streamId;
221
+ this.version = props.version;
222
+ }
223
+ apply(existing) {
224
+ if (!existing) {
225
+ throw new Error('User must exist to change display name');
226
+ }
227
+ const existingUser = existing;
228
+ return {
229
+ ...existingUser,
230
+ displayName: this.displayName,
231
+ updatedAt: this.createdAt,
232
+ updatedBy: this.createdBy,
233
+ version: this.version,
234
+ };
235
+ }
236
+ activityLog(existing, actorName) {
237
+ if (!existing) {
238
+ return undefined;
239
+ }
240
+ const existingUser = existing;
241
+ const actor = actorName ?? 'You';
242
+ const possessive = actor === 'You' ? 'your' : `${actor}'s`;
243
+ const logMessage = `${actor} changed ${possessive} name from "${existingUser.displayName}" to "${this.displayName}"`;
244
+ return {
245
+ userId: existingUser.userId,
246
+ activityByUid: this.createdBy,
247
+ sourceStreamId: this.streamId,
248
+ sourceType: ActivityLogEvents_1.SourceType.User,
249
+ logMessage,
250
+ date: this.createdAt,
251
+ createdAt: this.createdAt,
252
+ createdBy: this.createdBy,
253
+ streamId: (0, uuid_1.v4)(),
254
+ version: 1,
255
+ };
256
+ }
257
+ }
258
+ exports.UserDisplayNameChanged = UserDisplayNameChanged;
259
+ class UserDeleted {
260
+ constructor(props) {
261
+ this.userId = props.userId;
262
+ this.createdAt = props.createdAt;
263
+ this.createdBy = props.createdBy;
264
+ this.streamId = props.streamId;
265
+ this.version = props.version;
266
+ }
267
+ apply(existing) {
268
+ if (!existing) {
269
+ throw new Error('User must exist to delete');
270
+ }
271
+ const existingUser = existing;
272
+ return {
273
+ ...existingUser,
274
+ updatedAt: this.createdAt,
275
+ updatedBy: this.createdBy,
276
+ version: this.version,
277
+ deleted: true,
278
+ };
279
+ }
280
+ }
281
+ exports.UserDeleted = UserDeleted;
282
+ class PlaceholderUserMerged {
283
+ constructor(props) {
284
+ this.userId = props.userId;
285
+ this.firebaseUid = props.firebaseUid;
286
+ this.displayName = props.displayName;
287
+ this.email = props.email;
288
+ this.phoneNumber = props.phoneNumber;
289
+ this.photoUrl = props.photoUrl;
290
+ this.emailVerified = props.emailVerified;
291
+ this.createdAt = props.createdAt;
292
+ this.createdBy = props.createdBy;
293
+ this.streamId = props.streamId;
294
+ this.version = props.version;
295
+ }
296
+ apply(existing) {
297
+ if (!existing) {
298
+ throw new Error('Placeholder user must exist to merge');
299
+ }
300
+ const existingUser = existing;
301
+ if (!existingUser.isPlaceholder) {
302
+ throw new Error('Can only merge placeholder users');
303
+ }
304
+ return {
305
+ ...existingUser,
306
+ uid: this.firebaseUid,
307
+ displayName: this.displayName,
308
+ email: this.email,
309
+ phoneNumber: this.phoneNumber,
310
+ photoUrl: this.photoUrl,
311
+ emailVerified: this.emailVerified,
312
+ isPlaceholder: false,
313
+ updatedAt: this.createdAt,
314
+ updatedBy: this.createdBy,
315
+ version: this.version,
316
+ };
317
+ }
318
+ }
319
+ exports.PlaceholderUserMerged = PlaceholderUserMerged;
320
+ class UserConvertedToPlaceholder {
321
+ constructor(props) {
322
+ this.userId = props.userId;
323
+ this.createdAt = props.createdAt;
324
+ this.createdBy = props.createdBy;
325
+ this.streamId = props.streamId;
326
+ this.version = props.version;
327
+ }
328
+ apply(existing) {
329
+ if (!existing) {
330
+ throw new Error('User must exist to convert to placeholder');
331
+ }
332
+ const existingUser = existing;
333
+ if (existingUser.isPlaceholder) {
334
+ throw new Error('User is already a placeholder');
335
+ }
336
+ return {
337
+ ...existingUser,
338
+ uid: undefined,
339
+ isPlaceholder: true,
340
+ photoUrl: undefined,
341
+ emailVerified: false,
342
+ updatedAt: this.createdAt,
343
+ updatedBy: this.createdBy,
344
+ version: this.version,
345
+ };
346
+ }
347
+ }
348
+ exports.UserConvertedToPlaceholder = UserConvertedToPlaceholder;
@@ -1,8 +1,11 @@
1
1
  import { Model } from './Model';
2
+ import { ActivityLogCreatedProps } from '../ActivityLogEvents';
2
3
  export interface Event {
3
- userId: string;
4
4
  streamId: string;
5
5
  version: number;
6
- apply(existing: Model | null): Model;
6
+ createdAt: Date;
7
+ createdBy: string;
8
+ apply(existing?: Model): Model;
9
+ activityLog?(existingModel?: Model, actorName?: string): ActivityLogCreatedProps | undefined;
7
10
  }
8
11
  //# sourceMappingURL=Event.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../src/common/Event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;CACtC"}
1
+ {"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../src/common/Event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC/B,WAAW,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;CAC9F"}
@@ -1,5 +1,4 @@
1
1
  export interface Model {
2
- id: string | null;
3
2
  userId: string;
4
3
  streamId: string;
5
4
  version: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/common/Model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/common/Model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -1,5 +1,3 @@
1
1
  export { Event } from './Event';
2
2
  export { Model } from './Model';
3
- export { EventStore } from './EventStore';
4
- export { ModelStore } from './ModelStore';
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1,7 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelStore = exports.EventStore = void 0;
4
- var EventStore_1 = require("./EventStore");
5
- Object.defineProperty(exports, "EventStore", { enumerable: true, get: function () { return EventStore_1.EventStore; } });
6
- var ModelStore_1 = require("./ModelStore");
7
- Object.defineProperty(exports, "ModelStore", { enumerable: true, get: function () { return ModelStore_1.ModelStore; } });
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  export { Event } from './common/Event';
2
2
  export { Model } from './common/Model';
3
- export { EventStore } from './common/EventStore';
4
- export { ModelStore } from './common/ModelStore';
5
- export { InMemoryEventStore } from './store/InMemoryEventStore';
6
- export { InMemoryModelStore } from './store/InMemoryModelStore';
7
- export { TransactionEventHandler } from './TransactionEventHandler';
8
- export { TransactionCreated, TransactionModel, SplitType, TransactionEventType, AmountDto, ChangeHistory, ChangeHistoryItem, DescriptionUpdated, AmountUpdated, CurrencyUpdated, SplitTypeUpdated, TransactionDateUpdated, } from './TransactionEvents';
3
+ export { TransactionCreated, TransactionCreatedProps, TransactionDeleted, TransactionDeletedProps, DescriptionChanged, DescriptionChangedProps, TotalAmountChanged, TotalAmountChangedProps, SplitTypeChanged, SplitTypeChangedProps, CurrencyChanged, CurrencyChangedProps, TransactionDateChanged, TransactionDateChangedProps, TransactionModel, SplitType, TransactionEventType, AmountDto, ChangeHistory, ChangeHistoryItem, DescriptionUpdated, AmountUpdated, CurrencyUpdated, SplitTypeUpdated, TransactionDateUpdated, } from './TransactionEvents';
4
+ export { UserCreated, UserCreatedProps, PlaceholderUserCreated, PlaceholderUserCreatedProps, UserCurrencyChanged, UserCurrencyChangedProps, UserPhoneNumberChanged, UserPhoneNumberChangedProps, UserDisplayNameChanged, UserDisplayNameChangedProps, UserDeleted, UserDeletedProps, PlaceholderUserMerged, PlaceholderUserMergedProps, UserConvertedToPlaceholder, UserConvertedToPlaceholderProps, UserModel, UserEventType, } from './UserEvents';
5
+ export { FriendCreated, FriendCreatedProps, FriendUpdated, FriendUpdatedProps, FriendDeleted, FriendDeletedProps, FriendIdAdded, FriendIdAddedProps, FriendIdRemoved, FriendIdRemovedProps, FriendModel, FriendEventType, } from './FriendEvents';
6
+ export { ActivityLogCreated, ActivityLogCreatedProps, ActivityLogModel, SourceType, } from './ActivityLogEvents';
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,2BAA2B,EAC3B,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,+BAA+B,EAC/B,SAAS,EACT,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,GACX,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,21 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangeHistory = exports.TransactionEventType = exports.SplitType = exports.TransactionCreated = exports.TransactionEventHandler = exports.InMemoryModelStore = exports.InMemoryEventStore = exports.ModelStore = exports.EventStore = void 0;
4
- // Abstract stores
5
- var EventStore_1 = require("./common/EventStore");
6
- Object.defineProperty(exports, "EventStore", { enumerable: true, get: function () { return EventStore_1.EventStore; } });
7
- var ModelStore_1 = require("./common/ModelStore");
8
- Object.defineProperty(exports, "ModelStore", { enumerable: true, get: function () { return ModelStore_1.ModelStore; } });
9
- // In-memory implementations
10
- var InMemoryEventStore_1 = require("./store/InMemoryEventStore");
11
- Object.defineProperty(exports, "InMemoryEventStore", { enumerable: true, get: function () { return InMemoryEventStore_1.InMemoryEventStore; } });
12
- var InMemoryModelStore_1 = require("./store/InMemoryModelStore");
13
- Object.defineProperty(exports, "InMemoryModelStore", { enumerable: true, get: function () { return InMemoryModelStore_1.InMemoryModelStore; } });
14
- // Transaction event handler and types
15
- var TransactionEventHandler_1 = require("./TransactionEventHandler");
16
- Object.defineProperty(exports, "TransactionEventHandler", { enumerable: true, get: function () { return TransactionEventHandler_1.TransactionEventHandler; } });
3
+ exports.SourceType = exports.ActivityLogCreated = exports.FriendEventType = exports.FriendIdRemoved = exports.FriendIdAdded = exports.FriendDeleted = exports.FriendUpdated = exports.FriendCreated = exports.UserEventType = exports.UserConvertedToPlaceholder = exports.PlaceholderUserMerged = exports.UserDeleted = exports.UserDisplayNameChanged = exports.UserPhoneNumberChanged = exports.UserCurrencyChanged = exports.PlaceholderUserCreated = exports.UserCreated = exports.ChangeHistory = exports.TransactionEventType = exports.SplitType = exports.TransactionDateChanged = exports.CurrencyChanged = exports.SplitTypeChanged = exports.TotalAmountChanged = exports.DescriptionChanged = exports.TransactionDeleted = exports.TransactionCreated = void 0;
4
+ // Transaction event types
17
5
  var TransactionEvents_1 = require("./TransactionEvents");
18
6
  Object.defineProperty(exports, "TransactionCreated", { enumerable: true, get: function () { return TransactionEvents_1.TransactionCreated; } });
7
+ Object.defineProperty(exports, "TransactionDeleted", { enumerable: true, get: function () { return TransactionEvents_1.TransactionDeleted; } });
8
+ Object.defineProperty(exports, "DescriptionChanged", { enumerable: true, get: function () { return TransactionEvents_1.DescriptionChanged; } });
9
+ Object.defineProperty(exports, "TotalAmountChanged", { enumerable: true, get: function () { return TransactionEvents_1.TotalAmountChanged; } });
10
+ Object.defineProperty(exports, "SplitTypeChanged", { enumerable: true, get: function () { return TransactionEvents_1.SplitTypeChanged; } });
11
+ Object.defineProperty(exports, "CurrencyChanged", { enumerable: true, get: function () { return TransactionEvents_1.CurrencyChanged; } });
12
+ Object.defineProperty(exports, "TransactionDateChanged", { enumerable: true, get: function () { return TransactionEvents_1.TransactionDateChanged; } });
19
13
  Object.defineProperty(exports, "SplitType", { enumerable: true, get: function () { return TransactionEvents_1.SplitType; } });
20
14
  Object.defineProperty(exports, "TransactionEventType", { enumerable: true, get: function () { return TransactionEvents_1.TransactionEventType; } });
21
15
  Object.defineProperty(exports, "ChangeHistory", { enumerable: true, get: function () { return TransactionEvents_1.ChangeHistory; } });
16
+ // User event types
17
+ var UserEvents_1 = require("./UserEvents");
18
+ Object.defineProperty(exports, "UserCreated", { enumerable: true, get: function () { return UserEvents_1.UserCreated; } });
19
+ Object.defineProperty(exports, "PlaceholderUserCreated", { enumerable: true, get: function () { return UserEvents_1.PlaceholderUserCreated; } });
20
+ Object.defineProperty(exports, "UserCurrencyChanged", { enumerable: true, get: function () { return UserEvents_1.UserCurrencyChanged; } });
21
+ Object.defineProperty(exports, "UserPhoneNumberChanged", { enumerable: true, get: function () { return UserEvents_1.UserPhoneNumberChanged; } });
22
+ Object.defineProperty(exports, "UserDisplayNameChanged", { enumerable: true, get: function () { return UserEvents_1.UserDisplayNameChanged; } });
23
+ Object.defineProperty(exports, "UserDeleted", { enumerable: true, get: function () { return UserEvents_1.UserDeleted; } });
24
+ Object.defineProperty(exports, "PlaceholderUserMerged", { enumerable: true, get: function () { return UserEvents_1.PlaceholderUserMerged; } });
25
+ Object.defineProperty(exports, "UserConvertedToPlaceholder", { enumerable: true, get: function () { return UserEvents_1.UserConvertedToPlaceholder; } });
26
+ Object.defineProperty(exports, "UserEventType", { enumerable: true, get: function () { return UserEvents_1.UserEventType; } });
27
+ // Friend event types
28
+ var FriendEvents_1 = require("./FriendEvents");
29
+ Object.defineProperty(exports, "FriendCreated", { enumerable: true, get: function () { return FriendEvents_1.FriendCreated; } });
30
+ Object.defineProperty(exports, "FriendUpdated", { enumerable: true, get: function () { return FriendEvents_1.FriendUpdated; } });
31
+ Object.defineProperty(exports, "FriendDeleted", { enumerable: true, get: function () { return FriendEvents_1.FriendDeleted; } });
32
+ Object.defineProperty(exports, "FriendIdAdded", { enumerable: true, get: function () { return FriendEvents_1.FriendIdAdded; } });
33
+ Object.defineProperty(exports, "FriendIdRemoved", { enumerable: true, get: function () { return FriendEvents_1.FriendIdRemoved; } });
34
+ Object.defineProperty(exports, "FriendEventType", { enumerable: true, get: function () { return FriendEvents_1.FriendEventType; } });
35
+ // Activity Log types
36
+ var ActivityLogEvents_1 = require("./ActivityLogEvents");
37
+ Object.defineProperty(exports, "ActivityLogCreated", { enumerable: true, get: function () { return ActivityLogEvents_1.ActivityLogCreated; } });
38
+ Object.defineProperty(exports, "SourceType", { enumerable: true, get: function () { return ActivityLogEvents_1.SourceType; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeeshan60/event-processor",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared event sourcing infrastructure for Loan Tracker projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,8 +26,12 @@
26
26
  "devDependencies": {
27
27
  "@types/jest": "^30.0.0",
28
28
  "@types/node": "^20.10.0",
29
+ "@types/uuid": "^10.0.0",
29
30
  "jest": "^30.2.0",
30
31
  "ts-jest": "^29.4.5",
31
32
  "typescript": "^5.3.3"
33
+ },
34
+ "dependencies": {
35
+ "uuid": "^13.0.0"
32
36
  }
33
37
  }