@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.
- package/build/cjs/index.js +7 -12
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +7 -13
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +7 -12
- package/lib/decoder/Decoder.js +2 -3
- package/lib/decoder/Decoder.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/types/custom/ArraySchema.d.ts +1 -0
- package/lib/types/custom/ArraySchema.js +0 -9
- package/lib/types/custom/ArraySchema.js.map +1 -1
- package/package.json +1 -1
- package/src/decoder/Decoder.ts +2 -4
- package/src/index.ts +1 -1
- package/src/types/custom/ArraySchema.ts +2 -1
package/build/esm/index.mjs
CHANGED
|
@@ -2228,15 +2228,6 @@ class ArraySchema {
|
|
|
2228
2228
|
lastIndexOf(searchElement, fromIndex = this.length - 1) {
|
|
2229
2229
|
return this.items.lastIndexOf(searchElement, fromIndex);
|
|
2230
2230
|
}
|
|
2231
|
-
/**
|
|
2232
|
-
* Determines whether all the members of an array satisfy the specified test.
|
|
2233
|
-
* @param callbackfn A function that accepts up to three arguments. The every method calls
|
|
2234
|
-
* the callbackfn function for each element in the array until the callbackfn returns a value
|
|
2235
|
-
* which is coercible to the Boolean value false, or until the end of the array.
|
|
2236
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function.
|
|
2237
|
-
* If thisArg is omitted, undefined is used as the this value.
|
|
2238
|
-
*/
|
|
2239
|
-
// @ts-ignore
|
|
2240
2231
|
every(callbackfn, thisArg) {
|
|
2241
2232
|
return this.items.every(callbackfn, thisArg);
|
|
2242
2233
|
}
|
|
@@ -2691,6 +2682,10 @@ class MapSchema {
|
|
|
2691
2682
|
registerType("map", { constructor: MapSchema });
|
|
2692
2683
|
|
|
2693
2684
|
const DEFAULT_VIEW_TAG = -1;
|
|
2685
|
+
function entity(constructor) {
|
|
2686
|
+
TypeContext.register(constructor);
|
|
2687
|
+
return constructor;
|
|
2688
|
+
}
|
|
2694
2689
|
/**
|
|
2695
2690
|
* [See documentation](https://docs.colyseus.io/state/schema/)
|
|
2696
2691
|
*
|
|
@@ -4212,12 +4207,11 @@ class Decoder {
|
|
|
4212
4207
|
return new type();
|
|
4213
4208
|
}
|
|
4214
4209
|
removeChildRefs(ref, allChanges) {
|
|
4215
|
-
const changeTree = ref[$changes];
|
|
4216
4210
|
const needRemoveRef = typeof (ref[$childType]) !== "string";
|
|
4217
|
-
const refId =
|
|
4211
|
+
const refId = this.root.refIds.get(ref);
|
|
4218
4212
|
ref.forEach((value, key) => {
|
|
4219
4213
|
allChanges.push({
|
|
4220
|
-
ref:
|
|
4214
|
+
ref: ref,
|
|
4221
4215
|
refId,
|
|
4222
4216
|
op: OPERATION.DELETE,
|
|
4223
4217
|
field: key,
|
|
@@ -4874,5 +4868,5 @@ registerType("array", { constructor: ArraySchema });
|
|
|
4874
4868
|
registerType("set", { constructor: SetSchema });
|
|
4875
4869
|
registerType("collection", { constructor: CollectionSchema, });
|
|
4876
4870
|
|
|
4877
|
-
export { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $track, ArraySchema, ChangeTree, CollectionSchema, Decoder, Encoder, MapSchema, Metadata, OPERATION, Reflection, ReflectionField, ReflectionType, Schema, SetSchema, StateView, TypeContext, decode, decodeKeyValueOperation, decodeSchemaOperation, defineCustomTypes, defineTypes, deprecated, dumpChanges, encode, encodeArray as encodeKeyValueOperation, encodeSchemaOperation, getDecoderStateCallbacks, getRawChangesCallback, registerType, schema, type, view };
|
|
4871
|
+
export { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $track, ArraySchema, ChangeTree, CollectionSchema, Decoder, Encoder, MapSchema, Metadata, OPERATION, Reflection, ReflectionField, ReflectionType, Schema, SetSchema, StateView, TypeContext, decode, decodeKeyValueOperation, decodeSchemaOperation, defineCustomTypes, defineTypes, deprecated, dumpChanges, encode, encodeArray as encodeKeyValueOperation, encodeSchemaOperation, entity, getDecoderStateCallbacks, getRawChangesCallback, registerType, schema, type, view };
|
|
4878
4872
|
//# sourceMappingURL=index.mjs.map
|