@kontur.candy/generator 5.30.0-calc2-args-changed.2 → 5.30.0-fixpartialprint.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 +929 -1006
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75350,6 +75350,85 @@ function validateAutoCalculationsAst(ast) {
75350
75350
 
75351
75351
  /***/ }),
75352
75352
 
75353
+ /***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts":
75354
+ /*!*********************************************************************************************************************************************!*\
75355
+ !*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts ***!
75356
+ \*********************************************************************************************************************************************/
75357
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
75358
+
75359
+ "use strict";
75360
+ __webpack_require__.r(__webpack_exports__);
75361
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
75362
+ /* harmony export */ AutoCalculationsCalculator2Generator: () => (/* binding */ AutoCalculationsCalculator2Generator)
75363
+ /* harmony export */ });
75364
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
75365
+ /* harmony import */ var _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../KCXmlGenerator/KCXmlGeneratorBase */ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts");
75366
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
75367
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../../Common/Errors */ "./Common/Errors.ts");
75368
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
75369
+
75370
+
75371
+
75372
+
75373
+
75374
+ class AutoCalculationsCalculator2Generator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.KCXmlGeneratorBase {
75375
+ constructor(schema, dataDeclarationHelper) {
75376
+ super(schema);
75377
+ this.dataDeclarationHelper = void 0;
75378
+ this.dataDeclarationHelper = dataDeclarationHelper;
75379
+ }
75380
+ generate(formulas, options) {
75381
+ var _ref;
75382
+ const compiledFormulas = (_ref = formulas !== null && formulas !== void 0 ? formulas : []) === null || _ref === void 0 ? void 0 : _ref.map(x => this.compileFormula(x, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_4__.isNotNullOrUndefined);
75383
+ const compiledAggregationFunctions = this.compileAggregationDependencies(compiledFormulas.map(x => x.dependencies).flat());
75384
+ const indent = " ";
75385
+ const allItemsText = compiledFormulas.map(x => x.compiledFunction).concat(compiledAggregationFunctions).map(x => `${indent}form.calculator2.addCalculationFunction(${x});`).join("\n");
75386
+ const finalText = allItemsText.length > 0 ? `\n${allItemsText}\n` : "";
75387
+ const result = `export default function kcXmlAutoCalculationConfigurator (
75388
+ { form, ap, CalculationFunction , KCCalculation, KCSumCalculation, KCCountCalculation, PathTokens }) {${finalText}}`;
75389
+ return result;
75390
+ }
75391
+ compileAllItemsIsEmptyCheckBlock(innerExpression, deps) {
75392
+ if (deps.length === 0) {
75393
+ return innerExpression;
75394
+ }
75395
+ const compiledArgumentsCondition = deps.map(x => x.toLegacyPath()).map(x => `(expression.argument("${x}") === "" || expression.argument("${x}") == undefined)`).join(" && ");
75396
+ const compiledBlock = `(${compiledArgumentsCondition} ? undefined : ${innerExpression})`;
75397
+ return compiledBlock;
75398
+ }
75399
+ compileFormula(formula, options) {
75400
+ const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(formula.match), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
75401
+ const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(formula.target), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
75402
+ const dependencies = [];
75403
+ const compiledExpression = this.compileExpressionWithUnsupportedHandled(prefix, target, formula.expression, dependencies);
75404
+ if (compiledExpression instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_3__.NotSupportedError) {
75405
+ if (options.skipNotSupportedFunction) {
75406
+ return undefined;
75407
+ } else {
75408
+ throw compiledExpression;
75409
+ }
75410
+ }
75411
+ const defaultValue = this.dataDeclarationHelper.getDefaultValue(target.toLegacyPath());
75412
+ const autoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(target.toLegacyPath());
75413
+ const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
75414
+ const compiledTarget = this.modelPathInstance(target);
75415
+ const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(dependencies.map(x => ({
75416
+ path: x.asDependencyModelPath(),
75417
+ isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_1__.isDependencyWithoutChecks)(x),
75418
+ 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()
75419
+ })).filter(x => !x.path.isEquals(target)), x => x.pathString));
75420
+ const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
75421
+ const compiledExpressionWithCheck = this.compileAllItemsIsEmptyCheckBlock(compiledExpression, dependencyModelPaths.filter(x => !x.isIgnoreForChecks).map(x => x.path));
75422
+ const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpressionWithCheck}, "${defaultValue}")`;
75423
+ return {
75424
+ compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled})`,
75425
+ dependencies: dependencies
75426
+ };
75427
+ }
75428
+ }
75429
+
75430
+ /***/ }),
75431
+
75353
75432
  /***/ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/FormulaProcessing/DataPath.ts":
75354
75433
  /*!***********************************************************************************************************************!*\
75355
75434
  !*** ./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/FormulaProcessing/DataPath.ts ***!
@@ -77603,825 +77682,108 @@ function getObjectPropertyName(property) {
77603
77682
 
77604
77683
  /***/ }),
77605
77684
 
77606
- /***/ "./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts":
77685
+ /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts":
77607
77686
  /*!***********************************************************************************************!*\
77608
- !*** ./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts ***!
77687
+ !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts ***!
77609
77688
  \***********************************************************************************************/
77610
77689
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77611
77690
 
77612
77691
  "use strict";
77613
77692
  __webpack_require__.r(__webpack_exports__);
77614
77693
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77615
- /* harmony export */ AutoCalculationsCalculator2Generator: () => (/* binding */ AutoCalculationsCalculator2Generator)
77694
+ /* harmony export */ DataDeclarationGenerationContext: () => (/* binding */ DataDeclarationGenerationContext),
77695
+ /* harmony export */ emptyDataDeclarationCollection: () => (/* binding */ emptyDataDeclarationCollection)
77616
77696
  /* harmony export */ });
77617
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77618
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
77619
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
77620
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77621
- /* harmony import */ var _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./FormulaToCalculator2FunctionConverter */ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts");
77622
-
77623
-
77624
-
77625
-
77697
+ /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash.mergewith */ "./node_modules/lodash.mergewith/index.js");
77698
+ /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__);
77699
+ /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.uniqwith */ "./node_modules/lodash.uniqwith/index.js");
77700
+ /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__);
77701
+ /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
77702
+ /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
77703
+ /* harmony import */ var _Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/CommonConstants/SectionNames */ "./Common/CommonConstants/SectionNames.ts");
77704
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77705
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77706
+ /* harmony import */ var _markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
77707
+ /* harmony import */ var _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/ElementProcessors/FormParts/Page/PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
77708
+ /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
77626
77709
 
77627
- class AutoCalculationsCalculator2Generator {
77628
- constructor(schema, dataDeclarationHelper) {
77629
- this.dataDeclarationHelper = void 0;
77630
- this.schema = void 0;
77631
- this.converter = void 0;
77632
- this.schema = schema;
77633
- this.dataDeclarationHelper = dataDeclarationHelper;
77634
- this.converter = new _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.FormulaToCalculator2FunctionConverter(schema);
77635
- }
77636
- generate(formulas, options) {
77637
- var _ref;
77638
- const compiledFormulas = (_ref = formulas !== null && formulas !== void 0 ? formulas : []) === null || _ref === void 0 ? void 0 : _ref.map(x => this.compileFormula(x, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrUndefined);
77639
- const compiledAggregationFunctions = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.compileAggregationDependencies)(compiledFormulas.map(x => x.dependencies).flat());
77640
- const indent = " ";
77641
- const allItemsText = compiledFormulas.map(x => x.compiledFunction).concat(compiledAggregationFunctions).map(x => `${indent}form.calculator2.addCalculationFunction(${x});`).join("\n");
77642
- const finalText = allItemsText.length > 0 ? `\n${allItemsText}\n` : "";
77643
- const result = `export default function kcXmlAutoCalculationConfigurator (
77644
- { form, ap, CalculationFunction , KCCalculation, KCSumCalculation, KCCountCalculation, PathTokens }) {${finalText}}`;
77645
- return result;
77646
- }
77647
- compileFormula(formula, options) {
77648
- const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.removeAttributePrefix)(formula.match), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
77649
- const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.removeAttributePrefix)(formula.target), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77650
- const compileResult = this.converter.compileExpressionWithUnsupportedHandled(prefix, target, formula.expression);
77651
- if (compileResult instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.NotSupportedError) {
77652
- if (options.skipNotSupportedFunction) {
77653
- return undefined;
77654
- } else {
77655
- throw compileResult;
77656
- }
77657
- }
77658
- const {
77659
- body: compiledExpression,
77660
- deps: dependencies
77661
- } = compileResult;
77662
- const defaultValue = this.dataDeclarationHelper.getDefaultValue(target.toLegacyPath());
77663
- const autoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(target.toLegacyPath());
77664
- const disabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(target.toLegacyPath());
77665
- const compiledTarget = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.modelPathInstance)(target);
77666
- const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_1__.IterUtils.distinctBy(dependencies.map(x => ({
77667
- path: x.asDependencyModelPath(),
77668
- isIgnoreForChecks: (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.isDependencyWithoutChecks)(x),
77669
- 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()
77670
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
77671
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_4__.modelPathInstance)(x)).join(", ");
77672
- const compiledDelegate = `context => KCCalculation.execute(context, expression => ${compiledExpression}, "${defaultValue}")`;
77673
- return {
77674
- compiledFunction: `new CalculationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate}, ${autoField}, ${disabled})`,
77675
- dependencies: dependencies
77676
- };
77677
- }
77678
- }
77679
77710
 
77680
- /***/ }),
77681
77711
 
77682
- /***/ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts":
77683
- /*!************************************************************************************************!*\
77684
- !*** ./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts ***!
77685
- \************************************************************************************************/
77686
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77687
77712
 
77688
- "use strict";
77689
- __webpack_require__.r(__webpack_exports__);
77690
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77691
- /* harmony export */ AggregationDependencyModelPath: () => (/* binding */ AggregationDependencyModelPath),
77692
- /* harmony export */ DependencyWithoutChecks: () => (/* binding */ DependencyWithoutChecks),
77693
- /* harmony export */ FormulaToCalculator2FunctionConverter: () => (/* binding */ FormulaToCalculator2FunctionConverter),
77694
- /* harmony export */ RegularDependency: () => (/* binding */ RegularDependency),
77695
- /* harmony export */ compileAggregationDependencies: () => (/* binding */ compileAggregationDependencies),
77696
- /* harmony export */ createDependency: () => (/* binding */ createDependency),
77697
- /* harmony export */ getAggregationPaths: () => (/* binding */ getAggregationPaths),
77698
- /* harmony export */ getAggregationPathsRecursively: () => (/* binding */ getAggregationPathsRecursively),
77699
- /* harmony export */ getArgumentDeps: () => (/* binding */ getArgumentDeps),
77700
- /* harmony export */ getCompiledFuncWithArgs: () => (/* binding */ getCompiledFuncWithArgs),
77701
- /* harmony export */ getRuntimeFunctionName: () => (/* binding */ getRuntimeFunctionName),
77702
- /* harmony export */ isAggregationDependencyModelPath: () => (/* binding */ isAggregationDependencyModelPath),
77703
- /* harmony export */ isDependencyWithoutChecks: () => (/* binding */ isDependencyWithoutChecks),
77704
- /* harmony export */ modelPathInstance: () => (/* binding */ modelPathInstance),
77705
- /* harmony export */ removeAttributePrefix: () => (/* binding */ removeAttributePrefix),
77706
- /* harmony export */ removeMultiplicity: () => (/* binding */ removeMultiplicity)
77707
- /* harmony export */ });
77708
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
77709
- /* 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");
77710
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
77711
- /* harmony import */ var _markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/ComponentMarkupBuilder/PathHelper */ "./Generator/src/generators/markupGenerator/ComponentMarkupBuilder/PathHelper.ts");
77712
- /* harmony import */ var _Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/PathSplitHelper */ "./Common/ModelPath/PathSplitHelper.ts");
77713
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
77714
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
77715
77713
 
77716
77714
 
77717
77715
 
77718
77716
 
77719
77717
 
77720
77718
 
