@colyseus/schema 4.0.1 → 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 → 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 → 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 → build}/encoder/Root.d.ts +2 -2
- package/{lib → build}/encoder/StateView.d.ts +1 -1
- package/{lib → build}/encoding/assert.d.ts +6 -6
- package/{lib → build}/encoding/decode.d.ts +1 -1
- package/{lib → build}/encoding/encode.d.ts +1 -1
- package/build/{cjs/index.js → index.cjs} +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 → build}/types/custom/ArraySchema.d.ts +8 -8
- package/{lib → build}/types/custom/CollectionSchema.d.ts +7 -7
- package/{lib → build}/types/custom/MapSchema.d.ts +7 -7
- package/{lib → build}/types/custom/SetSchema.d.ts +7 -7
- package/{lib → build}/types/registry.d.ts +2 -2
- package/{lib → build}/utils.d.ts +1 -1
- package/package.json +15 -14
- 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 +10 -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 +7 -2
- package/src/codegen/types.ts +5 -0
- 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.js.map +0 -1
- package/build/esm/index.mjs.map +0 -1
- package/lib/Metadata.js +0 -260
- package/lib/Metadata.js.map +0 -1
- package/lib/Reflection.js +0 -182
- package/lib/Reflection.js.map +0 -1
- package/lib/Schema.js +0 -356
- package/lib/Schema.js.map +0 -1
- package/lib/annotations.js +0 -484
- package/lib/annotations.js.map +0 -1
- package/lib/bench_encode.d.ts +0 -1
- package/lib/bench_encode.js +0 -126
- package/lib/bench_encode.js.map +0 -1
- package/lib/codegen/api.js +0 -87
- package/lib/codegen/api.js.map +0 -1
- package/lib/codegen/argv.js +0 -41
- package/lib/codegen/argv.js.map +0 -1
- package/lib/codegen/cli.js +0 -63
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/languages/cpp.d.ts +0 -3
- package/lib/codegen/languages/cpp.js +0 -261
- 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 -157
- 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 -103
- package/lib/codegen/languages/haxe.js.map +0 -1
- package/lib/codegen/languages/java.js +0 -103
- 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 -104
- 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 -106
- 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 -119
- package/lib/codegen/languages/ts.js.map +0 -1
- package/lib/codegen/parser.js +0 -364
- package/lib/codegen/parser.js.map +0 -1
- package/lib/codegen/types.js +0 -181
- package/lib/codegen/types.js.map +0 -1
- package/lib/decoder/DecodeOperation.js +0 -255
- package/lib/decoder/DecodeOperation.js.map +0 -1
- package/lib/decoder/Decoder.js +0 -118
- package/lib/decoder/Decoder.js.map +0 -1
- package/lib/decoder/ReferenceTracker.js +0 -139
- package/lib/decoder/ReferenceTracker.js.map +0 -1
- package/lib/decoder/strategy/Callbacks.js +0 -340
- package/lib/decoder/strategy/Callbacks.js.map +0 -1
- package/lib/decoder/strategy/RawChanges.js +0 -7
- package/lib/decoder/strategy/RawChanges.js.map +0 -1
- package/lib/decoder/strategy/getDecoderStateCallbacks.js +0 -277
- package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
- package/lib/encoder/ChangeTree.js +0 -542
- package/lib/encoder/ChangeTree.js.map +0 -1
- package/lib/encoder/EncodeOperation.js +0 -139
- package/lib/encoder/EncodeOperation.js.map +0 -1
- package/lib/encoder/Encoder.js +0 -208
- package/lib/encoder/Encoder.js.map +0 -1
- package/lib/encoder/Root.js +0 -233
- package/lib/encoder/Root.js.map +0 -1
- package/lib/encoder/StateView.js +0 -284
- package/lib/encoder/StateView.js.map +0 -1
- package/lib/encoding/assert.js +0 -55
- package/lib/encoding/assert.js.map +0 -1
- package/lib/encoding/decode.js +0 -221
- package/lib/encoding/decode.js.map +0 -1
- package/lib/encoding/encode.js +0 -282
- package/lib/encoding/encode.js.map +0 -1
- package/lib/encoding/spec.js +0 -29
- package/lib/encoding/spec.js.map +0 -1
- package/lib/index.d.ts +0 -32
- package/lib/index.js +0 -81
- package/lib/index.js.map +0 -1
- package/lib/symbol.shim.js +0 -4
- package/lib/symbol.shim.js.map +0 -1
- package/lib/types/HelperTypes.js +0 -3
- package/lib/types/HelperTypes.js.map +0 -1
- package/lib/types/TypeContext.js +0 -147
- package/lib/types/TypeContext.js.map +0 -1
- package/lib/types/custom/ArraySchema.js +0 -737
- package/lib/types/custom/ArraySchema.js.map +0 -1
- package/lib/types/custom/CollectionSchema.js +0 -174
- package/lib/types/custom/CollectionSchema.js.map +0 -1
- package/lib/types/custom/MapSchema.js +0 -226
- package/lib/types/custom/MapSchema.js.map +0 -1
- package/lib/types/custom/SetSchema.js +0 -182
- package/lib/types/custom/SetSchema.js.map +0 -1
- package/lib/types/registry.js +0 -37
- package/lib/types/registry.js.map +0 -1
- package/lib/types/symbols.js +0 -37
- package/lib/types/symbols.js.map +0 -1
- package/lib/types/utils.js +0 -16
- package/lib/types/utils.js.map +0 -1
- package/lib/utils.js +0 -54
- package/lib/utils.js.map +0 -1
- package/lib/v3_bench.js +0 -130
- package/lib/v3_bench.js.map +0 -1
- package/src/bench_encode.ts +0 -64
- /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/{umd/index.js → index.js} +0 -0
- /package/build/{esm/index.mjs → index.mjs} +0 -0
- /package/{lib → build}/symbol.shim.d.ts +0 -0
- /package/{lib → build}/types/symbols.d.ts +0 -0
- /package/{lib → build}/types/utils.d.ts +0 -0
- /package/{lib → build}/v3_bench.d.ts +0 -0
|
@@ -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,
|
package/src/encoder/Encoder.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Schema } from "../Schema";
|
|
2
|
-
import { TypeContext } from "../types/TypeContext";
|
|
3
|
-
import { $changes, $encoder, $filter, $getByIndex, $refId } from "../types/symbols";
|
|
1
|
+
import type { Schema } from "../Schema.js";
|
|
2
|
+
import { TypeContext } from "../types/TypeContext.js";
|
|
3
|
+
import { $changes, $encoder, $filter, $getByIndex, $refId } from "../types/symbols.js";
|
|
4
4
|
|
|
5
|
-
import { encode } from "../encoding/encode";
|
|
6
|
-
import type { Iterator } from "../encoding/decode";
|
|
5
|
+
import { encode } from "../encoding/encode.js";
|
|
6
|
+
import type { Iterator } from "../encoding/decode.js";
|
|
7
7
|
|
|
8
|
-
import { OPERATION, SWITCH_TO_STRUCTURE, TYPE_ID } from '../encoding/spec';
|
|
9
|
-
import { Root } from "./Root";
|
|
8
|
+
import { OPERATION, SWITCH_TO_STRUCTURE, TYPE_ID } from '../encoding/spec.js';
|
|
9
|
+
import { Root } from "./Root.js";
|
|
10
10
|
|
|
11
|
-
import type { StateView } from "./StateView";
|
|
12
|
-
import type { ChangeSetName, ChangeTree, ChangeTreeList, ChangeTreeNode } from "./ChangeTree";
|
|
13
|
-
import { createChangeTreeList } from "./ChangeTree";
|
|
11
|
+
import type { StateView } from "./StateView.js";
|
|
12
|
+
import type { ChangeSetName, ChangeTree, ChangeTreeList, ChangeTreeNode } from "./ChangeTree.js";
|
|
13
|
+
import { createChangeTreeList } from "./ChangeTree.js";
|
|
14
14
|
|
|
15
15
|
function concatBytes(a: Uint8Array, b: Uint8Array): Uint8Array {
|
|
16
16
|
const result = new Uint8Array(a.length + b.length);
|
package/src/encoder/Root.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { OPERATION } from "../encoding/spec";
|
|
2
|
-
import { TypeContext } from "../types/TypeContext";
|
|
3
|
-
import { ChangeTree, setOperationAtIndex, ChangeTreeList, createChangeTreeList, ChangeSetName, type ChangeTreeNode } from "./ChangeTree";
|
|
4
|
-
import { $changes, $refId } from "../types/symbols";
|
|
1
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
2
|
+
import { TypeContext } from "../types/TypeContext.js";
|
|
3
|
+
import { ChangeTree, setOperationAtIndex, ChangeTreeList, createChangeTreeList, ChangeSetName, type ChangeTreeNode } from "./ChangeTree.js";
|
|
4
|
+
import { $changes, $refId } from "../types/symbols.js";
|
|
5
5
|
|
|
6
6
|
export class Root {
|
|
7
7
|
protected nextUniqueId: number = 0;
|
package/src/encoder/StateView.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ChangeTree, IndexedOperations, Ref } from "./ChangeTree";
|
|
2
|
-
import { $changes, $fieldIndexesByViewTag, $refId, $viewFieldIndexes } from "../types/symbols";
|
|
3
|
-
import { DEFAULT_VIEW_TAG } from "../annotations";
|
|
4
|
-
import { OPERATION } from "../encoding/spec";
|
|
5
|
-
import { Metadata } from "../Metadata";
|
|
6
|
-
import { spliceOne } from "../types/utils";
|
|
7
|
-
import type { Schema } from "../Schema";
|
|
1
|
+
import { ChangeTree, IndexedOperations, Ref } from "./ChangeTree.js";
|
|
2
|
+
import { $changes, $fieldIndexesByViewTag, $refId, $viewFieldIndexes } from "../types/symbols.js";
|
|
3
|
+
import { DEFAULT_VIEW_TAG } from "../annotations.js";
|
|
4
|
+
import { OPERATION } from "../encoding/spec.js";
|
|
5
|
+
import { Metadata } from "../Metadata.js";
|
|
6
|
+
import { spliceOne } from "../types/utils.js";
|
|
7
|
+
import type { Schema } from "../Schema.js";
|
|
8
8
|
|
|
9
9
|
export function createView(iterable: boolean = false) {
|
|
10
10
|
return new StateView(iterable);
|
package/src/encoding/assert.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Schema } from "../Schema";
|
|
2
|
-
import type { CollectionSchema } from "../types/custom/CollectionSchema";
|
|
3
|
-
import type { MapSchema } from "../types/custom/MapSchema";
|
|
4
|
-
import type { SetSchema } from "../types/custom/SetSchema";
|
|
5
|
-
import type { ArraySchema } from "../types/custom/ArraySchema";
|
|
6
|
-
import type { Ref } from "../encoder/ChangeTree";
|
|
1
|
+
import type { Schema } from "../Schema.js";
|
|
2
|
+
import type { CollectionSchema } from "../types/custom/CollectionSchema.js";
|
|
3
|
+
import type { MapSchema } from "../types/custom/MapSchema.js";
|
|
4
|
+
import type { SetSchema } from "../types/custom/SetSchema.js";
|
|
5
|
+
import type { ArraySchema } from "../types/custom/ArraySchema.js";
|
|
6
|
+
import type { Ref } from "../encoder/ChangeTree.js";
|
|
7
7
|
|
|
8
8
|
export class EncodeSchemaError extends Error {}
|
|
9
9
|
|
package/src/encoding/decode.ts
CHANGED
package/src/encoding/encode.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { Schema } from "./Schema";
|
|
2
|
-
export type { DataChange } from "./decoder/DecodeOperation";
|
|
3
|
-
export type { ToJSON } from "./types/HelperTypes";
|
|
1
|
+
export { Schema } from "./Schema.js";
|
|
2
|
+
export type { DataChange } from "./decoder/DecodeOperation.js";
|
|
3
|
+
export type { ToJSON } from "./types/HelperTypes.js";
|
|
4
4
|
|
|
5
|
-
import { MapSchema } from "./types/custom/MapSchema"
|
|
5
|
+
import { MapSchema } from "./types/custom/MapSchema.js"
|
|
6
6
|
export { MapSchema };
|
|
7
7
|
|
|
8
|
-
import { ArraySchema } from "./types/custom/ArraySchema";
|
|
8
|
+
import { ArraySchema } from "./types/custom/ArraySchema.js";
|
|
9
9
|
export { ArraySchema };
|
|
10
10
|
|
|
11
|
-
import { CollectionSchema } from "./types/custom/CollectionSchema";
|
|
11
|
+
import { CollectionSchema } from "./types/custom/CollectionSchema.js";
|
|
12
12
|
export { CollectionSchema };
|
|
13
13
|
|
|
14
|
-
import { SetSchema } from "./types/custom/SetSchema";
|
|
14
|
+
import { SetSchema } from "./types/custom/SetSchema.js";
|
|
15
15
|
export { SetSchema };
|
|
16
16
|
|
|
17
|
-
import { registerType, defineCustomTypes } from "./types/registry";
|
|
17
|
+
import { registerType, defineCustomTypes } from "./types/registry.js";
|
|
18
18
|
export { registerType, defineCustomTypes };
|
|
19
19
|
|
|
20
20
|
registerType("map", { constructor: MapSchema });
|
|
@@ -23,22 +23,22 @@ registerType("set", { constructor: SetSchema });
|
|
|
23
23
|
registerType("collection", { constructor: CollectionSchema, });
|
|
24
24
|
|
|
25
25
|
// Utils
|
|
26
|
-
export { dumpChanges } from "./utils";
|
|
26
|
+
export { dumpChanges } from "./utils.js";
|
|
27
27
|
|
|
28
28
|
// Encoder / Decoder
|
|
29
|
-
export { $track, $encoder, $decoder, $filter, $getByIndex, $deleteByIndex, $changes, $childType, $refId } from "./types/symbols";
|
|
30
|
-
export { encode } from "./encoding/encode";
|
|
31
|
-
export { decode, type Iterator } from "./encoding/decode";
|
|
29
|
+
export { $track, $encoder, $decoder, $filter, $getByIndex, $deleteByIndex, $changes, $childType, $refId } from "./types/symbols.js";
|
|
30
|
+
export { encode } from "./encoding/encode.js";
|
|
31
|
+
export { decode, type Iterator } from "./encoding/decode.js";
|
|
32
32
|
|
|
33
33
|
// Reflection
|
|
34
34
|
export {
|
|
35
35
|
Reflection,
|
|
36
36
|
ReflectionType,
|
|
37
37
|
ReflectionField,
|
|
38
|
-
} from "./Reflection";
|
|
38
|
+
} from "./Reflection.js";
|
|
39
39
|
|
|
40
40
|
// Annotations, Metadata and TypeContext
|
|
41
|
-
export { Metadata } from "./Metadata";
|
|
41
|
+
export { Metadata } from "./Metadata.js";
|
|
42
42
|
|
|
43
43
|
// Schema definition types
|
|
44
44
|
export {
|
|
@@ -55,23 +55,23 @@ export {
|
|
|
55
55
|
type SchemaWithExtendsConstructor,
|
|
56
56
|
type SchemaWithExtends,
|
|
57
57
|
type SchemaType,
|
|
58
|
-
} from "./annotations";
|
|
58
|
+
} from "./annotations.js";
|
|
59
59
|
|
|
60
|
-
export { TypeContext } from "./types/TypeContext";
|
|
60
|
+
export { TypeContext } from "./types/TypeContext.js";
|
|
61
61
|
|
|
62
62
|
// Helper types for type inference
|
|
63
|
-
export type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes";
|
|
63
|
+
export type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes.js";
|
|
64
64
|
|
|
65
|
-
export { getDecoderStateCallbacks, CallbackProxy, SchemaCallback, CollectionCallback, SchemaCallbackProxy } from "./decoder/strategy/getDecoderStateCallbacks";
|
|
66
|
-
export { Callbacks, StateCallbackStrategy } from "./decoder/strategy/Callbacks";
|
|
67
|
-
export { getRawChangesCallback } from "./decoder/strategy/RawChanges";
|
|
65
|
+
export { getDecoderStateCallbacks, type CallbackProxy, type SchemaCallback, type CollectionCallback, type SchemaCallbackProxy } from "./decoder/strategy/getDecoderStateCallbacks.js";
|
|
66
|
+
export { Callbacks, StateCallbackStrategy } from "./decoder/strategy/Callbacks.js";
|
|
67
|
+
export { getRawChangesCallback } from "./decoder/strategy/RawChanges.js";
|
|
68
68
|
|
|
69
|
-
export { Encoder } from "./encoder/Encoder";
|
|
70
|
-
export { encodeSchemaOperation, encodeArray, encodeKeyValueOperation } from "./encoder/EncodeOperation";
|
|
71
|
-
export { ChangeTree, Ref, IRef, type ChangeSetName, type ChangeSet} from "./encoder/ChangeTree";
|
|
72
|
-
export { StateView } from "./encoder/StateView";
|
|
69
|
+
export { Encoder } from "./encoder/Encoder.js";
|
|
70
|
+
export { encodeSchemaOperation, encodeArray, encodeKeyValueOperation } from "./encoder/EncodeOperation.js";
|
|
71
|
+
export { ChangeTree, type Ref, type IRef, type ChangeSetName, type ChangeSet} from "./encoder/ChangeTree.js";
|
|
72
|
+
export { StateView } from "./encoder/StateView.js";
|
|
73
73
|
|
|
74
|
-
export { Decoder } from "./decoder/Decoder";
|
|
75
|
-
export { decodeSchemaOperation, decodeKeyValueOperation } from "./decoder/DecodeOperation";
|
|
74
|
+
export { Decoder } from "./decoder/Decoder.js";
|
|
75
|
+
export { decodeSchemaOperation, decodeKeyValueOperation } from "./decoder/DecodeOperation.js";
|
|
76
76
|
|
|
77
|
-
export { OPERATION } from "./encoding/spec";
|
|
77
|
+
export { OPERATION } from "./encoding/spec.js";
|
package/src/types/HelperTypes.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Definition, DefinitionType, PrimitiveType, RawPrimitiveType } 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, RawPrimitiveType } 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
|
|
|
8
8
|
export type Constructor<T = {}> = new (...args: any[]) => T;
|
|
9
9
|
|
package/src/types/TypeContext.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Metadata } from "../Metadata";
|
|
2
|
-
import { Schema } from "../Schema";
|
|
3
|
-
import { $viewFieldIndexes } from "./symbols";
|
|
1
|
+
import { Metadata } from "../Metadata.js";
|
|
2
|
+
import { Schema } from "../Schema.js";
|
|
3
|
+
import { $viewFieldIndexes } from "./symbols.js";
|
|
4
4
|
|
|
5
5
|
export class TypeContext {
|
|
6
6
|
types: { [id: number]: typeof Schema; } = {};
|
|
@@ -1,14 +1,14 @@
|
|
|
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, setOperationAtIndex } from "../../encoder/ChangeTree";
|
|
4
|
-
import { OPERATION } from "../../encoding/spec";
|
|
5
|
-
import { registerType } from "../registry";
|
|
6
|
-
import { Collection } from "../HelperTypes";
|
|
7
|
-
|
|
8
|
-
import { encodeArray } from "../../encoder/EncodeOperation";
|
|
9
|
-
import { decodeArray } from "../../decoder/DecodeOperation";
|
|
10
|
-
import type { StateView } from "../../encoder/StateView";
|
|
11
|
-
import { assertInstanceType } from "../../encoding/assert";
|
|
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, setOperationAtIndex } from "../../encoder/ChangeTree.js";
|
|
4
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
5
|
+
import { registerType } from "../registry.js";
|
|
6
|
+
import { Collection } from "../HelperTypes.js";
|
|
7
|
+
|
|
8
|
+
import { encodeArray } from "../../encoder/EncodeOperation.js";
|
|
9
|
+
import { decodeArray } from "../../decoder/DecodeOperation.js";
|
|
10
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
11
|
+
import { assertInstanceType } from "../../encoding/assert.js";
|
|
12
12
|
|
|
13
13
|
const DEFAULT_SORT = (a: any, b: any) => {
|
|
14
14
|
const A = a.toString();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols";
|
|
2
|
-
import { ChangeTree, type IRef } from "../../encoder/ChangeTree";
|
|
3
|
-
import { OPERATION } from "../../encoding/spec";
|
|
4
|
-
import { registerType } from "../registry";
|
|
5
|
-
import { Collection } from "../HelperTypes";
|
|
6
|
-
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation";
|
|
7
|
-
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation";
|
|
8
|
-
import type { StateView } from "../../encoder/StateView";
|
|
9
|
-
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 { OPERATION } from "../../encoding/spec.js";
|
|
4
|
+
import { registerType } from "../registry.js";
|
|
5
|
+
import { Collection } from "../HelperTypes.js";
|
|
6
|
+
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation.js";
|
|
7
|
+
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation.js";
|
|
8
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
9
|
+
import type { Schema } from "../../Schema.js";
|
|
10
10
|
|
|
11
11
|
type K = number; // TODO: allow to specify K generic on MapSchema.
|
|
12
12
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $numFields, $refId } from "../symbols";
|
|
2
|
-
import { ChangeTree, IRef } from "../../encoder/ChangeTree";
|
|
3
|
-
import { OPERATION } from "../../encoding/spec";
|
|
4
|
-
import { registerType } from "../registry";
|
|
5
|
-
import { Collection } from "../HelperTypes";
|
|
6
|
-
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation";
|
|
7
|
-
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation";
|
|
8
|
-
import type { StateView } from "../../encoder/StateView";
|
|
9
|
-
import type { Schema } from "../../Schema";
|
|
10
|
-
import { assertInstanceType } from "../../encoding/assert";
|
|
1
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $onEncodeEnd, $encoder, $filter, $getByIndex, $numFields, $refId } from "../symbols.js";
|
|
2
|
+
import { ChangeTree, IRef } from "../../encoder/ChangeTree.js";
|
|
3
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
4
|
+
import { registerType } from "../registry.js";
|
|
5
|
+
import { Collection } from "../HelperTypes.js";
|
|
6
|
+
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation.js";
|
|
7
|
+
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation.js";
|
|
8
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
9
|
+
import type { Schema } from "../../Schema.js";
|
|
10
|
+
import { assertInstanceType } from "../../encoding/assert.js";
|
|
11
11
|
|
|
12
12
|
export class MapSchema<V=any, K extends string = string> implements Map<K, V>, Collection<K, V, [K, V]>, IRef {
|
|
13
13
|
[$changes]: ChangeTree;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { OPERATION } from "../../encoding/spec";
|
|
2
|
-
import { registerType } from "../registry";
|
|
3
|
-
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols";
|
|
4
|
-
import { Collection } from "../HelperTypes";
|
|
5
|
-
import { ChangeTree, type IRef } from "../../encoder/ChangeTree";
|
|
6
|
-
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation";
|
|
7
|
-
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation";
|
|
8
|
-
import type { StateView } from "../../encoder/StateView";
|
|
9
|
-
import type { Schema } from "../../Schema";
|
|
1
|
+
import { OPERATION } from "../../encoding/spec.js";
|
|
2
|
+
import { registerType } from "../registry.js";
|
|
3
|
+
import { $changes, $childType, $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $onEncodeEnd, $refId } from "../symbols.js";
|
|
4
|
+
import { Collection } from "../HelperTypes.js";
|
|
5
|
+
import { ChangeTree, type IRef } from "../../encoder/ChangeTree.js";
|
|
6
|
+
import { encodeKeyValueOperation } from "../../encoder/EncodeOperation.js";
|
|
7
|
+
import { decodeKeyValueOperation } from "../../decoder/DecodeOperation.js";
|
|
8
|
+
import type { StateView } from "../../encoder/StateView.js";
|
|
9
|
+
import type { Schema } from "../../Schema.js";
|
|
10
10
|
|
|
11
11
|
export class SetSchema<V=any> implements Collection<number, V>, IRef {
|
|
12
12
|
[$changes]: ChangeTree;
|
package/src/types/registry.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefinitionType, type } from "../annotations";
|
|
2
|
-
import { BufferLike, encode } from "../encoding/encode";
|
|
3
|
-
import { decode, Iterator } from "../encoding/decode";
|
|
1
|
+
import { DefinitionType, type } from "../annotations.js";
|
|
2
|
+
import { BufferLike, encode } from "../encoding/encode.js";
|
|
3
|
+
import { decode, Iterator } from "../encoding/decode.js";
|
|
4
4
|
|
|
5
5
|
export interface TypeDefinition {
|
|
6
6
|
constructor?: any,
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Schema } from "./Schema";
|
|
2
|
-
import { OPERATION } from "./encoding/spec";
|
|
3
|
-
import { $changes, $refId } from "./types/symbols";
|
|
1
|
+
import type { Schema } from "./Schema.js";
|
|
2
|
+
import { OPERATION } from "./encoding/spec.js";
|
|
3
|
+
import { $changes, $refId } from "./types/symbols.js";
|
|
4
4
|
|
|
5
5
|
interface ChangeDump {
|
|
6
6
|
ops: {
|
package/src/v3_bench.ts
CHANGED