@fluid-experimental/property-changeset 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +1 -0
  2. package/dist/changeset.d.ts +2 -2
  3. package/dist/changeset.d.ts.map +1 -1
  4. package/dist/changeset.js +61 -45
  5. package/dist/changeset.js.map +1 -1
  6. package/dist/changeset_operations/array.d.ts +6 -6
  7. package/dist/changeset_operations/array.d.ts.map +1 -1
  8. package/dist/changeset_operations/array.js +87 -56
  9. package/dist/changeset_operations/array.js.map +1 -1
  10. package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
  11. package/dist/changeset_operations/arrayChangesetIterator.js +43 -41
  12. package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
  13. package/dist/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
  14. package/dist/changeset_operations/changesetConflictTypes.js.map +1 -1
  15. package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
  16. package/dist/changeset_operations/indexedCollection.js +76 -44
  17. package/dist/changeset_operations/indexedCollection.js.map +1 -1
  18. package/dist/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
  19. package/dist/changeset_operations/isEmptyChangeset.js +2 -1
  20. package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
  21. package/dist/changeset_operations/operationTypes.d.ts.map +1 -1
  22. package/dist/changeset_operations/operationTypes.js.map +1 -1
  23. package/dist/helpers/typeidHelper.d.ts +10 -10
  24. package/dist/helpers/typeidHelper.d.ts.map +1 -1
  25. package/dist/helpers/typeidHelper.js +19 -17
  26. package/dist/helpers/typeidHelper.js.map +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/isReservedKeyword.d.ts.map +1 -1
  30. package/dist/isReservedKeyword.js.map +1 -1
  31. package/dist/pathHelper.d.ts.map +1 -1
  32. package/dist/pathHelper.js +16 -10
  33. package/dist/pathHelper.js.map +1 -1
  34. package/dist/rebase.d.ts.map +1 -1
  35. package/dist/rebase.js +20 -13
  36. package/dist/rebase.js.map +1 -1
  37. package/dist/templateSchema.d.ts.map +1 -1
  38. package/dist/templateSchema.js +10 -11
  39. package/dist/templateSchema.js.map +1 -1
  40. package/dist/templateValidator.d.ts.map +1 -1
  41. package/dist/templateValidator.js +135 -102
  42. package/dist/templateValidator.js.map +1 -1
  43. package/dist/test/array.spec.js +141 -343
  44. package/dist/test/array.spec.js.map +1 -1
  45. package/dist/test/pathHelper.spec.js +299 -166
  46. package/dist/test/pathHelper.spec.js.map +1 -1
  47. package/dist/test/reversibleCs.spec.js.map +1 -1
  48. package/dist/test/schemaValidator.js +3 -1
  49. package/dist/test/schemaValidator.js.map +1 -1
  50. package/dist/test/schemas/badBothPropertiesAndTypeid.js +8 -8
  51. package/dist/test/schemas/badBothPropertiesAndTypeid.js.map +1 -1
  52. package/dist/test/schemas/badInvalidSemverInTypeid.js +18 -16
  53. package/dist/test/schemas/badInvalidSemverInTypeid.js.map +1 -1
  54. package/dist/test/schemas/badMissingSemverInTypeid.js +18 -16
  55. package/dist/test/schemas/badMissingSemverInTypeid.js.map +1 -1
  56. package/dist/test/schemas/badNestedProperties.js +18 -17
  57. package/dist/test/schemas/badNestedProperties.js.map +1 -1
  58. package/dist/test/schemas/badPrimitiveTypeid.js +9 -8
  59. package/dist/test/schemas/badPrimitiveTypeid.js.map +1 -1
  60. package/dist/test/schemas/badVersionedTypeid.js +19 -17
  61. package/dist/test/schemas/badVersionedTypeid.js.map +1 -1
  62. package/dist/test/schemas/goodColorPalette.js +4 -4
  63. package/dist/test/schemas/goodColorPalette.js.map +1 -1
  64. package/dist/test/schemas/goodDraftAsVersion.js +2 -4
  65. package/dist/test/schemas/goodDraftAsVersion.js.map +1 -1
  66. package/dist/test/schemas/goodPointId.js +18 -16
  67. package/dist/test/schemas/goodPointId.js.map +1 -1
  68. package/dist/test/schemas/goodReferenceAndRegular.js +5 -5
  69. package/dist/test/schemas/goodReferenceAndRegular.js.map +1 -1
  70. package/dist/test/schemas/goodReservedTypes.js +8 -7
  71. package/dist/test/schemas/goodReservedTypes.js.map +1 -1
  72. package/dist/test/schemas/goodUIBorder.js +19 -16
  73. package/dist/test/schemas/goodUIBorder.js.map +1 -1
  74. package/dist/test/tsconfig.tsbuildinfo +1 -1
  75. package/dist/test/validator/templateSyntax.spec.js.map +1 -1
  76. package/dist/test/validator/templateValidator.spec.js +329 -306
  77. package/dist/test/validator/templateValidator.spec.js.map +1 -1
  78. package/dist/test/validator/typeidHelper.spec.js +98 -65
  79. package/dist/test/validator/typeidHelper.spec.js.map +1 -1
  80. package/dist/utils.d.ts +1 -1
  81. package/dist/utils.d.ts.map +1 -1
  82. package/dist/utils.js +149 -95
  83. package/dist/utils.js.map +1 -1
  84. package/dist/validationResultBuilder.d.ts.map +1 -1
  85. package/dist/validationResultBuilder.js.map +1 -1
  86. package/lib/changeset.js +63 -47
  87. package/lib/changeset.js.map +1 -1
  88. package/lib/changeset_operations/array.js +88 -57
  89. package/lib/changeset_operations/array.js.map +1 -1
  90. package/lib/changeset_operations/arrayChangesetIterator.js +43 -41
  91. package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
  92. package/lib/changeset_operations/changesetConflictTypes.js.map +1 -1
  93. package/lib/changeset_operations/indexedCollection.js +76 -44
  94. package/lib/changeset_operations/indexedCollection.js.map +1 -1
  95. package/lib/changeset_operations/isEmptyChangeset.js +2 -1
  96. package/lib/changeset_operations/isEmptyChangeset.js.map +1 -1
  97. package/lib/changeset_operations/operationTypes.js.map +1 -1
  98. package/lib/helpers/typeidHelper.js +19 -17
  99. package/lib/helpers/typeidHelper.js.map +1 -1
  100. package/lib/index.js.map +1 -1
  101. package/lib/isReservedKeyword.js.map +1 -1
  102. package/lib/pathHelper.js +17 -11
  103. package/lib/pathHelper.js.map +1 -1
  104. package/lib/rebase.js +20 -13
  105. package/lib/rebase.js.map +1 -1
  106. package/lib/templateSchema.js +10 -11
  107. package/lib/templateSchema.js.map +1 -1
  108. package/lib/templateValidator.js +135 -102
  109. package/lib/templateValidator.js.map +1 -1
  110. package/lib/utils.js +149 -95
  111. package/lib/utils.js.map +1 -1
  112. package/lib/validationResultBuilder.js.map +1 -1
  113. package/package.json +100 -100
