@kontur.candy/generator 5.54.1-crlfhash.1 → 5.55.0-onprem.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 -65
  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,20 +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
+ function normalizeLineEndings(content) {
67888
+ return content.replace(/\r\n/gi, "\n").replace(/\n\r/gi, "\n");
67889
+ }
67887
67890
  async function getAllDependenciesHash(formSourcesPath, farmDirectory) {
67888
67891
  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
- function hashFile(filePath) {
67895
- const fileBuffer = fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(filePath);
67896
- const hashBuffer = (0,crypto__WEBPACK_IMPORTED_MODULE_3__.createHash)("sha256");
67897
- hashBuffer.update(fileBuffer);
67898
- const a = hashBuffer.digest("hex");
67899
- console.log(filePath, a);
67900
- return a;
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(""));
67901
67901
  }
67902
67902
  async function readSugarFiles(formSugarDirectoryPath, references) {
67903
67903
  const result = {
@@ -67960,7 +67960,7 @@ async function readAdditionalNormalizersFiles(rootPath) {
67960
67960
  return normalizerFiles;
67961
67961
  } catch (error) {
67962
67962
  // eslint-disable-next-line no-console
67963
- 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));
67964
67964
  return [];
67965
67965
  }
67966
67966
  }
@@ -68703,6 +68703,7 @@ __webpack_require__.r(__webpack_exports__);
68703
68703
  /* harmony export */ LenExpression: () => (/* binding */ LenExpression),
68704
68704
  /* harmony export */ LogicalExpression: () => (/* binding */ LogicalExpression),
68705
68705
  /* harmony export */ LtExpression: () => (/* binding */ LtExpression),
68706
+ /* harmony export */ MakeHashSetFromDictExpression: () => (/* binding */ MakeHashSetFromDictExpression),
68706
68707
  /* harmony export */ MinusBinaryExpression: () => (/* binding */ MinusBinaryExpression),
68707
68708
  /* harmony export */ MinusUnaryExpression: () => (/* binding */ MinusUnaryExpression),
68708
68709
  /* harmony export */ MultiplicativeBinaryExpression: () => (/* binding */ MultiplicativeBinaryExpression),
