@kontur.candy/generator 5.27.0-fix-decimal-fields.0 → 5.27.0-fix-error-count.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 +6 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -77750,13 +77750,6 @@ class DataDeclarationGenerationContext {
77750
77750
  }
77751
77751
  return undefined;
77752
77752
  }
77753
- addTypeNode(node) {
77754
- var _this$formSchemaRng$g;
77755
- const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
77756
- return baseType ? {
77757
- type: baseType
77758
- } : {};
77759
- }
77760
77753
  processChildrenDataDeclaration(children, nodeProcessor) {
77761
77754
  const childrenDataDeclaration = [];
77762
77755
  for (const child of children) {
@@ -77795,7 +77788,7 @@ class DataDeclarationGenerationContext {
77795
77788
  declEntry[fieldName] = option;
77796
77789
  }
77797
77790
  return {
77798
- [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default()(declEntry, this.addTypeNode(sugarNode))
77791
+ [(0,_markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__.getResolvedBindingPath)(sugarNode)]: declEntry
77799
77792
  };
77800
77793
  }
77801
77794
  addSpecialFieldsEntry(node, {
@@ -80944,8 +80937,7 @@ class FLangValidationBuildContext {
80944
80937
  }
80945
80938
  const valueEqlAutoValueErrorLevel = (_ref5 = (_typeNode$children$fi4 = typeNode === null || typeNode === void 0 ? void 0 : (_typeNode$children11 = typeNode.children) === null || _typeNode$children11 === void 0 ? void 0 : (_typeNode$children11$ = _typeNode$children11.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ofType)(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_12__.ValueEqlAutoValueTypeCheck))) === null || _typeNode$children11$ === void 0 ? void 0 : _typeNode$children11$.level) !== null && _typeNode$children$fi4 !== void 0 ? _typeNode$children$fi4 : typeNode === null || typeNode === void 0 ? void 0 : (_typeNode$children12 = typeNode.children) === null || _typeNode$children12 === void 0 ? void 0 : (_typeNode$children12$ = _typeNode$children12.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_0__.ValueEqlAutoValueTypeCheckNode))) === null || _typeNode$children12$ === void 0 ? void 0 : _typeNode$children12$.level) !== null && _ref5 !== void 0 ? _ref5 : schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.valueEqlAutoValue;
80946
80939
  if (valueEqlAutoValueErrorLevel != undefined) {
80947
- const isDecimal = (schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType) === "decimal";
80948
- const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_13__.decimalWrapper)(valueReference, isDecimal), (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_13__.decimalWrapper)(autoValueReference, isDecimal)));
80940
+ const condition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.NegateUnaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_14__.IsEqualsBinaryExpression(valueReference, autoValueReference));
80949
80941
  yield {
80950
80942
  condition: condition,
80951
80943
  message: makeMessage({
@@ -82391,7 +82383,6 @@ __webpack_require__.r(__webpack_exports__);
82391
82383
  /* harmony export */ combineByAndFlangExpr: () => (/* binding */ combineByAndFlangExpr),
82392
82384
  /* harmony export */ combineByOrFlangExpr: () => (/* binding */ combineByOrFlangExpr),
82393
82385
  /* harmony export */ combineRulesWithOptionalSectionChecking: () => (/* binding */ combineRulesWithOptionalSectionChecking),
82394
- /* harmony export */ decimalWrapper: () => (/* binding */ decimalWrapper),
82395
82386
  /* harmony export */ ensureOperandsOfTypeOrNull: () => (/* binding */ ensureOperandsOfTypeOrNull),
82396
82387
  /* harmony export */ getAllExpressionChildren: () => (/* binding */ getAllExpressionChildren),
82397
82388
  /* harmony export */ nullCoalesceWithTypeCheck: () => (/* binding */ nullCoalesceWithTypeCheck),
@@ -82437,7 +82428,7 @@ function tryExtractValueReferenceAsStringFromDecimal(expression) {
82437
82428
  }
82438
82429
  return expression;
82439
82430
  }
82440
- function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82431
+ function castOperandToStringIfNeed(operandExpression, decimalFormat) {
82441
82432
  if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82442
82433
  return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82443
82434
  }
@@ -82452,7 +82443,6 @@ function castOperandToBoolIfNeed(operandExpression) {
82452
82443
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82453
82444
  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;
82454
82445
  }
82455
- const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82456
82446
  function castOperandToDateTimeIfNeed(operandExpression) {
82457
82447
  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;
82458
82448
  }
@@ -83358,7 +83348,6 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83358
83348
  }
83359
83349
  }
83360
83350
  buildFormulaFlashRule(formula) {
83361
- var _this$formSchemaRng$g;
83362
83351
  const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.match.replace(/\@/g, ""), true).normalize();
83363
83352
  const target = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(formula.target.replace(/\@/g, ""), false);
83364
83353
  const fullTarget = (0,_DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_2__.adjustPathMultiplicityComplex)(prefix.joinWith(target).normalize(), this.formSchemaRng, this.dataDeclarationHelper);
@@ -83366,11 +83355,10 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83366
83355
  const precalculationRules = [];
83367
83356
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83368
83357
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83369
- const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83370
83358
  const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, targetField), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression(defaultValue));
83371
83359
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83372
83360
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83373
- const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;
83361
+ const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget) : undefined;
83374
83362
  const result = [autoValueRule, autoFlagRule, valueRule].concat(...precalculationRules).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined);
83375
83363
  return result;
83376
83364
  }
@@ -83380,8 +83368,8 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83380
83368
  createRegularValueRule(fullTarget, getFormulaExpression) {
83381
83369
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
83382
83370
  }
83383
- createAutoFlagRule(fullTarget, isDecimal) {
83384
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("false"))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.decimalWrapper)(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), isDecimal), (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_3__.decimalWrapper)(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue"), isDecimal)), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.BuildInTypeExpression.string), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"))));
83371
+ createAutoFlagRule(fullTarget) {
83372
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.StringLiteralExpression("false"))), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.BuildInTypeExpression.string), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NoDepsExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoFlag"))));
83385
83373
  }
83386
83374
  createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) {
83387
83375
  return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.27.0-fix-decimal-fields.0",
3
+ "version": "5.27.0-fix-error-count.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,