@kontur.candy/generator 5.14.0-rsvfunctions.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +24 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -79278,7 +79278,10 @@ class KCXmlGeneratorBase {
79278
79278
  const compiledItems = expression.items.expressions.map(item => this.compileExpression(prefix, targetFullPath, item, deps)).join(",");
79279
79279
  return gcf(x => x.oneOf, compiledArgument, `[${compiledItems}]`);
79280
79280
  }
79281
-
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
+ }
79282
79285
  // -- не работает в рантайм калькуляторе
79283
79286
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
79284
79287
  return "null";
@@ -79289,10 +79292,6 @@ class KCXmlGeneratorBase {
79289
79292
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
79290
79293
  return "null";
79291
79294
  }
79292
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
79293
- const itemsText = expression.items.map(x => this.compileExpression(prefix, targetFullPath, x, deps)).join(", ");
79294
- return `JSON.stringify([${itemsText}])`;
79295
- }
79296
79295
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
79297
79296
  return "null";
79298
79297
  }
@@ -81838,22 +81837,25 @@ class SerializeEnumerationExpression extends FLangExpression {
81838
81837
  }
81839
81838
  }
81840
81839
  class DeserializeEnumerationExpression extends FLangExpression {
81841
- constructor(expression, convertToStringFlag) {
81840
+ constructor(items, convertToStringFlag) {
81842
81841
  super();
81843
- this.expression = void 0;
81842
+ this.items = void 0;
81844
81843
  this.autoConvertToArray = void 0;
81845
- this.expression = expression;
81844
+ this.items = items;
81846
81845
  this.autoConvertToArray = convertToStringFlag;
81847
81846
  }
81848
81847
  getType() {
81849
81848
  return BuildInTypeExpression.string;
81850
81849
  }
81851
81850
  *getChildNodes() {
81852
- yield this.expression;
81851
+ for (const item of this.items) {
81852
+ yield item;
81853
+ }
81853
81854
  yield this.autoConvertToArray;
81854
81855
  }
81855
81856
  convertToString() {
81856
- return `deserializeEnumeration(${this.expression.convertToString()}, ${this.autoConvertToArray.convertToString()})`;
81857
+ const items = this.items.map(x => x.convertToString()).join(", ");
81858
+ return `deserializeEnumeration(${items}, ${this.autoConvertToArray.convertToString()})`;
81857
81859
  }
81858
81860
  }
81859
81861
  class ArrayExpression extends FLangExpression {
@@ -82534,12 +82536,7 @@ class FormulaExpressionToFlangExpressionConverter {
82534
82536
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.IsValidMirCardNumberExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(arg));
82535
82537
  }
82536
82538
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArrayExpression) {
82537
- const items = expression.items.map(arg => {
82538
- if (arg instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
82539
- return this.compiledArgumentExpression(prefix, target, arg.select, "string", addPrecalculationRule);
82540
- }
82541
- return this.compileExpressionToFlangExpressionInternal(arg, prefix, target, addPrecalculationRule);
82542
- });
82539
+ const items = expression.items.map(arg => this.compileEnumerationItem(arg, prefix, target, addPrecalculationRule));
82543
82540
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArrayExpression(items);
82544
82541
  }
82545
82542
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaFirstOrDefaultExpression) {
@@ -82615,30 +82612,31 @@ class FormulaExpressionToFlangExpressionConverter {
82615
82612
  const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
82616
82613
  const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
82617
82614
  const finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
82618
- 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));
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
- if (targetKeys instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ArrayExpression) {
82624
- const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.GetExpression(reduceExpression, targetKeys !== null && targetKeys !== void 0 ? targetKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)());
82625
- return finalValueExpression;
82626
- } else {
82627
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.NotSupportedError("Server normalization does not support non array first argument in groupSum operator");
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.14.0-rsvfunctions.2",
3
+ "version": "5.14.0-rsvfunctions.3",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,