@moqtap/codec 0.8.1 → 0.9.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 (127) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +16 -4
  3. package/dist/chunk-BMJMY6FX.cjs +868 -0
  4. package/dist/chunk-MAXEHYVB.cjs +2362 -0
  5. package/dist/{chunk-3YAR3I3S.js → chunk-Q7NSUXXB.js} +3 -1
  6. package/dist/{chunk-VWXUT5R2.cjs → chunk-TVSFDQYE.cjs} +3 -1
  7. package/dist/chunk-WX5PU7HF.js +868 -0
  8. package/dist/chunk-YJGOD3Y4.js +2362 -0
  9. package/dist/{codec-BLYAy2OP.d.ts → codec--CVeqGQv.d.ts} +1 -1
  10. package/dist/{codec-DujHf55Z.d.ts → codec-BJ7BHuiZ.d.ts} +1 -1
  11. package/dist/{codec-D47r_-Rl.d.ts → codec-BKsVu3Fr.d.ts} +1 -1
  12. package/dist/{codec-BNS3gS77.d.ts → codec-BMwgZIgG.d.ts} +1 -1
  13. package/dist/{codec-CI0BjmHc.d.ts → codec-BNy5syCU.d.ts} +1 -1
  14. package/dist/{codec-v6Vloc7H.d.ts → codec-BQa6Qsav.d.ts} +1 -1
  15. package/dist/codec-Bym-K2q2.d.cts +49 -0
  16. package/dist/{codec-D2JbI2tp.d.ts → codec-C006F75E.d.ts} +1 -1
  17. package/dist/codec-C5evFHL-.d.ts +49 -0
  18. package/dist/{codec-DQWQSam3.d.cts → codec-C6Mx4bwz.d.cts} +1 -1
  19. package/dist/{codec-DL0njGkL.d.ts → codec-CA6nbbEk.d.ts} +1 -1
  20. package/dist/{codec-D89DWXbv.d.cts → codec-CSBFdPgP.d.cts} +1 -1
  21. package/dist/{codec-DvcJgYKq.d.cts → codec-CXCjya_G.d.cts} +1 -1
  22. package/dist/{codec-hvkJfCF5.d.cts → codec-C_xxsbKy.d.cts} +1 -1
  23. package/dist/{codec-BOyrk_C9.d.cts → codec-Cfo_z5ET.d.cts} +1 -1
  24. package/dist/{codec-xeuGZY77.d.cts → codec-CgZdadPt.d.cts} +2 -2
  25. package/dist/{codec-WwwUipaU.d.ts → codec-Cl73EfRW.d.ts} +1 -1
  26. package/dist/{codec-BOtv3R5j.d.cts → codec-CtvFK4aV.d.cts} +1 -1
  27. package/dist/{codec-DAePx2NL.d.ts → codec-CviAa4lp.d.ts} +2 -2
  28. package/dist/{codec-DJmV04i0.d.ts → codec-D4RvFQmu.d.ts} +1 -1
  29. package/dist/{codec-cou9XBMF.d.cts → codec-DAyiF5sq.d.cts} +1 -1
  30. package/dist/{codec-CyApDKwf.d.cts → codec-DJmqoIsp.d.cts} +1 -1
  31. package/dist/{codec-NMsTK0GX.d.cts → codec-DchsPfr3.d.cts} +1 -1
  32. package/dist/{codec-DplRgIKq.d.ts → codec-Dl_QIXMz.d.ts} +1 -1
  33. package/dist/{codec-N3g1lxQQ.d.cts → codec-DzLvG8Wb.d.cts} +1 -1
  34. package/dist/{codec-D95gT98n.d.cts → codec-DzkdW4kO.d.cts} +1 -1
  35. package/dist/{codec-CWj5iTxA.d.ts → codec-O-1Js7h4.d.ts} +1 -1
  36. package/dist/{codec-BqqoYdh_.d.cts → codec-vddqy0KY.d.cts} +1 -1
  37. package/dist/draft07-session.d.cts +3 -3
  38. package/dist/draft07-session.d.ts +3 -3
  39. package/dist/draft07.d.cts +3 -3
  40. package/dist/draft07.d.ts +3 -3
  41. package/dist/draft08-session.d.cts +3 -3
  42. package/dist/draft08-session.d.ts +3 -3
  43. package/dist/draft08.d.cts +4 -4
  44. package/dist/draft08.d.ts +4 -4
  45. package/dist/draft09-session.d.cts +3 -3
  46. package/dist/draft09-session.d.ts +3 -3
  47. package/dist/draft09.d.cts +4 -4
  48. package/dist/draft09.d.ts +4 -4
  49. package/dist/draft10-session.d.cts +3 -3
  50. package/dist/draft10-session.d.ts +3 -3
  51. package/dist/draft10.d.cts +4 -4
  52. package/dist/draft10.d.ts +4 -4
  53. package/dist/draft11-session.d.cts +3 -3
  54. package/dist/draft11-session.d.ts +3 -3
  55. package/dist/draft11.d.cts +4 -4
  56. package/dist/draft11.d.ts +4 -4
  57. package/dist/draft12-session.d.cts +3 -3
  58. package/dist/draft12-session.d.ts +3 -3
  59. package/dist/draft12.d.cts +4 -4
  60. package/dist/draft12.d.ts +4 -4
  61. package/dist/draft13-session.d.cts +3 -3
  62. package/dist/draft13-session.d.ts +3 -3
  63. package/dist/draft13.d.cts +4 -4
  64. package/dist/draft13.d.ts +4 -4
  65. package/dist/draft14-session.d.cts +3 -3
  66. package/dist/draft14-session.d.ts +3 -3
  67. package/dist/draft14.d.cts +4 -4
  68. package/dist/draft14.d.ts +4 -4
  69. package/dist/draft15-session.d.cts +3 -3
  70. package/dist/draft15-session.d.ts +3 -3
  71. package/dist/draft15.d.cts +4 -4
  72. package/dist/draft15.d.ts +4 -4
  73. package/dist/draft16-session.d.cts +3 -3
  74. package/dist/draft16-session.d.ts +3 -3
  75. package/dist/draft16.d.cts +4 -4
  76. package/dist/draft16.d.ts +4 -4
  77. package/dist/draft17-session.d.cts +3 -3
  78. package/dist/draft17-session.d.ts +3 -3
  79. package/dist/draft17.d.cts +3 -3
  80. package/dist/draft17.d.ts +3 -3
  81. package/dist/draft18-session.d.cts +3 -3
  82. package/dist/draft18-session.d.ts +3 -3
  83. package/dist/draft18.d.cts +3 -3
  84. package/dist/draft18.d.ts +3 -3
  85. package/dist/draft19-session.d.cts +3 -3
  86. package/dist/draft19-session.d.ts +3 -3
  87. package/dist/draft19.cjs +2 -2
  88. package/dist/draft19.d.cts +3 -3
  89. package/dist/draft19.d.ts +3 -3
  90. package/dist/draft19.js +1 -1
  91. package/dist/draft20-session.cjs +8 -0
  92. package/dist/draft20-session.d.cts +195 -0
  93. package/dist/draft20-session.d.ts +195 -0
  94. package/dist/draft20-session.js +8 -0
  95. package/dist/draft20.cjs +217 -0
  96. package/dist/draft20.d.cts +175 -0
  97. package/dist/draft20.d.ts +175 -0
  98. package/dist/draft20.js +217 -0
  99. package/dist/index.cjs +9 -3
  100. package/dist/index.d.cts +32 -17
  101. package/dist/index.d.ts +32 -17
  102. package/dist/index.js +8 -2
  103. package/dist/{session-types-KsqyVp6y.d.cts → session-types-B9idsih-.d.cts} +13 -1
  104. package/dist/{session-types-C0l_-Ups.d.ts → session-types-Dn7b3RZM.d.ts} +13 -1
  105. package/dist/session.cjs +5 -1
  106. package/dist/session.d.cts +5 -3
  107. package/dist/session.d.ts +5 -3
  108. package/dist/session.js +5 -1
  109. package/dist/types-CWCQwuvy.d.cts +359 -0
  110. package/dist/types-CWCQwuvy.d.ts +359 -0
  111. package/dist/{types-CdCSIfvI.d.cts → types-DG5_iKuv.d.cts} +1 -1
  112. package/dist/{types-CdCSIfvI.d.ts → types-DG5_iKuv.d.ts} +1 -1
  113. package/package.json +16 -3
  114. package/src/core/session-types.ts +7 -0
  115. package/src/core/types.ts +1 -0
  116. package/src/drafts/draft19/codec.ts +4 -2
  117. package/src/drafts/draft20/codec.ts +1737 -0
  118. package/src/drafts/draft20/data-streams.ts +1291 -0
  119. package/src/drafts/draft20/error-codes.ts +135 -0
  120. package/src/drafts/draft20/index.ts +165 -0
  121. package/src/drafts/draft20/messages.ts +68 -0
  122. package/src/drafts/draft20/rules.ts +107 -0
  123. package/src/drafts/draft20/session-fsm.ts +1063 -0
  124. package/src/drafts/draft20/session.ts +21 -0
  125. package/src/drafts/draft20/types.ts +455 -0
  126. package/src/index.ts +20 -2
  127. package/src/session.ts +4 -0
