@zeeshan60/event-processor 1.0.15 → 1.0.17

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.
Files changed (122) hide show
  1. package/README.md +29 -22
  2. package/dist/ActivityEventHandler.d.ts +7 -4
  3. package/dist/ActivityEventHandler.d.ts.map +1 -1
  4. package/dist/ActivityEventHandler.js +24 -13
  5. package/dist/ActivityLogEvents.d.ts.map +1 -1
  6. package/dist/ActivityLogEvents.js +1 -0
  7. package/dist/BaseEventHandler.d.ts +12 -3
  8. package/dist/BaseEventHandler.d.ts.map +1 -1
  9. package/dist/BaseEventHandler.js +15 -0
  10. package/dist/EventProcessorSDK.d.ts +8 -0
  11. package/dist/EventProcessorSDK.d.ts.map +1 -1
  12. package/dist/EventProcessorSDK.js +20 -6
  13. package/dist/FriendEventHandler.d.ts +8 -3
  14. package/dist/FriendEventHandler.d.ts.map +1 -1
  15. package/dist/FriendEventHandler.js +65 -39
  16. package/dist/GroupEventHandler.d.ts +6 -3
  17. package/dist/GroupEventHandler.d.ts.map +1 -1
  18. package/dist/GroupEventHandler.js +254 -189
  19. package/dist/GroupTransactionEventHandler.d.ts +5 -8
  20. package/dist/GroupTransactionEventHandler.d.ts.map +1 -1
  21. package/dist/GroupTransactionEventHandler.js +26 -298
  22. package/dist/TransactionEventHandler.d.ts +5 -3
  23. package/dist/TransactionEventHandler.d.ts.map +1 -1
  24. package/dist/TransactionEventHandler.js +26 -13
  25. package/dist/TransactionEvents.d.ts +10 -9
  26. package/dist/TransactionEvents.d.ts.map +1 -1
  27. package/dist/TransactionEvents.js +10 -12
  28. package/dist/UserEventHandler.d.ts +5 -3
  29. package/dist/UserEventHandler.d.ts.map +1 -1
  30. package/dist/UserEventHandler.js +27 -14
  31. package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts +1 -0
  32. package/dist/__tests__/test-helpers/IMActivityLogEventStore.d.ts.map +1 -1
  33. package/dist/__tests__/test-helpers/IMActivityLogEventStore.js +3 -0
  34. package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts +2 -0
  35. package/dist/__tests__/test-helpers/IMActivityLogModelStore.d.ts.map +1 -1
  36. package/dist/__tests__/test-helpers/IMActivityLogModelStore.js +10 -0
  37. package/dist/__tests__/test-helpers/IMCurrencyStore.d.ts +9 -0
  38. package/dist/__tests__/test-helpers/IMCurrencyStore.d.ts.map +1 -0
  39. package/dist/__tests__/test-helpers/IMCurrencyStore.js +19 -0
  40. package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts +1 -0
  41. package/dist/__tests__/test-helpers/IMFriendModelStore.d.ts.map +1 -1
  42. package/dist/__tests__/test-helpers/IMFriendModelStore.js +7 -0
  43. package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts +1 -0
  44. package/dist/__tests__/test-helpers/IMGroupModelStore.d.ts.map +1 -1
  45. package/dist/__tests__/test-helpers/IMGroupModelStore.js +7 -0
  46. package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts +2 -0
  47. package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.d.ts.map +1 -1
  48. package/dist/__tests__/test-helpers/IMGroupTransactionEventStore.js +18 -0
  49. package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts +1 -0
  50. package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.d.ts.map +1 -1
  51. package/dist/__tests__/test-helpers/IMGroupTransactionModelStore.js +7 -0
  52. package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts +2 -0
  53. package/dist/__tests__/test-helpers/IMTransactionEventStore.d.ts.map +1 -1
  54. package/dist/__tests__/test-helpers/IMTransactionEventStore.js +6 -0
  55. package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts +3 -0
  56. package/dist/__tests__/test-helpers/IMTransactionModelStore.d.ts.map +1 -1
  57. package/dist/__tests__/test-helpers/IMTransactionModelStore.js +27 -0
  58. package/dist/__tests__/test-helpers/IMUserModelStore.d.ts +4 -0
  59. package/dist/__tests__/test-helpers/IMUserModelStore.d.ts.map +1 -1
  60. package/dist/__tests__/test-helpers/IMUserModelStore.js +17 -0
  61. package/dist/client/controllers/FriendController.d.ts +4 -0
  62. package/dist/client/controllers/FriendController.d.ts.map +1 -1
  63. package/dist/client/controllers/FriendController.js +81 -15
  64. package/dist/client/controllers/TransactionController.d.ts +13 -2
  65. package/dist/client/controllers/TransactionController.d.ts.map +1 -1
  66. package/dist/client/controllers/TransactionController.js +150 -16
  67. package/dist/client/handlers/UIEventHandler.d.ts +3 -0
  68. package/dist/client/handlers/UIEventHandler.d.ts.map +1 -1
  69. package/dist/client/handlers/UIEventHandler.js +36 -0
  70. package/dist/common/CurrencyRate.d.ts +7 -0
  71. package/dist/common/CurrencyRate.d.ts.map +1 -0
  72. package/dist/common/CurrencyRate.js +2 -0
  73. package/dist/common/Model.d.ts +1 -0
  74. package/dist/common/Model.d.ts.map +1 -1
  75. package/dist/contracts/friends/index.d.ts +2 -9
  76. package/dist/contracts/friends/index.d.ts.map +1 -1
  77. package/dist/contracts/groups/index.d.ts +1 -1
  78. package/dist/contracts/groups/index.d.ts.map +1 -1
  79. package/dist/contracts/transactions/index.d.ts +33 -23
  80. package/dist/contracts/transactions/index.d.ts.map +1 -1
  81. package/dist/contracts/transactions/index.js +14 -11
  82. package/dist/converters/ActivityLogConverters.d.ts.map +1 -1
  83. package/dist/converters/ActivityLogConverters.js +3 -1
  84. package/dist/events.d.ts +2 -0
  85. package/dist/events.d.ts.map +1 -1
  86. package/dist/events.js +7 -1
  87. package/dist/index.d.ts +3 -4
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +8 -5
  90. package/dist/store/CurrencyStore.d.ts +6 -0
  91. package/dist/store/CurrencyStore.d.ts.map +1 -0
  92. package/dist/store/CurrencyStore.js +6 -0
  93. package/dist/store/ModelStore.d.ts +1 -0
  94. package/dist/store/ModelStore.d.ts.map +1 -1
  95. package/dist/store/TransactionModelStore.d.ts +2 -0
  96. package/dist/store/TransactionModelStore.d.ts.map +1 -1
  97. package/dist/store/UserModelStore.d.ts +1 -0
  98. package/dist/store/UserModelStore.d.ts.map +1 -1
  99. package/dist/utils/BalanceUtil.d.ts +17 -0
  100. package/dist/utils/BalanceUtil.d.ts.map +1 -0
  101. package/dist/utils/BalanceUtil.js +105 -0
  102. package/dist/utils/splitTypeUtils.d.ts.map +1 -1
  103. package/dist/utils/splitTypeUtils.js +21 -21
  104. package/package.json +1 -1
  105. package/dist/client/handlers/UIFriendEventHandler.d.ts +0 -16
  106. package/dist/client/handlers/UIFriendEventHandler.d.ts.map +0 -1
  107. package/dist/client/handlers/UIFriendEventHandler.js +0 -27
  108. package/dist/client/handlers/UIGroupEventHandler.d.ts +0 -18
  109. package/dist/client/handlers/UIGroupEventHandler.d.ts.map +0 -1
  110. package/dist/client/handlers/UIGroupEventHandler.js +0 -28
  111. package/dist/client/handlers/UIGroupTransactionEventHandler.d.ts +0 -18
  112. package/dist/client/handlers/UIGroupTransactionEventHandler.d.ts.map +0 -1
  113. package/dist/client/handlers/UIGroupTransactionEventHandler.js +0 -28
  114. package/dist/client/handlers/UITransactionEventHandler.d.ts +0 -14
  115. package/dist/client/handlers/UITransactionEventHandler.d.ts.map +0 -1
  116. package/dist/client/handlers/UITransactionEventHandler.js +0 -26
  117. package/dist/client/handlers/UIUserEventHandler.d.ts +0 -12
  118. package/dist/client/handlers/UIUserEventHandler.d.ts.map +0 -1
  119. package/dist/client/handlers/UIUserEventHandler.js +0 -29
  120. package/dist/utils/userPathUtils.d.ts +0 -6
  121. package/dist/utils/userPathUtils.d.ts.map +0 -1
  122. package/dist/utils/userPathUtils.js +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contracts/transactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO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AAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;AAED,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,WAAW,CAAC;CACpC"}
