@moqtap/codec 0.1.0 → 0.1.1

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 (67) hide show
  1. package/dist/{chunk-YBSEOSSP.js → chunk-A27S7HW7.js} +5 -1
  2. package/dist/{chunk-5WFXFLL4.cjs → chunk-FUFTMAQD.cjs} +96 -63
  3. package/dist/{chunk-2NARXGVA.cjs → chunk-FWISIR26.cjs} +5 -1
  4. package/dist/{chunk-23YG7F46.js → chunk-IXHOBNXA.js} +117 -17
  5. package/dist/{chunk-3BSZ55L3.cjs → chunk-NLYTRGXA.cjs} +153 -19
  6. package/dist/{chunk-GDRGWFEK.cjs → chunk-NPWHHWXT.cjs} +249 -37
  7. package/dist/{chunk-IQPDRQVC.js → chunk-U2B3B42P.js} +62 -29
  8. package/dist/{chunk-WNTXF3DE.cjs → chunk-YBZD3DU5.cjs} +127 -27
  9. package/dist/{chunk-DC4L6ZIT.js → chunk-YTXLWKOR.js} +153 -19
  10. package/dist/{chunk-YPXLV5YK.js → chunk-Z66WDWHI.js} +249 -37
  11. package/dist/{codec-qPzfmLNu.d.ts → codec-B2mc2g3i.d.ts} +5 -5
  12. package/dist/{codec-CTvFtQQI.d.cts → codec-Bvr7rFtj.d.cts} +5 -5
  13. package/dist/draft14-session.cjs +2 -2
  14. package/dist/draft14-session.d.cts +4 -4
  15. package/dist/draft14-session.d.ts +4 -4
  16. package/dist/draft14-session.js +1 -1
  17. package/dist/draft14.cjs +4 -4
  18. package/dist/draft14.d.cts +15 -15
  19. package/dist/draft14.d.ts +15 -15
  20. package/dist/draft14.js +3 -3
  21. package/dist/draft7-session.cjs +2 -2
  22. package/dist/draft7-session.d.cts +3 -3
  23. package/dist/draft7-session.d.ts +3 -3
  24. package/dist/draft7-session.js +1 -1
  25. package/dist/draft7.cjs +5 -5
  26. package/dist/draft7.d.cts +10 -10
  27. package/dist/draft7.d.ts +10 -10
  28. package/dist/draft7.js +2 -2
  29. package/dist/index.cjs +6 -6
  30. package/dist/index.d.cts +6 -6
  31. package/dist/index.d.ts +6 -6
  32. package/dist/index.js +3 -3
  33. package/dist/{session-types-B9NIf7_F.d.ts → session-types-DFjMk4HH.d.ts} +20 -20
  34. package/dist/{session-types-CCo-oA-d.d.cts → session-types-DW1RSZX_.d.cts} +20 -20
  35. package/dist/session.cjs +4 -4
  36. package/dist/session.d.cts +3 -3
  37. package/dist/session.d.ts +3 -3
  38. package/dist/session.js +2 -2
  39. package/dist/{types-CIk5W10V.d.ts → types-BTFeKYCb.d.cts} +37 -37
  40. package/dist/{types-CIk5W10V.d.cts → types-BTFeKYCb.d.ts} +37 -37
  41. package/dist/{types-ClXELFGN.d.cts → types-DPYE49t0.d.cts} +36 -36
  42. package/dist/{types-ClXELFGN.d.ts → types-DPYE49t0.d.ts} +36 -36
  43. package/package.json +7 -7
  44. package/src/core/buffer-reader.ts +16 -9
  45. package/src/core/buffer-writer.ts +2 -2
  46. package/src/core/errors.ts +1 -1
  47. package/src/core/session-types.ts +28 -41
  48. package/src/core/types.ts +70 -70
  49. package/src/drafts/draft07/announce-fsm.ts +1 -1
  50. package/src/drafts/draft07/codec.ts +195 -86
  51. package/src/drafts/draft07/index.ts +43 -44
  52. package/src/drafts/draft07/messages.ts +1 -1
  53. package/src/drafts/draft07/parameters.ts +2 -2
  54. package/src/drafts/draft07/rules.ts +68 -37
  55. package/src/drafts/draft07/session-fsm.ts +330 -117
  56. package/src/drafts/draft07/session.ts +10 -10
  57. package/src/drafts/draft07/subscription-fsm.ts +1 -1
  58. package/src/drafts/draft07/varint.ts +4 -4
  59. package/src/drafts/draft14/codec.ts +339 -189
  60. package/src/drafts/draft14/index.ts +103 -108
  61. package/src/drafts/draft14/messages.ts +61 -61
  62. package/src/drafts/draft14/rules.ts +77 -34
  63. package/src/drafts/draft14/session-fsm.ts +458 -146
  64. package/src/drafts/draft14/session.ts +13 -13
  65. package/src/drafts/draft14/types.ts +68 -68
  66. package/src/index.ts +66 -31
  67. package/src/session.ts +20 -20
