@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.
Files changed (190) hide show
  1. package/{lib → build}/Metadata.d.ts +2 -2
  2. package/{lib → build}/Reflection.d.ts +13 -13
  3. package/{lib → build}/Schema.d.ts +10 -10
  4. package/{lib → build}/annotations.d.ts +10 -10
  5. package/build/codegen/languages/cpp.d.ts +3 -0
  6. package/build/codegen/languages/csharp.d.ts +4 -0
  7. package/build/codegen/languages/haxe.d.ts +3 -0
  8. package/{lib → build}/codegen/languages/java.d.ts +2 -2
  9. package/build/codegen/languages/js.d.ts +3 -0
  10. package/build/codegen/languages/lua.d.ts +3 -0
  11. package/build/codegen/languages/ts.d.ts +3 -0
  12. package/{lib → build}/codegen/parser.d.ts +1 -1
  13. package/{lib → build}/decoder/DecodeOperation.d.ts +5 -5
  14. package/{lib → build}/decoder/Decoder.d.ts +7 -7
  15. package/{lib → build}/decoder/ReferenceTracker.d.ts +1 -1
  16. package/{lib → build}/decoder/strategy/Callbacks.d.ts +11 -11
  17. package/{lib → build}/decoder/strategy/RawChanges.d.ts +2 -2
  18. package/{lib → build}/decoder/strategy/getDecoderStateCallbacks.d.ts +3 -3
  19. package/{lib → build}/encoder/ChangeTree.d.ts +11 -11
  20. package/{lib → build}/encoder/EncodeOperation.d.ts +5 -5
  21. package/{lib → build}/encoder/Encoder.d.ts +6 -6
  22. package/{lib → build}/encoder/Root.d.ts +2 -2
  23. package/{lib → build}/encoder/StateView.d.ts +1 -1
  24. package/{lib → build}/encoding/assert.d.ts +6 -6
  25. package/{lib → build}/encoding/decode.d.ts +1 -1
  26. package/{lib → build}/encoding/encode.d.ts +1 -1
  27. package/build/{cjs/index.js → index.cjs} +1 -1
  28. package/build/index.cjs.map +1 -0
  29. package/build/index.d.ts +32 -0
  30. package/build/index.mjs.map +1 -0
  31. package/{lib → build}/types/HelperTypes.d.ts +6 -6
  32. package/{lib → build}/types/TypeContext.d.ts +1 -1
  33. package/{lib → build}/types/custom/ArraySchema.d.ts +8 -8
  34. package/{lib → build}/types/custom/CollectionSchema.d.ts +7 -7
  35. package/{lib → build}/types/custom/MapSchema.d.ts +7 -7
  36. package/{lib → build}/types/custom/SetSchema.d.ts +7 -7
  37. package/{lib → build}/types/registry.d.ts +2 -2
  38. package/{lib → build}/utils.d.ts +1 -1
  39. package/package.json +15 -14
  40. package/src/Metadata.ts +5 -5
  41. package/src/Reflection.ts +7 -7
  42. package/src/Schema.ts +11 -11
  43. package/src/annotations.ts +13 -13
  44. package/src/codegen/api.ts +10 -3
  45. package/src/codegen/cli.ts +2 -2
  46. package/src/codegen/languages/cpp.ts +2 -2
  47. package/src/codegen/languages/csharp.ts +3 -3
  48. package/src/codegen/languages/haxe.ts +2 -2
  49. package/src/codegen/languages/java.ts +2 -2
  50. package/src/codegen/languages/js.ts +2 -2
  51. package/src/codegen/languages/lua.ts +2 -2
  52. package/src/codegen/languages/ts.ts +2 -2
  53. package/src/codegen/parser.ts +7 -2
  54. package/src/codegen/types.ts +5 -0
  55. package/src/decoder/DecodeOperation.ts +14 -14
  56. package/src/decoder/Decoder.ts +11 -11
  57. package/src/decoder/ReferenceTracker.ts +8 -8
  58. package/src/decoder/strategy/Callbacks.ts +12 -12
  59. package/src/decoder/strategy/RawChanges.ts +2 -2
  60. package/src/decoder/strategy/getDecoderStateCallbacks.ts +10 -10
  61. package/src/encoder/ChangeTree.ts +13 -13
  62. package/src/encoder/EncodeOperation.ts +9 -9
  63. package/src/encoder/Encoder.ts +10 -10
  64. package/src/encoder/Root.ts +4 -4
  65. package/src/encoder/StateView.ts +7 -7
  66. package/src/encoding/assert.ts +6 -6
  67. package/src/encoding/decode.ts +1 -1
  68. package/src/encoding/encode.ts +1 -1
  69. package/src/index.ts +27 -27
  70. package/src/types/HelperTypes.ts +6 -6
  71. package/src/types/TypeContext.ts +3 -3
  72. package/src/types/custom/ArraySchema.ts +11 -11
  73. package/src/types/custom/CollectionSchema.ts +9 -9
  74. package/src/types/custom/MapSchema.ts +10 -10
  75. package/src/types/custom/SetSchema.ts +9 -9
  76. package/src/types/registry.ts +3 -3
  77. package/src/utils.ts +3 -3
  78. package/src/v3_bench.ts +1 -1
  79. package/build/cjs/index.js.map +0 -1
  80. package/build/esm/index.mjs.map +0 -1
  81. package/lib/Metadata.js +0 -260
  82. package/lib/Metadata.js.map +0 -1
  83. package/lib/Reflection.js +0 -182
  84. package/lib/Reflection.js.map +0 -1
  85. package/lib/Schema.js +0 -356
  86. package/lib/Schema.js.map +0 -1
  87. package/lib/annotations.js +0 -484
  88. package/lib/annotations.js.map +0 -1
  89. package/lib/bench_encode.d.ts +0 -1
  90. package/lib/bench_encode.js +0 -126
  91. package/lib/bench_encode.js.map +0 -1
  92. package/lib/codegen/api.js +0 -87
  93. package/lib/codegen/api.js.map +0 -1
  94. package/lib/codegen/argv.js +0 -41
  95. package/lib/codegen/argv.js.map +0 -1
  96. package/lib/codegen/cli.js +0 -63
  97. package/lib/codegen/cli.js.map +0 -1
  98. package/lib/codegen/languages/cpp.d.ts +0 -3
  99. package/lib/codegen/languages/cpp.js +0 -261
  100. package/lib/codegen/languages/cpp.js.map +0 -1
  101. package/lib/codegen/languages/csharp.d.ts +0 -4
  102. package/lib/codegen/languages/csharp.js +0 -157
  103. package/lib/codegen/languages/csharp.js.map +0 -1
  104. package/lib/codegen/languages/haxe.d.ts +0 -3
  105. package/lib/codegen/languages/haxe.js +0 -103
  106. package/lib/codegen/languages/haxe.js.map +0 -1
  107. package/lib/codegen/languages/java.js +0 -103
  108. package/lib/codegen/languages/java.js.map +0 -1
  109. package/lib/codegen/languages/js.d.ts +0 -3
  110. package/lib/codegen/languages/js.js +0 -104
  111. package/lib/codegen/languages/js.js.map +0 -1
  112. package/lib/codegen/languages/lua.d.ts +0 -3
  113. package/lib/codegen/languages/lua.js +0 -106
  114. package/lib/codegen/languages/lua.js.map +0 -1
  115. package/lib/codegen/languages/ts.d.ts +0 -3
  116. package/lib/codegen/languages/ts.js +0 -119
  117. package/lib/codegen/languages/ts.js.map +0 -1
  118. package/lib/codegen/parser.js +0 -364
  119. package/lib/codegen/parser.js.map +0 -1
  120. package/lib/codegen/types.js +0 -181
  121. package/lib/codegen/types.js.map +0 -1
  122. package/lib/decoder/DecodeOperation.js +0 -255
  123. package/lib/decoder/DecodeOperation.js.map +0 -1
  124. package/lib/decoder/Decoder.js +0 -118
  125. package/lib/decoder/Decoder.js.map +0 -1
  126. package/lib/decoder/ReferenceTracker.js +0 -139
  127. package/lib/decoder/ReferenceTracker.js.map +0 -1
  128. package/lib/decoder/strategy/Callbacks.js +0 -340
  129. package/lib/decoder/strategy/Callbacks.js.map +0 -1
  130. package/lib/decoder/strategy/RawChanges.js +0 -7
  131. package/lib/decoder/strategy/RawChanges.js.map +0 -1
  132. package/lib/decoder/strategy/getDecoderStateCallbacks.js +0 -277
  133. package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
  134. package/lib/encoder/ChangeTree.js +0 -542
  135. package/lib/encoder/ChangeTree.js.map +0 -1
  136. package/lib/encoder/EncodeOperation.js +0 -139
  137. package/lib/encoder/EncodeOperation.js.map +0 -1
  138. package/lib/encoder/Encoder.js +0 -208
  139. package/lib/encoder/Encoder.js.map +0 -1
  140. package/lib/encoder/Root.js +0 -233
  141. package/lib/encoder/Root.js.map +0 -1
  142. package/lib/encoder/StateView.js +0 -284
  143. package/lib/encoder/StateView.js.map +0 -1
  144. package/lib/encoding/assert.js +0 -55
  145. package/lib/encoding/assert.js.map +0 -1
  146. package/lib/encoding/decode.js +0 -221
  147. package/lib/encoding/decode.js.map +0 -1
  148. package/lib/encoding/encode.js +0 -282
  149. package/lib/encoding/encode.js.map +0 -1
  150. package/lib/encoding/spec.js +0 -29
  151. package/lib/encoding/spec.js.map +0 -1
  152. package/lib/index.d.ts +0 -32
  153. package/lib/index.js +0 -81
  154. package/lib/index.js.map +0 -1
  155. package/lib/symbol.shim.js +0 -4
  156. package/lib/symbol.shim.js.map +0 -1
  157. package/lib/types/HelperTypes.js +0 -3
  158. package/lib/types/HelperTypes.js.map +0 -1
  159. package/lib/types/TypeContext.js +0 -147
  160. package/lib/types/TypeContext.js.map +0 -1
  161. package/lib/types/custom/ArraySchema.js +0 -737
  162. package/lib/types/custom/ArraySchema.js.map +0 -1
  163. package/lib/types/custom/CollectionSchema.js +0 -174
  164. package/lib/types/custom/CollectionSchema.js.map +0 -1
  165. package/lib/types/custom/MapSchema.js +0 -226
  166. package/lib/types/custom/MapSchema.js.map +0 -1
  167. package/lib/types/custom/SetSchema.js +0 -182
  168. package/lib/types/custom/SetSchema.js.map +0 -1
  169. package/lib/types/registry.js +0 -37
  170. package/lib/types/registry.js.map +0 -1
  171. package/lib/types/symbols.js +0 -37
  172. package/lib/types/symbols.js.map +0 -1
  173. package/lib/types/utils.js +0 -16
  174. package/lib/types/utils.js.map +0 -1
  175. package/lib/utils.js +0 -54
  176. package/lib/utils.js.map +0 -1
  177. package/lib/v3_bench.js +0 -130
  178. package/lib/v3_bench.js.map +0 -1
  179. package/src/bench_encode.ts +0 -64
  180. /package/{lib → build}/codegen/api.d.ts +0 -0
  181. /package/{lib → build}/codegen/argv.d.ts +0 -0
  182. /package/{lib → build}/codegen/cli.d.ts +0 -0
  183. /package/{lib → build}/codegen/types.d.ts +0 -0
  184. /package/{lib → build}/encoding/spec.d.ts +0 -0
  185. /package/build/{umd/index.js → index.js} +0 -0
  186. /package/build/{esm/index.mjs → index.mjs} +0 -0
  187. /package/{lib → build}/symbol.shim.d.ts +0 -0
  188. /package/{lib → build}/types/symbols.d.ts +0 -0
  189. /package/{lib → build}/types/utils.d.ts +0 -0
  190. /package/{lib → build}/v3_bench.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { DefinitionType } from "./annotations";
