@moqtap/codec 0.2.3 → 0.4.0

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 (313) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +100 -99
  3. package/dist/{chunk-RZHAPEXO.js → chunk-2A57DRXV.js} +36 -10
  4. package/dist/{chunk-73MWUKSJ.js → chunk-2UTVXWFF.js} +190 -102
  5. package/dist/{chunk-JTVCOMBI.cjs → chunk-3XKO6PCR.cjs} +290 -183
  6. package/dist/{chunk-ACQ4CUJP.cjs → chunk-4BDEU3D4.cjs} +237 -158
  7. package/dist/{chunk-4N4INRE7.cjs → chunk-4HBKHNU2.cjs} +144 -110
  8. package/dist/{chunk-2ZT6CVSE.js → chunk-4IVZZOY3.js} +269 -162
  9. package/dist/{chunk-GLBQDG4L.cjs → chunk-5O764MBD.cjs} +508 -117
  10. package/dist/chunk-7KBAWOBA.js +1212 -0
  11. package/dist/{chunk-JSQM2MG3.js → chunk-7QOPNSDF.js} +44 -12
  12. package/dist/{chunk-SYHW3FLI.cjs → chunk-7RE6KSIY.cjs} +28 -8
  13. package/dist/{chunk-YG5KJESI.js → chunk-AY6IAHUM.js} +28 -8
  14. package/dist/{chunk-EFM5T7OM.js → chunk-BLQDWOSG.js} +36 -10
  15. package/dist/{chunk-UYXTY6ZQ.cjs → chunk-E65QKRSN.cjs} +20 -12
  16. package/dist/{chunk-BISI45MN.cjs → chunk-EAHE3IOG.cjs} +44 -12
  17. package/dist/{chunk-PZBPH2D7.js → chunk-GCBFHZW6.js} +216 -137
  18. package/dist/{chunk-GXEW4COZ.cjs → chunk-H5NSL4MO.cjs} +36 -10
  19. package/dist/chunk-HZHSO7EW.cjs +1212 -0
  20. package/dist/{chunk-KZCYQ7ED.cjs → chunk-IILNSDEQ.cjs} +69 -41
  21. package/dist/{chunk-4XYGE53S.cjs → chunk-J3XCPBW3.cjs} +36 -10
  22. package/dist/{chunk-6AEHWULA.cjs → chunk-JKOEJZ5B.cjs} +28 -8
  23. package/dist/{chunk-RUPCJTC3.cjs → chunk-JL3NEW3O.cjs} +23 -1
  24. package/dist/{chunk-G7GI7LJA.js → chunk-LORZMJJB.js} +36 -10
  25. package/dist/{chunk-DUBCL3WF.cjs → chunk-LV5C6MEC.cjs} +36 -10
  26. package/dist/{chunk-ENURAVHI.cjs → chunk-MYXAD5JC.cjs} +44 -12
  27. package/dist/{chunk-FXZ2MYKJ.js → chunk-MZ7HUCGJ.js} +20 -12
  28. package/dist/{chunk-S74DWJE2.cjs → chunk-OKG2HT25.cjs} +277 -88
  29. package/dist/{chunk-BGWGVINJ.cjs → chunk-PKEOQSSZ.cjs} +144 -110
  30. package/dist/{chunk-2GODRVT5.js → chunk-Q46ZURKX.js} +325 -48
  31. package/dist/{chunk-UR6JKS56.js → chunk-Q7IGWV3P.js} +41 -9
  32. package/dist/{chunk-XSNX2IUJ.js → chunk-RW4UG7CN.js} +121 -87
  33. package/dist/{chunk-DWK5ZQZ4.js → chunk-RZTLQAKF.js} +28 -8
  34. package/dist/{chunk-UNS34PTA.cjs → chunk-S6IPIN66.cjs} +44 -12
  35. package/dist/{chunk-YIG2C3LF.cjs → chunk-SDWRXXOO.cjs} +214 -126
  36. package/dist/{chunk-CEH7ESNC.js → chunk-SHMA4PBY.js} +121 -87
  37. package/dist/{chunk-MC7W6PMI.js → chunk-U3ZVLT5L.js} +483 -135
  38. package/dist/{chunk-VJUUZ4W2.cjs → chunk-UJU63EFY.cjs} +374 -97
  39. package/dist/{chunk-7L43FE6P.js → chunk-VOU7PNHI.js} +23 -1
  40. package/dist/{chunk-E6E3NQYU.js → chunk-WRHGCVYN.js} +44 -12
  41. package/dist/{chunk-FPISPJ5N.cjs → chunk-XNWYLVGU.cjs} +529 -181
  42. package/dist/{chunk-U3IPZYPX.js → chunk-XS77RBY7.js} +228 -39
  43. package/dist/{chunk-JGG7CMSZ.cjs → chunk-XZE5R57R.cjs} +144 -110
  44. package/dist/{chunk-77MNXX3M.js → chunk-Y6KCSM3V.js} +121 -87
  45. package/dist/{chunk-TLYNOOQP.cjs → chunk-YTPZZI2M.cjs} +41 -9
  46. package/dist/{chunk-7DUBLRXC.js → chunk-YWRCSQBA.js} +44 -12
  47. package/dist/{chunk-MRJWLGYH.js → chunk-Z3VKP3PJ.js} +69 -41
  48. package/dist/{chunk-E6P74GDT.js → chunk-Z6U26IRI.js} +464 -73
  49. package/dist/{codec-FvGCxIhr.d.ts → codec-25u4_1HS.d.ts} +4 -4
  50. package/dist/{codec-DRcsBCsb.d.ts → codec-3Ppy_5Gd.d.ts} +4 -4
  51. package/dist/{codec-BdVMRMOI.d.ts → codec-BB0U8MF2.d.cts} +4 -4
  52. package/dist/{codec-B2cH-f5V.d.cts → codec-BHHfBTnV.d.ts} +4 -4
  53. package/dist/{codec-B5K73Bdj.d.ts → codec-BN6jk0Td.d.cts} +4 -4
  54. package/dist/{codec-R8GrCPt2.d.ts → codec-BU0gaSZm.d.ts} +4 -4
  55. package/dist/{codec-Bq-tLtfP.d.ts → codec-C-Yk2RNa.d.ts} +4 -4
  56. package/dist/codec-CFWQY9Lj.d.cts +18 -0
  57. package/dist/{codec-CPlK3Pi5.d.ts → codec-COy4uuPO.d.cts} +4 -4
  58. package/dist/codec-CewFCsEy.d.ts +18 -0
  59. package/dist/{codec-KXHvXZVb.d.cts → codec-Ck7ZwFF1.d.cts} +4 -4
  60. package/dist/{codec-DZhZSIii.d.cts → codec-D2QVSH9D.d.ts} +4 -4
  61. package/dist/{codec-BwFgpeQu.d.ts → codec-DDUBJGn0.d.cts} +4 -4
  62. package/dist/{codec-BFeliJFc.d.ts → codec-DNfml-se.d.ts} +4 -4
  63. package/dist/{codec-C4n1PS09.d.cts → codec-DoOGjjDq.d.cts} +4 -4
  64. package/dist/{codec-Bap882Fh.d.cts → codec-J7ekOSMc.d.ts} +4 -4
  65. package/dist/{codec-SKBeHQk7.d.ts → codec-R9TJCq-E.d.cts} +4 -4
  66. package/dist/{codec-DNUIgLqc.d.cts → codec-ZwV-Njt6.d.ts} +4 -4
  67. package/dist/{codec-HgBgHkFI.d.cts → codec-j819z_hL.d.cts} +4 -4
  68. package/dist/{codec-DY4QH364.d.cts → codec-w8z2j_uo.d.cts} +4 -4
  69. package/dist/{codec-CPvPq0sb.d.cts → codec-wtt6WF1K.d.ts} +4 -4
  70. package/dist/{codec-BUMjz0J4.d.cts → codec-z6_2PSzi.d.cts} +4 -4
  71. package/dist/{draft7-session.cjs → draft07-session.cjs} +2 -2
  72. package/dist/draft07-session.d.cts +8 -0
  73. package/dist/draft07-session.d.ts +8 -0
  74. package/dist/{draft7-session.js → draft07-session.js} +1 -1
  75. package/dist/draft07.cjs +129 -0
  76. package/dist/draft07.d.cts +67 -0
  77. package/dist/draft07.d.ts +67 -0
  78. package/dist/draft07.js +129 -0
  79. package/dist/draft08-session.cjs +6 -0
  80. package/dist/draft08-session.d.cts +8 -0
  81. package/dist/draft08-session.d.ts +8 -0
  82. package/dist/{draft8-session.js → draft08-session.js} +1 -1
  83. package/dist/draft08.cjs +119 -0
  84. package/dist/{draft8.d.cts → draft08.d.cts} +15 -13
  85. package/dist/{draft8.d.ts → draft08.d.ts} +15 -13
  86. package/dist/{draft8.js → draft08.js} +7 -4
  87. package/dist/draft09-session.cjs +6 -0
  88. package/dist/draft09-session.d.cts +8 -0
  89. package/dist/draft09-session.d.ts +8 -0
  90. package/dist/{draft9-session.js → draft09-session.js} +1 -1
  91. package/dist/draft09.cjs +119 -0
  92. package/dist/{draft9.d.cts → draft09.d.cts} +15 -13
  93. package/dist/{draft9.d.ts → draft09.d.ts} +15 -13
  94. package/dist/{draft9.js → draft09.js} +7 -4
  95. package/dist/draft10-session.cjs +2 -2
  96. package/dist/draft10-session.d.cts +6 -6
  97. package/dist/draft10-session.d.ts +6 -6
  98. package/dist/draft10-session.js +1 -1
  99. package/dist/draft10.cjs +8 -5
  100. package/dist/draft10.d.cts +14 -12
  101. package/dist/draft10.d.ts +14 -12
  102. package/dist/draft10.js +16 -13
  103. package/dist/draft11-session.cjs +2 -2
  104. package/dist/draft11-session.d.cts +6 -6
  105. package/dist/draft11-session.d.ts +6 -6
  106. package/dist/draft11-session.js +1 -1
  107. package/dist/draft11.cjs +8 -5
  108. package/dist/draft11.d.cts +14 -12
  109. package/dist/draft11.d.ts +14 -12
  110. package/dist/draft11.js +16 -13
  111. package/dist/draft12-session.cjs +2 -2
  112. package/dist/draft12-session.d.cts +6 -6
  113. package/dist/draft12-session.d.ts +6 -6
  114. package/dist/draft12-session.js +1 -1
  115. package/dist/draft12.cjs +8 -5
  116. package/dist/draft12.d.cts +16 -14
  117. package/dist/draft12.d.ts +16 -14
  118. package/dist/draft12.js +16 -13
  119. package/dist/draft13-session.cjs +2 -2
  120. package/dist/draft13-session.d.cts +6 -6
  121. package/dist/draft13-session.d.ts +6 -6
  122. package/dist/draft13-session.js +1 -1
  123. package/dist/draft13.cjs +8 -5
  124. package/dist/draft13.d.cts +16 -14
  125. package/dist/draft13.d.ts +16 -14
  126. package/dist/draft13.js +16 -13
  127. package/dist/draft14-session.cjs +2 -2
  128. package/dist/draft14-session.d.cts +6 -6
  129. package/dist/draft14-session.d.ts +6 -6
  130. package/dist/draft14-session.js +1 -1
  131. package/dist/draft14.cjs +14 -5
  132. package/dist/draft14.d.cts +14 -12
  133. package/dist/draft14.d.ts +14 -12
  134. package/dist/draft14.js +13 -4
  135. package/dist/draft15-session.cjs +2 -2
  136. package/dist/draft15-session.d.cts +6 -6
  137. package/dist/draft15-session.d.ts +6 -6
  138. package/dist/draft15-session.js +1 -1
  139. package/dist/draft15.cjs +8 -5
  140. package/dist/draft15.d.cts +14 -12
  141. package/dist/draft15.d.ts +14 -12
  142. package/dist/draft15.js +16 -13
  143. package/dist/draft16-session.cjs +2 -2
  144. package/dist/draft16-session.d.cts +6 -6
  145. package/dist/draft16-session.d.ts +6 -6
  146. package/dist/draft16-session.js +1 -1
  147. package/dist/draft16.cjs +8 -5
  148. package/dist/draft16.d.cts +14 -12
  149. package/dist/draft16.d.ts +14 -12
  150. package/dist/draft16.js +16 -13
  151. package/dist/draft17-session.cjs +2 -2
  152. package/dist/draft17-session.d.cts +7 -7
  153. package/dist/draft17-session.d.ts +7 -7
  154. package/dist/draft17-session.js +1 -1
  155. package/dist/draft17.cjs +8 -5
  156. package/dist/draft17.d.cts +11 -9
  157. package/dist/draft17.d.ts +11 -9
  158. package/dist/draft17.js +16 -13
  159. package/dist/index.cjs +52 -74
  160. package/dist/index.d.cts +41 -60
  161. package/dist/index.d.ts +41 -60
  162. package/dist/index.js +40 -62
  163. package/dist/{session-types-CJIFbTPd.d.ts → session-types-C7UONex5.d.cts} +28 -27
  164. package/dist/{session-types-Cbq8IGCP.d.cts → session-types-X-IYEGoG.d.ts} +28 -27
  165. package/dist/session.cjs +46 -13
  166. package/dist/session.d.cts +29 -11
  167. package/dist/session.d.ts +29 -11
  168. package/dist/session.js +46 -13
  169. package/dist/{types-DxSFvL2b.d.cts → types--Q7_DcvP.d.cts} +43 -39
  170. package/dist/{types-DxSFvL2b.d.ts → types--Q7_DcvP.d.ts} +43 -39
  171. package/dist/{types-B0FT5Qs2.d.cts → types-0IWbU9Z_.d.cts} +36 -36
  172. package/dist/{types-B0FT5Qs2.d.ts → types-0IWbU9Z_.d.ts} +36 -36
  173. package/dist/{types-gQsr0AAA.d.cts → types-B3g5G9KP.d.cts} +36 -36
  174. package/dist/{types-gQsr0AAA.d.ts → types-B3g5G9KP.d.ts} +36 -36
  175. package/dist/{types-Pme7sua0.d.cts → types-BFpFNM_m.d.cts} +57 -32
  176. package/dist/{types-Pme7sua0.d.ts → types-BFpFNM_m.d.ts} +57 -32
  177. package/dist/{types-8gUGeMgs.d.cts → types-Br7fm2mf.d.cts} +48 -26
  178. package/dist/{types-8gUGeMgs.d.ts → types-Br7fm2mf.d.ts} +48 -26
  179. package/dist/{types-BeAVNU-F.d.cts → types-C2qKTRR_.d.cts} +50 -45
  180. package/dist/{types-BeAVNU-F.d.ts → types-C2qKTRR_.d.ts} +50 -45
  181. package/dist/{types-DKpsfD3i.d.cts → types-DEaypVsD.d.cts} +115 -55
  182. package/dist/{types-DKpsfD3i.d.ts → types-DEaypVsD.d.ts} +115 -55
  183. package/dist/types-Dl4IaAHR.d.cts +282 -0
  184. package/dist/types-Dl4IaAHR.d.ts +282 -0
  185. package/dist/{types-CDa7F5ct.d.cts → types-DrQpTW1G.d.cts} +58 -50
  186. package/dist/{types-CDa7F5ct.d.ts → types-DrQpTW1G.d.ts} +58 -50
  187. package/dist/types-DuIO7cWK.d.cts +25 -0
  188. package/dist/types-DuIO7cWK.d.ts +25 -0
  189. package/dist/{types-B9A2g05r.d.cts → types-DuxfOYiO.d.cts} +47 -31
  190. package/dist/{types-B9A2g05r.d.ts → types-DuxfOYiO.d.ts} +47 -31
  191. package/dist/{types-D1dI_oTX.d.cts → types-jV1yDDBA.d.cts} +36 -36
  192. package/dist/{types-D1dI_oTX.d.ts → types-jV1yDDBA.d.ts} +36 -36
  193. package/package.json +192 -192
  194. package/src/core/buffer-reader.ts +130 -130
  195. package/src/core/buffer-writer.ts +100 -100
  196. package/src/core/errors.ts +1 -1
  197. package/src/core/hex.ts +21 -21
  198. package/src/core/session-types.ts +61 -59
  199. package/src/core/types.ts +18 -361
  200. package/src/drafts/draft07/codec.ts +1058 -938
  201. package/src/drafts/draft07/data-streams.ts +240 -240
  202. package/src/drafts/draft07/index.ts +124 -89
  203. package/src/drafts/draft07/messages.ts +76 -42
  204. package/src/drafts/draft07/rules.ts +107 -101
  205. package/src/drafts/draft07/session-fsm.ts +315 -287
  206. package/src/drafts/draft07/session.ts +8 -6
  207. package/src/drafts/draft07/types.ts +406 -72
  208. package/src/drafts/draft07/varint.ts +51 -51
  209. package/src/drafts/draft08/codec.ts +985 -953
  210. package/src/drafts/draft08/data-streams.ts +363 -359
  211. package/src/drafts/draft08/index.ts +10 -9
  212. package/src/drafts/draft08/messages.ts +59 -59
  213. package/src/drafts/draft08/rules.ts +73 -73
  214. package/src/drafts/draft08/session-fsm.ts +335 -303
  215. package/src/drafts/draft08/session.ts +6 -7
  216. package/src/drafts/draft08/types.ts +380 -384
  217. package/src/drafts/draft09/codec.ts +977 -945
  218. package/src/drafts/draft09/data-streams.ts +336 -332
  219. package/src/drafts/draft09/index.ts +10 -9
  220. package/src/drafts/draft09/messages.ts +59 -59
  221. package/src/drafts/draft09/rules.ts +73 -73
  222. package/src/drafts/draft09/session-fsm.ts +335 -303
  223. package/src/drafts/draft09/session.ts +6 -7
  224. package/src/drafts/draft09/types.ts +380 -384
  225. package/src/drafts/draft10/codec.ts +977 -945
  226. package/src/drafts/draft10/data-streams.ts +336 -332
  227. package/src/drafts/draft10/index.ts +10 -9
  228. package/src/drafts/draft10/messages.ts +59 -59
  229. package/src/drafts/draft10/rules.ts +73 -73
  230. package/src/drafts/draft10/session-fsm.ts +335 -303
  231. package/src/drafts/draft10/session.ts +6 -7
  232. package/src/drafts/draft10/types.ts +380 -384
  233. package/src/drafts/draft11/codec.ts +1054 -988
  234. package/src/drafts/draft11/data-streams.ts +316 -269
  235. package/src/drafts/draft11/index.ts +10 -9
  236. package/src/drafts/draft11/messages.ts +60 -59
  237. package/src/drafts/draft11/rules.ts +73 -73
  238. package/src/drafts/draft11/session-fsm.ts +359 -333
  239. package/src/drafts/draft11/session.ts +6 -7
  240. package/src/drafts/draft11/types.ts +385 -381
  241. package/src/drafts/draft12/codec.ts +1178 -1122
  242. package/src/drafts/draft12/data-streams.ts +324 -275
  243. package/src/drafts/draft12/index.ts +10 -9
  244. package/src/drafts/draft12/messages.ts +67 -66
  245. package/src/drafts/draft12/rules.ts +79 -79
  246. package/src/drafts/draft12/session-fsm.ts +384 -358
  247. package/src/drafts/draft12/session.ts +6 -7
  248. package/src/drafts/draft12/types.ts +424 -419
  249. package/src/drafts/draft13/codec.ts +1296 -1206
  250. package/src/drafts/draft13/data-streams.ts +326 -275
  251. package/src/drafts/draft13/index.ts +10 -9
  252. package/src/drafts/draft13/messages.ts +73 -68
  253. package/src/drafts/draft13/rules.ts +81 -81
  254. package/src/drafts/draft13/session-fsm.ts +392 -366
  255. package/src/drafts/draft13/session.ts +6 -7
  256. package/src/drafts/draft13/types.ts +447 -438
  257. package/src/drafts/draft14/codec.ts +1347 -1043
  258. package/src/drafts/draft14/data-streams.ts +831 -813
  259. package/src/drafts/draft14/index.ts +17 -9
  260. package/src/drafts/draft14/messages.ts +65 -65
  261. package/src/drafts/draft14/rules.ts +81 -81
  262. package/src/drafts/draft14/session-fsm.ts +415 -405
  263. package/src/drafts/draft14/session.ts +6 -7
  264. package/src/drafts/draft14/types.ts +451 -381
  265. package/src/drafts/draft15/codec.ts +1138 -978
  266. package/src/drafts/draft15/data-streams.ts +842 -794
  267. package/src/drafts/draft15/index.ts +10 -9
  268. package/src/drafts/draft15/messages.ts +54 -53
  269. package/src/drafts/draft15/rules.ts +67 -67
  270. package/src/drafts/draft15/session-fsm.ts +319 -299
  271. package/src/drafts/draft15/session.ts +6 -7
  272. package/src/drafts/draft15/types.ts +357 -339
  273. package/src/drafts/draft16/codec.ts +1242 -966
  274. package/src/drafts/draft16/data-streams.ts +835 -789
  275. package/src/drafts/draft16/index.ts +10 -9
  276. package/src/drafts/draft16/messages.ts +56 -55
  277. package/src/drafts/draft16/rules.ts +69 -69
  278. package/src/drafts/draft16/session-fsm.ts +319 -299
  279. package/src/drafts/draft16/session.ts +6 -7
  280. package/src/drafts/draft16/types.ts +386 -357
  281. package/src/drafts/draft17/codec.ts +1209 -971
  282. package/src/drafts/draft17/data-streams.ts +969 -758
  283. package/src/drafts/draft17/index.ts +9 -7
  284. package/src/drafts/draft17/messages.ts +43 -42
  285. package/src/drafts/draft17/rules.ts +58 -58
  286. package/src/drafts/draft17/session-fsm.ts +248 -216
  287. package/src/drafts/draft17/session.ts +5 -5
  288. package/src/drafts/draft17/types.ts +337 -313
  289. package/src/index.ts +85 -274
  290. package/src/session.ts +63 -25
  291. package/dist/chunk-FZDIEHQL.cjs +0 -1042
  292. package/dist/chunk-HDWJ2GDE.js +0 -24
  293. package/dist/chunk-KNDYS3DK.cjs +0 -24
  294. package/dist/chunk-N2KBF5Q2.js +0 -1042
  295. package/dist/draft7-session.d.cts +0 -7
  296. package/dist/draft7-session.d.ts +0 -7
  297. package/dist/draft7.cjs +0 -72
  298. package/dist/draft7.d.cts +0 -148
  299. package/dist/draft7.d.ts +0 -148
  300. package/dist/draft7.js +0 -72
  301. package/dist/draft8-session.cjs +0 -6
  302. package/dist/draft8-session.d.cts +0 -8
  303. package/dist/draft8-session.d.ts +0 -8
  304. package/dist/draft8.cjs +0 -116
  305. package/dist/draft9-session.cjs +0 -6
  306. package/dist/draft9-session.d.cts +0 -8
  307. package/dist/draft9-session.d.ts +0 -8
  308. package/dist/draft9.cjs +0 -116
  309. package/dist/types-QNXoxC9Y.d.cts +0 -236
  310. package/dist/types-QNXoxC9Y.d.ts +0 -236
  311. package/src/drafts/draft07/announce-fsm.ts +0 -2
  312. package/src/drafts/draft07/parameters.ts +0 -12
  313. package/src/drafts/draft07/subscription-fsm.ts +0 -3
