moqtail 0.10.1 → 0.12.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.
@@ -62,17 +62,37 @@ declare class KeyValuePair {
62
62
  static tryNewBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
63
63
  /**
64
64
  * Serializes this key-value pair to a frozen byte buffer.
65
+ * Equivalent to {@link KeyValuePair.serializeDelta} with `prevType = 0n`.
65
66
  * @returns The serialized buffer.
66
67
  */
67
68
  serialize(): FrozenByteBuffer;
69
+ /**
70
+ * Serializes this pair's wire form, encoding the Type as a delta from
71
+ * `prevType` (the type of the previous KVP in the same list, or 0n if this
72
+ * is the first entry).
73
+ * @param prevType - The type of the previous KVP in the same list.
74
+ * @throws ProtocolViolationError if this pair's type is less than prevType
75
+ * (Delta Type is an unsigned varint, so the list must be sorted ascending).
76
+ */
77
+ serializeDelta(prevType: bigint): FrozenByteBuffer;
68
78
  /**
69
79
  * Deserializes a KeyValuePair from a buffer.
80
+ * Equivalent to {@link KeyValuePair.deserializeDelta} with `prevType = 0n`.
70
81
  * @param buf - The buffer to read from.
71
82
  * @returns The deserialized KeyValuePair.
72
83
  * @throws LengthExceedsMaxError if blob length exceeds 65535 bytes.
73
84
  * @throws NotEnoughBytesError if buffer does not contain enough bytes.
74
85
  */
75
86
  static deserialize(buf: BaseByteBuffer): KeyValuePair;
87
+ /**
88
+ * Deserializes a wire-form KVP whose Type field is a delta from `prevType`
89
+ * (the type of the previous KVP in the same list, or 0n if this is the
90
+ * first entry).
91
+ * @param buf - The buffer to read from.
92
+ * @param prevType - The type of the previous KVP in the same list.
93
+ * @throws ProtocolViolationError if prevType + delta exceeds 2^64 - 1.
94
+ */
95
+ static deserializeDelta(buf: BaseByteBuffer, prevType: bigint): KeyValuePair;
76
96
  /**
77
97
  * Checks if this pair is equal to another.
78
98
  * @param other - The other KeyValuePair.
@@ -80,6 +100,20 @@ declare class KeyValuePair {
80
100
  */
81
101
  equals(other: KeyValuePair): boolean;
82
102
  }
