@colyseus/schema 3.0.24 → 3.0.26
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/build/cjs/index.js +54 -60
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +54 -60
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +54 -60
- package/lib/encoder/ChangeTree.d.ts +1 -1
- package/lib/encoder/ChangeTree.js +25 -22
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/lib/encoder/Encoder.js +5 -20
- package/lib/encoder/Encoder.js.map +1 -1
- package/lib/encoder/Root.js +7 -3
- package/lib/encoder/Root.js.map +1 -1
- package/lib/types/custom/ArraySchema.js +4 -3
- package/lib/types/custom/ArraySchema.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/ChangeTree.ts +30 -24
- package/src/encoder/Encoder.ts +3 -22
- package/src/encoder/Root.ts +9 -2
- package/src/types/custom/ArraySchema.ts +5 -3
package/src/encoder/Root.ts
CHANGED
|
@@ -97,11 +97,18 @@ export class Root {
|
|
|
97
97
|
|
|
98
98
|
removeChangeFromChangeSet(changeSetName: "allChanges" | "changes" | "filteredChanges" | "allFilteredChanges", changeTree: ChangeTree) {
|
|
99
99
|
const changeSet = this[changeSetName];
|
|
100
|
-
|
|
100
|
+
const changeSetIndex = changeSet.indexOf(changeTree);
|
|
101
|
+
|
|
102
|
+
if (changeSetIndex !== -1) {
|
|
101
103
|
changeTree[changeSetName].queueRootIndex = -1;
|
|
102
|
-
|
|
104
|
+
changeSet[changeSetIndex] = undefined;
|
|
103
105
|
return true;
|
|
104
106
|
}
|
|
107
|
+
|
|
108
|
+
// if (spliceOne(changeSet, changeSet.indexOf(changeTree))) {
|
|
109
|
+
// changeTree[changeSetName].queueRootIndex = -1;
|
|
110
|
+
// return true;
|
|
111
|
+
// }
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
clear() {
|
|
@@ -360,11 +360,13 @@ export class ArraySchema<V = any> implements Array<V>, Collection<number, V> {
|
|
|
360
360
|
if (this.items.length === 0) { return undefined; }
|
|
361
361
|
|
|
362
362
|
// const index = Number(Object.keys(changeTree.indexes)[0]);
|
|
363
|
-
const index = this.tmpItems.findIndex((item, i) => item === this.items[0]);
|
|
364
363
|
const changeTree = this[$changes];
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
const index = this.tmpItems.findIndex(item => item === this.items[0]);
|
|
366
|
+
const allChangesIndex = this.items.findIndex(item => item === this.items[0]);
|
|
367
|
+
|
|
368
|
+
changeTree.delete(index, OPERATION.DELETE, allChangesIndex);
|
|
369
|
+
changeTree.shiftAllChangeIndexes(-1, allChangesIndex);
|
|
368
370
|
|
|
369
371
|
// this.deletedIndexes[index] = true;
|
|
370
372
|
|