@colyseus/schema 2.0.35 → 2.0.37

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.
Files changed (59) hide show
  1. package/build/cjs/index.js +6 -14
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/index.mjs +6 -14
  4. package/build/esm/index.mjs.map +1 -1
  5. package/build/umd/index.js +6 -14
  6. package/lib/Schema.d.ts +1 -1
  7. package/lib/annotations.js +8 -8
  8. package/lib/annotations.js.map +1 -1
  9. package/lib/bench_encode.d.ts +1 -0
  10. package/lib/bench_encode.js +145 -0
  11. package/lib/bench_encode.js.map +1 -0
  12. package/lib/codegen/api.js +1 -2
  13. package/lib/codegen/api.js.map +1 -1
  14. package/lib/codegen/languages/cpp.js +1 -2
  15. package/lib/codegen/languages/cpp.js.map +1 -1
  16. package/lib/codegen/languages/csharp.js +1 -2
  17. package/lib/codegen/languages/csharp.js.map +1 -1
  18. package/lib/codegen/languages/haxe.js +1 -2
  19. package/lib/codegen/languages/haxe.js.map +1 -1
  20. package/lib/codegen/languages/java.js +1 -2
  21. package/lib/codegen/languages/java.js.map +1 -1
  22. package/lib/codegen/languages/js.js +1 -2
  23. package/lib/codegen/languages/js.js.map +1 -1
  24. package/lib/codegen/languages/lua.js +1 -2
  25. package/lib/codegen/languages/lua.js.map +1 -1
  26. package/lib/codegen/languages/ts.js +1 -2
  27. package/lib/codegen/languages/ts.js.map +1 -1
  28. package/lib/codegen/parser.js +2 -3
  29. package/lib/codegen/parser.js.map +1 -1
  30. package/lib/codegen/types.js +3 -3
  31. package/lib/codegen/types.js.map +1 -1
  32. package/lib/encoding/decode.js +19 -20
  33. package/lib/encoding/decode.js.map +1 -1
  34. package/lib/encoding/encode.js +16 -17
  35. package/lib/encoding/encode.js.map +1 -1
  36. package/lib/types/ArraySchema.d.ts +3 -2
  37. package/lib/types/ArraySchema.js +2 -10
  38. package/lib/types/ArraySchema.js.map +1 -1
  39. package/lib/types/CollectionSchema.d.ts +2 -2
  40. package/lib/types/MapSchema.d.ts +3 -3
  41. package/lib/types/MapSchema.js +2 -2
  42. package/lib/types/MapSchema.js.map +1 -1
  43. package/lib/types/SetSchema.d.ts +2 -2
  44. package/lib/types/typeRegistry.js +2 -3
  45. package/lib/types/typeRegistry.js.map +1 -1
  46. package/lib/types/utils.js +3 -4
  47. package/lib/types/utils.js.map +1 -1
  48. package/lib/utils.js +1 -2
  49. package/lib/utils.js.map +1 -1
  50. package/lib/v2.d.ts +1 -0
  51. package/lib/v2.js +141 -0
  52. package/lib/v2.js.map +1 -0
  53. package/lib/v2_bench.d.ts +1 -0
  54. package/lib/v2_bench.js +141 -0
  55. package/lib/v2_bench.js.map +1 -0
  56. package/package.json +1 -1
  57. package/src/annotations.ts +1 -1
  58. package/src/bench_encode.ts +108 -0
  59. package/src/types/ArraySchema.ts +4 -2
@@ -14,7 +14,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
14
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
15
  PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
- /* global Reflect, Promise, SuppressedError, Symbol */
17
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
18
 
19
19
  var extendStatics = function(d, b) {
20
20
  extendStatics = Object.setPrototypeOf ||
@@ -676,14 +676,6 @@ var ArraySchema = /** @class */ (function () {
676
676
  if (fromIndex === void 0) { fromIndex = this.length - 1; }
677
677
  return Array.from(this.$items.values()).lastIndexOf(searchElement, fromIndex);
678
678
  };
679
- /**
680
- * Determines whether all the members of an array satisfy the specified test.
681
- * @param callbackfn A function that accepts up to three arguments. The every method calls
682
- * the callbackfn function for each element in the array until the callbackfn returns a value
683
- * which is coercible to the Boolean value false, or until the end of the array.
684
- * @param thisArg An object to which the this keyword can refer in the callbackfn function.
685
- * If thisArg is omitted, undefined is used as the this value.
686
- */
687
679
  ArraySchema.prototype.every = function (callbackfn, thisArg) {
688
680
  return Array.from(this.$items.values()).every(callbackfn, thisArg);
689
681
  };
@@ -1373,7 +1365,7 @@ function type(type, options) {
1373
1365
  value['$changes'].setParent(this, this.$changes.root, this._definition.indexes[field]);
1374
1366
  }
1375
1367
  }
1376
- else if (this[fieldCached]) {
1368
+ else if (this[fieldCached] !== undefined) {
1377
1369
  //
1378
1370
  // Setting a field to `null` or `undefined` will delete it.
1379
1371
  //
@@ -1658,24 +1650,24 @@ function number$1(bytes, value) {
1658
1650
  }
1659
1651
  else {
1660
1652
  // negative fixnum
1661
- if (value >= -0x20) {
1653
+ if (value >= -32) {
1662
1654
  bytes.push(0xe0 | (value + 0x20));
1663
1655
  return 1;
1664
1656
  }
1665
1657
  // int 8
1666
- if (value >= -0x80) {
1658
+ if (value >= -128) {
1667
1659
  bytes.push(0xd0);
1668
1660
  int8$1(bytes, value);
1669
1661
  return 2;
1670
1662
  }
1671
1663
  // int 16
1672
- if (value >= -0x8000) {
1664
+ if (value >= -32768) {
1673
1665
  bytes.push(0xd1);
1674
1666
  int16$1(bytes, value);
1675
1667
  return 3;
1676
1668
  }
1677
1669
  // int 32
1678
- if (value >= -0x80000000) {
1670
+ if (value >= -2147483648) {
1679
1671
  bytes.push(0xd2);
1680
1672
  int32$1(bytes, value);
1681
1673
  return 5;