package/lib/utils.js CHANGED
@@ -23,18 +23,18 @@ const { PROPERTY_PATH_DELIMITER, MSG } = constants;
23
23
  * Utils
24
24
  * @alias property-changeset.Utils
25
25
  * @class
26
- */
26
+ */
27
27
  // eslint-disable-next-line @typescript-eslint/no-namespace
28
28
  export var Utils;
29
29
  (function (Utils) {
30
30
  /**
31
- * Traverses a ChangeSet recursively and invokes the callback for each visited property.
32
- *
33
- * @param in_preCallback - The (pre-order) callback function that is invoked for each property
34
- * @param in_postCallback - The (post-order) callback function that is invoked for each property
35
- * @param in_context - The traversal context for the currently processed property
36
- * @param in_levelCallback - A callback for when a node is reached
37
- */
31
+ * Traverses a ChangeSet recursively and invokes the callback for each visited property.
32
+ *
33
+ * @param in_preCallback - The (pre-order) callback function that is invoked for each property
34
+ * @param in_postCallback - The (post-order) callback function that is invoked for each property
35
+ * @param in_context - The traversal context for the currently processed property
36
+ * @param in_levelCallback - A callback for when a node is reached
37
+ */
38
38
  function _traverseChangeSetRecursivelyAsync(in_preCallback, in_postCallback, in_context, in_levelCallback) {
39
39
  let pathSeparator;
40
40
  let currentPath;
@@ -44,9 +44,7 @@ export var Utils;
44
44
  // Call the callback function for this ChangeSet
45
45
  in_context._traversalStopped = false;
46
46
  const typeid = in_context.getTypeid();
47
- let splitTypeId = typeid !== undefined ?
48
- TypeIdHelper.extractContext(typeid) :
49
- undefined;
47
+ let splitTypeId = typeid !== undefined ? TypeIdHelper.extractContext(typeid) : undefined;
50
48
  in_context.setSplitTypeID(splitTypeId);
51
49
  let currentUserData;
52
50
  series([
@@ -66,9 +64,8 @@ export var Utils;
66
64
  const _typeid = in_context.getTypeid();
67
65
  // Call the callback function for this ChangeSet
68
66
  in_context._traversalStopped = false;
69
- splitTypeId = _typeid !== undefined ?
70
- TypeIdHelper.extractContext(_typeid) :
71
- undefined;
67
+ splitTypeId =
68
+ _typeid !== undefined ? TypeIdHelper.extractContext(_typeid) : undefined;
72
69
  in_context.setSplitTypeID(splitTypeId);
73
70
  if (in_postCallback !== undefined) {
74
71
  // TODO: this duplicates the context object putting stress on the GC.
@@ -103,16 +100,20 @@ export var Utils;
103
100
  try {
104
101
  // Update the path
105
102
  in_context._lastSegment = in_segment;
106
- const escapedSegment = in_escape && isString(in_segment) ? PathHelper.quotePathSegmentIfNeeded(in_segment) : in_segment;
103
+ const escapedSegment = in_escape && isString(in_segment)
104
+ ? PathHelper.quotePathSegmentIfNeeded(in_segment)
105
+ : in_segment;
107
106
  let nextSegmentToPushInParentStack = in_context.getLastSegment();
108
107
  // Note: we don't quote the path string here, since the paths
109
108
  // in a ChangeSet are already quoted, if necessary
110
- in_context._lastSegmentString = currentTypeIdContext === "map" ||
111
- currentTypeIdContext === "array" ||
112
- currentTypeIdContext === "set"
113
- ? `[${escapedSegment}]`
114
- : pathSeparator + escapedSegment;
115
- in_context._fullPath = currentPath + in_context.getLastSegmentString();
109
+ in_context._lastSegmentString =
110
+ currentTypeIdContext === "map" ||
111
+ currentTypeIdContext === "array" ||
112
+ currentTypeIdContext === "set"
113
+ ? `[${escapedSegment}]`
114
+ : pathSeparator + escapedSegment;
115
+ in_context._fullPath =
116
+ currentPath + in_context.getLastSegmentString();
116
117
  // Store the typeid and nested ChangeSet
117
118
  in_context._typeid = in_nestedTypeid;
118
119
  in_context._nestedChangeSet = in_subChangeSet;
@@ -121,22 +122,29 @@ export var Utils;
121
122
  in_context._arrayLocalIndex = in_arrayLocalIndex;
122
123
  in_context._arrayOperationOffset = in_arrayOperationOffset;
123
124
  in_context._arrayIteratorOffset = in_arrayIteratorOffset;
124
- if (in_arrayIteratorOffset !== undefined && isNumber(in_segment)) {
125
+ if (in_arrayIteratorOffset !== undefined &&
126
+ isNumber(in_segment)) {
125
127
  if (in_context._operationType === "remove") {
126
128
  nextSegmentToPushInParentStack =
127
- in_context.getLastSegment() + in_arrayIteratorOffset - in_arrayLocalIndex;
128
- in_context._fullPostPath =
129
- `${currentPostPath}[${in_segment +
130
- in_arrayIteratorOffset - in_arrayLocalIndex}]`;
129
+ in_context.getLastSegment() +
130
+ in_arrayIteratorOffset -
131
+ in_arrayLocalIndex;
132
+ in_context._fullPostPath = `${currentPostPath}[${in_segment +
133
+ in_arrayIteratorOffset -
134
+ in_arrayLocalIndex}]`;
131
135
  }
132
136
  else {
133
- nextSegmentToPushInParentStack = in_context.getLastSegment() + in_arrayIteratorOffset;
137
+ nextSegmentToPushInParentStack =
138
+ in_context.getLastSegment() +
139
+ in_arrayIteratorOffset;
134
140
  in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset}]`;
135
141
  }
136
142
  }
137
143
  else {
138
- nextSegmentToPushInParentStack = in_context._lastSegment;
139
- in_context._fullPostPath = currentPostPath + in_context._lastSegmentString;
144
+ nextSegmentToPushInParentStack =
145
+ in_context._lastSegment;
146
+ in_context._fullPostPath =
147
+ currentPostPath + in_context._lastSegmentString;
140
148
  }
141
149
  // Continue traversal
142
150
  in_context._stackDepth++;
@@ -167,9 +175,11 @@ export var Utils;
167
175
  series([
168
176
  function (n3) {
169
177
  // If this property is a collection, we set the correct type, otherwise we assume it is a NodeProperty
170
- const propertyContainerType = (splitTypeId.context === "map" ||
178
+ const propertyContainerType = splitTypeId.context === "map" ||
171
179
  splitTypeId.context === "set" ||
172
- splitTypeId.context === "array") ? splitTypeId.context : "NodeProperty";
180
+ splitTypeId.context === "array"
181
+ ? splitTypeId.context
182
+ : "NodeProperty";
173
183
  let oldOperationType = in_context._operationType;
174
184
  if (splitTypeId.context === "array") {
175
185
  // Use the ArrayChangeSetIterator to process the changes in the ChangeSet in the correct order
@@ -184,7 +194,8 @@ export var Utils;
184
194
  switch (arrayIterator.opDescription.type) {
185
195
  case ArrayIteratorOperationTypes.INSERT:
186
196
  in_context._operationType = "insert";
187
- operation = arrayIterator.opDescription.operation;
197
+ operation =
198
+ arrayIterator.opDescription.operation;
188
199
  eachOfSeries(operation[1], function (item, i, n5) {
189
200
  // The typeid is stored inline for arrays
190
201
  const typeid = item.typeid;
@@ -198,7 +209,8 @@ export var Utils;
198
209
  break;
199
210
  case ArrayIteratorOperationTypes.REMOVE:
200
211
  in_context._operationType = "remove";
201
- operation = arrayIterator.opDescription.operation;
212
+ operation =
213
+ arrayIterator.opDescription.operation;
202
214
  timesSeries(operation[1], function (i, n5) {
203
215
  // For removals, we don't have a typeid and we use the ChangeSet
204
216
  // of the removal operation as nested
@@ -211,7 +223,8 @@ export var Utils;
211
223
  });
212
224
  break;
213
225
  case ArrayIteratorOperationTypes.MODIFY:
214
- operation = arrayIterator.opDescription.operation;
226
+ operation =
227
+ arrayIterator.opDescription.operation;
215
228
  in_context._operationType = "modify";
216
229
  timesSeries(operation[1].length, function (i, n5) {
217
230
  // The typeid is stored inline for arrays
@@ -226,7 +239,8 @@ export var Utils;
226
239
  break;
227
240
  default:
228
241
  arrayIterator.next();
229
- n4(new Error(MSG.UNKNOWN_OPERATOR + arrayIterator.opDescription.type));
242
+ n4(new Error(MSG.UNKNOWN_OPERATOR +
243
+ arrayIterator.opDescription.type));
230
244
  }
231
245
  }, function (err) {
232
246
  in_context._operationType = oldOperationType;
@@ -247,7 +261,8 @@ export var Utils;
247
261
  // removal operation as nested ChangeSet
248
262
  processChange(paths[i], nestedChangeSet.remove, undefined, true, propertyContainerType, undefined, undefined, undefined, undefined, n5);
249
263
  }, function (err) {
250
- in_context._operationType = oldOperationType;
264
+ in_context._operationType =
265
+ oldOperationType;
251
266
  n4(err);
252
267
  });
253
268
  }
@@ -261,7 +276,8 @@ export var Utils;
261
276
  processChange(paths[j], nestedChangeSet.remove[typeid][paths[j]], typeid, true, propertyContainerType, undefined, undefined, undefined, undefined, n6);
262
277
  }, n5);
263
278
  }, function (err) {
264
- in_context._operationType = oldOperationType;
279
+ in_context._operationType =
280
+ oldOperationType;
265
281
  n4(err);
266
282
  });
267
283
  }
@@ -284,7 +300,8 @@ export var Utils;
284
300
  processChange(paths[j], nestedChangeSet.insert[typeid][paths[j]], typeid, true, propertyContainerType, undefined, undefined, undefined, undefined, n6);
285
301
  }, n5);
286
302
  }, function (err) {
287
- in_context._operationType = oldOperationType;
303
+ in_context._operationType =
304
+ oldOperationType;
288
305
  n4(err);
289
306
  });
290
307
  }
@@ -376,26 +393,26 @@ export var Utils;
376
393
  in_objectToPopulate.remove = in_objectToPopulate.remove || {};
377
394
  in_objectToPopulate.remove[in_context.getTypeid()] =
378
395
  in_objectToPopulate.remove[in_context.getTypeid()] || {};
379
- in_objectToPopulate.remove[in_context.getTypeid()][in_context.getLastSegment()] =
380
- cloneDeep(in_context.getNestedChangeSet());
396
+ in_objectToPopulate.remove[in_context.getTypeid()][in_context.getLastSegment()] = cloneDeep(in_context.getNestedChangeSet());
381
397
  }
382
398
  }
383
399
  else {
384
- in_objectToPopulate[in_context.getOperationType()] = in_objectToPopulate[in_context.getOperationType()] || {};
400
+ in_objectToPopulate[in_context.getOperationType()] =
401
+ in_objectToPopulate[in_context.getOperationType()] || {};
385
402
  in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] =
386
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] || {};
403
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] ||
404
+ {};
387
405
  if (TypeIdHelper.isPrimitiveType(in_context.getTypeid()) || in_isLeaf) {
388
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] =
389
- cloneDeep(in_context.getNestedChangeSet());
406
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] = cloneDeep(in_context.getNestedChangeSet());
390
407
  }
391
408
  else {
392
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] =
393
- nestedChangeSet;
409
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] = nestedChangeSet;
394
410
  }
395
411
  }
396
412
  }
397
413
  else if (in_context.getPropertyContainerType() === "template") {
398
- in_objectToPopulate[in_context.getTypeid()] = in_objectToPopulate[in_context.getTypeid()] || {};
414
+ in_objectToPopulate[in_context.getTypeid()] =
415
+ in_objectToPopulate[in_context.getTypeid()] || {};
399
416
  if (TypeIdHelper.isPrimitiveType(in_context.getTypeid()) || in_isLeaf) {
400
417
  in_objectToPopulate[in_context.getTypeid()][in_context.getLastSegment()] =
401
418
  cloneDeep(in_context.getNestedChangeSet());
@@ -429,9 +446,9 @@ export var Utils;
429
446
  const nestedChangeSet = in_context.getNestedChangeSet();
430
447
  // Call the callback function for this ChangeSet
431
448
  in_context._traversalStopped = false;
432
- const splitTypeId = in_context.getTypeid() !== undefined ?
433
- TypeIdHelper.extractContext(in_context.getTypeid()) :
434
- undefined;
449
+ const splitTypeId = in_context.getTypeid() !== undefined
450
+ ? TypeIdHelper.extractContext(in_context.getTypeid())
451
+ : undefined;
435
452
  in_context._splitTypeId = splitTypeId;
436
453
  // TODO: this duplicates the context object putting stress on the GC.
437
454
  let postOrderContext;
@@ -458,14 +475,17 @@ export var Utils;
458
475
  const processChange = function (in_segment, in_subChangeSet, in_nestedTypeid, in_escape, in_parentPropertyType, in_arrayOperationIndex, in_arrayLocalIndex, in_arrayOperationOffset, in_arrayIteratorOffset) {
459
476
  // Update the path
460
477
  in_context._lastSegment = in_segment;
461
- const escapedSegment = in_escape && isString(in_segment) ? PathHelper.quotePathSegmentIfNeeded(in_segment) : in_segment;
478
+ const escapedSegment = in_escape && isString(in_segment)
479
+ ? PathHelper.quotePathSegmentIfNeeded(in_segment)
480
+ : in_segment;
462
481
  let nextSegmentToPushInParentStack = in_context._lastSegment;
463
482
  // Note: we don't quote the path string here, since the paths in a ChangeSet are already quoted, if necessary
464
- in_context._lastSegmentString = currentTypeIdContext === "map" ||
465
- currentTypeIdContext === "array" ||
466
- currentTypeIdContext === "set"
467
- ? `[${escapedSegment}]`
468
- : pathSeparator + escapedSegment;
483
+ in_context._lastSegmentString =
484
+ currentTypeIdContext === "map" ||
485
+ currentTypeIdContext === "array" ||
486
+ currentTypeIdContext === "set"
487
+ ? `[${escapedSegment}]`
488
+ : pathSeparator + escapedSegment;
469
489
  in_context._fullPath = currentPath + in_context._lastSegmentString;
470
490
  // Store the typeid and nested ChangeSet
471
491
  in_context._typeid = in_nestedTypeid;
@@ -477,12 +497,15 @@ export var Utils;
477
497
  in_context._arrayIteratorOffset = in_arrayIteratorOffset;
478
498
  if (in_arrayIteratorOffset !== undefined) {
479
499
  if (in_context._operationType === "remove") {
480
- nextSegmentToPushInParentStack = in_context._lastSegment + in_arrayIteratorOffset - in_arrayLocalIndex;
481
- in_context._fullPostPath = `${currentPostPath}[${in_segment +
482
- in_arrayIteratorOffset - in_arrayLocalIndex}]`;
500
+ nextSegmentToPushInParentStack =
501
+ in_context._lastSegment +
502
+ in_arrayIteratorOffset -
503
+ in_arrayLocalIndex;
504
+ in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset - in_arrayLocalIndex}]`;
483
505
  }
484
506
  else {
485
- nextSegmentToPushInParentStack = in_context._lastSegment + in_arrayIteratorOffset;
507
+ nextSegmentToPushInParentStack =
508
+ in_context._lastSegment + in_arrayIteratorOffset;
486
509
  in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset}]`;
487
510
  }
488
511
  }
@@ -506,9 +529,11 @@ export var Utils;
506
529
  in_context._parentNestedChangeSet = nestedChangeSet;
507
530
  };
508
531
  // If this property is a collection, we set the correct type, otherwise we assume it is a NodeProperty
509
- const propertyContainerType = (splitTypeId.context === "map" ||
532
+ const propertyContainerType = splitTypeId.context === "map" ||
510
533
  splitTypeId.context === "set" ||
511
- splitTypeId.context === "array") ? splitTypeId.context : "NodeProperty";
534
+ splitTypeId.context === "array"
535
+ ? splitTypeId.context
536
+ : "NodeProperty";
512
537
  let oldOperationType = in_context._operationType;
513
538
  let paths;
514
539
  let typeids;
@@ -737,9 +762,9 @@ export var Utils;
737
762
  //
738
763
  // @ts-ignore currently it's not needed
739
764
  isLeafNode() {
740
- return TypeIdHelper.isPrimitiveType(this._typeid) ||
765
+ return (TypeIdHelper.isPrimitiveType(this._typeid) ||
741
766
  this._isEmptyObject(this) ||
742
- this.getOperationType() === "remove";
767
+ this.getOperationType() === "remove");
743
768
  }
744
769
  /**
745
770
  * Returns the index of the last segment, either a string with the key or a number with the position in the array
@@ -747,7 +772,9 @@ export var Utils;
747
772
  * @returns The last segment index
748
773
  */
749
774
  getPostLastSegment() {
750
- if (this._propertyContainerType === "array" && isNumber(this._lastSegment) && this._arrayIteratorOffset !== undefined) {
775
+ if (this._propertyContainerType === "array" &&
776
+ isNumber(this._lastSegment) &&
777
+ this._arrayIteratorOffset !== undefined) {
751
778
  return this._operationType === "remove"
752
779
  ? this._lastSegment + this._arrayIteratorOffset - this._arrayLocalIndex
753
780
  : this._lastSegment + this._arrayIteratorOffset;
@@ -790,8 +817,10 @@ export var Utils;
790
817
  but could not find "${this.getTypeid()}" in "${JSON.stringify(this.getParentNestedChangeSet())}"`);
791
818
  }
792
819
  }
793
- else if (this.getPropertyContainerType() === "NodeProperty" || this.getPropertyContainerType() === "map") {
794
- parent[this.getOperationType()][this.getTypeid()][this.getLastSegment()] = in_newNestedChangeset;
820
+ else if (this.getPropertyContainerType() === "NodeProperty" ||
821
+ this.getPropertyContainerType() === "map") {
822
+ parent[this.getOperationType()][this.getTypeid()][this.getLastSegment()] =
823
+ in_newNestedChangeset;
795
824
  }
796
825
  else {
797
826
  console.warn("replaceNestedChangeSet: not implemented. type: ", this.getPropertyContainerType());
@@ -1089,8 +1118,9 @@ export var Utils;
1089
1118
  return;
1090
1119
  }
1091
1120
  const operationScope = in_context.getPropertyContainerType() !== "template"
1092
- ? (userData[in_context.getOperationType()] = userData[in_context.getOperationType()]
1093
- || (in_context.getPropertyContainerType() === "array" ? [] : {}))
1121
+ ? (userData[in_context.getOperationType()] =
1122
+ userData[in_context.getOperationType()] ||
1123
+ (in_context.getPropertyContainerType() === "array" ? [] : {}))
1094
1124
  : userData;
1095
1125
  if (TypeIdHelper.isPrimitiveType(in_context.getTypeid())) {
1096
1126
  // This is a primitive type, we store it under its name in the result
@@ -1100,7 +1130,10 @@ export var Utils;
1100
1130
  const nestedUserData = {};
1101
1131
  if (in_context.getPropertyContainerType() === "array") {
1102
1132
  if (!operationScope[in_context.getArrayOperationIndex()]) {
1103
- operationScope[in_context.getArrayOperationIndex()] = [in_context.getArrayOperationOffset(), []];
1133
+ operationScope[in_context.getArrayOperationIndex()] = [
1134
+ in_context.getArrayOperationOffset(),
1135
+ [],
1136
+ ];
1104
1137
  }
1105
1138
  const arrayOperation = operationScope[in_context.getArrayOperationIndex()];
1106
1139
  arrayOperation[1][in_context.getArrayLocalIndex()] = nestedUserData;
@@ -1115,7 +1148,9 @@ export var Utils;
1115
1148
  userData: result,
1116
1149
  });
1117
1150
  // Remove all existing keys from the ChangeSet
1118
- Object.keys(io_changeSet).forEach(function (key) { delete io_changeSet[key]; });
1151
+ Object.keys(io_changeSet).forEach(function (key) {
1152
+ delete io_changeSet[key];
1153
+ });
1119
1154
  // Assign from the result user data
1120
1155
  extend(io_changeSet, result);
1121
1156
  }
@@ -1136,8 +1171,10 @@ export var Utils;
1136
1171
  // If we found and instance of the requested typeid, we store it under its path
1137
1172
  if (in_context.getTypeid() === in_typeid) {
1138
1173
  const userData = in_context.getUserData();
1139
- userData[in_context.getOperationType()] = userData[in_context.getOperationType()] || {};
1140
- userData[in_context.getOperationType()][in_context.getFullPath()] = in_context.getNestedChangeSet();
1174
+ userData[in_context.getOperationType()] =
1175
+ userData[in_context.getOperationType()] || {};
1176
+ userData[in_context.getOperationType()][in_context.getFullPath()] =
1177
+ in_context.getNestedChangeSet();
1141
1178
  }
1142
1179
  },
1143
1180
  userData: result,
@@ -1201,8 +1238,10 @@ export var Utils;
1201
1238
  changesetSegment.substr(0, mergedSegment.length) === mergedSegment &&
1202
1239
  level < pathSegments.length - 1) {
1203
1240
  level++;
1204
- mergedSegment = mergedSegment + PROPERTY_PATH_DELIMITER +
1205
- PathHelper.quotePathSegmentIfNeeded(pathSegments[level]);
1241
+ mergedSegment =
1242
+ mergedSegment +
1243
+ PROPERTY_PATH_DELIMITER +
1244
+ PathHelper.quotePathSegmentIfNeeded(pathSegments[level]);
1206
1245
  }
1207
1246
  // Have we found the right entry in the ChangeSet?
1208
1247
  // TODO: This could be done more efficiently
@@ -1223,7 +1262,8 @@ export var Utils;
1223
1262
  currentChangeSet = cloneDeep(currentChangeSet);
1224
1263
  Utils._stripTypeids(currentChangeSet);
1225
1264
  }
