@moqtap/codec 0.4.3 → 0.6.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.
Files changed (133) hide show
  1. package/dist/chunk-62LYLROG.js +2095 -0
  2. package/dist/chunk-A33U4WVS.cjs +1993 -0
  3. package/dist/chunk-A655PHFX.cjs +446 -0
  4. package/dist/chunk-CQ65LKPQ.cjs +446 -0
  5. package/dist/chunk-DLSGOZ6P.js +1993 -0
  6. package/dist/chunk-IWYKDCXP.js +446 -0
  7. package/dist/chunk-MSG2FXJ2.cjs +2095 -0
  8. package/dist/chunk-O5DQ44TM.js +446 -0
  9. package/dist/{codec-C7UzTYSS.d.cts → codec-B1snaM9L.d.cts} +1 -1
  10. package/dist/{codec-ZwV-Njt6.d.ts → codec-BLYAy2OP.d.ts} +1 -1
  11. package/dist/{codec-B2lYE0YA.d.ts → codec-BNS3gS77.d.ts} +1 -1
  12. package/dist/{codec-BbbLDSKA.d.cts → codec-BOtv3R5j.d.cts} +1 -1
  13. package/dist/{codec-DDUBJGn0.d.cts → codec-BOyrk_C9.d.cts} +1 -1
  14. package/dist/{codec-BWQ5Jlap.d.cts → codec-BqqoYdh_.d.cts} +1 -1
  15. package/dist/{codec-3Ppy_5Gd.d.ts → codec-CI0BjmHc.d.ts} +1 -1
  16. package/dist/{codec-DftaRuVz.d.ts → codec-CWj5iTxA.d.ts} +1 -1
  17. package/dist/{codec-B_QST4y1.d.cts → codec-CyApDKwf.d.cts} +1 -1
  18. package/dist/{codec-BFg5xnrJ.d.ts → codec-D2JbI2tp.d.ts} +1 -1
  19. package/dist/{codec-DFU-6Rax.d.ts → codec-D47r_-Rl.d.ts} +1 -1
  20. package/dist/{codec-Db-0pk38.d.ts → codec-D49OofBr.d.ts} +1 -1
  21. package/dist/codec-D89DWXbv.d.cts +30 -0
  22. package/dist/{codec-R9TJCq-E.d.cts → codec-D95gT98n.d.cts} +1 -1
  23. package/dist/codec-DAePx2NL.d.ts +30 -0
  24. package/dist/{codec-CpZrZ3ok.d.ts → codec-DJmV04i0.d.ts} +1 -1
  25. package/dist/{codec-Va_wZCF_.d.ts → codec-DL0njGkL.d.ts} +1 -1
  26. package/dist/{codec-CFWQY9Lj.d.cts → codec-DQWQSam3.d.cts} +1 -1
  27. package/dist/{codec-wtt6WF1K.d.ts → codec-DplRgIKq.d.ts} +1 -1
  28. package/dist/{codec-CewFCsEy.d.ts → codec-DujHf55Z.d.ts} +1 -1
  29. package/dist/{codec-j819z_hL.d.cts → codec-DvcJgYKq.d.cts} +1 -1
  30. package/dist/{codec-C8aSvE41.d.cts → codec-NMsTK0GX.d.cts} +1 -1
  31. package/dist/codec-WwwUipaU.d.ts +30 -0
  32. package/dist/{codec-CAbm9d_n.d.cts → codec-cou9XBMF.d.cts} +1 -1
  33. package/dist/{codec-lqDowbyT.d.cts → codec-hvkJfCF5.d.cts} +1 -1
  34. package/dist/codec-xeuGZY77.d.cts +30 -0
  35. package/dist/draft07-session.d.cts +3 -3
  36. package/dist/draft07-session.d.ts +3 -3
  37. package/dist/draft07.d.cts +3 -3
  38. package/dist/draft07.d.ts +3 -3
  39. package/dist/draft08-session.d.cts +3 -3
  40. package/dist/draft08-session.d.ts +3 -3
  41. package/dist/draft08.d.cts +4 -4
  42. package/dist/draft08.d.ts +4 -4
  43. package/dist/draft09-session.d.cts +3 -3
  44. package/dist/draft09-session.d.ts +3 -3
  45. package/dist/draft09.d.cts +4 -4
  46. package/dist/draft09.d.ts +4 -4
  47. package/dist/draft10-session.d.cts +3 -3
  48. package/dist/draft10-session.d.ts +3 -3
  49. package/dist/draft10.d.cts +4 -4
  50. package/dist/draft10.d.ts +4 -4
  51. package/dist/draft11-session.d.cts +3 -3
  52. package/dist/draft11-session.d.ts +3 -3
  53. package/dist/draft11.d.cts +4 -4
  54. package/dist/draft11.d.ts +4 -4
  55. package/dist/draft12-session.d.cts +3 -3
  56. package/dist/draft12-session.d.ts +3 -3
  57. package/dist/draft12.d.cts +4 -4
  58. package/dist/draft12.d.ts +4 -4
  59. package/dist/draft13-session.d.cts +3 -3
  60. package/dist/draft13-session.d.ts +3 -3
  61. package/dist/draft13.d.cts +4 -4
  62. package/dist/draft13.d.ts +4 -4
  63. package/dist/draft14-session.d.cts +3 -3
  64. package/dist/draft14-session.d.ts +3 -3
  65. package/dist/draft14.d.cts +4 -4
  66. package/dist/draft14.d.ts +4 -4
  67. package/dist/draft15-session.d.cts +3 -3
  68. package/dist/draft15-session.d.ts +3 -3
  69. package/dist/draft15.d.cts +4 -4
  70. package/dist/draft15.d.ts +4 -4
  71. package/dist/draft16-session.d.cts +3 -3
  72. package/dist/draft16-session.d.ts +3 -3
  73. package/dist/draft16.d.cts +4 -4
  74. package/dist/draft16.d.ts +4 -4
  75. package/dist/draft17-session.d.cts +3 -3
  76. package/dist/draft17-session.d.ts +3 -3
  77. package/dist/draft17.d.cts +3 -3
  78. package/dist/draft17.d.ts +3 -3
  79. package/dist/draft18-session.cjs +8 -0
  80. package/dist/draft18-session.d.cts +50 -0
  81. package/dist/draft18-session.d.ts +50 -0
  82. package/dist/draft18-session.js +8 -0
  83. package/dist/draft18.cjs +179 -0
  84. package/dist/draft18.d.cts +126 -0
  85. package/dist/draft18.d.ts +126 -0
  86. package/dist/draft18.js +179 -0
  87. package/dist/draft19-session.cjs +8 -0
  88. package/dist/draft19-session.d.cts +50 -0
  89. package/dist/draft19-session.d.ts +50 -0
  90. package/dist/draft19-session.js +8 -0
  91. package/dist/draft19.cjs +189 -0
  92. package/dist/draft19.d.cts +130 -0
  93. package/dist/draft19.d.ts +130 -0
  94. package/dist/draft19.js +189 -0
  95. package/dist/index.cjs +13 -1
  96. package/dist/index.d.cts +24 -14
  97. package/dist/index.d.ts +24 -14
  98. package/dist/index.js +13 -1
  99. package/dist/{session-types-X-IYEGoG.d.ts → session-types-C0l_-Ups.d.ts} +1 -1
  100. package/dist/{session-types-C7UONex5.d.cts → session-types-KsqyVp6y.d.cts} +1 -1
  101. package/dist/session.cjs +9 -1
  102. package/dist/session.d.cts +7 -3
  103. package/dist/session.d.ts +7 -3
  104. package/dist/session.js +9 -1
  105. package/dist/{types-DuIO7cWK.d.cts → types-CdCSIfvI.d.cts} +1 -1
  106. package/dist/{types-DuIO7cWK.d.ts → types-CdCSIfvI.d.ts} +1 -1
  107. package/dist/types-Cqp10JtB.d.cts +249 -0
  108. package/dist/types-Cqp10JtB.d.ts +249 -0
  109. package/dist/types-zHgCS6o5.d.cts +265 -0
  110. package/dist/types-zHgCS6o5.d.ts +265 -0
  111. package/package.json +26 -2
  112. package/src/core/types.ts +14 -1
  113. package/src/drafts/draft17/error-codes.ts +72 -0
  114. package/src/drafts/draft18/codec.ts +1310 -0
  115. package/src/drafts/draft18/data-streams.ts +996 -0
  116. package/src/drafts/draft18/error-codes.ts +75 -0
  117. package/src/drafts/draft18/index.ts +122 -0
  118. package/src/drafts/draft18/messages.ts +56 -0
  119. package/src/drafts/draft18/rules.ts +85 -0
  120. package/src/drafts/draft18/session-fsm.ts +451 -0
  121. package/src/drafts/draft18/session.ts +15 -0
  122. package/src/drafts/draft18/types.ts +347 -0
  123. package/src/drafts/draft19/codec.ts +1425 -0
  124. package/src/drafts/draft19/data-streams.ts +996 -0
  125. package/src/drafts/draft19/error-codes.ts +78 -0
  126. package/src/drafts/draft19/index.ts +126 -0
  127. package/src/drafts/draft19/messages.ts +58 -0
  128. package/src/drafts/draft19/rules.ts +85 -0
  129. package/src/drafts/draft19/session-fsm.ts +451 -0
  130. package/src/drafts/draft19/session.ts +15 -0
  131. package/src/drafts/draft19/types.ts +368 -0
  132. package/src/index.ts +17 -1
  133. package/src/session.ts +8 -0
