@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.
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +3 -6
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +31 -0
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +52 -47
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +12 -14
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +13 -14
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +6 -6
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +16 -26
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/pathHelper.d.ts +1 -1
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +50 -52
- package/dist/pathHelper.js.map +1 -1
- package/dist/templateValidator.d.ts +58 -26
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +64 -38
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +3 -6
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +2 -4
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +2 -4
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/validator/templateValidator.spec.js +5 -10
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/utils.d.ts +131 -103
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +160 -167
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +2 -4
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js +1 -7
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/changeset.js +3 -6
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +52 -47
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +13 -14
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/helpers/typeidHelper.js +16 -26
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/pathHelper.js +50 -52
- package/lib/pathHelper.js.map +1 -1
- package/lib/templateValidator.js +64 -38
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js +160 -167
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.js +1 -7
- package/lib/validationResultBuilder.js.map +1 -1
- 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
|
-
|
|
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
|
-
|
|
129
|
-
|
|
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
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
-
|
|
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
|
-
|
|
970
|
-
|
|
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
|