@colyseus/schema 4.0.2 → 4.0.3
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/{lib → build}/Metadata.d.ts +2 -2
- package/{lib → build}/Reflection.d.ts +13 -13
- package/{lib → build}/Schema.d.ts +10 -10
- package/{lib/src → build}/annotations.d.ts +10 -10
- package/build/codegen/languages/cpp.d.ts +3 -0
- package/build/codegen/languages/csharp.d.ts +4 -0
- package/build/codegen/languages/haxe.d.ts +3 -0
- package/{lib → build}/codegen/languages/java.d.ts +2 -2
- package/build/codegen/languages/js.d.ts +3 -0
- package/build/codegen/languages/lua.d.ts +3 -0
- package/build/codegen/languages/ts.d.ts +3 -0
- package/{lib → build}/codegen/parser.d.ts +1 -1
- package/{lib → build}/decoder/DecodeOperation.d.ts +5 -5
- package/{lib/src → build}/decoder/Decoder.d.ts +7 -7
- package/{lib → build}/decoder/ReferenceTracker.d.ts +1 -1
- package/{lib → build}/decoder/strategy/Callbacks.d.ts +11 -11
- package/{lib → build}/decoder/strategy/RawChanges.d.ts +2 -2
- package/{lib → build}/decoder/strategy/getDecoderStateCallbacks.d.ts +3 -3
- package/{lib → build}/encoder/ChangeTree.d.ts +11 -11
- package/{lib → build}/encoder/EncodeOperation.d.ts +5 -5
- package/{lib → build}/encoder/Encoder.d.ts +6 -6
- package/{lib/src → build}/encoder/Root.d.ts +2 -2
- package/{lib/src → build}/encoder/StateView.d.ts +1 -1
- package/{lib/src → build}/encoding/assert.d.ts +6 -6
- package/{lib/src → build}/encoding/decode.d.ts +1 -1
- package/{lib/src → build}/encoding/encode.d.ts +1 -1
- package/build/index.cjs.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.mjs.map +1 -0
- package/{lib → build}/types/HelperTypes.d.ts +6 -6
- package/{lib → build}/types/TypeContext.d.ts +1 -1
- package/{lib/src → build}/types/custom/ArraySchema.d.ts +8 -8
- package/{lib/src → build}/types/custom/CollectionSchema.d.ts +7 -7
- package/{lib → build}/types/custom/MapSchema.d.ts +7 -7
- package/{lib/src → build}/types/custom/SetSchema.d.ts +7 -7
- package/{lib/src → build}/types/registry.d.ts +2 -2
- package/{lib → build}/utils.d.ts +1 -1
- package/package.json +9 -10
- package/src/Metadata.ts +5 -5
- package/src/Reflection.ts +7 -7
- package/src/Schema.ts +11 -11
- package/src/annotations.ts +13 -13
- package/src/codegen/api.ts +3 -3
- package/src/codegen/cli.ts +2 -2
- package/src/codegen/languages/cpp.ts +2 -2
- package/src/codegen/languages/csharp.ts +3 -3
- package/src/codegen/languages/haxe.ts +2 -2
- package/src/codegen/languages/java.ts +2 -2
- package/src/codegen/languages/js.ts +2 -2
- package/src/codegen/languages/lua.ts +2 -2
- package/src/codegen/languages/ts.ts +2 -2
- package/src/codegen/parser.ts +6 -1
- package/src/decoder/DecodeOperation.ts +14 -14
- package/src/decoder/Decoder.ts +11 -11
- package/src/decoder/ReferenceTracker.ts +8 -8
- package/src/decoder/strategy/Callbacks.ts +12 -12
- package/src/decoder/strategy/RawChanges.ts +2 -2
- package/src/decoder/strategy/getDecoderStateCallbacks.ts +10 -10
- package/src/encoder/ChangeTree.ts +13 -13
- package/src/encoder/EncodeOperation.ts +9 -9
- package/src/encoder/Encoder.ts +10 -10
- package/src/encoder/Root.ts +4 -4
- package/src/encoder/StateView.ts +7 -7
- package/src/encoding/assert.ts +6 -6
- package/src/encoding/decode.ts +1 -1
- package/src/encoding/encode.ts +1 -1
- package/src/index.ts +27 -27
- package/src/types/HelperTypes.ts +6 -6
- package/src/types/TypeContext.ts +3 -3
- package/src/types/custom/ArraySchema.ts +11 -11
- package/src/types/custom/CollectionSchema.ts +9 -9
- package/src/types/custom/MapSchema.ts +10 -10
- package/src/types/custom/SetSchema.ts +9 -9
- package/src/types/registry.ts +3 -3
- package/src/utils.ts +3 -3
- package/src/v3_bench.ts +1 -1
- package/build/cjs/index.cjs.map +0 -1
- package/build/esm/index.mjs.map +0 -1
- package/lib/Metadata.js +0 -256
- package/lib/Metadata.js.map +0 -1
- package/lib/Reflection.js +0 -179
- package/lib/Reflection.js.map +0 -1
- package/lib/Schema.js +0 -352
- package/lib/Schema.js.map +0 -1
- package/lib/annotations.d.ts +0 -109
- package/lib/annotations.js +0 -473
- package/lib/annotations.js.map +0 -1
- package/lib/bench_encode.d.ts +0 -1
- package/lib/bench_encode.js +0 -91
- package/lib/bench_encode.js.map +0 -1
- package/lib/benchmark.d.ts +0 -1
- package/lib/benchmark.js +0 -218
- package/lib/benchmark.js.map +0 -1
- package/lib/codegen/api.js +0 -56
- package/lib/codegen/api.js.map +0 -1
- package/lib/codegen/argv.js +0 -39
- package/lib/codegen/argv.js.map +0 -1
- package/lib/codegen/cli.js +0 -58
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/languages/cpp.d.ts +0 -3
- package/lib/codegen/languages/cpp.js +0 -258
- package/lib/codegen/languages/cpp.js.map +0 -1
- package/lib/codegen/languages/csharp.d.ts +0 -4
- package/lib/codegen/languages/csharp.js +0 -154
- package/lib/codegen/languages/csharp.js.map +0 -1
- package/lib/codegen/languages/haxe.d.ts +0 -3
- package/lib/codegen/languages/haxe.js +0 -100
- package/lib/codegen/languages/haxe.js.map +0 -1
- package/lib/codegen/languages/java.js +0 -100
- package/lib/codegen/languages/java.js.map +0 -1
- package/lib/codegen/languages/js.d.ts +0 -3
- package/lib/codegen/languages/js.js +0 -101
- package/lib/codegen/languages/js.js.map +0 -1
- package/lib/codegen/languages/lua.d.ts +0 -3
- package/lib/codegen/languages/lua.js +0 -103
- package/lib/codegen/languages/lua.js.map +0 -1
- package/lib/codegen/languages/ts.d.ts +0 -3
- package/lib/codegen/languages/ts.js +0 -116
- package/lib/codegen/languages/ts.js.map +0 -1
- package/lib/codegen/parser.js +0 -327
- package/lib/codegen/parser.js.map +0 -1
- package/lib/codegen/types.js +0 -142
- package/lib/codegen/types.js.map +0 -1
- package/lib/decoder/DecodeOperation.js +0 -248
- package/lib/decoder/DecodeOperation.js.map +0 -1
- package/lib/decoder/Decoder.d.ts +0 -21
- package/lib/decoder/Decoder.js +0 -114
- package/lib/decoder/Decoder.js.map +0 -1
- package/lib/decoder/ReferenceTracker.js +0 -135
- package/lib/decoder/ReferenceTracker.js.map +0 -1
- package/lib/decoder/strategy/Callbacks.js +0 -336
- package/lib/decoder/strategy/Callbacks.js.map +0 -1
- package/lib/decoder/strategy/RawChanges.js +0 -4
- package/lib/decoder/strategy/RawChanges.js.map +0 -1
- package/lib/decoder/strategy/getDecoderStateCallbacks.js +0 -274
- package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
- package/lib/encoder/ChangeTree.js +0 -534
- package/lib/encoder/ChangeTree.js.map +0 -1
- package/lib/encoder/EncodeOperation.js +0 -132
- package/lib/encoder/EncodeOperation.js.map +0 -1
- package/lib/encoder/Encoder.js +0 -204
- package/lib/encoder/Encoder.js.map +0 -1
- package/lib/encoder/Root.d.ts +0 -28
- package/lib/encoder/Root.js +0 -229
- package/lib/encoder/Root.js.map +0 -1
- package/lib/encoder/StateView.d.ts +0 -34
- package/lib/encoder/StateView.js +0 -279
- package/lib/encoder/StateView.js.map +0 -1
- package/lib/encoding/assert.d.ts +0 -10
- package/lib/encoding/assert.js +0 -49
- package/lib/encoding/assert.js.map +0 -1
- package/lib/encoding/decode.d.ts +0 -67
- package/lib/encoding/decode.js +0 -217
- package/lib/encoding/decode.js.map +0 -1
- package/lib/encoding/encode.d.ts +0 -40
- package/lib/encoding/encode.js +0 -279
- package/lib/encoding/encode.js.map +0 -1
- package/lib/encoding/spec.js +0 -26
- package/lib/encoding/spec.js.map +0 -1
- package/lib/index.d.ts +0 -32
- package/lib/index.js +0 -39
- package/lib/index.js.map +0 -1
- package/lib/src/Metadata.d.ts +0 -49
- package/lib/src/Metadata.js +0 -256
- package/lib/src/Metadata.js.map +0 -1
- package/lib/src/Reflection.d.ts +0 -71
- package/lib/src/Reflection.js +0 -179
- package/lib/src/Reflection.js.map +0 -1
- package/lib/src/Schema.d.ts +0 -86
- package/lib/src/Schema.js +0 -352
- package/lib/src/Schema.js.map +0 -1
- package/lib/src/annotations.js +0 -473
- package/lib/src/annotations.js.map +0 -1
- package/lib/src/bench_encode.d.ts +0 -1
- package/lib/src/bench_encode.js +0 -91
- package/lib/src/bench_encode.js.map +0 -1
- package/lib/src/codegen/api.d.ts +0 -7
- package/lib/src/codegen/api.js +0 -56
- package/lib/src/codegen/api.js.map +0 -1
- package/lib/src/codegen/argv.d.ts +0 -6
- package/lib/src/codegen/argv.js +0 -39
- package/lib/src/codegen/argv.js.map +0 -1
- package/lib/src/codegen/cli.d.ts +0 -1
- package/lib/src/codegen/cli.js +0 -58
- package/lib/src/codegen/cli.js.map +0 -1
- package/lib/src/codegen/languages/cpp.d.ts +0 -3
- package/lib/src/codegen/languages/cpp.js +0 -258
- package/lib/src/codegen/languages/cpp.js.map +0 -1
- package/lib/src/codegen/languages/csharp.d.ts +0 -4
- package/lib/src/codegen/languages/csharp.js +0 -154
- package/lib/src/codegen/languages/csharp.js.map +0 -1
- package/lib/src/codegen/languages/haxe.d.ts +0 -3
- package/lib/src/codegen/languages/haxe.js +0 -100
- package/lib/src/codegen/languages/haxe.js.map +0 -1
- package/lib/src/codegen/languages/java.d.ts +0 -6
- package/lib/src/codegen/languages/java.js +0 -100
- package/lib/src/codegen/languages/java.js.map +0 -1
- package/lib/src/codegen/languages/js.d.ts +0 -3
- package/lib/src/codegen/languages/js.js +0 -101
- package/lib/src/codegen/languages/js.js.map +0 -1
- package/lib/src/codegen/languages/lua.d.ts +0 -3
- package/lib/src/codegen/languages/lua.js +0 -103
- package/lib/src/codegen/languages/lua.js.map +0 -1
- package/lib/src/codegen/languages/ts.d.ts +0 -3
- package/lib/src/codegen/languages/ts.js +0 -116
- package/lib/src/codegen/languages/ts.js.map +0 -1
- package/lib/src/codegen/parser.d.ts +0 -13
- package/lib/src/codegen/parser.js +0 -327
- package/lib/src/codegen/parser.js.map +0 -1
- package/lib/src/codegen/types.d.ts +0 -52
- package/lib/src/codegen/types.js +0 -142
- package/lib/src/codegen/types.js.map +0 -1
- package/lib/src/decoder/DecodeOperation.d.ts +0 -23
- package/lib/src/decoder/DecodeOperation.js +0 -248
- package/lib/src/decoder/DecodeOperation.js.map +0 -1
- package/lib/src/decoder/Decoder.js +0 -114
- package/lib/src/decoder/Decoder.js.map +0 -1
- package/lib/src/decoder/ReferenceTracker.d.ts +0 -25
- package/lib/src/decoder/ReferenceTracker.js +0 -135
- package/lib/src/decoder/ReferenceTracker.js.map +0 -1
- package/lib/src/decoder/strategy/Callbacks.d.ts +0 -154
- package/lib/src/decoder/strategy/Callbacks.js +0 -336
- package/lib/src/decoder/strategy/Callbacks.js.map +0 -1
- package/lib/src/decoder/strategy/RawChanges.d.ts +0 -3
- package/lib/src/decoder/strategy/RawChanges.js +0 -4
- package/lib/src/decoder/strategy/RawChanges.js.map +0 -1
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.d.ts +0 -76
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.js +0 -274
- package/lib/src/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
- package/lib/src/encoder/ChangeTree.d.ts +0 -135
- package/lib/src/encoder/ChangeTree.js +0 -534
- package/lib/src/encoder/ChangeTree.js.map +0 -1
- package/lib/src/encoder/EncodeOperation.d.ts +0 -22
- package/lib/src/encoder/EncodeOperation.js +0 -132
- package/lib/src/encoder/EncodeOperation.js.map +0 -1
- package/lib/src/encoder/Encoder.d.ts +0 -22
- package/lib/src/encoder/Encoder.js +0 -204
- package/lib/src/encoder/Encoder.js.map +0 -1
- package/lib/src/encoder/Root.js +0 -229
- package/lib/src/encoder/Root.js.map +0 -1
- package/lib/src/encoder/StateView.js +0 -279
- package/lib/src/encoder/StateView.js.map +0 -1
- package/lib/src/encoding/assert.js +0 -49
- package/lib/src/encoding/assert.js.map +0 -1
- package/lib/src/encoding/decode.js +0 -217
- package/lib/src/encoding/decode.js.map +0 -1
- package/lib/src/encoding/encode.js +0 -279
- package/lib/src/encoding/encode.js.map +0 -1
- package/lib/src/encoding/spec.d.ts +0 -24
- package/lib/src/encoding/spec.js +0 -26
- package/lib/src/encoding/spec.js.map +0 -1
- package/lib/src/index.d.ts +0 -32
- package/lib/src/index.js +0 -39
- package/lib/src/index.js.map +0 -1
- package/lib/src/symbol.shim.js +0 -3
- package/lib/src/symbol.shim.js.map +0 -1
- package/lib/src/types/HelperTypes.d.ts +0 -77
- package/lib/src/types/HelperTypes.js +0 -2
- package/lib/src/types/HelperTypes.js.map +0 -1
- package/lib/src/types/TypeContext.d.ts +0 -31
- package/lib/src/types/TypeContext.js +0 -143
- package/lib/src/types/TypeContext.js.map +0 -1
- package/lib/src/types/custom/ArraySchema.js +0 -733
- package/lib/src/types/custom/ArraySchema.js.map +0 -1
- package/lib/src/types/custom/CollectionSchema.js +0 -170
- package/lib/src/types/custom/CollectionSchema.js.map +0 -1
- package/lib/src/types/custom/MapSchema.d.ts +0 -51
- package/lib/src/types/custom/MapSchema.js +0 -222
- package/lib/src/types/custom/MapSchema.js.map +0 -1
- package/lib/src/types/custom/SetSchema.js +0 -178
- package/lib/src/types/custom/SetSchema.js.map +0 -1
- package/lib/src/types/registry.js +0 -30
- package/lib/src/types/registry.js.map +0 -1
- package/lib/src/types/symbols.js +0 -34
- package/lib/src/types/symbols.js.map +0 -1
- package/lib/src/types/utils.js +0 -13
- package/lib/src/types/utils.js.map +0 -1
- package/lib/src/utils.d.ts +0 -13
- package/lib/src/utils.js +0 -49
- package/lib/src/utils.js.map +0 -1
- package/lib/src/v3_bench.js +0 -128
- package/lib/src/v3_bench.js.map +0 -1
- package/lib/symbol.shim.d.ts +0 -6
- package/lib/symbol.shim.js +0 -3
- package/lib/symbol.shim.js.map +0 -1
- package/lib/types/HelperTypes.js +0 -2
- package/lib/types/HelperTypes.js.map +0 -1
- package/lib/types/TypeContext.js +0 -143
- package/lib/types/TypeContext.js.map +0 -1
- package/lib/types/custom/ArraySchema.d.ts +0 -270
- package/lib/types/custom/ArraySchema.js +0 -733
- package/lib/types/custom/ArraySchema.js.map +0 -1
- package/lib/types/custom/CollectionSchema.d.ts +0 -51
- package/lib/types/custom/CollectionSchema.js +0 -170
- package/lib/types/custom/CollectionSchema.js.map +0 -1
- package/lib/types/custom/MapSchema.js +0 -222
- package/lib/types/custom/MapSchema.js.map +0 -1
- package/lib/types/custom/SetSchema.d.ts +0 -48
- package/lib/types/custom/SetSchema.js +0 -178
- package/lib/types/custom/SetSchema.js.map +0 -1
- package/lib/types/registry.d.ts +0 -16
- package/lib/types/registry.js +0 -30
- package/lib/types/registry.js.map +0 -1
- package/lib/types/symbols.d.ts +0 -33
- package/lib/types/symbols.js +0 -34
- package/lib/types/symbols.js.map +0 -1
- package/lib/types/utils.d.ts +0 -1
- package/lib/types/utils.js +0 -13
- package/lib/types/utils.js.map +0 -1
- package/lib/utils.js +0 -49
- package/lib/utils.js.map +0 -1
- package/lib/v3_bench.d.ts +0 -1
- package/lib/v3_bench.js +0 -128
- package/lib/v3_bench.js.map +0 -1
- /package/{lib → build}/codegen/api.d.ts +0 -0
- /package/{lib → build}/codegen/argv.d.ts +0 -0
- /package/{lib → build}/codegen/cli.d.ts +0 -0
- /package/{lib → build}/codegen/types.d.ts +0 -0
- /package/{lib → build}/encoding/spec.d.ts +0 -0
- /package/build/{cjs/index.cjs → index.cjs} +0 -0
- /package/build/{umd/index.js → index.js} +0 -0
- /package/build/{esm/index.mjs → index.mjs} +0 -0
- /package/{lib/src → build}/symbol.shim.d.ts +0 -0
- /package/{lib/src → build}/types/symbols.d.ts +0 -0
- /package/{lib/src → build}/types/utils.d.ts +0 -0
- /package/{lib/src → build}/v3_bench.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Definition, DefinitionType, PrimitiveType } from "../annotations";
|
|
2
|
-
import type { Schema } from "../Schema";
|
|
3
|
-
import type { ArraySchema } from "./custom/ArraySchema";
|
|
4
|
-
import type { CollectionSchema } from "./custom/CollectionSchema";
|
|
5
|
-
import type { MapSchema } from "./custom/MapSchema";
|
|
6
|
-
import type { SetSchema } from "./custom/SetSchema";
|
|
1
|
+
import type { Definition, DefinitionType, PrimitiveType } from "../annotations.js";
|
|
2
|
+
import type { Schema } from "../Schema.js";
|
|
3
|
+
import type { ArraySchema } from "./custom/ArraySchema.js";
|
|
4
|
+
import type { CollectionSchema } from "./custom/CollectionSchema.js";
|
|
5
|
+
import type { MapSchema } from "./custom/MapSchema.js";
|
|
6
|
+
import type { SetSchema } from "./custom/SetSchema.js";
|
|
7
7
|
export type Constructor<T = {}> = new (...args: any[]) => T;
|
|
8
8
|
type PrimitiveStringToType<T> = T extends "string" ? string : T extends "number" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64" | "float32" | "float64" ? number : T extends "boolean" ? boolean : T;
|
|
9
9
|
export interface Collection<K = any, V = any, IT = V> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $onDecodeEnd, $refId } from "../symbols";
|
|
2
|
-
import type { Schema } from "../../Schema";
|
|
3
|
-
import { type IRef, ChangeTree } from "../../encoder/ChangeTree";
|
|
4
|
-
import { OPERATION } from "../../encoding/spec";
|
|
5
|
-
import { Collection } from "../HelperTypes";
|
|
6
|
-
import type { StateView } from "../../encoder/StateView";
|
|
1
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $onDecodeEnd, $refId } from "../symbols.js";
|
|
2
|
+
import type { Schema } from "../../Schema.js";
|
|
3
|
+
import { type IRef, ChangeTree } from "../../encoder/ChangeTree.js";
|
|
4
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
5
|
+
import { Collection } from "../HelperTypes.js";
|
|
6
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
7
7
|
export declare class ArraySchema<V = any> implements Array<V>, Collection<number, V>, IRef {
|
|
8
8
|
[n: number]: V;
|
|
9
9
|
[$changes]: ChangeTree;
|
|
@@ -15,8 +15,8 @@ export declare class ArraySchema<V = any> implements Array<V>, Collection<number
|
|
|
15
15
|
[index: number]: boolean;
|
|
16
16
|
};
|
|
17
17
|
protected isMovingItems: boolean;
|
|
18
|
-
static [$encoder]: import("../../encoder/EncodeOperation").EncodeOperation<any>;
|
|
19
|
-
static [$decoder]: import("../../decoder/DecodeOperation").DecodeOperation<any>;
|
|
18
|
+
static [$encoder]: import("../../encoder/EncodeOperation.js").EncodeOperation<any>;
|
|
19
|
+
static [$decoder]: import("../../decoder/DecodeOperation.js").DecodeOperation<any>;
|
|
20
20
|
/**
|
|
21
21
|
* Determine if a property must be filtered.
|
|
22
22
|
* - If returns false, the property is NOT going to be encoded.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols";
|
|
2
|
-
import { ChangeTree, type IRef } from "../../encoder/ChangeTree";
|
|
3
|
-
import { Collection } from "../HelperTypes";
|
|
4
|
-
import type { StateView } from "../../encoder/StateView";
|
|
5
|
-
import type { Schema } from "../../Schema";
|
|
1
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols.js";
|
|
2
|
+
import { ChangeTree, type IRef } from "../../encoder/ChangeTree.js";
|
|
3
|
+
import { Collection } from "../HelperTypes.js";
|
|
4
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
5
|
+
import type { Schema } from "../../Schema.js";
|
|
6
6
|
type K = number;
|
|
7
7
|
export declare class CollectionSchema<V = any> implements Collection<K, V>, IRef {
|
|
8
8
|
[$changes]: ChangeTree;
|
|
@@ -14,8 +14,8 @@ export declare class CollectionSchema<V = any> implements Collection<K, V>, IRef
|
|
|
14
14
|
[field: string]: V;
|
|
15
15
|
};
|
|
16
16
|
protected $refId: number;
|
|
17
|
-
static [$encoder]: import("../../encoder/EncodeOperation").EncodeOperation<any>;
|
|
18
|
-
static [$decoder]: import("../../decoder/DecodeOperation").DecodeOperation<any>;
|
|
17
|
+
static [$encoder]: import("../../encoder/EncodeOperation.js").EncodeOperation<any>;
|
|
18
|
+
static [$decoder]: import("../../decoder/DecodeOperation.js").DecodeOperation<any>;
|
|
19
19
|
/**
|
|
20
20
|
* Determine if a property must be filtered.
|
|
21
21
|
* - If returns false, the property is NOT going to be encoded.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $refId } from "../symbols";
|
|
2
|
-
import { ChangeTree, IRef } from "../../encoder/ChangeTree";
|
|
3
|
-
import { Collection } from "../HelperTypes";
|
|
4
|
-
import type { StateView } from "../../encoder/StateView";
|
|
5
|
-
import type { Schema } from "../../Schema";
|
|
1
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $refId } from "../symbols.js";
|
|
2
|
+
import { ChangeTree, IRef } from "../../encoder/ChangeTree.js";
|
|
3
|
+
import { Collection } from "../HelperTypes.js";
|
|
4
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
5
|
+
import type { Schema } from "../../Schema.js";
|
|
6
6
|
export declare class MapSchema<V = any, K extends string = string> implements Map<K, V>, Collection<K, V, [K, V]>, IRef {
|
|
7
7
|
[$changes]: ChangeTree;
|
|
8
8
|
[$refId]?: number;
|
|
@@ -13,8 +13,8 @@ export declare class MapSchema<V = any, K extends string = string> implements Ma
|
|
|
13
13
|
protected deletedItems: {
|
|
14
14
|
[index: string]: V;
|
|
15
15
|
};
|
|
16
|
-
static [$encoder]: import("../../encoder/EncodeOperation").EncodeOperation<any>;
|
|
17
|
-
static [$decoder]: import("../../decoder/DecodeOperation").DecodeOperation<any>;
|
|
16
|
+
static [$encoder]: import("../../encoder/EncodeOperation.js").EncodeOperation<any>;
|
|
17
|
+
static [$decoder]: import("../../decoder/DecodeOperation.js").DecodeOperation<any>;
|
|
18
18
|
/**
|
|
19
19
|
* Determine if a property must be filtered.
|
|
20
20
|
* - If returns false, the property is NOT going to be encoded.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols";
|
|
2
|
-
import { Collection } from "../HelperTypes";
|
|
3
|
-
import { ChangeTree, type IRef } from "../../encoder/ChangeTree";
|
|
4
|
-
import type { StateView } from "../../encoder/StateView";
|
|
5
|
-
import type { Schema } from "../../Schema";
|
|
1
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols.js";
|
|
2
|
+
import { Collection } from "../HelperTypes.js";
|
|
3
|
+
import { ChangeTree, type IRef } from "../../encoder/ChangeTree.js";
|
|
4
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
5
|
+
import type { Schema } from "../../Schema.js";
|
|
6
6
|
export declare class SetSchema<V = any> implements Collection<number, V>, IRef {
|
|
7
7
|
[$changes]: ChangeTree;
|
|
8
8
|
[$refId]?: number;
|
|
@@ -13,8 +13,8 @@ export declare class SetSchema<V = any> implements Collection<number, V>, IRef {
|
|
|
13
13
|
[field: string]: V;
|
|
14
14
|
};
|
|
15
15
|
protected $refId: number;
|
|
16
|
-
static [$encoder]: import("../../encoder/EncodeOperation").EncodeOperation<any>;
|
|
17
|
-
static [$decoder]: import("../../decoder/DecodeOperation").DecodeOperation<any>;
|
|
16
|
+
static [$encoder]: import("../../encoder/EncodeOperation.js").EncodeOperation<any>;
|
|
17
|
+
static [$decoder]: import("../../decoder/DecodeOperation.js").DecodeOperation<any>;
|
|
18
18
|
/**
|
|
19
19
|
* Determine if a property must be filtered.
|
|
20
20
|
* - If returns false, the property is NOT going to be encoded.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BufferLike } from "../encoding/encode";
|
|
2
|
-
import { Iterator } from "../encoding/decode";
|
|
1
|
+
import { BufferLike } from "../encoding/encode.js";
|
|
2
|
+
import { Iterator } from "../encoding/decode.js";
|
|
3
3
|
export interface TypeDefinition {
|
|
4
4
|
constructor?: any;
|
|
5
5
|
encode?: (bytes: BufferLike, value: any, it: Iterator) => any;
|
package/{lib → build}/utils.d.ts
RENAMED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/schema",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Binary state serializer with delta encoding for games",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,20 +28,19 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
|
31
|
-
"lib",
|
|
32
31
|
"build",
|
|
33
32
|
"bin"
|
|
34
33
|
],
|
|
35
|
-
"types": "
|
|
36
|
-
"main": "build/
|
|
37
|
-
"module": "build/
|
|
38
|
-
"browser": "./build/
|
|
34
|
+
"types": "./build/index.d.ts",
|
|
35
|
+
"main": "./build/index.cjs",
|
|
36
|
+
"module": "./build/index.mjs",
|
|
37
|
+
"browser": "./build/index.js",
|
|
39
38
|
"exports": {
|
|
40
39
|
".": {
|
|
41
|
-
"browser": "./build/
|
|
42
|
-
"import": "./build/
|
|
43
|
-
"require": "./build/
|
|
44
|
-
"types": "./
|
|
40
|
+
"browser": "./build/index.mjs",
|
|
41
|
+
"import": "./build/index.mjs",
|
|
42
|
+
"require": "./build/index.cjs",
|
|
43
|
+
"types": "./build/index.d.ts"
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
46
|
"repository": {
|
package/src/Metadata.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DefinitionType, getPropertyDescriptor } from "./annotations";
|
|
2
|
-
import { Schema } from "./Schema";
|
|
3
|
-
import { getType, registeredTypes } from "./types/registry";
|
|
4
|
-
import { $decoder, $descriptors, $encoder, $fieldIndexesByViewTag, $numFields, $refTypeFieldIndexes, $track, $viewFieldIndexes } from "./types/symbols";
|
|
5
|
-
import { TypeContext } from "./types/TypeContext";
|
|
1
|
+
import { DefinitionType, getPropertyDescriptor } from "./annotations.js";
|
|
2
|
+
import { Schema } from "./Schema.js";
|
|
3
|
+
import { getType, registeredTypes } from "./types/registry.js";
|
|
4
|
+
import { $decoder, $descriptors, $encoder, $fieldIndexesByViewTag, $numFields, $refTypeFieldIndexes, $track, $viewFieldIndexes } from "./types/symbols.js";
|
|
5
|
+
import { TypeContext } from "./types/TypeContext.js";
|
|
6
6
|
|
|
7
7
|
export type MetadataField = {
|
|
8
8
|
type: DefinitionType,
|
package/src/Reflection.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PrimitiveType, schema, SchemaType } from "./annotations";
|
|
2
|
-
import { TypeContext } from "./types/TypeContext";
|
|
3
|
-
import { Metadata } from "./Metadata";
|
|
4
|
-
import { Iterator } from "./encoding/decode";
|
|
5
|
-
import { Encoder } from "./encoder/Encoder";
|
|
6
|
-
import { Decoder } from "./decoder/Decoder";
|
|
7
|
-
import { Schema } from "./Schema";
|
|
1
|
+
import { PrimitiveType, schema, SchemaType } from "./annotations.js";
|
|
2
|
+
import { TypeContext } from "./types/TypeContext.js";
|
|
3
|
+
import { Metadata } from "./Metadata.js";
|
|
4
|
+
import { Iterator } from "./encoding/decode.js";
|
|
5
|
+
import { Encoder } from "./encoder/Encoder.js";
|
|
6
|
+
import { Decoder } from "./decoder/Decoder.js";
|
|
7
|
+
import { Schema } from "./Schema.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Static methods available on Reflection
|
package/src/Schema.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { OPERATION } from './encoding/spec';
|
|
2
|
-
import { DEFAULT_VIEW_TAG, type DefinitionType } from "./annotations";
|
|
1
|
+
import { OPERATION } from './encoding/spec.js';
|
|
2
|
+
import { DEFAULT_VIEW_TAG, type DefinitionType } from "./annotations.js";
|
|
3
3
|
|
|
4
|
-
import { AssignableProps, NonFunctionPropNames, ToJSON } from './types/HelperTypes';
|
|
4
|
+
import { AssignableProps, NonFunctionPropNames, ToJSON } from './types/HelperTypes.js';
|
|
5
5
|
|
|
6
|
-
import { ChangeSet, ChangeSetName, ChangeTree, IRef, Ref } from './encoder/ChangeTree';
|
|
7
|
-
import { $changes, $decoder, $deleteByIndex, $descriptors, $encoder, $filter, $getByIndex, $refId, $track } from './types/symbols';
|
|
8
|
-
import { StateView } from './encoder/StateView';
|
|
6
|
+
import { ChangeSet, ChangeSetName, ChangeTree, IRef, Ref } from './encoder/ChangeTree.js';
|
|
7
|
+
import { $changes, $decoder, $deleteByIndex, $descriptors, $encoder, $filter, $getByIndex, $refId, $track } from './types/symbols.js';
|
|
8
|
+
import { StateView } from './encoder/StateView.js';
|
|
9
9
|
|
|
10
|
-
import { encodeSchemaOperation } from './encoder/EncodeOperation';
|
|
11
|
-
import { decodeSchemaOperation } from './decoder/DecodeOperation';
|
|
10
|
+
import { encodeSchemaOperation } from './encoder/EncodeOperation.js';
|
|
11
|
+
import { decodeSchemaOperation } from './decoder/DecodeOperation.js';
|
|
12
12
|
|
|
13
|
-
import type { Decoder } from './decoder/Decoder';
|
|
14
|
-
import type { Metadata, MetadataField } from './Metadata';
|
|
15
|
-
import { getIndent } from './utils';
|
|
13
|
+
import type { Decoder } from './decoder/Decoder.js';
|
|
14
|
+
import type { Metadata, MetadataField } from './Metadata.js';
|
|
15
|
+
import { getIndent } from './utils.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Schema encoder / decoder
|
package/src/annotations.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "./symbol.shim";
|
|
2
|
-
import { Schema } from './Schema';
|
|
3
|
-
import { ArraySchema } from './types/custom/ArraySchema';
|
|
4
|
-
import { MapSchema } from './types/custom/MapSchema';
|
|
5
|
-
import { getNormalizedType, Metadata } from "./Metadata";
|
|
6
|
-
import { $changes, $childType, $descriptors, $numFields, $track } from "./types/symbols";
|
|
7
|
-
import { TypeDefinition, getType } from "./types/registry";
|
|
8
|
-
import { OPERATION } from "./encoding/spec";
|
|
9
|
-
import { TypeContext } from "./types/TypeContext";
|
|
10
|
-
import { assertInstanceType, assertType } from "./encoding/assert";
|
|
11
|
-
import type { InferValueType, InferSchemaInstanceType, AssignableProps, IsNever } from "./types/HelperTypes";
|
|
12
|
-
import { CollectionSchema } from "./types/custom/CollectionSchema";
|
|
13
|
-
import { SetSchema } from "./types/custom/SetSchema";
|
|
1
|
+
import "./symbol.shim.js";
|
|
2
|
+
import { Schema } from './Schema.js';
|
|
3
|
+
import { ArraySchema } from './types/custom/ArraySchema.js';
|
|
4
|
+
import { MapSchema } from './types/custom/MapSchema.js';
|
|
5
|
+
import { getNormalizedType, Metadata } from "./Metadata.js";
|
|
6
|
+
import { $changes, $childType, $descriptors, $numFields, $track } from "./types/symbols.js";
|
|
7
|
+
import { TypeDefinition, getType } from "./types/registry.js";
|
|
8
|
+
import { OPERATION } from "./encoding/spec.js";
|
|
9
|
+
import { TypeContext } from "./types/TypeContext.js";
|
|
10
|
+
import { assertInstanceType, assertType } from "./encoding/assert.js";
|
|
11
|
+
import type { InferValueType, InferSchemaInstanceType, AssignableProps, IsNever } from "./types/HelperTypes.js";
|
|
12
|
+
import { CollectionSchema } from "./types/custom/CollectionSchema.js";
|
|
13
|
+
import { SetSchema } from "./types/custom/SetSchema.js";
|
|
14
14
|
|
|
15
15
|
export type RawPrimitiveType = "string" |
|
|
16
16
|
"number" |
|
package/src/codegen/api.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as path from "path";
|
|
|
3
3
|
import { createRequire } from "module";
|
|
4
4
|
// import { fileURLToPath } from "url";
|
|
5
5
|
|
|
6
|
-
import { File } from "./types";
|
|
7
|
-
import { parseFiles } from "./parser";
|
|
6
|
+
import { File } from "./types.js";
|
|
7
|
+
import { parseFiles } from "./parser.js";
|
|
8
8
|
|
|
9
9
|
// Create require relative to this file's location (for ESM compatibility)
|
|
10
10
|
// const __filename = fileURLToPath(import.meta.url);
|
|
@@ -22,7 +22,7 @@ export function generate(targetId: string, options: GenerateOptions) {
|
|
|
22
22
|
let generator: Function;
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
generator = require('./languages/' + targetId).generate;
|
|
25
|
+
generator = require('./languages/' + targetId + '.js').generate;
|
|
26
26
|
|
|
27
27
|
} catch (e) {
|
|
28
28
|
throw new Error("You must provide a valid generator as argument, such as: --csharp, --haxe or --cpp");
|
package/src/codegen/cli.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
const typeMaps: { [key: string]: string } = {
|
|
5
5
|
"string": "string",
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
getCommentHeader,
|
|
6
6
|
Interface,
|
|
7
7
|
Enum,
|
|
8
|
-
} from "../types";
|
|
9
|
-
import { GenerateOptions } from "../api";
|
|
10
|
-
import { Context } from "../types";
|
|
8
|
+
} from "../types.js";
|
|
9
|
+
import { GenerateOptions } from "../api.js";
|
|
10
|
+
import { Context } from "../types.js";
|
|
11
11
|
|
|
12
12
|
const typeMaps: { [key: string]: string } = {
|
|
13
13
|
"string": "string",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, Context } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, Context } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
const typeMaps: { [key: string]: string } = {
|
|
5
5
|
"string": "String",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, Context } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, Context } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
const typeMaps: { [key: string]: string } = {
|
|
5
5
|
"string": "String",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
const typeMaps: { [key: string]: string } = {
|
|
5
5
|
"string": "string",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
TODO:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context, Interface } from "../types";
|
|
2
|
-
import { GenerateOptions } from "../api";
|
|
1
|
+
import { Class, Property, File, getCommentHeader, getInheritanceTree, Context, Interface } from "../types.js";
|
|
2
|
+
import { GenerateOptions } from "../api.js";
|
|
3
3
|
|
|
4
4
|
const typeMaps: { [key: string]: string } = {
|
|
5
5
|
"string": "string",
|
package/src/codegen/parser.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
|
-
import { IStructure, Class, Interface, Property, Context, Enum } from "./types";
|
|
4
|
+
import { IStructure, Class, Interface, Property, Context, Enum } from "./types.js";
|
|
5
5
|
|
|
6
6
|
let currentStructure: IStructure;
|
|
7
7
|
let currentProperty: Property;
|
|
@@ -358,6 +358,11 @@ export function parseFiles(
|
|
|
358
358
|
fileNameAlternatives.push(`${fileName}.ts`);
|
|
359
359
|
fileNameAlternatives.push(`${fileName}/index.ts`);
|
|
360
360
|
|
|
361
|
+
} else if (fileName.endsWith(".js")) {
|
|
362
|
+
// Handle .js extensions by also trying .ts (ESM imports often use .js extension)
|
|
363
|
+
fileNameAlternatives.push(fileName);
|
|
364
|
+
fileNameAlternatives.push(fileName.replace(/\.js$/, ".ts"));
|
|
365
|
+
|
|
361
366
|
} else {
|
|
362
367
|
fileNameAlternatives.push(fileName);
|
|
363
368
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { OPERATION } from "../encoding/spec";
|
|
2
|
-
import { Metadata } from "../Metadata";
|
|
3
|
-
import { Schema } from "../Schema";
|
|
4
|
-
import type { Ref } from "../encoder/ChangeTree";
|
|
5
|
-
import type { Decoder } from "./Decoder";
|
|
6
|
-
import { Iterator, decode } from "../encoding/decode";
|
|
7
|
-
import { $childType, $deleteByIndex, $getByIndex, $refId } from "../types/symbols";
|
|
8
|
-
|
|
9
|
-
import type { MapSchema } from "../types/custom/MapSchema";
|
|
10
|
-
import type { ArraySchema } from "../types/custom/ArraySchema";
|
|
11
|
-
import type { CollectionSchema } from "../types/custom/CollectionSchema";
|
|
12
|
-
|
|
13
|
-
import { getType } from "../types/registry";
|
|
14
|
-
import { Collection } from "../types/HelperTypes";
|
|
1
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
2
|
+
import { Metadata } from "../Metadata.js";
|
|
3
|
+
import { Schema } from "../Schema.js";
|
|
4
|
+
import type { Ref } from "../encoder/ChangeTree.js";
|
|
5
|
+
import type { Decoder } from "./Decoder.js";
|
|
6
|
+
import { Iterator, decode } from "../encoding/decode.js";
|
|
7
|
+
import { $childType, $deleteByIndex, $getByIndex, $refId } from "../types/symbols.js";
|
|
8
|
+
|
|
9
|
+
import type { MapSchema } from "../types/custom/MapSchema.js";
|
|
10
|
+
import type { ArraySchema } from "../types/custom/ArraySchema.js";
|
|
11
|
+
import type { CollectionSchema } from "../types/custom/CollectionSchema.js";
|
|
12
|
+
|
|
13
|
+
import { getType } from "../types/registry.js";
|
|
14
|
+
import { Collection } from "../types/HelperTypes.js";
|
|
15
15
|
|
|
16
16
|
export interface DataChange<T = any, F = string> {
|
|
17
17
|
ref: Ref,
|
package/src/decoder/Decoder.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { TypeContext } from "../types/TypeContext";
|
|
2
|
-
import { $changes, $childType, $decoder, $onDecodeEnd, $refId } from "../types/symbols";
|
|
3
|
-
import { Schema } from "../Schema";
|
|
4
|
-
|
|
5
|
-
import { decode } from "../encoding/decode";
|
|
6
|
-
import { OPERATION, SWITCH_TO_STRUCTURE, TYPE_ID } from '../encoding/spec';
|
|
7
|
-
import type { Ref } from "../encoder/ChangeTree";
|
|
8
|
-
import type { Iterator } from "../encoding/decode";
|
|
9
|
-
import { ReferenceTracker } from "./ReferenceTracker";
|
|
10
|
-
import { DEFINITION_MISMATCH, type DataChange, type DecodeOperation } from "./DecodeOperation";
|
|
11
|
-
import { Collection } from "../types/HelperTypes";
|
|
1
|
+
import { TypeContext } from "../types/TypeContext.js";
|
|
2
|
+
import { $changes, $childType, $decoder, $onDecodeEnd, $refId } from "../types/symbols.js";
|
|
3
|
+
import { Schema } from "../Schema.js";
|
|
4
|
+
|
|
5
|
+
import { decode } from "../encoding/decode.js";
|
|
6
|
+
import { OPERATION, SWITCH_TO_STRUCTURE, TYPE_ID } from '../encoding/spec.js';
|
|
7
|
+
import type { Ref } from "../encoder/ChangeTree.js";
|
|
8
|
+
import type { Iterator } from "../encoding/decode.js";
|
|
9
|
+
import { ReferenceTracker } from "./ReferenceTracker.js";
|
|
10
|
+
import { DEFINITION_MISMATCH, type DataChange, type DecodeOperation } from "./DecodeOperation.js";
|
|
11
|
+
import { Collection } from "../types/HelperTypes.js";
|
|
12
12
|
|
|
13
13
|
export class Decoder<T extends Schema = any> {
|
|
14
14
|
context: TypeContext;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Metadata } from "../Metadata";
|
|
2
|
-
import { $childType, $refId } from "../types/symbols";
|
|
3
|
-
import { Ref } from "../encoder/ChangeTree";
|
|
4
|
-
import { spliceOne } from "../types/utils";
|
|
5
|
-
import { OPERATION } from "../encoding/spec";
|
|
6
|
-
|
|
7
|
-
import type { MapSchema } from "../types/custom/MapSchema";
|
|
8
|
-
import type { Schema } from "../Schema";
|
|
1
|
+
import { Metadata } from "../Metadata.js";
|
|
2
|
+
import { $childType, $refId } from "../types/symbols.js";
|
|
3
|
+
import { Ref } from "../encoder/ChangeTree.js";
|
|
4
|
+
import { spliceOne } from "../types/utils.js";
|
|
5
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
6
|
+
|
|
7
|
+
import type { MapSchema } from "../types/custom/MapSchema.js";
|
|
8
|
+
import type { Schema } from "../Schema.js";
|
|
9
9
|
|
|
10
10
|
class DecodingWarning extends Error {
|
|
11
11
|
constructor(message: string) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Metadata } from "../../Metadata";
|
|
2
|
-
import { Collection, NonFunctionPropNames } from "../../types/HelperTypes";
|
|
3
|
-
import { Ref } from "../../encoder/ChangeTree";
|
|
4
|
-
import { Decoder } from "../Decoder";
|
|
5
|
-
import { DataChange } from "../DecodeOperation";
|
|
6
|
-
import { OPERATION } from "../../encoding/spec";
|
|
7
|
-
import { Schema } from "../../Schema";
|
|
8
|
-
import { $refId } from "../../types/symbols";
|
|
9
|
-
import { MapSchema } from "../../types/custom/MapSchema";
|
|
10
|
-
import { ArraySchema } from "../../types/custom/ArraySchema";
|
|
11
|
-
import { getDecoderStateCallbacks, type SchemaCallbackProxy } from "./getDecoderStateCallbacks";
|
|
12
|
-
import { getRawChangesCallback } from "./RawChanges";
|
|
1
|
+
import { Metadata } from "../../Metadata.js";
|
|
2
|
+
import { Collection, NonFunctionPropNames } from "../../types/HelperTypes.js";
|
|
3
|
+
import { Ref } from "../../encoder/ChangeTree.js";
|
|
4
|
+
import { Decoder } from "../Decoder.js";
|
|
5
|
+
import { DataChange } from "../DecodeOperation.js";
|
|
6
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
7
|
+
import { Schema } from "../../Schema.js";
|
|
8
|
+
import { $refId } from "../../types/symbols.js";
|
|
9
|
+
import { MapSchema } from "../../types/custom/MapSchema.js";
|
|
10
|
+
import { ArraySchema } from "../../types/custom/ArraySchema.js";
|
|
11
|
+
import { getDecoderStateCallbacks, type SchemaCallbackProxy } from "./getDecoderStateCallbacks.js";
|
|
12
|
+
import { getRawChangesCallback } from "./RawChanges.js";
|
|
13
13
|
|
|
14
14
|
//
|
|
15
15
|
// C#-style Callbacks API
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Metadata } from "../../Metadata";
|
|
2
|
-
import { Collection, NonFunctionNonPrimitivePropNames, NonFunctionPropNames } from "../../types/HelperTypes";
|
|
3
|
-
import { IRef, Ref } from "../../encoder/ChangeTree";
|
|
4
|
-
import { Decoder } from "../Decoder";
|
|
5
|
-
import { DataChange } from "../DecodeOperation";
|
|
6
|
-
import { OPERATION } from "../../encoding/spec";
|
|
7
|
-
import { Schema } from "../../Schema";
|
|
8
|
-
import { $refId } from "../../types/symbols";
|
|
9
|
-
import type { DefinitionType } from "../../annotations";
|
|
10
|
-
import type { CollectionSchema } from "../../types/custom/CollectionSchema";
|
|
1
|
+
import { Metadata } from "../../Metadata.js";
|
|
2
|
+
import { Collection, NonFunctionNonPrimitivePropNames, NonFunctionPropNames } from "../../types/HelperTypes.js";
|
|
3
|
+
import { IRef, Ref } from "../../encoder/ChangeTree.js";
|
|
4
|
+
import { Decoder } from "../Decoder.js";
|
|
5
|
+
import { DataChange } from "../DecodeOperation.js";
|
|
6
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
7
|
+
import { Schema } from "../../Schema.js";
|
|
8
|
+
import { $refId } from "../../types/symbols.js";
|
|
9
|
+
import type { DefinitionType } from "../../annotations.js";
|
|
10
|
+
import type { CollectionSchema } from "../../types/custom/CollectionSchema.js";
|
|
11
11
|
|
|
12
12
|
//
|
|
13
13
|
// Discussion: https://github.com/colyseus/schema/issues/155
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { OPERATION } from "../encoding/spec";
|
|
2
|
-
import { Schema } from "../Schema";
|
|
3
|
-
import { $changes, $childType, $decoder, $onEncodeEnd, $encoder, $getByIndex, $refId, $refTypeFieldIndexes, $viewFieldIndexes, type $deleteByIndex } from "../types/symbols";
|
|
4
|
-
|
|
5
|
-
import type { MapSchema } from "../types/custom/MapSchema";
|
|
6
|
-
import type { ArraySchema } from "../types/custom/ArraySchema";
|
|
7
|
-
import type { CollectionSchema } from "../types/custom/CollectionSchema";
|
|
8
|
-
import type { SetSchema } from "../types/custom/SetSchema";
|
|
9
|
-
|
|
10
|
-
import { Root } from "./Root";
|
|
11
|
-
import { Metadata } from "../Metadata";
|
|
12
|
-
import type { EncodeOperation } from "./EncodeOperation";
|
|
13
|
-
import type { DecodeOperation } from "../decoder/DecodeOperation";
|
|
1
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
2
|
+
import { Schema } from "../Schema.js";
|
|
3
|
+
import { $changes, $childType, $decoder, $onEncodeEnd, $encoder, $getByIndex, $refId, $refTypeFieldIndexes, $viewFieldIndexes, type $deleteByIndex } from "../types/symbols.js";
|
|
4
|
+
|
|
5
|
+
import type { MapSchema } from "../types/custom/MapSchema.js";
|
|
6
|
+
import type { ArraySchema } from "../types/custom/ArraySchema.js";
|
|
7
|
+
import type { CollectionSchema } from "../types/custom/CollectionSchema.js";
|
|
8
|
+
import type { SetSchema } from "../types/custom/SetSchema.js";
|
|
9
|
+
|
|
10
|
+
import { Root } from "./Root.js";
|
|
11
|
+
import { Metadata } from "../Metadata.js";
|
|
12
|
+
import type { EncodeOperation } from "./EncodeOperation.js";
|
|
13
|
+
import type { DecodeOperation } from "../decoder/DecodeOperation.js";
|
|
14
14
|
|
|
15
15
|
declare global {
|
|
16
16
|
interface Object {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { OPERATION } from "../encoding/spec";
|
|
2
|
-
import { $changes, $childType, $getByIndex, $refId } from "../types/symbols";
|
|
1
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
2
|
+
import { $changes, $childType, $getByIndex, $refId } from "../types/symbols.js";
|
|
3
3
|
|
|
4
|
-
import { encode } from "../encoding/encode";
|
|
4
|
+
import { encode } from "../encoding/encode.js";
|
|
5
5
|
|
|
6
|
-
import type { ChangeTree, Ref } from "./ChangeTree";
|
|
7
|
-
import type { Encoder } from "./Encoder";
|
|
8
|
-
import type { Schema } from "../Schema";
|
|
6
|
+
import type { ChangeTree, Ref } from "./ChangeTree.js";
|
|
7
|
+
import type { Encoder } from "./Encoder.js";
|
|
8
|
+
import type { Schema } from "../Schema.js";
|
|
9
9
|
|
|
10
|
-
import type { Iterator } from "../encoding/decode";
|
|
11
|
-
import type { ArraySchema } from "../types/custom/ArraySchema";
|
|
12
|
-
import type { Metadata } from "../Metadata";
|
|
10
|
+
import type { Iterator } from "../encoding/decode.js";
|
|
11
|
+
import type { ArraySchema } from "../types/custom/ArraySchema.js";
|
|
12
|
+
import type { Metadata } from "../Metadata.js";
|
|
13
13
|
|
|
14
14
|
export type EncodeOperation<T extends Ref = any> = (
|
|
15
15
|
encoder: Encoder,
|