@@ -69776,6 +69777,26 @@ class HashSetExpression extends FLangExpression {
69776
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 : ""})`;
69777
69778
  }
69778
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
+ }
69779
69800
  class AddArrayExpression extends FLangExpression {
69780
69801
  constructor(argumentReference, expression) {
69781
69802
  super();
@@ -70631,24 +70652,7 @@ class FormulaExpressionToFlangExpressionConverter {
70631
70652
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.FirstOrDefaultExpression(firstOrDefaultExpression);
70632
70653
  }
70633
70654
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaHashSetExpression) {
70634
- if (expression.expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
70635
- const adjustedSelectPath = this.preparePathAndAdjustMultiplicity(prefix, expression.expression.select);
70636
- const splitInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, adjustedSelectPath);
70637
- const diffSelectPath = splitInfo.differentPath;
70638
- const hasMultiplicity = diffSelectPath.getIterationRank() > 0;
70639
- if (hasMultiplicity) {
70640
- const sourceKeyParts = adjustedSelectPath.getPathPartsAsArray();
70641
- const firstPart = splitInfo.matchedPath.toCurrentIteration();
70642
- const firstPartLength = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.count(firstPart.getPathParts());
70643
- const secondPartParts = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createRelativeFromTokens)(sourceKeyParts.slice(firstPartLength)).getPathPartsAsArray();
70644
- const lastStarIndexSecondPart = secondPartParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each);
70645
- const secondPartFinalParts = secondPartParts.slice(0, lastStarIndexSecondPart);
70646
- const finalIterPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createAbsoluteFromTokens)([...firstPart.getPathParts(), ...secondPartFinalParts]).trimLastStarIfLastToken();
70647
- 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());
70648
- }
70649
- }
70650
- const hashSetExpression = this.compileExpressionToFlangExpressionInternal(expression.expression, prefix, target, addPrecalculationRule);
70651
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.HashSetExpression(hashSetExpression);
70655
+ return this.compileHashSetExpression(prefix, target, expression, addPrecalculationRule);
70652
70656
  }
70653
70657
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaGetPicklistValuesExpression) {
70654
70658
  const filterColumn = this.compileExpressionToFlangExpressionInternal(expression.filterColumn.filterColumn, prefix, target, addPrecalculationRule);
@@ -70711,6 +70715,36 @@ class FormulaExpressionToFlangExpressionConverter {
70711
70715
  }
70712
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));
70713
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
+ }
70714
70748
  compileMakeDictExpressionImpl(prefix, target, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
70715
70749
  const getOldSourceValueExpression = () => {
70716
70750
  if (sourceValueExpression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression) {
@@ -70742,7 +70776,7 @@ class FormulaExpressionToFlangExpressionConverter {
70742
70776
  return reduceExpression;
70743
70777
  }
70744
70778
  compileArrayOfTargetKeys(prefix, target, targetKeys, addPrecalculationRule) {
70745
- 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 => {
70746
70780
  const item = this.compileEnumerationItem(i, prefix, target, addPrecalculationRule);
70747
70781
  if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ConstExpression) {
70748
70782
  return item;
@@ -70758,7 +70792,7 @@ class FormulaExpressionToFlangExpressionConverter {
70758
70792
  compileGetSumByKeysExpression(prefix, target, expression, addPrecalculationRule) {
70759
70793
  const dictPath = this.preparePathAndAdjustMultiplicity(prefix, expression.dictPath);
70760
70794
  const targetKeys = expression.targetKeys;
70761
- const deserializedKeys = this.compileArrayOfTargetKeys(prefix, target, targetKeys, addPrecalculationRule);
70795
+ const deserializedKeys = this.compileArrayOfTargetKeys(prefix, target, targetKeys.items, addPrecalculationRule);
70762
70796
  return this.compileGetSumByKeysExpressionImpl(prefix, target, dictPath, deserializedKeys, addPrecalculationRule);
70763
70797
  }
70764
70798
  compileGroupSumExpressionWithPersistentDictionary(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
@@ -70777,29 +70811,8 @@ class FormulaExpressionToFlangExpressionConverter {
70777
70811
  if (finalIterPath.isEmpty()) {
70778
70812
  throw new Error("Error occurred while trying parse path for reduce: " + firstPart.toLegacyPath());
70779
70813
  }
70780
- const extractNameFromPath = path => Iterator.from(path.getPathParts()).filter(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.isSimpleToken).toArray().join("_");
70781
- const extractNameFromExpression = (basePathForDict, expr) => {
70782
- 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;
70783
- if (exprAsValueRef != undefined) {
70784
- return extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePathForDict, exprAsValueRef.modePath).differentPath);
70785
- }
70786
- 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;
70787
- if (exprAsConst != undefined) {
70788
- if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression) {
70789
- return `constant_${exprAsConst.value}`;
70790
- }
70791
- if (exprAsConst instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.StringLiteralExpression) {
70792
- return `constant_${exprAsConst.stringValue}`;
70793
- }
70794
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name: unsupported type of constant!");
70795
- }
70796
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.reject)("Can't convert sourceValueExpression for generated dictionary name!");
70797
- };
70798
70814
  const basePathForDict = finalIterPath;
70799
- const keyDiffPathText = extractNameFromPath((0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(basePathForDict, sourceKeyPath).differentPath);
70800
- const valueDiffPathText = extractNameFromExpression(basePathForDict, sourceValueExpression);
70801
- const dictPath = basePathForDict.joinWith(`${keyDiffPathText}_${valueDiffPathText}_generated${_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.dictFieldNameSuffix}`);
70802
- const dictPathWithField = new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_7__.AbsoluteModelFieldPath(dictPath, "value");
70815
+ const dictPathWithField = this.makeDictNameFromKeyAndValue(finalIterPath, sourceKeyPath, sourceValueExpression);
70803
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());
70804
70817
  const dictExpression = this.compileMakeDictExpressionImpl(basePathForDictPrefix, dictPathWithField, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70805
70818
  const dictStatement = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.ValueReferenceExpression(dictPathWithField.path, "value"), dictExpression);
@@ -70808,6 +70821,33 @@ class FormulaExpressionToFlangExpressionConverter {
70808
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);
70809
70822
  return finalValueExpression;
70810
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
+ }
70811
70851
  compileGroupSumExpressionWithoutPersistentDictionaries(prefix, target, targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule) {
70812
70852
  const matchPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_5__.getMatchedAndDifferentModelPaths)(target.path, sourceKeyPath);
70813
70853
  const sourceKeyParts = sourceKeyPath.getPathPartsAsArray();
@@ -70831,7 +70871,7 @@ class FormulaExpressionToFlangExpressionConverter {
70831
70871
  }
70832
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));
70833
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());
70834
- 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));
70835
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)());
70836
70876
  return finalValueExpression;
70837
70877
  }
@@ -70848,12 +70888,12 @@ class FormulaExpressionToFlangExpressionConverter {
70848
70888
  const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
70849
70889
  const sourceValuePath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceValuePath);
70850
70890
  const sourceValueExpression = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.makeStringValueReference)(sourceValuePath.toCurrentIteration(), "value");
70851
- return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70891
+ return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys.items, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70852
70892
  }
70853
70893
  compileGroupCountExpression(prefix, target, expression, addPrecalculationRule) {
70854
70894
  const sourceKeyPath = this.preparePathAndAdjustMultiplicity(prefix, expression.sourceKeyPath);
70855
70895
  const sourceValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_9__.DecimalLiteralExpression(1);
70856
- return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70896
+ return this.compileGroupSumExpressionWithCustomValueExpression(prefix, target, expression.targetKeys.items, sourceKeyPath, sourceValueExpression, addPrecalculationRule);
70857
70897
  }
70858
70898
  convertExpressionTypePropertyToFLangType(type) {
70859
70899
  switch (type) {
@@ -130489,6 +130529,59 @@ const forEachStep = (self, fn, node, thisp) => {
130489
130529
  module.exports = LRUCache
130490
130530
 
130491
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
+
130492
130585
  /***/ }),
130493
130586
 
130494
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.1",
3
+ "version": "5.55.0-onprem.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,