77719
+ var RequisiteSectionMode = /*#__PURE__*/function (RequisiteSectionMode) {
77720
+ RequisiteSectionMode[RequisiteSectionMode["AsRequisiteAttribute"] = 0] = "AsRequisiteAttribute";
77721
+ RequisiteSectionMode[RequisiteSectionMode["ForceAdd"] = 1] = "ForceAdd";
77722
+ RequisiteSectionMode[RequisiteSectionMode["ForceSkip"] = 2] = "ForceSkip";
77723
+ return RequisiteSectionMode;
77724
+ }(RequisiteSectionMode || {});
77725
+ const emptyDataDeclarationCollection = {};
77726
+ class DataDeclarationGenerationContext {
77727
+ constructor(initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
77728
+ this.initSequenceFactory = void 0;
77729
+ this.formSchemaRng = void 0;
77730
+ this.schemeValidations = void 0;
77731
+ this.controlCustomizationContext = void 0;
77732
+ this.typesRegistry = void 0;
77733
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
77734
+ this.declarationCustomizer = (objValue, srcValue, key) => {
77735
+ // Вся эта функция не типизируется
77736
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
77737
+ if (key === "section") {
77738
+ const result = lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default()([].concat(...(objValue !== null && objValue !== void 0 ? objValue : []), ...srcValue), (a, b) => {
77739
+ if (typeof a === "object" && typeof b === "object") {
77740
+ // @ts-ignore см. выше.
77741
+ return a.fn === b.fn;
77742
+ }
77743
+ return a === b;
77744
+ });
77721
77745
 
77722
- class RegularDependency {
77723
- constructor(currentDependencyPath, eachDependencyPath) {
77724
- this.currentDependencyPath = void 0;
77725
- this.eachDependencyPath = void 0;
77726
- this.eachDependencyPath = eachDependencyPath;
77727
- this.currentDependencyPath = currentDependencyPath;
77728
- }
77729
- asDependencyModelPath() {
77730
- const currentPart = this.currentDependencyPath.toCurrentIteration();
77731
- return this.eachDependencyPath != undefined ? currentPart.joinWith(this.eachDependencyPath) : currentPart;
77732
- }
77733
- }
77734
- class AggregationDependencyModelPath {
77735
- constructor(type, modelPath, prefixModelPath, restModelPath) {
77736
- this.type = void 0;
77737
- this.modelPath = void 0;
77738
- this.prefixModelPath = void 0;
77739
- this.restModelPath = void 0;
77740
- this.type = type;
77741
- this.modelPath = modelPath;
77742
- this.prefixModelPath = prefixModelPath;
77743
- this.restModelPath = restModelPath;
77744
- }
77745
- asDependencyModelPath() {
77746
- return this.modelPath.toCurrentIteration();
77746
+ // @ts-ignore см. выше.
77747
+ if (result[0].fn) {
77748
+ return result;
77749
+ }
77750
+ return [result];
77751
+ }
77752
+ /* eslint-enable @typescript-eslint/no-unsafe-argument */
77753
+ return undefined;
77754
+ };
77755
+ this.formSchemaRng = formSchemaRng;
77756
+ this.schemeValidations = schemeValidations;
77757
+ this.initSequenceFactory = initSequenceFactory;
77758
+ this.controlCustomizationContext = controlCustomizationContext;
77759
+ this.typesRegistry = typesRegistry;
77747
77760
  }
77748
- }
77749
- class DependencyWithoutChecks extends RegularDependency {}
77750
- function isAggregationDependencyModelPath(path) {
77751
- return path instanceof AggregationDependencyModelPath;
77752
- }
77753
- function isDependencyWithoutChecks(path) {
77754
- return path instanceof DependencyWithoutChecks;
77755
- }
77756
- function getArgumentDeps(targetFullPath, selectFullPath, aggregationType) {
77757
- const pathDiffInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetFullPath, selectFullPath);
77758
- const restPath = pathDiffInfo.differentPath;
77759
- return !restPath.isContainIteration() ? new RegularDependency(selectFullPath) : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
77760
- }
77761
- function getRuntimeFunctionName(functionSelector) {
77762
- return (0,_markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__.extractPath)(functionSelector.toString());
77763
- }
77764
- function getCompiledFuncWithArgs(functionSelector, args) {
77765
- const funcName = getRuntimeFunctionName(functionSelector);
77766
- const funcParams = args.join(", ");
77767
- return `expression.${funcName}(${funcParams})`;
77768
- }
77769
- function getAggregationPathsRecursively(currentParts, restParts) {
77770
- if (restParts.length === 0) {
77771
- return [];
77761
+ isMultipleNodeOptionalFromScheme(path) {
77762
+ if (!this.schemeValidations) {
77763
+ return undefined;
77764
+ }
77765
+ const schemaNode = this.formSchemaRng.getElementByPath(path);
77766
+ if (schemaNode instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__.FormSchemaRngElement) {
77767
+ var _schemaNode$isOptiona;
77768
+ return (_schemaNode$isOptiona = schemaNode.isOptionalOrNillable()) !== null && _schemaNode$isOptiona !== void 0 ? _schemaNode$isOptiona : false;
77769
+ }
77770
+ return undefined;
77772
77771
  }
77773
- const firstRestItem = restParts[1];
77774
- const nextRestParts = restParts.slice(2);
77775
- const nextCurrentParts = [...currentParts, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each, firstRestItem];
77776
- const restWithoutMultiple = nextRestParts.filter(x => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x));
77777
- const result = {
77778
- aggregationPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...currentParts, firstRestItem, ...restWithoutMultiple),
77779
- targetPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...nextCurrentParts, ...restWithoutMultiple),
77780
- isTargetFinal: restWithoutMultiple.length === 0
77781
- };
77782
- const nextResults = getAggregationPathsRecursively(nextCurrentParts, nextRestParts);
77783
- return [result, ...nextResults];
77784
- }
77785
-
77786
- // Example: Root/B/*/C/D/*/E = Root/B/C/D/E/Sum -> Root/B/*/C/D/E/Sum -> Root/B/*/C/D/*/E
77787
- function getAggregationPaths(relativePath) {
77788
- const splittedPath = [...relativePath.splitByMultiplicity()];
77789
- return getAggregationPathsRecursively([splittedPath[0]], splittedPath.slice(1));
77790
- }
77791
- function createDependency(prefixModelPath, x, aggregationType) {
77792
- return {
77793
- aggPath: prefixModelPath.joinWith(x.aggregationPath).joinWith(aggregationType),
77794
- type: aggregationType,
77795
- dependencyPath: x.isTargetFinal ? prefixModelPath.joinWith(x.targetPath) : prefixModelPath.joinWith(x.targetPath).joinWith(aggregationType),
77796
- isDependencyAggregation: !x.isTargetFinal
77797
- };
77798
- }
77799
- function compileAggregationDependencies(dependencies) {
77800
- const resultItems = dependencies.filter(isAggregationDependencyModelPath).map(dep => getAggregationPaths(dep.restModelPath).map(x => {
77801
- switch (dep.type) {
77802
- case "Sum":
77803
- return [createDependency(dep.prefixModelPath, x, "Sum"), createDependency(dep.prefixModelPath, x, "Count")];
77804
- case "Count":
77805
- return [createDependency(dep.prefixModelPath, x, "Count")];
77806
- default:
77807
- {
77808
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureNever)(dep.type);
77809
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Not supported aggregation dependency: ${dep.type}`);
77810
- }
77811
- }
77812
- })).flat(2);
77813
- const distinctiveItems = Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__.IterUtils.distinctBy(resultItems, x => x.aggPath.toLegacyPath()));
77814
- const sumCompiledFunctions = distinctiveItems.map(x => {
77815
- const compiledDep = modelPathInstance(x.dependencyPath.toCurrentIteration());
77816
- const compiledAggPath = modelPathInstance(x.aggPath);
77817
- const compiledCountPath = modelPathInstance(x.aggPath.getParentPath().joinWith("Count").toCurrentIteration());
77818
- const compiledDelegate = x.type === "Sum" ? `context => KCSumCalculation.execute(context, ${compiledAggPath},${compiledDep}, ${compiledCountPath}, "")` : x.type === "Count" ? `context => KCCountCalculation.execute(context, ${compiledAggPath}, ${compiledDep}, ${x.isDependencyAggregation}, "")` : "";
77819
- const compiledDeps = [compiledDep, ...(x.type === "Sum" ? [compiledCountPath] : [])].join(", ");
77820
- return `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
77821
- });
77822
- return [...sumCompiledFunctions];
77823
- }
77824
- function removeAttributePrefix(pathPart) {
77825
- return pathPart.replace(/\@/g, "");
77826
- }
77827
- function removeMultiplicity(path) {
77828
- return path.replace(/\/\*/g, "");
77829
- }
77830
- function modelPathInstance(target) {
77831
- return `ap([${[...target.getPathParts()].map(x => {
77832
- if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each) {
77833
- return "PathTokens.each";
77772
+ getTypeNode(node) {
77773
+ if (node.anonymousType != undefined) {
77774
+ return node.anonymousType;
77834
77775
  }
77835
- if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current) {
77836
- return "PathTokens.current";
77776
+ if (node.type != undefined) {
77777
+ return this.typesRegistry.getByName(node.type);
77837
77778
  }
77838
- return JSON.stringify(x);
77839
- }).join(", ")}])`;
77840
- }
77841
-
77842
- /*
77843
- Метод вычисляет зависимости для оператора.
77844
- Для того, чтобы калькулятор корректно реагировал на измнения необходимо сделать корректные зависимости:
77845
- 1) Если исходная множественность и множественность по которой строится группа совпадают, то необходио
77846
- для последней звёздочки построить зависимость не через PathTokens.current, а через PathTokens.each,
77847
- т.к. в таком случае пересчёт groupSum/groupCount должен тригетрися при изменении любого элемента в множественности, а не только текущего.
77848
- 2) Если множественности не совпадают, то количество звёздочек (getIterationRank()) в общей части будет разным и ничего дополнительно делать не нужно,
77849
- в зависимостях в CalculationFunction в данном случае все звёздочки превратятся в PathTokens.current.
77850
- */
77851
- function calculatedGroupSumDependencyForSourcePath(targetKeyPath, sourcePath) {
77852
- const diffPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetKeyPath, sourcePath);
77853
- if (targetKeyPath.getIterationRank() > diffPaths.matchedPath.getIterationRank()) {
77854
- return {
77855
- currentDepsPath: diffPaths.matchedPath,
77856
- eachDepsPath: diffPaths.differentPath
77857
- };
77779
+ return undefined;
77858
77780
  }
77859
- const targetPathParts = diffPaths.matchedPath.getPathPartsAsArray();
77860
- const lastStarIndex = targetPathParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
77861
- const currentDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(targetPathParts.slice(0, lastStarIndex));
77862
- let eachDepsPath;
77863
- if (lastStarIndex === -1) {
77864
- eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...diffPaths.matchedPath.getPathParts(), ...diffPaths.differentPath.getPathParts()]);
77865
- } else {
77866
- var _targetPathParts$last;
77867
- eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([(_targetPathParts$last = targetPathParts[lastStarIndex]) !== null && _targetPathParts$last !== void 0 ? _targetPathParts$last : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)("path in groupSum is incorrect. Cannot create DepsPath for " + targetPathParts.join("/")), ...targetPathParts.slice(lastStarIndex + 1), ...diffPaths.differentPath.getPathParts()]);
77868
- }
77869
- return {
77870
- currentDepsPath: currentDepsPath,
77871
- eachDepsPath: eachDepsPath
77872
- };
77873
- }
77874
- function makeResult(body, newDeps) {
77875
- return {
77876
- body: body,
77877
- deps: newDeps
77878
- };
77879
- }
77880
- function makeUnhandledResult() {
77881
- return {
77882
- body: "null",
77883
- deps: []
77884
- };
77885
- }
77886
- class FormulaToCalculator2FunctionConverter {
77887
- constructor(schema) {
77888
- this.schema = void 0;
77889
- this.schema = schema;
77890
- }
77891
- compileExpressionWithUnsupportedHandled(prefix, targetFullPath, expression) {
77892
- try {
77893
- return this.compile(prefix, targetFullPath, expression);
77894
- } catch (e) {
77895
- if (e instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
77896
- return e;
77897
- }
77898
- throw e;
77899
- }
77900
- }
77901
- getAdjustedNormalizedPath(prefix, path) {
77902
- const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(removeMultiplicity(removeAttributePrefix(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77903
- return modelPath;
77904
- }
77905
- getModelPath(prefix, path) {
77906
- return this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(removeAttributePrefix(removeMultiplicity(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
77907
- }
77908
- compile(prefix, targetFullPath, expression) {
77909
- const result = this.compileExpression(prefix, targetFullPath, expression);
77910
- return result;
77911
- }
77912
-
77913
- /* eslint-disable @typescript-eslint/unbound-method */
77914
- compileExpression(prefix, targetFullPath, expression) {
77915
- const gcf = (selector, ...args) => getCompiledFuncWithArgs(selector, args);
77916
- const getCompiledArgs = expressions => {
77917
- const compiledExpressions = expressions.map(arg => this.compileExpression(prefix, targetFullPath, arg));
77918
- const compiledArgs = compiledExpressions.map(x => x.body);
77919
- const compiledJoinedArgs = compiledArgs.join(",");
77920
- const allDeps = compiledExpressions.map(x => x.deps).flat();
77921
- return {
77922
- compiledArgs: compiledArgs,
77923
- compiledJoinedArgs: compiledJoinedArgs,
77924
- allDeps: allDeps
77925
- };
77926
- };
77927
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArgumentExpression || expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultySumExpression) {
77928
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77929
- const argumentDependency = getArgumentDeps(targetFullPath, modelPath, "Sum");
77930
- const finalPath = argumentDependency.asDependencyModelPath();
77931
- return makeResult(gcf(x => x.argument, `"${finalPath.toLegacyPath()}"`), [argumentDependency]);
77932
- }
77933
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
77934
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77935
- return makeResult(gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77936
- }
77937
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsSnilsExpression) {
77938
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77939
- return makeResult(gcf(x => x.isSnils, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77940
- }
77941
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsInnExpression) {
77942
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77943
- return makeResult(gcf(x => x.isInn, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77944
- }
77945
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidMirCardNumberExpression) {
77946
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77947
- return makeResult(gcf(x => x.isValidMirCardNumber, `"${modelPath.toLegacyPath()}"`), [new RegularDependency(modelPath)]);
77948
- }
77949
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidAccountNumberExpression) {
77950
- const bikPath = this.getAdjustedNormalizedPath(prefix, expression.bik);
77951
- const accountPath = this.getAdjustedNormalizedPath(prefix, expression.account);
77952
- return makeResult(gcf(x => x.isValidAccountNumber, `"${bikPath.toLegacyPath()}"`, `"${accountPath.toLegacyPath()}"`), [new RegularDependency(bikPath), new RegularDependency(accountPath)]);
77953
- }
77954
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaCountExpression) {
77955
- var _expression$withNullO;
77956
- const modelPath = this.getAdjustedNormalizedPath(prefix, expression.select);
77957
- let finalPath = modelPath;
77958
- const deps = [];
77959
- if (targetFullPath.isContainIteration()) {
77960
- const argumentDependency = getArgumentDeps(targetFullPath, modelPath, "Count");
77961
- deps.push(argumentDependency);
77962
- finalPath = argumentDependency.asDependencyModelPath();
77963
- } else {
77964
- deps.push(new RegularDependency(modelPath));
77965
- }
77966
- return makeResult(gcf(x => x.count, `"${finalPath.toLegacyPath()}"`, `"${(_expression$withNullO = expression.withNullOrEmptyValues) !== null && _expression$withNullO !== void 0 ? _expression$withNullO : false}"`), deps);
77967
- }
77968
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaWhenExpression) {
77969
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.expressions, 2);
77970
- const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.expressions[0]);
77971
- const compiledBody = this.compileExpression(prefix, targetFullPath, expression.expressions[1]);
77972
- return makeResult(gcf(x => x.when, compiledCondition.body, `() => ${compiledBody.body}`), [...compiledCondition.deps, ...compiledBody.deps]);
77973
- }
77974
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOrExpression) {
77975
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
77976
- const {
77977
- compiledJoinedArgs,
77978
- allDeps
77979
- } = getCompiledArgs(expression.arguments);
77980
- return makeResult(gcf(x => x.or, `[${compiledJoinedArgs}]`), allDeps);
77981
- }
77982
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAndExpression) {
77983
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
77984
- const {
77985
- compiledJoinedArgs,
77986
- allDeps
77987
- } = getCompiledArgs(expression.arguments);
77988
- return makeResult(gcf(x => x.and, `[${compiledJoinedArgs}]`), allDeps);
77989
- }
77990
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNotExpression) {
77991
- const innerExpression = this.compileExpression(prefix, targetFullPath, expression.argument);
77992
- return makeResult(gcf(x => x.not, innerExpression.body), innerExpression.deps);
77993
- }
77994
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaEqExpression) {
77995
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
77996
- const {
77997
- compiledArgs,
77998
- allDeps
77999
- } = getCompiledArgs(expression.arguments);
78000
- return makeResult(gcf(x => x.eq, ...compiledArgs), allDeps);
78001
- }
78002
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConstExpression) {
78003
- return makeResult(gcf(x => x.const, `"${expression.value}"`), []);
78004
- }
78005
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGtExpression) {
78006
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78007
- const {
78008
- compiledArgs,
78009
- allDeps
78010
- } = getCompiledArgs(expression.arguments);
78011
- return makeResult(gcf(x => x.gt, ...compiledArgs), allDeps);
78012
- }
78013
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGeExpression) {
78014
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78015
- const {
78016
- compiledArgs,
78017
- allDeps
78018
- } = getCompiledArgs(expression.arguments);
78019
- return makeResult(gcf(x => x.ge, ...compiledArgs), allDeps);
78020
- }
78021
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLtExpression) {
78022
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78023
- const {
78024
- compiledArgs,
78025
- allDeps
78026
- } = getCompiledArgs(expression.arguments);
78027
- return makeResult(gcf(x => x.lt, ...compiledArgs), allDeps);
78028
- }
78029
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLeExpression) {
78030
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78031
- const {
78032
- compiledArgs,
78033
- allDeps
78034
- } = getCompiledArgs(expression.arguments);
78035
- return makeResult(gcf(x => x.le, ...compiledArgs), allDeps);
78036
- }
78037
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLengthExpression) {
78038
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78039
- return makeResult(gcf(x => x.length, compiledArgument.body), compiledArgument.deps);
78040
- }
78041
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRegexMatchExpression) {
78042
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78043
- const preparedPattern = expression.pattern.replace(/"/g, '\\"').replace(/\\/g, "\\\\");
78044
- return makeResult(gcf(x => x.regexMatch, compiledArgument.body, `"${preparedPattern}"`), compiledArgument.deps);
78045
- }
78046
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultiplyExpression) {
78047
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78048
- const {
78049
- compiledJoinedArgs,
78050
- allDeps
78051
- } = getCompiledArgs(expression.arguments);
78052
- return makeResult(gcf(x => x.multiply, `[${compiledJoinedArgs}]`), allDeps);
78053
- }
78054
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDivisionExpression) {
78055
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78056
- const {
78057
- compiledJoinedArgs,
78058
- allDeps
78059
- } = getCompiledArgs(expression.arguments);
78060
- return makeResult(gcf(x => x.division, `[${compiledJoinedArgs}]`), allDeps);
78061
- }
78062
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
78063
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
78064
- const {
78065
- compiledJoinedArgs,
78066
- allDeps
78067
- } = getCompiledArgs(expression.arguments);
78068
- return makeResult(gcf(x => x.sum, `[${compiledJoinedArgs}]`), allDeps);
78069
- }
78070
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMinusExpression) {
78071
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78072
- return makeResult(gcf(x => x.minus, compiledArgument.body), compiledArgument.deps);
78073
- }
78074
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRoundExpression) {
78075
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78076
- return makeResult(gcf(x => x.round, compiledArgument.body, `${expression.fractionalDigits}`), compiledArgument.deps);
78077
- }
78078
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFloorExpression) {
78079
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78080
- return makeResult(gcf(x => x.floor, compiledArgument.body), compiledArgument.deps);
78081
- }
78082
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAbsExpression) {
78083
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78084
- return makeResult(gcf(x => x.abs, compiledArgument.body), compiledArgument.deps);
78085
- }
78086
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaXAbsExpression) {
78087
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78088
- return makeResult(gcf(x => x.xabs, compiledArgument.body), compiledArgument.deps);
78089
- }
78090
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaChooseExpression) {
78091
- const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.ifNode.condition);
78092
- const compiledThen = this.compileExpression(prefix, targetFullPath, expression.thenNode.expression);
78093
- const compiledElse = this.compileExpression(prefix, targetFullPath, expression.elseNode.expression);
78094
- return makeResult(gcf(x => x.choose, compiledCondition.body, `() => ${compiledThen.body}`, `() => ${compiledElse.body}`), [compiledCondition.deps, compiledThen.deps, compiledElse.deps].flat());
78095
- }
78096
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateNowExpression) {
78097
- return makeResult(gcf(x => x.dateNow), []);
78098
- }
78099
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDaysInMonthExpression) {
78100
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78101
- return makeResult(gcf(x => x.getDaysInMonth, compiledArgument.body), compiledArgument.deps);
78102
- }
78103
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDayExpression) {
78104
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78105
- return makeResult(gcf(x => x.getDay, compiledArgument.body), compiledArgument.deps);
78106
- }
78107
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetMonthExpression) {
78108
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78109
- return makeResult(gcf(x => x.getMonth, compiledArgument.body), compiledArgument.deps);
78110
- }
78111
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetYearExpression) {
78112
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78113
- return makeResult(gcf(x => x.getYear, compiledArgument.body), compiledArgument.deps);
78114
- }
78115
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsDateExpression) {
78116
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78117
- return makeResult(gcf(x => x.isDate, compiledArgument.body), compiledArgument.deps);
78118
- }
78119
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInMonthsExpression) {
78120
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78121
- const {
78122
- compiledJoinedArgs,
78123
- allDeps
78124
- } = getCompiledArgs(expression.arguments);
78125
- return makeResult(gcf(x => x.differenceInMonths, `[${compiledJoinedArgs}]`), allDeps);
78126
- }
78127
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInDaysExpression) {
78128
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
78129
- const {
78130
- compiledJoinedArgs,
78131
- allDeps
78132
- } = getCompiledArgs(expression.arguments);
78133
- return makeResult(gcf(x => x.differenceInDays, `[${compiledJoinedArgs}]`), allDeps);
78134
- }
78135
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddDaysExpression) {
78136
- const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78137
- return makeResult(gcf(x => x.addDays, `${path.body}, ${expression.amount}`), path.deps);
78138
- }
78139
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddMonthsExpression) {
78140
- const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78141
- return makeResult(gcf(x => x.addMonths, `${path.body}, ${expression.amount}`), path.deps);
78142
- }
78143
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddYearsExpression) {
78144
- const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78145
- return makeResult(gcf(x => x.addYears, `${path.body}, ${expression.amount}`), path.deps);
78146
- }
78147
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateToStringExpression) {
78148
- const path = this.compileExpression(prefix, targetFullPath, expression.expression);
78149
- return makeResult(gcf(x => x.dateToString, `${path.body}, "${!!expression.format ? expression.format : "dd.MM.yyyy"}"`), path.deps);
78150
- }
78151
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateTimeExpression) {
78152
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78153
- return makeResult(gcf(x => x.dateTime, compiledArgument.body), compiledArgument.deps);
78154
- }
78155
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSubstringExpression) {
78156
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined)(expression.expression);
78157
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression);
78158
- return makeResult(gcf(x => x.substring, `${compiledArgument.body}`, `${expression.start}`, `${expression.length}`), compiledArgument.deps);
78159
- }
78160
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
78161
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78162
- const {
78163
- compiledJoinedArgs,
78164
- allDeps
78165
- } = getCompiledArgs(expression.arguments);
78166
- return makeResult(gcf(x => x.sum, `[${compiledJoinedArgs}]`), allDeps);
78167
- }
78168
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupSumExpression) {
78169
- const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys);
78170
- const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
78171
- const sourceKeyDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
78172
- const sourceValuePath = this.getModelPath(prefix, expression.sourceValuePath);
78173
- const sourceValueDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceValuePath);
78174
- return makeResult(gcf(x => x.groupSum, `${targetKeys.body}, "${sourceKeyPath}", "${sourceValuePath}"`), [new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath), new DependencyWithoutChecks(sourceValueDeps.currentDepsPath, sourceValueDeps.eachDepsPath), ...targetKeys.deps]);
78175
- }
78176
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupCountExpression) {
78177
- const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys);
78178
- const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
78179
- const sourceKeyDeps = calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
78180
- return makeResult(gcf(x => x.groupCount, `${targetKeys.body}, "${sourceKeyPath}"`), [new DependencyWithoutChecks(targetFullPath), new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath), ...targetKeys.deps]);
78181
- }
78182
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression) {
78183
- (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
78184
- const {
78185
- compiledJoinedArgs,
78186
- allDeps
78187
- } = getCompiledArgs(expression.arguments);
78188
- return makeResult(gcf(x => x.concat, `[${compiledJoinedArgs}]`), allDeps);
78189
- }
78190
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNewLineExpression) {
78191
- return makeResult(gcf(x => x.const, `"\\r\\n"`), []);
78192
- }
78193
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOneOfExpression) {
78194
- const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument);
78195
- const {
78196
- compiledJoinedArgs,
78197
- allDeps
78198
- } = getCompiledArgs(expression.items.expressions);
78199
- return makeResult(gcf(x => x.oneOf, compiledArgument.body, `[${compiledJoinedArgs}]`), [...compiledArgument.deps, ...allDeps]);
78200
- }
78201
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
78202
- const {
78203
- compiledJoinedArgs,
78204
- allDeps
78205
- } = getCompiledArgs(expression.items);
78206
- return makeResult(`JSON.stringify([${compiledJoinedArgs}])`, allDeps);
78207
- }
78208
- // -- не работает в рантайм калькуляторе
78209
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
78210
- return makeUnhandledResult();
78211
- }
78212
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFirstOrDefaultExpression) {
78213
- return makeUnhandledResult();
78214
- }
78215
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
78216
- return makeUnhandledResult();
78217
- }
78218
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
78219
- return makeUnhandledResult();
78220
- }
78221
- if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHasAutoFlagExpression) {
78222
- return makeUnhandledResult();
78223
- }
78224
- // -----
78225
-
78226
- throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Unsupported node type: ${expression.constructor.name}`);
78227
- }
78228
- /* eslint-enable @typescript-eslint/unbound-method */
78229
- }
78230
-
78231
- /***/ }),
78232
-
78233
- /***/ "./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts":
78234
- /*!******************************************************************************************!*\
78235
- !*** ./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts ***!
78236
- \******************************************************************************************/
78237
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78238
-
78239
- "use strict";
78240
- __webpack_require__.r(__webpack_exports__);
78241
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78242
- /* harmony export */ ValidationsCalculator2Generator: () => (/* binding */ ValidationsCalculator2Generator)
78243
- /* harmony export */ });
78244
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78245
- /* 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");
78246
- /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
78247
- /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/KCXmlContract/FormulaParsingDescription.ts");
78248
- /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
78249
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78250
- /* harmony import */ var _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./FormulaToCalculator2FunctionConverter */ "./Generator/src/generators/Calculator2Generator/FormulaToCalculator2FunctionConverter.ts");
78251
-
78252
-
78253
-
78254
-
78255
-
78256
-
78257
-
78258
- const emptyResult = `
78259
- export default function kcXmlValidationConfigurator ({ form, ModelPath, ValidationFunction, KCCondition }) {}
78260
- `;
78261
- class ValidationsCalculator2Generator {
78262
- constructor(schema) {
78263
- this.converter = void 0;
78264
- this.schema = void 0;
78265
- this.schema = schema;
78266
- this.converter = new _FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.FormulaToCalculator2FunctionConverter(schema);
78267
- }
78268
- generate(kcXmlConditions, options) {
78269
- const compiledConditions = Iterator.from(kcXmlConditions).map(condition => this.compileCondition(condition, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__.isNotNullOrUndefined).toArray();
78270
- if (compiledConditions.length === 0) {
78271
- // NOTE Просто, чтоб не падали аппрувал тесты
78272
- return emptyResult;
78273
- }
78274
- const result = `export default function kcXmlValidationConfigurator ({ form, ap, ValidationFunction, KCCondition, PathTokens }) {
78275
- ${compiledConditions.map(x => `form.calculator2.addCalculationFunction(${x});`).join("\n")}
78276
- }
78277
- `;
78278
- return result;
78279
- }
78280
- compileCondition(condition, options) {
78281
- var _condition$descriptio, _condition$errorLevel;
78282
- const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeMultiplicity)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeAttributePrefix)(condition.match)), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
78283
- const target = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeMultiplicity)((0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.removeAttributePrefix)(condition.target)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
78284
- const compileResult = this.converter.compileExpressionWithUnsupportedHandled(prefix, target, condition.expression);
78285
- if (compileResult instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_4__.NotSupportedError) {
78286
- if (options.skipNotSupportedFunction) {
78287
- return undefined;
78288
- } else {
78289
- throw compileResult;
78290
- }
78291
- }
78292
- const {
78293
- body: compiledExpression,
78294
- deps
78295
- } = compileResult;
78296
- const compiledDescriptionParts = (0,_AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_FormulaParsingDescription__WEBPACK_IMPORTED_MODULE_3__.splitConditionDescriptionToParts)((_condition$descriptio = condition.description) !== null && _condition$descriptio !== void 0 ? _condition$descriptio : "Error Message");
78297
- let concatDescription;
78298
- if (compiledDescriptionParts.length > 1) {
78299
- concatDescription = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression();
78300
- concatDescription.arguments = compiledDescriptionParts;
78301
- } else {
78302
- concatDescription = compiledDescriptionParts[0];
78303
- }
78304
- const {
78305
- body: compiledDescription,
78306
- deps: descriptionDeps
78307
- } = this.converter.compile(prefix, target, concatDescription);
78308
- const allDeps = deps.concat(...descriptionDeps);
78309
- const compiledTarget = (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.modelPathInstance)(target);
78310
- const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_2__.IterUtils.distinctBy(allDeps.map(x => ({
78311
- path: x.asDependencyModelPath(),
78312
- isIgnoreForChecks: (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.isDependencyWithoutChecks)(x),
78313
- 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()
78314
- })).filter(x => !x.path.isEquals(target)), x => x.pathString));
78315
- const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => (0,_FormulaToCalculator2FunctionConverter__WEBPACK_IMPORTED_MODULE_6__.modelPathInstance)(x)).join(", ");
78316
- const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `(expression) => ${compiledDescription}, "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
78317
- return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
78318
- }
78319
- }
78320
-
78321
- /***/ }),
78322
-
78323
- /***/ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts":
78324
- /*!***********************************************************************************************!*\
78325
- !*** ./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationContext.ts ***!
78326
- \***********************************************************************************************/
78327
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78328
-
78329
- "use strict";
78330
- __webpack_require__.r(__webpack_exports__);
78331
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78332
- /* harmony export */ DataDeclarationGenerationContext: () => (/* binding */ DataDeclarationGenerationContext),
78333
- /* harmony export */ emptyDataDeclarationCollection: () => (/* binding */ emptyDataDeclarationCollection)
78334
- /* harmony export */ });
78335
- /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash.mergewith */ "./node_modules/lodash.mergewith/index.js");
78336
- /* harmony import */ var lodash_mergewith__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_mergewith__WEBPACK_IMPORTED_MODULE_0__);
78337
- /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.uniqwith */ "./node_modules/lodash.uniqwith/index.js");
78338
- /* harmony import */ var lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1__);
78339
- /* harmony import */ var _markupGenerator_AllConverters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../markupGenerator/AllConverters */ "./Generator/src/generators/markupGenerator/AllConverters.ts");
78340
- /* harmony import */ var _markupGenerator_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/Serializer/SugarSerializer */ "./Generator/src/generators/markupGenerator/Serializer/SugarSerializer.ts");
78341
- /* harmony import */ var _Common_CommonConstants_SectionNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/CommonConstants/SectionNames */ "./Common/CommonConstants/SectionNames.ts");
78342
- /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
78343
- /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
78344
- /* harmony import */ var _markupGenerator_getBindingPath__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../markupGenerator/getBindingPath */ "./Generator/src/generators/markupGenerator/getBindingPath.ts");
78345
- /* harmony import */ var _markupGenerator_ElementProcessors_FormParts_Page_PageNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../markupGenerator/ElementProcessors/FormParts/Page/PageNode */ "./Generator/src/generators/markupGenerator/ElementProcessors/FormParts/Page/PageNode.ts");
78346
- /* harmony import */ var _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../common/SchemaRng/FormSchemaRng */ "./Generator/src/common/SchemaRng/FormSchemaRng.ts");
78347
-
78348
-
78349
-
78350
-
78351
-
78352
-
78353
-
78354
-
78355
-
78356
-
78357
- var RequisiteSectionMode = /*#__PURE__*/function (RequisiteSectionMode) {
78358
- RequisiteSectionMode[RequisiteSectionMode["AsRequisiteAttribute"] = 0] = "AsRequisiteAttribute";
78359
- RequisiteSectionMode[RequisiteSectionMode["ForceAdd"] = 1] = "ForceAdd";
78360
- RequisiteSectionMode[RequisiteSectionMode["ForceSkip"] = 2] = "ForceSkip";
78361
- return RequisiteSectionMode;
78362
- }(RequisiteSectionMode || {});
78363
- const emptyDataDeclarationCollection = {};
78364
- class DataDeclarationGenerationContext {
78365
- constructor(initSequenceFactory, controlCustomizationContext, typesRegistry, formSchemaRng, schemeValidations) {
78366
- this.initSequenceFactory = void 0;
78367
- this.formSchemaRng = void 0;
78368
- this.schemeValidations = void 0;
78369
- this.controlCustomizationContext = void 0;
78370
- this.typesRegistry = void 0;
78371
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
78372
- this.declarationCustomizer = (objValue, srcValue, key) => {
78373
- // Вся эта функция не типизируется
78374
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
78375
- if (key === "section") {
78376
- const result = lodash_uniqwith__WEBPACK_IMPORTED_MODULE_1___default()([].concat(...(objValue !== null && objValue !== void 0 ? objValue : []), ...srcValue), (a, b) => {
78377
- if (typeof a === "object" && typeof b === "object") {
78378
- // @ts-ignore см. выше.
78379
- return a.fn === b.fn;
78380
- }
78381
- return a === b;
78382
- });
78383
-
78384
- // @ts-ignore см. выше.
78385
- if (result[0].fn) {
78386
- return result;
78387
- }
78388
- return [result];
78389
- }
78390
- /* eslint-enable @typescript-eslint/no-unsafe-argument */
78391
- return undefined;
78392
- };
78393
- this.formSchemaRng = formSchemaRng;
78394
- this.schemeValidations = schemeValidations;
78395
- this.initSequenceFactory = initSequenceFactory;
78396
- this.controlCustomizationContext = controlCustomizationContext;
78397
- this.typesRegistry = typesRegistry;
78398
- }
78399
- isMultipleNodeOptionalFromScheme(path) {
78400
- if (!this.schemeValidations) {
78401
- return undefined;
78402
- }
78403
- const schemaNode = this.formSchemaRng.getElementByPath(path);
78404
- if (schemaNode instanceof _common_SchemaRng_FormSchemaRng__WEBPACK_IMPORTED_MODULE_9__.FormSchemaRngElement) {
78405
- var _schemaNode$isOptiona;
78406
- return (_schemaNode$isOptiona = schemaNode.isOptionalOrNillable()) !== null && _schemaNode$isOptiona !== void 0 ? _schemaNode$isOptiona : false;
78407
- }
78408
- return undefined;
78409
- }
78410
- getTypeNode(node) {
78411
- if (node.anonymousType != undefined) {
78412
- return node.anonymousType;
78413
- }
78414
- if (node.type != undefined) {
78415
- return this.typesRegistry.getByName(node.type);
78416
- }
78417
- return undefined;
78418
- }
78419
- addTypeNode(node) {
78420
- var _this$formSchemaRng$g;
78421
- const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
78422
- return baseType ? {
78423
- type: baseType
78424
- } : {};
77781
+ addTypeNode(node) {
77782
+ var _this$formSchemaRng$g;
77783
+ const baseType = (_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(node.getFullPath())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType;
77784
+ return baseType ? {
77785
+ type: baseType
77786
+ } : {};
78425
77787
  }
78426
77788
  processChildrenDataDeclaration(children, nodeProcessor) {
78427
77789
  const childrenDataDeclaration = [];
@@ -79587,238 +78949,785 @@ if (window.CF.entryPoint[gfv]) {
79587
78949
  isDisabledCloseAndSaveButton: defaultSettings.isDisabledCloseAndSaveButton || settings.isDisabledCloseAndSaveButton,
79588
78950
  }
79589
78951
  }
79590
- const formInstance = await renderForm(Form, resources, container)
79591
- window.CF.entryPoint[gfv].instances = window.CF.entryPoint[gfv].instances ?? [];
79592
- window.CF.entryPoint[gfv].instances.push(formInstance)
79593
- return formInstance;
78952
+ const formInstance = await renderForm(Form, resources, container)
78953
+ window.CF.entryPoint[gfv].instances = window.CF.entryPoint[gfv].instances ?? [];
78954
+ window.CF.entryPoint[gfv].instances.push(formInstance)
78955
+ return formInstance;
78956
+ }
78957
+ }
78958
+
78959
+ if (module.hot) {
78960
+ module.hot.accept();
78961
+ }
78962
+ `;
78963
+ }
78964
+
78965
+ /***/ }),
78966
+
78967
+ /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts":
78968
+ /*!************************************************************************!*\
78969
+ !*** ./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts ***!
78970
+ \************************************************************************/
78971
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78972
+
78973
+ "use strict";
78974
+ __webpack_require__.r(__webpack_exports__);
78975
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
78976
+ /* harmony export */ getWebJsContent: () => (/* binding */ getWebJsContent)
78977
+ /* harmony export */ });
78978
+ function getWebJsContent() {
78979
+ return `if (window.CF && window.CF.keformsUrl) {
78980
+ let { keformsUrl } = window.CF
78981
+ let publicPath = __webpack_public_path__
78982
+
78983
+ publicPath = publicPath.slice(0, 1) == '/' ? publicPath.slice(1) : publicPath
78984
+ keformsUrl = keformsUrl.slice(-1) == '/' ? keformsUrl.slice(0, -1) : keformsUrl
78985
+ __webpack_public_path__ = \`\${keformsUrl\}/\$\{publicPath\}\`
78986
+ }
78987
+
78988
+ require('./webEntry')
78989
+ `;
78990
+ }
78991
+
78992
+ /***/ }),
78993
+
78994
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts":
78995
+ /*!***********************************************************************************!*\
78996
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts ***!
78997
+ \***********************************************************************************/
78998
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
78999
+
79000
+ "use strict";
79001
+ __webpack_require__.r(__webpack_exports__);
79002
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79003
+ /* harmony export */ astToExportStatement: () => (/* binding */ astToExportStatement)
79004
+ /* harmony export */ });
79005
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79006
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79007
+
79008
+ const astToExportStatement = (filename, ast) => {
79009
+ const defaultExport = ast.program.body.find(x => _babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(x) && _babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(x.declaration));
79010
+ if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(defaultExport) || !_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(defaultExport.declaration)) {
79011
+ throw new Error(`InvalidProgramState: default function export not found in ${filename}.js`);
79012
+ }
79013
+ return _babel_types__WEBPACK_IMPORTED_MODULE_0__.exportNamedDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.functionDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.identifier(filename), defaultExport.declaration.params, defaultExport.declaration.body, defaultExport.declaration.generator, defaultExport.declaration.async));
79014
+ };
79015
+
79016
+ /***/ }),
79017
+
79018
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts":
79019
+ /*!*********************************************************************************************!*\
79020
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts ***!
79021
+ \*********************************************************************************************/
79022
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79023
+
79024
+ "use strict";
79025
+ __webpack_require__.r(__webpack_exports__);
79026
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79027
+ /* harmony export */ CommonHelperFunctionsGenerator: () => (/* binding */ CommonHelperFunctionsGenerator)
79028
+ /* harmony export */ });
79029
+ /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79030
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79031
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79032
+ /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79033
+ /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79034
+ /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79035
+
79036
+
79037
+
79038
+
79039
+
79040
+ class CommonHelperFunctionsGenerator {
79041
+ generate(commonHelpers) {
79042
+ if (commonHelpers.length === 0) {
79043
+ return "";
79044
+ }
79045
+ const helperFunctionsList = commonHelpers.map(helper => helper.filename).join(", ");
79046
+ const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79047
+ sourceType: "module"
79048
+ });
79049
+ const exportDefault = buildExportDefault();
79050
+ if (Array.isArray(exportDefault)) {
79051
+ throw new Error("InvalidProgramState: default export build failed");
79052
+ }
79053
+ const helpersStatements = [].concat(...commonHelpers.map(helper => {
79054
+ const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79055
+ return this.transform(helper.filename, ast);
79056
+ }), exportDefault);
79057
+ return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79058
+ }
79059
+ transform(filename, ast) {
79060
+ const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79061
+ const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./"));
79062
+ return [...imports, result];
79063
+ }
79064
+ }
79065
+
79066
+ /***/ }),
79067
+
79068
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts":
79069
+ /*!*******************************************************************************!*\
79070
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts ***!
79071
+ \*******************************************************************************/
79072
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79073
+
79074
+ "use strict";
79075
+ __webpack_require__.r(__webpack_exports__);
79076
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79077
+ /* harmony export */ fileContentToAst: () => (/* binding */ fileContentToAst)
79078
+ /* harmony export */ });
79079
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79080
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79081
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79082
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79083
+
79084
+
79085
+ const fileContentToAst = helper => {
79086
+ const ast = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.parse)(helper.content, {
79087
+ sourceType: "module",
79088
+ filename: "fake-file-name.js",
79089
+ configFile: false,
79090
+ babelrc: false,
79091
+ plugins: [__webpack_require__(/*! @babel/plugin-syntax-jsx */ "./node_modules/@babel/plugin-syntax-jsx/lib/index.js")]
79092
+ });
79093
+ if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFile(ast)) {
79094
+ throw new Error(`InvalidProgramState: incorrect helper ${helper.filename}.js`);
79095
+ }
79096
+ return ast;
79097
+ };
79098
+
79099
+ /***/ }),
79100
+
79101
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts":
79102
+ /*!***************************************************************************************!*\
79103
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts ***!
79104
+ \***************************************************************************************/
79105
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79106
+
79107
+ "use strict";
79108
+ __webpack_require__.r(__webpack_exports__);
79109
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79110
+ /* harmony export */ HelperFunctionsGenerator: () => (/* binding */ HelperFunctionsGenerator)
79111
+ /* harmony export */ });
79112
+ /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79113
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79114
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79115
+ /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79116
+ /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79117
+ /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79118
+
79119
+
79120
+
79121
+
79122
+
79123
+ class HelperFunctionsGenerator {
79124
+ generate(helpers) {
79125
+ if (helpers.length === 0) {
79126
+ return "";
79127
+ }
79128
+ const helperFunctionsList = helpers.map(helper => helper.filename).join(", ");
79129
+ const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79130
+ sourceType: "module"
79131
+ });
79132
+ const exportDefault = buildExportDefault();
79133
+ if (Array.isArray(exportDefault)) {
79134
+ throw new Error("InvalidProgramState: default export build failed");
79135
+ }
79136
+ const helpersStatements = [].concat(...helpers.map(helper => {
79137
+ const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79138
+ return this.transform(helper.filename, ast);
79139
+ }), exportDefault);
79140
+ return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79141
+ }
79142
+ transform(filename, ast) {
79143
+ const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79144
+ const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./")).map(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && x.source.value.includes("/jsHelpers/") ? _babel_types__WEBPACK_IMPORTED_MODULE_1__.importDeclaration(x.specifiers.map(s => _babel_types__WEBPACK_IMPORTED_MODULE_1__.importSpecifier(s.local, s.local)), _babel_types__WEBPACK_IMPORTED_MODULE_1__.stringLiteral("./commonHelperFunctions")) : x);
79145
+ return [...imports, result];
79594
79146
  }
