@moq/net 0.4.7 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/announce.d.ts +1 -1
- package/announce.d.ts.map +1 -1
- package/announce.js +1 -2
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -32
- package/announced.js.map +1 -1
- package/announced.test-util.d.ts +2 -0
- package/announced.test-util.d.ts.map +1 -0
- package/announced.test-util.js +27 -0
- package/announced.test-util.js.map +1 -0
- package/auth.d.ts +64 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +20 -0
- package/auth.js.map +1 -0
- package/auth_gate.d.ts +2 -0
- package/auth_gate.d.ts.map +1 -0
- package/auth_gate.js +24 -0
- package/auth_gate.js.map +1 -0
- package/auth_session.d.ts +49 -0
- package/auth_session.d.ts.map +1 -0
- package/auth_session.js +1097 -0
- package/auth_session.js.map +1 -0
- package/bandwidth.d.ts +129 -25
- package/bandwidth.d.ts.map +1 -1
- package/bandwidth.js +410 -139
- package/bandwidth.js.map +1 -1
- package/bandwidth_api.d.ts +1 -1
- package/bandwidth_api.d.ts.map +1 -1
- package/bandwidth_api.js +1 -2
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +64 -38
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -173
- package/broadcast.js.map +1 -1
- package/cache.d.ts +103 -0
- package/cache.d.ts.map +1 -0
- package/cache.js +254 -0
- package/cache.js.map +1 -0
- package/claim.test-util.d.ts +5 -0
- package/claim.test-util.d.ts.map +1 -0
- package/claim.test-util.js +13 -0
- package/claim.test-util.js.map +1 -0
- package/connection/accept.d.ts +21 -13
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -130
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -20
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +120 -24
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -217
- package/connection/connect.js.map +1 -1
- package/connection/dials.d.ts +45 -0
- package/connection/dials.d.ts.map +1 -0
- package/connection/dials.js +109 -0
- package/connection/dials.js.map +1 -0
- package/connection/endpoint.d.ts +60 -0
- package/connection/endpoint.d.ts.map +1 -0
- package/connection/endpoint.js +114 -0
- package/connection/endpoint.js.map +1 -0
- package/connection/forward.d.ts +7 -1
- package/connection/forward.d.ts.map +1 -1
- package/connection/forward.js +265 -81
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +16 -9
- package/connection/goaway.d.ts.map +1 -1
- package/connection/goaway.js +22 -95
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +34 -8
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -21
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +4 -7
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -3
- package/connection/index.js.map +1 -1
- package/connection/liveness.d.ts +14 -0
- package/connection/liveness.d.ts.map +1 -0
- package/connection/liveness.js +30 -0
- package/connection/liveness.js.map +1 -0
- package/connection/pool.d.ts +142 -63
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -118
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts +60 -12
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +859 -234
- package/connection/reload.js.map +1 -1
- package/connection/session.d.ts +91 -0
- package/connection/session.d.ts.map +1 -0
- package/connection/session.js +2 -0
- package/connection/session.js.map +1 -0
- package/connection/stats.d.ts +20 -11
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js +64 -9
- package/connection/stats.js.map +1 -1
- package/connection/ticker.d.ts +4 -0
- package/connection/ticker.d.ts.map +1 -0
- package/connection/ticker.js +66 -0
- package/connection/ticker.js.map +1 -0
- package/connection/tokens.d.ts +2 -0
- package/connection/tokens.d.ts.map +1 -0
- package/connection/tokens.js +404 -0
- package/connection/tokens.js.map +1 -0
- package/connection/transport.d.ts.map +1 -1
- package/connection/transport.js +4 -5
- package/connection/transport.js.map +1 -1
- package/connection/withdrawal.d.ts +2 -0
- package/connection/withdrawal.d.ts.map +1 -0
- package/connection/withdrawal.js +23 -0
- package/connection/withdrawal.js.map +1 -0
- package/consume.js +213 -47
- package/consume.js.map +1 -1
- package/cover.d.ts +59 -0
- package/cover.d.ts.map +1 -0
- package/cover.js +375 -0
- package/cover.js.map +1 -0
- package/datagram.d.ts +70 -11
- package/datagram.d.ts.map +1 -1
- package/datagram.js +317 -2
- package/datagram.js.map +1 -1
- package/datagram_stream.d.ts +18 -0
- package/datagram_stream.d.ts.map +1 -0
- package/datagram_stream.js +67 -0
- package/datagram_stream.js.map +1 -0
- package/defined.test-util.d.ts +2 -0
- package/defined.test-util.d.ts.map +1 -0
- package/defined.test-util.js +7 -0
- package/defined.test-util.js.map +1 -0
- package/delivered.d.ts +75 -0
- package/delivered.d.ts.map +1 -0
- package/delivered.js +228 -0
- package/delivered.js.map +1 -0
- package/demand.d.ts +173 -0
- package/demand.d.ts.map +1 -0
- package/demand.js +582 -0
- package/demand.js.map +1 -0
- package/drops.d.ts +93 -0
- package/drops.d.ts.map +1 -0
- package/drops.js +283 -0
- package/drops.js.map +1 -0
- package/error.d.ts +120 -21
- package/error.d.ts.map +1 -1
- package/error.js +230 -38
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -3
- package/errors.js.map +1 -1
- package/fill.d.ts +174 -0
- package/fill.d.ts.map +1 -0
- package/fill.js +760 -0
- package/fill.js.map +1 -0
- package/flate/decoder.d.ts +2 -0
- package/flate/decoder.d.ts.map +1 -0
- package/flate/decoder.js +63 -0
- package/flate/decoder.js.map +1 -0
- package/flate/encoder.d.ts +2 -0
- package/flate/encoder.d.ts.map +1 -0
- package/flate/encoder.js +64 -0
- package/flate/encoder.js.map +1 -0
- package/flate/group.d.ts +34 -0
- package/flate/group.d.ts.map +1 -0
- package/flate/group.js +140 -0
- package/flate/group.js.map +1 -0
- package/frame.d.ts +80 -0
- package/frame.d.ts.map +1 -0
- package/frame.js +296 -0
- package/frame.js.map +1 -0
- package/frame.test-util.d.ts +5 -0
- package/frame.test-util.d.ts.map +1 -0
- package/frame.test-util.js +9 -0
- package/frame.test-util.js.map +1 -0
- package/group.d.ts +108 -45
- package/group.d.ts.map +1 -1
- package/group.js +1616 -308
- package/group.js.map +1 -1
- package/group_api.d.ts +7 -0
- package/group_api.d.ts.map +1 -0
- package/group_api.js +7 -0
- package/group_api.js.map +1 -0
- package/hop.d.ts +62 -76
- package/hop.d.ts.map +1 -1
- package/hop.js +92 -65
- package/hop.js.map +1 -1
- package/identity.d.ts +39 -0
- package/identity.d.ts.map +1 -0
- package/identity.js +47 -0
- package/identity.js.map +1 -0
- package/ietf/active_count.d.ts +2 -0
- package/ietf/active_count.d.ts.map +1 -0
- package/ietf/active_count.js +30 -0
- package/ietf/active_count.js.map +1 -0
- package/ietf/aliases.js +69 -36
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -55
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +1 -31
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +305 -144
- package/ietf/connection.js.map +1 -1
- package/ietf/datagram.d.ts +60 -0
- package/ietf/datagram.d.ts.map +1 -0
- package/ietf/datagram.js +152 -0
- package/ietf/datagram.js.map +1 -0
- package/ietf/error.d.ts +3 -3
- package/ietf/error.js +82 -101
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +93 -37
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -94
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +21 -31
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -172
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +12 -10
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -36
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -2
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +8 -20
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -15
- package/ietf/index.js.map +1 -1
- package/ietf/join.d.ts +7 -0
- package/ietf/join.d.ts.map +1 -0
- package/ietf/join.js +234 -0
- package/ietf/join.js.map +1 -0
- package/ietf/message.d.ts +18 -2
- package/ietf/message.d.ts.map +1 -1
- package/ietf/message.js +60 -41
- package/ietf/message.js.map +1 -1
- package/ietf/message.test-util.d.ts +6 -0
- package/ietf/message.test-util.d.ts.map +1 -0
- package/ietf/message.test-util.js +13 -0
- package/ietf/message.test-util.js.map +1 -0
- package/ietf/namespace.d.ts +19 -5
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -27
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +195 -33
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -179
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +25 -45
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -473
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +17 -2
- package/ietf/priority.d.ts.map +1 -1
- package/ietf/priority.js +19 -5
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +6 -5
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -49
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +25 -33
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -140
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +49 -72
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -185
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -601
- package/ietf/publisher.js.map +1 -1
- package/ietf/range.d.ts +2 -0
- package/ietf/range.d.ts.map +1 -0
- package/ietf/range.js +222 -0
- package/ietf/range.js.map +1 -0
- package/ietf/request.d.ts +6 -30
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -79
- package/ietf/request.js.map +1 -1
- package/ietf/request_stream.d.ts +1 -6
- package/ietf/request_stream.d.ts.map +1 -1
- package/ietf/request_stream.js +306 -17
- package/ietf/request_stream.js.map +1 -1
- package/ietf/session.d.ts +41 -0
- package/ietf/session.d.ts.map +1 -0
- package/ietf/session.js +65 -0
- package/ietf/session.js.map +1 -0
- package/ietf/setup.d.ts +5 -30
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -118
- package/ietf/setup.js.map +1 -1
- package/ietf/setup_options.d.ts +31 -0
- package/ietf/setup_options.d.ts.map +1 -0
- package/ietf/setup_options.js +138 -0
- package/ietf/setup_options.js.map +1 -0
- package/ietf/solicit.js +4 -15
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +52 -45
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -240
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +16 -79
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -202
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -537
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -28
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +27 -24
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -62
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +13 -42
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +22 -49
- package/ietf/version.js.map +1 -1
- package/implementation.d.ts +2 -0
- package/implementation.d.ts.map +1 -0
- package/implementation.js +5 -0
- package/implementation.js.map +1 -0
- package/index.d.ts +34 -19
- package/index.d.ts.map +1 -1
- package/index.js +19 -7
- package/index.js.map +1 -1
- package/internal.d.ts +1515 -67
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -80
- package/internal.js.map +1 -1
- package/ledger.d.ts +23 -0
- package/ledger.d.ts.map +1 -0
- package/ledger.js +247 -0
- package/ledger.js.map +1 -0
- package/listing.d.ts +132 -0
- package/listing.d.ts.map +1 -0
- package/listing.js +486 -0
- package/listing.js.map +1 -0
- package/lite/announce.d.ts +127 -66
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -159
- package/lite/announce.js.map +1 -1
- package/lite/announce_stream.d.ts +2 -0
- package/lite/announce_stream.d.ts.map +1 -0
- package/lite/announce_stream.js +92 -0
- package/lite/announce_stream.js.map +1 -0
- package/lite/answer.d.ts +22 -0
- package/lite/answer.d.ts.map +1 -0
- package/lite/answer.js +301 -0
- package/lite/answer.js.map +1 -0
- package/lite/auth.d.ts +45 -0
- package/lite/auth.d.ts.map +1 -0
- package/lite/auth.js +204 -0
- package/lite/auth.js.map +1 -0
- package/lite/compat.d.ts +31 -0
- package/lite/compat.d.ts.map +1 -0
- package/lite/compat.js +86 -0
- package/lite/compat.js.map +1 -0
- package/lite/connection.d.ts +1 -45
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +360 -78
- package/lite/connection.js.map +1 -1
- package/lite/datagram-end.d.ts +26 -0
- package/lite/datagram-end.d.ts.map +1 -0
- package/lite/datagram-end.js +30 -0
- package/lite/datagram-end.js.map +1 -0
- package/lite/datagram.d.ts +73 -8
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +144 -10
- package/lite/datagram.js.map +1 -1
- package/lite/duration.d.ts +6 -0
- package/lite/duration.d.ts.map +1 -0
- package/lite/duration.js +14 -0
- package/lite/duration.js.map +1 -0
- package/lite/error.d.ts +9 -0
- package/lite/error.d.ts.map +1 -0
- package/lite/error.js +24 -0
- package/lite/error.js.map +1 -0
- package/lite/fills.d.ts +162 -0
- package/lite/fills.d.ts.map +1 -0
- package/lite/fills.js +486 -0
- package/lite/fills.js.map +1 -0
- package/lite/fit.d.ts +49 -0
- package/lite/fit.d.ts.map +1 -0
- package/lite/fit.js +305 -0
- package/lite/fit.js.map +1 -0
- package/lite/goaway.d.ts +2 -2
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -14
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +67 -16
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -31
- package/lite/group.js.map +1 -1
- package/lite/identity.d.ts +25 -0
- package/lite/identity.d.ts.map +1 -0
- package/lite/identity.js +79 -0
- package/lite/identity.js.map +1 -0
- package/lite/index.d.ts +14 -13
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -2
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +10 -2
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -45
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +9 -2
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +11 -106
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts +2 -2
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -1
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +10 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +2548 -438
- package/lite/publisher.js.map +1 -1
- package/lite/routed.d.ts +59 -0
- package/lite/routed.d.ts.map +1 -0
- package/lite/routed.js +564 -0
- package/lite/routed.js.map +1 -0
- package/lite/session.d.ts +2 -28
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -100
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +32 -5
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -22
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +5 -11
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +5 -2
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +478 -78
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -143
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +7 -44
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3290 -516
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +27 -12
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -38
- package/lite/track.js.map +1 -1
- package/lite/tracks.d.ts +55 -0
- package/lite/tracks.d.ts.map +1 -0
- package/lite/tracks.js +114 -0
- package/lite/tracks.js.map +1 -0
- package/lite/version.d.ts +132 -24
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +378 -34
- package/lite/version.js.map +1 -1
- package/meta.d.ts +77 -0
- package/meta.d.ts.map +1 -0
- package/meta.js +130 -0
- package/meta.js.map +1 -0
- package/meta_api.d.ts +7 -0
- package/meta_api.d.ts.map +1 -0
- package/meta_api.js +7 -0
- package/meta_api.js.map +1 -0
- package/mint.d.ts +28 -0
- package/mint.d.ts.map +1 -0
- package/mint.js +66 -0
- package/mint.js.map +1 -0
- package/open.d.ts +63 -0
- package/open.d.ts.map +1 -0
- package/open.js +250 -0
- package/open.js.map +1 -0
- package/origin.d.ts +394 -142
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -687
- package/origin.js.map +1 -1
- package/package.json +8 -13
- package/path.d.ts +51 -51
- package/path.d.ts.map +1 -1
- package/path.js +210 -58
- package/path.js.map +1 -1
- package/payload.d.ts +33 -0
- package/payload.d.ts.map +1 -0
- package/payload.js +65 -0
- package/payload.js.map +1 -0
- package/prefix.d.ts +152 -0
- package/prefix.d.ts.map +1 -0
- package/prefix.js +349 -0
- package/prefix.js.map +1 -0
- package/priority.d.ts +8 -0
- package/priority.d.ts.map +1 -0
- package/priority.js +185 -0
- package/priority.js.map +1 -0
- package/queue.d.ts +2 -0
- package/queue.d.ts.map +1 -0
- package/queue.js +46 -0
- package/queue.js.map +1 -0
- package/ranges.d.ts +36 -0
- package/ranges.d.ts.map +1 -0
- package/ranges.js +312 -0
- package/ranges.js.map +1 -0
- package/rescale.d.ts +24 -0
- package/rescale.d.ts.map +1 -0
- package/rescale.js +39 -0
- package/rescale.js.map +1 -0
- package/resume.d.ts +55 -0
- package/resume.d.ts.map +1 -0
- package/resume.js +4173 -0
- package/resume.js.map +1 -0
- package/resume.test-util.d.ts +2 -0
- package/resume.test-util.d.ts.map +1 -0
- package/resume.test-util.js +25 -0
- package/resume.test-util.js.map +1 -0
- package/skips.d.ts +48 -0
- package/skips.d.ts.map +1 -0
- package/skips.js +182 -0
- package/skips.js.map +1 -0
- package/stream.d.ts +78 -40
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -93
- package/stream.js.map +1 -1
- package/subscription.test-util.d.ts +2 -0
- package/subscription.test-util.d.ts.map +1 -0
- package/subscription.test-util.js +49 -0
- package/subscription.test-util.js.map +1 -0
- package/tail.d.ts +23 -14
- package/tail.d.ts.map +1 -1
- package/tail.js +224 -98
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -92
- package/time.js.map +1 -1
- package/timed.d.ts +21 -0
- package/timed.d.ts.map +1 -0
- package/timed.js +2 -0
- package/timed.js.map +1 -0
- package/track.d.ts +578 -246
- package/track.d.ts.map +1 -1
- package/track.js +7306 -772
- package/track.js.map +1 -1
- package/track_api.d.ts +7 -0
- package/track_api.d.ts.map +1 -0
- package/track_api.js +7 -0
- package/track_api.js.map +1 -0
- package/util/abort.d.ts +1 -0
- package/util/abort.d.ts.map +1 -1
- package/util/abort.js +23 -2
- package/util/abort.js.map +1 -1
- package/util/announce.d.ts +4 -0
- package/util/announce.d.ts.map +1 -0
- package/util/announce.js +11 -0
- package/util/announce.js.map +1 -0
- package/util/bigint.d.ts +3 -0
- package/util/bigint.d.ts.map +1 -0
- package/util/bigint.js +8 -0
- package/util/bigint.js.map +1 -0
- package/util/change.d.ts +12 -0
- package/util/change.d.ts.map +1 -0
- package/util/change.js +18 -0
- package/util/change.js.map +1 -0
- package/util/deadline.d.ts +2 -0
- package/util/deadline.d.ts.map +1 -0
- package/util/deadline.js +108 -0
- package/util/deadline.js.map +1 -0
- package/util/decode_error.d.ts +3 -0
- package/util/decode_error.d.ts.map +1 -0
- package/util/decode_error.js +11 -0
- package/util/decode_error.js.map +1 -0
- package/util/demand.d.ts +8 -0
- package/util/demand.d.ts.map +1 -0
- package/util/demand.js +24 -0
- package/util/demand.js.map +1 -0
- package/util/given_up.d.ts +2 -0
- package/util/given_up.d.ts.map +1 -0
- package/util/given_up.js +101 -0
- package/util/given_up.js.map +1 -0
- package/util/hex.d.ts +6 -0
- package/util/hex.d.ts.map +1 -1
- package/util/hex.js +19 -5
- package/util/hex.js.map +1 -1
- package/util/key.d.ts +15 -0
- package/util/key.d.ts.map +1 -0
- package/util/key.js +38 -0
- package/util/key.js.map +1 -0
- package/util/limits.d.ts +2 -0
- package/util/limits.d.ts.map +1 -0
- package/util/limits.js +76 -0
- package/util/limits.js.map +1 -0
- package/util/observed.d.ts +23 -0
- package/util/observed.d.ts.map +1 -0
- package/util/observed.js +122 -0
- package/util/observed.js.map +1 -0
- package/util/sorted.d.ts +2 -0
- package/util/sorted.d.ts.map +1 -0
- package/util/sorted.js +149 -0
- package/util/sorted.js.map +1 -0
- package/util/timeout.d.ts +2 -1
- package/util/timeout.d.ts.map +1 -1
- package/util/timeout.js +13 -10
- package/util/timeout.js.map +1 -1
- package/util/timer.d.ts +2 -0
- package/util/timer.d.ts.map +1 -0
- package/util/timer.js +19 -0
- package/util/timer.js.map +1 -0
- package/util/u64.js +0 -1
- package/util/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -2
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -2
- package/util/varint.js.map +1 -1
- package/util/watch.d.ts +8 -0
- package/util/watch.d.ts.map +1 -0
- package/util/watch.js +38 -0
- package/util/watch.js.map +1 -0
- package/util/yield.d.ts +2 -0
- package/util/yield.d.ts.map +1 -0
- package/util/yield.js +31 -0
- package/util/yield.js.map +1 -0
- package/varint.d.ts +0 -29
- package/varint.d.ts.map +1 -1
- package/varint.js +7 -29
- package/varint.js.map +1 -1
- package/varint_api.d.ts +7 -0
- package/varint_api.d.ts.map +1 -0
- package/varint_api.js +7 -0
- package/varint_api.js.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +4 -0
- package/version.js.map +1 -0
- package/window.d.ts +570 -0
- package/window.d.ts.map +1 -0
- package/window.js +1677 -0
- package/window.js.map +1 -0
- package/wire.d.ts +150 -35
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -1
- package/wire.js.map +1 -1
- package/connection/established.d.ts +0 -53
- package/connection/established.d.ts.map +0 -1
- package/connection/established.js +0 -3
- package/connection/established.js.map +0 -1
- package/ietf/adapter.d.ts +0 -75
- package/ietf/adapter.d.ts.map +0 -1
- package/ietf/adapter.js +0 -700
- package/ietf/adapter.js.map +0 -1
- package/lite/datagram_stream.d.ts +0 -8
- package/lite/datagram_stream.d.ts.map +0 -1
- package/lite/datagram_stream.js +0 -44
- package/lite/datagram_stream.js.map +0 -1
- package/lite/fetch.d.ts +0 -28
- package/lite/fetch.d.ts.map +0 -1
- package/lite/fetch.js +0 -79
- package/lite/fetch.js.map +0 -1
- package/util/log.d.ts +0 -5
- package/util/log.d.ts.map +0 -1
- package/util/log.js +0 -17
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -19
- package/zod.js.map +0 -1
package/lite/fit.js
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// Widening a lite-07 subscription's ranges until they fit the message that carries them. Mirrors
|
|
2
|
+
// the Rust `lite/subscriber/fit.rs`.
|
|
3
|
+
//
|
|
4
|
+
// A relay asks its upstream for the union of every viewer's ranges, and each viewer's request
|
|
5
|
+
// fits one message while the union need not. Rather than give back the copy every viewer reads
|
|
6
|
+
// through, the relay asks for a covering superset: the narrowest gaps close first, so the fewest
|
|
7
|
+
// unwanted groups are asked for. Each viewer still reads only its own ranges from the copy.
|
|
8
|
+
import { runsFrom } from "../internal.js";
|
|
9
|
+
import { max } from "../util/key.js";
|
|
10
|
+
import { MAX_MESSAGE_SIZE } from "./message.js";
|
|
11
|
+
import { rangeSize, subscriptionPolicy, varintSize, withPolicy } from "./subscribe.js";
|
|
12
|
+
/**
|
|
13
|
+
* The most a SUBSCRIBE_UPDATE's fields besides its ranges take, size prefix included: nine
|
|
14
|
+
* varints of at most nine bytes, and the priority byte.
|
|
15
|
+
*/
|
|
16
|
+
export const UPDATE_FIELDS = 9 * 9 + 1;
|
|
17
|
+
/**
|
|
18
|
+
* The most one range takes besides its Range ID: its priority and order, each end's type, then at
|
|
19
|
+
* most three varints of nine bytes for a start and two for an end.
|
|
20
|
+
*/
|
|
21
|
+
const RANGE_FIELDS = 2 + 2 + 5 * 9;
|
|
22
|
+
/**
|
|
23
|
+
* The budget for ranges a subscription takes Range IDs from `next` for, whose SUBSCRIBE carries
|
|
24
|
+
* `fields` bytes besides its ranges, `count` the most ranges it asks for.
|
|
25
|
+
*
|
|
26
|
+
* Half a message, so that the ranges sent last, retired by Range ID, and the ranges replacing
|
|
27
|
+
* them fit one SUBSCRIBE_UPDATE however little the two share: a relay never narrows its ask in
|
|
28
|
+
* between, which would reset group streams still arriving. Never more than leaves room in a
|
|
29
|
+
* SUBSCRIBE for one range past it, which {@link fitAfter} takes.
|
|
30
|
+
*
|
|
31
|
+
* A live range the update retunes instead, its policy or a live join's max changed in place,
|
|
32
|
+
* costs its Range ID, two bytes, and its max, never more than the range as the update asks for it:
|
|
33
|
+
* the ranges replacing the last pay for their retunes as they do for their additions.
|
|
34
|
+
*/
|
|
35
|
+
export function budget(fields, next, count) {
|
|
36
|
+
const half = Math.floor((MAX_MESSAGE_SIZE - UPDATE_FIELDS) / 2);
|
|
37
|
+
const largest = next + BigInt(count);
|
|
38
|
+
// Past the varint's reach it takes the most a varint can.
|
|
39
|
+
const id = largest >= 1n << 64n ? 9 : varintSize(largest);
|
|
40
|
+
return {
|
|
41
|
+
bytes: Math.min(half, Math.max(0, MAX_MESSAGE_SIZE - fields - RANGE_FIELDS - id)),
|
|
42
|
+
id,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** What `range` costs, or undefined when it can't go out. */
|
|
46
|
+
function cost(budget, range) {
|
|
47
|
+
try {
|
|
48
|
+
return rangeSize(range) + budget.id;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Past the varint's reach, which encoding refuses too.
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* As many of `ranges`, in order, as fit `budget` beside the `spent` ones, at least the first: one
|
|
57
|
+
* range past them still fits the message, which the budget leaves room for. Mirrors the Rust
|
|
58
|
+
* `Budget::fit_after`.
|
|
59
|
+
*/
|
|
60
|
+
export function fitAfter(budget, spent, ranges) {
|
|
61
|
+
let used = spent.reduce((total, range) => total + (cost(budget, range) ?? Number.POSITIVE_INFINITY), 0);
|
|
62
|
+
const taken = [];
|
|
63
|
+
for (const range of ranges) {
|
|
64
|
+
used += cost(budget, range) ?? Number.POSITIVE_INFINITY;
|
|
65
|
+
if (used > budget.bytes && taken.length > 0)
|
|
66
|
+
break;
|
|
67
|
+
taken.push(range);
|
|
68
|
+
}
|
|
69
|
+
return taken;
|
|
70
|
+
}
|
|
71
|
+
/** What `a` and `b` ask as one range: the more urgent, newest first on a tie unless both are not. */
|
|
72
|
+
function top(a, b) {
|
|
73
|
+
return subscriptionPolicy([withPolicy({}, a ?? {}), withPolicy({}, b ?? {})]);
|
|
74
|
+
}
|
|
75
|
+
function spanCost(budget, span) {
|
|
76
|
+
const range = { start: { absolute: span.start } };
|
|
77
|
+
if (span.end !== undefined)
|
|
78
|
+
range.end = { absolute: span.end };
|
|
79
|
+
return cost(budget, range) ?? Number.POSITIVE_INFINITY;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The groups `range` asks for when it starts at one. A time is a group's start, inclusive as an
|
|
83
|
+
* end; any other end is taken as open.
|
|
84
|
+
*/
|
|
85
|
+
function groupSpan(range) {
|
|
86
|
+
const start = range.start?.absolute ?? range.start?.time;
|
|
87
|
+
if (start === undefined)
|
|
88
|
+
return undefined;
|
|
89
|
+
const end = range.end?.absolute ?? (range.end?.time === undefined ? undefined : range.end.time + 1n);
|
|
90
|
+
const policy = subscriptionPolicy([range]);
|
|
91
|
+
return end === undefined ? { start, policy } : { start, end, policy };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* `demand`'s ranges and the `fills` groups, each widened only as far as both must be to fit
|
|
95
|
+
* `budget`, as the same arrays when nothing must. A gap between fills closes across `avoid`,
|
|
96
|
+
* sorted, disjoint groups the fills leave out on purpose, only once every other gap has. A
|
|
97
|
+
* widened demand range names its groups by time, as the demand's own do, at the most urgent
|
|
98
|
+
* policy among the ranges it covers, so no group goes out later than one of them asked.
|
|
99
|
+
*
|
|
100
|
+
* Throws when even one range per kind of start would not fit, which only a broadcast path or
|
|
101
|
+
* track name filling the message leaves.
|
|
102
|
+
*/
|
|
103
|
+
export function fit(demand, fills, avoid, budget) {
|
|
104
|
+
let sum = 0;
|
|
105
|
+
for (const range of [...demand, ...fills.map(fillRange)]) {
|
|
106
|
+
const bytes = cost(budget, range);
|
|
107
|
+
// One that can't go out fails when it is encoded, as it would unfitted.
|
|
108
|
+
if (bytes === undefined)
|
|
109
|
+
return { ranges: demand, fills };
|
|
110
|
+
sum += bytes;
|
|
111
|
+
}
|
|
112
|
+
if (sum <= budget.bytes)
|
|
113
|
+
return { ranges: demand, fills };
|
|
114
|
+
const starts = [];
|
|
115
|
+
let others = [];
|
|
116
|
+
for (const range of demand) {
|
|
117
|
+
const span = groupSpan(range);
|
|
118
|
+
if (span)
|
|
119
|
+
starts.push(span);
|
|
120
|
+
else
|
|
121
|
+
others.push(range);
|
|
122
|
+
}
|
|
123
|
+
const spans = new Spans(starts, budget, () => false);
|
|
124
|
+
const runs = new Spans(fills.map((run) => ({ ...run })), budget, (gap) => {
|
|
125
|
+
const index = runsFrom(avoid, gap.start);
|
|
126
|
+
return index < avoid.length && avoid[index].start < gap.end;
|
|
127
|
+
});
|
|
128
|
+
// The other ranges have no time start, so no gap between them is measured: when even one span per
|
|
129
|
+
// list leaves them no room, they collapse to one range per kind covering them.
|
|
130
|
+
const costOf = (ranges) => ranges.reduce((sum, range) => sum + (cost(budget, range) ?? Number.POSITIVE_INFINITY), 0);
|
|
131
|
+
if (costOf(others) + spans.least() + runs.least() > budget.bytes)
|
|
132
|
+
others = collapse(others);
|
|
133
|
+
const rest = costOf(others);
|
|
134
|
+
const total = () => rest + spans.total + runs.total;
|
|
135
|
+
// Close the narrowest gaps first, of either list, until everything fits.
|
|
136
|
+
const gaps = [...spans.gaps(false), ...runs.gaps(true)].sort(byGap);
|
|
137
|
+
for (const gap of gaps) {
|
|
138
|
+
if (total() <= budget.bytes)
|
|
139
|
+
break;
|
|
140
|
+
(gap.fill ? runs : spans).join(gap.index);
|
|
141
|
+
}
|
|
142
|
+
if (total() > budget.bytes)
|
|
143
|
+
throw new Error("too many ranges for one SUBSCRIBE");
|
|
144
|
+
const ranges = spans.ranges().map(({ start, end, policy }) => {
|
|
145
|
+
const range = { start: { time: start } };
|
|
146
|
+
if (end !== undefined)
|
|
147
|
+
range.end = { time: end - 1n };
|
|
148
|
+
return withPolicy(range, policy ?? {});
|
|
149
|
+
});
|
|
150
|
+
ranges.push(...others);
|
|
151
|
+
return { ranges, fills: runs.ranges().map(({ start, end }) => ({ start, end: bounded(end) })) };
|
|
152
|
+
}
|
|
153
|
+
/** The range a fill's run takes on the wire, as `RangeFills` asks it. */
|
|
154
|
+
function fillRange(run) {
|
|
155
|
+
return { start: { absolute: run.start }, end: { absolute: run.end } };
|
|
156
|
+
}
|
|
157
|
+
/** A gap's end: only the last span is open, and no gap follows it. */
|
|
158
|
+
function bounded(end) {
|
|
159
|
+
if (end === undefined)
|
|
160
|
+
throw new Error("only the last span is open");
|
|
161
|
+
return end;
|
|
162
|
+
}
|
|
163
|
+
function byGap(a, b) {
|
|
164
|
+
if (a.late !== b.late)
|
|
165
|
+
return a.late ? 1 : -1;
|
|
166
|
+
if (a.width !== b.width)
|
|
167
|
+
return a.width < b.width ? -1 : 1;
|
|
168
|
+
if (a.fill !== b.fill)
|
|
169
|
+
return a.fill ? 1 : -1;
|
|
170
|
+
return a.index - b.index;
|
|
171
|
+
}
|
|
172
|
+
/** Disjoint spans in order, each the run of the input spans from one start to its chain's end. */
|
|
173
|
+
class Spans {
|
|
174
|
+
#spans = [];
|
|
175
|
+
// The last span of the chain starting at each chain's first, and the first of the chain ending
|
|
176
|
+
// at each chain's last.
|
|
177
|
+
#end;
|
|
178
|
+
#start;
|
|
179
|
+
// Whether the gap after each span closes only once every other gap has.
|
|
180
|
+
#late = [];
|
|
181
|
+
#budget;
|
|
182
|
+
total = 0;
|
|
183
|
+
constructor(input, budget, late) {
|
|
184
|
+
this.#budget = budget;
|
|
185
|
+
input.sort(bySpan);
|
|
186
|
+
// Spans that overlap or touch cost less as one, and ask for nothing more.
|
|
187
|
+
for (const span of input) {
|
|
188
|
+
const last = this.#spans.at(-1);
|
|
189
|
+
if (last && (last.end === undefined || last.end >= span.start)) {
|
|
190
|
+
last.end = last.end === undefined || span.end === undefined ? undefined : max(last.end, span.end);
|
|
191
|
+
last.policy = top(last.policy, span.policy);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.#spans.push({ ...span });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
for (let index = 0; index + 1 < this.#spans.length; index++)
|
|
198
|
+
this.#late.push(late({ start: bounded(this.#spans[index].end), end: this.#spans[index + 1].start }));
|
|
199
|
+
for (const span of this.#spans)
|
|
200
|
+
this.total += spanCost(budget, span);
|
|
201
|
+
this.#end = this.#spans.map((_, index) => index);
|
|
202
|
+
this.#start = this.#spans.map((_, index) => index);
|
|
203
|
+
}
|
|
204
|
+
/** What the one span covering every span costs, or nothing when there are none. */
|
|
205
|
+
least() {
|
|
206
|
+
const first = this.#spans.at(0);
|
|
207
|
+
const last = this.#spans.at(-1);
|
|
208
|
+
if (!first || !last)
|
|
209
|
+
return 0;
|
|
210
|
+
return spanCost(this.#budget, { start: first.start, end: last.end });
|
|
211
|
+
}
|
|
212
|
+
/** Every gap, tagged with whether this list is the fills'. */
|
|
213
|
+
gaps(fill) {
|
|
214
|
+
return this.#late.map((late, index) => ({
|
|
215
|
+
late,
|
|
216
|
+
width: this.#spans[index + 1].start - bounded(this.#spans[index].end),
|
|
217
|
+
fill,
|
|
218
|
+
index,
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
/** Close the gap after span `index`, joining the chains on either side. */
|
|
222
|
+
join(index) {
|
|
223
|
+
const first = this.#start[index];
|
|
224
|
+
const last = this.#end[index + 1];
|
|
225
|
+
const spans = this.#spans;
|
|
226
|
+
this.total -= spanCost(this.#budget, { start: spans[first].start, end: spans[index].end });
|
|
227
|
+
this.total -= spanCost(this.#budget, { start: spans[index + 1].start, end: spans[last].end });
|
|
228
|
+
this.total += spanCost(this.#budget, { start: spans[first].start, end: spans[last].end });
|
|
229
|
+
this.#end[first] = last;
|
|
230
|
+
this.#start[last] = first;
|
|
231
|
+
}
|
|
232
|
+
/** Each chain as the one span covering it, at the most urgent policy among its spans. */
|
|
233
|
+
ranges() {
|
|
234
|
+
const ranges = [];
|
|
235
|
+
for (let first = 0; first < this.#spans.length; first = this.#end[first] + 1) {
|
|
236
|
+
const last = this.#end[first];
|
|
237
|
+
let policy = this.#spans[first].policy;
|
|
238
|
+
for (let index = first + 1; index <= last; index++)
|
|
239
|
+
policy = top(policy, this.#spans[index].policy);
|
|
240
|
+
const span = { start: this.#spans[first].start, end: this.#spans[last].end };
|
|
241
|
+
if (policy !== undefined)
|
|
242
|
+
span.policy = policy;
|
|
243
|
+
ranges.push(span);
|
|
244
|
+
}
|
|
245
|
+
return ranges;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** By start, an open end before any bound one, then by end. */
|
|
249
|
+
function bySpan(a, b) {
|
|
250
|
+
if (a.start !== b.start)
|
|
251
|
+
return a.start < b.start ? -1 : 1;
|
|
252
|
+
if (a.end === b.end)
|
|
253
|
+
return 0;
|
|
254
|
+
if (a.end === undefined)
|
|
255
|
+
return -1;
|
|
256
|
+
if (b.end === undefined)
|
|
257
|
+
return 1;
|
|
258
|
+
return a.end < b.end ? -1 : 1;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* One range per kind of start covering every range of that kind, from the earliest start to the
|
|
262
|
+
* latest end. A time or absolute start is a span, so only ranges with no start and live joins are
|
|
263
|
+
* left: those with no start all start at the same group, and the join reaching furthest back,
|
|
264
|
+
* under the widest max, delivers what each of the others does. Each takes the most urgent policy
|
|
265
|
+
* among those it covers. Mirrors the Rust `collapse`.
|
|
266
|
+
*/
|
|
267
|
+
function collapse(ranges) {
|
|
268
|
+
const kinds = [];
|
|
269
|
+
const kind = (range) => (range.start?.live ? 1 : range.start?.joined ? 2 : 0);
|
|
270
|
+
const widest = (a, b) => (a === null || b === null ? null : Math.max(a, b));
|
|
271
|
+
for (const range of ranges) {
|
|
272
|
+
const live = range.start?.live;
|
|
273
|
+
const joined = range.start?.joined;
|
|
274
|
+
const index = kinds.findIndex((cover) => kind(cover) === kind(range));
|
|
275
|
+
if (index < 0) {
|
|
276
|
+
kinds.push({ ...range });
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
kinds[index] = withPolicy(kinds[index], subscriptionPolicy([kinds[index], range]));
|
|
280
|
+
const cover = kinds[index];
|
|
281
|
+
// The join reaching furthest back, none past one with no lag limit, under the widest max,
|
|
282
|
+
// delivers what each of the others does.
|
|
283
|
+
const held = cover.start?.live;
|
|
284
|
+
if (held !== undefined && live !== undefined)
|
|
285
|
+
cover.start = { live: { min: widest(held.min, live.min), max: widest(held.max, live.max) } };
|
|
286
|
+
// The join placed earliest, under the widest max.
|
|
287
|
+
const placed = cover.start?.joined;
|
|
288
|
+
if (placed !== undefined && joined !== undefined) {
|
|
289
|
+
const earlier = joined.absolute < placed.absolute ||
|
|
290
|
+
(joined.absolute === placed.absolute && joined.frame < placed.frame);
|
|
291
|
+
const at = earlier ? joined : placed;
|
|
292
|
+
cover.start = { joined: { absolute: at.absolute, frame: at.frame, max: widest(placed.max, joined.max) } };
|
|
293
|
+
}
|
|
294
|
+
const [a, b] = [cover.end, range.end];
|
|
295
|
+
if (a?.absolute !== undefined && b?.absolute !== undefined)
|
|
296
|
+
cover.end = { absolute: max(a.absolute, b.absolute) };
|
|
297
|
+
else if (a?.time !== undefined && b?.time !== undefined)
|
|
298
|
+
cover.end = { time: max(a.time, b.time) };
|
|
299
|
+
// An exclusive and an inclusive end, or an open one: follow the edge.
|
|
300
|
+
else
|
|
301
|
+
delete cover.end;
|
|
302
|
+
}
|
|
303
|
+
return kinds;
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=fit.js.map
|
package/lite/fit.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit.js","sourceRoot":"","sources":["../../src/lite/fit.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,qCAAqC;AACrC,EAAE;AACF,8FAA8F;AAC9F,+FAA+F;AAC/F,iGAAiG;AACjG,4FAA4F;AAE5F,OAAO,EAAY,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAe,SAAS,EAAE,kBAAkB,EAAE,UAAU,EAAkB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvC;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,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Z,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ;gBACjC,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YACrC,KAAK,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QAC3G,CAAC;QACD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,QAAQ,KAAK,SAAS,IAAI,CAAC,EAAE,QAAQ,KAAK,SAAS;YACzD,KAAK,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;aAClD,IAAI,CAAC,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,IAAI,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACnG,sEAAsE;;YACjE,OAAO,KAAK,CAAC,GAAG,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["// Widening a lite-07 subscription's ranges until they fit the message that carries them. Mirrors\n// the Rust `lite/subscriber/fit.rs`.\n//\n// A relay asks its upstream for the union of every viewer's ranges, and each viewer's request\n// fits one message while the union need not. Rather than give back the copy every viewer reads\n// through, the relay asks for a covering superset: the narrowest gaps close first, so the fewest\n// unwanted groups are asked for. Each viewer still reads only its own ranges from the copy.\n\nimport { type Run, runsFrom } from \"../internal.ts\";\nimport { max } from \"../util/key.ts\";\nimport { MAX_MESSAGE_SIZE } from \"./message.ts\";\nimport { type Policy, rangeSize, subscriptionPolicy, varintSize, type WireRange, withPolicy } from \"./subscribe.ts\";\n\n/**\n * The most a SUBSCRIBE_UPDATE's fields besides its ranges take, size prefix included: nine\n * varints of at most nine bytes, and the priority byte.\n */\nexport const UPDATE_FIELDS = 9 * 9 + 1;\n\n/**\n * The most one range takes besides its Range ID: its priority and order, each end's type, then at\n * most three varints of nine bytes for a start and two for an end.\n */\nconst RANGE_FIELDS = 2 + 2 + 5 * 9;\n\n/** What lite-07 ranges may take on the wire. */\nexport interface Budget {\n\t/** The bytes every range and its Range ID may take together. */\n\tbytes: number;\n\t/** The bytes the largest Range ID any of the ranges may take. */\n\tid: number;\n}\n\n/**\n * The budget for ranges a subscription takes Range IDs from `next` for, whose SUBSCRIBE carries\n * `fields` bytes besides its ranges, `count` the most ranges it asks for.\n *\n * Half a message, so that the ranges sent last, retired by Range ID, and the ranges replacing\n * them fit one SUBSCRIBE_UPDATE however little the two share: a relay never narrows its ask in\n * between, which would reset group streams still arriving. Never more than leaves room in a\n * SUBSCRIBE for one range past it, which {@link fitAfter} takes.\n *\n * A live range the update retunes instead, its policy or a live join's max changed in place,\n * costs its Range ID, two bytes, and its max, never more than the range as the update asks for it:\n * the ranges replacing the last pay for their retunes as they do for their additions.\n */\nexport function budget(fields: number, next: bigint, count: number): Budget {\n\tconst half = Math.floor((MAX_MESSAGE_SIZE - UPDATE_FIELDS) / 2);\n\tconst largest = next + BigInt(count);\n\t// Past the varint's reach it takes the most a varint can.\n\tconst id = largest >= 1n << 64n ? 9 : varintSize(largest);\n\treturn {\n\t\tbytes: Math.min(half, Math.max(0, MAX_MESSAGE_SIZE - fields - RANGE_FIELDS - id)),\n\t\tid,\n\t};\n}\n\n/** What `range` costs, or undefined when it can't go out. */\nfunction cost(budget: Budget, range: WireRange): number | undefined {\n\ttry {\n\t\treturn rangeSize(range) + budget.id;\n\t} catch {\n\t\t// Past the varint's reach, which encoding refuses too.\n\t\treturn undefined;\n\t}\n}\n\n/**\n * As many of `ranges`, in order, as fit `budget` beside the `spent` ones, at least the first: one\n * range past them still fits the message, which the budget leaves room for. Mirrors the Rust\n * `Budget::fit_after`.\n */\nexport function fitAfter(budget: Budget, spent: readonly WireRange[], ranges: readonly WireRange[]): WireRange[] {\n\tlet used = spent.reduce((total, range) => total + (cost(budget, range) ?? Number.POSITIVE_INFINITY), 0);\n\tconst taken: WireRange[] = [];\n\tfor (const range of ranges) {\n\t\tused += cost(budget, range) ?? Number.POSITIVE_INFINITY;\n\t\tif (used > budget.bytes && taken.length > 0) break;\n\t\ttaken.push(range);\n\t}\n\treturn taken;\n}\n\n/** Groups from `start`, up to the exclusive `end` or open, asked at `policy`. */\ninterface Span {\n\tstart: bigint;\n\tend?: bigint;\n\tpolicy?: Policy;\n}\n\n/** What `a` and `b` ask as one range: the more urgent, newest first on a tie unless both are not. */\nfunction top(a: Policy | undefined, b: Policy | undefined): Policy {\n\treturn subscriptionPolicy([withPolicy({}, a ?? {}), withPolicy({}, b ?? {})]);\n}\n\nfunction spanCost(budget: Budget, span: Span): number {\n\tconst range: WireRange = { start: { absolute: span.start } };\n\tif (span.end !== undefined) range.end = { absolute: span.end };\n\treturn cost(budget, range) ?? Number.POSITIVE_INFINITY;\n}\n\n/**\n * The groups `range` asks for when it starts at one. A time is a group's start, inclusive as an\n * end; any other end is taken as open.\n */\nfunction groupSpan(range: WireRange): Span | undefined {\n\tconst start = range.start?.absolute ?? range.start?.time;\n\tif (start === undefined) return undefined;\n\tconst end = range.end?.absolute ?? (range.end?.time === undefined ? undefined : range.end.time + 1n);\n\tconst policy = subscriptionPolicy([range]);\n\treturn end === undefined ? { start, policy } : { start, end, policy };\n}\n\n/**\n * `demand`'s ranges and the `fills` groups, each widened only as far as both must be to fit\n * `budget`, as the same arrays when nothing must. A gap between fills closes across `avoid`,\n * sorted, disjoint groups the fills leave out on purpose, only once every other gap has. A\n * widened demand range names its groups by time, as the demand's own do, at the most urgent\n * policy among the ranges it covers, so no group goes out later than one of them asked.\n *\n * Throws when even one range per kind of start would not fit, which only a broadcast path or\n * track name filling the message leaves.\n */\nexport function fit(\n\tdemand: readonly WireRange[],\n\tfills: readonly Run[],\n\tavoid: readonly Run[],\n\tbudget: Budget,\n): { ranges: readonly WireRange[]; fills: readonly Run[] } {\n\tlet sum = 0;\n\tfor (const range of [...demand, ...fills.map(fillRange)]) {\n\t\tconst bytes = cost(budget, range);\n\t\t// One that can't go out fails when it is encoded, as it would unfitted.\n\t\tif (bytes === undefined) return { ranges: demand, fills };\n\t\tsum += bytes;\n\t}\n\tif (sum <= budget.bytes) return { ranges: demand, fills };\n\n\tconst starts: Span[] = [];\n\tlet others: WireRange[] = [];\n\tfor (const range of demand) {\n\t\tconst span = groupSpan(range);\n\t\tif (span) starts.push(span);\n\t\telse others.push(range);\n\t}\n\tconst spans = new Spans(starts, budget, () => false);\n\tconst runs = new Spans(\n\t\tfills.map((run) => ({ ...run })),\n\t\tbudget,\n\t\t(gap) => {\n\t\t\tconst index = runsFrom(avoid, gap.start);\n\t\t\treturn index < avoid.length && avoid[index].start < gap.end;\n\t\t},\n\t);\n\n\t// The other ranges have no time start, so no gap between them is measured: when even one span per\n\t// list leaves them no room, they collapse to one range per kind covering them.\n\tconst costOf = (ranges: readonly WireRange[]) =>\n\t\tranges.reduce((sum, range) => sum + (cost(budget, range) ?? Number.POSITIVE_INFINITY), 0);\n\tif (costOf(others) + spans.least() + runs.least() > budget.bytes) others = collapse(others);\n\tconst rest = costOf(others);\n\tconst total = () => rest + spans.total + runs.total;\n\n\t// Close the narrowest gaps first, of either list, until everything fits.\n\tconst gaps = [...spans.gaps(false), ...runs.gaps(true)].sort(byGap);\n\tfor (const gap of gaps) {\n\t\tif (total() <= budget.bytes) break;\n\t\t(gap.fill ? runs : spans).join(gap.index);\n\t}\n\tif (total() > budget.bytes) throw new Error(\"too many ranges for one SUBSCRIBE\");\n\n\tconst ranges: WireRange[] = spans.ranges().map(({ start, end, policy }) => {\n\t\tconst range: WireRange = { start: { time: start } };\n\t\tif (end !== undefined) range.end = { time: end - 1n };\n\t\treturn withPolicy(range, policy ?? {});\n\t});\n\tranges.push(...others);\n\treturn { ranges, fills: runs.ranges().map(({ start, end }) => ({ start, end: bounded(end) })) };\n}\n\n/** The range a fill's run takes on the wire, as `RangeFills` asks it. */\nfunction fillRange(run: Run): WireRange {\n\treturn { start: { absolute: run.start }, end: { absolute: run.end } };\n}\n\n/** A gap's end: only the last span is open, and no gap follows it. */\nfunction bounded(end: bigint | undefined): bigint {\n\tif (end === undefined) throw new Error(\"only the last span is open\");\n\treturn end;\n}\n\n/** A gap between two spans: how late it closes, which list it is in, and the span before it. */\ninterface Gap {\n\tlate: boolean;\n\twidth: bigint;\n\tfill: boolean;\n\tindex: number;\n}\n\nfunction byGap(a: Gap, b: Gap): number {\n\tif (a.late !== b.late) return a.late ? 1 : -1;\n\tif (a.width !== b.width) return a.width < b.width ? -1 : 1;\n\tif (a.fill !== b.fill) return a.fill ? 1 : -1;\n\treturn a.index - b.index;\n}\n\n/** Disjoint spans in order, each the run of the input spans from one start to its chain's end. */\nclass Spans {\n\treadonly #spans: Span[] = [];\n\t// The last span of the chain starting at each chain's first, and the first of the chain ending\n\t// at each chain's last.\n\treadonly #end: number[];\n\treadonly #start: number[];\n\t// Whether the gap after each span closes only once every other gap has.\n\treadonly #late: boolean[] = [];\n\treadonly #budget: Budget;\n\ttotal = 0;\n\n\tconstructor(input: Span[], budget: Budget, late: (gap: Run) => boolean) {\n\t\tthis.#budget = budget;\n\t\tinput.sort(bySpan);\n\t\t// Spans that overlap or touch cost less as one, and ask for nothing more.\n\t\tfor (const span of input) {\n\t\t\tconst last = this.#spans.at(-1);\n\t\t\tif (last && (last.end === undefined || last.end >= span.start)) {\n\t\t\t\tlast.end = last.end === undefined || span.end === undefined ? undefined : max(last.end, span.end);\n\t\t\t\tlast.policy = top(last.policy, span.policy);\n\t\t\t} else {\n\t\t\t\tthis.#spans.push({ ...span });\n\t\t\t}\n\t\t}\n\t\tfor (let index = 0; index + 1 < this.#spans.length; index++)\n\t\t\tthis.#late.push(late({ start: bounded(this.#spans[index].end), end: this.#spans[index + 1].start }));\n\t\tfor (const span of this.#spans) this.total += spanCost(budget, span);\n\t\tthis.#end = this.#spans.map((_, index) => index);\n\t\tthis.#start = this.#spans.map((_, index) => index);\n\t}\n\n\t/** What the one span covering every span costs, or nothing when there are none. */\n\tleast(): number {\n\t\tconst first = this.#spans.at(0);\n\t\tconst last = this.#spans.at(-1);\n\t\tif (!first || !last) return 0;\n\t\treturn spanCost(this.#budget, { start: first.start, end: last.end });\n\t}\n\n\t/** Every gap, tagged with whether this list is the fills'. */\n\tgaps(fill: boolean): Gap[] {\n\t\treturn this.#late.map((late, index) => ({\n\t\t\tlate,\n\t\t\twidth: this.#spans[index + 1].start - bounded(this.#spans[index].end),\n\t\t\tfill,\n\t\t\tindex,\n\t\t}));\n\t}\n\n\t/** Close the gap after span `index`, joining the chains on either side. */\n\tjoin(index: number): void {\n\t\tconst first = this.#start[index];\n\t\tconst last = this.#end[index + 1];\n\t\tconst spans = this.#spans;\n\t\tthis.total -= spanCost(this.#budget, { start: spans[first].start, end: spans[index].end });\n\t\tthis.total -= spanCost(this.#budget, { start: spans[index + 1].start, end: spans[last].end });\n\t\tthis.total += spanCost(this.#budget, { start: spans[first].start, end: spans[last].end });\n\t\tthis.#end[first] = last;\n\t\tthis.#start[last] = first;\n\t}\n\n\t/** Each chain as the one span covering it, at the most urgent policy among its spans. */\n\tranges(): Span[] {\n\t\tconst ranges: Span[] = [];\n\t\tfor (let first = 0; first < this.#spans.length; first = this.#end[first] + 1) {\n\t\t\tconst last = this.#end[first];\n\t\t\tlet policy = this.#spans[first].policy;\n\t\t\tfor (let index = first + 1; index <= last; index++) policy = top(policy, this.#spans[index].policy);\n\t\t\tconst span: Span = { start: this.#spans[first].start, end: this.#spans[last].end };\n\t\t\tif (policy !== undefined) span.policy = policy;\n\t\t\tranges.push(span);\n\t\t}\n\t\treturn ranges;\n\t}\n}\n\n/** By start, an open end before any bound one, then by end. */\nfunction bySpan(a: Span, b: Span): number {\n\tif (a.start !== b.start) return a.start < b.start ? -1 : 1;\n\tif (a.end === b.end) return 0;\n\tif (a.end === undefined) return -1;\n\tif (b.end === undefined) return 1;\n\treturn a.end < b.end ? -1 : 1;\n}\n\n/**\n * One range per kind of start covering every range of that kind, from the earliest start to the\n * latest end. A time or absolute start is a span, so only ranges with no start and live joins are\n * left: those with no start all start at the same group, and the join reaching furthest back,\n * under the widest max, delivers what each of the others does. Each takes the most urgent policy\n * among those it covers. Mirrors the Rust `collapse`.\n */\nfunction collapse(ranges: readonly WireRange[]): WireRange[] {\n\tconst kinds: WireRange[] = [];\n\tconst kind = (range: WireRange) => (range.start?.live ? 1 : range.start?.joined ? 2 : 0);\n\tconst widest = (a: number | null, b: number | null) => (a === null || b === null ? null : Math.max(a, b));\n\tfor (const range of ranges) {\n\t\tconst live = range.start?.live;\n\t\tconst joined = range.start?.joined;\n\t\tconst index = kinds.findIndex((cover) => kind(cover) === kind(range));\n\t\tif (index < 0) {\n\t\t\tkinds.push({ ...range });\n\t\t\tcontinue;\n\t\t}\n\t\tkinds[index] = withPolicy(kinds[index], subscriptionPolicy([kinds[index], range]));\n\t\tconst cover = kinds[index];\n\t\t// The join reaching furthest back, none past one with no lag limit, under the widest max,\n\t\t// delivers what each of the others does.\n\t\tconst held = cover.start?.live;\n\t\tif (held !== undefined && live !== undefined)\n\t\t\tcover.start = { live: { min: widest(held.min, live.min), max: widest(held.max, live.max) } };\n\t\t// The join placed earliest, under the widest max.\n\t\tconst placed = cover.start?.joined;\n\t\tif (placed !== undefined && joined !== undefined) {\n\t\t\tconst earlier =\n\t\t\t\tjoined.absolute < placed.absolute ||\n\t\t\t\t(joined.absolute === placed.absolute && joined.frame < placed.frame);\n\t\t\tconst at = earlier ? joined : placed;\n\t\t\tcover.start = { joined: { absolute: at.absolute, frame: at.frame, max: widest(placed.max, joined.max) } };\n\t\t}\n\t\tconst [a, b] = [cover.end, range.end];\n\t\tif (a?.absolute !== undefined && b?.absolute !== undefined)\n\t\t\tcover.end = { absolute: max(a.absolute, b.absolute) };\n\t\telse if (a?.time !== undefined && b?.time !== undefined) cover.end = { time: max(a.time, b.time) };\n\t\t// An exclusive and an inclusive end, or an open one: follow the edge.\n\t\telse delete cover.end;\n\t}\n\treturn kinds;\n}\n"]}
|
package/lite/goaway.d.ts
CHANGED
package/lite/goaway.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goaway.d.ts","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,
|
|
1
|
+
{"version":3,"file":"goaway.d.ts","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAKvD,qBAAa,MAAM;;IAClB,GAAG,EAAE,MAAM,CAAC;IAEZ,YAAY,GAAG,EAAE,MAAM,EAEtB;IAgBK,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvD;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAGhE;CACD"}
|
package/lite/goaway.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/* @ts-self-types="./goaway.d.ts" */
|
|
2
1
|
import * as Message from "./message.js";
|
|
3
|
-
import {
|
|
4
|
-
function guardGoaway(version) {
|
|
5
|
-
switch (version) {
|
|
6
|
-
case Version.DRAFT_01:
|
|
7
|
-
case Version.DRAFT_02:
|
|
8
|
-
case Version.DRAFT_03:
|
|
9
|
-
throw new Error("goaway not supported for this version");
|
|
10
|
-
default:
|
|
11
|
-
break;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
2
|
+
import { hasGoaway } from "./version.js";
|
|
14
3
|
/// Sent to gracefully shut down a session and optionally redirect to a new URI.
|
|
15
4
|
///
|
|
16
5
|
/// Lite04+ only.
|
|
@@ -32,11 +21,13 @@ export class Goaway {
|
|
|
32
21
|
return new Goaway(uri);
|
|
33
22
|
}
|
|
34
23
|
async encode(w, version) {
|
|
35
|
-
|
|
24
|
+
if (!hasGoaway(version))
|
|
25
|
+
throw new Error("goaway not supported for this version");
|
|
36
26
|
return Message.encode(w, this.#encode.bind(this));
|
|
37
27
|
}
|
|
38
28
|
static async decode(r, version) {
|
|
39
|
-
|
|
29
|
+
if (!hasGoaway(version))
|
|
30
|
+
throw new Error("goaway not supported for this version");
|
|
40
31
|
return Message.decode(r, Goaway.#decode);
|
|
41
32
|
}
|
|
42
33
|
}
|
package/lite/goaway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"goaway.js","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"goaway.js","sourceRoot":"","sources":["../../src/lite/goaway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAEvD,gFAAgF;AAChF,GAAG;AACH,iBAAiB;AACjB,MAAM,OAAO,MAAM;IAClB,GAAG,CAAS;IAEZ,YAAY,GAAW;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,CAAS;QACtB,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAS;QAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,wEAAwE;QACxE,iDAAiD;QACjD,IAAI,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,CAAS,EAAE,OAAgB;QACvC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAClF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAS,EAAE,OAAgB;QAC9C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAClF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Reader, Writer } from \"../stream.ts\";\nimport * as Message from \"./message.ts\";\nimport { hasGoaway, type Version } from \"./version.ts\";\n\n/// Sent to gracefully shut down a session and optionally redirect to a new URI.\n///\n/// Lite04+ only.\nexport class Goaway {\n\turi: string;\n\n\tconstructor(uri: string) {\n\t\tthis.uri = uri;\n\t}\n\n\tasync #encode(w: Writer) {\n\t\tawait w.string(this.uri);\n\t}\n\n\tstatic async #decode(r: Reader): Promise<Goaway> {\n\t\tconst uri = await r.string();\n\t\t// The URI is capped at 8,192 bytes, matching the IETF wire and the Rust\n\t\t// decoder; a longer one is a protocol violation.\n\t\tif (new TextEncoder().encode(uri).byteLength > 8192) {\n\t\t\tthrow new Error(\"GOAWAY URI exceeds 8,192 bytes\");\n\t\t}\n\t\treturn new Goaway(uri);\n\t}\n\n\tasync encode(w: Writer, version: Version): Promise<void> {\n\t\tif (!hasGoaway(version)) throw new Error(\"goaway not supported for this version\");\n\t\treturn Message.encode(w, this.#encode.bind(this));\n\t}\n\n\tstatic async decode(r: Reader, version: Version): Promise<Goaway> {\n\t\tif (!hasGoaway(version)) throw new Error(\"goaway not supported for this version\");\n\t\treturn Message.decode(r, Goaway.#decode);\n\t}\n}\n"]}
|
package/lite/group.d.ts
CHANGED
|
@@ -1,36 +1,87 @@
|
|
|
1
|
-
import type * as netGroup from "../group";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type * as netGroup from "../group.ts";
|
|
2
|
+
import { type WirePayload } from "../payload.ts";
|
|
3
|
+
import type { Cursor, Reader, Writer } from "../stream.ts";
|
|
4
|
+
import { type Version } from "./version.ts";
|
|
4
5
|
export declare class Group {
|
|
5
6
|
#private;
|
|
6
7
|
subscribe: bigint;
|
|
7
|
-
|
|
8
|
+
key: bigint;
|
|
8
9
|
/**
|
|
9
10
|
* The index of the first frame on this stream within the group.
|
|
10
11
|
*
|
|
11
12
|
* 0 (the common case) means the stream carries the group from its beginning. A
|
|
12
|
-
* higher value means the leading frames are not here,
|
|
13
|
-
*
|
|
14
|
-
* the tail. Lite-06+; older versions always start at 0.
|
|
13
|
+
* higher value means the leading frames are not here, because the subscription started
|
|
14
|
+
* partway into the group. Lite-06+ only; older versions always start at 0.
|
|
15
15
|
*/
|
|
16
16
|
frameStart: number;
|
|
17
|
-
constructor({ subscribe, sequence, frameStart, }: {
|
|
17
|
+
constructor({ subscribe, key: sequence, frameStart, }: {
|
|
18
18
|
subscribe: bigint;
|
|
19
|
-
|
|
19
|
+
key: bigint;
|
|
20
20
|
frameStart?: number;
|
|
21
21
|
});
|
|
22
22
|
encode(w: Writer, version: Version): Promise<void>;
|
|
23
23
|
static decode(r: Reader, version: Version): Promise<Group>;
|
|
24
24
|
static decodeMaybe(r: Reader, version: Version): Promise<Group | undefined>;
|
|
25
25
|
}
|
|
26
|
+
/** A decoded frame, whose payload may still be a stored slice or follow on the stream. */
|
|
27
|
+
export interface WireFrame extends WirePayload {
|
|
28
|
+
/** The declared plain size on a compressed track. */
|
|
29
|
+
inflated?: number;
|
|
30
|
+
/** A metadata FRAME: its header alone, `size` being the plain size, with no payload. */
|
|
31
|
+
header?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Lite-07 GROUP_END: the group is whole, ending at `end` in the track's timescale. */
|
|
34
|
+
export interface GroupEnd {
|
|
35
|
+
end: bigint;
|
|
36
|
+
}
|
|
37
|
+
/** How {@link frameDecoder} reads each frame's optional fields. */
|
|
38
|
+
export interface FrameFormat {
|
|
39
|
+
/** The wire timescale; non-zero means every frame carries a delta timestamp. */
|
|
40
|
+
scale: number;
|
|
41
|
+
/**
|
|
42
|
+
* The group's start: lite-07's frame 0 sits there, a later stream's first timestamp delta counts
|
|
43
|
+
* from it, and so does a GROUP_END's End when the stream carries no timestamp. Before lite-07
|
|
44
|
+
* the first delta counts from 0.
|
|
45
|
+
*/
|
|
46
|
+
start?: bigint;
|
|
47
|
+
/**
|
|
48
|
+
* The index of the stream's first frame, from its GROUP header: on lite-07, frame 0 carries no
|
|
49
|
+
* delta, and a GROUP_END before any frame is malformed only for a stream from frame 0.
|
|
50
|
+
* {@link readFrames} defaults it to where its group begins.
|
|
51
|
+
*/
|
|
52
|
+
frameStart?: number;
|
|
53
|
+
/** Whether every frame declares its plain size ahead of a stored slice. */
|
|
54
|
+
compress?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether every frame leads with its `Payload Length`, the payload size plus one (lite-07),
|
|
57
|
+
* rather than ending its header with the size. Lite-07 also carries unsigned timestamp deltas;
|
|
58
|
+
* earlier versions carry zigzag ones that a receiver reads and drops.
|
|
59
|
+
*/
|
|
60
|
+
lengthFirst?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether every frame is its header alone, as a metadata subscription delivers it (lite-07): its
|
|
63
|
+
* `Payload Length` is the plain size plus one, with no Inflated Size and no payload, compressed
|
|
64
|
+
* track or not. {@link readFrames} takes it from the group it writes.
|
|
65
|
+
*/
|
|
66
|
+
meta?: boolean;
|
|
67
|
+
}
|
|
26
68
|
/**
|
|
27
|
-
*
|
|
69
|
+
* Decode one frame, with timestamp deltas when stamped and declared plain sizes when compressed,
|
|
70
|
+
* or a lite-07 GROUP_END. Lite-07 leads with the size plus one, 0 for GROUP_END, where stream end
|
|
71
|
+
* closes the group; before it the size ends the header, and stream end at the frame's first field
|
|
72
|
+
* ends the group.
|
|
28
73
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* timestamp,
|
|
74
|
+
* On lite-07 frame 0 carries no delta, sitting at the group's `start`; every other delta is an
|
|
75
|
+
* unsigned offset from the prior frame, or from `start` for a stream that begins later, and
|
|
76
|
+
* GROUP_END's End counts from the last frame's timestamp, or from `start` when the stream carried
|
|
77
|
+
* none. Before lite-07 every delta is read and dropped: a publisher may stamp send times there. Mirrors the Rust `FrameIngest`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function frameDecoder({ scale, start, frameStart, compress, lengthFirst, meta, }: FrameFormat): (c: Cursor) => WireFrame | GroupEnd;
|
|
80
|
+
/**
|
|
81
|
+
* Write a group stream's frames into `producer` until the stream ends or the producer closes.
|
|
82
|
+
* Resolves with where a lite-07 GROUP_END said the group ends, or undefined when the stream ended
|
|
83
|
+
* without one: the caller finishes the group at that end, and a bare FIN only closes it. Anything
|
|
84
|
+
* after GROUP_END is malformed.
|
|
32
85
|
*/
|
|
33
|
-
export declare function
|
|
34
|
-
/** Write a group stream's frames into `producer` until the stream ends or the producer closes. */
|
|
35
|
-
export declare function readFrames(stream: Reader, producer: netGroup.Producer, scale: number): Promise<void>;
|
|
86
|
+
export declare function readFrames(stream: Reader, producer: netGroup.Producer, format: FrameFormat): Promise<bigint | undefined>;
|
|
36
87
|
//# sourceMappingURL=group.d.ts.map
|
package/lite/group.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/lite/group.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/lite/group.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,QAAQ,MAAM,aAAa,CAAC;AAE7C,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAO3D,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,qBAAa,KAAK;;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,YAAY,EACX,SAAS,EACT,GAAG,EAAE,QAAQ,EACb,UAAc,GACd,EAAE;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,EAIA;IAoBK,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvD;IAED,OAAa,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAE/D;IAED,OAAa,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,OA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