@kontur.candy/generator 5.73.1 → 5.73.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 +17 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50114,9 +50114,11 @@ class KCLangAntlrVisitor {
50114
50114
  };
50115
50115
  }
50116
50116
  visitConstString(ctx) {
50117
+ const stringLiteralAsIs = ctx.STRING_LITERAL().text;
50118
+ const literalValue = stringLiteralAsIs.startsWith("'") ? stringLiteralAsIs.replace(/^\'|\'$/g, "").replace(/\\'/g, "'") : stringLiteralAsIs.replace(/^\"|\"$/g, "").replace(/\\"/g, '"');
50117
50119
  return {
50118
50120
  type: "string",
50119
- value: ctx.STRING_LITERAL().text.replace(/^\'|\'$/g, "").replace(/^\"|\"$/g, "")
50121
+ value: literalValue
50120
50122
  };
50121
50123
  }
50122
50124
  visitConstDecimal(ctx) {
@@ -60190,7 +60192,15 @@ function removeTrailingSlash(inputStr) {
60190
60192
  return inputStr;
60191
60193
  }
60192
60194
  function joinPaths(paths) {
60193
- return paths.map(removeTrailingSlash).join("/");
60195
+ let result = "";
60196
+ for (const path of paths) {
60197
+ if (path.startsWith("/")) {
60198
+ result = removeTrailingSlash(path);
60199
+ } else {
60200
+ result += (result == "" ? "" : "/") + removeTrailingSlash(path);
60201
+ }
60202
+ }
60203
+ return result;
60194
60204
  }
60195
60205
  function generateBlockKCXmlFormulas(block, parents) {
60196
60206
  const nextParents = [...parents, {
@@ -69733,7 +69743,7 @@ class KCXmlGeneratorBase {
69733
69743
  return gcf(x => x.eq, ...compiledParts);
69734
69744
  }
69735
69745
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConstExpression) {
69736
- return gcf(x => x.const, `"${expression.value}"`);
69746
+ return gcf(x => x.const, `${JSON.stringify(expression.value)}`);
69737
69747
  }
69738
69748
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGtExpression) {
69739
69749
  (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
@@ -69761,8 +69771,8 @@ class KCXmlGeneratorBase {
69761
69771
  }
69762
69772
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRegexMatchExpression) {
69763
69773
  const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
69764
- const preparedPattern = expression.pattern.replace(/"/g, '\\"').replace(/\\/g, "\\\\");
69765
- return gcf(x => x.regexMatch, compiledArgument, `"${preparedPattern}"`);
69774
+ const preparedPattern = JSON.stringify(expression.pattern);
69775
+ return gcf(x => x.regexMatch, compiledArgument, preparedPattern);
69766
69776
  }
69767
69777
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultiplyExpression) {
69768
69778
  (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
@@ -70972,7 +70982,7 @@ function getAllMatches(regexPattern, sourceString) {
70972
70982
  }
70973
70983
  function getRequisitesFromEvaluablePropValue(filter) {
70974
70984
  var _filter$match$map$fil, _filter$match, _getAllMatches$map$fi;
70975
- return [...((_filter$match$map$fil = (_filter$match = filter.match(/path([^)]+)/g)) === null || _filter$match === void 0 ? void 0 : _filter$match.map(path => path.slice(6, -1)).filter(path => path.startsWith("@clientInfo") || path.startsWith("@formsClientInfo")).map(path => `${path}.value`)) !== null && _filter$match$map$fil !== void 0 ? _filter$match$map$fil : []), ...((_getAllMatches$map$fi = getAllMatches(/getProperty\('([^']+?)'\)/g, filter).map(path => path[1]).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined).filter(path => path.startsWith("currentAccount") || path.startsWith("recipient") || (path === null || path === void 0 ? void 0 : path.startsWith("sender"))).map(path => `@formsClientInfo/${path}.value`)) !== null && _getAllMatches$map$fi !== void 0 ? _getAllMatches$map$fi : [])];
70985
+ return [...((_filter$match$map$fil = (_filter$match = filter.match(/path([^)]+)/g)) === null || _filter$match === void 0 ? void 0 : _filter$match.map(path => path.slice(6, -1)).filter(path => path.startsWith("@clientInfo") || path.startsWith("@formsClientInfo") || path.startsWith("@draftMeta")).map(path => `${path}.value`)) !== null && _filter$match$map$fil !== void 0 ? _filter$match$map$fil : []), ...((_getAllMatches$map$fi = getAllMatches(/getProperty\('([^']+?)'\)/g, filter).map(path => path[1]).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined).filter(path => path.startsWith("currentAccount") || path.startsWith("recipient") || (path === null || path === void 0 ? void 0 : path.startsWith("sender"))).map(path => `@formsClientInfo/${path}.value`)) !== null && _getAllMatches$map$fi !== void 0 ? _getAllMatches$map$fi : [])];
70976
70986
  }
70977
70987
  function getPathsFromEvaluablePropValue(evaluableProp) {
70978
70988
  const pathRegex = /(?<=path\((?:'|")).*?(?=(?:'|"))/g;
@@ -78143,6 +78153,7 @@ function naiveConvertJsConditionToKCLangCondition(condition) {
78143
78153
  applyReplacements([/path\('([^']*?)'\)\.length/g, "length($1)"]);
78144
78154
  applyReplacements([/path\('@formsClientInfo\/[^']*?'\)/g, "''"]);
78145
78155
  applyReplacements([/path\('@featureFlags\/([^']*?)'\)/g, "getProperty('$1')"]);
78156
+ applyReplacements([/path\('@draftMeta\/([^']*?)'\)/g, "getProperty('draftMeta/$1')"]);
78146
78157
  applyReplacements([/path\('@settings\/someSettings'\)/g, "getProperty('someSettings')"]);
78147
78158
  applyReplacements([/path\('@settings\/scenario'\)/g, "''"]);
78148
78159
  applyReplacements([/path\('@settings\/isForeign'\)/g, "'false'"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.73.1",
3
+ "version": "5.73.3",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,