@kontur.candy/generator 5.14.0-rsvfunctions.0 → 5.14.0-rsvfunctions.3
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 +28 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61999,7 +61999,7 @@ const isInnKCLangFunction = params => {
|
|
|
61999
61999
|
throw new Error("Invalid parameters!");
|
|
62000
62000
|
};
|
|
62001
62001
|
const arrayKCLangFunction = params => {
|
|
62002
|
-
const errors = Array.from(validateParams(params,
|
|
62002
|
+
const errors = Array.from(validateParams(params, 0, Infinity));
|
|
62003
62003
|
if (errors.length > 0) {
|
|
62004
62004
|
return new FunctionValidationErrorCollection(errors);
|
|
62005
62005
|
}
|
|
@@ -77075,8 +77075,6 @@ let MathContainer = (_dec149 = (0,_markupGenerator_Serializer_SugarSerializer__W
|
|
|
77075
77075
|
let FormulaGroupSumExpression = (_dec152 = (0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.sugarNode)("groupsum", `Вычисление суммы с группировкой в разных множественностях`), _dec153 = (0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.singleChild)("array", [FormulaArrayExpression]), _dec154 = (0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("sourceKeyPath", _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string.required, `Путь откуда брать ключ группы в суммируемой множественности`), _dec155 = (0,_markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attr)("sourceValuePath", _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_5__.attrType.string.required, `Путь в суммируемой множественности откуда берем значение для свёртки`), _dec152(_class187 = (_class188 = class FormulaGroupSumExpression extends FormulaExpression {
|
|
77076
77076
|
constructor(...args) {
|
|
77077
77077
|
super(...args);
|
|
77078
|
-
// @attr("targetKeyPath", attrType.string.required, `Путь откуда брать ключ группы в целевой множественности`)
|
|
77079
|
-
// public targetKeys!: string;
|
|
77080
77078
|
_babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "targetKeys", _descriptor88, this);
|
|
77081
77079
|
_babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "sourceKeyPath", _descriptor89, this);
|
|
77082
77080
|
_babel_runtime_helpers_initializerDefineProperty__WEBPACK_IMPORTED_MODULE_0___default()(this, "sourceValuePath", _descriptor90, this);
|
|
@@ -79280,7 +79278,10 @@ class KCXmlGeneratorBase {
|
|
|
79280
79278
|
const compiledItems = expression.items.expressions.map(item => this.compileExpression(prefix, targetFullPath, item, deps)).join(",");
|
|
79281
79279
|
return gcf(x => x.oneOf, compiledArgument, `[${compiledItems}]`);
|
|
79282
79280
|
}
|
|
79283
|
-
|
|
79281
|
+
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
|
|
79282
|
+
const itemsText = expression.items.map(x => this.compileExpression(prefix, targetFullPath, x, deps)).join(", ");
|
|
79283
|
+
return `JSON.stringify([${itemsText}])`;
|
|
79284
|
+
}
|
|
79284
79285
|
// -- не работает в рантайм калькуляторе
|
|
79285
79286
|
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
|
|
79286
79287
|
return "null";
|
|
@@ -79291,10 +79292,6 @@ class KCXmlGeneratorBase {
|
|
|
79291
79292
|
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
|
|
79292
79293
|
return "null";
|
|
79293
79294
|
}
|
|
79294
|
-
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
|
|
79295
|
-
const itemsText = expression.items.map(x => this.compileExpression(prefix, targetFullPath, x, deps)).join(", ");
|
|
79296
|
-
return `JSON.stringify([${itemsText}])`;
|
|
79297
|
-
}
|
|
79298
79295
|
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
|
|
79299
79296
|
return "null";
|
|
79300
79297
|
}
|
|
@@ -81840,19 +81837,25 @@ class SerializeEnumerationExpression extends FLangExpression {
|
|
|
81840
81837
|
}
|
|
81841
81838
|
}
|
|
81842
81839
|
class DeserializeEnumerationExpression extends FLangExpression {
|
|
81843
|
-
constructor(
|
|
81840
|
+
constructor(items, convertToStringFlag) {
|
|
81844
81841
|
super();
|
|
81845
|
-
this.
|
|
81846
|
-
this.
|
|
81842
|
+
this.items = void 0;
|
|
81843
|
+
this.autoConvertToArray = void 0;
|
|
81844
|
+
this.items = items;
|
|
81845
|
+
this.autoConvertToArray = convertToStringFlag;
|
|
81847
81846
|
}
|
|
81848
81847
|
getType() {
|
|
81849
81848
|
return BuildInTypeExpression.string;
|
|
81850
81849
|
}
|
|
81851
81850
|
*getChildNodes() {
|
|
81852
|
-
|
|
81851
|
+
for (const item of this.items) {
|
|
81852
|
+
yield item;
|
|
81853
|
+
}
|
|
81854
|
+
yield this.autoConvertToArray;
|
|
81853
81855
|
}
|
|
81854
81856
|
convertToString() {
|
|
81855
|
-
|
|
81857
|
+
const items = this.items.map(x => x.convertToString()).join(", ");
|
|
81858
|
+
return `deserializeEnumeration(${items}, ${this.autoConvertToArray.convertToString()})`;
|
|
81856
81859
|
}
|
|
81857
81860
|
}
|
|
81858
81861
|
class ArrayExpression extends FLangExpression {
|
|
@@ -82533,12 +82536,7 @@ class FormulaExpressionToFlangExpressionConverter {
|
|
|
82533
82536
|
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.IsValidMirCardNumberExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(arg));
|
|
82534
82537
|
}
|
|
82535
82538
|
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArrayExpression) {
|
|
82536
|
-
const items = expression.items.map(arg =>
|
|
82537
|
-
if (arg instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
|
|
82538
|
-
return this.compiledArgumentExpression(prefix, target, arg.select, "string", addPrecalculationRule);
|
|
82539
|
-
}
|
|
82540
|
-
return this.compileExpressionToFlangExpressionInternal(arg, prefix, target, addPrecalculationRule);
|
|
82541
|
-
});
|
|
82539
|
+
const items = expression.items.map(arg => this.compileEnumerationItem(arg, prefix, target, addPrecalculationRule));
|
|
82542
82540
|
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArrayExpression(items);
|
|
82543
82541
|
}
|
|
82544
82542
|
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaFirstOrDefaultExpression) {
|
|
@@ -82614,31 +82612,31 @@ class FormulaExpressionToFlangExpressionConverter {
|
|
|
82614
82612
|
const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
|
|
82615
82613
|
const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
|
|
82616
82614
|
const finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
|
|
82617
|
-
const
|
|
82618
|
-
const keys = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.NullCoalesceExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DeserializeEnumerationExpression(value), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArrayExpression([value]));
|
|
82615
|
+
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));
|
|
82619
82616
|
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__.AddSumExpression(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());
|
|
82620
82617
|
if (reduceExpression == undefined) {
|
|
82621
82618
|
throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.NotSupportedError("Target and source must be in different collections! " + "\n" + `Target: ${target}` + "\n" + `SourceKey: ${sourceKeyPath}`);
|
|
82622
82619
|
}
|
|
82623
|
-
|
|
82624
|
-
|
|
82625
|
-
|
|
82626
|
-
|
|
82627
|
-
|
|
82620
|
+
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));
|
|
82621
|
+
const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.GetExpression(reduceExpression, deserializedKeys !== null && deserializedKeys !== void 0 ? deserializedKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)());
|
|
82622
|
+
return finalValueExpression;
|
|
82623
|
+
}
|
|
82624
|
+
compileEnumerationItem(expression, prefix, target, addPrecalculationRule) {
|
|
82625
|
+
if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
|
|
82626
|
+
return this.compiledArgumentExpression(prefix, target, expression.select, "string", addPrecalculationRule);
|
|
82628
82627
|
}
|
|
82628
|
+
return this.compileExpressionToFlangExpressionInternal(expression, prefix, target, addPrecalculationRule);
|
|
82629
82629
|
}
|
|
82630
82630
|
compileGroupSumExpression(prefix, target, expression, addPrecalculationRule) {
|
|
82631
|
-
const targetKeys = this.compileExpressionToFlangExpressionInternal(expression.targetKeys, prefix, target, addPrecalculationRule);
|
|
82632
82631
|
const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
|
|
82633
82632
|
const sourceValuePath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceValuePath);
|
|
82634
82633
|
const sourceValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ValueReferenceExpression(sourceValuePath.toCurrentIteration(), "value");
|
|
82635
|
-
return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
|
|
82634
|
+
return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
|
|
82636
82635
|
}
|
|
82637
82636
|
compileGroupCountExpression(prefix, target, expression, addPrecalculationRule) {
|
|
82638
|
-
const targetKeys = this.compileExpressionToFlangExpressionInternal(expression.targetKeys, prefix, target, addPrecalculationRule);
|
|
82639
82637
|
const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
|
|
82640
82638
|
const sourceValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DecimalLiteralExpression(1);
|
|
82641
|
-
return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
|
|
82639
|
+
return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
|
|
82642
82640
|
}
|
|
82643
82641
|
compiledArgumentExpression(prefix, target, selectPath, selectType, addPrecalculationRule, aggregationFunction = "Sum") {
|
|
82644
82642
|
const adjustedSelectPath = this.preparePathAndAdjustMultiplicity(prefix, selectPath);
|