@fintekkers/ledger-models 0.1.95 → 0.1.97

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 (202) hide show
  1. package/node/fintekkers/models/portfolio/portfolio_grpc_pb.js +1 -0
  2. package/node/fintekkers/models/position/field_grpc_pb.js +1 -0
  3. package/node/fintekkers/models/position/measure_grpc_pb.js +1 -0
  4. package/node/fintekkers/models/position/position_filter_grpc_pb.js +1 -0
  5. package/node/fintekkers/models/position/position_grpc_pb.js +1 -0
  6. package/node/fintekkers/models/position/position_status_grpc_pb.js +1 -0
  7. package/node/fintekkers/models/position/position_util_grpc_pb.js +1 -0
  8. package/node/fintekkers/models/price/price_grpc_pb.js +1 -0
  9. package/node/fintekkers/models/security/bond/auction_type_grpc_pb.js +1 -0
  10. package/node/fintekkers/models/security/bond/issuance_grpc_pb.js +1 -0
  11. package/node/fintekkers/models/security/coupon_frequency_grpc_pb.js +1 -0
  12. package/node/fintekkers/models/security/coupon_type_grpc_pb.js +1 -0
  13. package/node/fintekkers/models/security/identifier/identifier_grpc_pb.js +1 -0
  14. package/node/fintekkers/models/security/identifier/identifier_type_grpc_pb.js +1 -0
  15. package/node/fintekkers/models/security/security_grpc_pb.js +1 -0
  16. package/node/fintekkers/models/security/security_pb.test.d.ts +1 -0
  17. package/node/fintekkers/models/security/security_pb.test.js +10 -10
  18. package/node/fintekkers/models/security/security_pb.test.js.map +1 -1
  19. package/node/fintekkers/models/security/security_quantity_type_grpc_pb.js +1 -0
  20. package/node/fintekkers/models/security/security_type_grpc_pb.js +1 -0
  21. package/node/fintekkers/models/security/tenor_grpc_pb.js +1 -0
  22. package/node/fintekkers/models/security/tenor_type_grpc_pb.js +1 -0
  23. package/node/fintekkers/models/strategy/strategy_allocation_grpc_pb.js +1 -0
  24. package/node/fintekkers/models/strategy/strategy_grpc_pb.js +1 -0
  25. package/node/fintekkers/models/transaction/transaction_grpc_pb.js +1 -0
  26. package/node/fintekkers/models/transaction/transaction_type_grpc_pb.js +1 -0
  27. package/node/fintekkers/models/util/api/api_key_grpc_pb.js +1 -0
  28. package/node/fintekkers/models/util/date_range_grpc_pb.js +1 -0
  29. package/node/fintekkers/models/util/date_range_pb.d.ts +43 -0
  30. package/node/fintekkers/models/util/date_range_pb.js +310 -0
  31. package/node/fintekkers/models/util/decimal_value_grpc_pb.js +1 -0
  32. package/node/fintekkers/models/util/endpoint_grpc_pb.js +1 -0
  33. package/node/fintekkers/models/util/local_date_grpc_pb.js +1 -0
  34. package/node/fintekkers/models/util/local_timestamp_grpc_pb.js +1 -0
  35. package/node/fintekkers/models/util/lock/node_partition_grpc_pb.js +1 -0
  36. package/node/fintekkers/models/util/lock/node_state_grpc_pb.js +1 -0
  37. package/node/fintekkers/models/util/uuid_grpc_pb.js +1 -0
  38. package/node/fintekkers/requests/portfolio/create_portfolio_request_grpc_pb.js +1 -0
  39. package/node/fintekkers/requests/portfolio/create_portfolio_response_grpc_pb.js +1 -0
  40. package/node/fintekkers/requests/portfolio/query_portfolio_request_grpc_pb.js +1 -0
  41. package/node/fintekkers/requests/portfolio/query_portfolio_response_grpc_pb.js +1 -0
  42. package/node/fintekkers/requests/position/query_position_request_grpc_pb.js +1 -0
  43. package/node/fintekkers/requests/position/query_position_response_grpc_pb.js +1 -0
  44. package/node/fintekkers/requests/price/create_price_request_grpc_pb.js +1 -0
  45. package/node/fintekkers/requests/price/create_price_response_grpc_pb.js +1 -0
  46. package/node/fintekkers/requests/price/query_price_request_grpc_pb.js +1 -0
  47. package/node/fintekkers/requests/price/query_price_request_pb.d.ts +47 -0
  48. package/node/fintekkers/requests/price/query_price_request_pb.js +190 -2
  49. package/node/fintekkers/requests/price/query_price_response_grpc_pb.js +1 -0
  50. package/node/fintekkers/requests/security/create_security_request_grpc_pb.js +1 -0
  51. package/node/fintekkers/requests/security/create_security_response_grpc_pb.js +1 -0
  52. package/node/fintekkers/requests/security/get_field_values_request_grpc_pb.js +1 -0
  53. package/node/fintekkers/requests/security/get_field_values_request_pb.js +238 -0
  54. package/node/fintekkers/requests/security/get_field_values_response_grpc_pb.js +1 -0
  55. package/node/fintekkers/requests/security/get_field_values_response_pb.js +268 -0
  56. package/node/fintekkers/requests/security/get_fields_response_grpc_pb.js +1 -0
  57. package/node/fintekkers/requests/security/get_fields_response_pb.js +266 -0
  58. package/node/fintekkers/requests/security/query_security_request_grpc_pb.js +1 -0
  59. package/node/fintekkers/requests/security/query_security_response_grpc_pb.js +1 -0
  60. package/node/fintekkers/requests/transaction/create_transaction_request_grpc_pb.js +1 -0
  61. package/node/fintekkers/requests/transaction/create_transaction_response_grpc_pb.js +1 -0
  62. package/node/fintekkers/requests/transaction/query_transaction_request_grpc_pb.js +1 -0
  63. package/node/fintekkers/requests/transaction/query_transaction_response_grpc_pb.js +1 -0
  64. package/node/fintekkers/requests/util/errors/error_grpc_pb.js +1 -0
  65. package/node/fintekkers/requests/util/errors/message_grpc_pb.js +1 -0
  66. package/node/fintekkers/requests/util/errors/summary_grpc_pb.js +1 -0
  67. package/node/fintekkers/requests/util/lock/lock_request_grpc_pb.js +1 -0
  68. package/node/fintekkers/requests/util/lock/lock_request_pb.js +54 -1
  69. package/node/fintekkers/requests/util/lock/lock_response_grpc_pb.js +1 -0
  70. package/node/fintekkers/requests/util/operation_grpc_pb.js +1 -0
  71. package/node/fintekkers/requests/valuation/valuation_request_grpc_pb.js +1 -0
  72. package/node/fintekkers/requests/valuation/valuation_response_grpc_pb.js +1 -0
  73. package/node/wrappers/models/portfolio/portfolio.d.ts +15 -0
  74. package/node/wrappers/models/portfolio/portfolio.js +26 -21
  75. package/node/wrappers/models/portfolio/portfolio.js.map +1 -1
  76. package/node/wrappers/models/portfolio/portfolio.ts +6 -2
  77. package/node/wrappers/models/position/field.d.ts +7 -0
  78. package/node/wrappers/models/position/field.js +10 -14
  79. package/node/wrappers/models/position/field.js.map +1 -1
  80. package/node/wrappers/models/position/field.test.d.ts +1 -0
  81. package/node/wrappers/models/position/field.test.js +10 -48
  82. package/node/wrappers/models/position/field.test.js.map +1 -1
  83. package/node/wrappers/models/position/field.ts +1 -2
  84. package/node/wrappers/models/position/position.d.ts +32 -0
  85. package/node/wrappers/models/position/position.js +89 -83
  86. package/node/wrappers/models/position/position.js.map +1 -1
  87. package/node/wrappers/models/position/position.test.d.ts +1 -0
  88. package/node/wrappers/models/position/position.test.js +128 -198
  89. package/node/wrappers/models/position/position.test.js.map +1 -1
  90. package/node/wrappers/models/position/position.test.ts +1 -1
  91. package/node/wrappers/models/position/position.ts +19 -12
  92. package/node/wrappers/models/position/positionfilter.d.ts +24 -0
  93. package/node/wrappers/models/position/positionfilter.js +19 -20
  94. package/node/wrappers/models/position/positionfilter.js.map +1 -1
  95. package/node/wrappers/models/position/positionfilter.ts +1 -1
  96. package/node/wrappers/models/security/security.d.ts +23 -0
  97. package/node/wrappers/models/security/security.js +55 -44
  98. package/node/wrappers/models/security/security.js.map +1 -1
  99. package/node/wrappers/models/security/security.test.d.ts +1 -0
  100. package/node/wrappers/models/security/security.test.js +14 -11
  101. package/node/wrappers/models/security/security.test.js.map +1 -1
  102. package/node/wrappers/models/security/security.ts +13 -6
  103. package/node/wrappers/models/transaction/transaction.d.ts +36 -0
  104. package/node/wrappers/models/transaction/transaction.js +98 -68
  105. package/node/wrappers/models/transaction/transaction.js.map +1 -1
  106. package/node/wrappers/models/transaction/transaction.test.d.ts +1 -0
  107. package/node/wrappers/models/transaction/transaction.test.js +12 -9
  108. package/node/wrappers/models/transaction/transaction.test.js.map +1 -1
  109. package/node/wrappers/models/transaction/transaction.ts +30 -12
  110. package/node/wrappers/models/transaction/transaction_type.d.ts +17 -0
  111. package/node/wrappers/models/transaction/transaction_type.js +12 -12
  112. package/node/wrappers/models/transaction/transaction_type.js.map +1 -1
  113. package/node/wrappers/models/transaction/transaction_type.ts +5 -5
  114. package/node/wrappers/models/utils/date.d.ts +11 -0
  115. package/node/wrappers/models/utils/date.js +16 -17
  116. package/node/wrappers/models/utils/date.js.map +1 -1
  117. package/node/wrappers/models/utils/date.test.d.ts +1 -0
  118. package/node/wrappers/models/utils/date.test.js +28 -58
  119. package/node/wrappers/models/utils/date.test.js.map +1 -1
  120. package/node/wrappers/models/utils/date.ts +1 -1
  121. package/node/wrappers/models/utils/datetime.d.ts +14 -0
  122. package/node/wrappers/models/utils/datetime.js +41 -34
  123. package/node/wrappers/models/utils/datetime.js.map +1 -1
  124. package/node/wrappers/models/utils/datetime.test.d.ts +1 -0
  125. package/node/wrappers/models/utils/datetime.test.js +40 -70
  126. package/node/wrappers/models/utils/datetime.test.js.map +1 -1
  127. package/node/wrappers/models/utils/datetime.ts +13 -8
  128. package/node/wrappers/models/utils/protoEnum.d.ts +12 -0
  129. package/node/wrappers/models/utils/protoEnum.js +22 -24
  130. package/node/wrappers/models/utils/protoEnum.js.map +1 -1
  131. package/node/wrappers/models/utils/protoEnum.test.d.ts +1 -0
  132. package/node/wrappers/models/utils/protoEnum.test.js +13 -13
  133. package/node/wrappers/models/utils/protoEnum.test.js.map +1 -1
  134. package/node/wrappers/models/utils/requestcontext.d.ts +13 -0
  135. package/node/wrappers/models/utils/requestcontext.js +52 -44
  136. package/node/wrappers/models/utils/requestcontext.js.map +1 -1
  137. package/node/wrappers/models/utils/requestcontext.ts +15 -15
  138. package/node/wrappers/models/utils/requestcontext_d.d.ts +6 -0
  139. package/node/wrappers/models/utils/requestcontext_d.js +1 -0
  140. package/node/wrappers/models/utils/serialization.d.ts +12 -0
  141. package/node/wrappers/models/utils/serialization.js +19 -22
  142. package/node/wrappers/models/utils/serialization.js.map +1 -1
  143. package/node/wrappers/models/utils/serialization.test.d.ts +1 -0
  144. package/node/wrappers/models/utils/serialization.test.js +14 -14
  145. package/node/wrappers/models/utils/serialization.test.js.map +1 -1
  146. package/node/wrappers/models/utils/serialization.ts +1 -1
  147. package/node/wrappers/models/utils/serialization.util.d.ts +4 -0
  148. package/node/wrappers/models/utils/serialization.util.js +25 -25
  149. package/node/wrappers/models/utils/serialization.util.js.map +1 -1
  150. package/node/wrappers/models/utils/serialization.util.test.d.ts +1 -0
  151. package/node/wrappers/models/utils/serialization.util.test.js +15 -15
  152. package/node/wrappers/models/utils/serialization.util.test.js.map +1 -1
  153. package/node/wrappers/models/utils/serialization.util.ts +5 -5
  154. package/node/wrappers/models/utils/uuid.d.ts +13 -0
  155. package/node/wrappers/models/utils/uuid.js +53 -31
  156. package/node/wrappers/models/utils/uuid.js.map +1 -1
  157. package/node/wrappers/models/utils/uuid.test.d.ts +1 -0
  158. package/node/wrappers/models/utils/uuid.test.js +7 -7
  159. package/node/wrappers/models/utils/uuid.test.js.map +1 -1
  160. package/node/wrappers/models/utils/uuid.ts +1 -1
  161. package/node/wrappers/requests/position/QueryPositionRequest.d.ts +19 -0
  162. package/node/wrappers/requests/position/QueryPositionRequest.js +19 -20
  163. package/node/wrappers/requests/position/QueryPositionRequest.js.map +1 -1
  164. package/node/wrappers/services/portfolio-service/PortfolioService.d.ts +15 -0
  165. package/node/wrappers/services/portfolio-service/PortfolioService.js +58 -109
  166. package/node/wrappers/services/portfolio-service/PortfolioService.js.map +1 -1
  167. package/node/wrappers/services/portfolio-service/PortfolioService.ts +2 -2
  168. package/node/wrappers/services/portfolio-service/portfolioService.test.d.ts +1 -0
  169. package/node/wrappers/services/portfolio-service/portfolioService.test.js +47 -64
  170. package/node/wrappers/services/portfolio-service/portfolioService.test.js.map +1 -1
  171. package/node/wrappers/services/position-service/PositionService.d.ts +10 -0
  172. package/node/wrappers/services/position-service/PositionService.js +45 -83
  173. package/node/wrappers/services/position-service/PositionService.js.map +1 -1
  174. package/node/wrappers/services/position-service/position.test.d.ts +1 -0
  175. package/node/wrappers/services/position-service/position.test.js +52 -118
  176. package/node/wrappers/services/position-service/position.test.js.map +1 -1
  177. package/node/wrappers/services/position-service/position.test.ts +7 -1
  178. package/node/wrappers/services/security-service/SecurityService.d.ts +15 -0
  179. package/node/wrappers/services/security-service/SecurityService.js +86 -117
  180. package/node/wrappers/services/security-service/SecurityService.js.map +1 -1
  181. package/node/wrappers/services/security-service/SecurityService.ts +2 -2
  182. package/node/wrappers/services/security-service/security.maturityLadder.test.d.ts +1 -0
  183. package/node/wrappers/services/security-service/security.maturityLadder.test.js +40 -75
  184. package/node/wrappers/services/security-service/security.maturityLadder.test.js.map +1 -1
  185. package/node/wrappers/services/security-service/security.maturityLadder.test.ts +1 -1
  186. package/node/wrappers/services/security-service/security.test.d.ts +1 -0
  187. package/node/wrappers/services/security-service/security.test.js +88 -114
  188. package/node/wrappers/services/security-service/security.test.js.map +1 -1
  189. package/node/wrappers/services/security-service/security.test.ts +2 -2
  190. package/node/wrappers/services/transaction-service/TransactionService.d.ts +13 -0
  191. package/node/wrappers/services/transaction-service/TransactionService.js +53 -98
  192. package/node/wrappers/services/transaction-service/TransactionService.js.map +1 -1
  193. package/node/wrappers/services/transaction-service/TransactionService.ts +2 -2
  194. package/node/wrappers/services/transaction-service/transaction.search.test.d.ts +1 -0
  195. package/node/wrappers/services/transaction-service/transaction.search.test.js +51 -70
  196. package/node/wrappers/services/transaction-service/transaction.search.test.js.map +1 -1
  197. package/node/wrappers/services/transaction-service/transaction.test.d.ts +1 -0
  198. package/node/wrappers/services/transaction-service/transaction.test.js +127 -171
  199. package/node/wrappers/services/transaction-service/transaction.test.js.map +1 -1
  200. package/node/wrappers/services/transaction-service/transaction.test.ts +3 -1
  201. package/package.json +4 -1
  202. package/tsconfig.json +15 -6
