@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
@@ -12,7 +12,7 @@ import isEqual from "lodash/isEqual";
12
12
  // @ts-ignore
13
13
  import { ConsoleUtils, constants } from "@fluid-experimental/property-common";
14
14
  import { TypeIdHelper } from "../helpers/typeidHelper";
15
- import { ArrayChangeSetIterator } from "./arrayChangesetIterator";
15
+ import { ArrayChangeSetIterator, } from "./arrayChangesetIterator";
16
16
  import { ConflictType } from "./changesetConflictTypes";
17
17
  const { MSG } = constants;
18
18
  const { isPrimitiveType } = TypeIdHelper;
@@ -90,7 +90,8 @@ const getRangeForCurrentStateOperation = function (io_operation, in_aOffset, io_
90
90
  io_resultingRange.end = io_operation.operation[0];
91
91
  io_resultingRange.op = io_operation;
92
92
  io_resultingRange.flag = ArrayChangeSetRangeType.completeA;
93
- io_resultingRange.removeInsertOperation = io_operation.removeInsertOperation;
93
+ io_resultingRange.removeInsertOperation =
94
+ io_operation.removeInsertOperation;
94
95
  return;
95
96
  case ArrayChangeSetIterator.types.MODIFY:
96
97
  io_resultingRange.begin = io_operation.operation[0];
@@ -102,7 +103,7 @@ const getRangeForCurrentStateOperation = function (io_operation, in_aOffset, io_
102
103
  throw new Error(`getRangeForCurrentStateOperation: ${MSG.UNKNOWN_OPERATION}`);
103
104
  }
104
105
  };