@@ -1,19 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransactionChangeType = exports.ActivityType = exports.SplitTypeEnum = void 0;
4
- const TransactionEvents_1 = require("../../TransactionEvents");
5
- Object.defineProperty(exports, "SplitTypeEnum", { enumerable: true, get: function () { return TransactionEvents_1.SplitType; } });
3
+ exports.TransactionChangeTypeEnum = exports.ActivityType = exports.SplitTypeEnum = void 0;
4
+ var TransactionEvents_1 = require("../../TransactionEvents");
5
+ Object.defineProperty(exports, "SplitTypeEnum", { enumerable: true, get: function () { return TransactionEvents_1.SplitTypeEnum; } });
6
+ // export type SplitType = EventSplitType;
7
+ // export { EventSplitType as SplitTypeEnum };
6
8
  var ActivityType;
7
9
  (function (ActivityType) {
8
10
  ActivityType["CREATED"] = "CREATED";
9
11
  ActivityType["UPDATED"] = "UPDATED";
10
12
  ActivityType["DELETED"] = "DELETED";
11
13
  })(ActivityType || (exports.ActivityType = ActivityType = {}));
12
- var TransactionChangeType;
13
- (function (TransactionChangeType) {
14
- TransactionChangeType["DESCRIPTION"] = "DESCRIPTION";
15
- TransactionChangeType["AMOUNT"] = "AMOUNT";
16
- TransactionChangeType["CURRENCY"] = "CURRENCY";
17
- TransactionChangeType["SPLIT_TYPE"] = "SPLIT_TYPE";
18
- TransactionChangeType["DATE"] = "DATE";
19
- })(TransactionChangeType || (exports.TransactionChangeType = TransactionChangeType = {}));
14
+ exports.TransactionChangeTypeEnum = {
15
+ DESCRIPTION: "DESCRIPTION",
16
+ AMOUNT: "AMOUNT",
17
+ CURRENCY: "CURRENCY",
18
+ SPLIT_TYPE: "SPLIT_TYPE",
19
+ DATE: "DATE",
20
+ DELETED: "DELETED",
21
+ TRANSACTION_DATE: "TRANSACTION_DATE",
22
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"ActivityLogConverters.d.ts","sourceRoot":"","sources":["../../src/converters/ActivityLogConverters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACH,yBAAyB,EAEzB,kBAAkB,EACrB,MAAM,sBAAsB,CAAC;AAI9B,qBAAa,2BAA4B,SAAQ,yBAAyB;IACtE,OAAO,CAAC,eAAe,CAAkB;;IAOzC,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB;IAW9D,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;CAgBlE"}
1
+ {"version":3,"file":"ActivityLogConverters.d.ts","sourceRoot":"","sources":["../../src/converters/ActivityLogConverters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACH,yBAAyB,EAEzB,kBAAkB,EACrB,MAAM,sBAAsB,CAAC;AAI9B,qBAAa,2BAA4B,SAAQ,yBAAyB;IACtE,OAAO,CAAC,eAAe,CAAkB;;IAOzC,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB;IAW9D,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;CAkBlE"}
@@ -27,7 +27,9 @@ class ActivityLogCreatedConverter extends EventConverterCore_1.ActivityLogEventC
27
27
  sourceStreamId: data.sourceStreamId,
28
28
  sourceType: data.sourceType,
29
29
  logMessage: data.logMessage,
30
- date: this.firebaseAdapter.toDate(data.date),
30
+ date: data.date
31
+ ? this.firebaseAdapter.toDate(data.date)
32
+ : new Date(), // todo: zeeshan: fix this fallback date
31
33
  createdAt: this.firebaseAdapter.toDate(data.createdAt),
32
34
  createdBy: data.createdBy,
33
35
  streamId: data.streamId,
package/dist/events.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./GroupTransactionEvents";
6
6
  export * from "./ActivityLogEvents";
7
7
  export * from "./common/Event";
8
8
  export * from "./common/Model";
9
+ export { BaseEventHandler } from "./BaseEventHandler";
9
10
  export * from "./store/ModelStore";
10
11
  export * from "./store/TransactionEventStore";
11
12
  export * from "./store/TransactionModelStore";
@@ -26,4 +27,5 @@ export { GroupEventHandler } from "./GroupEventHandler";
26
27
  export { GroupTransactionEventHandler } from "./GroupTransactionEventHandler";
27
28
  export { ActivityEventHandler } from "./ActivityEventHandler";
28
29
  export { reverseSplitType, calculateMirrorAmountAndIsOwed, } from "./utils/splitTypeUtils";
30
+ export { BalanceUtil } from "./utils/BalanceUtil";
29
31
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB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BAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EACH,gBAAgB,EAChB,8BAA8B,GACjC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/events.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.calculateMirrorAmountAndIsOwed = exports.reverseSplitType = exports.ActivityEventHandler = exports.GroupTransactionEventHandler = exports.GroupEventHandler = exports.FriendEventHandler = exports.UserEventHandler = exports.TransactionEventHandler = void 0;
17
+ exports.BalanceUtil = exports.calculateMirrorAmountAndIsOwed = exports.reverseSplitType = exports.ActivityEventHandler = exports.GroupTransactionEventHandler = exports.GroupEventHandler = exports.FriendEventHandler = exports.UserEventHandler = exports.TransactionEventHandler = exports.BaseEventHandler = void 0;
18
18
  // Re-export all event types
19
19
  __exportStar(require("./TransactionEvents"), exports);
20
20
  __exportStar(require("./UserEvents"), exports);
@@ -25,6 +25,9 @@ __exportStar(require("./ActivityLogEvents"), exports);
25
25
  // Re-export common types
26
26
  __exportStar(require("./common/Event"), exports);
27
27
  __exportStar(require("./common/Model"), exports);
28
+ // Re-export base event handler
29
+ var BaseEventHandler_1 = require("./BaseEventHandler");
30
+ Object.defineProperty(exports, "BaseEventHandler", { enumerable: true, get: function () { return BaseEventHandler_1.BaseEventHandler; } });
28
31
  // Re-export store classes
29
32
  __exportStar(require("./store/ModelStore"), exports);
30
33
  __exportStar(require("./store/TransactionEventStore"), exports);
@@ -56,3 +59,6 @@ Object.defineProperty(exports, "ActivityEventHandler", { enumerable: true, get:
56
59
  var splitTypeUtils_1 = require("./utils/splitTypeUtils");
57
60
  Object.defineProperty(exports, "reverseSplitType", { enumerable: true, get: function () { return splitTypeUtils_1.reverseSplitType; } });
58
61
  Object.defineProperty(exports, "calculateMirrorAmountAndIsOwed", { enumerable: true, get: function () { return splitTypeUtils_1.calculateMirrorAmountAndIsOwed; } });
62
+ // Re-export utility classes
63
+ var BalanceUtil_1 = require("./utils/BalanceUtil");
64
+ Object.defineProperty(exports, "BalanceUtil", { enumerable: true, get: function () { return BalanceUtil_1.BalanceUtil; } });
package/dist/index.d.ts CHANGED
@@ -5,13 +5,12 @@ export { UserController } from "./client/controllers/UserController";
5
5
  export { FriendController } from "./client/controllers/FriendController";
6
6
  export { TransactionController } from "./client/controllers/TransactionController";
7
7
  export { UIEventHandler } from "./client/handlers/UIEventHandler";
8
- export { EventProcessorSDK, initializeSDK, getUserController, getFriendController, getTransactionController, getUIEventHandler, getUserEventHandler, getFriendEventHandler, getTransactionEventHandler, getGroupEventHandler, getGroupTransactionEventHandler, getActivityEventHandler, getFirebaseAdapter, getModelChangeObservable, eventToFirestore, firestoreToEvent, isSDKInitialized, StoreConfig, } from "./EventProcessorSDK";
8
+ export { EventProcessorSDK, initializeSDK, getUserController, getFriendController, getTransactionController, getUIEventHandler, getUserEventHandler, getFriendEventHandler, getTransactionEventHandler, getGroupEventHandler, getGroupTransactionEventHandler, getActivityEventHandler, getFirebaseAdapter, getCurrencyStore, getModelChangeObservable, eventToFirestore, firestoreToEvent, isSDKInitialized, StoreConfig, } from "./EventProcessorSDK";
9
9
  export { ModelChangeEmitter, ModelChange } from "./ModelChangeEmitter";
10
10
  export { FirebaseAdapter } from "./adapters/FirebaseAdapter";
11
+ export { CurrencyStore } from "./store/CurrencyStore";
12
+ export type { CurrencyRate } from "./common/CurrencyRate";
11
13
  export type { FirestoreEventData } from "./converters/eventConverter";
12
14
  export { EventConverterFactory } from "./converters/eventConverter";
13
15
  export { __resetSDKForTesting } from "./EventProcessorSDK";
14
- export declare const residence: {
15
- isClient: boolean;
16
- };
17
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EACH,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,UAAU,EACV,qBAAqB,EACrB,gBAAgB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGnF,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EACH,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACpB,+BAA+B,EAC/B,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,GACd,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO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CAAC"}
package/dist/index.js CHANGED
@@ -14,9 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.residence = exports.__resetSDKForTesting = exports.EventConverterFactory = exports.ModelChangeEmitter = exports.isSDKInitialized = exports.firestoreToEvent = exports.eventToFirestore = exports.getModelChangeObservable = exports.getFirebaseAdapter = exports.getActivityEventHandler = exports.getGroupTransactionEventHandler = exports.getGroupEventHandler = exports.getTransactionEventHandler = exports.getFriendEventHandler = exports.getUserEventHandler = exports.getUIEventHandler = exports.getTransactionController = exports.getFriendController = exports.getUserController = exports.initializeSDK = exports.EventProcessorSDK = exports.UIEventHandler = exports.TransactionController = exports.FriendController = exports.UserController = void 0;
17
+ exports.__resetSDKForTesting = exports.EventConverterFactory = exports.CurrencyStore = exports.ModelChangeEmitter = exports.isSDKInitialized = exports.firestoreToEvent = exports.eventToFirestore = exports.getModelChangeObservable = exports.getCurrencyStore = exports.getFirebaseAdapter = exports.getActivityEventHandler = exports.getGroupTransactionEventHandler = exports.getGroupEventHandler = exports.getTransactionEventHandler = exports.getFriendEventHandler = exports.getUserEventHandler = exports.getUIEventHandler = exports.getTransactionController = exports.getFriendController = exports.getUserController = exports.initializeSDK = exports.EventProcessorSDK = exports.UIEventHandler = exports.TransactionController = exports.FriendController = exports.UserController = exports.BaseEventHandler = void 0;
18
18
  // Export all backend event definitions here
19
19
  __exportStar(require("./events"), exports);
20
+ // Export base event handler interface
21
+ var BaseEventHandler_1 = require("./BaseEventHandler");
22
+ Object.defineProperty(exports, "BaseEventHandler", { enumerable: true, get: function () { return BaseEventHandler_1.BaseEventHandler; } });
20
23
  // Export controllers
21
24
  var UserController_1 = require("./client/controllers/UserController");
22
25
  Object.defineProperty(exports, "UserController", { enumerable: true, get: function () { return UserController_1.UserController; } });
@@ -42,6 +45,7 @@ Object.defineProperty(exports, "getGroupEventHandler", { enumerable: true, get:
42
45
  Object.defineProperty(exports, "getGroupTransactionEventHandler", { enumerable: true, get: function () { return EventProcessorSDK_1.getGroupTransactionEventHandler; } });
43
46
  Object.defineProperty(exports, "getActivityEventHandler", { enumerable: true, get: function () { return EventProcessorSDK_1.getActivityEventHandler; } });
44
47
  Object.defineProperty(exports, "getFirebaseAdapter", { enumerable: true, get: function () { return EventProcessorSDK_1.getFirebaseAdapter; } });
48
+ Object.defineProperty(exports, "getCurrencyStore", { enumerable: true, get: function () { return EventProcessorSDK_1.getCurrencyStore; } });
45
49
  Object.defineProperty(exports, "getModelChangeObservable", { enumerable: true, get: function () { return EventProcessorSDK_1.getModelChangeObservable; } });
46
50
  Object.defineProperty(exports, "eventToFirestore", { enumerable: true, get: function () { return EventProcessorSDK_1.eventToFirestore; } });
47
51
  Object.defineProperty(exports, "firestoreToEvent", { enumerable: true, get: function () { return EventProcessorSDK_1.firestoreToEvent; } });
@@ -49,12 +53,11 @@ Object.defineProperty(exports, "isSDKInitialized", { enumerable: true, get: func
49
53
  // Export ModelChangeEmitter
50
54
  var ModelChangeEmitter_1 = require("./ModelChangeEmitter");
51
55
  Object.defineProperty(exports, "ModelChangeEmitter", { enumerable: true, get: function () { return ModelChangeEmitter_1.ModelChangeEmitter; } });
56
+ // Export currency store and types
57
+ var CurrencyStore_1 = require("./store/CurrencyStore");
58
+ Object.defineProperty(exports, "CurrencyStore", { enumerable: true, get: function () { return CurrencyStore_1.CurrencyStore; } });
52
59
  var eventConverter_1 = require("./converters/eventConverter");
53
60
  Object.defineProperty(exports, "EventConverterFactory", { enumerable: true, get: function () { return eventConverter_1.EventConverterFactory; } });
54
61
  // Export singleton utilities for testing
55
62
  var EventProcessorSDK_2 = require("./EventProcessorSDK");
56
63
  Object.defineProperty(exports, "__resetSDKForTesting", { enumerable: true, get: function () { return EventProcessorSDK_2.__resetSDKForTesting; } });
57
- // Export environment context
58
- exports.residence = {
59
- isClient: true,
60
- };
@@ -0,0 +1,6 @@
1
+ import { CurrencyRate } from "../common/CurrencyRate";
2
+ export declare abstract class CurrencyStore {
3
+ abstract getCurrencyRates(): Promise<CurrencyRate | undefined>;
4
+ abstract saveCurrencyRates(rates: CurrencyRate): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=CurrencyStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyStore.d.ts","sourceRoot":"","sources":["../../src/store/CurrencyStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,8BAAsB,aAAa;IAC/B,QAAQ,CAAC,gBAAgB,IAAI,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;CACjE"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CurrencyStore = void 0;
4
+ class CurrencyStore {
5
+ }
6
+ exports.CurrencyStore = CurrencyStore;
@@ -2,6 +2,7 @@ import { Model } from "..";
2
2
  export interface ModelStore {
3
3
  getByStreamId(streamId: string): Promise<Model | undefined>;
4
4
  getByStreamIdWhereDeletedIsFalse(streamId: string): Promise<Model | undefined>;
5
+ getLatestByUpdatedAt(): Promise<Model | undefined>;
5
6
  save(model: Model): Promise<void>;
6
7
  }
7
8
  //# sourceMappingURL=ModelStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelStore.d.ts","sourceRoot":"","sources":["../../src/store/ModelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B,MAAM,WAAW,UAAU;IACvB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5D,gCAAgC,CAC5B,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
1
+ {"version":3,"file":"ModelStore.d.ts","sourceRoot":"","sources":["../../src/store/ModelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAE3B,MAAM,WAAW,UAAU;IACvB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5D,gCAAgC,CAC5B,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC9B,oBAAoB,IAAI,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
@@ -5,6 +5,8 @@ export interface TransactionModelStore extends ModelStore {
5
5
  getByStreamIdWhereDeletedIsFalse(streamId: string): Promise<TransactionModel | undefined>;
6
6
  findByUserAndLogicalTransactionId(userId: string, recipientUserId: string, logicalTransactionId: string): Promise<TransactionModel | undefined>;
7
7
  findByGroupTransactionId(userId: string, groupTransactionId: string): Promise<TransactionModel[]>;
8
+ findByUserIdAndRecipientUserIdWhereDeletedIsFalse(userId: string, recipientUserId: string): Promise<TransactionModel[]>;
9
+ findAllByUserIdWhereDeletedIsFalse(userId: string): Promise<TransactionModel[]>;
8
10
  save(model: TransactionModel): Promise<void>;
9
11
  }
10
12
  //# sourceMappingURL=TransactionModelStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionModelStore.d.ts","sourceRoot":"","sources":["../../src/store/TransactionModelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;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CAC7C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACxB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE/B,kCAAkC,CAC9B,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE/B,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
@@ -7,5 +7,6 @@ export interface UserModelStore extends ModelStore {
7
7
  findByEmail(email: string): Promise<UserModel | undefined>;
8
8
  findByPhone(phone: string): Promise<UserModel | undefined>;
9
9
  findByFirebaseUid(uid: string): Promise<UserModel | undefined>;
10
+ appUser(): Promise<UserModel>;
10
11
  }
11
12
  //# sourceMappingURL=UserModelStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserModelStore.d.ts","sourceRoot":"","sources":["../../src/store/UserModelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAEhE,gCAAgC,CAC5B,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAElC,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE3D,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE3D,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;CAClE"}
1
+ {"version":3,"file":"UserModelStore.d.ts","sourceRoot":"","sources":["../../src/store/UserModelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,cAAe,SAAQ,UAAU;IAC9C,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAEhE,gCAAgC,CAC5B,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAElC,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE3D,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE3D,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAE/D,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;CACjC"}
@@ -0,0 +1,17 @@
1
+ import { TransactionModel } from "../TransactionEvents";
2
+ import { UserModelStore } from "../store/UserModelStore";
3
+ import { CurrencyStore } from "../store/CurrencyStore";
4
+ import { BalanceResponse } from "../contracts";
5
+ export declare class BalanceUtil {
6
+ private userModelStore;
7
+ private currencyStore;
8
+ constructor(userModelStore: UserModelStore, currencyStore: CurrencyStore);
9
+ calculateBalance(transactions: TransactionModel[], userId: string): Promise<BalanceResponse>;
10
+ private calculateCurrencyBalances;
11
+ convertAmount(amount: number, fromCurrency: string, toCurrency: string, rates: Record<string, number>): {
12
+ amount: number;
13
+ currency: string;
14
+ };
15
+ private convertCurrency;
16
+ }
17
+ //# sourceMappingURL=BalanceUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BalanceUtil.d.ts","sourceRoot":"","sources":["../../src/utils/BalanceUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAEH,eAAe,EAElB,MAAM,cAAc,CAAC;AAEtB,qBAAa,WAAW;IAEhB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,aAAa;gBADb,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa;IAGlC,gBAAgB,CAClB,YAAY,EAAE,gBAAgB,EAAE,EAChC,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC;IAmE3B,OAAO,CAAC,yBAAyB;IAwCjC,aAAa,CACT,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAevC,OAAO,CAAC,eAAe;CAmB1B"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceUtil = void 0;
4
+ class BalanceUtil {
5
+ constructor(userModelStore, currencyStore) {
6
+ this.userModelStore = userModelStore;
7
+ this.currencyStore = currencyStore;
8
+ }
9
+ async calculateBalance(transactions, userId) {
10
+ if (transactions.length === 0) {
11
+ return {
12
+ main: undefined,
13
+ other: [],
14
+ };
15
+ }
16
+ const user = await this.userModelStore.getByStreamIdWhereDeletedIsFalse(userId);
17
+ const baseCurrency = user?.currency ?? "USD";
18
+ const currencyBalances = this.calculateCurrencyBalances(transactions);
19
+ if (!baseCurrency || currencyBalances.size === 0) {
20
+ return {
21
+ main: undefined,
22
+ other: [],
23
+ };
24
+ }
25
+ ``;
26
+ const currencyRates = await this.currencyStore.getCurrencyRates();
27
+ const other = [];
28
+ let totalConvertedAmount = 0;
29
+ let mainIsOwed = false;
30
+ for (const [currency, balance] of currencyBalances.entries()) {
31
+ const convertedAmount = this.convertCurrency(balance.amount, currency, baseCurrency, currencyRates?.rates);
32
+ other.push({
33
+ amount: {
34
+ amount: Math.abs(balance.amount),
35
+ currency: currency,
36
+ isOwed: balance.amount < 0,
37
+ },
38
+ convertedAmount: {
39
+ amount: Math.abs(convertedAmount),
40
+ currency: baseCurrency,
41
+ isOwed: convertedAmount < 0,
42
+ },
43
+ });
44
+ totalConvertedAmount += convertedAmount;
45
+ }
46
+ if (totalConvertedAmount < 0) {
47
+ mainIsOwed = true;
48
+ }
49
+ const main = {
50
+ amount: Math.abs(totalConvertedAmount),
51
+ currency: baseCurrency,
52
+ isOwed: mainIsOwed,
53
+ };
54
+ return {
55
+ main,
56
+ other,
57
+ };
58
+ }
59
+ calculateCurrencyBalances(transactions) {
60
+ const balances = new Map();
61
+ for (const transaction of transactions) {
62
+ if (transaction.deleted) {
63
+ continue;
64
+ }
65
+ const existingBalance = balances.get(transaction.currency) || {
66
+ amount: 0,
67
+ isOwed: false,
68
+ };
69
+ const signedAmount = transaction.isOwed
70
+ ? -transaction.amount
71
+ : transaction.amount;
72
+ const newAmount = existingBalance.amount + signedAmount;
73
+ balances.set(transaction.currency, {
74
+ amount: newAmount,
75
+ isOwed: newAmount < 0,
76
+ });
77
+ }
78
+ const nonZeroBalances = new Map();
79
+ for (const [currency, balance] of balances.entries()) {
80
+ if (balance.amount !== 0) {
81
+ nonZeroBalances.set(currency, balance);
82
+ }
83
+ }
84
+ return nonZeroBalances;
85
+ }
86
+ convertAmount(amount, fromCurrency, toCurrency, rates) {
87
+ if (fromCurrency === toCurrency) {
88
+ return { amount, currency: toCurrency };
89
+ }
90
+ const convertedAmount = this.convertCurrency(amount, fromCurrency, toCurrency, rates);
91
+ return { amount: convertedAmount, currency: toCurrency };
92
+ }
93
+ convertCurrency(amount, fromCurrency, toCurrency, rates) {
94
+ if (fromCurrency === toCurrency) {
95
+ return amount;
96
+ }
97
+ if (!rates || !rates[fromCurrency] || !rates[toCurrency]) {
98
+ return amount;
99
+ }
100
+ const amountInBase = amount / rates[fromCurrency];
101
+ const convertedAmount = amountInBase * rates[toCurrency];
102
+ return convertedAmount;
103
+ }
104
+ }
105
+ exports.BalanceUtil = BalanceUtil;
@@ -1 +1 @@
1
- {"version":3,"file":"splitTypeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/splitTypeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAmBhE;AAED,wBAAgB,8BAA8B,CAC1C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,GAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAmBrC"}
1
+ {"version":3,"file":"splitTypeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/splitTypeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,IAAI,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAmBhE;AAED,wBAAgB,8BAA8B,CAC1C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,GAChB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAmBrC"}
@@ -5,39 +5,39 @@ exports.calculateMirrorAmountAndIsOwed = calculateMirrorAmountAndIsOwed;
5
5
  const __1 = require("..");
6
6
  function reverseSplitType(splitType) {
7
7
  switch (splitType) {
8
- case __1.SplitType.YouPaidSplitEqually:
9
- return __1.SplitType.TheyPaidSplitEqually;
10
- case __1.SplitType.TheyPaidSplitEqually:
11
- return __1.SplitType.YouPaidSplitEqually;
12
- case __1.SplitType.TheyOweYouAll:
13
- return __1.SplitType.YouOweThemAll;
14
- case __1.SplitType.YouOweThemAll:
15
- return __1.SplitType.TheyOweYouAll;
16
- case __1.SplitType.TheyPaidToSettle:
17
- return __1.SplitType.YouPaidToSettle;
18
- case __1.SplitType.YouPaidToSettle:
19
- return __1.SplitType.TheyPaidToSettle;
20
- case __1.SplitType.SpecificAmounts:
21
- return __1.SplitType.SpecificAmounts;
8
+ case __1.SplitTypeEnum.YouPaidSplitEqually:
9
+ return __1.SplitTypeEnum.TheyPaidSplitEqually;
10
+ case __1.SplitTypeEnum.TheyPaidSplitEqually:
11
+ return __1.SplitTypeEnum.YouPaidSplitEqually;
12
+ case __1.SplitTypeEnum.TheyOweYouAll:
13
+ return __1.SplitTypeEnum.YouOweThemAll;
14
+ case __1.SplitTypeEnum.YouOweThemAll:
15
+ return __1.SplitTypeEnum.TheyOweYouAll;
16
+ case __1.SplitTypeEnum.TheyPaidToSettle:
17
+ return __1.SplitTypeEnum.YouPaidToSettle;
18
+ case __1.SplitTypeEnum.YouPaidToSettle:
19
+ return __1.SplitTypeEnum.TheyPaidToSettle;
20
+ case __1.SplitTypeEnum.SpecificAmounts:
21
+ return __1.SplitTypeEnum.SpecificAmounts;
22
22
  default:
23
23
  throw new Error(`Unknown split type: ${splitType}`);
24
24
  }
25
25
  }
26
26
  function calculateMirrorAmountAndIsOwed(totalAmount, amount, splitType, isOwed) {
27
27
  switch (splitType) {
28
- case __1.SplitType.YouPaidSplitEqually:
28
+ case __1.SplitTypeEnum.YouPaidSplitEqually:
29
29
  return { amount: totalAmount / 2, isOwed: false };
30
- case __1.SplitType.TheyPaidSplitEqually:
30
+ case __1.SplitTypeEnum.TheyPaidSplitEqually:
31
31
  return { amount: totalAmount / 2, isOwed: true };
32
- case __1.SplitType.TheyOweYouAll:
32
+ case __1.SplitTypeEnum.TheyOweYouAll:
33
33
  return { amount: totalAmount, isOwed: false };
34
- case __1.SplitType.YouOweThemAll:
34
+ case __1.SplitTypeEnum.YouOweThemAll:
35
35
  return { amount: totalAmount, isOwed: true };
36
- case __1.SplitType.TheyPaidToSettle:
36
+ case __1.SplitTypeEnum.TheyPaidToSettle:
37
37
  return { amount: totalAmount, isOwed: true };
38
- case __1.SplitType.YouPaidToSettle:
38
+ case __1.SplitTypeEnum.YouPaidToSettle:
39
39
  return { amount: totalAmount, isOwed: false };
40
- case __1.SplitType.SpecificAmounts:
40
+ case __1.SplitTypeEnum.SpecificAmounts:
41
41
  return { amount: amount, isOwed: !isOwed };
42
42
  default:
43
43
  throw new Error(`Unknown split type: ${splitType}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeeshan60/event-processor",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Shared event sourcing infrastructure for Loan Tracker projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,16 +0,0 @@
1
- import { FriendModel, FriendEvent } from "../..";
2
- import { FriendModelStore } from "../..";
3
- import { UserModelStore } from "../..";
4
- import { FriendEventStore } from "../..";
5
- import { UserEventStore } from "../..";
6
- import { ActivityEventHandler } from "../../ActivityEventHandler";
7
- export declare class UIFriendEventHandler {
8
- private modelStore;
9
- private userModelStore;
10
- private friendEventStore;
11
- private userEventStore;
12
- private activityEventHandler?;
13
- constructor(modelStore: FriendModelStore, userModelStore: UserModelStore, friendEventStore: FriendEventStore, userEventStore: UserEventStore, activityEventHandler?: ActivityEventHandler | undefined);
14
- handleEvent(event: FriendEvent): Promise<FriendModel>;
15
- }
16
- //# sourceMappingURL=UIFriendEventHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UIFriendEventHandler.d.ts","sourceRoot":"","sources":["../../../src/client/handlers/UIFriendEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,oBAAoB;IAEzB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,oBAAoB,CAAC;gBAJrB,UAAU,EAAE,gBAAgB,EAC5B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,oBAAoB,CAAC,EAAE,oBAAoB,YAAA;IAGjD,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAsB9D"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UIFriendEventHandler = void 0;
4
- const DomainEvents_1 = require("../../common/DomainEvents");
5
- class UIFriendEventHandler {
6
- constructor(modelStore, userModelStore, friendEventStore, userEventStore, activityEventHandler) {
7
- this.modelStore = modelStore;
8
- this.userModelStore = userModelStore;
9
- this.friendEventStore = friendEventStore;
10
- this.userEventStore = userEventStore;
11
- this.activityEventHandler = activityEventHandler;
12
- }
13
- async handleEvent(event) {
14
- const eventType = event.constructor.name;
15
- if (!(0, DomainEvents_1.isValidFriendEventType)(eventType)) {
16
- throw new Error(`Unknown friend event type: ${eventType}`);
17
- }
18
- const existingModel = await this.modelStore.getByStreamIdWhereDeletedIsFalse(event.streamId);
19
- const updatedModel = event.apply(existingModel);
20
- await this.modelStore.save(updatedModel);
21
- if (this.activityEventHandler) {
22
- await this.activityEventHandler.createActivityLog(event, existingModel, updatedModel);
23
- }
24
- return updatedModel;
25
- }
26
- }
27
- exports.UIFriendEventHandler = UIFriendEventHandler;
@@ -1,18 +0,0 @@
1
- import { GroupModel, GroupEvent } from "../..";
2
- import { GroupModelStore } from "../..";
3
- import { FriendModelStore } from "../..";
4
- import { UserModelStore } from "../..";
5
- import { GroupEventStore } from "../..";
6
- import { FriendEventStore } from "../..";
7
- import { ActivityEventHandler } from "../../ActivityEventHandler";
8
- export declare class UIGroupEventHandler {
9
- private modelStore;
10
- private friendModelStore;
11
- private userModelStore;
12
- private groupEventStore;
13
- private friendEventStore;
14
- private activityEventHandler?;
15
- constructor(modelStore: GroupModelStore, friendModelStore: FriendModelStore, userModelStore: UserModelStore, groupEventStore: GroupEventStore, friendEventStore: FriendEventStore, activityEventHandler?: ActivityEventHandler | undefined);
16
- handleEvent(event: GroupEvent): Promise<GroupModel>;
17
- }
18
- //# sourceMappingURL=UIGroupEventHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UIGroupEventHandler.d.ts","sourceRoot":"","sources":["../../../src/client/handlers/UIGroupEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,mBAAmB;IAExB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,oBAAoB,CAAC;gBALrB,UAAU,EAAE,eAAe,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,oBAAoB,CAAC,EAAE,oBAAoB,YAAA;IAGjD,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAsB5D"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UIGroupEventHandler = void 0;
4
- const DomainEvents_1 = require("../../common/DomainEvents");
5
- class UIGroupEventHandler {
6
- constructor(modelStore, friendModelStore, userModelStore, groupEventStore, friendEventStore, activityEventHandler) {
7
- this.modelStore = modelStore;
8
- this.friendModelStore = friendModelStore;
9
- this.userModelStore = userModelStore;
10
- this.groupEventStore = groupEventStore;
11
- this.friendEventStore = friendEventStore;
12
- this.activityEventHandler = activityEventHandler;
13
- }
14
- async handleEvent(event) {
15
- const eventType = event.constructor.name;
16
- if (!(0, DomainEvents_1.isValidGroupEventType)(eventType)) {
17
- throw new Error(`Unknown group event type: ${eventType}`);
18
- }
19
- const existingModel = await this.modelStore.getByStreamIdWhereDeletedIsFalse(event.streamId);
20
- const updatedModel = event.apply(existingModel);
21
- await this.modelStore.save(updatedModel);
22
- if (this.activityEventHandler) {
23
- await this.activityEventHandler.createActivityLog(event, existingModel, updatedModel);
24
- }
25
- return updatedModel;
26
- }
27
- }
28
- exports.UIGroupEventHandler = UIGroupEventHandler;
@@ -1,18 +0,0 @@
1
- import { GroupTransactionModel, GroupTransactionEvent } from "../..";
2
- import { GroupTransactionModelStore } from "../..";
3
- import { GroupTransactionEventStore } from "../..";
4
- import { GroupModelStore } from "../..";
5
- import { TransactionEventStore } from "../..";
6
- import { TransactionModelStore } from "../..";
7
- import { ActivityEventHandler } from "../../ActivityEventHandler";
8
- export declare class UIGroupTransactionEventHandler {
9
- private modelStore;
10
- private eventStore;
11
- private groupModelStore;
12
- private transactionEventStore;
13
- private transactionModelStore;
14
- private activityEventHandler?;
15
- constructor(modelStore: GroupTransactionModelStore, eventStore: GroupTransactionEventStore, groupModelStore: GroupModelStore, transactionEventStore: TransactionEventStore, transactionModelStore: TransactionModelStore, activityEventHandler?: ActivityEventHandler | undefined);
16
- handleEvent(event: GroupTransactionEvent): Promise<GroupTransactionModel>;
17
- }
18
- //# sourceMappingURL=UIGroupTransactionEventHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UIGroupTransactionEventHandler.d.ts","sourceRoot":"","sources":["../../../src/client/handlers/UIGroupTransactionEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,8BAA8B;IAEnC,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,qBAAqB;IAC7B,OAAO,CAAC,oBAAoB,CAAC;gBALrB,UAAU,EAAE,0BAA0B,EACtC,UAAU,EAAE,0BAA0B,EACtC,eAAe,EAAE,eAAe,EAChC,qBAAqB,EAAE,qBAAqB,EAC5C,qBAAqB,EAAE,qBAAqB,EAC5C,oBAAoB,CAAC,EAAE,oBAAoB,YAAA;IAGjD,WAAW,CACb,KAAK,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;CA0BpC"}