@kontur.candy/generator 5.46.0-incremental-dictionaries.3 → 5.46.0-incremental-dictionaries.4

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 +85 -52
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68611,6 +68611,7 @@ __webpack_require__.r(__webpack_exports__);
68611
68611
  /* harmony export */ DifferenceInMonthsExpression: () => (/* binding */ DifferenceInMonthsExpression),
68612
68612
  /* harmony export */ DivisionBinaryExpression: () => (/* binding */ DivisionBinaryExpression),
68613
68613
  /* harmony export */ EqExpression: () => (/* binding */ EqExpression),
68614
+ /* harmony export */ ExistsExpression: () => (/* binding */ ExistsExpression),
68614
68615
  /* harmony export */ FLangBoolExpression: () => (/* binding */ FLangBoolExpression),
68615
68616
  /* harmony export */ FLangDecimalExpression: () => (/* binding */ FLangDecimalExpression),
68616
68617
  /* harmony export */ FLangDictExpression: () => (/* binding */ FLangDictExpression),
@@ -69794,7 +69795,23 @@ class ArrayExpression extends FLangExpression {
69794
69795
  }
69795
69796
  convertToString() {
69796
69797
  const items = this.items.map(x => x.convertToString()).join(", ");
69797
- return `array(${items})`;
69798
+ return `makeArray(${items})`;
69799
+ }
69800
+ }
69801
+ class ExistsExpression extends FLangExpression {
69802
+ constructor(source) {
69803
+ super();
69804
+ this.source = void 0;
69805
+ this.source = source;
69806
+ }
69807
+ getType() {
69808
+ return BuildInTypeExpression.bool;
69809
+ }
69810
+ *getChildNodes() {
69811
+ yield this.source;
69812
+ }
69813
+ convertToString() {
69814
+ return `exists(${this.source.convertToString()})`;
69798
69815
  }
69799
69816
  }
69800
69817
  class NullCoalesceExpression extends FLangExpression {
@@ -69985,9 +70002,12 @@ __webpack_require__.r(__webpack_exports__);
69985
70002
  /* harmony export */ wrapWithArgumentsCondition: () => (/* binding */ wrapWithArgumentsCondition),
69986
70003
  /* harmony export */ wrapWithDisableValueAutoInitFlagCheckIfRequired: () => (/* binding */ wrapWithDisableValueAutoInitFlagCheckIfRequired)
69987
70004
  /* harmony export */ });
69988
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
69989
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
69990
- /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
70005
+ /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! util */ "util");
70006
+ /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_0__);
70007
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
70008
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
70009
+ /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
70010
+
69991
70011
 
69992
70012
 
69993
70013
 
@@ -70001,111 +70021,114 @@ function* getAllExpressionChildren(node, descendantsFilter) {
70001
70021
  }
70002
70022
  }
70003
70023
  function createValueRuleWithDisableValueAutoInitCheck(path, originalExpression) {
70004
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(path, "value"), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ConditionalExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.EqExpression(makeStringValueReference(path.toCurrentIteration(), "disableValueAutoInit"), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("true")), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NoDepsExpression(castOperandIfNeed(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(path.toCurrentIteration(), "value"), originalExpression.getType())), originalExpression));
70024
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(path, "value"), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ConditionalExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.EqExpression(makeStringValueReference(path.toCurrentIteration(), "disableValueAutoInit"), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.StringLiteralExpression("true")), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NoDepsExpression(castOperandIfNeed(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(path.toCurrentIteration(), "value"), originalExpression.getType())), originalExpression));
70005
70025
  }
70006
70026
  function wrapWithDisableValueAutoInitFlagCheckIfRequired(formSchemaRng, x) {
70007
70027
  var _formSchemaRng$getEle;
70008
- return x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement && x.left.valueName === "value" && (_formSchemaRng$getEle = formSchemaRng.getElementByPath(x.left.modePath)) !== null && _formSchemaRng$getEle !== void 0 && _formSchemaRng$getEle.isIgnoreForcedValueSet() ? [createValueRuleWithDisableValueAutoInitCheck(x.left.modePath, x.right)] : [x];
70028
+ return x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement && x.left.valueName === "value" && (_formSchemaRng$getEle = formSchemaRng.getElementByPath(x.left.modePath)) !== null && _formSchemaRng$getEle !== void 0 && _formSchemaRng$getEle.isIgnoreForcedValueSet() ? [createValueRuleWithDisableValueAutoInitCheck(x.left.modePath, x.right)] : [x];
70009
70029
  }