@@ -25,13 +25,13 @@ class Transaction {
25
25
  toString(): string {
26
26
  try {
27
27
  const validTo: string =
28
- this.proto.getValidTo() ? this.proto.getValidTo().toString() : "NULL";
28
+ this.proto.getValidTo()?.toString() ?? "NULL";
29
29
 
30
30
  const validFrom: string =
31
- this.proto.getValidFrom() ? this.proto.getValidFrom().toString() : "NULL";
31
+ this.proto.getValidFrom()?.toString() ?? "NULL";
32
32
 
33
33
  const strategyAllocation =
34
- this.proto.getStrategyAllocation() ? this.getStrategyAllocation().toString() : "NULL";
34
+ this.proto.getStrategyAllocation()?.toString() ?? "NULL";
35
35
 
36
36
  return `${/*this.proto.isCancelled()*/ false ? "INVALIDATED: " : ""}TXN[${this.getID().toString()}], ` +
37
37
  `TradeDate[${this.getTradeDate().toString()}], TxnType[${this.getTransactionType()}], Price[${this.getPrice()}], Quantity[${this.getQuantity()}], ` +
@@ -73,31 +73,45 @@ class Transaction {
73
73
  }
74
74
 
75
75
  getID(): UUID {
76
- return UUID.fromU8Array(this.proto.getUuid().getRawUuid_asU8());
76
+ const uuid = this.proto.getUuid();
77
+ if (!uuid) throw new Error("UUID is required");
78
+ return UUID.fromU8Array(uuid.getRawUuid_asU8());
77
79
  }
78
80
 
79
81
  getAsOf(): ZonedDateTime {
80
- return new ZonedDateTime(this.proto.getAsOf());
82
+ const asOf = this.proto.getAsOf();
83
+ if (!asOf) throw new Error("AsOf is required");
84
+ return new ZonedDateTime(asOf);
81
85
  }
82
86
 
83
87
  getPortfolio(): Portfolio {
84
- return new Portfolio(this.proto.getPortfolio());
88
+ const portfolio = this.proto.getPortfolio();
89
+ if (!portfolio) throw new Error("Portfolio is required");
90
+ return new Portfolio(portfolio);
85
91
  }
86
92
 
87
93
  getSecurity(): Security {
88
- return new Security(this.proto.getSecurity());
94
+ const security = this.proto.getSecurity();
95
+ if (!security) throw new Error("Security is required");
96
+ return new Security(security);
89
97
  }
90
98
 
91
99
  getStrategyAllocation(): StrategyAllocationProto {
92
- return this.proto.getStrategyAllocation();
100
+ const allocation = this.proto.getStrategyAllocation();
101
+ if (!allocation) throw new Error("StrategyAllocation is required");
102
+ return allocation;
93
103
  }
94
104
 
95
105
  getPrice(): PriceProto {
96
- return this.proto.getPrice();
106
+ const price = this.proto.getPrice();
107
+ if (!price) throw new Error("Price is required");
108
+ return price;
97
109
  }
98
110
 
99
111
  getQuantity(): Decimal {
100
- return new Decimal(this.proto.getQuantity().getArbitraryPrecisionValue());
112
+ const quantity = this.proto.getQuantity();
113
+ if (!quantity) throw new Error("Quantity is required");
114
+ return new Decimal(quantity.getArbitraryPrecisionValue());
101
115
  }
102
116
 
103
117
  getIssuerName(): string {
@@ -109,11 +123,15 @@ class Transaction {
109
123
  }
110
124
 
111
125
  getTradeDate(): LocalDate {
112
- return new LocalDate(this.proto.getTradeDate());
126
+ const tradeDate = this.proto.getTradeDate();
127
+ if (!tradeDate) throw new Error("TradeDate is required");
128
+ return new LocalDate(tradeDate);
113
129
  }
114
130
 
115
131
  getSettlementDate(): LocalDate {
116
- return new LocalDate(this.proto.getSettlementDate());
132
+ const settlementDate = this.proto.getSettlementDate();
133
+ if (!settlementDate) throw new Error("SettlementDate is required");
134
+ return new LocalDate(settlementDate);
117
135
  }
118
136
 
119
137
  getTransactionType(): TransactionType {
@@ -0,0 +1,17 @@
1
+ import { TransactionTypeProto } from "../../../fintekkers/models/transaction/transaction_type_pb";
2
+ export declare class TransactionType {
3
+ proto: TransactionTypeProto;
4
+ constructor(proto: TransactionTypeProto);
5
+ static ttEnumMap: Map<number, string>;
6
+ getDirectionMultiplier(): number;
7
+ /**
8
+ * NOTE that this method is not performant and should only be used for debugging purposes,
9
+ * or infrequently. If this is required for a high performance use case, please create a
10
+ * reverse map with the enum ID as the key and the enum desriptor as the value. There is
11
+ * nothing stopping this code from returning a value that does not map exactly to the enum
12
+ * value. E.g. rather than BUY, you could return Buy.
13
+ *
14
+ * @returns TransactionType as a string
15
+ */
16
+ toString(): string;
17
+ }
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TransactionType = void 0;
4
- var transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
5
- var TransactionType = /** @class */ (function () {
6
- function TransactionType(proto) {
4
+ const transaction_type_pb_1 = require("../../../fintekkers/models/transaction/transaction_type_pb");
5
+ class TransactionType {
6
+ constructor(proto) {
7
7
  this.proto = proto;
8
8
  }
9
- TransactionType.prototype.getDirectionMultiplier = function () {
9
+ getDirectionMultiplier() {
10
10
  switch (this.proto) {
11
11
  case transaction_type_pb_1.TransactionTypeProto.BUY:
12
12
  case transaction_type_pb_1.TransactionTypeProto.DEPOSIT:
@@ -19,7 +19,7 @@ var TransactionType = /** @class */ (function () {
19
19
  case transaction_type_pb_1.TransactionTypeProto.UNKNOWN:
20
20
  throw new Error('Unknown transaction type: ' + this.toString());
21
21
  }
22
- };
22
+ }
23
23
  /**
24
24
  * NOTE that this method is not performant and should only be used for debugging purposes,
25
25
  * or infrequently. If this is required for a high performance use case, please create a
@@ -29,15 +29,15 @@ var TransactionType = /** @class */ (function () {
29
29
  *
30
30
  * @returns TransactionType as a string
31
31
  */
32
- TransactionType.prototype.toString = function () {
33
- return TransactionType.ttEnumMap.get(this.proto);
34
- };
35
- return TransactionType;
36
- }());
32
+ toString() {
33
+ var _a;
34
+ return (_a = TransactionType.ttEnumMap.get(this.proto)) !== null && _a !== void 0 ? _a : 'UNKNOWN';
35
+ }
36
+ }
37
37
  exports.TransactionType = TransactionType;
38
- (function () {
38
+ (() => {
39
39
  TransactionType.ttEnumMap = new Map();
40
- Object.keys(transaction_type_pb_1.TransactionTypeProto).forEach(function (key) {
40
+ Object.keys(transaction_type_pb_1.TransactionTypeProto).forEach(key => {
41
41
  TransactionType.ttEnumMap.set(transaction_type_pb_1.TransactionTypeProto[key], key);
42
42
  });
43
43
  })();
@@ -1 +1 @@
1
- {"version":3,"file":"transaction_type.js","sourceRoot":"","sources":["transaction_type.ts"],"names":[],"mappings":";;;AAAA,kGAAkG;AAElG;IAGI,yBAAY,KAA2B;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAYH,gDAAsB,GAAtB;QACI,QAAQ,IAAI,CAAC,KAAK,EAAE;YAChB,KAAK,0CAAoB,CAAC,GAAG,CAAC;YAC9B,KAAK,0CAAoB,CAAC,OAAO,CAAC;YAClC,KAAK,0CAAoB,CAAC,iBAAiB;gBACvC,OAAO,CAAC,CAAC;YACb,KAAK,0CAAoB,CAAC,IAAI,CAAC;YAC/B,KAAK,0CAAoB,C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AAI,KAAK,CAAC,4BAA4B,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ;;QACJ,OAAO,MAAA,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,mCAAI,SAAS,CAAC;IAClE,CAAC;CACJ;AA5CD,0CA4CC;AAnCG;IACI,eAAe,CAAC,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEtD,MAAM,CAAC,IAAI,CAAC,0CAAoB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5C,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,0CAAoB,CAAC,GAAwC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvG,CAAC,CAAC,CAAC;AACP,CAAC,GAAA,CAAA"}
@@ -5,7 +5,7 @@ export class TransactionType {
5
5
 
6
6
  constructor(proto: TransactionTypeProto) {
7
7
  this.proto = proto;
8
- }
8
+ }
9
9
 
10
10
  static ttEnumMap: Map<number, string>;
11
11
 
@@ -13,7 +13,7 @@ export class TransactionType {
13
13
  TransactionType.ttEnumMap = new Map<number, string>();
14
14
 
15
15
  Object.keys(TransactionTypeProto).forEach(key => {
16
- TransactionType.ttEnumMap.set(TransactionTypeProto[key], key);
16
+ TransactionType.ttEnumMap.set(TransactionTypeProto[key as keyof typeof TransactionTypeProto], key);
17
17
  });
18
18
  }
19
19
 
@@ -28,7 +28,7 @@ export class TransactionType {
28
28
  case TransactionTypeProto.MATURATION:
29
29
  return -1;
30
30
  case TransactionTypeProto.UNKNOWN:
31
- throw new Error('Unknown transaction type: '+this.toString());
31
+ throw new Error('Unknown transaction type: ' + this.toString());
32
32
  }
33
33
  }
34
34
 
@@ -41,7 +41,7 @@ export class TransactionType {
41
41
  *
42
42
  * @returns TransactionType as a string
43
43
  */
44
- toString() : string {
45
- return TransactionType.ttEnumMap.get(this.proto);
44
+ toString(): string {
45
+ return TransactionType.ttEnumMap.get(this.proto) ?? 'UNKNOWN';
46
46
  }
47
47
  }
@@ -0,0 +1,11 @@
1
+ import { LocalDateProto } from '../../../fintekkers/models/util/local_date_pb';
2
+ declare class LocalDate {
3
+ private proto;
4
+ constructor(proto: LocalDateProto);
5
+ toDate(): Date;
6
+ toString(): string;
7
+ toProto(): LocalDateProto;
8
+ static today(): LocalDate;
9
+ static from(date: Date): LocalDate;
10
+ }
11
+ export { LocalDate };
@@ -1,32 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalDate = void 0;
4
- var local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
5
- var serialization_1 = require("./serialization");
6
- var LocalDate = /** @class */ (function () {
7
- function LocalDate(proto) {
4
+ const local_date_pb_1 = require("../../../fintekkers/models/util/local_date_pb");
5
+ const serialization_1 = require("./serialization");
6
+ class LocalDate {
7
+ constructor(proto) {
8
8
  this.proto = proto;
9
9
  }
10
- LocalDate.prototype.toDate = function () {
10
+ toDate() {
11
11
  //Use the deserialization class which correctly handles month indexing
12
12
  //mismatch between Javascript date and other languages, and the proto definition
13
13
  //In the Proto 2 means Februrary, but in Javascript it will be read as March
14
14
  return serialization_1.ProtoSerializationUtil.deserialize(this.proto);
15
- };
16
- LocalDate.prototype.toString = function () {
15
+ }
16
+ toString() {
17
17
  return this.proto.getYear() + '-' + this.proto.getMonth() + '-' + this.proto.getDay();
18
- };
19
- LocalDate.prototype.toProto = function () {
18
+ }
19
+ toProto() {
20
20
  return this.proto;
21
- };
22
- LocalDate.today = function () {
23
- var today = new Date();
21
+ }
22
+ static today() {
23
+ const today = new Date();
24
24
  return this.from(today);
25
- };
26
- LocalDate.from = function (date) {
25
+ }
26
+ static from(date) {
27
27
  return new LocalDate(new local_date_pb_1.LocalDateProto().setYear(date.getFullYear()).setMonth(date.getMonth() + 1).setDay(date.getDate()));
28
- };
29
- return LocalDate;
30
- }());
28
+ }
29
+ }
31
30
  exports.LocalDate = LocalDate;
32
31
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["date.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAC/E,iDAAyD;AAEzD;IAGE,mBAAY,KAAqB;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,0BAAM,GAAN;QACE,sEAAsE;QACtE,gFAAgF;QAChF,4EAA4E;QAC5E,OAAO,sCAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IAED,4BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxF,CAAC;IAED,2BAAO,GAAP;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAEM,eAAK,GAAZ;QACE,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAI,GAAX,UAAY,IAAU;QACpB,OAAO,IAAI,SAAS,CAClB,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CACtG,CAAC;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AAhCD,IAgCC;AAEQ,8BAAS"}
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["date.ts"],"names":[],"mappings":";;;AACA,iFAA+E;AAC/E,mDAAyD;AAEzD,MAAM,SAAS;IAGb,YAAY,KAAqB;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM;QACJ,sEAAsE;QACtE,gFAAgF;QAChF,4EAA4E;QAC5E,OAAO,sCAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAS,CAAC;IAChE,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxF,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,KAAK;QACV,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,IAAU;QACpB,OAAO,IAAI,SAAS,CAClB,IAAI,8BAAc,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CACtG,CAAC;IACJ,CAAC;CACF;AAEQ,8BAAS"}
@@ -0,0 +1 @@
1
+ export {};
@@ -8,63 +8,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
11
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var field_pb_1 = require("../../../fintekkers/models/position/field_pb");
40
- var position_pb_1 = require("../../../fintekkers/models/position/position_pb");
41
- var position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
42
- var position_1 = require("../position/position");
43
- var date_1 = require("./date");
44
- var any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
45
- test('test the date time', function () { return __awaiter(void 0, void 0, void 0, function () {
46
- var now, nowProto, nowPacked, position, field1, pos, timestampStr;
47
- return __generator(this, function (_a) {
48
- now = date_1.LocalDate.today();
49
- nowProto = now.toProto();
50
- nowPacked = new any_pb_1.Any();
51
- nowPacked.setTypeUrl("DUMMYTYPE_DATE");
52
- nowPacked.setValue(nowProto.serializeBinary());
53
- position = new position_pb_1.PositionProto();
54
- // Set properties
55
- position.setObjectClass(' MyClass');
56
- position.setVersion('1.0');
57
- position.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
58
- position.setPositionType(position_pb_1.PositionTypeProto.TRANSACTION);
59
- field1 = new position_util_pb_1.FieldMapEntry();
60
- field1.setField(field_pb_1.FieldProto.EFFECTIVE_DATE);
61
- field1.setFieldValuePacked(nowPacked);
62
- position.addFields(field1);
63
- pos = new position_1.Position(position);
64
- timestampStr = pos.getFieldDisplay(field1);
65
- //Expect timestamp match
66
- expect(timestampStr).toMatch(/^\d{4}\/(?:\d{1,2})(?:\/\d{1,2})?$/);
67
- return [2 /*return*/];
68
- });
69
- }); });
12
+ const field_pb_1 = require("../../../fintekkers/models/position/field_pb");
13
+ const position_pb_1 = require("../../../fintekkers/models/position/position_pb");
14
+ const position_util_pb_1 = require("../../../fintekkers/models/position/position_util_pb");
15
+ const position_1 = require("../position/position");
16
+ const date_1 = require("./date");
17
+ const any_pb_1 = require("google-protobuf/google/protobuf/any_pb");
18
+ test('test the date time', () => __awaiter(void 0, void 0, void 0, function* () {
19
+ const now = date_1.LocalDate.today();
20
+ const nowProto = now.toProto();
21
+ const nowPacked = new any_pb_1.Any();
22
+ nowPacked.setTypeUrl(`DUMMYTYPE_DATE`);
23
+ nowPacked.setValue(nowProto.serializeBinary());
24
+ const position = new position_pb_1.PositionProto();
25
+ // Set properties
26
+ position.setObjectClass(' MyClass');
27
+ position.setVersion('1.0');
28
+ position.setPositionView(position_pb_1.PositionViewProto.DEFAULT_VIEW);
29
+ position.setPositionType(position_pb_1.PositionTypeProto.TRANSACTION);
30
+ // Add fields
31
+ const field1 = new position_util_pb_1.FieldMapEntry();
32
+ field1.setField(field_pb_1.FieldProto.EFFECTIVE_DATE);
33
+ field1.setFieldValuePacked(nowPacked);
34
+ position.addFields(field1);
35
+ const pos = new position_1.Position(position);
36
+ const timestampStr = pos.getFieldDisplay(field1);
37
+ //Expect timestamp match
38
+ expect(timestampStr).toMatch(/^\d{4}\/(?:\d{1,2})(?:\/\d{1,2})?$/);
39
+ }));
70
40
  //# sourceMappingURL=date.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.test.js","sourceRoot":"","sources":["date.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yEAA0E;AAC1E,+EAAsH;AACtH,yFAAqF;AACrF,iDAAgD;AAChD,+BAAmC;AACnC,iEAA6D;AAE7D,IAAI,CAAC,oBAAoB,EAAE;;;QACjB,GAAG,GAAG,gBAAS,CAAC,KAAK,EAAE,CAAC;QAExB,QAAQ,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QACzB,SAAS,GAAG,IAAI,YAAG,EAAE,CAAC;QAC5B,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;QACvC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;QAEzC,QAAQ,GAAG,IAAI,2BAAa,EAAE,CAAC;QAErC,iBAAiB;QACjB,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACpC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3B,QAAQ,CAAC,eAAe,CAAC,+BAAiB,CAAC,YAAY,CAAC,CAAC;QACzD,QAAQ,CAAC,eAAe,CAAC,+BAAiB,CAAC,WAAW,CAAC,CAAC;QAGlD,MAAM,GAAG,IAAI,gCAAa,EAAE,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,qBAAU,CAAC,cAAc,CAAC,CAAC;QAC3C,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACtC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAErB,GAAG,GAAG,IAAI,mBAAQ,CAAC,QAAQ,CAAC,CAAC;QAC7B,YAAY,GAAG,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC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,CAAC,CAAC;IAEjD,wBAAwB;IACxB,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC;AACvE,CAAC,CAAA,CAAC,CAAC"}
@@ -13,7 +13,7 @@ class LocalDate {
13
13
  //Use the deserialization class which correctly handles month indexing
14
14
  //mismatch between Javascript date and other languages, and the proto definition
15
15
  //In the Proto 2 means Februrary, but in Javascript it will be read as March
16
- return ProtoSerializationUtil.deserialize(this.proto);
16
+ return ProtoSerializationUtil.deserialize(this.proto) as Date;
17
17
  }
18
18
 
19
19
  toString(): string {
@@ -0,0 +1,14 @@
1
+ import { LocalTimestampProto } from '../../../fintekkers/models/util/local_timestamp_pb';
2
+ import { DateTime } from 'luxon';
3
+ declare class ZonedDateTime {
4
+ private proto;
5
+ constructor(proto: LocalTimestampProto);
6
+ getTimezone(): string;
7
+ getSeconds(): number;
8
+ getNanoSeconds(): number;
9
+ toDateTime(): DateTime;
10
+ toString(): string;
11
+ toProto(): LocalTimestampProto;
12
+ static now(): ZonedDateTime;
13
+ }
14
+ export { ZonedDateTime };
@@ -1,55 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ZonedDateTime = void 0;
4
- var local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timestamp_pb");
5
- var timestamp_pb_1 = require("google-protobuf/google/protobuf/timestamp_pb");
6
- var luxon_1 = require("luxon");
7
- var ZonedDateTime = /** @class */ (function () {
8
- function ZonedDateTime(proto) {
4
+ const local_timestamp_pb_1 = require("../../../fintekkers/models/util/local_timestamp_pb");
5
+ const timestamp_pb_1 = require("google-protobuf/google/protobuf/timestamp_pb");
6
+ const luxon_1 = require("luxon");
7
+ class ZonedDateTime {
8
+ constructor(proto) {
9
9
  this.proto = proto;
10
10
  }
11
- ZonedDateTime.prototype.getTimezone = function () {
11
+ getTimezone() {
12
12
  return this.proto.getTimeZone();
13
- };
14
- ZonedDateTime.prototype.getSeconds = function () {
15
- return this.proto.getTimestamp().getSeconds();
16
- };
17
- ZonedDateTime.prototype.getNanoSeconds = function () {
18
- return this.proto.getTimestamp().getNanos();
19
- };
20
- ZonedDateTime.prototype.toDateTime = function () {
21
- // Creating a DateTime object with the current date and time in a specific time zone (e.g., 'America/New_York')
22
- var unixTimestampSeconds = this.proto.getTimestamp().getSeconds();
23
- var nanoseconds = this.proto.getTimestamp().getNanos();
24
- var dateTime = luxon_1.DateTime.fromSeconds(unixTimestampSeconds, { zone: this.proto.getTimeZone() });
13
+ }
14
+ getSeconds() {
15
+ const timestamp = this.proto.getTimestamp();
16
+ if (!timestamp)
17
+ throw new Error("Timestamp is required");
18
+ return timestamp.getSeconds();
19
+ }
20
+ getNanoSeconds() {
21
+ const timestamp = this.proto.getTimestamp();
22
+ if (!timestamp)
23
+ throw new Error("Timestamp is required");
24
+ return timestamp.getNanos();
25
+ }
26
+ toDateTime() {
27
+ const timestamp = this.proto.getTimestamp();
28
+ if (!timestamp)
29
+ throw new Error("Timestamp is required");
30
+ const unixTimestampSeconds = timestamp.getSeconds();
31
+ const nanoseconds = timestamp.getNanos();
32
+ let dateTime = luxon_1.DateTime.fromSeconds(unixTimestampSeconds, { zone: this.proto.getTimeZone() });
25
33
  // Manually add nanoseconds using the set method
26
34
  dateTime = dateTime.set({ millisecond: Math.floor(nanoseconds / 1000000) });
27
35
  return dateTime;
28
- };
29
- ZonedDateTime.prototype.toString = function () {
30
- var dateTime = this.toDateTime();
31
- var date = new Date(dateTime.year, dateTime.month - 1, dateTime.day, dateTime.hour, dateTime.minute, dateTime.second);
36
+ }
37
+ toString() {
38
+ const dateTime = this.toDateTime();
39
+ const date = new Date(dateTime.year, dateTime.month - 1, dateTime.day, dateTime.hour, dateTime.minute, dateTime.second);
32
40
  return date.toISOString().slice(0, 19).replace(/-/g, '/').replace('T', ' ');
33
- };
34
- ZonedDateTime.prototype.toProto = function () {
41
+ }
42
+ toProto() {
35
43
  return this.proto;
36
- };
37
- ZonedDateTime.now = function () {
44
+ }
45
+ static now() {
38
46
  // Get the current time in milliseconds since January 1, 1970 (Unix timestamp)
39
- var currentTimeMillis = Date.now();
47
+ const currentTimeMillis = Date.now();
40
48
  // Convert milliseconds to seconds and nanoseconds
41
- var seconds = Math.floor(currentTimeMillis / 1000);
42
- var nanos = (currentTimeMillis % 1000) * 1e6; // 1 millisecond = 1e6 nanoseconds
49
+ const seconds = Math.floor(currentTimeMillis / 1000);
50
+ const nanos = (currentTimeMillis % 1000) * 1e6; // 1 millisecond = 1e6 nanoseconds
43
51
  // Create a new Timestamp object with the current time
44
- var timestamp = new timestamp_pb_1.Timestamp();
52
+ const timestamp = new timestamp_pb_1.Timestamp();
45
53
  timestamp.setSeconds(seconds);
46
54
  timestamp.setNanos(nanos);
47
- var localTimestamp = new local_timestamp_pb_1.LocalTimestampProto();
55
+ const localTimestamp = new local_timestamp_pb_1.LocalTimestampProto();
48
56
  localTimestamp.setTimeZone('America/New_York');
49
57
  localTimestamp.setTimestamp(timestamp);
50
58
  return new ZonedDateTime(localTimestamp);
51
- };
52
- return ZonedDateTime;
53
- }());
59
+ }
60
+ }
54
61
  exports.ZonedDateTime = ZonedDateTime;
55
62
  //# sourceMappingURL=datetime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datetime.js","sourceRoot":"","sources":["datetime.ts"],"names":[],"mappings":";;;AAAA,yFAAuF;AACvF,6EAAuE;AACvE,+BAA+B;AAE/B;IAGE,uBAAY,KAA0B;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,mCAAW,GAAX;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,kCAAU,GAAV;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC;IAED,sCAAc,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC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