@colyseus/schema 3.0.5 → 3.0.7

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.
@@ -2230,15 +2230,6 @@ class ArraySchema {
2230
2230
  lastIndexOf(searchElement, fromIndex = this.length - 1) {
2231
2231
  return this.items.lastIndexOf(searchElement, fromIndex);
2232
2232
  }
2233
- /**
2234
- * Determines whether all the members of an array satisfy the specified test.
2235
- * @param callbackfn A function that accepts up to three arguments. The every method calls
2236
- * the callbackfn function for each element in the array until the callbackfn returns a value
2237
- * which is coercible to the Boolean value false, or until the end of the array.
2238
- * @param thisArg An object to which the this keyword can refer in the callbackfn function.
2239
- * If thisArg is omitted, undefined is used as the this value.
2240
- */
2241
- // @ts-ignore
2242
2233
  every(callbackfn, thisArg) {
2243
2234
  return this.items.every(callbackfn, thisArg);
2244
2235
  }
@@ -2693,6 +2684,10 @@ class MapSchema {
2693
2684
  registerType("map", { constructor: MapSchema });
2694
2685
 
2695
2686
  const DEFAULT_VIEW_TAG = -1;
2687
+ function entity(constructor) {
2688
+ TypeContext.register(constructor);
2689
+ return constructor;
2690
+ }
2696
2691
  /**
2697
2692
  * [See documentation](https://docs.colyseus.io/state/schema/)
2698
2693
  *
@@ -4214,12 +4209,11 @@ class Decoder {
4214
4209
  return new type();
4215
4210
  }
4216
4211
  removeChildRefs(ref, allChanges) {
4217
- const changeTree = ref[$changes];
4218
4212
  const needRemoveRef = typeof (ref[$childType]) !== "string";
4219
- const refId = changeTree.refId;
4213
+ const refId = this.root.refIds.get(ref);
4220
4214
  ref.forEach((value, key) => {
4221
4215
  allChanges.push({
4222
- ref: value,
4216
+ ref: ref,
4223
4217
  refId,
4224
4218
  op: exports.OPERATION.DELETE,
4225
4219
  field: key,
@@ -4908,6 +4902,7 @@ exports.dumpChanges = dumpChanges;
4908
4902
  exports.encode = encode;
4909
4903
  exports.encodeKeyValueOperation = encodeArray;
4910
4904
  exports.encodeSchemaOperation = encodeSchemaOperation;
4905
+ exports.entity = entity;
4911
4906
  exports.getDecoderStateCallbacks = getDecoderStateCallbacks;
4912
4907
  exports.getRawChangesCallback = getRawChangesCallback;
4913
4908
  exports.registerType = registerType;