2
- import { $descriptors, $fieldIndexesByViewTag, $numFields, $refTypeFieldIndexes, $viewFieldIndexes } from "./types/symbols";
1
+ import { DefinitionType } from "./annotations.js";
2
+ import { $descriptors, $fieldIndexesByViewTag, $numFields, $refTypeFieldIndexes, $viewFieldIndexes } from "./types/symbols.js";
3
3
  export type MetadataField = {
4
4
  type: DefinitionType;
5
5
  name: string;
@@ -1,8 +1,8 @@
1
- import { schema, SchemaType } from "./annotations";
2
- import { Iterator } from "./encoding/decode";
3
- import { Encoder } from "./encoder/Encoder";
4
- import { Decoder } from "./decoder/Decoder";
5
- import { Schema } from "./Schema";
1
+ import { schema, SchemaType } from "./annotations.js";
2
+ import { Iterator } from "./encoding/decode.js";
3
+ import { Encoder } from "./encoder/Encoder.js";
4
+ import { Decoder } from "./decoder/Decoder.js";
5
+ import { Schema } from "./Schema.js";
6
6
  /**
7
7
  * Static methods available on Reflection
8
8
  */
@@ -27,36 +27,36 @@ interface ReflectionStatic {
27
27
  /**
28
28
  * Reflection
29
29
  */
30
- export declare const ReflectionField: import("./annotations").SchemaWithExtendsConstructor<{
30
+ export declare const ReflectionField: import("./annotations.js").SchemaWithExtendsConstructor<{
31
31
  name: "string";
32
32
  type: "string";
33
33
  referencedType: "number";
34
- }, import(".").AssignableProps<import(".").InferSchemaInstanceType<{
34
+ }, import("./index.js").AssignableProps<import("./index.js").InferSchemaInstanceType<{
35
35
  name: "string";
36
36
  type: "string";
37
37
  referencedType: "number";
38
38
  }>>, typeof Schema>;
39
39
  export type ReflectionField = SchemaType<typeof ReflectionField>;
40
- export declare const ReflectionType: import("./annotations").SchemaWithExtendsConstructor<{
40
+ export declare const ReflectionType: import("./annotations.js").SchemaWithExtendsConstructor<{
41
41
  id: "number";
42
42
  extendsId: "number";
43
- fields: import("./annotations").SchemaWithExtendsConstructor<{
43
+ fields: import("./annotations.js").SchemaWithExtendsConstructor<{
44
44
  name: "string";
45
45
  type: "string";
46
46
  referencedType: "number";
47
- }, import(".").AssignableProps<import(".").InferSchemaInstanceType<{
47
+ }, import("./index.js").AssignableProps<import("./index.js").InferSchemaInstanceType<{
48
48
  name: "string";
49
49
  type: "string";
50
50
  referencedType: "number";
51
51
  }>>, typeof Schema>[];
52
- }, import(".").AssignableProps<import(".").InferSchemaInstanceType<{
52
+ }, import("./index.js").AssignableProps<import("./index.js").InferSchemaInstanceType<{
53
53
  id: "number";
54
54
  extendsId: "number";
55
- fields: import("./annotations").SchemaWithExtendsConstructor<{
55
+ fields: import("./annotations.js").SchemaWithExtendsConstructor<{
56
56
  name: "string";
57
57
  type: "string";
58
58
  referencedType: "number";
59
- }, import(".").AssignableProps<import(".").InferSchemaInstanceType<{
59
+ }, import("./index.js").AssignableProps<import("./index.js").InferSchemaInstanceType<{
60
60
  name: "string";
61
61
  type: "string";
62
62
  referencedType: "number";
@@ -1,18 +1,18 @@
1
- import { OPERATION } from './encoding/spec';
2
- import { type DefinitionType } from "./annotations";
3
- import { AssignableProps, NonFunctionPropNames, ToJSON } from './types/HelperTypes';
4
- import { ChangeSetName, ChangeTree, IRef, Ref } from './encoder/ChangeTree';
5
- import { $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $refId, $track } from './types/symbols';
6
- import { StateView } from './encoder/StateView';
7
- import type { Decoder } from './decoder/Decoder';
8
- import type { Metadata } from './Metadata';
1
+ import { OPERATION } from './encoding/spec.js';
2
+ import { type DefinitionType } from "./annotations.js";
3
+ import { AssignableProps, NonFunctionPropNames, ToJSON } from './types/HelperTypes.js';
4
+ import { ChangeSetName, ChangeTree, IRef, Ref } from './encoder/ChangeTree.js';
5
+ import { $decoder, $deleteByIndex, $encoder, $filter, $getByIndex, $refId, $track } from './types/symbols.js';
6
+ import { StateView } from './encoder/StateView.js';
7
+ import type { Decoder } from './decoder/Decoder.js';
8
+ import type { Metadata } from './Metadata.js';
9
9
  /**
10
10
  * Schema encoder / decoder
11
11
  */
12
12
  export declare class Schema<C = any> implements IRef {
13
13
  static [Symbol.metadata]: Metadata;
14
- static [$encoder]: import("./encoder/EncodeOperation").EncodeOperation<any>;
15
- static [$decoder]: import("./decoder/DecodeOperation").DecodeOperation<any>;
14
+ static [$encoder]: import("./encoder/EncodeOperation.js").EncodeOperation<any>;
15
+ static [$decoder]: import("./decoder/DecodeOperation.js").DecodeOperation<any>;
16
16
  [$refId]?: number;
17
17
  /**
18
18
  * Assign the property descriptors required to track changes on this instance.
@@ -1,12 +1,12 @@
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 { TypeDefinition } from "./types/registry";
6
- import { OPERATION } from "./encoding/spec";
7
- import type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes";
8
- import { CollectionSchema } from "./types/custom/CollectionSchema";
9
- 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 { TypeDefinition } from "./types/registry.js";
6
+ import { OPERATION } from "./encoding/spec.js";
7
+ import type { InferValueType, InferSchemaInstanceType, AssignableProps } from "./types/HelperTypes.js";
8
+ import { CollectionSchema } from "./types/custom/CollectionSchema.js";
9
+ import { SetSchema } from "./types/custom/SetSchema.js";
10
10
  export type RawPrimitiveType = "string" | "number" | "boolean" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64" | "float32" | "float64" | "bigint64" | "biguint64";
11
11
  export type PrimitiveType = RawPrimitiveType | typeof Schema | object;
12
12
  export type DefinitionType<T extends PrimitiveType = PrimitiveType> = T | T[] | {
@@ -63,7 +63,7 @@ export declare function view<T>(tag?: number): (target: T, fieldName: string) =>
63
63
  export declare function unreliable<T>(target: T, field: string): void;
64
64
  export declare function type(type: DefinitionType, options?: TypeOptions): PropertyDecorator;
65
65
  export declare function getPropertyDescriptor(fieldCached: string, fieldIndex: number, type: DefinitionType, complexTypeKlass: TypeDefinition): {
66
- get: (this: Schema) => number | ((index: number) => any) | ((index: number) => void) | (() => Schema<any>) | (<T extends Partial<Schema<any>>>(props: AssignableProps<T>) => Schema<any>) | ((jsonData: import("./types/HelperTypes").ToJSON<Schema<any>>) => Schema<any>) | (<K extends "~refId">(property: number | K, operation?: OPERATION) => void) | ((this: any) => import("./types/HelperTypes").ToJSON<Schema<any>>) | (() => void);
66
+ get: (this: Schema) => number | ((index: number) => any) | ((index: number) => void) | (() => Schema<any>) | (<T extends Partial<Schema<any>>>(props: AssignableProps<T>) => Schema<any>) | ((jsonData: import("./index.js").ToJSON<Schema<any>>) => Schema<any>) | (<K extends "~refId">(property: number | K, operation?: OPERATION) => void) | ((this: any) => import("./index.js").ToJSON<Schema<any>>) | (() => void);
67
67
  set: (this: Schema, value: any) => void;
68
68
  enumerable: boolean;
69
69
  configurable: boolean;
@@ -0,0 +1,3 @@
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -0,0 +1,4 @@
1
+ import { File } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ import { Context } from "../types.js";
4
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -0,0 +1,3 @@
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -1,5 +1,5 @@
1
- import { File, Context } from "../types";
2
- import { GenerateOptions } from "../api";
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
3
  /**
4
4
  * C# Code Generator
5
5
  */
@@ -0,0 +1,3 @@
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -0,0 +1,3 @@
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -0,0 +1,3 @@
1
+ import { File, Context } from "../types.js";
2
+ import { GenerateOptions } from "../api.js";
3
+ export declare function generate(context: Context, options: GenerateOptions): File[];
@@ -1,5 +1,5 @@
1
1
  import * as ts from "typescript";
2
- import { Class, Interface, Context, Enum } from "./types";
2
+ import { Class, Interface, Context, Enum } from "./types.js";
3
3
  export declare function parseFiles(fileNames: string[], decoratorName?: string, context?: Context): {
4
4
  classes: Class[];
5
5
  interfaces: Interface[];
@@ -1,8 +1,8 @@
1
- import { OPERATION } from "../encoding/spec";
2
- import { Schema } from "../Schema";
3
- import type { Ref } from "../encoder/ChangeTree";
4
- import type { Decoder } from "./Decoder";
5
- import { Iterator } from "../encoding/decode";
1
+ import { OPERATION } from "../encoding/spec.js";
2
+ import { Schema } from "../Schema.js";
3
+ import type { Ref } from "../encoder/ChangeTree.js";
4
+ import type { Decoder } from "./Decoder.js";
5
+ import { Iterator } from "../encoding/decode.js";
6
6
  export interface DataChange<T = any, F = string> {
7
7
  ref: Ref;
8
8
  refId: number;
@@ -1,10 +1,10 @@
1
- import { TypeContext } from "../types/TypeContext";
2
- import { Schema } from "../Schema";
3
- import type { Ref } from "../encoder/ChangeTree";
4
- import type { Iterator } from "../encoding/decode";
5
- import { ReferenceTracker } from "./ReferenceTracker";
6
- import { type DataChange } from "./DecodeOperation";
7
- import { Collection } from "../types/HelperTypes";
1
+ import { TypeContext } from "../types/TypeContext.js";
2
+ import { Schema } from "../Schema.js";
3
+ import type { Ref } from "../encoder/ChangeTree.js";
4
+ import type { Iterator } from "../encoding/decode.js";
5
+ import { ReferenceTracker } from "./ReferenceTracker.js";
6
+ import { type DataChange } from "./DecodeOperation.js";
7
+ import { Collection } from "../types/HelperTypes.js";
8
8
  export declare class Decoder<T extends Schema = any> {
9
9
  context: TypeContext;
10
10
  state: T;
@@ -1,4 +1,4 @@
1
- import { Ref } from "../encoder/ChangeTree";
1
+ import { Ref } from "../encoder/ChangeTree.js";
2
2
  /**
3
3
  * Used for decoding only.
4
4
  */
@@ -1,13 +1,13 @@
1
- import { Collection, NonFunctionPropNames } from "../../types/HelperTypes";
2
- import { Ref } from "../../encoder/ChangeTree";
3
- import { Decoder } from "../Decoder";
4
- import { DataChange } from "../DecodeOperation";
5
- import { OPERATION } from "../../encoding/spec";
6
- import { Schema } from "../../Schema";
7
- import { $refId } from "../../types/symbols";
8
- import { MapSchema } from "../../types/custom/MapSchema";
9
- import { ArraySchema } from "../../types/custom/ArraySchema";
10
- import { type SchemaCallbackProxy } from "./getDecoderStateCallbacks";
1
+ import { Collection, NonFunctionPropNames } from "../../types/HelperTypes.js";
2
+ import { Ref } from "../../encoder/ChangeTree.js";
3
+ import { Decoder } from "../Decoder.js";
4
+ import { DataChange } from "../DecodeOperation.js";
5
+ import { OPERATION } from "../../encoding/spec.js";
6
+ import { Schema } from "../../Schema.js";
7
+ import { $refId } from "../../types/symbols.js";
8
+ import { MapSchema } from "../../types/custom/MapSchema.js";
9
+ import { ArraySchema } from "../../types/custom/ArraySchema.js";
10
+ import { type SchemaCallbackProxy } from "./getDecoderStateCallbacks.js";
11
11
  type PropertyChangeCallback<K> = (currentValue: K, previousValue: K) => void;
12
12
  type KeyValueCallback<K, V> = (key: K, value: V) => void;
13
13
  type InstanceChangeCallback = () => void;
@@ -49,7 +49,7 @@ export declare class StateCallbackStrategy<TState extends Schema> {
49
49
  protected isTriggering: boolean;
50
50
  constructor(decoder: Decoder<TState>);
51
51
  protected get callbacks(): {
52
- [refId: number]: import("../ReferenceTracker").SchemaCallbacks;
52
+ [refId: number]: import("../ReferenceTracker.js").SchemaCallbacks;
53
53
  };
54
54
  protected get state(): TState;
55
55
  protected addCallback(refId: number, operationOrProperty: OPERATION | string, handler: Function): () => void;
@@ -1,3 +1,3 @@
1
- import { DataChange } from "../DecodeOperation";
2
- import { Decoder } from "../Decoder";
1
+ import { DataChange } from "../DecodeOperation.js";
2
+ import { Decoder } from "../Decoder.js";
3
3
  export declare function getRawChangesCallback(decoder: Decoder, callback: (changes: DataChange[]) => void): void;
@@ -1,6 +1,6 @@
1
- import { Collection, NonFunctionNonPrimitivePropNames, NonFunctionPropNames } from "../../types/HelperTypes";
2
- import { Decoder } from "../Decoder";
3
- import { Schema } from "../../Schema";
1
+ import { Collection, NonFunctionNonPrimitivePropNames, NonFunctionPropNames } from "../../types/HelperTypes.js";
2
+ import { Decoder } from "../Decoder.js";
3
+ import { Schema } from "../../Schema.js";
4
4
  /**
5
5
  * TODO: define a schema interface, which even having duplicate definitions, it could be used to get the callback proxy.
6
6
  *
@@ -1,14 +1,14 @@
1
- import { OPERATION } from "../encoding/spec";
2
- import { Schema } from "../Schema";
3
- import { $changes, $decoder, $encoder, $getByIndex, $refId, type $deleteByIndex } from "../types/symbols";
4
- import type { MapSchema } from "../types/custom/MapSchema";
5
- import type { ArraySchema } from "../types/custom/ArraySchema";
6
- import type { CollectionSchema } from "../types/custom/CollectionSchema";
7
- import type { SetSchema } from "../types/custom/SetSchema";
8
- import { Root } from "./Root";
9
- import { Metadata } from "../Metadata";
10
- import type { EncodeOperation } from "./EncodeOperation";
11
- import type { DecodeOperation } from "../decoder/DecodeOperation";
1
+ import { OPERATION } from "../encoding/spec.js";
2
+ import { Schema } from "../Schema.js";
3
+ import { $changes, $decoder, $encoder, $getByIndex, $refId, type $deleteByIndex } from "../types/symbols.js";
4
+ import type { MapSchema } from "../types/custom/MapSchema.js";
5
+ import type { ArraySchema } from "../types/custom/ArraySchema.js";
6
+ import type { CollectionSchema } from "../types/custom/CollectionSchema.js";
7
+ import type { SetSchema } from "../types/custom/SetSchema.js";
8
+ import { Root } from "./Root.js";
9
+ import { Metadata } from "../Metadata.js";
10
+ import type { EncodeOperation } from "./EncodeOperation.js";
11
+ import type { DecodeOperation } from "../decoder/DecodeOperation.js";
12
12
  declare global {
13
13
  interface Object {
14
14
  [$changes]?: ChangeTree;
@@ -1,8 +1,8 @@
1
- import { OPERATION } from "../encoding/spec";
2
- import type { ChangeTree, Ref } from "./ChangeTree";
3
- import type { Encoder } from "./Encoder";
4
- import type { Iterator } from "../encoding/decode";
5
- import type { Metadata } from "../Metadata";
1
+ import { OPERATION } from "../encoding/spec.js";
2
+ import type { ChangeTree, Ref } from "./ChangeTree.js";
3
+ import type { Encoder } from "./Encoder.js";
4
+ import type { Iterator } from "../encoding/decode.js";
5
+ import type { Metadata } from "../Metadata.js";
6
6
  export type EncodeOperation<T extends Ref = any> = (encoder: Encoder, bytes: Uint8Array, changeTree: ChangeTree<T>, index: number, operation: OPERATION, it: Iterator, isEncodeAll: boolean, hasView: boolean, metadata?: Metadata) => void;
7
7
  export declare function encodeValue(encoder: Encoder, bytes: Uint8Array, type: any, value: any, operation: OPERATION, it: Iterator): void;
8
8
  /**
@@ -1,9 +1,9 @@
1
- import type { Schema } from "../Schema";
2
- import { TypeContext } from "../types/TypeContext";
3
- import type { Iterator } from "../encoding/decode";
4
- import { Root } from "./Root";
5
- import type { StateView } from "./StateView";
6
- import type { ChangeSetName } from "./ChangeTree";
1
+ import type { Schema } from "../Schema.js";
2
+ import { TypeContext } from "../types/TypeContext.js";
3
+ import type { Iterator } from "../encoding/decode.js";
4
+ import { Root } from "./Root.js";
5
+ import type { StateView } from "./StateView.js";
6
+ import type { ChangeSetName } from "./ChangeTree.js";
7
7
  export declare class Encoder<T extends Schema = any> {
8
8
  static BUFFER_SIZE: number;
9
9
  sharedBuffer: Uint8Array;
@@ -1,5 +1,5 @@
1
- import { TypeContext } from "../types/TypeContext";
2
- import { ChangeTree, ChangeTreeList, ChangeSetName, type ChangeTreeNode } from "./ChangeTree";
1
+ import { TypeContext } from "../types/TypeContext.js";
2
+ import { ChangeTree, ChangeTreeList, ChangeSetName, type ChangeTreeNode } from "./ChangeTree.js";
3
3
  export declare class Root {
4
4
  types: TypeContext;
5
5
  protected nextUniqueId: number;
@@ -1,4 +1,4 @@
1
- import { ChangeTree, IndexedOperations, Ref } from "./ChangeTree";
1
+ import { ChangeTree, IndexedOperations, Ref } from "./ChangeTree.js";
2
2
  export declare function createView(iterable?: boolean): StateView;
3
3
  export declare class StateView {
4
4
  iterable: boolean;
@@ -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
  export declare class EncodeSchemaError extends Error {
8
8
  }
9
9
  export declare function assertType(value: any, type: string, klass: Schema, field: string | number): void;
@@ -20,7 +20,7 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE
22
22
  */
23
- import type { BufferLike } from "./encode";
23
+ import type { BufferLike } from "./encode.js";
24
24
  /**
25
25
  * msgpack implementation highly based on notepack.io
26
26
  * https://github.com/darrachequesne/notepack
@@ -1,4 +1,4 @@
1
- import type { Iterator } from "./decode";
1
+ import type { Iterator } from "./decode.js";
2
2
  export type BufferLike = ArrayLike<number> & {
3
3
  [index: number]: number;
4
4
  };
@@ -5779,4 +5779,4 @@ exports.registerType = registerType;
5779
5779
  exports.schema = schema;
5780
5780
  exports.type = type;
5781
5781
  exports.view = view;
5782
- //# sourceMappingURL=index.js.map
5782
+ //# sourceMappingURL=index.cjs.map