@kontur.candy/generator 6.29.0 → 6.30.0-kclang-force-validation.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.
- package/dist/index.js +44 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -168919,11 +168919,16 @@ class KCLangCalculationsBuildContext {
|
|
|
168919
168919
|
var _typeNode$base, _typeNode$description;
|
|
168920
168920
|
const baseName = (_typeNode$base = typeNode === null || typeNode === void 0 ? void 0 : typeNode.base) !== null && _typeNode$base !== void 0 ? _typeNode$base : schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType;
|
|
168921
168921
|
const baseDescription = (_typeNode$description = typeNode === null || typeNode === void 0 ? void 0 : typeNode.description) !== null && _typeNode$description !== void 0 ? _typeNode$description : schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description;
|
|
168922
|
+
const isForced = checkNode => {
|
|
168923
|
+
var _typeNode$isNodeForce;
|
|
168924
|
+
return (_typeNode$isNodeForce = typeNode === null || typeNode === void 0 ? void 0 : typeNode.isNodeForced(checkNode)) !== null && _typeNode$isNodeForce !== void 0 ? _typeNode$isNodeForce : false;
|
|
168925
|
+
};
|
|
168922
168926
|
const valueChecks = [];
|
|
168923
168927
|
if (baseName != undefined) {
|
|
168924
168928
|
valueChecks.push(...Iterator.from(this.createBaseTypeValidation(targetPath, baseName, (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_38__.omitLocalization)(baseDescription), node)).toArray());
|
|
168925
168929
|
}
|
|
168926
|
-
valueChecks.push(...Iterator.from(this.createTypeValidations(targetPath, typeNode, schemaTypeNode, nodeGId)).toArray());
|
|
168930
|
+
valueChecks.push(...Iterator.from(this.createTypeValidations(targetPath, typeNode, schemaTypeNode, n => !isForced(n), true, nodeGId)).toArray());
|
|
168931
|
+
const forcedValueChecks = Iterator.from(this.createTypeValidations(targetPath, typeNode, schemaTypeNode, n => isForced(n), false, nodeGId)).toArray();
|
|
168927
168932
|
const schemaNode = this.schemaRng.getElementByPath(targetFullPath);
|
|
168928
168933
|
if (!optional) {
|
|
168929
168934
|
var _ref, _ref2, _ref3, _ref4, _allChildrenPaths$len, _allChildrenPaths, _allChildrenPaths2;
|
|
@@ -168962,6 +168967,7 @@ class KCLangCalculationsBuildContext {
|
|
|
168962
168967
|
}
|
|
168963
168968
|
}
|
|
168964
168969
|
yield new _common_KCLang_CodeDom_IfStatement__WEBPACK_IMPORTED_MODULE_16__.IfStatement(new _common_KCLang_CodeDom_AndExpression__WEBPACK_IMPORTED_MODULE_4__.AndExpression(new _common_KCLang_CodeDom_Functions_ExistsFunctionCall__WEBPACK_IMPORTED_MODULE_10__.ExistsFunctionCall(new _common_KCLang_CodeDom_ValueReferenceExpression__WEBPACK_IMPORTED_MODULE_26__.ValueReferenceExpression(_common_KCLang_CodeDom_KCLangPath__WEBPACK_IMPORTED_MODULE_17__.KCLangPath.fromModelPath(targetPath, true))), new _common_KCLang_CodeDom_NotEqExpression__WEBPACK_IMPORTED_MODULE_20__.NotEqExpression(new _common_KCLang_CodeDom_CastExpression__WEBPACK_IMPORTED_MODULE_5__.CastExpression(new _common_KCLang_CodeDom_ValueReferenceExpression__WEBPACK_IMPORTED_MODULE_26__.ValueReferenceExpression(_common_KCLang_CodeDom_KCLangPath__WEBPACK_IMPORTED_MODULE_17__.KCLangPath.fromModelPath(targetPath, true)), _common_KCLang_CodeDom_KCLangType__WEBPACK_IMPORTED_MODULE_18__.StringType.default), new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression(""))), valueChecks);
|
|
168970
|
+
yield* forcedValueChecks;
|
|
168965
168971
|
}
|
|
168966
168972
|
getFirstAcceptedParent(schemaNode) {
|
|
168967
168973
|
let parentNode = schemaNode === null || schemaNode === void 0 ? void 0 : schemaNode.parent;
|
|
@@ -168988,11 +168994,15 @@ class KCLangCalculationsBuildContext {
|
|
|
168988
168994
|
}
|
|
168989
168995
|
return new _common_KCLang_CodeDom_CheckStatement__WEBPACK_IMPORTED_MODULE_6__.CheckStatement(condition, withBlocks);
|
|
168990
168996
|
}
|
|
168991
|
-
*createTypeValidations(targetPath, typeNode, schemaTypeNode, nodeGId) {
|
|
168992
|
-
var _typeNode$
|
|
168997
|
+
*createTypeValidations(targetPath, typeNode, schemaTypeNode, nodeFilter, includeSchemaConstraints, nodeGId) {
|
|
168998
|
+
var _typeNode$flattenType, _typeNode$checkType, _schema$enumeration, _digest$gId, _typeNodeLength$value, _typeNodeMinLength$va, _typeNodeMaxLength$va, _typeNodeMinInclusive, _typeNodeMinExclusive, _typeNodeMaxInclusive, _typeNodeMaxExclusive, _typeNodeTotalDigits$, _patternNodes$, _patternNodes$0$check, _patternNodes$2, _schema$patterns, _typeNodeInteger$valu, _typeNodeFractional$v, _ref10, _findCheck$level, _findCheck, _findCheck2, _typeNode$base2;
|
|
168999
|
+
const typeCheckNodes = ((_typeNode$flattenType = typeNode === null || typeNode === void 0 ? void 0 : typeNode.flattenTypeCheckNodes()) !== null && _typeNode$flattenType !== void 0 ? _typeNode$flattenType : []).filter(nodeFilter);
|
|
169000
|
+
const findCheck = cl => typeCheckNodes.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(cl));
|
|
169001
|
+
const filterChecks = cl => typeCheckNodes.filter((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(cl));
|
|
169002
|
+
const schema = includeSchemaConstraints ? schemaTypeNode : undefined;
|
|
168993
169003
|
const checkType = (_typeNode$checkType = typeNode === null || typeNode === void 0 ? void 0 : typeNode.checkType) !== null && _typeNode$checkType !== void 0 ? _typeNode$checkType : "error";
|
|
168994
|
-
const typeNodeEnumerations = (
|
|
168995
|
-
const enumerationItems = (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.arrayIsNotEmpty)(typeNodeEnumerations) ? typeNodeEnumerations : (
|
|
169004
|
+
const typeNodeEnumerations = filterChecks(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.EnumerationTypeCheckNode).map(x => x.value);
|
|
169005
|
+
const enumerationItems = (0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.arrayIsNotEmpty)(typeNodeEnumerations) ? typeNodeEnumerations : (_schema$enumeration = schema === null || schema === void 0 ? void 0 : schema.enumeration) !== null && _schema$enumeration !== void 0 ? _schema$enumeration : [];
|
|
168996
169006
|
const makeMessage = (constraints, sugarTypeCheckDescription, sugarTypeDescription, schemaTypeDescription) => {
|
|
168997
169007
|
var _ref5, _ref6, _ref7, _omitLocalization;
|
|
168998
169008
|
return (_ref5 = (_ref6 = (_ref7 = (_omitLocalization = (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_38__.omitLocalization)(sugarTypeCheckDescription)) !== null && _omitLocalization !== void 0 ? _omitLocalization : (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_38__.omitLocalization)(sugarTypeDescription)) !== null && _ref7 !== void 0 ? _ref7 : (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_38__.omitLocalization)(schemaTypeDescription)) !== null && _ref6 !== void 0 ? _ref6 : _common_SchemaRng_StringTypeMessageGenerator__WEBPACK_IMPORTED_MODULE_30__.StringTypeMessageGenerator.generate(constraints !== null && constraints !== void 0 ? constraints : {})) !== null && _ref5 !== void 0 ? _ref5 : "Поле должно быть заполнено";
|
|
@@ -169004,7 +169014,7 @@ class KCLangCalculationsBuildContext {
|
|
|
169004
169014
|
enumerationAllowedValues: enumerationItems
|
|
169005
169015
|
}, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169006
169016
|
}
|
|
169007
|
-
const digest =
|
|
169017
|
+
const digest = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.DigestcheckTypeCheckNode);
|
|
169008
169018
|
const gId = (_digest$gId = digest === null || digest === void 0 ? void 0 : digest.gId) !== null && _digest$gId !== void 0 ? _digest$gId : nodeGId;
|
|
169009
169019
|
if ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrEmpty)(gId) && digest != undefined) {
|
|
169010
169020
|
var _digest$keyColumnName, _digest$keyColumnName2, _ref8, _digest$description, _ref9, _digest$checkType;
|
|
@@ -169012,8 +169022,8 @@ class KCLangCalculationsBuildContext {
|
|
|
169012
169022
|
const ruleBody = new _common_KCLang_CodeDom_OrExpression__WEBPACK_IMPORTED_MODULE_23__.OrExpression(new _common_KCLang_CodeDom_OrExpression__WEBPACK_IMPORTED_MODULE_23__.OrExpression(new _common_KCLang_CodeDom_NotExpression__WEBPACK_IMPORTED_MODULE_21__.NotExpression(new _common_KCLang_CodeDom_Functions_ExistsFunctionCall__WEBPACK_IMPORTED_MODULE_10__.ExistsFunctionCall(valueReferenceExpression)), new _common_KCLang_CodeDom_EqExpression__WEBPACK_IMPORTED_MODULE_9__.EqExpression(stringValueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression(""))), new _common_KCLang_CodeDom_NotEqExpression__WEBPACK_IMPORTED_MODULE_20__.NotEqExpression(new _common_KCLang_CodeDom_Functions_JoinFunctionCall__WEBPACK_IMPORTED_MODULE_12__.JoinFunctionCall(new _common_KCLang_CodeDom_Functions_GetPicklistValuesFunctionCall__WEBPACK_IMPORTED_MODULE_11__.GetPicklistValuesFunctionCall(new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression(gId), new _common_KCLang_CodeDom_StringArrayConstExpression__WEBPACK_IMPORTED_MODULE_24__.StringArrayConstExpression([new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression((_digest$keyColumnName = digest.keyColumnName) !== null && _digest$keyColumnName !== void 0 ? _digest$keyColumnName : "code")]), new _common_KCLang_CodeDom_StringArrayConstExpression__WEBPACK_IMPORTED_MODULE_24__.StringArrayConstExpression([stringValueReference]), new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression((_digest$keyColumnName2 = digest.keyColumnName) !== null && _digest$keyColumnName2 !== void 0 ? _digest$keyColumnName2 : "code"))), new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression("")));
|
|
169013
169023
|
yield this.createCheck(targetPath, ruleBody, (0,_Serializer_SugarSerializer__WEBPACK_IMPORTED_MODULE_38__.omitLocalization)((_ref8 = (_digest$description = digest.description) !== null && _digest$description !== void 0 ? _digest$description : typeNode === null || typeNode === void 0 ? void 0 : typeNode.description) !== null && _ref8 !== void 0 ? _ref8 : "Поле заполнено не по справочнику"), (_ref9 = (_digest$checkType = digest.checkType) !== null && _digest$checkType !== void 0 ? _digest$checkType : typeNode === null || typeNode === void 0 ? void 0 : typeNode.checkType) !== null && _ref9 !== void 0 ? _ref9 : "error");
|
|
169014
169024
|
}
|
|
169015
|
-
const typeNodeLength =
|
|
169016
|
-
const lengthValue = (_typeNodeLength$value = typeNodeLength === null || typeNodeLength === void 0 ? void 0 : typeNodeLength.value) !== null && _typeNodeLength$value !== void 0 ? _typeNodeLength$value :
|
|
169025
|
+
const typeNodeLength = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.LengthTypeCheckNode);
|
|
169026
|
+
const lengthValue = (_typeNodeLength$value = typeNodeLength === null || typeNodeLength === void 0 ? void 0 : typeNodeLength.value) !== null && _typeNodeLength$value !== void 0 ? _typeNodeLength$value : schema === null || schema === void 0 ? void 0 : schema.length;
|
|
169017
169027
|
if (lengthValue != undefined) {
|
|
169018
169028
|
var _typeNodeLength$check;
|
|
169019
169029
|
yield this.createCheck(targetPath, new _common_KCLang_CodeDom_EqExpression__WEBPACK_IMPORTED_MODULE_9__.EqExpression(new _common_KCLang_CodeDom_Functions_LengthFunctionCall__WEBPACK_IMPORTED_MODULE_13__.LengthFunctionCall(stringValueReference), new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(lengthValue)), makeMessage({
|
|
@@ -169022,10 +169032,10 @@ class KCLangCalculationsBuildContext {
|
|
|
169022
169032
|
}
|
|
169023
169033
|
const valueReference = stringValueReference;
|
|
169024
169034
|
const decimalValueReference = valueReferenceExpression;
|
|
169025
|
-
const typeNodeMinLength =
|
|
169026
|
-
const minLengthValue = (_typeNodeMinLength$va = typeNodeMinLength === null || typeNodeMinLength === void 0 ? void 0 : typeNodeMinLength.value) !== null && _typeNodeMinLength$va !== void 0 ? _typeNodeMinLength$va :
|
|
169027
|
-
const typeNodeMaxLength =
|
|
169028
|
-
const maxLengthValue = (_typeNodeMaxLength$va = typeNodeMaxLength === null || typeNodeMaxLength === void 0 ? void 0 : typeNodeMaxLength.value) !== null && _typeNodeMaxLength$va !== void 0 ? _typeNodeMaxLength$va :
|
|
169035
|
+
const typeNodeMinLength = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MinlengthTypeCheckNode);
|
|
169036
|
+
const minLengthValue = (_typeNodeMinLength$va = typeNodeMinLength === null || typeNodeMinLength === void 0 ? void 0 : typeNodeMinLength.value) !== null && _typeNodeMinLength$va !== void 0 ? _typeNodeMinLength$va : schema === null || schema === void 0 ? void 0 : schema.minLength;
|
|
169037
|
+
const typeNodeMaxLength = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MaxlengthTypeCheckNode);
|
|
169038
|
+
const maxLengthValue = (_typeNodeMaxLength$va = typeNodeMaxLength === null || typeNodeMaxLength === void 0 ? void 0 : typeNodeMaxLength.value) !== null && _typeNodeMaxLength$va !== void 0 ? _typeNodeMaxLength$va : schema === null || schema === void 0 ? void 0 : schema.maxLength;
|
|
169029
169039
|
if (minLengthValue != undefined && maxLengthValue != undefined) {
|
|
169030
169040
|
var _typeNodeMinLength$de;
|
|
169031
169041
|
const lengthExprRuleBody = new _common_KCLang_CodeDom_AndExpression__WEBPACK_IMPORTED_MODULE_4__.AndExpression(new _common_KCLang_CodeDom_GeExpression__WEBPACK_IMPORTED_MODULE_15__.GeExpression(new _common_KCLang_CodeDom_Functions_LengthFunctionCall__WEBPACK_IMPORTED_MODULE_13__.LengthFunctionCall(valueReference), new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(minLengthValue)), new _common_KCLang_CodeDom_LeExpression__WEBPACK_IMPORTED_MODULE_19__.LeExpression(new _common_KCLang_CodeDom_Functions_LengthFunctionCall__WEBPACK_IMPORTED_MODULE_13__.LengthFunctionCall(valueReference), new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(maxLengthValue)));
|
|
@@ -169044,32 +169054,32 @@ class KCLangCalculationsBuildContext {
|
|
|
169044
169054
|
maxLength: maxLengthValue
|
|
169045
169055
|
}, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169046
169056
|
}
|
|
169047
|
-
const typeNodeMinInclusive =
|
|
169048
|
-
const minInclusiveValue = (_typeNodeMinInclusive = typeNodeMinInclusive === null || typeNodeMinInclusive === void 0 ? void 0 : typeNodeMinInclusive.value) !== null && _typeNodeMinInclusive !== void 0 ? _typeNodeMinInclusive :
|
|
169057
|
+
const typeNodeMinInclusive = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MininclusiveTypeCheckNode);
|
|
169058
|
+
const minInclusiveValue = (_typeNodeMinInclusive = typeNodeMinInclusive === null || typeNodeMinInclusive === void 0 ? void 0 : typeNodeMinInclusive.value) !== null && _typeNodeMinInclusive !== void 0 ? _typeNodeMinInclusive : schema === null || schema === void 0 ? void 0 : schema.minInclusive;
|
|
169049
169059
|
if (minInclusiveValue != undefined) {
|
|
169050
169060
|
const minInclusiveRuleBody = new _common_KCLang_CodeDom_GeExpression__WEBPACK_IMPORTED_MODULE_15__.GeExpression(decimalValueReference, new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(minInclusiveValue));
|
|
169051
169061
|
yield this.createCheck(targetPath, minInclusiveRuleBody, makeMessage({
|
|
169052
169062
|
minInclusive: minInclusiveValue
|
|
169053
169063
|
}, typeNodeMinInclusive === null || typeNodeMinInclusive === void 0 ? void 0 : typeNodeMinInclusive.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169054
169064
|
}
|
|
169055
|
-
const typeNodeMinExclusive =
|
|
169056
|
-
const minExclusiveValue = (_typeNodeMinExclusive = typeNodeMinExclusive === null || typeNodeMinExclusive === void 0 ? void 0 : typeNodeMinExclusive.value) !== null && _typeNodeMinExclusive !== void 0 ? _typeNodeMinExclusive :
|
|
169065
|
+
const typeNodeMinExclusive = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MinExclusiveTypeCheckNode);
|
|
169066
|
+
const minExclusiveValue = (_typeNodeMinExclusive = typeNodeMinExclusive === null || typeNodeMinExclusive === void 0 ? void 0 : typeNodeMinExclusive.value) !== null && _typeNodeMinExclusive !== void 0 ? _typeNodeMinExclusive : schema === null || schema === void 0 ? void 0 : schema.minExclusive;
|
|
169057
169067
|
if (minExclusiveValue != undefined) {
|
|
169058
169068
|
const minExclusiveRuleBody = new _common_KCLang_CodeDom_GtExpression__WEBPACK_IMPORTED_MODULE_35__.GtExpression(decimalValueReference, new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(minExclusiveValue));
|
|
169059
169069
|
yield this.createCheck(targetPath, minExclusiveRuleBody, makeMessage({
|
|
169060
169070
|
minExclusive: minExclusiveValue
|
|
169061
169071
|
}, typeNodeMinExclusive === null || typeNodeMinExclusive === void 0 ? void 0 : typeNodeMinExclusive.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169062
169072
|
}
|
|
169063
|
-
const typeNodeMaxInclusive =
|
|
169064
|
-
const maxInclusiveValue = (_typeNodeMaxInclusive = typeNodeMaxInclusive === null || typeNodeMaxInclusive === void 0 ? void 0 : typeNodeMaxInclusive.value) !== null && _typeNodeMaxInclusive !== void 0 ? _typeNodeMaxInclusive :
|
|
169073
|
+
const typeNodeMaxInclusive = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MaxinclusiveTypeCheckNode);
|
|
169074
|
+
const maxInclusiveValue = (_typeNodeMaxInclusive = typeNodeMaxInclusive === null || typeNodeMaxInclusive === void 0 ? void 0 : typeNodeMaxInclusive.value) !== null && _typeNodeMaxInclusive !== void 0 ? _typeNodeMaxInclusive : schema === null || schema === void 0 ? void 0 : schema.maxInclusive;
|
|
169065
169075
|
if (maxInclusiveValue != undefined) {
|
|
169066
169076
|
const maxInclusiveRuleBody = new _common_KCLang_CodeDom_LeExpression__WEBPACK_IMPORTED_MODULE_19__.LeExpression(decimalValueReference, new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(maxInclusiveValue));
|
|
169067
169077
|
yield this.createCheck(targetPath, maxInclusiveRuleBody, makeMessage({
|
|
169068
169078
|
maxInclusive: maxInclusiveValue
|
|
169069
169079
|
}, typeNodeMaxInclusive === null || typeNodeMaxInclusive === void 0 ? void 0 : typeNodeMaxInclusive.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169070
169080
|
}
|
|
169071
|
-
const typeNodeMaxExclusive =
|
|
169072
|
-
const maxExclusiveValue = (_typeNodeMaxExclusive = typeNodeMaxExclusive === null || typeNodeMaxExclusive === void 0 ? void 0 : typeNodeMaxExclusive.value) !== null && _typeNodeMaxExclusive !== void 0 ? _typeNodeMaxExclusive :
|
|
169081
|
+
const typeNodeMaxExclusive = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.MaxExclusiveTypeCheckNode);
|
|
169082
|
+
const maxExclusiveValue = (_typeNodeMaxExclusive = typeNodeMaxExclusive === null || typeNodeMaxExclusive === void 0 ? void 0 : typeNodeMaxExclusive.value) !== null && _typeNodeMaxExclusive !== void 0 ? _typeNodeMaxExclusive : schema === null || schema === void 0 ? void 0 : schema.maxExclusive;
|
|
169073
169083
|
if (maxExclusiveValue != undefined) {
|
|
169074
169084
|
const maxExclusiveRuleBody = new _common_KCLang_CodeDom_LtExpression__WEBPACK_IMPORTED_MODULE_36__.LtExpression(decimalValueReference, new _common_KCLang_CodeDom_DecimalConstExpression__WEBPACK_IMPORTED_MODULE_7__.DecimalConstExpression(maxExclusiveValue));
|
|
169075
169085
|
yield this.createCheck(targetPath, maxExclusiveRuleBody, makeMessage({
|
|
@@ -169077,18 +169087,19 @@ class KCLangCalculationsBuildContext {
|
|
|
169077
169087
|
}, typeNodeMaxExclusive === null || typeNodeMaxExclusive === void 0 ? void 0 : typeNodeMaxExclusive.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType);
|
|
169078
169088
|
}
|
|
169079
169089
|
const isDecimalCondition = new _common_KCLang_CodeDom_Functions_RegexMatchFunctionCall__WEBPACK_IMPORTED_MODULE_14__.RegexMatchFunctionCall(valueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression("^-?\\d+(([.]\\d+$)|($))"));
|
|
169080
|
-
const typeNodeTotalDigits =
|
|
169081
|
-
const totalDigitsValue = (_typeNodeTotalDigits$ = typeNodeTotalDigits === null || typeNodeTotalDigits === void 0 ? void 0 : typeNodeTotalDigits.value) !== null && _typeNodeTotalDigits$ !== void 0 ? _typeNodeTotalDigits$ :
|
|
169090
|
+
const typeNodeTotalDigits = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.TotaldigitsTypeCheckNode);
|
|
169091
|
+
const totalDigitsValue = (_typeNodeTotalDigits$ = typeNodeTotalDigits === null || typeNodeTotalDigits === void 0 ? void 0 : typeNodeTotalDigits.value) !== null && _typeNodeTotalDigits$ !== void 0 ? _typeNodeTotalDigits$ : schema === null || schema === void 0 ? void 0 : schema.totalDigits;
|
|
169082
169092
|
if (totalDigitsValue != undefined) {
|
|
169083
169093
|
const totalDigitsRuleBody = new _common_KCLang_CodeDom_Functions_RegexMatchFunctionCall__WEBPACK_IMPORTED_MODULE_14__.RegexMatchFunctionCall(valueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression("^-?(\\.?\\d){0," + totalDigitsValue.toString() + "}$"));
|
|
169084
169094
|
yield new _common_KCLang_CodeDom_IfStatement__WEBPACK_IMPORTED_MODULE_16__.IfStatement(isDecimalCondition, [this.createCheck(targetPath, totalDigitsRuleBody, makeMessage({
|
|
169085
169095
|
totalDigitsMaxCount: totalDigitsValue
|
|
169086
169096
|
}, typeNodeTotalDigits === null || typeNodeTotalDigits === void 0 ? void 0 : typeNodeTotalDigits.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType)]);
|
|
169087
169097
|
}
|
|
169088
|
-
const
|
|
169089
|
-
const
|
|
169090
|
-
const
|
|
169091
|
-
const
|
|
169098
|
+
const patternNodes = filterChecks(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.PatternTypeCheckNode);
|
|
169099
|
+
const typeNodePatterns = patternNodes.map(x => x.value).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrUndefined);
|
|
169100
|
+
const firstItemDescription = (_patternNodes$ = patternNodes[0]) === null || _patternNodes$ === void 0 ? void 0 : _patternNodes$.description;
|
|
169101
|
+
const firstItemCheckType = (_patternNodes$0$check = (_patternNodes$2 = patternNodes[0]) === null || _patternNodes$2 === void 0 ? void 0 : _patternNodes$2.checkType) !== null && _patternNodes$0$check !== void 0 ? _patternNodes$0$check : checkType;
|
|
169102
|
+
const stringPatterns = ((0,_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.arrayIsNotEmpty)(typeNodePatterns) ? typeNodePatterns : (_schema$patterns = schema === null || schema === void 0 ? void 0 : schema.patterns) !== null && _schema$patterns !== void 0 ? _schema$patterns : []).filter(_Common_TypingUtils__WEBPACK_IMPORTED_MODULE_3__.isNotNullOrUndefined);
|
|
169092
169103
|
const patterns = stringPatterns.map(pattern => new _common_KCLang_CodeDom_Functions_RegexMatchFunctionCall__WEBPACK_IMPORTED_MODULE_14__.RegexMatchFunctionCall(valueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression(pattern))).reduce((acc, current) => acc != undefined ? new _common_KCLang_CodeDom_OrExpression__WEBPACK_IMPORTED_MODULE_23__.OrExpression(acc, current) : current, undefined);
|
|
169093
169104
|
if (patterns != undefined) {
|
|
169094
169105
|
const stringPatternsRuleBody = patterns;
|
|
@@ -169096,30 +169107,28 @@ class KCLangCalculationsBuildContext {
|
|
|
169096
169107
|
patterns: stringPatterns
|
|
169097
169108
|
}, firstItemDescription, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), firstItemCheckType);
|
|
169098
169109
|
}
|
|
169099
|
-
const typeNodeInteger =
|
|
169100
|
-
const integerDigits = (_typeNodeInteger$valu = typeNodeInteger === null || typeNodeInteger === void 0 ? void 0 : typeNodeInteger.value) !== null && _typeNodeInteger$valu !== void 0 ? _typeNodeInteger$valu :
|
|
169110
|
+
const typeNodeInteger = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.IntegerdigitsTypeCheckNode);
|
|
169111
|
+
const integerDigits = (_typeNodeInteger$valu = typeNodeInteger === null || typeNodeInteger === void 0 ? void 0 : typeNodeInteger.value) !== null && _typeNodeInteger$valu !== void 0 ? _typeNodeInteger$valu : schema === null || schema === void 0 ? void 0 : schema.integerDigits;
|
|
169101
169112
|
if (integerDigits != undefined) {
|
|
169102
169113
|
const integerDigitsRuleBody = new _common_KCLang_CodeDom_Functions_RegexMatchFunctionCall__WEBPACK_IMPORTED_MODULE_14__.RegexMatchFunctionCall(valueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression("^-?\\d{0," + integerDigits.toString() + "}(([.]\\d+$)|($))"));
|
|
169103
169114
|
yield new _common_KCLang_CodeDom_IfStatement__WEBPACK_IMPORTED_MODULE_16__.IfStatement(isDecimalCondition, [this.createCheck(targetPath, integerDigitsRuleBody, makeMessage({
|
|
169104
169115
|
integerDigitsMaxCount: integerDigits
|
|
169105
169116
|
}, typeNodeInteger === null || typeNodeInteger === void 0 ? void 0 : typeNodeInteger.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType)]);
|
|
169106
169117
|
}
|
|
169107
|
-
const typeNodeFractional =
|
|
169108
|
-
const fractionalDigits = (_typeNodeFractional$v = typeNodeFractional === null || typeNodeFractional === void 0 ? void 0 : typeNodeFractional.value) !== null && _typeNodeFractional$v !== void 0 ? _typeNodeFractional$v :
|
|
169118
|
+
const typeNodeFractional = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.FractiondigitsTypeCheckNode);
|
|
169119
|
+
const fractionalDigits = (_typeNodeFractional$v = typeNodeFractional === null || typeNodeFractional === void 0 ? void 0 : typeNodeFractional.value) !== null && _typeNodeFractional$v !== void 0 ? _typeNodeFractional$v : schema === null || schema === void 0 ? void 0 : schema.fractionDigits;
|
|
169109
169120
|
if (fractionalDigits != undefined) {
|
|
169110
169121
|
const fractionalDigitsRuleBody = new _common_KCLang_CodeDom_Functions_RegexMatchFunctionCall__WEBPACK_IMPORTED_MODULE_14__.RegexMatchFunctionCall(valueReference, new _common_KCLang_CodeDom_StringConstExpression__WEBPACK_IMPORTED_MODULE_25__.StringConstExpression("^-?\\d+(([.]\\d{0," + fractionalDigits.toString() + "}$)|($))"));
|
|
169111
169122
|
yield new _common_KCLang_CodeDom_IfStatement__WEBPACK_IMPORTED_MODULE_16__.IfStatement(isDecimalCondition, [this.createCheck(targetPath, fractionalDigitsRuleBody, makeMessage({
|
|
169112
169123
|
fractionalDigitsMaxCount: fractionalDigits
|
|
169113
169124
|
}, typeNodeFractional === null || typeNodeFractional === void 0 ? void 0 : typeNodeFractional.description, typeNode === null || typeNode === void 0 ? void 0 : typeNode.description, schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.description), checkType)]);
|
|
169114
169125
|
}
|
|
169115
|
-
const valueEqlAutoValueErrorLevel = (_ref10 = (
|
|
169126
|
+
const valueEqlAutoValueErrorLevel = (_ref10 = (_findCheck$level = (_findCheck = findCheck(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_29__.ValueEqlAutoValueTypeCheck)) === null || _findCheck === void 0 ? void 0 : _findCheck.level) !== null && _findCheck$level !== void 0 ? _findCheck$level : (_findCheck2 = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ValueEqlAutoValueTypeCheckNode)) === null || _findCheck2 === void 0 ? void 0 : _findCheck2.level) !== null && _ref10 !== void 0 ? _ref10 : schema === null || schema === void 0 ? void 0 : schema.valueEqlAutoValue;
|
|
169116
169127
|
const baseName = (_typeNode$base2 = typeNode === null || typeNode === void 0 ? void 0 : typeNode.base) !== null && _typeNode$base2 !== void 0 ? _typeNode$base2 : schemaTypeNode === null || schemaTypeNode === void 0 ? void 0 : schemaTypeNode.baseType;
|
|
169117
169128
|
if (valueEqlAutoValueErrorLevel != undefined) {
|
|
169118
|
-
var
|
|
169129
|
+
var _findCheck$condition, _findCheck3, _findCheck4;
|
|
169119
169130
|
const isDecimal = baseName == "decimal";
|
|
169120
|
-
|
|
169121
|
-
(_typeNode$children$fi5 = typeNode === null || typeNode === void 0 || (_typeNode$children17 = typeNode.children) === null || _typeNode$children17 === void 0 || (_typeNode$children17 = _typeNode$children17.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_29__.ValueEqlAutoValueTypeCheck))) === null || _typeNode$children17 === void 0 ? void 0 : _typeNode$children17.condition) !== null && _typeNode$children$fi5 !== void 0 ? _typeNode$children$fi5 : typeNode === null || typeNode === void 0 || (_typeNode$children18 = typeNode.children) === null || _typeNode$children18 === void 0 || (_typeNode$children18 = _typeNode$children18.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ValueEqlAutoValueTypeCheckNode))) === null || _typeNode$children18 === void 0 ? void 0 : _typeNode$children18.condition;
|
|
169122
|
-
const validationCondition = (_typeNode$children$fi6 = typeNode === null || typeNode === void 0 || (_typeNode$children19 = typeNode.children) === null || _typeNode$children19 === void 0 || (_typeNode$children19 = _typeNode$children19.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_29__.ValueEqlAutoValueTypeCheck))) === null || _typeNode$children19 === void 0 ? void 0 : _typeNode$children19.condition) !== null && _typeNode$children$fi6 !== void 0 ? _typeNode$children$fi6 : typeNode === null || typeNode === void 0 || (_typeNode$children20 = typeNode.children) === null || _typeNode$children20 === void 0 || (_typeNode$children20 = _typeNode$children20.find((0,_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ofType)(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ValueEqlAutoValueTypeCheckNode))) === null || _typeNode$children20 === void 0 ? void 0 : _typeNode$children20.condition;
|
|
169131
|
+
const validationCondition = (_findCheck$condition = (_findCheck3 = findCheck(_common_SchemaRng_Nodes_SchemaRngRoot__WEBPACK_IMPORTED_MODULE_29__.ValueEqlAutoValueTypeCheck)) === null || _findCheck3 === void 0 ? void 0 : _findCheck3.condition) !== null && _findCheck$condition !== void 0 ? _findCheck$condition : (_findCheck4 = findCheck(_validationGenerator_Nodes_TypeNode__WEBPACK_IMPORTED_MODULE_32__.ValueEqlAutoValueTypeCheckNode)) === null || _findCheck4 === void 0 ? void 0 : _findCheck4.condition;
|
|
169123
169132
|
let result = this.createCheck(targetPath, new _common_KCLang_CodeDom_Functions_IsEqualToAutoCalculatedFunctionCall__WEBPACK_IMPORTED_MODULE_33__.IsEqualToAutoCalculatedFunctionCall(isDecimal ? new _common_KCLang_CodeDom_CastExpression__WEBPACK_IMPORTED_MODULE_5__.CastExpression(valueReferenceExpression, _common_KCLang_CodeDom_KCLangType__WEBPACK_IMPORTED_MODULE_18__.DecimalType.default) : new _common_KCLang_CodeDom_CastExpression__WEBPACK_IMPORTED_MODULE_5__.CastExpression(valueReferenceExpression, _common_KCLang_CodeDom_KCLangType__WEBPACK_IMPORTED_MODULE_18__.StringType.default)), _Common_AutoValidationUtils__WEBPACK_IMPORTED_MODULE_0__.AutoValidationMessage, valueEqlAutoValueErrorLevel !== null && valueEqlAutoValueErrorLevel !== void 0 ? valueEqlAutoValueErrorLevel : checkType);
|
|
169124
169133
|
if (validationCondition != undefined) {
|
|
169125
169134
|
result = new _common_KCLang_CodeDom_IfStatement__WEBPACK_IMPORTED_MODULE_16__.IfStatement(new _common_KCLang_CodeDom_KCLangRawStringExpression__WEBPACK_IMPORTED_MODULE_34__.KCLangRawStringExpression(validationCondition, _common_KCLang_CodeDom_KCLangType__WEBPACK_IMPORTED_MODULE_18__.BoolType.default), [result]);
|