@colyseus/schema 1.0.28 → 1.0.32
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 +9 -13
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +81 -110
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +9 -13
- package/lib/Reflection.js +11 -11
- package/lib/Reflection.js.map +1 -1
- package/lib/Schema.js +2 -2
- package/lib/Schema.js.map +1 -1
- package/lib/annotations.js +8 -12
- package/lib/annotations.js.map +1 -1
- package/lib/changes/ReferenceTracker.d.ts +14 -0
- package/lib/changes/ReferenceTracker.js +77 -0
- package/lib/changes/ReferenceTracker.js.map +1 -0
- package/lib/codegen/api.js +1 -1
- package/lib/codegen/api.js.map +1 -1
- package/lib/codegen/cli.js +2 -2
- package/lib/codegen/cli.js.map +1 -1
- package/lib/codegen/languages/cpp.js +3 -3
- package/lib/codegen/languages/cpp.js.map +1 -1
- package/lib/codegen/languages/csharp.js +8 -12
- package/lib/codegen/languages/csharp.js.map +1 -1
- package/lib/codegen/languages/haxe.js +1 -1
- package/lib/codegen/languages/haxe.js.map +1 -1
- package/lib/codegen/languages/java.js +1 -1
- package/lib/codegen/languages/java.js.map +1 -1
- package/lib/codegen/languages/js.js +2 -2
- package/lib/codegen/languages/js.js.map +1 -1
- package/lib/codegen/languages/lua.js +2 -2
- package/lib/codegen/languages/lua.js.map +1 -1
- package/lib/codegen/languages/ts.js +9 -13
- package/lib/codegen/languages/ts.js.map +1 -1
- package/lib/codegen/parser.js +1 -1
- package/lib/codegen/parser.js.map +1 -1
- package/lib/codegen/types.js +14 -1
- package/lib/codegen/types.js.map +1 -1
- package/lib/events/EventEmitter.js +6 -10
- package/lib/events/EventEmitter.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/types/ArraySchema.js +8 -12
- package/lib/types/ArraySchema.js.map +1 -1
- package/lib/types/typeRegistry.d.ts +5 -0
- package/lib/types/typeRegistry.js +13 -0
- package/lib/types/typeRegistry.js.map +1 -0
- package/lib/types/utils.d.ts +9 -0
- package/lib/types/utils.js +50 -0
- package/lib/types/utils.js.map +1 -0
- package/package.json +4 -1
- package/decoders/cpp/usage_array_schema_types.cpp +0 -40
- package/decoders/cpp/usage_child_schema_types.cpp +0 -24
- package/decoders/cpp/usage_inherited_types.cpp +0 -34
- package/decoders/cpp/usage_map_schema_types.cpp +0 -35
- package/decoders/cpp/usage_primitive_types.cpp +0 -41
package/build/cjs/index.js
CHANGED
|
@@ -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
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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)
|
|
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)
|
|
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())
|
|
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); })
|
|
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
|
|
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)) {
|