@moq/net 0.4.8 → 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 -1
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -31
- 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 -138
- 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 -1
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +62 -36
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -172
- 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 +20 -12
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -129
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -19
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +119 -23
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -216
- 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 -80
- 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 -108
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +32 -6
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -20
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +3 -6
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -2
- 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 +137 -58
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -117
- 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 -233
- 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 -8
- 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 -4
- 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 -46
- 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 -1
- 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 -37
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -2
- 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 -307
- 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 -64
- 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 -35
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -62
- 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 -143
- 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 -100
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +91 -35
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -93
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +20 -30
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -171
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +11 -9
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -35
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -1
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +2 -14
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -14
- 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 -40
- 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 +17 -3
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -26
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +194 -32
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -178
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +22 -42
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -472
- 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 -4
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +5 -4
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -48
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +22 -30
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -139
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +46 -69
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -184
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -600
- 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 +3 -27
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -78
- 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 -16
- 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 +4 -29
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -117
- 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 -14
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +48 -41
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -239
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +13 -76
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -201
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -536
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -27
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +25 -22
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -61
- 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 -48
- 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 +25 -10
- package/index.d.ts.map +1 -1
- package/index.js +19 -6
- package/index.js.map +1 -1
- package/internal.d.ts +1512 -64
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -79
- 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 +124 -63
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -158
- 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 -77
- 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 -9
- 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 +1 -1
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -13
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +64 -13
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -30
- 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 +2 -1
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -1
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +9 -1
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -44
- 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 -105
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -0
- 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 -437
- 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 +1 -27
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -99
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +29 -2
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -21
- 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 -1
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +475 -75
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -142
- 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 -515
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +24 -9
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -37
- 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 -33
- 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 +392 -140
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -686
- 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 -57
- 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 +75 -37
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -92
- 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 -97
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -91
- 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 +577 -245
- package/track.d.ts.map +1 -1
- package/track.js +7306 -771
- 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 -1
- 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 -4
- 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 -9
- 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/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -1
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -1
- 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 -28
- 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 +145 -30
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -0
- 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 -2
- 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 -699
- 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 -43
- 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 -78
- 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 -16
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -18
- package/zod.js.map +0 -1
package/ietf/object.js
CHANGED
|
@@ -1,108 +1,131 @@
|
|
|
1
1
|
import { ProtocolViolation, StreamCode, Stream as StreamError } from "../error.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
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";
|
|
5
8
|
// Implementation limit for object extension blocks, independent of the IETF draft.
|
|
6
9
|
const MAX_OBJECT_EXTENSIONS = 64 * 1024;
|
|
7
10
|
const GROUP_END = 0x03;
|
|
8
11
|
const END_OF_TRACK = 0x04;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
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;
|
|
17
20
|
// draft-18 adds bit 0x40 (FIRST_OBJECT) to the subgroup header type per spec
|
|
18
21
|
// 11.4.2. Set on emit unless a filter trimmed the group's head. On parse a
|
|
19
22
|
// cleared bit is the peer's claim that the stream starts partway through;
|
|
20
|
-
// object 0 is still the head
|
|
23
|
+
// object 0 is still the payload head; a standalone terminal may name a later ID.
|
|
21
24
|
const FIRST_OBJECT_BIT = 0x40;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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 };
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
});
|
|
41
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);
|
|
42
56
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// on the wire matches what the track declared.
|
|
51
|
-
async function encodeObjectTime(w, timestamp, timescale, version) {
|
|
52
|
-
const value = Math.round((timestamp.value * timescale) / timestamp.scale);
|
|
53
|
-
await encodeObjectPropertyType(w, PROP_TIMESTAMP, 0n, version);
|
|
54
|
-
await w.u62(BigInt(value));
|
|
55
|
-
}
|
|
56
|
-
async function encodeObjectExtensions(timestamp, timescale, version) {
|
|
57
|
-
if (timestamp === undefined) {
|
|
58
|
-
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;
|
|
59
64
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
write(chunk) {
|
|
63
|
-
chunks.push(new Uint8Array(chunk));
|
|
64
|
-
},
|
|
65
|
-
}), version);
|
|
66
|
-
await encodeObjectTime(writer, timestamp, timescale, version);
|
|
67
|
-
writer.close();
|
|
68
|
-
await writer.closed;
|
|
69
|
-
const size = chunks.reduce((total, chunk) => total + chunk.byteLength, 0);
|
|
70
|
-
const result = new Uint8Array(size);
|
|
71
|
-
let offset = 0;
|
|
72
|
-
for (const chunk of chunks) {
|
|
73
|
-
result.set(chunk, offset);
|
|
74
|
-
offset += chunk.byteLength;
|
|
65
|
+
if (tie !== undefined && tie > 0n) {
|
|
66
|
+
parts.push(encodeVarint(TIMESTAMP_TIE - prev, version), encodeVarint(tie, version));
|
|
75
67
|
}
|
|
76
|
-
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);
|
|
77
76
|
}
|
|
78
|
-
function
|
|
79
|
-
let
|
|
80
|
-
let
|
|
77
|
+
function decodeProperties(c, immutable) {
|
|
78
|
+
let groupGap;
|
|
79
|
+
let tie;
|
|
80
|
+
let sealed = false;
|
|
81
81
|
let prevType = 0n;
|
|
82
|
-
|
|
82
|
+
const malformed = (message) => new StreamError(StreamCode.MalformedTrack, { message });
|
|
83
83
|
while (c.remaining > 0) {
|
|
84
|
-
const
|
|
85
|
-
const id = !hasDeltaObjectPropertyTypes(asIetf(c.version)) || first ? step : prevType + step;
|
|
86
|
-
first = false;
|
|
84
|
+
const id = prevType + c.u62();
|
|
87
85
|
prevType = id;
|
|
88
86
|
if (id % 2n === 0n) {
|
|
89
87
|
const value = c.u62();
|
|
90
|
-
if (id ===
|
|
91
|
-
|
|
88
|
+
if (id === PRIOR_GROUP_ID_GAP) {
|
|
89
|
+
if (groupGap !== undefined)
|
|
90
|
+
throw malformed("repeated Prior Group ID Gap");
|
|
91
|
+
groupGap = value;
|
|
92
92
|
}
|
|
93
|
-
else if (id ===
|
|
94
|
-
|
|
93
|
+
else if (id === TIMESTAMP_TIE) {
|
|
94
|
+
if (tie !== undefined)
|
|
95
|
+
throw malformed("repeated Timestamp Tie");
|
|
96
|
+
tie = value;
|
|
95
97
|
}
|
|
98
|
+
continue;
|
|
96
99
|
}
|
|
97
|
-
|
|
98
|
-
|
|
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;
|
|
99
126
|
}
|
|
100
127
|
}
|
|
101
|
-
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
// An object-scope Timescale (which LOC permits) overrides the track's for this object.
|
|
105
|
-
return new Timestamp(Number(timestamp), overrideScale !== undefined ? Timescale(Number(overrideScale)) : timescale);
|
|
128
|
+
return { groupGap, tie };
|
|
106
129
|
}
|
|
107
130
|
/**
|
|
108
131
|
* STREAM_HEADER_SUBGROUP from moq-transport spec.
|
|
@@ -128,8 +151,8 @@ export class Group {
|
|
|
128
151
|
async encode(w, version) {
|
|
129
152
|
await w.write(await Writer.collect(version, (h) => this.#encode(h, version)));
|
|
130
153
|
}
|
|
131
|
-
async #encode(w,
|
|
132
|
-
if (!this.flags.hasSubgroup && this.subGroupId !==
|
|
154
|
+
async #encode(w, _version) {
|
|
155
|
+
if (!this.flags.hasSubgroup && this.subGroupId !== 0n) {
|
|
133
156
|
throw new Error(`Subgroup ID must be 0 if hasSubgroup is false: ${this.subGroupId}`);
|
|
134
157
|
}
|
|
135
158
|
const base = this.flags.hasPriority ? 0x10 : 0x30;
|
|
@@ -146,30 +169,30 @@ export class Group {
|
|
|
146
169
|
if (this.flags.hasEnd) {
|
|
147
170
|
id |= 0x08;
|
|
148
171
|
}
|
|
149
|
-
if (this.flags.firstObject
|
|
172
|
+
if (this.flags.firstObject) {
|
|
150
173
|
id |= FIRST_OBJECT_BIT;
|
|
151
174
|
}
|
|
152
175
|
await w.u53(id);
|
|
153
176
|
await w.u62(this.trackAlias);
|
|
154
|
-
await w.
|
|
177
|
+
await w.u62(this.groupId);
|
|
155
178
|
if (this.flags.hasSubgroup) {
|
|
156
|
-
await w.
|
|
179
|
+
await w.u62(this.subGroupId);
|
|
157
180
|
}
|
|
158
181
|
if (this.flags.hasPriority) {
|
|
159
182
|
await w.u8(this.publisherPriority);
|
|
160
183
|
}
|
|
161
184
|
}
|
|
162
185
|
/** Decode a SUBGROUP_HEADER. Pass `type` when the caller already read it to classify the stream. */
|
|
163
|
-
static async decode(r,
|
|
186
|
+
static async decode(r, _version, type) {
|
|
164
187
|
const raw = type ?? (await r.u53());
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
const firstObject =
|
|
170
|
-
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;
|
|
171
194
|
// An invalid type MUST close the session, including the reserved SUBGROUP_ID_MODE
|
|
172
|
-
// 0b11 (draft-
|
|
195
|
+
// 0b11 (draft-22 section 11.3.1).
|
|
173
196
|
const known = (id >= 0x10 && id <= 0x1f) || (id >= 0x30 && id <= 0x3f);
|
|
174
197
|
if (!known || (id & 0x06) === 0x06) {
|
|
175
198
|
throw new ProtocolViolation(`Unsupported group type: ${raw}`);
|
|
@@ -186,105 +209,174 @@ export class Group {
|
|
|
186
209
|
firstObject,
|
|
187
210
|
};
|
|
188
211
|
const trackAlias = await r.u62();
|
|
189
|
-
const groupId = await r.
|
|
190
|
-
const subGroupId = flags.hasSubgroup ? await r.
|
|
191
|
-
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;
|
|
192
215
|
return new Group({ trackAlias, groupId, subGroupId, publisherPriority, flags });
|
|
193
216
|
}
|
|
194
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
|
+
}
|
|
195
237
|
/** A moq-transport object inside a group stream. */
|
|
196
238
|
export class Frame {
|
|
197
|
-
/**
|
|
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
|
+
*/
|
|
198
243
|
payload;
|
|
199
|
-
/** The
|
|
200
|
-
|
|
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;
|
|
201
253
|
/**
|
|
202
254
|
* An END_OF_TRACK marker: no object at or past its location exists. At object 0 its group
|
|
203
255
|
* does not exist either, so the track ends at that group; later in a group it ends after it.
|
|
204
256
|
*/
|
|
205
257
|
endOfTrack;
|
|
206
|
-
|
|
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, } = {}) {
|
|
207
263
|
this.payload = payload;
|
|
208
|
-
this.
|
|
264
|
+
this.streamed = streamed;
|
|
265
|
+
this.groupGap = groupGap;
|
|
266
|
+
this.tie = tie;
|
|
209
267
|
this.endOfTrack = endOfTrack;
|
|
210
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
|
+
}
|
|
211
273
|
/**
|
|
212
274
|
* Encode this frame using the group flags and negotiated IETF version.
|
|
213
275
|
*
|
|
214
|
-
* `idDelta` is the first object's absolute Object ID and
|
|
215
|
-
*
|
|
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.
|
|
216
278
|
*/
|
|
217
|
-
async encode(w, flags,
|
|
218
|
-
|
|
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)];
|
|
219
283
|
if (flags.hasExtensions) {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
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);
|
|
223
288
|
}
|
|
289
|
+
const payload = this.endOfTrack ? undefined : this.payload;
|
|
224
290
|
if (this.endOfTrack) {
|
|
225
|
-
|
|
226
|
-
await w.u53(END_OF_TRACK);
|
|
291
|
+
header.push(encodeVarint(0, version), encodeVarint(END_OF_TRACK, version)); // length = 0
|
|
227
292
|
}
|
|
228
|
-
else if (this.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
else {
|
|
234
|
-
await w.write(this.payload);
|
|
235
|
-
}
|
|
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
|
|
236
298
|
}
|
|
237
299
|
else {
|
|
238
|
-
|
|
239
|
-
|
|
300
|
+
header.push(encodeVarint(payload.byteLength, version));
|
|
301
|
+
if (payload.byteLength === 0)
|
|
302
|
+
header.push(encodeVarint(0, version)); // status = normal
|
|
240
303
|
}
|
|
304
|
+
await w.write(concat(header));
|
|
305
|
+
if (payload !== undefined && payload.byteLength > 0)
|
|
306
|
+
await w.write(payload);
|
|
241
307
|
}
|
|
242
|
-
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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;
|
|
253
331
|
if (flags.hasExtensions) {
|
|
254
332
|
const extensionsLength = c.u53();
|
|
255
333
|
if (extensionsLength > MAX_OBJECT_EXTENSIONS) {
|
|
256
334
|
throw new StreamError(StreamCode.MalformedTrack, { message: "object extensions exceed 64 KiB" });
|
|
257
335
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
c.read(extensionsLength);
|
|
265
|
-
}
|
|
336
|
+
hasProperties = extensionsLength !== 0;
|
|
337
|
+
const decoded = c.exact(extensionsLength, decodeObjectProperties);
|
|
338
|
+
groupGap = decoded.groupGap;
|
|
339
|
+
tie = decoded.tie;
|
|
266
340
|
}
|
|
267
341
|
const payloadLength = c.u53();
|
|
268
342
|
if (payloadLength > 0) {
|
|
269
|
-
|
|
270
|
-
|
|
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;
|
|
271
354
|
}
|
|
272
355
|
const status = c.u53();
|
|
356
|
+
if (status !== 0 && hasProperties) {
|
|
357
|
+
throw new ProtocolViolation(`status object ${status} carries properties`);
|
|
358
|
+
}
|
|
273
359
|
// Defined on every implemented draft, whether or not the header marks the group's end.
|
|
274
|
-
if (status === END_OF_TRACK)
|
|
275
|
-
|
|
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
|
+
}
|
|
276
369
|
// Allowed even when the header marks the group's end: that bit only lets a FIN imply it,
|
|
277
370
|
// and imquic sends both.
|
|
278
|
-
if (status === GROUP_END)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (status === 0)
|
|
283
|
-
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;
|
|
284
375
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
376
|
+
if (status === 0) {
|
|
377
|
+
const frame = new Frame({ payload: new Uint8Array(0), groupGap, tie });
|
|
378
|
+
frame.idDelta = delta;
|
|
379
|
+
return frame;
|
|
288
380
|
}
|
|
289
381
|
throw new Error(`Unsupported object status: ${status}`);
|
|
290
382
|
}
|
|
@@ -298,45 +390,180 @@ const FETCH_PROPERTIES = 0x20;
|
|
|
298
390
|
/**
|
|
299
391
|
* A moq-transport object inside a fetch stream, which a publisher writes to serve a fill.
|
|
300
392
|
*
|
|
301
|
-
* The first object carries
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* 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.
|
|
305
396
|
*/
|
|
306
397
|
export class FetchFrame {
|
|
307
398
|
/** The object payload. */
|
|
308
399
|
payload;
|
|
309
|
-
/** The
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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;
|
|
314
414
|
}
|
|
315
|
-
/** Encode this object at `position`,
|
|
316
|
-
async encode(w, position,
|
|
317
|
-
|
|
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) {
|
|
318
423
|
// Include the priority too: "same as the prior object" has no prior to refer to.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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));
|
|
324
429
|
}
|
|
325
430
|
else {
|
|
326
|
-
|
|
327
|
-
|
|
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
|
+
}
|
|
328
439
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (this.timestamp !== undefined) {
|
|
332
|
-
const extensions = await encodeObjectExtensions(this.timestamp, timescale, version);
|
|
333
|
-
await w.u53(extensions.byteLength);
|
|
334
|
-
await w.write(extensions);
|
|
440
|
+
if (properties) {
|
|
441
|
+
header.push(encodeVarint(properties.byteLength, version), properties);
|
|
335
442
|
}
|
|
336
|
-
|
|
443
|
+
header.push(encodeVarint(this.streamed ?? this.payload.byteLength, version));
|
|
444
|
+
await w.write(concat(header));
|
|
337
445
|
if (this.payload.byteLength > 0) {
|
|
338
446
|
await w.write(this.payload);
|
|
339
447
|
}
|
|
340
448
|
}
|
|
341
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
|
+
}
|
|
342
569
|
//# sourceMappingURL=object.js.map
|