@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/dist/utils.js CHANGED
@@ -29,18 +29,18 @@ const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
29
29
  * Utils
30
30
  * @alias property-changeset.Utils
31
31
  * @class
32
- */
32
+ */
33
33
  // eslint-disable-next-line @typescript-eslint/no-namespace
34
34
  var Utils;
35
35
  (function (Utils) {
36
36
  /**
37
- * Traverses a ChangeSet recursively and invokes the callback for each visited property.
38
- *
39
- * @param in_preCallback - The (pre-order) callback function that is invoked for each property
40
- * @param in_postCallback - The (post-order) callback function that is invoked for each property
41
- * @param in_context - The traversal context for the currently processed property
42
- * @param in_levelCallback - A callback for when a node is reached
43
- */
37
+ * Traverses a ChangeSet recursively and invokes the callback for each visited property.
38
+ *
39
+ * @param in_preCallback - The (pre-order) callback function that is invoked for each property
40
+ * @param in_postCallback - The (post-order) callback function that is invoked for each property
41
+ * @param in_context - The traversal context for the currently processed property
42
+ * @param in_levelCallback - A callback for when a node is reached
43
+ */
44
44
  function _traverseChangeSetRecursivelyAsync(in_preCallback, in_postCallback, in_context, in_levelCallback) {
45
45
  let pathSeparator;
46
46
  let currentPath;
@@ -50,9 +50,7 @@ var Utils;
50
50
  // Call the callback function for this ChangeSet
51
51
  in_context._traversalStopped = false;
52
52
  const typeid = in_context.getTypeid();
53
- let splitTypeId = typeid !== undefined ?
54
- typeidHelper_1.TypeIdHelper.extractContext(typeid) :
55
- undefined;
53
+ let splitTypeId = typeid !== undefined ? typeidHelper_1.TypeIdHelper.extractContext(typeid) : undefined;
56
54
  in_context.setSplitTypeID(splitTypeId);
57
55
  let currentUserData;
58
56
  (0, async_1.series)([
@@ -72,9 +70,8 @@ var Utils;
72
70
  const _typeid = in_context.getTypeid();
73
71
  // Call the callback function for this ChangeSet
74
72
  in_context._traversalStopped = false;
75
- splitTypeId = _typeid !== undefined ?
76
- typeidHelper_1.TypeIdHelper.extractContext(_typeid) :
77
- undefined;
73
+ splitTypeId =
74
+ _typeid !== undefined ? typeidHelper_1.TypeIdHelper.extractContext(_typeid) : undefined;
78
75
  in_context.setSplitTypeID(splitTypeId);
79
76
  if (in_postCallback !== undefined) {
80
77
  // TODO: this duplicates the context object putting stress on the GC.
@@ -109,16 +106,20 @@ var Utils;
109
106
  try {
110
107
  // Update the path
111
108
  in_context._lastSegment = in_segment;
112
- const escapedSegment = in_escape && (0, isString_1.default)(in_segment) ? pathHelper_1.PathHelper.quotePathSegmentIfNeeded(in_segment) : in_segment;
109
+ const escapedSegment = in_escape && (0, isString_1.default)(in_segment)
110
+ ? pathHelper_1.PathHelper.quotePathSegmentIfNeeded(in_segment)
111
+ : in_segment;
113
112
  let nextSegmentToPushInParentStack = in_context.getLastSegment();
114
113
  // Note: we don't quote the path string here, since the paths
115
114
  // in a ChangeSet are already quoted, if necessary
116
- in_context._lastSegmentString = currentTypeIdContext === "map" ||
117
- currentTypeIdContext === "array" ||
118
- currentTypeIdContext === "set"
119
- ? `[${escapedSegment}]`
120
- : pathSeparator + escapedSegment;
121
- in_context._fullPath = currentPath + in_context.getLastSegmentString();
115
+ in_context._lastSegmentString =
116
+ currentTypeIdContext === "map" ||
117
+ currentTypeIdContext === "array" ||
118
+ currentTypeIdContext === "set"
119
+ ? `[${escapedSegment}]`
120
+ : pathSeparator + escapedSegment;
121
+ in_context._fullPath =
122
+ currentPath + in_context.getLastSegmentString();
122
123
  // Store the typeid and nested ChangeSet
123
124
  in_context._typeid = in_nestedTypeid;
124
125
  in_context._nestedChangeSet = in_subChangeSet;
@@ -127,22 +128,29 @@ var Utils;
127
128
  in_context._arrayLocalIndex = in_arrayLocalIndex;
128
129
  in_context._arrayOperationOffset = in_arrayOperationOffset;
129
130
  in_context._arrayIteratorOffset = in_arrayIteratorOffset;
130
- if (in_arrayIteratorOffset !== undefined && (0, isNumber_1.default)(in_segment)) {
131
+ if (in_arrayIteratorOffset !== undefined &&
132
+ (0, isNumber_1.default)(in_segment)) {
131
133
  if (in_context._operationType === "remove") {
132
134
  nextSegmentToPushInParentStack =
133
- in_context.getLastSegment() + in_arrayIteratorOffset - in_arrayLocalIndex;
134
- in_context._fullPostPath =
135
- `${currentPostPath}[${in_segment +
136
- in_arrayIteratorOffset - in_arrayLocalIndex}]`;
135
+ in_context.getLastSegment() +
136
+ in_arrayIteratorOffset -
137
+ in_arrayLocalIndex;
138
+ in_context._fullPostPath = `${currentPostPath}[${in_segment +
139
+ in_arrayIteratorOffset -
140
+ in_arrayLocalIndex}]`;
137
141
  }
138
142
  else {
139
- nextSegmentToPushInParentStack = in_context.getLastSegment() + in_arrayIteratorOffset;
143
+ nextSegmentToPushInParentStack =
144
+ in_context.getLastSegment() +
145
+ in_arrayIteratorOffset;
140
146
  in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset}]`;
141
147
  }
142
148
  }
143
149
  else {
144
- nextSegmentToPushInParentStack = in_context._lastSegment;
145
- in_context._fullPostPath = currentPostPath + in_context._lastSegmentString;
150
+ nextSegmentToPushInParentStack =
151
+ in_context._lastSegment;
152
+ in_context._fullPostPath =
153
+ currentPostPath + in_context._lastSegmentString;
146
154
  }
147
155
  // Continue traversal
148
156
  in_context._stackDepth++;
@@ -173,9 +181,11 @@ var Utils;
173
181
  (0, async_1.series)([
174
182
  function (n3) {
175
183
  // If this property is a collection, we set the correct type, otherwise we assume it is a NodeProperty
176
- const propertyContainerType = (splitTypeId.context === "map" ||
184
+ const propertyContainerType = splitTypeId.context === "map" ||
177
185
  splitTypeId.context === "set" ||
178
- splitTypeId.context === "array") ? splitTypeId.context : "NodeProperty";
186
+ splitTypeId.context === "array"
187
+ ? splitTypeId.context
188
+ : "NodeProperty";
179
189
  let oldOperationType = in_context._operationType;
180
190
  if (splitTypeId.context === "array") {
181
191
  // Use the ArrayChangeSetIterator to process the changes in the ChangeSet in the correct order
@@ -190,7 +200,8 @@ var Utils;
190
200
  switch (arrayIterator.opDescription.type) {
191
201
  case operationTypes_1.ArrayIteratorOperationTypes.INSERT:
192
202
  in_context._operationType = "insert";
193
- operation = arrayIterator.opDescription.operation;
203
+ operation =
204
+ arrayIterator.opDescription.operation;
194
205
  (0, async_1.eachOfSeries)(operation[1], function (item, i, n5) {
195
206
  // The typeid is stored inline for arrays
196
207
  const typeid = item.typeid;
@@ -204,7 +215,8 @@ var Utils;
204
215
  break;
205
216
  case operationTypes_1.ArrayIteratorOperationTypes.REMOVE:
206
217
  in_context._operationType = "remove";
207
- operation = arrayIterator.opDescription.operation;
218
+ operation =
219
+ arrayIterator.opDescription.operation;
208
220
  (0, async_1.timesSeries)(operation[1], function (i, n5) {
209
221
  // For removals, we don't have a typeid and we use the ChangeSet
210
222
  // of the removal operation as nested
@@ -217,7 +229,8 @@ var Utils;
217
229
  });
218
230
  break;
219
231
  case operationTypes_1.ArrayIteratorOperationTypes.MODIFY:
220
- operation = arrayIterator.opDescription.operation;
232
+ operation =
233
+ arrayIterator.opDescription.operation;
221
234
  in_context._operationType = "modify";
222
235
  (0, async_1.timesSeries)(operation[1].length, function (i, n5) {
223
236
  // The typeid is stored inline for arrays
@@ -232,7 +245,8 @@ var Utils;
232
245
  break;
233
246
  default:
234
247
  arrayIterator.next();
235
- n4(new Error(MSG.UNKNOWN_OPERATOR + arrayIterator.opDescription.type));
248
+ n4(new Error(MSG.UNKNOWN_OPERATOR +
249
+ arrayIterator.opDescription.type));
236
250
  }
237
251
  }, function (err) {
238
252
  in_context._operationType = oldOperationType;
@@ -253,7 +267,8 @@ var Utils;
253
267
  // removal operation as nested ChangeSet
254
268
  processChange(paths[i], nestedChangeSet.remove, undefined, true, propertyContainerType, undefined, undefined, undefined, undefined, n5);
255
269
  }, function (err) {
256
- in_context._operationType = oldOperationType;
270
+ in_context._operationType =
271
+ oldOperationType;
257
272
  n4(err);
258
273
  });
259
274
  }
@@ -267,7 +282,8 @@ var Utils;
267
282
  processChange(paths[j], nestedChangeSet.remove[typeid][paths[j]], typeid, true, propertyContainerType, undefined, undefined, undefined, undefined, n6);
268
283
  }, n5);
269
284
  }, function (err) {
270
- in_context._operationType = oldOperationType;
285
+ in_context._operationType =
286
+ oldOperationType;
271
287
  n4(err);
272
288
  });
273
289
  }
@@ -290,7 +306,8 @@ var Utils;
290
306
  processChange(paths[j], nestedChangeSet.insert[typeid][paths[j]], typeid, true, propertyContainerType, undefined, undefined, undefined, undefined, n6);
291
307
  }, n5);
292
308
  }, function (err) {
293
- in_context._operationType = oldOperationType;
309
+ in_context._operationType =
310
+ oldOperationType;
294
311
  n4(err);
295
312
  });
296
313
  }
@@ -382,26 +399,26 @@ var Utils;
382
399
  in_objectToPopulate.remove = in_objectToPopulate.remove || {};
383
400
  in_objectToPopulate.remove[in_context.getTypeid()] =
384
401
  in_objectToPopulate.remove[in_context.getTypeid()] || {};
385
- in_objectToPopulate.remove[in_context.getTypeid()][in_context.getLastSegment()] =
386
- (0, fastest_json_copy_1.copy)(in_context.getNestedChangeSet());
402
+ in_objectToPopulate.remove[in_context.getTypeid()][in_context.getLastSegment()] = (0, fastest_json_copy_1.copy)(in_context.getNestedChangeSet());
387
403
  }
388
404
  }
389
405
  else {
390
- in_objectToPopulate[in_context.getOperationType()] = in_objectToPopulate[in_context.getOperationType()] || {};
406
+ in_objectToPopulate[in_context.getOperationType()] =
407
+ in_objectToPopulate[in_context.getOperationType()] || {};
391
408
  in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] =
392
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] || {};
409
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()] ||
410
+ {};
393
411
  if (typeidHelper_1.TypeIdHelper.isPrimitiveType(in_context.getTypeid()) || in_isLeaf) {
394
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] =
395
- (0, fastest_json_copy_1.copy)(in_context.getNestedChangeSet());
412
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] = (0, fastest_json_copy_1.copy)(in_context.getNestedChangeSet());
396
413
  }
397
414
  else {
398
- in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] =
399
- nestedChangeSet;
415
+ in_objectToPopulate[in_context.getOperationType()][in_context.getTypeid()][in_context.getLastSegment()] = nestedChangeSet;
400
416
  }
401
417
  }
402
418
  }
403
419
  else if (in_context.getPropertyContainerType() === "template") {
404
- in_objectToPopulate[in_context.getTypeid()] = in_objectToPopulate[in_context.getTypeid()] || {};
420
+ in_objectToPopulate[in_context.getTypeid()] =
421
+ in_objectToPopulate[in_context.getTypeid()] || {};
405
422
  if (typeidHelper_1.TypeIdHelper.isPrimitiveType(in_context.getTypeid()) || in_isLeaf) {
406
423
  in_objectToPopulate[in_context.getTypeid()][in_context.getLastSegment()] =
407
424
  (0, fastest_json_copy_1.copy)(in_context.getNestedChangeSet());
@@ -435,9 +452,9 @@ var Utils;
435
452
  const nestedChangeSet = in_context.getNestedChangeSet();
436
453
  // Call the callback function for this ChangeSet
437
454
  in_context._traversalStopped = false;
438
- const splitTypeId = in_context.getTypeid() !== undefined ?
439
- typeidHelper_1.TypeIdHelper.extractContext(in_context.getTypeid()) :
440
- undefined;
455
+ const splitTypeId = in_context.getTypeid() !== undefined
456
+ ? typeidHelper_1.TypeIdHelper.extractContext(in_context.getTypeid())
457
+ : undefined;
441
458
  in_context._splitTypeId = splitTypeId;
442
459
  // TODO: this duplicates the context object putting stress on the GC.
443
460
  let postOrderContext;
@@ -464,14 +481,17 @@ var Utils;
464
481
  const processChange = function (in_segment, in_subChangeSet, in_nestedTypeid, in_escape, in_parentPropertyType, in_arrayOperationIndex, in_arrayLocalIndex, in_arrayOperationOffset, in_arrayIteratorOffset) {
465
482
  // Update the path
466
483
  in_context._lastSegment = in_segment;
467
- const escapedSegment = in_escape && (0, isString_1.default)(in_segment) ? pathHelper_1.PathHelper.quotePathSegmentIfNeeded(in_segment) : in_segment;
484
+ const escapedSegment = in_escape && (0, isString_1.default)(in_segment)
485
+ ? pathHelper_1.PathHelper.quotePathSegmentIfNeeded(in_segment)
486
+ : in_segment;
468
487
  let nextSegmentToPushInParentStack = in_context._lastSegment;
469
488
  // Note: we don't quote the path string here, since the paths in a ChangeSet are already quoted, if necessary
470
- in_context._lastSegmentString = currentTypeIdContext === "map" ||
471
- currentTypeIdContext === "array" ||
472
- currentTypeIdContext === "set"
473
- ? `[${escapedSegment}]`
474
- : pathSeparator + escapedSegment;
489
+ in_context._lastSegmentString =
490
+ currentTypeIdContext === "map" ||
491
+ currentTypeIdContext === "array" ||
492
+ currentTypeIdContext === "set"
493
+ ? `[${escapedSegment}]`
494
+ : pathSeparator + escapedSegment;
475
495
  in_context._fullPath = currentPath + in_context._lastSegmentString;
476
496
  // Store the typeid and nested ChangeSet
477
497
  in_context._typeid = in_nestedTypeid;
@@ -483,12 +503,15 @@ var Utils;
483
503
  in_context._arrayIteratorOffset = in_arrayIteratorOffset;
484
504
  if (in_arrayIteratorOffset !== undefined) {
485
505
  if (in_context._operationType === "remove") {
486
- nextSegmentToPushInParentStack = in_context._lastSegment + in_arrayIteratorOffset - in_arrayLocalIndex;
487
- in_context._fullPostPath = `${currentPostPath}[${in_segment +
488
- in_arrayIteratorOffset - in_arrayLocalIndex}]`;
506
+ nextSegmentToPushInParentStack =
507
+ in_context._lastSegment +
508
+ in_arrayIteratorOffset -
509
+ in_arrayLocalIndex;
510
+ in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset - in_arrayLocalIndex}]`;
489
511
  }
490
512
  else {
491
- nextSegmentToPushInParentStack = in_context._lastSegment + in_arrayIteratorOffset;
513
+ nextSegmentToPushInParentStack =
514
+ in_context._lastSegment + in_arrayIteratorOffset;
492
515
  in_context._fullPostPath = `${currentPostPath}[${in_segment + in_arrayIteratorOffset}]`;
493
516
  }
494
517
  }
@@ -512,9 +535,11 @@ var Utils;
512
535
  in_context._parentNestedChangeSet = nestedChangeSet;
513
536
  };
514
537
  // If this property is a collection, we set the correct type, otherwise we assume it is a NodeProperty
515
- const propertyContainerType = (splitTypeId.context === "map" ||
538
+ const propertyContainerType = splitTypeId.context === "map" ||
516
539
  splitTypeId.context === "set" ||
517
- splitTypeId.context === "array") ? splitTypeId.context : "NodeProperty";
540
+ splitTypeId.context === "array"
541
+ ? splitTypeId.context
542
+ : "NodeProperty";
518
543
  let oldOperationType = in_context._operationType;
519
544
  let paths;
520
545
  let typeids;
@@ -743,9 +768,9 @@ var Utils;
743
768
  //
744
769
  // @ts-ignore currently it's not needed
745
770
  isLeafNode() {
746
- return typeidHelper_1.TypeIdHelper.isPrimitiveType(this._typeid) ||
771
+ return (typeidHelper_1.TypeIdHelper.isPrimitiveType(this._typeid) ||
747
772
  this._isEmptyObject(this) ||
748
- this.getOperationType() === "remove";
773
+ this.getOperationType() === "remove");
749
774
  }
750
775
  /**
751
776
  * Returns the index of the last segment, either a string with the key or a number with the position in the array
@@ -753,7 +778,9 @@ var Utils;
753
778
  * @returns The last segment index
754
779
  */
755
780
  getPostLastSegment() {
756
- if (this._propertyContainerType === "array" && (0, isNumber_1.default)(this._lastSegment) && this._arrayIteratorOffset !== undefined) {
781
+ if (this._propertyContainerType === "array" &&
782
+ (0, isNumber_1.default)(this._lastSegment) &&
783
+ this._arrayIteratorOffset !== undefined) {
757
784
  return this._operationType === "remove"
758
785
  ? this._lastSegment + this._arrayIteratorOffset - this._arrayLocalIndex
759
786
  : this._lastSegment + this._arrayIteratorOffset;
@@ -796,8 +823,10 @@ var Utils;
796
823
  but could not find "${this.getTypeid()}" in "${JSON.stringify(this.getParentNestedChangeSet())}"`);
797
824
  }
798
825
  }
799
- else if (this.getPropertyContainerType() === "NodeProperty" || this.getPropertyContainerType() === "map") {
800
- parent[this.getOperationType()][this.getTypeid()][this.getLastSegment()] = in_newNestedChangeset;
826
+ else if (this.getPropertyContainerType() === "NodeProperty" ||
827
+ this.getPropertyContainerType() === "map") {
828
+ parent[this.getOperationType()][this.getTypeid()][this.getLastSegment()] =
829
+ in_newNestedChangeset;
801
830
  }
802
831
  else {
803
832
  console.warn("replaceNestedChangeSet: not implemented. type: ", this.getPropertyContainerType());
@@ -1095,8 +1124,9 @@ var Utils;
1095
1124
  return;
1096
1125
  }
1097
1126
  const operationScope = in_context.getPropertyContainerType() !== "template"
1098
- ? (userData[in_context.getOperationType()] = userData[in_context.getOperationType()]
1099
- || (in_context.getPropertyContainerType() === "array" ? [] : {}))
1127
+ ? (userData[in_context.getOperationType()] =
1128
+ userData[in_context.getOperationType()] ||
1129
+ (in_context.getPropertyContainerType() === "array" ? [] : {}))
1100
1130
  : userData;
1101
1131
  if (typeidHelper_1.TypeIdHelper.isPrimitiveType(in_context.getTypeid())) {
1102
1132
  // This is a primitive type, we store it under its name in the result
@@ -1106,7 +1136,10 @@ var Utils;
1106
1136
  const nestedUserData = {};
1107
1137
  if (in_context.getPropertyContainerType() === "array") {
1108
1138
  if (!operationScope[in_context.getArrayOperationIndex()]) {
1109
- operationScope[in_context.getArrayOperationIndex()] = [in_context.getArrayOperationOffset(), []];
1139
+ operationScope[in_context.getArrayOperationIndex()] = [
1140
+ in_context.getArrayOperationOffset(),
1141
+ [],
1142
+ ];
1110
1143
  }
1111
1144
  const arrayOperation = operationScope[in_context.getArrayOperationIndex()];
1112
1145
  arrayOperation[1][in_context.getArrayLocalIndex()] = nestedUserData;
@@ -1121,7 +1154,9 @@ var Utils;
1121
1154
  userData: result,
1122
1155
  });
1123
1156
  // Remove all existing keys from the ChangeSet
1124
- Object.keys(io_changeSet).forEach(function (key) { delete io_changeSet[key]; });
1157
+ Object.keys(io_changeSet).forEach(function (key) {
1158
+ delete io_changeSet[key];
1159
+ });
1125
1160
  // Assign from the result user data
1126
1161
  (0, extend_1.default)(io_changeSet, result);
1127
1162
  }
@@ -1142,8 +1177,10 @@ var Utils;
1142
1177
  // If we found and instance of the requested typeid, we store it under its path
1143
1178
  if (in_context.getTypeid() === in_typeid) {
1144
1179
  const userData = in_context.getUserData();
1145
- userData[in_context.getOperationType()] = userData[in_context.getOperationType()] || {};
1146
- userData[in_context.getOperationType()][in_context.getFullPath()] = in_context.getNestedChangeSet();
1180
+ userData[in_context.getOperationType()] =
1181
+ userData[in_context.getOperationType()] || {};
1182
+ userData[in_context.getOperationType()][in_context.getFullPath()] =
1183
+ in_context.getNestedChangeSet();
1147
1184
  }
1148
1185
  },
1149
1186
  userData: result,
@@ -1207,8 +1244,10 @@ var Utils;
1207
1244
  changesetSegment.substr(0, mergedSegment.length) === mergedSegment &&
1208
1245
  level < pathSegments.length - 1) {
1209
1246
  level++;
1210
- mergedSegment = mergedSegment + PROPERTY_PATH_DELIMITER +
1211
- pathHelper_1.PathHelper.quotePathSegmentIfNeeded(pathSegments[level]);
1247
+ mergedSegment =
1248
+ mergedSegment +
1249
+ PROPERTY_PATH_DELIMITER +
1250
+ pathHelper_1.PathHelper.quotePathSegmentIfNeeded(pathSegments[level]);
1212
1251
  }
1213
1252
  // Have we found the right entry in the ChangeSet?
1214
1253
  // TODO: This could be done more efficiently
@@ -1229,7 +1268,8 @@ var Utils;
1229
1268
  currentChangeSet = (0, fastest_json_copy_1.copy)(currentChangeSet);
1230
1269
  Utils._stripTypeids(currentChangeSet);
1231
1270
  }
1232
- result[in_context.getOperationType()][in_context.getFullPath()] = currentChangeSet;
1271
+ result[in_context.getOperationType()][in_context.getFullPath()] =
1272
+ currentChangeSet;
1233
1273
  in_context._traversalStopped = true;
1234
1274
  }
1235
1275
  else {
@@ -1324,7 +1364,7 @@ var Utils;
1324
1364
  * escaped (by adding an additional '_') before the lookup into the paths map. This frees the keyspace with
1325
1365
  * duplicated underscores for the use by the calling application.
1326
1366
  */
1327
- function getChangesToTokenizedPaths(in_paths, in_changeSet, in_callback, in_options = { escapeLeadingDoubleUnderscore: false, rootOperation: 'modify' }) {
1367
+ function getChangesToTokenizedPaths(in_paths, in_changeSet, in_callback, in_options = { escapeLeadingDoubleUnderscore: false, rootOperation: "modify" }) {
1328
1368
  const currentTokenizedPath = [];
1329
1369
  let paths;
1330
1370
  let legacyPaths;
@@ -1336,8 +1376,12 @@ var Utils;
1336
1376
  // Note that if the calling application sets the in_options.escapeLeadingDoubleUnderscore option, it is responsible
1337
1377
  // for escaping input path segments that begin with a double underscore,
1338
1378
  // otherwise such segments will be considered as user data!
1339
- return in_options.escapeLeadingDoubleUnderscore && k && k.length > 2 && k[0] === "_" && k[1] === "_" &&
1340
- k[2] !== "_";
1379
+ return (in_options.escapeLeadingDoubleUnderscore &&
1380
+ k &&
1381
+ k.length > 2 &&
1382
+ k[0] === "_" &&
1383
+ k[1] === "_" &&
1384
+ k[2] !== "_");
1341
1385
  };
1342
1386
  let _convertLevelToMap = function (obj) {
1343
1387
  const thisLevel = new Map();
@@ -1371,9 +1415,9 @@ var Utils;
1371
1415
  };
1372
1416
  const _toCallbackParam = (pathLevels) => {
1373
1417
  return legacyPaths
1374
- // If a user provided objects as paths, they would expect objects in their callbacks as well.
1375
- // So, we transform the parameter to an object, which is not very performant but is backwards compatible.
1376
- ? _convertMapToLevel(pathLevels)
1418
+ ? // If a user provided objects as paths, they would expect objects in their callbacks as well.
1419
+ // So, we transform the parameter to an object, which is not very performant but is backwards compatible.
1420
+ _convertMapToLevel(pathLevels)
1377
1421
  : pathLevels;
1378
1422
  };
1379
1423
  if (!(in_paths instanceof Map)) {
@@ -1544,18 +1588,24 @@ var Utils;
1544
1588
  tokenizedPath.forEach((segment, index) => {
1545
1589
  if (index === 0) {
1546
1590
  parentPath += pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment);
1547
- changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
1591
+ changeSetToPopulate =
1592
+ pathToChangeSet[parentPath] || changeSetToPopulate;
1548
1593
  }
1549
1594
  else if (index < tokenizedPath.length - 1) {
1550
- parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
1551
- ? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
1552
- : `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1553
- changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
1595
+ parentPath +=
1596
+ context.getContainerStack()[index] !== "set" &&
1597
+ context.getContainerStack()[index] !== "map"
1598
+ ? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
1599
+ : `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1600
+ changeSetToPopulate =
1601
+ pathToChangeSet[parentPath] || changeSetToPopulate;
1554
1602
  }
1555
1603
  else {
1556
- parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
1557
- ? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
1558
- : `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1604
+ parentPath +=
1605
+ context.getContainerStack()[index] !== "set" &&
1606
+ context.getContainerStack()[index] !== "map"
1607
+ ? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
1608
+ : `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
1559
1609
  fullPath = parentPath;
1560
1610
  }
1561
1611
  pathsToDelete.push(parentPath);
@@ -1582,7 +1632,8 @@ var Utils;
1582
1632
  }
1583
1633
  }
1584
1634
  });
1585
- if (fullPath !== context.getFullPath() && pathToChangeSet[context.getFullPath()]) {
1635
+ if (fullPath !== context.getFullPath() &&
1636
+ pathToChangeSet[context.getFullPath()]) {
1586
1637
  // Here we are in the case where we have a changeset that
1587
1638
  // contains a property with path a.b.c.d as the key.
1588
1639
  // In that case, getChangesToTokenizedPaths will be called
@@ -1607,7 +1658,8 @@ var Utils;
1607
1658
  // property container which means that our fullPath will actually contain
1608
1659
  // dots for sets. This is OK because we build the fullpath ourselves in such a
1609
1660
  // case and it will be consistent with the way we search for a valid changeSetToPopulate
1610
- if (context.getPropertyContainerType() !== "set" && context.getPropertyContainerType() !== "map") {
1661
+ if (context.getPropertyContainerType() !== "set" &&
1662
+ context.getPropertyContainerType() !== "map") {
1611
1663
  fullPath = context.getFullPath();
1612
1664
  }
1613
1665
  // keep a reference to the underlying change set of the current path.
@@ -1627,9 +1679,9 @@ var Utils;
1627
1679
  // i.e.
1628
1680
  const lastSegment = context.getLastSegmentEscaped();
1629
1681
  if (contractedPathSegment &&
1630
- ((lastSegment.indexOf(".") !== -1 ||
1682
+ (lastSegment.indexOf(".") !== -1 ||
1631
1683
  (lastSegment.length > 0 && lastSegment[0] === '"')) &&
1632
- pathHelper_1.PathHelper.tokenizePathString(lastSegment).length > 1)) {
1684
+ pathHelper_1.PathHelper.tokenizePathString(lastSegment).length > 1) {
1633
1685
  toPurge[context.getFullPath()] = {
1634
1686
  changeSet: changeSetToPopulate,
1635
1687
  typeid: context.getTypeid(),
@@ -1768,7 +1820,9 @@ var Utils;
1768
1820
  const rootChangeSet = (0, fastest_json_copy_1.copy)(in_changeSet);
1769
1821
  Utils.traverseChangeSetRecursively(rootChangeSet, {
1770
1822
  preCallback: (in_context) => {
1771
- const shouldExclude = (0, find_1.default)(tokenizedPaths, (val) => { return (0, isEqual_1.default)(val, in_context.getParentStack()); });
1823
+ const shouldExclude = (0, find_1.default)(tokenizedPaths, (val) => {
1824
+ return (0, isEqual_1.default)(val, in_context.getParentStack());
1825
+ });
1772
1826
  if (shouldExclude) {
1773
1827
  const operationType = in_context.getOperationType();
1774
1828
  const typeId = in_context.getTypeid();