@moq/net 0.4.1 → 0.4.3

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 (184) hide show
  1. package/broadcast.d.ts +21 -7
  2. package/broadcast.d.ts.map +1 -1
  3. package/broadcast.js +38 -16
  4. package/broadcast.js.map +1 -1
  5. package/connection/accept.js +6 -4
  6. package/connection/accept.js.map +1 -1
  7. package/connection/connect.d.ts.map +1 -1
  8. package/connection/connect.js +5 -4
  9. package/connection/connect.js.map +1 -1
  10. package/connection/forward.js +54 -47
  11. package/connection/forward.js.map +1 -1
  12. package/connection/goaway.d.ts +34 -0
  13. package/connection/goaway.d.ts.map +1 -0
  14. package/connection/goaway.js +176 -0
  15. package/connection/goaway.js.map +1 -0
  16. package/connection/handshake.d.ts +4 -2
  17. package/connection/handshake.d.ts.map +1 -1
  18. package/connection/handshake.js +42 -10
  19. package/connection/handshake.js.map +1 -1
  20. package/connection/pool.d.ts +16 -1
  21. package/connection/pool.d.ts.map +1 -1
  22. package/connection/pool.js +32 -10
  23. package/connection/pool.js.map +1 -1
  24. package/connection/reload.d.ts.map +1 -1
  25. package/connection/reload.js +184 -30
  26. package/connection/reload.js.map +1 -1
  27. package/error.d.ts +11 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.js +14 -0
  30. package/error.js.map +1 -1
  31. package/errors.d.ts +1 -1
  32. package/errors.d.ts.map +1 -1
  33. package/errors.js +1 -1
  34. package/errors.js.map +1 -1
  35. package/group.d.ts.map +1 -1
  36. package/group.js +5 -4
  37. package/group.js.map +1 -1
  38. package/hop.d.ts +8 -0
  39. package/hop.d.ts.map +1 -1
  40. package/hop.js +16 -0
  41. package/hop.js.map +1 -1
  42. package/ietf/adapter.d.ts +4 -0
  43. package/ietf/adapter.d.ts.map +1 -1
  44. package/ietf/adapter.js +19 -8
  45. package/ietf/adapter.js.map +1 -1
  46. package/ietf/cluster.d.ts +3 -3
  47. package/ietf/cluster.js +3 -3
  48. package/ietf/cluster.js.map +1 -1
  49. package/ietf/connection.d.ts.map +1 -1
  50. package/ietf/connection.js +110 -37
  51. package/ietf/connection.js.map +1 -1
  52. package/ietf/fetch.d.ts +7 -20
  53. package/ietf/fetch.d.ts.map +1 -1
  54. package/ietf/fetch.js +52 -22
  55. package/ietf/fetch.js.map +1 -1
  56. package/ietf/filter.d.ts +20 -4
  57. package/ietf/filter.d.ts.map +1 -1
  58. package/ietf/filter.js +165 -17
  59. package/ietf/filter.js.map +1 -1
  60. package/ietf/goaway.d.ts +9 -1
  61. package/ietf/goaway.d.ts.map +1 -1
  62. package/ietf/goaway.js +20 -0
  63. package/ietf/goaway.js.map +1 -1
  64. package/ietf/hidden.js +1 -1
  65. package/ietf/hidden.js.map +1 -1
  66. package/ietf/index.d.ts +1 -1
  67. package/ietf/index.d.ts.map +1 -1
  68. package/ietf/index.js +1 -1
  69. package/ietf/index.js.map +1 -1
  70. package/ietf/object.d.ts +9 -6
  71. package/ietf/object.d.ts.map +1 -1
  72. package/ietf/object.js +47 -38
  73. package/ietf/object.js.map +1 -1
  74. package/ietf/parameters.d.ts +13 -8
  75. package/ietf/parameters.d.ts.map +1 -1
  76. package/ietf/parameters.js +177 -30
  77. package/ietf/parameters.js.map +1 -1
  78. package/ietf/publish.d.ts +1 -0
  79. package/ietf/publish.d.ts.map +1 -1
  80. package/ietf/publish.js +1 -0
  81. package/ietf/publish.js.map +1 -1
  82. package/ietf/publish_namespace.d.ts +2 -2
  83. package/ietf/publish_namespace.js +2 -2
  84. package/ietf/publish_namespace.js.map +1 -1
  85. package/ietf/publisher.js +404 -202
  86. package/ietf/publisher.js.map +1 -1
  87. package/ietf/request_stream.d.ts +7 -0
  88. package/ietf/request_stream.d.ts.map +1 -0
  89. package/ietf/request_stream.js +20 -0
  90. package/ietf/request_stream.js.map +1 -0
  91. package/ietf/subscribe.d.ts +7 -1
  92. package/ietf/subscribe.d.ts.map +1 -1
  93. package/ietf/subscribe.js +24 -17
  94. package/ietf/subscribe.js.map +1 -1
  95. package/ietf/subscribe_namespace.d.ts.map +1 -1
  96. package/ietf/subscribe_namespace.js +7 -3
  97. package/ietf/subscribe_namespace.js.map +1 -1
  98. package/ietf/subscriber.js +83 -56
  99. package/ietf/subscriber.js.map +1 -1
  100. package/ietf/token.d.ts +2 -0
  101. package/ietf/token.d.ts.map +1 -0
  102. package/ietf/token.js +99 -0
  103. package/ietf/token.js.map +1 -0
  104. package/ietf/track.d.ts +4 -0
  105. package/ietf/track.d.ts.map +1 -1
  106. package/ietf/track.js +6 -20
  107. package/ietf/track.js.map +1 -1
  108. package/index.d.ts +1 -1
  109. package/index.d.ts.map +1 -1
  110. package/index.js.map +1 -1
  111. package/internal.d.ts +12 -3
  112. package/internal.d.ts.map +1 -1
  113. package/internal.js +32 -0
  114. package/internal.js.map +1 -1
  115. package/lite/announce.d.ts.map +1 -1
  116. package/lite/announce.js +7 -4
  117. package/lite/announce.js.map +1 -1
  118. package/lite/connection.d.ts.map +1 -1
  119. package/lite/connection.js +22 -7
  120. package/lite/connection.js.map +1 -1
  121. package/lite/datagram.d.ts +3 -2
  122. package/lite/datagram.d.ts.map +1 -1
  123. package/lite/datagram.js +7 -8
  124. package/lite/datagram.js.map +1 -1
  125. package/lite/group.d.ts +12 -8
  126. package/lite/group.d.ts.map +1 -1
  127. package/lite/group.js +37 -16
  128. package/lite/group.js.map +1 -1
  129. package/lite/message.d.ts +2 -2
  130. package/lite/message.d.ts.map +1 -1
  131. package/lite/message.js +14 -5
  132. package/lite/message.js.map +1 -1
  133. package/lite/publisher.js +39 -45
  134. package/lite/publisher.js.map +1 -1
  135. package/lite/setup.d.ts +1 -1
  136. package/lite/setup.d.ts.map +1 -1
  137. package/lite/setup.js +22 -19
  138. package/lite/setup.js.map +1 -1
  139. package/lite/subscribe.d.ts.map +1 -1
  140. package/lite/subscribe.js +4 -5
  141. package/lite/subscribe.js.map +1 -1
  142. package/lite/subscriber.d.ts.map +1 -1
  143. package/lite/subscriber.js +210 -127
  144. package/lite/subscriber.js.map +1 -1
  145. package/origin.d.ts +9 -1
  146. package/origin.d.ts.map +1 -1
  147. package/origin.js +341 -146
  148. package/origin.js.map +1 -1
  149. package/package.json +2 -2
  150. package/stream.d.ts +77 -12
  151. package/stream.d.ts.map +1 -1
  152. package/stream.js +359 -122
  153. package/stream.js.map +1 -1
  154. package/tail.d.ts +7 -0
  155. package/tail.d.ts.map +1 -1
  156. package/tail.js +68 -22
  157. package/tail.js.map +1 -1
  158. package/track.d.ts +14 -3
  159. package/track.d.ts.map +1 -1
  160. package/track.js +170 -76
  161. package/track.js.map +1 -1
  162. package/util/abort.d.ts +2 -0
  163. package/util/abort.d.ts.map +1 -0
  164. package/util/abort.js +20 -0
  165. package/util/abort.js.map +1 -0
  166. package/util/u64.d.ts +39 -0
  167. package/util/u64.d.ts.map +1 -0
  168. package/util/u64.js +83 -0
  169. package/util/u64.js.map +1 -0
  170. package/util/varint.d.ts +29 -0
  171. package/util/varint.d.ts.map +1 -0
  172. package/util/varint.js +198 -0
  173. package/util/varint.js.map +1 -0
  174. package/varint.d.ts +10 -6
  175. package/varint.d.ts.map +1 -1
  176. package/varint.js +40 -237
  177. package/varint.js.map +1 -1
  178. package/wire.d.ts +17 -3
  179. package/wire.d.ts.map +1 -1
  180. package/wire.js.map +1 -1
  181. package/ietf/control.d.ts +0 -135
  182. package/ietf/control.d.ts.map +0 -1
  183. package/ietf/control.js +0 -242
  184. package/ietf/control.js.map +0 -1
