@kontur.candy/generator 4.278.0-efs-partial-load.11 → 4.278.0-efs-partial-load.13

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 +30 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -131940,7 +131940,7 @@ class FLangValidationBuildContext {
131940
131940
  if (parentNode instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_0__.FormSchemaRngElement) {
131941
131941
  const targetCheck = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.OrBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.EqExpression(valueReference, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.NullLiteralExpression()), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.EqExpression(valueReference, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.StringLiteralExpression("")));
131942
131942
  const allChildrenPaths = this.schemaRng.getAllChildren(parentNode).map(x => this.schemaRng.getPath(x, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.PathTokens.each)).filter(x => !(0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_11__.getMatchedAndDifferentModelPaths)(targetPath, x).differentPath.isContainIteration());
131943
- const restChecks = allChildrenPaths.map(childPath => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.EqExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.ValueReferenceExpression(childPath.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.StringLiteralExpression(""))).reduce((acc, current) => acc != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.AndBinaryExpression(acc, current) : current, undefined);
131943
+ const restChecks = allChildrenPaths.map(childPath => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.EqExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.ValueReferenceExpression(childPath.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.StringLiteralExpression(""))).reduce(_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_13__.combineByAndFlangExpr, undefined);
131944
131944
 
131945
131945
  if (restChecks != undefined) {
131946
131946
  const finalChildrenCondition = new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_12__.AndBinaryExpression(targetCheck, restChecks);
@@ -133239,7 +133239,9 @@ __webpack_require__.r(__webpack_exports__);
133239
133239
  /* harmony export */ "castOperandToBoolIfNeed": () => (/* binding */ castOperandToBoolIfNeed),
133240
133240
  /* harmony export */ "castOperandToDecimalIfNeed": () => (/* binding */ castOperandToDecimalIfNeed),
133241
133241
  /* harmony export */ "nullCoalesceWithTypeCheck": () => (/* binding */ nullCoalesceWithTypeCheck),
133242
- /* harmony export */ "ensureOperandsOfTypeOrNull": () => (/* binding */ ensureOperandsOfTypeOrNull)
133242
+ /* harmony export */ "ensureOperandsOfTypeOrNull": () => (/* binding */ ensureOperandsOfTypeOrNull),
133243
+ /* harmony export */ "combineByOrFlangExpr": () => (/* binding */ combineByOrFlangExpr),
133244
+ /* harmony export */ "combineByAndFlangExpr": () => (/* binding */ combineByAndFlangExpr)
133243
133245
  /* harmony export */ });
133244
133246
  /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
133245
133247
  /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
@@ -133312,6 +133314,12 @@ function ensureOperandsOfTypeOrNull(type, ...operands) {
133312
133314
  }
133313
133315
  }
133314
133316
  }
133317
+ function combineByOrFlangExpr(acc, current) {
133318
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, current) : current;
133319
+ }
133320
+ function combineByAndFlangExpr(acc, current) {
133321
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(acc, current) : current;
133322
+ }
133315
133323
 
133316
133324
  /***/ }),
133317
133325
 
@@ -134454,8 +134462,7 @@ class ValidationRulesBuilder {
134454
134462
  *buildSugarValidationRules() {
134455
134463
  const converter = new _markupGenerator_ElementProcessors_FormParts_Form_FormConverter__WEBPACK_IMPORTED_MODULE_2__.FormConverter(this.sugarRoot);
134456
134464
  const context = new _FLangValidationBuildContext__WEBPACK_IMPORTED_MODULE_3__.FLangValidationBuildContext(this.typesRegistry, this.formSchemaRng, this.useSchemaValidations, this.formulaExprConverter);
134457
- const kcRules = this.buildKcValidationRules();
134458
- const allRules = Iterator.from(converter.buildFLangValidations(context, this.formSchemaRng)).reduce((ctx, current) => {
134465
+ const sugarRules = Iterator.from(converter.buildFLangValidations(context, this.formSchemaRng)).reduce((ctx, current) => {
134459
134466
  const statement = current.statement;
134460
134467
 
134461
134468
  if (!(statement instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement)) {
@@ -134464,15 +134471,30 @@ class ValidationRulesBuilder {
134464
134471
 
134465
134472
  const targetCtx = current.checkType === "warning" ? ctx.warnings : ctx.errors;
134466
134473
  const path = statement.left.modePath.toLegacyPath();
134467
- const existing = targetCtx[path];
134468
- const expression = existing != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NotEqExpression(statement.right, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression()), statement.right, existing) : statement.right;
134474
+ const currentExpression = targetCtx[path];
134475
+ const expression = currentExpression != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NotEqExpression(statement.right, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression()), statement.right, currentExpression) : statement.right;
134469
134476
  targetCtx[path] = expression;
134470
134477
  return ctx;
134471
- }, kcRules);
134478
+ }, {
134479
+ errors: {},
134480
+ warnings: {}
134481
+ });
134482
+
134483
+ const mergeRules = (left, right) => Object.entries(right).reduce((ctx, [path, expr]) => {
134484
+ const current = ctx[path];
134485
+ const nextExpr = current != undefined ? new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NotEqExpression(expr, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression()), expr, current) : expr;
134486
+ ctx[path] = nextExpr;
134487
+ return ctx;
134488
+ }, { ...left
134489
+ });
134490
+
134491
+ const kcRules = this.buildKcValidationRules();
134492
+ const allErrorRules = mergeRules(kcRules.errors, sugarRules.errors);
134493
+ const allWarningRules = mergeRules(kcRules.warnings, sugarRules.warnings);
134472
134494
 
134473
134495
  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]);
134474
134496
 
134475
- const rules = Object.keys(allRules.errors).map(path => createRule(allRules.errors, path, "error")).concat(Object.keys(allRules.warnings).map(path => createRule(allRules.warnings, path, "warning")));
134497
+ const rules = Object.keys(allErrorRules).map(path => createRule(allErrorRules, path, "error")).concat(Object.keys(allWarningRules).map(path => createRule(allWarningRules, path, "warning")));
134476
134498
 
134477
134499
  for (const rule of rules) {
134478
134500
  yield rule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontur.candy/generator",
3
- "version": "4.278.0-efs-partial-load.11",
3
+ "version": "4.278.0-efs-partial-load.13",
4
4
  "description": "Candy forms generator",
5
5
  "author": "SKBKontur Candy Team",
6
6
  "private": false,