@moq/net 0.3.5 → 0.4.1

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 (244) hide show
  1. package/announce.d.ts +7 -0
  2. package/announce.d.ts.map +1 -0
  3. package/announce.js +8 -0
  4. package/announce.js.map +1 -0
  5. package/announced.d.ts +49 -91
  6. package/announced.d.ts.map +1 -1
  7. package/announced.js +21 -156
  8. package/announced.js.map +1 -1
  9. package/bandwidth.d.ts +163 -0
  10. package/bandwidth.d.ts.map +1 -0
  11. package/bandwidth.js +304 -0
  12. package/bandwidth.js.map +1 -0
  13. package/bandwidth_api.d.ts +7 -0
  14. package/bandwidth_api.d.ts.map +1 -0
  15. package/bandwidth_api.js +8 -0
  16. package/bandwidth_api.js.map +1 -0
  17. package/broadcast.d.ts +23 -28
  18. package/broadcast.d.ts.map +1 -1
  19. package/broadcast.js +61 -40
  20. package/broadcast.js.map +1 -1
  21. package/connection/accept.d.ts +16 -1
  22. package/connection/accept.d.ts.map +1 -1
  23. package/connection/accept.js +48 -25
  24. package/connection/accept.js.map +1 -1
  25. package/connection/browser.d.ts.map +1 -1
  26. package/connection/browser.js +9 -7
  27. package/connection/browser.js.map +1 -1
  28. package/connection/connect.d.ts +30 -6
  29. package/connection/connect.d.ts.map +1 -1
  30. package/connection/connect.js +95 -46
  31. package/connection/connect.js.map +1 -1
  32. package/connection/established.d.ts +17 -21
  33. package/connection/established.d.ts.map +1 -1
  34. package/connection/established.js.map +1 -1
  35. package/connection/forward.d.ts +2 -0
  36. package/connection/forward.d.ts.map +1 -0
  37. package/connection/forward.js +166 -0
  38. package/connection/forward.js.map +1 -0
  39. package/connection/handshake.d.ts +1 -0
  40. package/connection/handshake.d.ts.map +1 -1
  41. package/connection/handshake.js +5 -2
  42. package/connection/handshake.js.map +1 -1
  43. package/connection/index.d.ts +5 -5
  44. package/connection/index.d.ts.map +1 -1
  45. package/connection/index.js +4 -5
  46. package/connection/index.js.map +1 -1
  47. package/connection/pool.d.ts +186 -0
  48. package/connection/pool.d.ts.map +1 -0
  49. package/connection/pool.js +361 -0
  50. package/connection/pool.js.map +1 -0
  51. package/connection/reload.d.ts +14 -93
  52. package/connection/reload.d.ts.map +1 -1
  53. package/connection/reload.js +217 -81
  54. package/connection/reload.js.map +1 -1
  55. package/connection/stats.d.ts +3 -26
  56. package/connection/stats.d.ts.map +1 -1
  57. package/connection/stats.js.map +1 -1
  58. package/connection/transport.d.ts +0 -7
  59. package/connection/transport.d.ts.map +1 -1
  60. package/consume.d.ts +1 -43
  61. package/consume.d.ts.map +1 -1
  62. package/consume.js +1 -1
  63. package/consume.js.map +1 -1
  64. package/error.d.ts +180 -29
  65. package/error.d.ts.map +1 -1
  66. package/error.js +331 -16
  67. package/error.js.map +1 -1
  68. package/errors.d.ts +7 -0
  69. package/errors.d.ts.map +1 -0
  70. package/errors.js +8 -0
  71. package/errors.js.map +1 -0
  72. package/group.d.ts +9 -43
  73. package/group.d.ts.map +1 -1
  74. package/group.js +283 -69
  75. package/group.js.map +1 -1
  76. package/hop.d.ts +107 -0
  77. package/hop.d.ts.map +1 -0
  78. package/hop.js +103 -0
  79. package/hop.js.map +1 -0
  80. package/ietf/adapter.d.ts +5 -1
  81. package/ietf/adapter.d.ts.map +1 -1
  82. package/ietf/adapter.js +27 -9
  83. package/ietf/adapter.js.map +1 -1
  84. package/ietf/aliases.d.ts +1 -78
  85. package/ietf/aliases.d.ts.map +1 -1
  86. package/ietf/cluster.d.ts +6 -120
  87. package/ietf/cluster.d.ts.map +1 -1
  88. package/ietf/cluster.js +81 -41
  89. package/ietf/cluster.js.map +1 -1
  90. package/ietf/connection.d.ts +6 -72
  91. package/ietf/connection.d.ts.map +1 -1
  92. package/ietf/connection.js +17 -49
  93. package/ietf/connection.js.map +1 -1
  94. package/ietf/error.d.ts +11 -0
  95. package/ietf/error.d.ts.map +1 -0
  96. package/ietf/error.js +193 -0
  97. package/ietf/error.js.map +1 -0
  98. package/ietf/filter.d.ts.map +1 -1
  99. package/ietf/filter.js +6 -1
  100. package/ietf/filter.js.map +1 -1
  101. package/ietf/goaway.d.ts.map +1 -1
  102. package/ietf/goaway.js +22 -5
  103. package/ietf/goaway.js.map +1 -1
  104. package/ietf/hidden.d.ts +2 -0
  105. package/ietf/hidden.d.ts.map +1 -0
  106. package/ietf/hidden.js +30 -0
  107. package/ietf/hidden.js.map +1 -0
  108. package/ietf/index.d.ts +1 -0
  109. package/ietf/index.d.ts.map +1 -1
  110. package/ietf/index.js +1 -0
  111. package/ietf/index.js.map +1 -1
  112. package/ietf/object.d.ts +8 -2
  113. package/ietf/object.d.ts.map +1 -1
  114. package/ietf/object.js +17 -3
  115. package/ietf/object.js.map +1 -1
  116. package/ietf/parameters.d.ts +7 -2
  117. package/ietf/parameters.d.ts.map +1 -1
  118. package/ietf/parameters.js +35 -17
  119. package/ietf/parameters.js.map +1 -1
  120. package/ietf/properties.d.ts +1 -0
  121. package/ietf/properties.d.ts.map +1 -1
  122. package/ietf/properties.js +14 -0
  123. package/ietf/properties.js.map +1 -1
  124. package/ietf/publish.d.ts +19 -2
  125. package/ietf/publish.d.ts.map +1 -1
  126. package/ietf/publish.js +40 -6
  127. package/ietf/publish.js.map +1 -1
  128. package/ietf/publish_namespace.d.ts +25 -0
  129. package/ietf/publish_namespace.d.ts.map +1 -1
  130. package/ietf/publish_namespace.js +63 -0
  131. package/ietf/publish_namespace.js.map +1 -1
  132. package/ietf/publisher.d.ts +1 -82
  133. package/ietf/publisher.d.ts.map +1 -1
  134. package/ietf/publisher.js +302 -181
  135. package/ietf/publisher.js.map +1 -1
  136. package/ietf/solicit.d.ts +1 -40
  137. package/ietf/solicit.d.ts.map +1 -1
  138. package/ietf/subscribe.d.ts +1 -5
  139. package/ietf/subscribe.d.ts.map +1 -1
  140. package/ietf/subscribe.js +11 -13
  141. package/ietf/subscribe.js.map +1 -1
  142. package/ietf/subscribe_namespace.d.ts +8 -2
  143. package/ietf/subscribe_namespace.d.ts.map +1 -1
  144. package/ietf/subscribe_namespace.js +18 -8
  145. package/ietf/subscribe_namespace.js.map +1 -1
  146. package/ietf/subscriber.d.ts +1 -65
  147. package/ietf/subscriber.d.ts.map +1 -1
  148. package/ietf/subscriber.js +325 -121
  149. package/ietf/subscriber.js.map +1 -1
  150. package/ietf/version.d.ts +12 -1
  151. package/ietf/version.d.ts.map +1 -1
  152. package/ietf/version.js +13 -0
  153. package/ietf/version.js.map +1 -1
  154. package/index.d.ts +11 -6
  155. package/index.d.ts.map +1 -1
  156. package/index.js +10 -5
  157. package/index.js.map +1 -1
  158. package/internal.d.ts +104 -1
  159. package/internal.d.ts.map +1 -1
  160. package/internal.js +76 -0
  161. package/internal.js.map +1 -1
  162. package/lite/announce.d.ts +60 -10
  163. package/lite/announce.d.ts.map +1 -1
  164. package/lite/announce.js +173 -31
  165. package/lite/announce.js.map +1 -1
  166. package/lite/connection.d.ts +9 -59
  167. package/lite/connection.d.ts.map +1 -1
  168. package/lite/connection.js +26 -32
  169. package/lite/connection.js.map +1 -1
  170. package/lite/fetch.d.ts +15 -1
  171. package/lite/fetch.d.ts.map +1 -1
  172. package/lite/fetch.js +39 -7
  173. package/lite/fetch.js.map +1 -1
  174. package/lite/goaway.d.ts.map +1 -1
  175. package/lite/goaway.js +7 -1
  176. package/lite/goaway.js.map +1 -1
  177. package/lite/group.d.ts +18 -4
  178. package/lite/group.d.ts.map +1 -1
  179. package/lite/group.js +31 -10
  180. package/lite/group.js.map +1 -1
  181. package/lite/priority.d.ts +1 -61
  182. package/lite/priority.d.ts.map +1 -1
  183. package/lite/priority.js +4 -5
  184. package/lite/priority.js.map +1 -1
  185. package/lite/publisher.d.ts +1 -69
  186. package/lite/publisher.d.ts.map +1 -1
  187. package/lite/publisher.js +593 -227
  188. package/lite/publisher.js.map +1 -1
  189. package/lite/setup.d.ts +7 -7
  190. package/lite/setup.d.ts.map +1 -1
  191. package/lite/setup.js +13 -13
  192. package/lite/setup.js.map +1 -1
  193. package/lite/subscribe.d.ts +71 -17
  194. package/lite/subscribe.d.ts.map +1 -1
  195. package/lite/subscribe.js +205 -53
  196. package/lite/subscribe.js.map +1 -1
  197. package/lite/subscriber.d.ts +15 -56
  198. package/lite/subscriber.d.ts.map +1 -1
  199. package/lite/subscriber.js +316 -188
  200. package/lite/subscriber.js.map +1 -1
  201. package/lite/track.d.ts +4 -10
  202. package/lite/track.d.ts.map +1 -1
  203. package/lite/track.js +34 -29
  204. package/lite/track.js.map +1 -1
  205. package/lite/version.d.ts +42 -6
  206. package/lite/version.d.ts.map +1 -1
  207. package/lite/version.js +126 -10
  208. package/lite/version.js.map +1 -1
  209. package/origin.d.ts +248 -29
  210. package/origin.d.ts.map +1 -1
  211. package/origin.js +1232 -37
  212. package/origin.js.map +1 -1
  213. package/package.json +8 -3
  214. package/path.d.ts +25 -7
  215. package/path.d.ts.map +1 -1
  216. package/path.js +5 -3
  217. package/path.js.map +1 -1
  218. package/stream.d.ts +2 -2
  219. package/stream.d.ts.map +1 -1
  220. package/stream.js +39 -25
  221. package/stream.js.map +1 -1
  222. package/tail.d.ts +11 -0
  223. package/tail.d.ts.map +1 -0
  224. package/tail.js +121 -0
  225. package/tail.js.map +1 -0
  226. package/time.d.ts +15 -2
  227. package/time.d.ts.map +1 -1
  228. package/time.js +28 -9
  229. package/time.js.map +1 -1
  230. package/track.d.ts +195 -84
  231. package/track.d.ts.map +1 -1
  232. package/track.js +694 -196
  233. package/track.js.map +1 -1
  234. package/wire.d.ts +69 -0
  235. package/wire.d.ts.map +1 -0
  236. package/wire.js +32 -0
  237. package/wire.js.map +1 -0
  238. package/zod.d.ts +1 -1
  239. package/zod.d.ts.map +1 -1
  240. package/zod.js.map +1 -1
  241. package/mock.d.ts +0 -66
  242. package/mock.d.ts.map +0 -1
  243. package/mock.js +0 -243
  244. package/mock.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/connection/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AA2FnC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAkB;IACtD,MAAM,QAAQ,GAAI,IAAqD,CAAC,QAAQ,CAAC;IACjF,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,EAAE,CAAC;IAC9C,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO;YACN,GAAG,EAAE,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YAChF,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,SAAS;YACvD,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,WAAW,EAAE,KAAK,CAAC,WAAW;SAC9B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["/**\n * Connection statistics: what the local transport counts, and what the peer reports.\n *\n * @module\n */\nimport * as Time from \"../time.ts\";\n\n/**\n * A point-in-time snapshot of the transport's counters, from `WebTransport.getStats()`.\n *\n * Pulled on demand rather than pushed: the transport has no event to subscribe to, and\n * a caller computing a rate wants to choose its own sampling instants. Snapshot twice\n * and divide by the interval you measured.\n *\n * Every field is optional. The qmux/WebSocket fallback implements no `getStats()` at\n * all and reports nothing; see {@link Probe} for what the peer measures.\n *\n * The field names match Rust's `moq_net::ConnectionStats` but the counters keep each\n * stack's own semantics rather than being normalized. Notably W3C excludes\n * retransmissions and QUIC overhead from the byte counts where quinn includes them,\n * and counts packets where quinn counts datagrams.\n *\n * @public\n */\nexport interface Stats {\n\t/**\n\t * Smoothed round-trip time estimate in milliseconds.\n\t *\n\t * Usually absent: browsers don't report an RTT yet even though the W3C dictionary\n\t * has the field. Use {@link Probe.rtt}, which the peer measures.\n\t */\n\trtt?: Time.Milli;\n\n\t/** Estimated send bandwidth from the congestion controller, in bits per second. */\n\testimatedSendRate?: number;\n\n\t/** Total bytes sent on streams and datagrams, excluding retransmissions and QUIC overhead. */\n\tbytesSent?: number;\n\n\t/** Total bytes received on streams and datagrams, including duplicates, excluding QUIC overhead. */\n\tbytesReceived?: number;\n\n\t/** Bytes currently declared lost. The estimate can decrease when a loss proves spurious. */\n\tbytesLost?: number;\n\n\t/** Total packets sent, including retransmissions. */\n\tpacketsSent?: number;\n\n\t/** Total packets received, including duplicates. */\n\tpacketsReceived?: number;\n\n\t/** Packets currently declared lost. The estimate can decrease when a loss proves spurious. */\n\tpacketsLost?: number;\n}\n\n/**\n * Estimates measured by the peer and delivered over the MoQ PROBE stream.\n *\n * Pushed rather than pulled: these arrive when the peer sends them, so they're read\n * from a signal. Empty until the first PROBE message, on versions without PROBE\n * (moq-lite-01/02, moq-transport), and again once the stream ends, so a consumer\n * never holds a stale estimate from a dead stream.\n *\n * @public\n */\nexport interface Probe {\n\t/**\n\t * Round-trip time in milliseconds.\n\t *\n\t * The only RTT available today, since browsers don't populate the transport's.\n\t * Measured through the peer's application layer, so it reads higher than a\n\t * transport-level RTT would.\n\t */\n\trtt?: Time.Milli;\n\n\t/** The peer's estimate of the bitrate it is receiving from us, in bits per second. */\n\testimatedRecvRate?: number;\n}\n\n/**\n * The subset of the W3C `WebTransportConnectionStats` dictionary we consume.\n * `getStats()` is not in TypeScript's DOM lib yet, so it is declared here.\n *\n * @internal\n */\nexport interface TransportStats {\n\tsmoothedRtt?: number;\n\testimatedSendRate?: number | null;\n\tbytesSent?: number;\n\tbytesReceived?: number;\n\tbytesLost?: number;\n\tpacketsSent?: number;\n\tpacketsReceived?: number;\n\tpacketsLost?: number;\n}\n\n/**\n * Snapshot `quic` via `getStats()`, or an empty snapshot when the transport doesn't\n * implement it (the qmux/WebSocket fallback, older browsers) or the call fails.\n *\n * @internal\n */\nexport async function transportStats(quic: WebTransport): Promise<Stats> {\n\tconst getStats = (quic as { getStats?: () => Promise<TransportStats> }).getStats;\n\tif (typeof getStats !== \"function\") return {};\n\ttry {\n\t\tconst stats = await getStats.call(quic);\n\t\treturn {\n\t\t\trtt: stats.smoothedRtt !== undefined ? Time.Milli(stats.smoothedRtt) : undefined,\n\t\t\testimatedSendRate: stats.estimatedSendRate ?? undefined,\n\t\t\tbytesSent: stats.bytesSent,\n\t\t\tbytesReceived: stats.bytesReceived,\n\t\t\tbytesLost: stats.bytesLost,\n\t\t\tpacketsSent: stats.packetsSent,\n\t\t\tpacketsReceived: stats.packetsReceived,\n\t\t\tpacketsLost: stats.packetsLost,\n\t\t};\n\t} catch {\n\t\treturn {};\n\t}\n}\n"]}
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../src/connection/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AA2FnC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAkB;IACtD,MAAM,QAAQ,GAAI,IAAqD,CAAC,QAAQ,CAAC;IACjF,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,EAAE,CAAC;IAC9C,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,OAAO;YACN,GAAG,EAAE,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;YAChF,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,SAAS;YACvD,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,WAAW,EAAE,KAAK,CAAC,WAAW;SAC9B,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["/**\n * Connection statistics: what the local transport counts, and what the peer reports.\n *\n * @module\n */\nimport * as Time from \"../time.ts\";\n\n/**\n * A point-in-time snapshot of the transport's counters, from `WebTransport.getStats()`.\n *\n * Pulled on demand rather than pushed: the transport has no event to subscribe to, and\n * a caller computing a rate wants to choose its own sampling instants. Snapshot twice\n * and divide by the interval you measured.\n *\n * Every field is optional. The qmux/WebSocket fallback implements no `getStats()` at\n * all and reports nothing; see {@link Probe} for what the peer measures.\n *\n * The field names match Rust's `moq_net::session::Stats` but the counters keep each\n * stack's own semantics rather than being normalized. Notably W3C excludes\n * retransmissions and QUIC overhead from the byte counts where native QUIC includes\n * them, and counts packets where native QUIC counts datagrams.\n *\n * @public\n */\nexport interface Stats {\n\t/**\n\t * Smoothed round-trip time estimate in milliseconds.\n\t *\n\t * Usually absent: browsers don't report an RTT yet even though the W3C dictionary\n\t * has the field. Use {@link Probe.rtt}, which the peer measures.\n\t */\n\trtt?: Time.Milli;\n\n\t/** Estimated send bandwidth from the congestion controller, in bits per second. */\n\testimatedSendRate?: number;\n\n\t/** Total bytes sent on streams and datagrams, excluding retransmissions and QUIC overhead. */\n\tbytesSent?: number;\n\n\t/** Total bytes received on streams and datagrams, including duplicates, excluding QUIC overhead. */\n\tbytesReceived?: number;\n\n\t/** Bytes currently declared lost. The estimate can decrease when a loss proves spurious. */\n\tbytesLost?: number;\n\n\t/** Total packets sent, including retransmissions. */\n\tpacketsSent?: number;\n\n\t/** Total packets received, including duplicates. */\n\tpacketsReceived?: number;\n\n\t/** Packets currently declared lost. The estimate can decrease when a loss proves spurious. */\n\tpacketsLost?: number;\n}\n\n/**\n * Estimates measured by the peer and delivered over the MoQ PROBE stream.\n *\n * Pushed rather than pulled: these arrive when the peer sends them, so they're read\n * from a signal. Empty until the first PROBE message, on versions without PROBE\n * (moq-lite-01/02, moq-transport), and again once the stream ends, so a consumer\n * never holds a stale estimate from a dead stream.\n *\n * @public\n */\nexport interface Probe {\n\t/**\n\t * Round-trip time in milliseconds.\n\t *\n\t * The only RTT available today, since browsers don't populate the transport's.\n\t * Measured through the peer's application layer, so it reads higher than a\n\t * transport-level RTT would.\n\t */\n\trtt?: Time.Milli;\n\n\t/** The peer's estimate of the bitrate it is receiving from us, in bits per second. */\n\testimatedRecvRate?: number;\n}\n\n/**\n * The subset of the W3C `WebTransportConnectionStats` dictionary we consume.\n * `getStats()` is not in TypeScript's DOM lib yet, so it is declared here.\n *\n * @internal\n */\nexport interface TransportStats {\n\tsmoothedRtt?: number;\n\testimatedSendRate?: number | null;\n\tbytesSent?: number;\n\tbytesReceived?: number;\n\tbytesLost?: number;\n\tpacketsSent?: number;\n\tpacketsReceived?: number;\n\tpacketsLost?: number;\n}\n\n/**\n * Snapshot `quic` via `getStats()`, or an empty snapshot when the transport doesn't\n * implement it (the qmux/WebSocket fallback, older browsers) or the call fails.\n *\n * @internal\n */\nexport async function transportStats(quic: WebTransport): Promise<Stats> {\n\tconst getStats = (quic as { getStats?: () => Promise<TransportStats> }).getStats;\n\tif (typeof getStats !== \"function\") return {};\n\ttry {\n\t\tconst stats = await getStats.call(quic);\n\t\treturn {\n\t\t\trtt: stats.smoothedRtt !== undefined ? Time.Milli(stats.smoothedRtt) : undefined,\n\t\t\testimatedSendRate: stats.estimatedSendRate ?? undefined,\n\t\t\tbytesSent: stats.bytesSent,\n\t\t\tbytesReceived: stats.bytesReceived,\n\t\t\tbytesLost: stats.bytesLost,\n\t\t\tpacketsSent: stats.packetsSent,\n\t\t\tpacketsReceived: stats.packetsReceived,\n\t\t\tpacketsLost: stats.packetsLost,\n\t\t};\n\t} catch {\n\t\treturn {};\n\t}\n}\n"]}
@@ -1,10 +1,3 @@
1
1
  /** The wire transport a session runs over. */