package/varint.js CHANGED
@@ -1,10 +1,12 @@
1
1
  /* @ts-self-types="./varint.d.ts" */
2
2
  /**
3
- * QUIC variable-length integer encoding and decoding.
3
+ * Variable-length integers: QUIC's (RFC 9000 Section 16) and moq-transport's leading-ones form.
4
4
  * https://www.rfc-editor.org/rfc/rfc9000#section-16
5
5
  *
6
6
  * @module
7
7
  */
8
+ import { toBigInt, toNumber } from "./util/u64.js";
9
+ import { lengthLeadingOnes, lengthQuic, parts, peekLeadingOnes, peekQuic, readLeadingOnes, readQuic, split, writeLeadingOnes, writeQuic, } from "./util/varint.js";
8
10
  /** Largest value that fits in a 1-byte varint (6 bits). */
9
11
  export const MAX_U6 = 2 ** 6 - 1;
10
12
  /** Largest value that fits in a 2-byte varint (14 bits). */
@@ -13,181 +15,40 @@ export const MAX_U14 = 2 ** 14 - 1;
13
15
  export const MAX_U30 = 2 ** 30 - 1;
14
16
  /** Largest value representable without precision loss (`Number.MAX_SAFE_INTEGER`, 53 bits). */
15
17
  export const MAX_U53 = Number.MAX_SAFE_INTEGER;
16
- // Leading-ones varint encoding/decoding (draft-17 Section 1.4.1)
17
- // Encoding scheme:
18
- // 0xxxxxxx → 1 byte (7 bits)
19
- // 10xxxxxx + 1B → 2 bytes (14 bits)
20
- // 110xxxxx + 2B → 3 bytes (21 bits)
21
- // 1110xxxx + 3B → 4 bytes (28 bits)
22
- // 11110xxx + 4B → 5 bytes (35 bits)
23
- // 111110xx + 5B → 6 bytes (42 bits)
24
- // 1111110x + 6B → 7 bytes (49 bits), draft-18+ only (invalid in draft-17 per #1595)
25
- // 11111110 + 7B → 8 bytes (56 bits)
26
- // 11111111 + 8B → 9 bytes (64 bits)
27
- const MAX_U64 = (1n << 64n) - 1n;
18
+ // The size of the varint at the start of `buf`, throwing unless all of it is there.
19
+ function sizeOf(buf, size) {
20
+ if (buf.length === 0)
21
+ throw new Error("buffer is empty");
22
+ const n = size(buf[0]);
23
+ if (buf.length < n)
24
+ throw new Error(`buffer too short: need ${n} bytes, have ${buf.length}`);
25
+ return n;
26
+ }
28
27
  /** Number of bytes needed to encode a value in the leading-ones varint format. */
29
28
  export function sizeLeadingOnes(v) {
30
- const b = BigInt(v);
31
- if (b < 0n)
32
- throw new RangeError(`value is negative: ${v}`);
33
- if (b > MAX_U64)
34
- throw new RangeError(`value exceeds 64 bits: ${v}`);
35
- if (b < 1n << 7n)
36
- return 1;
37
- if (b < 1n << 14n)
38
- return 2;
39
- if (b < 1n << 21n)
40
- return 3;
41
- if (b < 1n << 28n)
42
- return 4;
43
- if (b < 1n << 35n)
44
- return 5;
45
- if (b < 1n << 42n)
46
- return 6;
47
- if (b < 1n << 56n)
48
- return 8;
49
- return 9;
29
+ const lo = split(v);
30
+ return lengthLeadingOnes(parts.hi, lo);
50
31
  }
51
32
  /** Encode a value in leading-ones varint format into the provided buffer, returning the written subarray. */
52
33
  export function encodeLeadingOnesTo(dst, v) {
53
- const x = BigInt(v);
54
- if (x < 0n)
55
- throw new RangeError(`underflow, value is negative: ${v}`);
56
- if (x > MAX_U64)
57
- throw new RangeError(`value exceeds 64 bits: ${v}`);
58
- const view = new DataView(dst);
59
- if (x < 1n << 7n) {
60
- view.setUint8(0, Number(x));
61
- return new Uint8Array(dst, 0, 1);
62
- }
63
- if (x < 1n << 14n) {
64
- view.setUint8(0, 0x80 | Number(x >> 8n));
65
- view.setUint8(1, Number(x & 0xffn));
66
- return new Uint8Array(dst, 0, 2);
67
- }
68
- if (x < 1n << 21n) {
69
- view.setUint8(0, 0xc0 | Number(x >> 16n));
70
- view.setUint16(1, Number(x & 0xffffn));
71
- return new Uint8Array(dst, 0, 3);
72
- }
73
- if (x < 1n << 28n) {
74
- view.setUint8(0, 0xe0 | Number(x >> 24n));
75
- view.setUint8(1, Number((x >> 16n) & 0xffn));
76
- view.setUint16(2, Number(x & 0xffffn));
77
- return new Uint8Array(dst, 0, 4);
78
- }
79
- if (x < 1n << 35n) {
80
- view.setUint8(0, 0xf0 | Number(x >> 32n));
81
- view.setUint32(1, Number(x & 0xffffffffn));
82
- return new Uint8Array(dst, 0, 5);
83
- }
84
- if (x < 1n << 42n) {
85
- view.setUint8(0, 0xf8 | Number(x >> 40n));
86
- view.setUint8(1, Number((x >> 32n) & 0xffn));
87
- view.setUint32(2, Number(x & 0xffffffffn));
88
- return new Uint8Array(dst, 0, 6);
89
- }
90
- if (x < 1n << 56n) {
91
- // 11111110 + 7 bytes
92
- view.setUint8(0, 0xfe);
93
- view.setUint8(1, Number((x >> 48n) & 0xffn));
94
- view.setUint16(2, Number((x >> 32n) & 0xffffn));
95
- view.setUint32(4, Number(x & 0xffffffffn));
96
- return new Uint8Array(dst, 0, 8);
97
- }
98
- // 11111111 + 8 bytes
99
- view.setUint8(0, 0xff);
100
- view.setBigUint64(1, x);
101
- return new Uint8Array(dst, 0, 9);
34
+ const lo = split(v);
35
+ const buf = new Uint8Array(dst, 0, lengthLeadingOnes(parts.hi, lo));
36
+ writeLeadingOnes(buf, parts.hi, lo, buf.length);
37
+ return buf;
102
38
  }
103
39
  /** Encode a value in leading-ones varint format into a freshly allocated buffer. */
104
40
  export function encodeLeadingOnes(v) {
105
41
  return encodeLeadingOnesTo(new ArrayBuffer(9), v);
106
42
  }
