@colyseus/schema 3.0.64 → 3.0.65
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 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +6 -1
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +6 -1
- package/lib/Schema.js +3 -1
- package/lib/Schema.js.map +1 -1
- package/lib/encoder/ChangeTree.js +3 -0
- package/lib/encoder/ChangeTree.js.map +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +4 -1
- package/src/encoder/ChangeTree.ts +1 -0
package/build/cjs/index.js
CHANGED
|
@@ -1059,6 +1059,9 @@ class ChangeTree {
|
|
|
1059
1059
|
if (typeof (this.ref[$childType]) !== "string") {
|
|
1060
1060
|
// MapSchema / ArraySchema, etc.
|
|
1061
1061
|
for (const [key, value] of this.ref.entries()) {
|
|
1062
|
+
if (!value) {
|
|
1063
|
+
continue;
|
|
1064
|
+
} // sparse arrays can have undefined values
|
|
1062
1065
|
callback(value[$changes], this.indexes?.[key] ?? key);
|
|
1063
1066
|
}
|
|
1064
1067
|
}
|
|
@@ -3699,7 +3702,9 @@ class Schema {
|
|
|
3699
3702
|
this[$changes].change(metadata[metadata[property]].index, operation);
|
|
3700
3703
|
}
|
|
3701
3704
|
clone() {
|
|
3702
|
-
|
|
3705
|
+
// Create instance without calling custom constructor
|
|
3706
|
+
const cloned = Object.create(this.constructor.prototype);
|
|
3707
|
+
Schema.initialize(cloned);
|
|
3703
3708
|
const metadata = this.constructor[Symbol.metadata];
|
|
3704
3709
|
//
|
|
3705
3710
|
// TODO: clone all properties, not only annotated ones
|