@fluid-experimental/property-changeset 2.0.0-internal.1.2.0.93071 → 2.0.0-internal.1.2.2

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 (57) hide show
  1. package/dist/changeset.d.ts.map +1 -1
  2. package/dist/changeset.js +3 -6
  3. package/dist/changeset.js.map +1 -1
  4. package/dist/changeset_operations/array.d.ts +31 -0
  5. package/dist/changeset_operations/array.d.ts.map +1 -1
  6. package/dist/changeset_operations/array.js +52 -47
  7. package/dist/changeset_operations/array.js.map +1 -1
  8. package/dist/changeset_operations/indexedCollection.d.ts +12 -14
  9. package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
  10. package/dist/changeset_operations/indexedCollection.js +13 -14
  11. package/dist/changeset_operations/indexedCollection.js.map +1 -1
  12. package/dist/helpers/typeidHelper.d.ts +6 -6
  13. package/dist/helpers/typeidHelper.d.ts.map +1 -1
  14. package/dist/helpers/typeidHelper.js +16 -26
  15. package/dist/helpers/typeidHelper.js.map +1 -1
  16. package/dist/pathHelper.d.ts +1 -1
  17. package/dist/pathHelper.d.ts.map +1 -1
  18. package/dist/pathHelper.js +50 -52
  19. package/dist/pathHelper.js.map +1 -1
  20. package/dist/templateValidator.d.ts +58 -26
  21. package/dist/templateValidator.d.ts.map +1 -1
  22. package/dist/templateValidator.js +64 -38
  23. package/dist/templateValidator.js.map +1 -1
  24. package/dist/test/array.spec.js +3 -6
  25. package/dist/test/array.spec.js.map +1 -1
  26. package/dist/test/pathHelper.spec.js +2 -4
  27. package/dist/test/pathHelper.spec.js.map +1 -1
  28. package/dist/test/reversibleCs.spec.js +2 -4
  29. package/dist/test/reversibleCs.spec.js.map +1 -1
  30. package/dist/test/tsconfig.tsbuildinfo +1 -1
  31. package/dist/test/validator/templateValidator.spec.js +5 -10
  32. package/dist/test/validator/templateValidator.spec.js.map +1 -1
  33. package/dist/utils.d.ts +131 -103
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +160 -167
  36. package/dist/utils.js.map +1 -1
  37. package/dist/validationResultBuilder.d.ts +2 -4
  38. package/dist/validationResultBuilder.d.ts.map +1 -1
  39. package/dist/validationResultBuilder.js +1 -7
  40. package/dist/validationResultBuilder.js.map +1 -1
  41. package/lib/changeset.js +3 -6
  42. package/lib/changeset.js.map +1 -1
  43. package/lib/changeset_operations/array.js +52 -47
  44. package/lib/changeset_operations/array.js.map +1 -1
  45. package/lib/changeset_operations/indexedCollection.js +13 -14
  46. package/lib/changeset_operations/indexedCollection.js.map +1 -1
  47. package/lib/helpers/typeidHelper.js +16 -26
  48. package/lib/helpers/typeidHelper.js.map +1 -1
  49. package/lib/pathHelper.js +50 -52
  50. package/lib/pathHelper.js.map +1 -1
  51. package/lib/templateValidator.js +64 -38
  52. package/lib/templateValidator.js.map +1 -1
  53. package/lib/utils.js +160 -167
  54. package/lib/utils.js.map +1 -1
  55. package/lib/validationResultBuilder.js +1 -7
  56. package/lib/validationResultBuilder.js.map +1 -1
  57. package/package.json +3 -3
@@ -23,13 +23,37 @@ const { isPrimitiveType } = TypeIdHelper;
23
23
  */
24
24
  var ArrayChangeSetRangeType;
25
25
  (function (ArrayChangeSetRangeType) {
26
+ /**
27
+ * A complete operation of change set A.
28
+ */
26
29
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeA"] = 0] = "completeA";
30
+ /**
31
+ * A complete operation of change set B.
32
+ */
27
33
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeB"] = 1] = "completeB";
34
+ /**
35
+ * A partial operation of change set A.
36
+ */
28
37
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfA"] = 2] = "partOfA";
38
+ /**
39
+ * A partial operation of change set B.
40
+ */
29
41
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfB"] = 3] = "partOfB";
42
+ /**
43
+ * A complete operation of change set A overlapping with a partial operation of change set B.
44
+ */
30
45
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeApartOfB"] = 4] = "completeApartOfB";
46
+ /**
47
+ * A complete operation of change set B overlapping with a partial operation of change set A.
48
+ */
31
49
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeBpartOfA"] = 5] = "completeBpartOfA";
50
+ /**
51
+ * A complete operation of change set A overlapping a complete operation of change set B.
52
+ */
32
53
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeAcompleteB"] = 6] = "completeAcompleteB";
54
+ /**
55
+ * A partial operation of change set A, a partial operation of change set B.
56
+ */
33
57
  ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfApartOfB"] = 7] = "partOfApartOfB";
34
58
  })(ArrayChangeSetRangeType || (ArrayChangeSetRangeType = {}));
