b2m-utils 0.0.296 → 0.0.297

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1446,7 +1446,17 @@ var getCtesFeesResult = function (feesToCalc, cte, allFeesForCalc) {
1446
1446
  if (totalPercentageFees.length > 0) {
1447
1447
  console.log("\n\uD83D\uDD04 [getCtesFeesResult] Calculando ".concat(totalPercentageFees.length, " fees TOTAL_PERCENTAGE"));
1448
1448
  console.log("\uD83D\uDCCB Fees: ".concat(totalPercentageFees.map(function (f) { var _a; return "".concat((_a = f.fee) === null || _a === void 0 ? void 0 : _a.name, " (").concat(f.value, "%)"); }).join(', ')));
1449
- var percentageFeesCache = calculateTotalPercentageFees(feesToCalc, cte, allFeesForCalc);
1449
+ // Criar Map com valores já calculados das fees normais (respeitando lógica de siblings)
1450
+ var preCalculatedValues_1 = new Map();
1451
+ results.forEach(function (r) {
1452
+ var _a;
1453
+ var fee = feesToCalc.find(function (f) { return f.feeId === r.feeId; });
1454
+ if ((_a = fee === null || fee === void 0 ? void 0 : fee.fee) === null || _a === void 0 ? void 0 : _a.id) {
1455
+ preCalculatedValues_1.set(fee.fee.id, r.total);
1456
+ }
1457
+ });
1458
+ console.log("\uD83D\uDCCA Usando ".concat(preCalculatedValues_1.size, " valores pr\u00E9-calculados"));
1459
+ var percentageFeesCache = calculateTotalPercentageFees(feesToCalc, cte, allFeesForCalc, preCalculatedValues_1);
1450
1460
  console.log("\u2705 Cache gerado com ".concat(percentageFeesCache.size, " fees"));
1451
1461
  for (var _g = 0, totalPercentageFees_1 = totalPercentageFees; _g < totalPercentageFees_1.length; _g++) {
1452
1462
  var item = totalPercentageFees_1[_g];
package/build/index.js.gz CHANGED
Binary file