@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
|
@@ -29,13 +29,37 @@ const { isPrimitiveType } = typeidHelper_1.TypeIdHelper;
|
|
|
29
29
|
*/
|
|
30
30
|
var ArrayChangeSetRangeType;
|
|
31
31
|
(function (ArrayChangeSetRangeType) {
|
|
32
|
+
/**
|
|
33
|
+
* A complete operation of change set A.
|
|
34
|
+
*/
|
|
32
35
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeA"] = 0] = "completeA";
|
|
36
|
+
/**
|
|
37
|
+
* A complete operation of change set B.
|
|
38
|
+
*/
|
|
33
39
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeB"] = 1] = "completeB";
|
|
40
|
+
/**
|
|
41
|
+
* A partial operation of change set A.
|
|
42
|
+
*/
|
|
34
43
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfA"] = 2] = "partOfA";
|
|
44
|
+
/**
|
|
45
|
+
* A partial operation of change set B.
|
|
46
|
+
*/
|
|
35
47
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfB"] = 3] = "partOfB";
|
|
48
|
+
/**
|
|
49
|
+
* A complete operation of change set A overlapping with a partial operation of change set B.
|
|
50
|
+
*/
|
|
36
51
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeApartOfB"] = 4] = "completeApartOfB";
|
|
52
|
+
/**
|
|
53
|
+
* A complete operation of change set B overlapping with a partial operation of change set A.
|
|
54
|
+
*/
|
|
37
55
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeBpartOfA"] = 5] = "completeBpartOfA";
|
|
56
|
+
/**
|
|
57
|
+
* A complete operation of change set A overlapping a complete operation of change set B.
|
|
58
|
+
*/
|
|
38
59
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["completeAcompleteB"] = 6] = "completeAcompleteB";
|
|
60
|
+
/**
|
|
61
|
+
* A partial operation of change set A, a partial operation of change set B.
|
|
62
|
+
*/
|
|
39
63
|
ArrayChangeSetRangeType[ArrayChangeSetRangeType["partOfApartOfB"] = 7] = "partOfApartOfB";
|
|
40
64
|
})(ArrayChangeSetRangeType || (ArrayChangeSetRangeType = {}));
|
|
41
65
|
/**
|
|
@@ -111,12 +135,7 @@ const getRangeForAppliedOperation = function (in_operation, io_resultingRange, i
|
|
|
111
135
|
io_resultingRange.op.operation[0] = in_operation.operation[0];
|
|
112
136
|
io_resultingRange.begin = in_operation.operation[0];
|
|
113
137
|
io_resultingRange.op._absoluteBegin = in_operation.operation[0];
|
|
114
|
-
|
|
115
|
-
io_resultingRange.flag = in_flag;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
io_resultingRange.flag = ArrayChangeSetRangeType.completeB;
|
|
119
|
-
}
|
|
138
|
+
io_resultingRange.flag = in_flag !== undefined ? in_flag : ArrayChangeSetRangeType.completeB;
|
|
120
139
|
switch (in_operation.type) {
|
|
121
140
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.INSERT:
|
|
122
141
|
io_resultingRange.end = in_operation.operation[0];
|
|
@@ -131,12 +150,9 @@ const getRangeForAppliedOperation = function (in_operation, io_resultingRange, i
|
|
|
131
150
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE:
|
|
132
151
|
let numberOfRemovedElements = getOpLength(in_operation.operation);
|
|
133
152
|
io_resultingRange.end = in_operation.operation[0] + numberOfRemovedElements;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
else {
|
|
138
|
-
io_resultingRange.op.operation[1] = in_operation.operation[1];
|
|
139
|
-
}
|
|
153
|
+
io_resultingRange.op.operation[1] = Array.isArray(in_operation.operation[1])
|
|
154
|
+
? in_operation.operation[1].slice()
|
|
155
|
+
: in_operation.operation[1];
|
|
140
156
|
io_resultingRange.removeInsertOperation = in_operation.removeInsertOperation;
|
|
141
157
|
return;
|
|
142
158
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY:
|
|
@@ -399,22 +415,14 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
399
415
|
io_resultingSegment.end = io_rangeA.end;
|
|
400
416
|
io_resultingSegment.op = undefined; // This is used to indicate that we don't need any operation
|
|
401
417
|
if (io_rangeB.op.operation[1].length === rangeLength) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
io_resultingSegment.flag = ArrayChangeSetRangeType.completeBpartOfA;
|
|
408
|
-
}
|
|
418
|
+
io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
|
|
419
|
+
? ArrayChangeSetRangeType.completeAcompleteB
|
|
420
|
+
: ArrayChangeSetRangeType.completeBpartOfA;
|
|
409
421
|
}
|
|
410
422
|
else {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
io_resultingSegment.flag = ArrayChangeSetRangeType.partOfApartOfB;
|
|
417
|
-
}
|
|
423
|
+
io_resultingSegment.flag = io_rangeA.op.operation[1].length === rangeLength
|
|
424
|
+
? ArrayChangeSetRangeType.completeApartOfB
|
|
425
|
+
: ArrayChangeSetRangeType.partOfApartOfB;
|
|
418
426
|
}
|
|
419
427
|
// cut the remaining segment entry
|
|
420
428
|
if (io_resultingSegment.flag === ArrayChangeSetRangeType.partOfApartOfB ||
|
|
@@ -745,13 +753,7 @@ const handleCombinations = function (in_segment, in_isPrimitiveType) {
|
|
|
745
753
|
}
|
|
746
754
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE: {
|
|
747
755
|
// Attention: B removes A completely, kill A to avoid zero inserts
|
|
748
|
-
|
|
749
|
-
if ((0, isNumber_1.default)(opB.operation[1])) {
|
|
750
|
-
opBLen = opB.operation[1];
|
|
751
|
-
}
|
|
752
|
-
else {
|
|
753
|
-
opBLen = opB.operation[1].length;
|
|
754
|
-
}
|
|
756
|
+
const opBLen = (0, isNumber_1.default)(opB.operation[1]) ? opB.operation[1] : opB.operation[1].length;
|
|
755
757
|
if (opBLen !== opA.operation[1].length) {
|
|
756
758
|
throw new Error("handleCombinations: insert-remove: unequal number of affected entries");
|
|
757
759
|
}
|
|
@@ -855,21 +857,27 @@ const arraysHaveSameValues = function (in_arr1, in_arr2) {
|
|
|
855
857
|
*
|
|
856
858
|
* We have to handle the conflicting rebase changes. The changes we do, are summarized in this table.
|
|
857
859
|
* Other is the modified, rebased (on own) changeset.
|
|
860
|
+
*
|
|
861
|
+
* ```
|
|
858
862
|
* BASE
|
|
859
863
|
* / \
|
|
860
864
|
* / \
|
|
861
865
|
* OWN OTHER
|
|
866
|
+
* ```
|
|
862
867
|
*
|
|
863
868
|
* gets rebased to:
|
|
864
869
|
*
|
|
870
|
+
* ```
|
|
865
871
|
* BASE
|
|
866
872
|
* /
|
|
867
873
|
* OWN
|
|
868
874
|
* \
|
|
869
875
|
* OTHER
|
|
876
|
+
* ```
|
|
870
877
|
*
|
|
871
878
|
* conflict default behavior in ()
|
|
872
879
|
*
|
|
880
|
+
* ```
|
|
873
881
|
* -------|-----------------+------------------+------------------|
|
|
874
882
|
* \Own| insert | modify | remove |
|
|
875
883
|
* \ | | | |
|
|
@@ -888,6 +896,7 @@ const arraysHaveSameValues = function (in_arr1, in_arr2) {
|
|
|
888
896
|
* remove | change | change | change |
|
|
889
897
|
* | [rem orig. data]| (note the user) | [rem dupl. rem] |
|
|
890
898
|
* -------|-----------------+------------------+------------------|
|
|
899
|
+
* ```
|
|
891
900
|
*
|
|
892
901
|
* @param {{opA:{}, opB:{}}} in_segment - The two ops to be combined
|
|
893
902
|
* @param {Array.<property-changeset.ChangeSet.ConflictInfo>} out_conflicts - A list of paths that resulted in
|
|
@@ -972,20 +981,8 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
|
|
|
972
981
|
}
|
|
973
982
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE: {
|
|
974
983
|
// Remove already in A, no need to add the same again -> write nop
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
if ((0, isNumber_1.default)(opB.operation[1])) {
|
|
978
|
-
opBLen = opB.operation[1];
|
|
979
|
-
}
|
|
980
|
-
else {
|
|
981
|
-
opBLen = opB.operation[1].length;
|
|
982
|
-
}
|
|
983
|
-
if ((0, isNumber_1.default)(opA.operation[1])) {
|
|
984
|
-
opALen = opA.operation[1];
|
|
985
|
-
}
|
|
986
|
-
else {
|
|
987
|
-
opALen = opA.operation[1].length;
|
|
988
|
-
}
|
|
984
|
+
const opBLen = (0, isNumber_1.default)(opB.operation[1]) ? opB.operation[1] : opB.operation[1].length;
|
|
985
|
+
const opALen = (0, isNumber_1.default)(opA.operation[1]) ? opA.operation[1] : opA.operation[1].length;
|
|
989
986
|
if (opBLen !== opALen) {
|
|
990
987
|
throw new Error("handleRebaseCombinations: remove-remove: unequal number of affected entries, " +
|
|
991
988
|
"this should never happen! Probably a bug in splitRange.");
|
|
@@ -1127,6 +1124,7 @@ const applyRebaseSegment = function (in_segment, io_changeset, in_currentIndexOf
|
|
|
1127
1124
|
pushOp(in_segment.opB, io_changeset, in_currentIndexOffset, in_options);
|
|
1128
1125
|
}
|
|
1129
1126
|
};
|
|
1127
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
1130
1128
|
var ChangeSetArrayFunctions;
|
|
1131
1129
|
(function (ChangeSetArrayFunctions) {
|
|
1132
1130
|
/**
|
|
@@ -1390,21 +1388,27 @@ var ChangeSetArrayFunctions;
|
|
|
1390
1388
|
*
|
|
1391
1389
|
* We have to handle the conflicting rebase changes. The changes we do, are summarized in this table.
|
|
1392
1390
|
* Other is the modified, rebased (on own) changeset.
|
|
1391
|
+
*
|
|
1392
|
+
* ```
|
|
1393
1393
|
* BASE
|
|
1394
1394
|
* / \
|
|
1395
1395
|
* / \
|
|
1396
1396
|
* OWN OTHER
|
|
1397
|
+
* ```
|
|
1397
1398
|
*
|
|
1398
1399
|
* gets rebased to:
|
|
1399
1400
|
*
|
|
1401
|
+
* ```
|
|
1400
1402
|
* BASE
|
|
1401
1403
|
* /
|
|
1402
1404
|
* OWN
|
|
1403
1405
|
* \
|
|
1404
1406
|
* OTHER
|
|
1407
|
+
* ```
|
|
1405
1408
|
*
|
|
1406
1409
|
* conflict default behavior in ()
|
|
1407
1410
|
*
|
|
1411
|
+
* ```
|
|
1408
1412
|
* -------|-----------------+------------------+------------------|----------------|
|
|
1409
1413
|
* \Own| insert | modify | remove | String set |
|
|
1410
1414
|
* \ | | | | |
|
|
@@ -1425,6 +1429,7 @@ var ChangeSetArrayFunctions;
|
|
|
1425
1429
|
* set | 'other's set overwrites whatever happend before |
|
|
1426
1430
|
* | | | | |
|
|
1427
1431
|
* --------------------------------------------------------------------------------|
|
|
1432
|
+
* ```
|
|
1428
1433
|
*
|
|
1429
1434
|
* @param in_ownPropertyChangeSet - The ChangeSet for the property stored in this object
|
|
1430
1435
|
* @param io_rebasePropertyChangeSetParent - The Array containing the ChangeSet for the property to be rebased
|