@@ -0,0 +1,175 @@
1
+ export { D as Draft20Codec, U as UNKNOWN_STREAM_COUNT, c as createDraft20Codec, a as createStreamDecoder, d as decodeMessage, e as encodeMessage } from './codec-Bym-K2q2.cjs';
2
+ import { b as DataStreamEvent, F as FetchStreamHeader, O as ObjectPayload, S as SubgroupStreamHeader, c as Draft20DataStream, d as DatagramObject, e as FetchStream, f as SubgroupStream, a as Draft20MessageType } from './types-CWCQwuvy.cjs';
3
+ export { g as DataStreamHeader, h as Draft20BaseMessage, i as Draft20Fetch, j as Draft20FetchOk, k as Draft20FillParameters, l as Draft20GoAway, D as Draft20Message, m as Draft20Namespace, n as Draft20NamespaceDone, o as Draft20Params, p as Draft20Publish, q as Draft20PublishDone, r as Draft20PublishNamespace, s as Draft20PublishSkipped, t as Draft20PublishStateNotify, u as Draft20RequestError, v as Draft20RequestOk, w as Draft20RequestUpdate, x as Draft20Setup, y as Draft20SetupOptions, z as Draft20Subscribe, A as Draft20SubscribeNamespace, B as Draft20SubscribeOk, C as Draft20SubscribeTracks, E as Draft20TrackProperties, G as Draft20TrackStatus, H as FetchObjectPayload, L as LargestObject, I as LocationFilter, R as RangeFilter, J as RangeFilterRange, K as Redirect, U as UnknownParam } from './types-CWCQwuvy.cjs';
4
+ export { Draft20SessionFSM, FillFetchStreamPhase, FillFetchStreamState, PublisherSide, RequestKind, createDraft20SessionState } from './draft20-session.cjs';
5
+ export { P as ProtocolViolation, g as SessionPhase, h as SideEffect, T as TransitionResult, V as ValidationResult } from './session-types-B9idsih-.cjs';
6
+ import { b as DecodeResult } from './types-DG5_iKuv.cjs';
7
+
8
+ declare function encodeSubgroupStream(stream: SubgroupStream): Uint8Array;
9
+ declare function encodeDatagram(dg: DatagramObject): Uint8Array;
10
+ declare function encodeFetchStream(stream: FetchStream): Uint8Array;
11
+ declare function decodeSubgroupStream(bytes: Uint8Array): DecodeResult<SubgroupStream>;
12
+ declare function decodeDatagram(bytes: Uint8Array): DecodeResult<DatagramObject>;
13
+ declare function decodeFetchStream(bytes: Uint8Array): DecodeResult<FetchStream>;
14
+ declare function decodeDataStream(streamType: 'subgroup' | 'datagram' | 'fetch', bytes: Uint8Array): DecodeResult<Draft20DataStream>;
15
+ declare function createSubgroupStreamDecoder(): TransformStream<Uint8Array, SubgroupStreamHeader | ObjectPayload>;
16
+ declare function createFetchStreamDecoder(): TransformStream<Uint8Array, FetchStreamHeader | ObjectPayload>;
17
+ declare function createDataStreamDecoder(): TransformStream<Uint8Array, DataStreamEvent>;
18
+
19
+ /** draft-20 Section 15.11.1, Table 18 (prose Section 3.5). */
20
+ declare const SessionTerminationCode: {
21
+ readonly NoError: 0n;
22
+ readonly InternalError: 1n;
23
+ readonly Unauthorized: 2n;
24
+ readonly ProtocolViolation: 3n;
25
+ readonly InvalidRequestId: 4n;
26
+ readonly DuplicateTrackAlias: 5n;
27
+ readonly KeyValueFormattingError: 6n;
28
+ readonly InvalidPath: 8n;
29
+ readonly MalformedPath: 9n;
30
+ readonly GoawayTimeout: 16n;
31
+ readonly ControlMessageTimeout: 17n;
32
+ readonly DataStreamTimeout: 18n;
33
+ readonly AuthTokenCacheOverflow: 19n;
34
+ readonly DuplicateAuthTokenAlias: 20n;
35
+ readonly MalformedAuthToken: 22n;
36
+ readonly UnknownAuthTokenAlias: 23n;
37
+ readonly ExpiredAuthToken: 24n;
38
+ readonly InvalidAuthority: 25n;
39
+ readonly MalformedAuthority: 26n;
40
+ readonly TooManyRequestUpdates: 27n;
41
+ };
42
+ type SessionTerminationCodeValue = (typeof SessionTerminationCode)[keyof typeof SessionTerminationCode];
43
+ /** draft-20 Section 15.11.2, Table 19 (prose Section 10.6.2). */
44
+ declare const RequestErrorCode: {
45
+ readonly InternalError: 0n;
46
+ readonly Unauthorized: 1n;
47
+ readonly Timeout: 2n;
48
+ readonly NotSupported: 3n;
49
+ readonly MalformedAuthToken: 4n;
50
+ readonly ExpiredAuthToken: 5n;
51
+ readonly GoingAway: 6n;
52
+ readonly ExcessiveLoad: 9n;
53
+ readonly DoesNotExist: 16n;
54
+ readonly InvalidRange: 17n;
55
+ readonly MalformedTrack: 18n;
56
+ readonly Uninterested: 32n;
57
+ readonly PrefixOverlap: 48n;
58
+ readonly NamespaceTooLarge: 49n;
59
+ readonly UnsupportedExtension: 51n;
60
+ readonly Redirect: 52n;
61
+ readonly ConflictingFilters: 53n;
62
+ readonly InvalidFilter: 54n;
63
+ };
64
+ type RequestErrorCodeValue = (typeof RequestErrorCode)[keyof typeof RequestErrorCode];
65
+ /** draft-20 Section 15.11.3, Table 20 (prose Section 10.12). */
66
+ declare const PublishDoneCode: {
67
+ readonly InternalError: 0n;
68
+ readonly Unauthorized: 1n;
69
+ readonly TrackEnded: 2n;
70
+ readonly GoingAway: 4n;
71
+ readonly TooFarBehind: 5n;
72
+ readonly Expired: 6n;
73
+ readonly UpdateFailed: 8n;
74
+ readonly ExcessiveLoad: 9n;
75
+ readonly MalformedTrack: 18n;
76
+ };
77
+ type PublishDoneCodeValue = (typeof PublishDoneCode)[keyof typeof PublishDoneCode];
78
+ /** draft-20 Section 15.11.4, Table 21 (prose Section 3.3.4) — unchanged from draft-19. */
79
+ declare const DataStreamResetCode: {
80
+ readonly InternalError: 0n;
81
+ readonly Cancelled: 1n;
82
+ readonly DeliveryTimeout: 2n;
83
+ readonly SessionClosed: 3n;
84
+ readonly GoingAway: 4n;
85
+ readonly TooFarBehind: 5n;
86
+ readonly UnknownObjectStatus: 6n;
87
+ readonly ExpiredAuthToken: 7n;
88
+ readonly ExcessiveLoad: 9n;
89
+ readonly MalformedTrack: 18n;
90
+ };
91
+ type DataStreamResetCodeValue = (typeof DataStreamResetCode)[keyof typeof DataStreamResetCode];
92
+ declare const RETIRED_SESSION_TERMINATION_CODES: ReadonlySet<bigint>;
93
+ declare const RETIRED_REQUEST_ERROR_CODES: ReadonlySet<bigint>;
94
+ declare const RETIRED_PUBLISH_DONE_CODES: ReadonlySet<bigint>;
95
+
96
+ declare const MSG_REQUEST_UPDATE = 2n;
97
+ declare const MSG_SUBSCRIBE = 3n;
98
+ declare const MSG_SUBSCRIBE_OK = 4n;
99
+ declare const MSG_REQUEST_ERROR = 5n;
100
+ declare const MSG_PUBLISH_NAMESPACE = 6n;
101
+ declare const MSG_REQUEST_OK = 7n;
102
+ declare const MSG_NAMESPACE = 8n;
103
+ declare const MSG_PUBLISH_DONE = 11n;
104
+ declare const MSG_TRACK_STATUS = 13n;
105
+ declare const MSG_NAMESPACE_DONE = 14n;
106
+ declare const MSG_PUBLISH_SKIPPED = 15n;
107
+ declare const MSG_GOAWAY = 16n;
108
+ declare const MSG_FETCH = 22n;
109
+ declare const MSG_FETCH_OK = 24n;
110
+ declare const MSG_PUBLISH = 29n;
111
+ /** NEW in draft-20 — Section 10.10. Unilateral publisher→subscriber notification. */
112
+ declare const MSG_PUBLISH_STATE_NOTIFY = 34n;
113
+ declare const MSG_PUBLISH_OK = 7n;
114
+ declare const MSG_SUBSCRIBE_NAMESPACE = 80n;
115
+ declare const MSG_SUBSCRIBE_TRACKS = 81n;
116
+ declare const MSG_SETUP = 12032n;
117
+ declare const SETUP_OPT_PATH = 1n;
118
+ declare const SETUP_OPT_AUTHORIZATION_TOKEN = 3n;
119
+ declare const SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = 4n;
120
+ declare const SETUP_OPT_AUTHORITY = 5n;
121
+ declare const SETUP_OPT_MAX_FILTER_RANGES = 6n;
122
+ declare const SETUP_OPT_MOQT_IMPLEMENTATION = 7n;
123
+ declare const SETUP_OPT_MAX_REQUEST_UPDATES = 8n;
124
+ declare const MESSAGE_TYPE_MAP: ReadonlyMap<bigint, string>;
125
+ declare const MESSAGE_ID_MAP: ReadonlyMap<string, bigint>;
126
+
127
+ declare const CONTROL_MESSAGES: ReadonlySet<Draft20MessageType>;
128
+ declare const CLIENT_ONLY_MESSAGES: ReadonlySet<Draft20MessageType>;
129
+ declare const SERVER_ONLY_MESSAGES: ReadonlySet<Draft20MessageType>;
130
+ declare const BIDIRECTIONAL_MESSAGES: ReadonlySet<Draft20MessageType>;
131
+ /**
132
+ * The seven message types that may be the FIRST message on a new bidirectional
133
+ * (request) stream — draft-20 Section 3.3, and the rows marked "First" in the
134
+ * Section 10 registry. Unchanged from draft-19.
135
+ *
136
+ * "Bidirectional streams MUST NOT begin with any other message type unless
137
+ * negotiated. If they do, the peer MUST close the Session with a
138
+ * PROTOCOL_VIOLATION." Note GOAWAY (0x10) is marked "Control, Request" but not
139
+ * "First": it may travel on either kind of stream but may never open one.
140
+ */
141
+ declare const REQUEST_STREAM_OPENERS: ReadonlySet<Draft20MessageType>;
142
+ declare function getLegalOutgoing(phase: string, _role: 'client' | 'server'): Set<Draft20MessageType>;
143
+ declare function getLegalIncoming(phase: string, role: 'client' | 'server'): Set<Draft20MessageType>;
144
+
145
+ /**
146
+ * Draft-20's real identifier is the protocol string `moqt-20`.
147
+ *
148
+ * draft-20 Section 3.1: "MOQT uses ALPN in QUIC and 'WT-Available-Protocols' in
149
+ * WebTransport to perform version negotiation. […] ALPNs used to identify IETF
150
+ * drafts are created by appending the draft number to 'moqt-'. […] Note: Draft
151
+ * versions prior to -15 all used moq-00 ALPN, followed by version negotiation
152
+ * in the SETUP messages."
153
+ *
154
+ * So this is what a draft-20 peer actually negotiates with, and it is the only
155
+ * identifier that appears anywhere in a draft-20 session.
156
+ */
157
+ declare const PROTOCOL_STRING = "moqt-20";
158
+ /**
159
+ * The `0xff000000 + N` identifier for draft 20.
160
+ *
161
+ * **This is a derived identifier, not an observed wire value.** No draft-20
162
+ * peer ever sends it. The `0xff0000NN` scheme belonged to the SETUP-time
163
+ * version negotiation that drafts before -15 used; from draft-15 on the version
164
+ * is negotiated by ALPN / `WT-Available-Protocols` and no version number
165
+ * appears on the wire at all. It is kept only so that code indexing drafts by a
166
+ * numeric key — {@link DRAFT_VERSIONS} in the package root, trace formats,
167
+ * anything that predates the change — has a stable key for draft-20.
168
+ *
169
+ * Anything that reports a version to a user should report
170
+ * {@link PROTOCOL_STRING} instead, and should not claim to have observed this
171
+ * number.
172
+ */
173
+ declare const DRAFT_VERSION = 4278190100n;
174
+
175
+ export { BIDIRECTIONAL_MESSAGES, CLIENT_ONLY_MESSAGES, CONTROL_MESSAGES, DRAFT_VERSION, DataStreamEvent, DataStreamResetCode, type DataStreamResetCodeValue, DatagramObject, Draft20DataStream, Draft20MessageType, FetchStream, FetchStreamHeader, MESSAGE_ID_MAP, MESSAGE_TYPE_MAP, MSG_FETCH, MSG_FETCH_OK, MSG_GOAWAY, MSG_NAMESPACE, MSG_NAMESPACE_DONE, MSG_PUBLISH, MSG_PUBLISH_DONE, MSG_PUBLISH_NAMESPACE, MSG_PUBLISH_OK, MSG_PUBLISH_SKIPPED, MSG_PUBLISH_STATE_NOTIFY, MSG_REQUEST_ERROR, MSG_REQUEST_OK, MSG_REQUEST_UPDATE, MSG_SETUP, MSG_SUBSCRIBE, MSG_SUBSCRIBE_NAMESPACE, MSG_SUBSCRIBE_OK, MSG_SUBSCRIBE_TRACKS, MSG_TRACK_STATUS, ObjectPayload, PROTOCOL_STRING, PublishDoneCode, type PublishDoneCodeValue, REQUEST_STREAM_OPENERS, RETIRED_PUBLISH_DONE_CODES, RETIRED_REQUEST_ERROR_CODES, RETIRED_SESSION_TERMINATION_CODES, RequestErrorCode, type RequestErrorCodeValue, SERVER_ONLY_MESSAGES, SETUP_OPT_AUTHORITY, SETUP_OPT_AUTHORIZATION_TOKEN, SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE, SETUP_OPT_MAX_FILTER_RANGES, SETUP_OPT_MAX_REQUEST_UPDATES, SETUP_OPT_MOQT_IMPLEMENTATION, SETUP_OPT_PATH, SessionTerminationCode, type SessionTerminationCodeValue, SubgroupStream, SubgroupStreamHeader, createDataStreamDecoder, createFetchStreamDecoder, createSubgroupStreamDecoder, decodeDataStream, decodeDatagram, decodeFetchStream, decodeSubgroupStream, encodeDatagram, encodeFetchStream, encodeSubgroupStream, getLegalIncoming, getLegalOutgoing };
@@ -0,0 +1,175 @@
1
+ export { D as Draft20Codec, U as UNKNOWN_STREAM_COUNT, c as createDraft20Codec, a as createStreamDecoder, d as decodeMessage, e as encodeMessage } from './codec-C5evFHL-.js';
2
+ import { b as DataStreamEvent, F as FetchStreamHeader, O as ObjectPayload, S as SubgroupStreamHeader, c as Draft20DataStream, d as DatagramObject, e as FetchStream, f as SubgroupStream, a as Draft20MessageType } from './types-CWCQwuvy.js';
3
+ export { g as DataStreamHeader, h as Draft20BaseMessage, i as Draft20Fetch, j as Draft20FetchOk, k as Draft20FillParameters, l as Draft20GoAway, D as Draft20Message, m as Draft20Namespace, n as Draft20NamespaceDone, o as Draft20Params, p as Draft20Publish, q as Draft20PublishDone, r as Draft20PublishNamespace, s as Draft20PublishSkipped, t as Draft20PublishStateNotify, u as Draft20RequestError, v as Draft20RequestOk, w as Draft20RequestUpdate, x as Draft20Setup, y as Draft20SetupOptions, z as Draft20Subscribe, A as Draft20SubscribeNamespace, B as Draft20SubscribeOk, C as Draft20SubscribeTracks, E as Draft20TrackProperties, G as Draft20TrackStatus, H as FetchObjectPayload, L as LargestObject, I as LocationFilter, R as RangeFilter, J as RangeFilterRange, K as Redirect, U as UnknownParam } from './types-CWCQwuvy.js';
4
+ export { Draft20SessionFSM, FillFetchStreamPhase, FillFetchStreamState, PublisherSide, RequestKind, createDraft20SessionState } from './draft20-session.js';
5
+ export { P as ProtocolViolation, g as SessionPhase, h as SideEffect, T as TransitionResult, V as ValidationResult } from './session-types-Dn7b3RZM.js';
6
+ import { b as DecodeResult } from './types-DG5_iKuv.js';
7
+
8
+ declare function encodeSubgroupStream(stream: SubgroupStream): Uint8Array;
9
+ declare function encodeDatagram(dg: DatagramObject): Uint8Array;
10
+ declare function encodeFetchStream(stream: FetchStream): Uint8Array;
11
+ declare function decodeSubgroupStream(bytes: Uint8Array): DecodeResult<SubgroupStream>;
12
+ declare function decodeDatagram(bytes: Uint8Array): DecodeResult<DatagramObject>;
13
+ declare function decodeFetchStream(bytes: Uint8Array): DecodeResult<FetchStream>;
14
+ declare function decodeDataStream(streamType: 'subgroup' | 'datagram' | 'fetch', bytes: Uint8Array): DecodeResult<Draft20DataStream>;
15
+ declare function createSubgroupStreamDecoder(): TransformStream<Uint8Array, SubgroupStreamHeader | ObjectPayload>;
16
+ declare function createFetchStreamDecoder(): TransformStream<Uint8Array, FetchStreamHeader | ObjectPayload>;
17
+ declare function createDataStreamDecoder(): TransformStream<Uint8Array, DataStreamEvent>;
18
+
19
+ /** draft-20 Section 15.11.1, Table 18 (prose Section 3.5). */
20
+ declare const SessionTerminationCode: {
21
+ readonly NoError: 0n;
22
+ readonly InternalError: 1n;
23
+ readonly Unauthorized: 2n;
24
+ readonly ProtocolViolation: 3n;
25
+ readonly InvalidRequestId: 4n;
26
+ readonly DuplicateTrackAlias: 5n;
27
+ readonly KeyValueFormattingError: 6n;
28
+ readonly InvalidPath: 8n;
29
+ readonly MalformedPath: 9n;
30
+ readonly GoawayTimeout: 16n;
31
+ readonly ControlMessageTimeout: 17n;
32
+ readonly DataStreamTimeout: 18n;
33
+ readonly AuthTokenCacheOverflow: 19n;
34
+ readonly DuplicateAuthTokenAlias: 20n;
35
+ readonly MalformedAuthToken: 22n;
36
+ readonly UnknownAuthTokenAlias: 23n;
37
+ readonly ExpiredAuthToken: 24n;
38
+ readonly InvalidAuthority: 25n;
39
+ readonly MalformedAuthority: 26n;
40
+ readonly TooManyRequestUpdates: 27n;
41
+ };
42
+ type SessionTerminationCodeValue = (typeof SessionTerminationCode)[keyof typeof SessionTerminationCode];
43
+ /** draft-20 Section 15.11.2, Table 19 (prose Section 10.6.2). */
44
+ declare const RequestErrorCode: {
45
+ readonly InternalError: 0n;
46
+ readonly Unauthorized: 1n;
47
+ readonly Timeout: 2n;
48
+ readonly NotSupported: 3n;
49
+ readonly MalformedAuthToken: 4n;
50
+ readonly ExpiredAuthToken: 5n;
51
+ readonly GoingAway: 6n;
52
+ readonly ExcessiveLoad: 9n;
53
+ readonly DoesNotExist: 16n;
54
+ readonly InvalidRange: 17n;
55
+ readonly MalformedTrack: 18n;
56
+ readonly Uninterested: 32n;
57
+ readonly PrefixOverlap: 48n;
58
+ readonly NamespaceTooLarge: 49n;
59
+ readonly UnsupportedExtension: 51n;
60
+ readonly Redirect: 52n;
61
+ readonly ConflictingFilters: 53n;
62
+ readonly InvalidFilter: 54n;
63
+ };
64
+ type RequestErrorCodeValue = (typeof RequestErrorCode)[keyof typeof RequestErrorCode];
65
+ /** draft-20 Section 15.11.3, Table 20 (prose Section 10.12). */
66
+ declare const PublishDoneCode: {
67
+ readonly InternalError: 0n;
68
+ readonly Unauthorized: 1n;
69
+ readonly TrackEnded: 2n;
70
+ readonly GoingAway: 4n;
71
+ readonly TooFarBehind: 5n;
72
+ readonly Expired: 6n;
73
+ readonly UpdateFailed: 8n;
74
+ readonly ExcessiveLoad: 9n;
75
+ readonly MalformedTrack: 18n;
76
+ };
77
+ type PublishDoneCodeValue = (typeof PublishDoneCode)[keyof typeof PublishDoneCode];
78
+ /** draft-20 Section 15.11.4, Table 21 (prose Section 3.3.4) — unchanged from draft-19. */
79
+ declare const DataStreamResetCode: {
80
+ readonly InternalError: 0n;
81
+ readonly Cancelled: 1n;
82
+ readonly DeliveryTimeout: 2n;
83
+ readonly SessionClosed: 3n;
84
+ readonly GoingAway: 4n;
85
+ readonly TooFarBehind: 5n;
86
+ readonly UnknownObjectStatus: 6n;
87
+ readonly ExpiredAuthToken: 7n;
88
+ readonly ExcessiveLoad: 9n;
89
+ readonly MalformedTrack: 18n;
90
+ };
91
+ type DataStreamResetCodeValue = (typeof DataStreamResetCode)[keyof typeof DataStreamResetCode];
92
+ declare const RETIRED_SESSION_TERMINATION_CODES: ReadonlySet<bigint>;
93
+ declare const RETIRED_REQUEST_ERROR_CODES: ReadonlySet<bigint>;
94
+ declare const RETIRED_PUBLISH_DONE_CODES: ReadonlySet<bigint>;
95
+
96
+ declare const MSG_REQUEST_UPDATE = 2n;
97
+ declare const MSG_SUBSCRIBE = 3n;
98
+ declare const MSG_SUBSCRIBE_OK = 4n;
99
+ declare const MSG_REQUEST_ERROR = 5n;
100
+ declare const MSG_PUBLISH_NAMESPACE = 6n;
101
+ declare const MSG_REQUEST_OK = 7n;
102
+ declare const MSG_NAMESPACE = 8n;
103
+ declare const MSG_PUBLISH_DONE = 11n;
104
+ declare const MSG_TRACK_STATUS = 13n;
105
+ declare const MSG_NAMESPACE_DONE = 14n;
106
+ declare const MSG_PUBLISH_SKIPPED = 15n;
107
+ declare const MSG_GOAWAY = 16n;
108
+ declare const MSG_FETCH = 22n;
109
+ declare const MSG_FETCH_OK = 24n;
110
+ declare const MSG_PUBLISH = 29n;
111
+ /** NEW in draft-20 — Section 10.10. Unilateral publisher→subscriber notification. */
112
+ declare const MSG_PUBLISH_STATE_NOTIFY = 34n;
113
+ declare const MSG_PUBLISH_OK = 7n;
114
+ declare const MSG_SUBSCRIBE_NAMESPACE = 80n;
115
+ declare const MSG_SUBSCRIBE_TRACKS = 81n;
116
+ declare const MSG_SETUP = 12032n;
117
+ declare const SETUP_OPT_PATH = 1n;
118
+ declare const SETUP_OPT_AUTHORIZATION_TOKEN = 3n;
119
+ declare const SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = 4n;
120
+ declare const SETUP_OPT_AUTHORITY = 5n;
121
+ declare const SETUP_OPT_MAX_FILTER_RANGES = 6n;
122
+ declare const SETUP_OPT_MOQT_IMPLEMENTATION = 7n;
123
+ declare const SETUP_OPT_MAX_REQUEST_UPDATES = 8n;
124
+ declare const MESSAGE_TYPE_MAP: ReadonlyMap<bigint, string>;
125
+ declare const MESSAGE_ID_MAP: ReadonlyMap<string, bigint>;
126
+
127
+ declare const CONTROL_MESSAGES: ReadonlySet<Draft20MessageType>;
128
+ declare const CLIENT_ONLY_MESSAGES: ReadonlySet<Draft20MessageType>;
129
+ declare const SERVER_ONLY_MESSAGES: ReadonlySet<Draft20MessageType>;
130
+ declare const BIDIRECTIONAL_MESSAGES: ReadonlySet<Draft20MessageType>;
131
+ /**
132
+ * The seven message types that may be the FIRST message on a new bidirectional
133
+ * (request) stream — draft-20 Section 3.3, and the rows marked "First" in the
134
+ * Section 10 registry. Unchanged from draft-19.
135
+ *
136
+ * "Bidirectional streams MUST NOT begin with any other message type unless
137
+ * negotiated. If they do, the peer MUST close the Session with a
138
+ * PROTOCOL_VIOLATION." Note GOAWAY (0x10) is marked "Control, Request" but not
139
+ * "First": it may travel on either kind of stream but may never open one.
140
+ */
141
+ declare const REQUEST_STREAM_OPENERS: ReadonlySet<Draft20MessageType>;
142
+ declare function getLegalOutgoing(phase: string, _role: 'client' | 'server'): Set<Draft20MessageType>;
143
+ declare function getLegalIncoming(phase: string, role: 'client' | 'server'): Set<Draft20MessageType>;
144
+
145
+ /**
146
+ * Draft-20's real identifier is the protocol string `moqt-20`.
147
+ *
148
+ * draft-20 Section 3.1: "MOQT uses ALPN in QUIC and 'WT-Available-Protocols' in
149
+ * WebTransport to perform version negotiation. […] ALPNs used to identify IETF
150
+ * drafts are created by appending the draft number to 'moqt-'. […] Note: Draft
151
+ * versions prior to -15 all used moq-00 ALPN, followed by version negotiation
152
+ * in the SETUP messages."
153
+ *
154
+ * So this is what a draft-20 peer actually negotiates with, and it is the only
155
+ * identifier that appears anywhere in a draft-20 session.
156
+ */
157
+ declare const PROTOCOL_STRING = "moqt-20";
158
+ /**
159
+ * The `0xff000000 + N` identifier for draft 20.
160
+ *
161
+ * **This is a derived identifier, not an observed wire value.** No draft-20
162
+ * peer ever sends it. The `0xff0000NN` scheme belonged to the SETUP-time
163
+ * version negotiation that drafts before -15 used; from draft-15 on the version
164
+ * is negotiated by ALPN / `WT-Available-Protocols` and no version number
165
+ * appears on the wire at all. It is kept only so that code indexing drafts by a
166
+ * numeric key — {@link DRAFT_VERSIONS} in the package root, trace formats,
167
+ * anything that predates the change — has a stable key for draft-20.
168
+ *
169
+ * Anything that reports a version to a user should report
170
+ * {@link PROTOCOL_STRING} instead, and should not claim to have observed this
171
+ * number.
172
+ */
173
+ declare const DRAFT_VERSION = 4278190100n;
174
+
175
+ export { BIDIRECTIONAL_MESSAGES, CLIENT_ONLY_MESSAGES, CONTROL_MESSAGES, DRAFT_VERSION, DataStreamEvent, DataStreamResetCode, type DataStreamResetCodeValue, DatagramObject, Draft20DataStream, Draft20MessageType, FetchStream, FetchStreamHeader, MESSAGE_ID_MAP, MESSAGE_TYPE_MAP, MSG_FETCH, MSG_FETCH_OK, MSG_GOAWAY, MSG_NAMESPACE, MSG_NAMESPACE_DONE, MSG_PUBLISH, MSG_PUBLISH_DONE, MSG_PUBLISH_NAMESPACE, MSG_PUBLISH_OK, MSG_PUBLISH_SKIPPED, MSG_PUBLISH_STATE_NOTIFY, MSG_REQUEST_ERROR, MSG_REQUEST_OK, MSG_REQUEST_UPDATE, MSG_SETUP, MSG_SUBSCRIBE, MSG_SUBSCRIBE_NAMESPACE, MSG_SUBSCRIBE_OK, MSG_SUBSCRIBE_TRACKS, MSG_TRACK_STATUS, ObjectPayload, PROTOCOL_STRING, PublishDoneCode, type PublishDoneCodeValue, REQUEST_STREAM_OPENERS, RETIRED_PUBLISH_DONE_CODES, RETIRED_REQUEST_ERROR_CODES, RETIRED_SESSION_TERMINATION_CODES, RequestErrorCode, type RequestErrorCodeValue, SERVER_ONLY_MESSAGES, SETUP_OPT_AUTHORITY, SETUP_OPT_AUTHORIZATION_TOKEN, SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE, SETUP_OPT_MAX_FILTER_RANGES, SETUP_OPT_MAX_REQUEST_UPDATES, SETUP_OPT_MOQT_IMPLEMENTATION, SETUP_OPT_PATH, SessionTerminationCode, type SessionTerminationCodeValue, SubgroupStream, SubgroupStreamHeader, createDataStreamDecoder, createFetchStreamDecoder, createSubgroupStreamDecoder, decodeDataStream, decodeDatagram, decodeFetchStream, decodeSubgroupStream, encodeDatagram, encodeFetchStream, encodeSubgroupStream, getLegalIncoming, getLegalOutgoing };
@@ -0,0 +1,217 @@
1
+ import {
2
+ MESSAGE_ID_MAP,
3
+ MESSAGE_TYPE_MAP,
4
+ MSG_FETCH,
5
+ MSG_FETCH_OK,
6
+ MSG_GOAWAY,
7
+ MSG_NAMESPACE,
8
+ MSG_NAMESPACE_DONE,
9
+ MSG_PUBLISH,
10
+ MSG_PUBLISH_DONE,
11
+ MSG_PUBLISH_NAMESPACE,
12
+ MSG_PUBLISH_OK,
13
+ MSG_PUBLISH_SKIPPED,
14
+ MSG_PUBLISH_STATE_NOTIFY,
15
+ MSG_REQUEST_ERROR,
16
+ MSG_REQUEST_OK,
17
+ MSG_REQUEST_UPDATE,
18
+ MSG_SETUP,
19
+ MSG_SUBSCRIBE,
20
+ MSG_SUBSCRIBE_NAMESPACE,
21
+ MSG_SUBSCRIBE_OK,
22
+ MSG_SUBSCRIBE_TRACKS,
23
+ MSG_TRACK_STATUS,
24
+ SETUP_OPT_AUTHORITY,
25
+ SETUP_OPT_AUTHORIZATION_TOKEN,
26
+ SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE,
27
+ SETUP_OPT_MAX_FILTER_RANGES,
28
+ SETUP_OPT_MAX_REQUEST_UPDATES,
29
+ SETUP_OPT_MOQT_IMPLEMENTATION,
30
+ SETUP_OPT_PATH,
31
+ UNKNOWN_STREAM_COUNT,
32
+ createDataStreamDecoder,
33
+ createDraft20Codec,
34
+ createFetchStreamDecoder,
35
+ createStreamDecoder,
36
+ createSubgroupStreamDecoder,
37
+ decodeDataStream,
38
+ decodeDatagram,
39
+ decodeFetchStream,
40
+ decodeMessage,
41
+ decodeSubgroupStream,
42
+ encodeDatagram,
43
+ encodeFetchStream,
44
+ encodeMessage,
45
+ encodeSubgroupStream
46
+ } from "./chunk-YJGOD3Y4.js";
47
+ import {
48
+ BIDIRECTIONAL_MESSAGES,
49
+ CLIENT_ONLY_MESSAGES,
50
+ CONTROL_MESSAGES,
51
+ Draft20SessionFSM,
52
+ REQUEST_STREAM_OPENERS,
53
+ SERVER_ONLY_MESSAGES,
54
+ createDraft20SessionState,
55
+ getLegalIncoming,
56
+ getLegalOutgoing
57
+ } from "./chunk-WX5PU7HF.js";
58
+ import "./chunk-KLPWJU6W.js";
59
+
60
+ // src/drafts/draft20/error-codes.ts
61
+ var SessionTerminationCode = {
62
+ NoError: 0x0n,
63
+ InternalError: 0x1n,
64
+ Unauthorized: 0x2n,
65
+ ProtocolViolation: 0x3n,
66
+ InvalidRequestId: 0x4n,
67
+ DuplicateTrackAlias: 0x5n,
68
+ KeyValueFormattingError: 0x6n,
69
+ InvalidPath: 0x8n,
70
+ MalformedPath: 0x9n,
71
+ GoawayTimeout: 0x10n,
72
+ ControlMessageTimeout: 0x11n,
73
+ DataStreamTimeout: 0x12n,
74
+ AuthTokenCacheOverflow: 0x13n,
75
+ DuplicateAuthTokenAlias: 0x14n,
76
+ // 0x15 VERSION_NEGOTIATION_FAILED — REMOVED in draft-20. Version negotiation
77
+ // moved to ALPN / WT-Available-Protocols in draft-15, so there is no longer a
78
+ // SETUP-time negotiation that can fail. See RETIRED_SESSION_TERMINATION_CODES.
79
+ MalformedAuthToken: 0x16n,
80
+ UnknownAuthTokenAlias: 0x17n,
81
+ ExpiredAuthToken: 0x18n,
82
+ InvalidAuthority: 0x19n,
83
+ MalformedAuthority: 0x1an,
84
+ TooManyRequestUpdates: 0x1bn
85
+ };
86
+ var RequestErrorCode = {
87
+ InternalError: 0x0n,
88
+ Unauthorized: 0x1n,
89
+ Timeout: 0x2n,
90
+ NotSupported: 0x3n,
91
+ MalformedAuthToken: 0x4n,
92
+ ExpiredAuthToken: 0x5n,
93
+ GoingAway: 0x6n,
94
+ ExcessiveLoad: 0x9n,
95
+ DoesNotExist: 0x10n,
96
+ InvalidRange: 0x11n,
97
+ MalformedTrack: 0x12n,
98
+ Uninterested: 0x20n,
99
+ PrefixOverlap: 0x30n,
100
+ NamespaceTooLarge: 0x31n,
101
+ // 0x32 INVALID_JOINING_REQUEST_ID — REMOVED in draft-20 along with the whole
102
+ // joining-fetch mechanism (draft-19 Section 10.12.2). A draft-20 FETCH names
103
+ // its own track inline and never references another request, so there is no
104
+ // joining Request ID left to be invalid. See RETIRED_REQUEST_ERROR_CODES.
105
+ UnsupportedExtension: 0x33n,
106
+ Redirect: 0x34n,
107
+ ConflictingFilters: 0x35n,
108
+ InvalidFilter: 0x36n
109
+ };
110
+ var PublishDoneCode = {
111
+ InternalError: 0x0n,
112
+ Unauthorized: 0x1n,
113
+ TrackEnded: 0x2n,
114
+ // 0x3 SUBSCRIPTION_ENDED — REMOVED in draft-20. The behaviour went with it:
115
+ // Section 5.1.2 now says "A publisher does not end a subscription solely
116
+ // because the Largest Object advances past the end of the current Location
117
+ // Filter", which is the only thing this code used to report.
118
+ // See RETIRED_PUBLISH_DONE_CODES.
119
+ GoingAway: 0x4n,
120
+ TooFarBehind: 0x5n,
121
+ Expired: 0x6n,
122
+ UpdateFailed: 0x8n,
123
+ ExcessiveLoad: 0x9n,
124
+ MalformedTrack: 0x12n
125
+ };
126
+ var DataStreamResetCode = {
127
+ InternalError: 0x0n,
128
+ Cancelled: 0x1n,
129
+ DeliveryTimeout: 0x2n,
130
+ SessionClosed: 0x3n,
131
+ GoingAway: 0x4n,
132
+ TooFarBehind: 0x5n,
133
+ UnknownObjectStatus: 0x6n,
134
+ ExpiredAuthToken: 0x7n,
135
+ ExcessiveLoad: 0x9n,
136
+ MalformedTrack: 0x12n
137
+ };
138
+ var RETIRED_SESSION_TERMINATION_CODES = /* @__PURE__ */ new Set([
139
+ 0x15n
140
+ // VERSION_NEGOTIATION_FAILED (draft-19 Section 3.5)
141
+ ]);
142
+ var RETIRED_REQUEST_ERROR_CODES = /* @__PURE__ */ new Set([
143
+ 0x32n
144
+ // INVALID_JOINING_REQUEST_ID (draft-19 Section 10.6.2)
145
+ ]);
146
+ var RETIRED_PUBLISH_DONE_CODES = /* @__PURE__ */ new Set([
147
+ 0x3n
148
+ // SUBSCRIPTION_ENDED (draft-19 Section 10.11)
149
+ ]);
150
+
151
+ // src/drafts/draft20/index.ts
152
+ var PROTOCOL_STRING = "moqt-20";
153
+ var DRAFT_VERSION = 0xff000014n;
154
+ export {
155
+ BIDIRECTIONAL_MESSAGES,
156
+ CLIENT_ONLY_MESSAGES,
157
+ CONTROL_MESSAGES,
158
+ DRAFT_VERSION,
159
+ DataStreamResetCode,
160
+ Draft20SessionFSM,
161
+ MESSAGE_ID_MAP,
162
+ MESSAGE_TYPE_MAP,
163
+ MSG_FETCH,
164
+ MSG_FETCH_OK,
165
+ MSG_GOAWAY,
166
+ MSG_NAMESPACE,
167
+ MSG_NAMESPACE_DONE,
168
+ MSG_PUBLISH,
169
+ MSG_PUBLISH_DONE,
170
+ MSG_PUBLISH_NAMESPACE,
171
+ MSG_PUBLISH_OK,
172
+ MSG_PUBLISH_SKIPPED,
173
+ MSG_PUBLISH_STATE_NOTIFY,
174
+ MSG_REQUEST_ERROR,
175
+ MSG_REQUEST_OK,
176
+ MSG_REQUEST_UPDATE,
177
+ MSG_SETUP,
178
+ MSG_SUBSCRIBE,
179
+ MSG_SUBSCRIBE_NAMESPACE,
180
+ MSG_SUBSCRIBE_OK,
181
+ MSG_SUBSCRIBE_TRACKS,
182
+ MSG_TRACK_STATUS,
183
+ PROTOCOL_STRING,
184
+ PublishDoneCode,
185
+ REQUEST_STREAM_OPENERS,
186
+ RETIRED_PUBLISH_DONE_CODES,
187
+ RETIRED_REQUEST_ERROR_CODES,
188
+ RETIRED_SESSION_TERMINATION_CODES,
189
+ RequestErrorCode,
190
+ SERVER_ONLY_MESSAGES,
191
+ SETUP_OPT_AUTHORITY,
192
+ SETUP_OPT_AUTHORIZATION_TOKEN,
193
+ SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE,
194
+ SETUP_OPT_MAX_FILTER_RANGES,
195
+ SETUP_OPT_MAX_REQUEST_UPDATES,
196
+ SETUP_OPT_MOQT_IMPLEMENTATION,
197
+ SETUP_OPT_PATH,
198
+ SessionTerminationCode,
199
+ UNKNOWN_STREAM_COUNT,
200
+ createDataStreamDecoder,
201
+ createDraft20Codec,
202
+ createDraft20SessionState,
203
+ createFetchStreamDecoder,
204
+ createStreamDecoder,
205
+ createSubgroupStreamDecoder,
206
+ decodeDataStream,
207
+ decodeDatagram,
208
+ decodeFetchStream,
209
+ decodeMessage,
210
+ decodeSubgroupStream,
211
+ encodeDatagram,
212
+ encodeFetchStream,
213
+ encodeMessage,
214
+ encodeSubgroupStream,
215
+ getLegalIncoming,
216
+ getLegalOutgoing
217
+ };
package/dist/index.cjs CHANGED
@@ -3,7 +3,10 @@
3
3
  var _chunkUZO5Z2XTcjs = require('./chunk-UZO5Z2XT.cjs');