103
+ /**
104
+ * Delta-encodes and serializes a list of Key-Value-Pairs to wire bytes.
105
+ * The list is sorted by ascending type first, since Delta Type is an
106
+ * unsigned varint and cannot represent a type decrease.
107
+ */
108
+ declare function serializeKvpList(items: KeyValuePair[]): FrozenByteBuffer;
109
+ /**
110
+ * Reads exactly `count` delta-encoded Key-Value-Pairs from `buf`.
111
+ */
112
+ declare function deserializeKvpList(buf: BaseByteBuffer, count: number | bigint): KeyValuePair[];
113
+ /**
114
+ * Reads delta-encoded Key-Value-Pairs from `buf` until it is exhausted.
115
+ */
116
+ declare function deserializeKvpListUntilEmpty(buf: BaseByteBuffer): KeyValuePair[];
83
117
  /**
84
118
  * Checks if the KeyValuePair is a varint pair (even typeValue).
85
119
  * @param pair - The KeyValuePair to check.
@@ -2721,4 +2755,4 @@ declare class SetupParameters {
2721
2755
  static fromKeyValuePairs(kvps: KeyValuePair[]): SetupParameter[];
2722
2756
  }
2723
2757
 
2724
- export { ObjectStatus as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, Datagram as D, EndOfRangeKind as E, Fetch as F, GoAway as G, Header as H, ImmutableExtensionsExtension as I, MAX_REASON_PHRASE_LEN as J, KeyValuePair as K, LOCHeaderExtensionId as L, MAX_FULL_TRACK_NAME_LENGTH as M, MaxAuthTokenCacheSize as N, MaxCacheDurationExtension as O, MaxRequestId$1 as P, MaxRequestId as Q, MessageParameter as R, MessageParameterType as S, MessageParameters as T, MoqtObject as U, Namespace as V, NamespaceDone as W, NamespaceSubscribeOptions as X, NewGroupRequest as Y, ObjectDatagramType as Z, ObjectForwardingPreference as _, AuthorizationToken as a, type Parameter as a0, Path as a1, Publish as a2, PublishDone as a3, PublishDoneStatusCode as a4, PublishNamespace as a5, PublishNamespaceCancel as a6, PublishNamespaceDone as a7, PublishOk as a8, ReasonPhrase as a9, UnknownTrackExtension as aA, Unsubscribe as aB, UnsubscribeNamespace as aC, applyMessageParameterUpdate as aD, controlMessageTypeFromBigInt as aE, fetchTypeFromBigInt as aF, filterTypeFromBigInt as aG, groupOrderFromNumber as aH, isBytes as aI, isVarInt as aJ, locHeaderExtensionIdFromNumber as aK, messageParameterTypeFromNumber as aL, publishDoneStatusCodeFromBigInt as aM, requestErrorCodeFromBigInt as aN, setupParameterTypeFromNumber as aO, tokenAliasTypeFromNumber as aP, trackStatusCodeFromBigInt as aQ, RequestError as aa, RequestErrorCode as ab, RequestIdMap as ac, RequestOk as ad, RequestUpdate as ae, RequestsBlocked as af, SUPPORTED_VERSIONS as ag, ServerSetup as ah, SetupParameter as ai, SetupParameterType as aj, SetupParameters as ak, SubgroupHeader as al, SubgroupHeaderType as am, SubgroupObject as an, Subscribe as ao, SubscribeNamespace as ap, SubscribeOk as aq, SubscriberPriority as ar, SubscriptionFilter as as, TokenAliasType as at, TrackExtension as au, TrackExtensionType as av, TrackStatus as aw, TrackStatusCode as ax, Tuple as ay, TupleField as az, ByteBuffer as b, ControlMessage as c, ControlMessageType as d, DefaultPublisherGroupOrderExtension as e, DefaultPublisherPriorityExtension as f, DeliveryTimeout as g, DeliveryTimeoutExtension as h, DynamicGroupsExtension as i, Expires as j, FetchCancel as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, type FetchObjectContext as o, FetchOk as p, FetchType as q, FilterType as r, Forward as s, FrozenByteBuffer as t, FullTrackName as u, GroupOrder as v, GroupOrderParam as w, LargestObject as x, Location as y, MAX_NAMESPACE_TUPLE_COUNT as z };
2758
+ export { ObjectStatus as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, Datagram as D, EndOfRangeKind as E, Fetch as F, GoAway as G, Header as H, ImmutableExtensionsExtension as I, MAX_REASON_PHRASE_LEN as J, KeyValuePair as K, LOCHeaderExtensionId as L, MAX_FULL_TRACK_NAME_LENGTH as M, MaxAuthTokenCacheSize as N, MaxCacheDurationExtension as O, MaxRequestId$1 as P, MaxRequestId as Q, MessageParameter as R, MessageParameterType as S, MessageParameters as T, MoqtObject as U, Namespace as V, NamespaceDone as W, NamespaceSubscribeOptions as X, NewGroupRequest as Y, ObjectDatagramType as Z, ObjectForwardingPreference as _, AuthorizationToken as a, type Parameter as a0, Path as a1, Publish as a2, PublishDone as a3, PublishDoneStatusCode as a4, PublishNamespace as a5, PublishNamespaceCancel as a6, PublishNamespaceDone as a7, PublishOk as a8, ReasonPhrase as a9, UnknownTrackExtension as aA, Unsubscribe as aB, UnsubscribeNamespace as aC, applyMessageParameterUpdate as aD, controlMessageTypeFromBigInt as aE, deserializeKvpList as aF, deserializeKvpListUntilEmpty as aG, fetchTypeFromBigInt as aH, filterTypeFromBigInt as aI, groupOrderFromNumber as aJ, isBytes as aK, isVarInt as aL, locHeaderExtensionIdFromNumber as aM, messageParameterTypeFromNumber as aN, publishDoneStatusCodeFromBigInt as aO, requestErrorCodeFromBigInt as aP, serializeKvpList as aQ, setupParameterTypeFromNumber as aR, tokenAliasTypeFromNumber as aS, trackStatusCodeFromBigInt as aT, RequestError as aa, RequestErrorCode as ab, RequestIdMap as ac, RequestOk as ad, RequestUpdate as ae, RequestsBlocked as af, SUPPORTED_VERSIONS as ag, ServerSetup as ah, SetupParameter as ai, SetupParameterType as aj, SetupParameters as ak, SubgroupHeader as al, SubgroupHeaderType as am, SubgroupObject as an, Subscribe as ao, SubscribeNamespace as ap, SubscribeOk as aq, SubscriberPriority as ar, SubscriptionFilter as as, TokenAliasType as at, TrackExtension as au, TrackExtensionType as av, TrackStatus as aw, TrackStatusCode as ax, Tuple as ay, TupleField as az, ByteBuffer as b, ControlMessage as c, ControlMessageType as d, DefaultPublisherGroupOrderExtension as e, DefaultPublisherPriorityExtension as f, DeliveryTimeout as g, DeliveryTimeoutExtension as h, DynamicGroupsExtension as i, Expires as j, FetchCancel as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, type FetchObjectContext as o, FetchOk as p, FetchType as q, FilterType as r, Forward as s, FrozenByteBuffer as t, FullTrackName as u, GroupOrder as v, GroupOrderParam as w, LargestObject as x, Location as y, MAX_NAMESPACE_TUPLE_COUNT as z };
@@ -62,17 +62,37 @@ declare class KeyValuePair {
62
62
  static tryNewBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
63
63
  /**
64
64
  * Serializes this key-value pair to a frozen byte buffer.
65
+ * Equivalent to {@link KeyValuePair.serializeDelta} with `prevType = 0n`.
65
66
  * @returns The serialized buffer.
66
67
  */
