@colyseus/schema 3.0.25 → 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 +6 -5
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +6 -5
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +6 -5
- package/lib/encoder/ChangeTree.js +2 -2
- package/lib/encoder/ChangeTree.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 +2 -3
- package/src/types/custom/ArraySchema.ts +5 -3
package/build/cjs/index.js
CHANGED
|
@@ -1139,7 +1139,7 @@ class ChangeTree {
|
|
|
1139
1139
|
const newIndexes = {};
|
|
1140
1140
|
for (const index in this.indexedOperations) {
|
|
1141
1141
|
newIndexedOperations[Number(index) + shiftIndex] = this.indexedOperations[index];
|
|
1142
|
-
newIndexes[Number(index) + shiftIndex] = changeSet[index];
|
|
1142
|
+
newIndexes[Number(index) + shiftIndex] = changeSet.indexes[index];
|
|
1143
1143
|
}
|
|
1144
1144
|
this.indexedOperations = newIndexedOperations;
|
|
1145
1145
|
changeSet.indexes = newIndexes;
|
|
@@ -1233,6 +1233,7 @@ class ChangeTree {
|
|
|
1233
1233
|
: this.changes;
|
|
1234
1234
|
this.indexedOperations[index] = operation ?? exports.OPERATION.DELETE;
|
|
1235
1235
|
setOperationAtIndex(changeSet, index);
|
|
1236
|
+
deleteOperationAtIndex(this.allChanges, allChangesIndex);
|
|
1236
1237
|
const previousValue = this.getValue(index);
|
|
1237
1238
|
// remove `root` reference
|
|
1238
1239
|
if (previousValue && previousValue[$changes]) {
|
|
@@ -1248,7 +1249,6 @@ class ChangeTree {
|
|
|
1248
1249
|
//
|
|
1249
1250
|
this.root?.remove(previousValue[$changes]);
|
|
1250
1251
|
}
|
|
1251
|
-
deleteOperationAtIndex(this.allChanges, allChangesIndex);
|
|
1252
1252
|
//
|
|
1253
1253
|
// FIXME: this is looking a ugly and repeated
|
|
1254
1254
|
//
|
|
@@ -2101,10 +2101,11 @@ class ArraySchema {
|
|
|
2101
2101
|
return undefined;
|
|
2102
2102
|
}
|
|
2103
2103
|
// const index = Number(Object.keys(changeTree.indexes)[0]);
|
|
2104
|
-
const index = this.tmpItems.findIndex((item, i) => item === this.items[0]);
|
|
2105
2104
|
const changeTree = this[$changes];
|
|
2106
|
-
|
|
2107
|
-
|
|
2105
|
+
const index = this.tmpItems.findIndex(item => item === this.items[0]);
|
|
2106
|
+
const allChangesIndex = this.items.findIndex(item => item === this.items[0]);
|
|
2107
|
+
changeTree.delete(index, exports.OPERATION.DELETE, allChangesIndex);
|
|
2108
|
+
changeTree.shiftAllChangeIndexes(-1, allChangesIndex);
|
|
2108
2109
|
// this.deletedIndexes[index] = true;
|
|
2109
2110
|
return this.items.shift();
|
|
2110
2111
|
}
|