@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.
Files changed (326) 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/src → 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/src → 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/src → build}/encoder/Root.d.ts +2 -2
  23. package/{lib/src → build}/encoder/StateView.d.ts +1 -1
  24. package/{lib/src → build}/encoding/assert.d.ts +6 -6
  25. package/{lib/src → build}/encoding/decode.d.ts +1 -1
  26. package/{lib/src → build}/encoding/encode.d.ts +1 -1
  27. package/build/index.cjs.map +1 -0
  28. package/build/index.d.ts +32 -0
  29. package/build/index.mjs.map +1 -0
  30. package/{lib → build}/types/HelperTypes.d.ts +6 -6
  31. package/{lib → build}/types/TypeContext.d.ts +1 -1
  32. package/{lib/src → build}/types/custom/ArraySchema.d.ts +8 -8
  33. package/{lib/src → build}/types/custom/CollectionSchema.d.ts +7 -7
  34. package/{lib → build}/types/custom/MapSchema.d.ts +7 -7
  35. package/{lib/src → build}/types/custom/SetSchema.d.ts +7 -7
  36. package/{lib/src → build}/types/registry.d.ts +2 -2
  37. package/{lib → build}/utils.d.ts +1 -1
  38. package/package.json +9 -10
  39. package/src/Metadata.ts +5 -5
  40. package/src/Reflection.ts +7 -7
  41. package/src/Schema.ts +11 -11
  42. package/src/annotations.ts +13 -13
  43. package/src/codegen/api.ts +3 -3
  44. package/src/codegen/cli.ts +2 -2
  45. package/src/codegen/languages/cpp.ts +2 -2
  46. package/src/codegen/languages/csharp.ts +3 -3
  47. package/src/codegen/languages/haxe.ts +2 -2
  48. package/src/codegen/languages/java.ts +2 -2
  49. package/src/codegen/languages/js.ts +2 -2
  50. package/src/codegen/languages/lua.ts +2 -2
  51. package/src/codegen/languages/ts.ts +2 -2
  52. package/src/codegen/parser.ts +6 -1
  53. package/src/decoder/DecodeOperation.ts +14 -14
  54. package/src/decoder/Decoder.ts +11 -11
  55. package/src/decoder/ReferenceTracker.ts +8 -8
  56. package/src/decoder/strategy/Callbacks.ts +12 -12
  57. package/src/decoder/strategy/RawChanges.ts +2 -2
  58. package/src/decoder/strategy/getDecoderStateCallbacks.ts +10 -10
  59. package/src/encoder/ChangeTree.ts +13 -13
  60. package/src/encoder/EncodeOperation.ts +9 -9
  61. package/src/encoder/Encoder.ts +10 -10
  62. package/src/encoder/Root.ts +4 -4
  63. package/src/encoder/StateView.ts +7 -7
  64. package/src/encoding/assert.ts +6 -6
  65. package/src/encoding/decode.ts +1 -1
  66. package/src/encoding/encode.ts +1 -1
  67. package/src/index.ts +27 -27
  68. package/src/types/HelperTypes.ts +6 -6
  69. package/src/types/TypeContext.ts +3 -3
  70. package/src/types/custom/ArraySchema.ts +11 -11
  71. package/src/types/custom/CollectionSchema.ts +9 -9
  72. package/src/types/custom/MapSchema.ts +10 -10
  73. package/src/types/custom/SetSchema.ts +9 -9
  74. package/src/types/registry.ts +3 -3
  75. package/src/utils.ts +3 -3
  76. package/src/v3_bench.ts +1 -1
  77. package/build/cjs/index.cjs.map +0 -1
  78. package/build/esm/index.mjs.map +0 -1
  79. package/lib/Metadata.js +0 -256
  80. package/lib/Metadata.js.map +0 -1
  81. package/lib/Reflection.js +0 -179
  82. package/lib/Reflection.js.map +0 -1
  83. package/lib/Schema.js +0 -352
  84. package/lib/Schema.js.map +0 -1
  85. package/lib/annotations.d.ts +0 -109
  86. package/lib/annotations.js +0 -473
  87. package/lib/annotations.js.map +0 -1
  88. package/lib/bench_encode.d.ts +0 -1
  89. package/lib/bench_encode.js +0 -91
  90. package/lib/bench_encode.js.map +0 -1
  91. package/lib/benchmark.d.ts +0 -1
  92. package/lib/benchmark.js +0 -218
  93. package/lib/benchmark.js.map +0 -1
  94. package/lib/codegen/api.js +0 -56
  95. package/lib/codegen/api.js.map +0 -1
  96. package/lib/codegen/argv.js +0 -39
  97. package/lib/codegen/argv.js.map +0 -1
  98. package/lib/codegen/cli.js +0 -58
  99. package/lib/codegen/cli.js.map +0 -1
  100. package/lib/codegen/languages/cpp.d.ts +0 -3
  101. package/lib/codegen/languages/cpp.js +0 -258
  102. package/lib/codegen/languages/cpp.js.map +0 -1
  103. package/lib/codegen/languages/csharp.d.ts +0 -4
  104. package/lib/codegen/languages/csharp.js +0 -154
  105. package/lib/codegen/languages/csharp.js.map +0 -1
  106. package/lib/codegen/languages/haxe.d.ts +0 -3
  107. package/lib/codegen/languages/haxe.js +0 -100
  108. package/lib/codegen/languages/haxe.js.map +0 -1
  109. package/lib/codegen/languages/java.js +0 -100
  110. package/lib/codegen/languages/java.js.map +0 -1
  111. package/lib/codegen/languages/js.d.ts +0 -3
  112. package/lib/codegen/languages/js.js +0 -101
  113. package/lib/codegen/languages/js.js.map +0 -1
  114. package/lib/codegen/languages/lua.d.ts +0 -3
  115. package/lib/codegen/languages/lua.js +0 -103
  116. package/lib/codegen/languages/lua.js.map +0 -1
  117. package/lib/codegen/languages/ts.d.ts +0 -3
  118. package/lib/codegen/languages/ts.js +0 -116
  119. package/lib/codegen/languages/ts.js.map +0 -1
  120. package/lib/codegen/parser.js +0 -327
  121. package/lib/codegen/parser.js.map +0 -1
  122. package/lib/codegen/types.js +0 -142
  123. package/lib/codegen/types.js.map +0 -1
  124. package/lib/decoder/DecodeOperation.js +0 -248
  125. package/lib/decoder/DecodeOperation.js.map +0 -1
  126. package/lib/decoder/Decoder.d.ts +0 -21
  127. package/lib/decoder/Decoder.js +0 -114
  128. package/lib/decoder/Decoder.js.map +0 -1
  129. package/lib/decoder/ReferenceTracker.js +0 -135
  130. package/lib/decoder/ReferenceTracker.js.map +0 -1
  131. package/lib/decoder/strategy/Callbacks.js +0 -336
  132. package/lib/decoder/strategy/Callbacks.js.map +0 -1
  133. package/lib/decoder/strategy/RawChanges.js +0 -4
  134. package/lib/decoder/strategy/RawChanges.js.map +0 -1
  135. package/lib/decoder/strategy/getDecoderStateCallbacks.js +0 -274
  136. package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
  137. package/lib/encoder/ChangeTree.js +0 -534
  138. package/lib/encoder/ChangeTree.js.map +0 -1
  139. package/lib/encoder/EncodeOperation.js +0 -132
  140. package/lib/encoder/EncodeOperation.js.map +0 -1
  141. package/lib/encoder/Encoder.js +0 -204
  142. package/lib/encoder/Encoder.js.map +0 -1
  143. package/lib/encoder/Root.d.ts +0 -28
  144. package/lib/encoder/Root.js +0 -229
  145. package/lib/encoder/Root.js.map +0 -1
  146. package/lib/encoder/StateView.d.ts +0 -34
  147. package/lib/encoder/StateView.js +0 -279
  148. package/lib/encoder/StateView.js.map +0 -1
  149. package/lib/encoding/assert.d.ts +0 -10
  150. package/lib/encoding/assert.js +0 -49
  151. package/lib/encoding/assert.js.map +0 -1
  152. package/lib/encoding/decode.d.ts +0 -67
  153. package/lib/encoding/decode.js +0 -217
  154. package/lib/encoding/decode.js.map +0 -1
  155. package/lib/encoding/encode.d.ts +0 -40
  156. package/lib/encoding/encode.js +0 -279
  157. package/lib/encoding/encode.js.map +0 -1
  158. package/lib/encoding/spec.js +0 -26
  159. package/lib/encoding/spec.js.map +0 -1
  160. package/lib/index.d.ts +0 -32
  161. package/lib/index.js +0 -39
  162. package/lib/index.js.map +0 -1
  163. package/lib/src/Metadata.d.ts +0 -49
  164. package/lib/src/Metadata.js +0 -256
  165. package/lib/src/Metadata.js.map +0 -1
  166. package/lib/src/Reflection.d.ts +0 -71
  167. package/lib/src/Reflection.js +0 -179
  168. package/lib/src/Reflection.js.map +0 -1
  169. package/lib/src/Schema.d.ts +0 -86
  170. package/lib/src/Schema.js +0 -352
  171. package/lib/src/Schema.js.map +0 -1
  172. package/lib/src/annotations.js +0 -473
  173. package/lib/src/annotations.js.map +0 -1
  174. package/lib/src/bench_encode.d.ts +0 -1
  175. package/lib/src/bench_encode.js +0 -91
  176. package/lib/src/bench_encode.js.map +0 -1
  177. package/lib/src/codegen/api.d.ts +0 -7
  178. package/lib/src/codegen/api.js +0 -56
  179. package/lib/src/codegen/api.js.map +0 -1
  180. package/lib/src/codegen/argv.d.ts +0 -6
  181. package/lib/src/codegen/argv.js +0 -39
  182. package/lib/src/codegen/argv.js.map +0 -1
  183. package/lib/src/codegen/cli.d.ts +0 -1
  184. package/lib/src/codegen/cli.js +0 -58
  185. package/lib/src/codegen/cli.js.map +0 -1
  186. package/lib/src/codegen/languages/cpp.d.ts +0 -3
  187. package/lib/src/codegen/languages/cpp.js +0 -258
  188. package/lib/src/codegen/languages/cpp.js.map +0 -1
  189. package/lib/src/codegen/languages/csharp.d.ts +0 -4
  190. package/lib/src/codegen/languages/csharp.js +0 -154
  191. package/lib/src/codegen/languages/csharp.js.map +0 -1
  192. package/lib/src/codegen/languages/haxe.d.ts +0 -3
  193. package/lib/src/codegen/languages/haxe.js +0 -100
  194. package/lib/src/codegen/languages/haxe.js.map +0 -1
  195. package/lib/src/codegen/languages/java.d.ts +0 -6
  196. package/lib/src/codegen/languages/java.js +0 -100
  197. package/lib/src/codegen/languages/java.js.map +0 -1
  198. package/lib/src/codegen/languages/js.d.ts +0 -3
  199. package/lib/src/codegen/languages/js.js +0 -101
  200. package/lib/src/codegen/languages/js.js.map +0 -1
  201. package/lib/src/codegen/languages/lua.d.ts +0 -3
  202. package/lib/src/codegen/languages/lua.js +0 -103
  203. package/lib/src/codegen/languages/lua.js.map +0 -1
  204. package/lib/src/codegen/languages/ts.d.ts +0 -3
  205. package/lib/src/codegen/languages/ts.js +0 -116
  206. package/lib/src/codegen/languages/ts.js.map +0 -1
  207. package/lib/src/codegen/parser.d.ts +0 -13
  208. package/lib/src/codegen/parser.js +0 -327
  209. package/lib/src/codegen/parser.js.map +0 -1
  210. package/lib/src/codegen/types.d.ts +0 -52
  211. package/lib/src/codegen/types.js +0 -142
  212. package/lib/src/codegen/types.js.map +0 -1
  213. package/lib/src/decoder/DecodeOperation.d.ts +0 -23
  214. package/lib/src/decoder/DecodeOperation.js +0 -248
  215. package/lib/src/decoder/DecodeOperation.js.map +0 -1
  216. package/lib/src/decoder/Decoder.js +0 -114
  217. package/lib/src/decoder/Decoder.js.map +0 -1
  218. package/lib/src/decoder/ReferenceTracker.d.ts +0 -25
  219. package/lib/src/decoder/ReferenceTracker.js +0 -135
  220. package/lib/src/decoder/ReferenceTracker.js.map +0 -1
  221. package/lib/src/decoder/strategy/Callbacks.d.ts +0 -154
  222. package/lib/src/decoder/strategy/Callbacks.js +0 -336
  223. package/lib/src/decoder/strategy/Callbacks.js.map +0 -1
  224. package/lib/src/decoder/strategy/RawChanges.d.ts +0 -3
  225. package/lib/src/decoder/strategy/RawChanges.js +0 -4
  226. package/lib/src/decoder/strategy/RawChanges.js.map +0 -1
  227. package/lib/src/decoder/strategy/getDecoderStateCallbacks.d.ts +0 -76
  228. package/lib/src/decoder/strategy/getDecoderStateCallbacks.js +0 -274
  229. package/lib/src/decoder/strategy/getDecoderStateCallbacks.js.map +0 -1
  230. package/lib/src/encoder/ChangeTree.d.ts +0 -135
  231. package/lib/src/encoder/ChangeTree.js +0 -534
  232. package/lib/src/encoder/ChangeTree.js.map +0 -1
  233. package/lib/src/encoder/EncodeOperation.d.ts +0 -22
  234. package/lib/src/encoder/EncodeOperation.js +0 -132
  235. package/lib/src/encoder/EncodeOperation.js.map +0 -1
  236. package/lib/src/encoder/Encoder.d.ts +0 -22
  237. package/lib/src/encoder/Encoder.js +0 -204
  238. package/lib/src/encoder/Encoder.js.map +0 -1
  239. package/lib/src/encoder/Root.js +0 -229
  240. package/lib/src/encoder/Root.js.map +0 -1
  241. package/lib/src/encoder/StateView.js +0 -279
  242. package/lib/src/encoder/StateView.js.map +0 -1
  243. package/lib/src/encoding/assert.js +0 -49
  244. package/lib/src/encoding/assert.js.map +0 -1
  245. package/lib/src/encoding/decode.js +0 -217
  246. package/lib/src/encoding/decode.js.map +0 -1
  247. package/lib/src/encoding/encode.js +0 -279
  248. package/lib/src/encoding/encode.js.map +0 -1
  249. package/lib/src/encoding/spec.d.ts +0 -24
  250. package/lib/src/encoding/spec.js +0 -26
  251. package/lib/src/encoding/spec.js.map +0 -1
  252. package/lib/src/index.d.ts +0 -32
  253. package/lib/src/index.js +0 -39
  254. package/lib/src/index.js.map +0 -1
  255. package/lib/src/symbol.shim.js +0 -3
  256. package/lib/src/symbol.shim.js.map +0 -1
  257. package/lib/src/types/HelperTypes.d.ts +0 -77
  258. package/lib/src/types/HelperTypes.js +0 -2
  259. package/lib/src/types/HelperTypes.js.map +0 -1
  260. package/lib/src/types/TypeContext.d.ts +0 -31
  261. package/lib/src/types/TypeContext.js +0 -143
  262. package/lib/src/types/TypeContext.js.map +0 -1
  263. package/lib/src/types/custom/ArraySchema.js +0 -733
  264. package/lib/src/types/custom/ArraySchema.js.map +0 -1
  265. package/lib/src/types/custom/CollectionSchema.js +0 -170
  266. package/lib/src/types/custom/CollectionSchema.js.map +0 -1
  267. package/lib/src/types/custom/MapSchema.d.ts +0 -51
  268. package/lib/src/types/custom/MapSchema.js +0 -222
  269. package/lib/src/types/custom/MapSchema.js.map +0 -1
  270. package/lib/src/types/custom/SetSchema.js +0 -178
  271. package/lib/src/types/custom/SetSchema.js.map +0 -1
  272. package/lib/src/types/registry.js +0 -30
  273. package/lib/src/types/registry.js.map +0 -1
  274. package/lib/src/types/symbols.js +0 -34
  275. package/lib/src/types/symbols.js.map +0 -1
  276. package/lib/src/types/utils.js +0 -13
  277. package/lib/src/types/utils.js.map +0 -1
  278. package/lib/src/utils.d.ts +0 -13
  279. package/lib/src/utils.js +0 -49
  280. package/lib/src/utils.js.map +0 -1
  281. package/lib/src/v3_bench.js +0 -128
  282. package/lib/src/v3_bench.js.map +0 -1
  283. package/lib/symbol.shim.d.ts +0 -6
  284. package/lib/symbol.shim.js +0 -3
  285. package/lib/symbol.shim.js.map +0 -1
  286. package/lib/types/HelperTypes.js +0 -2
  287. package/lib/types/HelperTypes.js.map +0 -1
  288. package/lib/types/TypeContext.js +0 -143
  289. package/lib/types/TypeContext.js.map +0 -1
  290. package/lib/types/custom/ArraySchema.d.ts +0 -270
  291. package/lib/types/custom/ArraySchema.js +0 -733
  292. package/lib/types/custom/ArraySchema.js.map +0 -1
  293. package/lib/types/custom/CollectionSchema.d.ts +0 -51
  294. package/lib/types/custom/CollectionSchema.js +0 -170
  295. package/lib/types/custom/CollectionSchema.js.map +0 -1
  296. package/lib/types/custom/MapSchema.js +0 -222
  297. package/lib/types/custom/MapSchema.js.map +0 -1
  298. package/lib/types/custom/SetSchema.d.ts +0 -48
  299. package/lib/types/custom/SetSchema.js +0 -178
  300. package/lib/types/custom/SetSchema.js.map +0 -1
  301. package/lib/types/registry.d.ts +0 -16
  302. package/lib/types/registry.js +0 -30
  303. package/lib/types/registry.js.map +0 -1
  304. package/lib/types/symbols.d.ts +0 -33
  305. package/lib/types/symbols.js +0 -34
  306. package/lib/types/symbols.js.map +0 -1
  307. package/lib/types/utils.d.ts +0 -1
  308. package/lib/types/utils.js +0 -13
  309. package/lib/types/utils.js.map +0 -1
  310. package/lib/utils.js +0 -49
  311. package/lib/utils.js.map +0 -1
  312. package/lib/v3_bench.d.ts +0 -1
  313. package/lib/v3_bench.js +0 -128
  314. package/lib/v3_bench.js.map +0 -1
  315. /package/{lib → build}/codegen/api.d.ts +0 -0
  316. /package/{lib → build}/codegen/argv.d.ts +0 -0
  317. /package/{lib → build}/codegen/cli.d.ts +0 -0
  318. /package/{lib → build}/codegen/types.d.ts +0 -0
  319. /package/{lib → build}/encoding/spec.d.ts +0 -0
  320. /package/build/{cjs/index.cjs → index.cjs} +0 -0
  321. /package/build/{umd/index.js → index.js} +0 -0
  322. /package/build/{esm/index.mjs → index.mjs} +0 -0
  323. /package/{lib/src → build}/symbol.shim.d.ts +0 -0
  324. /package/{lib/src → build}/types/symbols.d.ts +0 -0
  325. /package/{lib/src → build}/types/utils.d.ts +0 -0
  326. /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,4 +1,4 @@