2
2
  export type Transport = "webtransport" | "websocket";
3
- /**
4
- * The transport a live session is actually running over. qmux implements the `WebTransport`
5
- * interface on top of a WebSocket, so the two are indistinguishable by shape.
6
- *
7
- * @internal Not re-exported from the package entrypoint.
8
- */
9
- export declare function transportOf(quic: WebTransport): Transport;
10
3
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/connection/transport.ts"],"names":[],"mappings":"AAEA,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAEzD"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/connection/transport.ts"],"names":[],"mappings":"AAEA,8CAA8C;AAC9C,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,WAAW,CAAC"}
package/consume.d.ts CHANGED
@@ -1,44 +1,2 @@
1
- import type * as broadcast from "./broadcast";
2
- import type * as Path from "./path";
3
- /**
4
- * Per-path dedup cache for consumed broadcasts, shared by the moq-lite and moq-ietf
5
- * subscribers.
6
- *
7
- * `Connection.consume(path)` must not mint a fresh subscription per call: repeat requests
8
- * for the same path (e.g. several renditions referencing one `broadcast: "./source"`) should
9
- * share a single upstream subscription. This mirrors the Rust `origin::Consumer` weak-cache:
10
- * a still-live path resolves to a shared {@link broadcast.Consumer.clone}, a closed one is
11
- * re-consumed on the next request. Each handle is reference-counted, so the shared broadcast
12
- * closes once every caller has closed its handle.
13
- *
14
- * @internal
15
- */
16
- export declare class BroadcastCache {
17
- #private;
18
- /** A shared handle to the live broadcast cached for `path`, or `undefined` on a miss. */
19
- get(path: Path.Valid): broadcast.Consumer | undefined;
20
- /**
21
- * Cache `consumer` as the base handle for `path` (evicting it once it closes) and return it.
22
- * Call on a {@link get} miss, after wiring up the fresh consumer's subscribe loop.
23
- */
24
- insert(path: Path.Valid, consumer: broadcast.Consumer): broadcast.Consumer;
25
- /**
26
- * Stop sharing the broadcast cached for `path`, so the next request subscribes fresh.
27
- *
28
- * Call when the path's advertisement goes away. A handle only leaves the cache on its own
29
- * once *every* holder has closed it, so one holder outliving the publisher (a second
30
- * watcher, or a caller consuming the path directly) would otherwise keep the dead
31
- * generation's cached tracks alive and hand them to whoever consumes the path next.
32
- * Existing handles are left alone: they belong to their holders, and the wire resets
33
- * whatever they still have open.
34
- *
35
- * Eviction is unconditional, which costs a dedup miss when two announcement streams watch
36
- * one path: the second stream's retraction can arrive after the first has already seen the
37
- * replacement, dropping the fresh entry so the next request subscribes again instead of
38
- * sharing. Telling that stale retraction from a live one needs a generation id on the
39
- * advertisement (moq-lite's `Epoch`, not yet on the wire), so until then this errs toward a
40
- * duplicate subscription rather than risk handing out a dead one.
41
- */
42
- evict(path: Path.Valid): void;
43
- }
1
+ export {};
44
2
  //# sourceMappingURL=consume.d.ts.map