107
- /** Decode a leading-ones varint, returning the value and the remaining buffer. */
43
+ /**
44
+ * Decode a leading-ones varint, returning the value and the remaining buffer.
45
+ *
46
+ * Accepts the 7-byte form, which only draft-18+ allows, since there is no version here to check.
47
+ */
108
48
  export function decodeLeadingOnes(buf) {
109
- if (buf.length === 0)
110
- throw new Error("buffer is empty");
111
- const b = buf[0];
112
- // Count leading 1-bits
113
- let ones = 0;
114
- for (let bit = 7; bit >= 0; bit--) {
115
- if (b & (1 << bit))
116
- ones++;
117
- else
118
- break;
119
- }
120
- // 1111110x is a 7-byte form: invalid on draft-17, allowed on draft-18+ per #1595.
121
- // This standalone decoder is permissive (Postel-style) since we lack version context here.
122
- let totalSize;
123
- if (ones <= 5)
124
- totalSize = ones + 1;
125
- else if (ones === 6)
126
- totalSize = 7;
127
- else if (ones === 7)
128
- totalSize = 8;
129
- else
130
- totalSize = 9; // ones === 8
131
- if (buf.length < totalSize) {
132
- throw new Error(`buffer too short: need ${totalSize} bytes, have ${buf.length}`);
133
- }
134
- const view = new DataView(buf.buffer, buf.byteOffset, totalSize);
135
- const remain = buf.subarray(totalSize);
136
- let value;
137
- switch (ones) {
138
- case 0:
139
- value = BigInt(b);
140
- break;
141
- case 1:
142
- value = (BigInt(b & 0x3f) << 8n) | BigInt(buf[1]);
143
- break;
144
- case 2:
145
- value = (BigInt(b & 0x1f) << 16n) | BigInt(view.getUint16(1));
146
- break;
147
- case 3:
148
- value = (BigInt(b & 0x0f) << 24n) | (BigInt(buf[1]) << 16n) | (BigInt(buf[2]) << 8n) | BigInt(buf[3]);
149
- break;
150
- case 4:
151
- value = (BigInt(b & 0x07) << 32n) | BigInt(view.getUint32(1));
152
- break;
153
- case 5:
154
- value =
155
- (BigInt(b & 0x03) << 40n) |
156
- (BigInt(buf[1]) << 32n) |
157
- (BigInt(buf[2]) << 24n) |
158
- (BigInt(buf[3]) << 16n) |
159
- (BigInt(buf[4]) << 8n) |
160
- BigInt(buf[5]);
161
- break;
162
- case 6: {
163
- // 1111110x + 6 bytes = 49 bits (draft-18+)
164
- value =
165
- (BigInt(b & 0x01) << 48n) |
166
- (BigInt(buf[1]) << 40n) |
167
- (BigInt(buf[2]) << 32n) |
168
- (BigInt(buf[3]) << 24n) |
169
- (BigInt(buf[4]) << 16n) |
170
- (BigInt(buf[5]) << 8n) |
171
- BigInt(buf[6]);
172
- break;
173
- }
174
- case 7: {
175
- // 11111110 + 7 bytes = 56 usable bits
176
- const hi = new Uint8Array(8);
177
- hi[0] = 0;
178
- hi.set(buf.subarray(1, 8), 1);
179
- value = new DataView(hi.buffer).getBigUint64(0);
180
- break;
181
- }
182
- case 8: {
183
- // 11111111 + 8 bytes = 64 bits
184
- value = new DataView(buf.buffer, buf.byteOffset + 1, 8).getBigUint64(0);
185
- break;
186
- }
187
- default:
188
- throw new Error("impossible");
189
- }
190
- return [value, remain];
49
+ const size = sizeOf(buf, peekLeadingOnes);
50
+ const lo = readLeadingOnes(buf, 0, size);
51
+ return [toBigInt(parts.hi, lo), buf.subarray(size)];
191
52
  }
192
53
  /**
193
54
  * Returns the number of bytes needed to encode a value as a varint.
@@ -203,54 +64,18 @@ export function size(v) {
203
64
  return 8;
204
65
  throw new Error(`overflow, value larger than 53-bits: ${v}`);
205
66
  }
206
- // Helper functions for writing to an ArrayBuffer
207
- function setUint8(dst, v) {
208
- const buffer = new Uint8Array(dst, 0, 1);
209
- buffer[0] = v;
210
- return buffer;
211
- }
212
- function setUint16(dst, v) {
213
- const view = new DataView(dst, 0, 2);
214
- view.setUint16(0, v);
215
- return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
216
- }
217
- function setUint32(dst, v) {
218
- const view = new DataView(dst, 0, 4);
219
- view.setUint32(0, v);
220
- return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
221
- }
222
- function setUint64(dst, v) {
223
- const view = new DataView(dst, 0, 8);
224
- view.setBigUint64(0, v);
225
- return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
226
- }
227
- const MAX_U62 = 2n ** 62n - 1n;
228
67
  /**
229
- * Encodes a number or bigint into a scratch buffer.
230
- * Used by stream.ts to avoid allocations.
68
+ * Encodes a value as a QUIC variable-length integer into the provided buffer,
69
+ * returning the written subarray.
231
70
  */
232
71
  export function encodeTo(dst, v) {
233
- const b = BigInt(v);
234
- if (b < 0n) {
235
- throw new Error(`underflow, value is negative: ${v}`);
236
- }
237
- if (b > MAX_U62) {
238
- throw new Error(`overflow, value larger than 62-bits: ${v}`);
239
- }
240
- const n = Number(b);
241
- if (n <= MAX_U6) {
242
- return setUint8(dst, n);
243
- }
244
- if (n <= MAX_U14) {
245
- return setUint16(dst, n | 0x4000);
246
- }
247
- if (n <= MAX_U30) {
248
- return setUint32(dst, n | 0x80000000);
249
- }
250
- return setUint64(dst, b | 0xc000000000000000n);
72
+ const lo = split(v);
73
+ const buf = new Uint8Array(dst, 0, lengthQuic(parts.hi, lo));
74
+ writeQuic(buf, parts.hi, lo, buf.length);
75
+ return buf;
251
76
  }
252
77
  /**
253
- * Encodes a number or bigint as a QUIC variable-length integer.
78
+ * Encodes a value as a QUIC variable-length integer.
254
79
  * Returns a new Uint8Array containing the encoded bytes.
255
80
  */
