@yamato-daiwa/es-extensions 1.4.3 → 1.4.4
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/Distributable/cjs/RawObjectDataProcessor/RawObjectDataProcessor.js +27 -27
- package/Distributable/cjs/RawObjectDataProcessor/RawObjectDataProcessorLocalization__English.js +17 -18
- package/Distributable/esm/RawObjectDataProcessor/RawObjectDataProcessor.d.ts +1 -1
- package/Distributable/esm/RawObjectDataProcessor/RawObjectDataProcessor.js +27 -27
- package/Distributable/esm/RawObjectDataProcessor/RawObjectDataProcessorLocalization__English.js +17 -18
- package/package.json +1 -1
|
@@ -630,13 +630,13 @@ class RawObjectDataProcessor {
|
|
|
630
630
|
let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.existingObjectManipulation ?
|
|
631
631
|
targetValue__expectedToBeAssociativeArrayTypeObject : {};
|
|
632
632
|
const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedObjectPropertyQualifiedNameSegmentsForLogging.length;
|
|
633
|
-
let
|
|
634
|
-
for (const [key,
|
|
633
|
+
let areOneOnMoreValuesInvalid = false;
|
|
634
|
+
for (const [key, rawValue] of Object.entries(targetValue__expectedToBeAssociativeArrayTypeObject)) {
|
|
635
635
|
this.currentlyIteratedObjectPropertyQualifiedNameSegmentsForLogging[currentObjectDepthLevel__beginWithZero] = key;
|
|
636
636
|
if (foundDisallowedKeys.includes(key)) {
|
|
637
637
|
continue;
|
|
638
638
|
}
|
|
639
|
-
let value =
|
|
639
|
+
let value = rawValue;
|
|
640
640
|
let stringifiedValueBeforeFirstPreValidationModification;
|
|
641
641
|
const preValidationModifications = RawObjectDataProcessor.
|
|
642
642
|
getNormalizedPreValidationModifications(targetAssociativeArrayTypeValueSpecification.value.preValidationModifications);
|
|
@@ -661,7 +661,7 @@ class RawObjectDataProcessor {
|
|
|
661
661
|
const keyFinalName = (_b = ((_a = targetAssociativeArrayTypeValueSpecification.keysRenamings) !== null && _a !== void 0 ? _a : {})[key]) !== null && _b !== void 0 ? _b : key;
|
|
662
662
|
if ((0, isUndefined_1.default)(value)) {
|
|
663
663
|
if (targetAssociativeArrayTypeValueSpecification.allowUndefinedTypeValues !== true) {
|
|
664
|
-
|
|
664
|
+
areOneOnMoreValuesInvalid = true;
|
|
665
665
|
this.registerValidationError(this.validationErrorsMessagesBuilder.associativeArrayDisallowedUndefinedValueErrorMessage({
|
|
666
666
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
667
667
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -674,7 +674,7 @@ class RawObjectDataProcessor {
|
|
|
674
674
|
}
|
|
675
675
|
if ((0, isNull_1.default)(value)) {
|
|
676
676
|
if (targetAssociativeArrayTypeValueSpecification.allowNullValues !== true) {
|
|
677
|
-
|
|
677
|
+
areOneOnMoreValuesInvalid = true;
|
|
678
678
|
this.registerValidationError(this.validationErrorsMessagesBuilder.associativeArrayDisallowedNullValueErrorMessage({
|
|
679
679
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
680
680
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -694,7 +694,7 @@ class RawObjectDataProcessor {
|
|
|
694
694
|
switch (this.processingApproach) {
|
|
695
695
|
case RawObjectDataProcessor.ProcessingApproaches.newObjectAssembling: {
|
|
696
696
|
if ("isInvalid" in valueProcessingResult) {
|
|
697
|
-
|
|
697
|
+
areOneOnMoreValuesInvalid = true;
|
|
698
698
|
continue;
|
|
699
699
|
}
|
|
700
700
|
else if ("isValidButValidationOnlyModeActive" in valueProcessingResult) {
|
|
@@ -714,7 +714,7 @@ class RawObjectDataProcessor {
|
|
|
714
714
|
rawData__full: this.rawData,
|
|
715
715
|
rawData__currentObjectDepth: parentObject !== null && parentObject !== void 0 ? parentObject : this.rawData
|
|
716
716
|
})) {
|
|
717
|
-
|
|
717
|
+
areOneOnMoreValuesInvalid = true;
|
|
718
718
|
this.registerValidationError(this.validationErrorsMessagesBuilder.buildCustomValidationFailedErrorMessageTextData({
|
|
719
719
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
720
720
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -725,7 +725,7 @@ class RawObjectDataProcessor {
|
|
|
725
725
|
}));
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
if (isTargetAssociativeArrayTypeValueInvalid ||
|
|
728
|
+
if (isTargetAssociativeArrayTypeValueInvalid || areOneOnMoreValuesInvalid) {
|
|
729
729
|
return { isInvalid: true };
|
|
730
730
|
}
|
|
731
731
|
else if (this.isValidationOnlyMode) {
|
|
@@ -871,7 +871,7 @@ class RawObjectDataProcessor {
|
|
|
871
871
|
}
|
|
872
872
|
if ((0, isNotUndefined_1.default)(targetValueSpecification.allowedAlternatives) &&
|
|
873
873
|
!targetValueSpecification.allowedAlternatives.includes(targetValue__expectedToBeNumber)) {
|
|
874
|
-
this.registerValidationError(this.validationErrorsMessagesBuilder.
|
|
874
|
+
this.registerValidationError(this.validationErrorsMessagesBuilder.buildValueIsNotAmongAllowedAlternativesErrorMessage({
|
|
875
875
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
876
876
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
877
877
|
targetPropertyValue: targetValue__expectedToBeNumber,
|
|
@@ -948,7 +948,7 @@ class RawObjectDataProcessor {
|
|
|
948
948
|
}
|
|
949
949
|
if ((0, isNotUndefined_1.default)(targetValueSpecification.allowedAlternatives) &&
|
|
950
950
|
!targetValueSpecification.allowedAlternatives.includes(targetValue__expectedToBeString)) {
|
|
951
|
-
this.registerValidationError(this.validationErrorsMessagesBuilder.
|
|
951
|
+
this.registerValidationError(this.validationErrorsMessagesBuilder.buildValueIsNotAmongAllowedAlternativesErrorMessage({
|
|
952
952
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
953
953
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
954
954
|
targetPropertyValue: targetValue__expectedToBeString,
|
|
@@ -1094,26 +1094,26 @@ class RawObjectDataProcessor {
|
|
|
1094
1094
|
return { processedValue };
|
|
1095
1095
|
}
|
|
1096
1096
|
processMultipleTypesAllowedValue({ targetValue, targetValueSpecification, parentObject, targetPropertyStringifiedValueBeforeFirstPreValidationModification }) {
|
|
1097
|
-
let
|
|
1097
|
+
let specificationForValueOfCurrentType;
|
|
1098
1098
|
switch (typeof targetValue) {
|
|
1099
1099
|
case "number": {
|
|
1100
|
-
|
|
1100
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.number ||
|
|
1101
1101
|
alternativeSpecification.type === Number);
|
|
1102
1102
|
break;
|
|
1103
1103
|
}
|
|
1104
1104
|
case "string": {
|
|
1105
|
-
|
|
1105
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.string ||
|
|
1106
1106
|
alternativeSpecification.type === String);
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
1109
|
case "boolean": {
|
|
1110
|
-
|
|
1110
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.boolean ||
|
|
1111
1111
|
alternativeSpecification.type === Boolean);
|
|
1112
1112
|
break;
|
|
1113
1113
|
}
|
|
1114
1114
|
case "object": {
|
|
1115
1115
|
if (Array.isArray(targetValue)) {
|
|
1116
|
-
|
|
1116
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.indexedArrayOfUniformElements ||
|
|
1117
1117
|
alternativeSpecification.type === Array);
|
|
1118
1118
|
break;
|
|
1119
1119
|
}
|
|
@@ -1125,36 +1125,36 @@ class RawObjectDataProcessor {
|
|
|
1125
1125
|
Logger_1.default.logError({
|
|
1126
1126
|
errorType: InvalidParameterValueError_1.default.NAME,
|
|
1127
1127
|
title: InvalidParameterValueError_1.default.DEFAULT_TITLE,
|
|
1128
|
-
description: this.validationErrorsMessagesBuilder.
|
|
1129
|
-
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
1130
|
-
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
1131
|
-
targetPropertyValue: targetValue,
|
|
1132
|
-
targetPropertyValueSpecification: targetValueSpecification,
|
|
1133
|
-
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1134
|
-
}),
|
|
1128
|
+
description: this.validationErrorsMessagesBuilder.buildIncompatibleValuesTypesAlternativesErrorDescription(targetValueSpecification),
|
|
1135
1129
|
occurrenceLocation: "RawObjectDataProcessor.processMultipleTypesAllowedValue(parametersObject)"
|
|
1136
1130
|
});
|
|
1137
1131
|
return { isInvalid: true };
|
|
1138
1132
|
}
|
|
1139
|
-
|
|
1133
|
+
specificationForValueOfCurrentType = possibleSpecificationsForObjectValueTypes[0];
|
|
1140
1134
|
break;
|
|
1141
1135
|
}
|
|
1142
1136
|
default: {
|
|
1143
1137
|
break;
|
|
1144
1138
|
}
|
|
1145
1139
|
}
|
|
1146
|
-
if ((0, isUndefined_1.default)(
|
|
1140
|
+
if ((0, isUndefined_1.default)(specificationForValueOfCurrentType)) {
|
|
1147
1141
|
Logger_1.default.logError({
|
|
1148
1142
|
errorType: InvalidParameterValueError_1.default.NAME,
|
|
1149
1143
|
title: InvalidParameterValueError_1.default.DEFAULT_TITLE,
|
|
1150
|
-
description: this.validationErrorsMessagesBuilder.
|
|
1144
|
+
description: this.validationErrorsMessagesBuilder.buildUnsupportedValueTypeErrorDescription({
|
|
1145
|
+
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
1146
|
+
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
1147
|
+
targetPropertyValue: targetValue,
|
|
1148
|
+
targetPropertyValueSpecification: targetValueSpecification,
|
|
1149
|
+
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1150
|
+
}),
|
|
1151
1151
|
occurrenceLocation: "RawObjectDataProcessor.processMultipleTypesAllowedValue(parametersObject)"
|
|
1152
1152
|
});
|
|
1153
1153
|
return { isInvalid: true };
|
|
1154
1154
|
}
|
|
1155
1155
|
return this.processSingleNeitherUndefinedNorNullValue({
|
|
1156
1156
|
targetValue,
|
|
1157
|
-
targetValueSpecification:
|
|
1157
|
+
targetValueSpecification: specificationForValueOfCurrentType,
|
|
1158
1158
|
parentObject,
|
|
1159
1159
|
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1160
1160
|
});
|
|
@@ -1363,7 +1363,7 @@ RawObjectDataProcessor.defaultLocalization = RawObjectDataProcessorLocalization_
|
|
|
1363
1363
|
...{ expectedNumbersSet: payload.expectedNumbersSet }
|
|
1364
1364
|
});
|
|
1365
1365
|
}
|
|
1366
|
-
|
|
1366
|
+
buildValueIsNotAmongAllowedAlternativesErrorMessage(payload) {
|
|
1367
1367
|
return this.buildErrorMessage({
|
|
1368
1368
|
...payload,
|
|
1369
1369
|
...this.localization.valueIsNotAmongAllowedAlternativesErrorMessageTextData
|
package/Distributable/cjs/RawObjectDataProcessor/RawObjectDataProcessorLocalization__English.js
CHANGED
|
@@ -75,12 +75,12 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
75
75
|
},
|
|
76
76
|
indexedArrayDisallowedUndefinedElementErrorMessageTextData: {
|
|
77
77
|
title: "Disallowed undefined-type element of indexed array",
|
|
78
|
-
specificMessagePart: "This indexed array
|
|
78
|
+
specificMessagePart: "This element of indexed array is 'undefined' while undefined-type elements has not been allowed " +
|
|
79
79
|
"by valid element specification."
|
|
80
80
|
},
|
|
81
81
|
indexedArrayDisallowedNullElementErrorMessageTextData: {
|
|
82
82
|
title: "Disallowed null element of indexed array",
|
|
83
|
-
specificMessagePart: "This indexed array
|
|
83
|
+
specificMessagePart: "This element of indexed array is 'null' while null elements has not been allowed by valid element " +
|
|
84
84
|
"specification."
|
|
85
85
|
},
|
|
86
86
|
buildAssociativeArrayEntriesCountIsLessThanRequiredMinimumErrorMessageTextData({ minimalEntriesCount, actualEntriesCount }) {
|
|
@@ -126,13 +126,13 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
126
126
|
};
|
|
127
127
|
},
|
|
128
128
|
associativeArrayDisallowedUndefinedValueErrorMessageTextData: {
|
|
129
|
-
title: "
|
|
130
|
-
specificMessagePart: "This associative array
|
|
129
|
+
title: "Disallowed undefined-type value of associative array",
|
|
130
|
+
specificMessagePart: "This value of associative array is 'undefined' while undefined-type values has not been allowed " +
|
|
131
131
|
"by valid value specification."
|
|
132
132
|
},
|
|
133
133
|
associativeArrayDisallowedNullValueErrorMessageTextData: {
|
|
134
|
-
title: "
|
|
135
|
-
specificMessagePart: "This associative array
|
|
134
|
+
title: "Disallowed null value of associative array",
|
|
135
|
+
specificMessagePart: "This value of associative array is 'null' while null values has not been allowed by valid value " +
|
|
136
136
|
"specification."
|
|
137
137
|
},
|
|
138
138
|
valueType(valueType) {
|
|
@@ -168,11 +168,12 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
168
168
|
buildNumberValueIsNotBelongToExpectedNumbersSetErrorMessageTextData(expectedNumberSet) {
|
|
169
169
|
return {
|
|
170
170
|
title: "Expected and actual numbers set mismatch",
|
|
171
|
-
specificMessagePart:
|
|
171
|
+
specificMessagePart: "Contrary to expectations, this numeric value is in not member of " +
|
|
172
|
+
`'${this.numbersSet(expectedNumberSet)}'`
|
|
172
173
|
};
|
|
173
174
|
},
|
|
174
175
|
valueIsNotAmongAllowedAlternativesErrorMessageTextData: {
|
|
175
|
-
title: "Disallowed value
|
|
176
|
+
title: "Disallowed alternative of value",
|
|
176
177
|
specificMessagePart: "This value is not among allowed alternatives."
|
|
177
178
|
},
|
|
178
179
|
buildNumericValueIsSmallerThanRequiredMinimumErrorMessageTextData(requiredMinimum) {
|
|
@@ -190,42 +191,40 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
190
191
|
buildCharactersCountIsLessThanRequiredErrorMessageTextData({ minimalCharactersCount, realCharactersCount }) {
|
|
191
192
|
return {
|
|
192
193
|
title: "Minimal characters count fall short",
|
|
193
|
-
specificMessagePart: `This string value has ${realCharactersCount} characters while
|
|
194
|
-
|
|
194
|
+
specificMessagePart: `This string value has ${realCharactersCount} characters while at least ` +
|
|
195
|
+
`${minimalCharactersCount} required.`
|
|
195
196
|
};
|
|
196
197
|
},
|
|
197
198
|
buildCharactersCountIsMoreThanAllowedErrorMessageTextData({ maximalCharactersCount, realCharactersCount }) {
|
|
198
199
|
return {
|
|
199
200
|
title: "Maximal characters count exceeding",
|
|
200
|
-
specificMessagePart: `This string value has ${realCharactersCount} characters
|
|
201
|
-
|
|
201
|
+
specificMessagePart: `This string value has ${realCharactersCount} characters ${maximalCharactersCount} allowed ` +
|
|
202
|
+
"as maximum."
|
|
202
203
|
};
|
|
203
204
|
},
|
|
204
205
|
buildCharactersCountDoesNotMatchWithSpecifiedErrorMessageTextData({ fixedCharactersCount, realCharactersCount }) {
|
|
205
206
|
return {
|
|
206
207
|
title: "Fixed characters count mismatch",
|
|
207
|
-
specificMessagePart: `The value has ${realCharactersCount}
|
|
208
|
-
"characters."
|
|
208
|
+
specificMessagePart: `The value has ${realCharactersCount} characters exactly ${fixedCharactersCount} required.`
|
|
209
209
|
};
|
|
210
210
|
},
|
|
211
211
|
buildRegularExpressionMismatchErrorMessageTextData(regularExpression) {
|
|
212
212
|
return {
|
|
213
213
|
title: "Regular expression mismatch",
|
|
214
|
-
specificMessagePart: `This value does not match with specified regular expression:\n ${regularExpression.toString()}`
|
|
214
|
+
specificMessagePart: `This string value does not match with specified regular expression:\n ${regularExpression.toString()}`
|
|
215
215
|
};
|
|
216
216
|
},
|
|
217
217
|
buildDisallowedBooleanValueVariantErrorMessageTextData(disallowedVariant) {
|
|
218
218
|
return {
|
|
219
219
|
title: "Disallowed boolean variant",
|
|
220
|
-
specificMessagePart: `This value is '${!disallowedVariant}' while only '${disallowedVariant}' allowed
|
|
220
|
+
specificMessagePart: `This boolean value is '${!disallowedVariant}' while only '${disallowedVariant}' allowed.`
|
|
221
221
|
};
|
|
222
222
|
},
|
|
223
223
|
buildIncompatibleValuesTypesAlternativesErrorDescription(targetValueSpecification) {
|
|
224
224
|
return "The 'ValuesTypesIDs.fixedKeyAndValuePairsObject' (aliased as Object) and " +
|
|
225
225
|
"'ValuesTypesIDs.associativeArrayOfUniformTypeValues' (aliased as Map) are incompatible alternatives of " +
|
|
226
226
|
"'ValuesTypesIDs.oneOf' because from the viewpoint of ECMAScript both are the 'object'. Target value marked " +
|
|
227
|
-
|
|
228
|
-
`\n● Value specification: \n${(0, stringifyAndFormatArbitraryValue_1.default)(targetValueSpecification)}`;
|
|
227
|
+
`as invalid. Please correct below specification:\n ${(0, stringifyAndFormatArbitraryValue_1.default)(targetValueSpecification)}`;
|
|
229
228
|
},
|
|
230
229
|
buildUnsupportedValueTypeErrorMessageTextData(propertyDataForMessagesBuilding) {
|
|
231
230
|
return {
|
|
@@ -484,7 +484,7 @@ declare namespace RawObjectDataProcessor {
|
|
|
484
484
|
buildNumberValueIsNotBelongToExpectedNumbersSetErrorMessage(payload: Localization.PropertyDataForMessagesBuilding & {
|
|
485
485
|
expectedNumbersSet: NumbersSets;
|
|
486
486
|
}): string;
|
|
487
|
-
|
|
487
|
+
buildValueIsNotAmongAllowedAlternativesErrorMessage(payload: Localization.PropertyDataForMessagesBuilding): string;
|
|
488
488
|
buildNumericValueIsSmallerThanRequiredMinimumErrorMessage(payload: Localization.PropertyDataForMessagesBuilding & {
|
|
489
489
|
requiredMinimum: number;
|
|
490
490
|
}): string;
|
|
@@ -628,13 +628,13 @@ class RawObjectDataProcessor {
|
|
|
628
628
|
let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.existingObjectManipulation ?
|
|
629
629
|
targetValue__expectedToBeAssociativeArrayTypeObject : {};
|
|
630
630
|
const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedObjectPropertyQualifiedNameSegmentsForLogging.length;
|
|
631
|
-
let
|
|
632
|
-
for (const [key,
|
|
631
|
+
let areOneOnMoreValuesInvalid = false;
|
|
632
|
+
for (const [key, rawValue] of Object.entries(targetValue__expectedToBeAssociativeArrayTypeObject)) {
|
|
633
633
|
this.currentlyIteratedObjectPropertyQualifiedNameSegmentsForLogging[currentObjectDepthLevel__beginWithZero] = key;
|
|
634
634
|
if (foundDisallowedKeys.includes(key)) {
|
|
635
635
|
continue;
|
|
636
636
|
}
|
|
637
|
-
let value =
|
|
637
|
+
let value = rawValue;
|
|
638
638
|
let stringifiedValueBeforeFirstPreValidationModification;
|
|
639
639
|
const preValidationModifications = RawObjectDataProcessor.
|
|
640
640
|
getNormalizedPreValidationModifications(targetAssociativeArrayTypeValueSpecification.value.preValidationModifications);
|
|
@@ -659,7 +659,7 @@ class RawObjectDataProcessor {
|
|
|
659
659
|
const keyFinalName = (_b = ((_a = targetAssociativeArrayTypeValueSpecification.keysRenamings) !== null && _a !== void 0 ? _a : {})[key]) !== null && _b !== void 0 ? _b : key;
|
|
660
660
|
if (isUndefined(value)) {
|
|
661
661
|
if (targetAssociativeArrayTypeValueSpecification.allowUndefinedTypeValues !== true) {
|
|
662
|
-
|
|
662
|
+
areOneOnMoreValuesInvalid = true;
|
|
663
663
|
this.registerValidationError(this.validationErrorsMessagesBuilder.associativeArrayDisallowedUndefinedValueErrorMessage({
|
|
664
664
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
665
665
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -672,7 +672,7 @@ class RawObjectDataProcessor {
|
|
|
672
672
|
}
|
|
673
673
|
if (isNull(value)) {
|
|
674
674
|
if (targetAssociativeArrayTypeValueSpecification.allowNullValues !== true) {
|
|
675
|
-
|
|
675
|
+
areOneOnMoreValuesInvalid = true;
|
|
676
676
|
this.registerValidationError(this.validationErrorsMessagesBuilder.associativeArrayDisallowedNullValueErrorMessage({
|
|
677
677
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
678
678
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -692,7 +692,7 @@ class RawObjectDataProcessor {
|
|
|
692
692
|
switch (this.processingApproach) {
|
|
693
693
|
case RawObjectDataProcessor.ProcessingApproaches.newObjectAssembling: {
|
|
694
694
|
if ("isInvalid" in valueProcessingResult) {
|
|
695
|
-
|
|
695
|
+
areOneOnMoreValuesInvalid = true;
|
|
696
696
|
continue;
|
|
697
697
|
}
|
|
698
698
|
else if ("isValidButValidationOnlyModeActive" in valueProcessingResult) {
|
|
@@ -712,7 +712,7 @@ class RawObjectDataProcessor {
|
|
|
712
712
|
rawData__full: this.rawData,
|
|
713
713
|
rawData__currentObjectDepth: parentObject !== null && parentObject !== void 0 ? parentObject : this.rawData
|
|
714
714
|
})) {
|
|
715
|
-
|
|
715
|
+
areOneOnMoreValuesInvalid = true;
|
|
716
716
|
this.registerValidationError(this.validationErrorsMessagesBuilder.buildCustomValidationFailedErrorMessageTextData({
|
|
717
717
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
718
718
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
@@ -723,7 +723,7 @@ class RawObjectDataProcessor {
|
|
|
723
723
|
}));
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
if (isTargetAssociativeArrayTypeValueInvalid ||
|
|
726
|
+
if (isTargetAssociativeArrayTypeValueInvalid || areOneOnMoreValuesInvalid) {
|
|
727
727
|
return { isInvalid: true };
|
|
728
728
|
}
|
|
729
729
|
else if (this.isValidationOnlyMode) {
|
|
@@ -869,7 +869,7 @@ class RawObjectDataProcessor {
|
|
|
869
869
|
}
|
|
870
870
|
if (isNotUndefined(targetValueSpecification.allowedAlternatives) &&
|
|
871
871
|
!targetValueSpecification.allowedAlternatives.includes(targetValue__expectedToBeNumber)) {
|
|
872
|
-
this.registerValidationError(this.validationErrorsMessagesBuilder.
|
|
872
|
+
this.registerValidationError(this.validationErrorsMessagesBuilder.buildValueIsNotAmongAllowedAlternativesErrorMessage({
|
|
873
873
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
874
874
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
875
875
|
targetPropertyValue: targetValue__expectedToBeNumber,
|
|
@@ -946,7 +946,7 @@ class RawObjectDataProcessor {
|
|
|
946
946
|
}
|
|
947
947
|
if (isNotUndefined(targetValueSpecification.allowedAlternatives) &&
|
|
948
948
|
!targetValueSpecification.allowedAlternatives.includes(targetValue__expectedToBeString)) {
|
|
949
|
-
this.registerValidationError(this.validationErrorsMessagesBuilder.
|
|
949
|
+
this.registerValidationError(this.validationErrorsMessagesBuilder.buildValueIsNotAmongAllowedAlternativesErrorMessage({
|
|
950
950
|
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
951
951
|
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
952
952
|
targetPropertyValue: targetValue__expectedToBeString,
|
|
@@ -1092,26 +1092,26 @@ class RawObjectDataProcessor {
|
|
|
1092
1092
|
return { processedValue };
|
|
1093
1093
|
}
|
|
1094
1094
|
processMultipleTypesAllowedValue({ targetValue, targetValueSpecification, parentObject, targetPropertyStringifiedValueBeforeFirstPreValidationModification }) {
|
|
1095
|
-
let
|
|
1095
|
+
let specificationForValueOfCurrentType;
|
|
1096
1096
|
switch (typeof targetValue) {
|
|
1097
1097
|
case "number": {
|
|
1098
|
-
|
|
1098
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.number ||
|
|
1099
1099
|
alternativeSpecification.type === Number);
|
|
1100
1100
|
break;
|
|
1101
1101
|
}
|
|
1102
1102
|
case "string": {
|
|
1103
|
-
|
|
1103
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.string ||
|
|
1104
1104
|
alternativeSpecification.type === String);
|
|
1105
1105
|
break;
|
|
1106
1106
|
}
|
|
1107
1107
|
case "boolean": {
|
|
1108
|
-
|
|
1108
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.boolean ||
|
|
1109
1109
|
alternativeSpecification.type === Boolean);
|
|
1110
1110
|
break;
|
|
1111
1111
|
}
|
|
1112
1112
|
case "object": {
|
|
1113
1113
|
if (Array.isArray(targetValue)) {
|
|
1114
|
-
|
|
1114
|
+
specificationForValueOfCurrentType = targetValueSpecification.alternatives.find((alternativeSpecification) => alternativeSpecification.type === RawObjectDataProcessor.ValuesTypesIDs.indexedArrayOfUniformElements ||
|
|
1115
1115
|
alternativeSpecification.type === Array);
|
|
1116
1116
|
break;
|
|
1117
1117
|
}
|
|
@@ -1123,36 +1123,36 @@ class RawObjectDataProcessor {
|
|
|
1123
1123
|
Logger.logError({
|
|
1124
1124
|
errorType: InvalidParameterValueError.NAME,
|
|
1125
1125
|
title: InvalidParameterValueError.DEFAULT_TITLE,
|
|
1126
|
-
description: this.validationErrorsMessagesBuilder.
|
|
1127
|
-
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
1128
|
-
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
1129
|
-
targetPropertyValue: targetValue,
|
|
1130
|
-
targetPropertyValueSpecification: targetValueSpecification,
|
|
1131
|
-
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1132
|
-
}),
|
|
1126
|
+
description: this.validationErrorsMessagesBuilder.buildIncompatibleValuesTypesAlternativesErrorDescription(targetValueSpecification),
|
|
1133
1127
|
occurrenceLocation: "RawObjectDataProcessor.processMultipleTypesAllowedValue(parametersObject)"
|
|
1134
1128
|
});
|
|
1135
1129
|
return { isInvalid: true };
|
|
1136
1130
|
}
|
|
1137
|
-
|
|
1131
|
+
specificationForValueOfCurrentType = possibleSpecificationsForObjectValueTypes[0];
|
|
1138
1132
|
break;
|
|
1139
1133
|
}
|
|
1140
1134
|
default: {
|
|
1141
1135
|
break;
|
|
1142
1136
|
}
|
|
1143
1137
|
}
|
|
1144
|
-
if (isUndefined(
|
|
1138
|
+
if (isUndefined(specificationForValueOfCurrentType)) {
|
|
1145
1139
|
Logger.logError({
|
|
1146
1140
|
errorType: InvalidParameterValueError.NAME,
|
|
1147
1141
|
title: InvalidParameterValueError.DEFAULT_TITLE,
|
|
1148
|
-
description: this.validationErrorsMessagesBuilder.
|
|
1142
|
+
description: this.validationErrorsMessagesBuilder.buildUnsupportedValueTypeErrorDescription({
|
|
1143
|
+
targetPropertyDotSeparatedQualifiedName: this.currentObjectPropertyDotSeparatedQualifiedName,
|
|
1144
|
+
targetPropertyNewName: this.currentlyIteratedPropertyNewNameForLogging,
|
|
1145
|
+
targetPropertyValue: targetValue,
|
|
1146
|
+
targetPropertyValueSpecification: targetValueSpecification,
|
|
1147
|
+
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1148
|
+
}),
|
|
1149
1149
|
occurrenceLocation: "RawObjectDataProcessor.processMultipleTypesAllowedValue(parametersObject)"
|
|
1150
1150
|
});
|
|
1151
1151
|
return { isInvalid: true };
|
|
1152
1152
|
}
|
|
1153
1153
|
return this.processSingleNeitherUndefinedNorNullValue({
|
|
1154
1154
|
targetValue,
|
|
1155
|
-
targetValueSpecification:
|
|
1155
|
+
targetValueSpecification: specificationForValueOfCurrentType,
|
|
1156
1156
|
parentObject,
|
|
1157
1157
|
targetPropertyStringifiedValueBeforeFirstPreValidationModification
|
|
1158
1158
|
});
|
|
@@ -1361,7 +1361,7 @@ RawObjectDataProcessor.defaultLocalization = RawObjectDataProcessorLocalization_
|
|
|
1361
1361
|
...{ expectedNumbersSet: payload.expectedNumbersSet }
|
|
1362
1362
|
});
|
|
1363
1363
|
}
|
|
1364
|
-
|
|
1364
|
+
buildValueIsNotAmongAllowedAlternativesErrorMessage(payload) {
|
|
1365
1365
|
return this.buildErrorMessage({
|
|
1366
1366
|
...payload,
|
|
1367
1367
|
...this.localization.valueIsNotAmongAllowedAlternativesErrorMessageTextData
|
package/Distributable/esm/RawObjectDataProcessor/RawObjectDataProcessorLocalization__English.js
CHANGED
|
@@ -73,12 +73,12 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
73
73
|
},
|
|
74
74
|
indexedArrayDisallowedUndefinedElementErrorMessageTextData: {
|
|
75
75
|
title: "Disallowed undefined-type element of indexed array",
|
|
76
|
-
specificMessagePart: "This indexed array
|
|
76
|
+
specificMessagePart: "This element of indexed array is 'undefined' while undefined-type elements has not been allowed " +
|
|
77
77
|
"by valid element specification."
|
|
78
78
|
},
|
|
79
79
|
indexedArrayDisallowedNullElementErrorMessageTextData: {
|
|
80
80
|
title: "Disallowed null element of indexed array",
|
|
81
|
-
specificMessagePart: "This indexed array
|
|
81
|
+
specificMessagePart: "This element of indexed array is 'null' while null elements has not been allowed by valid element " +
|
|
82
82
|
"specification."
|
|
83
83
|
},
|
|
84
84
|
buildAssociativeArrayEntriesCountIsLessThanRequiredMinimumErrorMessageTextData({ minimalEntriesCount, actualEntriesCount }) {
|
|
@@ -124,13 +124,13 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
124
124
|
};
|
|
125
125
|
},
|
|
126
126
|
associativeArrayDisallowedUndefinedValueErrorMessageTextData: {
|
|
127
|
-
title: "
|
|
128
|
-
specificMessagePart: "This associative array
|
|
127
|
+
title: "Disallowed undefined-type value of associative array",
|
|
128
|
+
specificMessagePart: "This value of associative array is 'undefined' while undefined-type values has not been allowed " +
|
|
129
129
|
"by valid value specification."
|
|
130
130
|
},
|
|
131
131
|
associativeArrayDisallowedNullValueErrorMessageTextData: {
|
|
132
|
-
title: "
|
|
133
|
-
specificMessagePart: "This associative array
|
|
132
|
+
title: "Disallowed null value of associative array",
|
|
133
|
+
specificMessagePart: "This value of associative array is 'null' while null values has not been allowed by valid value " +
|
|
134
134
|
"specification."
|
|
135
135
|
},
|
|
136
136
|
valueType(valueType) {
|
|
@@ -166,11 +166,12 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
166
166
|
buildNumberValueIsNotBelongToExpectedNumbersSetErrorMessageTextData(expectedNumberSet) {
|
|
167
167
|
return {
|
|
168
168
|
title: "Expected and actual numbers set mismatch",
|
|
169
|
-
specificMessagePart:
|
|
169
|
+
specificMessagePart: "Contrary to expectations, this numeric value is in not member of " +
|
|
170
|
+
`'${this.numbersSet(expectedNumberSet)}'`
|
|
170
171
|
};
|
|
171
172
|
},
|
|
172
173
|
valueIsNotAmongAllowedAlternativesErrorMessageTextData: {
|
|
173
|
-
title: "Disallowed value
|
|
174
|
+
title: "Disallowed alternative of value",
|
|
174
175
|
specificMessagePart: "This value is not among allowed alternatives."
|
|
175
176
|
},
|
|
176
177
|
buildNumericValueIsSmallerThanRequiredMinimumErrorMessageTextData(requiredMinimum) {
|
|
@@ -188,42 +189,40 @@ const RawObjectDataProcessorLocalization__English = {
|
|
|
188
189
|
buildCharactersCountIsLessThanRequiredErrorMessageTextData({ minimalCharactersCount, realCharactersCount }) {
|
|
189
190
|
return {
|
|
190
191
|
title: "Minimal characters count fall short",
|
|
191
|
-
specificMessagePart: `This string value has ${realCharactersCount} characters while
|
|
192
|
-
|
|
192
|
+
specificMessagePart: `This string value has ${realCharactersCount} characters while at least ` +
|
|
193
|
+
`${minimalCharactersCount} required.`
|
|
193
194
|
};
|
|
194
195
|
},
|
|
195
196
|
buildCharactersCountIsMoreThanAllowedErrorMessageTextData({ maximalCharactersCount, realCharactersCount }) {
|
|
196
197
|
return {
|
|
197
198
|
title: "Maximal characters count exceeding",
|
|
198
|
-
specificMessagePart: `This string value has ${realCharactersCount} characters
|
|
199
|
-
|
|
199
|
+
specificMessagePart: `This string value has ${realCharactersCount} characters ${maximalCharactersCount} allowed ` +
|
|
200
|
+
"as maximum."
|
|
200
201
|
};
|
|
201
202
|
},
|
|
202
203
|
buildCharactersCountDoesNotMatchWithSpecifiedErrorMessageTextData({ fixedCharactersCount, realCharactersCount }) {
|
|
203
204
|
return {
|
|
204
205
|
title: "Fixed characters count mismatch",
|
|
205
|
-
specificMessagePart: `The value has ${realCharactersCount}
|
|
206
|
-
"characters."
|
|
206
|
+
specificMessagePart: `The value has ${realCharactersCount} characters exactly ${fixedCharactersCount} required.`
|
|
207
207
|
};
|
|
208
208
|
},
|
|
209
209
|
buildRegularExpressionMismatchErrorMessageTextData(regularExpression) {
|
|
210
210
|
return {
|
|
211
211
|
title: "Regular expression mismatch",
|
|
212
|
-
specificMessagePart: `This value does not match with specified regular expression:\n ${regularExpression.toString()}`
|
|
212
|
+
specificMessagePart: `This string value does not match with specified regular expression:\n ${regularExpression.toString()}`
|
|
213
213
|
};
|
|
214
214
|
},
|
|
215
215
|
buildDisallowedBooleanValueVariantErrorMessageTextData(disallowedVariant) {
|
|
216
216
|
return {
|
|
217
217
|
title: "Disallowed boolean variant",
|
|
218
|
-
specificMessagePart: `This value is '${!disallowedVariant}' while only '${disallowedVariant}' allowed
|
|
218
|
+
specificMessagePart: `This boolean value is '${!disallowedVariant}' while only '${disallowedVariant}' allowed.`
|
|
219
219
|
};
|
|
220
220
|
},
|
|
221
221
|
buildIncompatibleValuesTypesAlternativesErrorDescription(targetValueSpecification) {
|
|
222
222
|
return "The 'ValuesTypesIDs.fixedKeyAndValuePairsObject' (aliased as Object) and " +
|
|
223
223
|
"'ValuesTypesIDs.associativeArrayOfUniformTypeValues' (aliased as Map) are incompatible alternatives of " +
|
|
224
224
|
"'ValuesTypesIDs.oneOf' because from the viewpoint of ECMAScript both are the 'object'. Target value marked " +
|
|
225
|
-
|
|
226
|
-
`\n● Value specification: \n${stringifyAndFormatArbitraryValue(targetValueSpecification)}`;
|
|
225
|
+
`as invalid. Please correct below specification:\n ${stringifyAndFormatArbitraryValue(targetValueSpecification)}`;
|
|
227
226
|
},
|
|
228
227
|
buildUnsupportedValueTypeErrorMessageTextData(propertyDataForMessagesBuilding) {
|
|
229
228
|
return {
|