67
68
  serialize(): FrozenByteBuffer;
69
+ /**
70
+ * Serializes this pair's wire form, encoding the Type as a delta from
71
+ * `prevType` (the type of the previous KVP in the same list, or 0n if this
72
+ * is the first entry).
73
+ * @param prevType - The type of the previous KVP in the same list.
74
+ * @throws ProtocolViolationError if this pair's type is less than prevType
75
+ * (Delta Type is an unsigned varint, so the list must be sorted ascending).
76
+ */
77
+ serializeDelta(prevType: bigint): FrozenByteBuffer;
68
78
  /**
69
79
  * Deserializes a KeyValuePair from a buffer.
80
+ * Equivalent to {@link KeyValuePair.deserializeDelta} with `prevType = 0n`.
70
81
  * @param buf - The buffer to read from.
71
82
  * @returns The deserialized KeyValuePair.
72
83
  * @throws LengthExceedsMaxError if blob length exceeds 65535 bytes.
73
84
  * @throws NotEnoughBytesError if buffer does not contain enough bytes.
74
85
  */
75
86
  static deserialize(buf: BaseByteBuffer): KeyValuePair;
87
+ /**
88
+ * Deserializes a wire-form KVP whose Type field is a delta from `prevType`
89
+ * (the type of the previous KVP in the same list, or 0n if this is the
90
+ * first entry).
91
+ * @param buf - The buffer to read from.
92
+ * @param prevType - The type of the previous KVP in the same list.
93
+ * @throws ProtocolViolationError if prevType + delta exceeds 2^64 - 1.
94
+ */
95
+ static deserializeDelta(buf: BaseByteBuffer, prevType: bigint): KeyValuePair;
76
96
  /**
77
97
  * Checks if this pair is equal to another.
78
98
  * @param other - The other KeyValuePair.
@@ -80,6 +100,20 @@ declare class KeyValuePair {
80
100
  */
