@kontur.candy/generator 5.54.1-crlfhash.2 → 5.55.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 +158 -69
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -67742,14 +67742,14 @@ __webpack_require__.r(__webpack_exports__);
67742
67742
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
67743
67743
  /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! util */ "util");
67744
67744
  /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_2__);
67745
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! crypto */ "crypto");
67746
- /* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_3__);
67747
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! chalk */ "./node_modules/chalk/source/index.js");
67748
- /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_4__);
67745
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! chalk */ "./node_modules/chalk/source/index.js");
67746
+ /* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_3__);
67749
67747
  /* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! fs-extra */ "./node_modules/fs-extra/lib/index.js");
67750
67748
  /* harmony import */ var fs_extra__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(fs_extra__WEBPACK_IMPORTED_MODULE_10__);
67751
- /* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
67752
- /* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(md5__WEBPACK_IMPORTED_MODULE_5__);
67749
+ /* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
67750
+ /* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(md5__WEBPACK_IMPORTED_MODULE_4__);
67751
+ /* harmony import */ var md5_file__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! md5-file */ "./node_modules/md5-file/index.js");
67752
+ /* harmony import */ var md5_file__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(md5_file__WEBPACK_IMPORTED_MODULE_5__);
67753
67753
  /* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! recursive-readdir */ "./node_modules/recursive-readdir/index.js");
67754
67754
  /* harmony import */ var recursive_readdir__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(recursive_readdir__WEBPACK_IMPORTED_MODULE_6__);
67755
67755
  /* harmony import */ var _common_ExtractSugarReferences__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/ExtractSugarReferences */ "./Generator/src/common/ExtractSugarReferences.ts");
@@ -67778,7 +67778,7 @@ async function readFormSources(formSourcesPath, farmDirectory) {
67778
67778
  const sugarContent = await readSugarFiles(formSugarDirectoryPath, sugarReferences);
67779
67779
  if (sugarReferences.fetchFunctionFiles.length === 0) {
67780
67780
  // eslint-disable-next-line no-console
67781
- console.warn(chalk__WEBPACK_IMPORTED_MODULE_4___default().yellow(`[WARN] Форма не содержит ссылок на fetch-функции. Будут автоматически подключены функции из каталога legacyfetchfuctions\n` + `[WARN] В будущем необходимо явно прописывать ссылки на используемые fetch-функции`));
67781
+ console.warn(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`[WARN] Форма не содержит ссылок на fetch-функции. Будут автоматически подключены функции из каталога legacyfetchfuctions\n` + `[WARN] В будущем необходимо явно прописывать ссылки на используемые fetch-функции`));
67782
67782
  const legacyfetchfunctionsDirectory = (await (0,fs_extra__WEBPACK_IMPORTED_MODULE_10__.pathExists)(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "legacyfetchfunctions"))) ? path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "legacyfetchfunctions") : path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "candy.farm", "legacyfetchfunctions");
67783
67783
  sugarReferences.fetchFunctionFiles = (await readdirAsync(legacyfetchfunctionsDirectory)).map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(legacyfetchfunctionsDirectory, x));
67784
67784
  }
@@ -67884,24 +67884,20 @@ async function getAllDependencies(formSourcesPath, farmDirectory) {
67884
67884
  }
67885
67885
  return [path__WEBPACK_IMPORTED_MODULE_1___default().join(formSugarDirectoryPath, "index.sugar.xml"), ...sugarReferences.fetchFunctionFiles.map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSugarDirectoryPath, x)), ...sugarReferences.sugarFiles.map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSugarDirectoryPath, x + ".sugar.xml")), ...sugarReferences.resourceFiles.map(x => path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSugarDirectoryPath, x)), ...(await checkFileExists(path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSourcesPath, "settings.json"))), ...(await checkFileExists(path__WEBPACK_IMPORTED_MODULE_1___default().resolve(formSourcesPath, "hooks.js"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "autocalc"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "helpers"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "converters"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "mergers"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "jsHelpers"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "xsltTemplates"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "validations"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "schemas"))), ...(await checkFileExists(path__WEBPACK_IMPORTED_MODULE_1___default().join(farmDirectory, "tour", "tour.js"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "controls"))), ...(await getAllFilePathsInDirectory(path__WEBPACK_IMPORTED_MODULE_1___default().join(formSourcesPath, "localization")))];
