@colyseus/schema 3.0.0-alpha.10 → 3.0.0-alpha.11
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 +28 -5
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +28 -5
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +28 -5
- package/lib/encoder/EncodeOperation.js +12 -0
- package/lib/encoder/EncodeOperation.js.map +1 -1
- package/lib/encoder/Encoder.js +16 -5
- package/lib/encoder/Encoder.js.map +1 -1
- package/package.json +1 -1
- package/src/encoder/EncodeOperation.ts +13 -0
- package/src/encoder/Encoder.ts +17 -5
package/build/cjs/index.js
CHANGED
|
@@ -946,6 +946,18 @@ const encodeKeyValueOperation = function (encoder, bytes, changeTree, field, ope
|
|
|
946
946
|
}
|
|
947
947
|
const type = changeTree.getType(field);
|
|
948
948
|
const value = changeTree.getValue(field);
|
|
949
|
+
// try { throw new Error(); } catch (e) {
|
|
950
|
+
// // only print if not coming from Reflection.ts
|
|
951
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
952
|
+
// console.log("encodeKeyValueOperation -> ", {
|
|
953
|
+
// ref: changeTree.ref.constructor.name,
|
|
954
|
+
// field,
|
|
955
|
+
// operation: OPERATION[operation],
|
|
956
|
+
// value: value?.toJSON(),
|
|
957
|
+
// items: ref.toJSON(),
|
|
958
|
+
// });
|
|
959
|
+
// }
|
|
960
|
+
// }
|
|
949
961
|
// TODO: inline this function call small performance gain
|
|
950
962
|
encodeValue(encoder, bytes, ref, type, value, field, operation, it);
|
|
951
963
|
};
|
|
@@ -3396,6 +3408,12 @@ class Encoder {
|
|
|
3396
3408
|
const ctor = ref['constructor'];
|
|
3397
3409
|
const encoder = ctor[$encoder];
|
|
3398
3410
|
const filter = ctor[$filter];
|
|
3411
|
+
// try { throw new Error(); } catch (e) {
|
|
3412
|
+
// // only print if not coming from Reflection.ts
|
|
3413
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
3414
|
+
// console.log("ChangeTree:", { ref: ref.constructor.name, });
|
|
3415
|
+
// }
|
|
3416
|
+
// }
|
|
3399
3417
|
if (hasView) {
|
|
3400
3418
|
if (!view.items.has(changeTree)) {
|
|
3401
3419
|
view.invisible.add(changeTree);
|
|
@@ -3425,11 +3443,16 @@ class Encoder {
|
|
|
3425
3443
|
// view?.invisible.add(changeTree);
|
|
3426
3444
|
continue;
|
|
3427
3445
|
}
|
|
3428
|
-
//
|
|
3429
|
-
//
|
|
3430
|
-
//
|
|
3431
|
-
//
|
|
3432
|
-
//
|
|
3446
|
+
// try { throw new Error(); } catch (e) {
|
|
3447
|
+
// // only print if not coming from Reflection.ts
|
|
3448
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
3449
|
+
// // console.log("WILL ENCODE", {
|
|
3450
|
+
// // ref: changeTree.ref.constructor.name,
|
|
3451
|
+
// // fieldIndex,
|
|
3452
|
+
// // operation: OPERATION[operation],
|
|
3453
|
+
// // });
|
|
3454
|
+
// }
|
|
3455
|
+
// }
|
|
3433
3456
|
encoder(this, buffer, changeTree, fieldIndex, operation, it, isEncodeAll, hasView);
|
|
3434
3457
|
}
|
|
3435
3458
|
}
|