105
- const getOpLength = (op) => isNumber(op[1]) ? op[1] : op[1].length;
106
+ const getOpLength = (op) => (isNumber(op[1]) ? op[1] : op[1].length);
106
107
  /**
107
108
  * Computes the impact range for a given operation of the applied change set
108
109
  * @param in_operation - The op
@@ -278,7 +279,8 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
278
279
  }
279
280
  if (io_rangeB.removeInsertOperation &&
280
281
  io_rangeB.op.type === ArrayChangeSetIterator.types.REMOVE &&
281
- (io_rangeA.begin === undefined || io_rangeB.removeInsertOperation[0] < io_rangeA.begin - io_rangeA.op.offset) &&
282
+ (io_rangeA.begin === undefined ||
283
+ io_rangeB.removeInsertOperation[0] < io_rangeA.begin - io_rangeA.op.offset) &&
282
284
  io_rangeB.removeInsertOperation[0] < io_rangeB.begin &&
283
285
  !io_rangeB.insertAlreadyProcessed) {
284
286
  io_resultingSegment.begin = io_rangeB.removeInsertOperation[0];
@@ -315,17 +317,18 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
315
317
  nextInsertOffset = getOpLength(io_rangeA.removeInsertOperation);
316
318
  }
317
319
  if (!in_rebasing &&
318
- (io_rangeA.begin <= io_rangeB.begin) &&
319
- (io_rangeA.begin + nextInsertOffset >= io_rangeB.begin) &&
320
- (io_rangeA.op.type === ArrayChangeSetIterator.types.REMOVE) &&
320
+ io_rangeA.begin <= io_rangeB.begin &&
321
+ io_rangeA.begin + nextInsertOffset >= io_rangeB.begin &&
322
+ io_rangeA.op.type === ArrayChangeSetIterator.types.REMOVE &&
321
323
  Array.isArray(io_rangeA.op.operation[1]) && // This is a reversible remove operation
322
- (io_rangeB.op.type === ArrayChangeSetIterator.types.INSERT)) {
324
+ io_rangeB.op.type === ArrayChangeSetIterator.types.INSERT) {
323
325
  // Are the two operations canceling out?
324
326
  let startOffset = 0;
325
327
  let rangeStart = 0;
326
328
  let matchFound = false;
327
329
  let rangeLength = io_rangeB.op.operation[1].length;
328
- const operationMetaInfo = in_options && in_options.applyAfterMetaInformation &&
330
+ const operationMetaInfo = in_options &&
331
+ in_options.applyAfterMetaInformation &&
329
332
  in_options.applyAfterMetaInformation.get(io_rangeB.op.operation[1]);
330
333
  if (operationMetaInfo && operationMetaInfo.rebasedRemoveInsertRanges) {
331
334
  if (operationMetaInfo.currentInsertOffset === undefined) {
@@ -334,13 +337,16 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
334
337
  }
335
338
  let i = 0;
336
339
  for (; i < operationMetaInfo.rebasedRemoveInsertRanges.length; i++) {
337
- if (operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart >= operationMetaInfo.currentInsertOffset) {
338
- startOffset = operationMetaInfo.rebasedRemoveInsertRanges[i].originalStartPosition -
339
- io_rangeA.op.operation[0] +
340
- io_rangeA.op.offset +
341
- io_rangeB.op.offset;
342
- rangeStart = operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart -
343
- operationMetaInfo.currentInsertOffset;
340
+ if (operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart >=
341
+ operationMetaInfo.currentInsertOffset) {
342
+ startOffset =
343
+ operationMetaInfo.rebasedRemoveInsertRanges[i].originalStartPosition -
344
+ io_rangeA.op.operation[0] +
345
+ io_rangeA.op.offset +
346
+ io_rangeB.op.offset;
347
+ rangeStart =
348
+ operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart -
349
+ operationMetaInfo.currentInsertOffset;
344
350
  rangeLength = operationMetaInfo.rebasedRemoveInsertRanges[i].rangeLength;
345
351
  if (io_rangeA.op.operation[1].length - startOffset >= rangeLength &&
346
352
  isEqual(io_rangeA.op.operation[1].slice(startOffset, startOffset + rangeLength), io_rangeB.op.operation[1].slice(rangeStart, rangeStart + rangeLength))) {
@@ -409,14 +415,16 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
409
415
  io_resultingSegment.end = io_rangeA.end;
410
416
  io_resultingSegment.op = undefined; // This is used to indicate that we don't need any operation
411
417
  if (io_rangeB.op.operation[1].length === rangeLength) {
412
- io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
413
- ? ArrayChangeSetRangeType.completeAcompleteB
414
- : ArrayChangeSetRangeType.completeBpartOfA;
418
+ io_resultingSegment.flag =
419
+ io_rangeA.op.operation[1].length === rangeLength
420
+ ? ArrayChangeSetRangeType.completeAcompleteB
421
+ : ArrayChangeSetRangeType.completeBpartOfA;
415
422
  }
416
423
  else {
417
- io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
418
- ? ArrayChangeSetRangeType.completeApartOfB
419
- : ArrayChangeSetRangeType.partOfApartOfB;
424
+ io_resultingSegment.flag =
425
+ io_rangeA.op.operation[1].length === rangeLength
426
+ ? ArrayChangeSetRangeType.completeApartOfB
427
+ : ArrayChangeSetRangeType.partOfApartOfB;
420
428
  }
421
429
  // cut the remaining segment entry
422
430
  if (io_resultingSegment.flag === ArrayChangeSetRangeType.partOfApartOfB ||
@@ -433,9 +441,9 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
433
441
  }
434
442
  }
435
443
  }
436
- if ((io_rangeA.end < io_rangeB.begin) || // please see in_rebasing comments in the function description
444
+ if (io_rangeA.end < io_rangeB.begin || // please see in_rebasing comments in the function description
437
445
  ((!in_rebasing || io_rangeA.op.type === ArrayChangeSetIterator.types.REMOVE) &&
438
- (io_rangeA.end === io_rangeB.begin))) {
446
+ io_rangeA.end === io_rangeB.begin)) {
439
447
  io_resultingSegment.begin = io_rangeA.begin;
440
448
  io_resultingSegment.end = io_rangeA.end;
441
449
  io_resultingSegment.op = io_rangeA.op;
@@ -450,18 +458,20 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
450
458
  length = length.length;
451
459
  }
452
460
  in_options.applyAfterMetaInformation.set(io_rangeB.op.operation[1], {
453
- rebasedRemoveInsertRanges: [{
461
+ rebasedRemoveInsertRanges: [
462
+ {
454
463
  rangeStart: 0,
455
464
  rangeLength: length,
456
465
  originalStartPosition: io_rangeA.end + io_rangeB.op.offset,
457
- }],
466
+ },
467
+ ],
458
468
  });
459
469
  }
460
470
  }
461
471
  return;
462
472
  }
463
- if ((io_rangeB.end < io_rangeA.begin) || // please see in_rebasing comments in the function description
464
- (!in_rebasing && (io_rangeB.end === io_rangeA.begin))) {
473
+ if (io_rangeB.end < io_rangeA.begin || // please see in_rebasing comments in the function description
474
+ (!in_rebasing && io_rangeB.end === io_rangeA.begin)) {
465
475
  io_resultingSegment.begin = io_rangeB.begin;
466
476
  io_resultingSegment.end = io_rangeB.end;
467
477
  io_resultingSegment.op = io_rangeB.op;
@@ -679,16 +689,20 @@ const pushOp = function (in_op, io_changeset, in_indexOffset, in_options, in_las
679
689
  }
680
690
  switch (in_op.type) {
681
691
  case ArrayChangeSetIterator.types.INSERT: {
682
- if (in_options && in_options.applyAfterMetaInformation && !isNumber(in_op.operation[1])) {
692
+ if (in_options &&
693
+ in_options.applyAfterMetaInformation &&
694
+ !isNumber(in_op.operation[1])) {
683
695
  // If we don't have any meta information yet, we add an entry with the correct offset applied
684
696
  const metaInfo = in_options.applyAfterMetaInformation.get(in_op.operation[1]);
685
697
  if (!metaInfo) {
686
698
  in_options.applyAfterMetaInformation.set(in_op.operation[1], {
687
- rebasedRemoveInsertRanges: [{
699
+ rebasedRemoveInsertRanges: [
700
+ {
688
701
  rangeStart: 0,
689
702
  rangeLength: in_op.operation[1].length,
690
703
  originalStartPosition: in_op.operation[0],
691
- }],
704
+ },
705
+ ],
692
706
  });
693
707
  }
694
708
  }
@@ -711,7 +725,11 @@ const pushOp = function (in_op, io_changeset, in_indexOffset, in_options, in_las
711
725
  case ArrayChangeSetIterator.types.MODIFY: {
712
726
  if (!mergeWithLastIfPossible(in_op, io_changeset, writeTargetIndex, in_options)) {
713
727
  if (in_op.operation[2] !== undefined) {
714
- io_changeset.modify.push([writeTargetIndex, in_op.operation[1], in_op.operation[2]]);
728
+ io_changeset.modify.push([
729
+ writeTargetIndex,
730
+ in_op.operation[1],
731
+ in_op.operation[2],
732
+ ]);
715
733
  }
716
734
  else {
717
735
  io_changeset.modify.push([writeTargetIndex, in_op.operation[1]]);
@@ -747,7 +765,9 @@ const handleCombinations = function (in_segment, in_isPrimitiveType) {
747
765
  }
748
766
  case ArrayChangeSetIterator.types.REMOVE: {
749
767
  // Attention: B removes A completely, kill A to avoid zero inserts
750
- const opBLen = isNumber(opB.operation[1]) ? opB.operation[1] : opB.operation[1].length;
768
+ const opBLen = isNumber(opB.operation[1])
769
+ ? opB.operation[1]
770
+ : opB.operation[1].length;
751
771
  if (opBLen !== opA.operation[1].length) {
752
772
  throw new Error("handleCombinations: insert-remove: unequal number of affected entries");
753
773
  }
@@ -912,11 +932,13 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
912
932
  if (!isNumber(insertEntries)) {
913
933
  length = insertEntries.length;
914
934
  in_options.applyAfterMetaInformation.set(insertEntries, {
915
- rebasedRemoveInsertRanges: [{
935
+ rebasedRemoveInsertRanges: [
936
+ {
916
937
  rangeStart: 0,
917
938
  rangeLength: length,
918
939
  originalStartPosition,
919
- }],
940
+ },
941
+ ],
920
942
  });
921
943
  }
922
944
  }
@@ -975,8 +997,12 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
975
997
  }
976
998
  case ArrayChangeSetIterator.types.REMOVE: {
977
999
  // Remove already in A, no need to add the same again -> write nop
978
- const opBLen = isNumber(opB.operation[1]) ? opB.operation[1] : opB.operation[1].length;
979
- const opALen = isNumber(opA.operation[1]) ? opA.operation[1] : opA.operation[1].length;
1000
+ const opBLen = isNumber(opB.operation[1])
1001
+ ? opB.operation[1]
1002
+ : opB.operation[1].length;
1003
+ const opALen = isNumber(opA.operation[1])
1004
+ ? opA.operation[1]
1005
+ : opA.operation[1].length;
980
1006
  if (opBLen !== opALen) {
981
1007
  throw new Error("handleRebaseCombinations: remove-remove: unequal number of affected entries, " +
982
1008
  "this should never happen! Probably a bug in splitRange.");
@@ -1010,7 +1036,8 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
1010
1036
  case ArrayChangeSetIterator.types.MODIFY: {
1011
1037
  if (in_isPrimitiveType) {
1012
1038
  // just use opB and notify accordingly
1013
- if (opB.type === ArrayChangeSetIterator.types.MODIFY && opB.operation[1].length > 0) {
1039
+ if (opB.type === ArrayChangeSetIterator.types.MODIFY &&
1040
+ opB.operation[1].length > 0) {
1014
1041
  delete opA._absoluteBegin;
1015
1042
  delete opB.offset;
1016
1043
  let conflict = {
@@ -1073,7 +1100,9 @@ const applySegment = function (in_segment, io_changeset, in_currentIndexOffset,
1073
1100
  throw Error("applySegment: in_segment is undefined!");
1074
1101
  }
1075
1102
  // No operation needs to be performed
1076
- if (in_segment.op === undefined && in_segment.opA === undefined && in_segment.opB === undefined) {
1103
+ if (in_segment.op === undefined &&
1104
+ in_segment.opA === undefined &&
1105
+ in_segment.opB === undefined) {
1077
1106
  return;
1078
1107
  }
1079
1108
  if (in_segment.flag === ArrayChangeSetRangeType.completeA ||
@@ -1136,8 +1165,8 @@ export var ChangeSetArrayFunctions;
1136
1165
  ConsoleUtils.assert(!isString(in_appliedPropertyChanges), in_appliedPropertyChanges);
1137
1166
  const isPrimitiveTypeid = isPrimitiveType(in_typeid);
1138
1167
  // Iterator to process the changes in the ChangeSet in the correct order
1139
- const iteratorA = new ArrayChangeSetIterator((io_basePropertyChanges));
1140
- const iteratorB = new ArrayChangeSetIterator((in_appliedPropertyChanges));
1168
+ const iteratorA = new ArrayChangeSetIterator(io_basePropertyChanges);
1169
+ const iteratorB = new ArrayChangeSetIterator(in_appliedPropertyChanges);
1141
1170
  const rangeA = {};
1142
1171
  const rangeB = {};
1143
1172
  const opA = iteratorA.opDescription;
@@ -1162,8 +1191,7 @@ export var ChangeSetArrayFunctions;
1162
1191
  }
1163
1192
  else {
1164
1193
  iteratorB.next();
1165
- if (skipIteratorBOperation &&
1166
- opB.operation === skipIteratorBOperation) {
1194
+ if (skipIteratorBOperation && opB.operation === skipIteratorBOperation) {
1167
1195
  iteratorB.next();
1168
1196
  }
1169
1197
  skipIteratorBOperation = undefined;
@@ -1180,13 +1208,14 @@ export var ChangeSetArrayFunctions;
1180
1208
  let indexOffset = currentIndexOffset;
1181
1209
  if (lastOpWasNop &&
1182
1210
  (rangeA.begin === undefined || rangeA.begin >= segment.begin) &&
1183
- (segment.flag === ArrayChangeSetRangeType.completeB &&
1184
- segment.op.type === ArrayChangeSetIterator.types.INSERT &&
1185
- segment.op.operation[0] === canceledSegmentBegin)) {
1211
+ segment.flag === ArrayChangeSetRangeType.completeB &&
1212
+ segment.op.type === ArrayChangeSetIterator.types.INSERT &&
1213
+ segment.op.operation[0] === canceledSegmentBegin) {
1186
1214
  indexOffset = lastIndexOffset;
1187
1215
  }
1188
1216
  applySegment.call(this, segment, resultPropertyChanges, indexOffset, lastIteratorARemove, isPrimitiveTypeid);
1189
- lastOpWasNop = segment.opB !== undefined && segment.opB.type === ArrayChangeSetIterator.types.NOP;
1217
+ lastOpWasNop =
1218
+ segment.opB !== undefined && segment.opB.type === ArrayChangeSetIterator.types.NOP;
1190
1219
  if (lastOpWasNop) {
1191
1220
  canceledSegmentBegin = segment.begin;
1192
1221
  }
@@ -1200,8 +1229,7 @@ export var ChangeSetArrayFunctions;
1200
1229
  // be placed behind the remove. We detect this case and correct the offset accordingly
1201
1230
  // in pushOp
1202
1231
  if (opA.type === ArrayChangeSetIterator.types.REMOVE) {
1203
- if (!lastIteratorARemove ||
1204
- lastIteratorARemove.position !== opA.operation[0]) {
1232
+ if (!lastIteratorARemove || lastIteratorARemove.position !== opA.operation[0]) {
1205
1233
  lastIteratorARemove = {
1206
1234
  position: opA.operation[0],
1207
1235
  length: getOpLength(opA.operation),
@@ -1212,7 +1240,8 @@ export var ChangeSetArrayFunctions;
1212
1240
  // we have to adjust the position to the end of this operation (an insert that is
1213
1241
  // applied at the position of the remove would be shifted behind this insert)
1214
1242
  if (opA.removeInsertOperation) {
1215
- if (opA.removeInsertOperation[0] + opA.offset === lastIteratorARemove.position) {
1243
+ if (opA.removeInsertOperation[0] + opA.offset ===
1244
+ lastIteratorARemove.position) {
1216
1245
  lastIteratorARemove.position += getOpLength(opA.removeInsertOperation);
1217
1246
  }
1218
1247
  }
@@ -1222,7 +1251,8 @@ export var ChangeSetArrayFunctions;
1222
1251
  // The offset will only be incremented as soon as the iterator reaches an operation at a different index.
1223
1252
  // We detect this case and keep track, whether the remove has already been added to the offset or not.
1224
1253
  if (lastIteratorARemove &&
1225
- (opA.operation === undefined || opA.operation[0] !== lastIteratorARemove.currentIndex)) {
1254
+ (opA.operation === undefined ||
1255
+ opA.operation[0] !== lastIteratorARemove.currentIndex)) {
1226
1256
  lastIteratorARemove.offsetIncremented = true;
1227
1257
  }
1228
1258
  getRangeForCurrentStateOperation(iteratorA.opDescription, moreAs ? opA.offset : 0, rangeA);
@@ -1295,8 +1325,8 @@ export var ChangeSetArrayFunctions;
1295
1325
  function _rebaseArrayChangeSetForProperty(in_ownPropertyChangeSet, io_rebasePropertyChangeSet, in_basePath, out_conflicts, in_typeid, in_options) {
1296
1326
  const isPrimitiveTypeid = isPrimitiveType(in_typeid);
1297
1327
  // Iterator to process the changes in the ChangeSet in the correct order
1298
- const iteratorA = new ArrayChangeSetIterator((in_ownPropertyChangeSet));
1299
- const iteratorB = new ArrayChangeSetIterator((io_rebasePropertyChangeSet));
1328
+ const iteratorA = new ArrayChangeSetIterator(in_ownPropertyChangeSet);
1329
+ const iteratorB = new ArrayChangeSetIterator(io_rebasePropertyChangeSet);
1300
1330
  const opA = iteratorA.opDescription;
1301
1331
  const rangeA = {};
1302
1332
  getRangeForAppliedOperation(opA, rangeA, ArrayChangeSetRangeType.completeA, in_options);
@@ -1432,8 +1462,9 @@ export var ChangeSetArrayFunctions;
1432
1462
  * @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict
1433
1463
  */
