@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/esm/index.mjs
CHANGED
|
@@ -942,6 +942,18 @@ const encodeKeyValueOperation = function (encoder, bytes, changeTree, field, ope
|
|
|
942
942
|
}
|
|
943
943
|
const type = changeTree.getType(field);
|
|
944
944
|
const value = changeTree.getValue(field);
|
|
945
|
+
// try { throw new Error(); } catch (e) {
|
|
946
|
+
// // only print if not coming from Reflection.ts
|
|
947
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
948
|
+
// console.log("encodeKeyValueOperation -> ", {
|
|
949
|
+
// ref: changeTree.ref.constructor.name,
|
|
950
|
+
// field,
|
|
951
|
+
// operation: OPERATION[operation],
|
|
952
|
+
// value: value?.toJSON(),
|
|
953
|
+
// items: ref.toJSON(),
|
|
954
|
+
// });
|
|
955
|
+
// }
|
|
956
|
+
// }
|
|
945
957
|
// TODO: inline this function call small performance gain
|
|
946
958
|
encodeValue(encoder, bytes, ref, type, value, field, operation, it);
|
|
947
959
|
};
|
|
@@ -3392,6 +3404,12 @@ class Encoder {
|
|
|
3392
3404
|
const ctor = ref['constructor'];
|
|
3393
3405
|
const encoder = ctor[$encoder];
|
|
3394
3406
|
const filter = ctor[$filter];
|
|
3407
|
+
// try { throw new Error(); } catch (e) {
|
|
3408
|
+
// // only print if not coming from Reflection.ts
|
|
3409
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
3410
|
+
// console.log("ChangeTree:", { ref: ref.constructor.name, });
|
|
3411
|
+
// }
|
|
3412
|
+
// }
|
|
3395
3413
|
if (hasView) {
|
|
3396
3414
|
if (!view.items.has(changeTree)) {
|
|
3397
3415
|
view.invisible.add(changeTree);
|
|
@@ -3421,11 +3439,16 @@ class Encoder {
|
|
|
3421
3439
|
// view?.invisible.add(changeTree);
|
|
3422
3440
|
continue;
|
|
3423
3441
|
}
|
|
3424
|
-
//
|
|
3425
|
-
//
|
|
3426
|
-
//
|
|
3427
|
-
//
|
|
3428
|
-
//
|
|
3442
|
+
// try { throw new Error(); } catch (e) {
|
|
3443
|
+
// // only print if not coming from Reflection.ts
|
|
3444
|
+
// if (!e.stack.includes("src/Reflection.ts")) {
|
|
3445
|
+
// // console.log("WILL ENCODE", {
|
|
3446
|
+
// // ref: changeTree.ref.constructor.name,
|
|
3447
|
+
// // fieldIndex,
|
|
3448
|
+
// // operation: OPERATION[operation],
|
|
3449
|
+
// // });
|
|
3450
|
+
// }
|
|
3451
|
+
// }
|
|
3429
3452
|
encoder(this, buffer, changeTree, fieldIndex, operation, it, isEncodeAll, hasView);
|
|
3430
3453
|
}
|
|
3431
3454
|
}
|