@moq/net 0.4.7 → 0.22.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 (664) hide show
  1. package/README.md +7 -1
  2. package/announce.d.ts +1 -1
  3. package/announce.d.ts.map +1 -1
  4. package/announce.js +1 -2
  5. package/announce.js.map +1 -1
  6. package/announced.d.ts +51 -47
  7. package/announced.d.ts.map +1 -1
  8. package/announced.js +183 -32
  9. package/announced.js.map +1 -1
  10. package/announced.test-util.d.ts +2 -0
  11. package/announced.test-util.d.ts.map +1 -0
  12. package/announced.test-util.js +27 -0
  13. package/announced.test-util.js.map +1 -0
  14. package/auth.d.ts +64 -0
  15. package/auth.d.ts.map +1 -0
  16. package/auth.js +20 -0
  17. package/auth.js.map +1 -0
  18. package/auth_gate.d.ts +2 -0
  19. package/auth_gate.d.ts.map +1 -0
  20. package/auth_gate.js +24 -0
  21. package/auth_gate.js.map +1 -0
  22. package/auth_session.d.ts +49 -0
  23. package/auth_session.d.ts.map +1 -0
  24. package/auth_session.js +1097 -0
  25. package/auth_session.js.map +1 -0
  26. package/bandwidth.d.ts +129 -25
  27. package/bandwidth.d.ts.map +1 -1
  28. package/bandwidth.js +410 -139
  29. package/bandwidth.js.map +1 -1
  30. package/bandwidth_api.d.ts +1 -1
  31. package/bandwidth_api.d.ts.map +1 -1
  32. package/bandwidth_api.js +1 -2
  33. package/bandwidth_api.js.map +1 -1
  34. package/broadcast.d.ts +64 -38
  35. package/broadcast.d.ts.map +1 -1
  36. package/broadcast.js +556 -173
  37. package/broadcast.js.map +1 -1
  38. package/cache.d.ts +103 -0
  39. package/cache.d.ts.map +1 -0
  40. package/cache.js +254 -0
  41. package/cache.js.map +1 -0
  42. package/claim.test-util.d.ts +5 -0
  43. package/claim.test-util.d.ts.map +1 -0
  44. package/claim.test-util.js +13 -0
  45. package/claim.test-util.js.map +1 -0
  46. package/connection/accept.d.ts +21 -13
  47. package/connection/accept.d.ts.map +1 -1
  48. package/connection/accept.js +97 -130
  49. package/connection/accept.js.map +1 -1
  50. package/connection/browser.d.ts.map +1 -1
  51. package/connection/browser.js +28 -20
  52. package/connection/browser.js.map +1 -1
  53. package/connection/connect.d.ts +120 -24
  54. package/connection/connect.d.ts.map +1 -1
  55. package/connection/connect.js +535 -217
  56. package/connection/connect.js.map +1 -1
  57. package/connection/dials.d.ts +45 -0
  58. package/connection/dials.d.ts.map +1 -0
  59. package/connection/dials.js +109 -0
  60. package/connection/dials.js.map +1 -0
  61. package/connection/endpoint.d.ts +60 -0
  62. package/connection/endpoint.d.ts.map +1 -0
  63. package/connection/endpoint.js +114 -0
  64. package/connection/endpoint.js.map +1 -0
  65. package/connection/forward.d.ts +7 -1
  66. package/connection/forward.d.ts.map +1 -1
  67. package/connection/forward.js +265 -81
  68. package/connection/forward.js.map +1 -1
  69. package/connection/goaway.d.ts +16 -9
  70. package/connection/goaway.d.ts.map +1 -1
  71. package/connection/goaway.js +22 -95
  72. package/connection/goaway.js.map +1 -1
  73. package/connection/handshake.d.ts +34 -8
  74. package/connection/handshake.d.ts.map +1 -1
  75. package/connection/handshake.js +97 -21
  76. package/connection/handshake.js.map +1 -1
  77. package/connection/index.d.ts +4 -7
  78. package/connection/index.d.ts.map +1 -1
  79. package/connection/index.js +1 -3
  80. package/connection/index.js.map +1 -1
  81. package/connection/liveness.d.ts +14 -0
  82. package/connection/liveness.d.ts.map +1 -0
  83. package/connection/liveness.js +30 -0
  84. package/connection/liveness.js.map +1 -0
  85. package/connection/pool.d.ts +142 -63
  86. package/connection/pool.d.ts.map +1 -1
  87. package/connection/pool.js +281 -118
  88. package/connection/pool.js.map +1 -1
  89. package/connection/reload.d.ts +60 -12
  90. package/connection/reload.d.ts.map +1 -1
  91. package/connection/reload.js +859 -234
  92. package/connection/reload.js.map +1 -1
  93. package/connection/session.d.ts +91 -0
  94. package/connection/session.d.ts.map +1 -0
  95. package/connection/session.js +2 -0
  96. package/connection/session.js.map +1 -0
  97. package/connection/stats.d.ts +20 -11
  98. package/connection/stats.d.ts.map +1 -1
  99. package/connection/stats.js +64 -9
  100. package/connection/stats.js.map +1 -1
  101. package/connection/ticker.d.ts +4 -0
  102. package/connection/ticker.d.ts.map +1 -0
  103. package/connection/ticker.js +66 -0
  104. package/connection/ticker.js.map +1 -0
  105. package/connection/tokens.d.ts +2 -0
  106. package/connection/tokens.d.ts.map +1 -0
  107. package/connection/tokens.js +404 -0
  108. package/connection/tokens.js.map +1 -0
  109. package/connection/transport.d.ts.map +1 -1
  110. package/connection/transport.js +4 -5
  111. package/connection/transport.js.map +1 -1
  112. package/connection/withdrawal.d.ts +2 -0
  113. package/connection/withdrawal.d.ts.map +1 -0
  114. package/connection/withdrawal.js +23 -0
  115. package/connection/withdrawal.js.map +1 -0
  116. package/consume.js +213 -47
  117. package/consume.js.map +1 -1
  118. package/cover.d.ts +59 -0
  119. package/cover.d.ts.map +1 -0
  120. package/cover.js +375 -0
  121. package/cover.js.map +1 -0
  122. package/datagram.d.ts +70 -11
  123. package/datagram.d.ts.map +1 -1
  124. package/datagram.js +317 -2
  125. package/datagram.js.map +1 -1
  126. package/datagram_stream.d.ts +18 -0
  127. package/datagram_stream.d.ts.map +1 -0
  128. package/datagram_stream.js +67 -0
  129. package/datagram_stream.js.map +1 -0
  130. package/defined.test-util.d.ts +2 -0
  131. package/defined.test-util.d.ts.map +1 -0
  132. package/defined.test-util.js +7 -0
  133. package/defined.test-util.js.map +1 -0
  134. package/delivered.d.ts +75 -0
  135. package/delivered.d.ts.map +1 -0
  136. package/delivered.js +228 -0
  137. package/delivered.js.map +1 -0
  138. package/demand.d.ts +173 -0
  139. package/demand.d.ts.map +1 -0
  140. package/demand.js +582 -0
  141. package/demand.js.map +1 -0
  142. package/drops.d.ts +93 -0
  143. package/drops.d.ts.map +1 -0
  144. package/drops.js +283 -0
  145. package/drops.js.map +1 -0
  146. package/error.d.ts +120 -21
  147. package/error.d.ts.map +1 -1
  148. package/error.js +230 -38
  149. package/error.js.map +1 -1
  150. package/errors.d.ts +2 -2
  151. package/errors.d.ts.map +1 -1
  152. package/errors.js +2 -3
  153. package/errors.js.map +1 -1
  154. package/fill.d.ts +174 -0
  155. package/fill.d.ts.map +1 -0
  156. package/fill.js +760 -0
  157. package/fill.js.map +1 -0
  158. package/flate/decoder.d.ts +2 -0
  159. package/flate/decoder.d.ts.map +1 -0
  160. package/flate/decoder.js +63 -0
  161. package/flate/decoder.js.map +1 -0
  162. package/flate/encoder.d.ts +2 -0
  163. package/flate/encoder.d.ts.map +1 -0
  164. package/flate/encoder.js +64 -0
  165. package/flate/encoder.js.map +1 -0
  166. package/flate/group.d.ts +34 -0
  167. package/flate/group.d.ts.map +1 -0
  168. package/flate/group.js +140 -0
  169. package/flate/group.js.map +1 -0
  170. package/frame.d.ts +80 -0
  171. package/frame.d.ts.map +1 -0
  172. package/frame.js +296 -0
  173. package/frame.js.map +1 -0
  174. package/frame.test-util.d.ts +5 -0
  175. package/frame.test-util.d.ts.map +1 -0
  176. package/frame.test-util.js +9 -0
  177. package/frame.test-util.js.map +1 -0
  178. package/group.d.ts +108 -45
  179. package/group.d.ts.map +1 -1
  180. package/group.js +1616 -308
  181. package/group.js.map +1 -1
  182. package/group_api.d.ts +7 -0
  183. package/group_api.d.ts.map +1 -0
  184. package/group_api.js +7 -0
  185. package/group_api.js.map +1 -0
  186. package/hop.d.ts +62 -76
  187. package/hop.d.ts.map +1 -1
  188. package/hop.js +92 -65
  189. package/hop.js.map +1 -1
  190. package/identity.d.ts +39 -0
  191. package/identity.d.ts.map +1 -0
  192. package/identity.js +47 -0
  193. package/identity.js.map +1 -0
  194. package/ietf/active_count.d.ts +2 -0
  195. package/ietf/active_count.d.ts.map +1 -0
  196. package/ietf/active_count.js +30 -0
  197. package/ietf/active_count.js.map +1 -0
  198. package/ietf/aliases.js +69 -36
  199. package/ietf/aliases.js.map +1 -1
  200. package/ietf/cluster.d.ts +3 -3
  201. package/ietf/cluster.js +14 -55
  202. package/ietf/cluster.js.map +1 -1
  203. package/ietf/connection.d.ts +1 -31
  204. package/ietf/connection.d.ts.map +1 -1
  205. package/ietf/connection.js +305 -144
  206. package/ietf/connection.js.map +1 -1
  207. package/ietf/datagram.d.ts +60 -0
  208. package/ietf/datagram.d.ts.map +1 -0
  209. package/ietf/datagram.js +152 -0
  210. package/ietf/datagram.js.map +1 -0
  211. package/ietf/error.d.ts +3 -3
  212. package/ietf/error.js +82 -101
  213. package/ietf/error.js.map +1 -1
  214. package/ietf/fetch.d.ts +93 -37
  215. package/ietf/fetch.d.ts.map +1 -1
  216. package/ietf/fetch.js +172 -94
  217. package/ietf/fetch.js.map +1 -1
  218. package/ietf/filter.d.ts +21 -31
  219. package/ietf/filter.d.ts.map +1 -1
  220. package/ietf/filter.js +140 -172
  221. package/ietf/filter.js.map +1 -1
  222. package/ietf/goaway.d.ts +12 -10
  223. package/ietf/goaway.d.ts.map +1 -1
  224. package/ietf/goaway.js +22 -36
  225. package/ietf/goaway.js.map +1 -1
  226. package/ietf/hidden.js +1 -2
  227. package/ietf/hidden.js.map +1 -1
  228. package/ietf/index.d.ts +8 -20
  229. package/ietf/index.d.ts.map +1 -1
  230. package/ietf/index.js +4 -15
  231. package/ietf/index.js.map +1 -1
  232. package/ietf/join.d.ts +7 -0
  233. package/ietf/join.d.ts.map +1 -0
  234. package/ietf/join.js +234 -0
  235. package/ietf/join.js.map +1 -0
  236. package/ietf/message.d.ts +18 -2
  237. package/ietf/message.d.ts.map +1 -1
  238. package/ietf/message.js +60 -41
  239. package/ietf/message.js.map +1 -1
  240. package/ietf/message.test-util.d.ts +6 -0
  241. package/ietf/message.test-util.d.ts.map +1 -0
  242. package/ietf/message.test-util.js +13 -0
  243. package/ietf/message.test-util.js.map +1 -0
  244. package/ietf/namespace.d.ts +19 -5
  245. package/ietf/namespace.d.ts.map +1 -1
  246. package/ietf/namespace.js +78 -27
  247. package/ietf/namespace.js.map +1 -1
  248. package/ietf/object.d.ts +195 -33
  249. package/ietf/object.d.ts.map +1 -1
  250. package/ietf/object.js +405 -179
  251. package/ietf/object.js.map +1 -1
  252. package/ietf/parameters.d.ts +25 -45
  253. package/ietf/parameters.d.ts.map +1 -1
  254. package/ietf/parameters.js +260 -473
  255. package/ietf/parameters.js.map +1 -1
  256. package/ietf/priority.d.ts +17 -2
  257. package/ietf/priority.d.ts.map +1 -1
  258. package/ietf/priority.js +19 -5
  259. package/ietf/priority.js.map +1 -1
  260. package/ietf/properties.d.ts +6 -5
  261. package/ietf/properties.d.ts.map +1 -1
  262. package/ietf/properties.js +78 -49
  263. package/ietf/properties.js.map +1 -1
  264. package/ietf/publish.d.ts +25 -33
  265. package/ietf/publish.d.ts.map +1 -1
  266. package/ietf/publish.js +45 -140
  267. package/ietf/publish.js.map +1 -1
  268. package/ietf/publish_namespace.d.ts +49 -72
  269. package/ietf/publish_namespace.d.ts.map +1 -1
  270. package/ietf/publish_namespace.js +66 -185
  271. package/ietf/publish_namespace.js.map +1 -1
  272. package/ietf/publisher.js +1800 -601
  273. package/ietf/publisher.js.map +1 -1
  274. package/ietf/range.d.ts +2 -0
  275. package/ietf/range.d.ts.map +1 -0
  276. package/ietf/range.js +222 -0
  277. package/ietf/range.js.map +1 -0
  278. package/ietf/request.d.ts +6 -30
  279. package/ietf/request.d.ts.map +1 -1
  280. package/ietf/request.js +41 -79
  281. package/ietf/request.js.map +1 -1
  282. package/ietf/request_stream.d.ts +1 -6
  283. package/ietf/request_stream.d.ts.map +1 -1
  284. package/ietf/request_stream.js +306 -17
  285. package/ietf/request_stream.js.map +1 -1
  286. package/ietf/session.d.ts +41 -0
  287. package/ietf/session.d.ts.map +1 -0
  288. package/ietf/session.js +65 -0
  289. package/ietf/session.js.map +1 -0
  290. package/ietf/setup.d.ts +5 -30
  291. package/ietf/setup.d.ts.map +1 -1
  292. package/ietf/setup.js +6 -118
  293. package/ietf/setup.js.map +1 -1
  294. package/ietf/setup_options.d.ts +31 -0
  295. package/ietf/setup_options.d.ts.map +1 -0
  296. package/ietf/setup_options.js +138 -0
  297. package/ietf/setup_options.js.map +1 -0
  298. package/ietf/solicit.js +4 -15
  299. package/ietf/solicit.js.map +1 -1
  300. package/ietf/subscribe.d.ts +52 -45
  301. package/ietf/subscribe.d.ts.map +1 -1
  302. package/ietf/subscribe.js +118 -240
  303. package/ietf/subscribe.js.map +1 -1
  304. package/ietf/subscribe_namespace.d.ts +16 -79
  305. package/ietf/subscribe_namespace.d.ts.map +1 -1
  306. package/ietf/subscribe_namespace.js +30 -202
  307. package/ietf/subscribe_namespace.js.map +1 -1
  308. package/ietf/subscriber.js +1839 -537
  309. package/ietf/subscriber.js.map +1 -1
  310. package/ietf/token.js +105 -28
  311. package/ietf/token.js.map +1 -1
  312. package/ietf/track.d.ts +27 -24
  313. package/ietf/track.d.ts.map +1 -1
  314. package/ietf/track.js +48 -62
  315. package/ietf/track.js.map +1 -1
  316. package/ietf/version.d.ts +13 -42
  317. package/ietf/version.d.ts.map +1 -1
  318. package/ietf/version.js +22 -49
  319. package/ietf/version.js.map +1 -1
  320. package/implementation.d.ts +2 -0
  321. package/implementation.d.ts.map +1 -0
  322. package/implementation.js +5 -0
  323. package/implementation.js.map +1 -0
  324. package/index.d.ts +34 -19
  325. package/index.d.ts.map +1 -1
  326. package/index.js +19 -7
  327. package/index.js.map +1 -1
  328. package/internal.d.ts +1515 -67
  329. package/internal.d.ts.map +1 -1
  330. package/internal.js +557 -80
  331. package/internal.js.map +1 -1
  332. package/ledger.d.ts +23 -0
  333. package/ledger.d.ts.map +1 -0
  334. package/ledger.js +247 -0
  335. package/ledger.js.map +1 -0
  336. package/listing.d.ts +132 -0
  337. package/listing.d.ts.map +1 -0
  338. package/listing.js +486 -0
  339. package/listing.js.map +1 -0
  340. package/lite/announce.d.ts +127 -66
  341. package/lite/announce.d.ts.map +1 -1
  342. package/lite/announce.js +384 -159
  343. package/lite/announce.js.map +1 -1
  344. package/lite/announce_stream.d.ts +2 -0
  345. package/lite/announce_stream.d.ts.map +1 -0
  346. package/lite/announce_stream.js +92 -0
  347. package/lite/announce_stream.js.map +1 -0
  348. package/lite/answer.d.ts +22 -0
  349. package/lite/answer.d.ts.map +1 -0
  350. package/lite/answer.js +301 -0
  351. package/lite/answer.js.map +1 -0
  352. package/lite/auth.d.ts +45 -0
  353. package/lite/auth.d.ts.map +1 -0
  354. package/lite/auth.js +204 -0
  355. package/lite/auth.js.map +1 -0
  356. package/lite/compat.d.ts +31 -0
  357. package/lite/compat.d.ts.map +1 -0
  358. package/lite/compat.js +86 -0
  359. package/lite/compat.js.map +1 -0
  360. package/lite/connection.d.ts +1 -45
  361. package/lite/connection.d.ts.map +1 -1
  362. package/lite/connection.js +360 -78
  363. package/lite/connection.js.map +1 -1
  364. package/lite/datagram-end.d.ts +26 -0
  365. package/lite/datagram-end.d.ts.map +1 -0
  366. package/lite/datagram-end.js +30 -0
  367. package/lite/datagram-end.js.map +1 -0
  368. package/lite/datagram.d.ts +73 -8
  369. package/lite/datagram.d.ts.map +1 -1
  370. package/lite/datagram.js +144 -10
  371. package/lite/datagram.js.map +1 -1
  372. package/lite/duration.d.ts +6 -0
  373. package/lite/duration.d.ts.map +1 -0
  374. package/lite/duration.js +14 -0
  375. package/lite/duration.js.map +1 -0
  376. package/lite/error.d.ts +9 -0
  377. package/lite/error.d.ts.map +1 -0
  378. package/lite/error.js +24 -0
  379. package/lite/error.js.map +1 -0
  380. package/lite/fills.d.ts +162 -0
  381. package/lite/fills.d.ts.map +1 -0
  382. package/lite/fills.js +486 -0
  383. package/lite/fills.js.map +1 -0
  384. package/lite/fit.d.ts +49 -0
  385. package/lite/fit.d.ts.map +1 -0
  386. package/lite/fit.js +305 -0
  387. package/lite/fit.js.map +1 -0
  388. package/lite/goaway.d.ts +2 -2
  389. package/lite/goaway.d.ts.map +1 -1
  390. package/lite/goaway.js +5 -14
  391. package/lite/goaway.js.map +1 -1
  392. package/lite/group.d.ts +67 -16
  393. package/lite/group.d.ts.map +1 -1
  394. package/lite/group.js +108 -31
  395. package/lite/group.js.map +1 -1
  396. package/lite/identity.d.ts +25 -0
  397. package/lite/identity.d.ts.map +1 -0
  398. package/lite/identity.js +79 -0
  399. package/lite/identity.js.map +1 -0
  400. package/lite/index.d.ts +14 -13
  401. package/lite/index.d.ts.map +1 -1
  402. package/lite/index.js +2 -2
  403. package/lite/index.js.map +1 -1
  404. package/lite/message.d.ts +10 -2
  405. package/lite/message.d.ts.map +1 -1
  406. package/lite/message.js +28 -45
  407. package/lite/message.js.map +1 -1
  408. package/lite/priority.d.ts +9 -2
  409. package/lite/priority.d.ts.map +1 -1
  410. package/lite/priority.js +11 -106
  411. package/lite/priority.js.map +1 -1
  412. package/lite/probe.d.ts +2 -2
  413. package/lite/probe.d.ts.map +1 -1
  414. package/lite/probe.js +9 -1
  415. package/lite/probe.js.map +1 -1
  416. package/lite/publisher.d.ts +10 -1
  417. package/lite/publisher.d.ts.map +1 -1
  418. package/lite/publisher.js +2548 -438
  419. package/lite/publisher.js.map +1 -1
  420. package/lite/routed.d.ts +59 -0
  421. package/lite/routed.d.ts.map +1 -0
  422. package/lite/routed.js +564 -0
  423. package/lite/routed.js.map +1 -0
  424. package/lite/session.d.ts +2 -28
  425. package/lite/session.d.ts.map +1 -1
  426. package/lite/session.js +0 -100
  427. package/lite/session.js.map +1 -1
  428. package/lite/setup.d.ts +32 -5
  429. package/lite/setup.d.ts.map +1 -1
  430. package/lite/setup.js +95 -22
  431. package/lite/setup.js.map +1 -1
  432. package/lite/stream.d.ts +5 -11
  433. package/lite/stream.d.ts.map +1 -1
  434. package/lite/stream.js +5 -2
  435. package/lite/stream.js.map +1 -1
  436. package/lite/subscribe.d.ts +478 -78
  437. package/lite/subscribe.d.ts.map +1 -1
  438. package/lite/subscribe.js +1373 -143
  439. package/lite/subscribe.js.map +1 -1
  440. package/lite/subscriber.d.ts +7 -44
  441. package/lite/subscriber.d.ts.map +1 -1
  442. package/lite/subscriber.js +3290 -516
  443. package/lite/subscriber.js.map +1 -1
  444. package/lite/track.d.ts +27 -12
  445. package/lite/track.d.ts.map +1 -1
  446. package/lite/track.js +116 -38
  447. package/lite/track.js.map +1 -1
  448. package/lite/tracks.d.ts +55 -0
  449. package/lite/tracks.d.ts.map +1 -0
  450. package/lite/tracks.js +114 -0
  451. package/lite/tracks.js.map +1 -0
  452. package/lite/version.d.ts +132 -24
  453. package/lite/version.d.ts.map +1 -1
  454. package/lite/version.js +378 -34
  455. package/lite/version.js.map +1 -1
  456. package/meta.d.ts +77 -0
  457. package/meta.d.ts.map +1 -0
  458. package/meta.js +130 -0
  459. package/meta.js.map +1 -0
  460. package/meta_api.d.ts +7 -0
  461. package/meta_api.d.ts.map +1 -0
  462. package/meta_api.js +7 -0
  463. package/meta_api.js.map +1 -0
  464. package/mint.d.ts +28 -0
  465. package/mint.d.ts.map +1 -0
  466. package/mint.js +66 -0
  467. package/mint.js.map +1 -0
  468. package/open.d.ts +63 -0
  469. package/open.d.ts.map +1 -0
  470. package/open.js +250 -0
  471. package/open.js.map +1 -0
  472. package/origin.d.ts +394 -142
  473. package/origin.d.ts.map +1 -1
  474. package/origin.js +2533 -687
  475. package/origin.js.map +1 -1
  476. package/package.json +8 -13
  477. package/path.d.ts +51 -51
  478. package/path.d.ts.map +1 -1
  479. package/path.js +210 -58
  480. package/path.js.map +1 -1
  481. package/payload.d.ts +33 -0
  482. package/payload.d.ts.map +1 -0
  483. package/payload.js +65 -0
  484. package/payload.js.map +1 -0
  485. package/prefix.d.ts +152 -0
  486. package/prefix.d.ts.map +1 -0
  487. package/prefix.js +349 -0
  488. package/prefix.js.map +1 -0
  489. package/priority.d.ts +8 -0
  490. package/priority.d.ts.map +1 -0
  491. package/priority.js +185 -0
  492. package/priority.js.map +1 -0
  493. package/queue.d.ts +2 -0
  494. package/queue.d.ts.map +1 -0
  495. package/queue.js +46 -0
  496. package/queue.js.map +1 -0
  497. package/ranges.d.ts +36 -0
  498. package/ranges.d.ts.map +1 -0
  499. package/ranges.js +312 -0
  500. package/ranges.js.map +1 -0
  501. package/rescale.d.ts +24 -0
  502. package/rescale.d.ts.map +1 -0
  503. package/rescale.js +39 -0
  504. package/rescale.js.map +1 -0
  505. package/resume.d.ts +55 -0
  506. package/resume.d.ts.map +1 -0
  507. package/resume.js +4173 -0
  508. package/resume.js.map +1 -0
  509. package/resume.test-util.d.ts +2 -0
  510. package/resume.test-util.d.ts.map +1 -0
  511. package/resume.test-util.js +25 -0
  512. package/resume.test-util.js.map +1 -0
  513. package/skips.d.ts +48 -0
  514. package/skips.d.ts.map +1 -0
  515. package/skips.js +182 -0
  516. package/skips.js.map +1 -0
  517. package/stream.d.ts +78 -40
  518. package/stream.d.ts.map +1 -1
  519. package/stream.js +236 -93
  520. package/stream.js.map +1 -1
  521. package/subscription.test-util.d.ts +2 -0
  522. package/subscription.test-util.d.ts.map +1 -0
  523. package/subscription.test-util.js +49 -0
  524. package/subscription.test-util.js.map +1 -0
  525. package/tail.d.ts +23 -14
  526. package/tail.d.ts.map +1 -1
  527. package/tail.js +224 -98
  528. package/tail.js.map +1 -1
  529. package/time.d.ts +41 -102
  530. package/time.d.ts.map +1 -1
  531. package/time.js +129 -92
  532. package/time.js.map +1 -1
  533. package/timed.d.ts +21 -0
  534. package/timed.d.ts.map +1 -0
  535. package/timed.js +2 -0
  536. package/timed.js.map +1 -0
  537. package/track.d.ts +578 -246
  538. package/track.d.ts.map +1 -1
  539. package/track.js +7306 -772
  540. package/track.js.map +1 -1
  541. package/track_api.d.ts +7 -0
  542. package/track_api.d.ts.map +1 -0
  543. package/track_api.js +7 -0
  544. package/track_api.js.map +1 -0
  545. package/util/abort.d.ts +1 -0
  546. package/util/abort.d.ts.map +1 -1
  547. package/util/abort.js +23 -2
  548. package/util/abort.js.map +1 -1
  549. package/util/announce.d.ts +4 -0
  550. package/util/announce.d.ts.map +1 -0
  551. package/util/announce.js +11 -0
  552. package/util/announce.js.map +1 -0
  553. package/util/bigint.d.ts +3 -0
  554. package/util/bigint.d.ts.map +1 -0
  555. package/util/bigint.js +8 -0
  556. package/util/bigint.js.map +1 -0
  557. package/util/change.d.ts +12 -0
  558. package/util/change.d.ts.map +1 -0
  559. package/util/change.js +18 -0
  560. package/util/change.js.map +1 -0
  561. package/util/deadline.d.ts +2 -0
  562. package/util/deadline.d.ts.map +1 -0
  563. package/util/deadline.js +108 -0
  564. package/util/deadline.js.map +1 -0
  565. package/util/decode_error.d.ts +3 -0
  566. package/util/decode_error.d.ts.map +1 -0
  567. package/util/decode_error.js +11 -0
  568. package/util/decode_error.js.map +1 -0
  569. package/util/demand.d.ts +8 -0
  570. package/util/demand.d.ts.map +1 -0
  571. package/util/demand.js +24 -0
  572. package/util/demand.js.map +1 -0
  573. package/util/given_up.d.ts +2 -0
  574. package/util/given_up.d.ts.map +1 -0
  575. package/util/given_up.js +101 -0
  576. package/util/given_up.js.map +1 -0
  577. package/util/hex.d.ts +6 -0
  578. package/util/hex.d.ts.map +1 -1
  579. package/util/hex.js +19 -5
  580. package/util/hex.js.map +1 -1
  581. package/util/key.d.ts +15 -0
  582. package/util/key.d.ts.map +1 -0
  583. package/util/key.js +38 -0
  584. package/util/key.js.map +1 -0
  585. package/util/limits.d.ts +2 -0
  586. package/util/limits.d.ts.map +1 -0
  587. package/util/limits.js +76 -0
  588. package/util/limits.js.map +1 -0
  589. package/util/observed.d.ts +23 -0
  590. package/util/observed.d.ts.map +1 -0
  591. package/util/observed.js +122 -0
  592. package/util/observed.js.map +1 -0
  593. package/util/sorted.d.ts +2 -0
  594. package/util/sorted.d.ts.map +1 -0
  595. package/util/sorted.js +149 -0
  596. package/util/sorted.js.map +1 -0
  597. package/util/timeout.d.ts +2 -1
  598. package/util/timeout.d.ts.map +1 -1
  599. package/util/timeout.js +13 -10
  600. package/util/timeout.js.map +1 -1
  601. package/util/timer.d.ts +2 -0
  602. package/util/timer.d.ts.map +1 -0
  603. package/util/timer.js +19 -0
  604. package/util/timer.js.map +1 -0
  605. package/util/u64.js +0 -1
  606. package/util/utf8.d.ts +2 -0
  607. package/util/utf8.d.ts.map +1 -1
  608. package/util/utf8.js +7 -2
  609. package/util/utf8.js.map +1 -1
  610. package/util/varint.d.ts.map +1 -1
  611. package/util/varint.js +8 -2
  612. package/util/varint.js.map +1 -1
  613. package/util/watch.d.ts +8 -0
  614. package/util/watch.d.ts.map +1 -0
  615. package/util/watch.js +38 -0
  616. package/util/watch.js.map +1 -0
  617. package/util/yield.d.ts +2 -0
  618. package/util/yield.d.ts.map +1 -0
  619. package/util/yield.js +31 -0
  620. package/util/yield.js.map +1 -0
  621. package/varint.d.ts +0 -29
  622. package/varint.d.ts.map +1 -1
  623. package/varint.js +7 -29
  624. package/varint.js.map +1 -1
  625. package/varint_api.d.ts +7 -0
  626. package/varint_api.d.ts.map +1 -0
  627. package/varint_api.js +7 -0
  628. package/varint_api.js.map +1 -0
  629. package/version.d.ts +2 -0
  630. package/version.d.ts.map +1 -0
  631. package/version.js +4 -0
  632. package/version.js.map +1 -0
  633. package/window.d.ts +570 -0
  634. package/window.d.ts.map +1 -0
  635. package/window.js +1677 -0
  636. package/window.js.map +1 -0
  637. package/wire.d.ts +150 -35
  638. package/wire.d.ts.map +1 -1
  639. package/wire.js +27 -1
  640. package/wire.js.map +1 -1
  641. package/connection/established.d.ts +0 -53
  642. package/connection/established.d.ts.map +0 -1
  643. package/connection/established.js +0 -3
  644. package/connection/established.js.map +0 -1
  645. package/ietf/adapter.d.ts +0 -75
  646. package/ietf/adapter.d.ts.map +0 -1
  647. package/ietf/adapter.js +0 -700
  648. package/ietf/adapter.js.map +0 -1
  649. package/lite/datagram_stream.d.ts +0 -8
  650. package/lite/datagram_stream.d.ts.map +0 -1
  651. package/lite/datagram_stream.js +0 -44
  652. package/lite/datagram_stream.js.map +0 -1
  653. package/lite/fetch.d.ts +0 -28
  654. package/lite/fetch.d.ts.map +0 -1
  655. package/lite/fetch.js +0 -79
  656. package/lite/fetch.js.map +0 -1
  657. package/util/log.d.ts +0 -5
  658. package/util/log.d.ts.map +0 -1
  659. package/util/log.js +0 -17
  660. package/util/log.js.map +0 -1
  661. package/zod.d.ts +0 -13
  662. package/zod.d.ts.map +0 -1
  663. package/zod.js +0 -19
  664. package/zod.js.map +0 -1