81
101
  equals(other: KeyValuePair): boolean;
82
102
  }
103
+ /**
104
+ * Delta-encodes and serializes a list of Key-Value-Pairs to wire bytes.
105
+ * The list is sorted by ascending type first, since Delta Type is an
106
+ * unsigned varint and cannot represent a type decrease.
107
+ */
108
+ declare function serializeKvpList(items: KeyValuePair[]): FrozenByteBuffer;
109
+ /**
110
+ * Reads exactly `count` delta-encoded Key-Value-Pairs from `buf`.
111
+ */
112
+ declare function deserializeKvpList(buf: BaseByteBuffer, count: number | bigint): KeyValuePair[];
113
+ /**
114
+ * Reads delta-encoded Key-Value-Pairs from `buf` until it is exhausted.
115
+ */
116
+ declare function deserializeKvpListUntilEmpty(buf: BaseByteBuffer): KeyValuePair[];
83
117
  /**
84
118
  * Checks if the KeyValuePair is a varint pair (even typeValue).
85
119
  * @param pair - The KeyValuePair to check.
@@ -2721,4 +2755,4 @@ declare class SetupParameters {
2721
2755
  static fromKeyValuePairs(kvps: KeyValuePair[]): SetupParameter[];
2722
2756
  }
2723
2757
 
2724
- export { ObjectStatus as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, Datagram as D, EndOfRangeKind as E, Fetch as F, GoAway as G, Header as H, ImmutableExtensionsExtension as I, MAX_REASON_PHRASE_LEN as J, KeyValuePair as K, LOCHeaderExtensionId as L, MAX_FULL_TRACK_NAME_LENGTH as M, MaxAuthTokenCacheSize as N, MaxCacheDurationExtension as O, MaxRequestId$1 as P, MaxRequestId as Q, MessageParameter as R, MessageParameterType as S, MessageParameters as T, MoqtObject as U, Namespace as V, NamespaceDone as W, NamespaceSubscribeOptions as X, NewGroupRequest as Y, ObjectDatagramType as Z, ObjectForwardingPreference as _, AuthorizationToken as a, type Parameter as a0, Path as a1, Publish as a2, PublishDone as a3, PublishDoneStatusCode as a4, PublishNamespace as a5, PublishNamespaceCancel as a6, PublishNamespaceDone as a7, PublishOk as a8, ReasonPhrase as a9, UnknownTrackExtension as aA, Unsubscribe as aB, UnsubscribeNamespace as aC, applyMessageParameterUpdate as aD, controlMessageTypeFromBigInt as aE, fetchTypeFromBigInt as aF, filterTypeFromBigInt as aG, groupOrderFromNumber as aH, isBytes as aI, isVarInt as aJ, locHeaderExtensionIdFromNumber as aK, messageParameterTypeFromNumber as aL, publishDoneStatusCodeFromBigInt as aM, requestErrorCodeFromBigInt as aN, setupParameterTypeFromNumber as aO, tokenAliasTypeFromNumber as aP, trackStatusCodeFromBigInt as aQ, RequestError as aa, RequestErrorCode as ab, RequestIdMap as ac, RequestOk as ad, RequestUpdate as ae, RequestsBlocked as af, SUPPORTED_VERSIONS as ag, ServerSetup as ah, SetupParameter as ai, SetupParameterType as aj, SetupParameters as ak, SubgroupHeader as al, SubgroupHeaderType as am, SubgroupObject as an, Subscribe as ao, SubscribeNamespace as ap, SubscribeOk as aq, SubscriberPriority as ar, SubscriptionFilter as as, TokenAliasType as at, TrackExtension as au, TrackExtensionType as av, TrackStatus as aw, TrackStatusCode as ax, Tuple as ay, TupleField as az, ByteBuffer as b, ControlMessage as c, ControlMessageType as d, DefaultPublisherGroupOrderExtension as e, DefaultPublisherPriorityExtension as f, DeliveryTimeout as g, DeliveryTimeoutExtension as h, DynamicGroupsExtension as i, Expires as j, FetchCancel as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, type FetchObjectContext as o, FetchOk as p, FetchType as q, FilterType as r, Forward as s, FrozenByteBuffer as t, FullTrackName as u, GroupOrder as v, GroupOrderParam as w, LargestObject as x, Location as y, MAX_NAMESPACE_TUPLE_COUNT as z };
2758
+ export { ObjectStatus as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, Datagram as D, EndOfRangeKind as E, Fetch as F, GoAway as G, Header as H, ImmutableExtensionsExtension as I, MAX_REASON_PHRASE_LEN as J, KeyValuePair as K, LOCHeaderExtensionId as L, MAX_FULL_TRACK_NAME_LENGTH as M, MaxAuthTokenCacheSize as N, MaxCacheDurationExtension as O, MaxRequestId$1 as P, MaxRequestId as Q, MessageParameter as R, MessageParameterType as S, MessageParameters as T, MoqtObject as U, Namespace as V, NamespaceDone as W, NamespaceSubscribeOptions as X, NewGroupRequest as Y, ObjectDatagramType as Z, ObjectForwardingPreference as _, AuthorizationToken as a, type Parameter as a0, Path as a1, Publish as a2, PublishDone as a3, PublishDoneStatusCode as a4, PublishNamespace as a5, PublishNamespaceCancel as a6, PublishNamespaceDone as a7, PublishOk as a8, ReasonPhrase as a9, UnknownTrackExtension as aA, Unsubscribe as aB, UnsubscribeNamespace as aC, applyMessageParameterUpdate as aD, controlMessageTypeFromBigInt as aE, deserializeKvpList as aF, deserializeKvpListUntilEmpty as aG, fetchTypeFromBigInt as aH, filterTypeFromBigInt as aI, groupOrderFromNumber as aJ, isBytes as aK, isVarInt as aL, locHeaderExtensionIdFromNumber as aM, messageParameterTypeFromNumber as aN, publishDoneStatusCodeFromBigInt as aO, requestErrorCodeFromBigInt as aP, serializeKvpList as aQ, setupParameterTypeFromNumber as aR, tokenAliasTypeFromNumber as aS, trackStatusCodeFromBigInt as aT, RequestError as aa, RequestErrorCode as ab, RequestIdMap as ac, RequestOk as ad, RequestUpdate as ae, RequestsBlocked as af, SUPPORTED_VERSIONS as ag, ServerSetup as ah, SetupParameter as ai, SetupParameterType as aj, SetupParameters as ak, SubgroupHeader as al, SubgroupHeaderType as am, SubgroupObject as an, Subscribe as ao, SubscribeNamespace as ap, SubscribeOk as aq, SubscriberPriority as ar, SubscriptionFilter as as, TokenAliasType as at, TrackExtension as au, TrackExtensionType as av, TrackStatus as aw, TrackStatusCode as ax, Tuple as ay, TupleField as az, ByteBuffer as b, ControlMessage as c, ControlMessageType as d, DefaultPublisherGroupOrderExtension as e, DefaultPublisherPriorityExtension as f, DeliveryTimeout as g, DeliveryTimeoutExtension as h, DynamicGroupsExtension as i, Expires as j, FetchCancel as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, type FetchObjectContext as o, FetchOk as p, FetchType as q, FilterType as r, Forward as s, FrozenByteBuffer as t, FullTrackName as u, GroupOrder as v, GroupOrderParam as w, LargestObject as x, Location as y, MAX_NAMESPACE_TUPLE_COUNT as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moqtail",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "Media Over QUIC Transport client implementation",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",