67886
67886
  }
67887
- async function getAllDependenciesHash(formSourcesPath, farmDirectory) {
67888
- const allDeps = await getAllDependencies(formSourcesPath, farmDirectory);
67889
- const hashes = await Promise.all(allDeps.map(async depFilePath => hashFile(depFilePath)));
67890
- console.log("hashes", hashes);
67891
- console.log("md5(hashes.join())", md5__WEBPACK_IMPORTED_MODULE_5___default()(hashes.join()));
67892
- return md5__WEBPACK_IMPORTED_MODULE_5___default()(hashes.join());
67893
- }
67894
67887
  function normalizeLineEndings(content) {
67895
- return content.replace(/\r/gi, "");
67888
+ return content.replace(/\r\n/gi, "\n").replace(/\n\r/gi, "\n");
67896
67889
  }
67897
- async function hashFile(filePath) {
67898
- const fileBuffer = await readFileAsync(filePath, "utf-8");
67899
- const clearedCRLF = normalizeLineEndings(fileBuffer);
67900
- const hashBuffer = (0,crypto__WEBPACK_IMPORTED_MODULE_3__.createHash)("sha256");
67901
- hashBuffer.update(clearedCRLF);
67902
- const a = hashBuffer.digest("hex");
67903
- console.log(filePath, a);
67904
- return a;
67890
+ async function getAllDependenciesHash(formSourcesPath, farmDirectory) {
67891
+ const allDeps = await getAllDependencies(formSourcesPath, farmDirectory);
67892
+ const hashes = await Promise.all(allDeps.map(async depFilePath => {
67893
+ if ([".js", ".xml", ".xslt", ".json"].some(ext => depFilePath.endsWith(ext))) {
67894
+ let content = await readFileAsync(depFilePath, "utf-8");
67895
+ content = normalizeLineEndings(content);
67896
+ return md5__WEBPACK_IMPORTED_MODULE_4___default()(content);
67897
+ }
67898
+ return md5_file__WEBPACK_IMPORTED_MODULE_5___default()(depFilePath);
67899
+ }));
67900
+ return md5__WEBPACK_IMPORTED_MODULE_4___default()(hashes.join(""));
67905
67901
  }
67906
67902
  async function readSugarFiles(formSugarDirectoryPath, references) {
67907
67903
  const result = {
@@ -67964,7 +67960,7 @@ async function readAdditionalNormalizersFiles(rootPath) {
67964
67960
  return normalizerFiles;
67965
67961
  } catch (error) {
67966
67962
  // eslint-disable-next-line no-console
67967
- console.warn(chalk__WEBPACK_IMPORTED_MODULE_4___default().yellow(`Error while reading normalizers at ${rootPath}`, error));
67963
+ console.warn(chalk__WEBPACK_IMPORTED_MODULE_3___default().yellow(`Error while reading normalizers at ${rootPath}`, error));
67968
67964
  return [];
67969
67965
  }
67970
67966
  }
@@ -68707,6 +68703,7 @@ __webpack_require__.r(__webpack_exports__);
68707
68703
  /* harmony export */ LenExpression: () => (/* binding */ LenExpression),
68708
68704
  /* harmony export */ LogicalExpression: () => (/* binding */ LogicalExpression),
68709
68705
  /* harmony export */ LtExpression: () => (/* binding */ LtExpression),
68706
+ /* harmony export */ MakeHashSetFromDictExpression: () => (/* binding */ MakeHashSetFromDictExpression),
68710
68707
  /* harmony export */ MinusBinaryExpression: () => (/* binding */ MinusBinaryExpression),
68711
68708
  /* harmony export */ MinusUnaryExpression: () => (/* binding */ MinusUnaryExpression),
68712
68709
  /* harmony export */ MultiplicativeBinaryExpression: () => (/* binding */ MultiplicativeBinaryExpression),
@@ -69780,6 +69777,26 @@ class HashSetExpression extends FLangExpression {
69780
69777
  return `hashSet(${(_this$expression$conv = (_this$expression = this.expression) === null || _this$expression === void 0 ? void 0 : _this$expression.convertToString()) !== null && _this$expression$conv !== void 0 ? _this$expression$conv : ""})`;
69781
69778
  }
69782
69779
  }
69780
+ class MakeHashSetFromDictExpression extends FLangExpression {
69781
+ constructor(expression) {
69782
+ super();
69783
+ this.expression = void 0;
69784
+ this.expression = expression;
69785
+ }
69786
+ getType() {
69787
+ return BuildInTypeExpression.hashSet;
69788
+ }
69789
+ *getChildNodes() {
69790
+ if (this.expression != undefined) {
69791
+ yield this.expression;
69792
+ }
69793
+ return [];
69794
+ }
69795
+ convertToString() {
69796
+ var _this$expression$conv2, _this$expression2;
69797
+ return `makeHashSetFromDict(${(_this$expression$conv2 = (_this$expression2 = this.expression) === null || _this$expression2 === void 0 ? void 0 : _this$expression2.convertToString()) !== null && _this$expression$conv2 !== void 0 ? _this$expression$conv2 : ""})`;
69798
+ }
69799
+ }
69783
69800
  class AddArrayExpression extends FLangExpression {
69784
69801
  constructor(argumentReference, expression) {
69785
69802
  super();
@@ -70635,24 +70652,7 @@ class FormulaExpressionToFlangExpressionConverter {
70635
70652
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.FirstOrDefaultExpression(firstOrDefaultExpression);
70636
70653
  }
70637
70654
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaHashSetExpression) {
70638
- if (expression.expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
70639
- const adjustedSelectPath = this.preparePathAndAdjustMultiplicity(prefix, expression.expression.select);
70640
- const splitInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, adjustedSelectPath);
70641
- const diffSelectPath = splitInfo.differentPath;
70642
- const hasMultiplicity = diffSelectPath.getIterationRank() > 0;
70643
- if (hasMultiplicity) {
70644
- const sourceKeyParts = adjustedSelectPath.getPathPartsAsArray();
70645
- const firstPart = splitInfo.matchedPath.toCurrentIteration();
70646
- const firstPartLength = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.count(firstPart.getPathParts());
70647
- const secondPartParts = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createRelativeFromTokens)(sourceKeyParts.slice(firstPartLength)).getPathPartsAsArray();
70648
- const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
70649
- const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
70650
- const finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
70651
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.hashSet, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.hashSet)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AddArrayExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentReferenceExpression("result"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(adjustedSelectPath.toCurrentIteration(), "value")))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression());
70652
- }
70653
- }
70654
- const hashSetExpression = this.compileExpressionToFlangExpressionInternal(expression.expression, prefix, target, addPrecalculationRule);
70655
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression(hashSetExpression);
70655
+ return this.compileHashSetExpression(prefix, target, expression, addPrecalculationRule);
70656
70656
  }
