@fluid-experimental/property-changeset 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0
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/ajvFactory.cjs +19 -0
- package/dist/ajvFactory.cjs.map +1 -0
- package/dist/ajvFactory.d.cts +7 -0
- package/dist/ajvFactory.d.cts.map +1 -0
- package/dist/changeset.d.ts +3 -6
- package/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +75 -75
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +6 -2
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +94 -96
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.d.ts +2 -5
- package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/dist/changeset_operations/arrayChangesetIterator.js +11 -12
- 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 +2 -2
- package/dist/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +1 -4
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +48 -49
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.d.ts +1 -4
- package/dist/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.js +9 -9
- package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +0 -3
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +10 -10
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/isReservedKeyword.d.ts.map +1 -1
- package/dist/isReservedKeyword.js +2 -2
- package/dist/isReservedKeyword.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/pathHelper.d.ts +0 -3
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +2 -2
- package/dist/pathHelper.js.map +1 -1
- package/dist/rebase.js +8 -8
- package/dist/rebase.js.map +1 -1
- package/dist/templateSchema.d.ts.map +1 -1
- package/dist/templateSchema.js +2 -2
- package/dist/templateSchema.js.map +1 -1
- package/dist/templateValidator.d.ts +1 -1
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +49 -54
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +34 -36
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/indexedCollection.spec.js +9 -6
- package/dist/test/indexedCollection.spec.js.map +1 -1
- package/dist/test/map.spec.js +4 -4
- package/dist/test/map.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +185 -185
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +5 -5
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/schemaValidator.js +12 -11
- package/dist/test/schemaValidator.js.map +1 -1
- package/dist/test/schemas/badBothPropertiesAndTypeid.js +18 -18
- package/dist/test/schemas/badBothPropertiesAndTypeid.js.map +1 -1
- package/dist/test/schemas/badInvalidSemverInTypeid.js +40 -40
- package/dist/test/schemas/badInvalidSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badMissingSemverInTypeid.js +40 -40
- package/dist/test/schemas/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/schemas/badNestedProperties.js +40 -40
- package/dist/test/schemas/badNestedProperties.js.map +1 -1
- package/dist/test/schemas/badPrimitiveTypeid.js +25 -25
- package/dist/test/schemas/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/schemas/badVersionedTypeid.js +41 -41
- package/dist/test/schemas/badVersionedTypeid.js.map +1 -1
- package/dist/test/schemas/goodColorPalette.js +15 -15
- package/dist/test/schemas/goodColorPalette.js.map +1 -1
- package/dist/test/schemas/goodDraftAsVersion.js +12 -12
- package/dist/test/schemas/goodDraftAsVersion.js.map +1 -1
- package/dist/test/schemas/goodPointId.js +40 -40
- package/dist/test/schemas/goodPointId.js.map +1 -1
- package/dist/test/schemas/goodReferenceAndRegular.js +16 -16
- package/dist/test/schemas/goodReferenceAndRegular.js.map +1 -1
- package/dist/test/schemas/goodReservedTypes.js +22 -22
- package/dist/test/schemas/goodReservedTypes.js.map +1 -1
- package/dist/test/schemas/goodUIBorder.js +34 -34
- package/dist/test/schemas/goodUIBorder.js.map +1 -1
- package/dist/test/schemas/index.js +55 -0
- package/dist/test/schemas/index.js.map +1 -0
- package/dist/test/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/test/validator/templateSyntax.spec.js +20 -25
- package/dist/test/validator/templateSyntax.spec.js.map +1 -1
- package/dist/test/validator/templateValidator.spec.js +118 -89
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/test/validator/typeidHelper.spec.js +42 -41
- package/dist/test/validator/typeidHelper.spec.js.map +1 -1
- package/dist/utils.d.ts +17 -13
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +79 -79
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +2 -1
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/ajvFactory.cjs +19 -0
- package/lib/ajvFactory.cjs.map +1 -0
- package/lib/ajvFactory.d.cts +7 -0
- package/lib/ajvFactory.d.cts.map +1 -0
- package/lib/changeset.d.ts +3 -6
- package/lib/changeset.d.ts.map +1 -1
- package/lib/changeset.js +16 -16
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.d.ts +6 -2
- package/lib/changeset_operations/array.d.ts.map +1 -1
- package/lib/changeset_operations/array.js +7 -9
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.d.ts +2 -5
- package/lib/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.js +3 -4
- package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/lib/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
- package/lib/changeset_operations/changesetConflictTypes.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.d.ts +1 -4
- package/lib/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +10 -11
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/changeset_operations/isEmptyChangeset.d.ts +1 -4
- package/lib/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
- package/lib/changeset_operations/isEmptyChangeset.js +3 -3
- package/lib/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/lib/helpers/typeidHelper.d.ts +0 -3
- package/lib/helpers/typeidHelper.d.ts.map +1 -1
- package/lib/helpers/typeidHelper.js +1 -1
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/index.d.ts +8 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/lib/isReservedKeyword.d.ts.map +1 -1
- package/lib/isReservedKeyword.js.map +1 -1
- package/lib/pathHelper.d.ts +0 -3
- package/lib/pathHelper.d.ts.map +1 -1
- package/lib/pathHelper.js.map +1 -1
- package/lib/rebase.js +2 -2
- package/lib/rebase.js.map +1 -1
- package/lib/templateSchema.d.ts.map +1 -1
- package/lib/templateSchema.js.map +1 -1
- package/lib/templateValidator.d.ts +1 -1
- package/lib/templateValidator.d.ts.map +1 -1
- package/lib/templateValidator.js +24 -29
- package/lib/templateValidator.js.map +1 -1
- package/lib/test/array.spec.js +768 -0
- package/lib/test/array.spec.js.map +1 -0
- package/lib/test/indexedCollection.spec.js +75 -0
- package/lib/test/indexedCollection.spec.js.map +1 -0
- package/lib/test/map.spec.js +17 -0
- package/lib/test/map.spec.js.map +1 -0
- package/lib/test/pathHelper.spec.js +435 -0
- package/lib/test/pathHelper.spec.js.map +1 -0
- package/lib/test/reversibleCs.spec.js +42 -0
- package/lib/test/reversibleCs.spec.js.map +1 -0
- package/lib/test/schemaValidator.js +103 -0
- package/lib/test/schemaValidator.js.map +1 -0
- package/lib/test/schemas/badBothPropertiesAndTypeid.js +24 -0
- package/lib/test/schemas/badBothPropertiesAndTypeid.js.map +1 -0
- package/lib/test/schemas/badInvalidSemverInTypeid.js +46 -0
- package/lib/test/schemas/badInvalidSemverInTypeid.js.map +1 -0
- package/lib/test/schemas/badMissingSemverInTypeid.js +46 -0
- package/lib/test/schemas/badMissingSemverInTypeid.js.map +1 -0
- package/lib/test/schemas/badNestedProperties.js +46 -0
- package/lib/test/schemas/badNestedProperties.js.map +1 -0
- package/lib/test/schemas/badPrimitiveTypeid.js +31 -0
- package/lib/test/schemas/badPrimitiveTypeid.js.map +1 -0
- package/lib/test/schemas/badVersionedTypeid.js +47 -0
- package/lib/test/schemas/badVersionedTypeid.js.map +1 -0
- package/lib/test/schemas/goodColorPalette.js +21 -0
- package/lib/test/schemas/goodColorPalette.js.map +1 -0
- package/lib/test/schemas/goodDraftAsVersion.js +18 -0
- package/lib/test/schemas/goodDraftAsVersion.js.map +1 -0
- package/lib/test/schemas/goodPointId.js +46 -0
- package/lib/test/schemas/goodPointId.js.map +1 -0
- package/lib/test/schemas/goodReferenceAndRegular.js +22 -0
- package/lib/test/schemas/goodReferenceAndRegular.js.map +1 -0
- package/lib/test/schemas/goodReservedTypes.js +29 -0
- package/lib/test/schemas/goodReservedTypes.js.map +1 -0
- package/lib/test/schemas/goodUIBorder.js +41 -0
- package/lib/test/schemas/goodUIBorder.js.map +1 -0
- package/lib/test/schemas/index.js +29 -0
- package/lib/test/schemas/index.js.map +1 -0
- package/lib/test/tsconfig.tsbuildinfo +1 -0
- package/lib/test/validator/templateSyntax.spec.js +83 -0
- package/lib/test/validator/templateSyntax.spec.js.map +1 -0
- package/lib/test/validator/templateValidator.spec.js +1022 -0
- package/lib/test/validator/templateValidator.spec.js.map +1 -0
- package/lib/test/validator/typeidHelper.spec.js +142 -0
- package/lib/test/validator/typeidHelper.spec.js.map +1 -0
- package/lib/utils.d.ts +17 -13
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +23 -23
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.d.ts +2 -1
- package/lib/validationResultBuilder.d.ts.map +1 -1
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +37 -16
- package/dist/test/tsconfig.tsbuildinfo +0 -1
|
@@ -3,19 +3,18 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview Iterator to iterate over array ChangeSets
|
|
8
|
-
*/
|
|
9
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
8
|
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
exports.ArrayChangeSetIterator = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @fileoverview Iterator to iterate over array ChangeSets
|
|
13
|
+
*/
|
|
17
14
|
const property_common_1 = require("@fluid-experimental/property-common");
|
|
18
|
-
const
|
|
15
|
+
const isNumber_js_1 = __importDefault(require("lodash/isNumber.js"));
|
|
16
|
+
const isString_js_1 = __importDefault(require("lodash/isString.js"));
|
|
17
|
+
const operationTypes_js_1 = require("./operationTypes.js");
|
|
19
18
|
const { MSG } = property_common_1.constants;
|
|
20
19
|
/**
|
|
21
20
|
* Iterator class which iterates over an array ChangeSet. It will successively return the operations ordered by their
|
|
@@ -54,7 +53,7 @@ class ArrayChangeSetIterator {
|
|
|
54
53
|
this._lastOperationOffset = 0;
|
|
55
54
|
this._atEnd = false;
|
|
56
55
|
this._op = {
|
|
57
|
-
type:
|
|
56
|
+
type: operationTypes_js_1.ArrayIteratorOperationTypes.NOP,
|
|
58
57
|
offset: 0,
|
|
59
58
|
operation: undefined,
|
|
60
59
|
};
|
|
@@ -75,7 +74,7 @@ class ArrayChangeSetIterator {
|
|
|
75
74
|
type = ArrayChangeSetIterator.types.REMOVE;
|
|
76
75
|
currentIndex = this._changeSet.remove[this._currentIndices.remove][0];
|
|
77
76
|
let currentLength = this._changeSet.remove[this._currentIndices.remove][1];
|
|
78
|
-
if (!(0,
|
|
77
|
+
if (!(0, isNumber_js_1.default)(currentLength)) {
|
|
79
78
|
currentLength = currentLength.length;
|
|
80
79
|
}
|
|
81
80
|
// Check, whether this is a removeInsertOperation
|
|
@@ -132,7 +131,7 @@ class ArrayChangeSetIterator {
|
|
|
132
131
|
this._op.operation = this._changeSet.remove[this._currentIndices.remove];
|
|
133
132
|
this._op.offset = this._currentOffset;
|
|
134
133
|
// Update the current offset. For a remove we have to decrement it by the number of the removed elements
|
|
135
|
-
var removedElements = (0,
|
|
134
|
+
var removedElements = (0, isNumber_js_1.default)(this._op.operation[1])
|
|
136
135
|
? this._op.operation[1]
|
|
137
136
|
: this._op.operation[1].length;
|
|
138
137
|
this._lastOperationOffset -= removedElements;
|
|
@@ -159,7 +158,7 @@ class ArrayChangeSetIterator {
|
|
|
159
158
|
// use modify only up to insert's position
|
|
160
159
|
// build a partial modify and cut the remaining one:
|
|
161
160
|
const partialModify = [nextModify[0], undefined];
|
|
162
|
-
if ((0,
|
|
161
|
+
if ((0, isString_js_1.default)(nextModify[1])) {
|
|
163
162
|
partialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);
|
|
164
163
|
nextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);
|
|
165
164
|
}
|
|
@@ -202,5 +201,5 @@ class ArrayChangeSetIterator {
|
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
exports.ArrayChangeSetIterator = ArrayChangeSetIterator;
|
|
205
|
-
ArrayChangeSetIterator.types =
|
|
204
|
+
ArrayChangeSetIterator.types = operationTypes_js_1.ArrayIteratorOperationTypes; // @TODO Not sure if this is still required if we export it separately.
|
|
206
205
|
//# sourceMappingURL=arrayChangesetIterator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayChangesetIterator.js","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEH,+DAAuC;AACvC,+DAAuC;AAEvC,aAAa;AACb,yEAAgE;AAGhE,qDAA+D;AAE/D,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AA0D1B;;;;;GAKG;AACH,MAAa,sBAAsB;IAalC,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAED,IAAW,kBAAkB;QAC5B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACjC,CAAC;IAED,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,YAAY,YAAiC;QAC5C,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;QAC/B,8EAA8E;QAC9E,4CAA4C;QAC5C,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,eAAe,GAAG;YACtB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACT,CAAC;QAEF,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC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,CAAC,EAAE;YAC7C,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC5D;QACD,OAAO,MAAM,CAAC;IACf,CAAC;;AA1NF,wDA2NC;AA1NO,4BAAK,GAAG,4CAA2B,CAAC,CAAC,uEAAuE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Iterator to iterate over array ChangeSets\n */\n\nimport isNumber from \"lodash/isNumber\";\nimport isString from \"lodash/isString\";\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\n\nimport { SerializedChangeSet } from \"../changeset\";\nimport { ArrayIteratorOperationTypes } from \"./operationTypes\";\n\nconst { MSG } = constants;\n\ntype genericArray = (number | string | (SerializedChangeSet & { typeid: string }))[];\nexport type arrayInsertList = [number, string | genericArray];\nexport type arrayModifyList =\n\t| [number, string | genericArray]\n\t| [number, string, string]\n\t| [number, genericArray, genericArray];\nexport type arrayRemoveList = [number, number | string | genericArray];\n\n/**\n * Description of an array operation\n */\nexport interface OperationDescription {\n\t_absoluteBegin?: number;\n\ttype?: ArrayIteratorOperationTypes;\n\toffset?: number;\n}\n\n/**\n * Description of an insert array operation\n */\nexport interface InsertOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.INSERT;\n\tremoveInsertOperation?: arrayInsertList;\n\toperation?: arrayInsertList;\n}\n\n/**\n * Description of a remove array operation\n */\nexport interface RemoveOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.REMOVE;\n\tremoveInsertOperation?: arrayRemoveList;\n\toperation?: arrayRemoveList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface ModifyOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.MODIFY;\n\tremoveInsertOperation?: arrayModifyList;\n\toperation: arrayModifyList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface NOPOperation\n\textends Omit<OperationDescription, \"removeInsertOperation\" | \"operation\"> {\n\ttype: ArrayIteratorOperationTypes.NOP;\n\toperation?: [];\n}\n\nexport type NoneNOPOperation = RemoveOperation | InsertOperation | ModifyOperation;\nexport type GenericOperation = NoneNOPOperation | NOPOperation;\n\n/**\n * Iterator class which iterates over an array ChangeSet. It will successively return the operations ordered by their\n * position within the array. Additionally, it will keep track of the modifications to the array indices caused\n * by the previous operations.\n * @internal\n */\nexport class ArrayChangeSetIterator {\n\tstatic types = ArrayIteratorOperationTypes; // @TODO Not sure if this is still required if we export it separately.\n\n\tprivate readonly _changeSet: SerializedChangeSet;\n\tprivate _copiedModifies: string | any[];\n\tprivate readonly _currentIndices: { insert: number; remove: number; modify: number };\n\tprivate _currentOffset: number;\n\tprivate _lastOperationIndex: number;\n\tprivate _lastOperationOffset: number;\n\n\tprivate _atEnd: boolean;\n\tprivate _op: GenericOperation;\n\n\tpublic get opDescription(): GenericOperation {\n\t\treturn this._op;\n\t}\n\n\tpublic get currentOffset(): number {\n\t\treturn this._currentOffset;\n\t}\n\n\tpublic get lastOperationIndex(): number {\n\t\treturn this._lastOperationIndex;\n\t}\n\n\tpublic get lastOperationOffset(): number {\n\t\treturn this._lastOperationOffset;\n\t}\n\n\t/**\n\t * @param in_changeSet - The ChangeSet to iterate over (this has to be an array ChangeSet\n\t */\n\tconstructor(in_changeSet: SerializedChangeSet) {\n\t\tthis._changeSet = in_changeSet;\n\t\t// if we need to chop overlapping modifies internally, so we have to copy them\n\t\t// we do this lazy and only if really needed\n\t\tthis._copiedModifies = in_changeSet.modify;\n\t\tthis._currentIndices = {\n\t\t\tinsert: 0,\n\t\t\tremove: 0,\n\t\t\tmodify: 0,\n\t\t};\n\n\t\tthis._currentOffset = 0;\n\t\tthis._lastOperationIndex = -1;\n\t\tthis._lastOperationOffset = 0;\n\t\tthis._atEnd = false;\n\n\t\tthis._op = {\n\t\t\ttype: ArrayIteratorOperationTypes.NOP,\n\t\t\toffset: 0,\n\t\t\toperation: undefined,\n\t\t};\n\n\t\t// go to the first element\n\t\tthis.next();\n\t}\n\n\t/**\n\t * Returns the next operation in the ChangeSet\n\t * @returns true, if there are operations left\n\t */\n\tnext(): boolean {\n\t\t// Find the smallest index in the operations lists\n\t\tlet currentIndex = Infinity;\n\t\tlet type: ArrayIteratorOperationTypes;\n\t\t(this._op as any).removeInsertOperation = undefined;\n\t\t// Process the current remove entry\n\t\tif (this._changeSet.remove && this._currentIndices.remove < this._changeSet.remove.length) {\n\t\t\ttype = ArrayChangeSetIterator.types.REMOVE;\n\t\t\tcurrentIndex = this._changeSet.remove[this._currentIndices.remove][0];\n\t\t\tlet currentLength = this._changeSet.remove[this._currentIndices.remove][1];\n\t\t\tif (!isNumber(currentLength)) {\n\t\t\t\tcurrentLength = currentLength.length;\n\t\t\t}\n\n\t\t\t// Check, whether this is a removeInsertOperation\n\t\t\tif (\n\t\t\t\tthis._changeSet.insert &&\n\t\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] <=\n\t\t\t\t\tcurrentIndex + currentLength\n\t\t\t) {\n\t\t\t\t(this._op as InsertOperation).removeInsertOperation =\n\t\t\t\t\tthis._changeSet.insert[this._currentIndices.insert];\n\t\t\t}\n\t\t}\n\n\t\t// Process the current insert entry (we prefer remove over insert, since this prevents the array from growing more\n\t\t// than necessary)\n\t\tif (\n\t\t\tthis._changeSet.insert &&\n\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] < currentIndex\n\t\t) {\n\t\t\ttype = ArrayChangeSetIterator.types.INSERT;\n\t\t\tcurrentIndex = this._changeSet.insert[this._currentIndices.insert][0];\n\t\t}\n\n\t\t// Process the current modify entry\n\t\tif (\n\t\t\tthis._copiedModifies &&\n\t\t\tthis._currentIndices.modify < this._copiedModifies.length &&\n\t\t\tthis._copiedModifies[this._currentIndices.modify][0] < currentIndex\n\t\t) {\n\t\t\ttype = ArrayChangeSetIterator.types.MODIFY;\n\t\t}\n\n\t\tif (this._lastOperationIndex !== currentIndex) {\n\t\t\tthis._currentOffset += this._lastOperationOffset;\n\t\t\tthis._lastOperationIndex = currentIndex;\n\t\t\tthis._lastOperationOffset = 0;\n\t\t}\n\n\t\t// We have found nothing, so we are at the end of the ChangeSet\n\t\tif (type === undefined) {\n\t\t\tthis._op.type = ArrayChangeSetIterator.types.NOP;\n\t\t\tthis._op.offset = this._currentOffset;\n\t\t\tthis._op.operation = undefined;\n\t\t\tthis._atEnd = true;\n\t\t\treturn false;\n\t\t}\n\n\t\t// Determine the return value and update the internal indices and offsets depending on the next operation\n\t\tswitch (type) {\n\t\t\tcase ArrayChangeSetIterator.types.INSERT:\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.INSERT;\n\t\t\t\t// Define the return value\n\t\t\t\tthis._op.operation = this._changeSet.insert[this._currentIndices.insert];\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// Update the current offset. For an insert we have to increase it by the number of the inserted elements\n\t\t\t\tthis._lastOperationOffset += (this._op.operation[1] as any).length;\n\n\t\t\t\t// Shift the internal index\n\t\t\t\tthis._currentIndices.insert++;\n\t\t\t\tbreak;\n\t\t\tcase ArrayChangeSetIterator.types.REMOVE:\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.REMOVE;\n\t\t\t\t// Define the return value\n\t\t\t\tthis._op.operation = this._changeSet.remove[this._currentIndices.remove];\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// Update the current offset. For a remove we have to decrement it by the number of the removed elements\n\t\t\t\tvar removedElements = isNumber(this._op.operation[1])\n\t\t\t\t\t? this._op.operation[1]\n\t\t\t\t\t: this._op.operation[1].length;\n\t\t\t\tthis._lastOperationOffset -= removedElements;\n\n\t\t\t\t// Shift the internal index\n\t\t\t\tthis._currentIndices.remove++;\n\t\t\t\tbreak;\n\t\t\tcase ArrayChangeSetIterator.types.MODIFY: {\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.MODIFY;\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// check, if the modify's range overlaps with coming insert changes:\n\t\t\t\tlet nextModify = this._copiedModifies[this._currentIndices.modify];\n\t\t\t\tconst modifyEnd = nextModify[0] + nextModify[1].length;\n\t\t\t\tif (\n\t\t\t\t\tthis._changeSet.insert &&\n\t\t\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] < modifyEnd\n\t\t\t\t) {\n\t\t\t\t\t// we have an overlap and need to cut the modify\n\t\t\t\t\tconst insertPosition = this._changeSet.insert[this._currentIndices.insert][0];\n\n\t\t\t\t\t// if we haven't copied the change set's modifies yet, we need to do that now\n\t\t\t\t\tif (this._copiedModifies === this._changeSet.modify) {\n\t\t\t\t\t\tthis._copiedModifies = this._copyModifies(this._changeSet.modify);\n\t\t\t\t\t\t// now we need to update nextModify!\n\t\t\t\t\t\tnextModify = this._copiedModifies[this._currentIndices.modify];\n\t\t\t\t\t}\n\n\t\t\t\t\t// use modify only up to insert's position\n\n\t\t\t\t\t// build a partial modify and cut the remaining one:\n\t\t\t\t\tconst partialModify: arrayModifyList = [nextModify[0], undefined];\n\t\t\t\t\tif (isString(nextModify[1])) {\n\t\t\t\t\t\tpartialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);\n\t\t\t\t\t\tnextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpartialModify[1] = nextModify[1].splice(0, insertPosition - nextModify[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\tnextModify[0] = insertPosition;\n\n\t\t\t\t\t// use the whole modify\n\t\t\t\t\tthis._op.operation = partialModify;\n\t\t\t\t} else {\n\t\t\t\t\t// use the whole modify\n\t\t\t\t\tthis._op.operation = nextModify;\n\n\t\t\t\t\t// Shift the internal index\n\t\t\t\t\tthis._currentIndices.modify++;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`ArrayChangeSetIterator: ${MSG.UNKNOWN_OPERATION}`);\n\t\t}\n\t\tthis._atEnd = false;\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns true, if there are no more operations left\n\t */\n\tatEnd(): boolean {\n\t\treturn this._atEnd;\n\t}\n\n\tprivate _copyModifies(in_modifies: string[]) {\n\t\tif (!in_modifies || in_modifies.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst result = [];\n\t\tfor (let i = 0; i < in_modifies.length; i++) {\n\t\t\tresult.push([in_modifies[i][0], in_modifies[i][1].slice()]);\n\t\t}\n\t\treturn result;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"arrayChangesetIterator.js","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH;;GAEG;AAEH,yEAAgE;AAChE,qEAA0C;AAC1C,qEAA0C;AAM1C,2DAAkE;AAElE,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AA0D1B;;;;;GAKG;AACH,MAAa,sBAAsB;IAalC,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAED,IAAW,kBAAkB;QAC5B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACjC,CAAC;IAED,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACl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BACvB,IAAI,CAAC,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC;oBAEhC,2BAA2B;oBAC3B,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;iBAC9B;gBACD,MAAM;aACN;YACD;gBACC,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;SACrE;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,KAAK;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAEO,aAAa,CAAC,WAAqB;QAC1C,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC7C,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC5D;QACD,OAAO,MAAM,CAAC;IACf,CAAC;;AA1NF,wDA2NC;AA1NO,4BAAK,GAAG,+CAA2B,CAAC,CAAC,uEAAuE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Iterator to iterate over array ChangeSets\n */\n\nimport { constants } from \"@fluid-experimental/property-common\";\nimport isNumber from \"lodash/isNumber.js\";\nimport isString from \"lodash/isString.js\";\n\n// @ts-ignore\n\nimport { SerializedChangeSet } from \"../changeset.js\";\n\nimport { ArrayIteratorOperationTypes } from \"./operationTypes.js\";\n\nconst { MSG } = constants;\n\ntype genericArray = (number | string | (SerializedChangeSet & { typeid: string }))[];\nexport type arrayInsertList = [number, string | genericArray];\nexport type arrayModifyList =\n\t| [number, string | genericArray]\n\t| [number, string, string]\n\t| [number, genericArray, genericArray];\nexport type arrayRemoveList = [number, number | string | genericArray];\n\n/**\n * Description of an array operation\n */\nexport interface OperationDescription {\n\t_absoluteBegin?: number;\n\ttype?: ArrayIteratorOperationTypes;\n\toffset?: number;\n}\n\n/**\n * Description of an insert array operation\n */\nexport interface InsertOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.INSERT;\n\tremoveInsertOperation?: arrayInsertList;\n\toperation?: arrayInsertList;\n}\n\n/**\n * Description of a remove array operation\n */\nexport interface RemoveOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.REMOVE;\n\tremoveInsertOperation?: arrayRemoveList;\n\toperation?: arrayRemoveList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface ModifyOperation extends OperationDescription {\n\ttype: ArrayIteratorOperationTypes.MODIFY;\n\tremoveInsertOperation?: arrayModifyList;\n\toperation: arrayModifyList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface NOPOperation\n\textends Omit<OperationDescription, \"removeInsertOperation\" | \"operation\"> {\n\ttype: ArrayIteratorOperationTypes.NOP;\n\toperation?: [];\n}\n\nexport type NoneNOPOperation = RemoveOperation | InsertOperation | ModifyOperation;\nexport type GenericOperation = NoneNOPOperation | NOPOperation;\n\n/**\n * Iterator class which iterates over an array ChangeSet. It will successively return the operations ordered by their\n * position within the array. Additionally, it will keep track of the modifications to the array indices caused\n * by the previous operations.\n * @internal\n */\nexport class ArrayChangeSetIterator {\n\tstatic types = ArrayIteratorOperationTypes; // @TODO Not sure if this is still required if we export it separately.\n\n\tprivate readonly _changeSet: SerializedChangeSet;\n\tprivate _copiedModifies: string | any[];\n\tprivate readonly _currentIndices: { insert: number; remove: number; modify: number };\n\tprivate _currentOffset: number;\n\tprivate _lastOperationIndex: number;\n\tprivate _lastOperationOffset: number;\n\n\tprivate _atEnd: boolean;\n\tprivate _op: GenericOperation;\n\n\tpublic get opDescription(): GenericOperation {\n\t\treturn this._op;\n\t}\n\n\tpublic get currentOffset(): number {\n\t\treturn this._currentOffset;\n\t}\n\n\tpublic get lastOperationIndex(): number {\n\t\treturn this._lastOperationIndex;\n\t}\n\n\tpublic get lastOperationOffset(): number {\n\t\treturn this._lastOperationOffset;\n\t}\n\n\t/**\n\t * @param in_changeSet - The ChangeSet to iterate over (this has to be an array ChangeSet\n\t */\n\tconstructor(in_changeSet: SerializedChangeSet) {\n\t\tthis._changeSet = in_changeSet;\n\t\t// if we need to chop overlapping modifies internally, so we have to copy them\n\t\t// we do this lazy and only if really needed\n\t\tthis._copiedModifies = in_changeSet.modify;\n\t\tthis._currentIndices = {\n\t\t\tinsert: 0,\n\t\t\tremove: 0,\n\t\t\tmodify: 0,\n\t\t};\n\n\t\tthis._currentOffset = 0;\n\t\tthis._lastOperationIndex = -1;\n\t\tthis._lastOperationOffset = 0;\n\t\tthis._atEnd = false;\n\n\t\tthis._op = {\n\t\t\ttype: ArrayIteratorOperationTypes.NOP,\n\t\t\toffset: 0,\n\t\t\toperation: undefined,\n\t\t};\n\n\t\t// go to the first element\n\t\tthis.next();\n\t}\n\n\t/**\n\t * Returns the next operation in the ChangeSet\n\t * @returns true, if there are operations left\n\t */\n\tnext(): boolean {\n\t\t// Find the smallest index in the operations lists\n\t\tlet currentIndex = Infinity;\n\t\tlet type: ArrayIteratorOperationTypes;\n\t\t(this._op as any).removeInsertOperation = undefined;\n\t\t// Process the current remove entry\n\t\tif (this._changeSet.remove && this._currentIndices.remove < this._changeSet.remove.length) {\n\t\t\ttype = ArrayChangeSetIterator.types.REMOVE;\n\t\t\tcurrentIndex = this._changeSet.remove[this._currentIndices.remove][0];\n\t\t\tlet currentLength = this._changeSet.remove[this._currentIndices.remove][1];\n\t\t\tif (!isNumber(currentLength)) {\n\t\t\t\tcurrentLength = currentLength.length;\n\t\t\t}\n\n\t\t\t// Check, whether this is a removeInsertOperation\n\t\t\tif (\n\t\t\t\tthis._changeSet.insert &&\n\t\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] <=\n\t\t\t\t\tcurrentIndex + currentLength\n\t\t\t) {\n\t\t\t\t(this._op as InsertOperation).removeInsertOperation =\n\t\t\t\t\tthis._changeSet.insert[this._currentIndices.insert];\n\t\t\t}\n\t\t}\n\n\t\t// Process the current insert entry (we prefer remove over insert, since this prevents the array from growing more\n\t\t// than necessary)\n\t\tif (\n\t\t\tthis._changeSet.insert &&\n\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] < currentIndex\n\t\t) {\n\t\t\ttype = ArrayChangeSetIterator.types.INSERT;\n\t\t\tcurrentIndex = this._changeSet.insert[this._currentIndices.insert][0];\n\t\t}\n\n\t\t// Process the current modify entry\n\t\tif (\n\t\t\tthis._copiedModifies &&\n\t\t\tthis._currentIndices.modify < this._copiedModifies.length &&\n\t\t\tthis._copiedModifies[this._currentIndices.modify][0] < currentIndex\n\t\t) {\n\t\t\ttype = ArrayChangeSetIterator.types.MODIFY;\n\t\t}\n\n\t\tif (this._lastOperationIndex !== currentIndex) {\n\t\t\tthis._currentOffset += this._lastOperationOffset;\n\t\t\tthis._lastOperationIndex = currentIndex;\n\t\t\tthis._lastOperationOffset = 0;\n\t\t}\n\n\t\t// We have found nothing, so we are at the end of the ChangeSet\n\t\tif (type === undefined) {\n\t\t\tthis._op.type = ArrayChangeSetIterator.types.NOP;\n\t\t\tthis._op.offset = this._currentOffset;\n\t\t\tthis._op.operation = undefined;\n\t\t\tthis._atEnd = true;\n\t\t\treturn false;\n\t\t}\n\n\t\t// Determine the return value and update the internal indices and offsets depending on the next operation\n\t\tswitch (type) {\n\t\t\tcase ArrayChangeSetIterator.types.INSERT:\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.INSERT;\n\t\t\t\t// Define the return value\n\t\t\t\tthis._op.operation = this._changeSet.insert[this._currentIndices.insert];\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// Update the current offset. For an insert we have to increase it by the number of the inserted elements\n\t\t\t\tthis._lastOperationOffset += (this._op.operation[1] as any).length;\n\n\t\t\t\t// Shift the internal index\n\t\t\t\tthis._currentIndices.insert++;\n\t\t\t\tbreak;\n\t\t\tcase ArrayChangeSetIterator.types.REMOVE:\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.REMOVE;\n\t\t\t\t// Define the return value\n\t\t\t\tthis._op.operation = this._changeSet.remove[this._currentIndices.remove];\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// Update the current offset. For a remove we have to decrement it by the number of the removed elements\n\t\t\t\tvar removedElements = isNumber(this._op.operation[1])\n\t\t\t\t\t? this._op.operation[1]\n\t\t\t\t\t: this._op.operation[1].length;\n\t\t\t\tthis._lastOperationOffset -= removedElements;\n\n\t\t\t\t// Shift the internal index\n\t\t\t\tthis._currentIndices.remove++;\n\t\t\t\tbreak;\n\t\t\tcase ArrayChangeSetIterator.types.MODIFY: {\n\t\t\t\tthis._op.type = ArrayChangeSetIterator.types.MODIFY;\n\t\t\t\tthis._op.offset = this._currentOffset;\n\t\t\t\t// check, if the modify's range overlaps with coming insert changes:\n\t\t\t\tlet nextModify = this._copiedModifies[this._currentIndices.modify];\n\t\t\t\tconst modifyEnd = nextModify[0] + nextModify[1].length;\n\t\t\t\tif (\n\t\t\t\t\tthis._changeSet.insert &&\n\t\t\t\t\tthis._currentIndices.insert < this._changeSet.insert.length &&\n\t\t\t\t\tthis._changeSet.insert[this._currentIndices.insert][0] < modifyEnd\n\t\t\t\t) {\n\t\t\t\t\t// we have an overlap and need to cut the modify\n\t\t\t\t\tconst insertPosition = this._changeSet.insert[this._currentIndices.insert][0];\n\n\t\t\t\t\t// if we haven't copied the change set's modifies yet, we need to do that now\n\t\t\t\t\tif (this._copiedModifies === this._changeSet.modify) {\n\t\t\t\t\t\tthis._copiedModifies = this._copyModifies(this._changeSet.modify);\n\t\t\t\t\t\t// now we need to update nextModify!\n\t\t\t\t\t\tnextModify = this._copiedModifies[this._currentIndices.modify];\n\t\t\t\t\t}\n\n\t\t\t\t\t// use modify only up to insert's position\n\n\t\t\t\t\t// build a partial modify and cut the remaining one:\n\t\t\t\t\tconst partialModify: arrayModifyList = [nextModify[0], undefined];\n\t\t\t\t\tif (isString(nextModify[1])) {\n\t\t\t\t\t\tpartialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);\n\t\t\t\t\t\tnextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpartialModify[1] = nextModify[1].splice(0, insertPosition - nextModify[0]);\n\t\t\t\t\t}\n\n\t\t\t\t\tnextModify[0] = insertPosition;\n\n\t\t\t\t\t// use the whole modify\n\t\t\t\t\tthis._op.operation = partialModify;\n\t\t\t\t} else {\n\t\t\t\t\t// use the whole modify\n\t\t\t\t\tthis._op.operation = nextModify;\n\n\t\t\t\t\t// Shift the internal index\n\t\t\t\t\tthis._currentIndices.modify++;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`ArrayChangeSetIterator: ${MSG.UNKNOWN_OPERATION}`);\n\t\t}\n\t\tthis._atEnd = false;\n\t\treturn true;\n\t}\n\n\t/**\n\t * @returns true, if there are no more operations left\n\t */\n\tatEnd(): boolean {\n\t\treturn this._atEnd;\n\t}\n\n\tprivate _copyModifies(in_modifies: string[]) {\n\t\tif (!in_modifies || in_modifies.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst result = [];\n\t\tfor (let i = 0; i < in_modifies.length; i++) {\n\t\t\tresult.push([in_modifies[i][0], in_modifies[i][1].slice()]);\n\t\t}\n\t\treturn result;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesetConflictTypes.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/changesetConflictTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"changesetConflictTypes.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/changesetConflictTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,oBAAY,YAAY;IACvB,oGAAoG;IACpG,sBAAsB,IAAI;IAC1B,6CAA6C;IAC7C,aAAa,IAAA;IACb,wCAAwC;IACxC,2BAA2B,IAAA;IAC3B;;;;OAIG;IACH,sCAAsC,IAAA;IACtC,kEAAkE;IAClE,4BAA4B,IAAA;IAC5B,+GAA+G;IAC/G,mBAAmB,IAAA;IAEnB,kBAAkB,IAAA;IAElB,uBAAuB,IAAA;CACvB"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ConflictType = void 0;
|
|
6
8
|
/**
|
|
7
9
|
* @fileoverview Conflict types that can occur during changeset operations
|
|
8
10
|
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ConflictType = void 0;
|
|
11
11
|
var ConflictType;
|
|
12
12
|
(function (ConflictType) {
|
|
13
13
|
/** We had two incompatible ChangeSets, they probably were with respect to different base commits */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesetConflictTypes.js","sourceRoot":"","sources":["../../src/changeset_operations/changesetConflictTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"changesetConflictTypes.js","sourceRoot":"","sources":["../../src/changeset_operations/changesetConflictTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AAEH,IAAY,YAqBX;AArBD,WAAY,YAAY;IACvB,oGAAoG;IACpG,mFAA0B,CAAA;IAC1B,6CAA6C;IAC7C,iEAAa,CAAA;IACb,wCAAwC;IACxC,6FAA2B,CAAA;IAC3B;;;;OAIG;IACH,mHAAsC,CAAA;IACtC,kEAAkE;IAClE,+FAA4B,CAAA;IAC5B,+GAA+G;IAC/G,6EAAmB,CAAA;IACnB,oDAAoD;IACpD,2EAAkB,CAAA;IAClB,+CAA+C;IAC/C,qFAAuB,CAAA;AACxB,CAAC,EArBW,YAAY,4BAAZ,YAAY,QAqBvB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Conflict types that can occur during changeset operations\n */\n\nexport enum ConflictType {\n\t/** We had two incompatible ChangeSets, they probably were with respect to different base commits */\n\tINVALID_CHANGESET_BASE = 1,\n\t/** A value was changed in both ChangeSets */\n\tCOLLIDING_SET,\n\t/** A deleted child node was modified */\n\tENTRY_MODIFIED_AFTER_REMOVE,\n\t/** A child was modified after it had been removed and added.\n\t *\n\t * The modification can no longer be applied, since the affected object has changed and thus\n\t * the ChangeSet is no longer compatible.\n\t */\n\tENTRY_MODIFICATION_AFTER_REMOVE_INSERT,\n\t/** An entry with the same key was inserted into the collection */\n\tINSERTED_ENTRY_WITH_SAME_KEY,\n\t/** A property was removed after a modify, this should mostly be safe, be we report it for completeness sake */\n\tREMOVE_AFTER_MODIFY,\n\t// Templates do not match from one commit to another\n\tMISMATCH_TEMPLATES,\n\t// Tried to insert inside a removed array range\n\tINSERT_IN_REMOVED_RANGE,\n}\n"]}
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
* @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)
|
|
7
|
-
*/
|
|
8
|
-
import { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from "../changeset";
|
|
5
|
+
import { ApplyChangeSetOptions, ConflictInfo, SerializedChangeSet } from "../changeset.js";
|
|
9
6
|
export declare namespace ChangeSetIndexedCollectionFunctions {
|
|
10
7
|
/**
|
|
11
8
|
* Applies a ChangeSet to a given indexed collection property (recursively). The ChangeSet is assumed to be relative
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedCollection.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"indexedCollection.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/indexedCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAuC3F,yBAAiB,mCAAmC,CAAC;IACpD;;;;;;;;;;;;;OAaG;IACI,MAAM,6CAA6C,2BACjC,mBAAmB,6BAChB,mBAAmB,aACnC,MAAM,cACL,qBAAqB,SAoXjC,CAAC;IAEF;;;;;;;;;;;;;;;OAeG;IACI,MAAM,4CAA4C,4BAC/B,mBAAmB,8BAChB,mBAAmB,eAClC,MAAM,aACR,MAAM,8BACW,OAAO,iBACpB,YAAY,EAAE,cACjB,qBAAqB,SAmYjC,CAAC;IAEF;;;;;;OAMG;IACI,MAAM,gCAAgC,uBACxB,mBAAmB,sBACnB,OAAO,SAyD3B,CAAC;CACF"}
|
|
@@ -3,26 +3,25 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)
|
|
8
|
-
*/
|
|
9
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
8
|
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
exports.ChangeSetIndexedCollectionFunctions = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const isObject_1 = __importDefault(require("lodash/isObject"));
|
|
18
|
-
const without_1 = __importDefault(require("lodash/without"));
|
|
19
|
-
const includes_1 = __importDefault(require("lodash/includes"));
|
|
20
|
-
// @ts-ignore
|
|
11
|
+
/**
|
|
12
|
+
* @fileoverview Helper functions and classes to work with ChangeSets with indexed collections (sets and maps)
|
|
13
|
+
*/
|
|
21
14
|
const property_common_1 = require("@fluid-experimental/property-common");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
15
|
+
const fastest_json_copy_1 = require("fastest-json-copy");
|
|
16
|
+
const includes_js_1 = __importDefault(require("lodash/includes.js"));
|
|
17
|
+
const isEmpty_js_1 = __importDefault(require("lodash/isEmpty.js"));
|
|
18
|
+
const isEqual_js_1 = __importDefault(require("lodash/isEqual.js"));
|
|
19
|
+
const isObject_js_1 = __importDefault(require("lodash/isObject.js"));
|
|
20
|
+
const without_js_1 = __importDefault(require("lodash/without.js"));
|
|
21
|
+
const typeidHelper_js_1 = require("../helpers/typeidHelper.js");
|
|
22
|
+
const pathHelper_js_1 = require("../pathHelper.js");
|
|
23
|
+
const changesetConflictTypes_js_1 = require("./changesetConflictTypes.js");
|
|
24
|
+
const isEmptyChangeset_js_1 = require("./isEmptyChangeset.js");
|
|
26
25
|
const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
|
|
27
26
|
/**
|
|
28
27
|
* @namespace property-changeset.ChangeSetOperations.IndexedCollectionOperations
|
|
@@ -40,8 +39,8 @@ const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
|
|
|
40
39
|
* @private
|
|
41
40
|
*/
|
|
42
41
|
const _fastIsEmptyObject = function (in_object) {
|
|
43
|
-
if (!in_object || Array.isArray(in_object) || !(0,
|
|
44
|
-
return (0,
|
|
42
|
+
if (!in_object || Array.isArray(in_object) || !(0, isObject_js_1.default)(in_object)) {
|
|
43
|
+
return (0, isEmpty_js_1.default)(in_object);
|
|
45
44
|
}
|
|
46
45
|
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
47
46
|
for (const _entry in in_object) {
|
|
@@ -67,7 +66,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
67
66
|
* @private
|
|
68
67
|
*/
|
|
69
68
|
ChangeSetIndexedCollectionFunctions._performApplyAfterOnPropertyIndexedCollection = function (io_basePropertyChanges, in_appliedPropertyChanges, in_typeid, in_options) {
|
|
70
|
-
const isPrimitiveTypeid =
|
|
69
|
+
const isPrimitiveTypeid = typeidHelper_js_1.TypeIdHelper.isPrimitiveType(in_typeid);
|
|
71
70
|
// Handle remove entry operations
|
|
72
71
|
if (in_appliedPropertyChanges.remove) {
|
|
73
72
|
// Get and initialize the corresponding entries in the existing collection
|
|
@@ -95,7 +94,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
95
94
|
delete baseInserted[removedTypes[t]][removedKeys[i]];
|
|
96
95
|
// If all entries for a typeid have been removed, we can remove
|
|
97
96
|
// the whole typeid from the inserted section
|
|
98
|
-
if (baseInserted && (0,
|
|
97
|
+
if (baseInserted && (0, isEmpty_js_1.default)(baseInserted[removedTypes[t]])) {
|
|
99
98
|
delete baseInserted[removedTypes[t]];
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -106,7 +105,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
106
105
|
delete baseModified[removedTypes[t]][removedKeys[i]];
|
|
107
106
|
// If all entries for a typeid have been removed, we can remove
|
|
108
107
|
// the whole typeid from the inserted section
|
|
109
|
-
if (baseModified && (0,
|
|
108
|
+
if (baseModified && (0, isEmpty_js_1.default)(baseModified[removedTypes[t]])) {
|
|
110
109
|
delete baseModified[removedTypes[t]];
|
|
111
110
|
}
|
|
112
111
|
}
|
|
@@ -168,10 +167,10 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
168
167
|
delete baseInserted[foundInTypeid][key];
|
|
169
168
|
// If all entries for a typeid have been removed, we can remove
|
|
170
169
|
// the whole typeid from the inserted or modified section
|
|
171
|
-
if (baseInserted && (0,
|
|
170
|
+
if (baseInserted && (0, isEmpty_js_1.default)(baseInserted[foundInTypeid])) {
|
|
172
171
|
delete baseInserted[foundInTypeid];
|
|
173
172
|
}
|
|
174
|
-
if (baseModified && (0,
|
|
173
|
+
if (baseModified && (0, isEmpty_js_1.default)(baseModified[foundInTypeid])) {
|
|
175
174
|
delete baseModified[foundInTypeid];
|
|
176
175
|
}
|
|
177
176
|
}
|
|
@@ -224,39 +223,39 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
224
223
|
// the insert is reinserting exactly what was removed.
|
|
225
224
|
if (!isPrimitiveTypeid &&
|
|
226
225
|
removalCS &&
|
|
227
|
-
(0,
|
|
226
|
+
(0, isObject_js_1.default)(removalCS) &&
|
|
228
227
|
removalCS[key] !== undefined) {
|
|
229
228
|
// Split out the two parts: all the keys other than remove/insert should match exactly.
|
|
230
229
|
// The contents 'remove' and 'insert', if they exist, should also match.
|
|
231
230
|
deeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;
|
|
232
231
|
// If there are 'insert' and 'remove', see if the removed data matches the inserted data
|
|
233
232
|
if (deeplyEqualCS && insertedEntries[key].insert) {
|
|
234
|
-
deeplyEqualCS = (0,
|
|
233
|
+
deeplyEqualCS = (0, isEqual_js_1.default)(insertedEntries[key].insert, removalCS[key].remove);
|
|
235
234
|
}
|
|
236
235
|
// Finally, check if the data being inserted matches the data that was removed
|
|
237
|
-
const insertedEntry = (0,
|
|
238
|
-
? (0,
|
|
236
|
+
const insertedEntry = (0, isObject_js_1.default)(insertedEntries[key])
|
|
237
|
+
? (0, without_js_1.default)(insertedEntries[key], "insert")
|
|
239
238
|
: insertedEntries[key];
|
|
240
|
-
const removedEntry = (0,
|
|
241
|
-
? (0,
|
|
239
|
+
const removedEntry = (0, isObject_js_1.default)(removalCS[key])
|
|
240
|
+
? (0, without_js_1.default)(removalCS[key], "remove")
|
|
242
241
|
: removalCS[key];
|
|
243
|
-
deeplyEqualCS = deeplyEqualCS && (0,
|
|
242
|
+
deeplyEqualCS = deeplyEqualCS && (0, isEqual_js_1.default)(insertedEntry, removedEntry);
|
|
244
243
|
}
|
|
245
244
|
if ((isPrimitiveTypeid ||
|
|
246
|
-
|
|
245
|
+
typeidHelper_js_1.TypeIdHelper.isPrimitiveType(typeid) ||
|
|
247
246
|
deeplyEqualCS) &&
|
|
248
247
|
removalCS &&
|
|
249
|
-
((Array.isArray(removalCS) && (0,
|
|
248
|
+
((Array.isArray(removalCS) && (0, includes_js_1.default)(baseRemoved, key)) ||
|
|
250
249
|
removalCS[key] !== undefined)) {
|
|
251
250
|
// A remove and insert are combined into a modify for primitive types
|
|
252
251
|
// Remove the old remove command
|
|
253
252
|
let oldValueMatches = false;
|
|
254
253
|
if (Array.isArray(removalCS)) {
|
|
255
254
|
if (isPrimitiveTypeid) {
|
|
256
|
-
io_basePropertyChanges.remove = (0,
|
|
255
|
+
io_basePropertyChanges.remove = (0, without_js_1.default)(io_basePropertyChanges.remove, key);
|
|
257
256
|
}
|
|
258
257
|
else {
|
|
259
|
-
io_basePropertyChanges.remove[typeid] = (0,
|
|
258
|
+
io_basePropertyChanges.remove[typeid] = (0, without_js_1.default)(io_basePropertyChanges.remove[typeid], key);
|
|
260
259
|
}
|
|
261
260
|
}
|
|
262
261
|
else {
|
|
@@ -329,7 +328,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
329
328
|
else {
|
|
330
329
|
// If this is a polymorphic collection, we can still have individual entries with
|
|
331
330
|
// primitive types
|
|
332
|
-
const isEntryPrimitiveType =
|
|
331
|
+
const isEntryPrimitiveType = typeidHelper_js_1.TypeIdHelper.isPrimitiveType(typeid);
|
|
333
332
|
if (baseInserted[typeid] && baseInserted[typeid][key] !== undefined) {
|
|
334
333
|
// If this entry was added by this ChangeSet, we modify the insert operation according to the
|
|
335
334
|
// new ChangeSet
|
|
@@ -404,7 +403,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
404
403
|
* @private
|
|
405
404
|
*/
|
|
406
405
|
ChangeSetIndexedCollectionFunctions._rebaseIndexedCollectionChangeSetForProperty = function (in_ownPropertyChangeSet, io_rebasePropertyChangeSet, in_basePath, in_typeid, in_useSquareBracketsInPath, out_conflicts, in_options) {
|
|
407
|
-
const isPrimitiveTypeid =
|
|
406
|
+
const isPrimitiveTypeid = typeidHelper_js_1.TypeIdHelper.isPrimitiveType(in_typeid);
|
|
408
407
|
const changesByKeys = {};
|
|
409
408
|
let modifyMap = {};
|
|
410
409
|
// Helper function which stores the changes indexed by key in the changesByKeys array to
|
|
@@ -489,8 +488,8 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
489
488
|
for (let i = 0; i < changedKeys.length; i++) {
|
|
490
489
|
const key = changedKeys[i];
|
|
491
490
|
const newPath = in_useSquareBracketsInPath
|
|
492
|
-
? `${in_basePath}[${
|
|
493
|
-
: (0, property_common_1.joinPaths)(in_basePath,
|
|
491
|
+
? `${in_basePath}[${pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded(key)}]`
|
|
492
|
+
: (0, property_common_1.joinPaths)(in_basePath, pathHelper_js_1.PathHelper.quotePathSegmentIfNeeded(key), PROPERTY_PATH_DELIMITER);
|
|
494
493
|
const modification = changesByKeys[key];
|
|
495
494
|
if (modification.own && modification.other) {
|
|
496
495
|
/*
|
|
@@ -528,7 +527,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
528
527
|
// A key was modified after it had been removed
|
|
529
528
|
if (modification.own === "modify" && modification.other === "modify") {
|
|
530
529
|
if (isPrimitiveTypeid ||
|
|
531
|
-
(
|
|
530
|
+
(typeidHelper_js_1.TypeIdHelper.isPrimitiveType(modification.ownTypeid) &&
|
|
532
531
|
modification.ownTypeid !== "String")) {
|
|
533
532
|
// We have two modification operations that affect the same entry for a base type.
|
|
534
533
|
// This is a legal operation, the second one will overwrite the first one, but we
|
|
@@ -541,7 +540,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
541
540
|
}
|
|
542
541
|
let conflict = {
|
|
543
542
|
path: newPath,
|
|
544
|
-
type:
|
|
543
|
+
type: changesetConflictTypes_js_1.ConflictType.COLLIDING_SET,
|
|
545
544
|
conflictingChange: ownModify[key],
|
|
546
545
|
};
|
|
547
546
|
out_conflicts.push(conflict);
|
|
@@ -580,7 +579,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
580
579
|
// Create the conflict information
|
|
581
580
|
let conflict = {
|
|
582
581
|
path: newPath,
|
|
583
|
-
type:
|
|
582
|
+
type: changesetConflictTypes_js_1.ConflictType.ENTRY_MODIFIED_AFTER_REMOVE,
|
|
584
583
|
conflictingChange: modifyMap[key],
|
|
585
584
|
};
|
|
586
585
|
out_conflicts.push(conflict);
|
|
@@ -597,7 +596,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
597
596
|
// Create the conflict information
|
|
598
597
|
let conflict = {
|
|
599
598
|
path: newPath,
|
|
600
|
-
type:
|
|
599
|
+
type: changesetConflictTypes_js_1.ConflictType.ENTRY_MODIFICATION_AFTER_REMOVE_INSERT,
|
|
601
600
|
conflictingChange: io_rebasePropertyChangeSet.modify[modification.otherTypeid][key],
|
|
602
601
|
};
|
|
603
602
|
out_conflicts.push(conflict);
|
|
@@ -614,7 +613,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
614
613
|
// Create the conflict information
|
|
615
614
|
let conflict = {
|
|
616
615
|
path: newPath,
|
|
617
|
-
type:
|
|
616
|
+
type: changesetConflictTypes_js_1.ConflictType.REMOVE_AFTER_MODIFY,
|
|
618
617
|
conflictingChange: modifyMap[key],
|
|
619
618
|
};
|
|
620
619
|
out_conflicts.push(conflict);
|
|
@@ -622,7 +621,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
622
621
|
// If we have a duplicated delete, we remove it from the new ChangeSet
|
|
623
622
|
if (modification.own === "remove") {
|
|
624
623
|
if (Array.isArray(io_rebasePropertyChangeSet.remove)) {
|
|
625
|
-
io_rebasePropertyChangeSet.remove = (0,
|
|
624
|
+
io_rebasePropertyChangeSet.remove = (0, without_js_1.default)(io_rebasePropertyChangeSet.remove, key);
|
|
626
625
|
}
|
|
627
626
|
else {
|
|
628
627
|
if (isPrimitiveTypeid) {
|
|
@@ -635,7 +634,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
635
634
|
}
|
|
636
635
|
}
|
|
637
636
|
else if (modification.own === "insert" && modification.other === "insert") {
|
|
638
|
-
if (isPrimitiveTypeid ||
|
|
637
|
+
if (isPrimitiveTypeid || typeidHelper_js_1.TypeIdHelper.isPrimitiveType(modification.ownTypeid)) {
|
|
639
638
|
let insertMap = modification.otherTypeid
|
|
640
639
|
? io_rebasePropertyChangeSet.insert[modification.otherTypeid]
|
|
641
640
|
: io_rebasePropertyChangeSet.insert;
|
|
@@ -644,7 +643,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
644
643
|
// report it as a possible conflicting set
|
|
645
644
|
let conflict = {
|
|
646
645
|
path: newPath,
|
|
647
|
-
type:
|
|
646
|
+
type: changesetConflictTypes_js_1.ConflictType.COLLIDING_SET,
|
|
648
647
|
conflictingChange: insertMap[key],
|
|
649
648
|
};
|
|
650
649
|
out_conflicts.push(conflict);
|
|
@@ -676,7 +675,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
676
675
|
// Create the conflict information
|
|
677
676
|
let conflict = {
|
|
678
677
|
path: newPath,
|
|
679
|
-
type:
|
|
678
|
+
type: changesetConflictTypes_js_1.ConflictType.INSERTED_ENTRY_WITH_SAME_KEY,
|
|
680
679
|
conflictingChange: insertMap[key],
|
|
681
680
|
};
|
|
682
681
|
out_conflicts.push(conflict);
|
|
@@ -692,7 +691,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
692
691
|
// Raise the duplicate inserts as a conflict
|
|
693
692
|
let conflict = {
|
|
694
693
|
path: newPath,
|
|
695
|
-
type:
|
|
694
|
+
type: changesetConflictTypes_js_1.ConflictType.COLLIDING_SET,
|
|
696
695
|
conflictingChange: insertMap[key],
|
|
697
696
|
};
|
|
698
697
|
out_conflicts.push(conflict);
|
|
@@ -703,7 +702,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
703
702
|
// Create the conflict information
|
|
704
703
|
let conflict = {
|
|
705
704
|
path: newPath,
|
|
706
|
-
type:
|
|
705
|
+
type: changesetConflictTypes_js_1.ConflictType.INVALID_CHANGESET_BASE,
|
|
707
706
|
conflictingChange: modification.change,
|
|
708
707
|
};
|
|
709
708
|
out_conflicts.push(conflict);
|
|
@@ -719,7 +718,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
719
718
|
else {
|
|
720
719
|
// Remove remove operations from the ChangeSet
|
|
721
720
|
if (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {
|
|
722
|
-
io_rebasePropertyChangeSet[modification.other] = (0,
|
|
721
|
+
io_rebasePropertyChangeSet[modification.other] = (0, without_js_1.default)(io_rebasePropertyChangeSet[modification.other], key);
|
|
723
722
|
}
|
|
724
723
|
else {
|
|
725
724
|
delete io_rebasePropertyChangeSet[modification.other][key];
|
|
@@ -776,7 +775,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
776
775
|
const modifies = changes.modify[typeidList[j]];
|
|
777
776
|
const modifyKeys = Object.keys(modifies);
|
|
778
777
|
for (let k = 0; k < modifyKeys.length; k++) {
|
|
779
|
-
if ((0,
|
|
778
|
+
if ((0, isEmptyChangeset_js_1.isEmptyChangeSet)(modifies[modifyKeys[k]])) {
|
|
780
779
|
delete modifies[modifyKeys[k]];
|
|
781
780
|
}
|
|
782
781
|
}
|