4
4
 
5
5
 
6
- var _chunkVWXUT5R2cjs = require('./chunk-VWXUT5R2.cjs');
6
+ var _chunkTVSFDQYEcjs = require('./chunk-TVSFDQYE.cjs');
7
+
8
+
9
+ var _chunkMAXEHYVBcjs = require('./chunk-MAXEHYVB.cjs');
7
10
 
8
11
 
9
12
  var _chunk7ENEWAMZcjs = require('./chunk-7ENEWAMZ.cjs');
@@ -103,7 +106,8 @@ var DRAFT_VERSIONS = {
103
106
  "16": 0xff000010n,
104
107
  "17": 0xff000011n,
105
108
  "18": 0xff000012n,
106
- "19": 0xff000013n
109
+ "19": 0xff000013n,
110
+ "20": 0xff000014n
107
111
  };
108
112
  function createCodec(options) {
109
113
  const draft = DRAFT_VERSIONS[options.draft];
@@ -139,7 +143,9 @@ Supported draft values: ${Object.keys(DRAFT_VERSIONS).join(", ")}`
139
143
  case "18":
140
144
  return _chunkUZO5Z2XTcjs.createDraft18Codec.call(void 0, );
141
145
  case "19":
142
- return _chunkVWXUT5R2cjs.createDraft19Codec.call(void 0, );
146
+ return _chunkTVSFDQYEcjs.createDraft19Codec.call(void 0, );
147
+ case "20":
148
+ return _chunkMAXEHYVBcjs.createDraft20Codec.call(void 0, );
143
149
  default:
144
150
  throw new Error(`Unsupported draft: ${draft}`);
145
151
  }
package/dist/index.d.cts CHANGED
@@ -1,18 +1,19 @@
1
- import { C as CodecOptions } from './types-CdCSIfvI.cjs';
2
- export { B as BaseCodec, D as DecodeError, a as DecodeErrorCode, b as DecodeResult, c as Draft } from './types-CdCSIfvI.cjs';
3
- import { D as Draft07Codec } from './codec-DQWQSam3.cjs';
4
- import { D as Draft08Codec } from './codec-D95gT98n.cjs';
5
- import { D as Draft09Codec } from './codec-DvcJgYKq.cjs';
6
- import { D as Draft10Codec } from './codec-BOyrk_C9.cjs';
7
- import { D as Draft11Codec } from './codec-cou9XBMF.cjs';
8
- import { D as Draft12Codec } from './codec-BOtv3R5j.cjs';
9
- import { D as Draft13Codec } from './codec-hvkJfCF5.cjs';
10
- import { D as Draft14Codec } from './codec-N3g1lxQQ.cjs';
11
- import { D as Draft15Codec } from './codec-BqqoYdh_.cjs';
12
- import { D as Draft16Codec } from './codec-CyApDKwf.cjs';
13
- import { D as Draft17Codec } from './codec-NMsTK0GX.cjs';
14
- import { D as Draft18Codec } from './codec-D89DWXbv.cjs';
15
- import { D as Draft19Codec } from './codec-xeuGZY77.cjs';
1
+ import { C as CodecOptions } from './types-DG5_iKuv.cjs';
2
+ export { B as BaseCodec, D as DecodeError, a as DecodeErrorCode, b as DecodeResult, c as Draft } from './types-DG5_iKuv.cjs';
3
+ import { D as Draft07Codec } from './codec-C6Mx4bwz.cjs';
4
+ import { D as Draft08Codec } from './codec-DzkdW4kO.cjs';
5
+ import { D as Draft09Codec } from './codec-CXCjya_G.cjs';
6
+ import { D as Draft10Codec } from './codec-Cfo_z5ET.cjs';
7
+ import { D as Draft11Codec } from './codec-DAyiF5sq.cjs';
8
+ import { D as Draft12Codec } from './codec-CtvFK4aV.cjs';
9
+ import { D as Draft13Codec } from './codec-C_xxsbKy.cjs';
10
+ import { D as Draft14Codec } from './codec-DzLvG8Wb.cjs';
11
+ import { D as Draft15Codec } from './codec-vddqy0KY.cjs';
12
+ import { D as Draft16Codec } from './codec-DJmqoIsp.cjs';
13
+ import { D as Draft17Codec } from './codec-DchsPfr3.cjs';
14
+ import { D as Draft18Codec } from './codec-CSBFdPgP.cjs';
15
+ import { D as Draft19Codec } from './codec-CgZdadPt.cjs';
16
+ import { D as Draft20Codec } from './codec-Bym-K2q2.cjs';
16
17
  import './types-Dl4IaAHR.cjs';
17
18
  import './types-jV1yDDBA.cjs';
18
19
  import './types-B3g5G9KP.cjs';
@@ -26,6 +27,7 @@ import './types-Cm9fjeYC.cjs';
26
27
  import './types-D9eiB_9A.cjs';
27
28
  import './types-Cqp10JtB.cjs';
28
29
  import './types-zHgCS6o5.cjs';
30
+ import './types-CWCQwuvy.cjs';
29
31
 
30
32
  /**
31
33
  * Draft-agnostic readers for decoded control messages.
@@ -111,7 +113,17 @@ declare function joiningRequestIdOf(msg: AnyMessage): bigint | undefined;
111
113
  */
112
114
 
113
115
  /**
114
- * Wire version numbers for each MoQT draft, keyed by short aliases.
116
+ * Version identifiers for each MoQT draft, keyed by short aliases.
117
+ *
118
+ * Only the entries up to '14' are wire values: those drafts negotiated the
119
+ * version inside CLIENT_SETUP/SERVER_SETUP and really do put `0xff0000NN` on
120
+ * the wire. From draft-15 on, the version is negotiated by ALPN (raw QUIC) or
121
+ * `WT-Available-Protocols` (WebTransport) as the string `moqt-NN`, and no
122
+ * version number is sent at all — so '15' through '20' are *derived*
123
+ * identifiers kept as stable numeric keys, not observed values. Do not report
124
+ * one to a user as a version seen on the wire; report the protocol string.
125
+ * Each draft's own module exports it (e.g. `PROTOCOL_STRING` in
126
+ * `@moqtap/codec/draft20`).
115
127
  */
116
128
  declare const DRAFT_VERSIONS: Record<string, bigint>;
117
129
  declare function createCodec(options: CodecOptions & {
@@ -153,12 +165,15 @@ declare function createCodec(options: CodecOptions & {
153
165
  declare function createCodec(options: CodecOptions & {
154
166
  draft: '19';
155
167
  }): Draft19Codec;
168
+ declare function createCodec(options: CodecOptions & {
169
+ draft: '20';
170
+ }): Draft20Codec;
156
171
  /**
157
172
  * Create a codec for the specified draft version.
158
173
  *
159
174
  * A draft must always be specified — there is no default while the
160
175
  * MoQT specification is still in draft stage.
161
176
  */
162
- declare function createCodec(options: CodecOptions): Draft07Codec | Draft08Codec | Draft09Codec | Draft10Codec | Draft11Codec | Draft12Codec | Draft13Codec | Draft14Codec | Draft15Codec | Draft16Codec | Draft17Codec | Draft18Codec | Draft19Codec;
177
+ declare function createCodec(options: CodecOptions): Draft07Codec | Draft08Codec | Draft09Codec | Draft10Codec | Draft11Codec | Draft12Codec | Draft13Codec | Draft14Codec | Draft15Codec | Draft16Codec | Draft17Codec | Draft18Codec | Draft19Codec | Draft20Codec;
163
178
 
164
179
  export { type AnyMessage, CodecOptions, DRAFT_VERSIONS, type TrackIdentity, createCodec, joiningRequestIdOf, requestIdOf, trackAliasOf, trackOf };