@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forward.d.ts","sourceRoot":"","sources":["../../src/connection/forward.ts"],"names":[],"mappings":""}
@@ -0,0 +1,166 @@
1
+ /* @ts-self-types="./forward.d.ts" */
2
+ /**
3
+ * Feeds a session's announced routes into an origin; the `consume` connect option.
4
+ *
5
+ * @module
6
+ */
7
+ import { race } from "@moq/signals";
8
+ import { isActive } from "../announced.js";
9
+ import { wireOf } from "../wire.js";
10
+ /**
11
+ * Wire a session into `origin` for the session's lifetime: forward the peer's announced
12
+ * routes into the table, and answer the origin's open requests with blind
13
+ * subscriptions.
14
+ *
15
+ * Each active announcement inserts a route covering the announced prefix, served
16
+ * lazily through this connection, so nothing touches the wire until somebody requests
17
+ * a path under it. A retraction removes the entry, and so does the session dying (the
18
+ * announce stream ends with it), which is what scopes remote routes to the session
19
+ * that announced them. A reconnect wires a fresh session to the same origin and
20
+ * re-populates it.
21
+ *
22
+ * Without discovery there are no announcements to forward, so the table stays empty and
23
+ * requests are the only way through; see the origin's `request`.
24
+ *
25
+ * @internal
26
+ */
27
+ export function forwardAnnounced(conn, origin) {
28
+ const originWire = wireOf(origin);
29
+ // Reassigned if discovery dies under a live session, so the origin stops counting this
30
+ // one as a discovering session. Called through a closure so the session's death always
31
+ // detaches whichever attachment is current.
32
+ let detach = originWire.attach(conn.discovery);
33
+ let dead = false;
34
+ void conn.closed.then(() => {
35
+ dead = true;
36
+ detach();
37
+ });
38
+ void serveRequests(conn, origin);
39
+ if (!conn.discovery) {
40
+ console.warn("relay does not support broadcast discovery; broadcasts resolve on request only.");
41
+ return;
42
+ }
43
+ // Hidden routes are mirrored too; each local reader opts in on its own.
44
+ const announced = conn.announced(undefined, { hidden: true });
45
+ const inserted = new Map();
46
+ // End the stream the moment the session closes rather than waiting for the wire to
47
+ // error it, so the retractions below land promptly.
48
+ void conn.closed.then(() => announced.close());
49
+ void (async () => {
50
+ let failure;
51
+ try {
52
+ for (;;) {
53
+ const event = await announced.next();
54
+ if (!event)
55
+ break;
56
+ if (isActive(event.kind)) {
57
+ const existing = inserted.get(event.prefix);
58
+ if (existing) {
59
+ existing.update(event.route);
60
+ }
61
+ else {
62
+ const handle = originWire.receive(event.prefix, event.route);
63
+ inserted.set(event.prefix, handle);
64
+ void drive(handle, conn);
65
+ }
66
+ }
67
+ else {
68
+ const handle = inserted.get(event.prefix);
69
+ inserted.delete(event.prefix);
70
+ handle?.close();
71
+ }
72
+ }
73
+ }
74
+ catch (err) {
75
+ // The session died mid-stream, or the relay refused or reset the stream. The
76
+ // cleanup below retracts everything this stream fed either way.
77
+ failure = err;
78
+ }
79
+ finally {
80
+ for (const handle of inserted.values())
81
+ handle.close();
82
+ inserted.clear();
83
+ announced.close();
84
+ // Discovery ended while the session lives, and nothing reopens the stream on this
85
+ // connection. Downgrade the attachment rather than leaving the origin claiming a
86
+ // discovery that no longer works: announcement-gated consumers would wait forever
87
+ // on a table this session can no longer fill. Now they fall back to standing
88
+ // requests, which this session still answers.
89
+ if (!dead) {
90
+ console.warn("broadcast discovery failed; broadcasts resolve on request only.", failure);
91
+ detach();
92
+ detach = originWire.attach(false);
93
+ }
94
+ }
95
+ })();
96
+ }
97
+ /**
98
+ * Answer the origin's open requests with blind subscriptions for the session's lifetime.
99
+ *
100
+ * Every session answers, discovery or not: subscribing to an unannounced path is always
101
+ * legal, and a missing broadcast surfaces as a reset on the first track. The first session
102
+ * to answer wins; when this session dies its answers are withdrawn so a later session
103
+ * answers again, which is what makes a request span reconnects.
104
+ *
105
+ * A path the table already routes is left alone. A request resolves to the table's route over
106
+ * any blind answer, so answering one would only park a handle nothing reads.
107
+ */
108
+ async function drive(handle, conn) {
109
+ const session = wireOf(conn);
110
+ try {
111
+ for await (const request of handle.requested()) {
112
+ request.accept(session.consume(request.path));
113
+ }
114
+ }
115
+ catch {
116
+ handle.close();
117
+ }
118
+ }
119
+ async function serveRequests(conn, origin) {
120
+ const table = wireOf(origin);
121
+ const session = wireOf(conn);
122
+ // The withdraws for the answers this session provided, so a dead session only takes
123
+ // back its own. Keyed by path but remembering the slot, because a path outlives its
124
+ // slot: the last handle closing tears the slot down and a new request installs a fresh
125
+ // one, and those two writes coalesce into a single wakeup. Matching on the path alone
126
+ // would read the new slot as already answered and leave it unanswered forever.
127
+ const answered = new Map();
128
+ let dead = false;
129
+ const closed = conn.closed.then(() => {
130
+ dead = true;
131
+ });
132
+ for (;;) {
133
+ const map = table.requests.peek();
134
+ if (!map || dead)
135
+ break;
136
+ for (const [path, slot] of map) {
137
+ if (slot.blind === 0)
138
+ continue;
139
+ if (answered.get(path)?.slot === slot || slot.answer !== undefined)
140
+ continue;
141
+ if (table.routes(path))
142
+ continue;
143
+ const withdraw = table.answer(path, session.consume(path));
144
+ if (withdraw)
145
+ answered.set(path, { slot, withdraw });
146
+ }
147
+ // A withdrawn request already released the answer; just forget our claim on the path.
148
+ // A replaced slot counts as withdrawn: the answer we hold belongs to the slot that
149
+ // went away, not to whatever now occupies the path.
150
+ for (const [path, entry] of [...answered]) {
151
+ if (map.get(path) === entry.slot && entry.slot.blind > 0)
152
+ continue;
153
+ answered.delete(path);
154
+ entry.withdraw();
155
+ }
156
+ // Woken by the table too, not just the requests: a path that stops being routed needs
157
+ // the blind answer this loop skipped while it was.
158
+ await race([table.changed(), closed]);
159
+ }
160
+ // Session gone: withdraw our answers, waking a standby session to provide fresh ones.
161
+ for (const { withdraw } of answered.values()) {
162
+ withdraw();
163
+ }
164
+ answered.clear();
165
+ }
166
+ //# sourceMappingURL=forward.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forward.js","sourceRoot":"","sources":["../../src/connection/forward.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAgB,IAAI,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAiB,EAAE,MAAsB;IACzE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,uFAAuF;IACvF,uF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IAAI,CAAC,CAAC,CAAC;YAC3D,IAAI,QAAQ;gBAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtD,CAAC;QAED,sFAAsF;QACtF,mFAAmF;QACnF,oDAAoD;QACpD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC;gBAAE,SAAS;YACnE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACtB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;QAED,sFAAsF;QACtF,mDAAmD;QACnD,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,sFAAsF;IACtF,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QAC9C,QAAQ,EAAE,CAAC;IACZ,CAAC;IACD,QAAQ,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC","sourcesContent":["/**\n * Feeds a session's announced routes into an origin; the `consume` connect option.\n *\n * @module\n */\nimport { type Dispose, race } from \"@moq/signals\";\nimport { isActive } from \"../announced.ts\";\nimport type { Dynamic, Producer as OriginProducer, RequestSlot } from \"../origin.ts\";\nimport type * as Path from \"../path.ts\";\nimport { wireOf } from \"../wire.ts\";\nimport type { Established } from \"./established.ts\";\n\n/**\n * Wire a session into `origin` for the session's lifetime: forward the peer's announced\n * routes into the table, and answer the origin's open requests with blind\n * subscriptions.\n *\n * Each active announcement inserts a route covering the announced prefix, served\n * lazily through this connection, so nothing touches the wire until somebody requests\n * a path under it. A retraction removes the entry, and so does the session dying (the\n * announce stream ends with it), which is what scopes remote routes to the session\n * that announced them. A reconnect wires a fresh session to the same origin and\n * re-populates it.\n *\n * Without discovery there are no announcements to forward, so the table stays empty and\n * requests are the only way through; see the origin's `request`.\n *\n * @internal\n */\nexport function forwardAnnounced(conn: Established, origin: OriginProducer): void {\n\tconst originWire = wireOf(origin);\n\t// Reassigned if discovery dies under a live session, so the origin stops counting this\n\t// one as a discovering session. Called through a closure so the session's death always\n\t// detaches whichever attachment is current.\n\tlet detach = originWire.attach(conn.discovery);\n\n\tlet dead = false;\n\tvoid conn.closed.then(() => {\n\t\tdead = true;\n\t\tdetach();\n\t});\n\n\tvoid serveRequests(conn, origin);\n\n\tif (!conn.discovery) {\n\t\tconsole.warn(\"relay does not support broadcast discovery; broadcasts resolve on request only.\");\n\t\treturn;\n\t}\n\n\t// Hidden routes are mirrored too; each local reader opts in on its own.\n\tconst announced = conn.announced(undefined, { hidden: true });\n\tconst inserted = new Map<Path.Valid, Dynamic>();\n\n\t// End the stream the moment the session closes rather than waiting for the wire to\n\t// error it, so the retractions below land promptly.\n\tvoid conn.closed.then(() => announced.close());\n\n\tvoid (async () => {\n\t\tlet failure: unknown;\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst event = await announced.next();\n\t\t\t\tif (!event) break;\n\n\t\t\t\tif (isActive(event.kind)) {\n\t\t\t\t\tconst existing = inserted.get(event.prefix);\n\t\t\t\t\tif (existing) {\n\t\t\t\t\t\texisting.update(event.route);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst handle = originWire.receive(event.prefix, event.route);\n\t\t\t\t\t\tinserted.set(event.prefix, handle);\n\t\t\t\t\t\tvoid drive(handle, conn);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst handle = inserted.get(event.prefix);\n\t\t\t\t\tinserted.delete(event.prefix);\n\t\t\t\t\thandle?.close();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// The session died mid-stream, or the relay refused or reset the stream. The\n\t\t\t// cleanup below retracts everything this stream fed either way.\n\t\t\tfailure = err;\n\t\t} finally {\n\t\t\tfor (const handle of inserted.values()) handle.close();\n\t\t\tinserted.clear();\n\t\t\tannounced.close();\n\n\t\t\t// Discovery ended while the session lives, and nothing reopens the stream on this\n\t\t\t// connection. Downgrade the attachment rather than leaving the origin claiming a\n\t\t\t// discovery that no longer works: announcement-gated consumers would wait forever\n\t\t\t// on a table this session can no longer fill. Now they fall back to standing\n\t\t\t// requests, which this session still answers.\n\t\t\tif (!dead) {\n\t\t\t\tconsole.warn(\"broadcast discovery failed; broadcasts resolve on request only.\", failure);\n\t\t\t\tdetach();\n\t\t\t\tdetach = originWire.attach(false);\n\t\t\t}\n\t\t}\n\t})();\n}\n\n/**\n * Answer the origin's open requests with blind subscriptions for the session's lifetime.\n *\n * Every session answers, discovery or not: subscribing to an unannounced path is always\n * legal, and a missing broadcast surfaces as a reset on the first track. The first session\n * to answer wins; when this session dies its answers are withdrawn so a later session\n * answers again, which is what makes a request span reconnects.\n *\n * A path the table already routes is left alone. A request resolves to the table's route over\n * any blind answer, so answering one would only park a handle nothing reads.\n */\nasync function drive(handle: Dynamic, conn: Established): Promise<void> {\n\tconst session = wireOf(conn);\n\ttry {\n\t\tfor await (const request of handle.requested()) {\n\t\t\trequest.accept(session.consume(request.path));\n\t\t}\n\t} catch {\n\t\thandle.close();\n\t}\n}\n\nasync function serveRequests(conn: Established, origin: OriginProducer): Promise<void> {\n\tconst table = wireOf(origin);\n\tconst session = wireOf(conn);\n\t// The withdraws for the answers this session provided, so a dead session only takes\n\t// back its own. Keyed by path but remembering the slot, because a path outlives its\n\t// slot: the last handle closing tears the slot down and a new request installs a fresh\n\t// one, and those two writes coalesce into a single wakeup. Matching on the path alone\n\t// would read the new slot as already answered and leave it unanswered forever.\n\tconst answered = new Map<Path.Valid, { slot: RequestSlot; withdraw: Dispose }>();\n\n\tlet dead = false;\n\tconst closed = conn.closed.then(() => {\n\t\tdead = true;\n\t});\n\n\tfor (;;) {\n\t\tconst map = table.requests.peek();\n\t\tif (!map || dead) break;\n\n\t\tfor (const [path, slot] of map) {\n\t\t\tif (slot.blind === 0) continue;\n\t\t\tif (answered.get(path)?.slot === slot || slot.answer !== undefined) continue;\n\t\t\tif (table.routes(path)) continue;\n\t\t\tconst withdraw = table.answer(path, session.consume(path));\n\t\t\tif (withdraw) answered.set(path, { slot, withdraw });\n\t\t}\n\n\t\t// A withdrawn request already released the answer; just forget our claim on the path.\n\t\t// A replaced slot counts as withdrawn: the answer we hold belongs to the slot that\n\t\t// went away, not to whatever now occupies the path.\n\t\tfor (const [path, entry] of [...answered]) {\n\t\t\tif (map.get(path) === entry.slot && entry.slot.blind > 0) continue;\n\t\t\tanswered.delete(path);\n\t\t\tentry.withdraw();\n\t\t}\n\n\t\t// Woken by the table too, not just the requests: a path that stops being routed needs\n\t\t// the blind answer this loop skipped while it was.\n\t\tawait race([table.changed(), closed]);\n\t}\n\n\t// Session gone: withdraw our answers, waking a standby session to provide fresh ones.\n\tfor (const { withdraw } of answered.values()) {\n\t\twithdraw();\n\t}\n\tanswered.clear();\n}\n"]}
@@ -16,6 +16,7 @@ import { Stream } from "../stream";
16
16
  export declare function exchangeSetup(transport: WebTransport, version: Ietf.IetfVersion, implementation: string): Promise<{
17
17
  control: Stream;
18
18
  solicit: boolean | undefined;
19
+ hidden: boolean;
19
20
  cluster: Ietf.Cluster.Hops;
20
21
  }>;
