@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/esm/index.mjs
CHANGED
|
@@ -1057,6 +1057,9 @@ class ChangeTree {
|
|
|
1057
1057
|
if (typeof (this.ref[$childType]) !== "string") {
|
|
1058
1058
|
// MapSchema / ArraySchema, etc.
|
|
1059
1059
|
for (const [key, value] of this.ref.entries()) {
|
|
1060
|
+
if (!value) {
|
|
1061
|
+
continue;
|
|
1062
|
+
} // sparse arrays can have undefined values
|
|
1060
1063
|
callback(value[$changes], this.indexes?.[key] ?? key);
|
|
1061
1064
|
}
|
|
1062
1065
|
}
|
|
@@ -3697,7 +3700,9 @@ class Schema {
|
|
|
3697
3700
|
this[$changes].change(metadata[metadata[property]].index, operation);
|
|
3698
3701
|
}
|
|
3699
3702
|
clone() {
|
|
3700
|
-
|
|
3703
|
+
// Create instance without calling custom constructor
|
|
3704
|
+
const cloned = Object.create(this.constructor.prototype);
|
|
3705
|
+
Schema.initialize(cloned);
|
|
3701
3706
|
const metadata = this.constructor[Symbol.metadata];
|
|
3702
3707
|
//
|
|
3703
3708
|
// TODO: clone all properties, not only annotated ones
|