256
81
  export function encode(v) {
@@ -261,39 +86,17 @@ export function encode(v) {
261
86
  * Returns a tuple of [value, remaining buffer].
262
87
  */
263
88
  export function decodeBigInt(buf) {
264
- if (buf.length === 0) {
265
- throw new Error("buffer is empty");
266
- }
267
- const size = 1 << ((buf[0] & 0xc0) >> 6);
268
- if (buf.length < size) {
269
- throw new Error(`buffer too short: need ${size} bytes, have ${buf.length}`);
270
- }
271
- const view = new DataView(buf.buffer, buf.byteOffset, size);
272
- const remain = buf.subarray(size);
273
- let value;
274
- if (size === 1) {
275
- value = BigInt(buf[0] & 0x3f);
276
- }
277
- else if (size === 2) {
278
- value = BigInt(view.getUint16(0) & 0x3fff);
279
- }
280
- else if (size === 4) {
281
- value = BigInt(view.getUint32(0) & 0x3fffffff);
282
- }
283
- else if (size === 8) {
284
- value = view.getBigUint64(0) & 0x3fffffffffffffffn;
285
- }
286
- else {
287
- throw new Error("impossible");
288
- }
289
- return [value, remain];
89
+ const size = sizeOf(buf, peekQuic);
90
+ const lo = readQuic(buf, 0, size);
91
+ return [toBigInt(parts.hi, lo), buf.subarray(size)];
290
92
  }
291
93
  /**
292
94
  * Decodes a QUIC variable-length integer from a buffer.
293
- * Values above 53 bits lose precision; use {@link decodeBigInt} for exact decoding.
95
+ * Throws above `Number.MAX_SAFE_INTEGER` rather than rounding; use {@link decodeBigInt} for those.
294
96
  */
295
97
  export function decode(buf) {
296
- const [value, remain] = decodeBigInt(buf);
297
- return [Number(value), remain];
98
+ const size = sizeOf(buf, peekQuic);
99
+ const lo = readQuic(buf, 0, size);
100
+ return [toNumber(parts.hi, lo), buf.subarray(size)];
298
101
  }
299
102
  //# sourceMappingURL=varint.js.map
package/varint.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"varint.js","sourceRoot":"","sources":["../src/varint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACnC,4DAA4D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,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/**\n * QUIC variable-length integer encoding and decoding.\n * https://www.rfc-editor.org/rfc/rfc9000#section-16\n *\n * @module\n */\n\n/** Largest value that fits in a 1-byte varint (6 bits). */\nexport const MAX_U6 = 2 ** 6 - 1;\n/** Largest value that fits in a 2-byte varint (14 bits). */\nexport const MAX_U14 = 2 ** 14 - 1;\n/** Largest value that fits in a 4-byte varint (30 bits). */\nexport const MAX_U30 = 2 ** 30 - 1;\n/** Largest value representable without precision loss (`Number.MAX_SAFE_INTEGER`, 53 bits). */\nexport const MAX_U53 = Number.MAX_SAFE_INTEGER;\n\n// Leading-ones varint encoding/decoding (draft-17 Section 1.4.1)\n// Encoding scheme:\n// 0xxxxxxx → 1 byte (7 bits)\n// 10xxxxxx + 1B → 2 bytes (14 bits)\n// 110xxxxx + 2B → 3 bytes (21 bits)\n// 1110xxxx + 3B → 4 bytes (28 bits)\n// 11110xxx + 4B → 5 bytes (35 bits)\n// 111110xx + 5B → 6 bytes (42 bits)\n// 1111110x + 6B → 7 bytes (49 bits), draft-18+ only (invalid in draft-17 per #1595)\n// 11111110 + 7B → 8 bytes (56 bits)\n// 11111111 + 8B → 9 bytes (64 bits)\n\nconst MAX_U64 = (1n << 64n) - 1n;\n\n/** Number of bytes needed to encode a value in the leading-ones varint format. */\nexport function sizeLeadingOnes(v: number | bigint): number {\n\tconst b = BigInt(v);\n\tif (b < 0n) throw new RangeError(`value is negative: ${v}`);\n\tif (b > MAX_U64) throw new RangeError(`value exceeds 64 bits: ${v}`);\n\tif (b < 1n << 7n) return 1;\n\tif (b < 1n << 14n) return 2;\n\tif (b < 1n << 21n) return 3;\n\tif (b < 1n << 28n) return 4;\n\tif (b < 1n << 35n) return 5;\n\tif (b < 1n << 42n) return 6;\n\tif (b < 1n << 56n) return 8;\n\treturn 9;\n}\n\n/** Encode a value in leading-ones varint format into the provided buffer, returning the written subarray. */\nexport function encodeLeadingOnesTo(dst: ArrayBuffer, v: number | bigint): Uint8Array {\n\tconst x = BigInt(v);\n\tif (x < 0n) throw new RangeError(`underflow, value is negative: ${v}`);\n\tif (x > MAX_U64) throw new RangeError(`value exceeds 64 bits: ${v}`);\n\n\tconst view = new DataView(dst);\n\n\tif (x < 1n << 7n) {\n\t\tview.setUint8(0, Number(x));\n\t\treturn new Uint8Array(dst, 0, 1);\n\t}\n\tif (x < 1n << 14n) {\n\t\tview.setUint8(0, 0x80 | Number(x >> 8n));\n\t\tview.setUint8(1, Number(x & 0xffn));\n\t\treturn new Uint8Array(dst, 0, 2);\n\t}\n\tif (x < 1n << 21n) {\n\t\tview.setUint8(0, 0xc0 | Number(x >> 16n));\n\t\tview.setUint16(1, Number(x & 0xffffn));\n\t\treturn new Uint8Array(dst, 0, 3);\n\t}\n\tif (x < 1n << 28n) {\n\t\tview.setUint8(0, 0xe0 | Number(x >> 24n));\n\t\tview.setUint8(1, Number((x >> 16n) & 0xffn));\n\t\tview.setUint16(2, Number(x & 0xffffn));\n\t\treturn new Uint8Array(dst, 0, 4);\n\t}\n\tif (x < 1n << 35n) {\n\t\tview.setUint8(0, 0xf0 | Number(x >> 32n));\n\t\tview.setUint32(1, Number(x & 0xffffffffn));\n\t\treturn new Uint8Array(dst, 0, 5);\n\t}\n\tif (x < 1n << 42n) {\n\t\tview.setUint8(0, 0xf8 | Number(x >> 40n));\n\t\tview.setUint8(1, Number((x >> 32n) & 0xffn));\n\t\tview.setUint32(2, Number(x & 0xffffffffn));\n\t\treturn new Uint8Array(dst, 0, 6);\n\t}\n\tif (x < 1n << 56n) {\n\t\t// 11111110 + 7 bytes\n\t\tview.setUint8(0, 0xfe);\n\t\tview.setUint8(1, Number((x >> 48n) & 0xffn));\n\t\tview.setUint16(2, Number((x >> 32n) & 0xffffn));\n\t\tview.setUint32(4, Number(x & 0xffffffffn));\n\t\treturn new Uint8Array(dst, 0, 8);\n\t}\n\t// 11111111 + 8 bytes\n\tview.setUint8(0, 0xff);\n\tview.setBigUint64(1, x);\n\treturn new Uint8Array(dst, 0, 9);\n}\n\n/** Encode a value in leading-ones varint format into a freshly allocated buffer. */\nexport function encodeLeadingOnes(v: number | bigint): Uint8Array {\n\treturn encodeLeadingOnesTo(new ArrayBuffer(9), v);\n}\n\n/** Decode a leading-ones varint, returning the value and the remaining buffer. */\nexport function decodeLeadingOnes(buf: Uint8Array): [bigint, Uint8Array] {\n\tif (buf.length === 0) throw new Error(\"buffer is empty\");\n\n\tconst b = buf[0];\n\t// Count leading 1-bits\n\tlet ones = 0;\n\tfor (let bit = 7; bit >= 0; bit--) {\n\t\tif (b & (1 << bit)) ones++;\n\t\telse break;\n\t}\n\n\t// 1111110x is a 7-byte form: invalid on draft-17, allowed on draft-18+ per #1595.\n\t// This standalone decoder is permissive (Postel-style) since we lack version context here.\n\n\tlet totalSize: number;\n\tif (ones <= 5) totalSize = ones + 1;\n\telse if (ones === 6) totalSize = 7;\n\telse if (ones === 7) totalSize = 8;\n\telse totalSize = 9; // ones === 8\n\n\tif (buf.length < totalSize) {\n\t\tthrow new Error(`buffer too short: need ${totalSize} bytes, have ${buf.length}`);\n\t}\n\n\tconst view = new DataView(buf.buffer, buf.byteOffset, totalSize);\n\tconst remain = buf.subarray(totalSize);\n\tlet value: bigint;\n\n\tswitch (ones) {\n\t\tcase 0:\n\t\t\tvalue = BigInt(b);\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tvalue = (BigInt(b & 0x3f) << 8n) | BigInt(buf[1]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tvalue = (BigInt(b & 0x1f) << 16n) | BigInt(view.getUint16(1));\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tvalue = (BigInt(b & 0x0f) << 24n) | (BigInt(buf[1]) << 16n) | (BigInt(buf[2]) << 8n) | BigInt(buf[3]);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tvalue = (BigInt(b & 0x07) << 32n) | BigInt(view.getUint32(1));\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tvalue =\n\t\t\t\t(BigInt(b & 0x03) << 40n) |\n\t\t\t\t(BigInt(buf[1]) << 32n) |\n\t\t\t\t(BigInt(buf[2]) << 24n) |\n\t\t\t\t(BigInt(buf[3]) << 16n) |\n\t\t\t\t(BigInt(buf[4]) << 8n) |\n\t\t\t\tBigInt(buf[5]);\n\t\t\tbreak;\n\t\tcase 6: {\n\t\t\t// 1111110x + 6 bytes = 49 bits (draft-18+)\n\t\t\tvalue =\n\t\t\t\t(BigInt(b & 0x01) << 48n) |\n\t\t\t\t(BigInt(buf[1]) << 40n) |\n\t\t\t\t(BigInt(buf[2]) << 32n) |\n\t\t\t\t(BigInt(buf[3]) << 24n) |\n\t\t\t\t(BigInt(buf[4]) << 16n) |\n\t\t\t\t(BigInt(buf[5]) << 8n) |\n\t\t\t\tBigInt(buf[6]);\n\t\t\tbreak;\n\t\t}\n\t\tcase 7: {\n\t\t\t// 11111110 + 7 bytes = 56 usable bits\n\t\t\tconst hi = new Uint8Array(8);\n\t\t\thi[0] = 0;\n\t\t\thi.set(buf.subarray(1, 8), 1);\n\t\t\tvalue = new DataView(hi.buffer).getBigUint64(0);\n\t\t\tbreak;\n\t\t}\n\t\tcase 8: {\n\t\t\t// 11111111 + 8 bytes = 64 bits\n\t\t\tvalue = new DataView(buf.buffer, buf.byteOffset + 1, 8).getBigUint64(0);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(\"impossible\");\n\t}\n\n\treturn [value, remain];\n}\n\n/**\n * Returns the number of bytes needed to encode a value as a varint.\n */\nexport function size(v: number): number {\n\tif (v <= MAX_U6) return 1;\n\tif (v <= MAX_U14) return 2;\n\tif (v <= MAX_U30) return 4;\n\tif (v <= MAX_U53) return 8;\n\tthrow new Error(`overflow, value larger than 53-bits: ${v}`);\n}\n\n// Helper functions for writing to an ArrayBuffer\nfunction setUint8(dst: ArrayBuffer, v: number): Uint8Array {\n\tconst buffer = new Uint8Array(dst, 0, 1);\n\tbuffer[0] = v;\n\treturn buffer;\n}\n\nfunction setUint16(dst: ArrayBuffer, v: number): Uint8Array {\n\tconst view = new DataView(dst, 0, 2);\n\tview.setUint16(0, v);\n\treturn new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n}\n\nfunction setUint32(dst: ArrayBuffer, v: number): Uint8Array {\n\tconst view = new DataView(dst, 0, 4);\n\tview.setUint32(0, v);\n\treturn new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n}\n\nfunction setUint64(dst: ArrayBuffer, v: bigint): Uint8Array {\n\tconst view = new DataView(dst, 0, 8);\n\tview.setBigUint64(0, v);\n\treturn new Uint8Array(view.buffer, view.byteOffset, view.byteLength);\n}\n\nconst MAX_U62 = 2n ** 62n - 1n;\n\n/**\n * Encodes a number or bigint into a scratch buffer.\n * Used by stream.ts to avoid allocations.\n */\nexport function encodeTo(dst: ArrayBuffer, v: number | bigint): Uint8Array {\n\tconst b = BigInt(v);\n\tif (b < 0n) {\n\t\tthrow new Error(`underflow, value is negative: ${v}`);\n\t}\n\tif (b > MAX_U62) {\n\t\tthrow new Error(`overflow, value larger than 62-bits: ${v}`);\n\t}\n\tconst n = Number(b);\n\tif (n <= MAX_U6) {\n\t\treturn setUint8(dst, n);\n\t}\n\tif (n <= MAX_U14) {\n\t\treturn setUint16(dst, n | 0x4000);\n\t}\n\tif (n <= MAX_U30) {\n\t\treturn setUint32(dst, n | 0x80000000);\n\t}\n\treturn setUint64(dst, b | 0xc000000000000000n);\n}\n\n/**\n * Encodes a number or bigint as a QUIC variable-length integer.\n * Returns a new Uint8Array containing the encoded bytes.\n */\nexport function encode(v: number | bigint): Uint8Array {\n\treturn encodeTo(new ArrayBuffer(8), v);\n}\n\n/**\n * Decodes a QUIC variable-length integer exactly from a buffer.\n * Returns a tuple of [value, remaining buffer].\n */\nexport function decodeBigInt(buf: Uint8Array): [bigint, Uint8Array] {\n\tif (buf.length === 0) {\n\t\tthrow new Error(\"buffer is empty\");\n\t}\n\n\tconst size = 1 << ((buf[0] & 0xc0) >> 6);\n\n\tif (buf.length < size) {\n\t\tthrow new Error(`buffer too short: need ${size} bytes, have ${buf.length}`);\n\t}\n\n\tconst view = new DataView(buf.buffer, buf.byteOffset, size);\n\tconst remain = buf.subarray(size);\n\n\tlet value: bigint;\n\n\tif (size === 1) {\n\t\tvalue = BigInt(buf[0] & 0x3f);\n\t} else if (size === 2) {\n\t\tvalue = BigInt(view.getUint16(0) & 0x3fff);\n\t} else if (size === 4) {\n\t\tvalue = BigInt(view.getUint32(0) & 0x3fffffff);\n\t} else if (size === 8) {\n\t\tvalue = view.getBigUint64(0) & 0x3fffffffffffffffn;\n\t} else {\n\t\tthrow new Error(\"impossible\");\n\t}\n\n\treturn [value, remain];\n}\n\n/**\n * Decodes a QUIC variable-length integer from a buffer.\n * Values above 53 bits lose precision; use {@link decodeBigInt} for exact decoding.\n */\nexport function decode(buf: Uint8Array): [number, Uint8Array] {\n\tconst [value, remain] = decodeBigInt(buf);\n\treturn [Number(value), remain];\n}\n"]}
1
+ {"version":3,"file":"varint.js","sourceRoot":"","sources":["../src/varint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACN,iBAAiB,EACjB,UAAU,EACV,KAAK,EACL,eAAe,EACf,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,SAAS,GACT,MAAM,kBAAkB,CAAC;AAE1B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACnC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACnC,+FAA+F;AAC/F,MAAM,CAAC,MAA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ACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,GAAe;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Variable-length integers: QUIC's (RFC 9000 Section 16) and moq-transport's leading-ones form.\n * https://www.rfc-editor.org/rfc/rfc9000#section-16\n *\n * @module\n */\n\nimport { toBigInt, toNumber } from \"./util/u64.ts\";\nimport {\n\tlengthLeadingOnes,\n\tlengthQuic,\n\tparts,\n\tpeekLeadingOnes,\n\tpeekQuic,\n\treadLeadingOnes,\n\treadQuic,\n\tsplit,\n\twriteLeadingOnes,\n\twriteQuic,\n} from \"./util/varint.ts\";\n\n/** Largest value that fits in a 1-byte varint (6 bits). */\nexport const MAX_U6 = 2 ** 6 - 1;\n/** Largest value that fits in a 2-byte varint (14 bits). */\nexport const MAX_U14 = 2 ** 14 - 1;\n/** Largest value that fits in a 4-byte varint (30 bits). */\nexport const MAX_U30 = 2 ** 30 - 1;\n/** Largest value representable without precision loss (`Number.MAX_SAFE_INTEGER`, 53 bits). */\nexport const MAX_U53 = Number.MAX_SAFE_INTEGER;\n\n// The size of the varint at the start of `buf`, throwing unless all of it is there.\nfunction sizeOf(buf: Uint8Array, size: (first: number) => number): number {\n\tif (buf.length === 0) throw new Error(\"buffer is empty\");\n\tconst n = size(buf[0]);\n\tif (buf.length < n) throw new Error(`buffer too short: need ${n} bytes, have ${buf.length}`);\n\treturn n;\n}\n\n/** Number of bytes needed to encode a value in the leading-ones varint format. */\nexport function sizeLeadingOnes(v: number | bigint): number {\n\tconst lo = split(v);\n\treturn lengthLeadingOnes(parts.hi, lo);\n}\n\n/** Encode a value in leading-ones varint format into the provided buffer, returning the written subarray. */\nexport function encodeLeadingOnesTo(dst: ArrayBuffer, v: number | bigint): Uint8Array {\n\tconst lo = split(v);\n\tconst buf = new Uint8Array(dst, 0, lengthLeadingOnes(parts.hi, lo));\n\twriteLeadingOnes(buf, parts.hi, lo, buf.length);\n\treturn buf;\n}\n\n/** Encode a value in leading-ones varint format into a freshly allocated buffer. */\nexport function encodeLeadingOnes(v: number | bigint): Uint8Array {\n\treturn encodeLeadingOnesTo(new ArrayBuffer(9), v);\n}\n\n/**\n * Decode a leading-ones varint, returning the value and the remaining buffer.\n *\n * Accepts the 7-byte form, which only draft-18+ allows, since there is no version here to check.\n */\nexport function decodeLeadingOnes(buf: Uint8Array): [bigint, Uint8Array] {\n\tconst size = sizeOf(buf, peekLeadingOnes);\n\tconst lo = readLeadingOnes(buf, 0, size);\n\treturn [toBigInt(parts.hi, lo), buf.subarray(size)];\n}\n\n/**\n * Returns the number of bytes needed to encode a value as a varint.\n */\nexport function size(v: number): number {\n\tif (v <= MAX_U6) return 1;\n\tif (v <= MAX_U14) return 2;\n\tif (v <= MAX_U30) return 4;\n\tif (v <= MAX_U53) return 8;\n\tthrow new Error(`overflow, value larger than 53-bits: ${v}`);\n}\n\n/**\n * Encodes a value as a QUIC variable-length integer into the provided buffer,\n * returning the written subarray.\n */\nexport function encodeTo(dst: ArrayBuffer, v: number | bigint): Uint8Array {\n\tconst lo = split(v);\n\tconst buf = new Uint8Array(dst, 0, lengthQuic(parts.hi, lo));\n\twriteQuic(buf, parts.hi, lo, buf.length);\n\treturn buf;\n}\n\n/**\n * Encodes a value as a QUIC variable-length integer.\n * Returns a new Uint8Array containing the encoded bytes.\n */\nexport function encode(v: number | bigint): Uint8Array {\n\treturn encodeTo(new ArrayBuffer(8), v);\n}\n\n/**\n * Decodes a QUIC variable-length integer exactly from a buffer.\n * Returns a tuple of [value, remaining buffer].\n */\nexport function decodeBigInt(buf: Uint8Array): [bigint, Uint8Array] {\n\tconst size = sizeOf(buf, peekQuic);\n\tconst lo = readQuic(buf, 0, size);\n\treturn [toBigInt(parts.hi, lo), buf.subarray(size)];\n}\n\n/**\n * Decodes a QUIC variable-length integer from a buffer.\n * Throws above `Number.MAX_SAFE_INTEGER` rather than rounding; use {@link decodeBigInt} for those.\n */\nexport function decode(buf: Uint8Array): [number, Uint8Array] {\n\tconst size = sizeOf(buf, peekQuic);\n\tconst lo = readQuic(buf, 0, size);\n\treturn [toNumber(parts.hi, lo), buf.subarray(size)];\n}\n"]}
package/wire.d.ts CHANGED
@@ -7,8 +7,9 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import type { Dispose, Getter } from "@moq/signals";
10
+ import type { Dispose, GetPromise, Getter } from "@moq/signals";
11
11
  import type * as broadcast from "./broadcast";
12
+ import type { Drain } from "./connection/goaway";
12
13
  import type { Consumer as GroupConsumer } from "./group";
13
14
  import type { Route } from "./hop";
14
15
  import type * as origin from "./origin";
@@ -23,6 +24,10 @@ export interface Broadcast {
23
24
  }
24
25
  /** The protocol-facing operations behind an origin producer. */
25
26
  export interface OriginProducer {
27
+ /** Minimal root-relative namespace prefixes that cover this origin scope. */
28
+ interests(): readonly Path.Valid[];
29
+ /** Whether an advertised prefix overlaps the handle's allowed paths. */
30
+ accepts(prefix: Path.Valid): boolean;
26
31
  receive(prefix: Path.Valid, route?: Route | {
27
32
  hops?: Route["hops"];
28
33
  cost?: Route["cost"] | bigint;
@@ -38,7 +43,7 @@ export interface OriginProducer {
38
43
  export interface OriginConsumer {
39
44
  routes(path: Path.Valid): boolean;
40
45
  readonly broadcasts: Getter<ReadonlyMap<Path.Valid, broadcast.Consumer> | undefined>;
41
- readonly advertised: Getter<ReadonlyMap<Path.Valid, Advertised> | undefined>;
46
+ readonly advertised: Getter<Advertisements | undefined>;
42
47
  /** The announced local broadcast at `path`, when it is the route peers are offered there. */
43
48
  local(path: Path.Valid): broadcast.Consumer | undefined;
44
49
  demand(path: Path.Valid): Promise<broadcast.Consumer | undefined>;
@@ -47,10 +52,19 @@ export interface OriginConsumer {
47
52
  export interface Advertised {
48
53
  readonly identity: object;
49
54
  readonly route: Route;
55
+ /** The paths a scoped route may serve beneath its prefix, relative like its key; unset for the whole subtree. */
56
+ readonly claim?: Path.Patterns;
50
57
  }
51
- /** The protocol-facing operation behind an established session. */
58
+ /**
59
+ * Every originated advertisement per prefix, most preferred first. A reader takes the first
60
+ * one its scope admits, so a cheaper route it cannot use never hides one it can.
61
+ */
62
+ export type Advertisements = ReadonlyMap<Path.Valid, readonly Advertised[]>;
63
+ /** The protocol-facing operations behind an established session. */
52
64
  export interface Established {
53
65
  consume(path: Path.Valid): broadcast.Consumer;
66
+ /** Settles with the peer's GOAWAY; the session keeps serving until it closes. */
67
+ readonly goaway: GetPromise<Drain>;
54
68
  }
55
69
  type View = Broadcast | OriginProducer | OriginConsumer | Established;
56
70
  /** Register the package-private view for a handle. */
package/wire.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CA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C/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACzD,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,GAAI,IAAkB,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;AAC7D,CAAC;AAMD,oDAAoD;AACpD,MAAM,UAAU,MAAM,CAAC,MAAc;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,IAAI,SAA4E,CAAC;AAEjF,sDAAsD;AACtD,MAAM,UAAU,qBAAqB,CAAC,OAA4D;IACjG,SAAS,GAAG,OAAO,CAAC;AACrB,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,MAA+C;IACpF,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC9D,OAAO,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Package-private capabilities used by the protocol implementations.\n *\n * Public handles register their wire view when they are constructed. Keeping the view in a\n * WeakMap means applications cannot call transport-facing operations on the handles they own,\n * while the protocol layers still share one implementation.\n *\n * @module\n */\nimport type { Dispose, Getter } from \"@moq/signals\";\nimport type * as broadcast from \"./broadcast.ts\";\nimport type { Consumer as GroupConsumer } from \"./group.ts\";\nimport type { Route } from \"./hop.ts\";\nimport type * as origin from \"./origin.ts\";\nimport type * as Path from \"./path.ts\";\nimport type * as track from \"./track.ts\";\n\n/** The protocol-facing operations behind a broadcast handle. */\nexport interface Broadcast {\n\tsubscribe(name: string, options?: track.Subscription): track.Subscriber;\n\tresolveTrackInfo(name: string): Promise<track.Info>;\n\tfetchGroup(name: string, sequence: number, options?: track.FetchGroupOptions): Promise<GroupConsumer>;\n\trequested(): Promise<track.Request | undefined>;\n}\n\n/** The protocol-facing operations behind an origin producer. */\nexport interface OriginProducer {\n\treceive(\n\t\tprefix: Path.Valid,\n\t\troute?: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint },\n\t): origin.Dynamic;\n\tattach(discovery: boolean): Dispose;\n\texpect(): Dispose;\n\treadonly requests: Getter<ReadonlyMap<Path.Valid, origin.RequestSlot> | undefined>;\n\tchanged(): Promise<unknown>;\n\tanswer(path: Path.Valid, front: broadcast.Consumer): Dispose | undefined;\n\troutes(path: Path.Valid): boolean;\n}\n\n/** The protocol-facing operations behind an origin consumer. */\nexport interface OriginConsumer {\n\troutes(path: Path.Valid): boolean;\n\treadonly broadcasts: Getter<ReadonlyMap<Path.Valid, broadcast.Consumer> | undefined>;\n\treadonly advertised: Getter<ReadonlyMap<Path.Valid, Advertised> | undefined>;\n\t/** The announced local broadcast at `path`, when it is the route peers are offered there. */\n\tlocal(path: Path.Valid): broadcast.Consumer | undefined;\n\tdemand(path: Path.Valid): Promise<broadcast.Consumer | undefined>;\n}\n\n/** One originated advertisement exposed to the publishing wire. */\nexport interface Advertised {\n\treadonly identity: object;\n\treadonly route: Route;\n}\n\n/** The protocol-facing operation behind an established session. */\nexport interface Established {\n\tconsume(path: Path.Valid): broadcast.Consumer;\n}\n\ntype View = Broadcast | OriginProducer | OriginConsumer | Established;\nconst views = new WeakMap<object, View>();\n\n/** Register the package-private view for a handle. */\nexport function registerWire(handle: object, view: View): void {\n\tviews.set(handle, view);\n}\n\n/** Replace selected operations on a broadcast's package-private view. */\nexport function overrideBroadcastWire(\n\thandle: broadcast.Consumer,\n\toverrides: Partial<Pick<Broadcast, \"resolveTrackInfo\" | \"fetchGroup\">>,\n): void {\n\tconst view = views.get(handle);\n\tif (!view) throw new Error(\"broadcast has no wire view\");\n\tviews.set(handle, { ...(view as Broadcast), ...overrides });\n}\n\nexport function wireOf(handle: broadcast.Producer | broadcast.Consumer): Broadcast;\nexport function wireOf(handle: origin.Producer): OriginProducer;\nexport function wireOf(handle: origin.Consumer): OriginConsumer;\nexport function wireOf(handle: import(\"./connection/established.ts\").Established): Established;\n/** Return the package-private view for a handle. */\nexport function wireOf(handle: object): View {\n\tconst view = views.get(handle);\n\tif (!view) throw new Error(\"handle has no wire view\");\n\treturn view;\n}\n\nlet makeTrack: ((name: string, source: Broadcast) => track.Consumer) | undefined;\n\n/** Install the private Track.Consumer constructor. */\nexport function registerTrackConsumer(factory: (name: string, source: Broadcast) => track.Consumer): void {\n\tmakeTrack = factory;\n}\n\n/** Create a track handle backed by a broadcast's private wire view. */\nexport function trackOf(name: string, source: broadcast.Producer | broadcast.Consumer): track.Consumer {\n\tif (!makeTrack) throw new Error(\"track module is not loaded\");\n\treturn makeTrack(name, wireOf(source));\n}\n"]}
1
+ {"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AA4EA,MAAM,KAAK,GAAG,IAAI,OAAO,EAAgB,CAAC;AAE1C,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,IAAU;IACtD,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,qBAAqB,CACpC,MAA0B,EAC1B,SAAsE;IAEtE,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACzD,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,GAAI,IAAkB,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;AAC7D,CAAC;AAMD,oDAAoD;AACpD,MAAM,UAAU,MAAM,CAAC,MAAc;IACpC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,IAAI,SAA4E,CAAC;AAEjF,sDAAsD;AACtD,MAAM,UAAU,qBAAqB,CAAC,OAA4D;IACjG,SAAS,GAAG,OAAO,CAAC;AACrB,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,MAA+C;IACpF,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC9D,OAAO,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Package-private capabilities used by the protocol implementations.\n *\n * Public handles register their wire view when they are constructed. Keeping the view in a\n * WeakMap means applications cannot call transport-facing operations on the handles they own,\n * while the protocol layers still share one implementation.\n *\n * @module\n */\nimport type { Dispose, GetPromise, Getter } from \"@moq/signals\";\nimport type * as broadcast from \"./broadcast.ts\";\nimport type { Drain } from \"./connection/goaway.ts\";\nimport type { Consumer as GroupConsumer } from \"./group.ts\";\nimport type { Route } from \"./hop.ts\";\nimport type * as origin from \"./origin.ts\";\nimport type * as Path from \"./path.ts\";\nimport type * as track from \"./track.ts\";\n\n/** The protocol-facing operations behind a broadcast handle. */\nexport interface Broadcast {\n\tsubscribe(name: string, options?: track.Subscription): track.Subscriber;\n\tresolveTrackInfo(name: string): Promise<track.Info>;\n\tfetchGroup(name: string, sequence: number, options?: track.FetchGroupOptions): Promise<GroupConsumer>;\n\trequested(): Promise<track.Request | undefined>;\n}\n\n/** The protocol-facing operations behind an origin producer. */\nexport interface OriginProducer {\n\t/** Minimal root-relative namespace prefixes that cover this origin scope. */\n\tinterests(): readonly Path.Valid[];\n\t/** Whether an advertised prefix overlaps the handle's allowed paths. */\n\taccepts(prefix: Path.Valid): boolean;\n\treceive(\n\t\tprefix: Path.Valid,\n\t\troute?: Route | { hops?: Route[\"hops\"]; cost?: Route[\"cost\"] | bigint },\n\t): origin.Dynamic;\n\tattach(discovery: boolean): Dispose;\n\texpect(): Dispose;\n\treadonly requests: Getter<ReadonlyMap<Path.Valid, origin.RequestSlot> | undefined>;\n\tchanged(): Promise<unknown>;\n\tanswer(path: Path.Valid, front: broadcast.Consumer): Dispose | undefined;\n\troutes(path: Path.Valid): boolean;\n}\n\n/** The protocol-facing operations behind an origin consumer. */\nexport interface OriginConsumer {\n\troutes(path: Path.Valid): boolean;\n\treadonly broadcasts: Getter<ReadonlyMap<Path.Valid, broadcast.Consumer> | undefined>;\n\treadonly advertised: Getter<Advertisements | undefined>;\n\t/** The announced local broadcast at `path`, when it is the route peers are offered there. */\n\tlocal(path: Path.Valid): broadcast.Consumer | undefined;\n\tdemand(path: Path.Valid): Promise<broadcast.Consumer | undefined>;\n}\n\n/** One originated advertisement exposed to the publishing wire. */\nexport interface Advertised {\n\treadonly identity: object;\n\treadonly route: Route;\n\t/** The paths a scoped route may serve beneath its prefix, relative like its key; unset for the whole subtree. */\n\treadonly claim?: Path.Patterns;\n}\n\n/**\n * Every originated advertisement per prefix, most preferred first. A reader takes the first\n * one its scope admits, so a cheaper route it cannot use never hides one it can.\n */\nexport type Advertisements = ReadonlyMap<Path.Valid, readonly Advertised[]>;\n\n/** The protocol-facing operations behind an established session. */\nexport interface Established {\n\tconsume(path: Path.Valid): broadcast.Consumer;\n\t/** Settles with the peer's GOAWAY; the session keeps serving until it closes. */\n\treadonly goaway: GetPromise<Drain>;\n}\n\ntype View = Broadcast | OriginProducer | OriginConsumer | Established;\nconst views = new WeakMap<object, View>();\n\n/** Register the package-private view for a handle. */\nexport function registerWire(handle: object, view: View): void {\n\tviews.set(handle, view);\n}\n\n/** Replace selected operations on a broadcast's package-private view. */\nexport function overrideBroadcastWire(\n\thandle: broadcast.Consumer,\n\toverrides: Partial<Pick<Broadcast, \"resolveTrackInfo\" | \"fetchGroup\">>,\n): void {\n\tconst view = views.get(handle);\n\tif (!view) throw new Error(\"broadcast has no wire view\");\n\tviews.set(handle, { ...(view as Broadcast), ...overrides });\n}\n\nexport function wireOf(handle: broadcast.Producer | broadcast.Consumer): Broadcast;\nexport function wireOf(handle: origin.Producer): OriginProducer;\nexport function wireOf(handle: origin.Consumer): OriginConsumer;\nexport function wireOf(handle: import(\"./connection/established.ts\").Established): Established;\n/** Return the package-private view for a handle. */\nexport function wireOf(handle: object): View {\n\tconst view = views.get(handle);\n\tif (!view) throw new Error(\"handle has no wire view\");\n\treturn view;\n}\n\nlet makeTrack: ((name: string, source: Broadcast) => track.Consumer) | undefined;\n\n/** Install the private Track.Consumer constructor. */\nexport function registerTrackConsumer(factory: (name: string, source: Broadcast) => track.Consumer): void {\n\tmakeTrack = factory;\n}\n\n/** Create a track handle backed by a broadcast's private wire view. */\nexport function trackOf(name: string, source: broadcast.Producer | broadcast.Consumer): track.Consumer {\n\tif (!makeTrack) throw new Error(\"track module is not loaded\");\n\treturn makeTrack(name, wireOf(source));\n}\n"]}
package/ietf/control.d.ts DELETED
@@ -1,135 +0,0 @@
1
- import type { Stream as StreamInner } from "../stream";
2
- import { Fetch, FetchCancel, FetchError, FetchOk } from "./fetch";
3
- import { GoAway } from "./goaway";
4
- import { Publish, PublishDone, PublishError, PublishOk } from "./publish";
5
- import { PublishNamespace, PublishNamespaceCancel, PublishNamespaceDone, PublishNamespaceError, PublishNamespaceOk } from "./publish_namespace";
6
- import { MaxRequestId, RequestError, RequestOk, RequestsBlocked } from "./request";
7
- import * as Setup from "./setup";
8
- import { Subscribe, SubscribeError, SubscribeOk, SubscribeUpdate, Unsubscribe } from "./subscribe";
9
- import { SubscribeNamespaceError, SubscribeNamespaceLegacy, SubscribeNamespaceOk, UnsubscribeNamespace } from "./subscribe_namespace";
10
- import { TrackStatus, TrackStatusRequest } from "./track";
11
- import { type IetfVersion } from "./version";
12
- declare const MessagesV14: {
13
- readonly [Setup.ClientSetup.id]: typeof Setup.ClientSetup;
14
- readonly [Setup.ServerSetup.id]: typeof Setup.ServerSetup;
15
- readonly [SubscribeUpdate.id]: typeof SubscribeUpdate;
16
- readonly [Subscribe.id]: typeof Subscribe;
17
- readonly [SubscribeOk.id]: typeof SubscribeOk;
18
- readonly [SubscribeError.id]: typeof SubscribeError;
19
- readonly [PublishNamespace.id]: typeof PublishNamespace;
20
- readonly [PublishNamespaceOk.id]: typeof PublishNamespaceOk;
21
- readonly [PublishNamespaceError.id]: typeof PublishNamespaceError;
22
- readonly [PublishNamespaceCancel.id]: typeof PublishNamespaceCancel;
23
- readonly [TrackStatusRequest.id]: typeof TrackStatusRequest;
24
- readonly [TrackStatus.id]: typeof TrackStatus;
25
- readonly [GoAway.id]: typeof GoAway;
26
- readonly [Fetch.id]: typeof Fetch;
27
- readonly [FetchCancel.id]: typeof FetchCancel;
28
- readonly [FetchOk.id]: typeof FetchOk;
29
- readonly [FetchError.id]: typeof FetchError;
30
- readonly [SubscribeNamespaceLegacy.id]: typeof SubscribeNamespaceLegacy;
31
- readonly [SubscribeNamespaceOk.id]: typeof SubscribeNamespaceOk;
32
- readonly [SubscribeNamespaceError.id]: typeof SubscribeNamespaceError;
33
- readonly [UnsubscribeNamespace.id]: typeof UnsubscribeNamespace;
34
- readonly [Publish.id]: typeof Publish;
35
- readonly [PublishOk.id]: typeof PublishOk;
36
- readonly [PublishError.id]: typeof PublishError;
37
- readonly [MaxRequestId.id]: typeof MaxRequestId;
38
- readonly [RequestsBlocked.id]: typeof RequestsBlocked;
39
- readonly 9: typeof PublishNamespaceDone;
40
- readonly 10: typeof Unsubscribe;
41
- readonly 11: typeof PublishDone;
42
- };
43
- declare const MessagesV15: {
44
- readonly [Setup.ClientSetup.id]: typeof Setup.ClientSetup;
45
- readonly [Setup.ServerSetup.id]: typeof Setup.ServerSetup;
46
- readonly [SubscribeUpdate.id]: typeof SubscribeUpdate;
47
- readonly [Subscribe.id]: typeof Subscribe;
48
- readonly [SubscribeOk.id]: typeof SubscribeOk;
49
- readonly [RequestError.id]: typeof RequestError;
50
- readonly [PublishNamespace.id]: typeof PublishNamespace;
51
- readonly [RequestOk.id]: typeof RequestOk;
52
- readonly [PublishNamespaceCancel.id]: typeof PublishNamespaceCancel;
53
- readonly [TrackStatusRequest.id]: typeof TrackStatusRequest;
54
- readonly [GoAway.id]: typeof GoAway;
55
- readonly [Fetch.id]: typeof Fetch;
56
- readonly [FetchCancel.id]: typeof FetchCancel;
57
- readonly [FetchOk.id]: typeof FetchOk;
58
- readonly [SubscribeNamespaceLegacy.id]: typeof SubscribeNamespaceLegacy;
59
- readonly [UnsubscribeNamespace.id]: typeof UnsubscribeNamespace;
60
- readonly [Publish.id]: typeof Publish;
61
- readonly [MaxRequestId.id]: typeof MaxRequestId;
62
- readonly [RequestsBlocked.id]: typeof RequestsBlocked;
63
- readonly 9: typeof PublishNamespaceDone;
64
- readonly 10: typeof Unsubscribe;
65
- readonly 11: typeof PublishDone;
66
- };
67
- declare const MessagesV16: {
68
- readonly [Setup.ClientSetup.id]: typeof Setup.ClientSetup;
69
- readonly [Setup.ServerSetup.id]: typeof Setup.ServerSetup;
70
- readonly [SubscribeUpdate.id]: typeof SubscribeUpdate;
71
- readonly [Subscribe.id]: typeof Subscribe;
72
- readonly [SubscribeOk.id]: typeof SubscribeOk;
73
- readonly [RequestError.id]: typeof RequestError;
74
- readonly [PublishNamespace.id]: typeof PublishNamespace;
75
- readonly [RequestOk.id]: typeof RequestOk;
76
- readonly [PublishNamespaceCancel.id]: typeof PublishNamespaceCancel;
77
- readonly [TrackStatusRequest.id]: typeof TrackStatusRequest;
78
- readonly [GoAway.id]: typeof GoAway;
79
- readonly [Fetch.id]: typeof Fetch;
80
- readonly [FetchCancel.id]: typeof FetchCancel;
81
- readonly [FetchOk.id]: typeof FetchOk;
82
- readonly [Publish.id]: typeof Publish;
83
- readonly [MaxRequestId.id]: typeof MaxRequestId;
84
- readonly [RequestsBlocked.id]: typeof RequestsBlocked;
85
- readonly 9: typeof PublishNamespaceDone;
86
- readonly 10: typeof Unsubscribe;
87
- readonly 11: typeof PublishDone;
88
- };
89
- declare const MessagesV17: {
90
- readonly [Setup.Setup.id]: typeof Setup.Setup;
91
- readonly [SubscribeUpdate.id]: typeof SubscribeUpdate;
92
- readonly [Subscribe.id]: typeof Subscribe;
93
- readonly [SubscribeOk.id]: typeof SubscribeOk;
94
- readonly [RequestError.id]: typeof RequestError;
95
- readonly [PublishNamespace.id]: typeof PublishNamespace;
96
- readonly [RequestOk.id]: typeof RequestOk;
97
- readonly [TrackStatusRequest.id]: typeof TrackStatusRequest;
98
- readonly [GoAway.id]: typeof GoAway;
99
- readonly [Fetch.id]: typeof Fetch;
100
- readonly [FetchOk.id]: typeof FetchOk;
101
- readonly [SubscribeNamespaceLegacy.id]: typeof SubscribeNamespaceLegacy;
102
- readonly [Publish.id]: typeof Publish;
103
- readonly 11: typeof PublishDone;
104
- };
105
- type V14MessageType = (typeof MessagesV14)[keyof typeof MessagesV14];
106
- type V15MessageType = (typeof MessagesV15)[keyof typeof MessagesV15];
107
- type V16MessageType = (typeof MessagesV16)[keyof typeof MessagesV16];
108
- type V17MessageType = (typeof MessagesV17)[keyof typeof MessagesV17];
109
- type MessageType = V14MessageType | V15MessageType | V16MessageType | V17MessageType;
110
- export type Message = InstanceType<MessageType>;
111
- export declare class Stream {
112
- #private;
113
- stream: StreamInner;
114
- version: IetfVersion;
115
- constructor({ stream, maxRequestId, version, }: {
116
- stream: StreamInner;
117
- maxRequestId: bigint;
118
- version?: IetfVersion;
119
- });
120
- /**
121
- * Writes a control message to the control stream with proper framing.
122
- * Format: Message Type (varint) + Message Length (u16) + Message Payload
123
- */
124
- write<T extends Message>(message: T): Promise<void>;
125
- /**
126
- * Reads a control message from the control stream.
127
- * Returns the message type and a reader for the payload.
128
- */
129
- read(): Promise<Message>;
130
- maxRequestId(max: bigint): void;
131
- nextRequestId(): Promise<bigint | undefined>;
132
- close(): void;
133
- }
134
- export {};
135
- //# sourceMappingURL=control.d.ts.map
@@ -1 +0,0 @@
1
- {"version":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