70010
70030
  function wrapWithArgumentsCondition(expression) {
70011
- const childFilter = node => !(node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ReduceCallExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.GetSumByKeysExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NoDepsExpression);
70012
- const allValueRefNodes = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.concat([expression], getAllExpressionChildren(expression, childFilter)).map(x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression ? x : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.isNotNullOrUndefined);
70013
- const uniquePaths = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allValueRefNodes, x => x.convertToString());
70014
- const conditionExpression = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.reduce(uniquePaths, (acc, curr) => {
70015
- const currExpr = new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullLiteralExpression()), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("")));
70016
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, currExpr) : currExpr;
70031
+ const childFilter = node => !(node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ReduceCallExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.GetSumByKeysExpression || node instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NoDepsExpression);
70032
+ const allValueRefNodes = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.concat([expression], getAllExpressionChildren(expression, childFilter)).map(x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression ? x : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined);
70033
+ const uniquePaths = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(allValueRefNodes, x => x.convertToString());
70034
+ const conditionExpression = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.reduce(uniquePaths, (acc, curr) => {
70035
+ const currExpr = new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.AndBinaryExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NullLiteralExpression()), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NotEqExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(curr.modePath, curr.valueName), new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.StringLiteralExpression("")));
70036
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.OrBinaryExpression(acc, currExpr) : currExpr;
70017
70037
  }, undefined);
70018
70038
  if (conditionExpression == undefined) {
70019
70039
  return expression;
70020
70040
  }
70021
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ConditionalExpression(conditionExpression, expression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullLiteralExpression());
70041
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ConditionalExpression(conditionExpression, expression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NullLiteralExpression());
70022
70042
  }
70023
70043
  function combineRulesWithOptionalSectionChecking(allRules, optionalSectionRulesBuilder) {
70024
- const allUniqueRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allRules, x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement ? x.left.convertToString() : x.convertToString());
70044
+ const allUniqueRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(allRules, x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.SetStatement ? x.left.convertToString() : x.convertToString());
70025
70045
  const allUniqueRulesWithOptionalChecks = Iterator.from(optionalSectionRulesBuilder.wrapRulesWithOptionalPageCheck(allUniqueRules)).map(x => x.convertToString()).reduce((x, y) => x + (x ? "\n" : "") + y, "");
70026
70046
  return allUniqueRulesWithOptionalChecks;
70027
70047
  }
70028
70048
  function tryExtractValueReferenceAsStringFromDecimal(expression) {
70029
- if (expression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal && expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70049
+ if (expression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.decimal && expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70030
70050
  return expression.targetExpression;
70031
70051
  }
70032
70052
  return expression;
70033
70053
  }
70034
70054
  function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
70035
- if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
70036
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
70055
+ if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.DateNowExpression) {
70056
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.StringLiteralExpression("dd.MM.yyyy"));
70037
70057
  }
70038
- if (operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict || operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.array) {
70058
+ if (operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.dict || operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.array || operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.hashSet) {
70039
70059
  return operandExpression;
70040
70060
  }
70041
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.string ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.string, decimalFormat != undefined && operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression(decimalFormat) : undefined) : operandExpression;
70061
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.string ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.string, decimalFormat != undefined && operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.StringLiteralExpression(decimalFormat) : undefined) : operandExpression;
70042
70062
  }
70043
70063
  function castOperandIfNeed(operandExpression, type) {
70044
- if (type instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression) {
70045
- return operandExpression.getType() != type ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, type) : operandExpression;
70064
+ if (type instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression) {
70065
+ return operandExpression.getType() != type ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(operandExpression, type) : operandExpression;
70046
70066
  }
70047
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(`Invalid type for cast: ${type}`);
70067
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(`Invalid type for cast: ${type}`);
70048
70068
  }
70049
70069
  function castOperandToBoolIfNeed(operandExpression) {
70050
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.bool ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.bool) : operandExpression;
70070
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.bool ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.bool) : operandExpression;
70051
70071
  }
70052
70072
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
70053
- return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
70073
+ return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
70054
70074
  }
70055
70075
  const decimalWrapper = (ex, needWrapped) => needWrapped ? castOperandToDecimalIfNeed(ex) : ex;
70056
70076
  function castOperandToDateTimeIfNeed(operandExpression) {
70057
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dateTime) : operandExpression;
70077
+ return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.dateTime) : operandExpression;
70058
70078
  }
