@kontur.candy/generator 4.295.0-fs-7926-fix-groupsum.2 → 4.296.0-finalerrorlogapi.0

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 +21 -71
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -127552,11 +127552,10 @@ class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGenerato
127552
127552
  const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
127553
127553
  const compiledTarget = this.modelPathInstance(target);
127554
127554
  const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(dependencies.map(x => ({
127555
- path: x.asDependencyModelPath(),
127556
- isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x),
127557
- pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
127558
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
127559
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
127555
+ path: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x) ? x : (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isAggregationDependencyModelPath)(x) ? x.modelPath : x.path,
127556
+ isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x)
127557
+ })).filter(x => !x.path.isEquals(target)), x => x.path.toLegacyPath()));
127558
+ const compiledDeps = dependencyModelPaths.map(x => x.path.toCurrentIteration()).map(x => this.modelPathInstance(x)).join(", ");
127560
127559
  const compiledExpressionWithCheck = this.compileAllItemsIsEmptyCheckBlock(compiledExpression, dependencyModelPaths.filter(x => !x.isIgnoreForChecks).map(x => x.path));
127561
127560
  const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpressionWithCheck}, "${defaultValue}")`;
127562
127561
  return {
@@ -131547,7 +131546,6 @@ const statementsToCode = statements => {
131547
131546
  "use strict";
131548
131547
  __webpack_require__.r(__webpack_exports__);
131549
131548
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
131550
- /* harmony export */ "RegularDependency": () => (/* binding */ RegularDependency),
131551
131549
  /* harmony export */ "AggregationDependencyModelPath": () => (/* binding */ AggregationDependencyModelPath),
131552
131550
  /* harmony export */ "DependencyWithoutChecks": () => (/* binding */ DependencyWithoutChecks),
131553
131551
  /* harmony export */ "isAggregationDependencyModelPath": () => (/* binding */ isAggregationDependencyModelPath),
@@ -131568,20 +131566,6 @@ __webpack_require__.r(__webpack_exports__);
131568
131566
 
131569
131567
 
131570
131568
 
131571
- class RegularDependency {
131572
- constructor(currentDependencyPath, eachDependencyPath) {
131573
- this.currentDependencyPath = void 0;
131574
- this.eachDependencyPath = void 0;
131575
- this.eachDependencyPath = eachDependencyPath;
131576
- this.currentDependencyPath = currentDependencyPath;
131577
- }
131578
-
131579
- asDependencyModelPath() {
131580
- const currentPart = this.currentDependencyPath.toCurrentIteration();
131581
- return this.eachDependencyPath != undefined ? currentPart.joinWith(this.eachDependencyPath) : currentPart;
131582
- }
131583
-
131584
- }
131585
131569
  class AggregationDependencyModelPath {
131586
131570
  constructor(type, modelPath, prefixModelPath, restModelPath) {
131587
131571
  this.type = void 0;
@@ -131594,12 +131578,14 @@ class AggregationDependencyModelPath {
131594
131578
  this.restModelPath = restModelPath;
131595
131579
  }
131596
131580
 
131597
- asDependencyModelPath() {
131598
- return this.modelPath.toCurrentIteration();
131581
+ }
131582
+ class DependencyWithoutChecks {
131583
+ constructor(path) {
131584
+ this.path = void 0;
131585
+ this.path = path;
131599
131586
  }
131600
131587
 
131601
131588
  }
131602
- class DependencyWithoutChecks extends RegularDependency {}
131603
131589
  function isAggregationDependencyModelPath(path) {
131604
131590
  return path instanceof AggregationDependencyModelPath;
131605
131591
  }
@@ -131625,7 +131611,7 @@ class KCXmlGeneratorBase {
131625
131611
  getArgumentDeps(targetFullPath, selectFullPath, aggregationType) {
131626
131612
  const pathDiffInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetFullPath, selectFullPath);
131627
131613
  const restPath = pathDiffInfo.differentPath;
131628
- return !restPath.isContainIteration() ? new RegularDependency(selectFullPath) : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
131614
+ return !restPath.isContainIteration() ? selectFullPath : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
131629
131615
  }
131630
131616
 
131631
131617
  getAggregationPathsRecursively(currentParts, restParts) {
@@ -131698,13 +131684,13 @@ class KCXmlGeneratorBase {
131698
131684
  const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
131699
131685
  const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Sum");
131700
131686
  deps.push(argumentDependency);
131701
- const finalPath = argumentDependency.asDependencyModelPath();
131687
+ const finalPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(argumentDependency) ? argumentDependency : isAggregationDependencyModelPath(argumentDependency) ? argumentDependency.modelPath : argumentDependency.path;
131702
131688
  return gcf(x => x.argument, `"${finalPath.toLegacyPath()}"`);
131703
131689
  }
131704
131690
 
131705
131691
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
131706
131692
  const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
131707
- deps.push(new RegularDependency(modelPath));
131693
+ deps.push(modelPath);
131708
131694
  return gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`);
131709
131695
  }
131710
131696
 