1
- import { Schema } from "../Schema";
1
+ import { Schema } from "../Schema.js";
2
2
  export declare class TypeContext {
3
3
  types: {
4
4
  [id: number]: typeof Schema;
@@ -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;
@@ -1,4 +1,4 @@
1
- import type { Schema } from "./Schema";
1
+ import type { Schema } from "./Schema.js";
2
2
  interface ChangeDump {
3
3
  ops: {
4
4
  ADD?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colyseus/schema",
3
- "version": "4.0.2",
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": "lib/index.d.ts",
36
- "main": "build/cjs/index.cjs",
37
- "module": "build/esm/index.mjs",
38
- "browser": "./build/umd/index.js",
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/umd/index.js",
42
- "import": "./build/esm/index.mjs",
43
- "require": "./build/cjs/index.cjs",
44
- "types": "./lib/index.d.ts"
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
@@ -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" |
@@ -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");
@@ -1,5 +1,5 @@
1
- import argv from "./argv";
2
- import { generate } from "./api";
1
+ import argv from "./argv.js";
2
+ import { generate } from "./api.js";
3
3
 
4
4
  const supportedTargets: Record<string, string> = {
5
5
  csharp: 'generate for C#/Unity',
@@ -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",
@@ -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,
@@ -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,5 +1,5 @@
1
- import { DataChange } from "../DecodeOperation";
2
- import { Decoder } from "../Decoder";
1
+ import { DataChange } from "../DecodeOperation.js";
2
+ import { Decoder } from "../Decoder.js";
3
3
 
4
4
  export function getRawChangesCallback(
5
5
  decoder: Decoder,
@@ -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,