70657
70657
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaGetPicklistValuesExpression) {
70658
70658
  const filterColumn = this.compileExpressionToFlangExpressionInternal(expression.filterColumn.filterColumn, prefix, target, addPrecalculationRule);
@@ -70715,6 +70715,36 @@ class FormulaExpressionToFlangExpressionConverter {
70715
70715
  }
70716
70716
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.EqExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.castOperandToStringIfNeed)(left), (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.castOperandToStringIfNeed)(right));
70717
70717
  }
70718
+ compileHashSetExpression(prefix, target, expression, addPrecalculationRule) {
70719
+ if (expression.expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
70720
+ const adjustedSelectPath = this.preparePathAndAdjustMultiplicity(prefix, expression.expression.select);
70721
+ const splitInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, adjustedSelectPath);
70722
+ const diffSelectPath = splitInfo.differentPath;
70723
+ const hasMultiplicity = diffSelectPath.getIterationRank() > 0;
70724
+ if (hasMultiplicity) {
70725
+ if (this.options.enableGroupSumAutoConversion) {
70726
+ const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.expression.select);
70727
+ const sourceValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression(1);
70728
+ const dictPathWithField = this.makeDictNameFromKeyAndValue(splitInfo.matchedPath, sourceKeyPath, sourceValueExpression);
70729
+ const dictExpression = this.compileMakeDictExpressionImpl(prefix, dictPathWithField, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70730
+ const dictStatement = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(dictPathWithField.path, "value"), dictExpression);
70731
+ addPrecalculationRule(dictStatement);
70732
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.MakeHashSetFromDictExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DictLiteralExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(dictPathWithField.path.toCurrentIteration(), "value")));
70733
+ } else {
70734
+ const sourceKeyParts = adjustedSelectPath.getPathPartsAsArray();
70735
+ const firstPart = splitInfo.matchedPath.toCurrentIteration();
70736
+ const firstPartLength = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.count(firstPart.getPathParts());
70737
+ const secondPartParts = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createRelativeFromTokens)(sourceKeyParts.slice(firstPartLength)).getPathPartsAsArray();
70738
+ const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
70739
+ const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
70740
+ const finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
70741
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.hashSet, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.hashSet)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AddArrayExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentReferenceExpression("result"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(adjustedSelectPath.toCurrentIteration(), "value")))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression());
70742
+ }
70743
+ }
70744
+ }
70745
+ const hashSetExpression = this.compileExpressionToFlangExpressionInternal(expression.expression, prefix, target, addPrecalculationRule);
70746
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression(hashSetExpression);
70747
+ }
70718
70748
  compileMakeDictExpressionImpl(prefix, target, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
70719
70749
  const getOldSourceValueExpression = () => {
70720
70750
  if (sourceValueExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression) {
@@ -70746,7 +70776,7 @@ class FormulaExpressionToFlangExpressionConverter {
70746
70776
  return reduceExpression;
70747
70777
  }
70748
70778
  compileArrayOfTargetKeys(prefix, target, targetKeys, addPrecalculationRule) {
70749
- 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_9__.DeserializeEnumerationExpression(targetKeys.items.map(i => {
70779
+ const deserializedKeys = targetKeys[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DeserializeEnumerationExpression(targetKeys.map(i => {
70750
70780
  const item = this.compileEnumerationItem(i, prefix, target, addPrecalculationRule);
70751
70781
  if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression) {
70752
70782
  return item;
@@ -70762,7 +70792,7 @@ class FormulaExpressionToFlangExpressionConverter {
70762
70792
  compileGetSumByKeysExpression(prefix, target, expression, addPrecalculationRule) {
70763
70793
  const dictPath = this.preparePathAndAdjustMultiplicity(prefix, expression.dictPath);
70764
70794
  const targetKeys = expression.targetKeys;
70765
- const deserializedKeys = this.compileArrayOfTargetKeys(prefix, target, targetKeys, addPrecalculationRule);
70795
+ const deserializedKeys = this.compileArrayOfTargetKeys(prefix, target, targetKeys.items, addPrecalculationRule);
70766
70796
  return this.compileGetSumByKeysExpressionImpl(prefix, target, dictPath, deserializedKeys, addPrecalculationRule);
70767
70797
  }
70768
70798
  compileGroupSumExpressionWithPersistentDictionary(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
@@ -70781,29 +70811,8 @@ class FormulaExpressionToFlangExpressionConverter {
70781
70811
  if (finalIterPath.isEmpty()) {
70782
70812
  throw new Error("Error occurred while trying parse path for reduce: " + firstPart.toLegacyPath());
70783
70813
  }
70784
- const extractNameFromPath = path => Iterator.from(path.getPathParts()).filter(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.isSimpleToken).toArray().join("_");
70785
- const extractNameFromExpression = (basePathForDict, expr) => {
70786
- const exprAsValueRef = expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression ? expr : expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.CastExpression && expr.targetExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression ? expr.targetExpression : undefined;
70787
- if (exprAsValueRef != undefined) {
70788
- return extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePathForDict, exprAsValueRef.modePath).differentPath);
70789
- }
70790
- const exprAsConst = expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression ? expr : expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.CastExpression && expr.targetExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression ? expr.targetExpression : undefined;
70791
- if (exprAsConst != undefined) {
70792
- if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression) {
70793
- return `constant_${exprAsConst.value}`;
70794
- }
70795
- if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.StringLiteralExpression) {
70796
- return `constant_${exprAsConst.stringValue}`;
70797
- }
70798
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name: unsupported type of constant!");
70799
- }
70800
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name!");
70801
- };
70802
70814
  const basePathForDict = finalIterPath;
70803
- const keyDiffPathText = extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePathForDict, sourceKeyPath).differentPath);
70804
- const valueDiffPathText = extractNameFromExpression(basePathForDict, sourceValueExpression);
70805
- const dictPath = basePathForDict.joinWith(`${keyDiffPathText}_${valueDiffPathText}_generated${_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.dictFieldNameSuffix}`);
70806
- const dictPathWithField = new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_7__.AbsoluteModelFieldPath(dictPath, "value");
70815
+ const dictPathWithField = this.makeDictNameFromKeyAndValue(finalIterPath, sourceKeyPath, sourceValueExpression);
70807
70816
  const basePathForDictPrefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)(Iterator.from(basePathForDict.getPathParts()).filter(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.isSimpleToken).toArray());
70808
70817
  const dictExpression = this.compileMakeDictExpressionImpl(basePathForDictPrefix, dictPathWithField, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70809
70818
  const dictStatement = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(dictPathWithField.path, "value"), dictExpression);
@@ -70812,6 +70821,33 @@ class FormulaExpressionToFlangExpressionConverter {
70812
70821
  const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.GetSumByKeysExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DictLiteralExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(dictStatement.left.modePath.toCurrentIteration(), dictStatement.left.valueName)), deserializedKeys);
70813
70822
  return finalValueExpression;
70814
70823
  }
70824
+ extractNameFromPath(path) {
70825
+ return Iterator.from(path.getPathParts()).filter(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.isSimpleToken).toArray().join("_");
70826
+ }
70827
+ extractNameFromExpression(basePath, expr) {
70828
+ const exprAsValueRef = expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression ? expr : expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.CastExpression && expr.targetExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression ? expr.targetExpression : undefined;
70829
+ if (exprAsValueRef != undefined) {
70830
+ return this.extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePath, exprAsValueRef.modePath).differentPath);
70831
+ }
70832
+ const exprAsConst = expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression ? expr : expr instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.CastExpression && expr.targetExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression ? expr.targetExpression : undefined;
70833
+ if (exprAsConst != undefined) {
70834
+ if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression) {
70835
+ return `constant_${exprAsConst.value}`;
70836
+ }
70837
+ if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.StringLiteralExpression) {
70838
+ return `constant_${exprAsConst.stringValue}`;
70839
+ }
70840
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name: unsupported type of constant!");
70841
+ }
70842
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name!");
70843
+ }
70844
+ makeDictNameFromKeyAndValue(basePathForDict, sourceKeyPath, sourceValueExpression) {
70845
+ const keyDiffPathText = this.extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePathForDict, sourceKeyPath).differentPath);
70846
+ const valueDiffPathText = this.extractNameFromExpression(basePathForDict, sourceValueExpression);
70847
+ const dictPath = basePathForDict.joinWith(`${keyDiffPathText}_${valueDiffPathText}_generated${_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.dictFieldNameSuffix}`);
70848
+ const dictPathWithField = new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_7__.AbsoluteModelFieldPath(dictPath, "value");
70849
+ return dictPathWithField;
70850
+ }
70815
70851
  compileGroupSumExpressionWithoutPersistentDictionaries(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
70816
70852
  const matchPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, sourceKeyPath);