35
59
  /**
@@ -105,12 +129,7 @@ const getRangeForAppliedOperation = function (in_operation, io_resultingRange, i
105
129
  io_resultingRange.op.operation[0] = in_operation.operation[0];
106
130
  io_resultingRange.begin = in_operation.operation[0];
107
131
  io_resultingRange.op._absoluteBegin = in_operation.operation[0];
108
- if (in_flag !== undefined) {
109
- io_resultingRange.flag = in_flag;
110
- }
111
- else {
112
- io_resultingRange.flag = ArrayChangeSetRangeType.completeB;
113
- }
132
+ io_resultingRange.flag = in_flag !== undefined ? in_flag : ArrayChangeSetRangeType.completeB;
114
133
  switch (in_operation.type) {
115
134
  case ArrayChangeSetIterator.types.INSERT:
116
135
  io_resultingRange.end = in_operation.operation[0];
@@ -125,12 +144,9 @@ const getRangeForAppliedOperation = function (in_operation, io_resultingRange, i
125
144
  case ArrayChangeSetIterator.types.REMOVE:
126
145
  let numberOfRemovedElements = getOpLength(in_operation.operation);
127
146
  io_resultingRange.end = in_operation.operation[0] + numberOfRemovedElements;
128
- if (Array.isArray(in_operation.operation[1])) {
129
- io_resultingRange.op.operation[1] = in_operation.operation[1].slice();
130
- }
131
- else {
132
- io_resultingRange.op.operation[1] = in_operation.operation[1];
133
- }
147
+ io_resultingRange.op.operation[1] = Array.isArray(in_operation.operation[1])
148
+ ? in_operation.operation[1].slice()
149
+ : in_operation.operation[1];
134
150
  io_resultingRange.removeInsertOperation = in_operation.removeInsertOperation;
135
151
  return;
136
152
  case ArrayChangeSetIterator.types.MODIFY:
@@ -393,22 +409,14 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
393
409
  io_resultingSegment.end = io_rangeA.end;
394
410
  io_resultingSegment.op = undefined; // This is used to indicate that we don't need any operation
395
411
  if (io_rangeB.op.operation[1].length === rangeLength) {
396
- if (io_rangeA.op.operation[1].length === rangeLength) {
397
- // We consume both A and B
398
- io_resultingSegment.flag = ArrayChangeSetRangeType.completeAcompleteB;
399
- }
400
- else {
401
- io_resultingSegment.flag = ArrayChangeSetRangeType.completeBpartOfA;
402
- }
412
+ io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
413
+ ? ArrayChangeSetRangeType.completeAcompleteB
414
+ : ArrayChangeSetRangeType.completeBpartOfA;
403
415
  }
404
416
  else {
405
- if (io_rangeA.op.operation[1].length === rangeLength) {
406
- // We consume A and leave a part of B
407
- io_resultingSegment.flag = ArrayChangeSetRangeType.completeApartOfB;
408
- }
409
- else {
410
- io_resultingSegment.flag = ArrayChangeSetRangeType.partOfApartOfB;
411
- }
417
+ io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
418
+ ? ArrayChangeSetRangeType.completeApartOfB
419
+ : ArrayChangeSetRangeType.partOfApartOfB;
412
420
  }
413
421
  // cut the remaining segment entry
414
422
  if (io_resultingSegment.flag === ArrayChangeSetRangeType.partOfApartOfB ||
@@ -739,13 +747,7 @@ const handleCombinations = function (in_segment, in_isPrimitiveType) {
739
747
  }
740
748
  case ArrayChangeSetIterator.types.REMOVE: {
741
749
  // Attention: B removes A completely, kill A to avoid zero inserts
742
- let opBLen;
743
- if (isNumber(opB.operation[1])) {
744
- opBLen = opB.operation[1];
745
- }
746
- else {
747
- opBLen = opB.operation[1].length;
748
- }
750
+ const opBLen = isNumber(opB.operation[1]) ? opB.operation[1] : opB.operation[1].length;
749
751
  if (opBLen !== opA.operation[1].length) {
750
752
  throw new Error("handleCombinations: insert-remove: unequal number of affected entries");
751
753
  }
@@ -849,21 +851,27 @@ const arraysHaveSameValues = function (in_arr1, in_arr2) {
849
851
  *
850
852
  * We have to handle the conflicting rebase changes. The changes we do, are summarized in this table.
851
853
  * Other is the modified, rebased (on own) changeset.
854
+ *
855
+ * ```
852
856
  * BASE
853
857
  * / \
854
858
  * / \
855
859
  * OWN OTHER
860
+ * ```
856
861
  *
857
862
  * gets rebased to:
858
863
  *
864
+ * ```
859
865
  * BASE
860
866
  * /
861
867
  * OWN
862
868
  * \
863
869
  * OTHER
870
+ * ```
864
871
  *
865
872
  * conflict default behavior in ()
866
873
  *
874
+ * ```
867
875
  * -------|-----------------+------------------+------------------|
868
876
  * \Own| insert | modify | remove |
869
877
  * \ | | | |
@@ -882,6 +890,7 @@ const arraysHaveSameValues = function (in_arr1, in_arr2) {
882
890
  * remove | change | change | change |
883
891
  * | [rem orig. data]| (note the user) | [rem dupl. rem] |
884
892
  * -------|-----------------+------------------+------------------|
893
+ * ```
885
894
  *
886
895
  * @param {{opA:{}, opB:{}}} in_segment - The two ops to be combined
887
896
  * @param {Array.<property-changeset.ChangeSet.ConflictInfo>} out_conflicts - A list of paths that resulted in
@@ -966,20 +975,8 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
966
975
  }
967
976
  case ArrayChangeSetIterator.types.REMOVE: {
968
977
  // Remove already in A, no need to add the same again -> write nop
969
- let opBLen;
970
- let opALen;
971
- if (isNumber(opB.operation[1])) {
972
- opBLen = opB.operation[1];
973
- }
974
- else {
975
- opBLen = opB.operation[1].length;
976
- }
977
- if (isNumber(opA.operation[1])) {
978
- opALen = opA.operation[1];
979
- }
980
- else {
981
- opALen = opA.operation[1].length;
982
- }
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;
983
980
  if (opBLen !== opALen) {
984
981
  throw new Error("handleRebaseCombinations: remove-remove: unequal number of affected entries, " +
985
982
  "this should never happen! Probably a bug in splitRange.");
@@ -1121,6 +1118,7 @@ const applyRebaseSegment = function (in_segment, io_changeset, in_currentIndexOf
1121
1118
  pushOp(in_segment.opB, io_changeset, in_currentIndexOffset, in_options);
1122
1119
  }
1123
1120
  };
1121
+ // eslint-disable-next-line @typescript-eslint/no-namespace
1124
1122
  export var ChangeSetArrayFunctions;
1125
1123
  (function (ChangeSetArrayFunctions) {
1126
1124
  /**
@@ -1384,21 +1382,27 @@ export var ChangeSetArrayFunctions;
1384
1382
  *
1385
1383
  * We have to handle the conflicting rebase changes. The changes we do, are summarized in this table.
1386
1384
  * Other is the modified, rebased (on own) changeset.
1385
+ *
1386
+ * ```
1387
1387
  * BASE
1388
1388
  * / \
1389
1389
  * / \
1390
1390
  * OWN OTHER
1391
+ * ```
1391
1392
  *
1392
1393
  * gets rebased to:
1393
1394
  *
1395
+ * ```
1394
1396
  * BASE
1395
1397
  * /
1396
1398
  * OWN
1397
1399
  * \
1398
1400
  * OTHER
1401
+ * ```
1399
1402
  *
1400
1403
  * conflict default behavior in ()
1401
1404
  *
1405
+ * ```
1402
1406
  * -------|-----------------+------------------+------------------|----------------|
1403
1407
  * \Own| insert | modify | remove | String set |
1404
1408
  * \ | | | | |
@@ -1419,6 +1423,7 @@ export var ChangeSetArrayFunctions;
1419
1423
  * set | 'other's set overwrites whatever happend before |
1420
1424
  * | | | | |
1421
1425
  * --------------------------------------------------------------------------------|
1426
+ * ```
1422
1427
  *
1423
1428
  * @param in_ownPropertyChangeSet - The ChangeSet for the property stored in this object
1424
1429
  * @param io_rebasePropertyChangeSetParent - The Array containing the ChangeSet for the property to be rebased