@kontur.candy/generator 5.59.0-fix-attachment-error-log.0 → 5.60.0-successful-checks.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 +14 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49607,15 +49607,16 @@ class KCLangAntlrVisitor {
49607
49607
  }
49608
49608
  }
49609
49609
  visitWithBlock(ctx) {
49610
- var _ctx$withBlockValue;
49611
- const value = (_ctx$withBlockValue = ctx.withBlockValue()) === null || _ctx$withBlockValue === void 0 ? void 0 : _ctx$withBlockValue.text;
49610
+ var _ctx$withBlockValue, _ctx$withBlockValue2;
49611
+ const hasInterpolation = ((_ctx$withBlockValue = ctx.withBlockValue()) === null || _ctx$withBlockValue === void 0 ? void 0 : _ctx$withBlockValue.interpolationExpression()) != undefined;
49612
+ const value = (_ctx$withBlockValue2 = ctx.withBlockValue()) === null || _ctx$withBlockValue2 === void 0 ? void 0 : _ctx$withBlockValue2.text;
49612
49613
  if (value == undefined) {
49613
49614
  throw Error("visitWithBlock syntax incorrect");
49614
49615
  }
49615
49616
  return {
49616
49617
  type: "withBlock",
49617
49618
  name: ctx.NAME().text,
49618
- value: value.replace(/```/g, "")
49619
+ value: hasInterpolation ? value.replace(/```/g, "") : value.replace(/^'|^"|'$|"$/g, "")
49619
49620
  };
49620
49621
  }
49621
49622
  visitFormula(ctx) {
@@ -67563,7 +67564,7 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
67563
67564
  const sugarRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_SugarRulesBuilder__WEBPACK_IMPORTED_MODULE_39__.SugarRulesBuilder(sugarRoot, formSchemaRng, controlCustomizationContext, fetchFunctions, dataDeclarationHelper, typeRegistry, useSchemaValidations);
67564
67565
  const validationRulesBuilder = new _ServerSideFLangNormalization_RuleBuilders_ValidationRulesBuilder__WEBPACK_IMPORTED_MODULE_40__.ValidationRulesBuilder(sugarRoot, dataDeclarationHelper, formSchemaRng, formulaExprConverter, kcXmlConditions, typeRegistry, useSchemaValidations);
67565
67566
  const optionalSectionRuleBuilder = new _ServerSideFLangNormalization_RuleBuilders_OptionalSectionRulesBuilder__WEBPACK_IMPORTED_MODULE_33__.OptionalSectionRulesBuilder(sugarRoot, dataDeclarationHelper);
67566
- const normalizationRulesGenerator = new _ServerSideFLangNormalization_Normalizers_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng);
67567
+ const normalizationRulesGenerator = new _ServerSideFLangNormalization_Normalizers_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__.NormalizationRulesGenerator(optionalSectionRuleBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng, false);
67567
67568
  const formulaOnlyNormalizationRulesGenerator = new _ServerSideFLangNormalization_Normalizers_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__.FormulaOnlyNormalizationRuleGenerator(dataDeclarationHelper, formSchemaRng, formulas, optionalSectionRuleBuilder, formulaExprConverter, validationRulesBuilder, {
67568
67569
  enableTypedFlang: (_additionalContent$fo9 = (_additionalContent$fo10 = additionalContent.formJsonSettings) === null || _additionalContent$fo10 === void 0 ? void 0 : _additionalContent$fo10.enableTypedFlang) !== null && _additionalContent$fo9 !== void 0 ? _additionalContent$fo9 : false
67569
67570
  });
@@ -71322,14 +71323,16 @@ __webpack_require__.r(__webpack_exports__);
71322
71323
  * Базовый нормализатор для основного сценария серверной нормализации
71323
71324
  */
71324
71325
  class NormalizationRulesGenerator {
71325
- constructor(optionalSectionRulesBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng) {
71326
+ constructor(optionalSectionRulesBuilder, validationRulesBuilder, lazyLoadingRulesBuilder, sugarRulesBuilder, initializationRulesBuilder, formulaRulesBuilder, formSchemaRng, calculateServerOnlyPaths) {
71326
71327
  this.formulaRulesBuilder = void 0;
71328
+ this.calculateServerOnlyPaths = void 0;
71327
71329
  this.initializationRulesBuilder = void 0;
71328
71330
  this.sugarRulesBuilder = void 0;
71329
71331
  this.lazyLoadingRulesBuilder = void 0;
71330
71332
  this.validationRulesBuilder = void 0;
71331
71333
  this.optionalSectionRulesBuilder = void 0;
71332
71334
  this.formSchemaRng = void 0;
71335
+ this.calculateServerOnlyPaths = calculateServerOnlyPaths;
71333
71336
  this.formulaRulesBuilder = formulaRulesBuilder;
71334
71337
  this.initializationRulesBuilder = initializationRulesBuilder;
71335
71338
  this.sugarRulesBuilder = sugarRulesBuilder;
@@ -71351,11 +71354,11 @@ class NormalizationRulesGenerator {
71351
71354
  (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_1__.ensureCorrectFieldNameByExpressionType)(rule);
71352
71355
  return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_1__.wrapWithDisableValueAutoInitFlagCheckIfRequired)(this.formSchemaRng, rule);
71353
71356
  }).toArray();
71354
- const dictionaryRules = Iterator.from(allRules).filter(rule => rule instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement && (rule.right.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict || rule.right instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && rule.right.targetExpression.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict || rule.right instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullCoalesceExpression && rule.right.expression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && rule.right.expression.targetExpression.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict)).map(x => x instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement ? new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(x.left.modePath, x.left.valueName) : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined).toArray();
71357
+ const getDictionaryTargets = () => Iterator.from(allRules).filter(rule => rule instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement && (rule.right.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict || rule.right instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && rule.right.targetExpression.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict || rule.right instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullCoalesceExpression && rule.right.expression instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression && rule.right.expression.targetExpression.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.dict)).map(x => x instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SetStatement ? new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(x.left.modePath, x.left.valueName) : undefined).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined).toArray();
71355
71358
  const content = (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_1__.combineRulesWithOptionalSectionChecking)(allRules, this.optionalSectionRulesBuilder);
71356
71359
  return {
71357
71360
  content: content,
71358
- serverOnlyPaths: dictionaryRules
71361
+ serverOnlyPaths: this.calculateServerOnlyPaths ? getDictionaryTargets() : []
71359
71362
  };
71360
71363
  }