21
22
  //# sourceMappingURL=handshake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAU,MAAM,EAAU,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;CAAE,CAAC,CAuBxF"}
1
+ {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAU,MAAM,EAAU,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;CAAE,CAAC,CAyBzG"}
@@ -1,6 +1,6 @@
1
1
  /* @ts-self-types="./handshake.d.ts" */
2
+ import { randomHop } from "../hop.js";
2
3
  import * as Ietf from "../ietf/index.js";
3
- import { randomOrigin } from "../origin.js";
4
4
  import { Reader, Stream, Writer } from "../stream.js";
5
5
  /**
6
6
  * Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup
@@ -20,9 +20,10 @@ export async function exchangeSetup(transport, version, implementation) {
20
20
  const params = new Ietf.SetupOptions();
21
21
  params.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));
22
22
  Ietf.solicitIntoSetup(params);
23
+ Ietf.hiddenIntoSetup(params);
23
24
  // One id per session, like the moq-lite connection: nothing in this process forwards
24
25
  // between sessions, so there is nothing for a shared id to detect.
25
- const self = randomOrigin();
26
+ const self = randomHop();
26
27
  Ietf.Cluster.intoSetup(params, self, version);
27
28
  const setupMsg = new Ietf.Setup({ parameters: params });
28
29
  const [writer, received] = await Promise.all([
@@ -32,6 +33,7 @@ export async function exchangeSetup(transport, version, implementation) {
32
33
  return {
33
34
  control: new Stream({ writer, reader: received.reader }),
34
35
  solicit: received.solicit,
36
+ hidden: received.hidden,
35
37
  cluster: { self, peer: received.cluster },
36
38
  };
37
39
  }
@@ -58,6 +60,7 @@ async function receiveSetup(transport, version) {
58
60
  return {
59
61
  reader,
60
62
  solicit: Ietf.solicitFromSetup(setup.parameters),
63
+ hidden: Ietf.hiddenFromSetup(setup.parameters),
61
64
  cluster: Ietf.Cluster.fromSetup(setup.parameters, version),
62
65
  };
63
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,SAAuB,EACvB,OAAyB,EACzB,cAAsB;IAEtB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IACjF,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE9B,qFAAqF;IACrF,mEAAmE;IACnE,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,MAA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C;IAE1D,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;IACtC,IAAI,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,0CAA0C,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvD,OAAO;QACN,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;QAChD,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;KAC1D,CAAC;AACH,CAAC","sourcesContent":["import * as Ietf from \"../ietf/index.ts\";\nimport { type Origin, randomOrigin } from \"../origin.ts\";\nimport { Reader, Stream, Writer } from \"../stream.ts\";\n\n/**\n * Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup\n * message, and reads the peer's Setup off an incoming uni stream. The two\n * halves run in parallel and the protocol is symmetric, so both `connect`\n * (client) and `accept` (server) use this same function.\n *\n * Returns the control stream plus what the peer's SETUP declared: whether it requires\n * solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit\n * extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on\n * every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited\n * advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop\n * ID can withhold the advertisements that already flowed through us.\n */\nexport async function exchangeSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n\timplementation: string,\n): Promise<{ control: Stream; solicit: boolean | undefined; cluster: Ietf.Cluster.Hops }> {\n\tconst encoder = new TextEncoder();\n\tconst params = new Ietf.SetupOptions();\n\tparams.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));\n\tIetf.solicitIntoSetup(params);\n\n\t// One id per session, like the moq-lite connection: nothing in this process forwards\n\t// between sessions, so there is nothing for a shared id to detect.\n\tconst self = randomOrigin();\n\tIetf.Cluster.intoSetup(params, self, version);\n\n\tconst setupMsg = new Ietf.Setup({ parameters: params });\n\n\tconst [writer, received] = await Promise.all([\n\t\tsendSetup(transport, version, setupMsg),\n\t\treceiveSetup(transport, version),\n\t]);\n\n\treturn {\n\t\tcontrol: new Stream({ writer, reader: received.reader }),\n\t\tsolicit: received.solicit,\n\t\tcluster: { self, peer: received.cluster },\n\t};\n}\n\nasync function sendSetup(transport: WebTransport, version: Ietf.IetfVersion, setupMsg: Ietf.Setup): Promise<Writer> {\n\t// Via Writer.open for its deadline: a peer can advertise a stream limit of zero and\n\t// never raise it, which would otherwise hang the handshake rather than failing it.\n\tconst writer = await Writer.open(transport, { version });\n\tawait writer.u53(Ietf.Setup.id); // 0x2F00 stream type\n\tawait setupMsg.encode(writer, version);\n\treturn writer;\n}\n\nasync function receiveSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n): Promise<{ reader: Reader; solicit: boolean | undefined; cluster: Origin | undefined }> {\n\tconst uniReader = transport.incomingUnidirectionalStreams.getReader() as ReadableStreamDefaultReader<\n\t\tReadableStream<Uint8Array>\n\t>;\n\tconst next = await uniReader.read();\n\tuniReader.releaseLock();\n\tif (next.done) throw new Error(\"no incoming uni stream for SETUP\");\n\n\tconst reader = new Reader(next.value, undefined, version);\n\n\tconst streamType = await reader.u53();\n\tif (streamType !== Ietf.Setup.id) {\n\t\tthrow new Error(`unexpected stream type on setup uni: 0x${streamType.toString(16)}`);\n\t}\n\tconst setup = await Ietf.Setup.decode(reader, version);\n\n\treturn {\n\t\treader,\n\t\tsolicit: Ietf.solicitFromSetup(setup.parameters),\n\t\tcluster: Ietf.Cluster.fromSetup(setup.parameters, version),\n\t};\n}\n"]}
1
+ {"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/connection/handsh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MAAM;QACN,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC;QAC9C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;KAC1D,CAAC;AACH,CAAC","sourcesContent":["import { type Hop, randomHop } from \"../hop.ts\";\nimport * as Ietf from \"../ietf/index.ts\";\nimport { Reader, Stream, Writer } from \"../stream.ts\";\n\n/**\n * Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup\n * message, and reads the peer's Setup off an incoming uni stream. The two\n * halves run in parallel and the protocol is symmetric, so both `connect`\n * (client) and `accept` (server) use this same function.\n *\n * Returns the control stream plus what the peer's SETUP declared: whether it requires\n * solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit\n * extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on\n * every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited\n * advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop\n * ID can withhold the advertisements that already flowed through us.\n */\nexport async function exchangeSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n\timplementation: string,\n): Promise<{ control: Stream; solicit: boolean | undefined; hidden: boolean; cluster: Ietf.Cluster.Hops }> {\n\tconst encoder = new TextEncoder();\n\tconst params = new Ietf.SetupOptions();\n\tparams.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));\n\tIetf.solicitIntoSetup(params);\n\tIetf.hiddenIntoSetup(params);\n\n\t// One id per session, like the moq-lite connection: nothing in this process forwards\n\t// between sessions, so there is nothing for a shared id to detect.\n\tconst self = randomHop();\n\tIetf.Cluster.intoSetup(params, self, version);\n\n\tconst setupMsg = new Ietf.Setup({ parameters: params });\n\n\tconst [writer, received] = await Promise.all([\n\t\tsendSetup(transport, version, setupMsg),\n\t\treceiveSetup(transport, version),\n\t]);\n\n\treturn {\n\t\tcontrol: new Stream({ writer, reader: received.reader }),\n\t\tsolicit: received.solicit,\n\t\thidden: received.hidden,\n\t\tcluster: { self, peer: received.cluster },\n\t};\n}\n\nasync function sendSetup(transport: WebTransport, version: Ietf.IetfVersion, setupMsg: Ietf.Setup): Promise<Writer> {\n\t// Via Writer.open for its deadline: a peer can advertise a stream limit of zero and\n\t// never raise it, which would otherwise hang the handshake rather than failing it.\n\tconst writer = await Writer.open(transport, { version });\n\tawait writer.u53(Ietf.Setup.id); // 0x2F00 stream type\n\tawait setupMsg.encode(writer, version);\n\treturn writer;\n}\n\nasync function receiveSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n): Promise<{ reader: Reader; solicit: boolean | undefined; hidden: boolean; cluster: Hop | undefined }> {\n\tconst uniReader = transport.incomingUnidirectionalStreams.getReader() as ReadableStreamDefaultReader<\n\t\tReadableStream<Uint8Array>\n\t>;\n\tconst next = await uniReader.read();\n\tuniReader.releaseLock();\n\tif (next.done) throw new Error(\"no incoming uni stream for SETUP\");\n\n\tconst reader = new Reader(next.value, undefined, version);\n\n\tconst streamType = await reader.u53();\n\tif (streamType !== Ietf.Setup.id) {\n\t\tthrow new Error(`unexpected stream type on setup uni: 0x${streamType.toString(16)}`);\n\t}\n\tconst setup = await Ietf.Setup.decode(reader, version);\n\n\treturn {\n\t\treader,\n\t\tsolicit: Ietf.solicitFromSetup(setup.parameters),\n\t\thidden: Ietf.hiddenFromSetup(setup.parameters),\n\t\tcluster: Ietf.Cluster.fromSetup(setup.parameters, version),\n\t};\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Connection helpers: connect to or accept a MoQ session and reconnect on failure.
2
+ * A reconnecting, shareable handle on a MoQ session, plus one-shot connect/accept.
3
3
  *
4
4
  * @module
5
5
  */
6
- export * from "./accept";
6
+ export { type AcceptProps, accept } from "./accept";
7
7
  export { isWebTransportSupported } from "./browser";
8
- export * from "./connect";
9
- export * from "./established";
10
- export * from "./reload";
8
+ export { type CertificateHash, type ConnectProps, certificateHash, connect, type WebSocketProps, type WebTransportProps, } from "./connect";
9
+ export type { Established } from "./established";
10
+ export { Connection, type ConnectionProps } from "./pool";
11
11
  export type { Probe, Stats } from "./stats";
12
12
  export type { Transport } from "./transport";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,eAAe,EACf,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACtB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7D,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,12 +1,11 @@
1
1
  /* @ts-self-types="./index.d.ts" */
2
2
  /**
3
- * Connection helpers: connect to or accept a MoQ session and reconnect on failure.
3
+ * A reconnecting, shareable handle on a MoQ session, plus one-shot connect/accept.
4
4
  *
5
5
  * @module
6
6
  */
7
- export * from "./accept.js";
7
+ export { accept } from "./accept.js";
8
8
  export { isWebTransportSupported } from "./browser.js";
9
- export * from "./connect.js";
10
- export * from "./established.js";
11
- export * from "./reload.js";
9
+ export { certificateHash, connect, } from "./connect.js";
10
+ export { Connection } from "./pool.js";
12
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC","sourcesContent":["/**\n * Connection helpers: connect to or accept a MoQ session and reconnect on failure.\n *\n * @module\n */\nexport * from \"./accept.ts\";\nexport { isWebTransportSupported } from \"./browser.ts\";\nexport * from \"./connect.ts\";\nexport * from \"./established.ts\";\nexport * from \"./reload.ts\";\nexport type { Probe, Stats } from \"./stats.ts\";\nexport type { Transport } from \"./transport.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAoB,MAAM,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAGN,eAAe,EACf,OAAO,GAGP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAwB,MAAM,WAAW,CAAC","sourcesContent":["/**\n * A reconnecting, shareable handle on a MoQ session, plus one-shot connect/accept.\n *\n * @module\n */\nexport { type AcceptProps, accept } from \"./accept.ts\";\nexport { isWebTransportSupported } from \"./browser.ts\";\nexport {\n\ttype CertificateHash,\n\ttype ConnectProps,\n\tcertificateHash,\n\tconnect,\n\ttype WebSocketProps,\n\ttype WebTransportProps,\n} from \"./connect.ts\";\nexport type { Established } from \"./established.ts\";\nexport { Connection, type ConnectionProps } from \"./pool.ts\";\nexport type { Probe, Stats } from \"./stats.ts\";\nexport type { Transport } from \"./transport.ts\";\n"]}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * A reconnecting, shareable connection: one origin and one reconnect loop per relay URL.
3
+ *
4
+ * @module
5
+ */
6
+ import { type GetPromise, type Getter, Signal } from "@moq/signals";
7
+ import * as Announce from "../announced";
8
+ import type { Handle } from "../bandwidth";
9
+ import * as Origin from "../origin";
10
+ import * as Path from "../path";
11
+ import * as Time from "../time";
12
+ import { type AcceptProps as AcceptPropsType, accept } from "./accept";
13
+ import { isWebTransportSupported } from "./browser";
14
+ import { type CertificateHash as CertificateHashType, type ConnectProps as ConnectPropsType, certificateHash, connect, type WebSocketProps as WebSocketPropsType, type WebTransportProps as WebTransportPropsType } from "./connect";
15
+ import type { Established as EstablishedType } from "./established";
16
+ import { type ReloadDelay, type ReloadStatus } from "./reload";
17
+ import type { Probe as ProbeType, Stats as StatsType } from "./stats";
18
+ import type { Transport as TransportType } from "./transport";
19
+ /** Options for {@link Connection}. */
20
+ export interface ConnectionProps {
21
+ /** The relay to connect to; pass a `Signal` to switch relays live. */
22
+ url?: URL | Signal<URL | undefined>;
23
+ /** Whether to connect at all (default: true); pass a `Signal` to toggle live. */
24
+ enabled?: boolean | Signal<boolean>;
25
+ /**
26
+ * How long the underlying connection outlives its last handle (default: 2000ms).
27
+ *
28
+ * The window is what makes moving an element around the DOM free: the connection and
29
+ * everything it discovered are still warm when the new owner asks for them. The longest
30
+ * linger requested by any handle sharing the connection wins.
31
+ */
32
+ linger?: Time.Milli;
33
+ /**
34
+ * Share a pooled transport keyed on the URL. By default, options specific to this
35
+ * handle use a private reconnect loop; otherwise connections share by URL.
36
+ * Explicit `true` refuses options a pool cannot honor.
37
+ */
38
+ share?: boolean;
39
+ /** WebTransport options applied to each connection attempt (not reactive). */
40
+ webtransport?: WebTransportPropsType;
41
+ /** WebSocket fallback options applied to each connection attempt (not reactive). */
42
+ websocket?: WebSocketPropsType;
43
+ /** Whether the relay supports broadcast discovery. */
44
+ discovery?: boolean;
45
+ /** The origin whose broadcasts are served, spanning reconnects. Implies a private loop. */
46
+ publish?: Origin.Consumer;
47
+ /** The origin fed with the peer's announced broadcasts, spanning reconnects. Implies a private loop. */
48
+ consume?: Origin.Producer;
49
+ /** Backoff settings for the reconnect loop; an unset field uses its default. */
50
+ delay?: ReloadDelay;
51
+ /** A Connection owns the abort signal for each connection attempt. */
52
+ signal?: never;
53
+ /** A one-shot transport cannot be reused by the reconnect loop; call {@link Connection.connect} instead. */
54
+ transport?: never;
55
+ }
56
+ /**
57
+ * A cloneable handle on a MoQ connection: `new Connection({ url })` reconnects and, by
58
+ * default, shares one origin and one reconnect loop with every other handle on that URL.
59
+ *
60
+ * The shared {@link origin} is wired to both directions. Everything the relay announces
61
+ * lands in it, a publish into it is announced to the relay, and a page that publishes and
62
+ * watches the same path resolves it locally with no round trip.
63
+ *
64
+ * {@link close} releases this handle; the connection survives its last handle by a short
65
+ * linger window (see {@link ConnectionProps.linger}), so a component torn down and rebuilt
66
+ * reuses the warm connection instead of redialing.
67
+ *
68
+ * The loop reconnects for as long as a handle holds it, so an outage of any length recovers
69
+ * on its own. An auth rejection stops retrying those credentials and retires the shared
70
+ * connection so the next handle dials fresh; a new URL on this handle starts another
71
+ * sequence. {@link closed} settles only when this handle is released.
72
+ *
73
+ * Options the pool cannot honor (transport options, discovery, delay, a pinned
74
+ * certificate, caller-owned origins) use a private loop. An explicit `share: true`
75
+ * refuses them. A supplied transport cannot reconnect at all; pass it to {@link Connection.connect}
76
+ * instead.
77
+ *
78
+ * @public
79
+ */
80
+ export declare class Connection {
81
+ #private;
82
+ /** Establish a one-shot session; a supplied transport belongs here, not in the reconnect loop. */
83
+ static readonly connect: typeof connect;
84
+ /** Accept a one-shot session on an already-open transport. */
85
+ static readonly accept: typeof accept;
86
+ /** SHA-256 of a certificate, for pinning via `webtransport.serverCertificateHashes`. */
87
+ static readonly certificateHash: typeof certificateHash;
88
+ /** Whether this runtime can connect with WebTransport. */
89
+ static readonly isWebTransportSupported: typeof isWebTransportSupported;
90
+ /** Relay URL to connect to; updating it reconnects to that URL. */
91
+ url: Signal<URL | undefined>;
92
+ /** Whether to hold a connection at all; clearing it releases this handle's share. */
93
+ enabled: Signal<boolean>;
94
+ /** Current status of the connection. */
95
+ readonly status: Getter<ReloadStatus>;
96
+ /**
97
+ * The failure that stopped retrying the current URL, or undefined while the loop is live.
98
+ *
99
+ * Set on an auth rejection or when a private retry window expires. Cleared when a new URL
100
+ * or a disable/re-enable starts another sequence, not on a page hide/show.
101
+ */
102
+ readonly error: Getter<Error | undefined>;
103
+ /**
104
+ * The wire transport the current session runs over, or undefined while disconnected.
105
+ *
106
+ * The session itself is deliberately not exposed: it is shared, so no handle may close
107
+ * or reconfigure it, and everything else it offers is reachable through {@link origin}.
108
+ */
109
+ readonly transport: Getter<TransportType | undefined>;
110
+ /** The current connection's PROBE estimates, or undefined while disconnected. */
111
+ readonly probe: Getter<ProbeType | undefined>;
112
+ /**
113
+ * The send-side bandwidth allocator for the current URL, or undefined
114
+ * while disabled or URL-less.
115
+ *
116
+ * Every handle on this URL shares the same instance, so publishers reserve
117
+ * against one registry. Borrowed, not owned: the type has no close, since
118
+ * closing it would starve every other handle.
119
+ */
120
+ readonly bandwidth: Getter<Handle | undefined>;
121
+ /**
122
+ * The origin for the current URL, or undefined while disabled or URL-less.
123
+ *
124
+ * Publish into it or consume from it; a shared handle's origin is the same one every
125
+ * other handle on this URL uses, and it spans the connection's reconnects. Borrowed,
126
+ * not owned: the type has no close, since closing it would tear the origin down under
127
+ * every other handle.
128
+ */
129
+ readonly origin: Getter<Origin.Table | undefined>;
130
+ /**
131
+ * Settles once this handle is released via {@link close}: `null` on a clean close, or
132
+ * the abort {@link Error}. Peek it synchronously (`undefined` while open), observe it
133
+ * reactively, or `await` it. Attempt failures live on {@link error} instead.
134
+ */
135
+ get closed(): GetPromise<Error | null>;
136
+ /**
137
+ * Take a handle on the connection for {@link ConnectionProps.url}.
138
+ *
139
+ * Dials immediately when a URL is given and `enabled` is not false; otherwise waits for
140
+ * the signals to say go. The handle owns nothing but its own share: {@link close}
141
+ * releases it, and the underlying connection and origin live for as long as any handle
142
+ * (plus the linger window) wants them.
143
+ */
144
+ constructor(props?: ConnectionProps);
145
+ /**
146
+ * Subscribe to broadcast announcements matching `scope`, spanning reconnects
147
+ * and URL switches: a switch retracts everything from
148
+ * the old relay's origin, then the new one's arrivals stream in.
149
+ */
150
+ announced(scope?: Path.Pattern, options?: Announce.Options): Announce.Consumer;
151
+ /** Snapshot the live connection's transport counters, or undefined while disconnected. */
152
+ stats(): Promise<StatsType | undefined>;
153
+ /**
154
+ * Release this handle. The shared connection closes once its last handle is gone and
155
+ * the linger window passes; other handles on the URL are unaffected. Idempotent.
156
+ */
157
+ close(abort?: Error): void;
158
+ }
159
+ /** Types on {@link Connection}: the handle is the class, these are its associated types. */
160
+ export declare namespace Connection {
161
+ /** Options for {@link Connection}. */
162
+ type Props = ConnectionProps;
163
+ /** Options for {@link Connection.connect}. */
164
+ type ConnectProps = ConnectPropsType;
165
+ /** Options for {@link Connection.accept}. */
166
+ type AcceptProps = AcceptPropsType;
167
+ /** Backoff settings for a private reconnect loop. */
168
+ type Backoff = ReloadDelay;
169
+ /** Current state of a {@link Connection}. */
170
+ type Status = ReloadStatus;
171
+ /** The current connection's PROBE estimates. */
172
+ type Probe = ProbeType;
173
+ /** A point-in-time snapshot of the transport's counters. */
174
+ type Stats = StatsType;
175
+ /** The wire transport a session runs over. */
176
+ type Transport = TransportType;
177
+ /** Tuning for the WebSocket fallback. */
178
+ type WebSocketProps = WebSocketPropsType;
179
+ /** WebTransport options, including friendlier certificate pinning. */
180
+ type WebTransportProps = WebTransportPropsType;
181
+ /** A server certificate hash used to pin a self-signed server. */
182
+ type CertificateHash = CertificateHashType;
183
+ /** An established one-shot session. */
184
+ type Established = EstablishedType;
185
+ }
186
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/connection/pool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,MAAM,EAAQ,MAAM,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,WAAW,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACN,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,YAAY,IAAI,gBAAgB,EACrC,eAAe,EACf,OAAO,EACP,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKjE,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC/B,sEAAsE;IACtE,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAA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