@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/filter.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Location Filter carried by SUBSCRIBE, and draft-
|
|
2
|
+
* The Location Filter carried by SUBSCRIBE, and draft-22's fill request.
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { ProtocolViolation } from "../error.js";
|
|
7
|
+
import { concat } from "../stream.js";
|
|
7
8
|
import * as Varint from "../varint.js";
|
|
8
|
-
import { Version } from "./version.js";
|
|
9
|
-
/** The tagged Filter Type of draft-
|
|
9
|
+
import { isDraft23, Version } from "./version.js";
|
|
10
|
+
/** The tagged Filter Type of draft-18 and earlier. */
|
|
10
11
|
const TAG_NEXT_GROUP = 0x1n;
|
|
11
12
|
const TAG_LARGEST_OBJECT = 0x2n;
|
|
12
13
|
const TAG_ABSOLUTE_START = 0x3n;
|
|
@@ -15,24 +16,18 @@ const TAG_ABSOLUTE_RANGE = 0x4n;
|
|
|
15
16
|
* Whether this is draft-20 or newer.
|
|
16
17
|
*
|
|
17
18
|
* Draft-20 replaced the Filter Type tag with up to four optional varints, where the number
|
|
18
|
-
* present selects the meaning.
|
|
19
|
+
* present selects the meaning, and added the parameters that ride with it. Draft-22 names
|
|
20
|
+
* the meaning with a Location Filter Type instead, but keeps those parameters.
|
|
19
21
|
*/
|
|
20
22
|
export function isDraft20(version) {
|
|
21
|
-
return
|
|
22
|
-
version !== Version.DRAFT_15 &&
|
|
23
|
-
version !== Version.DRAFT_16 &&
|
|
24
|
-
version !== Version.DRAFT_17 &&
|
|
25
|
-
version !== Version.DRAFT_18 &&
|
|
26
|
-
version !== Version.DRAFT_19);
|
|
23
|
+
return version !== Version.DRAFT_18;
|
|
27
24
|
}
|
|
28
25
|
/**
|
|
29
|
-
* Whether
|
|
30
|
-
*
|
|
31
|
-
* Draft-22 replaced the length-inferred field list with a Location Filter Type that names
|
|
32
|
-
* the fields that follow, so the value carries no Length.
|
|
26
|
+
* Whether LOCATION_FILTER starts with a Location Filter Type, which says which fields follow,
|
|
27
|
+
* so the value carries no Length. Draft-22 replaced draft-20's field count with it.
|
|
33
28
|
*/
|
|
34
|
-
|
|
35
|
-
return isDraft20(version) && version !== Version.DRAFT_20
|
|
29
|
+
function isTyped(version) {
|
|
30
|
+
return isDraft20(version) && version !== Version.DRAFT_20;
|
|
36
31
|
}
|
|
37
32
|
/** The Location Filter Type of draft-22. */
|
|
38
33
|
const TYPE_NONE = 0x0n;
|
|
@@ -41,58 +36,33 @@ const TYPE_ABSOLUTE_START = 0x2n;
|
|
|
41
36
|
const TYPE_ABSOLUTE_GROUP_END = 0x3n;
|
|
42
37
|
const TYPE_ABSOLUTE_RANGE = 0x4n;
|
|
43
38
|
const TYPE_NEXT_OBJECT = 0x5n;
|
|
44
|
-
/** Whether the Range Filters
|
|
39
|
+
/** Whether the Range Filters exist on this draft. */
|
|
45
40
|
export function hasRangeFilters(version) {
|
|
46
|
-
return isDraft20(version)
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Draft-17 replaced QUIC's two-bit-length varint with a leading-1-bits one. The two agree
|
|
50
|
-
* below 64 and diverge above it, so getting this wrong is invisible until group or object
|
|
51
|
-
* ids grow past that.
|
|
52
|
-
*/
|
|
53
|
-
function usesLeadingOnes(version) {
|
|
54
|
-
return version !== Version.DRAFT_14 && version !== Version.DRAFT_15 && version !== Version.DRAFT_16;
|
|
55
|
-
}
|
|
56
|
-
function varint(v, version) {
|
|
57
|
-
return usesLeadingOnes(version) ? Varint.encodeLeadingOnes(v) : Varint.encode(v);
|
|
58
|
-
}
|
|
59
|
-
function unvarint(buf, version) {
|
|
60
|
-
return usesLeadingOnes(version) ? Varint.decodeLeadingOnes(buf) : Varint.decodeBigInt(buf);
|
|
61
|
-
}
|
|
62
|
-
function concat(parts) {
|
|
63
|
-
const total = parts.reduce((n, p) => n + p.length, 0);
|
|
64
|
-
const out = new Uint8Array(total);
|
|
65
|
-
let offset = 0;
|
|
66
|
-
for (const part of parts) {
|
|
67
|
-
out.set(part, offset);
|
|
68
|
-
offset += part.length;
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
41
|
+
return isDraft20(version);
|
|
71
42
|
}
|
|
43
|
+
const varint = Varint.encodeLeadingOnes;
|
|
44
|
+
const unvarint = Varint.decodeLeadingOnes;
|
|
72
45
|
function endDelta(startGroup, endGroup) {
|
|
73
46
|
if (endGroup < startGroup) {
|
|
74
47
|
throw new Error(`filter range runs backwards: ${startGroup} > ${endGroup}`);
|
|
75
48
|
}
|
|
76
49
|
return endGroup - startGroup;
|
|
77
50
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Encode a filter as its raw parameter value, without the Length that frames it through
|
|
80
|
-
* draft-21. Unfiltered encodes to zero bytes on draft-20 and draft-21.
|
|
81
|
-
*/
|
|
51
|
+
/** Encode a filter as its raw parameter value, without the Length that frames it before draft-22. */
|
|
82
52
|
export function encode(filter, version) {
|
|
83
|
-
if (
|
|
84
|
-
return encodeTyped(filter
|
|
85
|
-
return isDraft20(version) ? encodeFields(filter
|
|
53
|
+
if (isTyped(version))
|
|
54
|
+
return encodeTyped(filter);
|
|
55
|
+
return isDraft20(version) ? encodeFields(filter) : encodeTag(filter);
|
|
86
56
|
}
|
|
87
57
|
/** Encode LOCATION_FILTER's value as it follows the parameter type from draft-17 on. */
|
|
88
58
|
export function encodeParam(filter, version) {
|
|
89
59
|
const value = encode(filter, version);
|
|
90
60
|
// Draft-22's Location Filter Type says where the value ends, so it needs no Length.
|
|
91
|
-
return
|
|
61
|
+
return isTyped(version) ? value : encodeLengthPrefixed(value);
|
|
92
62
|
}
|
|
93
63
|
/** Read LOCATION_FILTER's value as it follows the parameter type from draft-17 on. */
|
|
94
64
|
export async function decodeParam(r, version) {
|
|
95
|
-
if (!
|
|
65
|
+
if (!isTyped(version)) {
|
|
96
66
|
return decode(await r.read(await r.u53()), version);
|
|
97
67
|
}
|
|
98
68
|
const type = await r.u62();
|
|
@@ -102,29 +72,50 @@ export async function decodeParam(r, version) {
|
|
|
102
72
|
}
|
|
103
73
|
return fromTyped(type, fields);
|
|
104
74
|
}
|
|
105
|
-
|
|
75
|
+
/** Encode the draft-20 field list, where the number of fields selects the meaning. */
|
|
76
|
+
function encodeFields(filter) {
|
|
106
77
|
switch (filter.kind) {
|
|
107
78
|
case "unfiltered":
|
|
108
|
-
return
|
|
79
|
+
return new Uint8Array();
|
|
109
80
|
case "nextObject":
|
|
110
|
-
return varint(
|
|
81
|
+
return concat([varint(0n), varint(0n)]);
|
|
111
82
|
case "relative":
|
|
112
|
-
return
|
|
83
|
+
return varint(filter.groups);
|
|
84
|
+
case "absolute": {
|
|
85
|
+
// An open ended {0, 0} is defined as unfiltered, so it must not collide with Next Object.
|
|
86
|
+
if (filter.startGroup === 0n && filter.startObject === 0n && filter.endGroup === undefined) {
|
|
87
|
+
return new Uint8Array();
|
|
88
|
+
}
|
|
89
|
+
const parts = [varint(filter.startGroup), varint(filter.startObject)];
|
|
90
|
+
if (filter.endGroup !== undefined) {
|
|
91
|
+
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)));
|
|
92
|
+
if (filter.endObject !== undefined) {
|
|
93
|
+
parts.push(varint(filter.endObject));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return concat(parts);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function encodeTyped(filter) {
|
|
101
|
+
switch (filter.kind) {
|
|
102
|
+
case "unfiltered":
|
|
103
|
+
return varint(TYPE_NONE);
|
|
104
|
+
case "nextObject":
|
|
105
|
+
return varint(TYPE_NEXT_OBJECT);
|
|
106
|
+
case "relative":
|
|
107
|
+
return concat([varint(TYPE_RELATIVE_START), varint(filter.groups)]);
|
|
113
108
|
case "absolute": {
|
|
114
109
|
const type = filter.endGroup === undefined
|
|
115
110
|
? TYPE_ABSOLUTE_START
|
|
116
111
|
: filter.endObject === undefined
|
|
117
112
|
? TYPE_ABSOLUTE_GROUP_END
|
|
118
113
|
: TYPE_ABSOLUTE_RANGE;
|
|
119
|
-
const parts = [
|
|
120
|
-
varint(type, version),
|
|
121
|
-
varint(filter.startGroup, version),
|
|
122
|
-
varint(filter.startObject, version),
|
|
123
|
-
];
|
|
114
|
+
const parts = [varint(type), varint(filter.startGroup), varint(filter.startObject)];
|
|
124
115
|
if (filter.endGroup !== undefined) {
|
|
125
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)
|
|
116
|
+
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)));
|
|
126
117
|
if (filter.endObject !== undefined) {
|
|
127
|
-
parts.push(varint(filter.endObject
|
|
118
|
+
parts.push(varint(filter.endObject));
|
|
128
119
|
}
|
|
129
120
|
}
|
|
130
121
|
return concat(parts);
|
|
@@ -169,68 +160,43 @@ function fromTyped(type, fields) {
|
|
|
169
160
|
}
|
|
170
161
|
}
|
|
171
162
|
/** Read a draft-22 filter from the front of `data`, returning what follows it. */
|
|
172
|
-
function readTyped(data
|
|
173
|
-
let [type, rest] = unvarint(data
|
|
163
|
+
function readTyped(data) {
|
|
164
|
+
let [type, rest] = unvarint(data);
|
|
174
165
|
const fields = [];
|
|
175
166
|
for (let i = typedFieldCount(type); i > 0; i--) {
|
|
176
|
-
const [field, next] = unvarint(rest
|
|
167
|
+
const [field, next] = unvarint(rest);
|
|
177
168
|
fields.push(field);
|
|
178
169
|
rest = next;
|
|
179
170
|
}
|
|
180
171
|
return [fromTyped(type, fields), rest];
|
|
181
172
|
}
|
|
182
|
-
function
|
|
183
|
-
switch (filter.kind) {
|
|
184
|
-
case "unfiltered":
|
|
185
|
-
return new Uint8Array();
|
|
186
|
-
case "nextObject":
|
|
187
|
-
return concat([varint(0n, version), varint(0n, version)]);
|
|
188
|
-
case "relative":
|
|
189
|
-
return varint(filter.groups, version);
|
|
190
|
-
case "absolute": {
|
|
191
|
-
// An open ended absolute {0, 0} is defined as equivalent to unfiltered, so it
|
|
192
|
-
// normalizes rather than colliding with the two-zero-field nextObject spelling.
|
|
193
|
-
if (filter.startGroup === 0n && filter.startObject === 0n && filter.endGroup === undefined) {
|
|
194
|
-
return new Uint8Array();
|
|
195
|
-
}
|
|
196
|
-
const parts = [varint(filter.startGroup, version), varint(filter.startObject, version)];
|
|
197
|
-
if (filter.endGroup !== undefined) {
|
|
198
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup), version));
|
|
199
|
-
if (filter.endObject !== undefined) {
|
|
200
|
-
parts.push(varint(filter.endObject, version));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return concat(parts);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function encodeTag(filter, version) {
|
|
173
|
+
function encodeTag(filter) {
|
|
208
174
|
switch (filter.kind) {
|
|
209
175
|
case "unfiltered":
|
|
210
176
|
// No tag means "everything", which only the absolute spelling can say.
|
|
211
|
-
return concat([varint(TAG_ABSOLUTE_START
|
|
177
|
+
return concat([varint(TAG_ABSOLUTE_START), varint(0n), varint(0n)]);
|
|
212
178
|
case "nextObject":
|
|
213
|
-
return varint(TAG_LARGEST_OBJECT
|
|
179
|
+
return varint(TAG_LARGEST_OBJECT);
|
|
214
180
|
case "relative":
|
|
215
181
|
if (filter.groups !== 0n) {
|
|
216
|
-
// Only draft-
|
|
182
|
+
// Only draft-22 can name a start further back than the next group without
|
|
217
183
|
// knowing Largest Object, so there is no honest tag to fall back to.
|
|
218
|
-
throw new Error(`relative filter ${filter.groups} needs draft-
|
|
184
|
+
throw new Error(`relative filter ${filter.groups} needs draft-22`);
|
|
219
185
|
}
|
|
220
|
-
return varint(TAG_NEXT_GROUP
|
|
186
|
+
return varint(TAG_NEXT_GROUP);
|
|
221
187
|
case "absolute": {
|
|
222
|
-
// Draft-
|
|
188
|
+
// Draft-18's AbsoluteRange ends on a group, so an object-bounded range has no
|
|
223
189
|
// spelling. Refuse rather than widen the range the caller asked for.
|
|
224
190
|
if (filter.endObject !== undefined) {
|
|
225
|
-
throw new Error("an object-bounded range needs draft-
|
|
191
|
+
throw new Error("an object-bounded range needs draft-22");
|
|
226
192
|
}
|
|
227
193
|
const parts = [
|
|
228
|
-
varint(filter.endGroup === undefined ? TAG_ABSOLUTE_START : TAG_ABSOLUTE_RANGE
|
|
229
|
-
varint(filter.startGroup
|
|
230
|
-
varint(filter.startObject
|
|
194
|
+
varint(filter.endGroup === undefined ? TAG_ABSOLUTE_START : TAG_ABSOLUTE_RANGE),
|
|
195
|
+
varint(filter.startGroup),
|
|
196
|
+
varint(filter.startObject),
|
|
231
197
|
];
|
|
232
198
|
if (filter.endGroup !== undefined) {
|
|
233
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)
|
|
199
|
+
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)));
|
|
234
200
|
}
|
|
235
201
|
return concat(parts);
|
|
236
202
|
}
|
|
@@ -238,21 +204,22 @@ function encodeTag(filter, version) {
|
|
|
238
204
|
}
|
|
239
205
|
/** Decode a filter from its raw parameter value, which must be consumed whole. */
|
|
240
206
|
export function decode(data, version) {
|
|
241
|
-
if (
|
|
242
|
-
const [filter, rest] = readTyped(data
|
|
207
|
+
if (isTyped(version)) {
|
|
208
|
+
const [filter, rest] = readTyped(data);
|
|
243
209
|
expectEmpty(rest);
|
|
244
210
|
return filter;
|
|
245
211
|
}
|
|
246
|
-
return isDraft20(version) ? decodeFields(data
|
|
212
|
+
return isDraft20(version) ? decodeFields(data) : decodeTag(data);
|
|
247
213
|
}
|
|
248
|
-
|
|
214
|
+
/** Decode the draft-20 field list, which the caller has already delimited. */
|
|
215
|
+
function decodeFields(data) {
|
|
249
216
|
const fields = [];
|
|
250
217
|
let rest = data;
|
|
251
218
|
while (rest.length > 0) {
|
|
252
219
|
if (fields.length === 4) {
|
|
253
220
|
throw new Error("too many fields in LOCATION_FILTER");
|
|
254
221
|
}
|
|
255
|
-
const [value, next] = unvarint(rest
|
|
222
|
+
const [value, next] = unvarint(rest);
|
|
256
223
|
fields.push(value);
|
|
257
224
|
rest = next;
|
|
258
225
|
}
|
|
@@ -273,11 +240,11 @@ function decodeFields(data, version) {
|
|
|
273
240
|
}
|
|
274
241
|
}
|
|
275
242
|
}
|
|
276
|
-
function decodeTag(data
|
|
277
|
-
const [tag, afterTag] = unvarint(data
|
|
243
|
+
function decodeTag(data) {
|
|
244
|
+
const [tag, afterTag] = unvarint(data);
|
|
278
245
|
const readLocation = (buf) => {
|
|
279
|
-
const [group, afterGroup] = unvarint(buf
|
|
280
|
-
const [object, rest] = unvarint(afterGroup
|
|
246
|
+
const [group, afterGroup] = unvarint(buf);
|
|
247
|
+
const [object, rest] = unvarint(afterGroup);
|
|
281
248
|
return [group, object, rest];
|
|
282
249
|
};
|
|
283
250
|
switch (tag) {
|
|
@@ -294,7 +261,7 @@ function decodeTag(data, version) {
|
|
|
294
261
|
}
|
|
295
262
|
case TAG_ABSOLUTE_RANGE: {
|
|
296
263
|
const [startGroup, startObject, afterLocation] = readLocation(afterTag);
|
|
297
|
-
const [delta, rest] = unvarint(afterLocation
|
|
264
|
+
const [delta, rest] = unvarint(afterLocation);
|
|
298
265
|
expectEmpty(rest);
|
|
299
266
|
return { kind: "absolute", startGroup, startObject, endGroup: startGroup + delta };
|
|
300
267
|
}
|
|
@@ -302,43 +269,16 @@ function decodeTag(data, version) {
|
|
|
302
269
|
throw new Error(`unsupported filter type: ${tag}`);
|
|
303
270
|
}
|
|
304
271
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Read the tagged filter draft-14 carries inline in a SUBSCRIBE body, where the fields
|
|
307
|
-
* following the tag have no length to delimit them.
|
|
308
|
-
*
|
|
309
|
-
* Every tag is read, including the absolute forms we do not serve. Rejecting one would tear
|
|
310
|
-
* the session down over a filter the draft lets a subscriber send; what we do with it is
|
|
311
|
-
* decided when the range is resolved.
|
|
312
|
-
*/
|
|
313
|
-
export async function decodeInline(r) {
|
|
314
|
-
const tag = await r.u62();
|
|
315
|
-
switch (tag) {
|
|
316
|
-
case TAG_NEXT_GROUP:
|
|
317
|
-
return { kind: "relative", groups: 0n };
|
|
318
|
-
case TAG_LARGEST_OBJECT:
|
|
319
|
-
return { kind: "nextObject" };
|
|
320
|
-
case TAG_ABSOLUTE_START:
|
|
321
|
-
return { kind: "absolute", startGroup: await r.u62(), startObject: await r.u62() };
|
|
322
|
-
case TAG_ABSOLUTE_RANGE: {
|
|
323
|
-
const startGroup = await r.u62();
|
|
324
|
-
const startObject = await r.u62();
|
|
325
|
-
const delta = await r.u62();
|
|
326
|
-
return { kind: "absolute", startGroup, startObject, endGroup: startGroup + delta };
|
|
327
|
-
}
|
|
328
|
-
default:
|
|
329
|
-
throw new Error(`unsupported filter type: ${tag}`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
272
|
function expectEmpty(rest) {
|
|
333
273
|
if (rest.length !== 0) {
|
|
334
274
|
throw new Error("trailing bytes in LOCATION_FILTER");
|
|
335
275
|
}
|
|
336
276
|
}
|
|
337
|
-
/** LOCATION_FILTER, the
|
|
277
|
+
/** LOCATION_FILTER, the parameter that selects the fill's objects. */
|
|
338
278
|
const FILL_LOCATION_FILTER = 0x21n;
|
|
339
279
|
/**
|
|
340
|
-
* The parameters draft-
|
|
341
|
-
*
|
|
280
|
+
* The parameters draft-22 allows inside FILL_PARAMETERS besides LOCATION_FILTER, and how each
|
|
281
|
+
* frames its value. Only GROUP_ORDER is read: FILL_TIMEOUT is accepted and ignored.
|
|
342
282
|
*
|
|
343
283
|
* Tabulated rather than derived, because neither shortcut is right. The Key-Value-Pair rule
|
|
344
284
|
* keys framing off the id's parity, but the Range Filters (0x25-0x28) carry an explicit
|
|
@@ -361,31 +301,56 @@ const FILL_ALLOWED = new Map([
|
|
|
361
301
|
* The value is a nested parameter scope, encoded like a message's parameters.
|
|
362
302
|
*/
|
|
363
303
|
export function encodeFill(fill, version) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
// the
|
|
367
|
-
|
|
368
|
-
|
|
304
|
+
const count = [fill.filter, fill.groupOrder].filter((v) => v !== undefined).length;
|
|
305
|
+
const parts = [varint(BigInt(count))];
|
|
306
|
+
// Parameters sort by id, each a delta from the one before.
|
|
307
|
+
let prev = 0n;
|
|
308
|
+
const key = (id) => {
|
|
309
|
+
parts.push(varint(id - prev));
|
|
310
|
+
prev = id;
|
|
311
|
+
};
|
|
312
|
+
if (fill.filter !== undefined) {
|
|
313
|
+
key(FILL_LOCATION_FILTER);
|
|
314
|
+
parts.push(encodeParam(fill.filter, version));
|
|
369
315
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
]);
|
|
316
|
+
if (fill.groupOrder !== undefined) {
|
|
317
|
+
key(0x22n);
|
|
318
|
+
parts.push(new Uint8Array([fill.groupOrder === "ascending" ? 1 : 2]));
|
|
319
|
+
}
|
|
320
|
+
return concat(parts);
|
|
376
321
|
}
|
|
377
|
-
/**
|
|
322
|
+
/**
|
|
323
|
+
* Whether FILL_PARAMETERS is a bare Number of Parameters and the Parameters (draft-23 section
|
|
324
|
+
* 9.19.15) rather than a length-prefixed block.
|
|
325
|
+
*/
|
|
326
|
+
export function isCountedFill(version) {
|
|
327
|
+
return isDraft23(version);
|
|
328
|
+
}
|
|
329
|
+
/** Decode FILL_PARAMETERS, including its inherited or explicit group order. */
|
|
378
330
|
export function decodeFill(data, version) {
|
|
379
|
-
const [
|
|
331
|
+
const [fill, rest] = readFill(data, version);
|
|
332
|
+
if (rest.length !== 0) {
|
|
333
|
+
throw new Error("trailing bytes in FILL_PARAMETERS");
|
|
334
|
+
}
|
|
335
|
+
return fill;
|
|
336
|
+
}
|
|
337
|
+
/** How many bytes at the front of `data` the fill's count and Parameters span. */
|
|
338
|
+
export function fillSize(data, version) {
|
|
339
|
+
return data.length - readFill(data, version)[1].length;
|
|
340
|
+
}
|
|
341
|
+
/** Read a fill's count and Parameters off the front of `data`, returning what follows them. */
|
|
342
|
+
function readFill(data, version) {
|
|
343
|
+
const [count, afterCount] = unvarint(data);
|
|
380
344
|
if (count > 64n) {
|
|
381
345
|
throw new Error("too many parameters in FILL_PARAMETERS");
|
|
382
346
|
}
|
|
383
347
|
let rest = afterCount;
|
|
384
348
|
let filter;
|
|
349
|
+
let groupOrder;
|
|
385
350
|
let rangeFilters = false;
|
|
386
351
|
let prev = 0n;
|
|
387
352
|
for (let i = 0n; i < count; i++) {
|
|
388
|
-
const [delta, afterType] = unvarint(rest
|
|
353
|
+
const [delta, afterType] = unvarint(rest);
|
|
389
354
|
const key = i === 0n ? delta : prev + delta;
|
|
390
355
|
prev = key;
|
|
391
356
|
rest = afterType;
|
|
@@ -394,12 +359,12 @@ export function decodeFill(data, version) {
|
|
|
394
359
|
if (filter !== undefined) {
|
|
395
360
|
throw new Error("duplicate LOCATION_FILTER inside FILL_PARAMETERS");
|
|
396
361
|
}
|
|
397
|
-
if (
|
|
398
|
-
[filter, rest] = readTyped(rest
|
|
362
|
+
if (isTyped(version)) {
|
|
363
|
+
[filter, rest] = readTyped(rest);
|
|
399
364
|
}
|
|
400
365
|
else {
|
|
401
366
|
let value;
|
|
402
|
-
[value, rest] = readLengthPrefixed(rest
|
|
367
|
+
[value, rest] = readLengthPrefixed(rest);
|
|
403
368
|
filter = decode(value, version);
|
|
404
369
|
}
|
|
405
370
|
continue;
|
|
@@ -411,34 +376,38 @@ export function decodeFill(data, version) {
|
|
|
411
376
|
// A Range Filter changes which objects the fill may contain, so its presence is
|
|
412
377
|
// recorded even though its value is not interpreted.
|
|
413
378
|
rangeFilters ||= key >= 0x25n && key <= 0x28n;
|
|
414
|
-
//
|
|
415
|
-
// consumed or the remaining keys desync.
|
|
379
|
+
// Each parameter must consume its own value or the remaining keys desync.
|
|
416
380
|
if (framing === "varint") {
|
|
417
|
-
[, rest] = unvarint(rest
|
|
381
|
+
[, rest] = unvarint(rest);
|
|
418
382
|
continue;
|
|
419
383
|
}
|
|
420
384
|
if (framing === "byte") {
|
|
421
385
|
if (rest.length < 1)
|
|
422
386
|
throw new Error("truncated value inside FILL_PARAMETERS");
|
|
387
|
+
if (key === 0x22n) {
|
|
388
|
+
if (groupOrder !== undefined)
|
|
389
|
+
throw new Error("duplicate GROUP_ORDER inside FILL_PARAMETERS");
|
|
390
|
+
if (rest[0] !== 1 && rest[0] !== 2) {
|
|
391
|
+
throw new ProtocolViolation(`invalid group order: ${rest[0]}`);
|
|
392
|
+
}
|
|
393
|
+
groupOrder = rest[0] === 1 ? "ascending" : "descending";
|
|
394
|
+
}
|
|
423
395
|
rest = rest.slice(1);
|
|
424
396
|
continue;
|
|
425
397
|
}
|
|
426
|
-
[, rest] = readLengthPrefixed(rest
|
|
427
|
-
}
|
|
428
|
-
if (rest.length !== 0) {
|
|
429
|
-
throw new Error("trailing bytes in FILL_PARAMETERS");
|
|
398
|
+
[, rest] = readLengthPrefixed(rest);
|
|
430
399
|
}
|
|
431
|
-
return { filter, rangeFilters };
|
|
400
|
+
return [{ filter, groupOrder, rangeFilters }, rest];
|
|
432
401
|
}
|
|
433
402
|
/** Split a length-prefixed value off the front of `data`, returning it and what follows. */
|
|
434
|
-
function readLengthPrefixed(data
|
|
435
|
-
const [length, afterLength] = unvarint(data
|
|
403
|
+
function readLengthPrefixed(data) {
|
|
404
|
+
const [length, afterLength] = unvarint(data);
|
|
436
405
|
if (BigInt(afterLength.length) < length) {
|
|
437
406
|
throw new Error("truncated value inside FILL_PARAMETERS");
|
|
438
407
|
}
|
|
439
408
|
return [afterLength.slice(0, Number(length)), afterLength.slice(Number(length))];
|
|
440
409
|
}
|
|
441
|
-
function encodeLengthPrefixed(value
|
|
442
|
-
return concat([varint(BigInt(value.length)
|
|
410
|
+
function encodeLengthPrefixed(value) {
|
|
411
|
+
return concat([varint(BigInt(value.length)), value]);
|
|
443
412
|
}
|
|
444
413
|
//# sourceMappingURL=filter.js.map
|