71361
71364
  }
@@ -71851,10 +71854,12 @@ class ValidationRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_1
71851
71854
  const currentExpression = (_targetCtx$path = targetCtx[path]) !== null && _targetCtx$path !== void 0 ? _targetCtx$path : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression();
71852
71855
  const validationRule = this.generateValidationText(currentExpression, current);
71853
71856
  targetCtx[path] = validationRule;
71857
+ ctx.additionalRules.push(...current.precalculationRules);
71854
71858
  return ctx;
71855
71859
  }, {
71856
71860
  errors: {},
71857
- warnings: {}
71861
+ warnings: {},
71862
+ additionalRules: []
71858
71863
  });
71859
71864
  return allRulesCheck;
71860
71865
  }
@@ -71898,6 +71903,7 @@ class ValidationRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_1
71898
71903
  const kcRules = this.buildKcValidationRules();
71899
71904
  const allErrorRules = mergeRules(kcRules.errors, sugarRules.errors);
71900
71905
  const allWarningRules = mergeRules(kcRules.warnings, sugarRules.warnings);
71906
+ yield* kcRules.additionalRules;
71901
71907
  const createRule = (rules, path, checkType) => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(path, true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each), checkType), rules[path]);
71902
71908
  const rules = Object.keys(allErrorRules).map(path => createRule(allErrorRules, path, "error")).concat(Object.keys(allWarningRules).map(path => createRule(allWarningRules, path, "warning")));
71903
71909
  for (const rule of rules) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "5.59.0-fix-attachment-error-log.0",
3
+ "version": "5.60.0-successful-checks.0",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,