70817
70853
  const sourceKeyParts = sourceKeyPath.getPathPartsAsArray();
@@ -70835,7 +70871,7 @@ class FormulaExpressionToFlangExpressionConverter {
70835
70871
  }
70836
70872
  const keys = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DeserializeEnumerationExpression([new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(sourceKeyPath.toCurrentIteration(), "value")], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BoolLiteralExpression(true));
70837
70873
  const reduceExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.dict, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BuildInTypeExpression.dict)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.AddSumByKeysExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ArgumentReferenceExpression("result"), keys, (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.castOperandToDecimalIfNeed)(sourceValueExpression))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DictLiteralExpression());
70838
- 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_9__.DeserializeEnumerationExpression(targetKeys.items.map(i => this.compileEnumerationItem(i, prefix, target, addPrecalculationRule)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BoolLiteralExpression(true));
70874
+ const deserializedKeys = targetKeys[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DeserializeEnumerationExpression(targetKeys.map(i => this.compileEnumerationItem(i, prefix, target, addPrecalculationRule)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.BoolLiteralExpression(true));
70839
70875
  const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.GetSumByKeysExpression(reduceExpression, deserializedKeys !== null && deserializedKeys !== void 0 ? deserializedKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)());
70840
70876
  return finalValueExpression;
70841
70877
  }
@@ -70852,12 +70888,12 @@ class FormulaExpressionToFlangExpressionConverter {
70852
70888
  const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
70853
70889
  const sourceValuePath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceValuePath);
70854
70890
  const sourceValueExpression = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.makeStringValueReference)(sourceValuePath.toCurrentIteration(), "value");
