@kontur.candy/generator 5.22.0-fix-sourcemaps.7 → 5.22.0-fix-sourcemaps.8
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.
- package/dist/index.js +106 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77264,6 +77264,51 @@ const formulaExpressions = [FormulaSumExpression, FormulaArgumentExpression, For
|
|
|
77264
77264
|
|
|
77265
77265
|
/***/ }),
|
|
77266
77266
|
|
|
77267
|
+
/***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts":
|
|
77268
|
+
/*!************************************************************************************************************************************!*\
|
|
77269
|
+
!*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts ***!
|
|
77270
|
+
\************************************************************************************************************************************/
|
|
77271
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
77272
|
+
|
|
77273
|
+
"use strict";
|
|
77274
|
+
__webpack_require__.r(__webpack_exports__);
|
|
77275
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77276
|
+
/* harmony export */ "splitConditionDescriptionToParts": () => (/* binding */ splitConditionDescriptionToParts)
|
|
77277
|
+
/* harmony export */ });
|
|
77278
|
+
/* harmony import */ var _Formula__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
|
|
77279
|
+
|
|
77280
|
+
function splitConditionDescriptionToParts(description) {
|
|
77281
|
+
const reg = new RegExp(/\('|'\)/g);
|
|
77282
|
+
const words = description.split(reg);
|
|
77283
|
+
const splitWords = words.map(item => {
|
|
77284
|
+
if (item.includes("{")) {
|
|
77285
|
+
const word = item.substring(1, item.length - 1);
|
|
77286
|
+
const argument = new _Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression();
|
|
77287
|
+
argument.select = word;
|
|
77288
|
+
argument.type = "string";
|
|
77289
|
+
return argument;
|
|
77290
|
+
} else {
|
|
77291
|
+
return item;
|
|
77292
|
+
}
|
|
77293
|
+
});
|
|
77294
|
+
const wordsInFormulas = splitWords.map(part => {
|
|
77295
|
+
if (part instanceof _Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression) {
|
|
77296
|
+
const formulaPart = new _Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaArgumentExpression();
|
|
77297
|
+
formulaPart.select = part.select;
|
|
77298
|
+
formulaPart.type = "string";
|
|
77299
|
+
return formulaPart;
|
|
77300
|
+
} else {
|
|
77301
|
+
const stringPart = new _Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaConstExpression();
|
|
77302
|
+
stringPart.type = "string";
|
|
77303
|
+
stringPart.value = part;
|
|
77304
|
+
return stringPart;
|
|
77305
|
+
}
|
|
77306
|
+
});
|
|
77307
|
+
return wordsInFormulas;
|
|
77308
|
+
}
|
|
77309
|
+
|
|
77310
|
+
/***/ }),
|
|
77311
|
+
|
|
77267
77312
|
/***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaReader.ts":
|
|
77268
77313
|
/*!************************************************************************************************************************!*\
|
|
77269
77314
|
!*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaReader.ts ***!
|
|
@@ -79517,15 +79562,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
79517
79562
|
/* harmony export */ "KCXmlValidationGenerator": () => (/* binding */ KCXmlValidationGenerator)
|
|
79518
79563
|
/* harmony export */ });
|
|
79519
79564
|
/* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
|
|
79520
|
-
/* harmony import */ var
|
|
79521
|
-
/* harmony import */ var
|
|
79565
|
+
/* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/Formula.ts");
|
|
79566
|
+
/* harmony import */ var _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../KCXmlGenerator/KCXmlGeneratorBase */ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts");
|
|
79567
|
+
/* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
|
|
79568
|
+
/* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts");
|
|
79569
|
+
|
|
79570
|
+
|
|
79522
79571
|
|
|
79523
79572
|
|
|
79524
79573
|
|
|
79525
79574
|
const emptyResult = `
|
|
79526
79575
|
export default function kcXmlValidationConfigurator ({ form, ModelPath, ValidationFunction, KCCondition }) {}
|
|
79527
79576
|
`;
|
|
79528
|
-
class KCXmlValidationGenerator extends
|
|
79577
|
+
class KCXmlValidationGenerator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.KCXmlGeneratorBase {
|
|
79529
79578
|
generate(kcXmlConditions) {
|
|
79530
79579
|
const compiledConditions = Iterator.from(kcXmlConditions).map(condition => this.compileCondition(condition)).toArray();
|
|
79531
79580
|
if (compiledConditions.length === 0) {
|
|
@@ -79544,15 +79593,23 @@ class KCXmlValidationGenerator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPA
|
|
|
79544
79593
|
const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(condition.target)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
|
|
79545
79594
|
const deps = [];
|
|
79546
79595
|
const compiledExpression = this.compileExpression(prefix, target, condition.expression, deps);
|
|
79596
|
+
const compiledDescriptionParts = (0,_AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_4__.splitConditionDescriptionToParts)((_condition$descriptio = condition.description) !== null && _condition$descriptio !== void 0 ? _condition$descriptio : "Error Message");
|
|
79597
|
+
let concatDescription;
|
|
79598
|
+
if (compiledDescriptionParts.length > 1) {
|
|
79599
|
+
concatDescription = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression();
|
|
79600
|
+
concatDescription.arguments = compiledDescriptionParts;
|
|
79601
|
+
} else {
|
|
79602
|
+
concatDescription = compiledDescriptionParts[0];
|
|
79603
|
+
}
|
|
79604
|
+
const compiledDescription = this.compileExpression(prefix, target, concatDescription, deps);
|
|
79547
79605
|
const compiledTarget = this.modelPathInstance(target);
|
|
79548
|
-
const dependencyModelPaths = Array.from(
|
|
79606
|
+
const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.distinctBy(deps.map(x => ({
|
|
79549
79607
|
path: x.asDependencyModelPath(),
|
|
79550
|
-
isIgnoreForChecks: (0,
|
|
79608
|
+
isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.isDependencyWithoutChecks)(x),
|
|
79551
79609
|
pathString: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(x.asDependencyModelPath().getPathPartsAsArray().map(token => token === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current ? "!" : token)).toLegacyPath()
|
|
79552
79610
|
})).filter(x => !x.path.isEquals(target)), x => x.pathString));
|
|
79553
79611
|
const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
|
|
79554
|
-
const
|
|
79555
|
-
const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `() => "${compiledDescription}", "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
|
|
79612
|
+
const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `(expression) => ${compiledDescription}, "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
|
|
79556
79613
|
return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
|
|
79557
79614
|
}
|
|
79558
79615
|
}
|
|
@@ -80938,6 +80995,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
80938
80995
|
/* harmony export */ "ReduceCallExpression": () => (/* binding */ ReduceCallExpression),
|
|
80939
80996
|
/* harmony export */ "ReduceMultipleCallExpression": () => (/* binding */ ReduceMultipleCallExpression),
|
|
80940
80997
|
/* harmony export */ "CastExpression": () => (/* binding */ CastExpression),
|
|
80998
|
+
/* harmony export */ "JoinExpression": () => (/* binding */ JoinExpression),
|
|
80941
80999
|
/* harmony export */ "ConstExpression": () => (/* binding */ ConstExpression),
|
|
80942
81000
|
/* harmony export */ "StringLiteralExpression": () => (/* binding */ StringLiteralExpression),
|
|
80943
81001
|
/* harmony export */ "DecimalLiteralExpression": () => (/* binding */ DecimalLiteralExpression),
|
|
@@ -81482,6 +81540,25 @@ class CastExpression extends FLangExpression {
|
|
|
81482
81540
|
return this.targetType;
|
|
81483
81541
|
}
|
|
81484
81542
|
}
|
|
81543
|
+
class JoinExpression extends FLangExpression {
|
|
81544
|
+
constructor(expression, separator) {
|
|
81545
|
+
super();
|
|
81546
|
+
this.expression = void 0;
|
|
81547
|
+
this.separator = void 0;
|
|
81548
|
+
this.expression = expression;
|
|
81549
|
+
this.separator = separator;
|
|
81550
|
+
}
|
|
81551
|
+
getType() {
|
|
81552
|
+
return BuildInTypeExpression.string;
|
|
81553
|
+
}
|
|
81554
|
+
*getChildNodes() {
|
|
81555
|
+
yield this.expression;
|
|
81556
|
+
yield this.separator;
|
|
81557
|
+
}
|
|
81558
|
+
convertToString() {
|
|
81559
|
+
return `join(${this.expression.convertToString()}, ${this.separator.convertToString()})`;
|
|
81560
|
+
}
|
|
81561
|
+
}
|
|
81485
81562
|
class ConstExpression extends FLangExpression {
|
|
81486
81563
|
getChildNodes() {
|
|
81487
81564
|
return [];
|
|
@@ -83451,8 +83528,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
83451
83528
|
/* harmony import */ var _Common_ModelPath_EachCurrentCollision__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../../Common/ModelPath/EachCurrentCollision */ "./Common/ModelPath/EachCurrentCollision.ts");
|
|
83452
83529
|
/* harmony import */ var _DataSchema_DataSchemaUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../DataSchema/DataSchemaUtils */ "./Generator/src/generators/DataSchema/DataSchemaUtils.ts");
|
|
83453
83530
|
/* harmony import */ var _FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../FLang/FlangUtils */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FlangUtils.ts");
|
|
83454
|
-
/* harmony import */ var
|
|
83455
|
-
/* harmony import */ var
|
|
83531
|
+
/* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts");
|
|
83532
|
+
/* harmony import */ var _NodeTypeInfoHelper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../NodeTypeInfoHelper */ "./Generator/src/generators/ServerSideFLangNormalization/NodeTypeInfoHelper.ts");
|
|
83533
|
+
/* harmony import */ var _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../../../Common/ModelPath/AbsoluteModelFieldPath */ "./Common/ModelPath/AbsoluteModelFieldPath.ts");
|
|
83534
|
+
|
|
83456
83535
|
|
|
83457
83536
|
|
|
83458
83537
|
|
|
@@ -83491,8 +83570,8 @@ class ValidationRulesBuilder {
|
|
|
83491
83570
|
const precalculationRules = [];
|
|
83492
83571
|
return {
|
|
83493
83572
|
target: fullTarget,
|
|
83494
|
-
checkExpression: this.formulaExprConverter.compileExpressionToFlangExpression(condition.expression, prefix, new
|
|
83495
|
-
message: condition.description,
|
|
83573
|
+
checkExpression: this.formulaExprConverter.compileExpressionToFlangExpression(condition.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_11__.AbsoluteModelFieldPath(fullTarget, condition.errorLevel === "Error" ? "error" : "warning"), x => precalculationRules.push(x)),
|
|
83574
|
+
message: (0,_AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_9__.splitConditionDescriptionToParts)(condition.description).map(item => this.formulaExprConverter.compileExpressionToFlangExpression(item, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_11__.AbsoluteModelFieldPath(fullTarget, condition.errorLevel === "Error" ? "error" : "warning"), x => precalculationRules.push(x))),
|
|
83496
83575
|
errorLevel: condition.errorLevel,
|
|
83497
83576
|
precalculationRules: precalculationRules
|
|
83498
83577
|
};
|
|
@@ -83503,8 +83582,8 @@ class ValidationRulesBuilder {
|
|
|
83503
83582
|
const path = current.target.toLegacyPath();
|
|
83504
83583
|
const targetCtx = current.errorLevel === "Warning" ? ctx.warnings : ctx.errors;
|
|
83505
83584
|
const currentExpression = (_targetCtx$path = targetCtx[path]) !== null && _targetCtx$path !== void 0 ? _targetCtx$path : new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullLiteralExpression();
|
|
83506
|
-
const
|
|
83507
|
-
targetCtx[path] =
|
|
83585
|
+
const validationRule = this.generateValidationText(currentExpression, current);
|
|
83586
|
+
targetCtx[path] = validationRule;
|
|
83508
83587
|
return ctx;
|
|
83509
83588
|
}, {
|
|
83510
83589
|
errors: {},
|
|
@@ -83512,9 +83591,22 @@ class ValidationRulesBuilder {
|
|
|
83512
83591
|
});
|
|
83513
83592
|
return allRulesCheck;
|
|
83514
83593
|
}
|
|
83594
|
+
generateValidationText(current, next) {
|
|
83595
|
+
const validationText = next.message.reduce((acc, item) => {
|
|
83596
|
+
if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression) {
|
|
83597
|
+
return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ConcatStringsExpression(acc, (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_8__.castOperandToStringIfNeed)(item));
|
|
83598
|
+
} else if (item instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression) {
|
|
83599
|
+
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(", ")));
|
|
83600
|
+
} else {
|
|
83601
|
+
throw new Error(`Invalid WithDescription ${item.toString()}`);
|
|
83602
|
+
}
|
|
83603
|
+
}, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(""));
|
|
83604
|
+
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);
|
|
83605
|
+
return condition;
|
|
83606
|
+
}
|
|
83515
83607
|
*buildSugarValidationRules() {
|
|
83516
83608
|
const converter = new _markupGenerator_ElementProcessors_FormParts_Form_FormConverter__WEBPACK_IMPORTED_MODULE_2__.FormConverter(this.sugarRoot);
|
|
83517
|
-
const context = new _FLangValidationBuildContext__WEBPACK_IMPORTED_MODULE_3__.FLangValidationBuildContext(this.formSchemaRng, this.formulaExprConverter, new
|
|
83609
|
+
const context = new _FLangValidationBuildContext__WEBPACK_IMPORTED_MODULE_3__.FLangValidationBuildContext(this.formSchemaRng, this.formulaExprConverter, new _NodeTypeInfoHelper__WEBPACK_IMPORTED_MODULE_10__.NodeTypeInfoHelper(this.formSchemaRng, this.typesRegistry, this.useSchemaValidations));
|
|
83518
83610
|
const sugarRules = Iterator.from(converter.buildFLangValidations(context, this.formSchemaRng)).reduce((ctx, current) => {
|
|
83519
83611
|
const statement = current.statement;
|
|
83520
83612
|
if (!(statement instanceof _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement)) {
|