@colyseus/schema 3.0.0-alpha.3 → 3.0.0-alpha.5
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 +2 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +2 -3
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +2 -3
- package/lib/Reflection.d.ts +1 -1
- package/lib/Reflection.js +1 -2
- package/lib/Reflection.js.map +1 -1
- package/lib/encoding/decode.js +1 -1
- package/lib/encoding/decode.js.map +1 -1
- package/package.json +1 -1
- package/src/Reflection.ts +1 -2
- package/src/encoding/decode.ts +1 -2
package/build/cjs/index.js
CHANGED
|
@@ -1014,7 +1014,6 @@ const encodeArray = function (encoder, bytes, changeTree, field, operation, it,
|
|
|
1014
1014
|
* SOFTWARE
|
|
1015
1015
|
*/
|
|
1016
1016
|
function utf8Read(bytes, it, length) {
|
|
1017
|
-
it.offset += length;
|
|
1018
1017
|
var string = '', chr = 0;
|
|
1019
1018
|
for (var i = it.offset, end = it.offset + length; i < end; i++) {
|
|
1020
1019
|
var byte = bytes[i];
|
|
@@ -1051,6 +1050,7 @@ function utf8Read(bytes, it, length) {
|
|
|
1051
1050
|
// (do not throw error to avoid server/client from crashing due to hack attemps)
|
|
1052
1051
|
// throw new Error('Invalid byte ' + byte.toString(16));
|
|
1053
1052
|
}
|
|
1053
|
+
it.offset += length;
|
|
1054
1054
|
return string;
|
|
1055
1055
|
}
|
|
1056
1056
|
function int8(bytes, it) {
|
|
@@ -3822,7 +3822,7 @@ class Reflection extends Schema {
|
|
|
3822
3822
|
super(...arguments);
|
|
3823
3823
|
this.types = new ArraySchema();
|
|
3824
3824
|
}
|
|
3825
|
-
static encode(instance, context) {
|
|
3825
|
+
static encode(instance, context, it = { offset: 0 }) {
|
|
3826
3826
|
if (!context) {
|
|
3827
3827
|
context = new TypeContext(instance.constructor);
|
|
3828
3828
|
}
|
|
@@ -3879,7 +3879,6 @@ class Reflection extends Schema {
|
|
|
3879
3879
|
}
|
|
3880
3880
|
buildType(type, klass[Symbol.metadata]);
|
|
3881
3881
|
}
|
|
3882
|
-
const it = { offset: 0 };
|
|
3883
3882
|
const buf = encoder.encodeAll(it);
|
|
3884
3883
|
return Buffer.from(buf, 0, it.offset);
|
|
3885
3884
|
}
|