70855
- return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70891
+ return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys.items, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70856
70892
  }
70857
70893
  compileGroupCountExpression(prefix, target, expression, addPrecalculationRule) {
70858
70894
  const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
70859
70895
  const sourceValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression(1);
70860
- return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70896
+ return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys.items, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70861
70897
  }
70862
70898
  convertExpressionTypePropertyToFLangType(type) {
70863
70899
  switch (type) {
@@ -130493,6 +130529,59 @@ const forEachStep = (self, fn, node, thisp) => {
130493
130529
  module.exports = LRUCache
130494
130530
 
130495
130531
 
130532
+ /***/ }),
130533
+
130534
+ /***/ "./node_modules/md5-file/index.js":
130535
+ /*!****************************************!*\
130536
+ !*** ./node_modules/md5-file/index.js ***!
130537
+ \****************************************/
130538
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
130539
+
130540
+ const crypto = __webpack_require__(/*! crypto */ "crypto")
130541
+ const fs = __webpack_require__(/*! fs */ "fs")
130542
+
130543
+ const BUFFER_SIZE = 8192
130544
+
130545
+ function md5FileSync (path) {
130546
+ const fd = fs.openSync(path, 'r')
130547
+ const hash = crypto.createHash('md5')
130548
+ const buffer = Buffer.alloc(BUFFER_SIZE)
130549
+
130550
+ try {
130551
+ let bytesRead
130552
+
130553
+ do {
130554
+ bytesRead = fs.readSync(fd, buffer, 0, BUFFER_SIZE)
130555
+ hash.update(buffer.slice(0, bytesRead))
130556
+ } while (bytesRead === BUFFER_SIZE)
130557
+ } finally {
130558
+ fs.closeSync(fd)
130559
+ }
130560
+
130561
+ return hash.digest('hex')
130562
+ }
130563
+
130564
+ function md5File (path) {
130565
+ return new Promise((resolve, reject) => {
130566
+ const output = crypto.createHash('md5')
130567
+ const input = fs.createReadStream(path)
130568
+
130569
+ input.on('error', (err) => {
130570
+ reject(err)
130571
+ })
130572
+
130573
+ output.once('readable', () => {
130574
+ resolve(output.read().toString('hex'))
130575
+ })
130576
+
130577
+ input.pipe(output)
130578
+ })
130579
+ }
130580
+
130581
+ module.exports = md5File
130582
+ module.exports.sync = md5FileSync
130583
+
130584
+
130496
130585
  /***/ }),
130497
130586
 
130498
130587
  /***/ "./node_modules/md5/md5.js":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.54.1-crlfhash.2",
3
+ "version": "5.55.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,