@veloceapps/sdk 6.0.0-28 → 6.0.0-29
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.
@@ -668,31 +668,23 @@
|
|
668
668
|
if (lineItem.id === replaceTo.id) {
|
669
669
|
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
670
670
|
}
|
671
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) {
|
672
|
-
if (li.id === replaceTo.id) {
|
673
|
-
return replaceTo;
|
674
|
-
}
|
675
|
-
else if (li.lineItems.length) {
|
676
|
-
return replaceLineItem(li, replaceTo);
|
677
|
-
}
|
678
|
-
return li;
|
679
|
-
}) });
|
671
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) { return replaceLineItem(li, replaceTo); }) });
|
680
672
|
};
|
681
673
|
var recalculateCardinalityVariables = function (original, updated) {
|
682
|
-
var e_1, _c,
|
674
|
+
var e_1, _c, e_2, _d;
|
683
675
|
var _a;
|
684
|
-
var cardinalityVariables =
|
676
|
+
var cardinalityVariables = new Map();
|
685
677
|
try {
|
686
|
-
for (var
|
687
|
-
var li =
|
678
|
+
for (var _e = __values(updated.lineItems), _f = _e.next(); !_f.done; _f = _e.next()) {
|
679
|
+
var li = _f.value;
|
688
680
|
var cardinalityVariableName = "#CV-" + li.type + "@" + li.port;
|
689
|
-
cardinalityVariables
|
681
|
+
cardinalityVariables.set(cardinalityVariableName, ((_a = cardinalityVariables.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
690
682
|
}
|
691
683
|
}
|
692
684
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
693
685
|
finally {
|
694
686
|
try {
|
695
|
-
if (
|
687
|
+
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
696
688
|
}
|
697
689
|
finally { if (e_1) throw e_1.error; }
|
698
690
|
}
|
@@ -702,23 +694,23 @@
|
|
702
694
|
return li.id === id && li.qty === qty;
|
703
695
|
})) {
|
704
696
|
var cardinalityVariableName = "#CV-" + li.type + "@" + li.port;
|
705
|
-
delete
|
697
|
+
cardinalityVariables.delete(cardinalityVariableName);
|
706
698
|
}
|
707
699
|
};
|
708
700
|
try {
|
709
|
-
for (var
|
710
|
-
var li =
|
701
|
+
for (var _g = __values(original.lineItems), _h = _g.next(); !_h.done; _h = _g.next()) {
|
702
|
+
var li = _h.value;
|
711
703
|
_loop_1(li);
|
712
704
|
}
|
713
705
|
}
|
714
706
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
715
707
|
finally {
|
716
708
|
try {
|
717
|
-
if (
|
709
|
+
if (_h && !_h.done && (_d = _g.return)) _d.call(_g);
|
718
710
|
}
|
719
711
|
finally { if (e_2) throw e_2.error; }
|
720
712
|
}
|
721
|
-
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes,
|
713
|
+
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, __spreadArray([], __read(cardinalityVariables)).map(function (_c) {
|
722
714
|
var _d = __read(_c, 2), name = _d[0], value = _d[1];
|
723
715
|
return ({ name: name, value: value });
|
724
716
|
})) });
|