@norskvideo/moq-net 0.1.2 → 0.1.4

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 (310) hide show
  1. package/README.md +1 -0
  2. package/announced.d.ts +111 -21
  3. package/announced.d.ts.map +1 -1
  4. package/announced.js +213 -40
  5. package/announced.js.map +1 -1
  6. package/broadcast.d.ts +80 -25
  7. package/broadcast.d.ts.map +1 -1
  8. package/broadcast.js +270 -49
  9. package/broadcast.js.map +1 -1
  10. package/connection/accept.d.ts +6 -0
  11. package/connection/accept.d.ts.map +1 -1
  12. package/connection/accept.js +42 -13
  13. package/connection/accept.js.map +1 -1
  14. package/connection/browser.d.ts +5 -0
  15. package/connection/browser.d.ts.map +1 -0
  16. package/connection/browser.js +31 -0
  17. package/connection/browser.js.map +1 -0
  18. package/connection/connect.d.ts +43 -1
  19. package/connection/connect.d.ts.map +1 -1
  20. package/connection/connect.js +118 -123
  21. package/connection/connect.js.map +1 -1
  22. package/connection/established.d.ts +43 -16
  23. package/connection/established.d.ts.map +1 -1
  24. package/connection/established.js.map +1 -1
  25. package/connection/handshake.d.ts +12 -1
  26. package/connection/handshake.d.ts.map +1 -1
  27. package/connection/handshake.js +30 -14
  28. package/connection/handshake.js.map +1 -1
  29. package/connection/index.d.ts +8 -0
  30. package/connection/index.d.ts.map +1 -1
  31. package/connection/index.js +6 -0
  32. package/connection/index.js.map +1 -1
  33. package/connection/reload.d.ts +66 -9
  34. package/connection/reload.d.ts.map +1 -1
  35. package/connection/reload.js +192 -66
  36. package/connection/reload.js.map +1 -1
  37. package/connection/stats.d.ts +92 -0
  38. package/connection/stats.d.ts.map +1 -0
  39. package/connection/stats.js +35 -0
  40. package/connection/stats.js.map +1 -0
  41. package/connection/transport.d.ts +10 -0
  42. package/connection/transport.d.ts.map +1 -0
  43. package/connection/transport.js +12 -0
  44. package/connection/transport.js.map +1 -0
  45. package/consume.d.ts +44 -0
  46. package/consume.d.ts.map +1 -0
  47. package/consume.js +60 -0
  48. package/consume.js.map +1 -0
  49. package/datagram.d.ts +23 -0
  50. package/datagram.d.ts.map +1 -0
  51. package/datagram.js +3 -0
  52. package/datagram.js.map +1 -0
  53. package/error.d.ts +76 -0
  54. package/error.d.ts.map +1 -0
  55. package/error.js +107 -0
  56. package/error.js.map +1 -0
  57. package/group.d.ts +143 -38
  58. package/group.d.ts.map +1 -1
  59. package/group.js +270 -68
  60. package/group.js.map +1 -1
  61. package/ietf/adapter.d.ts +2 -2
  62. package/ietf/adapter.d.ts.map +1 -1
  63. package/ietf/adapter.js +20 -10
  64. package/ietf/adapter.js.map +1 -1
  65. package/ietf/aliases.d.ts +73 -5
  66. package/ietf/aliases.d.ts.map +1 -1
  67. package/ietf/aliases.js +121 -14
  68. package/ietf/aliases.js.map +1 -1
  69. package/ietf/cluster.d.ts +141 -0
  70. package/ietf/cluster.d.ts.map +1 -0
  71. package/ietf/cluster.js +204 -0
  72. package/ietf/cluster.js.map +1 -0
  73. package/ietf/connection.d.ts +39 -6
  74. package/ietf/connection.d.ts.map +1 -1
  75. package/ietf/connection.js +73 -12
  76. package/ietf/connection.js.map +1 -1
  77. package/ietf/fetch.d.ts +17 -0
  78. package/ietf/fetch.d.ts.map +1 -1
  79. package/ietf/fetch.js +21 -0
  80. package/ietf/fetch.js.map +1 -1
  81. package/ietf/filter.d.ts +87 -0
  82. package/ietf/filter.d.ts.map +1 -0
  83. package/ietf/filter.js +292 -0
  84. package/ietf/filter.js.map +1 -0
  85. package/ietf/index.d.ts +2 -0
  86. package/ietf/index.d.ts.map +1 -1
  87. package/ietf/index.js +3 -0
  88. package/ietf/index.js.map +1 -1
  89. package/ietf/namespace.d.ts +6 -0
  90. package/ietf/namespace.d.ts.map +1 -1
  91. package/ietf/namespace.js +27 -2
  92. package/ietf/namespace.js.map +1 -1
  93. package/ietf/object.d.ts +54 -6
  94. package/ietf/object.d.ts.map +1 -1
  95. package/ietf/object.js +178 -25
  96. package/ietf/object.js.map +1 -1
  97. package/ietf/parameters.d.ts +35 -10
  98. package/ietf/parameters.d.ts.map +1 -1
  99. package/ietf/parameters.js +236 -45
  100. package/ietf/parameters.js.map +1 -1
  101. package/ietf/priority.d.ts +5 -0
  102. package/ietf/priority.d.ts.map +1 -0
  103. package/ietf/priority.js +10 -0
  104. package/ietf/priority.js.map +1 -0
  105. package/ietf/properties.d.ts +13 -2
  106. package/ietf/properties.d.ts.map +1 -1
  107. package/ietf/properties.js +65 -8
  108. package/ietf/properties.js.map +1 -1
  109. package/ietf/publish.d.ts.map +1 -1
  110. package/ietf/publish.js +13 -3
  111. package/ietf/publish.js.map +1 -1
  112. package/ietf/publish_namespace.d.ts +16 -2
  113. package/ietf/publish_namespace.d.ts.map +1 -1
  114. package/ietf/publish_namespace.js +25 -6
  115. package/ietf/publish_namespace.js.map +1 -1
  116. package/ietf/publisher.d.ts +40 -7
  117. package/ietf/publisher.d.ts.map +1 -1
  118. package/ietf/publisher.js +751 -134
  119. package/ietf/publisher.js.map +1 -1
  120. package/ietf/request.js +1 -1
  121. package/ietf/request.js.map +1 -1
  122. package/ietf/solicit.d.ts +41 -0
  123. package/ietf/solicit.d.ts.map +1 -0
  124. package/ietf/solicit.js +47 -0
  125. package/ietf/solicit.js.map +1 -0
  126. package/ietf/subscribe.d.ts +41 -2
  127. package/ietf/subscribe.d.ts.map +1 -1
  128. package/ietf/subscribe.js +103 -22
  129. package/ietf/subscribe.js.map +1 -1
  130. package/ietf/subscribe_namespace.d.ts +21 -7
  131. package/ietf/subscribe_namespace.d.ts.map +1 -1
  132. package/ietf/subscribe_namespace.js +31 -14
  133. package/ietf/subscribe_namespace.js.map +1 -1
  134. package/ietf/subscriber.d.ts +20 -7
  135. package/ietf/subscriber.d.ts.map +1 -1
  136. package/ietf/subscriber.js +512 -142
  137. package/ietf/subscriber.js.map +1 -1
  138. package/ietf/version.d.ts +7 -1
  139. package/ietf/version.d.ts.map +1 -1
  140. package/ietf/version.js +7 -0
  141. package/ietf/version.js.map +1 -1
  142. package/index.d.ts +10 -5
  143. package/index.d.ts.map +1 -1
  144. package/index.js +10 -5
  145. package/index.js.map +1 -1
  146. package/internal.d.ts +29 -0
  147. package/internal.d.ts.map +1 -0
  148. package/internal.js +8 -0
  149. package/internal.js.map +1 -0
  150. package/lite/announce.d.ts +62 -15
  151. package/lite/announce.d.ts.map +1 -1
  152. package/lite/announce.js +230 -94
  153. package/lite/announce.js.map +1 -1
  154. package/lite/connection.d.ts +69 -20
  155. package/lite/connection.d.ts.map +1 -1
  156. package/lite/connection.js +128 -81
  157. package/lite/connection.js.map +1 -1
  158. package/lite/datagram.d.ts +23 -0
  159. package/lite/datagram.d.ts.map +1 -0
  160. package/lite/datagram.js +57 -0
  161. package/lite/datagram.js.map +1 -0
  162. package/lite/datagram_stream.d.ts +8 -0
  163. package/lite/datagram_stream.d.ts.map +1 -0
  164. package/lite/datagram_stream.js +44 -0
  165. package/lite/datagram_stream.js.map +1 -0
  166. package/lite/fetch.d.ts.map +1 -1
  167. package/lite/fetch.js +2 -2
  168. package/lite/fetch.js.map +1 -1
  169. package/lite/index.d.ts +3 -0
  170. package/lite/index.d.ts.map +1 -1
  171. package/lite/index.js +3 -0
  172. package/lite/index.js.map +1 -1
  173. package/lite/priority.d.ts +67 -0
  174. package/lite/priority.d.ts.map +1 -0
  175. package/lite/priority.js +114 -0
  176. package/lite/priority.js.map +1 -0
  177. package/lite/probe.d.ts +18 -2
  178. package/lite/probe.d.ts.map +1 -1
  179. package/lite/probe.js +24 -22
  180. package/lite/probe.js.map +1 -1
  181. package/lite/publisher.d.ts +14 -7
  182. package/lite/publisher.d.ts.map +1 -1
  183. package/lite/publisher.js +406 -84
  184. package/lite/publisher.js.map +1 -1
  185. package/lite/setup.d.ts +83 -6
  186. package/lite/setup.d.ts.map +1 -1
  187. package/lite/setup.js +203 -31
  188. package/lite/setup.js.map +1 -1
  189. package/lite/stream.d.ts +12 -3
  190. package/lite/stream.d.ts.map +1 -1
  191. package/lite/stream.js +7 -4
  192. package/lite/stream.js.map +1 -1
  193. package/lite/subscribe.d.ts +37 -23
  194. package/lite/subscribe.d.ts.map +1 -1
  195. package/lite/subscribe.js +70 -55
  196. package/lite/subscribe.js.map +1 -1
  197. package/lite/subscriber.d.ts +29 -23
  198. package/lite/subscriber.d.ts.map +1 -1
  199. package/lite/subscriber.js +689 -112
  200. package/lite/subscriber.js.map +1 -1
  201. package/lite/track.d.ts +25 -13
  202. package/lite/track.d.ts.map +1 -1
  203. package/lite/track.js +60 -35
  204. package/lite/track.js.map +1 -1
  205. package/lite/version.d.ts +39 -4
  206. package/lite/version.d.ts.map +1 -1
  207. package/lite/version.js +139 -17
  208. package/lite/version.js.map +1 -1
  209. package/mock.d.ts +53 -3
  210. package/mock.d.ts.map +1 -1
  211. package/mock.js +110 -21
  212. package/mock.js.map +1 -1
  213. package/{lite/origin.d.ts → origin.d.ts} +25 -1
  214. package/origin.d.ts.map +1 -0
  215. package/{lite/origin.js → origin.js} +25 -1
  216. package/origin.js.map +1 -0
  217. package/package.json +6 -4
  218. package/path.d.ts +67 -0
  219. package/path.d.ts.map +1 -1
  220. package/path.js +128 -0
  221. package/path.js.map +1 -1
  222. package/stream.d.ts +94 -4
  223. package/stream.d.ts.map +1 -1
  224. package/stream.js +128 -17
  225. package/stream.js.map +1 -1
  226. package/time.d.ts +109 -86
  227. package/time.d.ts.map +1 -1
  228. package/time.js +80 -30
  229. package/time.js.map +1 -1
  230. package/track.d.ts +298 -47
  231. package/track.d.ts.map +1 -1
  232. package/track.js +721 -109
  233. package/track.js.map +1 -1
  234. package/util/timeout.d.ts +5 -0
  235. package/util/timeout.d.ts.map +1 -0
  236. package/util/timeout.js +18 -0
  237. package/util/timeout.js.map +1 -0
  238. package/util/utf8.d.ts +3 -0
  239. package/util/utf8.d.ts.map +1 -0
  240. package/util/utf8.js +7 -0
  241. package/util/utf8.js.map +1 -0
  242. package/varint.d.ts +14 -3
  243. package/varint.d.ts.map +1 -1
  244. package/varint.js +23 -12
  245. package/varint.js.map +1 -1
  246. package/zod.d.ts +5 -5
  247. package/zod.d.ts.map +1 -1
  248. package/zod.js.map +1 -1
  249. package/bandwidth.d.ts +0 -11
  250. package/bandwidth.d.ts.map +0 -1
  251. package/bandwidth.js +0 -7
  252. package/bandwidth.js.map +0 -1
  253. package/connection/cert.test.d.ts +0 -2
  254. package/connection/cert.test.d.ts.map +0 -1
  255. package/connection/cert.test.js +0 -26
  256. package/connection/cert.test.js.map +0 -1
  257. package/connection/reload.test.d.ts +0 -2
  258. package/connection/reload.test.d.ts.map +0 -1
  259. package/connection/reload.test.js +0 -39
  260. package/connection/reload.test.js.map +0 -1
  261. package/group.test.d.ts +0 -2
  262. package/group.test.d.ts.map +0 -1
  263. package/group.test.js +0 -66
  264. package/group.test.js.map +0 -1
  265. package/ietf/aliases.test.d.ts +0 -2
  266. package/ietf/aliases.test.d.ts.map +0 -1
  267. package/ietf/aliases.test.js +0 -30
  268. package/ietf/aliases.test.js.map +0 -1
  269. package/ietf/ietf.test.d.ts +0 -2
  270. package/ietf/ietf.test.d.ts.map +0 -1
  271. package/ietf/ietf.test.js +0 -873
  272. package/ietf/ietf.test.js.map +0 -1
  273. package/integration.test.d.ts +0 -2
  274. package/integration.test.d.ts.map +0 -1
  275. package/integration.test.js +0 -90
  276. package/integration.test.js.map +0 -1
  277. package/lite/origin.d.ts.map +0 -1
  278. package/lite/origin.js.map +0 -1
  279. package/lite/subscriber.test.d.ts +0 -2
  280. package/lite/subscriber.test.d.ts.map +0 -1
  281. package/lite/subscriber.test.js +0 -30
  282. package/lite/subscriber.test.js.map +0 -1
  283. package/lite/track.test.d.ts +0 -2
  284. package/lite/track.test.d.ts.map +0 -1
  285. package/lite/track.test.js +0 -53
  286. package/lite/track.test.js.map +0 -1
  287. package/path.test.d.ts +0 -2
  288. package/path.test.d.ts.map +0 -1
  289. package/path.test.js +0 -169
  290. package/path.test.js.map +0 -1
  291. package/stream.test.d.ts +0 -2
  292. package/stream.test.d.ts.map +0 -1
  293. package/stream.test.js +0 -210
  294. package/stream.test.js.map +0 -1
  295. package/track.test.d.ts +0 -2
  296. package/track.test.d.ts.map +0 -1
  297. package/track.test.js +0 -56
  298. package/track.test.js.map +0 -1
  299. package/util/error.d.ts +0 -3
  300. package/util/error.d.ts.map +0 -1
  301. package/util/error.js +0 -9
  302. package/util/error.js.map +0 -1
  303. package/util/index.d.ts +0 -2
  304. package/util/index.d.ts.map +0 -1
  305. package/util/index.js +0 -3
  306. package/util/index.js.map +0 -1
  307. package/varint.test.d.ts +0 -2
  308. package/varint.test.d.ts.map +0 -1
  309. package/varint.test.js +0 -106
  310. package/varint.test.js.map +0 -1