1226
- result[in_context.getOperationType()][in_context.getFullPath()] = currentChangeSet;
1265
+ result[in_context.getOperationType()][in_context.getFullPath()] =
1266
+ currentChangeSet;
1227
1267
  in_context._traversalStopped = true;
1228
1268
  }
1229
1269
  else {
@@ -1318,7 +1358,7 @@ export var Utils;
1318
1358
  * escaped (by adding an additional '_') before the lookup into the paths map. This frees the keyspace with
1319
1359
  * duplicated underscores for the use by the calling application.
1320
1360
  */
1321
- function getChangesToTokenizedPaths(in_paths, in_changeSet, in_callback, in_options = { escapeLeadingDoubleUnderscore: false, rootOperation: 'modify' }) {
1361
+ function getChangesToTokenizedPaths(in_paths, in_changeSet, in_callback, in_options = { escapeLeadingDoubleUnderscore: false, rootOperation: "modify" }) {
1322
1362
  const currentTokenizedPath = [];
1323
1363
  let paths;
1324
1364
  let legacyPaths;
@@ -1330,8 +1370,12 @@ export var Utils;
1330
1370
  // Note that if the calling application sets the in_options.escapeLeadingDoubleUnderscore option, it is responsible
1331
1371
  // for escaping input path segments that begin with a double underscore,
1332
1372
  // otherwise such segments will be considered as user data!
1333
- return in_options.escapeLeadingDoubleUnderscore && k && k.length > 2 && k[0] === "_" && k[1] === "_" &&
1334
- k[2] !== "_";
1373
+ return (in_options.escapeLeadingDoubleUnderscore &&
1374
+ k &&
1375
+ k.length > 2 &&
1376
+ k[0] === "_" &&
1377
+ k[1] === "_" &&
1378
+ k[2] !== "_");
1335
1379
  };
1336
1380
  let _convertLevelToMap = function (obj) {
1337
1381
  const thisLevel = new Map();
@@ -1365,9 +1409,9 @@ export var Utils;
1365
1409
  };
1366
1410
  const _toCallbackParam = (pathLevels) => {
1367
1411
  return legacyPaths
1368
- // If a user provided objects as paths, they would expect objects in their callbacks as well.
1369
- // So, we transform the parameter to an object, which is not very performant but is backwards compatible.
1370
- ? _convertMapToLevel(pathLevels)
1412
+ ? // If a user provided objects as paths, they would expect objects in their callbacks as well.
1413
+ // So, we transform the parameter to an object, which is not very performant but is backwards compatible.
1414
+ _convertMapToLevel(pathLevels)
1371
1415
  : pathLevels;
1372
1416
  };
1373
1417
  if (!(in_paths instanceof Map)) {
@@ -1538,18 +1582,24 @@ export var Utils;
1538
1582
  tokenizedPath.forEach((segment, index) => {
1539
1583
  if (index === 0) {
1540
1584
  parentPath += PathHelper.quotePathSegmentIfNeeded(segment);
1541
- changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
1585
+ changeSetToPopulate =
1586
+ pathToChangeSet[parentPath] || changeSetToPopulate;
1542
1587
  }
1543
1588
  else if (index < tokenizedPath.length - 1) {
1544
- parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
1545
- ? `.${PathHelper.quotePathSegmentIfNeeded(segment)}`
1546
- : `[${PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1547
- changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
1589
+ parentPath +=
1590
+ context.getContainerStack()[index] !== "set" &&
1591
+ context.getContainerStack()[index] !== "map"
1592
+ ? `.${PathHelper.quotePathSegmentIfNeeded(segment)}`
1593
+ : `[${PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1594
+ changeSetToPopulate =
1595
+ pathToChangeSet[parentPath] || changeSetToPopulate;
1548
1596
  }
1549
1597
  else {
1550
- parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
1551
- ? `.${PathHelper.quotePathSegmentIfNeeded(segment)}`
1552
- : `[${PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1598
+ parentPath +=
1599
+ context.getContainerStack()[index] !== "set" &&
1600
+ context.getContainerStack()[index] !== "map"
1601
+ ? `.${PathHelper.quotePathSegmentIfNeeded(segment)}`
1602
+ : `[${PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1553
1603
  fullPath = parentPath;
1554
1604
  }
1555
1605
  pathsToDelete.push(parentPath);
@@ -1576,7 +1626,8 @@ export var Utils;
1576
1626
  }
1577
1627
  }
1578
1628
  });
1579
- if (fullPath !== context.getFullPath() && pathToChangeSet[context.getFullPath()]) {
1629
+ if (fullPath !== context.getFullPath() &&
1630
+ pathToChangeSet[context.getFullPath()]) {
1580
1631
  // Here we are in the case where we have a changeset that
1581
1632
  // contains a property with path a.b.c.d as the key.
1582
1633
  // In that case, getChangesToTokenizedPaths will be called
@@ -1601,7 +1652,8 @@ export var Utils;
1601
1652
  // property container which means that our fullPath will actually contain
1602
1653
  // dots for sets. This is OK because we build the fullpath ourselves in such a
1603
1654
  // case and it will be consistent with the way we search for a valid changeSetToPopulate
1604
- if (context.getPropertyContainerType() !== "set" && context.getPropertyContainerType() !== "map") {
1655
+ if (context.getPropertyContainerType() !== "set" &&
1656
+ context.getPropertyContainerType() !== "map") {
1605
1657
  fullPath = context.getFullPath();
1606
1658
  }
1607
1659
  // keep a reference to the underlying change set of the current path.
@@ -1621,9 +1673,9 @@ export var Utils;
1621
1673
  // i.e.
1622
1674
  const lastSegment = context.getLastSegmentEscaped();
1623
1675
  if (contractedPathSegment &&
1624
- ((lastSegment.indexOf(".") !== -1 ||
1676
+ (lastSegment.indexOf(".") !== -1 ||
1625
1677
  (lastSegment.length > 0 && lastSegment[0] === '"')) &&
1626
- PathHelper.tokenizePathString(lastSegment).length > 1)) {
1678
+ PathHelper.tokenizePathString(lastSegment).length > 1) {
1627
1679
  toPurge[context.getFullPath()] = {
1628
1680
  changeSet: changeSetToPopulate,
1629
1681
  typeid: context.getTypeid(),
@@ -1762,7 +1814,9 @@ export var Utils;
1762
1814
  const rootChangeSet = cloneDeep(in_changeSet);
1763
1815
  Utils.traverseChangeSetRecursively(rootChangeSet, {
1764
1816
  preCallback: (in_context) => {
1765
- const shouldExclude = find(tokenizedPaths, (val) => { return isEqual(val, in_context.getParentStack()); });
1817
+ const shouldExclude = find(tokenizedPaths, (val) => {
1818
+ return isEqual(val, in_context.getParentStack());
1819
+ });
1766
1820
  if (shouldExclude) {
1767
1821
  const operationType = in_context.getOperationType();
1768
1822
  const typeId = in_context.getTypeid();