70059
70079
  function nullCoalesceWithTypeCheck(argument, replacement) {
70060
- const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null;
70080
+ const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.null;
70061
70081
  if (!isValid) {
70062
70082
  throw new Error("Couldn't build null coalesce expression: types not match");
70063
70083
  }
70064
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullCoalesceExpression(argument, replacement);
70084
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NullCoalesceExpression(argument, replacement);
70065
70085
  }
70066
70086
  function ensureOperandsOfTypeOrNull(type, ...operands) {
70067
70087
  for (const operand of operands) {
70068
70088
  const operandType = operand.getType();
70069
- if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null && operandType !== type) {
70089
+ if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.null && operandType !== type) {
70070
70090
  throw new Error(`Invalid operand type: required [${type}] but got ${operandType}`);
70071
70091
  }
70072
70092
  }
70073
70093
  }
70074
70094
  function combineByOrFlangExpr(acc, current) {
70075
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, current) : current;
70095
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.OrBinaryExpression(acc, current) : current;
70076
70096
  }
70077
70097
  function combineByAndFlangExpr(acc, current) {
70078
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(acc, current) : current;
70098
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.AndBinaryExpression(acc, current) : current;
70079
70099
  }
70080
70100
  function makeNoDeps(expression) {
70081
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70082
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NoDepsExpression(expression);
70101
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70102
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NoDepsExpression(expression);
70083
70103
  }
70084
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70085
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NoDepsExpression(expression.targetExpression), expression.targetType, expression.defaultValue);
70104
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70105
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NoDepsExpression(expression.targetExpression), expression.targetType, expression.defaultValue);
70086
70106
  }
70087
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(`Invalid NoDeps usage: argument must be native ValueReferenceExpression or wrapped to CastExpression!`);
70107
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(`Invalid NoDeps usage: argument must be native ValueReferenceExpression or wrapped to CastExpression!`);
70088
70108
  }
70089
70109
  function makeGetOld(expression) {
70090
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70091
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.GetOldExpression(expression);
70110
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70111
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.GetOldExpression(expression);
70092
70112
  }
70093
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70094
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.GetOldExpression(expression.targetExpression), expression.targetType, expression.defaultValue);
70113
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70114
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.GetOldExpression(expression.targetExpression), expression.targetType, expression.defaultValue);
70095
70115
  }
70096
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(`Invalid GetOld usage: argument must be native ValueReferenceExpression or wrapped to CastExpression!`);
70116
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(`Invalid GetOld usage: argument must be native ValueReferenceExpression or wrapped to CastExpression!`);
70097
70117
  }
70098
70118
  function makeStringValueReference(modePath, valueName) {
70099
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression(modePath, valueName), _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.string);
70119
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression(new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression(modePath, valueName), _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.BuildInTypeExpression.string);
70100
70120
  }
70101
70121
  function extractValueReferenceFromCast(expression) {
70102
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70122
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70103
70123
  return expression;
70104
70124
  }
70105
- if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ValueReferenceExpression) {
70125
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.ValueReferenceExpression) {
70106
70126
  return expression.targetExpression;
70107
70127
  }
70108
- return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__.reject)(`Cannot extract ValueReferenceExpression!`);
70128
+ if (expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_3__.NoDepsExpression) {
70129
+ return expression.targetExpression;
70130
+ }
70131
+ return (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)(`Cannot extract ValueReferenceExpression! ${(0,util__WEBPACK_IMPORTED_MODULE_0__.inspect)(expression)}`);
70109
70132
  }
70110
70133
 
70111
70134
  /***/ }),
@@ -70405,8 +70428,8 @@ class FormulaExpressionToFlangExpressionConverter {
70405
70428
  // TODO: тут необходимо учесть, что exists может смотреть на множественность
70406
70429
  // TODO: реализовать в рамках задачи https://yt.skbkontur.ru/issue/FS-7385
70407
70430
  /* eslint-enable no-warning-comments */
70408
- const arg = this.compiledArgumentExpression(prefix, target, expression.select, "string", addPrecalculationRule);
70409
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.EqExpression(arg, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.StringLiteralExpression("")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.EqExpression(arg, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.NullLiteralExpression())));
70431
+ const arg = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_9__.extractValueReferenceFromCast)(this.compiledArgumentExpression(prefix, target, expression.select, "string", addPrecalculationRule));
70432
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ExistsExpression(arg);
70410
70433
  }
