@colyseus/schema 1.0.28 → 1.0.29

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 (52) hide show
  1. package/build/cjs/index.js +9 -13
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/index.mjs +81 -110
  4. package/build/esm/index.mjs.map +1 -1
  5. package/build/umd/index.js +9 -13
  6. package/lib/Reflection.js +11 -11
  7. package/lib/Reflection.js.map +1 -1
  8. package/lib/Schema.js +2 -2
  9. package/lib/Schema.js.map +1 -1
  10. package/lib/annotations.js +8 -12
  11. package/lib/annotations.js.map +1 -1
  12. package/lib/changes/ReferenceTracker.d.ts +14 -0
  13. package/lib/changes/ReferenceTracker.js +77 -0
  14. package/lib/changes/ReferenceTracker.js.map +1 -0
  15. package/lib/codegen/api.js +1 -1
  16. package/lib/codegen/api.js.map +1 -1
  17. package/lib/codegen/cli.js +2 -2
  18. package/lib/codegen/cli.js.map +1 -1
  19. package/lib/codegen/languages/cpp.js +3 -3
  20. package/lib/codegen/languages/cpp.js.map +1 -1
  21. package/lib/codegen/languages/csharp.js +8 -12
  22. package/lib/codegen/languages/csharp.js.map +1 -1
  23. package/lib/codegen/languages/haxe.js +1 -1
  24. package/lib/codegen/languages/haxe.js.map +1 -1
  25. package/lib/codegen/languages/java.js +1 -1
  26. package/lib/codegen/languages/java.js.map +1 -1
  27. package/lib/codegen/languages/js.js +2 -2
  28. package/lib/codegen/languages/js.js.map +1 -1
  29. package/lib/codegen/languages/lua.js +2 -2
  30. package/lib/codegen/languages/lua.js.map +1 -1
  31. package/lib/codegen/languages/ts.js +9 -13
  32. package/lib/codegen/languages/ts.js.map +1 -1
  33. package/lib/codegen/parser.js +2 -1
  34. package/lib/codegen/parser.js.map +1 -1
  35. package/lib/events/EventEmitter.js +6 -10
  36. package/lib/events/EventEmitter.js.map +1 -1
  37. package/lib/index.js +4 -4
  38. package/lib/index.js.map +1 -1
  39. package/lib/types/ArraySchema.js +8 -12
  40. package/lib/types/ArraySchema.js.map +1 -1
  41. package/lib/types/typeRegistry.d.ts +5 -0
  42. package/lib/types/typeRegistry.js +13 -0
  43. package/lib/types/typeRegistry.js.map +1 -0
  44. package/lib/types/utils.d.ts +9 -0
  45. package/lib/types/utils.js +50 -0
  46. package/lib/types/utils.js.map +1 -0
  47. package/package.json +4 -1
  48. package/decoders/cpp/usage_array_schema_types.cpp +0 -40
  49. package/decoders/cpp/usage_child_schema_types.cpp +0 -24
  50. package/decoders/cpp/usage_inherited_types.cpp +0 -34
  51. package/decoders/cpp/usage_map_schema_types.cpp +0 -35
  52. package/decoders/cpp/usage_primitive_types.cpp +0 -41
@@ -40,14 +40,10 @@ function __decorate(decorators, target, key, desc) {
40
40
  return c > 3 && r && Object.defineProperty(target, key, r), r;
41
41
  }
42
42
 
43
- function __spreadArray(to, from, pack) {
44
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
45
- if (ar || !(i in from)) {
46
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
47
- ar[i] = from[i];
48
- }
49
- }
50
- return to.concat(ar || Array.prototype.slice.call(from));
43
+ function __spreadArray(to, from) {
44
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
45
+ to[j] = from[i];
46
+ return to;
51
47
  }
52
48
 
53
49
  // export const SWITCH_TO_STRUCTURE = 193; (easily collides with DELETE_AND_ADD + fieldIndex = 2)
@@ -549,7 +545,7 @@ var ArraySchema = /** @class */ (function () {
549
545
  for (var _i = 0; _i < arguments.length; _i++) {
550
546
  items[_i] = arguments[_i];
551
547
  }
552
- return new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], (_a = Array.from(this.$items.values())).concat.apply(_a, items), false)))();
548
+ return new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], (_a = Array.from(this.$items.values())).concat.apply(_a, items))))();
553
549
  };
554
550
  /**
555
551
  * Adds all the elements of an array separated by the specified separator string.
@@ -589,7 +585,7 @@ var ArraySchema = /** @class */ (function () {
589
585
  * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
590
586
  */
591
587
  ArraySchema.prototype.slice = function (start, end) {
592
- return new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], Array.from(this.$items.values()).slice(start, end), false)))();
588
+ return new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], Array.from(this.$items.values()).slice(start, end))))();
593
589
  };
594
590
  /**
595
591
  * Sorts an array.
@@ -873,12 +869,12 @@ var ArraySchema = /** @class */ (function () {
873
869
  ArraySchema.prototype.clone = function (isDecoding) {
874
870
  var cloned;
875
871
  if (isDecoding) {
876
- cloned = new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], Array.from(this.$items.values()), false)))();
872
+ cloned = new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], Array.from(this.$items.values()))))();
877
873
  }
878
874
  else {
879
875
  cloned = new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], this.map(function (item) { return ((item['$changes'])
880
876
  ? item.clone()
881
- : item); }), false)))();
877
+ : item); }))))();
882
878
  }
883
879
  return cloned;
884
880
  };
@@ -1260,7 +1256,7 @@ function type(type, context) {
1260
1256
  value !== null) {
1261
1257
  // automaticallty transform Array into ArraySchema
1262
1258
  if (isArray && !(value instanceof ArraySchema)) {
1263
- value = new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], value, false)))();
1259
+ value = new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], value)))();
1264
1260
  }
1265
1261
  // automaticallty transform Map into MapSchema
1266
1262
  if (isMap && !(value instanceof MapSchema)) {