@yamato-daiwa/es-extensions 1.8.7 → 1.8.9

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.
@@ -139,7 +139,7 @@ class AJAX_Service {
139
139
  Logger_1.default.throwErrorWithFormattedMessage({
140
140
  errorInstance: new InvalidConfigError_1.default({
141
141
  customMessage: "The \"alternatingURI_PathPart\" has been specified while the static field " +
142
- "\"API_SERVER_URI_CONSTANT_PART\" has not been set."
142
+ "\"API_SERVER_URI_CONSTANT_PART__WITHOUT_TRAILING_SLASH\" has not been set."
143
143
  }),
144
144
  title: InvalidConfigError_1.default.localization.defaultTitle,
145
145
  occurrenceLocation: "AJAX_Service.normalizeURI_UntilPath(URI_PathRawDefinition)"
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = isStringifiedNonNegativeIntegerOfRegularNotation;
4
4
  function isStringifiedNonNegativeIntegerOfRegularNotation(value) {
5
- return (/^[1-9]\d*$/u).test(value);
5
+ return (/^(?:0|^[1-9]\d*)$/u).test(value);
6
6
  }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = getObjectPropertySafely;
7
+ const splitString_1 = __importDefault(require("../Strings/splitString"));
8
+ const Logger_1 = __importDefault(require("../Logging/Logger"));
9
+ const InvalidParameterValueError_1 = __importDefault(require("../Errors/InvalidParameterValue/InvalidParameterValueError"));
10
+ const isNonEmptyString_1 = __importDefault(require("../TypeGuards/Strings/isNonEmptyString"));
11
+ const isArbitraryObject_1 = __importDefault(require("../TypeGuards/Objects/isArbitraryObject"));
12
+ const isNaturalNumberOrZero_1 = __importDefault(require("../TypeGuards/Numbers/isNaturalNumberOrZero"));
13
+ function getObjectPropertySafely(targetObject, dotSeparatedOrArrayedPathToTargetProperty) {
14
+ if (!(0, isArbitraryObject_1.default)(targetObject)) {
15
+ return;
16
+ }
17
+ let targetPropertyPathSegments;
18
+ if (Array.isArray(dotSeparatedOrArrayedPathToTargetProperty) &&
19
+ dotSeparatedOrArrayedPathToTargetProperty.length > 0 &&
20
+ dotSeparatedOrArrayedPathToTargetProperty.
21
+ every((key) => (0, isNonEmptyString_1.default)(key) || (0, isNaturalNumberOrZero_1.default)(key))) {
22
+ targetPropertyPathSegments = dotSeparatedOrArrayedPathToTargetProperty;
23
+ }
24
+ else if ((0, isNaturalNumberOrZero_1.default)(dotSeparatedOrArrayedPathToTargetProperty)) {
25
+ targetPropertyPathSegments = [String(dotSeparatedOrArrayedPathToTargetProperty)];
26
+ }
27
+ else if ((0, isNonEmptyString_1.default)(dotSeparatedOrArrayedPathToTargetProperty)) {
28
+ targetPropertyPathSegments = (0, splitString_1.default)(dotSeparatedOrArrayedPathToTargetProperty, ".");
29
+ }
30
+ else {
31
+ Logger_1.default.throwErrorWithFormattedMessage({
32
+ errorInstance: new InvalidParameterValueError_1.default({
33
+ parameterNumber: 2,
34
+ parameterName: "dotSeparatedOrArrayedPathToTargetProperty",
35
+ messageSpecificPart: "This parameter must be either a non-empty string, or a non-negative integer, or a non-empty array " +
36
+ "of strings and/or non-negative integers."
37
+ }),
38
+ title: InvalidParameterValueError_1.default.localization.defaultTitle,
39
+ occurrenceLocation: "getObjectPropertySafely(targetObject, dotSeparatedOrArrayedPathToTargetProperty)"
40
+ });
41
+ return;
42
+ }
43
+ let objectOfCurrentDepthLevel = targetObject;
44
+ for (let depthLevel__numerationFrom1 = 1; depthLevel__numerationFrom1 <= targetPropertyPathSegments.length; depthLevel__numerationFrom1++) {
45
+ const isLastDepthLevel = depthLevel__numerationFrom1 === targetPropertyPathSegments.length;
46
+ const valueOfCurrentDepthLevel = objectOfCurrentDepthLevel[targetPropertyPathSegments[depthLevel__numerationFrom1 - 1]];
47
+ if (isLastDepthLevel) {
48
+ return valueOfCurrentDepthLevel;
49
+ }
50
+ else if ((0, isArbitraryObject_1.default)(valueOfCurrentDepthLevel)) {
51
+ objectOfCurrentDepthLevel = valueOfCurrentDepthLevel;
52
+ }
53
+ else {
54
+ return;
55
+ }
56
+ }
57
+ return;
58
+ }
@@ -30,6 +30,8 @@ const isEitherUndefinedOrNull_1 = __importDefault(require("../TypeGuards/EmptyTy
30
30
  const isNeitherUndefinedNorNull_1 = __importDefault(require("../TypeGuards/EmptyTypes/isNeitherUndefinedNorNull"));
31
31
  const emptyStringToNull_1 = __importDefault(require("../ValueTransformers/emptyStringToNull"));
32
32
  const getLastElementOfArray_1 = __importDefault(require("../Arrays/01-RetrievingOfElements/getLastElementOfArray"));
33
+ const ValuesDeepCopier_1 = __importDefault(require("../ValuesDeepCopier"));
34
+ const getObjectPropertySafely__TEMP_1 = __importDefault(require("../Objects/getObjectPropertySafely__TEMP"));
33
35
  class RawObjectDataProcessor {
34
36
  static defaultLocalization = RawObjectDataProcessorLocalization_english_1.default;
35
37
  rawData;
@@ -37,8 +39,9 @@ class RawObjectDataProcessor {
37
39
  localization;
38
40
  errorHandlingStrategies;
39
41
  validationErrorsMessages = [];
40
- currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging = [];
42
+ currentlyIteratedPropertyQualifiedInitialNameSegments = [];
41
43
  currentlyIteratedPropertyNewNamesByDepthLevelsForLogging = [];
44
+ initialObjectSnapshot;
42
45
  static process(rawData, validDataSpecification, options = {}) {
43
46
  const localization = options.localization ?? RawObjectDataProcessor.defaultLocalization;
44
47
  if (typeof rawData !== "object") {
@@ -155,6 +158,15 @@ class RawObjectDataProcessor {
155
158
  onUnableToUpdatePropertyValue: errorHandlingStrategies.onUnableToUpdatePropertyValue ??
156
159
  RawObjectDataProcessor.ErrorHandlingStrategies.throwingOfError
157
160
  };
161
+ switch (this.processingApproach) {
162
+ case RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject: {
163
+ this.initialObjectSnapshot = this.rawData;
164
+ break;
165
+ }
166
+ case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
167
+ this.initialObjectSnapshot = null;
168
+ }
169
+ }
158
170
  }
159
171
  processFixedSchemaObjectTypeValue({ targetObjectTypeValueSpecification, parentObject, targetPropertyStringifiedValueBeforeFirstPreValidationModification, ...compoundParameter }) {
160
172
  let targetObjectTypeSourceValue;
@@ -186,7 +198,7 @@ class RawObjectDataProcessor {
186
198
  }
187
199
  let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject ?
188
200
  targetObjectTypeSourceValue : {};
189
- const currentObjectDepthLevel__countFromZero = this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.length;
201
+ const currentObjectDepthLevel__countFromZero = this.currentlyIteratedPropertyQualifiedInitialNameSegments.length;
190
202
  const initialNamesOfNotCheckedYetProperties = new Set(Object.keys(targetObjectTypeSourceValue));
191
203
  let hasAtLeastOneInvalidPropertyBeenDetected = false;
192
204
  let hasAllChildrenPropertiesValuesDefinitelyNotChanged = true;
@@ -199,7 +211,8 @@ class RawObjectDataProcessor {
199
211
  if (possibleSchema.actualIf({
200
212
  rawData__currentObjectDepth: targetObjectTypeSourceValue,
201
213
  rawData__full: this.rawData,
202
- targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName
214
+ targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName,
215
+ targetPropertyPathSegments: [...this.currentlyIteratedPropertyQualifiedInitialNameSegments]
203
216
  })) {
204
217
  propertiesSpecification = possibleSchema.properties;
205
218
  break;
@@ -220,11 +233,13 @@ class RawObjectDataProcessor {
220
233
  }
221
234
  for (const [childPropertyInitialName, childPropertySpecification] of Object.entries(propertiesSpecification)) {
222
235
  initialNamesOfNotCheckedYetProperties.delete(childPropertyInitialName);
223
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging[currentObjectDepthLevel__countFromZero] = childPropertyInitialName;
236
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments[currentObjectDepthLevel__countFromZero] =
237
+ childPropertyInitialName;
224
238
  let childPropertyFinalName;
225
239
  if ((0, isUndefined_1.default)(childPropertySpecification.newName)) {
226
240
  childPropertyFinalName = childPropertyInitialName;
227
241
  this.currentlyIteratedPropertyNewNamesByDepthLevelsForLogging[currentObjectDepthLevel__countFromZero] = null;
242
+ this.createInitialObjectSnapshotIfNotCreatedYet();
228
243
  }
229
244
  else {
230
245
  childPropertyFinalName = childPropertySpecification.newName;
@@ -257,6 +272,7 @@ class RawObjectDataProcessor {
257
272
  (0, ArbitraryValueFormatter_1.stringifyAndFormatArbitraryValue)(childPropertyMutableValue);
258
273
  hasChildPropertyValueDefinitelyNotChanged = false;
259
274
  hasAllChildrenPropertiesValuesDefinitelyNotChanged = false;
275
+ this.createInitialObjectSnapshotIfNotCreatedYet();
260
276
  }
261
277
  for (const preValidationModification of preValidationModifications) {
262
278
  try {
@@ -301,10 +317,25 @@ class RawObjectDataProcessor {
301
317
  continue;
302
318
  }
303
319
  if ((0, isNotUndefined_1.default)(childPropertySpecification.undefinedForbiddenIf)) {
320
+ const rawData__full = this.createInitialObjectSnapshotIfNotCreatedYet();
321
+ let rawData__currentObjectDepth;
322
+ switch (this.processingApproach) {
323
+ case RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject: {
324
+ rawData__currentObjectDepth = targetObjectTypeSourceValue;
325
+ break;
326
+ }
327
+ case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
328
+ rawData__currentObjectDepth =
329
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
330
+ (0, getObjectPropertySafely__TEMP_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
331
+ rawData__full;
332
+ }
333
+ }
304
334
  if (childPropertySpecification.undefinedForbiddenIf.predicate({
305
- rawData__currentObjectDepth: targetObjectTypeSourceValue,
306
- rawData__full: this.rawData,
307
- targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName
335
+ rawData__full,
336
+ rawData__currentObjectDepth,
337
+ targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName,
338
+ targetPropertyPathSegments: [...this.currentlyIteratedPropertyQualifiedInitialNameSegments]
308
339
  })) {
309
340
  hasAtLeastOneInvalidPropertyBeenDetected = true;
310
341
  this.registerValidationError({
@@ -324,30 +355,47 @@ class RawObjectDataProcessor {
324
355
  }
325
356
  }
326
357
  else if ((0, isNotUndefined_1.default)(childPropertySpecification.undefinedValueSubstitution)) {
358
+ this.createInitialObjectSnapshotIfNotCreatedYet();
327
359
  childPropertyMutableValue = childPropertySpecification.undefinedValueSubstitution;
328
360
  hasChildPropertyValueDefinitelyNotChanged = false;
329
361
  hasAllChildrenPropertiesValuesDefinitelyNotChanged = false;
330
362
  }
331
363
  }
332
- else if ("mustBeUndefinedIf" in childPropertySpecification &&
333
- childPropertySpecification.mustBeUndefinedIf?.predicate({
334
- rawData__currentObjectDepth: targetObjectTypeSourceValue,
335
- rawData__full: this.rawData,
336
- targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName
364
+ else if ("mustBeUndefinedIf" in childPropertySpecification) {
365
+ const rawData__full = this.createInitialObjectSnapshotIfNotCreatedYet();
366
+ let rawData__currentObjectDepth;
367
+ switch (this.processingApproach) {
368
+ case RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject: {
369
+ rawData__currentObjectDepth = targetObjectTypeSourceValue;
370
+ break;
371
+ }
372
+ case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
373
+ rawData__currentObjectDepth =
374
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
375
+ (0, getObjectPropertySafely__TEMP_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
376
+ rawData__full;
377
+ }
378
+ }
379
+ if (childPropertySpecification.mustBeUndefinedIf?.predicate({
380
+ rawData__currentObjectDepth,
381
+ rawData__full,
382
+ targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName,
383
+ targetPropertyPathSegments: [...this.currentlyIteratedPropertyQualifiedInitialNameSegments]
337
384
  }) === true) {
338
- this.registerValidationError({
339
- title: this.localization.validationErrors.conditionallyForbiddenNonUndefinedValue.title,
340
- description: this.localization.validationErrors.conditionallyForbiddenNonUndefinedValue.generateDescription({
341
- verbalConditionWhenMustBeUndefinedWithoutEndOfSentenceMark: childPropertySpecification.mustBeUndefinedIf.descriptionForLogging
342
- }),
343
- targetPropertyDotSeparatedQualifiedInitialName: this.currentObjectPropertyDotSeparatedQualifiedName,
344
- targetPropertyNewName: childPropertySpecification.newName ?? null,
345
- targetPropertyValue: childPropertyMutableValue,
346
- targetPropertyValueSpecification: childPropertySpecification,
347
- targetPropertyStringifiedValueBeforeFirstPreValidationModification: childPropertyStringifiedValueBeforeFirstPreValidationModification,
348
- documentationPageAnchor: "VALIDATION_ERRORS_MESSAGES-CONDITIONALLY_FORBIDDEN_NON_UNDEFINED_VALUE"
349
- });
350
- continue;
385
+ this.registerValidationError({
386
+ title: this.localization.validationErrors.conditionallyForbiddenNonUndefinedValue.title,
387
+ description: this.localization.validationErrors.conditionallyForbiddenNonUndefinedValue.generateDescription({
388
+ verbalConditionWhenMustBeUndefinedWithoutEndOfSentenceMark: childPropertySpecification.mustBeUndefinedIf.descriptionForLogging
389
+ }),
390
+ targetPropertyDotSeparatedQualifiedInitialName: this.currentObjectPropertyDotSeparatedQualifiedName,
391
+ targetPropertyNewName: childPropertySpecification.newName ?? null,
392
+ targetPropertyValue: childPropertyMutableValue,
393
+ targetPropertyValueSpecification: childPropertySpecification,
394
+ targetPropertyStringifiedValueBeforeFirstPreValidationModification: childPropertyStringifiedValueBeforeFirstPreValidationModification,
395
+ documentationPageAnchor: "VALIDATION_ERRORS_MESSAGES-CONDITIONALLY_FORBIDDEN_NON_UNDEFINED_VALUE"
396
+ });
397
+ continue;
398
+ }
351
399
  }
352
400
  if (!(0, isBoolean_1.default)(childPropertySpecification.isNullForbidden) &&
353
401
  (0, isUndefined_1.default)(childPropertySpecification.nullForbiddenIf) &&
@@ -379,10 +427,25 @@ class RawObjectDataProcessor {
379
427
  continue;
380
428
  }
381
429
  if ((0, isNotUndefined_1.default)(childPropertySpecification.nullForbiddenIf)) {
430
+ const rawData__full = this.createInitialObjectSnapshotIfNotCreatedYet();
431
+ let rawData__currentObjectDepth;
432
+ switch (this.processingApproach) {
433
+ case RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject: {
434
+ rawData__currentObjectDepth = targetObjectTypeSourceValue;
435
+ break;
436
+ }
437
+ case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
438
+ rawData__currentObjectDepth =
439
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
440
+ (0, getObjectPropertySafely__TEMP_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1)) :
441
+ rawData__full;
442
+ }
443
+ }
382
444
  if (childPropertySpecification.nullForbiddenIf.predicate({
383
- rawData__currentObjectDepth: targetObjectTypeSourceValue,
384
- rawData__full: this.rawData,
385
- targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName
445
+ rawData__full,
446
+ rawData__currentObjectDepth,
447
+ targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName,
448
+ targetPropertyPathSegments: [...this.currentlyIteratedPropertyQualifiedInitialNameSegments]
386
449
  })) {
387
450
  hasAtLeastOneInvalidPropertyBeenDetected = true;
388
451
  this.registerValidationError({
@@ -402,30 +465,47 @@ class RawObjectDataProcessor {
402
465
  }
403
466
  }
404
467
  else if ((0, isNotUndefined_1.default)(childPropertySpecification.nullValueSubstitution)) {
468
+ this.createInitialObjectSnapshotIfNotCreatedYet();
405
469
  childPropertyMutableValue = childPropertySpecification.nullValueSubstitution;
406
470
  hasChildPropertyValueDefinitelyNotChanged = false;
407
471
  hasAllChildrenPropertiesValuesDefinitelyNotChanged = false;
408
472
  }
409
473
  }
410
- else if ("mustBeNullIf" in childPropertySpecification &&
411
- childPropertySpecification.mustBeNullIf?.predicate({
412
- rawData__currentObjectDepth: targetObjectTypeSourceValue,
413
- rawData__full: this.rawData,
414
- targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName
474
+ else if ("mustBeNullIf" in childPropertySpecification) {
475
+ const rawData__full = this.createInitialObjectSnapshotIfNotCreatedYet();
476
+ let rawData__currentObjectDepth;
477
+ switch (this.processingApproach) {
478
+ case RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject: {
479
+ rawData__currentObjectDepth = targetObjectTypeSourceValue;
480
+ break;
481
+ }
482
+ case RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject: {
483
+ rawData__currentObjectDepth =
484
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.length > 1 ?
485
+ (0, getObjectPropertySafely__TEMP_1.default)(rawData__full, this.currentlyIteratedPropertyQualifiedInitialNameSegments.slice(0, -1).join(".")) :
486
+ rawData__full;
487
+ }
488
+ }
489
+ if (childPropertySpecification.mustBeNullIf?.predicate({
490
+ rawData__currentObjectDepth,
491
+ rawData__full,
492
+ targetPropertyDotSeparatedPath: this.currentObjectPropertyDotSeparatedQualifiedName,
493
+ targetPropertyPathSegments: [...this.currentlyIteratedPropertyQualifiedInitialNameSegments]
415
494
  }) === true) {
416
- this.registerValidationError({
417
- title: this.localization.validationErrors.conditionallyForbiddenNonNullValue.title,
418
- description: this.localization.validationErrors.conditionallyForbiddenNonNullValue.generateDescription({
419
- verbalConditionWhenMustBeNullWithoutEndOfSentenceMark: childPropertySpecification.mustBeNullIf.descriptionForLogging
420
- }),
421
- targetPropertyDotSeparatedQualifiedInitialName: this.currentObjectPropertyDotSeparatedQualifiedName,
422
- targetPropertyNewName: childPropertySpecification.newName ?? null,
423
- targetPropertyValue: childPropertyMutableValue,
424
- targetPropertyValueSpecification: childPropertySpecification,
425
- targetPropertyStringifiedValueBeforeFirstPreValidationModification: childPropertyStringifiedValueBeforeFirstPreValidationModification,
426
- documentationPageAnchor: "VALIDATION_ERRORS_MESSAGES-CONDITIONALLY_FORBIDDEN_NON_NULL_VALUE"
427
- });
428
- continue;
495
+ this.registerValidationError({
496
+ title: this.localization.validationErrors.conditionallyForbiddenNonNullValue.title,
497
+ description: this.localization.validationErrors.conditionallyForbiddenNonNullValue.generateDescription({
498
+ verbalConditionWhenMustBeNullWithoutEndOfSentenceMark: childPropertySpecification.mustBeNullIf.descriptionForLogging
499
+ }),
500
+ targetPropertyDotSeparatedQualifiedInitialName: this.currentObjectPropertyDotSeparatedQualifiedName,
501
+ targetPropertyNewName: childPropertySpecification.newName ?? null,
502
+ targetPropertyValue: childPropertyMutableValue,
503
+ targetPropertyValueSpecification: childPropertySpecification,
504
+ targetPropertyStringifiedValueBeforeFirstPreValidationModification: childPropertyStringifiedValueBeforeFirstPreValidationModification,
505
+ documentationPageAnchor: "VALIDATION_ERRORS_MESSAGES-CONDITIONALLY_FORBIDDEN_NON_NULL_VALUE"
506
+ });
507
+ continue;
508
+ }
429
509
  }
430
510
  if ((0, isNeitherUndefinedNorNull_1.default)(childPropertyMutableValue)) {
431
511
  const childPropertyValueProcessingResult = this.processSingleNeitherUndefinedNorNullValue({
@@ -608,7 +688,7 @@ class RawObjectDataProcessor {
608
688
  }
609
689
  }
610
690
  }
611
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.splice(-1, 1);
691
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.splice(-1, 1);
612
692
  this.currentlyIteratedPropertyNewNamesByDepthLevelsForLogging.splice(-1, 1);
613
693
  if (targetObjectTypeValueSpecification.mustExpectOnlySpecifiedProperties === true &&
614
694
  initialNamesOfNotCheckedYetProperties.size > 0) {
@@ -654,8 +734,12 @@ class RawObjectDataProcessor {
654
734
  else if (this.isValidationOnlyMode) {
655
735
  return { thisOneIsValidButPostProcessingDisabledForPerformanceBecauseDataIsInvalidInLarge: true };
656
736
  }
657
- for (const postValidationModification of RawObjectDataProcessor.
658
- getNormalizedPostValidationModifications(targetObjectTypeValueSpecification.postValidationModifications)) {
737
+ const normalizedPostValidationModifications = RawObjectDataProcessor.
738
+ getNormalizedPostValidationModifications(targetObjectTypeValueSpecification.postValidationModifications);
739
+ if (normalizedPostValidationModifications.length > 0) {
740
+ this.createInitialObjectSnapshotIfNotCreatedYet();
741
+ }
742
+ for (const postValidationModification of normalizedPostValidationModifications) {
659
743
  processedValueWorkpiece = postValidationModification(processedValueWorkpiece);
660
744
  }
661
745
  for (const keyOfPropertyWhichWillBeDeleted of targetObjectTypeValueSpecification.propertiesWillBeDeletedAfterPostValidationModifications ?? []) {
@@ -775,7 +859,7 @@ class RawObjectDataProcessor {
775
859
  }
776
860
  let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject ?
777
861
  targetObjectTypeSourceValue : {};
778
- const currentObjectDepthLevel__countFromZero = this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.length;
862
+ const currentObjectDepthLevel__countFromZero = this.currentlyIteratedPropertyQualifiedInitialNameSegments.length;
779
863
  let hasAtLeastOneInvalidValueBeenDetected = false;
780
864
  const forbiddenKeys = targetAssociativeArrayTypeValueSpecification.forbiddenKeys ?? [];
781
865
  let allowedKeys;
@@ -800,8 +884,7 @@ class RawObjectDataProcessor {
800
884
  let hasAllEntriesDefinitelyNotChanged = true;
801
885
  const foundDisallowedKeys = [];
802
886
  for (const [initialKey, rawValue] of Object.entries(targetObjectTypeSourceValue)) {
803
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging[currentObjectDepthLevel__countFromZero] =
804
- initialKey;
887
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments[currentObjectDepthLevel__countFromZero] = initialKey;
805
888
  if (!allowedKeys.includes(initialKey)) {
806
889
  foundDisallowedKeys.push(initialKey);
807
890
  }
@@ -810,8 +893,9 @@ class RawObjectDataProcessor {
810
893
  if ((0, isNotNull_1.default)(newNameOfKey)) {
811
894
  this.currentlyIteratedPropertyNewNamesByDepthLevelsForLogging[currentObjectDepthLevel__countFromZero] =
812
895
  newNameOfKey;
896
+ this.createInitialObjectSnapshotIfNotCreatedYet();
813
897
  }
814
- if (hasAllEntriesDefinitelyNotChanged && finalKey !== initialKey) {
898
+ if (hasAllEntriesDefinitelyNotChanged && (0, isNotNull_1.default)(newNameOfKey)) {
815
899
  hasAllEntriesDefinitelyNotChanged = false;
816
900
  }
817
901
  let hasValueDefinitelyNotChanged = true;
@@ -828,6 +912,7 @@ class RawObjectDataProcessor {
828
912
  stringifiedValueBeforeFirstPreValidationModification = (0, ArbitraryValueFormatter_1.stringifyAndFormatArbitraryValue)(mutableValue);
829
913
  hasValueDefinitelyNotChanged = false;
830
914
  hasAllEntriesDefinitelyNotChanged = false;
915
+ this.createInitialObjectSnapshotIfNotCreatedYet();
831
916
  }
832
917
  for (const preValidationModification of preValidationModifications) {
833
918
  try {
@@ -963,7 +1048,7 @@ class RawObjectDataProcessor {
963
1048
  }
964
1049
  }
965
1050
  }
966
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.splice(-1, 1);
1051
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.splice(-1, 1);
967
1052
  this.currentlyIteratedPropertyNewNamesByDepthLevelsForLogging.splice(-1, 1);
968
1053
  if (foundDisallowedKeys.length > 0) {
969
1054
  hasTargetAssociativeArraySpecificEntryIndependentViolations = true;
@@ -1007,8 +1092,12 @@ class RawObjectDataProcessor {
1007
1092
  else if (this.isValidationOnlyMode) {
1008
1093
  return { thisOneIsValidButPostProcessingDisabledForPerformanceBecauseDataIsInvalidInLarge: true };
1009
1094
  }
1010
- for (const postValidationModification of RawObjectDataProcessor.
1011
- getNormalizedPostValidationModifications(targetAssociativeArrayTypeValueSpecification.postValidationModifications)) {
1095
+ const normalizedPostValidationModifications = RawObjectDataProcessor.
1096
+ getNormalizedPostValidationModifications(targetAssociativeArrayTypeValueSpecification.postValidationModifications);
1097
+ if (normalizedPostValidationModifications.length > 0) {
1098
+ this.createInitialObjectSnapshotIfNotCreatedYet();
1099
+ }
1100
+ for (const postValidationModification of normalizedPostValidationModifications) {
1012
1101
  processedValueWorkpiece = postValidationModification(processedValueWorkpiece);
1013
1102
  }
1014
1103
  return {
@@ -1118,12 +1207,11 @@ class RawObjectDataProcessor {
1118
1207
  }
1119
1208
  let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject ?
1120
1209
  targetArrayedTypeSourceValue : [];
1121
- const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.length;
1210
+ const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedPropertyQualifiedInitialNameSegments.length;
1122
1211
  let hasAtLeastOneInvalidElementBeenDetected = false;
1123
1212
  let hasAllElementsDefinitelyNotChanged = true;
1124
1213
  for (const [index, rawElement] of targetArrayedTypeSourceValue.entries()) {
1125
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging[currentObjectDepthLevel__beginWithZero] =
1126
- index;
1214
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments[currentObjectDepthLevel__beginWithZero] = index;
1127
1215
  let hasElementDefinitelyNotChanged = true;
1128
1216
  const preValidationModifications = RawObjectDataProcessor.
1129
1217
  getNormalizedPreValidationModifications({
@@ -1138,6 +1226,7 @@ class RawObjectDataProcessor {
1138
1226
  stringifiedElementBeforeFirstPreValidationModification = (0, ArbitraryValueFormatter_1.stringifyAndFormatArbitraryValue)(mutableElement);
1139
1227
  hasElementDefinitelyNotChanged = false;
1140
1228
  hasAllElementsDefinitelyNotChanged = false;
1229
+ this.createInitialObjectSnapshotIfNotCreatedYet();
1141
1230
  }
1142
1231
  for (const preValidationModification of preValidationModifications) {
1143
1232
  try {
@@ -1217,7 +1306,7 @@ class RawObjectDataProcessor {
1217
1306
  }
1218
1307
  }
1219
1308
  }
1220
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.splice(-1, 1);
1309
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.splice(-1, 1);
1221
1310
  for (const customValidator of RawObjectDataProcessor.getNormalizedCustomValidators(targetIndexedArrayTypeValueSpecification.customValidators)) {
1222
1311
  if (!customValidator.validationFunction({
1223
1312
  value: targetArrayedTypeSourceValue,
@@ -1246,8 +1335,12 @@ class RawObjectDataProcessor {
1246
1335
  else if (this.isValidationOnlyMode) {
1247
1336
  return { thisOneIsValidButPostProcessingDisabledForPerformanceBecauseDataIsInvalidInLarge: true };
1248
1337
  }
1249
- for (const postValidationModification of RawObjectDataProcessor.
1250
- getNormalizedPostValidationModifications(targetIndexedArrayTypeValueSpecification.postValidationModifications)) {
1338
+ const normalizedPostValidationModifications = RawObjectDataProcessor.
1339
+ getNormalizedPostValidationModifications(targetIndexedArrayTypeValueSpecification.postValidationModifications);
1340
+ if (normalizedPostValidationModifications.length > 0) {
1341
+ this.createInitialObjectSnapshotIfNotCreatedYet();
1342
+ }
1343
+ for (const postValidationModification of normalizedPostValidationModifications) {
1251
1344
  processedValueWorkpiece = postValidationModification(processedValueWorkpiece);
1252
1345
  }
1253
1346
  return {
@@ -1322,13 +1415,12 @@ class RawObjectDataProcessor {
1322
1415
  }
1323
1416
  let processedValueWorkpiece = this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.manipulationsWithSourceObject ?
1324
1417
  targetArrayedTypeSourceValue : [];
1325
- const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.length;
1418
+ const currentObjectDepthLevel__beginWithZero = this.currentlyIteratedPropertyQualifiedInitialNameSegments.length;
1326
1419
  let hasAtLeastOneInvalidElementBeenDetected = false;
1327
1420
  let hasAllElementsDefinitelyNotChanged = true;
1328
1421
  for (const [elementStringifiedIndex, elementSpecification] of Object.entries(targetTupleTypeValueSpecification.elements)) {
1329
1422
  const elementIndex = Number.parseInt(elementStringifiedIndex, 10);
1330
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging[currentObjectDepthLevel__beginWithZero] =
1331
- elementIndex;
1423
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments[currentObjectDepthLevel__beginWithZero] = elementIndex;
1332
1424
  let hasElementDefinitelyNotChanged = true;
1333
1425
  const preValidationModifications = RawObjectDataProcessor.
1334
1426
  getNormalizedPreValidationModifications({
@@ -1342,6 +1434,7 @@ class RawObjectDataProcessor {
1342
1434
  stringifiedElementBeforeFirstPreValidationModification = (0, ArbitraryValueFormatter_1.stringifyAndFormatArbitraryValue)(mutableElement);
1343
1435
  hasElementDefinitelyNotChanged = false;
1344
1436
  hasAllElementsDefinitelyNotChanged = false;
1437
+ this.createInitialObjectSnapshotIfNotCreatedYet();
1345
1438
  }
1346
1439
  for (const preValidationModification of preValidationModifications) {
1347
1440
  try {
@@ -1546,7 +1639,7 @@ class RawObjectDataProcessor {
1546
1639
  }
1547
1640
  }
1548
1641
  }
1549
- this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.splice(-1, 1);
1642
+ this.currentlyIteratedPropertyQualifiedInitialNameSegments.splice(-1, 1);
1550
1643
  for (const customValidator of RawObjectDataProcessor.getNormalizedCustomValidators(targetTupleTypeValueSpecification.customValidators)) {
1551
1644
  if (!customValidator.validationFunction({
1552
1645
  value: targetArrayedTypeSourceValue,
@@ -1575,8 +1668,12 @@ class RawObjectDataProcessor {
1575
1668
  else if (this.isValidationOnlyMode) {
1576
1669
  return { thisOneIsValidButPostProcessingDisabledForPerformanceBecauseDataIsInvalidInLarge: true };
1577
1670
  }
1578
- for (const postValidationModification of RawObjectDataProcessor.
1579
- getNormalizedPostValidationModifications(targetTupleTypeValueSpecification.postValidationModifications)) {
1671
+ const normalizedPostValidationModifications = RawObjectDataProcessor.
1672
+ getNormalizedPostValidationModifications(targetTupleTypeValueSpecification.postValidationModifications);
1673
+ if (normalizedPostValidationModifications.length > 0) {
1674
+ this.createInitialObjectSnapshotIfNotCreatedYet();
1675
+ }
1676
+ for (const postValidationModification of normalizedPostValidationModifications) {
1580
1677
  processedValueWorkpiece = postValidationModification(processedValueWorkpiece);
1581
1678
  }
1582
1679
  return {
@@ -1961,7 +2058,7 @@ class RawObjectDataProcessor {
1961
2058
  description: this.localization.validationErrors.valueTypeDoesNotMatchWithExpected.
1962
2059
  generateDescription({
1963
2060
  actualNativeType: typeof targetValue__expectedToBeString,
1964
- expectedTypeID: RawObjectDataProcessor.ValuesTypesIDs.number
2061
+ expectedTypeID: RawObjectDataProcessor.ValuesTypesIDs.string
1965
2062
  }),
1966
2063
  targetPropertyDotSeparatedQualifiedInitialName: this.currentObjectPropertyDotSeparatedQualifiedName,
1967
2064
  targetPropertyNewName: (0, getLastElementOfArray_1.default)(this.currentlyIteratedPropertyNewNamesByDepthLevelsForLogging),
@@ -2292,11 +2389,18 @@ class RawObjectDataProcessor {
2292
2389
  });
2293
2390
  }
2294
2391
  get currentObjectPropertyDotSeparatedQualifiedName() {
2295
- return this.currentlyIteratedObjectPropertyQualifiedInitialNameSegmentsForLogging.join(".");
2392
+ return this.currentlyIteratedPropertyQualifiedInitialNameSegments.join(".");
2296
2393
  }
2297
2394
  registerValidationError(payload) {
2298
2395
  this.validationErrorsMessages.push(RawObjectDataProcessor.generateValidationErrorMessage(payload, this.localization));
2299
2396
  }
2397
+ createInitialObjectSnapshotIfNotCreatedYet() {
2398
+ if (this.processingApproach === RawObjectDataProcessor.ProcessingApproaches.assemblingOfNewObject) {
2399
+ return this.rawData;
2400
+ }
2401
+ return this.initialObjectSnapshot ??
2402
+ (this.initialObjectSnapshot = ValuesDeepCopier_1.default.deeplyCloneObjectLikeValueAsPossible(this.rawData));
2403
+ }
2300
2404
  handleFailedPreValidationModification({ error, propertyOrElementMutableValue, propertyOrElementValueSpecification, propertyOrElementStringifiedValueBeforeFirstPreValidationModification, occurrenceMethodName }) {
2301
2405
  switch (this.errorHandlingStrategies.onPreValidationModificationFailed) {
2302
2406
  case RawObjectDataProcessor.ErrorHandlingStrategies.throwingOfError: {