70411
70434
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaWhenExpression) {
70412
70435
  const condition = this.compileExpressionToFlangExpressionInternal(expression.expressions[0], prefix, target, addPrecalculationRule);
@@ -70616,7 +70639,13 @@ class FormulaExpressionToFlangExpressionConverter {
70616
70639
  compileGetSumByKeysExpression(prefix, target, expression, addPrecalculationRule) {
70617
70640
  const dictPath = this.preparePathAndAdjustMultiplicity(prefix, expression.dictPath);
70618
70641
  const targetKeys = expression.targetKeys;
70619
- const deserializedKeys = targetKeys.items[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys.items[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DeserializeEnumerationExpression(targetKeys.items.map(i => (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_9__.extractValueReferenceFromCast)(this.compileEnumerationItem(i, prefix, target, addPrecalculationRule))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BoolLiteralExpression(true));
70642
+ const deserializedKeys = targetKeys.items[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys.items[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DeserializeEnumerationExpression(targetKeys.items.map(i => {
70643
+ const item = this.compileEnumerationItem(i, prefix, target, addPrecalculationRule);
70644
+ if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ConstExpression) {
70645
+ return item;
70646
+ }
70647
+ return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_9__.extractValueReferenceFromCast)(item);
70648
+ }), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BoolLiteralExpression(true));
70620
70649
  const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.GetSumByKeysExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DictLiteralExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ValueReferenceExpression(dictPath, "value")), deserializedKeys !== null && deserializedKeys !== void 0 ? deserializedKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)());
70621
70650
  return finalValueExpression;
70622
70651
  }
@@ -70643,7 +70672,13 @@ class FormulaExpressionToFlangExpressionConverter {
70643
70672
  }
70644
70673
  const keys = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DeserializeEnumerationExpression([new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ValueReferenceExpression(sourceKeyPath.toCurrentIteration(), "value")], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BoolLiteralExpression(true));
70645
70674
  const reduceExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ReduceCallExpression(finalIterPath, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.AnonymousFunctionDeclarationExpression(_FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BuildInTypeExpression.dict, [new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ArgumentDeclarationExpression("result", _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BuildInTypeExpression.dict)], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.AddSumByKeysExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ArgumentReferenceExpression("result"), keys, (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_9__.castOperandToDecimalIfNeed)(sourceValueExpression))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DictLiteralExpression());
70646
- const deserializedKeys = targetKeys.items[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys.items[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DeserializeEnumerationExpression(targetKeys.items.map(i => this.compileEnumerationItem(i, prefix, target, addPrecalculationRule)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BoolLiteralExpression(true));
70675
+ const deserializedKeys = targetKeys.items[0] instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression ? this.compileExpressionToFlangExpressionInternal(targetKeys.items[0], prefix, target, addPrecalculationRule) : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.DeserializeEnumerationExpression(targetKeys.items.map(i => {
70676
+ const item = this.compileEnumerationItem(i, prefix, target, addPrecalculationRule);
70677
+ if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.ConstExpression) {
70678
+ return item;
70679
+ }
70680
+ return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_9__.extractValueReferenceFromCast)(item);
70681
+ }), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.BoolLiteralExpression(true));
70647
70682
  const finalValueExpression = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_10__.GetSumByKeysExpression(reduceExpression, deserializedKeys !== null && deserializedKeys !== void 0 ? deserializedKeys : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_7__.reject)());
70648
70683
  return finalValueExpression;
70649
70684
  }
@@ -71578,11 +71613,9 @@ class ValidationRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_1
71578
71613
  const validationText = next.message.reduce((acc, item) => {
71579
71614
  if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression) {
71580
71615
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(acc, (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.castOperandToStringIfNeed)(item));
71581
- } else if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression) {
71582
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(acc, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.JoinExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DeserializeEnumerationExpression([item], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BoolLiteralExpression(true)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(", ")));
71583
- } else {
71584
- throw new Error(`Invalid WithDescription ${item.toString()}`);
71585
71616
  }
71617
+ const valueReference = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.extractValueReferenceFromCast)(item);
71618
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(acc, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.JoinExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DeserializeEnumerationExpression([valueReference], new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BoolLiteralExpression(true)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(", ")));
71586
71619
  }, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(""));
71587
71620
  const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NegateUnaryExpression(next.checkExpression), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(`["`), validationText), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(`"]`)), current);
71588
71621
  return condition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.46.0-incremental-dictionaries.3",
3
+ "version": "5.46.0-incremental-dictionaries.4",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,