@@ -0,0 +1,368 @@
1
+ // Draft-19 specific message types
2
+
3
+ // Unknown parameter for passthrough
4
+ export interface UnknownParam {
5
+ readonly id: string // e.g. "0x21"
6
+ readonly length: number
7
+ readonly raw_hex: string
8
+ }
9
+
10
+ // Authorization token parameter (nested structure within length-prefixed param)
11
+ export interface AuthorizationToken {
12
+ readonly alias_type: bigint // 0=DELETE, 1=REGISTER, 2=USE_ALIAS, 3=USE_VALUE
13
+ readonly token_alias?: bigint // present for DELETE(0), REGISTER(1), USE_ALIAS(2)
14
+ readonly token_type?: bigint // present for REGISTER(1), USE_VALUE(3)
15
+ readonly token_value?: Uint8Array // present for REGISTER(1), USE_VALUE(3)
16
+ }
17
+
18
+ // Setup options (KVP encoding, no count prefix)
19
+ export interface Draft19SetupOptions {
20
+ path?: string // 0x01 odd
21
+ authorization_token?: AuthorizationToken // 0x03 odd
22
+ max_auth_token_cache_size?: bigint // 0x04 even
23
+ authority?: string // 0x05 odd
24
+ max_filter_ranges?: bigint // 0x06 even (NEW in draft-19)
25
+ moqt_implementation?: string // 0x07 odd
26
+ max_request_updates?: bigint // 0x08 even (NEW in draft-19)
27
+ unknown?: UnknownParam[]
28
+ }
29
+
30
+ // Location filter parameter (renamed from SubscriptionFilter in draft-19)
31
+ export interface LocationFilter {
32
+ readonly filter_type: bigint
33
+ readonly start_group?: bigint
34
+ readonly start_object?: bigint
35
+ readonly end_group?: bigint
36
+ }
37
+
38
+ // Range Filter parameter (NEW in draft-19). Selects Objects/Tracks by integer
39
+ // ranges over Object header fields or Property values.
40
+ export interface RangeFilterRange {
41
+ readonly start: bigint
42
+ readonly end?: bigint // omitted on the final Range = open-ended (no upper bound)
43
+ }
44
+
45
+ export interface RangeFilter {
46
+ readonly set_id?: bigint
47
+ readonly property_type?: bigint // only for OBJECT_PROPERTY_FILTER / TRACK_PROPERTY_FILTER
48
+ readonly ranges?: RangeFilterRange[]
49
+ readonly removed?: boolean // REQUEST_UPDATE length-0 form: remove this filter
50
+ }
51
+
52
+ // Largest object location parameter
53
+ export interface LargestObject {
54
+ readonly group: bigint
55
+ readonly object: bigint
56
+ }
57
+
58
+ // Version-specific parameters (delta-encoded types, count-prefixed)
59
+ export interface Draft19Params {
60
+ object_delivery_timeout?: bigint // 0x02 varint (renamed from delivery_timeout in draft-17)
61
+ authorization_token?: AuthorizationToken // 0x03 length-prefixed nested
62
+ rendezvous_timeout?: bigint // 0x04 varint
63
+ subgroup_delivery_timeout?: bigint // 0x06 varint (NEW in draft-18)
64
+ expires?: bigint // 0x08 varint
65
+ largest_object?: LargestObject // 0x09 Location (2 bare varints)
66
+ fill_timeout?: bigint // 0x0a varint (NEW in draft-18)
67
+ forward?: bigint // 0x10 uint8 (was varint in draft-17)
68
+ subscriber_priority?: bigint // 0x20 uint8
69
+ location_filter?: LocationFilter // 0x21 length-prefixed (renamed from subscription_filter in draft-19)
70
+ group_order?: bigint // 0x22 uint8
71
+ subgroup_filter?: RangeFilter // 0x25 length-prefixed (NEW in draft-19)
72
+ objectid_filter?: RangeFilter // 0x26 length-prefixed (NEW in draft-19)
73
+ priority_filter?: RangeFilter // 0x27 length-prefixed (NEW in draft-19)
74
+ object_property_filter?: RangeFilter // 0x28 length-prefixed (NEW in draft-19)
75
+ track_property_filter?: RangeFilter // 0x29 length-prefixed (NEW in draft-19)
76
+ new_group_request?: bigint // 0x32 varint
77
+ track_namespace_prefix?: string[] // 0x34 Track Namespace encoding (NEW in draft-18)
78
+ unknown?: UnknownParam[]
79
+ }
80
+
81
+ // Track properties (KVP encoding, no count prefix, read until end of payload)
82
+ export interface Draft19TrackProperties {
83
+ object_delivery_timeout?: bigint // 0x02 even varint (renamed from delivery_timeout)
84
+ max_cache_duration?: bigint // 0x04 even varint
85
+ subgroup_delivery_timeout?: bigint // 0x06 even varint (NEW in draft-18)
86
+ immutable_properties?: Uint8Array // 0x0b odd length-prefixed
87
+ default_publisher_priority?: bigint // 0x0e even varint
88
+ default_publisher_group_order?: bigint // 0x22 even varint
89
+ dynamic_groups?: bigint // 0x30 even varint
90
+ unknown?: UnknownParam[]
91
+ }
92
+
93
+ // Draft-19 message type tag union
94
+ export type Draft19MessageType =
95
+ | 'setup'
96
+ | 'subscribe'
97
+ | 'subscribe_ok'
98
+ | 'request_update'
99
+ | 'publish'
100
+ | 'publish_done'
101
+ | 'publish_namespace'
102
+ | 'namespace'
103
+ | 'namespace_done'
104
+ | 'subscribe_namespace'
105
+ | 'subscribe_tracks'
106
+ | 'publish_skipped'
107
+ | 'fetch'
108
+ | 'fetch_ok'
109
+ | 'track_status'
110
+ | 'request_ok'
111
+ | 'request_error'
112
+ | 'goaway'
113
+
114
+ // Base
115
+ export interface Draft19BaseMessage {
116
+ readonly type: Draft19MessageType
117
+ }
118
+
119
+ // Setup — single unified message (0x2F00)
120
+ export interface Draft19Setup extends Draft19BaseMessage {
121
+ readonly type: 'setup'
122
+ readonly options: Draft19SetupOptions
123
+ }
124
+
125
+ // Subscribe — Required Request ID Delta REMOVED in draft-18
126
+ export interface Draft19Subscribe extends Draft19BaseMessage {
127
+ readonly type: 'subscribe'
128
+ readonly request_id: bigint
129
+ readonly track_namespace: string[]
130
+ readonly track_name: string
131
+ readonly parameters: Draft19Params
132
+ }
133
+
134
+ export interface Draft19SubscribeOk extends Draft19BaseMessage {
135
+ readonly type: 'subscribe_ok'
136
+ readonly track_alias: bigint
137
+ readonly parameters: Draft19Params
138
+ readonly track_properties: Draft19TrackProperties
139
+ }
140
+
141
+ export interface Draft19RequestUpdate extends Draft19BaseMessage {
142
+ readonly type: 'request_update'
143
+ readonly request_id: bigint
144
+ readonly parameters: Draft19Params
145
+ }
146
+
147
+ // Publish
148
+ export interface Draft19Publish extends Draft19BaseMessage {
149
+ readonly type: 'publish'
150
+ readonly request_id: bigint
151
+ readonly track_namespace: string[]
152
+ readonly track_name: string
153
+ readonly track_alias: bigint
154
+ readonly parameters: Draft19Params
155
+ readonly track_properties: Draft19TrackProperties
156
+ }
157
+
158
+ export interface Draft19PublishDone extends Draft19BaseMessage {
159
+ readonly type: 'publish_done'
160
+ readonly status_code: bigint
161
+ readonly stream_count: bigint
162
+ readonly reason_phrase: string
163
+ }
164
+
165
+ // Namespace
166
+ export interface Draft19PublishNamespace extends Draft19BaseMessage {
167
+ readonly type: 'publish_namespace'
168
+ readonly request_id: bigint
169
+ readonly track_namespace: string[]
170
+ readonly parameters: Draft19Params
171
+ }
172
+
173
+ export interface Draft19Namespace extends Draft19BaseMessage {
174
+ readonly type: 'namespace'
175
+ readonly namespace_suffix: string[]
176
+ }
177
+
178
+ export interface Draft19NamespaceDone extends Draft19BaseMessage {
179
+ readonly type: 'namespace_done'
180
+ readonly namespace_suffix: string[]
181
+ }
182
+
183
+ // SUBSCRIBE_NAMESPACE — type 0x50, subscribe_options field removed in draft-18
184
+ export interface Draft19SubscribeNamespace extends Draft19BaseMessage {
185
+ readonly type: 'subscribe_namespace'
186
+ readonly request_id: bigint
187
+ readonly namespace_prefix: string[]
188
+ readonly parameters: Draft19Params
189
+ }
190
+
191
+ // SUBSCRIBE_TRACKS — NEW in draft-18, type 0x51
192
+ export interface Draft19SubscribeTracks extends Draft19BaseMessage {
193
+ readonly type: 'subscribe_tracks'
194
+ readonly request_id: bigint
195
+ readonly namespace_prefix: string[]
196
+ readonly parameters: Draft19Params
197
+ }
198
+
199
+ export interface Draft19PublishSkipped extends Draft19BaseMessage {
200
+ readonly type: 'publish_skipped'
201
+ readonly namespace_suffix: string[]
202
+ readonly track_name: string
203
+ }
204
+
205
+ // Fetch
206
+ export interface StandaloneFetch {
207
+ readonly track_namespace: string[]
208
+ readonly track_name: string
209
+ readonly start_group: bigint
210
+ readonly start_object: bigint
211
+ readonly end_group: bigint
212
+ readonly end_object: bigint
213
+ }
214
+
215
+ export interface JoiningFetch {
216
+ readonly joining_request_id: bigint
217
+ readonly joining_start: bigint
218
+ }
219
+
220
+ export interface Draft19Fetch extends Draft19BaseMessage {
221
+ readonly type: 'fetch'
222
+ readonly request_id: bigint
223
+ readonly fetch_type: bigint
224
+ readonly standalone?: StandaloneFetch
225
+ readonly joining?: JoiningFetch
226
+ readonly parameters: Draft19Params
227
+ }
228
+
229
+ export interface Draft19FetchOk extends Draft19BaseMessage {
230
+ readonly type: 'fetch_ok'
231
+ readonly end_of_track: number // uint8
232
+ readonly end_group: bigint
233
+ readonly end_object: bigint
234
+ readonly parameters: Draft19Params
235
+ readonly track_properties: Draft19TrackProperties
236
+ }
237
+
238
+ // Track Status — same format as subscribe in draft-18 (without required_request_id_delta)
239
+ export interface Draft19TrackStatus extends Draft19BaseMessage {
240
+ readonly type: 'track_status'
241
+ readonly request_id: bigint
242
+ readonly track_namespace: string[]
243
+ readonly track_name: string
244
+ readonly parameters: Draft19Params
245
+ }
246
+
247
+ // REQUEST_OK — gained trailing Track Properties in draft-18
248
+ export interface Draft19RequestOk extends Draft19BaseMessage {
249
+ readonly type: 'request_ok'
250
+ readonly parameters: Draft19Params
251
+ readonly track_properties: Draft19TrackProperties
252
+ }
253
+
254
+ // Redirect structure (used inside REQUEST_ERROR when error_code = REDIRECT 0x34)
255
+ export interface Redirect {
256
+ readonly connect_uri: string
257
+ readonly track_namespace: string[]
258
+ readonly track_name: string
259
+ }
260
+
261
+ export interface Draft19RequestError extends Draft19BaseMessage {
262
+ readonly type: 'request_error'
263
+ readonly error_code: bigint
264
+ readonly retry_interval: bigint
265
+ readonly reason_phrase: string
266
+ readonly redirect?: Redirect
267
+ }
268
+
269
+ // Session Control
270
+ export interface Draft19GoAway extends Draft19BaseMessage {
271
+ readonly type: 'goaway'
272
+ readonly new_session_uri: string
273
+ readonly timeout: bigint
274
+ // Request ID removed from GOAWAY in draft-19 — control and request streams share one format
275
+ }
276
+
277
+ // Union of all draft-18 control messages
278
+ export type Draft19Message =
279
+ | Draft19Setup
280
+ | Draft19Subscribe
281
+ | Draft19SubscribeOk
282
+ | Draft19RequestUpdate
283
+ | Draft19Publish
284
+ | Draft19PublishDone
285
+ | Draft19PublishNamespace
286
+ | Draft19Namespace
287
+ | Draft19NamespaceDone
288
+ | Draft19SubscribeNamespace
289
+ | Draft19SubscribeTracks
290
+ | Draft19PublishSkipped
291
+ | Draft19Fetch
292
+ | Draft19FetchOk
293
+ | Draft19TrackStatus
294
+ | Draft19RequestOk
295
+ | Draft19RequestError
296
+ | Draft19GoAway
297
+
298
+ // Data stream types
299
+ export interface ObjectPayload {
300
+ readonly type: 'object'
301
+ readonly byteOffset: number
302
+ readonly payloadByteOffset: number
303
+ readonly objectId: bigint
304
+ readonly payloadLength: number
305
+ readonly status?: bigint
306
+ readonly extensionData: Uint8Array
307
+ readonly objectProperties?: Record<string, bigint>
308
+ readonly payload: Uint8Array
309
+ }
310
+
311
+ export interface SubgroupStream {
312
+ readonly type: 'subgroup'
313
+ readonly headerType: number
314
+ readonly trackAlias: bigint
315
+ readonly groupId: bigint
316
+ readonly subgroupId: bigint
317
+ readonly publisherPriority: number
318
+ readonly endOfGroup?: boolean
319
+ readonly firstObject?: boolean
320
+ readonly objects: ObjectPayload[]
321
+ }
322
+
323
+ export interface DatagramObject {
324
+ readonly type: 'datagram'
325
+ readonly datagramType: number
326
+ readonly trackAlias: bigint
327
+ readonly groupId: bigint
328
+ readonly objectId: bigint
329
+ readonly publisherPriority: number
330
+ readonly endOfGroup?: boolean
331
+ readonly objectStatus?: bigint
332
+ readonly objectProperties?: Record<string, bigint>
333
+ readonly payloadLength: number
334
+ readonly payload: Uint8Array
335
+ }
336
+
337
+ export interface FetchObjectPayload extends ObjectPayload {
338
+ readonly serializationFlags: number
339
+ readonly groupId: bigint
340
+ readonly subgroupId: bigint
341
+ readonly publisherPriority: number
342
+ readonly objectProperties?: Record<string, bigint>
343
+ }
344
+
345
+ export interface FetchStream {
346
+ readonly type: 'fetch'
347
+ readonly requestId: bigint
348
+ readonly objects: FetchObjectPayload[]
349
+ }
350
+
351
+ export type Draft19DataStream = SubgroupStream | DatagramObject | FetchStream
352
+
353
+ // Streaming data stream decoder types
354
+ export interface SubgroupStreamHeader {
355
+ readonly type: 'subgroup_header'
356
+ readonly trackAlias: bigint
357
+ readonly groupId: bigint
358
+ readonly subgroupId: bigint
359
+ readonly publisherPriority: number
360
+ }
361
+
362
+ export interface FetchStreamHeader {
363
+ readonly type: 'fetch_header'
364
+ readonly requestId: bigint
365
+ }
366
+
367
+ export type DataStreamHeader = SubgroupStreamHeader | FetchStreamHeader
368
+ export type DataStreamEvent = DataStreamHeader | ObjectPayload
package/src/index.ts CHANGED
@@ -34,6 +34,10 @@ import type { Draft16Codec } from './drafts/draft16/codec.js'
34
34
  import { createDraft16Codec } from './drafts/draft16/codec.js'