@@ -131743,9 +131729,9 @@ class KCXmlGeneratorBase {
131743
131729
  if (targetFullPath.isContainIteration()) {
131744
131730
  const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Count");
131745
131731
  deps.push(argumentDependency);
131746
- finalPath = argumentDependency.asDependencyModelPath();
131732
+ finalPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(argumentDependency) ? argumentDependency : isAggregationDependencyModelPath(argumentDependency) ? argumentDependency.modelPath : argumentDependency.path;
131747
131733
  } else {
131748
- deps.push(new RegularDependency(modelPath));
131734
+ deps.push(modelPath);
131749
131735
  }
131750
131736
 
131751
131737
  return gcf(x => x.count, `"${finalPath.toLegacyPath()}"`, `"${(_expression$withNullO = expression.withNullOrEmptyValues) !== null && _expression$withNullO !== void 0 ? _expression$withNullO : false}"`);
@@ -131888,11 +131874,9 @@ class KCXmlGeneratorBase {
131888
131874
  const targetKeyPath = this.getModelPath(prefix, expression.targetKeyPath);
131889
131875
  deps.push(new DependencyWithoutChecks(targetKeyPath));
131890
131876
  const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
131891
- const sourceKeyDeps = this.calculatedGroupSumDependencies(targetKeyPath, sourceKeyPath);
131892
- deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
131877
+ deps.push(new DependencyWithoutChecks(sourceKeyPath));
131893
131878
  const sourceValuePath = this.getModelPath(prefix, expression.sourceValuePath);
131894
- const sourceValueDeps = this.calculatedGroupSumDependencies(targetKeyPath, sourceValuePath);
131895
- deps.push(new DependencyWithoutChecks(sourceValueDeps.currentDepsPath, sourceValueDeps.eachDepsPath));
131879
+ deps.push(new DependencyWithoutChecks(sourceValuePath));
131896
131880
  return gcf(x => x.groupSum, `"${targetKeyPath}", "${sourceKeyPath}", "${sourceValuePath}"`);
131897
131881
  }
131898
131882
 
@@ -131900,8 +131884,7 @@ class KCXmlGeneratorBase {
131900
131884
  const targetKeyPath = this.getModelPath(prefix, expression.targetKeyPath);
131901
131885
  deps.push(new DependencyWithoutChecks(targetKeyPath));
131902
131886
  const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
131903
- const sourceKeyDeps = this.calculatedGroupSumDependencies(targetKeyPath, sourceKeyPath);
131904
- deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
131887
+ deps.push(new DependencyWithoutChecks(sourceKeyPath));
131905
131888
  return gcf(x => x.groupCount, `"${targetKeyPath}", "${sourceKeyPath}"`);
131906
131889
  }
131907
131890
 
@@ -131925,38 +131908,6 @@ class KCXmlGeneratorBase {
131925
131908
  }
131926
131909
  /* eslint-enable @typescript-eslint/unbound-method */
131927
131910
 
131928
- /*
131929
- Метод вычисляет зависимости для оператора.
131930
- Для того, чтобы калькулятор корректно реагировал на измнения необходимо сделать корректные зависимости:
131931
- 1) Если исходная множественность и множественность по которой строится группа совпадают, то необходио
131932
- для последней звёздочки построить зависимость не через PathTokens.current, а через PathTokens.each,
131933
- т.к. в таком случае пересчёт groupSum/groupCount должен тригетрися при изменении любого элемента в множественности, а не только текущего.
131934
- 2) Если множественности не совпадают, то количество звёздочек (getIterationRank()) в общей части будет разным и ничего дополнительно делать не нужно,
131935
- в зависимостях в CalculationFunction в данном случае все звёздочки превратятся в PathTokens.current.
131936
- */
131937
-
131938
-
131939
- calculatedGroupSumDependencies(targetKeyPath, sourcePath) {
131940
- var _targetPathParts$last;
131941
-
131942
- const diffPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetKeyPath, sourcePath);
131943
-
131944
- if (targetKeyPath.getIterationRank() > diffPaths.matchedPath.getIterationRank()) {
131945
- return {
131946
- currentDepsPath: diffPaths.matchedPath,
131947
- eachDepsPath: diffPaths.differentPath
131948
- };
131949
- }
131950
-
131951
- const targetPathParts = diffPaths.matchedPath.getPathPartsAsArray();
131952
- const lastStarIndex = targetPathParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
131953
- const currentDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(targetPathParts.slice(0, lastStarIndex));
131954
- const eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([(_targetPathParts$last = targetPathParts[lastStarIndex]) !== null && _targetPathParts$last !== void 0 ? _targetPathParts$last : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(), ...targetPathParts.slice(lastStarIndex + 1)]).joinWith(diffPaths.differentPath);
131955
- return {
131956
- currentDepsPath: currentDepsPath,
131957
- eachDepsPath: eachDepsPath
131958
- };
131959
- }
131960
131911
 
131961
131912
  removeAttributePrefix(pathPart) {
131962
131913
  return pathPart.replace(/\@/g, "");
@@ -132033,11 +131984,10 @@ class KCXmlValidationGenerator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPA
132033
131984
  const compiledExpression = this.compileExpression(prefix, target, condition.expression, deps);
132034
131985
  const compiledTarget = this.modelPathInstance(target);
132035
131986
  const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(deps.map(x => ({
132036
- path: x.asDependencyModelPath(),
132037
- isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x),
132038
- pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
132039
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
132040
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
131987
+ path: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x) ? x : (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isAggregationDependencyModelPath)(x) ? x.modelPath : x.path,
131988
+ isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x)
131989
+ })).filter(x => !x.path.isEquals(target)), x => x.path.toLegacyPath()));
131990
+ const compiledDeps = dependencyModelPaths.map(x => x.path.toCurrentIteration()).map(x => this.modelPathInstance(x)).join(", ");
132041
131991
  const compiledDescription = (_condition$descriptio = condition.description) !== null && _condition$descriptio !== void 0 ? _condition$descriptio : "Error Message";
132042
131992
  const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `() => "${compiledDescription}", "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
132043
131993
  return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.295.0-fs-7926-fix-groupsum.2",
3
+ "version": "4.296.0-finalerrorlogapi.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,