package/internal.d.ts CHANGED
@@ -1,28 +1,47 @@
1
1
  /**
2
2
  * Package-internal constructor hooks. Classes keep their constructors private so consumers
3
- * can't mint detached handles; sibling modules create instances through these hooks instead.
3
+ * can't mint detached handles; sibling modules create identities through these hooks instead.
4
4
  * Not exported from the package entrypoint.
5
5
  *
6
6
  * @module
7
7
  */
8
- import type { Dispose, Getter } from "@moq/signals";
9
- import type { Consumer as BroadcastConsumer, Producer as BroadcastProducer } from "./broadcast";
10
- import type { Frame, Consumer as GroupConsumer } from "./group";
11
- import type { Route } from "./hop";
12
- import * as Path from "./path";
13
- import type { Timestamp } from "./time";
14
- import type { Groups, Producer, Request, Subscriber } from "./track";
15
- import type { Advertised, Advertisements } from "./wire";
8
+ import { Duration, type Instant } from "@moq/clock";
9
+ import type { Dispose, GetPromise, Getter } from "@moq/signals";
10
+ import type { Consumer as BroadcastConsumer, Producer as BroadcastProducer } from "./broadcast.ts";
11
+ import type { Charge, Pool } from "./cache.ts";
12
+ import type * as datagram from "./datagram.ts";
13
+ import type { Delivered, Judged } from "./delivered.ts";
14
+ import type { Edit, Prefs, Subscriptions } from "./demand.ts";
15
+ import type { Consumer as FrameConsumer, Producer as FrameProducer } from "./frame.ts";
16
+ import type { Frame, Consumer as GroupConsumer, Producer as GroupProducer } from "./group.ts";
17
+ import { type WireRoute } from "./hop.ts";
18
+ import * as Identity from "./identity.ts";
19
+ import * as Path from "./path.ts";
20
+ import type { Timescale, Timestamp } from "./time.ts";
21
+ import type { Demand, Groups, Info, InfoInit, Position, Producer, Request, Subscriber, Subscription, WireRecord } from "./track.ts";
22
+ import type { Budget, Holdings, Resolved, Window } from "./window.ts";
23
+ import type { Advertised, Advertisements } from "./wire.ts";
24
+ /** A null {@link Live.max} in milliseconds, which the model holds as the largest value every peer can read. */
25
+ export declare const NO_MAX_DELAY: number;
26
+ /** A datagram track's properties as the stream track info a wire answers with: no groups, so no age, refresh, or compression. */
27
+ export declare function datagramTrackInfo(info: datagram.Info): Info;
28
+ /**
29
+ * What asks a track for a new group, mirroring the Rust `track::Ask`: a reader joining at the
30
+ * live edge (judged by the ratio), a {@link Subscriber.refresh} or a peer's Wanted Start past
31
+ * the largest, or a reader of the newest group reaching a frame its copy shed.
32
+ */
33
+ export type Ask = "join" | "refresh" | "shed";
34
+ /**
35
+ * `value` rounded up to a whole millisecond, as the wire carries it: callers derive one from
36
+ * measurements (a jitter estimate scaled off RTT), and a budget shortened by rounding skips a group
37
+ * the subscriber still wants. Refused past the safe integer range, naming `field`.
38
+ */
39
+ export declare function wireMillis(field: string, value: Duration): Duration;
16
40
  /** Normalize public group bounds into an inclusive start and exclusive end. */