35
35
  import type { Draft17Codec } from './drafts/draft17/codec.js'
36
36
  import { createDraft17Codec } from './drafts/draft17/codec.js'
37
+ import type { Draft18Codec } from './drafts/draft18/codec.js'
38
+ import { createDraft18Codec } from './drafts/draft18/codec.js'
39
+ import type { Draft19Codec } from './drafts/draft19/codec.js'
40
+ import { createDraft19Codec } from './drafts/draft19/codec.js'
37
41
 
38
42
  /**
39
43
  * Wire version numbers for each MoQT draft, keyed by short aliases.
@@ -50,6 +54,8 @@ export const DRAFT_VERSIONS: Record<string, bigint> = {
50
54
  '15': 0xff00000fn,
51
55
  '16': 0xff000010n,
52
56
  '17': 0xff000011n,
57
+ '18': 0xff000012n,
58
+ '19': 0xff000013n,
53
59
  }
54
60
 
55
61
  export function createCodec(options: CodecOptions & { draft: '07' }): Draft07Codec
@@ -63,6 +69,8 @@ export function createCodec(options: CodecOptions & { draft: '14' }): Draft14Cod
63
69
  export function createCodec(options: CodecOptions & { draft: '15' }): Draft15Codec
64
70
  export function createCodec(options: CodecOptions & { draft: '16' }): Draft16Codec
65
71
  export function createCodec(options: CodecOptions & { draft: '17' }): Draft17Codec
72
+ export function createCodec(options: CodecOptions & { draft: '18' }): Draft18Codec
73
+ export function createCodec(options: CodecOptions & { draft: '19' }): Draft19Codec
66
74
 
67
75
  /**
68
76
  * Create a codec for the specified draft version.
@@ -84,6 +92,8 @@ export function createCodec(
84
92
  | Draft15Codec
85
93
  | Draft16Codec
86
94
  | Draft17Codec
95
+ | Draft18Codec
96
+ | Draft19Codec
87
97
  export function createCodec(
88
98
  options: CodecOptions,
89
99
  ):
@@ -97,7 +107,9 @@ export function createCodec(
97
107
  | Draft14Codec
98
108
  | Draft15Codec
99
109
  | Draft16Codec
100
- | Draft17Codec {
110
+ | Draft17Codec
111
+ | Draft18Codec
112
+ | Draft19Codec {
101
113
  const draft = DRAFT_VERSIONS[options.draft]
102
114
  if (!draft) {
103
115
  throw new Error(
@@ -130,6 +142,10 @@ export function createCodec(
130
142
  return createDraft16Codec()
131
143
  case '17':
132
144
  return createDraft17Codec()
145
+ case '18':
146
+ return createDraft18Codec()
147
+ case '19':
148
+ return createDraft19Codec()
133
149
  default:
134
150
  throw new Error(`Unsupported draft: ${draft}`)
135
151
  }
package/src/session.ts CHANGED
@@ -30,6 +30,10 @@ import { createDraft16SessionState } from './drafts/draft16/session.js'
30
30
  import type { Draft16Message, Draft16MessageType } from './drafts/draft16/types.js'
31
31
  import { createDraft17SessionState } from './drafts/draft17/session.js'
32
32
  import type { Draft17Message, Draft17MessageType } from './drafts/draft17/types.js'
33
+ import { createDraft18SessionState } from './drafts/draft18/session.js'
34
+ import type { Draft18Message, Draft18MessageType } from './drafts/draft18/types.js'
35
+ import { createDraft19SessionState } from './drafts/draft19/session.js'
36
+ import type { Draft19Message, Draft19MessageType } from './drafts/draft19/types.js'
33
37
 
34
38
  type DraftSessionStateMap = {
35
39
  '07': SessionState<Draft07Message, Draft07MessageType>
@@ -43,6 +47,8 @@ type DraftSessionStateMap = {
43
47
  '15': SessionState<Draft15Message, Draft15MessageType>
44
48
  '16': SessionState<Draft16Message, Draft16MessageType>
45
49
  '17': SessionState<Draft17Message, Draft17MessageType>
50
+ '18': SessionState<Draft18Message, Draft18MessageType>
51
+ '19': SessionState<Draft19Message, Draft19MessageType>
46
52
  }
47
53
 
48
54
  /**
@@ -65,6 +71,8 @@ export function createSessionState<T extends Draft>(
65
71
  '15': createDraft15SessionState,
66
72
  '16': createDraft16SessionState,
67
73
  '17': createDraft17SessionState,
74
+ '18': createDraft18SessionState,
75
+ '19': createDraft19SessionState,
68
76
  }
69
77
 
70
78
  const factory = factories[draft]