@@ -1,6 +1,6 @@
1
- import type { Draft14Message, Draft14MessageType } from './types.js';
2
- import type { SessionState, SessionStateOptions } from '../../core/session-types.js';
3
- import { Draft14SessionFSM } from './session-fsm.js';
1
+ import type { SessionState, SessionStateOptions } from "../../core/session-types.js";
2
+ import { Draft14SessionFSM } from "./session-fsm.js";
3
+ import type { Draft14Message, Draft14MessageType } from "./types.js";
4
4
 
5
5
  export function createDraft14SessionState(
6
6
  options: SessionStateOptions,
@@ -9,18 +9,18 @@ export function createDraft14SessionState(
9
9
  }
10
10
 
11
11
  export type {
12
+ FetchPhase,
13
+ FetchState,
14
+ ProtocolViolation,
15
+ ProtocolViolationCode,
16
+ PublishPhase,
17
+ PublishState,
18
+ SessionPhase,
12
19
  SessionState,
13
20
  SessionStateOptions,
14
- SessionPhase,
15
- SubscriptionState,
21
+ SideEffect,
16
22
  SubscriptionPhase,
17
- PublishState,
18
- PublishPhase,
19
- FetchState,
20
- FetchPhase,
23
+ SubscriptionState,
21
24
  TransitionResult,
22
25
  ValidationResult,
23
- ProtocolViolation,
24
- ProtocolViolationCode,
25
- SideEffect,
26
- } from '../../core/session-types.js';
26
+ } from "../../core/session-types.js";
@@ -3,9 +3,9 @@
3
3
 
4
4
  // Parameter types for draft-14
5
5
  export interface UnknownParam {
6
- readonly id: string; // e.g. "0x21"
6
+ readonly id: string; // e.g. "0x21"
7
7
  readonly length: number;
8
- readonly raw_hex: string; // e.g. "deadbeef"
8
+ readonly raw_hex: string; // e.g. "deadbeef"
9
9
  }
10
10
 
