@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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moq/net",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0",
|
|
5
5
|
"description": "The networking layer for Media over QUIC: real-time pub/sub with built-in caching, fan-out, and prioritization.",
|
|
6
6
|
"license": "(MIT OR Apache-2.0)",
|
|
7
7
|
"repository": {
|
|
@@ -15,20 +15,15 @@
|
|
|
15
15
|
"types": "./index.d.ts",
|
|
16
16
|
"default": "./index.js"
|
|
17
17
|
},
|
|
18
|
-
"./
|
|
19
|
-
"types": "./
|
|
20
|
-
"default": "./
|
|
18
|
+
"./prefix": {
|
|
19
|
+
"types": "./prefix.d.ts",
|
|
20
|
+
"default": "./prefix.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@moq/
|
|
25
|
-
"@moq/qmux": "^0.
|
|
26
|
-
"@moq/signals": "^0.
|
|
27
|
-
"
|
|
28
|
-
"bowser": "^2.14.1"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"@zod/mini": "^4.5.0",
|
|
32
|
-
"zod": "^4.5.0"
|
|
24
|
+
"@moq/clock": "^0.22.0",
|
|
25
|
+
"@moq/qmux": "^0.4.0",
|
|
26
|
+
"@moq/signals": "^0.22.0",
|
|
27
|
+
"pako": "^3.0.3"
|
|
33
28
|
}
|
|
34
29
|
}
|
package/path.d.ts
CHANGED
|
@@ -4,26 +4,30 @@
|
|
|
4
4
|
* This module provides path-aware operations that respect delimiter boundaries,
|
|
5
5
|
* preventing issues like "foo" matching "foobar".
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* {@link
|
|
14
|
-
*
|
|
15
|
-
*
|
|
7
|
+
* A path is a run of non-empty segments separated by `/`, so it has exactly one spelling:
|
|
8
|
+
* {@link from} throws on a leading, trailing, or doubled slash rather than collapsing it, and on
|
|
9
|
+
* a lone surrogate, which has no UTF-8 bytes of its own.
|
|
10
|
+
* A `\` escapes the `\` or `/` after it, which is how a moq-transport namespace field holding
|
|
11
|
+
* either one is spelled, and any other `\` is refused. An escaped `/` never splits a segment:
|
|
12
|
+
* `a\/b` is one segment, and a prefix never ends inside it.
|
|
13
|
+
* {@link parts} is the one walk every segment reading goes through. Until the previous release
|
|
14
|
+
* is gone, an escaped `/` still counts against {@link MAX_PARTS}, and one beside a bare `/` or at
|
|
15
|
+
* the end is refused, since that release splits at every `/`.
|
|
16
|
+
* The empty path is the root, which prefixes every path; a prefix needs no trailing slash.
|
|
17
|
+
* A path names a point in the origin's tree from its root. The same type names an exact
|
|
18
|
+
* broadcast and the prefix a route or announcement covers, so a broadcast's own path is
|
|
19
|
+
* the prefix it announces. See {@link Relative} for `..`-style references.
|
|
20
|
+
*
|
|
21
|
+
* {@link Prefix} and {@link Prefixes} name grants and scopes: each prefix covers its whole subtree.
|
|
16
22
|
*
|
|
17
23
|
* @example
|
|
18
24
|
* ```typescript
|
|
19
|
-
* //
|
|
20
|
-
* const
|
|
21
|
-
*
|
|
22
|
-
* console.log(path1 === path2); // true
|
|
25
|
+
* // Multiple arguments are joined with "/", and an empty one is the root
|
|
26
|
+
* const path = Path.from("api", "", "v1/users");
|
|
27
|
+
* console.log(path); // "api/v1/users"
|
|
23
28
|
*
|
|
24
|
-
* //
|
|
25
|
-
*
|
|
26
|
-
* console.log(path3); // "api/v1/users"
|
|
29
|
+
* // A slash at a boundary or a doubled one is an empty segment
|
|
30
|
+
* Path.from("/api/v1"); // throws
|
|
27
31
|
*
|
|
28
32
|
* // Safe prefix matching
|
|
29
33
|
* const base = Path.from("api/v1");
|
|
@@ -33,7 +37,9 @@
|
|
|
33
37
|
* const joined = Path.join(base, Path.from("users"));
|
|
34
38
|
* console.log(joined); // "api/v1/users"
|
|
35
39
|
* ```
|
|
40
|
+
* @module
|
|
36
41
|
*/
|
|
42
|
+
/** A broadcast path: non-empty segments separated by `/`, or the empty root. */
|
|
37
43
|
export type Valid = string & {
|
|
38
44
|
__brand: "Name";
|
|
39
45
|
};
|
|
@@ -48,29 +54,20 @@ export type Relative = string & {
|
|
|
48
54
|
__brand: "Relative";
|
|
49
55
|
};
|
|
50
56
|
/**
|
|
51
|
-
*
|
|
57
|
+
* Build a path by joining components with "/", where an empty component is the root.
|
|
52
58
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
59
|
+
* Throws when a component has a leading, trailing, or doubled `/`, a `\` before anything
|
|
60
|
+
* but `\` or `/`, or a lone surrogate, or when the path is longer than 4096 bytes or
|
|
61
|
+
* deeper than 32 parts.
|
|
55
62
|
*/
|
|
56
|
-
export declare const MAX_PARTS = 32;
|
|
57
|
-
/** Build a path from one or more components, joining with "/" and trimming redundant slashes. */
|
|
58
63
|
export declare function from(...paths: string[]): Valid;
|
|
59
|
-
/** Split a path into its slash-separated parts. The empty path has no parts. */
|
|
60
|
-
export declare function parts(path: Valid): string[];
|
|
61
64
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* Throws when the path has too many parts; use at wire decode sites.
|
|
65
|
+
* Split a path into its segments, only at a `/` no `\` escapes, each still escaped as written.
|
|
66
|
+
* The empty path has no parts. See {@link unescape} for a segment's content.
|
|
65
67
|
*/
|
|
66
|
-
export declare function
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* Throws when the path has too many parts; use at wire encode sites so we never
|
|
71
|
-
* emit a path the remote side is required to reject.
|
|
72
|
-
*/
|
|
73
|
-
export declare function encode(path: Valid): Valid;
|
|
68
|
+
export declare function parts(path: Valid): string[];
|
|
69
|
+
/** The first `n` segments of `path`, or `undefined` if it has fewer. */
|
|
70
|
+
export declare function head(path: Valid, n: number): Valid | undefined;
|
|
74
71
|
/**
|
|
75
72
|
* Check if a path has the given prefix, respecting path boundaries.
|
|
76
73
|
*
|
|
@@ -84,7 +81,6 @@ export declare function encode(path: Valid): Valid;
|
|
|
84
81
|
* ```typescript
|
|
85
82
|
* const path = Path.from("foo/bar");
|
|
86
83
|
* console.log(Path.hasPrefix(Path.from("foo"), path)); // true
|
|
87
|
-
* console.log(Path.hasPrefix(Path.from("foo/"), path)); // true (trailing slash ignored)
|
|
88
84
|
* console.log(Path.hasPrefix(Path.from("fo"), path)); // false
|
|
89
85
|
*
|
|
90
86
|
* const path2 = Path.from("foobar");
|
|
@@ -103,16 +99,14 @@ export declare function hasPrefix(prefix: Valid, path: Valid): boolean;
|
|
|
103
99
|
* const suffix = Path.stripPrefix(Path.from("foo"), path);
|
|
104
100
|
* console.log(suffix); // "bar/baz"
|
|
105
101
|
*
|
|
106
|
-
* const suffix2 = Path.stripPrefix(Path.from("foo/"), path);
|
|
107
|
-
* console.log(suffix2); // "bar/baz"
|
|
108
|
-
*
|
|
109
102
|
* const noMatch = Path.stripPrefix(Path.from("notfound"), path);
|
|
110
103
|
* console.log(noMatch); // null
|
|
111
104
|
* ```
|
|
112
105
|
*/
|
|
113
106
|
export declare function stripPrefix(prefix: Valid, path: Valid): Valid | null;
|
|
114
107
|
/**
|
|
115
|
-
* Join two path components together
|
|
108
|
+
* Join two path components together, throwing when the result is longer than 4096 bytes
|
|
109
|
+
* or deeper than 32 parts.
|
|
116
110
|
*
|
|
117
111
|
* @example
|
|
118
112
|
* ```typescript
|
|
@@ -122,17 +116,20 @@ export declare function stripPrefix(prefix: Valid, path: Valid): Valid | null;
|
|
|
122
116
|
* ```
|
|
123
117
|
*/
|
|
124
118
|
export declare function join(path: Valid, other: Valid): Valid;
|
|
119
|
+
/** Like {@link join}, but `undefined` when the result is too long or too deep rather than a throw. */
|
|
120
|
+
export declare function tryJoin(path: Valid, other: Valid): Valid | undefined;
|
|
125
121
|
/** The empty path, which is a prefix of every path. */
|
|
126
122
|
export declare function empty(): Valid;
|
|
127
123
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* `..` is preserved and only interpreted
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* byte-for-byte on the stored
|
|
135
|
-
*
|
|
124
|
+
* Parse a relative path reference and drop its redundant `.` segments. It is spelled like
|
|
125
|
+
* a path, so this throws on a leading, trailing, or doubled `/` or a lone `\` rather than
|
|
126
|
+
* collapsing it, and an escaped `/` never splits a segment. A reference made only of `.` segments normalizes to `.` because it names
|
|
127
|
+
* the base's parent, while empty names the base. `..` is preserved and only interpreted
|
|
128
|
+
* by {@link resolve}.
|
|
129
|
+
*
|
|
130
|
+
* Mirrors the Rust `path::Relative::new`, so JS and Rust agree byte-for-byte on the stored
|
|
131
|
+
* form. Two callers comparing normalized strings can detect equivalent references while
|
|
132
|
+
* preserving the distinction between `""` and `"."`.
|
|
136
133
|
*/
|
|
137
134
|
export declare function normalizeRelative(rel: string): Relative;
|
|
138
135
|
/**
|
|
@@ -140,9 +137,11 @@ export declare function normalizeRelative(rel: string): Relative;
|
|
|
140
137
|
*
|
|
141
138
|
* A non-empty reference replaces the last segment of the base, matching relative URL
|
|
142
139
|
* resolution. `..` segments then pop another segment; other segments are appended.
|
|
143
|
-
* `.`
|
|
140
|
+
* `.` segments are no-ops. Excess `..` once the base is empty is also a no-op
|
|
144
141
|
* (subsequent named segments still append). An empty `rel` returns the base unchanged.
|
|
145
142
|
*
|
|
143
|
+
* Throws when the result is longer than 4096 bytes or deeper than 32 parts.
|
|
144
|
+
*
|
|
146
145
|
* Mirrors the Rust `Path::resolve`, used by hang catalogs to express
|
|
147
146
|
* cross-broadcast track references (a rendition's `broadcast` field).
|
|
148
147
|
*
|
|
@@ -155,7 +154,8 @@ export declare function normalizeRelative(rel: string): Relative;
|
|
|
155
154
|
*/
|
|
156
155
|
export declare function resolve(base: Valid, rel: Relative): Valid;
|
|
157
156
|
/**
|
|
158
|
-
* Resolve a relative path, returning `undefined` if it escapes above the root
|
|
157
|
+
* Resolve a relative path, returning `undefined` if it escapes above the root or
|
|
158
|
+
* {@link resolve} would throw.
|
|
159
159
|
*
|
|
160
160
|
* Unlike {@link resolve}, this distinguishes a valid reference to the empty root
|
|
161
161
|
* path from excess `..` segments. Use it for untrusted catalog references that
|
|
@@ -191,6 +191,6 @@ export declare function tryResolve(base: Valid, rel: Relative): Valid | undefine
|
|
|
191
191
|
* ```
|
|
192
192
|
*/
|
|
193
193
|
export declare function relative(target: Valid, base: Valid): Relative | undefined;
|
|
194
|
-
/**
|
|
195
|
-
export {
|
|
194
|
+
/** Grant prefixes and a segment's escaping. */
|
|
195
|
+
export { escape, InvalidPrefix, Prefix, Prefixes, unescape } from "./prefix.ts";
|
|
196
196
|
//# sourceMappingURL=path.d.ts.map
|
package/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAIH,gFAAgF;AAChF,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,CAAC;AAwBxD;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAM9C;AAiDD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,EAAE,CAE3C;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAG9D;AAiDD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAgB7D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAiBpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAKrD;AAED,sGAAsG;AACtG,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAKpE;AAED,uDAAuD;AACvD,wBAAgB,KAAK,IAAI,KAAK,CAE7B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAWvD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,CAmBzD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,GAAG,SAAS,CAmBxE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CA0BzE;AAED,+CAA+C;AAC/C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
package/path.js
CHANGED
|
@@ -1,44 +1,181 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A broadcast path that provides safe prefix matching operations.
|
|
3
|
+
*
|
|
4
|
+
* This module provides path-aware operations that respect delimiter boundaries,
|
|
5
|
+
* preventing issues like "foo" matching "foobar".
|
|
6
|
+
*
|
|
7
|
+
* A path is a run of non-empty segments separated by `/`, so it has exactly one spelling:
|
|
8
|
+
* {@link from} throws on a leading, trailing, or doubled slash rather than collapsing it, and on
|
|
9
|
+
* a lone surrogate, which has no UTF-8 bytes of its own.
|
|
10
|
+
* A `\` escapes the `\` or `/` after it, which is how a moq-transport namespace field holding
|
|
11
|
+
* either one is spelled, and any other `\` is refused. An escaped `/` never splits a segment:
|
|
12
|
+
* `a\/b` is one segment, and a prefix never ends inside it.
|
|
13
|
+
* {@link parts} is the one walk every segment reading goes through. Until the previous release
|
|
14
|
+
* is gone, an escaped `/` still counts against {@link MAX_PARTS}, and one beside a bare `/` or at
|
|
15
|
+
* the end is refused, since that release splits at every `/`.
|
|
16
|
+
* The empty path is the root, which prefixes every path; a prefix needs no trailing slash.
|
|
17
|
+
* A path names a point in the origin's tree from its root. The same type names an exact
|
|
18
|
+
* broadcast and the prefix a route or announcement covers, so a broadcast's own path is
|
|
19
|
+
* the prefix it announces. See {@link Relative} for `..`-style references.
|
|
20
|
+
*
|
|
21
|
+
* {@link Prefix} and {@link Prefixes} name grants and scopes: each prefix covers its whole subtree.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Multiple arguments are joined with "/", and an empty one is the root
|
|
26
|
+
* const path = Path.from("api", "", "v1/users");
|
|
27
|
+
* console.log(path); // "api/v1/users"
|
|
28
|
+
*
|
|
29
|
+
* // A slash at a boundary or a doubled one is an empty segment
|
|
30
|
+
* Path.from("/api/v1"); // throws
|
|
31
|
+
*
|
|
32
|
+
* // Safe prefix matching
|
|
33
|
+
* const base = Path.from("api/v1");
|
|
34
|
+
* console.log(Path.hasPrefix(Path.from("api"), base)); // true
|
|
35
|
+
* console.log(Path.hasPrefix(Path.from("api/v1"), base)); // true
|
|
36
|
+
*
|
|
37
|
+
* const joined = Path.join(base, Path.from("users"));
|
|
38
|
+
* console.log(joined); // "api/v1/users"
|
|
39
|
+
* ```
|
|
40
|
+
* @module
|
|
41
|
+
*/
|
|
42
|
+
import { parts as split } from "./prefix.js";
|
|
43
|
+
/**
|
|
44
|
+
* Maximum number of segments in a path.
|
|
3
45
|
*
|
|
4
46
|
* Matches the IETF moq-transport limit of 32 fields in a namespace tuple.
|
|
5
47
|
* moq-lite enforces the same bound when decoding paths off the wire.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
6
50
|
*/
|
|
7
51
|
export const MAX_PARTS = 32;
|
|
8
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Maximum UTF-8 length of a path in bytes.
|
|
54
|
+
*
|
|
55
|
+
* Matches the IETF moq-transport limit of 4096 bytes for a namespace. Its tuple fields
|
|
56
|
+
* drop the path's separators and escapes, so every path fits both wires.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export const MAX_BYTES = 4096;
|
|
61
|
+
const utf8 = new TextEncoder();
|
|
62
|
+
/**
|
|
63
|
+
* Build a path by joining components with "/", where an empty component is the root.
|
|
64
|
+
*
|
|
65
|
+
* Throws when a component has a leading, trailing, or doubled `/`, a `\` before anything
|
|
66
|
+
* but `\` or `/`, or a lone surrogate, or when the path is longer than 4096 bytes or
|
|
67
|
+
* deeper than 32 parts.
|
|
68
|
+
*/
|
|
9
69
|
export function from(...paths) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
70
|
+
for (const path of paths) {
|
|
71
|
+
const error = longer(path) ?? spelling(path);
|
|
72
|
+
if (error)
|
|
73
|
+
throw new Error(error);
|
|
74
|
+
}
|
|
75
|
+
return bounded(paths.filter((path) => path !== "").join("/"));
|
|
76
|
+
}
|
|
77
|
+
// Why `path` passes `MAX_BYTES`, or undefined when it fits.
|
|
78
|
+
function longer(path) {
|
|
79
|
+
// A UTF-16 unit is at most 3 UTF-8 bytes, so only a long path needs encoding to measure.
|
|
80
|
+
if (path.length > MAX_BYTES / 3 && utf8.encode(path).length > MAX_BYTES) {
|
|
81
|
+
return `path exceeds ${MAX_BYTES} bytes`;
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
// Why the resolved `path` breaks the bounds every path keeps, or undefined when it fits. A
|
|
86
|
+
// `Relative`'s `..` steps can pass `MAX_PARTS` between two valid paths, so it is exempt.
|
|
87
|
+
function bounds(path) {
|
|
88
|
+
return (longer(path) ?? (path !== "" && split(path).length > MAX_PARTS ? `path exceeds ${MAX_PARTS} parts` : undefined));
|
|
13
89
|
}
|
|
14
|
-
|
|
90
|
+
// `path`, already spelled validly, as a `Valid` once it fits the bounds.
|
|
91
|
+
function bounded(path) {
|
|
92
|
+
const error = bounds(path);
|
|
93
|
+
if (error)
|
|
94
|
+
throw new Error(error);
|
|
95
|
+
return path;
|
|
96
|
+
}
|
|
97
|
+
// Why `path` is not the one spelling of a path, or undefined when it is.
|
|
98
|
+
function spelling(path) {
|
|
99
|
+
// UTF-8 cannot carry a lone surrogate: the encoder writes U+FFFD, another path's bytes.
|
|
100
|
+
if (!path.isWellFormed())
|
|
101
|
+
return "path contains a lone surrogate";
|
|
102
|
+
if (!path.includes("\\")) {
|
|
103
|
+
// Without a `\`, every `/` separates.
|
|
104
|
+
return path.startsWith("/") || path.endsWith("/") || path.includes("//")
|
|
105
|
+
? "path contains an empty segment"
|
|
106
|
+
: undefined;
|
|
107
|
+
}
|
|
108
|
+
// Pairs of `\` are escaped backslashes, so any `\` left must escape a `/`.
|
|
109
|
+
if (/\\(?!\/)/.test(path.replaceAll("\\\\", ""))) {
|
|
110
|
+
return "path contains a `\\` that escapes neither `\\` nor `/`";
|
|
111
|
+
}
|
|
112
|
+
// TEMPORARY MIGRATION, delete at the next version cut: the previous release splits at every
|
|
113
|
+
// `/`, escaped or not, and trims and collapses the empty segments that leaves, so it would
|
|
114
|
+
// re-spell `a\//b` as `a\/b`, another broadcast's path. Refuse what it would re-spell.
|
|
115
|
+
if (path.endsWith("/") || path.includes("//"))
|
|
116
|
+
return "path contains an empty segment";
|
|
117
|
+
// An escaped `/` is content, so only a bare one can leave a segment empty.
|
|
118
|
+
if (split(path).includes(""))
|
|
119
|
+
return "path contains an empty segment";
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Split a path into its segments, only at a `/` no `\` escapes, each still escaped as written.
|
|
124
|
+
* The empty path has no parts. See {@link unescape} for a segment's content.
|
|
125
|
+
*/
|
|
15
126
|
export function parts(path) {
|
|
16
|
-
return
|
|
127
|
+
return split(path);
|
|
128
|
+
}
|
|
129
|
+
/** The first `n` segments of `path`, or `undefined` if it has fewer. */
|
|
130
|
+
export function head(path, n) {
|
|
131
|
+
const segments = parts(path);
|
|
132
|
+
return n <= segments.length ? segments.slice(0, n).join("/") : undefined;
|
|
17
133
|
}
|
|
18
134
|
/**
|
|
19
|
-
* Validate an untrusted wire string as a path, enforcing {@link MAX_PARTS}.
|
|
135
|
+
* Validate an untrusted wire string as a path, enforcing {@link MAX_PARTS} and a 4096 byte limit.
|
|
136
|
+
*
|
|
137
|
+
* Throws when the path has an empty segment or is too deep or too long; use at wire decode sites.
|
|
20
138
|
*
|
|
21
|
-
*
|
|
139
|
+
* @internal
|
|
22
140
|
*/
|
|
23
141
|
export function decode(raw) {
|
|
24
|
-
|
|
25
|
-
|
|
142
|
+
// The limits first, so a hostile path is refused before its spelling is split.
|
|
143
|
+
encode(raw);
|
|
144
|
+
return from(raw);
|
|
145
|
+
}
|
|
146
|
+
/** Like {@link decode}, but `undefined` for an invalid path rather than a throw. @internal */
|
|
147
|
+
export function tryDecode(raw) {
|
|
148
|
+
const path = raw;
|
|
149
|
+
if (check(path) !== undefined)
|
|
150
|
+
return undefined;
|
|
151
|
+
return spelling(raw) === undefined ? path : undefined;
|
|
26
152
|
}
|
|
27
153
|
/**
|
|
28
|
-
* Validate a path before writing it to the wire, enforcing {@link MAX_PARTS}.
|
|
154
|
+
* Validate a path before writing it to the wire, enforcing {@link MAX_PARTS} and a 4096 byte limit.
|
|
29
155
|
*
|
|
30
|
-
* Throws when the path
|
|
156
|
+
* Throws when the path is too deep or too long; use at wire encode sites so we never
|
|
31
157
|
* emit a path the remote side is required to reject.
|
|
158
|
+
*
|
|
159
|
+
* @internal
|
|
32
160
|
*/
|
|
33
161
|
export function encode(path) {
|
|
162
|
+
const error = check(path);
|
|
163
|
+
if (error)
|
|
164
|
+
throw new Error(error);
|
|
165
|
+
return path;
|
|
166
|
+
}
|
|
167
|
+
/** Why `path` breaks the wire limits, or undefined when it fits. @internal */
|
|
168
|
+
export function check(path) {
|
|
169
|
+
// TEMPORARY MIGRATION, delete at the next version cut and count `parts` instead: the previous
|
|
170
|
+
// release splits at every `/`, escaped or not, and ends the whole announce stream on a path
|
|
171
|
+
// past 32 parts by that count, so until it is gone the limit counts every `/`.
|
|
34
172
|
// Count separators with an early exit instead of splitting, so a hostile path never allocates per part.
|
|
35
173
|
let count = path === "" ? 0 : 1;
|
|
36
174
|
for (let i = path.indexOf("/"); i !== -1; i = path.indexOf("/", i + 1)) {
|
|
37
|
-
if (++count > MAX_PARTS)
|
|
38
|
-
|
|
39
|
-
}
|
|
175
|
+
if (++count > MAX_PARTS)
|
|
176
|
+
return `path exceeds ${MAX_PARTS} parts`;
|
|
40
177
|
}
|
|
41
|
-
return path;
|
|
178
|
+
return longer(path);
|
|
42
179
|
}
|
|
43
180
|
/**
|
|
44
181
|
* Check if a path has the given prefix, respecting path boundaries.
|
|
@@ -53,7 +190,6 @@ export function encode(path) {
|
|
|
53
190
|
* ```typescript
|
|
54
191
|
* const path = Path.from("foo/bar");
|
|
55
192
|
* console.log(Path.hasPrefix(Path.from("foo"), path)); // true
|
|
56
|
-
* console.log(Path.hasPrefix(Path.from("foo/"), path)); // true (trailing slash ignored)
|
|
57
193
|
* console.log(Path.hasPrefix(Path.from("fo"), path)); // false
|
|
58
194
|
*
|
|
59
195
|
* const path2 = Path.from("foobar");
|
|
@@ -85,9 +221,6 @@ export function hasPrefix(prefix, path) {
|
|
|
85
221
|
* const suffix = Path.stripPrefix(Path.from("foo"), path);
|
|
86
222
|
* console.log(suffix); // "bar/baz"
|
|
87
223
|
*
|
|
88
|
-
* const suffix2 = Path.stripPrefix(Path.from("foo/"), path);
|
|
89
|
-
* console.log(suffix2); // "bar/baz"
|
|
90
|
-
*
|
|
91
224
|
* const noMatch = Path.stripPrefix(Path.from("notfound"), path);
|
|
92
225
|
* console.log(noMatch); // null
|
|
93
226
|
* ```
|
|
@@ -108,7 +241,8 @@ export function stripPrefix(prefix, path) {
|
|
|
108
241
|
return path.slice(prefix.length + 1);
|
|
109
242
|
}
|
|
110
243
|
/**
|
|
111
|
-
* Join two path components together
|
|
244
|
+
* Join two path components together, throwing when the result is longer than 4096 bytes
|
|
245
|
+
* or deeper than 32 parts.
|
|
112
246
|
*
|
|
113
247
|
* @example
|
|
114
248
|
* ```typescript
|
|
@@ -118,44 +252,60 @@ export function stripPrefix(prefix, path) {
|
|
|
118
252
|
* ```
|
|
119
253
|
*/
|
|
120
254
|
export function join(path, other) {
|
|
121
|
-
if (path === "")
|
|
255
|
+
if (path === "")
|
|
122
256
|
return other;
|
|
123
|
-
|
|
124
|
-
else if (other === "") {
|
|
257
|
+
if (other === "")
|
|
125
258
|
return path;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
259
|
+
// Neither side has a boundary slash, so exactly one joins them.
|
|
260
|
+
return bounded(`${path}/${other}`);
|
|
261
|
+
}
|
|
262
|
+
/** Like {@link join}, but `undefined` when the result is too long or too deep rather than a throw. */
|
|
263
|
+
export function tryJoin(path, other) {
|
|
264
|
+
if (path === "")
|
|
265
|
+
return other;
|
|
266
|
+
if (other === "")
|
|
267
|
+
return path;
|
|
268
|
+
const joined = `${path}/${other}`;
|
|
269
|
+
return bounds(joined) === undefined ? joined : undefined;
|
|
131
270
|
}
|
|
132
271
|
/** The empty path, which is a prefix of every path. */
|
|
133
272
|
export function empty() {
|
|
134
273
|
return "";
|
|
135
274
|
}
|
|
136
275
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* `..` is preserved and only interpreted
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* byte-for-byte on the stored
|
|
144
|
-
*
|
|
276
|
+
* Parse a relative path reference and drop its redundant `.` segments. It is spelled like
|
|
277
|
+
* a path, so this throws on a leading, trailing, or doubled `/` or a lone `\` rather than
|
|
278
|
+
* collapsing it, and an escaped `/` never splits a segment. A reference made only of `.` segments normalizes to `.` because it names
|
|
279
|
+
* the base's parent, while empty names the base. `..` is preserved and only interpreted
|
|
280
|
+
* by {@link resolve}.
|
|
281
|
+
*
|
|
282
|
+
* Mirrors the Rust `path::Relative::new`, so JS and Rust agree byte-for-byte on the stored
|
|
283
|
+
* form. Two callers comparing normalized strings can detect equivalent references while
|
|
284
|
+
* preserving the distinction between `""` and `"."`.
|
|
145
285
|
*/
|
|
146
286
|
export function normalizeRelative(rel) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
287
|
+
// Unbounded: `..` steps between two valid paths can pass the limits, and only the path a
|
|
288
|
+
// reference resolves to is held to them.
|
|
289
|
+
const error = spelling(rel);
|
|
290
|
+
if (error)
|
|
291
|
+
throw new Error(error);
|
|
292
|
+
const raw = split(rel);
|
|
293
|
+
if (!raw.includes("."))
|
|
294
|
+
return rel;
|
|
295
|
+
// Dropping whole segments leaves a valid path.
|
|
296
|
+
const normalized = raw.filter((s) => s !== ".").join("/");
|
|
297
|
+
return (normalized === "" ? "." : normalized);
|
|
150
298
|
}
|
|
151
299
|
/**
|
|
152
300
|
* Resolve a relative path reference against a base path.
|
|
153
301
|
*
|
|
154
302
|
* A non-empty reference replaces the last segment of the base, matching relative URL
|
|
155
303
|
* resolution. `..` segments then pop another segment; other segments are appended.
|
|
156
|
-
* `.`
|
|
304
|
+
* `.` segments are no-ops. Excess `..` once the base is empty is also a no-op
|
|
157
305
|
* (subsequent named segments still append). An empty `rel` returns the base unchanged.
|
|
158
306
|
*
|
|
307
|
+
* Throws when the result is longer than 4096 bytes or deeper than 32 parts.
|
|
308
|
+
*
|
|
159
309
|
* Mirrors the Rust `Path::resolve`, used by hang catalogs to express
|
|
160
310
|
* cross-broadcast track references (a rendition's `broadcast` field).
|
|
161
311
|
*
|
|
@@ -169,10 +319,10 @@ export function normalizeRelative(rel) {
|
|
|
169
319
|
export function resolve(base, rel) {
|
|
170
320
|
if (rel === "")
|
|
171
321
|
return base;
|
|
172
|
-
const segments = base
|
|
322
|
+
const segments = parts(base);
|
|
173
323
|
segments.pop();
|
|
174
|
-
for (const seg of rel
|
|
175
|
-
if (seg === "
|
|
324
|
+
for (const seg of parts(rel)) {
|
|
325
|
+
if (seg === ".") {
|
|
176
326
|
continue;
|
|
177
327
|
}
|
|
178
328
|
if (seg === "..") {
|
|
@@ -182,10 +332,12 @@ export function resolve(base, rel) {
|
|
|
182
332
|
segments.push(seg);
|
|
183
333
|
}
|
|
184
334
|
}
|
|
185
|
-
|
|
335
|
+
// Whole segments of valid paths rejoin into a validly spelled path, unless it is too long or deep.
|
|
336
|
+
return bounded(segments.join("/"));
|
|
186
337
|
}
|
|
187
338
|
/**
|
|
188
|
-
* Resolve a relative path, returning `undefined` if it escapes above the root
|
|
339
|
+
* Resolve a relative path, returning `undefined` if it escapes above the root or
|
|
340
|
+
* {@link resolve} would throw.
|
|
189
341
|
*
|
|
190
342
|
* Unlike {@link resolve}, this distinguishes a valid reference to the empty root
|
|
191
343
|
* path from excess `..` segments. Use it for untrusted catalog references that
|
|
@@ -194,10 +346,10 @@ export function resolve(base, rel) {
|
|
|
194
346
|
export function tryResolve(base, rel) {
|
|
195
347
|
if (rel === "")
|
|
196
348
|
return base;
|
|
197
|
-
const segments = base
|
|
349
|
+
const segments = parts(base);
|
|
198
350
|
segments.pop();
|
|
199
|
-
for (const seg of rel
|
|
200
|
-
if (seg === "
|
|
351
|
+
for (const seg of parts(rel)) {
|
|
352
|
+
if (seg === ".") {
|
|
201
353
|
continue;
|
|
202
354
|
}
|
|
203
355
|
if (seg === "..") {
|
|
@@ -208,7 +360,8 @@ export function tryResolve(base, rel) {
|
|
|
208
360
|
segments.push(seg);
|
|
209
361
|
}
|
|
210
362
|
}
|
|
211
|
-
|
|
363
|
+
const resolved = segments.join("/");
|
|
364
|
+
return bounds(resolved) === undefined ? resolved : undefined;
|
|
212
365
|
}
|
|
213
366
|
/**
|
|
214
367
|
* Express `target` relative to `base`: the inverse of {@link resolve}.
|
|
@@ -244,14 +397,14 @@ export function relative(target, base) {
|
|
|
244
397
|
if (target === base)
|
|
245
398
|
return "";
|
|
246
399
|
// Resolution replaces the base's last segment, so walk from its parent.
|
|
247
|
-
const dir = base
|
|
400
|
+
const dir = parts(base);
|
|
248
401
|
dir.pop();
|
|
249
|
-
const
|
|
402
|
+
const segments = parts(target);
|
|
250
403
|
let common = 0;
|
|
251
|
-
while (common < dir.length && common <
|
|
404
|
+
while (common < dir.length && common < segments.length && dir[common] === segments[common]) {
|
|
252
405
|
common += 1;
|
|
253
406
|
}
|
|
254
|
-
const down =
|
|
407
|
+
const down = segments.slice(common);
|
|
255
408
|
// Resolution would walk on these instead of naming them.
|
|
256
409
|
if (down.some((part) => part === "." || part === ".."))
|
|
257
410
|
return undefined;
|
|
@@ -261,6 +414,6 @@ export function relative(target, base) {
|
|
|
261
414
|
// An empty reference resolves to the base itself, so name the parent explicitly.
|
|
262
415
|
return (rel.length === 0 ? "." : rel.join("/"));
|
|
263
416
|
}
|
|
264
|
-
/**
|
|
265
|
-
export {
|
|
417
|
+
/** Grant prefixes and a segment's escaping. */
|
|
418
|
+
export { escape, InvalidPrefix, Prefix, Prefixes, unescape } from "./prefix.js";
|
|
266
419
|
//# sourceMappingURL=path.js.map
|