package/path.test.js DELETED
@@ -1,169 +0,0 @@
1
- /* @ts-self-types="./path.test.d.ts" */
2
- import { expect, test } from "bun:test";
3
- import * as Path from "./path.js";
4
- test("Path constructor trims leading and trailing slashes", () => {
5
- expect(Path.from("/foo/bar/")).toBe("foo/bar");
6
- expect(Path.from("///foo/bar///")).toBe("foo/bar");
7
- expect(Path.from("foo/bar")).toBe("foo/bar");
8
- });
9
- test("Path constructor handles empty paths", () => {
10
- expect(Path.from("")).toBe("");
11
- expect(Path.from("/")).toBe("");
12
- expect(Path.from("///")).toBe("");
13
- });
14
- test("hasPrefix matches exact paths", () => {
15
- const path = Path.from("foo/bar");
16
- expect(Path.hasPrefix(Path.from("foo/bar"), path)).toBe(true);
17
- });
18
- test("hasPrefix matches proper prefixes", () => {
19
- const path = Path.from("foo/bar/baz");
20
- expect(Path.hasPrefix(Path.from("foo"), path)).toBe(true);
21
- expect(Path.hasPrefix(Path.from("foo/bar"), path)).toBe(true);
22
- });
23
- test("hasPrefix does not match partial segment prefixes", () => {
24
- const path = Path.from("foobar");
25
- expect(Path.hasPrefix(Path.from("foo"), path)).toBe(false);
26
- const path2 = Path.from("foo/bar");
27
- expect(Path.hasPrefix(Path.from("fo"), path2)).toBe(false);
28
- });
29
- test("hasPrefix handles empty prefix", () => {
30
- const path = Path.from("foo/bar");
31
- expect(Path.hasPrefix(Path.empty(), path)).toBe(true);
32
- });
33
- test("hasPrefix ignores trailing slashes in prefix", () => {
34
- const path = Path.from("foo/bar");
35
- expect(Path.hasPrefix(Path.from("foo/"), path)).toBe(true);
36
- expect(Path.hasPrefix(Path.from("foo/bar/"), path)).toBe(true);
37
- });
38
- test("stripPrefix strips valid prefixes", () => {
39
- const path = Path.from("foo/bar/baz");
40
- const suffix1 = Path.stripPrefix(Path.from("foo"), path);
41
- expect(suffix1).toBe("bar/baz");
42
- const suffix2 = Path.stripPrefix(Path.from("foo/bar"), path);
43
- expect(suffix2).toBe("baz");
44
- const suffix3 = Path.stripPrefix(Path.from("foo/bar/baz"), path);
45
- expect(suffix3).toBe("");
46
- });
47
- test("stripPrefix returns null for invalid prefixes", () => {
48
- const path = Path.from("foo/bar");
49
- expect(Path.stripPrefix(Path.from("notfound"), path)).toBe(null);
50
- expect(Path.stripPrefix(Path.from("fo"), path)).toBe(null);
51
- });
52
- test("stripPrefix handles empty prefix", () => {
53
- const path = Path.from("foo/bar");
54
- const result = Path.stripPrefix(Path.empty(), path);
55
- expect(result).toBe("foo/bar");
56
- });
57
- test("stripPrefix accepts Path instances", () => {
58
- const path = Path.from("foo/bar/baz");
59
- const prefix = Path.from("foo/bar");
60
- const result = Path.stripPrefix(prefix, path);
61
- expect(result).toBe("baz");
62
- });
63
- test("join paths with slashes", () => {
64
- const base = Path.from("foo");
65
- const joined = Path.join(base, Path.from("bar"));
66
- expect(joined).toBe("foo/bar");
67
- });
68
- test("join handles empty base", () => {
69
- const base = Path.empty();
70
- const joined = Path.join(base, Path.from("bar"));
71
- expect(joined).toBe("bar");
72
- });
73
- test("join handles empty suffix", () => {
74
- const base = Path.from("foo");
75
- const joined = Path.join(base, Path.empty());
76
- expect(joined).toBe("foo");
77
- });
78
- test("join accepts Path instances", () => {
79
- const base = Path.from("foo");
80
- const suffix = Path.from("bar");
81
- const joined = Path.join(base, suffix);
82
- expect(joined).toBe("foo/bar");
83
- });
84
- test("join handles multiple joins", () => {
85
- const path = Path.join(Path.join(Path.join(Path.from("api"), Path.from("v1")), Path.from("users")), Path.from("123"));
86
- expect(path).toBe("api/v1/users/123");
87
- });
88
- test("isEmpty checks correctly", () => {
89
- expect(Path.from("") === "").toBe(true);
90
- expect(Path.from("foo") === "").toBe(false);
91
- expect(Path.empty() === "").toBe(true);
92
- });
93
- test("length property works correctly", () => {
94
- expect(Path.from("foo").length).toBe(3);
95
- expect(Path.from("foo/bar").length).toBe(7);
96
- expect(Path.empty().length).toBe(0);
97
- });
98
- test("equals checks correctly", () => {
99
- const path1 = Path.from("foo/bar");
100
- const path2 = Path.from("/foo/bar/");
101
- const path3 = Path.from("foo/baz");
102
- expect(path1 === path2).toBe(true);
103
- expect(path1 === path3).toBe(false);
104
- });
105
- test("JSON serialization works", () => {
106
- const path = Path.from("foo/bar");
107
- expect(JSON.stringify(path)).toBe('"foo/bar"');
108
- });
109
- test("handles paths with multiple consecutive slashes", () => {
110
- const path = Path.from("foo//bar///baz");
111
- // Multiple consecutive slashes are collapsed to single slashes
112
- expect(path).toBe("foo/bar/baz");
113
- });
114
- test("removes multiple slashes comprehensively", () => {
115
- // Test various multiple slash scenarios
116
- expect(Path.from("foo//bar")).toBe("foo/bar");
117
- expect(Path.from("foo///bar")).toBe("foo/bar");
118
- expect(Path.from("foo////bar")).toBe("foo/bar");
119
- // Multiple occurrences of double slashes
120
- expect(Path.from("foo//bar//baz")).toBe("foo/bar/baz");
121
- expect(Path.from("a//b//c//d")).toBe("a/b/c/d");
122
- // Mixed slash counts
123
- expect(Path.from("foo//bar///baz////qux")).toBe("foo/bar/baz/qux");
124
- // With leading and trailing slashes
125
- expect(Path.from("//foo//bar//")).toBe("foo/bar");
126
- expect(Path.from("///foo///bar///")).toBe("foo/bar");
127
- // Edge case: only slashes
128
- expect(Path.from("//")).toBe("");
129
- expect(Path.from("////")).toBe("");
130
- // Test that operations work correctly with normalized paths
131
- const pathWithSlashes = Path.from("foo//bar///baz");
132
- expect(Path.hasPrefix(Path.from("foo/bar"), pathWithSlashes)).toBe(true);
133
- expect(Path.stripPrefix(Path.from("foo"), pathWithSlashes)).toBe("bar/baz");
134
- expect(Path.join(pathWithSlashes, Path.from("qux"))).toBe("foo/bar/baz/qux");
135
- });
136
- test("handles special characters", () => {
137
- const path = Path.from("foo-bar_baz.txt");
138
- expect(path).toBe("foo-bar_baz.txt");
139
- expect(Path.hasPrefix(Path.from("foo-bar"), path)).toBe(false);
140
- expect(Path.hasPrefix(Path.from("foo-bar_baz.txt"), path)).toBe(true);
141
- });
142
- test("from accepts multiple arguments", () => {
143
- expect(Path.from("foo", "bar", "baz")).toBe("foo/bar/baz");
144
- expect(Path.from("api", "v1", "users")).toBe("api/v1/users");
145
- });
146
- test("from handles empty strings in arguments", () => {
147
- expect(Path.from("foo", "", "bar")).toBe("foo/bar");
148
- expect(Path.from("", "foo", "bar", "")).toBe("foo/bar");
149
- });
150
- test("from sanitizes multiple arguments with slashes", () => {
151
- expect(Path.from("/foo/", "/bar/", "/baz/")).toBe("foo/bar/baz");
152
- expect(Path.from("foo//", "//bar", "baz")).toBe("foo/bar/baz");
153
- });
154
- test("parts splits a path into its components", () => {
155
- expect(Path.parts(Path.from(""))).toEqual([]);
156
- expect(Path.parts(Path.from("foo"))).toEqual(["foo"]);
157
- expect(Path.parts(Path.from("/foo//bar/"))).toEqual(["foo", "bar"]);
158
- });
159
- test("decode enforces the max part count", () => {
160
- const atLimit = Array.from({ length: Path.MAX_PARTS }, (_, i) => `${i}`).join("/");
161
- expect(Path.decode(atLimit)).toBe(atLimit);
162
- expect(() => Path.decode(`${atLimit}/extra`)).toThrow();
163
- });
164
- test("encode enforces the max part count", () => {
165
- const atLimit = Array.from({ length: Path.MAX_PARTS }, (_, i) => `${i}`).join("/");
166
- expect(Path.encode(atLimit)).toBe(atLimit);
167
- expect(() => Path.encode(`${atLimit}/extra`)).toThrow();
168
- });
169
- //# sourceMappingURL=path.test.js.map
package/path.test.js.map DELETED
@@ -1 +0,0 @@
1
- {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C","sourcesContent":["import { expect, test } from \"bun:test\";\nimport * as Path from \"./path.ts\";\n\ntest(\"Path constructor trims leading and trailing slashes\", () => {\n\texpect(Path.from(\"/foo/bar/\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"///foo/bar///\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"foo/bar\")).toBe(\"foo/bar\" as Path.Valid);\n});\n\ntest(\"Path constructor handles empty paths\", () => {\n\texpect(Path.from(\"\")).toBe(\"\" as Path.Valid);\n\texpect(Path.from(\"/\")).toBe(\"\" as Path.Valid);\n\texpect(Path.from(\"///\")).toBe(\"\" as Path.Valid);\n});\n\ntest(\"hasPrefix matches exact paths\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\texpect(Path.hasPrefix(Path.from(\"foo/bar\"), path)).toBe(true);\n});\n\ntest(\"hasPrefix matches proper prefixes\", () => {\n\tconst path = Path.from(\"foo/bar/baz\");\n\texpect(Path.hasPrefix(Path.from(\"foo\"), path)).toBe(true);\n\texpect(Path.hasPrefix(Path.from(\"foo/bar\"), path)).toBe(true);\n});\n\ntest(\"hasPrefix does not match partial segment prefixes\", () => {\n\tconst path = Path.from(\"foobar\");\n\texpect(Path.hasPrefix(Path.from(\"foo\"), path)).toBe(false);\n\n\tconst path2 = Path.from(\"foo/bar\");\n\texpect(Path.hasPrefix(Path.from(\"fo\"), path2)).toBe(false);\n});\n\ntest(\"hasPrefix handles empty prefix\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\texpect(Path.hasPrefix(Path.empty(), path)).toBe(true);\n});\n\ntest(\"hasPrefix ignores trailing slashes in prefix\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\texpect(Path.hasPrefix(Path.from(\"foo/\"), path)).toBe(true);\n\texpect(Path.hasPrefix(Path.from(\"foo/bar/\"), path)).toBe(true);\n});\n\ntest(\"stripPrefix strips valid prefixes\", () => {\n\tconst path = Path.from(\"foo/bar/baz\");\n\n\tconst suffix1 = Path.stripPrefix(Path.from(\"foo\"), path);\n\texpect(suffix1).toBe(\"bar/baz\" as Path.Valid);\n\n\tconst suffix2 = Path.stripPrefix(Path.from(\"foo/bar\"), path);\n\texpect(suffix2).toBe(\"baz\" as Path.Valid);\n\n\tconst suffix3 = Path.stripPrefix(Path.from(\"foo/bar/baz\"), path);\n\texpect(suffix3).toBe(\"\" as Path.Valid);\n});\n\ntest(\"stripPrefix returns null for invalid prefixes\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\texpect(Path.stripPrefix(Path.from(\"notfound\"), path)).toBe(null);\n\texpect(Path.stripPrefix(Path.from(\"fo\"), path)).toBe(null);\n});\n\ntest(\"stripPrefix handles empty prefix\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\tconst result = Path.stripPrefix(Path.empty(), path);\n\texpect(result).toBe(\"foo/bar\" as Path.Valid);\n});\n\ntest(\"stripPrefix accepts Path instances\", () => {\n\tconst path = Path.from(\"foo/bar/baz\");\n\tconst prefix = Path.from(\"foo/bar\");\n\tconst result = Path.stripPrefix(prefix, path);\n\texpect(result).toBe(\"baz\" as Path.Valid);\n});\n\ntest(\"join paths with slashes\", () => {\n\tconst base = Path.from(\"foo\");\n\tconst joined = Path.join(base, Path.from(\"bar\"));\n\texpect(joined).toBe(\"foo/bar\" as Path.Valid);\n});\n\ntest(\"join handles empty base\", () => {\n\tconst base = Path.empty();\n\tconst joined = Path.join(base, Path.from(\"bar\"));\n\texpect(joined).toBe(\"bar\" as Path.Valid);\n});\n\ntest(\"join handles empty suffix\", () => {\n\tconst base = Path.from(\"foo\");\n\tconst joined = Path.join(base, Path.empty());\n\texpect(joined).toBe(\"foo\" as Path.Valid);\n});\n\ntest(\"join accepts Path instances\", () => {\n\tconst base = Path.from(\"foo\");\n\tconst suffix = Path.from(\"bar\");\n\tconst joined = Path.join(base, suffix);\n\texpect(joined).toBe(\"foo/bar\" as Path.Valid);\n});\n\ntest(\"join handles multiple joins\", () => {\n\tconst path = Path.join(\n\t\tPath.join(Path.join(Path.from(\"api\"), Path.from(\"v1\")), Path.from(\"users\")),\n\t\tPath.from(\"123\"),\n\t);\n\texpect(path).toBe(\"api/v1/users/123\" as Path.Valid);\n});\n\ntest(\"isEmpty checks correctly\", () => {\n\texpect(Path.from(\"\") === \"\").toBe(true);\n\texpect(Path.from(\"foo\") === \"\").toBe(false);\n\texpect(Path.empty() === \"\").toBe(true);\n});\n\ntest(\"length property works correctly\", () => {\n\texpect(Path.from(\"foo\").length).toBe(3);\n\texpect(Path.from(\"foo/bar\").length).toBe(7);\n\texpect(Path.empty().length).toBe(0);\n});\n\ntest(\"equals checks correctly\", () => {\n\tconst path1 = Path.from(\"foo/bar\");\n\tconst path2 = Path.from(\"/foo/bar/\");\n\tconst path3 = Path.from(\"foo/baz\");\n\n\texpect(path1 === path2).toBe(true);\n\texpect(path1 === path3).toBe(false);\n});\n\ntest(\"JSON serialization works\", () => {\n\tconst path = Path.from(\"foo/bar\");\n\texpect(JSON.stringify(path)).toBe('\"foo/bar\"');\n});\n\ntest(\"handles paths with multiple consecutive slashes\", () => {\n\tconst path = Path.from(\"foo//bar///baz\");\n\t// Multiple consecutive slashes are collapsed to single slashes\n\texpect(path).toBe(\"foo/bar/baz\" as Path.Valid);\n});\n\ntest(\"removes multiple slashes comprehensively\", () => {\n\t// Test various multiple slash scenarios\n\texpect(Path.from(\"foo//bar\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"foo///bar\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"foo////bar\")).toBe(\"foo/bar\" as Path.Valid);\n\n\t// Multiple occurrences of double slashes\n\texpect(Path.from(\"foo//bar//baz\")).toBe(\"foo/bar/baz\" as Path.Valid);\n\texpect(Path.from(\"a//b//c//d\")).toBe(\"a/b/c/d\" as Path.Valid);\n\n\t// Mixed slash counts\n\texpect(Path.from(\"foo//bar///baz////qux\")).toBe(\"foo/bar/baz/qux\" as Path.Valid);\n\n\t// With leading and trailing slashes\n\texpect(Path.from(\"//foo//bar//\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"///foo///bar///\")).toBe(\"foo/bar\" as Path.Valid);\n\n\t// Edge case: only slashes\n\texpect(Path.from(\"//\")).toBe(\"\" as Path.Valid);\n\texpect(Path.from(\"////\")).toBe(\"\" as Path.Valid);\n\n\t// Test that operations work correctly with normalized paths\n\tconst pathWithSlashes = Path.from(\"foo//bar///baz\");\n\texpect(Path.hasPrefix(Path.from(\"foo/bar\"), pathWithSlashes)).toBe(true);\n\texpect(Path.stripPrefix(Path.from(\"foo\"), pathWithSlashes)).toBe(\"bar/baz\" as Path.Valid);\n\texpect(Path.join(pathWithSlashes, Path.from(\"qux\"))).toBe(\"foo/bar/baz/qux\" as Path.Valid);\n});\n\ntest(\"handles special characters\", () => {\n\tconst path = Path.from(\"foo-bar_baz.txt\");\n\texpect(path).toBe(\"foo-bar_baz.txt\" as Path.Valid);\n\texpect(Path.hasPrefix(Path.from(\"foo-bar\"), path)).toBe(false);\n\texpect(Path.hasPrefix(Path.from(\"foo-bar_baz.txt\"), path)).toBe(true);\n});\n\ntest(\"from accepts multiple arguments\", () => {\n\texpect(Path.from(\"foo\", \"bar\", \"baz\")).toBe(\"foo/bar/baz\" as Path.Valid);\n\texpect(Path.from(\"api\", \"v1\", \"users\")).toBe(\"api/v1/users\" as Path.Valid);\n});\n\ntest(\"from handles empty strings in arguments\", () => {\n\texpect(Path.from(\"foo\", \"\", \"bar\")).toBe(\"foo/bar\" as Path.Valid);\n\texpect(Path.from(\"\", \"foo\", \"bar\", \"\")).toBe(\"foo/bar\" as Path.Valid);\n});\n\ntest(\"from sanitizes multiple arguments with slashes\", () => {\n\texpect(Path.from(\"/foo/\", \"/bar/\", \"/baz/\")).toBe(\"foo/bar/baz\" as Path.Valid);\n\texpect(Path.from(\"foo//\", \"//bar\", \"baz\")).toBe(\"foo/bar/baz\" as Path.Valid);\n});\n\ntest(\"parts splits a path into its components\", () => {\n\texpect(Path.parts(Path.from(\"\"))).toEqual([]);\n\texpect(Path.parts(Path.from(\"foo\"))).toEqual([\"foo\"]);\n\texpect(Path.parts(Path.from(\"/foo//bar/\"))).toEqual([\"foo\", \"bar\"]);\n});\n\ntest(\"decode enforces the max part count\", () => {\n\tconst atLimit = Array.from({ length: Path.MAX_PARTS }, (_, i) => `${i}`).join(\"/\");\n\texpect(Path.decode(atLimit)).toBe(atLimit as Path.Valid);\n\texpect(() => Path.decode(`${atLimit}/extra`)).toThrow();\n});\n\ntest(\"encode enforces the max part count\", () => {\n\tconst atLimit = Array.from({ length: Path.MAX_PARTS }, (_, i) => `${i}`).join(\"/\") as Path.Valid;\n\texpect(Path.encode(atLimit)).toBe(atLimit);\n\texpect(() => Path.encode(`${atLimit}/extra` as Path.Valid)).toThrow();\n});\n"]}
package/stream.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=stream.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.test.d.ts","sourceRoot":"","sources":["../src/stream.test.ts"],"names":[],"mappings":""}
package/stream.test.js DELETED
@@ -1,210 +0,0 @@
1
- /* @ts-self-types="./stream.test.d.ts" */
2
- import { expect, test } from "bun:test";
3
- import { Reader, Writer } from "./stream.js";
4
- // Helper to create a writable stream that captures written data
5
- function createTestWritableStream() {
6
- const written = [];
7
- const stream = new WritableStream({
8
- write(chunk) {
9
- written.push(new Uint8Array(chunk));
10
- },
11
- });
12
- return { stream, written };
13
- }
14
- // Helper to concatenate written chunks
15
- function concatChunks(chunks) {
16
- const totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
17
- const result = new Uint8Array(totalLength);
18
- let offset = 0;
19
- for (const chunk of chunks) {
20
- result.set(chunk, offset);
21
- offset += chunk.byteLength;
22
- }
23
- return result;
24
- }
25
- test("Writer u8", async () => {
26
- const { stream, written } = createTestWritableStream();
27
- const writer = new Writer(stream);
28
- await writer.u8(42);
29
- await writer.u8(255);
30
- writer.close();
31
- await writer.closed;
32
- expect(written.length).toBe(2);
33
- expect(written[0]).toEqual(new Uint8Array([42]));
34
- expect(written[1]).toEqual(new Uint8Array([255]));
35
- });
36
- test("Writer i32", async () => {
37
- const { stream, written } = createTestWritableStream();
38
- const writer = new Writer(stream);
39
- await writer.i32(0);
40
- await writer.i32(-1);
41
- await writer.i32(1000);
42
- writer.close();
43
- await writer.closed;
44
- const result = concatChunks(written);
45
- expect(result.byteLength).toBe(12); // 3 * 4 bytes
46
- // Read back the values
47
- const view = new DataView(result.buffer, result.byteOffset, result.byteLength);
48
- expect(view.getInt32(0)).toBe(0);
49
- expect(view.getInt32(4)).toBe(-1);
50
- expect(view.getInt32(8)).toBe(1000);
51
- });
52
- test("Writer u53", async () => {
53
- const { stream, written } = createTestWritableStream();
54
- const writer = new Writer(stream);
55
- await writer.u53(0);
56
- await writer.u53(63); // MAX_U6
57
- await writer.u53(64); // MIN for 2-byte varint
58
- await writer.u53(16383); // MAX_U14
59
- await writer.u53(16384); // MIN for 4-byte varint
60
- writer.close();
61
- await writer.closed;
62
- // Verify the varint encoding sizes
63
- expect(written[0].byteLength).toBe(1); // 0 fits in 1 byte
64
- expect(written[1].byteLength).toBe(1); // 63 fits in 1 byte
65
- expect(written[2].byteLength).toBe(2); // 64 needs 2 bytes
66
- expect(written[3].byteLength).toBe(2); // 16383 fits in 2 bytes
67
- expect(written[4].byteLength).toBe(4); // 16384 needs 4 bytes
68
- });
69
- test("Writer string", async () => {
70
- const { stream, written } = createTestWritableStream();
71
- const writer = new Writer(stream);
72
- await writer.string("hello");
73
- await writer.string("🎉");
74
- writer.close();
75
- await writer.closed;
76
- const result = concatChunks(written);
77
- // Create a reader to parse the result
78
- const reader = new Reader(undefined, result);
79
- const str1 = await reader.string();
80
- const str2 = await reader.string();
81
- expect(str1).toBe("hello");
82
- expect(str2).toBe("🎉");
83
- });
84
- test("Reader u8", async () => {
85
- const data = new Uint8Array([42, 255, 0, 128]);
86
- const reader = new Reader(undefined, data);
87
- expect(await reader.u8()).toBe(42);
88
- expect(await reader.u8()).toBe(255);
89
- expect(await reader.u8()).toBe(0);
90
- expect(await reader.u8()).toBe(128);
91
- expect(await reader.done()).toBe(true);
92
- });
93
- test("Reader read with exact sizes", async () => {
94
- const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
95
- const reader = new Reader(undefined, data);
96
- const chunk1 = await reader.read(3);
97
- expect(chunk1).toEqual(new Uint8Array([1, 2, 3]));
98
- const chunk2 = await reader.read(2);
99
- expect(chunk2).toEqual(new Uint8Array([4, 5]));
100
- const chunk3 = await reader.read(3);
101
- expect(chunk3).toEqual(new Uint8Array([6, 7, 8]));
102
- expect(await reader.done()).toBe(true);
103
- });
104
- test("Reader read with zero size", async () => {
105
- const data = new Uint8Array([1, 2, 3]);
106
- const reader = new Reader(undefined, data);
107
- const chunk = await reader.read(0);
108
- expect(chunk).toEqual(new Uint8Array([]));
109
- // Original data should still be available
110
- const remaining = await reader.read(3);
111
- expect(remaining).toEqual(new Uint8Array([1, 2, 3]));
112
- });
113
- test("Reader readAll", async () => {
114
- const data = new Uint8Array([1, 2, 3, 4, 5]);
115
- const reader = new Reader(undefined, data);
116
- // Read some data first
117
- await reader.read(2);
118
- // readAll should get the remaining data
119
- const remaining = await reader.readAll();
120
- expect(remaining).toEqual(new Uint8Array([3, 4, 5]));
121
- expect(await reader.done()).toBe(true);
122
- });
123
- test("Reader u53 varint decoding", async () => {
124
- // Test various varint sizes
125
- const testValues = [0, 63, 64, 16383, 16384, 1073741823, 1073741824];
126
- const { stream, written } = createTestWritableStream();
127
- const testWriter = new Writer(stream);
128
- for (const value of testValues) {
129
- await testWriter.u53(value);
130
- }
131
- testWriter.close();
132
- await testWriter.closed;
133
- const data = concatChunks(written);
134
- const reader = new Reader(undefined, data);
135
- for (const expectedValue of testValues) {
136
- const actualValue = await reader.u53();
137
- expect(actualValue).toBe(expectedValue);
138
- }
139
- expect(await reader.done()).toBe(true);
140
- });
141
- test("Reader u62 varint decoding", async () => {
142
- const testValues = [0n, 63n, 64n, 16383n, 16384n, 1073741823n, 1073741824n, 9007199254740991n]; // MAX_U53
143
- const { stream, written } = createTestWritableStream();
144
- const testWriter = new Writer(stream);
145
- for (const value of testValues) {
146
- await testWriter.u62(value);
147
- }
148
- testWriter.close();
149
- await testWriter.closed;
150
- const data = concatChunks(written);
151
- const reader = new Reader(undefined, data);
152
- for (const expectedValue of testValues) {
153
- const actualValue = await reader.u62();
154
- expect(actualValue).toBe(expectedValue);
155
- }
156
- expect(await reader.done()).toBe(true);
157
- });
158
- test("Reader string decoding", async () => {
159
- const testStrings = ["hello", "🎉", "", "world with spaces", "multi\nline\nstring"];
160
- const { stream, written } = createTestWritableStream();
161
- const writer = new Writer(stream);
162
- for (const str of testStrings) {
163
- await writer.string(str);
164
- }
165
- writer.close();
166
- await writer.closed;
167
- const data = concatChunks(written);
168
- const reader = new Reader(undefined, data);
169
- for (const expectedString of testStrings) {
170
- const actualString = await reader.string();
171
- expect(actualString).toBe(expectedString);
172
- }
173
- expect(await reader.done()).toBe(true);
174
- });
175
- test("Reader from stream", async () => {
176
- const chunks = [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5]), new Uint8Array([6, 7, 8, 9])];
177
- const stream = new ReadableStream({
178
- start(controller) {
179
- for (const chunk of chunks) {
180
- controller.enqueue(chunk);
181
- }
182
- controller.close();
183
- },
184
- });
185
- const reader = new Reader(stream);
186
- // Read all data
187
- const result = await reader.readAll();
188
- expect(result).toEqual(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]));
189
- });
190
- test("Reader stream with partial reads", async () => {
191
- const chunks = [new Uint8Array([1, 2]), new Uint8Array([3, 4, 5]), new Uint8Array([6])];
192
- const stream = new ReadableStream({
193
- start(controller) {
194
- for (const chunk of chunks) {
195
- controller.enqueue(chunk);
196
- }
197
- controller.close();
198
- },
199
- });
200
- const reader = new Reader(stream);
201
- // Read specific amounts that cross chunk boundaries
202
- const first = await reader.read(3); // Should span first two chunks
203
- expect(first).toEqual(new Uint8Array([1, 2, 3]));
204
- const second = await reader.read(2);
205
- expect(second).toEqual(new Uint8Array([4, 5]));
206
- const third = await reader.read(1);
207
- expect(third).toEqual(new Uint8Array([6]));
208
- expect(await reader.done()).toBe(true);
209
- });
210
- //# sourceMappingURL=stream.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.test.js","sourceRoot":"","sources":["../src/stream.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7C,gEAAgE;AAChE,SAAS,wBAAwB;IAChC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,IAAI,cAAc,CAAa;QAC7C,KAAK,CAAC,KAAK;YACV,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,CAAC;KACD,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,uCAAuC;AACvC,SAAS,YAAY,CAAC,MAAoB;IACzC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC7E,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;IAC5B,MAAM,EAAE,MAAM,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C,CAAC;IACpC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/C,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3C,MAAM,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test } from \"bun:test\";\nimport { Reader, Writer } from \"./stream.ts\";\n\n// Helper to create a writable stream that captures written data\nfunction createTestWritableStream(): { stream: WritableStream<Uint8Array>; written: Uint8Array[] } {\n\tconst written: Uint8Array[] = [];\n\tconst stream = new WritableStream<Uint8Array>({\n\t\twrite(chunk) {\n\t\t\twritten.push(new Uint8Array(chunk));\n\t\t},\n\t});\n\treturn { stream, written };\n}\n\n// Helper to concatenate written chunks\nfunction concatChunks(chunks: Uint8Array[]): Uint8Array {\n\tconst totalLength = chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);\n\tconst result = new Uint8Array(totalLength);\n\tlet offset = 0;\n\tfor (const chunk of chunks) {\n\t\tresult.set(chunk, offset);\n\t\toffset += chunk.byteLength;\n\t}\n\treturn result;\n}\n\ntest(\"Writer u8\", async () => {\n\tconst { stream, written } = createTestWritableStream();\n\tconst writer = new Writer(stream);\n\n\tawait writer.u8(42);\n\tawait writer.u8(255);\n\n\twriter.close();\n\tawait writer.closed;\n\n\texpect(written.length).toBe(2);\n\texpect(written[0]).toEqual(new Uint8Array([42]));\n\texpect(written[1]).toEqual(new Uint8Array([255]));\n});\n\ntest(\"Writer i32\", async () => {\n\tconst { stream, written } = createTestWritableStream();\n\tconst writer = new Writer(stream);\n\n\tawait writer.i32(0);\n\tawait writer.i32(-1);\n\tawait writer.i32(1000);\n\n\twriter.close();\n\tawait writer.closed;\n\n\tconst result = concatChunks(written);\n\texpect(result.byteLength).toBe(12); // 3 * 4 bytes\n\n\t// Read back the values\n\tconst view = new DataView(result.buffer, result.byteOffset, result.byteLength);\n\texpect(view.getInt32(0)).toBe(0);\n\texpect(view.getInt32(4)).toBe(-1);\n\texpect(view.getInt32(8)).toBe(1000);\n});\n\ntest(\"Writer u53\", async () => {\n\tconst { stream, written } = createTestWritableStream();\n\tconst writer = new Writer(stream);\n\n\tawait writer.u53(0);\n\tawait writer.u53(63); // MAX_U6\n\tawait writer.u53(64); // MIN for 2-byte varint\n\tawait writer.u53(16383); // MAX_U14\n\tawait writer.u53(16384); // MIN for 4-byte varint\n\n\twriter.close();\n\tawait writer.closed;\n\n\t// Verify the varint encoding sizes\n\texpect(written[0].byteLength).toBe(1); // 0 fits in 1 byte\n\texpect(written[1].byteLength).toBe(1); // 63 fits in 1 byte\n\texpect(written[2].byteLength).toBe(2); // 64 needs 2 bytes\n\texpect(written[3].byteLength).toBe(2); // 16383 fits in 2 bytes\n\texpect(written[4].byteLength).toBe(4); // 16384 needs 4 bytes\n});\n\ntest(\"Writer string\", async () => {\n\tconst { stream, written } = createTestWritableStream();\n\tconst writer = new Writer(stream);\n\n\tawait writer.string(\"hello\");\n\tawait writer.string(\"🎉\");\n\n\twriter.close();\n\tawait writer.closed;\n\n\tconst result = concatChunks(written);\n\n\t// Create a reader to parse the result\n\tconst reader = new Reader(undefined, result);\n\n\tconst str1 = await reader.string();\n\tconst str2 = await reader.string();\n\n\texpect(str1).toBe(\"hello\");\n\texpect(str2).toBe(\"🎉\");\n});\n\ntest(\"Reader u8\", async () => {\n\tconst data = new Uint8Array([42, 255, 0, 128]);\n\tconst reader = new Reader(undefined, data);\n\n\texpect(await reader.u8()).toBe(42);\n\texpect(await reader.u8()).toBe(255);\n\texpect(await reader.u8()).toBe(0);\n\texpect(await reader.u8()).toBe(128);\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader read with exact sizes\", async () => {\n\tconst data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);\n\tconst reader = new Reader(undefined, data);\n\n\tconst chunk1 = await reader.read(3);\n\texpect(chunk1).toEqual(new Uint8Array([1, 2, 3]));\n\n\tconst chunk2 = await reader.read(2);\n\texpect(chunk2).toEqual(new Uint8Array([4, 5]));\n\n\tconst chunk3 = await reader.read(3);\n\texpect(chunk3).toEqual(new Uint8Array([6, 7, 8]));\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader read with zero size\", async () => {\n\tconst data = new Uint8Array([1, 2, 3]);\n\tconst reader = new Reader(undefined, data);\n\n\tconst chunk = await reader.read(0);\n\texpect(chunk).toEqual(new Uint8Array([]));\n\n\t// Original data should still be available\n\tconst remaining = await reader.read(3);\n\texpect(remaining).toEqual(new Uint8Array([1, 2, 3]));\n});\n\ntest(\"Reader readAll\", async () => {\n\tconst data = new Uint8Array([1, 2, 3, 4, 5]);\n\tconst reader = new Reader(undefined, data);\n\n\t// Read some data first\n\tawait reader.read(2);\n\n\t// readAll should get the remaining data\n\tconst remaining = await reader.readAll();\n\texpect(remaining).toEqual(new Uint8Array([3, 4, 5]));\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader u53 varint decoding\", async () => {\n\t// Test various varint sizes\n\tconst testValues = [0, 63, 64, 16383, 16384, 1073741823, 1073741824];\n\n\tconst { stream, written } = createTestWritableStream();\n\tconst testWriter = new Writer(stream);\n\n\tfor (const value of testValues) {\n\t\tawait testWriter.u53(value);\n\t}\n\n\ttestWriter.close();\n\tawait testWriter.closed;\n\n\tconst data = concatChunks(written);\n\tconst reader = new Reader(undefined, data);\n\n\tfor (const expectedValue of testValues) {\n\t\tconst actualValue = await reader.u53();\n\t\texpect(actualValue).toBe(expectedValue);\n\t}\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader u62 varint decoding\", async () => {\n\tconst testValues = [0n, 63n, 64n, 16383n, 16384n, 1073741823n, 1073741824n, 9007199254740991n]; // MAX_U53\n\n\tconst { stream, written } = createTestWritableStream();\n\tconst testWriter = new Writer(stream);\n\n\tfor (const value of testValues) {\n\t\tawait testWriter.u62(value);\n\t}\n\n\ttestWriter.close();\n\tawait testWriter.closed;\n\n\tconst data = concatChunks(written);\n\tconst reader = new Reader(undefined, data);\n\n\tfor (const expectedValue of testValues) {\n\t\tconst actualValue = await reader.u62();\n\t\texpect(actualValue).toBe(expectedValue);\n\t}\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader string decoding\", async () => {\n\tconst testStrings = [\"hello\", \"🎉\", \"\", \"world with spaces\", \"multi\\nline\\nstring\"];\n\n\tconst { stream, written } = createTestWritableStream();\n\tconst writer = new Writer(stream);\n\n\tfor (const str of testStrings) {\n\t\tawait writer.string(str);\n\t}\n\n\twriter.close();\n\tawait writer.closed;\n\n\tconst data = concatChunks(written);\n\tconst reader = new Reader(undefined, data);\n\n\tfor (const expectedString of testStrings) {\n\t\tconst actualString = await reader.string();\n\t\texpect(actualString).toBe(expectedString);\n\t}\n\n\texpect(await reader.done()).toBe(true);\n});\n\ntest(\"Reader from stream\", async () => {\n\tconst chunks = [new Uint8Array([1, 2, 3]), new Uint8Array([4, 5]), new Uint8Array([6, 7, 8, 9])];\n\n\tconst stream = new ReadableStream({\n\t\tstart(controller) {\n\t\t\tfor (const chunk of chunks) {\n\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t}\n\t\t\tcontroller.close();\n\t\t},\n\t});\n\n\tconst reader = new Reader(stream);\n\n\t// Read all data\n\tconst result = await reader.readAll();\n\texpect(result).toEqual(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]));\n});\n\ntest(\"Reader stream with partial reads\", async () => {\n\tconst chunks = [new Uint8Array([1, 2]), new Uint8Array([3, 4, 5]), new Uint8Array([6])];\n\n\tconst stream = new ReadableStream({\n\t\tstart(controller) {\n\t\t\tfor (const chunk of chunks) {\n\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t}\n\t\t\tcontroller.close();\n\t\t},\n\t});\n\n\tconst reader = new Reader(stream);\n\n\t// Read specific amounts that cross chunk boundaries\n\tconst first = await reader.read(3); // Should span first two chunks\n\texpect(first).toEqual(new Uint8Array([1, 2, 3]));\n\n\tconst second = await reader.read(2);\n\texpect(second).toEqual(new Uint8Array([4, 5]));\n\n\tconst third = await reader.read(1);\n\texpect(third).toEqual(new Uint8Array([6]));\n\n\texpect(await reader.done()).toBe(true);\n});\n"]}
package/track.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=track.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"track.test.d.ts","sourceRoot":"","sources":["../src/track.test.ts"],"names":[],"mappings":""}
package/track.test.js DELETED
@@ -1,56 +0,0 @@
1
- /* @ts-self-types="./track.test.d.ts" */
2
- import { expect, test } from "bun:test";
3
- import { Group } from "./group.js";
4
- import { Track } from "./track.js";
5
- test("nextGroupOrdered skips late arrivals", async () => {
6
- const track = new Track("test");
7
- track.writeGroup(new Group(5));
8
- const first = await track.nextGroupOrdered();
9
- expect(first?.sequence).toBe(5);
10
- // Late arrivals with sequence <= last returned are skipped.
11
- track.writeGroup(new Group(3));
12
- track.writeGroup(new Group(4));
13
- track.writeGroup(new Group(7));
14
- const next = await track.nextGroupOrdered();
15
- expect(next?.sequence).toBe(7);
16
- });
17
- test("nextGroupOrdered returns buffered groups in sequence", async () => {
18
- const track = new Track("test");
19
- track.writeGroup(new Group(3));
20
- track.writeGroup(new Group(5));
21
- expect((await track.nextGroupOrdered())?.sequence).toBe(3);
22
- expect((await track.nextGroupOrdered())?.sequence).toBe(5);
23
- });
24
- test("recvGroup after nextGroupOrdered still returns late arrivals", async () => {
25
- const track = new Track("test");
26
- track.writeGroup(new Group(5));
27
- // Ordered returns seq 5, advancing its cursor.
28
- const ordered = await track.nextGroupOrdered();
29
- expect(ordered?.sequence).toBe(5);
30
- // recvGroup is independent of the ordered cursor: a late seq 3 still surfaces.
31
- track.writeGroup(new Group(3));
32
- const recv = await track.recvGroup();
33
- expect(recv?.sequence).toBe(3);
34
- });
35
- test("nextGroupOrdered returns undefined when track closes", async () => {
36
- const track = new Track("test");
37
- track.close();
38
- expect(await track.nextGroupOrdered()).toBeUndefined();
39
- });
40
- test("readFrame does not livelock when a sole group finishes before the next arrives", async () => {
41
- const track = new Track("test");
42
- // A group is appended then finished empty while the track stays open. A finished group's
43
- // readable() resolves immediately, so the reader must not busy-wait on it (which would starve the
44
- // macrotask queue and never observe the next group).
45
- const g0 = track.appendGroup();
46
- g0.close();
47
- // The next group arrives via a macrotask; if the reader livelocks on microtasks it never runs.
48
- setTimeout(() => {
49
- const g1 = track.appendGroup();
50
- g1.writeString("hello");
51
- g1.close();
52
- track.close();
53
- }, 10);
54
- expect(await track.readString()).toBe("hello");
55
- }, 2000);
56
- //# sourceMappingURL=track.test.js.map
package/track.test.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"track.test.js","sourceRoot":"","sources":["../src/track.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,IAAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;IACvD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAEhC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/B,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,gBAAgB,EAAE,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhC,4DAA4D;IAC5D,KAAK,CAAC,UAAU,CAAC,IAAI,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IAC/E,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC;IACrC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;IACvE,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,CAAC,MAAM,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;AACxD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gFAAgF,EAAE,KAAK,IAAI,EAAE;IACjG,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAEhC,yFAAyF;IACzF,kGAAkG;IAClG,qDAAqD;IACrD,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC/B,EAAE,CAAC,KAAK,EAAE,CAAC;IAEX,+FAA+F;IAC/F,UAAU,CAAC,GAAG,EAAE;QACf,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAC/B,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACxB,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,CAAC,KAAK,EAAE,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,CAAC,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC,EAAE,IAAI,CAAC,CAAC","sourcesContent":["import { expect, test } from \"bun:test\";\nimport { Group } from \"./group.ts\";\nimport { Track } from \"./track.ts\";\n\ntest(\"nextGroupOrdered skips late arrivals\", async () => {\n\tconst track = new Track(\"test\");\n\n\ttrack.writeGroup(new Group(5));\n\n\tconst first = await track.nextGroupOrdered();\n\texpect(first?.sequence).toBe(5);\n\n\t// Late arrivals with sequence <= last returned are skipped.\n\ttrack.writeGroup(new Group(3));\n\ttrack.writeGroup(new Group(4));\n\ttrack.writeGroup(new Group(7));\n\n\tconst next = await track.nextGroupOrdered();\n\texpect(next?.sequence).toBe(7);\n});\n\ntest(\"nextGroupOrdered returns buffered groups in sequence\", async () => {\n\tconst track = new Track(\"test\");\n\n\ttrack.writeGroup(new Group(3));\n\ttrack.writeGroup(new Group(5));\n\n\texpect((await track.nextGroupOrdered())?.sequence).toBe(3);\n\texpect((await track.nextGroupOrdered())?.sequence).toBe(5);\n});\n\ntest(\"recvGroup after nextGroupOrdered still returns late arrivals\", async () => {\n\tconst track = new Track(\"test\");\n\n\ttrack.writeGroup(new Group(5));\n\n\t// Ordered returns seq 5, advancing its cursor.\n\tconst ordered = await track.nextGroupOrdered();\n\texpect(ordered?.sequence).toBe(5);\n\n\t// recvGroup is independent of the ordered cursor: a late seq 3 still surfaces.\n\ttrack.writeGroup(new Group(3));\n\tconst recv = await track.recvGroup();\n\texpect(recv?.sequence).toBe(3);\n});\n\ntest(\"nextGroupOrdered returns undefined when track closes\", async () => {\n\tconst track = new Track(\"test\");\n\ttrack.close();\n\texpect(await track.nextGroupOrdered()).toBeUndefined();\n});\n\ntest(\"readFrame does not livelock when a sole group finishes before the next arrives\", async () => {\n\tconst track = new Track(\"test\");\n\n\t// A group is appended then finished empty while the track stays open. A finished group's\n\t// readable() resolves immediately, so the reader must not busy-wait on it (which would starve the\n\t// macrotask queue and never observe the next group).\n\tconst g0 = track.appendGroup();\n\tg0.close();\n\n\t// The next group arrives via a macrotask; if the reader livelocks on microtasks it never runs.\n\tsetTimeout(() => {\n\t\tconst g1 = track.appendGroup();\n\t\tg1.writeString(\"hello\");\n\t\tg1.close();\n\t\ttrack.close();\n\t}, 10);\n\n\texpect(await track.readString()).toBe(\"hello\");\n}, 2000);\n"]}
package/util/error.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare function error(err: unknown): Error;
2
- export declare function unreachable(value: never): never;
3
- //# sourceMappingURL=error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/util/error.ts"],"names":[],"mappings":"AACA,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAEzC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
package/util/error.js DELETED
@@ -1,9 +0,0 @@
1
- /* @ts-self-types="./error.d.ts" */
2
- // I hate javascript.
3
- export function error(err) {
4
- return err instanceof Error ? err : new Error(String(err));
5
- }
6
- export function unreachable(value) {
7
- throw new Error(`unreachable: ${value}`);
8
- }
9
- //# sourceMappingURL=error.js.map
package/util/error.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/util/error.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,MAAM,UAAU,KAAK,CAAC,GAAY;IACjC,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAY;IACvC,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// I hate javascript.\nexport function error(err: unknown): Error {\n\treturn err instanceof Error ? err : new Error(String(err));\n}\n\nexport function unreachable(value: never): never {\n\tthrow new Error(`unreachable: ${value}`);\n}\n"]}
package/util/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./error";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
package/util/index.js DELETED
@@ -1,3 +0,0 @@
1
- /* @ts-self-types="./index.d.ts" */
2
- export * from "./error.js";
3
- //# sourceMappingURL=index.js.map
package/util/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC","sourcesContent":["export * from \"./error.ts\";\n"]}
package/varint.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=varint.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"varint.test.d.ts","sourceRoot":"","sources":["../src/varint.test.ts"],"names":[],"mappings":""}