79595
- }
79596
-
79597
- if (module.hot) {
79598
- module.hot.accept();
79599
- }
79600
- `;
79601
79147
  }
79602
79148
 
79603
79149
  /***/ }),
79604
79150
 
79605
- /***/ "./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts":
79606
- /*!************************************************************************!*\
79607
- !*** ./Generator/src/generators/FormSourcesBuilder/GetWebJsContent.ts ***!
79608
- \************************************************************************/
79151
+ /***/ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts":
79152
+ /*!*******************************************************************************!*\
79153
+ !*** ./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts ***!
79154
+ \*******************************************************************************/
79609
79155
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79610
79156
 
79611
79157
  "use strict";
79612
79158
  __webpack_require__.r(__webpack_exports__);
79613
79159
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79614
- /* harmony export */ getWebJsContent: () => (/* binding */ getWebJsContent)
79160
+ /* harmony export */ statementsToCode: () => (/* binding */ statementsToCode)
79615
79161
  /* harmony export */ });
79616
- function getWebJsContent() {
79617
- return `if (window.CF && window.CF.keformsUrl) {
79618
- let { keformsUrl } = window.CF
79619
- let publicPath = __webpack_public_path__
79162
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79163
+ /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79164
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79165
+ /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79620
79166
 
79621
- publicPath = publicPath.slice(0, 1) == '/' ? publicPath.slice(1) : publicPath
79622
- keformsUrl = keformsUrl.slice(-1) == '/' ? keformsUrl.slice(0, -1) : keformsUrl
79623
- __webpack_public_path__ = \`\${keformsUrl\}/\$\{publicPath\}\`
79624
- }
79625
79167
 
79626
- require('./webEntry')
79627
- `;
79628
- }
79168
+ const statementsToCode = statements => {
79169
+ const transformResult = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.transformFromAstSync)(_babel_types__WEBPACK_IMPORTED_MODULE_0__.program(statements), undefined, {
79170
+ configFile: false,
79171
+ sourceType: "module"
79172
+ });
79173
+ if (transformResult == undefined || transformResult.code == undefined) {
79174
+ throw new Error("InvalidProgramState: statements transform failed");
79175
+ }
79176
+ const {
79177
+ code
79178
+ } = transformResult;
79179
+ return unescape(code.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
79180
+ };
79629
79181
 