17
41
  export declare function groupBounds(groups?: Groups): {
18
- start: number;
19
- end?: number;
42
+ start: bigint;
43
+ end?: bigint;
20
44
  };
21
- /**
22
- * The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.
23
- * The peer echoes every suffix beneath it, and the caller filters what arrives.
24
- */
25
- export declare function scopeHead(scope: Path.Pattern): Path.Valid;
26
45
  /**
27
46
  * Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce
28
47
  * discovery unless the request opts in. A path at or above the prefix never hides.
@@ -31,13 +50,201 @@ export declare function hiddenBelow(prefix: Path.Valid, path: Path.Valid): boole
31
50
  /**
32
51
  * Where each carried route lands under the requested prefix: its suffix beneath the
33
52
  * prefix, or the empty suffix for a route above it, where the most specific such route
34
- * wins the way a request through the prefix would resolve.
53
+ * wins the way a request through the prefix would resolve. Only a candidate `shows` admits
54
+ * at the path it lands on competes.
55
+ */
56
+ export declare function presented(prefix: Path.Valid, table: Advertisements, carries: (covered: Path.Valid) => boolean, options?: {
57
+ root?: Path.Valid;
58
+ keepAbove?: boolean;
59
+ shows?: (candidate: Advertised, at: Path.Valid) => boolean;
60
+ }): Map<Path.Valid, Advertised>;
61
+ /**
62
+ * A candidate filed at `prefix`, `depth` segments deep, `order`th in its prefix's preference, and
63
+ * {@link arrival} `arrival`th.
64
+ */
65
+ export interface Filed<T> {
66
+ readonly prefix: Path.Valid;
67
+ readonly depth: number;
68
+ readonly order: number;
69
+ readonly arrival: number;
70
+ readonly candidate: T;
71
+ readonly route: WireRoute;
72
+ }
73
+ /** Records `ref` as received now, as each announce of a claim is: it ranks as the newest. */
74
+ export declare function receive(ref: object): void;
75
+ /**
76
+ * The order `ref` was last {@link receive}d in, stamped now if it never was: a later one is
77
+ * larger, so a full tie across filings goes to the most recently received claim, as Rust's newest
78
+ * route entry. An update keeps its ref's place.
79
+ */
80
+ export declare function arrival(ref: object): number;
81
+ /**
82
+ * The best of the most specific claims among `filed`, which all cover `path`: a claim shown above
83
+ * its own prefix counts for the shallower prefix it is really at, and claims of one prefix rank
84
+ * against each other wherever each is filed. Only an identity's highest epoch among them (and
85
+ * `others`, of the same claim when `exact`) is eligible; one that `serves` `path` ranks ahead, then
86
+ * {@link compareTier}, then {@link compareTie}. Mirrors `RouteTable::best_route` in rs/moq-net,
87
+ * and with `serves`, `TableCursor::best`.
88
+ */
89
+ export declare function bestOfTier<T>(path: Path.Valid, filed: readonly Filed<T>[], options?: {
90
+ others?: (specificity: number) => readonly WireRoute[];
91
+ serves?: (entry: Filed<T>) => boolean;
92
+ }): Filed<T> | undefined;
93
+ /**
94
+ * How a full tie between two claims of one tier resolving `path` breaks: to the newest, by each
95
+ * prefix's own order and across prefixes the most recently {@link arrival}, as Rust's final
96
+ * `Reverse(entry.id)`, so a publisher that restarts under a new identity takes over at once. Filed
97
+ * beneath `path` where neither is a lite-07 claim, it goes to the oldest instead, as Rust's
98
+ * `RouteEntry::since`: switching there would restart the route at every relay downstream that
99
+ * ranks it alike. Rust also renews `since` when a re-price changes the rank; this origin forwards
100
+ * no route it received, so a route that dips and recovers here restarts only its own readers.
101
+ * Then the deeper filing.
102
+ */
103
+ export declare function compareTie(path: Path.Valid, a: Pick<Filed<unknown>, "prefix" | "depth" | "order" | "arrival" | "route">, b: Pick<Filed<unknown>, "prefix" | "depth" | "order" | "arrival" | "route">): number;
104
+ /**
105
+ * The first of `candidates`, most preferred first, that `admits` and that no other admitted
106
+ * candidate supersedes. Supersession is decided among what the reader may see, so a higher epoch
107
+ * it cannot see never hides a route it can.
108
+ */
109
+ export declare function firstEligible<T extends {
110
+ readonly route: WireRoute;
111
+ }>(candidates: readonly T[], admits?: (candidate: T) => boolean): T | undefined;
112
+ /**
113
+ * What of `path`'s subtree every one of `scopes` serves: undefined when all of it, and otherwise
114
+ * the prefixes beneath `path` that all of them share, possibly none. Asked about a path rather
115
+ * than a {@link Path.Prefix}, so a path no prefix can spell still gets an answer.
116
+ */
117
+ export declare function within(path: Path.Valid, scopes: Iterable<Path.Prefixes | undefined>): Path.Prefixes | undefined;
118
+ /** A half-open run of group keys, `[start, end)`. */
119
+ /**
120
+ * What a fold of a reader's handed-out record judges by: the reader's budget, and the groups its
121
+ * ranges hold, undefined while a range is still being placed. A gap no range holds was never
122
+ * judged, so a range added later owes it again (see `Delivered.foldBelow`). Mirrors the Rust
123
+ * `track::FoldTerms`.
124
+ */
125
+ export interface FoldTerms {
126
+ budget: Budget;
127
+ ranges: Judged | undefined;
128
+ }
129
+ export interface Run {
130
+ start: bigint;
131
+ end: bigint;
132
+ }
133
+ /** Add `[start, end)` to sorted, disjoint, non-adjacent `runs`, merging every run it touches. */
134
+ export declare function insertRun(runs: Run[], start: bigint, end: bigint): void;
135
+ /** The sorted, disjoint `runs` with `[start, end)` taken out, each part keeping its run's fields. */
136
+ export declare function removeRun<R extends Run>(runs: readonly R[], start: bigint, end: bigint): R[];
137
+ /** Take `[start, end)` out of sorted, disjoint `runs` in place, each part keeping its run's fields. */
138
+ export declare function cutRun<R extends Run>(runs: R[], start: bigint, end: bigint): void;
139
+ /**
140
+ * Why a group key will not be delivered. Mirrors the Rust `track::Hole`.
141
+ *
142
+ * - `skip`: never produced, as the publisher declared: permanent, and it ends no reader.
143
+ * - `drop`: absent, not found: not permanent, so a later fill or failover may still find it.
144
+ * - `old`: judged stale under `maxAge`, so only a reader no wider settles on it.
145
+ *
146
+ * A track stores no other reason: a group's own failure is the copy's, never the track's.
147
+ */
148
+ export interface Hole {
149
+ /** Which verdict it is. */
150
+ reason: "skip" | "drop" | "old";
151
+ /**
152
+ * For `old`: the budget in milliseconds the staleness verdict was judged under. Only a widening
153
+ * past it reverses the verdict. Undefined for an `old` a publisher reached without a budget of
154
+ * its own, such as a group that landed below where its reader had read, which the publisher
155
+ * names under the narrowest budget its live ranges ask.
156
+ */
157
+ maxAge?: number;
158
+ /**
159
+ * For `old`: the exclusive group end the upstream subscription judged the verdict within,
160
+ * undefined when it followed the live edge or its end is not known to be the one it judged under.
161
+ * A reader capped at the same end reads the groups the verdict rests on, so it settles on it.
162
+ */
163
+ cap?: bigint;
164
+ }
165
+ /** A key never produced; see {@link Hole}. */
166
+ export declare function skipHole(): Hole;
167
+ /** A key not found, which a later fill or failover may still find; see {@link Hole}. */
168
+ export declare function dropHole(): Hole;
169
+ /** A group judged stale under `budget` milliseconds, within the exclusive group end `cap` when it has one. */
170
+ export declare function staleHole(budget: number, cap?: bigint): Hole;
171
+ /**
172
+ * The verdict a reader's own refusal or failure with `error` reaches: `old` for a superseded
173
+ * group, `skip` for one never produced, else not found. Mirrors the Rust `Hole::missed`.
174
+ */
175
+ export declare function holeOf(error: Error): Hole;
176
+ /** The error a reader waiting on a key given up as `hole` ends with: a key never produced is simply not found. */
177
+ export declare function holeError(hole: Hole): Error;
178
+ /** The groups a reader reads, and the exclusive end it stops at; undefined before its ranges resolve. */
179
+ export type Coverage = {
180
+ runs: readonly Run[];
181
+ cap?: bigint;
182
+ } | undefined;
183
+ /**
184
+ * Whether `run` settles a reader judging under `budget` with `coverage`. Any run but a received
185
+ * stale one does. A stale verdict holds for a reader no wider than the budget it was judged under
186
+ * that reads every group above the run's start: its own successor and edge are then no older than
187
+ * those the verdict was judged against, since a group's verdict looks only above it. An uncapped
188
+ * reader reads them past the live edge; a capped one only when the upstream judged within the very
189
+ * cap it has (`run.cap`), else the verdict may rest on groups above the cap it never sees. A reader
190
+ * whose budget varies by group is held to its widest. Mirrors the Rust `settles`.
35
191
  */
36
- export declare function presented(prefix: Path.Valid, table: Advertisements, carries: (covered: Path.Valid) => boolean): Map<Path.Valid, Advertised>;
37
- /** Whether the announced prefix's subtree overlaps `scope`. */
38
- export declare function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean;
39
- /** What `scope` captures from an exact announced prefix, if it pins every wildcard. */
40
- export declare function scopeCaptures(scope: Path.Pattern, prefix: Path.Valid): Path.Pattern[] | undefined;
192
+ export declare function settles(run: Run & Hole, budget: Budget, coverage: Coverage): boolean;
193
+ /** A run of keys given up, with why. */
194
+ export interface DropRun extends Run, Hole {
195
+ /** Copied into a cursor from the track's runs, which it folds in afresh on each change. */
196
+ received?: boolean;
197
+ /** The reader's own fill refused it: a verdict for it whatever it reads, until it widens. */
198
+ own?: boolean;
199
+ /** The fill's original error, which its fetch caller reads. */
200
+ refusal?: Error;
201
+ }
202
+ /** A group a subscriber holds unread, and whether it is whole from the frame asked. */
203
+ export interface Held {
204
+ key: bigint;
205
+ servable: boolean;
206
+ }
207
+ /** What a publisher knows of where its delivery can start; see `hooks.deliveryStart`. */
208
+ export interface Opening {
209
+ /** The first group going out. */
210
+ first: bigint;
211
+ /** Where the source's feed starts, if it names one. */
212
+ source: bigint | undefined;
213
+ /** The runs given up before delivery started, which it can't start in. */
214
+ givenUp: {
215
+ at(key: bigint): Run | undefined;
216
+ };
217
+ }
218
+ /** Whether two runs say the same thing, so they may merge. */
219
+ export declare function sameHole(a: DropRun, b: DropRun): boolean;
220
+ /**
221
+ * Sorted, disjoint `drops` with `[start, end)` given up as `hole` says, which replaces whatever
222
+ * it overlaps. Neighbours given up alike merge, so a wide DROP stays one run and a peer naming
223
+ * one key per DROP cannot grow the runs.
224
+ */
225
+ export declare function insertDrop(drops: readonly DropRun[], start: bigint, end: bigint, hole: Omit<DropRun, keyof Run>): DropRun[];
226
+ /**
227
+ * The parts of sorted, disjoint `runs` that sorted, disjoint `cut` leaves, each keeping its run's
228
+ * fields, as {@link removeRun} of each cut would, in one pass.
229
+ */
230
+ export declare function subtractRuns<R extends Run>(runs: readonly R[], cut: readonly Run[]): R[];
231
+ /**
232
+ * `drops` with each of the sorted, disjoint `runs` inserted as {@link insertDrop} inserts it, in
233
+ * one pass: folding in a span of many runs costs the runs, not their square.
234
+ */
235
+ export declare function insertDrops(drops: readonly DropRun[], runs: readonly DropRun[]): DropRun[];
236
+ /** The run of `drops` giving `key` up, if any. */
237
+ export declare function dropAt(drops: readonly DropRun[], key: bigint): DropRun | undefined;
238
+ /** The index of the first of sorted, disjoint `runs` ending past `key`. */
239
+ export declare function runsFrom(runs: readonly Run[], key: bigint): number;
240
+ /** The parts of `[start, end)` that sorted, disjoint `runs` do not cover, in order. */
241
+ export declare function runGaps(runs: readonly Run[], start: bigint, end: bigint): Run[];
242
+ /**
243
+ * What a group read reports as a `drop` before the group: nothing, everything its cursor gives up,
244
+ * or `"budget"`, only what its budget skips, still handing out a failed group so a front's read
245
+ * continues it through its recovery, as a front reads its serving copy.
246
+ */
247
+ export type Dispositions = boolean | "budget";
41
248
  /**
42
249
  * What a non-blocking group read found, which is everything the caller needs to decide what
43
250
  * to do next: no second look at the track's closed state, and no ordering rule to get wrong.
@@ -48,6 +255,18 @@ export type Recv =
48
255
  kind: "group";
49
256
  group: GroupConsumer;
50
257
  }
258
+ /**
259
+ * Keys `[start, end)` this cursor gave up without serving, and why. `failed` when the copy of
260
+ * the group this cursor held failed: the copy's word, which another route or fill may still
261
+ * answer, not a verdict the track recorded.
262
+ */
263
+ | ({
264
+ kind: "drop";
265
+ start: bigint;
266
+ end: bigint;
267
+ failed?: boolean;
268
+ refusal?: Error;
269
+ } & Hole)
51
270
  /** Nothing readable, but the track is live and may produce more. */
