@moqtap/codec 0.4.3 → 0.5.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/dist/chunk-A33U4WVS.cjs +1993 -0
- package/dist/chunk-A655PHFX.cjs +446 -0
- package/dist/chunk-DLSGOZ6P.js +1993 -0
- package/dist/chunk-IWYKDCXP.js +446 -0
- package/dist/{codec-CewFCsEy.d.ts → codec-3ZgEK-Yj.d.ts} +1 -1
- package/dist/{codec-BFg5xnrJ.d.ts → codec-6s9d5yZm.d.ts} +1 -1
- package/dist/{codec-CAbm9d_n.d.cts → codec-B6ouUJrm.d.cts} +1 -1
- package/dist/{codec-3Ppy_5Gd.d.ts → codec-BhW5CGZq.d.ts} +1 -1
- package/dist/{codec-wtt6WF1K.d.ts → codec-Bp4HPezr.d.ts} +1 -1
- package/dist/{codec-BWQ5Jlap.d.cts → codec-BsSNjvB3.d.cts} +1 -1
- package/dist/codec-BvSmr-Jp.d.ts +30 -0
- package/dist/{codec-DftaRuVz.d.ts → codec-BvzKRqiP.d.ts} +1 -1
- package/dist/{codec-DFU-6Rax.d.ts → codec-BzRIVIzS.d.ts} +1 -1
- package/dist/{codec-DDUBJGn0.d.cts → codec-C17JvsEU.d.cts} +1 -1
- package/dist/{codec-BbbLDSKA.d.cts → codec-CBLLytyP.d.cts} +1 -1
- package/dist/{codec-Va_wZCF_.d.ts → codec-Cbv3sG2y.d.ts} +1 -1
- package/dist/{codec-R9TJCq-E.d.cts → codec-CzBmYisK.d.cts} +1 -1
- package/dist/{codec-CFWQY9Lj.d.cts → codec-D2YMCU11.d.cts} +1 -1
- package/dist/{codec-C8aSvE41.d.cts → codec-D5Ss123f.d.cts} +1 -1
- package/dist/{codec-j819z_hL.d.cts → codec-DS-As0Pp.d.cts} +1 -1
- package/dist/{codec-CpZrZ3ok.d.ts → codec-D_9X0i31.d.ts} +1 -1
- package/dist/{codec-B_QST4y1.d.cts → codec-DbpLHKXN.d.cts} +1 -1
- package/dist/{codec-B2lYE0YA.d.ts → codec-DqHwYWM-.d.ts} +1 -1
- package/dist/{codec-Db-0pk38.d.ts → codec-GayA_uN0.d.ts} +1 -1
- package/dist/codec-MxIhLDR5.d.cts +30 -0
- package/dist/{codec-lqDowbyT.d.cts → codec-R28KwiGM.d.cts} +1 -1
- package/dist/{codec-ZwV-Njt6.d.ts → codec-Tdey03Bo.d.ts} +1 -1
- package/dist/{codec-C7UzTYSS.d.cts → codec-yJ_axwtp.d.cts} +1 -1
- package/dist/draft07-session.d.cts +3 -3
- package/dist/draft07-session.d.ts +3 -3
- package/dist/draft07.d.cts +3 -3
- package/dist/draft07.d.ts +3 -3
- package/dist/draft08-session.d.cts +3 -3
- package/dist/draft08-session.d.ts +3 -3
- package/dist/draft08.d.cts +4 -4
- package/dist/draft08.d.ts +4 -4
- package/dist/draft09-session.d.cts +3 -3
- package/dist/draft09-session.d.ts +3 -3
- package/dist/draft09.d.cts +4 -4
- package/dist/draft09.d.ts +4 -4
- package/dist/draft10-session.d.cts +3 -3
- package/dist/draft10-session.d.ts +3 -3
- package/dist/draft10.d.cts +4 -4
- package/dist/draft10.d.ts +4 -4
- package/dist/draft11-session.d.cts +3 -3
- package/dist/draft11-session.d.ts +3 -3
- package/dist/draft11.d.cts +4 -4
- package/dist/draft11.d.ts +4 -4
- package/dist/draft12-session.d.cts +3 -3
- package/dist/draft12-session.d.ts +3 -3
- package/dist/draft12.d.cts +4 -4
- package/dist/draft12.d.ts +4 -4
- package/dist/draft13-session.d.cts +3 -3
- package/dist/draft13-session.d.ts +3 -3
- package/dist/draft13.d.cts +4 -4
- package/dist/draft13.d.ts +4 -4
- package/dist/draft14-session.d.cts +3 -3
- package/dist/draft14-session.d.ts +3 -3
- package/dist/draft14.d.cts +4 -4
- package/dist/draft14.d.ts +4 -4
- package/dist/draft15-session.d.cts +3 -3
- package/dist/draft15-session.d.ts +3 -3
- package/dist/draft15.d.cts +4 -4
- package/dist/draft15.d.ts +4 -4
- package/dist/draft16-session.d.cts +3 -3
- package/dist/draft16-session.d.ts +3 -3
- package/dist/draft16.d.cts +4 -4
- package/dist/draft16.d.ts +4 -4
- package/dist/draft17-session.d.cts +3 -3
- package/dist/draft17-session.d.ts +3 -3
- package/dist/draft17.d.cts +3 -3
- package/dist/draft17.d.ts +3 -3
- package/dist/draft18-session.cjs +8 -0
- package/dist/draft18-session.d.cts +50 -0
- package/dist/draft18-session.d.ts +50 -0
- package/dist/draft18-session.js +8 -0
- package/dist/draft18.cjs +179 -0
- package/dist/draft18.d.cts +126 -0
- package/dist/draft18.d.ts +126 -0
- package/dist/draft18.js +179 -0
- package/dist/index.cjs +7 -1
- package/dist/index.d.cts +19 -14
- package/dist/index.d.ts +19 -14
- package/dist/index.js +7 -1
- package/dist/{session-types-X-IYEGoG.d.ts → session-types-DBpCRtrL.d.ts} +1 -1
- package/dist/{session-types-C7UONex5.d.cts → session-types-sBaTRwDh.d.cts} +1 -1
- package/dist/session.cjs +5 -1
- package/dist/session.d.cts +5 -3
- package/dist/session.d.ts +5 -3
- package/dist/session.js +5 -1
- package/dist/{types-DuIO7cWK.d.cts → types-CnBuq68e.d.cts} +1 -1
- package/dist/{types-DuIO7cWK.d.ts → types-CnBuq68e.d.ts} +1 -1
- package/dist/types-Cqp10JtB.d.cts +249 -0
- package/dist/types-Cqp10JtB.d.ts +249 -0
- package/package.json +14 -2
- package/src/core/types.ts +13 -1
- package/src/drafts/draft17/error-codes.ts +72 -0
- package/src/drafts/draft18/codec.ts +1310 -0
- package/src/drafts/draft18/data-streams.ts +996 -0
- package/src/drafts/draft18/error-codes.ts +75 -0
- package/src/drafts/draft18/index.ts +122 -0
- package/src/drafts/draft18/messages.ts +56 -0
- package/src/drafts/draft18/rules.ts +85 -0
- package/src/drafts/draft18/session-fsm.ts +451 -0
- package/src/drafts/draft18/session.ts +15 -0
- package/src/drafts/draft18/types.ts +347 -0
- package/src/index.ts +9 -1
- package/src/session.ts +4 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
interface UnknownParam {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly length: number;
|
|
4
|
+
readonly raw_hex: string;
|
|
5
|
+
}
|
|
6
|
+
interface AuthorizationToken {
|
|
7
|
+
readonly alias_type: bigint;
|
|
8
|
+
readonly token_alias?: bigint;
|
|
9
|
+
readonly token_type?: bigint;
|
|
10
|
+
readonly token_value?: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
interface Draft18SetupOptions {
|
|
13
|
+
path?: string;
|
|
14
|
+
authorization_token?: AuthorizationToken;
|
|
15
|
+
max_auth_token_cache_size?: bigint;
|
|
16
|
+
authority?: string;
|
|
17
|
+
moqt_implementation?: string;
|
|
18
|
+
unknown?: UnknownParam[];
|
|
19
|
+
}
|
|
20
|
+
interface SubscriptionFilter {
|
|
21
|
+
readonly filter_type: bigint;
|
|
22
|
+
readonly start_group?: bigint;
|
|
23
|
+
readonly start_object?: bigint;
|
|
24
|
+
readonly end_group?: bigint;
|
|
25
|
+
}
|
|
26
|
+
interface LargestObject {
|
|
27
|
+
readonly group: bigint;
|
|
28
|
+
readonly object: bigint;
|
|
29
|
+
}
|
|
30
|
+
interface Draft18Params {
|
|
31
|
+
object_delivery_timeout?: bigint;
|
|
32
|
+
authorization_token?: AuthorizationToken;
|
|
33
|
+
rendezvous_timeout?: bigint;
|
|
34
|
+
subgroup_delivery_timeout?: bigint;
|
|
35
|
+
expires?: bigint;
|
|
36
|
+
largest_object?: LargestObject;
|
|
37
|
+
fill_timeout?: bigint;
|
|
38
|
+
forward?: bigint;
|
|
39
|
+
subscriber_priority?: bigint;
|
|
40
|
+
subscription_filter?: SubscriptionFilter;
|
|
41
|
+
group_order?: bigint;
|
|
42
|
+
new_group_request?: bigint;
|
|
43
|
+
track_namespace_prefix?: string[];
|
|
44
|
+
unknown?: UnknownParam[];
|
|
45
|
+
}
|
|
46
|
+
interface Draft18TrackProperties {
|
|
47
|
+
object_delivery_timeout?: bigint;
|
|
48
|
+
max_cache_duration?: bigint;
|
|
49
|
+
subgroup_delivery_timeout?: bigint;
|
|
50
|
+
immutable_properties?: Uint8Array;
|
|
51
|
+
default_publisher_priority?: bigint;
|
|
52
|
+
default_publisher_group_order?: bigint;
|
|
53
|
+
dynamic_groups?: bigint;
|
|
54
|
+
unknown?: UnknownParam[];
|
|
55
|
+
}
|
|
56
|
+
type Draft18MessageType = 'setup' | 'subscribe' | 'subscribe_ok' | 'request_update' | 'publish' | 'publish_done' | 'publish_namespace' | 'namespace' | 'namespace_done' | 'subscribe_namespace' | 'subscribe_tracks' | 'publish_blocked' | 'fetch' | 'fetch_ok' | 'track_status' | 'request_ok' | 'request_error' | 'goaway';
|
|
57
|
+
interface Draft18BaseMessage {
|
|
58
|
+
readonly type: Draft18MessageType;
|
|
59
|
+
}
|
|
60
|
+
interface Draft18Setup extends Draft18BaseMessage {
|
|
61
|
+
readonly type: 'setup';
|
|
62
|
+
readonly options: Draft18SetupOptions;
|
|
63
|
+
}
|
|
64
|
+
interface Draft18Subscribe extends Draft18BaseMessage {
|
|
65
|
+
readonly type: 'subscribe';
|
|
66
|
+
readonly request_id: bigint;
|
|
67
|
+
readonly track_namespace: string[];
|
|
68
|
+
readonly track_name: string;
|
|
69
|
+
readonly parameters: Draft18Params;
|
|
70
|
+
}
|
|
71
|
+
interface Draft18SubscribeOk extends Draft18BaseMessage {
|
|
72
|
+
readonly type: 'subscribe_ok';
|
|
73
|
+
readonly track_alias: bigint;
|
|
74
|
+
readonly parameters: Draft18Params;
|
|
75
|
+
readonly track_properties: Draft18TrackProperties;
|
|
76
|
+
}
|
|
77
|
+
interface Draft18RequestUpdate extends Draft18BaseMessage {
|
|
78
|
+
readonly type: 'request_update';
|
|
79
|
+
readonly request_id: bigint;
|
|
80
|
+
readonly parameters: Draft18Params;
|
|
81
|
+
}
|
|
82
|
+
interface Draft18Publish extends Draft18BaseMessage {
|
|
83
|
+
readonly type: 'publish';
|
|
84
|
+
readonly request_id: bigint;
|
|
85
|
+
readonly track_namespace: string[];
|
|
86
|
+
readonly track_name: string;
|
|
87
|
+
readonly track_alias: bigint;
|
|
88
|
+
readonly parameters: Draft18Params;
|
|
89
|
+
readonly track_properties: Draft18TrackProperties;
|
|
90
|
+
}
|
|
91
|
+
interface Draft18PublishDone extends Draft18BaseMessage {
|
|
92
|
+
readonly type: 'publish_done';
|
|
93
|
+
readonly status_code: bigint;
|
|
94
|
+
readonly stream_count: bigint;
|
|
95
|
+
readonly reason_phrase: string;
|
|
96
|
+
}
|
|
97
|
+
interface Draft18PublishNamespace extends Draft18BaseMessage {
|
|
98
|
+
readonly type: 'publish_namespace';
|
|
99
|
+
readonly request_id: bigint;
|
|
100
|
+
readonly track_namespace: string[];
|
|
101
|
+
readonly parameters: Draft18Params;
|
|
102
|
+
}
|
|
103
|
+
interface Draft18Namespace extends Draft18BaseMessage {
|
|
104
|
+
readonly type: 'namespace';
|
|
105
|
+
readonly namespace_suffix: string[];
|
|
106
|
+
}
|
|
107
|
+
interface Draft18NamespaceDone extends Draft18BaseMessage {
|
|
108
|
+
readonly type: 'namespace_done';
|
|
109
|
+
readonly namespace_suffix: string[];
|
|
110
|
+
}
|
|
111
|
+
interface Draft18SubscribeNamespace extends Draft18BaseMessage {
|
|
112
|
+
readonly type: 'subscribe_namespace';
|
|
113
|
+
readonly request_id: bigint;
|
|
114
|
+
readonly namespace_prefix: string[];
|
|
115
|
+
readonly parameters: Draft18Params;
|
|
116
|
+
}
|
|
117
|
+
interface Draft18SubscribeTracks extends Draft18BaseMessage {
|
|
118
|
+
readonly type: 'subscribe_tracks';
|
|
119
|
+
readonly request_id: bigint;
|
|
120
|
+
readonly namespace_prefix: string[];
|
|
121
|
+
readonly parameters: Draft18Params;
|
|
122
|
+
}
|
|
123
|
+
interface Draft18PublishBlocked extends Draft18BaseMessage {
|
|
124
|
+
readonly type: 'publish_blocked';
|
|
125
|
+
readonly namespace_suffix: string[];
|
|
126
|
+
readonly track_name: string;
|
|
127
|
+
}
|
|
128
|
+
interface StandaloneFetch {
|
|
129
|
+
readonly track_namespace: string[];
|
|
130
|
+
readonly track_name: string;
|
|
131
|
+
readonly start_group: bigint;
|
|
132
|
+
readonly start_object: bigint;
|
|
133
|
+
readonly end_group: bigint;
|
|
134
|
+
readonly end_object: bigint;
|
|
135
|
+
}
|
|
136
|
+
interface JoiningFetch {
|
|
137
|
+
readonly joining_request_id: bigint;
|
|
138
|
+
readonly joining_start: bigint;
|
|
139
|
+
}
|
|
140
|
+
interface Draft18Fetch extends Draft18BaseMessage {
|
|
141
|
+
readonly type: 'fetch';
|
|
142
|
+
readonly request_id: bigint;
|
|
143
|
+
readonly fetch_type: bigint;
|
|
144
|
+
readonly standalone?: StandaloneFetch;
|
|
145
|
+
readonly joining?: JoiningFetch;
|
|
146
|
+
readonly parameters: Draft18Params;
|
|
147
|
+
}
|
|
148
|
+
interface Draft18FetchOk extends Draft18BaseMessage {
|
|
149
|
+
readonly type: 'fetch_ok';
|
|
150
|
+
readonly end_of_track: number;
|
|
151
|
+
readonly end_group: bigint;
|
|
152
|
+
readonly end_object: bigint;
|
|
153
|
+
readonly parameters: Draft18Params;
|
|
154
|
+
readonly track_properties: Draft18TrackProperties;
|
|
155
|
+
}
|
|
156
|
+
interface Draft18TrackStatus extends Draft18BaseMessage {
|
|
157
|
+
readonly type: 'track_status';
|
|
158
|
+
readonly request_id: bigint;
|
|
159
|
+
readonly track_namespace: string[];
|
|
160
|
+
readonly track_name: string;
|
|
161
|
+
readonly parameters: Draft18Params;
|
|
162
|
+
}
|
|
163
|
+
interface Draft18RequestOk extends Draft18BaseMessage {
|
|
164
|
+
readonly type: 'request_ok';
|
|
165
|
+
readonly parameters: Draft18Params;
|
|
166
|
+
readonly track_properties: Draft18TrackProperties;
|
|
167
|
+
}
|
|
168
|
+
interface Redirect {
|
|
169
|
+
readonly connect_uri: string;
|
|
170
|
+
readonly track_namespace: string[];
|
|
171
|
+
readonly track_name: string;
|
|
172
|
+
}
|
|
173
|
+
interface Draft18RequestError extends Draft18BaseMessage {
|
|
174
|
+
readonly type: 'request_error';
|
|
175
|
+
readonly error_code: bigint;
|
|
176
|
+
readonly retry_interval: bigint;
|
|
177
|
+
readonly reason_phrase: string;
|
|
178
|
+
readonly redirect?: Redirect;
|
|
179
|
+
}
|
|
180
|
+
interface Draft18GoAway extends Draft18BaseMessage {
|
|
181
|
+
readonly type: 'goaway';
|
|
182
|
+
readonly new_session_uri: string;
|
|
183
|
+
readonly timeout: bigint;
|
|
184
|
+
readonly request_id?: bigint;
|
|
185
|
+
}
|
|
186
|
+
type Draft18Message = Draft18Setup | Draft18Subscribe | Draft18SubscribeOk | Draft18RequestUpdate | Draft18Publish | Draft18PublishDone | Draft18PublishNamespace | Draft18Namespace | Draft18NamespaceDone | Draft18SubscribeNamespace | Draft18SubscribeTracks | Draft18PublishBlocked | Draft18Fetch | Draft18FetchOk | Draft18TrackStatus | Draft18RequestOk | Draft18RequestError | Draft18GoAway;
|
|
187
|
+
interface ObjectPayload {
|
|
188
|
+
readonly type: 'object';
|
|
189
|
+
readonly byteOffset: number;
|
|
190
|
+
readonly payloadByteOffset: number;
|
|
191
|
+
readonly objectId: bigint;
|
|
192
|
+
readonly payloadLength: number;
|
|
193
|
+
readonly status?: bigint;
|
|
194
|
+
readonly extensionData: Uint8Array;
|
|
195
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
196
|
+
readonly payload: Uint8Array;
|
|
197
|
+
}
|
|
198
|
+
interface SubgroupStream {
|
|
199
|
+
readonly type: 'subgroup';
|
|
200
|
+
readonly headerType: number;
|
|
201
|
+
readonly trackAlias: bigint;
|
|
202
|
+
readonly groupId: bigint;
|
|
203
|
+
readonly subgroupId: bigint;
|
|
204
|
+
readonly publisherPriority: number;
|
|
205
|
+
readonly endOfGroup?: boolean;
|
|
206
|
+
readonly firstObject?: boolean;
|
|
207
|
+
readonly objects: ObjectPayload[];
|
|
208
|
+
}
|
|
209
|
+
interface DatagramObject {
|
|
210
|
+
readonly type: 'datagram';
|
|
211
|
+
readonly datagramType: number;
|
|
212
|
+
readonly trackAlias: bigint;
|
|
213
|
+
readonly groupId: bigint;
|
|
214
|
+
readonly objectId: bigint;
|
|
215
|
+
readonly publisherPriority: number;
|
|
216
|
+
readonly endOfGroup?: boolean;
|
|
217
|
+
readonly objectStatus?: bigint;
|
|
218
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
219
|
+
readonly payloadLength: number;
|
|
220
|
+
readonly payload: Uint8Array;
|
|
221
|
+
}
|
|
222
|
+
interface FetchObjectPayload extends ObjectPayload {
|
|
223
|
+
readonly serializationFlags: number;
|
|
224
|
+
readonly groupId: bigint;
|
|
225
|
+
readonly subgroupId: bigint;
|
|
226
|
+
readonly publisherPriority: number;
|
|
227
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
228
|
+
}
|
|
229
|
+
interface FetchStream {
|
|
230
|
+
readonly type: 'fetch';
|
|
231
|
+
readonly requestId: bigint;
|
|
232
|
+
readonly objects: FetchObjectPayload[];
|
|
233
|
+
}
|
|
234
|
+
type Draft18DataStream = SubgroupStream | DatagramObject | FetchStream;
|
|
235
|
+
interface SubgroupStreamHeader {
|
|
236
|
+
readonly type: 'subgroup_header';
|
|
237
|
+
readonly trackAlias: bigint;
|
|
238
|
+
readonly groupId: bigint;
|
|
239
|
+
readonly subgroupId: bigint;
|
|
240
|
+
readonly publisherPriority: number;
|
|
241
|
+
}
|
|
242
|
+
interface FetchStreamHeader {
|
|
243
|
+
readonly type: 'fetch_header';
|
|
244
|
+
readonly requestId: bigint;
|
|
245
|
+
}
|
|
246
|
+
type DataStreamHeader = SubgroupStreamHeader | FetchStreamHeader;
|
|
247
|
+
type DataStreamEvent = DataStreamHeader | ObjectPayload;
|
|
248
|
+
|
|
249
|
+
export type { Draft18SubscribeTracks as A, Draft18TrackProperties as B, Draft18TrackStatus as C, Draft18Message as D, FetchObjectPayload as E, FetchStreamHeader as F, StandaloneFetch as G, SubscriptionFilter as H, JoiningFetch as J, LargestObject as L, ObjectPayload as O, Redirect as R, SubgroupStreamHeader as S, UnknownParam as U, Draft18MessageType as a, DataStreamEvent as b, Draft18DataStream as c, DatagramObject as d, FetchStream as e, SubgroupStream as f, DataStreamHeader as g, Draft18BaseMessage as h, Draft18Fetch as i, Draft18FetchOk as j, Draft18GoAway as k, Draft18Namespace as l, Draft18NamespaceDone as m, Draft18Params as n, Draft18Publish as o, Draft18PublishBlocked as p, Draft18PublishDone as q, Draft18PublishNamespace as r, Draft18RequestError as s, Draft18RequestOk as t, Draft18RequestUpdate as u, Draft18Setup as v, Draft18SetupOptions as w, Draft18Subscribe as x, Draft18SubscribeNamespace as y, Draft18SubscribeOk as z };
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
interface UnknownParam {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly length: number;
|
|
4
|
+
readonly raw_hex: string;
|
|
5
|
+
}
|
|
6
|
+
interface AuthorizationToken {
|
|
7
|
+
readonly alias_type: bigint;
|
|
8
|
+
readonly token_alias?: bigint;
|
|
9
|
+
readonly token_type?: bigint;
|
|
10
|
+
readonly token_value?: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
interface Draft18SetupOptions {
|
|
13
|
+
path?: string;
|
|
14
|
+
authorization_token?: AuthorizationToken;
|
|
15
|
+
max_auth_token_cache_size?: bigint;
|
|
16
|
+
authority?: string;
|
|
17
|
+
moqt_implementation?: string;
|
|
18
|
+
unknown?: UnknownParam[];
|
|
19
|
+
}
|
|
20
|
+
interface SubscriptionFilter {
|
|
21
|
+
readonly filter_type: bigint;
|
|
22
|
+
readonly start_group?: bigint;
|
|
23
|
+
readonly start_object?: bigint;
|
|
24
|
+
readonly end_group?: bigint;
|
|
25
|
+
}
|
|
26
|
+
interface LargestObject {
|
|
27
|
+
readonly group: bigint;
|
|
28
|
+
readonly object: bigint;
|
|
29
|
+
}
|
|
30
|
+
interface Draft18Params {
|
|
31
|
+
object_delivery_timeout?: bigint;
|
|
32
|
+
authorization_token?: AuthorizationToken;
|
|
33
|
+
rendezvous_timeout?: bigint;
|
|
34
|
+
subgroup_delivery_timeout?: bigint;
|
|
35
|
+
expires?: bigint;
|
|
36
|
+
largest_object?: LargestObject;
|
|
37
|
+
fill_timeout?: bigint;
|
|
38
|
+
forward?: bigint;
|
|
39
|
+
subscriber_priority?: bigint;
|
|
40
|
+
subscription_filter?: SubscriptionFilter;
|
|
41
|
+
group_order?: bigint;
|
|
42
|
+
new_group_request?: bigint;
|
|
43
|
+
track_namespace_prefix?: string[];
|
|
44
|
+
unknown?: UnknownParam[];
|
|
45
|
+
}
|
|
46
|
+
interface Draft18TrackProperties {
|
|
47
|
+
object_delivery_timeout?: bigint;
|
|
48
|
+
max_cache_duration?: bigint;
|
|
49
|
+
subgroup_delivery_timeout?: bigint;
|
|
50
|
+
immutable_properties?: Uint8Array;
|
|
51
|
+
default_publisher_priority?: bigint;
|
|
52
|
+
default_publisher_group_order?: bigint;
|
|
53
|
+
dynamic_groups?: bigint;
|
|
54
|
+
unknown?: UnknownParam[];
|
|
55
|
+
}
|
|
56
|
+
type Draft18MessageType = 'setup' | 'subscribe' | 'subscribe_ok' | 'request_update' | 'publish' | 'publish_done' | 'publish_namespace' | 'namespace' | 'namespace_done' | 'subscribe_namespace' | 'subscribe_tracks' | 'publish_blocked' | 'fetch' | 'fetch_ok' | 'track_status' | 'request_ok' | 'request_error' | 'goaway';
|
|
57
|
+
interface Draft18BaseMessage {
|
|
58
|
+
readonly type: Draft18MessageType;
|
|
59
|
+
}
|
|
60
|
+
interface Draft18Setup extends Draft18BaseMessage {
|
|
61
|
+
readonly type: 'setup';
|
|
62
|
+
readonly options: Draft18SetupOptions;
|
|
63
|
+
}
|
|
64
|
+
interface Draft18Subscribe extends Draft18BaseMessage {
|
|
65
|
+
readonly type: 'subscribe';
|
|
66
|
+
readonly request_id: bigint;
|
|
67
|
+
readonly track_namespace: string[];
|
|
68
|
+
readonly track_name: string;
|
|
69
|
+
readonly parameters: Draft18Params;
|
|
70
|
+
}
|
|
71
|
+
interface Draft18SubscribeOk extends Draft18BaseMessage {
|
|
72
|
+
readonly type: 'subscribe_ok';
|
|
73
|
+
readonly track_alias: bigint;
|
|
74
|
+
readonly parameters: Draft18Params;
|
|
75
|
+
readonly track_properties: Draft18TrackProperties;
|
|
76
|
+
}
|
|
77
|
+
interface Draft18RequestUpdate extends Draft18BaseMessage {
|
|
78
|
+
readonly type: 'request_update';
|
|
79
|
+
readonly request_id: bigint;
|
|
80
|
+
readonly parameters: Draft18Params;
|
|
81
|
+
}
|
|
82
|
+
interface Draft18Publish extends Draft18BaseMessage {
|
|
83
|
+
readonly type: 'publish';
|
|
84
|
+
readonly request_id: bigint;
|
|
85
|
+
readonly track_namespace: string[];
|
|
86
|
+
readonly track_name: string;
|
|
87
|
+
readonly track_alias: bigint;
|
|
88
|
+
readonly parameters: Draft18Params;
|
|
89
|
+
readonly track_properties: Draft18TrackProperties;
|
|
90
|
+
}
|
|
91
|
+
interface Draft18PublishDone extends Draft18BaseMessage {
|
|
92
|
+
readonly type: 'publish_done';
|
|
93
|
+
readonly status_code: bigint;
|
|
94
|
+
readonly stream_count: bigint;
|
|
95
|
+
readonly reason_phrase: string;
|
|
96
|
+
}
|
|
97
|
+
interface Draft18PublishNamespace extends Draft18BaseMessage {
|
|
98
|
+
readonly type: 'publish_namespace';
|
|
99
|
+
readonly request_id: bigint;
|
|
100
|
+
readonly track_namespace: string[];
|
|
101
|
+
readonly parameters: Draft18Params;
|
|
102
|
+
}
|
|
103
|
+
interface Draft18Namespace extends Draft18BaseMessage {
|
|
104
|
+
readonly type: 'namespace';
|
|
105
|
+
readonly namespace_suffix: string[];
|
|
106
|
+
}
|
|
107
|
+
interface Draft18NamespaceDone extends Draft18BaseMessage {
|
|
108
|
+
readonly type: 'namespace_done';
|
|
109
|
+
readonly namespace_suffix: string[];
|
|
110
|
+
}
|
|
111
|
+
interface Draft18SubscribeNamespace extends Draft18BaseMessage {
|
|
112
|
+
readonly type: 'subscribe_namespace';
|
|
113
|
+
readonly request_id: bigint;
|
|
114
|
+
readonly namespace_prefix: string[];
|
|
115
|
+
readonly parameters: Draft18Params;
|
|
116
|
+
}
|
|
117
|
+
interface Draft18SubscribeTracks extends Draft18BaseMessage {
|
|
118
|
+
readonly type: 'subscribe_tracks';
|
|
119
|
+
readonly request_id: bigint;
|
|
120
|
+
readonly namespace_prefix: string[];
|
|
121
|
+
readonly parameters: Draft18Params;
|
|
122
|
+
}
|
|
123
|
+
interface Draft18PublishBlocked extends Draft18BaseMessage {
|
|
124
|
+
readonly type: 'publish_blocked';
|
|
125
|
+
readonly namespace_suffix: string[];
|
|
126
|
+
readonly track_name: string;
|
|
127
|
+
}
|
|
128
|
+
interface StandaloneFetch {
|
|
129
|
+
readonly track_namespace: string[];
|
|
130
|
+
readonly track_name: string;
|
|
131
|
+
readonly start_group: bigint;
|
|
132
|
+
readonly start_object: bigint;
|
|
133
|
+
readonly end_group: bigint;
|
|
134
|
+
readonly end_object: bigint;
|
|
135
|
+
}
|
|
136
|
+
interface JoiningFetch {
|
|
137
|
+
readonly joining_request_id: bigint;
|
|
138
|
+
readonly joining_start: bigint;
|
|
139
|
+
}
|
|
140
|
+
interface Draft18Fetch extends Draft18BaseMessage {
|
|
141
|
+
readonly type: 'fetch';
|
|
142
|
+
readonly request_id: bigint;
|
|
143
|
+
readonly fetch_type: bigint;
|
|
144
|
+
readonly standalone?: StandaloneFetch;
|
|
145
|
+
readonly joining?: JoiningFetch;
|
|
146
|
+
readonly parameters: Draft18Params;
|
|
147
|
+
}
|
|
148
|
+
interface Draft18FetchOk extends Draft18BaseMessage {
|
|
149
|
+
readonly type: 'fetch_ok';
|
|
150
|
+
readonly end_of_track: number;
|
|
151
|
+
readonly end_group: bigint;
|
|
152
|
+
readonly end_object: bigint;
|
|
153
|
+
readonly parameters: Draft18Params;
|
|
154
|
+
readonly track_properties: Draft18TrackProperties;
|
|
155
|
+
}
|
|
156
|
+
interface Draft18TrackStatus extends Draft18BaseMessage {
|
|
157
|
+
readonly type: 'track_status';
|
|
158
|
+
readonly request_id: bigint;
|
|
159
|
+
readonly track_namespace: string[];
|
|
160
|
+
readonly track_name: string;
|
|
161
|
+
readonly parameters: Draft18Params;
|
|
162
|
+
}
|
|
163
|
+
interface Draft18RequestOk extends Draft18BaseMessage {
|
|
164
|
+
readonly type: 'request_ok';
|
|
165
|
+
readonly parameters: Draft18Params;
|
|
166
|
+
readonly track_properties: Draft18TrackProperties;
|
|
167
|
+
}
|
|
168
|
+
interface Redirect {
|
|
169
|
+
readonly connect_uri: string;
|
|
170
|
+
readonly track_namespace: string[];
|
|
171
|
+
readonly track_name: string;
|
|
172
|
+
}
|
|
173
|
+
interface Draft18RequestError extends Draft18BaseMessage {
|
|
174
|
+
readonly type: 'request_error';
|
|
175
|
+
readonly error_code: bigint;
|
|
176
|
+
readonly retry_interval: bigint;
|
|
177
|
+
readonly reason_phrase: string;
|
|
178
|
+
readonly redirect?: Redirect;
|
|
179
|
+
}
|
|
180
|
+
interface Draft18GoAway extends Draft18BaseMessage {
|
|
181
|
+
readonly type: 'goaway';
|
|
182
|
+
readonly new_session_uri: string;
|
|
183
|
+
readonly timeout: bigint;
|
|
184
|
+
readonly request_id?: bigint;
|
|
185
|
+
}
|
|
186
|
+
type Draft18Message = Draft18Setup | Draft18Subscribe | Draft18SubscribeOk | Draft18RequestUpdate | Draft18Publish | Draft18PublishDone | Draft18PublishNamespace | Draft18Namespace | Draft18NamespaceDone | Draft18SubscribeNamespace | Draft18SubscribeTracks | Draft18PublishBlocked | Draft18Fetch | Draft18FetchOk | Draft18TrackStatus | Draft18RequestOk | Draft18RequestError | Draft18GoAway;
|
|
187
|
+
interface ObjectPayload {
|
|
188
|
+
readonly type: 'object';
|
|
189
|
+
readonly byteOffset: number;
|
|
190
|
+
readonly payloadByteOffset: number;
|
|
191
|
+
readonly objectId: bigint;
|
|
192
|
+
readonly payloadLength: number;
|
|
193
|
+
readonly status?: bigint;
|
|
194
|
+
readonly extensionData: Uint8Array;
|
|
195
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
196
|
+
readonly payload: Uint8Array;
|
|
197
|
+
}
|
|
198
|
+
interface SubgroupStream {
|
|
199
|
+
readonly type: 'subgroup';
|
|
200
|
+
readonly headerType: number;
|
|
201
|
+
readonly trackAlias: bigint;
|
|
202
|
+
readonly groupId: bigint;
|
|
203
|
+
readonly subgroupId: bigint;
|
|
204
|
+
readonly publisherPriority: number;
|
|
205
|
+
readonly endOfGroup?: boolean;
|
|
206
|
+
readonly firstObject?: boolean;
|
|
207
|
+
readonly objects: ObjectPayload[];
|
|
208
|
+
}
|
|
209
|
+
interface DatagramObject {
|
|
210
|
+
readonly type: 'datagram';
|
|
211
|
+
readonly datagramType: number;
|
|
212
|
+
readonly trackAlias: bigint;
|
|
213
|
+
readonly groupId: bigint;
|
|
214
|
+
readonly objectId: bigint;
|
|
215
|
+
readonly publisherPriority: number;
|
|
216
|
+
readonly endOfGroup?: boolean;
|
|
217
|
+
readonly objectStatus?: bigint;
|
|
218
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
219
|
+
readonly payloadLength: number;
|
|
220
|
+
readonly payload: Uint8Array;
|
|
221
|
+
}
|
|
222
|
+
interface FetchObjectPayload extends ObjectPayload {
|
|
223
|
+
readonly serializationFlags: number;
|
|
224
|
+
readonly groupId: bigint;
|
|
225
|
+
readonly subgroupId: bigint;
|
|
226
|
+
readonly publisherPriority: number;
|
|
227
|
+
readonly objectProperties?: Record<string, bigint>;
|
|
228
|
+
}
|
|
229
|
+
interface FetchStream {
|
|
230
|
+
readonly type: 'fetch';
|
|
231
|
+
readonly requestId: bigint;
|
|
232
|
+
readonly objects: FetchObjectPayload[];
|
|
233
|
+
}
|
|
234
|
+
type Draft18DataStream = SubgroupStream | DatagramObject | FetchStream;
|
|
235
|
+
interface SubgroupStreamHeader {
|
|
236
|
+
readonly type: 'subgroup_header';
|
|
237
|
+
readonly trackAlias: bigint;
|
|
238
|
+
readonly groupId: bigint;
|
|
239
|
+
readonly subgroupId: bigint;
|
|
240
|
+
readonly publisherPriority: number;
|
|
241
|
+
}
|
|
242
|
+
interface FetchStreamHeader {
|
|
243
|
+
readonly type: 'fetch_header';
|
|
244
|
+
readonly requestId: bigint;
|
|
245
|
+
}
|
|
246
|
+
type DataStreamHeader = SubgroupStreamHeader | FetchStreamHeader;
|
|
247
|
+
type DataStreamEvent = DataStreamHeader | ObjectPayload;
|
|
248
|
+
|
|
249
|
+
export type { Draft18SubscribeTracks as A, Draft18TrackProperties as B, Draft18TrackStatus as C, Draft18Message as D, FetchObjectPayload as E, FetchStreamHeader as F, StandaloneFetch as G, SubscriptionFilter as H, JoiningFetch as J, LargestObject as L, ObjectPayload as O, Redirect as R, SubgroupStreamHeader as S, UnknownParam as U, Draft18MessageType as a, DataStreamEvent as b, Draft18DataStream as c, DatagramObject as d, FetchStream as e, SubgroupStream as f, DataStreamHeader as g, Draft18BaseMessage as h, Draft18Fetch as i, Draft18FetchOk as j, Draft18GoAway as k, Draft18Namespace as l, Draft18NamespaceDone as m, Draft18Params as n, Draft18Publish as o, Draft18PublishBlocked as p, Draft18PublishDone as q, Draft18PublishNamespace as r, Draft18RequestError as s, Draft18RequestOk as t, Draft18RequestUpdate as u, Draft18Setup as v, Draft18SetupOptions as w, Draft18Subscribe as x, Draft18SubscribeNamespace as y, Draft18SubscribeOk as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moqtap/codec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MoQT wire-format codec and session state machine — multi-draft, zero dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -172,6 +172,18 @@
|
|
|
172
172
|
"types": "./dist/draft17-session.d.ts",
|
|
173
173
|
"import": "./dist/draft17-session.js",
|
|
174
174
|
"require": "./dist/draft17-session.cjs"
|
|
175
|
+
},
|
|
176
|
+
"./draft18": {
|
|
177
|
+
"bun": "./src/drafts/draft18/index.ts",
|
|
178
|
+
"types": "./dist/draft18.d.ts",
|
|
179
|
+
"import": "./dist/draft18.js",
|
|
180
|
+
"require": "./dist/draft18.cjs"
|
|
181
|
+
},
|
|
182
|
+
"./draft18/session": {
|
|
183
|
+
"bun": "./src/drafts/draft18/session.ts",
|
|
184
|
+
"types": "./dist/draft18-session.d.ts",
|
|
185
|
+
"import": "./dist/draft18-session.js",
|
|
186
|
+
"require": "./dist/draft18-session.cjs"
|
|
175
187
|
}
|
|
176
188
|
},
|
|
177
189
|
"files": [
|
|
@@ -184,7 +196,7 @@
|
|
|
184
196
|
"test": "vitest run"
|
|
185
197
|
},
|
|
186
198
|
"devDependencies": {
|
|
187
|
-
"@moqtap/test-vectors": "^0.
|
|
199
|
+
"@moqtap/test-vectors": "^0.9.1",
|
|
188
200
|
"tsup": "^8.0.0",
|
|
189
201
|
"typescript": "^5.5.0",
|
|
190
202
|
"vitest": "^3.0.0"
|
package/src/core/types.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
// Draft identifiers
|
|
2
|
-
export type Draft =
|
|
2
|
+
export type Draft =
|
|
3
|
+
| '07'
|
|
4
|
+
| '08'
|
|
5
|
+
| '09'
|
|
6
|
+
| '10'
|
|
7
|
+
| '11'
|
|
8
|
+
| '12'
|
|
9
|
+
| '13'
|
|
10
|
+
| '14'
|
|
11
|
+
| '15'
|
|
12
|
+
| '16'
|
|
13
|
+
| '17'
|
|
14
|
+
| '18'
|
|
3
15
|
|
|
4
16
|
// Base codec interface — draft-specific codecs extend this
|
|
5
17
|
export interface BaseCodec<M> {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const SessionTerminationCode = {
|
|
2
|
+
NoError: 0x0n,
|
|
3
|
+
InternalError: 0x1n,
|
|
4
|
+
Unauthorized: 0x2n,
|
|
5
|
+
ProtocolViolation: 0x3n,
|
|
6
|
+
InvalidRequestId: 0x4n,
|
|
7
|
+
DuplicateTrackAlias: 0x5n,
|
|
8
|
+
KeyValueFormattingError: 0x6n,
|
|
9
|
+
InvalidRequiredRequestId: 0x7n,
|
|
10
|
+
InvalidPath: 0x8n,
|
|
11
|
+
MalformedPath: 0x9n,
|
|
12
|
+
GoawayTimeout: 0x10n,
|
|
13
|
+
ControlMessageTimeout: 0x11n,
|
|
14
|
+
DataStreamTimeout: 0x12n,
|
|
15
|
+
AuthTokenCacheOverflow: 0x13n,
|
|
16
|
+
DuplicateAuthTokenAlias: 0x14n,
|
|
17
|
+
VersionNegotiationFailed: 0x15n,
|
|
18
|
+
MalformedAuthToken: 0x16n,
|
|
19
|
+
UnknownAuthTokenAlias: 0x17n,
|
|
20
|
+
ExpiredAuthToken: 0x18n,
|
|
21
|
+
InvalidAuthority: 0x19n,
|
|
22
|
+
MalformedAuthority: 0x1an,
|
|
23
|
+
} as const
|
|
24
|
+
export type SessionTerminationCodeValue =
|
|
25
|
+
(typeof SessionTerminationCode)[keyof typeof SessionTerminationCode]
|
|
26
|
+
|
|
27
|
+
export const RequestErrorCode = {
|
|
28
|
+
InternalError: 0x0n,
|
|
29
|
+
Unauthorized: 0x1n,
|
|
30
|
+
Timeout: 0x2n,
|
|
31
|
+
NotSupported: 0x3n,
|
|
32
|
+
MalformedAuthToken: 0x4n,
|
|
33
|
+
ExpiredAuthToken: 0x5n,
|
|
34
|
+
GoingAway: 0x6n,
|
|
35
|
+
ExcessiveLoad: 0x9n,
|
|
36
|
+
DoesNotExist: 0x10n,
|
|
37
|
+
InvalidRange: 0x11n,
|
|
38
|
+
MalformedTrack: 0x12n,
|
|
39
|
+
DuplicateSubscription: 0x19n,
|
|
40
|
+
Uninterested: 0x20n,
|
|
41
|
+
PrefixOverlap: 0x30n,
|
|
42
|
+
NamespaceTooLarge: 0x31n,
|
|
43
|
+
InvalidJoiningRequestId: 0x32n,
|
|
44
|
+
} as const
|
|
45
|
+
export type RequestErrorCodeValue = (typeof RequestErrorCode)[keyof typeof RequestErrorCode]
|
|
46
|
+
|
|
47
|
+
export const PublishDoneCode = {
|
|
48
|
+
InternalError: 0x0n,
|
|
49
|
+
Unauthorized: 0x1n,
|
|
50
|
+
TrackEnded: 0x2n,
|
|
51
|
+
SubscriptionEnded: 0x3n,
|
|
52
|
+
GoingAway: 0x4n,
|
|
53
|
+
Expired: 0x5n,
|
|
54
|
+
TooFarBehind: 0x6n,
|
|
55
|
+
UpdateFailed: 0x8n,
|
|
56
|
+
ExcessiveLoad: 0x9n,
|
|
57
|
+
MalformedTrack: 0x12n,
|
|
58
|
+
} as const
|
|
59
|
+
export type PublishDoneCodeValue = (typeof PublishDoneCode)[keyof typeof PublishDoneCode]
|
|
60
|
+
|
|
61
|
+
export const DataStreamResetCode = {
|
|
62
|
+
InternalError: 0x0n,
|
|
63
|
+
Cancelled: 0x1n,
|
|
64
|
+
DeliveryTimeout: 0x2n,
|
|
65
|
+
SessionClosed: 0x3n,
|
|
66
|
+
UnknownObjectStatus: 0x4n,
|
|
67
|
+
TooFarBehind: 0x5n,
|
|
68
|
+
ExcessiveLoad: 0x9n,
|
|
69
|
+
MalformedTrack: 0x12n,
|
|
70
|
+
} as const
|
|
71
|
+
export type DataStreamResetCodeValue =
|
|
72
|
+
(typeof DataStreamResetCode)[keyof typeof DataStreamResetCode]
|