@kontur.candy/generator 5.21.0-picklist-new.1 → 5.21.0-picklist-again.1
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/dist/index.js +21 -39
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59580,6 +59580,9 @@ class ModelPathImpl {
|
|
|
59580
59580
|
isContainCurrentIteration() {
|
|
59581
59581
|
return this.tokens.some(x => x === PathTokens.current);
|
|
59582
59582
|
}
|
|
59583
|
+
isContainCurrentOrEachIteration() {
|
|
59584
|
+
return this.tokens.some(x => x === PathTokens.current || x === PathTokens.each);
|
|
59585
|
+
}
|
|
59583
59586
|
getLastListPath() {
|
|
59584
59587
|
if (!this.isContainIteration()) {
|
|
59585
59588
|
throw new Error("Path must contain iteration");
|
|
@@ -80911,8 +80914,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
80911
80914
|
/* harmony export */ "IsInnExpression": () => (/* binding */ IsInnExpression),
|
|
80912
80915
|
/* harmony export */ "IsValidMirCardNumberExpression": () => (/* binding */ IsValidMirCardNumberExpression),
|
|
80913
80916
|
/* harmony export */ "IsValidAccountNumberExpression": () => (/* binding */ IsValidAccountNumberExpression),
|
|
80914
|
-
/* harmony export */ "
|
|
80915
|
-
/* harmony export */ "
|
|
80917
|
+
/* harmony export */ "AddSumByKeysExpression": () => (/* binding */ AddSumByKeysExpression),
|
|
80918
|
+
/* harmony export */ "GetSumByKeysExpression": () => (/* binding */ GetSumByKeysExpression),
|
|
80916
80919
|
/* harmony export */ "IntegerLiteralExpression": () => (/* binding */ IntegerLiteralExpression),
|
|
80917
80920
|
/* harmony export */ "NullLiteralExpression": () => (/* binding */ NullLiteralExpression),
|
|
80918
80921
|
/* harmony export */ "ConditionalExpression": () => (/* binding */ ConditionalExpression),
|
|
@@ -81375,7 +81378,7 @@ class ReduceCallExpression extends CallExpression {
|
|
|
81375
81378
|
return this.reduceFunction.getType();
|
|
81376
81379
|
}
|
|
81377
81380
|
convertToString() {
|
|
81378
|
-
return `reduce(${toFLangString(this.modelPath)}
|
|
81381
|
+
return `reduce(${toFLangString(this.modelPath)}/#iter, ${this.reduceFunction.convertToString()}, ${this.initialValue.convertToString()})`;
|
|
81379
81382
|
}
|
|
81380
81383
|
}
|
|
81381
81384
|
class ReduceMultipleCallExpression extends CallExpression {
|
|
@@ -81707,7 +81710,7 @@ class IsValidAccountNumberExpression extends FLangBoolExpression {
|
|
|
81707
81710
|
return `isValidAccountNumber(${this.bik.convertToString()}, ${this.account.convertToString()})`;
|
|
81708
81711
|
}
|
|
81709
81712
|
}
|
|
81710
|
-
class
|
|
81713
|
+
class AddSumByKeysExpression extends FLangDictExpression {
|
|
81711
81714
|
constructor(argumentReference, key, value) {
|
|
81712
81715
|
super();
|
|
81713
81716
|
this.argumentReference = void 0;
|
|
@@ -81729,7 +81732,7 @@ class AddSumExpression extends FLangDictExpression {
|
|
|
81729
81732
|
return `addSumByKeys(${dictName}, ${key}, ${value})`;
|
|
81730
81733
|
}
|
|
81731
81734
|
}
|
|
81732
|
-
class
|
|
81735
|
+
class GetSumByKeysExpression extends FLangDecimalExpression {
|
|
81733
81736
|
constructor(dictionaryExpression, key) {
|
|
81734
81737
|
super();
|
|
81735
81738
|
this.dictionaryExpression = void 0;
|
|
@@ -82205,7 +82208,7 @@ function* getAllExpressionChildren(node, descendantsFilter) {
|
|
|
82205
82208
|
}
|
|
82206
82209
|
}
|
|
82207
82210
|
function wrapWithArgumentsCondition(expression) {
|
|
82208
|
-
const childFilter = node => !(node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ReduceCallExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.
|
|
82211
|
+
const childFilter = node => !(node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ReduceCallExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.GetSumByKeysExpression);
|
|
82209
82212
|
const allValueRefNodes = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat([expression], getAllExpressionChildren(expression, childFilter)).map(x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression ? x : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined);
|
|
82210
82213
|
const uniquePaths = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allValueRefNodes, x => x.convertToString());
|
|
82211
82214
|
const conditionExpression = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.reduce(uniquePaths, (acc, curr) => {
|
|
@@ -82767,48 +82770,27 @@ class FormulaExpressionToFlangExpressionConverter {
|
|
|
82767
82770
|
const matchPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, sourceKeyPath);
|
|
82768
82771
|
const sourceKeyParts = sourceKeyPath.getPathPartsAsArray();
|
|
82769
82772
|
const firstPart = matchPaths.matchedPath.toCurrentIteration();
|
|
82770
|
-
let finalIterPath;
|
|
82771
82773
|
const firstPartLength = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.count(firstPart.getPathParts());
|
|
82772
82774
|
const secondParts = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createRelativeFromTokens)(sourceKeyParts.slice(firstPartLength));
|
|
82773
|
-
|
|
82775
|
+
const getIterationPathWithNestedMultiplicity = () => {
|
|
82774
82776
|
const secondPartParts = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createRelativeFromTokens)(sourceKeyParts.slice(firstPartLength)).getPathPartsAsArray();
|
|
82775
82777
|
const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
|
|
82776
82778
|
const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
|
|
82777
|
-
|
|
82778
|
-
}
|
|
82779
|
-
|
|
82780
|
-
|
|
82781
|
-
|
|
82782
|
-
|
|
82783
|
-
|
|
82784
|
-
|
|
82785
|
-
|
|
82786
|
-
* GroupCountConstThrewMultiple/Б/__EACH__/С/__EACH__/Код
|
|
82787
|
-
* in Б
|
|
82788
|
-
* {
|
|
82789
|
-
* in С
|
|
82790
|
-
* {
|
|
82791
|
-
* check inС === groupCount(Код, Код);
|
|
82792
|
-
* GroupCountConstThrewMultiple/Б/__CURRENT__/С/__CURRENT__/Код
|
|
82793
|
-
* }
|
|
82794
|
-
* }
|
|
82795
|
-
* }
|
|
82796
|
-
* */
|
|
82797
|
-
finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)(predictIterMultiplisity.toCurrentIteration().getPathPartsAsArray().slice(0, firstPartLength - 1));
|
|
82798
|
-
} else {
|
|
82799
|
-
finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)(sourceKeyParts.slice(0, firstPartLength - 1));
|
|
82800
|
-
}
|
|
82801
|
-
}
|
|
82802
|
-
if (!finalIterPath) {
|
|
82779
|
+
return (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
|
|
82780
|
+
};
|
|
82781
|
+
const getIterationPathWithoutNestedMultiplicity = () => {
|
|
82782
|
+
const firstPartParts = matchPaths.matchedPath.getPathPartsAsArray();
|
|
82783
|
+
const lastStarIndexSecondPart = firstPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
|
|
82784
|
+
return (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)(sourceKeyParts.slice(0, lastStarIndexSecondPart)).toCurrentIteration().trimLastStarIfLastToken();
|
|
82785
|
+
};
|
|
82786
|
+
const finalIterPath = secondParts.isContainCurrentOrEachIteration() ? getIterationPathWithNestedMultiplicity() : getIterationPathWithoutNestedMultiplicity();
|
|
82787
|
+
if (finalIterPath.isEmpty()) {
|
|
82803
82788
|
throw new Error("Error occurred while trying parse path for reduce: " + firstPart.toLegacyPath());
|
|
82804
82789
|
}
|
|
82805
82790
|
const keys = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DeserializeEnumerationExpression([new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ValueReferenceExpression(sourceKeyPath.toCurrentIteration(), "value")], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BoolLiteralExpression(true));
|
|
82806
|
-
const reduceExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.dict, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.dict)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.
|
|
82807
|
-
if (reduceExpression == undefined) {
|
|
82808
|
-
throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.NotSupportedError("Target and source must be in different collections! " + "\n" + `Target: ${target}` + "\n" + `SourceKey: ${sourceKeyPath}`);
|
|
82809
|
-
}
|
|
82791
|
+
const reduceExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.dict, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.dict)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.AddSumByKeysExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArgumentReferenceExpression("result"), keys, (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToDecimalIfNeed)(sourceValueExpression))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DictLiteralExpression());
|
|
82810
82792
|
const deserializedKeys = targetKeys.items[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys.items[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DeserializeEnumerationExpression(targetKeys.items.map(i => this.compileEnumerationItem(i, prefix, target, addPrecalculationRule)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BoolLiteralExpression(true));
|
|
82811
|
-
const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.
|
|
82793
|
+
const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.GetSumByKeysExpression(reduceExpression, deserializedKeys !== null && deserializedKeys !== void 0 ? deserializedKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)());
|
|
82812
82794
|
return finalValueExpression;
|
|
82813
82795
|
}
|
|
82814
82796
|
compileEnumerationItem(expression, prefix, target, addPrecalculationRule) {
|