52
271
  | {
53
272
  kind: "idle";
@@ -60,84 +279,1313 @@ export type Recv =
60
279
  | {
61
280
  kind: "done";
62
281
  }
63
- /** The track aborted. */
282
+ /**
283
+ * The read failed: the track aborted, or, `refused`, the reader's ranges can't be served until
284
+ * they change, which a front's copy reports so the front does not take it for the track's end.
285
+ * Mirrors the Rust `track::Failure`.
286
+ */
64
287
  | {
65
288
  kind: "error";
66
289
  error: Error;
290
+ refused?: true;
67
291
  };
68
- /** A package-internal frame read the wire publisher completes once written. */
292
+ /** A package-internal frame read as the group stores it. */
69
293
  export interface ReadGroupFrame {
70
- /** Frame sequence within the group. */
71
- sequence: number;
72
- /** Frame returned to the publisher. */
294
+ /** The frame's index within the group. */
295
+ index: number;
296
+ /** The frame, holding its DEFLATE slice on a compressed read. */
73
297
  frame: Frame;
74
- /** Mark the frame delivered or deliberately skipped by the wire publisher. */
75
- complete(): void;
298
+ /** The declared plain size: a stored slice's on compressed reads, and a metadata copy's on every read. */
299
+ inflated?: number;
300
+ /** The payload to stream instead of `frame.payload`, for a frame written in pieces. */
301
+ chunks?: FrameConsumer;
302
+ }
303
+ /**
304
+ * The groups a group moved onto another copy is judged within: its logical reader's window below
305
+ * that reader's cursor cap. Not the copy's own, which a route switch starts at its boundary.
306
+ */
307
+ export interface Within {
308
+ contains: (key: bigint) => boolean;
309
+ end: () => bigint | undefined;
310
+ /** Where the reader's window runs past every group from (see `Window.openFrom`). */
311
+ openFrom: () => bigint | undefined;
312
+ /** How long each group stays worth delivering, as the logical reader's own ranges set it. */
313
+ budget: () => Budget;
314
+ /** What can change either. */
315
+ changed: readonly Getter<unknown>[];
316
+ }
317
+ /** What a resumed reader's {@link ResumeSource} sees of the subscriber it serves. */
318
+ export interface ResumeShell {
319
+ /** The reader's own preferences, mirrored into every copy it subscribes. */
320
+ readonly subscription: Getter<Subscription | undefined>;
321
+ /**
322
+ * The join tick each of the reader's ranges was added at, in order, 0 for one that doesn't join
323
+ * live: each copy it asks takes an answer recorded since (see `hooks.stampSubscriber`).
324
+ */
325
+ since(): readonly number[];
326
+ /**
327
+ * Whether the reader's ranges last changed by a retune alone, each live join kept where it joined
328
+ * under another max: each copy then retunes its own in place, and otherwise is asked whole,
329
+ * restated. Mirrors the Rust `Change::Edit` against `Change::All`.
330
+ */
331
+ retuned(): boolean;
332
+ /** The reader's group cursor: an inclusive start and an exclusive end. */
333
+ readonly cursor: Getter<{
334
+ start: bigint;
335
+ end?: bigint;
336
+ }>;
337
+ /** Settles once the logical track ends. */
338
+ readonly closed: GetPromise<Error | null>;
339
+ /** The properties the first copy committed, if any yet. */
340
+ info(): Info | undefined;
341
+ /** Commit the logical track's properties, once. */
342
+ commit(info: Info): void;
343
+ /** End the logical track: cleanly, or with `abort`. */
344
+ close(abort?: Error): void;
76
345
  }
77
- /** The next group or datagram sequence shared by dynamic producers of one broadcast track. */
78
- export interface TrackSequence {
79
- next: number;
346
+ /** A drift policy a handed-out group keeps applying; see `hooks.expireGroup`. */
347
+ export interface Expiry {
348
+ expired: () => boolean;
349
+ /** The budget in milliseconds the group is judged under, which a stale verdict names. */
350
+ budget?: () => number;
351
+ /**
352
+ * Whether the group aged past `budget` milliseconds, held to the publisher's max age, as
353
+ * {@link expired} judges its own: a range wanting it that long stops wanting it then. Arms a
354
+ * wakeup on {@link changed} for when it would.
355
+ */
356
+ aged?: (budget: number) => boolean;
357
+ changed: readonly Getter<unknown>[];
358
+ }
359
+ /**
360
+ * Why a group read looks past the copy it reads, as the Rust `resume::Cause`: the copy failed,
361
+ * stalled while a newer route serves, or closed the group short of a known end (a FIN without
362
+ * GROUP_END) after a newer route took over or while one is being spliced in, which may hold more.
363
+ */
364
+ export type RecoverCause = {
365
+ kind: "failed";
366
+ error: Error;
367
+ } | {
368
+ kind: "stalled";
369
+ } | {
370
+ kind: "closed";
371
+ };
372
+ /**
373
+ * Carries a handed-out group across its logical track's route changes. Consulted only once
374
+ * the copy it reads fails, stalls while a newer route serves, or closes the group short after
375
+ * one took over, so a passthrough read never touches it. The counterpart of the Rust
376
+ * `resume::Recover`.
377
+ */
378
+ export interface GroupRecover {
379
+ /** Release the route held by this group when its consumer closes. */
380
+ close?(): void;
381
+ /**
382
+ * Whether to look past the copy being read for `cause`: it failed and that is no verdict on
383
+ * the group, or it stalled or closed short while a newer route serves.
384
+ */
385
+ wants(cause: RecoverCause): boolean;
386
+ /** Wakes a stalled read once the route changes. */
387
+ readonly changed: Getter<unknown>;
388
+ /**
389
+ * The serving route's copy of the group, to read from frame `index` on, once the copy being
390
+ * read looks past itself for `cause`. Rejects once nothing can continue the group: with the
391
+ * error that ends it, or for a short close, why that close stands. Abandoned once `signal`
392
+ * aborts.
393
+ */
394
+ replace(index: number, cause: RecoverCause, signal: AbortSignal): Promise<Replacement>;
395
+ }
396
+ /** A copy of a group still arriving, held for a duplicate that waits on it. */
397
+ export interface Arriving {
398
+ /** How the copy ends. */
399
+ readonly settled: GetPromise<Error | null>;
400
+ /** Stop holding it, once the duplicate took the group or gave up. Idempotent. */
401
+ release(): void;
402
+ }
403
+ /** A candidate copy of a group, committed only once the read can use it. */
404
+ export interface Replacement {
405
+ readonly group: GroupConsumer;
406
+ /** The drift policy of the copy it came from. */
407
+ readonly expiry: Expiry;
408
+ /** The group reads this copy from now on. */
409
+ adopt(): void;
410
+ /** Nobody reads this copy: close it and give back what it holds. */
411
+ discard(): void;
412
+ }
413
+ /**
414
+ * Which groups of a track's live feed to ask whether one may still land: one the feed has not
415
+ * accounted for, the publisher did not drop, and the feed reaches, in a gap a later arrival
416
+ * opened less than `grace` ago or that nothing later opened, while a producer is left.
417
+ */
418
+ export interface Land {
419
+ /** The first group asked about. */
420
+ start: bigint;
421
+ /** The first group past those asked about. */
422
+ end: bigint;
423
+ /** Whether the feed was asked to start at `start`: otherwise only from its first arrival. */
424
+ floor: boolean;
425
+ /** How long a gap a later arrival opened is waited for, or until it is accounted for when none. */
426
+ grace: Duration | undefined;
427
+ /** When given, only a group it lacks counts. */
428
+ delivered?: Delivered;
429
+ }
430
+ /**
431
+ * The reads a resumed {@link Subscriber} delegates: it reads its routes' copies rather than a
432
+ * buffer of its own. Implemented by `resume.ts`, the counterpart of the Rust `Inner::Resume`.
433
+ */
434
+ export interface ResumeSource {
435
+ /** Observe a serving copy's abort, including delivery failures a resumable reader waits past. */
436
+ watchError(fn: (error: Error) => void): Dispose;
437
+ /** Ask the serving copy for a new group as `ask`, a request nobody withdraws. */
438
+ ask(ask: Ask): void;
439
+ /** Request a new group from the serving copy; see `Subscriber.refresh`. */
440
+ refresh(signal?: AbortSignal): Promise<void>;
441
+ /**
442
+ * The next group not in `delivered`, in arrival or sequence order, without waiting. With
443
+ * `dispositions`, a run no copy may still deliver is reported once as a `drop`.
444
+ */
445
+ tryGroup(ordered: boolean, delivered: Delivered, dispositions: boolean, admit?: bigint): Recv;
446
+ /**
447
+ * The next run no copy may still deliver, reported once as a `drop`, without taking a group.
448
+ * Below `passing`, which a key-order read is about to pass, no copy can deliver one later.
449
+ */
450
+ tryDrop(delivered: Delivered, passing?: bigint): (Recv & {
451
+ kind: "drop";
452
+ }) | undefined;
453
+ /**
454
+ * The next skip any copy of the track declared, one the front served before too, that `report`
455
+ * has yet to report, as it reports it.
456
+ */
457
+ trySkip(report: (start: bigint, end: bigint) => (Recv & {
458
+ kind: "drop";
459
+ }) | undefined): (Recv & {
460
+ kind: "drop";
461
+ }) | undefined;
462
+ /**
463
+ * Whether the reader's bounded window has nothing left to deliver: every key of the whole window
464
+ * the logical reader (`delivered`) lacks is accounted for, as {@link accounts} judges. A copy
465
+ * that may still deliver keeps it open. Mirrors the Rust `Reader::exhausted`.
466
+ */
467
+ exhausted(delivered: Delivered, ordered: boolean): boolean;
468
+ /** Whether any copy holds a group in `[start, end)` that `delivered` lacks. Mirrors the Rust `Subscriber::has_unread_group`. */
469
+ hasUnreadGroup(start: bigint, end: bigint | undefined, delivered: Delivered): boolean;
470
+ /**
471
+ * Whether every key of `gaps`, which the logical reader (`delivered`) lacks, is accounted for:
472
+ * under the serving copy's resume point by the copies it replaced, and above it by the serving
473
+ * copy, where an `ordered` reader passes what the copy's own publisher created past. Mirrors the
474
+ * Rust `Reader::accounts`.
475
+ */
476
+ accounts(delivered: Delivered, gaps: readonly Run[], ordered: boolean): boolean;
477
+ /** Wake once a read may go differently; fires at most once. */
478
+ changed(fn: () => void): Dispose;
479
+ /** Forget the gaps in `delivered` below each group past the budget, as {@link forgetPast} does. */
480
+ forgetPastBudget(delivered: Delivered): void;
481
+ /**
482
+ * Forget the gaps in `delivered` below each group past the budget of `terms`, an outer reader's
483
+ * whose `delivered` this is, judged on the newest copy, but never past a group a replaced copy
484
+ * still feeding the reader holds unread, nor past `keep`. Mirrors the Rust `Subscriber::forget_past`.
485
+ */
486
+ forgetPast(delivered: Delivered, terms: FoldTerms, keep?: bigint): void;
487
+ /** The lowest group any copy holds unread that `delivered` lacks; see `hooks.lowestBuffered`. */
488
+ lowestBuffered(delivered: Delivered, fresh?: boolean): bigint | undefined;
489
+ /** The first key any copy holds past `key`; see `hooks.keyAfter`. */
490
+ keyAfter(key: bigint): bigint | undefined;
491
+ /** Why a copy still serving refuses the reader's ranges; see `hooks.refused`. */
492
+ refused(): Error | undefined;
493
+ /**
494
+ * Forget every copy's report of `[start, end)`, so the copy serving when the reader's ranges ask
495
+ * for it again reports it again. Mirrors the Rust `Reader::untell`.
496
+ */
497
+ untell(start: bigint, end: bigint): void;
498
+ /** Have every copy read whole groups for this reader; see `hooks.wholeGroups`. */
499
+ wholeGroups(frameOf: (key: bigint) => number | undefined): void;
500
+ /** The newest key any copy has seen. */
501
+ latest(): bigint | undefined;
502
+ /** The serving copy's declared start, raised to its cursor floor, or `"pending"` until resolved. */
503
+ start(): bigint | "pending" | undefined;
504
+ /** Whether the serving copy places ranges as its publisher would; see `hooks.placesAsUpstream`. */
505
+ placesAsUpstream(): boolean;
506
+ /** Whether the serving copy knows where the live feed is; see `hooks.knowsEdge`. */
507
+ knowsEdge(): boolean;
508
+ /** The logical track's declared exclusive end, as the first copy to know it declared it. */
509
+ end(): Position | undefined;
510
+ /** The longest run of keys just below `key` any copy knows were never produced. */
511
+ skippedBelow(key: bigint): bigint;
512
+ /** Where each range starts on the serving copy once delivery starts at `from`, undefined without one. */
513
+ starts(from: bigint): (bigint | undefined)[] | undefined;
514
+ /** Each range as the reader's window resolved it, whichever copy serves. */
515
+ resolved(): (Resolved | undefined)[];
516
+ /**
517
+ * Where a live join this reader placed at `placed` starts under `budget` milliseconds, on the serving copy, from only
518
+ * what the copy's feed vouches for when `vouch`.
519
+ */
520
+ joinStart(placed: bigint, budget: number, vouch?: boolean): bigint;
521
+ /** The first group the serving copy holds from `placed` up that `budget` milliseconds leave fresh. */
522
+ freshStart(placed: bigint, budget: number, cap: bigint | undefined): bigint;
523
+ /**
524
+ * The first run of `[start, end)` that settles the reader and no copy may still deliver, or
525
+ * `"pending"` while the serving route has yet to answer.
526
+ */
527
+ nextSettledDrop(start: bigint, end: bigint): DropRun | undefined | "pending";
528
+ /** The runs of `[start, end)` the reader's ranges name, across every copy. */
529
+ runs(start: bigint, end: bigint): Run[];
530
+ /** The reader's own window, which spans every copy, synced. */
531
+ window(): Window;
532
+ /** The reader's ranges covering group `key`, by index, with their budgets; see `hooks.servingCovering`. */
533
+ covering(key: bigint): [bigint, number][];
534
+ /** Whether a time start the serving copy still waits to place holds back a gap; see `hooks.gapHeld`. */
535
+ gapHeld(at: bigint, end: bigint): boolean;
536
+ /** Whether a route's copy serves the reader now. */
537
+ serving(): boolean;
538
+ /** The parts of `[start, end)` any copy held or let go says its publisher skipped; see `hooks.skippedIn`. */
539
+ skippedIn(start: bigint, end: bigint): Run[];
540
+ /** Ask the serving copy's fills for kept-out keys an outer front owes; see `hooks.askUnproven`. */
541
+ askUnproven(unproven: Run[]): Run[];
542
+ /** Whether a group in `land` may still land on a copy this reader keeps; see `hooks.mayLand`. */
543
+ mayLand(land: Land): boolean;
544
+ /** Whether an ordered read of a copy this reader keeps waits for a group in `[start, end)`; see `hooks.owes`. */
545
+ owes(start: bigint, end: bigint): boolean;
546
+ /** Whether the serving route's copy names every start on its wire; see `hooks.provenTrack`. */
547
+ proven(): boolean;
548
+ /** Where the run of keys from `key` the serving copy says no group arrives at ends; see `hooks.holeEnd`. */
549
+ holeEnd(key: bigint, dropped: boolean): bigint | undefined;
550
+ /** Where the group the serving copy holds whole at `key` ends; see `hooks.wholeEnd`. */
551
+ wholeEnd(key: bigint): bigint | undefined;
552
+ /** The span of the group the serving copy holds whole around `key`; see `hooks.wholeAround`. */
553
+ wholeAround(key: bigint): Run | undefined;
554
+ /**
555
+ * The exclusive end past every group the serving copy reads: undefined while one of its
556
+ * ranges stays open or without a serving copy.
557
+ */
558
+ servingEnd(): bigint | undefined;
559
+ /** The first group the logical track's declared end excludes whole, undefined while it is open ended. */
560
+ finalKey(): bigint | undefined;
561
+ /** Resolve with the logical track's exclusive end once known. */
562
+ finished(): Promise<Position>;
563
+ /** The serving copy's newest buffered frame, which a wire answer names as its edge. */
564
+ bufferedLargest(): Position | undefined;
565
+ /** The group the next take hands out, without taking it; see `hooks.peekGroup`. */
566
+ peek(ordered: boolean, delivered: Delivered): bigint | undefined;
567
+ /** The lowest group any copy holds unread in `[from, below)`; see `hooks.lowestHeld`. */
568
+ lowestHeld(from: bigint, below: bigint, servable: boolean): Held | undefined;
569
+ /** The serving copy's newest actual object, including metadata retained past cache eviction. */
570
+ objectLargest(): Position | undefined;
571
+ /** The serving copy's largest location now, and whether it can still advance. */
572
+ peekLargest(): {
573
+ largest?: Position;
574
+ ended: boolean;
575
+ };
576
+ /** Whether `position` is the serving copy's largest and its group ended there. */
577
+ largestFinished(position: Position): boolean;
578
+ /**
579
+ * The serving copy's largest location once within the reader's cursor and newer than `seen`,
580
+ * or undefined once the logical track ends.
581
+ */
582
+ largest(seen: Position | undefined): Promise<Position | undefined>;
583
+ /** An independent subscriber to the serving copy. */
584
+ fork(options?: Subscription): Subscriber;
585
+ /** A fresh reader for a group still cached by one of this reader's copies. */
586
+ cachedGroup(key: bigint, from?: number): GroupConsumer | undefined;
587
+ /** As `hooks.cachedTimedId`, from the copies {@link cachedGroup} reads, without mirroring the group. */
588
+ cachedTimedId(key: bigint, index: number, timescale: Timescale): bigint | undefined;
589
+ /** As {@link cachedGroup} from its first frame, judged by the budget of the copy it comes from. */
590
+ judgedGroup(key: bigint): GroupConsumer | undefined;
591
+ /** When the latest group any copy caches in `[start, end)` landed; see `hooks.landed`. */
592
+ landed(start: bigint, end: bigint): Instant | undefined;
593
+ /** Let go of every copy. */
594
+ close(abort?: Error): void;
80
595
  }
81
- /** Per-track sequence namespaces owned by one broadcast generation. */
82
- export type TrackSequences = Map<string, TrackSequence>;
83
596
  /** Inputs for creating a package-internal track request. */
84
597
  export interface TrackRequestOptions {
85
598
  /** The requested track name. */
86
599
  name: string;
87
600
  /** The producer that will serve the request. */
88
601
  producer: Producer;
89
- /** Sequence namespaces shared by the broadcast generation. */
90
- sequences: TrackSequences;
91
602
  /** Requests not yet accepted or rejected by the publisher. */
92
603
  pending: Set<Request>;
604
+ /** Whether a metadata-only lookup opened this request, if its broadcast supports them. */
605
+ lookups?: {
606
+ opened: boolean;
607
+ };
608
+ /** Whether it asks for the track's metadata copy, each frame's header alone, rather than its payload. */
609
+ meta?: boolean;
610
+ }
611
+ /**
612
+ * A requested track written before any subscriber sees it; see `hooks.stageRequest`.
613
+ * Write through {@link producer}; {@link commit} publishes it with everything written so far.
614
+ */
615
+ export interface StagedTrack {
616
+ /** The track's writer. */
617
+ readonly producer: Producer;
618
+ /** Resolve every waiting subscriber now. Throws, rejecting the request, if the info is refused. */
619
+ commit(): Producer;
620
+ }
621
+ /**
622
+ * How a received copy's start bounds the fills its readers ask below it. Mirrors the Rust
623
+ * `Start::Resolved` and `Producer::fills_from_start`.
624
+ *
625
+ * Below a start the publisher resolved from the budget (`resolvesStart`), a reader fills the
626
+ * history its own budget reaches: an update can cross the response, so nobody knows which
627
+ * budget picked that start. On a wire whose fills and timestamps cannot judge an older group
628
+ * against that budget (`fillsFromStart`, lite-06), readers fill nothing below the start, and a
629
+ * widened budget reaches lower groups through the feed's re-offer. Anywhere else, a reader fills
630
+ * below the start only the groups its ranges name.
631
+ */
632
+ export interface FillStarts {
633
+ /** The wire's start is resolved from the subscriber's budget: lite SUBSCRIBE_START from lite-06. */
634
+ resolvesStart?: boolean;
635
+ /** Readers ask no fills below the start at all. */
636
+ fillsFromStart?: boolean;
93
637
  }
94
- /** Hooks assigned in static blocks by the owning class. */
95
- export declare const hooks: {
638
+ /** The first group an exclusive track end excludes whole: one past the last group that may exist. */
639
+ export declare function finalKey(end: Position): bigint;
640
+ /** The package-internal hooks, each assigned in its owning class's `static {}` block. */
641
+ interface Hooks {
642
+ /** Make a request for an unanswered datagram track. */
643
+ datagramRequest: (producer: datagram.Producer, pending: Set<datagram.Request>) => datagram.Request;
644
+ /** End a received datagram track if its last consumer left. */
645
+ closeUnusedDatagrams: (producer: datagram.Producer) => boolean;
646
+ /**
647
+ * End a datagram track with `error` for its consumers: a refused request or a session's wire
648
+ * reset. Not public, since an accepted track stops only by `close()`. Assigned by `datagram.ts`.
649
+ */
650
+ abortDatagrams: (producer: datagram.Producer, error: Error) => void;
651
+ /** A datagram track's properties, once accepted. */
652
+ datagramInfo: (producer: datagram.Producer) => datagram.Info | undefined;
653
+ /**
654
+ * Call `listener` as the datagram track ends, before it closes, with whether it finished
655
+ * rather than aborted. Assigned by `datagram.ts`.
656
+ */
657
+ onDatagramsEnd: (producer: datagram.Producer, listener: (finished: boolean) => void) => void;
658
+ /** Write a datagram a legacy hop delivered under `wire`, so a hop to the same kind of peer sends that key again. */
659
+ writeDatagramWire: (producer: datagram.Producer, datagram: datagram.Datagram, wire: bigint) => void;
660
+ /** The next datagram with the key a legacy hop delivered it under, if one did. */
661
+ recvDatagramWire: (consumer: datagram.Consumer) => Promise<{
662
+ datagram: datagram.Datagram;
663
+ wire?: bigint;
664
+ } | undefined>;
665
+ /** Follow this consumer's subscriber priority for transport scheduling. */
666
+ datagramPriority: (consumer: datagram.Consumer) => Getter<number>;
667
+ /** Forward data carried by an existing stream without contributing another subscription's demand. */
668
+ observeDatagrams: (producer: datagram.Producer) => datagram.Consumer;
669
+ /** A track producer whose info waits on a request's acceptance or the wire, which only {@link Producer.accept} commits. */
670
+ pendingTrack: (name: string) => Producer;
671
+ /** A datagram producer awaiting a request's acceptance, which only {@link datagram.Request.accept} completes. */
672
+ pendingDatagrams: (name: string) => datagram.Producer;
673
+ /** Settles once this consumer is closed, the end of whatever request it serves. */
674
+ datagramClosed: (consumer: datagram.Consumer) => GetPromise<Error | null>;
675
+ /** Whether two consumers read the same datagram track. */
676
+ datagramSameTrack: (a: datagram.Consumer, b: datagram.Consumer) => boolean;
677
+ /** Another consumer at the same position that adds no demand, until its priority is set. */
678
+ observeDatagramConsumer: (consumer: datagram.Consumer) => datagram.Consumer;
679
+ /**
680
+ * Declare the end a wire subscription received: repeating it is a no-op, and a mid-group
681
+ * end may refine the group boundary it falls just before. Throws `ProtocolViolation` on
682
+ * any other second end. Readers then hold at a hole below it until the hole fills, folds
683
+ * past the grace, or the track closes, since QUIC may deliver a lower group's stream after
684
+ * a higher one. Mirrors the Rust `finish_at` on a `received()` copy; assigned by `track.ts`.
685
+ */
686
+ endTrack: (producer: Producer, end: Position) => void;
687
+ /**
688
+ * Settle a received copy's pending tail once its subscription finishes cleanly, preserving the
689
+ * declared end. Mirrors the Rust `Producer::finish_shared` on a declared end;
690
+ * assigned by `track.ts`.
691
+ */
692
+ settleTail: (producer: Producer) => void;
693
+ /**
694
+ * End a wire subscription's copy cleanly without declaring an end, for a session closed
695
+ * locally: a dead route, not finished content, so a resumed reader's replacement route
696
+ * continues past it. Rust aborts its copy with `Cancel` instead, which its resume also reads
697
+ * as a dead route. Assigned by `track.ts`.
698
+ */
699
+ releaseTrack: (producer: Producer) => void;
700
+ /**
701
+ * Close a track with `error` for its subscribers: a refused request or a session's wire reset.
702
+ * Not public, since an accepted track stops only by {@link Producer.close}. Assigned by `track.ts`.
703
+ */
704
+ abortTrack: (producer: Producer, error: Error) => void;
705
+ /** Cache a new track's groups into its broadcast's `pool`, before it caches any. Assigned by `track.ts`. */
706
+ poolTrack: (producer: Producer, pool: Pool) => void;
707
+ /**
708
+ * Make a new track a metadata copy, before it holds any group: each group it creates holds
709
+ * frame headers alone (see {@link metaGroup}). Assigned by `track.ts`.
710
+ */
711
+ metaTrack: (producer: Producer) => void;
712
+ /**
713
+ * Settles once the producer is released (closed or aborted), unlike its public `closed`,
714
+ * which also settles on a reached end while the producer keeps serving. Assigned by `track.ts`.
715
+ */
716
+ trackReleased: (producer: Producer) => GetPromise<Error | null>;
717
+ /** {@link trackReleased} for a demand handle. Assigned by `track.ts`. */
718
+ demandReleased: (demand: Demand) => GetPromise<Error | null>;
719
+ /**
720
+ * The group start subscribers ask for while it is past every key written, whether or not
721
+ * anyone subscribes now: what a relay forwards upstream as SUBSCRIBE_UPDATE's Wanted Start.
722
+ * Mirrors the Rust `Demand::asked`; assigned by `track.ts`.
723
+ */
724
+ demandAsked: (demand: Demand) => Getter<bigint | undefined>;
725
+ /** Whether a subscriber, not just a held info lookup, wants the track; assigned by `track.ts`. */
726
+ demandSubscribed: (demand: Demand) => boolean;
727
+ /** Whether the producer declared the track's end, released or not. Assigned by `track.ts`. */
728
+ trackFinished: (producer: Producer) => boolean;
729
+ /**
730
+ * Call `listener` as the producer is released, before its track closes, with whether it
731
+ * finished: released cleanly at a declared end. Assigned by `track.ts`.
732
+ */
733
+ onTrackRelease: (producer: Producer, listener: (finished: boolean) => void) => void;
734
+ /**
735
+ * Record that the publisher gave up the groups `[start, end)` as `hole` says: none will
736
+ * arrive, so a reader waiting on one moves past it, a group still arriving in them ends, the
737
+ * declared end does not wait for them, and a relay serving this track forwards the drop. A skip
738
+ * ends no reader, and replaces any drop; a drop leaves a skip in place.
739
+ * Returns the runs recorded. Mirrors the Rust `give_up`; assigned by `track.ts`.
740
+ */
741
+ dropTrackGroups: (producer: Producer, start: bigint, end: bigint, hole: Hole) => Run[];
742
+ /**
743
+ * A skip received from upstream, as `Requests.skipGroups` but superseding each cached copy
744
+ * that has not finished the original group, returning the keys of those that did, which the
745
+ * skip contradicts. Mirrors the Rust `skip_received`; assigned by `track.ts`.
746
+ */
747
+ skipTrackGroups: (producer: Producer, start: bigint, end: bigint) => Run[];
748
+ /**
749
+ * The upstream subscription dropped `[start, end)` for itself, as a lite-07 SUBSCRIBE_DROP
750
+ * says: copies still arriving on it are given up for now, as
751
+ * `GroupProducer.abort` gives one up, and the keys count as arrived but not cached, so readers
752
+ * ask fills, while the track records no drop. Mirrors the Rust `drop_received`; assigned by
753
+ * `track.ts`.
754
+ */
755
+ loseTrackGroups: (producer: Producer, start: bigint, end: bigint) => void;
756
+ /**
757
+ * The parts of `[start, end)` a fill out, queued or taken, still owes, in order. Mirrors the Rust
758
+ * `Producer::fills_owe`; assigned by `track.ts`.
759
+ */
760
+ fillsOwe: (producer: Producer, start: bigint, end: bigint) => Run[];
761
+ /** Whether the received feed left a scoped drop that its copy can still recover. */
762
+ hasScopedDrops: (producer: Producer) => boolean;
763
+ /**
764
+ * Append a group one past every group the track holds, or at 0 on an empty track: for tests
765
+ * and benches that count groups rather than time them. Mirrors the Rust `append_next`.
766
+ */
767
+ appendNext: (producer: Producer) => GroupProducer;
768
+ /**
769
+ * Create group `key` with no frame yet, as a received GROUP header opens it: for tests that
770
+ * write its frames themselves. Mirrors the Rust `create_empty`.
771
+ */
772
+ createEmpty: (producer: Producer, key: bigint) => GroupProducer;
773
+ /**
774
+ * Create a group whose first frame is `frame`, at its key, without a `Requests` handle:
775
+ * for tests of a cache that takes groups in any order, which leaves the keys below it neither
776
+ * owed nor skipped. Mirrors the Rust test-only `Producer::create_group`.
777
+ */
778
+ createGroup: (producer: Producer, frame: Frame) => GroupProducer;
779
+ /**
780
+ * Append a group at `start` with no frame yet, as a received GROUP header opens it: for tests
781
+ * that write its frames themselves. Mirrors the Rust `append_empty`.
782
+ */
783
+ appendEmpty: (producer: Producer, start: Timestamp) => GroupProducer;
784
+ /**
785
+ * Forget every run a received copy holds as stale: a new upstream subscription opened, whose
786
+ * terms are new, so those groups are unknown again. Mirrors the Rust `supersede_stale`.
787
+ */
788
+ supersedeStale: (producer: Producer) => void;
789
+ /**
790
+ * Mark a track as fed by a wire subscription, which owes missing groups, until
791
+ * {@link cacheTrack} ends it. `starts` says how that wire's start bounds the fills its readers
792
+ * ask below it. Assigned by `track.ts`.
793
+ */
794
+ receiveTrack: (producer: Producer, starts?: FillStarts) => void;
795
+ /**
796
+ * Create a received group at its wire offset before publishing it to readers; `fill` marks one a
797
+ * fill's subscription answered, which the feed never promised. Assigned by `track.ts`.
798
+ */
799
+ receiveGroup: (producer: Producer, group: {
800
+ start: bigint;
801
+ offset: number;
802
+ fill?: boolean;
803
+ }) => GroupProducer;
804
+ /**
805
+ * Hold the copy of `key` still arriving, if one is, for a duplicate to wait on: until
806
+ * released, that copy's failure leaves its readers open for the duplicate to continue. Assigned
807
+ * by `track.ts`.
808
+ */
809
+ arrivingGroup: (producer: Producer, key: bigint) => Arriving | undefined;
810
+ /** The cached groups of `[start, end)` still arriving, by key, costing what the cache holds. Assigned by `track.ts`. */
811
+ arrivingIn: (producer: Producer, start: bigint, end: bigint) => bigint[];
812
+ /** The producer's largest reported location and its subsequent changes. */
813
+ producerLargest: (producer: Producer) => Getter<Position | undefined>;
814
+ /** Re-evaluate a live-edge join at this subscriber's copy. */
815
+ /**
816
+ * The track's exclusive end as this subscriber's copy knows it now, for a publisher
817
+ * forwarding it. Readers await `finished()` instead. Assigned by `track.ts`.
818
+ */
819
+ subscriberEnd: (subscriber: Subscriber) => Position | undefined;
820
+ /** What this subscriber resolves its ranges against, for a test. Assigned by `track.ts`. */
821
+ subscriberHoldings: (subscriber: Subscriber) => Holdings;
822
+ /**
823
+ * How many keys just below `key` the publisher declared it never produced: the skip run
824
+ * ending at `key`, which a moq-transport Prior Group ID Gap names. Mirrors the Rust
825
+ * `skipped_below`; assigned by `track.ts`.
826
+ */
827
+ skippedBelow: (subscriber: Subscriber, key: bigint) => bigint;
828
+ /** Ask a producer for a new group, judged by its {@link Info.refresh}; mirrors the Rust `TrackState::ask`. */
829
+ askProducer: (producer: Producer, ask: Ask) => void;
830
+ /**
831
+ * {@link askProducer} for a `Subscriber.refresh` caller, resolving once the request is sent.
832
+ * Aborting `signal` first withdraws it. Assigned by `track.ts`.
833
+ */
834
+ requestProducer: (producer: Producer, signal?: AbortSignal) => Promise<void>;
835
+ /** Ask the copy a subscriber reads for a new group as `ask`, a request nobody withdraws. Assigned by `track.ts`. */
836
+ askSubscriber: (subscriber: Subscriber, ask: Ask) => void;
837
+ /**
838
+ * Declare the first group a wire subscription's live feed serves (lite SUBSCRIBE_START, or
839
+ * IETF SUBSCRIBE_OK's Largest) for the floor its SUBSCRIBE requested: while the demand keeps
840
+ * that floor, a pending tail owes nothing below it. Mirrors the Rust `start_at`; assigned by
841
+ * `track.ts`. A null `start` resolves an empty range; without `start`, the SUBSCRIBE still
842
+ * waits on its START, as the Rust `request_start`. Only after {@link receiveTrack}: the start
843
+ * is that subscription's, and ends with it. `resolved` marks a start the publisher placed
844
+ * itself, as the Rust `start_resolved`: every older group stays fillable. `restated` marks a
845
+ * start its publisher has since placed afresh, as {@link restateTrack} does.
846
+ * A wire with per-range STARTs also supplies the spans its demand ranges can deliver.
847
+ */
848
+ startTrack: (producer: Producer, served: {
849
+ start?: bigint | null;
850
+ requested?: bigint;
851
+ resolved?: boolean;
852
+ restated?: boolean;
853
+ feed?: readonly Run[];
854
+ }) => void;
855
+ /**
856
+ * Mark the start a pre-07 copy's wire subscription declared as placed afresh by an update since:
857
+ * it still bounds fills, since the publisher's re-offer brings the groups below it, but no longer
858
+ * a reader's live join, which may reach lower. Assigned by `track.ts`.
859
+ */
860
+ restateTrack: (producer: Producer) => void;
861
+ /**
862
+ * Mark a track as a copy received over a wire without ranges, whose publisher placed its live
863
+ * join already, so its readers start one among the groups held by when each presented rather
864
+ * than prove it as a lite-07 copy does. Mirrors the Rust `Holdings::drops_anchors`; assigned by
865
+ * `track.ts`.
866
+ */
867
+ dropAnchors: (producer: Producer) => void;
868
+ /**
869
+ * Have a received copy's readers start a time anchor at the group starting there, held or
870
+ * not, for a wire whose publisher starts one at the first group at or after it. Mirrors the
871
+ * Rust `track::Producer::starts_at_keys`; assigned by `track.ts`.
872
+ */
873
+ startsAtKeys: (producer: Producer) => void;
874
+ /**
875
+ * Have a received copy's readers place a live join only where its upstream answered a range
876
+ * asking it (see `answerJoin`), for a wire whose ranges carry each join and report where each
877
+ * starts. Mirrors the Rust `track::Producer::answers_joins`; assigned by `track.ts`.
878
+ */
879
+ answersJoins: (producer: Producer) => void;
880
+ /**
881
+ * Record where the upstream publisher started each of a lite-07 copy's live history ranges, as
882
+ * `[time, start]` by the time each asked from (0 for the oldest group), `start` undefined for one
883
+ * with no group to deliver at or before its time, replacing the last set. A reader's time start
884
+ * the copy cannot place among its own groups resolves to the range asked from it: a start at or
885
+ * before the time names the group containing it, one past the time starts the range there, and
886
+ * no start says no group at or before the time is left.
887
+ * Mirrors the Rust `track::Producer::time_starts`; assigned by `track.ts`.
888
+ */
889
+ timeStarts: (producer: Producer, starts: Iterable<readonly [bigint, bigint | undefined]>) => void;
890
+ /**
891
+ * Record how the upstream publisher answered a range of a lite-07 copy asking the live join `min`
892
+ * milliseconds behind the live edge through the time `end`: at group `start`, or undefined for
893
+ * nothing to deliver, asked under at most `budget` milliseconds ({@link NO_MAX_DELAY} for no
894
+ * limit). It replaces the join's earlier answer, and places every reader of that join that began
895
+ * waiting before now, within the budget. Returns the tick it was recorded at. Mirrors the Rust
896
+ * `track::Producer::answer_join`; assigned by `track.ts`.
897
+ */
898
+ answerJoin: (producer: Producer, min: number | null, end: bigint | undefined, start: bigint | undefined, budget: number) => number;
899
+ /**
900
+ * Forget the answers of the live joins `keep` rejects: no live range asks them, so no reader waits
901
+ * on them. Mirrors the Rust `track::Producer::retain_joins`; assigned by `track.ts`.
902
+ */
903
+ retainJoins: (producer: Producer, keep: (min: number | null, end: bigint | undefined) => boolean) => void;
96
904
  /** Mint a track {@link Request}; assigned by `track.ts`. */
97
905
  makeRequest: (options: TrackRequestOptions) => Request;
98
- /** Access the existing producer while a request awaits immutable wire metadata. */
99
- pendingTrackProducer: (request: Request) => Producer;
906
+ /**
907
+ * Take a request's producer without resolving its subscribers, so content written before
908
+ * {@link StagedTrack.commit} is there when the first reader looks; assigned by `track.ts`.
909
+ */
910
+ stageRequest: (request: Request, info: InfoInit) => StagedTrack;
911
+ /** The newest frame a producer's cache holds, read without subscribing; assigned by `track.ts`. */
912
+ cachedLargest: (producer: Producer, timescale?: Timescale) => Position | undefined;
913
+ /**
914
+ * The first frame of the finished group `key` cached by a producer whose moq-timestamp Object ID
915
+ * at `timescale` is at least `id`, or its frame count when none is or the copy no longer holds
916
+ * frame 0; undefined when the group isn't cached and finished. Assigned by `track.ts`.
917
+ */
918
+ finishedTimedFrame: (producer: Producer, key: bigint, id: bigint, timescale: Timescale) => number | undefined;
919
+ /** A producer's committed {@link Info}, or undefined before it is accepted; assigned by `track.ts`. */
920
+ acceptedInfo: (producer: Producer) => Info | undefined;
921
+ /** Count an info lookup as the track's demand until the returned release, called once, runs; assigned by `track.ts`. */
922
+ holdTrack: (producer: Producer) => () => void;
923
+ /** The publisher priority from a demanded track's committed {@link Info}; assigned by `track.ts`. */
924
+ demandPriority: (demand: Demand) => number;
925
+ /**
926
+ * Seed a received track from the publisher's reported edge, and whether its group ended there;
927
+ * assigned by `track.ts`.
928
+ */
929
+ reportedLargest: (producer: Producer, largest: Position | undefined, finished: boolean) => void;
930
+ /** A received copy's upstream said where the live feed is, its largest or that it has none. */
931
+ answerEdge: (producer: Producer) => void;
932
+ /**
933
+ * Seed a received track from the publisher's reported group alone, whose frame is unknown,
934
+ * so it names no object; assigned by `track.ts`.
935
+ */
936
+ reportedGroup: (producer: Producer, group: bigint) => void;
937
+ /**
938
+ * How long a session's tail waits for a late group: the subscribers' max delay, bounded by
939
+ * the track's max age, or none on a copy whose wire names every start; assigned by `track.ts`.
940
+ */
941
+ tailGrace: (producer: Producer) => Duration | undefined;
942
+ /**
943
+ * Mark a received copy whose wire names every start (lite-07), so it waits out no grace for a
944
+ * missing group: the wire accounts for it; assigned by `track.ts`.
945
+ */
946
+ proveTrack: (producer: Producer) => void;
947
+ /** Whether {@link proveTrack} marked the copy a subscriber reads, or its serving route's; assigned by `track.ts`. */
948
+ provenTrack: (subscriber: Subscriber) => boolean;
949
+ /** Snapshot the latest group key for wire positioning; assigned by `track.ts`. */
950
+ latestKey: (subscriber: Subscriber) => bigint | undefined;
951
+ /** How many groups arrived on the subscriber's copy so far; assigned by `track.ts`. */
952
+ arrived: (subscriber: Subscriber) => number;
953
+ /**
954
+ * The source's declared start, raised to the subscriber's cursor floor, or `"pending"` while
955
+ * the upstream START that resolves it has yet to arrive; assigned by `track.ts`.
956
+ */
957
+ sourceStart: (subscriber: Subscriber) => bigint | "pending" | undefined;
958
+ /**
959
+ * Whether the copy the subscriber reads places a range only where its publisher would, from
960
+ * that publisher's answer for it or groups proving it, so `servingResolvedKeys` needs no other
961
+ * range answered first; false while a front's reader has no copy serving. Mirrors the Rust
962
+ * `track::Subscriber::places_as_upstream`; assigned by `track.ts`.
963
+ */
964
+ placesAsUpstream: (subscriber: Subscriber) => boolean;
965
+ /**
966
+ * Whether this hop knows where the live feed is: always on a track's own publisher, and on a
967
+ * received copy once its upstream said so or the track ended; assigned by `track.ts`. A relay
968
+ * answers a range following the live edge only then. Mirrors the Rust `poll_live`.
969
+ */
970
+ knowsEdge: (subscriber: Subscriber) => boolean;
971
+ /** The newest frame still buffered for a subscriber; assigned by `track.ts`. */
972
+ bufferedLargest: (subscriber: Subscriber) => Position | undefined;
973
+ /**
974
+ * Where a publisher's delivery starts once `opening.first` goes out first. Mirrors the Rust
975
+ * `track::Subscriber::delivery_start`; assigned by `track.ts`.
976
+ */
977
+ deliveryStart: (subscriber: Subscriber, opening: Opening) => bigint;
978
+ /**
979
+ * The lowest group the subscriber holds unread in `[from, below)`, in its window, only one whole
980
+ * from the frame asked when `servable`, and whether it is, for a front's `lowestHeld`. Assigned
981
+ * by `track.ts`.
982
+ */
983
+ lowestHeld: (subscriber: Subscriber, from: bigint, below: bigint, servable: boolean) => Held | undefined;
984
+ /** The newest actual object received or reported upstream, independent of cache retention. */
985
+ objectLargest: (subscriber: Subscriber) => Position | undefined;
986
+ /** Call `fn` with a group's frame count now and on every change; assigned by `group.ts`. */
987
+ groupProgress: (group: GroupProducer, fn: (total: number) => void) => Dispose;
100
988
  /**
101
989
  * Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.
102
990
  *
103
991
  * Synchronous so a caller can pop a group and act on it in the same turn. Park on
104
- * {@link groupChanged} when it reports `idle` or `boundary`.
992
+ * {@link groupChanged} when it reports `idle` or `boundary`. With `dispositions`, what
993
+ * the cursor gives up is reported once as a `drop`; see {@link Dispositions}.
994
+ */
995
+ tryRecvGroup: (subscriber: Subscriber, dispositions: Dispositions) => Recv;
996
+ /**
997
+ * The next run the subscriber's cursor gave up and has not reported, without taking a group.
998
+ * From the first call on, the budget skips of {@link tryRecvGroup} without dispositions are
999
+ * kept for it, so a resumed reader takes groups the plain way and drops from here.
1000
+ */
1001
+ tryDrop: (subscriber: Subscriber) => (Recv & {
1002
+ kind: "drop";
1003
+ }) | undefined;
1004
+ /** How many runs the subscriber holds for its fills: asked, given up, heads, and adopted verdicts. */
1005
+ fillRuns: (subscriber: Subscriber) => number;
1006
+ /** How many steps the subscriber's fill floor keeps to resume its walk from. */
1007
+ fillFloorSteps: (subscriber: Subscriber) => number;
1008
+ /**
1009
+ * Where the subscriber's fill floor walks to now, beside the lowest key above its hand-out floor,
1010
+ * not handed out, that media time judged alone does not put past its widest budget, and whether a
1011
+ * group it holds has yet to start, which may stop the walk lower.
1012
+ */
1013
+ fillFloor: (subscriber: Subscriber) => {
1014
+ walked: bigint;
1015
+ live: bigint;
1016
+ unstarted: boolean;
1017
+ };
1018
+ /**
1019
+ * Ask a route copy's fills for the keys of `unproven` a front's resumed reader owes that its
1020
+ * track cannot prove skipped, once its feed no longer waits for them, returning those its fills
1021
+ * gave up. Assigned by `track.ts`.
1022
+ */
1023
+ askUnproven: (subscriber: Subscriber, unproven: Run[]) => Run[];
1024
+ /**
1025
+ * The runs of `[start, end)` a subscriber reads: inside its ranges and its local bounds.
1026
+ * Assigned by `track.ts`.
1027
+ */
1028
+ servingRuns: (subscriber: Subscriber, start: bigint, end: bigint) => Run[];
1029
+ /**
1030
+ * Whether a time start still waiting below `end` holds back a gap an ordered read at `at` would
1031
+ * return. Assigned by `track.ts`.
1032
+ */
1033
+ gapHeld: (subscriber: Subscriber, at: bigint, end: bigint) => boolean;
1034
+ /**
1035
+ * The exclusive end past every group a subscriber reads, or undefined while one of its ranges
1036
+ * stays open. Assigned by `track.ts`.
1037
+ */
1038
+ servingEnd: (subscriber: Subscriber) => bigint | undefined;
1039
+ /**
1040
+ * Where each of a subscriber's ranges starts once delivery starts at `from`, undefined for one
1041
+ * with no group there: what lite-07 SUBSCRIBE_START answers. Assigned by `track.ts`.
1042
+ */
1043
+ servingStarts: (subscriber: Subscriber, from: bigint) => (bigint | undefined)[];
1044
+ /**
1045
+ * Each of a subscriber's ranges as resolved where it is served, undefined for one whose start
1046
+ * still waits: what lite-07 SUBSCRIBE_START answers. Assigned by `track.ts`.
1047
+ */
1048
+ servingResolved: (subscriber: Subscriber) => (Resolved | undefined)[];
1049
+ /**
1050
+ * A subscriber's ranges keyed `keys` as resolved where they are served, as
1051
+ * {@link servingResolved} reads them, undefined for one not held. Asked together, so a reader
1052
+ * resolving by position on route copies builds its ranges once for them all. Assigned by
1053
+ * `track.ts`.
1054
+ */
1055
+ servingResolvedKeys: (subscriber: Subscriber, keys: readonly bigint[]) => (Resolved | undefined)[];
1056
+ /**
1057
+ * The ranges of a subscriber covering group `key`, by key, each with how long in milliseconds it
1058
+ * keeps the group worth delivering once superseded: a range not yet placed may cover any group up
1059
+ * to its end. Mirrors the Rust `Subscriber::covering`; assigned by `track.ts`.
1060
+ */
1061
+ servingCovering: (subscriber: Subscriber, key: bigint) => [bigint, number][];
1062
+ /**
1063
+ * Where a live join placed at `placed` starts under `budget` milliseconds. A publisher
1064
+ * passes an unlimited budget so only the serving copy's own bound limits the history it
1065
+ * reports. Mirrors the Rust `Subscriber::join_start`; assigned by `track.ts`.
1066
+ */
1067
+ joinStart: (subscriber: Subscriber, placed: bigint, budget: number, vouch?: boolean) => bigint;
1068
+ /**
1069
+ * The first group a subscriber's copy holds from `placed` up that `budget` milliseconds leave
1070
+ * fresh, whatever keys it has not accounted for. Mirrors the Rust `Subscriber::fresh_start`;
1071
+ * assigned by `track.ts`.
1072
+ */
1073
+ freshStart: (subscriber: Subscriber, placed: bigint, budget: number, cap: bigint | undefined) => bigint;
1074
+ /**
1075
+ * The first drop of `[start, end)` a subscriber's track holds that settles it, with why; on a
1076
+ * front's reader, a skip it kept or its serving copy's drop, less what the reader was handed or
1077
+ * another copy may still deliver. `"pending"` while a front's serving route has yet to answer:
1078
+ * no verdict is known there yet, which is not the same as none. Mirrors the Rust
1079
+ * `Subscriber::next_settled_drop`; assigned by `track.ts`.
1080
+ */
1081
+ nextSettledDrop: (subscriber: Subscriber, start: bigint, end: bigint) => DropRun | undefined | "pending";
1082
+ /**
1083
+ * Edit a subscriber's preferences by key, costing the ranges the edit names rather than every
1084
+ * range: lite-07's SUBSCRIBE_UPDATE, by Range ID. Mirrors the Rust `Subscriber::edit`. Assigned
1085
+ * by `track.ts`.
1086
+ */
1087
+ editSubscriber: (subscriber: Subscriber, edit: Edit) => void;
1088
+ /**
1089
+ * Replace a subscriber's preferences as a subscription restated whole, as a SUBSCRIBE_UPDATE
1090
+ * before lite-07 restates it: every range is placed afresh, a live join whose max alone changed
1091
+ * included, since that wire names no range to retune. What the reader already handed out stays
1092
+ * settled. Mirrors the Rust `Subscriber::restate`. Assigned by `track.ts`.
1093
+ */
1094
+ restateSubscriber: (subscriber: Subscriber, subscription: Subscription) => void;
1095
+ /**
1096
+ * Note each of a subscriber's live join ranges keyed in `since` as added at its tick instead: a
1097
+ * front's reader stamps each copy it asks with the tick it added the range at, so an answer the
1098
+ * copy recorded since places it. Mirrors the Rust `Preferences::stamp`. Assigned by `track.ts`.
1099
+ */
1100
+ stampSubscriber: (subscriber: Subscriber, since: Iterable<readonly [bigint, number]>) => void;
1101
+ /**
1102
+ * A subscriber's preferences, whose scalars and revision read without materializing every
1103
+ * range as {@link Subscriber.subscription} does. Assigned by `track.ts`.
1104
+ */
1105
+ preferences: (subscriber: Subscriber) => Prefs;
1106
+ /**
1107
+ * `subscription`'s ranges resolved against the subscriber's track now, by index. Mirrors the
1108
+ * Rust `Subscriber::resolve_ranges`. Assigned by `track.ts`.
1109
+ */
1110
+ resolveRanges: (subscriber: Subscriber, subscription: Subscription) => (Resolved | undefined)[];
1111
+ /**
1112
+ * The buffered candidate the next take hands out: the lowest for an ordered take, which may wait
1113
+ * below it, else the first in the subscription's Group Order. `floor` passes keys taken on other copies.
1114
+ */
1115
+ peekGroup: (subscriber: Subscriber, ordered: boolean, floor?: bigint) => bigint | undefined;
1116
+ /**
1117
+ * Take the next group in sequence order without waiting, as {@link tryRecvGroup} does in arrival
1118
+ * order. One at or past `admit` stays next, and the read reports idle.
1119
+ */
1120
+ tryNextGroup: (subscriber: Subscriber, floor?: bigint, admit?: bigint) => Recv;
1121
+ /** Whether a buffered group in `[start, end)` that `delivered` lacks still waits to be read. */
1122
+ hasUnreadGroup: (subscriber: Subscriber, start: bigint, end: bigint | undefined, delivered: Delivered) => boolean;
1123
+ /**
1124
+ * Whether a subscriber's track ended and it holds nothing left to read: no group in `[start, end)` that `delivered` lacks.
1125
+ */
1126
+ spent: (subscriber: Subscriber, start: bigint, end: bigint | undefined, delivered: Delivered) => boolean;
1127
+ /** Whether a subscriber's last read waits on a fill that still owes it a group. Mirrors the Rust `awaits_fill`. */
1128
+ awaitsFill: (subscriber: Subscriber) => boolean;
1129
+ /**
1130
+ * Mark a wire publisher's reader to park past the end of a bounded window rather than end the
1131
+ * read there, since its peer reads the end of a stream as the track's. Mirrors the Rust
1132
+ * crate-private `track::Subscriber::parked`. Returns the subscriber.
1133
+ */
1134
+ parked: (subscriber: Subscriber) => Subscriber;
1135
+ /**
1136
+ * Mark whether a lite-07 publisher's reader is a fetch, reading only named groups, which a
1137
+ * track's own fill handler answers past the live edge too. Mirrors the Rust
1138
+ * `Prefs::fetches`.
1139
+ */
1140
+ fetches: (subscriber: Subscriber, fetches: boolean) => void;
1141
+ /**
1142
+ * Have a wire publisher's reader hand out each group from frame `frameOf(key)` on, asking a
1143
+ * fill for the frames its copy lacks below that, as a bounded window does, and giving the group
1144
+ * up once none can supply them. Through a front, each route copy asks its own fill. A cache only
1145
+ * makes things faster; mirrors the Rust publisher's `position_group`. `frameOf` answering
1146
+ * undefined takes the group as held. Returns the subscriber.
1147
+ */
1148
+ wholeGroups: (subscriber: Subscriber, frameOf: (key: bigint) => number | undefined) => Subscriber;
1149
+ /**
1150
+ * Whether a route copy accounts for every key of `gaps`, which the logical reader that handed
1151
+ * out `delivered` lacks: what the copy handed out itself counts too, read in key order when
1152
+ * `ordered`. Mirrors the Rust `accounts_for`.
1153
+ */
1154
+ accountsFor: (subscriber: Subscriber, delivered: Delivered, gaps: readonly Run[], ordered: boolean) => boolean;
1155
+ /**
1156
+ * The parts of `[start, end)` the publisher declared skipped on the subscriber's track, never to
1157
+ * be produced: a front's reader asks its serving copy. Mirrors the Rust crate-private
1158
+ * `track::Consumer::skipped_in`.
1159
+ */
1160
+ skippedIn: (subscriber: Subscriber, start: bigint, end: bigint) => Run[];
1161
+ /** How many runs of handed-out groups a subscriber remembers: one per gap, plus the floor. Tests only. */
1162
+ deliveredRuns: (subscriber: Subscriber) => number;
1163
+ /** How many runs a subscriber's record of what it reported holds. Tests only. */
1164
+ reportedRuns: (subscriber: Subscriber) => number;
1165
+ /**
1166
+ * Record `key` as final in `reported` when `subscriber` is already tracking drops, so a front's
1167
+ * copy coalesces each handed-out group with the skipped runs between them. Mirrors the Rust
1168
+ * `Subscriber::settle_if_dropping`.
1169
+ */
1170
+ settleIfDropping: (subscriber: Subscriber, key: bigint) => void;
1171
+ /** Whether the subscriber already handed out group `key`, or no longer expects it. */
1172
+ handedOut: (subscriber: Subscriber, key: bigint) => boolean;
1173
+ /**
1174
+ * Which groups the subscriber may still hand out, judged against one staleness verdict taken
1175
+ * now: a key qualifies when its ranges and floor cover it, nothing skipped or gave it up, it has
1176
+ * not handed it out or passed it, as an ordered read passes what lies below where it reads next,
1177
+ * and it is not stale under its budget. Mirrors the Rust crate-private `track::Subscriber::taking`.
1178
+ */
1179
+ taking: (subscriber: Subscriber) => (key: bigint) => boolean;
1180
+ /**
1181
+ * Forget the gaps in another reader's `delivered` below each group past the budget of `terms`,
1182
+ * the terms of the reader whose `delivered` this is, which a front's copy, its ranges raised to a
1183
+ * resume point, cannot judge by its own, forgetting no gap at or above `keep`. Mirrors the Rust
1184
+ * `Subscriber::forget_past_budget`.
1185
+ */
1186
+ forgetPastBudget: (subscriber: Subscriber, delivered: Delivered, terms: FoldTerms, keep?: bigint) => void;
1187
+ /**
1188
+ * The lowest group the subscriber holds unread that another reader's `delivered` lacks, in its
1189
+ * range and window, on any copy it reads. Mirrors the Rust `track::Subscriber::lowest_unread`
1190
+ * as a front's compaction reads it. With `fresh`, only one not stale even at the track's max age.
1191
+ */
1192
+ lowestBuffered: (subscriber: Subscriber, delivered: Delivered, fresh?: boolean) => bigint | undefined;
1193
+ /** The first key the subscriber holds unread past `key`, on any copy it reads. Mirrors the Rust `TrackState::key_after`. */
1194
+ keyAfter: (subscriber: Subscriber, key: bigint) => bigint | undefined;
1195
+ /** Why the subscriber's ranges can't be served, which its reads fail with. Mirrors the Rust `Subscriber::refused`. */
1196
+ refused: (subscriber: Subscriber) => Error | undefined;
1197
+ /** Fold a route copy's record below `at`, where the reader it feeds is, which reports nothing there. */
1198
+ fold: (subscriber: Subscriber, at: bigint) => void;
1199
+ /** Forget what a route copy reported of `[start, end)`, which its reader's wire was never told. */
1200
+ untell: (subscriber: Subscriber, start: bigint, end: bigint) => void;
1201
+ /**
1202
+ * What a lite publisher told its wire about a subscriber's keys, kept in the
1203
+ * subscriber's own record. Mirrors the Rust crate-private `track::Subscriber::record_mut`.
105
1204
  */
106
- tryRecvGroup: (subscriber: Subscriber) => Recv;
107
- /** Wake once a subscriber's group cursor may read differently; assigned by `track.ts`. */
1205
+ wire: (subscriber: Subscriber) => WireRecord;
1206
+ /**
1207
+ * Whether this subscriber's budget gives up on `key`, or the publisher's max age alone for a
1208
+ * `fetched` group, judged by its successor; see {@link expireGroup}. Successors count within
1209
+ * `within` when given, else within this subscriber's window below its cursor's cap.
1210
+ */
1211
+ staleAt: (subscriber: Subscriber, key: bigint, fetched?: boolean, within?: Within) => Expiry;
1212
+ /** A group the subscriber's track still caches, as a fresh read handle. */
1213
+ cachedGroup: (subscriber: Subscriber, key: bigint, from?: number) => GroupConsumer | undefined;
1214
+ /**
1215
+ * The moq-timestamp Object ID of frame `index` of the group cached at `key`, as
1216
+ * {@link groupTimedId} reads it from {@link cachedGroup}'s copy, without mirroring the group:
1217
+ * a join reads it, so its cost must not grow with the group. Undefined when that copy cannot
1218
+ * prove it.
1219
+ */
1220
+ cachedTimedId: (subscriber: Subscriber, key: bigint, index: number, timescale: Timescale) => bigint | undefined;
1221
+ /**
1222
+ * As {@link cachedGroup} from its first frame, the reader given up once the subscription's
1223
+ * budget gives up on it, judged by the route copy it is read from when routed.
1224
+ */
1225
+ judgedGroup: (subscriber: Subscriber, key: bigint) => GroupConsumer | undefined;
1226
+ /**
1227
+ * Whether {@link cachedGroup} would find the group, without making a read handle; with `whole`,
1228
+ * only one held from its first frame.
1229
+ */
1230
+ holdsGroup: (subscriber: Subscriber, key: bigint, whole?: boolean) => boolean;
1231
+ /** Whether `producer`'s cache currently holds a non-aborted group `key` (optionally whole). */
1232
+ producerHoldsGroup: (producer: Producer, key: bigint, whole?: boolean) => boolean;
1233
+ /**
1234
+ * When the latest group the subscriber's track caches in `[start, end)` landed, undefined when
1235
+ * it caches none; a routed reader asks every copy. Mirrors the Rust `Subscriber::landed`.
1236
+ */
1237
+ landed: (subscriber: Subscriber, start: bigint, end: bigint) => Instant | undefined;
1238
+ /**
1239
+ * Where the group the subscriber's track holds at `key` ends, once it finished whole: its span
1240
+ * is `[key, end)`. Undefined for a group not held, still open, or ended without one.
1241
+ */
1242
+ wholeEnd: (subscriber: Subscriber, key: bigint) => bigint | undefined;
1243
+ /**
1244
+ * The span of the group the subscriber's track holds finished whole that holds `key` strictly
1245
+ * past its start, which no other group starts inside; undefined when none does.
1246
+ */
1247
+ wholeAround: (subscriber: Subscriber, key: bigint) => Run | undefined;
1248
+ /**
1249
+ * Where the run of keys from `key` that no group can arrive at on the subscriber's track ends:
1250
+ * a skip, or with `dropped` a drop given up for good. Mirrors the Rust crate-private
1251
+ * `track::Subscriber::hole_end`.
1252
+ */
1253
+ holeEnd: (subscriber: Subscriber, key: bigint, dropped: boolean) => bigint | undefined;
1254
+ /**
1255
+ * The abort that closed the subscriber's track after its declared end settled, which its
1256
+ * readers saw as a clean end. Mirrors the Rust crate-private `track::Consumer::aborted`.
1257
+ */
1258
+ trackAborted: (subscriber: Subscriber) => Error | undefined;
1259
+ /** The error the subscriber's track gave `key` up with, if it did, and what changes it. */
1260
+ givenUp: (subscriber: Subscriber, key: bigint) => {
1261
+ error?: Error;
1262
+ changed: Getter<unknown>[];
1263
+ };
1264
+ /**
1265
+ * An upstream subscription feeding this copy asks a live join under `budget` milliseconds, before
1266
+ * it reaches the wire: that upstream may judge a group too old under it from then on. Mirrors
1267
+ * the Rust crate-private `track::Producer::judge_under`.
1268
+ */
1269
+ judgeUnder: (producer: Producer, budget: number) => void;
1270
+ /**
1271
+ * The narrowest budget in milliseconds an upstream subscription feeding the subscriber's copy
1272
+ * asked, undefined while none asked one. Mirrors the Rust `track::Consumer::judged_under`.
1273
+ */
1274
+ judgedUnder: (subscriber: Subscriber) => number | undefined;
1275
+ /**
1276
+ * The parts of `[start, end)` the subscriber's track still holds as a received stale run: one
1277
+ * a new upstream subscription superseded is gone. Mirrors the Rust crate-private
1278
+ * `track::Subscriber::stale_held`.
1279
+ */
1280
+ staleHeld: (subscriber: Subscriber, start: bigint, end: bigint) => Run[];
1281
+ /**
1282
+ * Whether a group may still land on the live feed of the subscriber's track, or for a front's
1283
+ * reader on any copy it keeps; see {@link Land}.
1284
+ */
1285
+ mayLand: (subscriber: Subscriber, land: Land) => boolean;
1286
+ /**
1287
+ * Whether an ordered read of the subscriber still waits for a group in `[start, end)`: one a fill
1288
+ * it asked has yet to answer, or one its received copy's live feed owes within its budget. Arms
1289
+ * the read's wakeups for that wait. A front's reader asks the copies it keeps. Mirrors the Rust
1290
+ * `track::Subscriber::owes`.
1291
+ */
1292
+ owes: (subscriber: Subscriber, start: bigint, end: bigint) => boolean;
1293
+ /** A subscriber's largest location now, and whether it can still advance. */
1294
+ peekLargest: (subscriber: Subscriber) => {
1295
+ largest?: Position;
1296
+ ended: boolean;
1297
+ };
1298
+ /** Whether `position` is a subscriber's largest and its group ended there, so no frame follows it. */
1299
+ largestFinished: (subscriber: Subscriber, position: Position) => boolean;
1300
+ /** Wake once a subscriber's largest location or its end may have changed; fires at most once. */
1301
+ largestChanged: (subscriber: Subscriber, fn: () => void) => Dispose;
1302
+ /** A subscriber that reads its routes' copies through `source` instead of a buffer of its own. */
1303
+ resumeSubscriber: (name: string, subscription: Subscription | undefined, source: (shell: ResumeShell) => ResumeSource) => Subscriber;
1304
+ /** Wake once a subscriber's group cursor may read differently, including when the track declares its end; assigned by `track.ts`. */
108
1305
  groupChanged: (subscriber: Subscriber, fn: () => void) => Dispose;
1306
+ /** Read one group for a fetch, bounded by the publisher's max age alone. */
1307
+ asFetch: (subscriber: Subscriber) => void;
1308
+ /** Whether a reader beyond one-shot fetches subscribes to this copy. */
1309
+ subscribing: (producer: Producer) => Getter<boolean>;
1310
+ /** The aggregate across every reader, one-shot fetches included: what the wire asks for. */
1311
+ requested: (producer: Producer) => Subscriptions;
1312
+ /** Leave a wire copy serving its cache and fills without a live feed. */
1313
+ cacheTrack: (producer: Producer) => void;
1314
+ /** Fail subscriptions reaching beyond `edge`, keeping history readers and one-shot fetches. */
1315
+ refuseLive: (producer: Producer, edge: bigint, error: Error) => void;
1316
+ /**
1317
+ * A fetch's group `key`, before it reads: `true` once it is cached or asked of a fill,
1318
+ * written yet or not, as the Rust `fetch_group` queues one; `false` with no handler to ask;
1319
+ * `"pending"` while the track awaits its accept, which opens its handler.
1320
+ */
1321
+ askFetch: (subscriber: Subscriber, key: bigint) => boolean | "pending";
1322
+ /**
1323
+ * Bind a group to its track's info, so a frame whose timestamp doesn't `rescale` to the track
1324
+ * is refused. Throws `TimestampMismatch` if a buffered frame already disagrees.
1325
+ */
1326
+ bindGroupTimed: (group: GroupProducer, track: Info) => void;
1327
+ /**
1328
+ * Refuse a timed frame 0 off the group's key, for a group handed out empty to a writer that
1329
+ * stamps frame 0 itself (a fill's): every other path creates the group from frame 0.
1330
+ */
1331
+ keyGroup: (group: GroupProducer) => void;
1332
+ /** Bind the group to its immutable track codec. */
1333
+ bindGroupCompression: (group: GroupProducer, compressed: boolean) => void;
1334
+ /** Admit a received stored slice without recompressing it. */
1335
+ /** Set a received group's first absolute frame before publishing it. Assigned by `group.ts`. */
1336
+ startGroup: (group: GroupProducer, start: number) => void;
1337
+ /** The first absolute frame this source copy began at. Assigned by `group.ts`. */
1338
+ groupOffset: (group: GroupProducer) => number;
1339
+ /** Whether this source copy can no longer serve frame 0: it began past it, or shed it. */
1340
+ groupHeadless: (group: GroupProducer) => boolean;
1341
+ /** Where a source copy finished whole ends, undefined while it is open or ended without one. */
1342
+ groupWholeEnd: (group: GroupProducer) => bigint | undefined;
1343
+ /**
1344
+ * Whether a source copy counts as content (its first frame landed, or it ended), whether it
1345
+ * failed, and its first and newest timestamps: what the groups below it are judged by once it
1346
+ * leaves the cache. Assigned by `group.ts`.
1347
+ */
1348
+ groupSpan: (group: GroupProducer) => {
1349
+ started: boolean;
1350
+ failed: boolean;
1351
+ first?: Timestamp;
1352
+ latest?: Timestamp;
1353
+ };
1354
+ /**
1355
+ * The first time a source copy can't place, undefined once it finished: it places a time it holds
1356
+ * a timed frame past, which puts its End past the time too. An aborted copy may have lost its End.
1357
+ * Mirrors the Rust `group::Handle::unplaced_from`.
1358
+ */
1359
+ groupUnplacedFrom: (group: GroupProducer) => bigint | undefined;
1360
+ /** A source copy's frame count, bumped on each write. */
1361
+ groupWrites: (group: GroupProducer) => Getter<number>;
1362
+ /**
1363
+ * Move a reader past every frame buffered now without building a payload, so a streamed frame
1364
+ * that aborted or shed its head never throws. Mirrors draining Rust's `poll_next_frame`.
1365
+ */
1366
+ skipGroupFrames: (group: GroupConsumer) => void;
1367
+ writeGroupFrame: (group: GroupProducer, frame: Frame, inflated?: number) => void;
1368
+ /**
1369
+ * Make a new group a metadata copy, before its first frame: it holds each frame's header alone,
1370
+ * which {@link writeGroupHeader} writes, and refuses a payload. It stores no compressed stream,
1371
+ * whatever its track declares. Assigned by `group.ts`.
1372
+ */
1373
+ metaGroup: (group: GroupProducer) => void;
1374
+ /** Whether a group is a metadata copy; see {@link metaGroup}. Assigned by `group.ts`. */
1375
+ groupMeta: (group: GroupProducer) => boolean;
1376
+ /**
1377
+ * Write the header of a frame of `size` plain bytes at `timestamp` into a metadata copy, as a
1378
+ * metadata subscription delivers it: an empty payload, which readers get with `size` as its
1379
+ * declared plain size. Throws on a payload group. Assigned by `group.ts`.
1380
+ */
1381
+ writeGroupHeader: (group: GroupProducer, timestamp: Timestamp, size: number) => void;
1382
+ /** Payload footprint including a shared inflated copy, for measurements. */
1383
+ groupCacheBytes: (group: GroupProducer) => number;
1384
+ /** Record a cached group's accesses to `charge` from now on, or stop with undefined. */
1385
+ chargeGroup: (group: GroupProducer, charge: Charge | undefined) => void;
1386
+ /** Frame count without creating a read handle. */
1387
+ groupFrameCount: (group: GroupProducer) => number;
1388
+ /**
1389
+ * The moq-timestamp Object ID of a group's last frame at `timescale`: a copy without frame 0
1390
+ * answers its last timestamp's offset from the start, which the ID is never below. Undefined
1391
+ * before any frame. Assigned by `group.ts`.
1392
+ */
1393
+ groupLastTimedId: (group: GroupProducer, timescale: Timescale) => bigint | undefined;
109
1394
  /**
110
- * Exempt a subscriber from live-delivery policy for a one-shot FETCH scan: it names one
111
- * old group explicitly, so it is neither late against the live edge nor bound by the start
112
- * a live subscription resolves to.
1395
+ * The first frame whose moq-timestamp Object ID at `timescale` is at least `id`, or the next
1396
+ * frame to be written when none is yet; undefined when the copy no longer holds frame 0.
1397
+ * Assigned by `group.ts`.
113
1398
  */
114
- exemptFetch: (subscriber: Subscriber) => void;
1399
+ groupTimedFrame: (group: GroupProducer, id: bigint, timescale: Timescale) => number | undefined;
1400
+ /** As {@link groupTimedId}, read from the group itself rather than a mirror. Assigned by `group.ts`. */
1401
+ groupSourceTimedId: (group: GroupProducer, index: number, timescale: Timescale) => bigint | undefined;
115
1402
  /**
116
- * Replace a serving cursor. An omitted start keeps the current floor; a provided start
117
- * can lower it. Wire publishers apply SUBSCRIBE_UPDATE here rather than through
118
- * `setGroups`, which never rewinds.
1403
+ * Cap a group at `frames` for a track end inside it, so later writes past it throw.
1404
+ * Throws `ProtocolViolation` if a frame at or past the cap already exists.
119
1405
  */
120
- replaceGroups: (subscriber: Subscriber, groups: Groups) => void;
1406
+ limitGroup: (group: GroupProducer, frames: number) => void;
1407
+ /**
1408
+ * Check a group's first frame against a track it joined before the frame lands. `admit`
1409
+ * throws `TimestampMismatch` on a rewind, or returns the commit to run once every track
1410
+ * the group joined accepted it.
1411
+ */
1412
+ admitGroupStart: (group: GroupProducer, admit: (start: Timestamp) => () => void) => void;
1413
+ /** Call `fn` as a group aborts, before its readers can look; assigned by `group.ts`. */
1414
+ onGroupAbort: (group: GroupProducer, fn: (error: Error) => void) => void;
1415
+ /**
1416
+ * End a group with `error` for the package's own teardown (eviction, expiry, a stream reset, a
1417
+ * session close), where the public `abort()` takes none. A no-op once it closed. Mirrors the
1418
+ * Rust `group::Handle::abort`; assigned by `group.ts`.
1419
+ */
1420
+ abortGroup: (group: GroupProducer, error: Error) => void;
1421
+ /** Fail a frame and its group with `error`, as {@link abortGroup} does; assigned by `frame.ts`. */
1422
+ abortFrame: (frame: FrameProducer, error: Error) => void;
1423
+ /** Whether a group's bytes after its first frame exceed `ratio` times the first frame. */
1424
+ overRefresh: (group: GroupProducer, ratio: number) => boolean;
1425
+ /** Keep a mirror of a group accepted unverified below its track's eviction watermark out of media-time expiry. */
1426
+ unverifyGroup: (group: GroupConsumer) => void;
121
1427
  /** Return a group's first timestamp, retained even after its first frame is read. */
1428
+ /**
1429
+ * Release a group reader, failing it with `abort` if given, by closing its own mirrored copy.
1430
+ * Assigned by `group.ts`.
1431
+ */
1432
+ releaseGroupReader: (group: GroupConsumer, abort?: Error) => void;
1433
+ /** Settles once a group reader read or released everything it holds, its {@link GroupConsumer.done}. Assigned by `group.ts`. */
1434
+ groupDone: (group: GroupConsumer) => GetPromise<Error | null>;
1435
+ /**
1436
+ * Settles as {@link GroupConsumer.closed} does, for a watcher that is no reader: it never judges
1437
+ * whether the read goes on past a short close, leaving that to the reader. Assigned by `group.ts`.
1438
+ */
1439
+ groupClosed: (group: GroupConsumer) => GetPromise<Error | null>;
1440
+ /** Settles once the group's producer closes it, read or not: when its {@link GroupConsumer.end} is known. Assigned by `group.ts`. */
1441
+ groupFinished: (group: GroupConsumer) => GetPromise<Error | null>;
1442
+ /** Settles once the reader releases the group (`close` or an abort), however far it read. */
1443
+ groupReleased: (group: GroupConsumer) => Promise<void>;
1444
+ /** Whether a group reader still reads the copy it was mirrored from, not one its recovery moved it to. */
1445
+ readsMirrored: (group: GroupConsumer) => boolean;
1446
+ /**
1447
+ * Whether the reader a track buffered `group` for will still read it: only then does it keep
1448
+ * its source group wanted. Assigned by `group.ts`.
1449
+ */
1450
+ groupReads: (group: GroupConsumer, reads: boolean) => void;
122
1451
  groupTimestamp: (group: GroupConsumer) => Timestamp | undefined;
123
1452
  groupLatest: (group: GroupConsumer) => Timestamp | undefined;
1453
+ /** Return when a group joined its track at this hop, on the installed clock. */
1454
+ groupArrived: (group: GroupConsumer) => Instant;
1455
+ /** Whether a group counts as content: its first frame landed, or it ended. */
1456
+ /** The next absolute frame this reader can serve. Assigned by `group.ts`. */
1457
+ groupIndex: (group: GroupConsumer) => number;
1458
+ /**
1459
+ * The moq-timestamp Object ID at `timescale` of frame `index`, which the reader still holds
1460
+ * from frame 0; undefined when it doesn't. Assigned by `group.ts`.
1461
+ */
1462
+ groupTimedId: (group: GroupConsumer, index: number, timescale: Timescale) => bigint | undefined;
1463
+ groupSettledFrames: (group: GroupConsumer) => number | undefined;
1464
+ groupStarted: (group: GroupConsumer) => boolean;
1465
+ /** The first frame this copy begins at: past 0 for one missing its head. */
1466
+ groupFirstFrame: (group: GroupConsumer) => number;
1467
+ /** Watch the error a group's copy closes with, ignoring readers' verdicts, without holding the consumer. */
1468
+ groupFate: (group: GroupConsumer) => () => Error | undefined;
1469
+ /** Record when a track's mirror of a group joined that track at this hop. */
1470
+ arriveGroup: (group: GroupConsumer, at: Instant) => void;
124
1471
  /** Keep applying a subscription's drift policy after it hands a group out. */
125
- expireGroup: (group: GroupConsumer, expiry: {
126
- expired: () => boolean;
127
- changed: readonly Getter<unknown>[];
128
- }) => void;
129
- /** Start a group operation unless the handed-out group has expired, and stop it if the group expires mid-flight. */
130
- guardGroup: <T>(group: GroupConsumer, operation: () => Promise<T>) => Promise<T>;
131
- /** Read a frame the wire publisher completes (or skips) once written. */
132
- readGroupFrame: (group: GroupConsumer, from?: number) => Promise<ReadGroupFrame | undefined>;
133
- /** Make an evicted mirror terminal while its track timeline still contains it. */
134
- evictGroup: (group: GroupConsumer) => void;
135
- /** Attach the origin advertisement of a created broadcast. */
136
- attachAnnouncer: (producer: BroadcastProducer, announcer: {
137
- announce(route: Route): void;
138
- unannounce(): void;
139
- }) => void;
1472
+ expireGroup: (group: GroupConsumer, expiry: Expiry) => void;
1473
+ /** The drift policy a group carries, if any; see {@link expireGroup}. */
1474
+ groupExpiry: (group: GroupConsumer) => Expiry | undefined;
1475
+ /** The failure that ends a group's reader, as its `closed` would settle, without building that handle. */
1476
+ groupFailed: (group: GroupConsumer) => Error | undefined;
1477
+ /**
1478
+ * Carry a group across its logical track's route changes. Attached before the group is handed
1479
+ * out, so its `closed` never settles on a failure the recovery continues past.
1480
+ */
1481
+ recoverGroup: (group: GroupConsumer, recover: GroupRecover) => void;
1482
+ /**
1483
+ * Hold a received copy still arriving for a duplicate: if it fails while held, its readers wait
1484
+ * for the duplicate to take over (see {@link Arriving}). Assigned by `group.ts`.
1485
+ */
1486
+ holdGroup: (group: GroupProducer) => () => void;
1487
+ /**
1488
+ * Hand `next` the readers `failed` kept open while held, teeing each from the frame it reached.
1489
+ * Fails those `next` cannot serve. Assigned by `group.ts`.
1490
+ */
1491
+ succeedGroup: (next: GroupProducer, failed: GroupProducer) => void;
1492
+ /** Read a payload chunk, releasing its wait when the output stream closes. */
1493
+ readFrameChunk: (frame: FrameConsumer, closed: Promise<void>) => Promise<Uint8Array | undefined>;
1494
+ /**
1495
+ * Read the next frame, as its stored DEFLATE slice when `compressed`, so a lite-07 publisher forwards it without inflating.
1496
+ * A `header` read takes the frame's header alone, leaving no payload in flight to tear on a route failure.
1497
+ */
1498
+ readGroupFrame: (group: GroupConsumer, compressed: boolean, from?: number, header?: boolean) => Promise<ReadGroupFrame | undefined>;
1499
+ /** Notify the owning track when a reader reaches its shed front. */
1500
+ onShedRead: (group: GroupConsumer, notify: () => void) => void;
1501
+ /**
1502
+ * Make an evicted mirror terminal while its track timeline still contains it, failing its
1503
+ * unread content with `lost`. Whether the mirror is released too: not when its group reads
1504
+ * on, or may yet, from another copy.
1505
+ */
1506
+ evictGroup: (group: GroupConsumer, lost: Error) => boolean;
1507
+ /** Record a cache access on a group a reader takes, restarting its idle window. */
1508
+ refreshGroup: (group: GroupConsumer) => void;
1509
+ /** Call `fn` synchronously when an open broadcast closes, from any handle. */
1510
+ onClosed: (producer: BroadcastProducer, fn: () => void) => Dispose;
1511
+ /** Reserve an on-demand track without listing it or enabling a request handler. */
1512
+ reserveUnlistedTrack: (producer: BroadcastProducer, name: string) => Request;
1513
+ /**
1514
+ * Answer an info lookup from the accepted copy of `name` a broadcast holds open, holding the copy
1515
+ * until `hold` aborts; undefined with no such copy. Assigned by `broadcast.ts`.
1516
+ */
1517
+ resolveHeld: (broadcast: BroadcastConsumer, name: string, hold?: AbortSignal) => Promise<Info> | undefined;
1518
+ /**
1519
+ * Serve a broadcast's metadata lookups from a metadata copy apart from the payload one, which
1520
+ * its request handler fills with frame headers alone: set only by a handler that can, a lite-07
1521
+ * session asking upstream with a metadata subscription. Mirrors the Rust `serve_meta`; assigned
1522
+ * by `broadcast.ts`.
1523
+ */
1524
+ serveMeta: (broadcast: BroadcastConsumer) => void;
1525
+ /** Transfer a metadata-opened request to its session's producer lifetime. */
1526
+ keepRequest: (request: Request) => void;
1527
+ /** Observe the peer's reset without waiting for routed delivery recovery. */
1528
+ watchSubscriberError: (subscriber: Subscriber, fn: (error: Error) => void) => Dispose;
140
1529
  /** Name a broadcast handle by the path an origin created or resolved it at. */
141
1530
  stampPath: (target: BroadcastProducer | BroadcastConsumer, path: Path.Valid) => void;
142
- };
1531
+ /** Name the identity of the route an origin resolved a broadcast handle through. */
1532
+ stampIdentity: (target: BroadcastConsumer, identity: Identity.Valid | undefined) => void;
1533
+ /** Mark a broadcast handle served through a route claiming a shorter prefix: it lists nothing. */
1534
+ stampUnlisted: (target: BroadcastConsumer) => void;
1535
+ /** Whether a broadcast handle was {@link stampUnlisted marked unlisted}. */
1536
+ unlisted: (target: BroadcastConsumer) => boolean;
1537
+ }
1538
+ /** Filled in by each owning module as it loads. */
1539
+ export declare const hooks: Hooks;
1540
+ /**
1541
+ * Spreads a pool's identities across paths: FNV-1a 64 of `path` then the identity's UTF-8.
1542
+ * Keyed on the requested path so a pool advertising one prefix shares its paths, and every
1543
+ * node agrees, since the identity reads the same everywhere. Mirrors `identity_key` in
1544
+ * `rs/moq-net`.
1545
+ */
1546
+ export declare function spreadHash(path: string, identity: string): bigint;
1547
+ /**
1548
+ * The best claim covering `path`, as `RouteTable::best_route` in rs/moq-net picks it: only the
1549
+ * most specific claims compete, a claim shown above its own prefix counting for the shallower
1550
+ * prefix it is really at, and they rank against each other wherever each is filed. Of those, only
1551
+ * an identity's highest epoch is eligible, an exact claim's `others` (which never win) included,
1552
+ * and the rest order by {@link compareTier}, then {@link compareTie}: a claim is new when it
1553
+ * starts or restarts (another identity or epoch), and keeps its place through a re-price.
1554
+ * `candidates` lists each
1555
+ * covering prefix's, newest first, and `advertised` names each one's ref and route. Every
1556
+ * selector ranks through this, so the announcements and the consumes of one session never pick
1557
+ * apart.
1558
+ */
1559
+ export declare function mostSpecific<T>(path: Path.Valid, candidates: (prefix: Path.Valid) => Iterable<T>, advertised: (candidate: T) => Advertised, others?: readonly WireRoute[]): T | undefined;
1560
+ /** Covering prefixes, most specific first, including the empty root. */
1561
+ export declare function coveringPrefixes(path: Path.Valid): Generator<Path.Valid>;
1562
+ /**
1563
+ * Whether `route` at `prefix` is superseded among `others`: one of them carries its identity at
1564
+ * a higher epoch at the same prefix. An older incarnation of an identity is never eligible,
1565
+ * however cheap, since its publisher was replaced.
1566
+ */
1567
+ export declare function superseded(route: WireRoute, others: Iterable<WireRoute>): boolean;
1568
+ /**
1569
+ * Prefer a route that is available (not held), then one that is not draining (a peer that sent
1570
+ * GOAWAY), which still reaches its origin, then the highest priority on its path, then identified
1571
+ * publishers, then lower static cost.
1572
+ */
1573
+ export declare function compareRoutes(a: WireRoute, b: WireRoute): number;
1574
+ /**
1575
+ * Order two claims of one tier resolving `path`, each filed at its `prefix`: by preference, hop
1576
+ * count, then one filed at `path` itself, then, keyed on `path` whatever each claim's filing, the
1577
+ * rendezvous hash of a lite-07 claim's identity or the spread hash of a named one. The hashes only
1578
+ * spread a pool over a prefix's paths, as `route_order` in rs/moq-net does. Any other tie breaks by
1579
+ * {@link compareTie}.
1580
+ */
1581
+ export declare function compareTier(path: Path.Valid, a: {
1582
+ readonly prefix: Path.Valid;
1583
+ readonly route: WireRoute;
1584
+ }, b: {
1585
+ readonly prefix: Path.Valid;
1586
+ readonly route: WireRoute;
1587
+ }): number;
1588
+ /** The hops a route ranks by: a lite-07 claim counts as the one hop to the peer that sent it. */
1589
+ export declare function routeHops(route: WireRoute): number;
1590
+ export {};
143
1591
  //# sourceMappingURL=internal.d.ts.map