@moq/net 0.4.7 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/announce.d.ts +1 -1
- package/announce.d.ts.map +1 -1
- package/announce.js +1 -2
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -32
- package/announced.js.map +1 -1
- package/announced.test-util.d.ts +2 -0
- package/announced.test-util.d.ts.map +1 -0
- package/announced.test-util.js +27 -0
- package/announced.test-util.js.map +1 -0
- package/auth.d.ts +64 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +20 -0
- package/auth.js.map +1 -0
- package/auth_gate.d.ts +2 -0
- package/auth_gate.d.ts.map +1 -0
- package/auth_gate.js +24 -0
- package/auth_gate.js.map +1 -0
- package/auth_session.d.ts +49 -0
- package/auth_session.d.ts.map +1 -0
- package/auth_session.js +1097 -0
- package/auth_session.js.map +1 -0
- package/bandwidth.d.ts +129 -25
- package/bandwidth.d.ts.map +1 -1
- package/bandwidth.js +410 -139
- package/bandwidth.js.map +1 -1
- package/bandwidth_api.d.ts +1 -1
- package/bandwidth_api.d.ts.map +1 -1
- package/bandwidth_api.js +1 -2
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +64 -38
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -173
- package/broadcast.js.map +1 -1
- package/cache.d.ts +103 -0
- package/cache.d.ts.map +1 -0
- package/cache.js +254 -0
- package/cache.js.map +1 -0
- package/claim.test-util.d.ts +5 -0
- package/claim.test-util.d.ts.map +1 -0
- package/claim.test-util.js +13 -0
- package/claim.test-util.js.map +1 -0
- package/connection/accept.d.ts +21 -13
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -130
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -20
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +120 -24
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -217
- package/connection/connect.js.map +1 -1
- package/connection/dials.d.ts +45 -0
- package/connection/dials.d.ts.map +1 -0
- package/connection/dials.js +109 -0
- package/connection/dials.js.map +1 -0
- package/connection/endpoint.d.ts +60 -0
- package/connection/endpoint.d.ts.map +1 -0
- package/connection/endpoint.js +114 -0
- package/connection/endpoint.js.map +1 -0
- package/connection/forward.d.ts +7 -1
- package/connection/forward.d.ts.map +1 -1
- package/connection/forward.js +265 -81
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +16 -9
- package/connection/goaway.d.ts.map +1 -1
- package/connection/goaway.js +22 -95
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +34 -8
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -21
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +4 -7
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -3
- package/connection/index.js.map +1 -1
- package/connection/liveness.d.ts +14 -0
- package/connection/liveness.d.ts.map +1 -0
- package/connection/liveness.js +30 -0
- package/connection/liveness.js.map +1 -0
- package/connection/pool.d.ts +142 -63
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -118
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts +60 -12
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +859 -234
- package/connection/reload.js.map +1 -1
- package/connection/session.d.ts +91 -0
- package/connection/session.d.ts.map +1 -0
- package/connection/session.js +2 -0
- package/connection/session.js.map +1 -0
- package/connection/stats.d.ts +20 -11
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js +64 -9
- package/connection/stats.js.map +1 -1
- package/connection/ticker.d.ts +4 -0
- package/connection/ticker.d.ts.map +1 -0
- package/connection/ticker.js +66 -0
- package/connection/ticker.js.map +1 -0
- package/connection/tokens.d.ts +2 -0
- package/connection/tokens.d.ts.map +1 -0
- package/connection/tokens.js +404 -0
- package/connection/tokens.js.map +1 -0
- package/connection/transport.d.ts.map +1 -1
- package/connection/transport.js +4 -5
- package/connection/transport.js.map +1 -1
- package/connection/withdrawal.d.ts +2 -0
- package/connection/withdrawal.d.ts.map +1 -0
- package/connection/withdrawal.js +23 -0
- package/connection/withdrawal.js.map +1 -0
- package/consume.js +213 -47
- package/consume.js.map +1 -1
- package/cover.d.ts +59 -0
- package/cover.d.ts.map +1 -0
- package/cover.js +375 -0
- package/cover.js.map +1 -0
- package/datagram.d.ts +70 -11
- package/datagram.d.ts.map +1 -1
- package/datagram.js +317 -2
- package/datagram.js.map +1 -1
- package/datagram_stream.d.ts +18 -0
- package/datagram_stream.d.ts.map +1 -0
- package/datagram_stream.js +67 -0
- package/datagram_stream.js.map +1 -0
- package/defined.test-util.d.ts +2 -0
- package/defined.test-util.d.ts.map +1 -0
- package/defined.test-util.js +7 -0
- package/defined.test-util.js.map +1 -0
- package/delivered.d.ts +75 -0
- package/delivered.d.ts.map +1 -0
- package/delivered.js +228 -0
- package/delivered.js.map +1 -0
- package/demand.d.ts +173 -0
- package/demand.d.ts.map +1 -0
- package/demand.js +582 -0
- package/demand.js.map +1 -0
- package/drops.d.ts +93 -0
- package/drops.d.ts.map +1 -0
- package/drops.js +283 -0
- package/drops.js.map +1 -0
- package/error.d.ts +120 -21
- package/error.d.ts.map +1 -1
- package/error.js +230 -38
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -3
- package/errors.js.map +1 -1
- package/fill.d.ts +174 -0
- package/fill.d.ts.map +1 -0
- package/fill.js +760 -0
- package/fill.js.map +1 -0
- package/flate/decoder.d.ts +2 -0
- package/flate/decoder.d.ts.map +1 -0
- package/flate/decoder.js +63 -0
- package/flate/decoder.js.map +1 -0
- package/flate/encoder.d.ts +2 -0
- package/flate/encoder.d.ts.map +1 -0
- package/flate/encoder.js +64 -0
- package/flate/encoder.js.map +1 -0
- package/flate/group.d.ts +34 -0
- package/flate/group.d.ts.map +1 -0
- package/flate/group.js +140 -0
- package/flate/group.js.map +1 -0
- package/frame.d.ts +80 -0
- package/frame.d.ts.map +1 -0
- package/frame.js +296 -0
- package/frame.js.map +1 -0
- package/frame.test-util.d.ts +5 -0
- package/frame.test-util.d.ts.map +1 -0
- package/frame.test-util.js +9 -0
- package/frame.test-util.js.map +1 -0
- package/group.d.ts +108 -45
- package/group.d.ts.map +1 -1
- package/group.js +1616 -308
- package/group.js.map +1 -1
- package/group_api.d.ts +7 -0
- package/group_api.d.ts.map +1 -0
- package/group_api.js +7 -0
- package/group_api.js.map +1 -0
- package/hop.d.ts +62 -76
- package/hop.d.ts.map +1 -1
- package/hop.js +92 -65
- package/hop.js.map +1 -1
- package/identity.d.ts +39 -0
- package/identity.d.ts.map +1 -0
- package/identity.js +47 -0
- package/identity.js.map +1 -0
- package/ietf/active_count.d.ts +2 -0
- package/ietf/active_count.d.ts.map +1 -0
- package/ietf/active_count.js +30 -0
- package/ietf/active_count.js.map +1 -0
- package/ietf/aliases.js +69 -36
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -55
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +1 -31
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +305 -144
- package/ietf/connection.js.map +1 -1
- package/ietf/datagram.d.ts +60 -0
- package/ietf/datagram.d.ts.map +1 -0
- package/ietf/datagram.js +152 -0
- package/ietf/datagram.js.map +1 -0
- package/ietf/error.d.ts +3 -3
- package/ietf/error.js +82 -101
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +93 -37
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -94
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +21 -31
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -172
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +12 -10
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -36
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -2
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +8 -20
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -15
- package/ietf/index.js.map +1 -1
- package/ietf/join.d.ts +7 -0
- package/ietf/join.d.ts.map +1 -0
- package/ietf/join.js +234 -0
- package/ietf/join.js.map +1 -0
- package/ietf/message.d.ts +18 -2
- package/ietf/message.d.ts.map +1 -1
- package/ietf/message.js +60 -41
- package/ietf/message.js.map +1 -1
- package/ietf/message.test-util.d.ts +6 -0
- package/ietf/message.test-util.d.ts.map +1 -0
- package/ietf/message.test-util.js +13 -0
- package/ietf/message.test-util.js.map +1 -0
- package/ietf/namespace.d.ts +19 -5
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -27
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +195 -33
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -179
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +25 -45
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -473
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +17 -2
- package/ietf/priority.d.ts.map +1 -1
- package/ietf/priority.js +19 -5
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +6 -5
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -49
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +25 -33
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -140
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +49 -72
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -185
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -601
- package/ietf/publisher.js.map +1 -1
- package/ietf/range.d.ts +2 -0
- package/ietf/range.d.ts.map +1 -0
- package/ietf/range.js +222 -0
- package/ietf/range.js.map +1 -0
- package/ietf/request.d.ts +6 -30
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -79
- package/ietf/request.js.map +1 -1
- package/ietf/request_stream.d.ts +1 -6
- package/ietf/request_stream.d.ts.map +1 -1
- package/ietf/request_stream.js +306 -17
- package/ietf/request_stream.js.map +1 -1
- package/ietf/session.d.ts +41 -0
- package/ietf/session.d.ts.map +1 -0
- package/ietf/session.js +65 -0
- package/ietf/session.js.map +1 -0
- package/ietf/setup.d.ts +5 -30
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -118
- package/ietf/setup.js.map +1 -1
- package/ietf/setup_options.d.ts +31 -0
- package/ietf/setup_options.d.ts.map +1 -0
- package/ietf/setup_options.js +138 -0
- package/ietf/setup_options.js.map +1 -0
- package/ietf/solicit.js +4 -15
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +52 -45
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -240
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +16 -79
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -202
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -537
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -28
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +27 -24
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -62
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +13 -42
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +22 -49
- package/ietf/version.js.map +1 -1
- package/implementation.d.ts +2 -0
- package/implementation.d.ts.map +1 -0
- package/implementation.js +5 -0
- package/implementation.js.map +1 -0
- package/index.d.ts +34 -19
- package/index.d.ts.map +1 -1
- package/index.js +19 -7
- package/index.js.map +1 -1
- package/internal.d.ts +1515 -67
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -80
- package/internal.js.map +1 -1
- package/ledger.d.ts +23 -0
- package/ledger.d.ts.map +1 -0
- package/ledger.js +247 -0
- package/ledger.js.map +1 -0
- package/listing.d.ts +132 -0
- package/listing.d.ts.map +1 -0
- package/listing.js +486 -0
- package/listing.js.map +1 -0
- package/lite/announce.d.ts +127 -66
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -159
- package/lite/announce.js.map +1 -1
- package/lite/announce_stream.d.ts +2 -0
- package/lite/announce_stream.d.ts.map +1 -0
- package/lite/announce_stream.js +92 -0
- package/lite/announce_stream.js.map +1 -0
- package/lite/answer.d.ts +22 -0
- package/lite/answer.d.ts.map +1 -0
- package/lite/answer.js +301 -0
- package/lite/answer.js.map +1 -0
- package/lite/auth.d.ts +45 -0
- package/lite/auth.d.ts.map +1 -0
- package/lite/auth.js +204 -0
- package/lite/auth.js.map +1 -0
- package/lite/compat.d.ts +31 -0
- package/lite/compat.d.ts.map +1 -0
- package/lite/compat.js +86 -0
- package/lite/compat.js.map +1 -0
- package/lite/connection.d.ts +1 -45
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +360 -78
- package/lite/connection.js.map +1 -1
- package/lite/datagram-end.d.ts +26 -0
- package/lite/datagram-end.d.ts.map +1 -0
- package/lite/datagram-end.js +30 -0
- package/lite/datagram-end.js.map +1 -0
- package/lite/datagram.d.ts +73 -8
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +144 -10
- package/lite/datagram.js.map +1 -1
- package/lite/duration.d.ts +6 -0
- package/lite/duration.d.ts.map +1 -0
- package/lite/duration.js +14 -0
- package/lite/duration.js.map +1 -0
- package/lite/error.d.ts +9 -0
- package/lite/error.d.ts.map +1 -0
- package/lite/error.js +24 -0
- package/lite/error.js.map +1 -0
- package/lite/fills.d.ts +162 -0
- package/lite/fills.d.ts.map +1 -0
- package/lite/fills.js +486 -0
- package/lite/fills.js.map +1 -0
- package/lite/fit.d.ts +49 -0
- package/lite/fit.d.ts.map +1 -0
- package/lite/fit.js +305 -0
- package/lite/fit.js.map +1 -0
- package/lite/goaway.d.ts +2 -2
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -14
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +67 -16
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -31
- package/lite/group.js.map +1 -1
- package/lite/identity.d.ts +25 -0
- package/lite/identity.d.ts.map +1 -0
- package/lite/identity.js +79 -0
- package/lite/identity.js.map +1 -0
- package/lite/index.d.ts +14 -13
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -2
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +10 -2
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -45
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +9 -2
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +11 -106
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts +2 -2
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -1
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +10 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +2548 -438
- package/lite/publisher.js.map +1 -1
- package/lite/routed.d.ts +59 -0
- package/lite/routed.d.ts.map +1 -0
- package/lite/routed.js +564 -0
- package/lite/routed.js.map +1 -0
- package/lite/session.d.ts +2 -28
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -100
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +32 -5
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -22
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +5 -11
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +5 -2
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +478 -78
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -143
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +7 -44
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3290 -516
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +27 -12
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -38
- package/lite/track.js.map +1 -1
- package/lite/tracks.d.ts +55 -0
- package/lite/tracks.d.ts.map +1 -0
- package/lite/tracks.js +114 -0
- package/lite/tracks.js.map +1 -0
- package/lite/version.d.ts +132 -24
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +378 -34
- package/lite/version.js.map +1 -1
- package/meta.d.ts +77 -0
- package/meta.d.ts.map +1 -0
- package/meta.js +130 -0
- package/meta.js.map +1 -0
- package/meta_api.d.ts +7 -0
- package/meta_api.d.ts.map +1 -0
- package/meta_api.js +7 -0
- package/meta_api.js.map +1 -0
- package/mint.d.ts +28 -0
- package/mint.d.ts.map +1 -0
- package/mint.js +66 -0
- package/mint.js.map +1 -0
- package/open.d.ts +63 -0
- package/open.d.ts.map +1 -0
- package/open.js +250 -0
- package/open.js.map +1 -0
- package/origin.d.ts +394 -142
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -687
- package/origin.js.map +1 -1
- package/package.json +8 -13
- package/path.d.ts +51 -51
- package/path.d.ts.map +1 -1
- package/path.js +210 -58
- package/path.js.map +1 -1
- package/payload.d.ts +33 -0
- package/payload.d.ts.map +1 -0
- package/payload.js +65 -0
- package/payload.js.map +1 -0
- package/prefix.d.ts +152 -0
- package/prefix.d.ts.map +1 -0
- package/prefix.js +349 -0
- package/prefix.js.map +1 -0
- package/priority.d.ts +8 -0
- package/priority.d.ts.map +1 -0
- package/priority.js +185 -0
- package/priority.js.map +1 -0
- package/queue.d.ts +2 -0
- package/queue.d.ts.map +1 -0
- package/queue.js +46 -0
- package/queue.js.map +1 -0
- package/ranges.d.ts +36 -0
- package/ranges.d.ts.map +1 -0
- package/ranges.js +312 -0
- package/ranges.js.map +1 -0
- package/rescale.d.ts +24 -0
- package/rescale.d.ts.map +1 -0
- package/rescale.js +39 -0
- package/rescale.js.map +1 -0
- package/resume.d.ts +55 -0
- package/resume.d.ts.map +1 -0
- package/resume.js +4173 -0
- package/resume.js.map +1 -0
- package/resume.test-util.d.ts +2 -0
- package/resume.test-util.d.ts.map +1 -0
- package/resume.test-util.js +25 -0
- package/resume.test-util.js.map +1 -0
- package/skips.d.ts +48 -0
- package/skips.d.ts.map +1 -0
- package/skips.js +182 -0
- package/skips.js.map +1 -0
- package/stream.d.ts +78 -40
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -93
- package/stream.js.map +1 -1
- package/subscription.test-util.d.ts +2 -0
- package/subscription.test-util.d.ts.map +1 -0
- package/subscription.test-util.js +49 -0
- package/subscription.test-util.js.map +1 -0
- package/tail.d.ts +23 -14
- package/tail.d.ts.map +1 -1
- package/tail.js +224 -98
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -92
- package/time.js.map +1 -1
- package/timed.d.ts +21 -0
- package/timed.d.ts.map +1 -0
- package/timed.js +2 -0
- package/timed.js.map +1 -0
- package/track.d.ts +578 -246
- package/track.d.ts.map +1 -1
- package/track.js +7306 -772
- package/track.js.map +1 -1
- package/track_api.d.ts +7 -0
- package/track_api.d.ts.map +1 -0
- package/track_api.js +7 -0
- package/track_api.js.map +1 -0
- package/util/abort.d.ts +1 -0
- package/util/abort.d.ts.map +1 -1
- package/util/abort.js +23 -2
- package/util/abort.js.map +1 -1
- package/util/announce.d.ts +4 -0
- package/util/announce.d.ts.map +1 -0
- package/util/announce.js +11 -0
- package/util/announce.js.map +1 -0
- package/util/bigint.d.ts +3 -0
- package/util/bigint.d.ts.map +1 -0
- package/util/bigint.js +8 -0
- package/util/bigint.js.map +1 -0
- package/util/change.d.ts +12 -0
- package/util/change.d.ts.map +1 -0
- package/util/change.js +18 -0
- package/util/change.js.map +1 -0
- package/util/deadline.d.ts +2 -0
- package/util/deadline.d.ts.map +1 -0
- package/util/deadline.js +108 -0
- package/util/deadline.js.map +1 -0
- package/util/decode_error.d.ts +3 -0
- package/util/decode_error.d.ts.map +1 -0
- package/util/decode_error.js +11 -0
- package/util/decode_error.js.map +1 -0
- package/util/demand.d.ts +8 -0
- package/util/demand.d.ts.map +1 -0
- package/util/demand.js +24 -0
- package/util/demand.js.map +1 -0
- package/util/given_up.d.ts +2 -0
- package/util/given_up.d.ts.map +1 -0
- package/util/given_up.js +101 -0
- package/util/given_up.js.map +1 -0
- package/util/hex.d.ts +6 -0
- package/util/hex.d.ts.map +1 -1
- package/util/hex.js +19 -5
- package/util/hex.js.map +1 -1
- package/util/key.d.ts +15 -0
- package/util/key.d.ts.map +1 -0
- package/util/key.js +38 -0
- package/util/key.js.map +1 -0
- package/util/limits.d.ts +2 -0
- package/util/limits.d.ts.map +1 -0
- package/util/limits.js +76 -0
- package/util/limits.js.map +1 -0
- package/util/observed.d.ts +23 -0
- package/util/observed.d.ts.map +1 -0
- package/util/observed.js +122 -0
- package/util/observed.js.map +1 -0
- package/util/sorted.d.ts +2 -0
- package/util/sorted.d.ts.map +1 -0
- package/util/sorted.js +149 -0
- package/util/sorted.js.map +1 -0
- package/util/timeout.d.ts +2 -1
- package/util/timeout.d.ts.map +1 -1
- package/util/timeout.js +13 -10
- package/util/timeout.js.map +1 -1
- package/util/timer.d.ts +2 -0
- package/util/timer.d.ts.map +1 -0
- package/util/timer.js +19 -0
- package/util/timer.js.map +1 -0
- package/util/u64.js +0 -1
- package/util/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -2
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -2
- package/util/varint.js.map +1 -1
- package/util/watch.d.ts +8 -0
- package/util/watch.d.ts.map +1 -0
- package/util/watch.js +38 -0
- package/util/watch.js.map +1 -0
- package/util/yield.d.ts +2 -0
- package/util/yield.d.ts.map +1 -0
- package/util/yield.js +31 -0
- package/util/yield.js.map +1 -0
- package/varint.d.ts +0 -29
- package/varint.d.ts.map +1 -1
- package/varint.js +7 -29
- package/varint.js.map +1 -1
- package/varint_api.d.ts +7 -0
- package/varint_api.d.ts.map +1 -0
- package/varint_api.js +7 -0
- package/varint_api.js.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +4 -0
- package/version.js.map +1 -0
- package/window.d.ts +570 -0
- package/window.d.ts.map +1 -0
- package/window.js +1677 -0
- package/window.js.map +1 -0
- package/wire.d.ts +150 -35
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -1
- package/wire.js.map +1 -1
- package/connection/established.d.ts +0 -53
- package/connection/established.d.ts.map +0 -1
- package/connection/established.js +0 -3
- package/connection/established.js.map +0 -1
- package/ietf/adapter.d.ts +0 -75
- package/ietf/adapter.d.ts.map +0 -1
- package/ietf/adapter.js +0 -700
- package/ietf/adapter.js.map +0 -1
- package/lite/datagram_stream.d.ts +0 -8
- package/lite/datagram_stream.d.ts.map +0 -1
- package/lite/datagram_stream.js +0 -44
- package/lite/datagram_stream.js.map +0 -1
- package/lite/fetch.d.ts +0 -28
- package/lite/fetch.d.ts.map +0 -1
- package/lite/fetch.js +0 -79
- package/lite/fetch.js.map +0 -1
- package/util/log.d.ts +0 -5
- package/util/log.d.ts.map +0 -1
- package/util/log.js +0 -17
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -19
- package/zod.js.map +0 -1
package/ietf/filter.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/* @ts-self-types="./filter.d.ts" */
|
|
2
1
|
/**
|
|
3
|
-
* The Location Filter carried by SUBSCRIBE, and draft-
|
|
2
|
+
* The Location Filter carried by SUBSCRIBE, and draft-22's fill request.
|
|
4
3
|
*
|
|
5
4
|
* @module
|
|
6
5
|
*/
|
|
7
6
|
import { ProtocolViolation } from "../error.js";
|
|
7
|
+
import { concat } from "../stream.js";
|
|
8
8
|
import * as Varint from "../varint.js";
|
|
9
|
-
import { Version } from "./version.js";
|
|
10
|
-
/** The tagged Filter Type of draft-
|
|
9
|
+
import { isDraft23, Version } from "./version.js";
|
|
10
|
+
/** The tagged Filter Type of draft-18 and earlier. */
|
|
11
11
|
const TAG_NEXT_GROUP = 0x1n;
|
|
12
12
|
const TAG_LARGEST_OBJECT = 0x2n;
|
|
13
13
|
const TAG_ABSOLUTE_START = 0x3n;
|
|
@@ -16,24 +16,18 @@ const TAG_ABSOLUTE_RANGE = 0x4n;
|
|
|
16
16
|
* Whether this is draft-20 or newer.
|
|
17
17
|
*
|
|
18
18
|
* Draft-20 replaced the Filter Type tag with up to four optional varints, where the number
|
|
19
|
-
* 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.
|
|
20
21
|
*/
|
|
21
22
|
export function isDraft20(version) {
|
|
22
|
-
return
|
|
23
|
-
version !== Version.DRAFT_15 &&
|
|
24
|
-
version !== Version.DRAFT_16 &&
|
|
25
|
-
version !== Version.DRAFT_17 &&
|
|
26
|
-
version !== Version.DRAFT_18 &&
|
|
27
|
-
version !== Version.DRAFT_19);
|
|
23
|
+
return version !== Version.DRAFT_18;
|
|
28
24
|
}
|
|
29
25
|
/**
|
|
30
|
-
* Whether
|
|
31
|
-
*
|
|
32
|
-
* Draft-22 replaced the length-inferred field list with a Location Filter Type that names
|
|
33
|
-
* 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.
|
|
34
28
|
*/
|
|
35
|
-
|
|
36
|
-
return isDraft20(version) && version !== Version.DRAFT_20
|
|
29
|
+
function isTyped(version) {
|
|
30
|
+
return isDraft20(version) && version !== Version.DRAFT_20;
|
|
37
31
|
}
|
|
38
32
|
/** The Location Filter Type of draft-22. */
|
|
39
33
|
const TYPE_NONE = 0x0n;
|
|
@@ -42,58 +36,33 @@ const TYPE_ABSOLUTE_START = 0x2n;
|
|
|
42
36
|
const TYPE_ABSOLUTE_GROUP_END = 0x3n;
|
|
43
37
|
const TYPE_ABSOLUTE_RANGE = 0x4n;
|
|
44
38
|
const TYPE_NEXT_OBJECT = 0x5n;
|
|
45
|
-
/** Whether the Range Filters
|
|
39
|
+
/** Whether the Range Filters exist on this draft. */
|
|
46
40
|
export function hasRangeFilters(version) {
|
|
47
|
-
return isDraft20(version)
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Draft-17 replaced QUIC's two-bit-length varint with a leading-1-bits one. The two agree
|
|
51
|
-
* below 64 and diverge above it, so getting this wrong is invisible until group or object
|
|
52
|
-
* ids grow past that.
|
|
53
|
-
*/
|
|
54
|
-
function usesLeadingOnes(version) {
|
|
55
|
-
return version !== Version.DRAFT_14 && version !== Version.DRAFT_15 && version !== Version.DRAFT_16;
|
|
56
|
-
}
|
|
57
|
-
function varint(v, version) {
|
|
58
|
-
return usesLeadingOnes(version) ? Varint.encodeLeadingOnes(v) : Varint.encode(v);
|
|
59
|
-
}
|
|
60
|
-
function unvarint(buf, version) {
|
|
61
|
-
return usesLeadingOnes(version) ? Varint.decodeLeadingOnes(buf) : Varint.decodeBigInt(buf);
|
|
62
|
-
}
|
|
63
|
-
function concat(parts) {
|
|
64
|
-
const total = parts.reduce((n, p) => n + p.length, 0);
|
|
65
|
-
const out = new Uint8Array(total);
|
|
66
|
-
let offset = 0;
|
|
67
|
-
for (const part of parts) {
|
|
68
|
-
out.set(part, offset);
|
|
69
|
-
offset += part.length;
|
|
70
|
-
}
|
|
71
|
-
return out;
|
|
41
|
+
return isDraft20(version);
|
|
72
42
|
}
|
|
43
|
+
const varint = Varint.encodeLeadingOnes;
|
|
44
|
+
const unvarint = Varint.decodeLeadingOnes;
|
|
73
45
|
function endDelta(startGroup, endGroup) {
|
|
74
46
|
if (endGroup < startGroup) {
|
|
75
47
|
throw new Error(`filter range runs backwards: ${startGroup} > ${endGroup}`);
|
|
76
48
|
}
|
|
77
49
|
return endGroup - startGroup;
|
|
78
50
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Encode a filter as its raw parameter value, without the Length that frames it through
|
|
81
|
-
* draft-21. Unfiltered encodes to zero bytes on draft-20 and draft-21.
|
|
82
|
-
*/
|
|
51
|
+
/** Encode a filter as its raw parameter value, without the Length that frames it before draft-22. */
|
|
83
52
|
export function encode(filter, version) {
|
|
84
|
-
if (
|
|
85
|
-
return encodeTyped(filter
|
|
86
|
-
return isDraft20(version) ? encodeFields(filter
|
|
53
|
+
if (isTyped(version))
|
|
54
|
+
return encodeTyped(filter);
|
|
55
|
+
return isDraft20(version) ? encodeFields(filter) : encodeTag(filter);
|
|
87
56
|
}
|
|
88
57
|
/** Encode LOCATION_FILTER's value as it follows the parameter type from draft-17 on. */
|
|
89
58
|
export function encodeParam(filter, version) {
|
|
90
59
|
const value = encode(filter, version);
|
|
91
60
|
// Draft-22's Location Filter Type says where the value ends, so it needs no Length.
|
|
92
|
-
return
|
|
61
|
+
return isTyped(version) ? value : encodeLengthPrefixed(value);
|
|
93
62
|
}
|
|
94
63
|
/** Read LOCATION_FILTER's value as it follows the parameter type from draft-17 on. */
|
|
95
64
|
export async function decodeParam(r, version) {
|
|
96
|
-
if (!
|
|
65
|
+
if (!isTyped(version)) {
|
|
97
66
|
return decode(await r.read(await r.u53()), version);
|
|
98
67
|
}
|
|
99
68
|
const type = await r.u62();
|
|
@@ -103,29 +72,50 @@ export async function decodeParam(r, version) {
|
|
|
103
72
|
}
|
|
104
73
|
return fromTyped(type, fields);
|
|
105
74
|
}
|
|
106
|
-
|
|
75
|
+
/** Encode the draft-20 field list, where the number of fields selects the meaning. */
|
|
76
|
+
function encodeFields(filter) {
|
|
107
77
|
switch (filter.kind) {
|
|
108
78
|
case "unfiltered":
|
|
109
|
-
return
|
|
79
|
+
return new Uint8Array();
|
|
110
80
|
case "nextObject":
|
|
111
|
-
return varint(
|
|
81
|
+
return concat([varint(0n), varint(0n)]);
|
|
112
82
|
case "relative":
|
|
113
|
-
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)]);
|
|
114
108
|
case "absolute": {
|
|
115
109
|
const type = filter.endGroup === undefined
|
|
116
110
|
? TYPE_ABSOLUTE_START
|
|
117
111
|
: filter.endObject === undefined
|
|
118
112
|
? TYPE_ABSOLUTE_GROUP_END
|
|
119
113
|
: TYPE_ABSOLUTE_RANGE;
|
|
120
|
-
const parts = [
|
|
121
|
-
varint(type, version),
|
|
122
|
-
varint(filter.startGroup, version),
|
|
123
|
-
varint(filter.startObject, version),
|
|
124
|
-
];
|
|
114
|
+
const parts = [varint(type), varint(filter.startGroup), varint(filter.startObject)];
|
|
125
115
|
if (filter.endGroup !== undefined) {
|
|
126
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)
|
|
116
|
+
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)));
|
|
127
117
|
if (filter.endObject !== undefined) {
|
|
128
|
-
parts.push(varint(filter.endObject
|
|
118
|
+
parts.push(varint(filter.endObject));
|
|
129
119
|
}
|
|
130
120
|
}
|
|
131
121
|
return concat(parts);
|
|
@@ -170,68 +160,43 @@ function fromTyped(type, fields) {
|
|
|
170
160
|
}
|
|
171
161
|
}
|
|
172
162
|
/** Read a draft-22 filter from the front of `data`, returning what follows it. */
|
|
173
|
-
function readTyped(data
|
|
174
|
-
let [type, rest] = unvarint(data
|
|
163
|
+
function readTyped(data) {
|
|
164
|
+
let [type, rest] = unvarint(data);
|
|
175
165
|
const fields = [];
|
|
176
166
|
for (let i = typedFieldCount(type); i > 0; i--) {
|
|
177
|
-
const [field, next] = unvarint(rest
|
|
167
|
+
const [field, next] = unvarint(rest);
|
|
178
168
|
fields.push(field);
|
|
179
169
|
rest = next;
|
|
180
170
|
}
|
|
181
171
|
return [fromTyped(type, fields), rest];
|
|
182
172
|
}
|
|
183
|
-
function
|
|
184
|
-
switch (filter.kind) {
|
|
185
|
-
case "unfiltered":
|
|
186
|
-
return new Uint8Array();
|
|
187
|
-
case "nextObject":
|
|
188
|
-
return concat([varint(0n, version), varint(0n, version)]);
|
|
189
|
-
case "relative":
|
|
190
|
-
return varint(filter.groups, version);
|
|
191
|
-
case "absolute": {
|
|
192
|
-
// An open ended absolute {0, 0} is defined as equivalent to unfiltered, so it
|
|
193
|
-
// normalizes rather than colliding with the two-zero-field nextObject spelling.
|
|
194
|
-
if (filter.startGroup === 0n && filter.startObject === 0n && filter.endGroup === undefined) {
|
|
195
|
-
return new Uint8Array();
|
|
196
|
-
}
|
|
197
|
-
const parts = [varint(filter.startGroup, version), varint(filter.startObject, version)];
|
|
198
|
-
if (filter.endGroup !== undefined) {
|
|
199
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup), version));
|
|
200
|
-
if (filter.endObject !== undefined) {
|
|
201
|
-
parts.push(varint(filter.endObject, version));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return concat(parts);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function encodeTag(filter, version) {
|
|
173
|
+
function encodeTag(filter) {
|
|
209
174
|
switch (filter.kind) {
|
|
210
175
|
case "unfiltered":
|
|
211
176
|
// No tag means "everything", which only the absolute spelling can say.
|
|
212
|
-
return concat([varint(TAG_ABSOLUTE_START
|
|
177
|
+
return concat([varint(TAG_ABSOLUTE_START), varint(0n), varint(0n)]);
|
|
213
178
|
case "nextObject":
|
|
214
|
-
return varint(TAG_LARGEST_OBJECT
|
|
179
|
+
return varint(TAG_LARGEST_OBJECT);
|
|
215
180
|
case "relative":
|
|
216
181
|
if (filter.groups !== 0n) {
|
|
217
|
-
// Only draft-
|
|
182
|
+
// Only draft-22 can name a start further back than the next group without
|
|
218
183
|
// knowing Largest Object, so there is no honest tag to fall back to.
|
|
219
|
-
throw new Error(`relative filter ${filter.groups} needs draft-
|
|
184
|
+
throw new Error(`relative filter ${filter.groups} needs draft-22`);
|
|
220
185
|
}
|
|
221
|
-
return varint(TAG_NEXT_GROUP
|
|
186
|
+
return varint(TAG_NEXT_GROUP);
|
|
222
187
|
case "absolute": {
|
|
223
|
-
// Draft-
|
|
188
|
+
// Draft-18's AbsoluteRange ends on a group, so an object-bounded range has no
|
|
224
189
|
// spelling. Refuse rather than widen the range the caller asked for.
|
|
225
190
|
if (filter.endObject !== undefined) {
|
|
226
|
-
throw new Error("an object-bounded range needs draft-
|
|
191
|
+
throw new Error("an object-bounded range needs draft-22");
|
|
227
192
|
}
|
|
228
193
|
const parts = [
|
|
229
|
-
varint(filter.endGroup === undefined ? TAG_ABSOLUTE_START : TAG_ABSOLUTE_RANGE
|
|
230
|
-
varint(filter.startGroup
|
|
231
|
-
varint(filter.startObject
|
|
194
|
+
varint(filter.endGroup === undefined ? TAG_ABSOLUTE_START : TAG_ABSOLUTE_RANGE),
|
|
195
|
+
varint(filter.startGroup),
|
|
196
|
+
varint(filter.startObject),
|
|
232
197
|
];
|
|
233
198
|
if (filter.endGroup !== undefined) {
|
|
234
|
-
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)
|
|
199
|
+
parts.push(varint(endDelta(filter.startGroup, filter.endGroup)));
|
|
235
200
|
}
|
|
236
201
|
return concat(parts);
|
|
237
202
|
}
|
|
@@ -239,21 +204,22 @@ function encodeTag(filter, version) {
|
|
|
239
204
|
}
|
|
240
205
|
/** Decode a filter from its raw parameter value, which must be consumed whole. */
|
|
241
206
|
export function decode(data, version) {
|
|
242
|
-
if (
|
|
243
|
-
const [filter, rest] = readTyped(data
|
|
207
|
+
if (isTyped(version)) {
|
|
208
|
+
const [filter, rest] = readTyped(data);
|
|
244
209
|
expectEmpty(rest);
|
|
245
210
|
return filter;
|
|
246
211
|
}
|
|
247
|
-
return isDraft20(version) ? decodeFields(data
|
|
212
|
+
return isDraft20(version) ? decodeFields(data) : decodeTag(data);
|
|
248
213
|
}
|
|
249
|
-
|
|
214
|
+
/** Decode the draft-20 field list, which the caller has already delimited. */
|
|
215
|
+
function decodeFields(data) {
|
|
250
216
|
const fields = [];
|
|
251
217
|
let rest = data;
|
|
252
218
|
while (rest.length > 0) {
|
|
253
219
|
if (fields.length === 4) {
|
|
254
220
|
throw new Error("too many fields in LOCATION_FILTER");
|
|
255
221
|
}
|
|
256
|
-
const [value, next] = unvarint(rest
|
|
222
|
+
const [value, next] = unvarint(rest);
|
|
257
223
|
fields.push(value);
|
|
258
224
|
rest = next;
|
|
259
225
|
}
|
|
@@ -274,11 +240,11 @@ function decodeFields(data, version) {
|
|
|
274
240
|
}
|
|
275
241
|
}
|
|
276
242
|
}
|
|
277
|
-
function decodeTag(data
|
|
278
|
-
const [tag, afterTag] = unvarint(data
|
|
243
|
+
function decodeTag(data) {
|
|
244
|
+
const [tag, afterTag] = unvarint(data);
|
|
279
245
|
const readLocation = (buf) => {
|
|
280
|
-
const [group, afterGroup] = unvarint(buf
|
|
281
|
-
const [object, rest] = unvarint(afterGroup
|
|
246
|
+
const [group, afterGroup] = unvarint(buf);
|
|
247
|
+
const [object, rest] = unvarint(afterGroup);
|
|
282
248
|
return [group, object, rest];
|
|
283
249
|
};
|
|
284
250
|
switch (tag) {
|
|
@@ -295,7 +261,7 @@ function decodeTag(data, version) {
|
|
|
295
261
|
}
|
|
296
262
|
case TAG_ABSOLUTE_RANGE: {
|
|
297
263
|
const [startGroup, startObject, afterLocation] = readLocation(afterTag);
|
|
298
|
-
const [delta, rest] = unvarint(afterLocation
|
|
264
|
+
const [delta, rest] = unvarint(afterLocation);
|
|
299
265
|
expectEmpty(rest);
|
|
300
266
|
return { kind: "absolute", startGroup, startObject, endGroup: startGroup + delta };
|
|
301
267
|
}
|
|
@@ -303,43 +269,16 @@ function decodeTag(data, version) {
|
|
|
303
269
|
throw new Error(`unsupported filter type: ${tag}`);
|
|
304
270
|
}
|
|
305
271
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Read the tagged filter draft-14 carries inline in a SUBSCRIBE body, where the fields
|
|
308
|
-
* following the tag have no length to delimit them.
|
|
309
|
-
*
|
|
310
|
-
* Every tag is read, including the absolute forms we do not serve. Rejecting one would tear
|
|
311
|
-
* the session down over a filter the draft lets a subscriber send; what we do with it is
|
|
312
|
-
* decided when the range is resolved.
|
|
313
|
-
*/
|
|
314
|
-
export async function decodeInline(r) {
|
|
315
|
-
const tag = await r.u62();
|
|
316
|
-
switch (tag) {
|
|
317
|
-
case TAG_NEXT_GROUP:
|
|
318
|
-
return { kind: "relative", groups: 0n };
|
|
319
|
-
case TAG_LARGEST_OBJECT:
|
|
320
|
-
return { kind: "nextObject" };
|
|
321
|
-
case TAG_ABSOLUTE_START:
|
|
322
|
-
return { kind: "absolute", startGroup: await r.u62(), startObject: await r.u62() };
|
|
323
|
-
case TAG_ABSOLUTE_RANGE: {
|
|
324
|
-
const startGroup = await r.u62();
|
|
325
|
-
const startObject = await r.u62();
|
|
326
|
-
const delta = await r.u62();
|
|
327
|
-
return { kind: "absolute", startGroup, startObject, endGroup: startGroup + delta };
|
|
328
|
-
}
|
|
329
|
-
default:
|
|
330
|
-
throw new Error(`unsupported filter type: ${tag}`);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
272
|
function expectEmpty(rest) {
|
|
334
273
|
if (rest.length !== 0) {
|
|
335
274
|
throw new Error("trailing bytes in LOCATION_FILTER");
|
|
336
275
|
}
|
|
337
276
|
}
|
|
338
|
-
/** LOCATION_FILTER, the
|
|
277
|
+
/** LOCATION_FILTER, the parameter that selects the fill's objects. */
|
|
339
278
|
const FILL_LOCATION_FILTER = 0x21n;
|
|
340
279
|
/**
|
|
341
|
-
* The parameters draft-
|
|
342
|
-
*
|
|
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.
|
|
343
282
|
*
|
|
344
283
|
* Tabulated rather than derived, because neither shortcut is right. The Key-Value-Pair rule
|
|
345
284
|
* keys framing off the id's parity, but the Range Filters (0x25-0x28) carry an explicit
|
|
@@ -362,31 +301,56 @@ const FILL_ALLOWED = new Map([
|
|
|
362
301
|
* The value is a nested parameter scope, encoded like a message's parameters.
|
|
363
302
|
*/
|
|
364
303
|
export function encodeFill(fill, version) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
// the
|
|
368
|
-
|
|
369
|
-
|
|
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));
|
|
370
315
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]);
|
|
316
|
+
if (fill.groupOrder !== undefined) {
|
|
317
|
+
key(0x22n);
|
|
318
|
+
parts.push(new Uint8Array([fill.groupOrder === "ascending" ? 1 : 2]));
|
|
319
|
+
}
|
|
320
|
+
return concat(parts);
|
|
377
321
|
}
|
|
378
|
-
/**
|
|
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. */
|
|
379
330
|
export function decodeFill(data, version) {
|
|
380
|
-
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);
|
|
381
344
|
if (count > 64n) {
|
|
382
345
|
throw new Error("too many parameters in FILL_PARAMETERS");
|
|
383
346
|
}
|
|
384
347
|
let rest = afterCount;
|
|
385
348
|
let filter;
|
|
349
|
+
let groupOrder;
|
|
386
350
|
let rangeFilters = false;
|
|
387
351
|
let prev = 0n;
|
|
388
352
|
for (let i = 0n; i < count; i++) {
|
|
389
|
-
const [delta, afterType] = unvarint(rest
|
|
353
|
+
const [delta, afterType] = unvarint(rest);
|
|
390
354
|
const key = i === 0n ? delta : prev + delta;
|
|
391
355
|
prev = key;
|
|
392
356
|
rest = afterType;
|
|
@@ -395,12 +359,12 @@ export function decodeFill(data, version) {
|
|
|
395
359
|
if (filter !== undefined) {
|
|
396
360
|
throw new Error("duplicate LOCATION_FILTER inside FILL_PARAMETERS");
|
|
397
361
|
}
|
|
398
|
-
if (
|
|
399
|
-
[filter, rest] = readTyped(rest
|
|
362
|
+
if (isTyped(version)) {
|
|
363
|
+
[filter, rest] = readTyped(rest);
|
|
400
364
|
}
|
|
401
365
|
else {
|
|
402
366
|
let value;
|
|
403
|
-
[value, rest] = readLengthPrefixed(rest
|
|
367
|
+
[value, rest] = readLengthPrefixed(rest);
|
|
404
368
|
filter = decode(value, version);
|
|
405
369
|
}
|
|
406
370
|
continue;
|
|
@@ -412,34 +376,38 @@ export function decodeFill(data, version) {
|
|
|
412
376
|
// A Range Filter changes which objects the fill may contain, so its presence is
|
|
413
377
|
// recorded even though its value is not interpreted.
|
|
414
378
|
rangeFilters ||= key >= 0x25n && key <= 0x28n;
|
|
415
|
-
//
|
|
416
|
-
// consumed or the remaining keys desync.
|
|
379
|
+
// Each parameter must consume its own value or the remaining keys desync.
|
|
417
380
|
if (framing === "varint") {
|
|
418
|
-
[, rest] = unvarint(rest
|
|
381
|
+
[, rest] = unvarint(rest);
|
|
419
382
|
continue;
|
|
420
383
|
}
|
|
421
384
|
if (framing === "byte") {
|
|
422
385
|
if (rest.length < 1)
|
|
423
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
|
+
}
|
|
424
395
|
rest = rest.slice(1);
|
|
425
396
|
continue;
|
|
426
397
|
}
|
|
427
|
-
[, rest] = readLengthPrefixed(rest
|
|
428
|
-
}
|
|
429
|
-
if (rest.length !== 0) {
|
|
430
|
-
throw new Error("trailing bytes in FILL_PARAMETERS");
|
|
398
|
+
[, rest] = readLengthPrefixed(rest);
|
|
431
399
|
}
|
|
432
|
-
return { filter, rangeFilters };
|
|
400
|
+
return [{ filter, groupOrder, rangeFilters }, rest];
|
|
433
401
|
}
|
|
434
402
|
/** Split a length-prefixed value off the front of `data`, returning it and what follows. */
|
|
435
|
-
function readLengthPrefixed(data
|
|
436
|
-
const [length, afterLength] = unvarint(data
|
|
403
|
+
function readLengthPrefixed(data) {
|
|
404
|
+
const [length, afterLength] = unvarint(data);
|
|
437
405
|
if (BigInt(afterLength.length) < length) {
|
|
438
406
|
throw new Error("truncated value inside FILL_PARAMETERS");
|
|
439
407
|
}
|
|
440
408
|
return [afterLength.slice(0, Number(length)), afterLength.slice(Number(length))];
|
|
441
409
|
}
|
|
442
|
-
function encodeLengthPrefixed(value
|
|
443
|
-
return concat([varint(BigInt(value.length)
|
|
410
|
+
function encodeLengthPrefixed(value) {
|
|
411
|
+
return concat([varint(BigInt(value.length)), value]);
|
|
444
412
|
}
|
|
445
413
|
//# sourceMappingURL=filter.js.map
|