1434
1464
  function _rebaseChangeSetForString(in_ownPropertyChangeSet, io_rebasePropertyChangeSetParent, in_key, in_basePath, out_conflicts, in_options) {
1435
- if (isString(io_rebasePropertyChangeSetParent[in_key]) || (io_rebasePropertyChangeSetParent[in_key] &&
1436
- io_rebasePropertyChangeSetParent[in_key].hasOwnProperty("value"))) {
1465
+ if (isString(io_rebasePropertyChangeSetParent[in_key]) ||
1466
+ (io_rebasePropertyChangeSetParent[in_key] &&
1467
+ io_rebasePropertyChangeSetParent[in_key].hasOwnProperty("value"))) {
1437
1468
  // other overwrites any old changes, we ignore them and report the conflict
1438
1469
  let conflict = {
1439
1470
  path: in_basePath,
@@ -1454,8 +1485,8 @@ export var ChangeSetArrayFunctions;
1454
1485
  delete io_rebasePropertyChangeSetParent[in_key];
1455
1486
  }
1456
1487
  }
1457
- else if (isString(in_ownPropertyChangeSet) || (in_ownPropertyChangeSet &&
1458
- in_ownPropertyChangeSet.hasOwnProperty("value"))) {
1488
+ else if (isString(in_ownPropertyChangeSet) ||
1489
+ (in_ownPropertyChangeSet && in_ownPropertyChangeSet.hasOwnProperty("value"))) {
1459
1490
  // we have a conflict since we cannot allow insert/remove/modify on an unknown state
1460
1491
  // we just ignore other's modifications and take own's set
1461
1492
  let conflict = {