@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.
- package/README.md +1 -0
- package/dist/changeset.d.ts +2 -2
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +61 -45
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +6 -6
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +87 -56
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.js +43 -41
- package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/dist/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
- package/dist/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +76 -44
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.js +2 -1
- package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/dist/changeset_operations/operationTypes.d.ts.map +1 -1
- package/dist/changeset_operations/operationTypes.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +10 -10
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +19 -17
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isReservedKeyword.d.ts.map +1 -1
- package/dist/isReservedKeyword.js.map +1 -1
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +16 -10
- package/dist/pathHelper.js.map +1 -1
- package/dist/rebase.d.ts.map +1 -1
- package/dist/rebase.js +20 -13
- package/dist/rebase.js.map +1 -1
- package/dist/templateSchema.d.ts.map +1 -1
- package/dist/templateSchema.js +10 -11
- package/dist/templateSchema.js.map +1 -1
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +135 -102
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +141 -343
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +299 -166
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/schemaValidator.js +3 -1
- package/dist/test/schemaValidator.js.map +1 -1
- package/dist/test/schemas/badBothPropertiesAndTypeid.js +8 -8
- package/dist/test/schemas/badBothPropertiesAndTypeid.js.map +1 -1
- package/dist/test/schemas/badInvalidSemverInTypeid.js +18 -16
- package/dist/test/schemas/badInvalidSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badMissingSemverInTypeid.js +18 -16
- package/dist/test/schemas/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badNestedProperties.js +18 -17
- package/dist/test/schemas/badNestedProperties.js.map +1 -1
- package/dist/test/schemas/badPrimitiveTypeid.js +9 -8
- package/dist/test/schemas/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/schemas/badVersionedTypeid.js +19 -17
- package/dist/test/schemas/badVersionedTypeid.js.map +1 -1
- package/dist/test/schemas/goodColorPalette.js +4 -4
- package/dist/test/schemas/goodColorPalette.js.map +1 -1
- package/dist/test/schemas/goodDraftAsVersion.js +2 -4
- package/dist/test/schemas/goodDraftAsVersion.js.map +1 -1
- package/dist/test/schemas/goodPointId.js +18 -16
- package/dist/test/schemas/goodPointId.js.map +1 -1
- package/dist/test/schemas/goodReferenceAndRegular.js +5 -5
- package/dist/test/schemas/goodReferenceAndRegular.js.map +1 -1
- package/dist/test/schemas/goodReservedTypes.js +8 -7
- package/dist/test/schemas/goodReservedTypes.js.map +1 -1
- package/dist/test/schemas/goodUIBorder.js +19 -16
- package/dist/test/schemas/goodUIBorder.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/validator/templateSyntax.spec.js.map +1 -1
- package/dist/test/validator/templateValidator.spec.js +329 -306
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/test/validator/typeidHelper.spec.js +98 -65
- package/dist/test/validator/typeidHelper.spec.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +149 -95
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/changeset.js +63 -47
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +88 -57
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.js +43 -41
- package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/lib/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +76 -44
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/changeset_operations/isEmptyChangeset.js +2 -1
- package/lib/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/lib/changeset_operations/operationTypes.js.map +1 -1
- package/lib/helpers/typeidHelper.js +19 -17
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/isReservedKeyword.js.map +1 -1
- package/lib/pathHelper.js +17 -11
- package/lib/pathHelper.js.map +1 -1
- package/lib/rebase.js +20 -13
- package/lib/rebase.js.map +1 -1
- package/lib/templateSchema.js +10 -11
- package/lib/templateSchema.js.map +1 -1
- package/lib/templateValidator.js +135 -102
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js +149 -95
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +100 -100
|
@@ -96,7 +96,8 @@ const getRangeForCurrentStateOperation = function (io_operation, in_aOffset, io_
|
|
|
96
96
|
io_resultingRange.end = io_operation.operation[0];
|
|
97
97
|
io_resultingRange.op = io_operation;
|
|
98
98
|
io_resultingRange.flag = ArrayChangeSetRangeType.completeA;
|
|
99
|
-
io_resultingRange.removeInsertOperation =
|
|
99
|
+
io_resultingRange.removeInsertOperation =
|
|
100
|
+
io_operation.removeInsertOperation;
|
|
100
101
|
return;
|
|
101
102
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY:
|
|
102
103
|
io_resultingRange.begin = io_operation.operation[0];
|
|
@@ -108,7 +109,7 @@ const getRangeForCurrentStateOperation = function (io_operation, in_aOffset, io_
|
|
|
108
109
|
throw new Error(`getRangeForCurrentStateOperation: ${MSG.UNKNOWN_OPERATION}`);
|
|
109
110
|
}
|
|
110
111
|
};
|
|
111
|
-
const getOpLength = (op) => (0, isNumber_1.default)(op[1]) ? op[1] : op[1].length;
|
|
112
|
+
const getOpLength = (op) => ((0, isNumber_1.default)(op[1]) ? op[1] : op[1].length);
|
|
112
113
|
/**
|
|
113
114
|
* Computes the impact range for a given operation of the applied change set
|
|
114
115
|
* @param in_operation - The op
|
|
@@ -284,7 +285,8 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
284
285
|
}
|
|
285
286
|
if (io_rangeB.removeInsertOperation &&
|
|
286
287
|
io_rangeB.op.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE &&
|
|
287
|
-
(io_rangeA.begin === undefined ||
|
|
288
|
+
(io_rangeA.begin === undefined ||
|
|
289
|
+
io_rangeB.removeInsertOperation[0] < io_rangeA.begin - io_rangeA.op.offset) &&
|
|
288
290
|
io_rangeB.removeInsertOperation[0] < io_rangeB.begin &&
|
|
289
291
|
!io_rangeB.insertAlreadyProcessed) {
|
|
290
292
|
io_resultingSegment.begin = io_rangeB.removeInsertOperation[0];
|
|
@@ -321,17 +323,18 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
321
323
|
nextInsertOffset = getOpLength(io_rangeA.removeInsertOperation);
|
|
322
324
|
}
|
|
323
325
|
if (!in_rebasing &&
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
io_rangeA.begin <= io_rangeB.begin &&
|
|
327
|
+
io_rangeA.begin + nextInsertOffset >= io_rangeB.begin &&
|
|
328
|
+
io_rangeA.op.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE &&
|
|
327
329
|
Array.isArray(io_rangeA.op.operation[1]) && // This is a reversible remove operation
|
|
328
|
-
|
|
330
|
+
io_rangeB.op.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.INSERT) {
|
|
329
331
|
// Are the two operations canceling out?
|
|
330
332
|
let startOffset = 0;
|
|
331
333
|
let rangeStart = 0;
|
|
332
334
|
let matchFound = false;
|
|
333
335
|
let rangeLength = io_rangeB.op.operation[1].length;
|
|
334
|
-
const operationMetaInfo = in_options &&
|
|
336
|
+
const operationMetaInfo = in_options &&
|
|
337
|
+
in_options.applyAfterMetaInformation &&
|
|
335
338
|
in_options.applyAfterMetaInformation.get(io_rangeB.op.operation[1]);
|
|
336
339
|
if (operationMetaInfo && operationMetaInfo.rebasedRemoveInsertRanges) {
|
|
337
340
|
if (operationMetaInfo.currentInsertOffset === undefined) {
|
|
@@ -340,13 +343,16 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
340
343
|
}
|
|
341
344
|
let i = 0;
|
|
342
345
|
for (; i < operationMetaInfo.rebasedRemoveInsertRanges.length; i++) {
|
|
343
|
-
if (operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart >=
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
if (operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart >=
|
|
347
|
+
operationMetaInfo.currentInsertOffset) {
|
|
348
|
+
startOffset =
|
|
349
|
+
operationMetaInfo.rebasedRemoveInsertRanges[i].originalStartPosition -
|
|
350
|
+
io_rangeA.op.operation[0] +
|
|
351
|
+
io_rangeA.op.offset +
|
|
352
|
+
io_rangeB.op.offset;
|
|
353
|
+
rangeStart =
|
|
354
|
+
operationMetaInfo.rebasedRemoveInsertRanges[i].rangeStart -
|
|
355
|
+
operationMetaInfo.currentInsertOffset;
|
|
350
356
|
rangeLength = operationMetaInfo.rebasedRemoveInsertRanges[i].rangeLength;
|
|
351
357
|
if (io_rangeA.op.operation[1].length - startOffset >= rangeLength &&
|
|
352
358
|
(0, isEqual_1.default)(io_rangeA.op.operation[1].slice(startOffset, startOffset + rangeLength), io_rangeB.op.operation[1].slice(rangeStart, rangeStart + rangeLength))) {
|
|
@@ -415,14 +421,16 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
415
421
|
io_resultingSegment.end = io_rangeA.end;
|
|
416
422
|
io_resultingSegment.op = undefined; // This is used to indicate that we don't need any operation
|
|
417
423
|
if (io_rangeB.op.operation[1].length === rangeLength) {
|
|
418
|
-
io_resultingSegment.flag =
|
|
419
|
-
|
|
420
|
-
|
|
424
|
+
io_resultingSegment.flag =
|
|
425
|
+
io_rangeA.op.operation[1].length === rangeLength
|
|
426
|
+
? ArrayChangeSetRangeType.completeAcompleteB
|
|
427
|
+
: ArrayChangeSetRangeType.completeBpartOfA;
|
|
421
428
|
}
|
|
422
429
|
else {
|
|
423
|
-
io_resultingSegment.flag =
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
io_resultingSegment.flag =
|
|
431
|
+
io_rangeA.op.operation[1].length === rangeLength
|
|
432
|
+
? ArrayChangeSetRangeType.completeApartOfB
|
|
433
|
+
: ArrayChangeSetRangeType.partOfApartOfB;
|
|
426
434
|
}
|
|
427
435
|
// cut the remaining segment entry
|
|
428
436
|
if (io_resultingSegment.flag === ArrayChangeSetRangeType.partOfApartOfB ||
|
|
@@ -439,9 +447,9 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
439
447
|
}
|
|
440
448
|
}
|
|
441
449
|
}
|
|
442
|
-
if (
|
|
450
|
+
if (io_rangeA.end < io_rangeB.begin || // please see in_rebasing comments in the function description
|
|
443
451
|
((!in_rebasing || io_rangeA.op.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE) &&
|
|
444
|
-
|
|
452
|
+
io_rangeA.end === io_rangeB.begin)) {
|
|
445
453
|
io_resultingSegment.begin = io_rangeA.begin;
|
|
446
454
|
io_resultingSegment.end = io_rangeA.end;
|
|
447
455
|
io_resultingSegment.op = io_rangeA.op;
|
|
@@ -456,18 +464,20 @@ const splitOverlapping = function (io_rangeA, io_rangeB, io_resultingSegment, in
|
|
|
456
464
|
length = length.length;
|
|
457
465
|
}
|
|
458
466
|
in_options.applyAfterMetaInformation.set(io_rangeB.op.operation[1], {
|
|
459
|
-
rebasedRemoveInsertRanges: [
|
|
467
|
+
rebasedRemoveInsertRanges: [
|
|
468
|
+
{
|
|
460
469
|
rangeStart: 0,
|
|
461
470
|
rangeLength: length,
|
|
462
471
|
originalStartPosition: io_rangeA.end + io_rangeB.op.offset,
|
|
463
|
-
}
|
|
472
|
+
},
|
|
473
|
+
],
|
|
464
474
|
});
|
|
465
475
|
}
|
|
466
476
|
}
|
|
467
477
|
return;
|
|
468
478
|
}
|
|
469
|
-
if (
|
|
470
|
-
(!in_rebasing &&
|
|
479
|
+
if (io_rangeB.end < io_rangeA.begin || // please see in_rebasing comments in the function description
|
|
480
|
+
(!in_rebasing && io_rangeB.end === io_rangeA.begin)) {
|
|
471
481
|
io_resultingSegment.begin = io_rangeB.begin;
|
|
472
482
|
io_resultingSegment.end = io_rangeB.end;
|
|
473
483
|
io_resultingSegment.op = io_rangeB.op;
|
|
@@ -685,16 +695,20 @@ const pushOp = function (in_op, io_changeset, in_indexOffset, in_options, in_las
|
|
|
685
695
|
}
|
|
686
696
|
switch (in_op.type) {
|
|
687
697
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.INSERT: {
|
|
688
|
-
if (in_options &&
|
|
698
|
+
if (in_options &&
|
|
699
|
+
in_options.applyAfterMetaInformation &&
|
|
700
|
+
!(0, isNumber_1.default)(in_op.operation[1])) {
|
|
689
701
|
// If we don't have any meta information yet, we add an entry with the correct offset applied
|
|
690
702
|
const metaInfo = in_options.applyAfterMetaInformation.get(in_op.operation[1]);
|
|
691
703
|
if (!metaInfo) {
|
|
692
704
|
in_options.applyAfterMetaInformation.set(in_op.operation[1], {
|
|
693
|
-
rebasedRemoveInsertRanges: [
|
|
705
|
+
rebasedRemoveInsertRanges: [
|
|
706
|
+
{
|
|
694
707
|
rangeStart: 0,
|
|
695
708
|
rangeLength: in_op.operation[1].length,
|
|
696
709
|
originalStartPosition: in_op.operation[0],
|
|
697
|
-
}
|
|
710
|
+
},
|
|
711
|
+
],
|
|
698
712
|
});
|
|
699
713
|
}
|
|
700
714
|
}
|
|
@@ -717,7 +731,11 @@ const pushOp = function (in_op, io_changeset, in_indexOffset, in_options, in_las
|
|
|
717
731
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY: {
|
|
718
732
|
if (!mergeWithLastIfPossible(in_op, io_changeset, writeTargetIndex, in_options)) {
|
|
719
733
|
if (in_op.operation[2] !== undefined) {
|
|
720
|
-
io_changeset.modify.push([
|
|
734
|
+
io_changeset.modify.push([
|
|
735
|
+
writeTargetIndex,
|
|
736
|
+
in_op.operation[1],
|
|
737
|
+
in_op.operation[2],
|
|
738
|
+
]);
|
|
721
739
|
}
|
|
722
740
|
else {
|
|
723
741
|
io_changeset.modify.push([writeTargetIndex, in_op.operation[1]]);
|
|
@@ -753,7 +771,9 @@ const handleCombinations = function (in_segment, in_isPrimitiveType) {
|
|
|
753
771
|
}
|
|
754
772
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE: {
|
|
755
773
|
// Attention: B removes A completely, kill A to avoid zero inserts
|
|
756
|
-
const opBLen = (0, isNumber_1.default)(opB.operation[1])
|
|
774
|
+
const opBLen = (0, isNumber_1.default)(opB.operation[1])
|
|
775
|
+
? opB.operation[1]
|
|
776
|
+
: opB.operation[1].length;
|
|
757
777
|
if (opBLen !== opA.operation[1].length) {
|
|
758
778
|
throw new Error("handleCombinations: insert-remove: unequal number of affected entries");
|
|
759
779
|
}
|
|
@@ -918,11 +938,13 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
|
|
|
918
938
|
if (!(0, isNumber_1.default)(insertEntries)) {
|
|
919
939
|
length = insertEntries.length;
|
|
920
940
|
in_options.applyAfterMetaInformation.set(insertEntries, {
|
|
921
|
-
rebasedRemoveInsertRanges: [
|
|
941
|
+
rebasedRemoveInsertRanges: [
|
|
942
|
+
{
|
|
922
943
|
rangeStart: 0,
|
|
923
944
|
rangeLength: length,
|
|
924
945
|
originalStartPosition,
|
|
925
|
-
}
|
|
946
|
+
},
|
|
947
|
+
],
|
|
926
948
|
});
|
|
927
949
|
}
|
|
928
950
|
}
|
|
@@ -981,8 +1003,12 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
|
|
|
981
1003
|
}
|
|
982
1004
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE: {
|
|
983
1005
|
// Remove already in A, no need to add the same again -> write nop
|
|
984
|
-
const opBLen = (0, isNumber_1.default)(opB.operation[1])
|
|
985
|
-
|
|
1006
|
+
const opBLen = (0, isNumber_1.default)(opB.operation[1])
|
|
1007
|
+
? opB.operation[1]
|
|
1008
|
+
: opB.operation[1].length;
|
|
1009
|
+
const opALen = (0, isNumber_1.default)(opA.operation[1])
|
|
1010
|
+
? opA.operation[1]
|
|
1011
|
+
: opA.operation[1].length;
|
|
986
1012
|
if (opBLen !== opALen) {
|
|
987
1013
|
throw new Error("handleRebaseCombinations: remove-remove: unequal number of affected entries, " +
|
|
988
1014
|
"this should never happen! Probably a bug in splitRange.");
|
|
@@ -1016,7 +1042,8 @@ const handleRebaseCombinations = function (in_segment, out_conflicts, in_basePat
|
|
|
1016
1042
|
case arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY: {
|
|
1017
1043
|
if (in_isPrimitiveType) {
|
|
1018
1044
|
// just use opB and notify accordingly
|
|
1019
|
-
if (opB.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY &&
|
|
1045
|
+
if (opB.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.MODIFY &&
|
|
1046
|
+
opB.operation[1].length > 0) {
|
|
1020
1047
|
delete opA._absoluteBegin;
|
|
1021
1048
|
delete opB.offset;
|
|
1022
1049
|
let conflict = {
|
|
@@ -1079,7 +1106,9 @@ const applySegment = function (in_segment, io_changeset, in_currentIndexOffset,
|
|
|
1079
1106
|
throw Error("applySegment: in_segment is undefined!");
|
|
1080
1107
|
}
|
|
1081
1108
|
// No operation needs to be performed
|
|
1082
|
-
if (in_segment.op === undefined &&
|
|
1109
|
+
if (in_segment.op === undefined &&
|
|
1110
|
+
in_segment.opA === undefined &&
|
|
1111
|
+
in_segment.opB === undefined) {
|
|
1083
1112
|
return;
|
|
1084
1113
|
}
|
|
1085
1114
|
if (in_segment.flag === ArrayChangeSetRangeType.completeA ||
|
|
@@ -1142,8 +1171,8 @@ var ChangeSetArrayFunctions;
|
|
|
1142
1171
|
property_common_1.ConsoleUtils.assert(!(0, isString_1.default)(in_appliedPropertyChanges), in_appliedPropertyChanges);
|
|
1143
1172
|
const isPrimitiveTypeid = isPrimitiveType(in_typeid);
|
|
1144
1173
|
// Iterator to process the changes in the ChangeSet in the correct order
|
|
1145
|
-
const iteratorA = new arrayChangesetIterator_1.ArrayChangeSetIterator(
|
|
1146
|
-
const iteratorB = new arrayChangesetIterator_1.ArrayChangeSetIterator(
|
|
1174
|
+
const iteratorA = new arrayChangesetIterator_1.ArrayChangeSetIterator(io_basePropertyChanges);
|
|
1175
|
+
const iteratorB = new arrayChangesetIterator_1.ArrayChangeSetIterator(in_appliedPropertyChanges);
|
|
1147
1176
|
const rangeA = {};
|
|
1148
1177
|
const rangeB = {};
|
|
1149
1178
|
const opA = iteratorA.opDescription;
|
|
@@ -1168,8 +1197,7 @@ var ChangeSetArrayFunctions;
|
|
|
1168
1197
|
}
|
|
1169
1198
|
else {
|
|
1170
1199
|
iteratorB.next();
|
|
1171
|
-
if (skipIteratorBOperation &&
|
|
1172
|
-
opB.operation === skipIteratorBOperation) {
|
|
1200
|
+
if (skipIteratorBOperation && opB.operation === skipIteratorBOperation) {
|
|
1173
1201
|
iteratorB.next();
|
|
1174
1202
|
}
|
|
1175
1203
|
skipIteratorBOperation = undefined;
|
|
@@ -1186,13 +1214,14 @@ var ChangeSetArrayFunctions;
|
|
|
1186
1214
|
let indexOffset = currentIndexOffset;
|
|
1187
1215
|
if (lastOpWasNop &&
|
|
1188
1216
|
(rangeA.begin === undefined || rangeA.begin >= segment.begin) &&
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1217
|
+
segment.flag === ArrayChangeSetRangeType.completeB &&
|
|
1218
|
+
segment.op.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.INSERT &&
|
|
1219
|
+
segment.op.operation[0] === canceledSegmentBegin) {
|
|
1192
1220
|
indexOffset = lastIndexOffset;
|
|
1193
1221
|
}
|
|
1194
1222
|
applySegment.call(this, segment, resultPropertyChanges, indexOffset, lastIteratorARemove, isPrimitiveTypeid);
|
|
1195
|
-
lastOpWasNop =
|
|
1223
|
+
lastOpWasNop =
|
|
1224
|
+
segment.opB !== undefined && segment.opB.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.NOP;
|
|
1196
1225
|
if (lastOpWasNop) {
|
|
1197
1226
|
canceledSegmentBegin = segment.begin;
|
|
1198
1227
|
}
|
|
@@ -1206,8 +1235,7 @@ var ChangeSetArrayFunctions;
|
|
|
1206
1235
|
// be placed behind the remove. We detect this case and correct the offset accordingly
|
|
1207
1236
|
// in pushOp
|
|
1208
1237
|
if (opA.type === arrayChangesetIterator_1.ArrayChangeSetIterator.types.REMOVE) {
|
|
1209
|
-
if (!lastIteratorARemove ||
|
|
1210
|
-
lastIteratorARemove.position !== opA.operation[0]) {
|
|
1238
|
+
if (!lastIteratorARemove || lastIteratorARemove.position !== opA.operation[0]) {
|
|
1211
1239
|
lastIteratorARemove = {
|
|
1212
1240
|
position: opA.operation[0],
|
|
1213
1241
|
length: getOpLength(opA.operation),
|
|
@@ -1218,7 +1246,8 @@ var ChangeSetArrayFunctions;
|
|
|
1218
1246
|
// we have to adjust the position to the end of this operation (an insert that is
|
|
1219
1247
|
// applied at the position of the remove would be shifted behind this insert)
|
|
1220
1248
|
if (opA.removeInsertOperation) {
|
|
1221
|
-
if (opA.removeInsertOperation[0] + opA.offset ===
|
|
1249
|
+
if (opA.removeInsertOperation[0] + opA.offset ===
|
|
1250
|
+
lastIteratorARemove.position) {
|
|
1222
1251
|
lastIteratorARemove.position += getOpLength(opA.removeInsertOperation);
|
|
1223
1252
|
}
|
|
1224
1253
|
}
|
|
@@ -1228,7 +1257,8 @@ var ChangeSetArrayFunctions;
|
|
|
1228
1257
|
// The offset will only be incremented as soon as the iterator reaches an operation at a different index.
|
|
1229
1258
|
// We detect this case and keep track, whether the remove has already been added to the offset or not.
|
|
1230
1259
|
if (lastIteratorARemove &&
|
|
1231
|
-
(opA.operation === undefined ||
|
|
1260
|
+
(opA.operation === undefined ||
|
|
1261
|
+
opA.operation[0] !== lastIteratorARemove.currentIndex)) {
|
|
1232
1262
|
lastIteratorARemove.offsetIncremented = true;
|
|
1233
1263
|
}
|
|
1234
1264
|
getRangeForCurrentStateOperation(iteratorA.opDescription, moreAs ? opA.offset : 0, rangeA);
|
|
@@ -1301,8 +1331,8 @@ var ChangeSetArrayFunctions;
|
|
|
1301
1331
|
function _rebaseArrayChangeSetForProperty(in_ownPropertyChangeSet, io_rebasePropertyChangeSet, in_basePath, out_conflicts, in_typeid, in_options) {
|
|
1302
1332
|
const isPrimitiveTypeid = isPrimitiveType(in_typeid);
|
|
1303
1333
|
// Iterator to process the changes in the ChangeSet in the correct order
|
|
1304
|
-
const iteratorA = new arrayChangesetIterator_1.ArrayChangeSetIterator(
|
|
1305
|
-
const iteratorB = new arrayChangesetIterator_1.ArrayChangeSetIterator(
|
|
1334
|
+
const iteratorA = new arrayChangesetIterator_1.ArrayChangeSetIterator(in_ownPropertyChangeSet);
|
|
1335
|
+
const iteratorB = new arrayChangesetIterator_1.ArrayChangeSetIterator(io_rebasePropertyChangeSet);
|
|
1306
1336
|
const opA = iteratorA.opDescription;
|
|
1307
1337
|
const rangeA = {};
|
|
1308
1338
|
getRangeForAppliedOperation(opA, rangeA, ArrayChangeSetRangeType.completeA, in_options);
|
|
@@ -1438,8 +1468,9 @@ var ChangeSetArrayFunctions;
|
|
|
1438
1468
|
* @param out_conflicts - A list of paths that resulted in conflicts together with the type of the conflict
|
|
1439
1469
|
*/
|
|
1440
1470
|
function _rebaseChangeSetForString(in_ownPropertyChangeSet, io_rebasePropertyChangeSetParent, in_key, in_basePath, out_conflicts, in_options) {
|
|
1441
|
-
if ((0, isString_1.default)(io_rebasePropertyChangeSetParent[in_key]) ||
|
|
1442
|
-
io_rebasePropertyChangeSetParent[in_key]
|
|
1471
|
+
if ((0, isString_1.default)(io_rebasePropertyChangeSetParent[in_key]) ||
|
|
1472
|
+
(io_rebasePropertyChangeSetParent[in_key] &&
|
|
1473
|
+
io_rebasePropertyChangeSetParent[in_key].hasOwnProperty("value"))) {
|
|
1443
1474
|
// other overwrites any old changes, we ignore them and report the conflict
|
|
1444
1475
|
let conflict = {
|
|
1445
1476
|
path: in_basePath,
|
|
@@ -1460,8 +1491,8 @@ var ChangeSetArrayFunctions;
|
|
|
1460
1491
|
delete io_rebasePropertyChangeSetParent[in_key];
|
|
1461
1492
|
}
|
|
1462
1493
|
}
|
|
1463
|
-
else if ((0, isString_1.default)(in_ownPropertyChangeSet) ||
|
|
1464
|
-
in_ownPropertyChangeSet.hasOwnProperty("value"))) {
|
|
1494
|
+
else if ((0, isString_1.default)(in_ownPropertyChangeSet) ||
|
|
1495
|
+
(in_ownPropertyChangeSet && in_ownPropertyChangeSet.hasOwnProperty("value"))) {
|
|
1465
1496
|
// we have a conflict since we cannot allow insert/remove/modify on an unknown state
|
|
1466
1497
|
// we just ignore other's modifications and take own's set
|
|
1467
1498
|
let conflict = {
|