@@ -1,438 +1,447 @@
1
- // Draft-13 specific message types
2
- // Field names use snake_case to match test vector JSON
3
-
4
- // Unknown parameter for passthrough
5
- export interface UnknownParam {
6
- readonly id: string; // e.g. "0x21"
7
- readonly length: number;
8
- readonly raw_hex: string;
9
- }
10
-
11
- // Authorization token parameter
12
- export interface AuthorizationToken {
13
- readonly alias_type: bigint;
14
- readonly token_type: bigint;
15
- readonly token_value: string;
16
- }
17
-
18
- // Setup parameters (PATH, MAX_REQUEST_ID) — same even/odd encoding as later drafts
19
- export interface Draft13SetupParams {
20
- path?: string; // 0x01 odd
21
- max_request_id?: bigint; // 0x02 even
22
- unknown?: UnknownParam[];
23
- }
24
-
25
- // Version-specific parameters both odd (length-prefixed)
26
- export interface Draft13Params {
27
- authorization_token?: AuthorizationToken; // 0x01 odd
28
- delivery_timeout?: bigint; // 0x03 odd
29
- unknown?: UnknownParam[];
30
- }
31
-
32
- // Largest object location
33
- export interface LargestLocation {
34
- readonly group: bigint;
35
- readonly object: bigint;
36
- }
37
-
38
- // Draft-13 message type tag union
39
- export type Draft13MessageType =
40
- | "client_setup"
41
- | "server_setup"
42
- | "subscribe"
43
- | "subscribe_ok"
44
- | "subscribe_error"
45
- | "subscribe_update"
46
- | "subscribe_done"
47
- | "unsubscribe"
48
- | "announce"
49
- | "announce_ok"
50
- | "announce_error"
51
- | "unannounce"
52
- | "announce_cancel"
53
- | "subscribe_namespace"
54
- | "subscribe_namespace_ok"
55
- | "subscribe_namespace_error"
56
- | "unsubscribe_namespace"
57
- | "fetch"
58
- | "fetch_ok"
59
- | "fetch_error"
60
- | "fetch_cancel"
61
- | "publish"
62
- | "publish_ok"
63
- | "publish_error"
64
- | "track_status"
65
- | "track_status_ok"
66
- | "track_status_error"
67
- | "goaway"
68
- | "max_request_id"
69
- | "requests_blocked";
70
-
71
- // Base
72
- export interface Draft13BaseMessage {
73
- readonly type: Draft13MessageType;
74
- }
75
-
76
- // Setup — versions negotiated in messages
77
- export interface Draft13ClientSetup extends Draft13BaseMessage {
78
- readonly type: "client_setup";
79
- readonly supported_versions: bigint[];
80
- readonly parameters: Draft13SetupParams;
81
- }
82
-
83
- export interface Draft13ServerSetup extends Draft13BaseMessage {
84
- readonly type: "server_setup";
85
- readonly selected_version: bigint;
86
- readonly parameters: Draft13SetupParams;
87
- }
88
-
89
- // Subscribe — no track_alias in subscribe (moved to subscribe_ok)
90
- export interface Draft13Subscribe extends Draft13BaseMessage {
91
- readonly type: "subscribe";
92
- readonly request_id: bigint;
93
- readonly track_namespace: string[];
94
- readonly track_name: string;
95
- readonly subscriber_priority: number; // uint8
96
- readonly group_order: bigint;
97
- readonly forward: bigint;
98
- readonly filter_type: bigint;
99
- readonly start_group?: bigint;
100
- readonly start_object?: bigint;
101
- readonly end_group?: bigint;
102
- readonly parameters: Draft13Params;
103
- }
104
-
105
- export interface Draft13SubscribeOk extends Draft13BaseMessage {
106
- readonly type: "subscribe_ok";
107
- readonly request_id: bigint;
108
- readonly track_alias: bigint;
109
- readonly expires: bigint;
110
- readonly group_order: bigint;
111
- readonly content_exists: bigint;
112
- readonly largest_location?: LargestLocation;
113
- readonly parameters: Draft13Params;
114
- }
115
-
116
- export interface Draft13SubscribeError extends Draft13BaseMessage {
117
- readonly type: "subscribe_error";
118
- readonly request_id: bigint;
119
- readonly error_code: bigint;
120
- readonly reason_phrase: string;
121
- }
122
-
123
- export interface Draft13SubscribeUpdate extends Draft13BaseMessage {
124
- readonly type: "subscribe_update";
125
- readonly request_id: bigint;
126
- readonly start_group: bigint;
127
- readonly start_object: bigint;
128
- readonly end_group: bigint;
129
- readonly subscriber_priority: number; // uint8
130
- readonly forward: bigint;
131
- readonly parameters: Draft13Params;
132
- }
133
-
134
- export interface Draft13SubscribeDone extends Draft13BaseMessage {
135
- readonly type: "subscribe_done";
136
- readonly request_id: bigint;
137
- readonly status_code: bigint;
138
- readonly stream_count: bigint;
139
- readonly reason_phrase: string;
140
- }
141
-
142
- export interface Draft13Unsubscribe extends Draft13BaseMessage {
143
- readonly type: "unsubscribe";
144
- readonly request_id: bigint;
145
- }
146
-
147
- // Announce
148
- export interface Draft13Announce extends Draft13BaseMessage {
149
- readonly type: "announce";
150
- readonly request_id: bigint;
151
- readonly track_namespace: string[];
152
- readonly parameters: Draft13Params;
153
- }
154
-
155
- export interface Draft13AnnounceOk extends Draft13BaseMessage {
156
- readonly type: "announce_ok";
157
- readonly request_id: bigint;
158
- }
159
-
160
- export interface Draft13AnnounceError extends Draft13BaseMessage {
161
- readonly type: "announce_error";
162
- readonly request_id: bigint;
163
- readonly error_code: bigint;
164
- readonly reason_phrase: string;
165
- }
166
-
167
- export interface Draft13Unannounce extends Draft13BaseMessage {
168
- readonly type: "unannounce";
169
- readonly track_namespace: string[];
170
- }
171
-
172
- export interface Draft13AnnounceCancel extends Draft13BaseMessage {
173
- readonly type: "announce_cancel";
174
- readonly track_namespace: string[];
175
- readonly error_code: bigint;
176
- readonly reason_phrase: string;
177
- }
178
-
179
- // Subscribe Namespace (renamed from subscribe_announces in draft-12)
180
- export interface Draft13SubscribeNamespace extends Draft13BaseMessage {
181
- readonly type: "subscribe_namespace";
182
- readonly request_id: bigint;
183
- readonly track_namespace_prefix: string[];
184
- readonly parameters: Draft13Params;
185
- }
186
-
187
- export interface Draft13SubscribeNamespaceOk extends Draft13BaseMessage {
188
- readonly type: "subscribe_namespace_ok";
189
- readonly request_id: bigint;
190
- }
191
-
192
- export interface Draft13SubscribeNamespaceError extends Draft13BaseMessage {
193
- readonly type: "subscribe_namespace_error";
194
- readonly request_id: bigint;
195
- readonly error_code: bigint;
196
- readonly reason_phrase: string;
197
- }
198
-
199
- export interface Draft13UnsubscribeNamespace extends Draft13BaseMessage {
200
- readonly type: "unsubscribe_namespace";
201
- readonly track_namespace_prefix: string[];
202
- }
203
-
204
- // Publish (same as draft-12)
205
- export interface Draft13Publish extends Draft13BaseMessage {
206
- readonly type: "publish";
207
- readonly request_id: bigint;
208
- readonly track_namespace: string[];
209
- readonly track_name: string;
210
- readonly track_alias: bigint;
211
- readonly group_order: bigint;
212
- readonly content_exists: bigint;
213
- readonly largest_location?: LargestLocation;
214
- readonly forward: bigint;
215
- readonly parameters: Draft13Params;
216
- }
217
-
218
- export interface Draft13PublishOk extends Draft13BaseMessage {
219
- readonly type: "publish_ok";
220
- readonly request_id: bigint;
221
- readonly forward: bigint;
222
- readonly subscriber_priority: number; // uint8
223
- readonly group_order: bigint;
224
- readonly filter_type: bigint;
225
- readonly start_group?: bigint;
226
- readonly start_object?: bigint;
227
- readonly end_group?: bigint;
228
- readonly parameters: Draft13Params;
229
- }
230
-
231
- export interface Draft13PublishError extends Draft13BaseMessage {
232
- readonly type: "publish_error";
233
- readonly request_id: bigint;
234
- readonly error_code: bigint;
235
- readonly reason_phrase: string;
236
- }
237
-
238
- // Fetch
239
- export interface StandaloneFetch {
240
- readonly track_namespace: string[];
241
- readonly track_name: string;
242
- readonly start_group: bigint;
243
- readonly start_object: bigint;
244
- readonly end_group: bigint;
245
- readonly end_object: bigint;
246
- }
247
-
248
- export interface JoiningFetch {
249
- readonly joining_subscribe_id: bigint;
250
- readonly joining_start: bigint;
251
- }
252
-
253
- export interface Draft13Fetch extends Draft13BaseMessage {
254
- readonly type: "fetch";
255
- readonly request_id: bigint;
256
- readonly subscriber_priority: number; // uint8
257
- readonly group_order: bigint;
258
- readonly fetch_type: bigint;
259
- readonly standalone?: StandaloneFetch;
260
- readonly joining?: JoiningFetch;
261
- readonly parameters: Draft13Params;
262
- }
263
-
264
- export interface Draft13FetchOk extends Draft13BaseMessage {
265
- readonly type: "fetch_ok";
266
- readonly request_id: bigint;
267
- readonly group_order: bigint;
268
- readonly end_of_track: bigint;
269
- readonly end_location: LargestLocation;
270
- readonly parameters: Draft13Params;
271
- }
272
-
273
- export interface Draft13FetchError extends Draft13BaseMessage {
274
- readonly type: "fetch_error";
275
- readonly request_id: bigint;
276
- readonly error_code: bigint;
277
- readonly reason_phrase: string;
278
- }
279
-
280
- export interface Draft13FetchCancel extends Draft13BaseMessage {
281
- readonly type: "fetch_cancel";
282
- readonly request_id: bigint;
283
- }
284
-
285
- // Track Status (restructured in draft-13: request is SUBSCRIBE-like)
286
- export interface Draft13TrackStatus extends Draft13BaseMessage {
287
- readonly type: "track_status";
288
- readonly request_id: bigint;
289
- readonly track_namespace: string[];
290
- readonly track_name: string;
291
- readonly subscriber_priority: number; // uint8
292
- readonly group_order: bigint;
293
- readonly forward: bigint;
294
- readonly filter_type: bigint;
295
- readonly start_group?: bigint;
296
- readonly start_object?: bigint;
297
- readonly end_group?: bigint;
298
- readonly parameters: Draft13Params;
299
- }
300
-
301
- export interface Draft13TrackStatusOk extends Draft13BaseMessage {
302
- readonly type: "track_status_ok";
303
- readonly request_id: bigint;
304
- readonly track_alias: bigint;
305
- readonly expires: bigint;
306
- readonly group_order: bigint;
307
- readonly content_exists: bigint;
308
- readonly largest_location?: LargestLocation;
309
- readonly parameters: Draft13Params;
310
- }
311
-
312
- export interface Draft13TrackStatusError extends Draft13BaseMessage {
313
- readonly type: "track_status_error";
314
- readonly request_id: bigint;
315
- readonly error_code: bigint;
316
- readonly reason_phrase: string;
317
- }
318
-
319
- // Session Control
320
- export interface Draft13GoAway extends Draft13BaseMessage {
321
- readonly type: "goaway";
322
- readonly new_session_uri: string;
323
- }
324
-
325
- export interface Draft13MaxRequestId extends Draft13BaseMessage {
326
- readonly type: "max_request_id";
327
- readonly request_id: bigint;
328
- }
329
-
330
- export interface Draft13RequestsBlocked extends Draft13BaseMessage {
331
- readonly type: "requests_blocked";
332
- readonly maximum_request_id: bigint;
333
- }
334
-
335
- // Union of all draft-13 control messages
336
- export type Draft13Message =
337
- | Draft13ClientSetup
338
- | Draft13ServerSetup
339
- | Draft13Subscribe
340
- | Draft13SubscribeOk
341
- | Draft13SubscribeError
342
- | Draft13SubscribeUpdate
343
- | Draft13SubscribeDone
344
- | Draft13Unsubscribe
345
- | Draft13Announce
346
- | Draft13AnnounceOk
347
- | Draft13AnnounceError
348
- | Draft13Unannounce
349
- | Draft13AnnounceCancel
350
- | Draft13SubscribeNamespace
351
- | Draft13SubscribeNamespaceOk
352
- | Draft13SubscribeNamespaceError
353
- | Draft13UnsubscribeNamespace
354
- | Draft13Publish
355
- | Draft13PublishOk
356
- | Draft13PublishError
357
- | Draft13Fetch
358
- | Draft13FetchOk
359
- | Draft13FetchError
360
- | Draft13FetchCancel
361
- | Draft13TrackStatus
362
- | Draft13TrackStatusOk
363
- | Draft13TrackStatusError
364
- | Draft13GoAway
365
- | Draft13MaxRequestId
366
- | Draft13RequestsBlocked;
367
-
368
- // Data stream types
369
- export interface ObjectPayload {
370
- readonly type: "object";
371
- readonly byteOffset: number;
372
- readonly payloadByteOffset: number;
373
- readonly objectId: bigint;
374
- readonly payloadLength: number;
375
- readonly status?: bigint;
376
- readonly extensionData: Uint8Array;
377
- readonly payload: Uint8Array;
378
- }
379
-
380
- export interface SubgroupStream {
381
- readonly type: "subgroup";
382
- readonly streamTypeId: number; // 0x10-0x15, 0x18-0x1D
383
- readonly trackAlias: bigint;
384
- readonly groupId: bigint;
385
- readonly subgroupId: bigint;
386
- readonly publisherPriority: number;
387
- readonly objects: ObjectPayload[];
388
- }
389
-
390
- export interface DatagramObject {
391
- readonly type: "datagram";
392
- readonly streamTypeId: number; // 0x00 or 0x02
393
- readonly trackAlias: bigint;
394
- readonly groupId: bigint;
395
- readonly objectId: bigint;
396
- readonly publisherPriority: number;
397
- readonly objectStatus?: bigint;
398
- readonly payloadLength: number;
399
- readonly payload: Uint8Array;
400
- }
401
-
402
- export interface FetchObjectPayload {
403
- readonly type: "object";
404
- readonly byteOffset: number;
405
- readonly payloadByteOffset: number;
406
- readonly groupId: bigint;
407
- readonly subgroupId: bigint;
408
- readonly objectId: bigint;
409
- readonly publisherPriority: number;
410
- readonly extensionData: Uint8Array;
411
- readonly payloadLength: number;
412
- readonly payload: Uint8Array;
413
- }
414
-
415
- export interface FetchStream {
416
- readonly type: "fetch";
417
- readonly requestId: bigint;
418
- readonly objects: FetchObjectPayload[];
419
- }
420
-
421
- export type Draft13DataStream = SubgroupStream | DatagramObject | FetchStream;
422
-
423
- // Streaming data stream decoder types
424
- export interface SubgroupStreamHeader {
425
- readonly type: "subgroup_header";
426
- readonly trackAlias: bigint;
427
- readonly groupId: bigint;
428
- readonly subgroupId: bigint;
429
- readonly publisherPriority: number;
430
- }
431
-
432
- export interface FetchStreamHeader {
433
- readonly type: "fetch_header";
434
- readonly requestId: bigint;
435
- }
436
-
437
- export type DataStreamHeader = SubgroupStreamHeader | FetchStreamHeader;
438
- export type DataStreamEvent = DataStreamHeader | ObjectPayload;
1
+ // Draft-13 specific message types
2
+ // Field names use snake_case to match test vector JSON
3
+
4
+ // Unknown parameter for passthrough
5
+ export interface UnknownParam {
6
+ readonly id: string // e.g. "0x21"
7
+ readonly length: number
8
+ readonly raw_hex: string
9
+ }
10
+
11
+ // Authorization token parameter
12
+ // alias_type: 0=DELETE, 1=REGISTER, 2=USE_ALIAS, 3=USE_VALUE
13
+ export interface AuthorizationToken {
14
+ readonly alias_type: bigint
15
+ readonly token_alias?: bigint // present for DELETE(0), REGISTER(1), USE_ALIAS(2)
16
+ readonly token_type?: bigint // present for USE_VALUE(3), REGISTER(1)
17
+ readonly token_value?: string // present for USE_VALUE(3), REGISTER(1)
18
+ }
19
+
20
+ // Setup parameters (PATH, MAX_REQUEST_ID, AUTHORIZATION_TOKEN, MAX_AUTH_TOKEN_CACHE_SIZE)
21
+ export interface Draft13SetupParams {
22
+ path?: string // 0x01 odd
23
+ max_request_id?: bigint // 0x02 even
24
+ authorization_token?: AuthorizationToken // 0x03 odd
25
+ max_auth_token_cache_size?: bigint // 0x04 even
26
+ unknown?: UnknownParam[]
27
+ }
28
+
29
+ // Version-specific parameters — even/odd convention
30
+ export interface Draft13Params {
31
+ delivery_timeout?: bigint // 0x02 even
32
+ authorization_token?: AuthorizationToken // 0x03 odd
33
+ max_cache_duration?: bigint // 0x04 even
34
+ unknown?: UnknownParam[]
35
+ }
36
+
37
+ // Largest object location
38
+ export interface LargestLocation {
39
+ readonly group: bigint
40
+ readonly object: bigint
41
+ }
42
+
43
+ // Draft-13 message type tag union
44
+ export type Draft13MessageType =
45
+ | 'client_setup'
46
+ | 'server_setup'
47
+ | 'subscribe'
48
+ | 'subscribe_ok'
49
+ | 'subscribe_error'
50
+ | 'subscribe_update'
51
+ | 'subscribe_done'
52
+ | 'unsubscribe'
53
+ | 'announce'
54
+ | 'announce_ok'
55
+ | 'announce_error'
56
+ | 'unannounce'
57
+ | 'announce_cancel'
58
+ | 'subscribe_namespace'
59
+ | 'subscribe_namespace_ok'
60
+ | 'subscribe_namespace_error'
61
+ | 'unsubscribe_namespace'
62
+ | 'fetch'
63
+ | 'fetch_ok'
64
+ | 'fetch_error'
65
+ | 'fetch_cancel'
66
+ | 'publish'
67
+ | 'publish_ok'
68
+ | 'publish_error'
69
+ | 'track_status'
70
+ | 'track_status_ok'
71
+ | 'track_status_error'
72
+ | 'goaway'
73
+ | 'max_request_id'
74
+ | 'requests_blocked'
75
+
76
+ // Base
77
+ export interface Draft13BaseMessage {
78
+ readonly type: Draft13MessageType
79
+ }
80
+
81
+ // Setup — versions negotiated in messages
82
+ export interface Draft13ClientSetup extends Draft13BaseMessage {
83
+ readonly type: 'client_setup'
84
+ readonly supported_versions: bigint[]
85
+ readonly parameters: Draft13SetupParams
86
+ }
87
+
88
+ export interface Draft13ServerSetup extends Draft13BaseMessage {
89
+ readonly type: 'server_setup'
90
+ readonly selected_version: bigint
91
+ readonly parameters: Draft13SetupParams
92
+ }
93
+
94
+ // Subscribe — no track_alias in subscribe (moved to subscribe_ok)
95
+ export interface Draft13Subscribe extends Draft13BaseMessage {
96
+ readonly type: 'subscribe'
97
+ readonly request_id: bigint
98
+ readonly track_namespace: string[]
99
+ readonly track_name: string
100
+ readonly subscriber_priority: number // uint8
101
+ readonly group_order: number // uint8
102
+ readonly forward: bigint
103
+ readonly filter_type: bigint
104
+ readonly start_group?: bigint
105
+ readonly start_object?: bigint
106
+ readonly end_group?: bigint
107
+ readonly parameters: Draft13Params
108
+ }
109
+
110
+ export interface Draft13SubscribeOk extends Draft13BaseMessage {
111
+ readonly type: 'subscribe_ok'
112
+ readonly request_id: bigint
113
+ readonly track_alias: bigint
114
+ readonly expires: bigint
115
+ readonly group_order: number // uint8
116
+ readonly content_exists: bigint
117
+ readonly largest_location?: LargestLocation
118
+ readonly parameters: Draft13Params
119
+ }
120
+
121
+ export interface Draft13SubscribeError extends Draft13BaseMessage {
122
+ readonly type: 'subscribe_error'
123
+ readonly request_id: bigint
124
+ readonly error_code: bigint
125
+ readonly reason_phrase: string
126
+ }
127
+
128
+ export interface Draft13SubscribeUpdate extends Draft13BaseMessage {
129
+ readonly type: 'subscribe_update'
130
+ readonly request_id: bigint
131
+ readonly start_group: bigint
132
+ readonly start_object: bigint
133
+ readonly end_group: bigint
134
+ readonly subscriber_priority: number // uint8
135
+ readonly forward: bigint
136
+ readonly parameters: Draft13Params
137
+ }
138
+
139
+ export interface Draft13SubscribeDone extends Draft13BaseMessage {
140
+ readonly type: 'subscribe_done'
141
+ readonly request_id: bigint
142
+ readonly status_code: bigint
143
+ readonly stream_count: bigint
144
+ readonly reason_phrase: string
145
+ }
146
+
147
+ export interface Draft13Unsubscribe extends Draft13BaseMessage {
148
+ readonly type: 'unsubscribe'
149
+ readonly request_id: bigint
150
+ }
151
+
152
+ // Announce
153
+ export interface Draft13Announce extends Draft13BaseMessage {
154
+ readonly type: 'announce'
155
+ readonly request_id: bigint
156
+ readonly track_namespace: string[]
157
+ readonly parameters: Draft13Params
158
+ }
159
+
160
+ export interface Draft13AnnounceOk extends Draft13BaseMessage {
161
+ readonly type: 'announce_ok'
162
+ readonly request_id: bigint
163
+ }
164
+
165
+ export interface Draft13AnnounceError extends Draft13BaseMessage {
166
+ readonly type: 'announce_error'
167
+ readonly request_id: bigint
168
+ readonly error_code: bigint
169
+ readonly reason_phrase: string
170
+ }
171
+
172
+ export interface Draft13Unannounce extends Draft13BaseMessage {
173
+ readonly type: 'unannounce'
174
+ readonly track_namespace: string[]
175
+ }
176
+
177
+ export interface Draft13AnnounceCancel extends Draft13BaseMessage {
178
+ readonly type: 'announce_cancel'
179
+ readonly track_namespace: string[]
180
+ readonly error_code: bigint
181
+ readonly reason_phrase: string
182
+ }
183
+
184
+ // Subscribe Namespace (renamed from subscribe_announces in draft-12)
185
+ export interface Draft13SubscribeNamespace extends Draft13BaseMessage {
186
+ readonly type: 'subscribe_namespace'
187
+ readonly request_id: bigint
188
+ readonly track_namespace_prefix: string[]
189
+ readonly parameters: Draft13Params
190
+ }
191
+
192
+ export interface Draft13SubscribeNamespaceOk extends Draft13BaseMessage {
193
+ readonly type: 'subscribe_namespace_ok'
194
+ readonly request_id: bigint
195
+ }
196
+
197
+ export interface Draft13SubscribeNamespaceError extends Draft13BaseMessage {
198
+ readonly type: 'subscribe_namespace_error'
199
+ readonly request_id: bigint
200
+ readonly error_code: bigint
201
+ readonly reason_phrase: string
202
+ }
203
+
204
+ export interface Draft13UnsubscribeNamespace extends Draft13BaseMessage {
205
+ readonly type: 'unsubscribe_namespace'
206
+ readonly track_namespace_prefix: string[]
207
+ }
208
+
209
+ // Publish (same as draft-12)
210
+ export interface Draft13Publish extends Draft13BaseMessage {
211
+ readonly type: 'publish'
212
+ readonly request_id: bigint
213
+ readonly track_namespace: string[]
214
+ readonly track_name: string
215
+ readonly track_alias: bigint
216
+ readonly group_order: number // uint8
217
+ readonly content_exists: bigint
218
+ readonly largest_location?: LargestLocation
219
+ readonly forward: bigint
220
+ readonly parameters: Draft13Params
221
+ }
222
+
223
+ export interface Draft13PublishOk extends Draft13BaseMessage {
224
+ readonly type: 'publish_ok'
225
+ readonly request_id: bigint
226
+ readonly forward: bigint
227
+ readonly subscriber_priority: number // uint8
228
+ readonly group_order: number // uint8
229
+ readonly filter_type: bigint
230
+ readonly start_group?: bigint
231
+ readonly start_object?: bigint
232
+ readonly end_group?: bigint
233
+ readonly parameters: Draft13Params
234
+ }
235
+
236
+ export interface Draft13PublishError extends Draft13BaseMessage {
237
+ readonly type: 'publish_error'
238
+ readonly request_id: bigint
239
+ readonly error_code: bigint
240
+ readonly reason_phrase: string
241
+ }
242
+
243
+ // Fetch
244
+ export interface StandaloneFetch {
245
+ readonly track_namespace: string[]
246
+ readonly track_name: string
247
+ readonly start_group: bigint
248
+ readonly start_object: bigint
249
+ readonly end_group: bigint
250
+ readonly end_object: bigint
251
+ }
252
+
253
+ export interface JoiningFetch {
254
+ readonly joining_subscribe_id: bigint
255
+ readonly joining_start: bigint
256
+ }
257
+
258
+ export interface Draft13Fetch extends Draft13BaseMessage {
259
+ readonly type: 'fetch'
260
+ readonly request_id: bigint
261
+ readonly subscriber_priority: number // uint8
262
+ readonly group_order: number // uint8
263
+ readonly fetch_type: bigint
264
+ readonly standalone?: StandaloneFetch
265
+ readonly joining?: JoiningFetch
266
+ readonly parameters: Draft13Params
267
+ }
268
+
269
+ export interface Draft13FetchOk extends Draft13BaseMessage {
270
+ readonly type: 'fetch_ok'
271
+ readonly request_id: bigint
272
+ readonly group_order: number // uint8
273
+ readonly end_of_track: bigint
274
+ readonly end_location: LargestLocation
275
+ readonly parameters: Draft13Params
276
+ }
277
+
278
+ export interface Draft13FetchError extends Draft13BaseMessage {
279
+ readonly type: 'fetch_error'
280
+ readonly request_id: bigint
281
+ readonly error_code: bigint
282
+ readonly reason_phrase: string
283
+ }
284
+
285
+ export interface Draft13FetchCancel extends Draft13BaseMessage {
286
+ readonly type: 'fetch_cancel'
287
+ readonly request_id: bigint
288
+ }
289
+
290
+ // Track Status (restructured in draft-13: request is SUBSCRIBE-like)
291
+ export interface Draft13TrackStatus extends Draft13BaseMessage {
292
+ readonly type: 'track_status'
293
+ readonly request_id: bigint
294
+ readonly track_namespace: string[]
295
+ readonly track_name: string
296
+ readonly subscriber_priority: number // uint8
297
+ readonly group_order: number // uint8
298
+ readonly forward: bigint
299
+ readonly filter_type: bigint
300
+ readonly start_group?: bigint
301
+ readonly start_object?: bigint
302
+ readonly end_group?: bigint
303
+ readonly parameters: Draft13Params
304
+ }
305
+
306
+ export interface Draft13TrackStatusOk extends Draft13BaseMessage {
307
+ readonly type: 'track_status_ok'
308
+ readonly request_id: bigint
309
+ readonly track_alias: bigint
310
+ readonly expires: bigint
311
+ readonly group_order: number // uint8
312
+ readonly content_exists: bigint
313
+ readonly largest_location?: LargestLocation
314
+ readonly parameters: Draft13Params
315
+ }
316
+
317
+ export interface Draft13TrackStatusError extends Draft13BaseMessage {
318
+ readonly type: 'track_status_error'
319
+ readonly request_id: bigint
320
+ readonly error_code: bigint
321
+ readonly reason_phrase: string
322
+ }
323
+
324
+ // Session Control
325
+ export interface Draft13GoAway extends Draft13BaseMessage {
326
+ readonly type: 'goaway'
327
+ readonly new_session_uri: string
328
+ }
329
+
330
+ export interface Draft13MaxRequestId extends Draft13BaseMessage {
331
+ readonly type: 'max_request_id'
332
+ readonly request_id: bigint
333
+ }
334
+
335
+ export interface Draft13RequestsBlocked extends Draft13BaseMessage {
336
+ readonly type: 'requests_blocked'
337
+ readonly maximum_request_id: bigint
338
+ }
339
+
340
+ // Union of all draft-13 control messages
341
+ export type Draft13Message =
342
+ | Draft13ClientSetup
343
+ | Draft13ServerSetup
344
+ | Draft13Subscribe
345
+ | Draft13SubscribeOk
346
+ | Draft13SubscribeError
347
+ | Draft13SubscribeUpdate
348
+ | Draft13SubscribeDone
349
+ | Draft13Unsubscribe
350
+ | Draft13Announce
351
+ | Draft13AnnounceOk
352
+ | Draft13AnnounceError
353
+ | Draft13Unannounce
354
+ | Draft13AnnounceCancel
355
+ | Draft13SubscribeNamespace
356
+ | Draft13SubscribeNamespaceOk
357
+ | Draft13SubscribeNamespaceError
358
+ | Draft13UnsubscribeNamespace
359
+ | Draft13Publish
360
+ | Draft13PublishOk
361
+ | Draft13PublishError
362
+ | Draft13Fetch
363
+ | Draft13FetchOk
364
+ | Draft13FetchError
365
+ | Draft13FetchCancel
366
+ | Draft13TrackStatus
367
+ | Draft13TrackStatusOk
368
+ | Draft13TrackStatusError
369
+ | Draft13GoAway
370
+ | Draft13MaxRequestId
371
+ | Draft13RequestsBlocked
372
+
373
+ // Data stream types
374
+ export interface ObjectPayload {
375
+ readonly type: 'object'
376
+ readonly byteOffset: number
377
+ readonly payloadByteOffset: number
378
+ readonly objectId: bigint
379
+ readonly extensionHeadersLength?: bigint
380
+ readonly payloadLength: number
381
+ readonly status?: bigint
382
+ readonly extensionData: Uint8Array
383
+ readonly payload: Uint8Array
384
+ }
385
+
386
+ export interface SubgroupStream {
387
+ readonly type: 'subgroup'
388
+ readonly streamTypeId: number // 0x10-0x15, 0x18-0x1D
389
+ readonly trackAlias: bigint
390
+ readonly groupId: bigint
391
+ readonly subgroupId: bigint
392
+ readonly publisherPriority: number
393
+ readonly objects: ObjectPayload[]
394
+ }
395
+
396
+ export interface DatagramObject {
397
+ readonly type: 'datagram'
398
+ readonly streamTypeId: number // 0x00-0x05
399
+ readonly trackAlias: bigint
400
+ readonly groupId: bigint
401
+ readonly objectId: bigint
402
+ readonly publisherPriority: number
403
+ readonly extensionHeadersLength?: bigint
404
+ readonly extensionData?: Uint8Array
405
+ readonly objectStatus?: bigint
406
+ readonly payloadLength: number
407
+ readonly payload: Uint8Array
408
+ }
409
+
410
+ export interface FetchObjectPayload {
411
+ readonly type: 'object'
412
+ readonly byteOffset: number
413
+ readonly payloadByteOffset: number
414
+ readonly groupId: bigint
415
+ readonly subgroupId: bigint
416
+ readonly objectId: bigint
417
+ readonly publisherPriority: number
418
+ readonly extensionHeadersLength: bigint
419
+ readonly extensionData: Uint8Array
420
+ readonly payloadLength: number
421
+ readonly payload: Uint8Array
422
+ }
423
+
424
+ export interface FetchStream {
425
+ readonly type: 'fetch'
426
+ readonly requestId: bigint
427
+ readonly objects: FetchObjectPayload[]
428
+ }
429
+
430
+ export type Draft13DataStream = SubgroupStream | DatagramObject | FetchStream
431
+
432
+ // Streaming data stream decoder types
433
+ export interface SubgroupStreamHeader {
434
+ readonly type: 'subgroup_header'
435
+ readonly trackAlias: bigint
436
+ readonly groupId: bigint
437
+ readonly subgroupId: bigint
438
+ readonly publisherPriority: number
439
+ }
440
+
441
+ export interface FetchStreamHeader {
442
+ readonly type: 'fetch_header'
443
+ readonly requestId: bigint
444
+ }
445
+
446
+ export type DataStreamHeader = SubgroupStreamHeader | FetchStreamHeader
447
+ export type DataStreamEvent = DataStreamHeader | ObjectPayload