@colyseus/schema 3.0.17 → 3.0.19
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 +9 -6
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +9 -6
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -6
- package/lib/Metadata.js +6 -0
- package/lib/Metadata.js.map +1 -1
- package/lib/decoder/DecodeOperation.js +0 -1
- package/lib/decoder/DecodeOperation.js.map +1 -1
- package/lib/decoder/ReferenceTracker.js +7 -2
- package/lib/decoder/ReferenceTracker.js.map +1 -1
- package/lib/encoder/ChangeTree.js +2 -3
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/package.json +1 -1
- package/src/Metadata.ts +7 -0
- package/src/decoder/DecodeOperation.ts +0 -1
- package/src/decoder/ReferenceTracker.ts +7 -2
- package/src/encoder/ChangeTree.ts +2 -4
package/build/cjs/index.js
CHANGED
|
@@ -1358,9 +1358,8 @@ class ChangeTree {
|
|
|
1358
1358
|
}
|
|
1359
1359
|
key += `-${parentIndex}`;
|
|
1360
1360
|
this.isFiltered = parent[$changes].isFiltered // in case parent is already filtered
|
|
1361
|
-
|| this.root.types.parentFiltered[key]
|
|
1362
|
-
|
|
1363
|
-
// this.isFiltered = parentMetadata?.[$viewFieldIndexes]?.includes(parentIndex) || this.root.types.parentFiltered[key];
|
|
1361
|
+
|| this.root.types.parentFiltered[key]
|
|
1362
|
+
|| parentConstructor?.[Symbol.metadata]?.[$viewFieldIndexes]?.includes(parentIndex);
|
|
1364
1363
|
//
|
|
1365
1364
|
// TODO: refactor this!
|
|
1366
1365
|
//
|
|
@@ -1575,7 +1574,6 @@ function decodeValue(decoder, operation, ref, index, type, bytes, it, allChanges
|
|
|
1575
1574
|
while ((iter = entries.next()) && !iter.done) {
|
|
1576
1575
|
const [key, value] = iter.value;
|
|
1577
1576
|
// if value is a schema, remove its reference
|
|
1578
|
-
// FIXME: not sure if this is necessary, add more tests to confirm
|
|
1579
1577
|
if (typeof (value) === "object") {
|
|
1580
1578
|
previousRefId = $root.refIds.get(value);
|
|
1581
1579
|
$root.removeRef(previousRefId);
|
|
@@ -4068,7 +4066,7 @@ class ReferenceTracker {
|
|
|
4068
4066
|
for (const index in metadata) {
|
|
4069
4067
|
const field = metadata[index].name;
|
|
4070
4068
|
const childRefId = typeof (ref[field]) === "object" && this.refIds.get(ref[field]);
|
|
4071
|
-
if (childRefId) {
|
|
4069
|
+
if (childRefId && !this.deletedRefs.has(childRefId)) {
|
|
4072
4070
|
this.removeRef(childRefId);
|
|
4073
4071
|
}
|
|
4074
4072
|
}
|
|
@@ -4076,7 +4074,12 @@ class ReferenceTracker {
|
|
|
4076
4074
|
else {
|
|
4077
4075
|
if (typeof (Object.values(ref[$childType])[0]) === "function") {
|
|
4078
4076
|
Array.from(ref.values())
|
|
4079
|
-
.forEach((child) =>
|
|
4077
|
+
.forEach((child) => {
|
|
4078
|
+
const childRefId = this.refIds.get(child);
|
|
4079
|
+
if (!this.deletedRefs.has(childRefId)) {
|
|
4080
|
+
this.removeRef(childRefId);
|
|
4081
|
+
}
|
|
4082
|
+
});
|
|
4080
4083
|
}
|
|
4081
4084
|
}
|
|
4082
4085
|
this.refs.delete(refId); // remove ref
|