package/consume.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"consume.d.ts","sourceRoot":"","sources":["../src/consume.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;;IAI1B,yFAAyF;IACzF,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAIpD;IAED;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAUzE;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAE5B;CACD"}
1
+ {"version":3,"file":"consume.d.ts","sourceRoot":"","sources":["../src/consume.ts"],"names":[],"mappings":""}
package/consume.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Per-path dedup cache for consumed broadcasts, shared by the moq-lite and moq-ietf
4
4
  * subscribers.
5
5
  *
6
- * `Connection.consume(path)` must not mint a fresh subscription per call: repeat requests
6
+ * Resolving the same path must not mint a fresh subscription per call: repeat requests
7
7
  * for the same path (e.g. several renditions referencing one `broadcast: "./source"`) should
8
8
  * share a single upstream subscription. This mirrors the Rust `origin::Consumer` weak-cache:
9
9
  * a still-live path resolves to a shared {@link broadcast.Consumer.clone}, a closed one is
package/consume.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"consume.js","sourceRoot":"","sources":["../src/consume.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAc;IAC1B,wEAAwE;IACxE,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;IAEnD,yFAAyF;IACzF,GAAG,CAAC,IAAgB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAAgB,EAAE,QAA4B;QACpD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEhC,wFAAwF;QACxF,2FAA2F;QAC3F,KAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ;gBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,IAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACD","sourcesContent":["import type * as broadcast from \"./broadcast.ts\";\nimport type * as Path from \"./path.ts\";\n\n/**\n * Per-path dedup cache for consumed broadcasts, shared by the moq-lite and moq-ietf\n * subscribers.\n *\n * `Connection.consume(path)` must not mint a fresh subscription per call: repeat requests\n * for the same path (e.g. several renditions referencing one `broadcast: \"./source\"`) should\n * share a single upstream subscription. This mirrors the Rust `origin::Consumer` weak-cache:\n * a still-live path resolves to a shared {@link broadcast.Consumer.clone}, a closed one is\n * re-consumed on the next request. Each handle is reference-counted, so the shared broadcast\n * closes once every caller has closed its handle.\n *\n * @internal\n */\nexport class BroadcastCache {\n\t// The base handle per path; callers get reference-counted clones of it.\n\t#cache = new Map<Path.Valid, broadcast.Consumer>();\n\n\t/** A shared handle to the live broadcast cached for `path`, or `undefined` on a miss. */\n\tget(path: Path.Valid): broadcast.Consumer | undefined {\n\t\tconst base = this.#cache.get(path);\n\t\tif (base && base.closed.peek() === undefined) return base.clone();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Cache `consumer` as the base handle for `path` (evicting it once it closes) and return it.\n\t * Call on a {@link get} miss, after wiring up the fresh consumer's subscribe loop.\n\t */\n\tinsert(path: Path.Valid, consumer: broadcast.Consumer): broadcast.Consumer {\n\t\tthis.#cache.set(path, consumer);\n\n\t\t// Drop the entry once the broadcast closes (every handle released), so the next request\n\t\t// re-consumes rather than cloning a dead handle. Guard against a newer entry for the path.\n\t\tvoid consumer.closed.then(() => {\n\t\t\tif (this.#cache.get(path) === consumer) this.#cache.delete(path);\n\t\t});\n\n\t\treturn consumer;\n\t}\n\n\t/**\n\t * Stop sharing the broadcast cached for `path`, so the next request subscribes fresh.\n\t *\n\t * Call when the path's advertisement goes away. A handle only leaves the cache on its own\n\t * once *every* holder has closed it, so one holder outliving the publisher (a second\n\t * watcher, or a caller consuming the path directly) would otherwise keep the dead\n\t * generation's cached tracks alive and hand them to whoever consumes the path next.\n\t * Existing handles are left alone: they belong to their holders, and the wire resets\n\t * whatever they still have open.\n\t *\n\t * Eviction is unconditional, which costs a dedup miss when two announcement streams watch\n\t * one path: the second stream's retraction can arrive after the first has already seen the\n\t * replacement, dropping the fresh entry so the next request subscribes again instead of\n\t * sharing. Telling that stale retraction from a live one needs a generation id on the\n\t * advertisement (moq-lite's `Epoch`, not yet on the wire), so until then this errs toward a\n\t * duplicate subscription rather than risk handing out a dead one.\n\t */\n\tevict(path: Path.Valid): void {\n\t\tthis.#cache.delete(path);\n\t}\n}\n"]}
1
+ {"version":3,"file":"consume.js","sourceRoot":"","sources":["../src/consume.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAc;IAC1B,wEAAwE;IACxE,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;IAEnD,yFAAyF;IACzF,GAAG,CAAC,IAAgB;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QAClE,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAAgB,EAAE,QAA4B;QACpD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEhC,wFAAwF;QACxF,2FAA2F;QAC3F,KAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ;gBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,IAAgB;QACrB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACD","sourcesContent":["import type * as broadcast from \"./broadcast.ts\";\nimport type * as Path from \"./path.ts\";\n\n/**\n * Per-path dedup cache for consumed broadcasts, shared by the moq-lite and moq-ietf\n * subscribers.\n *\n * Resolving the same path must not mint a fresh subscription per call: repeat requests\n * for the same path (e.g. several renditions referencing one `broadcast: \"./source\"`) should\n * share a single upstream subscription. This mirrors the Rust `origin::Consumer` weak-cache:\n * a still-live path resolves to a shared {@link broadcast.Consumer.clone}, a closed one is\n * re-consumed on the next request. Each handle is reference-counted, so the shared broadcast\n * closes once every caller has closed its handle.\n *\n * @internal\n */\nexport class BroadcastCache {\n\t// The base handle per path; callers get reference-counted clones of it.\n\t#cache = new Map<Path.Valid, broadcast.Consumer>();\n\n\t/** A shared handle to the live broadcast cached for `path`, or `undefined` on a miss. */\n\tget(path: Path.Valid): broadcast.Consumer | undefined {\n\t\tconst base = this.#cache.get(path);\n\t\tif (base && base.closed.peek() === undefined) return base.clone();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Cache `consumer` as the base handle for `path` (evicting it once it closes) and return it.\n\t * Call on a {@link get} miss, after wiring up the fresh consumer's subscribe loop.\n\t */\n\tinsert(path: Path.Valid, consumer: broadcast.Consumer): broadcast.Consumer {\n\t\tthis.#cache.set(path, consumer);\n\n\t\t// Drop the entry once the broadcast closes (every handle released), so the next request\n\t\t// re-consumes rather than cloning a dead handle. Guard against a newer entry for the path.\n\t\tvoid consumer.closed.then(() => {\n\t\t\tif (this.#cache.get(path) === consumer) this.#cache.delete(path);\n\t\t});\n\n\t\treturn consumer;\n\t}\n\n\t/**\n\t * Stop sharing the broadcast cached for `path`, so the next request subscribes fresh.\n\t *\n\t * Call when the path's advertisement goes away. A handle only leaves the cache on its own\n\t * once *every* holder has closed it, so one holder outliving the publisher (a second\n\t * watcher, or a caller consuming the path directly) would otherwise keep the dead\n\t * generation's cached tracks alive and hand them to whoever consumes the path next.\n\t * Existing handles are left alone: they belong to their holders, and the wire resets\n\t * whatever they still have open.\n\t *\n\t * Eviction is unconditional, which costs a dedup miss when two announcement streams watch\n\t * one path: the second stream's retraction can arrive after the first has already seen the\n\t * replacement, dropping the fresh entry so the next request subscribes again instead of\n\t * sharing. Telling that stale retraction from a live one needs a generation id on the\n\t * advertisement (moq-lite's `Epoch`, not yet on the wire), so until then this errs toward a\n\t * duplicate subscription rather than risk handing out a dead one.\n\t */\n\tevict(path: Path.Valid): void {\n\t\tthis.#cache.delete(path);\n\t}\n}\n"]}
package/error.d.ts CHANGED
@@ -1,69 +1,220 @@
1
1
  /**
2
- * Errors, including the code a peer reports when it resets a stream.
2
+ * Errors, including the code a peer reports when it resets a stream or closes the session.
3
3
  *
4
4
  * @module
5
5
  */
6
+ /** The nominal brand for session termination codes. */
7
+ declare const SESSION_CODE: unique symbol;
8
+ /** A code from the session termination registry. */
9
+ export type SessionCode = number & {
10
+ readonly [SESSION_CODE]: true;
11
+ };
6
12
  /**
7
- * An error the peer reported by resetting a stream, carrying the raw code it sent.
13
+ * Codes a peer sends when terminating the session, mirroring the Rust `Session`.
8
14
  *
9
- * The codes are not standardized, so this deliberately does not translate one into a local
10
- * error: the number means whatever the peer's implementation says it means. A read or write
11
- * rejects with this on every transport, so branch on {@link code} rather than feature-detecting
15
+ * Specified by moq-lite, which reuses moq-transport's codes unchanged. Call `SessionCode(code)`
16
+ * to construct an application code in the 64+ range. {@link StreamCode} is the other registry,
17
+ * and the two are disjoint, so the same integer means different things in each.
18
+ *
19
+ * Codes 32-47 are reserved: nothing is sent there, and the draft gives a received one no
20
+ * meaning, so treat anything not listed below as an unspecified error rather than guessing.
21
+ *
22
+ * @public
23
+ */
24
+ export declare const SessionCode: ((code: number) => SessionCode) & {
25
+ /** Ending the session normally, with no error. */
26
+ readonly Cancel: SessionCode;
27
+ /** Something went wrong that isn't worth a dedicated code. */
28
+ readonly Internal: SessionCode;
29
+ /** The credentials don't grant the requested path or operation. Retrying will fail again. */
30
+ readonly Unauthorized: SessionCode;
31
+ /** A protocol rule was broken; the session is unusable. */
32
+ readonly ProtocolViolation: SessionCode;
33
+ /** A key-value pair was malformed or repeated more than allowed. */
34
+ readonly KeyValueFormatting: SessionCode;
35
+ /** The peer did not close within the GOAWAY drain deadline. */
36
+ readonly GoawayTimeout: SessionCode;
37
+ /** A control message took too long. */
38
+ readonly Timeout: SessionCode;
39
+ /** No version could be negotiated. */
40
+ readonly Version: SessionCode;
41
+ };
42
+ /** The nominal brand for stream reset codes. */
43
+ declare const STREAM_CODE: unique symbol;
44
+ /** A code from the stream reset registry. */
45
+ export type StreamCode = number & {
46
+ readonly [STREAM_CODE]: true;
47
+ };
48
+ /**
49
+ * Codes a peer sends when resetting a stream, mirroring the Rust `Stream`.
50
+ *
51
+ * The counterpart to {@link SessionCode}, and a disjoint space: a stream reset of 0 is
52
+ * {@link StreamCode.Internal}, not a cancellation ({@link StreamCode.Cancel} is 1). Call
53
+ * `StreamCode(code)` to construct an application code in the 64+ range.
54
+ *
55
+ * Conditions the shared codes don't cover are assigned in moq-lite's own 48-63 range, so a
56
+ * received one is the named code. 32 through 47 is reserved: nothing is sent there and a
57
+ * received one is an unspecified error.
58
+ *
59
+ * @public
60
+ */
61
+ export declare const StreamCode: ((code: number) => StreamCode) & {
62
+ /** Something went wrong that isn't worth a dedicated code. */
63
+ readonly Internal: StreamCode;
64
+ /** The sender is done with this stream, not failing. A routine unsubscribe. */
65
+ readonly Cancel: StreamCode;
66
+ /** The content missed its delivery deadline. */
67
+ readonly DeliveryTimeout: StreamCode;
68
+ /** The session ended, taking this stream with it. */
69
+ readonly SessionClosed: StreamCode;
70
+ /** The session is going away (a GOAWAY was received). */
71
+ readonly GoingAway: StreamCode;
72
+ /** The reader fell too far behind and content was dropped to catch up. */
73
+ readonly TooFarBehind: StreamCode;
74
+ /** The track's content could not be parsed. */
75
+ readonly MalformedTrack: StreamCode;
76
+ /** The peer took too long to answer a control request. */
77
+ readonly ControlTimeout: StreamCode;
78
+ /** The requested broadcast or track does not exist at the peer. */
79
+ readonly NotFound: StreamCode;
80
+ /** The group was superseded by a newer one and dropped. */
81
+ readonly Old: StreamCode;
82
+ /** The group was dropped under memory pressure, so it can be re-fetched. */
83
+ readonly Evicted: StreamCode;
84
+ /** A frame declared a payload larger than the receiver accepts. */
85
+ readonly FrameTooLarge: StreamCode;
86
+ /** The publisher could serve this request but has no capacity for it now. */
87
+ readonly NoCapacity: StreamCode;
88
+ /** A group grew past its cache budget and was aborted. */
89
+ readonly GroupTooLarge: StreamCode;
90
+ };
91
+ /**
92
+ * An error the peer reported by closing the session, carrying its {@link SessionCode}.
93
+ *
94
+ * This surfaces on every transport, so catch this type rather than feature-detecting
12
95
  * `WebTransportError`, which a non-browser runtime never defines and the WebSocket fallback
13
96
  * never throws.
14
97
  *
15
- * Code 0 is what a transport sends when a stream is dropped or aborted with no code of its own.
98
+ * ```ts
99
+ * connection.error.subscribe((err) => {
100
+ * if (err instanceof Session && err.code === SessionCode.Unauthorized) {
101
+ * console.warn("server rejected the session");
102
+ * }
103
+ * });
104
+ * ```
105
+ *
106
+ * @public
107
+ */
108
+ export declare class Session extends Error {
109
+ /** The session code the peer sent, verbatim. */
110
+ readonly code: SessionCode;
111
+ constructor(code: SessionCode, options?: {
112
+ cause?: unknown;
113
+ reason?: string;
114
+ });
115
+ }
116
+ /** Options for a {@link Stream}. */
117
+ export interface StreamOptions {
118
+ /** The failure this one wraps. */
119
+ cause?: unknown;
120
+ /** The peer's human-readable reason, appended to the default message. */
121
+ reason?: string;
122
+ /** Replaces the default `remote error: <code>` text, for a condition raised locally. */
123
+ message?: string;
124
+ }
125
+ /**
126
+ * An error carrying a {@link StreamCode}: the code a peer sent when it reset a stream, or the
127
+ * one this side sends when it resets one.
128
+ *
129
+ * This surfaces on every transport, so catch this type rather than feature-detecting
130
+ * `WebTransportError`, which a non-browser runtime never defines and the WebSocket fallback
131
+ * never throws. Local conditions with a code of their own subclass it ({@link TooFarBehind},
132
+ * {@link FrameTooLarge}, {@link GroupTooLarge}, {@link NotFound}), so the same `code` check catches a condition
133
+ * whether it was raised here or reported by the peer.
16
134
  *
17
135
  * ```ts
18
136
  * try {
19
137
  * frame = await group.readFrame();
20
138
  * } catch (err) {
21
- * // Whatever this peer's code 2 means to it.
22
- * if (err instanceof RemoteError && err.code === 2) return;
139
+ * if (err instanceof Stream && err.code === StreamCode.Cancel) return;
23
140
  * throw err;
24
141
  * }
25
142
  * ```
26
143
  *
27
144
  * @public
28
145
  */
29
- export declare class RemoteError extends Error {
30
- /** The code the peer sent, verbatim. */
31
- readonly code: number;
32
- constructor(code: number, options?: {
146
+ export declare class Stream extends Error {
147
+ /** The stream code; moq-lite resets forward it verbatim. */
148
+ readonly code: StreamCode;
149
+ constructor(code: StreamCode, options?: StreamOptions);
150
+ }
151
+ /**
152
+ * The reader asked for a frame the group never held, so the stream has a gap.
153
+ *
154
+ * Raised locally by a frame read, and decoded from a moq-lite peer's `TOO_FAR_BEHIND` reset, since a gap
155
+ * reads the same either way.
156
+ *
157
+ * @public
158
+ */
159
+ export declare class TooFarBehind extends Stream {
160
+ constructor(options?: {
33
161
  cause?: unknown;
34
162
  });
35
163
  }
36
164
  /**
37
- * A peer broke the protocol in a way the spec says must end the session.
165
+ * A frame is larger than a group can cache, so appending it would exceed the budget by itself.
38
166
  *
39
- * Thrown where the violation is detected, rather than handled there: a decoder has no session
40
- * to close. The dispatch that owns the session watches for it and closes, so a nonconforming
41
- * peer cannot repeat the violation on the next stream.
167
+ * Raised locally by a frame write, and decoded from a moq-lite peer's `FRAME_TOO_LARGE` reset.
168
+ * Mirrors the Rust `Error::FrameTooLarge`, which rejects the same frame before touching any state.
42
169
  *
43
- * @internal
170
+ * @public
44
171
  */
45
- export declare class ProtocolViolation extends Error {
46
- constructor(message: string, options?: {
172
+ export declare class FrameTooLarge extends Stream {
173
+ constructor(options?: {
47
174
  cause?: unknown;
48
175
  });
49
176
  }
50
177
  /**
51
- * Decode a transport failure into a {@link RemoteError} error when it carries a stream reset code,
52
- * otherwise pass it through.
178
+ * A write grew the group past its cache budget, so the group is aborted.
53
179
  *
54
- * Native WebTransport rejects with a `WebTransportError`; the WebSocket fallback mints an error
55
- * with the same `source`/`streamErrorCode` fields. Reading the fields rather than the class
56
- * covers both, and works in a runtime with no `WebTransportError` at all.
180
+ * Raised locally by a frame write, and decoded from a moq-lite peer's `GROUP_TOO_LARGE`
181
+ * reset. Mirrors the Rust `Error::GroupTooLarge`.
57
182
  *
58
- * @internal Called at the transport boundary so the raw error never reaches an application.
183
+ * @public
59
184
  */
60
- export declare function fromTransport(err: unknown): Error;
185
+ export declare class GroupTooLarge extends Stream {
186
+ constructor(options?: {
187
+ cause?: unknown;
188
+ });
189
+ }
61
190
  /**
62
- * Coerce an unknown thrown value into an `Error`.
191
+ * The requested broadcast or track is not served here.
63
192
  *
64
- * @internal
193
+ * @public
65
194
  */
66
- export declare function error(err: unknown): Error;
195
+ export declare class NotFound extends Stream {
196
+ constructor(what: string, options?: {
197
+ cause?: unknown;
198
+ });
199
+ }
200
+ /**
201
+ * A peer broke the protocol in a way the spec says must end the session.
202
+ *
203
+ * Thrown where the violation is detected, rather than handled there: a decoder has no session
204
+ * to close. The dispatch that owns the session watches for it and closes, so a nonconforming
205
+ * peer cannot repeat the violation on the next stream.
206
+ *
207
+ * @public
208
+ */
209
+ export declare class ProtocolViolation extends Error {
210
+ constructor(message: string, options?: {
211
+ cause?: unknown;
212
+ });
213
+ }
214
+ /** Package-internal compatibility names used by the wire implementation. */
215
+ export { Session as SessionError, Stream as StreamError, TooFarBehind as Lagged };
216
+ /** Package-internal compatibility name used by the wire implementation. */
217
+ export type StreamErrorOptions = StreamOptions;
67
218
  /**
68
219
  * Format an error into a non-empty, human-readable string for logging.
69
220
  *
package/error.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACrC,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAItD;CACD;AAED;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC3C,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACD;AAcD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAIjD;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAa3C"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"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"}