@fluid-experimental/property-changeset 0.59.2000 → 0.59.3000-67119
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 +50 -50
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +22 -22
- 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 +3 -3
- package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +21 -21
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/changeset_operations/isEmptyChangeset.js +2 -2
- package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pathHelper.js.map +1 -1
- package/dist/rebase.js +6 -6
- package/dist/rebase.js.map +1 -1
- package/dist/templateSchema.d.ts.map +1 -1
- package/dist/templateSchema.js +1 -0
- package/dist/templateSchema.js.map +1 -1
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +32 -32
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +40 -40
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +147 -147
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +2 -2
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1660
- package/dist/test/validator/templateSyntax.spec.js +29 -29
- package/dist/test/validator/templateSyntax.spec.js.map +1 -1
- package/dist/test/validator/templateValidator.spec.js +202 -202
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/test/validator/typeidHelper.spec.js +39 -39
- package/dist/test/validator/typeidHelper.spec.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +41 -41
- package/dist/utils.js.map +1 -1
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/pathHelper.js.map +1 -1
- package/lib/rebase.js.map +1 -1
- package/lib/templateSchema.js +1 -0
- package/lib/templateSchema.js.map +1 -1
- package/lib/templateValidator.js +1 -1
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayChangesetIterator.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAI/D,aAAK,YAAY,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,mBAAmB,GAAG;
|
|
1
|
+
{"version":3,"file":"arrayChangesetIterator.d.ts","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAI/D,aAAK,YAAY,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,mBAAmB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;CAAE,CAAC,CAAC,EAAE,CAAC;AACtF,oBAAY,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC;AAC9D,oBAAY,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC,GAA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CAA+B;IAE3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,eAAe,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsD;IACtF,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,oBAAoB,CAAS;IAErC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,GAAG,CAAmB;IAE9B,IAAW,aAAa,IAAI,gBAAgB,CAE3C;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,kBAAkB,IAAI,MAAM,CAEtC;IAED,IAAW,mBAAmB,IAAI,MAAM,CAEvC;IAED;;OAEG;gBACS,YAAY,EAAE,mBAAmB;IA0B7C;;;OAGG;IACH,IAAI,IAAI,OAAO;IAkIf;;OAEG;IACH,KAAK,IAAI,OAAO;IAIhB,OAAO,CAAC,aAAa;CAUxB"}
|
|
@@ -76,7 +76,7 @@ class ArrayChangeSetIterator {
|
|
|
76
76
|
type = ArrayChangeSetIterator.types.REMOVE;
|
|
77
77
|
currentIndex = this._changeSet.remove[this._currentIndices.remove][0];
|
|
78
78
|
let currentLength = this._changeSet.remove[this._currentIndices.remove][1];
|
|
79
|
-
if (!isNumber_1.default(currentLength)) {
|
|
79
|
+
if (!(0, isNumber_1.default)(currentLength)) {
|
|
80
80
|
currentLength = currentLength.length;
|
|
81
81
|
}
|
|
82
82
|
// Check, whether this is a removeInsertOperation
|
|
@@ -131,7 +131,7 @@ class ArrayChangeSetIterator {
|
|
|
131
131
|
this._op.operation = this._changeSet.remove[this._currentIndices.remove];
|
|
132
132
|
this._op.offset = this._currentOffset;
|
|
133
133
|
// Update the current offset. For a remove we have to decrement it by the number of the removed elements
|
|
134
|
-
var removedElements = isNumber_1.default(this._op.operation[1]) ? this._op.operation[1] : this._op.operation[1].length;
|
|
134
|
+
var removedElements = (0, isNumber_1.default)(this._op.operation[1]) ? this._op.operation[1] : this._op.operation[1].length;
|
|
135
135
|
this._lastOperationOffset -= removedElements;
|
|
136
136
|
// Shift the internal index
|
|
137
137
|
this._currentIndices.remove++;
|
|
@@ -157,7 +157,7 @@ class ArrayChangeSetIterator {
|
|
|
157
157
|
// use modify only up to insert's position
|
|
158
158
|
// build a partial modify and cut the remaining one:
|
|
159
159
|
const partialModify = [nextModify[0], undefined];
|
|
160
|
-
if (isString_1.default(nextModify[1])) {
|
|
160
|
+
if ((0, isString_1.default)(nextModify[1])) {
|
|
161
161
|
partialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);
|
|
162
162
|
nextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);
|
|
163
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayChangesetIterator.js","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,+DAAuC;AACvC,+DAAuC;AAExC,aAAa;AACb,yEAAgE;AAGhE,qDAA+D;AAE/D,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAsD1B;;;;;GAKG;AACH,MAAa,sBAAsB;IA6B/B;;OAEG;IACH,YAAY,YAAiC;QACzC,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;YACnB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACZ,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;QAEpB,IAAI,CAAC,GAAG,GAAG;YACP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,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,aAAa,CAAC,WAAqB;QACvC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,SAAS,CAAC;SACpB;QACD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,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;SAC/D;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;;AAhNL,wDAiNC;AAhNU,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\n import isNumber from \"lodash/isNumber\";\n import 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 = [number, string | genericArray] | [number, string, string] | [number, genericArray, genericArray];\nexport type arrayRemoveList = [number, number | string | genericArray];\n\n/**\n * Description of an array operation\n */\nexport interface OperationDescription {\n _absoluteBegin?: number;\n type?: ArrayIteratorOperationTypes,\n offset?: number,\n}\n\n/**\n * Description of an insert array operation\n */\nexport interface InsertOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.INSERT;\n removeInsertOperation?: arrayInsertList;\n operation?: arrayInsertList;\n}\n\n/**\n * Description of a remove array operation\n */\nexport interface RemoveOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.REMOVE;\n removeInsertOperation?: arrayRemoveList;\n operation?: arrayRemoveList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface ModifyOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.MODIFY;\n removeInsertOperation?: arrayModifyList;\n operation: arrayModifyList;\n}\n\n/**\n * Description of a modify array operation\n */\n export interface NOPOperation extends Omit<OperationDescription, \"removeInsertOperation\" | \"operation\"> {\n type: ArrayIteratorOperationTypes.NOP;\n operation?: [];\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 *\n */\nexport class ArrayChangeSetIterator {\n static types = ArrayIteratorOperationTypes; // @TODO Not sure if this is still required if we export it separately.\n\n private readonly _changeSet: SerializedChangeSet;\n private _copiedModifies: string | any[];\n private readonly _currentIndices: { insert: number; remove: number; modify: number; };\n private _currentOffset: number;\n private _lastOperationIndex: number;\n private _lastOperationOffset: number;\n\n private _atEnd: boolean;\n private _op: GenericOperation;\n\n public get opDescription(): GenericOperation {\n return this._op;\n }\n\n public get currentOffset(): number {\n return this._currentOffset;\n }\n\n public get lastOperationIndex(): number {\n return this._lastOperationIndex;\n }\n\n public get lastOperationOffset(): number {\n return this._lastOperationOffset;\n }\n\n /**\n * @param in_changeSet - The ChangeSet to iterate over (this has to be an array ChangeSet\n */\n constructor(in_changeSet: SerializedChangeSet) {\n this._changeSet = in_changeSet;\n // if we need to chop overlapping modifies internally, so we have to copy them\n // we do this lazy and only if really needed\n this._copiedModifies = in_changeSet.modify;\n this._currentIndices = {\n insert: 0,\n remove: 0,\n modify: 0,\n };\n\n this._currentOffset = 0;\n this._lastOperationIndex = -1;\n this._lastOperationOffset = 0;\n this._atEnd = false;\n\n this._op = {\n type: ArrayIteratorOperationTypes.NOP,\n offset: 0,\n operation: undefined,\n };\n\n // go to the first element\n this.next();\n }\n\n /**\n * Returns the next operation in the ChangeSet\n * @returns true, if there are operations left\n */\n next(): boolean {\n // Find the smallest index in the operations lists\n let currentIndex = Infinity;\n let type: ArrayIteratorOperationTypes;\n (this._op as any).removeInsertOperation = undefined;\n // Process the current remove entry\n if (this._changeSet.remove &&\n this._currentIndices.remove < this._changeSet.remove.length) {\n type = ArrayChangeSetIterator.types.REMOVE;\n currentIndex = this._changeSet.remove[this._currentIndices.remove][0];\n let currentLength = this._changeSet.remove[this._currentIndices.remove][1];\n if (!isNumber(currentLength)) {\n currentLength = currentLength.length;\n }\n\n // Check, whether this is a removeInsertOperation\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] <= currentIndex + currentLength) {\n (this._op as InsertOperation).removeInsertOperation = this._changeSet.insert[this._currentIndices.insert];\n }\n }\n\n // Process the current insert entry (we prefer remove over insert, since this prevents the array from growing more\n // than necessary)\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] < currentIndex) {\n type = ArrayChangeSetIterator.types.INSERT;\n currentIndex = this._changeSet.insert[this._currentIndices.insert][0];\n }\n\n // Process the current modify entry\n if (this._copiedModifies &&\n this._currentIndices.modify < this._copiedModifies.length &&\n this._copiedModifies[this._currentIndices.modify][0] < currentIndex) {\n type = ArrayChangeSetIterator.types.MODIFY;\n }\n\n if (this._lastOperationIndex !== currentIndex) {\n this._currentOffset += this._lastOperationOffset;\n this._lastOperationIndex = currentIndex;\n this._lastOperationOffset = 0;\n }\n\n // We have found nothing, so we are at the end of the ChangeSet\n if (type === undefined) {\n this._op.type = ArrayChangeSetIterator.types.NOP;\n this._op.offset = this._currentOffset;\n this._op.operation = undefined;\n this._atEnd = true;\n return false;\n }\n\n // Determine the return value and update the internal indices and offsets depending on the next operation\n switch (type) {\n case ArrayChangeSetIterator.types.INSERT:\n this._op.type = ArrayChangeSetIterator.types.INSERT;\n // Define the return value\n this._op.operation = this._changeSet.insert[this._currentIndices.insert];\n this._op.offset = this._currentOffset;\n // Update the current offset. For an insert we have to increase it by the number of the inserted elements\n this._lastOperationOffset += (this._op.operation[1] as any).length;\n\n // Shift the internal index\n this._currentIndices.insert++;\n break;\n case ArrayChangeSetIterator.types.REMOVE:\n this._op.type = ArrayChangeSetIterator.types.REMOVE;\n // Define the return value\n this._op.operation = this._changeSet.remove[this._currentIndices.remove];\n this._op.offset = this._currentOffset;\n // Update the current offset. For a remove we have to decrement it by the number of the removed elements\n var removedElements = isNumber(this._op.operation[1]) ? this._op.operation[1] : this._op.operation[1].length;\n this._lastOperationOffset -= removedElements;\n\n // Shift the internal index\n this._currentIndices.remove++;\n break;\n case ArrayChangeSetIterator.types.MODIFY:\n {\n this._op.type = ArrayChangeSetIterator.types.MODIFY;\n this._op.offset = this._currentOffset;\n // check, if the modify's range overlaps with coming insert changes:\n let nextModify = this._copiedModifies[this._currentIndices.modify];\n const modifyEnd = nextModify[0] + nextModify[1].length;\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] < modifyEnd) {\n // we have an overlap and need to cut the modify\n const insertPosition = this._changeSet.insert[this._currentIndices.insert][0];\n\n // if we haven't copied the change set's modifies yet, we need to do that now\n if (this._copiedModifies === this._changeSet.modify) {\n this._copiedModifies = this._copyModifies(this._changeSet.modify);\n // now we need to update nextModify!\n nextModify = this._copiedModifies[this._currentIndices.modify];\n }\n\n // use modify only up to insert's position\n\n // build a partial modify and cut the remaining one:\n const partialModify: arrayModifyList = [nextModify[0], undefined];\n if (isString(nextModify[1])) {\n partialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);\n nextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);\n } else {\n partialModify[1] = nextModify[1].splice(0, insertPosition - nextModify[0]);\n }\n\n nextModify[0] = insertPosition;\n\n // use the whole modify\n this._op.operation = partialModify;\n } else {\n // use the whole modify\n this._op.operation = nextModify;\n\n // Shift the internal index\n this._currentIndices.modify++;\n }\n break;\n }\n default:\n throw new Error(`ArrayChangeSetIterator: ${MSG.UNKNOWN_OPERATION}`);\n }\n this._atEnd = false;\n return true;\n }\n\n /**\n * @returns true, if there are no more operations left\n */\n atEnd(): boolean {\n return this._atEnd;\n }\n\n private _copyModifies(in_modifies: string[]) {\n if (!in_modifies || in_modifies.length === 0) {\n return undefined;\n }\n const result = [];\n for (let i = 0; i < in_modifies.length; i++) {\n result.push([in_modifies[i][0], in_modifies[i][1].slice()]);\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"arrayChangesetIterator.js","sourceRoot":"","sources":["../../src/changeset_operations/arrayChangesetIterator.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;;;;AAEF,+DAAuC;AACvC,+DAAuC;AAExC,aAAa;AACb,yEAAgE;AAGhE,qDAA+D;AAE/D,MAAM,EAAE,GAAG,EAAE,GAAG,2BAAS,CAAC;AAsD1B;;;;;GAKG;AACH,MAAa,sBAAsB;IA6B/B;;OAEG;IACH,YAAY,YAAiC;QACzC,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;YACnB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;SACZ,CAAC;QAEF,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC;QAC9B,IA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M,EAAE,CAAC;qBACjC;oBACD,MAAM;iBACT;YACL;gBACI,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;SAC3E;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,aAAa,CAAC,WAAqB;QACvC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,OAAO,SAAS,CAAC;SACpB;QACD,MAAM,MAAM,GAAG,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,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;SAC/D;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;;AAhNL,wDAiNC;AAhNU,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\n import isNumber from \"lodash/isNumber\";\n import 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 = [number, string | genericArray] | [number, string, string] | [number, genericArray, genericArray];\nexport type arrayRemoveList = [number, number | string | genericArray];\n\n/**\n * Description of an array operation\n */\nexport interface OperationDescription {\n _absoluteBegin?: number;\n type?: ArrayIteratorOperationTypes;\n offset?: number;\n}\n\n/**\n * Description of an insert array operation\n */\nexport interface InsertOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.INSERT;\n removeInsertOperation?: arrayInsertList;\n operation?: arrayInsertList;\n}\n\n/**\n * Description of a remove array operation\n */\nexport interface RemoveOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.REMOVE;\n removeInsertOperation?: arrayRemoveList;\n operation?: arrayRemoveList;\n}\n\n/**\n * Description of a modify array operation\n */\nexport interface ModifyOperation extends OperationDescription {\n type: ArrayIteratorOperationTypes.MODIFY;\n removeInsertOperation?: arrayModifyList;\n operation: arrayModifyList;\n}\n\n/**\n * Description of a modify array operation\n */\n export interface NOPOperation extends Omit<OperationDescription, \"removeInsertOperation\" | \"operation\"> {\n type: ArrayIteratorOperationTypes.NOP;\n operation?: [];\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 *\n */\nexport class ArrayChangeSetIterator {\n static types = ArrayIteratorOperationTypes; // @TODO Not sure if this is still required if we export it separately.\n\n private readonly _changeSet: SerializedChangeSet;\n private _copiedModifies: string | any[];\n private readonly _currentIndices: { insert: number; remove: number; modify: number; };\n private _currentOffset: number;\n private _lastOperationIndex: number;\n private _lastOperationOffset: number;\n\n private _atEnd: boolean;\n private _op: GenericOperation;\n\n public get opDescription(): GenericOperation {\n return this._op;\n }\n\n public get currentOffset(): number {\n return this._currentOffset;\n }\n\n public get lastOperationIndex(): number {\n return this._lastOperationIndex;\n }\n\n public get lastOperationOffset(): number {\n return this._lastOperationOffset;\n }\n\n /**\n * @param in_changeSet - The ChangeSet to iterate over (this has to be an array ChangeSet\n */\n constructor(in_changeSet: SerializedChangeSet) {\n this._changeSet = in_changeSet;\n // if we need to chop overlapping modifies internally, so we have to copy them\n // we do this lazy and only if really needed\n this._copiedModifies = in_changeSet.modify;\n this._currentIndices = {\n insert: 0,\n remove: 0,\n modify: 0,\n };\n\n this._currentOffset = 0;\n this._lastOperationIndex = -1;\n this._lastOperationOffset = 0;\n this._atEnd = false;\n\n this._op = {\n type: ArrayIteratorOperationTypes.NOP,\n offset: 0,\n operation: undefined,\n };\n\n // go to the first element\n this.next();\n }\n\n /**\n * Returns the next operation in the ChangeSet\n * @returns true, if there are operations left\n */\n next(): boolean {\n // Find the smallest index in the operations lists\n let currentIndex = Infinity;\n let type: ArrayIteratorOperationTypes;\n (this._op as any).removeInsertOperation = undefined;\n // Process the current remove entry\n if (this._changeSet.remove &&\n this._currentIndices.remove < this._changeSet.remove.length) {\n type = ArrayChangeSetIterator.types.REMOVE;\n currentIndex = this._changeSet.remove[this._currentIndices.remove][0];\n let currentLength = this._changeSet.remove[this._currentIndices.remove][1];\n if (!isNumber(currentLength)) {\n currentLength = currentLength.length;\n }\n\n // Check, whether this is a removeInsertOperation\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] <= currentIndex + currentLength) {\n (this._op as InsertOperation).removeInsertOperation = this._changeSet.insert[this._currentIndices.insert];\n }\n }\n\n // Process the current insert entry (we prefer remove over insert, since this prevents the array from growing more\n // than necessary)\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] < currentIndex) {\n type = ArrayChangeSetIterator.types.INSERT;\n currentIndex = this._changeSet.insert[this._currentIndices.insert][0];\n }\n\n // Process the current modify entry\n if (this._copiedModifies &&\n this._currentIndices.modify < this._copiedModifies.length &&\n this._copiedModifies[this._currentIndices.modify][0] < currentIndex) {\n type = ArrayChangeSetIterator.types.MODIFY;\n }\n\n if (this._lastOperationIndex !== currentIndex) {\n this._currentOffset += this._lastOperationOffset;\n this._lastOperationIndex = currentIndex;\n this._lastOperationOffset = 0;\n }\n\n // We have found nothing, so we are at the end of the ChangeSet\n if (type === undefined) {\n this._op.type = ArrayChangeSetIterator.types.NOP;\n this._op.offset = this._currentOffset;\n this._op.operation = undefined;\n this._atEnd = true;\n return false;\n }\n\n // Determine the return value and update the internal indices and offsets depending on the next operation\n switch (type) {\n case ArrayChangeSetIterator.types.INSERT:\n this._op.type = ArrayChangeSetIterator.types.INSERT;\n // Define the return value\n this._op.operation = this._changeSet.insert[this._currentIndices.insert];\n this._op.offset = this._currentOffset;\n // Update the current offset. For an insert we have to increase it by the number of the inserted elements\n this._lastOperationOffset += (this._op.operation[1] as any).length;\n\n // Shift the internal index\n this._currentIndices.insert++;\n break;\n case ArrayChangeSetIterator.types.REMOVE:\n this._op.type = ArrayChangeSetIterator.types.REMOVE;\n // Define the return value\n this._op.operation = this._changeSet.remove[this._currentIndices.remove];\n this._op.offset = this._currentOffset;\n // Update the current offset. For a remove we have to decrement it by the number of the removed elements\n var removedElements = isNumber(this._op.operation[1]) ? this._op.operation[1] : this._op.operation[1].length;\n this._lastOperationOffset -= removedElements;\n\n // Shift the internal index\n this._currentIndices.remove++;\n break;\n case ArrayChangeSetIterator.types.MODIFY:\n {\n this._op.type = ArrayChangeSetIterator.types.MODIFY;\n this._op.offset = this._currentOffset;\n // check, if the modify's range overlaps with coming insert changes:\n let nextModify = this._copiedModifies[this._currentIndices.modify];\n const modifyEnd = nextModify[0] + nextModify[1].length;\n if (this._changeSet.insert &&\n this._currentIndices.insert < this._changeSet.insert.length &&\n this._changeSet.insert[this._currentIndices.insert][0] < modifyEnd) {\n // we have an overlap and need to cut the modify\n const insertPosition = this._changeSet.insert[this._currentIndices.insert][0];\n\n // if we haven't copied the change set's modifies yet, we need to do that now\n if (this._copiedModifies === this._changeSet.modify) {\n this._copiedModifies = this._copyModifies(this._changeSet.modify);\n // now we need to update nextModify!\n nextModify = this._copiedModifies[this._currentIndices.modify];\n }\n\n // use modify only up to insert's position\n\n // build a partial modify and cut the remaining one:\n const partialModify: arrayModifyList = [nextModify[0], undefined];\n if (isString(nextModify[1])) {\n partialModify[1] = nextModify[1].substr(0, insertPosition - nextModify[0]);\n nextModify[1] = nextModify[1].substr(insertPosition - nextModify[0]);\n } else {\n partialModify[1] = nextModify[1].splice(0, insertPosition - nextModify[0]);\n }\n\n nextModify[0] = insertPosition;\n\n // use the whole modify\n this._op.operation = partialModify;\n } else {\n // use the whole modify\n this._op.operation = nextModify;\n\n // Shift the internal index\n this._currentIndices.modify++;\n }\n break;\n }\n default:\n throw new Error(`ArrayChangeSetIterator: ${MSG.UNKNOWN_OPERATION}`);\n }\n this._atEnd = false;\n return true;\n }\n\n /**\n * @returns true, if there are no more operations left\n */\n atEnd(): boolean {\n return this._atEnd;\n }\n\n private _copyModifies(in_modifies: string[]) {\n if (!in_modifies || in_modifies.length === 0) {\n return undefined;\n }\n const result = [];\n for (let i = 0; i < in_modifies.length; i++) {\n result.push([in_modifies[i][0], in_modifies[i][1].slice()]);\n }\n return result;\n }\n}\n"]}
|
|
@@ -40,8 +40,8 @@ const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
|
|
|
40
40
|
* @private
|
|
41
41
|
*/
|
|
42
42
|
const _fastIsEmptyObject = function (in_object) {
|
|
43
|
-
if (!in_object || Array.isArray(in_object) || !isObject_1.default(in_object)) {
|
|
44
|
-
return isEmpty_1.default(in_object);
|
|
43
|
+
if (!in_object || Array.isArray(in_object) || !(0, isObject_1.default)(in_object)) {
|
|
44
|
+
return (0, isEmpty_1.default)(in_object);
|
|
45
45
|
}
|
|
46
46
|
// eslint-disable-next-line guard-for-in
|
|
47
47
|
for (const _entry in in_object) {
|
|
@@ -95,7 +95,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
95
95
|
delete baseInserted[removedTypes[t]][removedKeys[i]];
|
|
96
96
|
// If all entries for a typeid have been removed, we can remove
|
|
97
97
|
// the whole typeid from the inserted section
|
|
98
|
-
if (baseInserted && isEmpty_1.default(baseInserted[removedTypes[t]])) {
|
|
98
|
+
if (baseInserted && (0, isEmpty_1.default)(baseInserted[removedTypes[t]])) {
|
|
99
99
|
delete baseInserted[removedTypes[t]];
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -105,7 +105,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
105
105
|
delete baseModified[removedTypes[t]][removedKeys[i]];
|
|
106
106
|
// If all entries for a typeid have been removed, we can remove
|
|
107
107
|
// the whole typeid from the inserted section
|
|
108
|
-
if (baseModified && isEmpty_1.default(baseModified[removedTypes[t]])) {
|
|
108
|
+
if (baseModified && (0, isEmpty_1.default)(baseModified[removedTypes[t]])) {
|
|
109
109
|
delete baseModified[removedTypes[t]];
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -166,10 +166,10 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
166
166
|
delete baseInserted[foundInTypeid][key];
|
|
167
167
|
// If all entries for a typeid have been removed, we can remove
|
|
168
168
|
// the whole typeid from the inserted or modified section
|
|
169
|
-
if (baseInserted && isEmpty_1.default(baseInserted[foundInTypeid])) {
|
|
169
|
+
if (baseInserted && (0, isEmpty_1.default)(baseInserted[foundInTypeid])) {
|
|
170
170
|
delete baseInserted[foundInTypeid];
|
|
171
171
|
}
|
|
172
|
-
if (baseModified && isEmpty_1.default(baseModified[foundInTypeid])) {
|
|
172
|
+
if (baseModified && (0, isEmpty_1.default)(baseModified[foundInTypeid])) {
|
|
173
173
|
delete baseModified[foundInTypeid];
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -217,31 +217,31 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
217
217
|
// TODO: We should actually compute a diff between the two and recursively convert portions to modifies
|
|
218
218
|
// Instead, right now, we only handle the case where the two keys cancel each out perfectly, i.e.,
|
|
219
219
|
// the insert is reinserting exactly what was removed.
|
|
220
|
-
if (!isPrimitiveTypeid && removalCS && isObject_1.default(removalCS) && removalCS[key] !== undefined) {
|
|
220
|
+
if (!isPrimitiveTypeid && removalCS && (0, isObject_1.default)(removalCS) && removalCS[key] !== undefined) {
|
|
221
221
|
// Split out the two parts: all the keys other than remove/insert should match exactly.
|
|
222
222
|
// The contents 'remove' and 'insert', if they exist, should also match.
|
|
223
223
|
deeplyEqualCS = !!insertedEntries[key].insert === !!removalCS[key].remove;
|
|
224
224
|
// If there are 'insert' and 'remove', see if the removed data matches the inserted data
|
|
225
225
|
if (deeplyEqualCS && insertedEntries[key].insert) {
|
|
226
|
-
deeplyEqualCS = isEqual_1.default(insertedEntries[key].insert, removalCS[key].remove);
|
|
226
|
+
deeplyEqualCS = (0, isEqual_1.default)(insertedEntries[key].insert, removalCS[key].remove);
|
|
227
227
|
}
|
|
228
228
|
// Finally, check if the data being inserted matches the data that was removed
|
|
229
|
-
const insertedEntry = isObject_1.default(insertedEntries[key]) ? without_1.default(insertedEntries[key], "insert") : insertedEntries[key];
|
|
230
|
-
const removedEntry = isObject_1.default(removalCS[key]) ? without_1.default(removalCS[key], "remove") : removalCS[key];
|
|
231
|
-
deeplyEqualCS = deeplyEqualCS && isEqual_1.default(insertedEntry, removedEntry);
|
|
229
|
+
const insertedEntry = (0, isObject_1.default)(insertedEntries[key]) ? (0, without_1.default)(insertedEntries[key], "insert") : insertedEntries[key];
|
|
230
|
+
const removedEntry = (0, isObject_1.default)(removalCS[key]) ? (0, without_1.default)(removalCS[key], "remove") : removalCS[key];
|
|
231
|
+
deeplyEqualCS = deeplyEqualCS && (0, isEqual_1.default)(insertedEntry, removedEntry);
|
|
232
232
|
}
|
|
233
233
|
if ((isPrimitiveTypeid || typeidHelper_1.TypeIdHelper.isPrimitiveType(typeid) || deeplyEqualCS) &&
|
|
234
234
|
removalCS &&
|
|
235
|
-
((Array.isArray(removalCS) && includes_1.default(baseRemoved, key)) || removalCS[key] !== undefined)) {
|
|
235
|
+
((Array.isArray(removalCS) && (0, includes_1.default)(baseRemoved, key)) || removalCS[key] !== undefined)) {
|
|
236
236
|
// A remove and insert are combined into a modify for primitive types
|
|
237
237
|
// Remove the old remove command
|
|
238
238
|
let oldValueMatches = false;
|
|
239
239
|
if (Array.isArray(removalCS)) {
|
|
240
240
|
if (isPrimitiveTypeid) {
|
|
241
|
-
io_basePropertyChanges.remove = without_1.default(io_basePropertyChanges.remove, key);
|
|
241
|
+
io_basePropertyChanges.remove = (0, without_1.default)(io_basePropertyChanges.remove, key);
|
|
242
242
|
}
|
|
243
243
|
else {
|
|
244
|
-
io_basePropertyChanges.remove[typeid] = without_1.default(io_basePropertyChanges.remove[typeid], key);
|
|
244
|
+
io_basePropertyChanges.remove[typeid] = (0, without_1.default)(io_basePropertyChanges.remove[typeid], key);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
@@ -256,7 +256,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
256
256
|
}
|
|
257
257
|
else {
|
|
258
258
|
io_basePropertyChanges.modify[typeid] = io_basePropertyChanges.modify[typeid] || {};
|
|
259
|
-
io_basePropertyChanges.modify[typeid][key] = fastest_json_copy_1.copy(insertedEntries[key]);
|
|
259
|
+
io_basePropertyChanges.modify[typeid][key] = (0, fastest_json_copy_1.copy)(insertedEntries[key]);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
}
|
|
@@ -265,7 +265,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
265
265
|
}
|
|
266
266
|
else if (!isPrimitiveTypeid && (!baseInserted[typeid] || baseInserted[typeid][key] === undefined)) {
|
|
267
267
|
baseInserted[typeid] = baseInserted[typeid] || {};
|
|
268
|
-
baseInserted[typeid][key] = fastest_json_copy_1.copy(insertedEntries[key]);
|
|
268
|
+
baseInserted[typeid][key] = (0, fastest_json_copy_1.copy)(insertedEntries[key]);
|
|
269
269
|
}
|
|
270
270
|
else {
|
|
271
271
|
throw new Error(MSG.ALREADY_EXISTING_ENTRY + key);
|
|
@@ -358,7 +358,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
358
358
|
}
|
|
359
359
|
else {
|
|
360
360
|
baseModified[typeid] = baseModified[typeid] || {};
|
|
361
|
-
baseModified[typeid][key] = fastest_json_copy_1.copy(modifiedEntries[typeid][key]);
|
|
361
|
+
baseModified[typeid][key] = (0, fastest_json_copy_1.copy)(modifiedEntries[typeid][key]);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -475,7 +475,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
475
475
|
const key = changedKeys[i];
|
|
476
476
|
const newPath = in_useSquareBracketsInPath ?
|
|
477
477
|
`${in_basePath}[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(key)}]` :
|
|
478
|
-
property_common_1.joinPaths(in_basePath, pathHelper_1.PathHelper.quotePathSegmentIfNeeded(key), PROPERTY_PATH_DELIMITER);
|
|
478
|
+
(0, property_common_1.joinPaths)(in_basePath, pathHelper_1.PathHelper.quotePathSegmentIfNeeded(key), PROPERTY_PATH_DELIMITER);
|
|
479
479
|
const modification = changesByKeys[key];
|
|
480
480
|
if (modification.own && modification.other) {
|
|
481
481
|
/*
|
|
@@ -598,7 +598,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
598
598
|
// If we have a duplicated delete, we remove it from the new ChangeSet
|
|
599
599
|
if (modification.own === "remove") {
|
|
600
600
|
if (Array.isArray(io_rebasePropertyChangeSet.remove)) {
|
|
601
|
-
io_rebasePropertyChangeSet.remove = without_1.default(io_rebasePropertyChangeSet.remove, key);
|
|
601
|
+
io_rebasePropertyChangeSet.remove = (0, without_1.default)(io_rebasePropertyChangeSet.remove, key);
|
|
602
602
|
}
|
|
603
603
|
else {
|
|
604
604
|
if (isPrimitiveTypeid) {
|
|
@@ -691,7 +691,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
691
691
|
// Remove remove operations from the ChangeSet
|
|
692
692
|
if (Array.isArray(io_rebasePropertyChangeSet[modification.other])) {
|
|
693
693
|
io_rebasePropertyChangeSet[modification.other] =
|
|
694
|
-
without_1.default(io_rebasePropertyChangeSet[modification.other], key);
|
|
694
|
+
(0, without_1.default)(io_rebasePropertyChangeSet[modification.other], key);
|
|
695
695
|
}
|
|
696
696
|
else {
|
|
697
697
|
delete io_rebasePropertyChangeSet[modification.other][key];
|
|
@@ -748,7 +748,7 @@ var ChangeSetIndexedCollectionFunctions;
|
|
|
748
748
|
const modifies = changes.modify[typeidList[j]];
|
|
749
749
|
const modifyKeys = Object.keys(modifies);
|
|
750
750
|
for (let k = 0; k < modifyKeys.length; k++) {
|
|
751
|
-
if (isEmptyChangeset_1.isEmptyChangeSet(modifies[modifyKeys[k]])) {
|
|
751
|
+
if ((0, isEmptyChangeset_1.isEmptyChangeSet)(modifies[modifyKeys[k]])) {
|
|
752
752
|
delete modifies[modifyKeys[k]];
|
|
753
753
|
}
|
|
754
754
|
}
|