@colyseus/schema 2.0.6 → 2.0.8
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 +17 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +15 -2
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +17 -3
- package/lib/Reflection.js.map +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/codegen/api.js +19 -0
- package/lib/codegen/api.js.map +1 -1
- package/lib/codegen/parser.js.map +1 -1
- package/lib/types/ArraySchema.d.ts +2 -0
- package/lib/types/ArraySchema.js +15 -2
- package/lib/types/ArraySchema.js.map +1 -1
- package/package.json +3 -3
- package/src/codegen/api.ts +20 -0
- package/src/codegen/parser.ts +5 -5
- package/src/types/ArraySchema.ts +17 -2
- package/lib/events/EventEmitter.d.ts +0 -13
- package/lib/events/EventEmitter.js +0 -31
- package/lib/events/EventEmitter.js.map +0 -1
- package/lib/types/index.d.ts +0 -6
- package/lib/types/index.js +0 -13
- package/lib/types/index.js.map +0 -1
package/build/cjs/index.js
CHANGED
|
@@ -518,6 +518,7 @@ var ArraySchema = /** @class */ (function () {
|
|
|
518
518
|
* Combines two or more arrays.
|
|
519
519
|
* @param items Additional items to add to the end of array1.
|
|
520
520
|
*/
|
|
521
|
+
// @ts-ignore
|
|
521
522
|
ArraySchema.prototype.concat = function () {
|
|
522
523
|
var _a;
|
|
523
524
|
var items = [];
|
|
@@ -536,6 +537,7 @@ var ArraySchema = /** @class */ (function () {
|
|
|
536
537
|
/**
|
|
537
538
|
* Reverses the elements in an Array.
|
|
538
539
|
*/
|
|
540
|
+
// @ts-ignore
|
|
539
541
|
ArraySchema.prototype.reverse = function () {
|
|
540
542
|
var _this = this;
|
|
541
543
|
var indexes = Array.from(this.$items.keys());
|
|
@@ -564,7 +566,9 @@ var ArraySchema = /** @class */ (function () {
|
|
|
564
566
|
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
|
565
567
|
*/
|
|
566
568
|
ArraySchema.prototype.slice = function (start, end) {
|
|
567
|
-
|
|
569
|
+
var sliced = new ArraySchema();
|
|
570
|
+
sliced.push.apply(sliced, Array.from(this.$items.values()).slice(start, end));
|
|
571
|
+
return sliced;
|
|
568
572
|
};
|
|
569
573
|
/**
|
|
570
574
|
* Sorts an array.
|
|
@@ -805,9 +809,18 @@ var ArraySchema = /** @class */ (function () {
|
|
|
805
809
|
*/
|
|
806
810
|
// @ts-ignore
|
|
807
811
|
ArraySchema.prototype.flat = function (depth) {
|
|
808
|
-
// @ts-ignore
|
|
809
812
|
throw new Error("ArraySchema#flat() is not supported.");
|
|
810
813
|
};
|
|
814
|
+
ArraySchema.prototype.findLast = function () {
|
|
815
|
+
var arr = Array.from(this.$items.values());
|
|
816
|
+
// @ts-ignore
|
|
817
|
+
return arr.findLast.apply(arr, arguments);
|
|
818
|
+
};
|
|
819
|
+
ArraySchema.prototype.findLastIndex = function () {
|
|
820
|
+
var arr = Array.from(this.$items.values());
|
|
821
|
+
// @ts-ignore
|
|
822
|
+
return arr.findLastIndex.apply(arr, arguments);
|
|
823
|
+
};
|
|
811
824
|
// get size () {
|
|
812
825
|
// return this.$items.size;
|
|
813
826
|
// }
|
|
@@ -2422,6 +2435,7 @@ var Schema = /** @class */ (function () {
|
|
|
2422
2435
|
return function () { return spliceOne(_this.$callbacks[attr], _this.$callbacks[attr].indexOf(callback)); };
|
|
2423
2436
|
};
|
|
2424
2437
|
Schema.prototype.decode = function (bytes, it, ref) {
|
|
2438
|
+
var _a;
|
|
2425
2439
|
if (it === void 0) { it = { offset: 0 }; }
|
|
2426
2440
|
if (ref === void 0) { ref = this; }
|
|
2427
2441
|
var allChanges = [];
|
|
@@ -2561,7 +2575,7 @@ var Schema = /** @class */ (function () {
|
|
|
2561
2575
|
var entries = previousValue.entries();
|
|
2562
2576
|
var iter = void 0;
|
|
2563
2577
|
while ((iter = entries.next()) && !iter.done) {
|
|
2564
|
-
var _a = iter.value,
|
|
2578
|
+
var key = (_a = iter.value, _a[0]), value_1 = _a[1];
|
|
2565
2579
|
allChanges.push({
|
|
2566
2580
|
refId: refId_2,
|
|
2567
2581
|
op: exports.OPERATION.DELETE,
|