79630
79182
  /***/ }),
79631
79183
 
79632
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts":
79633
- /*!***********************************************************************************!*\
79634
- !*** ./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts ***!
79635
- \***********************************************************************************/
79184
+ /***/ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts":
79185
+ /*!***********************************************************************!*\
79186
+ !*** ./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts ***!
79187
+ \***********************************************************************/
79636
79188
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79637
79189
 
79638
79190
  "use strict";
79639
79191
  __webpack_require__.r(__webpack_exports__);
79640
79192
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79641
- /* harmony export */ astToExportStatement: () => (/* binding */ astToExportStatement)
79193
+ /* harmony export */ AggregationDependencyModelPath: () => (/* binding */ AggregationDependencyModelPath),
79194
+ /* harmony export */ DependencyWithoutChecks: () => (/* binding */ DependencyWithoutChecks),
79195
+ /* harmony export */ KCXmlGeneratorBase: () => (/* binding */ KCXmlGeneratorBase),
79196
+ /* harmony export */ RegularDependency: () => (/* binding */ RegularDependency),
79197
+ /* harmony export */ isAggregationDependencyModelPath: () => (/* binding */ isAggregationDependencyModelPath),
79198
+ /* harmony export */ isDependencyWithoutChecks: () => (/* binding */ isDependencyWithoutChecks)
79642
79199
  /* harmony export */ });
