@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/ietf/object.js
CHANGED
|
@@ -1,109 +1,131 @@
|
|
|
1
|
-
/* @ts-self-types="./object.d.ts" */
|
|
2
1
|
import { ProtocolViolation, StreamCode, Stream as StreamError } from "../error.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { decodePayload } from "../payload.js";
|
|
3
|
+
import { asIetf, concat, encodeVarint, Writer } from "../stream.js";
|
|
4
|
+
import { received, Timestamp } from "../time.js";
|
|
5
|
+
import { U64 } from "../util/u64.js";
|
|
6
|
+
import { DEFAULT_WIRE } from "./priority.js";
|
|
7
|
+
import { isDraft23, Version } from "./version.js";
|
|
6
8
|
// Implementation limit for object extension blocks, independent of the IETF draft.
|
|
7
9
|
const MAX_OBJECT_EXTENSIONS = 64 * 1024;
|
|
8
10
|
const GROUP_END = 0x03;
|
|
9
11
|
const END_OF_TRACK = 0x04;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
12
|
+
/** Whether `status` is an Object Status the drafts define: Normal, End of Group, or End of Track. */
|
|
13
|
+
export function statusDefined(status) {
|
|
14
|
+
return status === 0 || status === GROUP_END || status === END_OF_TRACK;
|
|
15
|
+
}
|
|
16
|
+
// MOQ Object Property ids. Both are even, so their values are bare varints.
|
|
17
|
+
const PRIOR_GROUP_ID_GAP = 0x3cn;
|
|
18
|
+
const TIMESTAMP_TIE = 0x40b72n;
|
|
19
|
+
const IMMUTABLE_PROPERTIES = 0x0bn;
|
|
18
20
|
// draft-18 adds bit 0x40 (FIRST_OBJECT) to the subgroup header type per spec
|
|
19
21
|
// 11.4.2. Set on emit unless a filter trimmed the group's head. On parse a
|
|
20
22
|
// cleared bit is the peer's claim that the stream starts partway through;
|
|
21
|
-
// object 0 is still the head
|
|
23
|
+
// object 0 is still the payload head; a standalone terminal may name a later ID.
|
|
22
24
|
const FIRST_OBJECT_BIT = 0x40;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
const MAX_SAFE_KEY = BigInt(Number.MAX_SAFE_INTEGER);
|
|
26
|
+
/**
|
|
27
|
+
* Compute the wire `(id, tie)` for a frame at `dts` in group `groupId` following `prior`
|
|
28
|
+
* (the previous frame's Object ID, if any), per draft-lcurley-moq-timestamp.
|
|
29
|
+
*/
|
|
30
|
+
export function timestampObjectId(groupId, prior, dts) {
|
|
31
|
+
const minOid = prior === undefined ? 0n : prior + 1n;
|
|
32
|
+
const desired = dts > groupId ? dts - groupId : 0n;
|
|
33
|
+
let id = minOid;
|
|
34
|
+
if (desired > id)
|
|
35
|
+
id = desired;
|
|
36
|
+
const tie = groupId + id > dts ? groupId + id - dts : 0n;
|
|
37
|
+
return { id, tie };
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A received object's timestamp: `Group ID + Object ID - tie` in the track's `ID_TIMESCALE`
|
|
41
|
+
* when declared (per draft-lcurley-moq-timestamp), else {@link Timestamp.unscaled}.
|
|
42
|
+
*/
|
|
43
|
+
export function objectTime(timescale, key, objectId = 0n, tie = 0n) {
|
|
44
|
+
if (timescale === undefined)
|
|
45
|
+
return received(undefined, key);
|
|
46
|
+
const dts = key + objectId - tie;
|
|
47
|
+
if (dts < 0n) {
|
|
48
|
+
throw new StreamError(StreamCode.MalformedTrack, {
|
|
49
|
+
message: `TIMESTAMP_TIE ${tie} exceeds ${key} + ${objectId}`,
|
|
50
|
+
});
|
|
42
51
|
}
|
|
52
|
+
if (dts > MAX_SAFE_KEY) {
|
|
53
|
+
throw new StreamError(StreamCode.NotSupported, { message: `timestamp ${dts} is past the latest timestamp` });
|
|
54
|
+
}
|
|
55
|
+
return new Timestamp(Number(dts), timescale);
|
|
43
56
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// on the wire matches what the track declared.
|
|
52
|
-
async function encodeObjectTime(w, timestamp, timescale, version) {
|
|
53
|
-
const value = Math.round((timestamp.value * timescale) / timestamp.scale);
|
|
54
|
-
await encodeObjectPropertyType(w, PROP_TIMESTAMP, 0n, version);
|
|
55
|
-
await w.u62(BigInt(value));
|
|
56
|
-
}
|
|
57
|
-
async function encodeObjectExtensions(timestamp, timescale, version) {
|
|
58
|
-
if (timestamp === undefined) {
|
|
59
|
-
return new Uint8Array();
|
|
57
|
+
/** Encode the Properties block of an object carrying an optional Prior Group ID Gap and/or Timestamp Tie. */
|
|
58
|
+
export function encodeObjectProperties({ groupGap, tie }, version) {
|
|
59
|
+
const parts = [];
|
|
60
|
+
let prev = 0n;
|
|
61
|
+
if (groupGap !== undefined && groupGap > 0n) {
|
|
62
|
+
parts.push(encodeVarint(PRIOR_GROUP_ID_GAP - prev, version), encodeVarint(groupGap, version));
|
|
63
|
+
prev = PRIOR_GROUP_ID_GAP;
|
|
60
64
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
write(chunk) {
|
|
64
|
-
chunks.push(new Uint8Array(chunk));
|
|
65
|
-
},
|
|
66
|
-
}), version);
|
|
67
|
-
await encodeObjectTime(writer, timestamp, timescale, version);
|
|
68
|
-
writer.close();
|
|
69
|
-
await writer.closed;
|
|
70
|
-
const size = chunks.reduce((total, chunk) => total + chunk.byteLength, 0);
|
|
71
|
-
const result = new Uint8Array(size);
|
|
72
|
-
let offset = 0;
|
|
73
|
-
for (const chunk of chunks) {
|
|
74
|
-
result.set(chunk, offset);
|
|
75
|
-
offset += chunk.byteLength;
|
|
65
|
+
if (tie !== undefined && tie > 0n) {
|
|
66
|
+
parts.push(encodeVarint(TIMESTAMP_TIE - prev, version), encodeVarint(tie, version));
|
|
76
67
|
}
|
|
77
|
-
return
|
|
68
|
+
return parts.length > 0 ? concat(parts) : undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Decode an object's Properties block, consuming all of it, for the Prior Group ID Gap and
|
|
72
|
+
* Timestamp Tie, outside or inside Immutable Properties. Every other property is skipped.
|
|
73
|
+
*/
|
|
74
|
+
export function decodeObjectProperties(c) {
|
|
75
|
+
return decodeProperties(c, false);
|
|
78
76
|
}
|
|
79
|
-
function
|
|
80
|
-
let
|
|
81
|
-
let
|
|
77
|
+
function decodeProperties(c, immutable) {
|
|
78
|
+
let groupGap;
|
|
79
|
+
let tie;
|
|
80
|
+
let sealed = false;
|
|
82
81
|
let prevType = 0n;
|
|
83
|
-
|
|
82
|
+
const malformed = (message) => new StreamError(StreamCode.MalformedTrack, { message });
|
|
84
83
|
while (c.remaining > 0) {
|
|
85
|
-
const
|
|
86
|
-
const id = !hasDeltaObjectPropertyTypes(asIetf(c.version)) || first ? step : prevType + step;
|
|
87
|
-
first = false;
|
|
84
|
+
const id = prevType + c.u62();
|
|
88
85
|
prevType = id;
|
|
89
86
|
if (id % 2n === 0n) {
|
|
90
87
|
const value = c.u62();
|
|
91
|
-
if (id ===
|
|
92
|
-
|
|
88
|
+
if (id === PRIOR_GROUP_ID_GAP) {
|
|
89
|
+
if (groupGap !== undefined)
|
|
90
|
+
throw malformed("repeated Prior Group ID Gap");
|
|
91
|
+
groupGap = value;
|
|
93
92
|
}
|
|
94
|
-
else if (id ===
|
|
95
|
-
|
|
93
|
+
else if (id === TIMESTAMP_TIE) {
|
|
94
|
+
if (tie !== undefined)
|
|
95
|
+
throw malformed("repeated Timestamp Tie");
|
|
96
|
+
tie = value;
|
|
96
97
|
}
|
|
98
|
+
continue;
|
|
97
99
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
const length = c.u53();
|
|
101
|
+
if (id !== IMMUTABLE_PROPERTIES) {
|
|
102
|
+
c.read(length);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (immutable || sealed)
|
|
106
|
+
throw malformed("nested or repeated Immutable Properties");
|
|
107
|
+
sealed = true;
|
|
108
|
+
let inner;
|
|
109
|
+
try {
|
|
110
|
+
inner = c.exact(length, (e) => decodeProperties(e, true));
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
if (err instanceof StreamError)
|
|
114
|
+
throw err;
|
|
115
|
+
throw malformed("unreadable Immutable Properties");
|
|
116
|
+
}
|
|
117
|
+
if (inner.groupGap !== undefined) {
|
|
118
|
+
if (groupGap !== undefined)
|
|
119
|
+
throw malformed("repeated Prior Group ID Gap");
|
|
120
|
+
groupGap = inner.groupGap;
|
|
121
|
+
}
|
|
122
|
+
if (inner.tie !== undefined) {
|
|
123
|
+
if (tie !== undefined)
|
|
124
|
+
throw malformed("repeated Timestamp Tie");
|
|
125
|
+
tie = inner.tie;
|
|
100
126
|
}
|
|
101
127
|
}
|
|
102
|
-
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
// An object-scope Timescale (which LOC permits) overrides the track's for this object.
|
|
106
|
-
return new Timestamp(Number(timestamp), overrideScale !== undefined ? Timescale(Number(overrideScale)) : timescale);
|
|
128
|
+
return { groupGap, tie };
|
|
107
129
|
}
|
|
108
130
|
/**
|
|
109
131
|
* STREAM_HEADER_SUBGROUP from moq-transport spec.
|
|
@@ -129,8 +151,8 @@ export class Group {
|
|
|
129
151
|
async encode(w, version) {
|
|
130
152
|
await w.write(await Writer.collect(version, (h) => this.#encode(h, version)));
|
|
131
153
|
}
|
|
132
|
-
async #encode(w,
|
|
133
|
-
if (!this.flags.hasSubgroup && this.subGroupId !==
|
|
154
|
+
async #encode(w, _version) {
|
|
155
|
+
if (!this.flags.hasSubgroup && this.subGroupId !== 0n) {
|
|
134
156
|
throw new Error(`Subgroup ID must be 0 if hasSubgroup is false: ${this.subGroupId}`);
|
|
135
157
|
}
|
|
136
158
|
const base = this.flags.hasPriority ? 0x10 : 0x30;
|
|
@@ -147,30 +169,30 @@ export class Group {
|
|
|
147
169
|
if (this.flags.hasEnd) {
|
|
148
170
|
id |= 0x08;
|
|
149
171
|
}
|
|
150
|
-
if (this.flags.firstObject
|
|
172
|
+
if (this.flags.firstObject) {
|
|
151
173
|
id |= FIRST_OBJECT_BIT;
|
|
152
174
|
}
|
|
153
175
|
await w.u53(id);
|
|
154
176
|
await w.u62(this.trackAlias);
|
|
155
|
-
await w.
|
|
177
|
+
await w.u62(this.groupId);
|
|
156
178
|
if (this.flags.hasSubgroup) {
|
|
157
|
-
await w.
|
|
179
|
+
await w.u62(this.subGroupId);
|
|
158
180
|
}
|
|
159
181
|
if (this.flags.hasPriority) {
|
|
160
182
|
await w.u8(this.publisherPriority);
|
|
161
183
|
}
|
|
162
184
|
}
|
|
163
185
|
/** Decode a SUBGROUP_HEADER. Pass `type` when the caller already read it to classify the stream. */
|
|
164
|
-
static async decode(r,
|
|
186
|
+
static async decode(r, _version, type) {
|
|
165
187
|
const raw = type ?? (await r.u53());
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
//
|
|
169
|
-
|
|
170
|
-
const firstObject =
|
|
171
|
-
const id =
|
|
188
|
+
if (raw > 0x7f)
|
|
189
|
+
throw new ProtocolViolation(`Unsupported group type: ${raw}`);
|
|
190
|
+
// Strip the FIRST_OBJECT bit before the range check, but keep the value: it is the only
|
|
191
|
+
// signal that a subgroup starts partway through.
|
|
192
|
+
const firstObject = (raw & FIRST_OBJECT_BIT) !== 0;
|
|
193
|
+
const id = raw & ~FIRST_OBJECT_BIT;
|
|
172
194
|
// An invalid type MUST close the session, including the reserved SUBGROUP_ID_MODE
|
|
173
|
-
// 0b11 (draft-
|
|
195
|
+
// 0b11 (draft-22 section 11.3.1).
|
|
174
196
|
const known = (id >= 0x10 && id <= 0x1f) || (id >= 0x30 && id <= 0x3f);
|
|
175
197
|
if (!known || (id & 0x06) === 0x06) {
|
|
176
198
|
throw new ProtocolViolation(`Unsupported group type: ${raw}`);
|
|
@@ -187,105 +209,174 @@ export class Group {
|
|
|
187
209
|
firstObject,
|
|
188
210
|
};
|
|
189
211
|
const trackAlias = await r.u62();
|
|
190
|
-
const groupId = await r.
|
|
191
|
-
const subGroupId = flags.hasSubgroup ? await r.
|
|
192
|
-
const publisherPriority = hasPriority ? await r.u8() :
|
|
212
|
+
const groupId = await r.u62();
|
|
213
|
+
const subGroupId = flags.hasSubgroup ? await r.u62() : 0n;
|
|
214
|
+
const publisherPriority = hasPriority ? await r.u8() : DEFAULT_WIRE;
|
|
193
215
|
return new Group({ trackAlias, groupId, subGroupId, publisherPriority, flags });
|
|
194
216
|
}
|
|
195
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* An object id that is not the next one in the group.
|
|
220
|
+
*
|
|
221
|
+
* moq-lite groups start at object 0 and never skip one, so a non-zero delta is either
|
|
222
|
+
* a subgroup that starts partway through or a hole later in the stream.
|
|
223
|
+
*/
|
|
224
|
+
export class ObjectIdGap extends Error {
|
|
225
|
+
constructor(delta) {
|
|
226
|
+
super(`object IDs must start at 0 and increment by 1, got a delta of ${delta}`);
|
|
227
|
+
this.name = "ObjectIdGap";
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/** A draft-14 END_OF_TRACK carried properties, which a track-level end has nowhere to keep. */
|
|
231
|
+
export class EndOfTrackProperties extends Error {
|
|
232
|
+
constructor() {
|
|
233
|
+
super("END_OF_TRACK properties are unsupported");
|
|
234
|
+
this.name = "EndOfTrackProperties";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
196
237
|
/** A moq-transport object inside a group stream. */
|
|
197
238
|
export class Frame {
|
|
198
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* The object payload, or `undefined` for an end of group or end of track marker, or for
|
|
241
|
+
* an object whose payload streams after its header (see {@link streamed}).
|
|
242
|
+
*/
|
|
199
243
|
payload;
|
|
200
|
-
/** The
|
|
201
|
-
|
|
244
|
+
/** The payload length of an object past one segment, which follows on the stream instead of in {@link payload}. */
|
|
245
|
+
streamed;
|
|
246
|
+
/**
|
|
247
|
+
* The Prior Group ID Gap in the object's properties: how many Group IDs just below its own
|
|
248
|
+
* the publisher will never produce. Only the group's first object sends one.
|
|
249
|
+
*/
|
|
250
|
+
groupGap;
|
|
251
|
+
/** The Timestamp Tie (`0x40B72`) subtracted from `Group ID + Object ID`. */
|
|
252
|
+
tie;
|
|
202
253
|
/**
|
|
203
254
|
* An END_OF_TRACK marker: no object at or past its location exists. At object 0 its group
|
|
204
255
|
* does not exist either, so the track ends at that group; later in a group it ends after it.
|
|
205
256
|
*/
|
|
206
257
|
endOfTrack;
|
|
207
|
-
|
|
258
|
+
/** Absolute object ID for the first object or a standalone terminal; delta minus 1 thereafter. */
|
|
259
|
+
idDelta = 0;
|
|
260
|
+
/** An END_OF_TRACK that carries properties, which a track end has nowhere to keep. */
|
|
261
|
+
hasProperties = false;
|
|
262
|
+
constructor({ payload, streamed, groupGap, tie, endOfTrack = false, } = {}) {
|
|
208
263
|
this.payload = payload;
|
|
209
|
-
this.
|
|
264
|
+
this.streamed = streamed;
|
|
265
|
+
this.groupGap = groupGap;
|
|
266
|
+
this.tie = tie;
|
|
210
267
|
this.endOfTrack = endOfTrack;
|
|
211
268
|
}
|
|
269
|
+
/** Whether this is an object, rather than an end of group or end of track marker. */
|
|
270
|
+
get isObject() {
|
|
271
|
+
return this.payload !== undefined || this.streamed !== undefined;
|
|
272
|
+
}
|
|
212
273
|
/**
|
|
213
274
|
* Encode this frame using the group flags and negotiated IETF version.
|
|
214
275
|
*
|
|
215
|
-
* `idDelta` is the first object's absolute Object ID and
|
|
216
|
-
*
|
|
276
|
+
* `idDelta` is the first object's absolute Object ID and the gap above `prior + 1` for
|
|
277
|
+
* every later one. A {@link streamed} object writes only its header; the caller writes its payload.
|
|
217
278
|
*/
|
|
218
|
-
async encode(w, flags,
|
|
219
|
-
|
|
279
|
+
async encode(w, flags, version, idDelta = 0) {
|
|
280
|
+
// Everything before the payload is built in memory and goes out as one write: a stream
|
|
281
|
+
// write is far costlier than a varint, and a backlog pays it for every object.
|
|
282
|
+
const header = [encodeVarint(idDelta, version)];
|
|
220
283
|
if (flags.hasExtensions) {
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
284
|
+
const properties = encodeObjectProperties({ groupGap: this.groupGap, tie: this.tie }, version);
|
|
285
|
+
header.push(encodeVarint(properties?.byteLength ?? 0, version));
|
|
286
|
+
if (properties)
|
|
287
|
+
header.push(properties);
|
|
224
288
|
}
|
|
289
|
+
const payload = this.endOfTrack ? undefined : this.payload;
|
|
225
290
|
if (this.endOfTrack) {
|
|
226
|
-
|
|
227
|
-
await w.u53(END_OF_TRACK);
|
|
291
|
+
header.push(encodeVarint(0, version), encodeVarint(END_OF_TRACK, version)); // length = 0
|
|
228
292
|
}
|
|
229
|
-
else if (this.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
else {
|
|
235
|
-
await w.write(this.payload);
|
|
236
|
-
}
|
|
293
|
+
else if (this.streamed) {
|
|
294
|
+
header.push(encodeVarint(this.streamed, version));
|
|
295
|
+
}
|
|
296
|
+
else if (payload === undefined) {
|
|
297
|
+
header.push(encodeVarint(0, version), encodeVarint(GROUP_END, version)); // length = 0
|
|
237
298
|
}
|
|
238
299
|
else {
|
|
239
|
-
|
|
240
|
-
|
|
300
|
+
header.push(encodeVarint(payload.byteLength, version));
|
|
301
|
+
if (payload.byteLength === 0)
|
|
302
|
+
header.push(encodeVarint(0, version)); // status = normal
|
|
241
303
|
}
|
|
304
|
+
await w.write(concat(header));
|
|
305
|
+
if (payload !== undefined && payload.byteLength > 0)
|
|
306
|
+
await w.write(payload);
|
|
242
307
|
}
|
|
243
|
-
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Decode a frame using the group flags, at the cursor's negotiated IETF version.
|
|
310
|
+
*
|
|
311
|
+
* `offset` lets a stream's first object start past zero, reporting its absolute Object ID
|
|
312
|
+
* in `idDelta` rather than throwing {@link ObjectIdGap}. `sparse` allows arbitrary non-zero
|
|
313
|
+
* Object ID deltas on a timed track (draft-lcurley-moq-timestamp).
|
|
314
|
+
*/
|
|
315
|
+
static decode(c, flags, offset = false, sparse = false) {
|
|
316
|
+
let delta = 0;
|
|
317
|
+
if (flags.hasSubgroupObject) {
|
|
318
|
+
// A compact stream's first Object ID is its subgroup, and only subgroup 0 is
|
|
319
|
+
// supported, so refuse one of any size before the rest of the object can fail
|
|
320
|
+
// differently. Later objects carry plain deltas: decode them without this flag.
|
|
321
|
+
const id = c.varint();
|
|
322
|
+
if (!id.equals(U64.ZERO))
|
|
323
|
+
throw new ObjectIdGap(id);
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
delta = c.u53();
|
|
327
|
+
}
|
|
328
|
+
let groupGap;
|
|
329
|
+
let tie;
|
|
330
|
+
let hasProperties = false;
|
|
254
331
|
if (flags.hasExtensions) {
|
|
255
332
|
const extensionsLength = c.u53();
|
|
256
333
|
if (extensionsLength > MAX_OBJECT_EXTENSIONS) {
|
|
257
334
|
throw new StreamError(StreamCode.MalformedTrack, { message: "object extensions exceed 64 KiB" });
|
|
258
335
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
c.read(extensionsLength);
|
|
266
|
-
}
|
|
336
|
+
hasProperties = extensionsLength !== 0;
|
|
337
|
+
const decoded = c.exact(extensionsLength, decodeObjectProperties);
|
|
338
|
+
groupGap = decoded.groupGap;
|
|
339
|
+
tie = decoded.tie;
|
|
267
340
|
}
|
|
268
341
|
const payloadLength = c.u53();
|
|
269
342
|
if (payloadLength > 0) {
|
|
270
|
-
|
|
271
|
-
|
|
343
|
+
if (delta !== 0 && !offset && !sparse)
|
|
344
|
+
throw new ObjectIdGap(delta);
|
|
345
|
+
const payload = decodePayload(c, payloadLength);
|
|
346
|
+
const frame = new Frame({
|
|
347
|
+
payload,
|
|
348
|
+
streamed: payload === undefined ? payloadLength : undefined,
|
|
349
|
+
groupGap,
|
|
350
|
+
tie,
|
|
351
|
+
});
|
|
352
|
+
frame.idDelta = delta;
|
|
353
|
+
return frame;
|
|
272
354
|
}
|
|
273
355
|
const status = c.u53();
|
|
356
|
+
if (status !== 0 && hasProperties) {
|
|
357
|
+
throw new ProtocolViolation(`status object ${status} carries properties`);
|
|
358
|
+
}
|
|
274
359
|
// Defined on every implemented draft, whether or not the header marks the group's end.
|
|
275
|
-
if (status === END_OF_TRACK)
|
|
276
|
-
|
|
360
|
+
if (status === END_OF_TRACK) {
|
|
361
|
+
const frame = new Frame({ endOfTrack: true });
|
|
362
|
+
frame.idDelta = delta;
|
|
363
|
+
frame.hasProperties = hasProperties;
|
|
364
|
+
return frame;
|
|
365
|
+
}
|
|
366
|
+
if (delta !== 0 && !((offset || sparse) && (status === 0 || status === GROUP_END))) {
|
|
367
|
+
throw new ObjectIdGap(delta);
|
|
368
|
+
}
|
|
277
369
|
// Allowed even when the header marks the group's end: that bit only lets a FIN imply it,
|
|
278
370
|
// and imquic sends both.
|
|
279
|
-
if (status === GROUP_END)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (status === 0)
|
|
284
|
-
return new Frame({ payload: new Uint8Array(0), timestamp });
|
|
371
|
+
if (status === GROUP_END) {
|
|
372
|
+
const frame = new Frame();
|
|
373
|
+
frame.idDelta = delta;
|
|
374
|
+
return frame;
|
|
285
375
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
376
|
+
if (status === 0) {
|
|
377
|
+
const frame = new Frame({ payload: new Uint8Array(0), groupGap, tie });
|
|
378
|
+
frame.idDelta = delta;
|
|
379
|
+
return frame;
|
|
289
380
|
}
|
|
290
381
|
throw new Error(`Unsupported object status: ${status}`);
|
|
291
382
|
}
|
|
@@ -299,45 +390,180 @@ const FETCH_PROPERTIES = 0x20;
|
|
|
299
390
|
/**
|
|
300
391
|
* A moq-transport object inside a fetch stream, which a publisher writes to serve a fill.
|
|
301
392
|
*
|
|
302
|
-
* The first object carries
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* object.
|
|
393
|
+
* The first object carries absolute Group and Object IDs plus the priority. A new group
|
|
394
|
+
* carries its delta and absolute Object ID; subsequent objects inherit the group and
|
|
395
|
+
* increment the Object ID. A zero payload length is simply an empty object.
|
|
306
396
|
*/
|
|
307
397
|
export class FetchFrame {
|
|
308
398
|
/** The object payload. */
|
|
309
399
|
payload;
|
|
310
|
-
/** The
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
400
|
+
/** The payload length when the caller streams its bytes after the header. */
|
|
401
|
+
streamed;
|
|
402
|
+
/**
|
|
403
|
+
* The track's Publisher Priority on the wire, which the stream's first object states for
|
|
404
|
+
* every object after it, as a subgroup header does.
|
|
405
|
+
*/
|
|
406
|
+
priority;
|
|
407
|
+
/** Optional Timestamp Tie (`0x40B72`) property. */
|
|
408
|
+
tie;
|
|
409
|
+
constructor({ payload, streamed, priority, tie, }) {
|
|
410
|
+
this.payload = payload ?? new Uint8Array(0);
|
|
411
|
+
this.streamed = streamed;
|
|
412
|
+
this.priority = priority;
|
|
413
|
+
this.tie = tie;
|
|
315
414
|
}
|
|
316
|
-
/** Encode this object at `position`,
|
|
317
|
-
async encode(w, position,
|
|
318
|
-
|
|
415
|
+
/** Encode this object at `position`, with optional properties. */
|
|
416
|
+
async encode(w, position, version) {
|
|
417
|
+
const previous = position.previousGroup;
|
|
418
|
+
const properties = encodeObjectProperties({ tie: this.tie }, version);
|
|
419
|
+
const propFlag = properties ? FETCH_PROPERTIES : 0;
|
|
420
|
+
// Everything before the payload goes out as one write, as in Frame.encode.
|
|
421
|
+
const header = [];
|
|
422
|
+
if (position.first || previous !== undefined) {
|
|
319
423
|
// Include the priority too: "same as the prior object" has no prior to refer to.
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
424
|
+
header.push(encodeVarint(FETCH_GROUP_ID | FETCH_OBJECT_ID | (position.first ? FETCH_PRIORITY : 0) | propFlag, version), encodeVarint(previous === undefined
|
|
425
|
+
? position.group
|
|
426
|
+
: (position.group > previous ? position.group - previous : previous - position.group) - 1n, version), encodeVarint(position.object, version));
|
|
427
|
+
if (position.first)
|
|
428
|
+
header.push(Uint8Array.of(this.priority));
|
|
325
429
|
}
|
|
326
430
|
else {
|
|
327
|
-
|
|
328
|
-
|
|
431
|
+
const step = position.previousObject === undefined ? 1 : position.object - position.previousObject;
|
|
432
|
+
if (step > 1) {
|
|
433
|
+
header.push(encodeVarint(FETCH_OBJECT_ID | propFlag, version), encodeVarint(step - objectDeltaBias(version), version));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
// Same group and priority; the Object ID is the prior one plus one.
|
|
437
|
+
header.push(encodeVarint(propFlag, version));
|
|
438
|
+
}
|
|
329
439
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if (this.timestamp !== undefined) {
|
|
333
|
-
const extensions = await encodeObjectExtensions(this.timestamp, timescale, version);
|
|
334
|
-
await w.u53(extensions.byteLength);
|
|
335
|
-
await w.write(extensions);
|
|
440
|
+
if (properties) {
|
|
441
|
+
header.push(encodeVarint(properties.byteLength, version), properties);
|
|
336
442
|
}
|
|
337
|
-
|
|
443
|
+
header.push(encodeVarint(this.streamed ?? this.payload.byteLength, version));
|
|
444
|
+
await w.write(concat(header));
|
|
338
445
|
if (this.payload.byteLength > 0) {
|
|
339
446
|
await w.write(this.payload);
|
|
340
447
|
}
|
|
341
448
|
}
|
|
342
449
|
}
|
|
450
|
+
/** Why the Locations a {@link FetchEndOfRange} closes are left out of a fetch stream. */
|
|
451
|
+
export const EndOfRange = {
|
|
452
|
+
/** They do not exist. */
|
|
453
|
+
NonExistent: 0x8c,
|
|
454
|
+
/** Their state is unknown, which before draft-22 includes a FILL_TIMEOUT running out. */
|
|
455
|
+
Unknown: 0x10c,
|
|
456
|
+
/** The FILL_TIMEOUT ran out before they arrived, from draft-22. */
|
|
457
|
+
TimedOut: 0x20c,
|
|
458
|
+
/** They are gone, from draft-23. */
|
|
459
|
+
Gone: 0x40c,
|
|
460
|
+
};
|
|
461
|
+
/**
|
|
462
|
+
* An End of Range on a fetch stream: every Location after the prior object, through this
|
|
463
|
+
* one, is missing for its reason.
|
|
464
|
+
*
|
|
465
|
+
* Through draft-22 its Group and Object IDs are absolute, wherever it falls: read as deltas,
|
|
466
|
+
* the Group ID could never name the group it follows, and every implementation reads them as
|
|
467
|
+
* absolute (moq-wg/moq-transport#1861). Draft-23 makes them deltas from the prior entry after
|
|
468
|
+
* the stream's first (section 11.4.2.1); this writes the fields as given. Nothing follows them.
|
|
469
|
+
*/
|
|
470
|
+
export class FetchEndOfRange {
|
|
471
|
+
reason;
|
|
472
|
+
group;
|
|
473
|
+
object;
|
|
474
|
+
constructor({ reason, group, object }) {
|
|
475
|
+
this.reason = reason;
|
|
476
|
+
this.group = group;
|
|
477
|
+
this.object = object;
|
|
478
|
+
}
|
|
479
|
+
async encode(w, version) {
|
|
480
|
+
if (this.reason === EndOfRange.TimedOut && version === Version.DRAFT_18) {
|
|
481
|
+
throw new Error("End of Timed-Out Range needs draft-22");
|
|
482
|
+
}
|
|
483
|
+
if (this.reason === EndOfRange.Gone && !hasGroupEnd(version)) {
|
|
484
|
+
throw new Error("End of Gone Range needs draft-23");
|
|
485
|
+
}
|
|
486
|
+
await w.u53(this.reason);
|
|
487
|
+
await w.u62(this.group);
|
|
488
|
+
await w.u62(this.object);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const END_OF_RANGE = [EndOfRange.NonExistent, EndOfRange.Unknown, EndOfRange.TimedOut];
|
|
492
|
+
// Draft-23's indicators: the prior object ends its group, or the track (section 11.4.2.2).
|
|
493
|
+
const FETCH_END_OF_GROUP = 0x80;
|
|
494
|
+
const FETCH_END_OF_TRACK = 0x81;
|
|
495
|
+
/**
|
|
496
|
+
* Whether the fetch stream has draft-23's End of Group, End of Track and End of Gone Range
|
|
497
|
+
* (section 11.4.1), and reads its End of Range IDs as deltas (section 11.4.2.1).
|
|
498
|
+
*/
|
|
499
|
+
export function hasGroupEnd(version) {
|
|
500
|
+
return isDraft23(version);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* How far past its own value an Object ID Delta reaches within a group: draft-23 (section
|
|
504
|
+
* 11.4.1) adds two, so a delta is only sent for a gap. Earlier drafts add the delta alone.
|
|
505
|
+
*/
|
|
506
|
+
export function objectDeltaBias(version) {
|
|
507
|
+
return isDraft23(version) ? 2 : 0;
|
|
508
|
+
}
|
|
509
|
+
// Serialization Flags at or above this are named values, not a set of flags.
|
|
510
|
+
const FETCH_NAMED = 0x80;
|
|
511
|
+
// The flag of an object published as a datagram, whose low bits then mean nothing.
|
|
512
|
+
const FETCH_DATAGRAM = 0x40;
|
|
513
|
+
// The low bits, which spell the Subgroup ID.
|
|
514
|
+
const FETCH_SUBGROUP = 0x03;
|
|
515
|
+
/** Decode the next object on a fetch stream, extracting Timestamp Tie when present. */
|
|
516
|
+
export function decodeFetchObject(c) {
|
|
517
|
+
// Any 62-bit value is a legal field, so an unknown one is a violation, not a decode failure.
|
|
518
|
+
const wide = c.varint();
|
|
519
|
+
if (wide.hi !== 0 || wide.lo >= FETCH_NAMED) {
|
|
520
|
+
const version = asIetf(c.version);
|
|
521
|
+
const named = version !== undefined && hasGroupEnd(version);
|
|
522
|
+
if (wide.hi === 0 && named && (wide.lo === FETCH_END_OF_GROUP || wide.lo === FETCH_END_OF_TRACK)) {
|
|
523
|
+
return { kind: "endOfGroup", track: wide.lo === FETCH_END_OF_TRACK };
|
|
524
|
+
}
|
|
525
|
+
if (wide.hi !== 0 || (!END_OF_RANGE.includes(wide.lo) && !(named && wide.lo === EndOfRange.Gone))) {
|
|
526
|
+
throw new ProtocolViolation(`unknown fetch serialization flags: 0x${wide.toBigInt().toString(16)}`);
|
|
527
|
+
}
|
|
528
|
+
return { kind: "endOfRange", reason: wide.lo, group: c.u62(), object: c.u62() };
|
|
529
|
+
}
|
|
530
|
+
const flags = wide.lo;
|
|
531
|
+
// Wire order: Group ID, Subgroup ID, Object ID, Priority, Properties.
|
|
532
|
+
const group = flags & FETCH_GROUP_ID ? c.u62() : undefined;
|
|
533
|
+
let subgroup;
|
|
534
|
+
let subgroupId;
|
|
535
|
+
if (flags & FETCH_DATAGRAM) {
|
|
536
|
+
subgroup = "datagram";
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
switch (flags & FETCH_SUBGROUP) {
|
|
540
|
+
case 0:
|
|
541
|
+
subgroup = "zero";
|
|
542
|
+
break;
|
|
543
|
+
case 1:
|
|
544
|
+
subgroup = "prior";
|
|
545
|
+
break;
|
|
546
|
+
case 2:
|
|
547
|
+
subgroup = "next";
|
|
548
|
+
break;
|
|
549
|
+
default:
|
|
550
|
+
subgroup = "explicit";
|
|
551
|
+
subgroupId = c.u62();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
const object = flags & FETCH_OBJECT_ID ? c.u53() : undefined;
|
|
555
|
+
const priority = flags & FETCH_PRIORITY ? c.u8() : undefined;
|
|
556
|
+
let tie;
|
|
557
|
+
if (flags & FETCH_PROPERTIES) {
|
|
558
|
+
const length = c.u53();
|
|
559
|
+
if (length > MAX_OBJECT_EXTENSIONS) {
|
|
560
|
+
throw new StreamError(StreamCode.MalformedTrack, { message: "object extensions exceed 64 KiB" });
|
|
561
|
+
}
|
|
562
|
+
tie = c.exact(length, decodeObjectProperties).tie;
|
|
563
|
+
}
|
|
564
|
+
// A fetch stream carries no Object Status: a zero length is simply an empty object.
|
|
565
|
+
const length = c.u53();
|
|
566
|
+
const payload = decodePayload(c, length);
|
|
567
|
+
return { kind: "object", group, subgroup, subgroupId, object, priority, tie, payload, size: length };
|
|
568
|
+
}
|
|
343
569
|
//# sourceMappingURL=object.js.map
|