11
11
  export interface Draft14Params {
@@ -17,36 +17,36 @@ export interface Draft14Params {
17
17
 
18
18
  // Draft-14 message type tag union
19
19
  export type Draft14MessageType =
20
- | 'client_setup'
21
- | 'server_setup'
22
- | 'subscribe'
23
- | 'subscribe_ok'
24
- | 'subscribe_update'
25
- | 'subscribe_error'
26
- | 'unsubscribe'
27
- | 'publish'
28
- | 'publish_ok'
29
- | 'publish_error'
30
- | 'publish_done'
31
- | 'publish_namespace'
32
- | 'publish_namespace_ok'
33
- | 'publish_namespace_error'
34
- | 'publish_namespace_done'
35
- | 'publish_namespace_cancel'
36
- | 'subscribe_namespace'
37
- | 'subscribe_namespace_ok'
38
- | 'subscribe_namespace_error'
39
- | 'unsubscribe_namespace'
40
- | 'fetch'
41
- | 'fetch_ok'
42
- | 'fetch_error'
43
- | 'fetch_cancel'
44
- | 'track_status'
45
- | 'track_status_ok'
46
- | 'track_status_error'
47
- | 'goaway'
48
- | 'max_request_id'
49
- | 'requests_blocked';
20
+ | "client_setup"
21
+ | "server_setup"
22
+ | "subscribe"
23
+ | "subscribe_ok"
24
+ | "subscribe_update"
25
+ | "subscribe_error"
26
+ | "unsubscribe"
27
+ | "publish"
28
+ | "publish_ok"
29
+ | "publish_error"
30
+ | "publish_done"
31
+ | "publish_namespace"
32
+ | "publish_namespace_ok"
33
+ | "publish_namespace_error"
34
+ | "publish_namespace_done"
35
+ | "publish_namespace_cancel"
36
+ | "subscribe_namespace"
37
+ | "subscribe_namespace_ok"
38
+ | "subscribe_namespace_error"
39
+ | "unsubscribe_namespace"
40
+ | "fetch"
41
+ | "fetch_ok"
42
+ | "fetch_error"
43
+ | "fetch_cancel"
44
+ | "track_status"
45
+ | "track_status_ok"
46
+ | "track_status_error"
47
+ | "goaway"
48
+ | "max_request_id"
49
+ | "requests_blocked";
50
50
 
51
51
  // Base
52
52
  export interface Draft14BaseMessage {
@@ -55,20 +55,20 @@ export interface Draft14BaseMessage {
55
55
 
56
56
  // Setup
57
57
  export interface Draft14ClientSetup extends Draft14BaseMessage {
58
- readonly type: 'client_setup';
58
+ readonly type: "client_setup";
59
59
  readonly supported_versions: bigint[];
60
60
  readonly parameters: Draft14Params;
61
61
  }
62
62
 
63
63
  export interface Draft14ServerSetup extends Draft14BaseMessage {
64
- readonly type: 'server_setup';
64
+ readonly type: "server_setup";
65
65
  readonly selected_version: bigint;
66
66
  readonly parameters: Draft14Params;
67
67
  }
68
68
 
69
69
  // Subscribe
70
70
  export interface Draft14Subscribe extends Draft14BaseMessage {
71
- readonly type: 'subscribe';
71
+ readonly type: "subscribe";
72
72
  readonly request_id: bigint;
73
73
  readonly track_namespace: string[];
74
74
  readonly track_name: string;
@@ -83,7 +83,7 @@ export interface Draft14Subscribe extends Draft14BaseMessage {
83
83
  }
84
84
 
85
85
  export interface Draft14SubscribeOk extends Draft14BaseMessage {
86
- readonly type: 'subscribe_ok';
86
+ readonly type: "subscribe_ok";
87
87
  readonly request_id: bigint;
88
88
  readonly track_alias: bigint;
89
89
  readonly expires: bigint;
@@ -95,7 +95,7 @@ export interface Draft14SubscribeOk extends Draft14BaseMessage {
95
95
  }
96
96
 
97
97
  export interface Draft14SubscribeUpdate extends Draft14BaseMessage {
98
- readonly type: 'subscribe_update';
98
+ readonly type: "subscribe_update";
99
99
  readonly request_id: bigint;
100
100
  readonly start_group: bigint;
101
101
  readonly start_object: bigint;
@@ -106,20 +106,20 @@ export interface Draft14SubscribeUpdate extends Draft14BaseMessage {
106
106
  }
107
107
 
108
108
  export interface Draft14SubscribeError extends Draft14BaseMessage {
109
- readonly type: 'subscribe_error';
109
+ readonly type: "subscribe_error";
110
110
  readonly request_id: bigint;
111
111
  readonly error_code: bigint;
112
112
  readonly reason_phrase: string;
113
113
  }
114
114
 
115
115
  export interface Draft14Unsubscribe extends Draft14BaseMessage {
116
- readonly type: 'unsubscribe';
116
+ readonly type: "unsubscribe";
117
117
  readonly request_id: bigint;
118
118
  }
119
119
 
120
120
  // Publish
121
121
  export interface Draft14Publish extends Draft14BaseMessage {
122
- readonly type: 'publish';
122
+ readonly type: "publish";
123
123
  readonly request_id: bigint;
124
124
  readonly track_namespace: string[];
125
125
  readonly track_name: string;
@@ -128,7 +128,7 @@ export interface Draft14Publish extends Draft14BaseMessage {
128
128
  }
129
129
 
130
130
  export interface Draft14PublishOk extends Draft14BaseMessage {
131
- readonly type: 'publish_ok';
131
+ readonly type: "publish_ok";
132
132
  readonly request_id: bigint;
133
133
  readonly track_alias: bigint;
134
134
  readonly forward: bigint;
@@ -136,14 +136,14 @@ export interface Draft14PublishOk extends Draft14BaseMessage {
136
136
  }
137
137
 
138
138
  export interface Draft14PublishError extends Draft14BaseMessage {
139
- readonly type: 'publish_error';
139
+ readonly type: "publish_error";
140
140
  readonly request_id: bigint;
141
141
  readonly error_code: bigint;
142
142
  readonly reason_phrase: string;
143
143
  }
144
144
 
145
145
  export interface Draft14PublishDone extends Draft14BaseMessage {
146
- readonly type: 'publish_done';
146
+ readonly type: "publish_done";
147
147
  readonly request_id: bigint;
148
148
  readonly status_code: bigint;
149
149
  readonly reason_phrase: string;
@@ -151,65 +151,65 @@ export interface Draft14PublishDone extends Draft14BaseMessage {
151
151
 
152
152
  // Namespace
153
153
  export interface Draft14PublishNamespace extends Draft14BaseMessage {
154
- readonly type: 'publish_namespace';
154
+ readonly type: "publish_namespace";
155
155
  readonly request_id: bigint;
156
156
  readonly track_namespace: string[];
157
157
  readonly parameters: Draft14Params;
158
158
  }
159
159
 
160
160
  export interface Draft14PublishNamespaceOk extends Draft14BaseMessage {
161
- readonly type: 'publish_namespace_ok';
161
+ readonly type: "publish_namespace_ok";
162
162
  readonly request_id: bigint;
163
163
  readonly parameters: Draft14Params;
164
164
  }
165
165
 
166
166
  export interface Draft14PublishNamespaceError extends Draft14BaseMessage {
167
- readonly type: 'publish_namespace_error';
167
+ readonly type: "publish_namespace_error";
168
168
  readonly request_id: bigint;
169
169
  readonly error_code: bigint;
170
170
  readonly reason_phrase: string;
171
171
  }
172
172
 
173
173
  export interface Draft14PublishNamespaceDone extends Draft14BaseMessage {
174
- readonly type: 'publish_namespace_done';
174
+ readonly type: "publish_namespace_done";
175
175
  readonly request_id: bigint;
176
176
  readonly status_code: bigint;
177
177
  readonly reason_phrase: string;
178
178
  }
179
179
 
180
180
  export interface Draft14PublishNamespaceCancel extends Draft14BaseMessage {
181
- readonly type: 'publish_namespace_cancel';
181
+ readonly type: "publish_namespace_cancel";
182
182
  readonly request_id: bigint;
183
183
  }
184
184
 
185
185
  export interface Draft14SubscribeNamespace extends Draft14BaseMessage {
186
- readonly type: 'subscribe_namespace';
186
+ readonly type: "subscribe_namespace";
187
187
  readonly request_id: bigint;
188
188
  readonly namespace_prefix: string[];
189
189
  readonly parameters: Draft14Params;
190
190
  }
191
191
 
192
192
  export interface Draft14SubscribeNamespaceOk extends Draft14BaseMessage {
193
- readonly type: 'subscribe_namespace_ok';
193
+ readonly type: "subscribe_namespace_ok";
194
194
  readonly request_id: bigint;
195
195
  readonly parameters: Draft14Params;
196
196
  }
197
197
 
198
198
  export interface Draft14SubscribeNamespaceError extends Draft14BaseMessage {
199
- readonly type: 'subscribe_namespace_error';
199
+ readonly type: "subscribe_namespace_error";
200
200
  readonly request_id: bigint;
201
201
  readonly error_code: bigint;
202
202
  readonly reason_phrase: string;
203
203
  }
204
204
 
205
205
  export interface Draft14UnsubscribeNamespace extends Draft14BaseMessage {
206
- readonly type: 'unsubscribe_namespace';
206
+ readonly type: "unsubscribe_namespace";
207
207
  readonly request_id: bigint;
208
208
  }
209
209
 
210
210
  // Fetch
211
211
  export interface Draft14Fetch extends Draft14BaseMessage {
212
- readonly type: 'fetch';
212
+ readonly type: "fetch";
213
213
  readonly request_id: bigint;
214
214
  readonly track_namespace: string[];
215
215
  readonly track_name: string;
@@ -220,7 +220,7 @@ export interface Draft14Fetch extends Draft14BaseMessage {
220
220
  }
221
221
 
222
222
  export interface Draft14FetchOk extends Draft14BaseMessage {
223
- readonly type: 'fetch_ok';
223
+ readonly type: "fetch_ok";
224
224
  readonly request_id: bigint;
225
225
  readonly track_alias: bigint;
226
226
  readonly end_of_track: bigint;
@@ -228,20 +228,20 @@ export interface Draft14FetchOk extends Draft14BaseMessage {
228
228
  }
229
229
 
230
230
  export interface Draft14FetchError extends Draft14BaseMessage {
231
- readonly type: 'fetch_error';
231
+ readonly type: "fetch_error";
232
232
  readonly request_id: bigint;
233
233
  readonly error_code: bigint;
234
234
  readonly reason_phrase: string;
235
235
  }
236
236
 
237
237
  export interface Draft14FetchCancel extends Draft14BaseMessage {
238
- readonly type: 'fetch_cancel';
238
+ readonly type: "fetch_cancel";
239
239
  readonly request_id: bigint;
240
240
  }
241
241
 
242
242
  // Track Status
243
243
  export interface Draft14TrackStatus extends Draft14BaseMessage {
244
- readonly type: 'track_status';
244
+ readonly type: "track_status";
245
245
  readonly request_id: bigint;
246
246
  readonly track_namespace: string[];
247
247
  readonly track_name: string;
@@ -249,7 +249,7 @@ export interface Draft14TrackStatus extends Draft14BaseMessage {
249
249
  }
250
250
 
251
251
  export interface Draft14TrackStatusOk extends Draft14BaseMessage {
252
- readonly type: 'track_status_ok';
252
+ readonly type: "track_status_ok";
253
253
  readonly request_id: bigint;
254
254
  readonly status_code: bigint;
255
255
  readonly largest_group?: bigint;
@@ -258,7 +258,7 @@ export interface Draft14TrackStatusOk extends Draft14BaseMessage {
258
258
  }
259
259
 
260
260
  export interface Draft14TrackStatusError extends Draft14BaseMessage {
261
- readonly type: 'track_status_error';
261
+ readonly type: "track_status_error";
262
262
  readonly request_id: bigint;
263
263
  readonly error_code: bigint;
264
264
  readonly reason_phrase: string;
@@ -266,17 +266,17 @@ export interface Draft14TrackStatusError extends Draft14BaseMessage {
266
266
 
267
267
  // Session Control
268
268
  export interface Draft14GoAway extends Draft14BaseMessage {
269
- readonly type: 'goaway';
269
+ readonly type: "goaway";
270
270
  readonly new_session_uri: string;
271
271
  }
272
272
 
273
273
  export interface Draft14MaxRequestId extends Draft14BaseMessage {
274
- readonly type: 'max_request_id';
274
+ readonly type: "max_request_id";
275
275
  readonly request_id: bigint;
276
276
  }
277
277
 
278
278
  export interface Draft14RequestsBlocked extends Draft14BaseMessage {
279
- readonly type: 'requests_blocked';
279
+ readonly type: "requests_blocked";
280
280
  readonly request_id: bigint;
281
281
  }
282
282
 
@@ -315,14 +315,14 @@ export type Draft14Message =
315
315
 
316
316
  // Data stream types (no type+length wrapper)
317
317
  export interface ObjectPayload {
318
- readonly type: 'object';
318
+ readonly type: "object";
319
319
  readonly objectId: bigint;
320
320
  readonly payloadLength: number;
321
321
  readonly payload: Uint8Array;
322
322
  }
323
323
 
324
324
  export interface SubgroupStream {
325
- readonly type: 'subgroup';
325
+ readonly type: "subgroup";
326
326
  readonly trackAlias: bigint;
327
327
  readonly groupId: bigint;
328
328
  readonly subgroupId: bigint;
@@ -331,7 +331,7 @@ export interface SubgroupStream {
331
331
  }
332
332
 
333
333
  export interface DatagramObject {
334
- readonly type: 'datagram';
334
+ readonly type: "datagram";
335
335
  readonly trackAlias: bigint;
336
336
  readonly groupId: bigint;
337
337
  readonly objectId: bigint;
@@ -340,7 +340,7 @@ export interface DatagramObject {
340
340
  }
341
341
 
342
342
  export interface FetchStream {
343
- readonly type: 'fetch';
343
+ readonly type: "fetch";
344
344
  readonly subscribeRequestId: bigint;
345
345
  readonly objects: ObjectPayload[];
346
346
  }
@@ -349,7 +349,7 @@ export type Draft14DataStream = SubgroupStream | DatagramObject | FetchStream;
349
349
 
350
350
  // Streaming data stream decoder types
351
351
  export interface SubgroupStreamHeader {
352
- readonly type: 'subgroup_header';
352
+ readonly type: "subgroup_header";
353
353
  readonly trackAlias: bigint;
354
354
  readonly groupId: bigint;
355
355
  readonly subgroupId: bigint;
@@ -357,7 +357,7 @@ export interface SubgroupStreamHeader {
357
357
  }
358
358
 
359
359
  export interface FetchStreamHeader {
360
- readonly type: 'fetch_header';
360
+ readonly type: "fetch_header";
361
361
  readonly subscribeRequestId: bigint;
362
362
  }
363
363
 
package/src/index.ts CHANGED
@@ -12,26 +12,30 @@
12
12
  * specification reaches RFC status. Until then, always specify a draft.
13
13
  */
14
14
 
15
- import type { Codec, BaseCodec, CodecOptions, Draft } from './core/types.js';
16
- import { createDraft07Codec } from './drafts/draft07/codec.js';
17
- import { createDraft14Codec } from './drafts/draft14/codec.js';
18
- import type { Draft14Codec } from './drafts/draft14/codec.js';
15
+ import type { Codec, CodecOptions, Draft } from "./core/types.js";
16
+ import { createDraft07Codec } from "./drafts/draft07/codec.js";
17
+ import type { Draft14Codec } from "./drafts/draft14/codec.js";
18
+ import { createDraft14Codec } from "./drafts/draft14/codec.js";
19
19
 
20
20
  const DRAFT_ALIASES: Record<string, Draft> = {
21
- '07': 'draft-ietf-moq-transport-07',
22
- 'draft-ietf-moq-transport-07': 'draft-ietf-moq-transport-07',
23
- '14': 'draft-ietf-moq-transport-14',
24
- 'draft-ietf-moq-transport-14': 'draft-ietf-moq-transport-14',
21
+ "07": "draft-ietf-moq-transport-07",
22
+ "draft-ietf-moq-transport-07": "draft-ietf-moq-transport-07",
23
+ "14": "draft-ietf-moq-transport-14",
24
+ "draft-ietf-moq-transport-14": "draft-ietf-moq-transport-14",
25
25
  };
26
26
 
27
27
  /**
28
28
  * Create a codec for draft-07 (returns full Codec with stream decoder).
29
29
  */
30
- export function createCodec(options: CodecOptions & { draft: 'draft-ietf-moq-transport-07' | '07' }): Codec;
30
+ export function createCodec(
31
+ options: CodecOptions & { draft: "draft-ietf-moq-transport-07" | "07" },
32
+ ): Codec;
31
33
  /**
32
34
  * Create a codec for draft-14 (returns Draft14Codec with data stream support).
33
35
  */
34
- export function createCodec(options: CodecOptions & { draft: 'draft-ietf-moq-transport-14' | '14' }): Draft14Codec;
36
+ export function createCodec(
37
+ options: CodecOptions & { draft: "draft-ietf-moq-transport-14" | "14" },
38
+ ): Draft14Codec;
35
39
  /**
36
40
  * Create a codec for the specified draft version.
37
41
  *
@@ -44,17 +48,17 @@ export function createCodec(options: CodecOptions): Codec | Draft14Codec {
44
48
  if (!draft) {
45
49
  throw new Error(
46
50
  `Unsupported draft: "${options.draft}". ` +
47
- `Use a draft-scoped import instead:\n` +
48
- ` import { createDraft07Codec } from '@moqtap/codec/draft7'\n` +
49
- ` import { createDraft14Codec } from '@moqtap/codec/draft14'\n` +
50
- `Supported draft values: ${Object.keys(DRAFT_ALIASES).join(', ')}`,
51
+ `Use a draft-scoped import instead:\n` +
52
+ ` import { createDraft07Codec } from '@moqtap/codec/draft7'\n` +
53
+ ` import { createDraft14Codec } from '@moqtap/codec/draft14'\n` +
54
+ `Supported draft values: ${Object.keys(DRAFT_ALIASES).join(", ")}`,
51
55
  );
52
56
  }
53
57
 
54
58
  switch (draft) {
55
- case 'draft-ietf-moq-transport-07':
59
+ case "draft-ietf-moq-transport-07":
56
60
  return createDraft07Codec();
57
- case 'draft-ietf-moq-transport-14':
61
+ case "draft-ietf-moq-transport-14":
58
62
  return createDraft14Codec();
59
63
  default:
60
64
  throw new Error(`Unsupported draft: ${draft}`);
@@ -63,23 +67,54 @@ export function createCodec(options: CodecOptions): Codec | Draft14Codec {
63
67
 
64
68
  // Re-export shared types
65
69
  export type {
66
- Codec, BaseCodec, CodecOptions, Draft, DraftShorthand,
67
- MoqtMessage, MoqtMessageType, DecodeResult, DecodeErrorCode,
68
- ClientSetup, ServerSetup, Subscribe, SubscribeOk, SubscribeError,
69
- SubscribeDone, SubscribeUpdate, Unsubscribe, Announce, AnnounceOk, AnnounceError,
70
- AnnounceCancel, Unannounce, TrackStatusRequest, TrackStatus,
71
- ObjectStream, ObjectDatagram, StreamHeaderTrack, StreamHeaderGroup,
72
- StreamHeaderSubgroup, GoAway, SubscribeAnnounces, SubscribeAnnouncesOk,
73
- SubscribeAnnouncesError, UnsubscribeAnnounces, MaxSubscribeId,
74
- Fetch, FetchOk, FetchError, FetchCancel,
75
- FilterType, GroupOrderValue,
76
- } from './core/types.js';
77
- export { DecodeError } from './core/types.js';
70
+ Announce,
71
+ AnnounceCancel,
72
+ AnnounceError,
73
+ AnnounceOk,
74
+ BaseCodec,
75
+ ClientSetup,
76
+ Codec,
77
+ CodecOptions,
78
+ DecodeErrorCode,
79
+ DecodeResult,
80
+ Draft,
81
+ DraftShorthand,
82
+ Fetch,
83
+ FetchCancel,
84
+ FetchError,
85
+ FetchOk,
86
+ FilterType,
87
+ GoAway,
88
+ GroupOrderValue,
89
+ MaxSubscribeId,
90
+ MoqtMessage,
91
+ MoqtMessageType,
92
+ ObjectDatagram,
93
+ ObjectStream,
94
+ ServerSetup,
95
+ StreamHeaderGroup,
96
+ StreamHeaderSubgroup,
97
+ StreamHeaderTrack,
98
+ Subscribe,
99
+ SubscribeAnnounces,
100
+ SubscribeAnnouncesError,
101
+ SubscribeAnnouncesOk,
102
+ SubscribeDone,
103
+ SubscribeError,
104
+ SubscribeOk,
105
+ SubscribeUpdate,
106
+ TrackStatus,
107
+ TrackStatusRequest,
108
+ Unannounce,
109
+ Unsubscribe,
110
+ UnsubscribeAnnounces,
111
+ } from "./core/types.js";
112
+ export { DecodeError } from "./core/types.js";
78
113
 
79
114
  // Re-export draft-14 types
80
- export type { Draft14Codec } from './drafts/draft14/codec.js';
115
+ export type { Draft14Codec } from "./drafts/draft14/codec.js";
81
116
  export type {
117
+ Draft14DataStream,
82
118
  Draft14Message,
83
119
  Draft14Params,
84
- Draft14DataStream,
85
- } from './drafts/draft14/types.js';
120
+ } from "./drafts/draft14/types.js";
package/src/session.ts CHANGED
@@ -7,9 +7,9 @@
7
7
  * import { createDraft14SessionState } from '@moqtap/codec/draft14/session';
8
8
  */
9
9
 
10
- import type { SessionState, SessionStateOptions } from './core/session-types.js';
11
- import { createDraft07SessionState } from './drafts/draft07/session.js';
12
- import { createDraft14SessionState } from './drafts/draft14/session.js';
10
+ import type { SessionState, SessionStateOptions } from "./core/session-types.js";
11
+ import { createDraft07SessionState } from "./drafts/draft07/session.js";
12
+ import { createDraft14SessionState } from "./drafts/draft14/session.js";
13
13
 
14
14
  /**
15
15
  * Create a session state machine for the given draft version.
@@ -23,36 +23,36 @@ export function createSessionState(options: SessionStateOptions): SessionState<u
23
23
  const draft = options.codec.draft;
24
24
 
25
25
  switch (draft) {
26
- case 'draft-ietf-moq-transport-07':
26
+ case "draft-ietf-moq-transport-07":
27
27
  return createDraft07SessionState(options);
28
- case 'draft-ietf-moq-transport-14':
28
+ case "draft-ietf-moq-transport-14":
29
29
  return createDraft14SessionState(options) as SessionState<unknown, string>;
30
30
  default:
31
31
  throw new Error(
32
32
  `Unsupported draft for session: "${draft}". ` +
33
- `Use a draft-scoped import instead:\n` +
34
- ` import { createDraft07SessionState } from '@moqtap/codec/draft7/session'\n` +
35
- ` import { createDraft14SessionState } from '@moqtap/codec/draft14/session'`,
33
+ `Use a draft-scoped import instead:\n` +
34
+ ` import { createDraft07SessionState } from '@moqtap/codec/draft7/session'\n` +
35
+ ` import { createDraft14SessionState } from '@moqtap/codec/draft14/session'`,
36
36
  );
37
37
  }
38
38
  }
39
39
 
40
40
  // Re-export all session types
41
41
  export type {
42
- SessionState,
43
- SessionStateOptions,
44
- SessionPhase,
45
- SubscriptionState,
46
- SubscriptionPhase,
47
- AnnounceState,
48
42
  AnnouncePhase,
49
- PublishState,
50
- PublishPhase,
51
- FetchState,
43
+ AnnounceState,
52
44
  FetchPhase,
53
- TransitionResult,
54
- ValidationResult,
45
+ FetchState,
55
46
  ProtocolViolation,
56
47
  ProtocolViolationCode,
48
+ PublishPhase,
49
+ PublishState,
50
+ SessionPhase,
51
+ SessionState,
52
+ SessionStateOptions,
57
53
  SideEffect,
58
- } from './core/session-types.js';
54
+ SubscriptionPhase,
55
+ SubscriptionState,
56
+ TransitionResult,
57
+ ValidationResult,
58
+ } from "./core/session-types.js";