79643
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79644
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79200
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
79201
+ /* 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");
79202
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
79203
+ /* harmony import */ var _markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../markupGenerator/ComponentMarkupBuilder/PathHelper */ "./Generator/src/generators/markupGenerator/ComponentMarkupBuilder/PathHelper.ts");
79204
+ /* harmony import */ var _Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Common/ModelPath/PathSplitHelper */ "./Common/ModelPath/PathSplitHelper.ts");
79205
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
79206
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
79207
+
79208
+
79209
+
79210
+
79211
+
79212
+
79213
+
79214
+ class RegularDependency {
79215
+ constructor(currentDependencyPath, eachDependencyPath) {
79216
+ this.currentDependencyPath = void 0;
79217
+ this.eachDependencyPath = void 0;
79218
+ this.eachDependencyPath = eachDependencyPath;
79219
+ this.currentDependencyPath = currentDependencyPath;
79220
+ }
79221
+ asDependencyModelPath() {
79222
+ const currentPart = this.currentDependencyPath.toCurrentIteration();
79223
+ return this.eachDependencyPath != undefined ? currentPart.joinWith(this.eachDependencyPath) : currentPart;
79224
+ }
79225
+ }
79226
+ class AggregationDependencyModelPath {
79227
+ constructor(type, modelPath, prefixModelPath, restModelPath) {
79228
+ this.type = void 0;
79229
+ this.modelPath = void 0;
79230
+ this.prefixModelPath = void 0;
79231
+ this.restModelPath = void 0;
79232
+ this.type = type;
79233
+ this.modelPath = modelPath;
79234
+ this.prefixModelPath = prefixModelPath;
79235
+ this.restModelPath = restModelPath;
79236
+ }
79237
+ asDependencyModelPath() {
79238
+ return this.modelPath.toCurrentIteration();
79239
+ }
79240
+ }
79241
+ class DependencyWithoutChecks extends RegularDependency {}
79242
+ function isAggregationDependencyModelPath(path) {
79243
+ return path instanceof AggregationDependencyModelPath;
79244
+ }
79245
+ function isDependencyWithoutChecks(path) {
79246
+ return path instanceof DependencyWithoutChecks;
79247
+ }
79248
+ class KCXmlGeneratorBase {
79249
+ constructor(schema) {
79250
+ this.schema = void 0;
79251
+ this.schema = schema;
79252
+ }
79253
+ getRuntimeFunctionName(functionSelector) {
79254
+ return (0,_markupGenerator_ComponentMarkupBuilder_PathHelper__WEBPACK_IMPORTED_MODULE_3__.extractPath)(functionSelector.toString());
79255
+ }
79256
+ getCompiledFuncWithArgs(functionSelector, args) {
79257
+ const funcName = this.getRuntimeFunctionName(functionSelector);
79258
+ const funcParams = args.join(", ");
79259
+ return `expression.${funcName}(${funcParams})`;
79260
+ }
79261
+ getArgumentDeps(targetFullPath, selectFullPath, aggregationType) {
79262
+ const pathDiffInfo = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetFullPath, selectFullPath);
79263
+ const restPath = pathDiffInfo.differentPath;
79264
+ return !restPath.isContainIteration() ? new RegularDependency(selectFullPath) : new AggregationDependencyModelPath(aggregationType, pathDiffInfo.matchedPath.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...restPath.getPathPartsAsArray().filter(x => _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.isSimpleToken(x)), aggregationType])), pathDiffInfo.matchedPath, restPath);
79265
+ }
79266
+ getAggregationPathsRecursively(currentParts, restParts) {
79267
+ if (restParts.length === 0) {
79268
+ return [];
79269
+ }
79270
+ const firstRestItem = restParts[1];
79271
+ const nextRestParts = restParts.slice(2);
79272
+ const nextCurrentParts = [...currentParts, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each, firstRestItem];
79273
+ const restWithoutMultiple = nextRestParts.filter(x => (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.isModelPath)(x));
79274
+ const result = {
79275
+ aggregationPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...currentParts, firstRestItem, ...restWithoutMultiple),
79276
+ targetPath: (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.emptyModelPath)().joinWith(...nextCurrentParts, ...restWithoutMultiple),
79277
+ isTargetFinal: restWithoutMultiple.length === 0
79278
+ };
79279
+ const nextResults = this.getAggregationPathsRecursively(nextCurrentParts, nextRestParts);
79280
+ return [result, ...nextResults];
79281
+ }
79282
+
79283
+ // Example: Root/B/*/C/D/*/E = Root/B/C/D/E/Sum -> Root/B/*/C/D/E/Sum -> Root/B/*/C/D/*/E
79284
+ getAggregationPaths(relativePath) {
79285
+ const splittedPath = [...relativePath.splitByMultiplicity()];
79286
+ return this.getAggregationPathsRecursively([splittedPath[0]], splittedPath.slice(1));
79287
+ }
79288
+ createDependency(prefixModelPath, x, aggregationType) {
79289
+ return {
79290
+ aggPath: prefixModelPath.joinWith(x.aggregationPath).joinWith(aggregationType),
79291
+ type: aggregationType,
79292
+ dependencyPath: x.isTargetFinal ? prefixModelPath.joinWith(x.targetPath) : prefixModelPath.joinWith(x.targetPath).joinWith(aggregationType),
79293
+ isDependencyAggregation: !x.isTargetFinal
79294
+ };
79295
+ }
79296
+ compileAggregationDependencies(dependencies) {
79297
+ const resultItems = dependencies.filter(isAggregationDependencyModelPath).map(dep => this.getAggregationPaths(dep.restModelPath).map(x => {
79298
+ switch (dep.type) {
79299
+ case "Sum":
79300
+ return [this.createDependency(dep.prefixModelPath, x, "Sum"), this.createDependency(dep.prefixModelPath, x, "Count")];
79301
+ case "Count":
79302
+ return [this.createDependency(dep.prefixModelPath, x, "Count")];
79303
+ default:
79304
+ {
79305
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureNever)(dep.type);
79306
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Not supported aggregation dependency: ${dep.type}`);
79307
+ }
79308
+ }
79309
+ })).flat(2);
79310
+ const distinctiveItems = Iterator.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_6__.IterUtils.distinctBy(resultItems, x => x.aggPath.toLegacyPath()));
79311
+ const sumCompiledFunctions = distinctiveItems.map(x => {
79312
+ const compiledDep = this.modelPathInstance(x.dependencyPath.toCurrentIteration());
79313
+ const compiledAggPath = this.modelPathInstance(x.aggPath);
79314
+ const compiledCountPath = this.modelPathInstance(x.aggPath.getParentPath().joinWith("Count").toCurrentIteration());
79315
+ const compiledDelegate = x.type === "Sum" ? `context => KCSumCalculation.execute(context, ${compiledAggPath},${compiledDep}, ${compiledCountPath}, "")` : x.type === "Count" ? `context => KCCountCalculation.execute(context, ${compiledAggPath}, ${compiledDep}, ${x.isDependencyAggregation}, "")` : "";
79316
+ const compiledDeps = [compiledDep, ...(x.type === "Sum" ? [compiledCountPath] : [])].join(", ");
79317
+ return `new CalculationFunction(${compiledAggPath}, [${compiledDeps}], ${compiledDelegate}, false, false)`;
79318
+ });
79319
+ return [...sumCompiledFunctions];
79320
+ }
79321
+ compileExpressionWithUnsupportedHandled(prefix, targetFullPath, expression, deps) {
79322
+ try {
79323
+ return this.compileExpression(prefix, targetFullPath, expression, deps);
79324
+ } catch (e) {
79325
+ if (e instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
79326
+ return e;
79327
+ }
79328
+ throw e;
79329
+ }
79330
+ }
79331
+
79332
+ /* eslint-disable @typescript-eslint/unbound-method */
79333
+ compileExpression(prefix, targetFullPath, expression, deps) {
79334
+ const gcf = (selector, ...args) => this.getCompiledFuncWithArgs(selector, args);
79335
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArgumentExpression || expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultySumExpression) {
79336
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79337
+ const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Sum");
79338
+ deps.push(argumentDependency);
79339
+ const finalPath = argumentDependency.asDependencyModelPath();
79340
+ return gcf(x => x.argument, `"${finalPath.toLegacyPath()}"`);
79341
+ }
79342
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaExistsExpression) {
79343
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79344
+ deps.push(new RegularDependency(modelPath));
79345
+ return gcf(x => x.exists, `"${modelPath.toLegacyPath()}"`);
79346
+ }
79347
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsSnilsExpression) {
79348
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79349
+ deps.push(new RegularDependency(modelPath));
79350
+ return gcf(x => x.isSnils, `"${modelPath.toLegacyPath()}"`);
79351
+ }
79352
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsInnExpression) {
79353
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79354
+ deps.push(new RegularDependency(modelPath));
79355
+ return gcf(x => x.isInn, `"${modelPath.toLegacyPath()}"`);
79356
+ }
79357
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidMirCardNumberExpression) {
79358
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79359
+ deps.push(new RegularDependency(modelPath));
79360
+ return gcf(x => x.isValidMirCardNumber, `"${modelPath.toLegacyPath()}"`);
79361
+ }
79362
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsValidAccountNumberExpression) {
79363
+ const bikPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.bik)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79364
+ const accountPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.account)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79365
+ deps.push(new RegularDependency(bikPath));
79366
+ deps.push(new RegularDependency(accountPath));
79367
+ return gcf(x => x.isValidAccountNumber, `"${bikPath.toLegacyPath()}"`, `"${accountPath.toLegacyPath()}"`);
79368
+ }
79369
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaCountExpression) {
79370
+ var _expression$withNullO;
79371
+ const modelPath = this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(expression.select)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79372
+ let finalPath = modelPath;
79373
+ if (targetFullPath.isContainIteration()) {
79374
+ const argumentDependency = this.getArgumentDeps(targetFullPath, modelPath, "Count");
79375
+ deps.push(argumentDependency);
79376
+ finalPath = argumentDependency.asDependencyModelPath();
79377
+ } else {
79378
+ deps.push(new RegularDependency(modelPath));
79379
+ }
79380
+ return gcf(x => x.count, `"${finalPath.toLegacyPath()}"`, `"${(_expression$withNullO = expression.withNullOrEmptyValues) !== null && _expression$withNullO !== void 0 ? _expression$withNullO : false}"`);
79381
+ }
79382
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaWhenExpression) {
79383
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.expressions, 2);
79384
+ const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.expressions[0], deps);
79385
+ const compiledBody = this.compileExpression(prefix, targetFullPath, expression.expressions[1], deps);
79386
+ return gcf(x => x.when, compiledCondition, `() => ${compiledBody}`);
79387
+ }
79388
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOrExpression) {
79389
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79390
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79391
+ return gcf(x => x.or, `[${compiledExpressions}]`);
79392
+ }
79393
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAndExpression) {
79394
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79395
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79396
+ return gcf(x => x.and, `[${compiledExpressions}]`);
79397
+ }
79398
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNotExpression) {
79399
+ return gcf(x => x.not, this.compileExpression(prefix, targetFullPath, expression.argument, deps));
79400
+ }
79401
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaEqExpression) {
79402
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79403
+ const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79404
+ return gcf(x => x.eq, ...compiledParts);
79405
+ }
79406
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConstExpression) {
79407
+ return gcf(x => x.const, `"${expression.value}"`);
79408
+ }
79409
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGtExpression) {
79410
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79411
+ const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79412
+ return gcf(x => x.gt, ...compiledParts);
79413
+ }
79414
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGeExpression) {
79415
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79416
+ const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79417
+ return gcf(x => x.ge, ...compiledParts);
79418
+ }
79419
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLtExpression) {
79420
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79421
+ const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79422
+ return gcf(x => x.lt, ...compiledParts);
79423
+ }
79424
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLeExpression) {
79425
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79426
+ const compiledParts = expression.arguments.map(x => this.compileExpression(prefix, targetFullPath, x, deps));
79427
+ return gcf(x => x.le, ...compiledParts);
79428
+ }
79429
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaLengthExpression) {
79430
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79431
+ return gcf(x => x.length, compiledArgument);
79432
+ }
79433
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRegexMatchExpression) {
79434
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79435
+ const preparedPattern = expression.pattern.replace(/"/g, '\\"').replace(/\\/g, "\\\\");
79436
+ return gcf(x => x.regexMatch, compiledArgument, `"${preparedPattern}"`);
79437
+ }
79438
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMultiplyExpression) {
79439
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79440
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79441
+ return gcf(x => x.multiply, `[${compiledExpressions}]`);
79442
+ }
79443
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDivisionExpression) {
79444
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79445
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79446
+ return gcf(x => x.division, `[${compiledExpressions}]`);
79447
+ }
79448
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
79449
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 1);
79450
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79451
+ return gcf(x => x.sum, `[${compiledExpressions}]`);
79452
+ }
79453
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaMinusExpression) {
79454
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79455
+ return gcf(x => x.minus, compiledArgument);
79456
+ }
79457
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaRoundExpression) {
79458
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79459
+ return gcf(x => x.round, compiledArgument, `${expression.fractionalDigits}`);
79460
+ }
79461
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFloorExpression) {
79462
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79463
+ return gcf(x => x.floor, compiledArgument);
79464
+ }
79465
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAbsExpression) {
79466
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79467
+ return gcf(x => x.abs, compiledArgument);
79468
+ }
79469
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaXAbsExpression) {
79470
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79471
+ return gcf(x => x.xabs, compiledArgument);
79472
+ }
79473
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaChooseExpression) {
79474
+ const compiledCondition = this.compileExpression(prefix, targetFullPath, expression.ifNode.condition, deps);
79475
+ const compiledThen = this.compileExpression(prefix, targetFullPath, expression.thenNode.expression, deps);
79476
+ const compiledElse = this.compileExpression(prefix, targetFullPath, expression.elseNode.expression, deps);
79477
+ return gcf(x => x.choose, compiledCondition, `() => ${compiledThen}`, `() => ${compiledElse}`);
79478
+ }
79479
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateNowExpression) {
79480
+ return gcf(x => x.dateNow);
79481
+ }
79482
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDaysInMonthExpression) {
79483
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79484
+ return gcf(x => x.getDaysInMonth, compiledArgument);
79485
+ }
79486
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetDayExpression) {
79487
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79488
+ return gcf(x => x.getDay, compiledArgument);
79489
+ }
79490
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetMonthExpression) {
79491
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79492
+ return gcf(x => x.getMonth, compiledArgument);
79493
+ }
79494
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetYearExpression) {
79495
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79496
+ return gcf(x => x.getYear, compiledArgument);
79497
+ }
79498
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaIsDateExpression) {
79499
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79500
+ return gcf(x => x.isDate, compiledArgument);
79501
+ }
79502
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInMonthsExpression) {
79503
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79504
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79505
+ return gcf(x => x.differenceInMonths, `[${compiledExpressions}]`);
79506
+ }
79507
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDifferenceInDaysExpression) {
79508
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayHasLength)(expression.arguments, 2);
79509
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79510
+ return gcf(x => x.differenceInDays, `[${compiledExpressions}]`);
79511
+ }
79512
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddDaysExpression) {
79513
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79514
+ return gcf(x => x.addDays, `${path}, ${expression.amount}`);
79515
+ }
79516
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddMonthsExpression) {
79517
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79518
+ return gcf(x => x.addMonths, `${path}, ${expression.amount}`);
79519
+ }
79520
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaAddYearsExpression) {
79521
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79522
+ return gcf(x => x.addYears, `${path}, ${expression.amount}`);
79523
+ }
79524
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateToStringExpression) {
79525
+ const path = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79526
+ return gcf(x => x.dateToString, `${path}, "${!!expression.format ? expression.format : "dd.MM.yyyy"}"`);
79527
+ }
79528
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaDateTimeExpression) {
79529
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.expression, deps);
79530
+ return gcf(x => x.dateTime, compiledArgument);
79531
+ }
79532
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSubstringExpression) {
79533
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.isNotNullOrUndefined)(expression.expression);
79534
+ return `expression.substring(${this.compileExpression(prefix, targetFullPath, expression.expression, deps)}, "${expression.start}", "${expression.length}")`;
79535
+ }
79536
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaSumExpression) {
79537
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79538
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79539
+ return `expression.sum([${compiledExpressions}])`;
79540
+ }
79541
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupSumExpression) {
79542
+ const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys, deps);
79543
+ const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
79544
+ const sourceKeyDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
79545
+ deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
79546
+ const sourceValuePath = this.getModelPath(prefix, expression.sourceValuePath);
79547
+ const sourceValueDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceValuePath);
79548
+ deps.push(new DependencyWithoutChecks(sourceValueDeps.currentDepsPath, sourceValueDeps.eachDepsPath));
79549
+ return gcf(x => x.groupSum, `${targetKeys}, "${sourceKeyPath}", "${sourceValuePath}"`);
79550
+ }
79551
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGroupCountExpression) {
79552
+ const targetKeys = this.compileExpression(prefix, targetFullPath, expression.targetKeys, deps);
79553
+ deps.push(new DependencyWithoutChecks(targetFullPath));
79554
+ const sourceKeyPath = this.getModelPath(prefix, expression.sourceKeyPath);
79555
+ const sourceKeyDeps = this.calculatedGroupSumDependencyForSourcePath(targetFullPath, sourceKeyPath);
79556
+ deps.push(new DependencyWithoutChecks(sourceKeyDeps.currentDepsPath, sourceKeyDeps.eachDepsPath));
79557
+ return gcf(x => x.groupCount, `${targetKeys}, "${sourceKeyPath}"`);
79558
+ }
79559
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression) {
79560
+ (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.ensureArrayLengthGreaterThenOrEqual)(expression.arguments, 2);
79561
+ const compiledExpressions = expression.arguments.map(arg => this.compileExpression(prefix, targetFullPath, arg, deps)).join(",");
79562
+ return gcf(x => x.concat, `[${compiledExpressions}]`);
79563
+ }
79564
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNewLineExpression) {
79565
+ return gcf(x => x.const, `"\\r\\n"`);
79566
+ }
79567
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaOneOfExpression) {
79568
+ const compiledArgument = this.compileExpression(prefix, targetFullPath, expression.argument, deps);
79569
+ const compiledItems = expression.items.expressions.map(item => this.compileExpression(prefix, targetFullPath, item, deps)).join(",");
79570
+ return gcf(x => x.oneOf, compiledArgument, `[${compiledItems}]`);
79571
+ }
79572
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaArrayExpression) {
79573
+ const itemsText = expression.items.map(x => this.compileExpression(prefix, targetFullPath, x, deps)).join(", ");
79574
+ return `JSON.stringify([${itemsText}])`;
79575
+ }
79576
+ // -- не работает в рантайм калькуляторе
79577
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaGetPicklistValuesExpression) {
79578
+ return "null";
79579
+ }
79580
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaFirstOrDefaultExpression) {
79581
+ return "null";
79582
+ }
79583
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHashSetExpression) {
79584
+ return "null";
79585
+ }
79586
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaNoDepsNode) {
79587
+ return "null";
79588
+ }
79589
+ if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaHasAutoFlagExpression) {
79590
+ return "null";
79591
+ }
79592
+ // -----
79645
79593
 
79646
- const astToExportStatement = (filename, ast) => {
79647
- const defaultExport = ast.program.body.find(x => _babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(x) && _babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(x.declaration));
79648
- if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isExportDefaultDeclaration(defaultExport) || !_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFunctionDeclaration(defaultExport.declaration)) {
79649
- throw new Error(`InvalidProgramState: default function export not found in ${filename}.js`);
79594
+ throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError(`Unsupported node type: ${expression.constructor.name}`);
79650
79595
  }
79651
- return _babel_types__WEBPACK_IMPORTED_MODULE_0__.exportNamedDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.functionDeclaration(_babel_types__WEBPACK_IMPORTED_MODULE_0__.identifier(filename), defaultExport.declaration.params, defaultExport.declaration.body, defaultExport.declaration.generator, defaultExport.declaration.async));
79652
- };
79653
-
79654
- /***/ }),
79655
-
79656
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts":
79657
- /*!*********************************************************************************************!*\
79658
- !*** ./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts ***!
79659
- \*********************************************************************************************/
79660
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79661
-
79662
- "use strict";
79663
- __webpack_require__.r(__webpack_exports__);
79664
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79665
- /* harmony export */ CommonHelperFunctionsGenerator: () => (/* binding */ CommonHelperFunctionsGenerator)
79666
- /* harmony export */ });
79667
- /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79668
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79669
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79670
- /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79671
- /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79672
- /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79673
-
79674
-
79675
-
79676
-
79596
+ /* eslint-enable @typescript-eslint/unbound-method */
79677
79597
 
79678
- class CommonHelperFunctionsGenerator {
79679
- generate(commonHelpers) {
79680
- if (commonHelpers.length === 0) {
79681
- return "";
79598
+ /*
79599
+ Метод вычисляет зависимости для оператора.
79600
+ Для того, чтобы калькулятор корректно реагировал на измнения необходимо сделать корректные зависимости:
79601
+ 1) Если исходная множественность и множественность по которой строится группа совпадают, то необходио
79602
+ для последней звёздочки построить зависимость не через PathTokens.current, а через PathTokens.each,
79603
+ т.к. в таком случае пересчёт groupSum/groupCount должен тригетрися при изменении любого элемента в множественности, а не только текущего.
79604
+ 2) Если множественности не совпадают, то количество звёздочек (getIterationRank()) в общей части будет разным и ничего дополнительно делать не нужно,
79605
+ в зависимостях в CalculationFunction в данном случае все звёздочки превратятся в PathTokens.current.
79606
+ */
79607
+ calculatedGroupSumDependencyForSourcePath(targetKeyPath, sourcePath) {
79608
+ const diffPaths = (0,_Common_ModelPath_PathSplitHelper__WEBPACK_IMPORTED_MODULE_4__.getMatchedAndDifferentModelPaths)(targetKeyPath, sourcePath);
79609
+ if (targetKeyPath.getIterationRank() > diffPaths.matchedPath.getIterationRank()) {
79610
+ return {
79611
+ currentDepsPath: diffPaths.matchedPath,
79612
+ eachDepsPath: diffPaths.differentPath
79613
+ };
79682
79614
  }
79683
- const helperFunctionsList = commonHelpers.map(helper => helper.filename).join(", ");
79684
- const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79685
- sourceType: "module"
79686
- });
79687
- const exportDefault = buildExportDefault();
79688
- if (Array.isArray(exportDefault)) {
79689
- throw new Error("InvalidProgramState: default export build failed");
79615
+ const targetPathParts = diffPaths.matchedPath.getPathPartsAsArray();
79616
+ const lastStarIndex = targetPathParts.lastIndexOf(_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each);
79617
+ const currentDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createAbsoluteFromTokens)(targetPathParts.slice(0, lastStarIndex));
79618
+ let eachDepsPath;
79619
+ if (lastStarIndex === -1) {
79620
+ eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([...diffPaths.matchedPath.getPathParts(), ...diffPaths.differentPath.getPathParts()]);
79621
+ } else {
79622
+ var _targetPathParts$last;
79623
+ eachDepsPath = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createRelativeFromTokens)([(_targetPathParts$last = targetPathParts[lastStarIndex]) !== null && _targetPathParts$last !== void 0 ? _targetPathParts$last : (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_2__.reject)("path in groupSum is incorrect. Cannot create DepsPath for " + targetPathParts.join("/")), ...targetPathParts.slice(lastStarIndex + 1), ...diffPaths.differentPath.getPathParts()]);
79690
79624
  }
79691
- const helpersStatements = [].concat(...commonHelpers.map(helper => {
79692
- const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79693
- return this.transform(helper.filename, ast);
79694
- }), exportDefault);
79695
- return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79625
+ return {
79626
+ currentDepsPath: currentDepsPath,
79627
+ eachDepsPath: eachDepsPath
79628
+ };
79696
79629
  }
79697
- transform(filename, ast) {
79698
- const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79699
- const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./"));
79700
- return [...imports, result];
79630
+ removeAttributePrefix(pathPart) {
79631
+ return pathPart.replace(/\@/g, "");
79701
79632
  }
79702
- }
79703
-
79704
- /***/ }),
79705
-
79706
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts":
79707
- /*!*******************************************************************************!*\
79708
- !*** ./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts ***!
79709
- \*******************************************************************************/
79710
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79711
-
79712
- "use strict";
79713
- __webpack_require__.r(__webpack_exports__);
79714
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79715
- /* harmony export */ fileContentToAst: () => (/* binding */ fileContentToAst)
79716
- /* harmony export */ });
79717
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79718
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79719
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79720
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79721
-
79722
-
79723
- const fileContentToAst = helper => {
79724
- const ast = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.parse)(helper.content, {
79725
- sourceType: "module",
79726
- filename: "fake-file-name.js",
79727
- configFile: false,
79728
- babelrc: false,
79729
- plugins: [__webpack_require__(/*! @babel/plugin-syntax-jsx */ "./node_modules/@babel/plugin-syntax-jsx/lib/index.js")]
79730
- });
79731
- if (!_babel_types__WEBPACK_IMPORTED_MODULE_0__.isFile(ast)) {
79732
- throw new Error(`InvalidProgramState: incorrect helper ${helper.filename}.js`);
79633
+ removeMultiplicity(path) {
79634
+ return path.replace(/\/\*/g, "");
79733
79635
  }
79734
- return ast;
79735
- };
79636
+ getModelPath(prefix, path) {
79637
+ return this.schema.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeAttributePrefix(this.removeMultiplicity(path)), false, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each)).normalize());
79638
+ }
79639
+ modelPathInstance(target) {
79640
+ return `ap([${[...target.getPathParts()].map(x => {
79641
+ if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each) {
79642
+ return "PathTokens.each";
79643
+ }
79644
+ if (x === _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.current) {
79645
+ return "PathTokens.current";
79646
+ }
79647
+ return JSON.stringify(x);
79648
+ }).join(", ")}])`;
79649
+ }
79650
+ }
79736
79651
 
79737
79652
  /***/ }),
79738
79653
 
79739
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts":
79654
+ /***/ "./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts":
79740
79655
  /*!***************************************************************************************!*\
79741
- !*** ./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts ***!
79656
+ !*** ./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts ***!
79742
79657
  \***************************************************************************************/
79743
79658
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79744
79659
 
79745
79660
  "use strict";
79746
79661
  __webpack_require__.r(__webpack_exports__);
79747
79662
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79748
- /* harmony export */ HelperFunctionsGenerator: () => (/* binding */ HelperFunctionsGenerator)
79663
+ /* harmony export */ KCXmlValidationGenerator: () => (/* binding */ KCXmlValidationGenerator)
79749
79664
  /* harmony export */ });
79750
- /* harmony import */ var _babel_template__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/template */ "./node_modules/@babel/template/lib/index.js");
79751
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79752
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_1__);
79753
- /* harmony import */ var _FileContentToAst__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FileContentToAst */ "./Generator/src/generators/HelperFunctionsGenerator/FileContentToAst.ts");
79754
- /* harmony import */ var _AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AstToExportStatement */ "./Generator/src/generators/HelperFunctionsGenerator/AstToExportStatement.ts");
79755
- /* harmony import */ var _StatementsToCode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./StatementsToCode */ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts");
79665
+ /* harmony import */ var _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Common/ModelPath/ModelPath */ "./Common/ModelPath/ModelPath.ts");
79666
+ /* 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");
79667
+ /* harmony import */ var _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../KCXmlGenerator/KCXmlGeneratorBase */ "./Generator/src/generators/KCXmlGenerator/KCXmlGeneratorBase.ts");
79668
+ /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
79669
+ /* 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");
79670
+ /* harmony import */ var _Common_Errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Common/Errors */ "./Common/Errors.ts");
79671
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
79756
79672
 
79757
79673
 
79758
79674
 
79759
79675
 
79760
79676
 
79761
- class HelperFunctionsGenerator {
79762
- generate(helpers) {
79763
- if (helpers.length === 0) {
79764
- return "";
79765
- }
79766
- const helperFunctionsList = helpers.map(helper => helper.filename).join(", ");
79767
- const buildExportDefault = (0,_babel_template__WEBPACK_IMPORTED_MODULE_0__["default"])(`export default { ${helperFunctionsList} }`, {
79768
- sourceType: "module"
79769
- });
79770
- const exportDefault = buildExportDefault();
79771
- if (Array.isArray(exportDefault)) {
79772
- throw new Error("InvalidProgramState: default export build failed");
79677
+
79678
+
79679
+ const emptyResult = `
79680
+ export default function kcXmlValidationConfigurator ({ form, ModelPath, ValidationFunction, KCCondition }) {}
79681
+ `;
79682
+ class KCXmlValidationGenerator extends _KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.KCXmlGeneratorBase {
79683
+ generate(kcXmlConditions, options) {
79684
+ const compiledConditions = Iterator.from(kcXmlConditions).map(condition => this.compileCondition(condition, options)).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_6__.isNotNullOrUndefined).toArray();
79685
+ if (compiledConditions.length === 0) {
79686
+ // NOTE Просто, чтоб не падали аппрувал тесты
79687
+ return emptyResult;
79773
79688
  }
79774
- const helpersStatements = [].concat(...helpers.map(helper => {
79775
- const ast = (0,_FileContentToAst__WEBPACK_IMPORTED_MODULE_2__.fileContentToAst)(helper);
79776
- return this.transform(helper.filename, ast);
79777
- }), exportDefault);
79778
- return (0,_StatementsToCode__WEBPACK_IMPORTED_MODULE_4__.statementsToCode)(helpersStatements);
79689
+ const result = `export default function kcXmlValidationConfigurator ({ form, ap, ValidationFunction, KCCondition, PathTokens }) {
79690
+ ${compiledConditions.map(x => `form.calculator2.addCalculationFunction(${x});`).join("\n")}
79691
+ }
79692
+ `;
79693
+ return result;
79779
79694
  }
79780
- transform(filename, ast) {
79781
- const result = (0,_AstToExportStatement__WEBPACK_IMPORTED_MODULE_3__.astToExportStatement)(filename, ast);
79782
- const imports = ast.program.body.filter(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && !x.source.value.startsWith("./")).map(x => _babel_types__WEBPACK_IMPORTED_MODULE_1__.isImportDeclaration(x) && x.source.value.includes("/jsHelpers/") ? _babel_types__WEBPACK_IMPORTED_MODULE_1__.importDeclaration(x.specifiers.map(s => _babel_types__WEBPACK_IMPORTED_MODULE_1__.importSpecifier(s.local, s.local)), _babel_types__WEBPACK_IMPORTED_MODULE_1__.stringLiteral("./commonHelperFunctions")) : x);
79783
- return [...imports, result];
79695
+ compileCondition(condition, options) {
79696
+ var _condition$descriptio, _condition$errorLevel;
79697
+ const prefix = (0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.createFromMask)(this.removeMultiplicity(this.removeAttributePrefix(condition.match)), true, _Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_0__.PathTokens.each).toAbsolute();
79698
+ 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());
79699
+ const deps = [];
79700
+ const compiledExpression = this.compileExpressionWithUnsupportedHandled(prefix, target, condition.expression, deps);
79701
+ if (compiledExpression instanceof _Common_Errors__WEBPACK_IMPORTED_MODULE_5__.NotSupportedError) {
79702
+ if (options.skipNotSupportedFunction) {
79703
+ return undefined;
79704
+ } else {
79705
+ throw compiledExpression;
79706
+ }
79707
+ }
79708
+ 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");
79709
+ let concatDescription;
79710
+ if (compiledDescriptionParts.length > 1) {
79711
+ concatDescription = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_1__.FormulaConcatExpression();
79712
+ concatDescription.arguments = compiledDescriptionParts;
79713
+ } else {
79714
+ concatDescription = compiledDescriptionParts[0];
79715
+ }
79716
+ const compiledDescription = this.compileExpression(prefix, target, concatDescription, deps);
79717
+ const compiledTarget = this.modelPathInstance(target);
79718
+ const dependencyModelPaths = Array.from(_Common_IterableUtils__WEBPACK_IMPORTED_MODULE_3__.IterUtils.distinctBy(deps.map(x => ({
79719
+ path: x.asDependencyModelPath(),
79720
+ isIgnoreForChecks: (0,_KCXmlGenerator_KCXmlGeneratorBase__WEBPACK_IMPORTED_MODULE_2__.isDependencyWithoutChecks)(x),
79721
+ 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()
79722
+ })).filter(x => !x.path.isEquals(target)), x => x.pathString));
79723
+ const compiledDeps = dependencyModelPaths.map(x => x.path).map(x => this.modelPathInstance(x)).join(", ");
79724
+ const compiledDelegate = `context => KCCondition.execute(context, expression => ${compiledExpression}, ` + `(expression) => ${compiledDescription}, "${(_condition$errorLevel = condition.errorLevel) !== null && _condition$errorLevel !== void 0 ? _condition$errorLevel : "Error"}")`;
79725
+ return `new ValidationFunction(${compiledTarget}, [${compiledDeps}], ${compiledDelegate})`;
79784
79726
  }
79785
79727
  }
79786
79728
 
79787
79729
  /***/ }),
79788
79730
 
79789
- /***/ "./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts":
79790
- /*!*******************************************************************************!*\
79791
- !*** ./Generator/src/generators/HelperFunctionsGenerator/StatementsToCode.ts ***!
79792
- \*******************************************************************************/
79793
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
79794
-
79795
- "use strict";
79796
- __webpack_require__.r(__webpack_exports__);
79797
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79798
- /* harmony export */ statementsToCode: () => (/* binding */ statementsToCode)
79799
- /* harmony export */ });
79800
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/types */ "./node_modules/@babel/types/lib/index.js");
79801
- /* harmony import */ var _babel_types__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_types__WEBPACK_IMPORTED_MODULE_0__);
79802
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/core */ "./node_modules/@babel/core/lib/index.js");
79803
- /* harmony import */ var _babel_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_core__WEBPACK_IMPORTED_MODULE_1__);
79804
-
79805
-
79806
- const statementsToCode = statements => {
79807
- const transformResult = (0,_babel_core__WEBPACK_IMPORTED_MODULE_1__.transformFromAstSync)(_babel_types__WEBPACK_IMPORTED_MODULE_0__.program(statements), undefined, {
79808
- configFile: false,
79809
- sourceType: "module"
79810
- });
79811
- if (transformResult == undefined || transformResult.code == undefined) {
79812
- throw new Error("InvalidProgramState: statements transform failed");
79813
- }
79814
- const {
79815
- code
79816
- } = transformResult;
79817
- return unescape(code.replace(/(\\)(u[\dA-Fa-f]{4})/g, "%$2"));
79818
- };
79819
-
79820
- /***/ }),
79821
-
79822
79731
  /***/ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts":
79823
79732
  /*!***********************************************************************************************!*\
79824
79733
  !*** ./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts ***!
@@ -80004,12 +79913,12 @@ __webpack_require__.r(__webpack_exports__);
80004
79913
  /* harmony import */ var _DataDeclarationGenerator_DataDeclarationInitSourceSequenceFactory__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationInitSourceSequenceFactory.ts");
80005
79914
  /* harmony import */ var _FormSourcesBuilder_FormSourcesBuilder__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./FormSourcesBuilder/FormSourcesBuilder */ "./Generator/src/generators/FormSourcesBuilder/FormSourcesBuilder.ts");
80006
79915
  /* harmony import */ var _HelperFunctionsGenerator_HelperFunctionsGenerator__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./HelperFunctionsGenerator/HelperFunctionsGenerator */ "./Generator/src/generators/HelperFunctionsGenerator/HelperFunctionsGenerator.ts");
80007
- /* harmony import */ var _Calculator2Generator_ValidationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Calculator2Generator/ValidationsCalculator2Generator */ "./Generator/src/generators/Calculator2Generator/ValidationsCalculator2Generator.ts");
79916
+ /* harmony import */ var _KCXmlValidationGenerator_KCXmlValidationGenerator__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./KCXmlValidationGenerator/KCXmlValidationGenerator */ "./Generator/src/generators/KCXmlValidationGenerator/KCXmlValidationGenerator.ts");
80008
79917
  /* harmony import */ var _RequisiteLIst_requisiteList__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./RequisiteLIst/requisiteList */ "./Generator/src/generators/RequisiteLIst/requisiteList.ts");
80009
79918
  /* harmony import */ var _ServerSideFLangNormalization_NormalizationRulesGenerator__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./ServerSideFLangNormalization/NormalizationRulesGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/NormalizationRulesGenerator.ts");
80010
79919
  /* harmony import */ var _DataDeclarationGenerator_DataDeclarationGenerationTimeHelper__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./DataDeclarationGenerator/DataDeclarationGenerationTimeHelper */ "./Generator/src/generators/DataDeclarationGenerator/DataDeclarationGenerationTimeHelper.ts");
80011
79920
  /* harmony import */ var _AttachmentPaths_AttachmentPathsGenerator__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./AttachmentPaths/AttachmentPathsGenerator */ "./Generator/src/generators/AttachmentPaths/AttachmentPathsGenerator.ts");
80012
- /* harmony import */ var _Calculator2Generator_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Calculator2Generator/AutoCalculationsCalculator2Generator */ "./Generator/src/generators/Calculator2Generator/AutoCalculationsCalculator2Generator.ts");
79921
+ /* harmony import */ var _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator */ "./Generator/src/generators/AutoCalculationsGenerator/AutoCalculationsFromFormulas/Calculator2/AutoCalculationsCalculator2Generator.ts");
80013
79922
  /* harmony import */ var _LazyLoadDeclarationGenerator_LazyLoadDeclarationGenerator__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator */ "./Generator/src/generators/LazyLoadDeclarationGenerator/LazyLoadDeclarationGenerator.ts");
80014
79923
  /* harmony import */ var _ServerSideFLangNormalization_FormulaOnlyNormalizationRuleGenerator__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator */ "./Generator/src/generators/ServerSideFLangNormalization/FormulaOnlyNormalizationRuleGenerator.ts");
80015
79924
  /* harmony import */ var _HelperFunctionsGenerator_CommonHelperFunctionsGenerator__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./HelperFunctionsGenerator/CommonHelperFunctionsGenerator */ "./Generator/src/generators/HelperFunctionsGenerator/CommonHelperFunctionsGenerator.ts");
@@ -80172,11 +80081,11 @@ function processSugar(formSugarContent, additionalContent, generationOptions) {
80172
80081
  const rngSchemaValidationConfigurator = validationGenerator.generateRngSchemaValidationConfigurator();
80173
80082
  builder.addResource("rngSchemaValidationConfigurator.js", rngSchemaValidationConfigurator);
80174
80083
  const formulasForCalculator2 = useCalculator2 ? formulas : [];
80175
- const kcXmlAutoCalcGenerator = new _Calculator2Generator_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__.AutoCalculationsCalculator2Generator(formSchemaRng, dataDeclarationHelper);
80084
+ const kcXmlAutoCalcGenerator = new _AutoCalculationsGenerator_AutoCalculationsFromFormulas_Calculator2_AutoCalculationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_28__.AutoCalculationsCalculator2Generator(formSchemaRng, dataDeclarationHelper);
80176
80085
  builder.addResource("kcXmlAutoCalculationConfigurator.js", kcXmlAutoCalcGenerator.generate(formulasForCalculator2, {
80177
80086
  skipNotSupportedFunction: useServerCalculations
80178
80087
  }));
80179
- const kcXmlValidationGenerator = new _Calculator2Generator_ValidationsCalculator2Generator__WEBPACK_IMPORTED_MODULE_23__.ValidationsCalculator2Generator(formSchemaRng);
80088
+ const kcXmlValidationGenerator = new _KCXmlValidationGenerator_KCXmlValidationGenerator__WEBPACK_IMPORTED_MODULE_23__.KCXmlValidationGenerator(formSchemaRng);
80180
80089
  const kcXmlConditionsForCalculator2 = kcXmlConditions;
80181
80090
  builder.addResource("kcXmlValidationConfigurator.js", kcXmlValidationGenerator.generate(kcXmlConditionsForCalculator2, {
80182
80091
  skipNotSupportedFunction: useServerCalculations
@@ -80688,7 +80597,7 @@ class CustomKCLangToFlangRuleGenerator {
80688
80597
  const defaultValue = this.dataDeclarationHelper.getDefaultValue(fullTarget.toLegacyPath());
80689
80598
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
80690
80599
  const result = [];
80691
- const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.StringLiteralExpression(defaultValue));
80600
+ const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_4__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.StringLiteralExpression(defaultValue));
80692
80601
  if (isTargetAutoField) {
80693
80602
  result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_6__.BuildInTypeExpression.string)));
80694
80603
  } else {
@@ -81242,7 +81151,6 @@ __webpack_require__.r(__webpack_exports__);
81242
81151
  /* harmony export */ StringLiteralExpression: () => (/* binding */ StringLiteralExpression),
81243
81152
  /* harmony export */ SubstringExpression: () => (/* binding */ SubstringExpression),
81244
81153
  /* harmony export */ SumBinaryExpression: () => (/* binding */ SumBinaryExpression),
81245
- /* harmony export */ TernaryConditionalExpression: () => (/* binding */ TernaryConditionalExpression),
81246
81154
  /* harmony export */ TrimExpression: () => (/* binding */ TrimExpression),
81247
81155
  /* harmony export */ TypeReferenceExpression: () => (/* binding */ TypeReferenceExpression),
81248
81156
  /* harmony export */ UnaryExpression: () => (/* binding */ UnaryExpression),
@@ -81455,7 +81363,7 @@ class MinusBinaryExpression extends BinaryExpression {
81455
81363
  }
81456
81364
  class MultiplicativeBinaryExpression extends BinaryExpression {
81457
81365
  needAddBraces(child) {
81458
- return !(child instanceof NegateUnaryExpression || child instanceof ValueReferenceExpression || child instanceof ArgumentReferenceExpression || child instanceof CastExpression || child instanceof ConstExpression);
81366
+ return !(child instanceof NegateUnaryExpression || child instanceof ValueReferenceExpression || child instanceof ArgumentReferenceExpression || child instanceof SumBinaryExpression || child instanceof MinusBinaryExpression || child instanceof CastExpression || child instanceof ConstExpression);
81459
81367
  }
81460
81368
  getType() {
81461
81369
  return BuildInTypeExpression.decimal;
@@ -82122,7 +82030,6 @@ class ConditionalExpression extends FLangExpression {
82122
82030
  return `${condition} ? ${this.trueResult.convertToString()} : ${this.falseResult.convertToString()}`;
82123
82031
  }
82124
82032
  }
82125
- class TernaryConditionalExpression extends ConditionalExpression {}
82126
82033
  class DateNowExpression extends DateTimeExpression {
82127
82034
  getChildNodes() {
82128
82035
  return [];
@@ -82516,10 +82423,13 @@ __webpack_require__.r(__webpack_exports__);
82516
82423
  /* harmony export */ ensureOperandsOfTypeOrNull: () => (/* binding */ ensureOperandsOfTypeOrNull),
82517
82424
  /* harmony export */ getAllExpressionChildren: () => (/* binding */ getAllExpressionChildren),
82518
82425
  /* harmony export */ nullCoalesceWithTypeCheck: () => (/* binding */ nullCoalesceWithTypeCheck),
82519
- /* harmony export */ tryExtractValueReferenceAsStringFromDecimal: () => (/* binding */ tryExtractValueReferenceAsStringFromDecimal)
82426
+ /* harmony export */ tryExtractValueReferenceAsStringFromDecimal: () => (/* binding */ tryExtractValueReferenceAsStringFromDecimal),
82427
+ /* harmony export */ wrapWithArgumentsCondition: () => (/* binding */ wrapWithArgumentsCondition)
82520
82428
  /* harmony export */ });
82521
82429
  /* harmony import */ var _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../../Common/IterableUtils */ "./Common/IterableUtils.ts");
82522
- /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
82430
+ /* harmony import */ var _Common_TypingUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../../Common/TypingUtils */ "./Common/TypingUtils.ts");
82431
+ /* harmony import */ var _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FLangCodeDom */ "./Generator/src/generators/ServerSideFLangNormalization/FLang/FLangCodeDom.ts");
82432
+
82523
82433
 
82524
82434
 
82525
82435
  function* getAllExpressionChildren(node, descendantsFilter) {
@@ -82531,56 +82441,69 @@ function* getAllExpressionChildren(node, descendantsFilter) {
82531
82441
  }
82532
82442
  }
82533
82443
  }
82444
+ function wrapWithArgumentsCondition(expression) {
82445
+ 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);
82446
+ 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);
82447
+ const uniquePaths = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allValueRefNodes, x => x.convertToString());
82448
+ const conditionExpression = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.reduce(uniquePaths, (acc, curr) => {
82449
+ 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("")));
82450
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, currExpr) : currExpr;
82451
+ }, undefined);
82452
+ if (conditionExpression == undefined) {
82453
+ return expression;
82454
+ }
82455
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.ConditionalExpression(conditionExpression, expression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullLiteralExpression());
82456
+ }
82534
82457
  function combineRulesWithOptionalSectionChecking(allRules, optionalSectionRulesBuilder) {
82535
- const allUniqueRules = _Common_IterableUtils__WEBPACK_IMPORTED_MODULE_0__.IterUtils.distinctBy(allRules, x => x instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SetStatement ? x.left.convertToString() : x.convertToString());
82458
+ 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());
82536
82459
  const allUniqueRulesWithOptionalChecks = Iterator.from(optionalSectionRulesBuilder.wrapRulesWithOptionalPageCheck(allUniqueRules)).map(x => x.convertToString()).reduce((x, y) => x + (x ? "\n" : "") + y, "");
82537
82460
  return allUniqueRulesWithOptionalChecks;
82538
82461
  }
82539
82462
  function tryExtractValueReferenceAsStringFromDecimal(expression) {
82540
- if (expression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal && expression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression && expression.targetExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.ValueReferenceExpression) {
82463
+ 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) {
82541
82464
  return expression.targetExpression;
82542
82465
  }
82543
82466
  return expression;
82544
82467
  }
82545
82468
  function castOperandToStringIfNeed(operandExpression, decimalFormat = "G29") {
82546
- if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateNowExpression) {
82547
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression("dd.MM.yyyy"));
82469
+ if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateTimeExpression || operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateNowExpression) {
82470
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.DateToStringExpression(operandExpression, new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.StringLiteralExpression("dd.MM.yyyy"));
82548
82471
  }
82549
- if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.HashSetExpression) {
82550
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.SerializeEnumerationExpression(operandExpression);
82472
+ if (operandExpression instanceof _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.HashSetExpression) {
82473
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.SerializeEnumerationExpression(operandExpression);
82551
82474
  }
82552
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.string ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.string, decimalFormat != undefined && operandExpression.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.StringLiteralExpression(decimalFormat) : undefined) : operandExpression;
82475
+ 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;
82553
82476
  }
82554
82477
  function castOperandToBoolIfNeed(operandExpression) {
82555
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.bool ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.bool) : operandExpression;
82478
+ 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;
82556
82479
  }
82557
82480
  function castOperandToDecimalIfNeed(operandExpression, defaultValue) {
82558
- return operandExpression.getType() !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal, defaultValue != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.DecimalLiteralExpression(defaultValue) : undefined) : operandExpression;
82481
+ 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;
82559
82482
  }
82560
- const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.decimal) : ex;
82483
+ const decimalWrapper = (ex, needWrapped) => needWrapped ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.CastExpression(ex, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.decimal) : ex;
82561
82484
  function castOperandToDateTimeIfNeed(operandExpression) {
82562
- return operandExpression.getType() != _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.dateTime ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.CastExpression(operandExpression, _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.dateTime) : operandExpression;
82485
+ 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;
82563
82486
  }
82564
82487
  function nullCoalesceWithTypeCheck(argument, replacement) {
82565
- const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null;
82488
+ const isValid = argument.getType() === replacement.getType() || argument.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null || replacement.getType() === _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null;
82566
82489
  if (!isValid) {
82567
82490
  throw new Error("Couldn't build null coalesce expression: types not match");
82568
82491
  }
82569
- return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.NullCoalesceExpression(argument, replacement);
82492
+ return new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.NullCoalesceExpression(argument, replacement);
82570
82493
  }
82571
82494
  function ensureOperandsOfTypeOrNull(type, ...operands) {
82572
82495
  for (const operand of operands) {
82573
82496
  const operandType = operand.getType();
82574
- if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.BuildInTypeExpression.null && operandType !== type) {
82497
+ if (operandType !== _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.BuildInTypeExpression.null && operandType !== type) {
82575
82498
  throw new Error(`Invalid operand type: required [${type}] but got ${operandType}`);
82576
82499
  }
82577
82500
  }
82578
82501
  }
82579
82502
  function combineByOrFlangExpr(acc, current) {
82580
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.OrBinaryExpression(acc, current) : current;
82503
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.OrBinaryExpression(acc, current) : current;
82581
82504
  }
82582
82505
  function combineByAndFlangExpr(acc, current) {
82583
- return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_1__.AndBinaryExpression(acc, current) : current;
82506
+ return acc != undefined ? new _FLangCodeDom__WEBPACK_IMPORTED_MODULE_2__.AndBinaryExpression(acc, current) : current;
82584
82507
  }
82585
82508
 
82586
82509
  /***/ }),
@@ -82856,7 +82779,7 @@ class FormulaExpressionToFlangExpressionConverter {
82856
82779
  const thenExpr = this.compileExpressionToFlangExpressionInternal(expression.thenNode.expression, prefix, target, addPrecalculationRule);
82857
82780
  const elseExpr = this.compileExpressionToFlangExpressionInternal(expression.elseNode.expression, prefix, target, addPrecalculationRule);
82858
82781
  const castToStringRequired = thenExpr.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.string || elseExpr.getType() === _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.BuildInTypeExpression.string;
82859
- return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.TernaryConditionalExpression(condExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(thenExpr) : thenExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(elseExpr) : elseExpr);
82782
+ return new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ConditionalExpression(condExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(thenExpr) : thenExpr, castToStringRequired ? (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.castOperandToStringIfNeed)(elseExpr) : elseExpr);
82860
82783
  }
82861
82784
  if (expression instanceof _AutoCalculationsGenerator_AutoCalculationsFromFormulas_KCXmlContract_Formula__WEBPACK_IMPORTED_MODULE_0__.FormulaMultiplyExpression) {
82862
82785
  return this.compileMultiplyExpression(expression, prefix, target, addPrecalculationRule);
@@ -83170,7 +83093,7 @@ class FormulaExpressionToFlangExpressionConverter {
83170
83093
  if (result == undefined) {
83171
83094
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83172
83095
  }
83173
- return result;
83096
+ return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83174
83097
  }
83175
83098
  compileConcatExpression(expression, prefix, target, addPrecalculationRule) {
83176
83099
  const result = expression.arguments.reduce((acc, curr) => {
@@ -83210,7 +83133,7 @@ class FormulaExpressionToFlangExpressionConverter {
83210
83133
  if (result == undefined) {
83211
83134
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83212
83135
  }
83213
- return result;
83136
+ return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83214
83137
  }
83215
83138
  compileDivisionExpression(expression, prefix, target, addPrecalculationRule) {
83216
83139
  const makeDivision = (numerator, denominator) => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.ConditionalExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.NotEqExpression(denominator, new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DecimalLiteralExpression(0)), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.DivisionBinaryExpression(numerator, denominator), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_8__.NullLiteralExpression());
@@ -83221,7 +83144,7 @@ class FormulaExpressionToFlangExpressionConverter {
83221
83144
  if (result == undefined) {
83222
83145
  throw new _Common_Errors__WEBPACK_IMPORTED_MODULE_2__.InvalidProgramStateError();
83223
83146
  }
83224
- return result;
83147
+ return (0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_7__.wrapWithArgumentsCondition)(result);
83225
83148
  }
83226
83149
  preparePathAndAdjustMultiplicity(prefix, path) {
83227
83150
  const resultPath = this.adjustPathMultiplicity(prefix.joinWith((0,_Common_ModelPath_ModelPath__WEBPACK_IMPORTED_MODULE_1__.createModelPath)(path.replace(/\@/g, ""), false)).normalize());
@@ -83285,7 +83208,7 @@ class FormulaOnlyNormalizationRuleGenerator {
83285
83208
  const defaultValue = this.dataDeclarationHelper.getDefaultValue(fullTarget.toLegacyPath());
83286
83209
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83287
83210
  const result = [];
83288
- const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.StringLiteralExpression(defaultValue));
83211
+ const getFormulaExpression = field => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.NullCoalesceExpression((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.wrapWithArgumentsCondition)((0,_FLang_FlangUtils__WEBPACK_IMPORTED_MODULE_5__.castOperandToStringIfNeed)(this.formulaExprConverter.compileExpressionToFlangExpression(formula.expression, prefix, new _Common_ModelPath_AbsoluteModelFieldPath__WEBPACK_IMPORTED_MODULE_3__.AbsoluteModelFieldPath(fullTarget, field), x => precalculationRules.push(x)), "G29")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.StringLiteralExpression(defaultValue));
83289
83212
  if (isTargetAutoField) {
83290
83213
  result.push(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "autoValue"), getFormulaExpression("autoValue")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "value"), getFormulaExpression("value")), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.SetStatement(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget, "autoFlag"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.CastExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.IsEqualsBinaryExpression(new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "value"), new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.ValueReferenceExpression(fullTarget.toCurrentIteration(), "autoValue")), _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_4__.BuildInTypeExpression.string)));
83291
83214
  } else {
@@ -83473,7 +83396,7 @@ class FormulaRulesBuilder extends _BaseRuleBuilder__WEBPACK_IMPORTED_MODULE_6__.
83473
83396
  const isTargetAutoField = this.dataDeclarationHelper.isNodeHasAutoFlagEntry(fullTarget.toAbsolute());
83474
83397
  const isDisabled = this.dataDeclarationHelper.isNodeHasDisabledEntry(fullTarget.toAbsolute());
83475
83398
  const isDecimal = ((_this$formSchemaRng$g = this.formSchemaRng.getTypeNodeByPath(fullTarget.toAbsolute())) === null || _this$formSchemaRng$g === void 0 ? void 0 : _this$formSchemaRng$g.baseType) === "decimal";
83476
- const getFormulaExpression = targetField => new _FLang_FLangCodeDom__WEBPACK_IMPORTED_MODULE_0__.NullCoalesceExpression((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));
83399
+ 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));
83477
83400
  const valueRule = isTargetAutoField ? isDisabled ? this.createValueRuleForDisabledAutoField(fullTarget, getFormulaExpression) : this.createValueRuleForAutoField(fullTarget, defaultValue, getFormulaExpression) : this.createRegularValueRule(fullTarget, getFormulaExpression);
83478
83401
  const autoValueRule = isTargetAutoField ? this.createAutoValueRule(fullTarget, getFormulaExpression) : undefined;
83479
83402
  const autoFlagRule = isTargetAutoField ? this.createAutoFlagRule(fullTarget, isDecimal) : undefined;