@moqtap/codec 0.8.0 → 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.
- package/CHANGELOG.md +49 -0
- package/README.md +16 -4
- package/dist/{chunk-5XZKO2U5.js → chunk-2XH6PHXR.js} +62 -51
- package/dist/{chunk-BQHLUT37.cjs → chunk-7ENEWAMZ.cjs} +2 -6
- package/dist/chunk-BMJMY6FX.cjs +868 -0
- package/dist/{chunk-MD2OA7SE.js → chunk-BV6MITLO.js} +15 -8
- package/dist/{chunk-B56AG5HU.cjs → chunk-EVCPBFSR.cjs} +6 -4
- package/dist/{chunk-KNLPX3YA.js → chunk-H6DTAIWM.js} +6 -4
- package/dist/{chunk-J3ASFPCX.cjs → chunk-IADVBKEJ.cjs} +15 -8
- package/dist/chunk-MAXEHYVB.cjs +2362 -0
- package/dist/{chunk-I55J3KXD.js → chunk-NH4L6NIY.js} +48 -33
- package/dist/{chunk-EQAYMCXO.cjs → chunk-PU2KV7VP.cjs} +48 -33
- package/dist/{chunk-APTV6F72.js → chunk-Q7NSUXXB.js} +70 -52
- package/dist/{chunk-HEO2JG6C.js → chunk-TMXRYOBS.js} +100 -92
- package/dist/{chunk-MH7537FB.cjs → chunk-TVSFDQYE.cjs} +70 -52
- package/dist/{chunk-IEJULBKB.cjs → chunk-UA5XFP4O.cjs} +100 -92
- package/dist/{chunk-KTVN4P6J.cjs → chunk-UZO5Z2XT.cjs} +62 -51
- package/dist/chunk-WX5PU7HF.js +868 -0
- package/dist/{chunk-JJEN2VG5.js → chunk-XQGEOFGE.js} +2 -6
- package/dist/chunk-YJGOD3Y4.js +2362 -0
- package/dist/{codec-BLYAy2OP.d.ts → codec--CVeqGQv.d.ts} +1 -1
- package/dist/{codec-DujHf55Z.d.ts → codec-BJ7BHuiZ.d.ts} +1 -1
- package/dist/{codec-D47r_-Rl.d.ts → codec-BKsVu3Fr.d.ts} +1 -1
- package/dist/{codec-BNS3gS77.d.ts → codec-BMwgZIgG.d.ts} +1 -1
- package/dist/{codec-CI0BjmHc.d.ts → codec-BNy5syCU.d.ts} +1 -1
- package/dist/{codec-CFhUGTu2.d.ts → codec-BQa6Qsav.d.ts} +2 -2
- package/dist/codec-Bym-K2q2.d.cts +49 -0
- package/dist/{codec-D2JbI2tp.d.ts → codec-C006F75E.d.ts} +1 -1
- package/dist/codec-C5evFHL-.d.ts +49 -0
- package/dist/{codec-DQWQSam3.d.cts → codec-C6Mx4bwz.d.cts} +1 -1
- package/dist/{codec-DL0njGkL.d.ts → codec-CA6nbbEk.d.ts} +1 -1
- package/dist/{codec-D89DWXbv.d.cts → codec-CSBFdPgP.d.cts} +1 -1
- package/dist/{codec-DvcJgYKq.d.cts → codec-CXCjya_G.d.cts} +1 -1
- package/dist/{codec-hvkJfCF5.d.cts → codec-C_xxsbKy.d.cts} +1 -1
- package/dist/{codec-BOyrk_C9.d.cts → codec-Cfo_z5ET.d.cts} +1 -1
- package/dist/{codec-xeuGZY77.d.cts → codec-CgZdadPt.d.cts} +2 -2
- package/dist/{codec-WwwUipaU.d.ts → codec-Cl73EfRW.d.ts} +1 -1
- package/dist/{codec-BOtv3R5j.d.cts → codec-CtvFK4aV.d.cts} +1 -1
- package/dist/{codec-DAePx2NL.d.ts → codec-CviAa4lp.d.ts} +2 -2
- package/dist/{codec-DJmV04i0.d.ts → codec-D4RvFQmu.d.ts} +1 -1
- package/dist/{codec-cou9XBMF.d.cts → codec-DAyiF5sq.d.cts} +1 -1
- package/dist/{codec-CyApDKwf.d.cts → codec-DJmqoIsp.d.cts} +1 -1
- package/dist/{codec-NMsTK0GX.d.cts → codec-DchsPfr3.d.cts} +1 -1
- package/dist/{codec-DplRgIKq.d.ts → codec-Dl_QIXMz.d.ts} +1 -1
- package/dist/{codec-BnamSx7L.d.cts → codec-DzLvG8Wb.d.cts} +2 -2
- package/dist/{codec-D95gT98n.d.cts → codec-DzkdW4kO.d.cts} +1 -1
- package/dist/{codec-CWj5iTxA.d.ts → codec-O-1Js7h4.d.ts} +1 -1
- package/dist/{codec-BqqoYdh_.d.cts → codec-vddqy0KY.d.cts} +1 -1
- package/dist/draft07-session.d.cts +3 -3
- package/dist/draft07-session.d.ts +3 -3
- package/dist/draft07.d.cts +3 -3
- package/dist/draft07.d.ts +3 -3
- package/dist/draft08-session.d.cts +3 -3
- package/dist/draft08-session.d.ts +3 -3
- package/dist/draft08.d.cts +4 -4
- package/dist/draft08.d.ts +4 -4
- package/dist/draft09-session.d.cts +3 -3
- package/dist/draft09-session.d.ts +3 -3
- package/dist/draft09.d.cts +4 -4
- package/dist/draft09.d.ts +4 -4
- package/dist/draft10-session.d.cts +3 -3
- package/dist/draft10-session.d.ts +3 -3
- package/dist/draft10.d.cts +4 -4
- package/dist/draft10.d.ts +4 -4
- package/dist/draft11-session.d.cts +3 -3
- package/dist/draft11-session.d.ts +3 -3
- package/dist/draft11.d.cts +4 -4
- package/dist/draft11.d.ts +4 -4
- package/dist/draft12-session.d.cts +3 -3
- package/dist/draft12-session.d.ts +3 -3
- package/dist/draft12.cjs +2 -2
- package/dist/draft12.d.cts +4 -4
- package/dist/draft12.d.ts +4 -4
- package/dist/draft12.js +1 -1
- package/dist/draft13-session.d.cts +3 -3
- package/dist/draft13-session.d.ts +3 -3
- package/dist/draft13.d.cts +4 -4
- package/dist/draft13.d.ts +4 -4
- package/dist/draft14-session.d.cts +4 -4
- package/dist/draft14-session.d.ts +4 -4
- package/dist/draft14.cjs +2 -2
- package/dist/draft14.d.cts +6 -6
- package/dist/draft14.d.ts +6 -6
- package/dist/draft14.js +1 -1
- package/dist/draft15-session.d.cts +3 -3
- package/dist/draft15-session.d.ts +3 -3
- package/dist/draft15.cjs +2 -2
- package/dist/draft15.d.cts +4 -4
- package/dist/draft15.d.ts +4 -4
- package/dist/draft15.js +1 -1
- package/dist/draft16-session.d.cts +3 -3
- package/dist/draft16-session.d.ts +3 -3
- package/dist/draft16.cjs +2 -2
- package/dist/draft16.d.cts +4 -4
- package/dist/draft16.d.ts +4 -4
- package/dist/draft16.js +1 -1
- package/dist/draft17-session.d.cts +3 -3
- package/dist/draft17-session.d.ts +3 -3
- package/dist/draft17.cjs +2 -2
- package/dist/draft17.d.cts +3 -3
- package/dist/draft17.d.ts +3 -3
- package/dist/draft17.js +1 -1
- package/dist/draft18-session.d.cts +3 -3
- package/dist/draft18-session.d.ts +3 -3
- package/dist/draft18.cjs +2 -2
- package/dist/draft18.d.cts +3 -3
- package/dist/draft18.d.ts +3 -3
- package/dist/draft18.js +1 -1
- package/dist/draft19-session.d.cts +3 -3
- package/dist/draft19-session.d.ts +3 -3
- package/dist/draft19.cjs +2 -2
- package/dist/draft19.d.cts +3 -3
- package/dist/draft19.d.ts +3 -3
- package/dist/draft19.js +1 -1
- package/dist/draft20-session.cjs +8 -0
- package/dist/draft20-session.d.cts +195 -0
- package/dist/draft20-session.d.ts +195 -0
- package/dist/draft20-session.js +8 -0
- package/dist/draft20.cjs +217 -0
- package/dist/draft20.d.cts +175 -0
- package/dist/draft20.d.ts +175 -0
- package/dist/draft20.js +217 -0
- package/dist/index.cjs +21 -15
- package/dist/index.d.cts +33 -18
- package/dist/index.d.ts +33 -18
- package/dist/index.js +14 -8
- package/dist/{session-types-KsqyVp6y.d.cts → session-types-B9idsih-.d.cts} +13 -1
- package/dist/{session-types-C0l_-Ups.d.ts → session-types-Dn7b3RZM.d.ts} +13 -1
- package/dist/session.cjs +5 -1
- package/dist/session.d.cts +6 -4
- package/dist/session.d.ts +6 -4
- package/dist/session.js +5 -1
- package/dist/types-CWCQwuvy.d.cts +359 -0
- package/dist/types-CWCQwuvy.d.ts +359 -0
- package/dist/{types-CdCSIfvI.d.cts → types-DG5_iKuv.d.cts} +1 -1
- package/dist/{types-CdCSIfvI.d.ts → types-DG5_iKuv.d.ts} +1 -1
- package/dist/{types-CVeKIk7A.d.cts → types-HI_bbXka.d.cts} +0 -2
- package/dist/{types-CVeKIk7A.d.ts → types-HI_bbXka.d.ts} +0 -2
- package/package.json +16 -3
- package/src/core/session-types.ts +7 -0
- package/src/core/types.ts +1 -0
- package/src/drafts/draft12/data-streams.ts +13 -4
- package/src/drafts/draft14/codec.ts +2 -6
- package/src/drafts/draft14/types.ts +0 -2
- package/src/drafts/draft15/data-streams.ts +30 -16
- package/src/drafts/draft16/codec.ts +116 -93
- package/src/drafts/draft17/codec.ts +72 -35
- package/src/drafts/draft18/codec.ts +89 -53
- package/src/drafts/draft19/codec.ts +98 -55
- package/src/drafts/draft20/codec.ts +1737 -0
- package/src/drafts/draft20/data-streams.ts +1291 -0
- package/src/drafts/draft20/error-codes.ts +135 -0
- package/src/drafts/draft20/index.ts +165 -0
- package/src/drafts/draft20/messages.ts +68 -0
- package/src/drafts/draft20/rules.ts +107 -0
- package/src/drafts/draft20/session-fsm.ts +1063 -0
- package/src/drafts/draft20/session.ts +21 -0
- package/src/drafts/draft20/types.ts +455 -0
- package/src/index.ts +20 -2
- package/src/session.ts +4 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { g as SessionPhase, j as SubscriptionState, b as AnnounceState, f as PublishState, c as FetchState, V as ValidationResult, T as TransitionResult, h as SideEffect } from './session-types-Dn7b3RZM.js';
|
|
2
|
+
export { P as ProtocolViolation } from './session-types-Dn7b3RZM.js';
|
|
3
|
+
import { a as Draft20MessageType, D as Draft20Message } from './types-CWCQwuvy.js';
|
|
4
|
+
import './types-DG5_iKuv.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What kind of request a bidirectional request stream carries.
|
|
8
|
+
*
|
|
9
|
+
* draft-20 keeps the draft-17 shape where a response is tied to its request by
|
|
10
|
+
* the stream it arrives on rather than by a Request ID field. Several draft-20
|
|
11
|
+
* rules are stated per request *kind* — most sharply
|
|
12
|
+
* "PUBLISH_STATE_NOTIFY applies only to subscriptions ... An endpoint that
|
|
13
|
+
* receives a PUBLISH_STATE_NOTIFY for any other request type ... MUST close
|
|
14
|
+
* the session with a PROTOCOL_VIOLATION" (Section 10.10) — so the FSM has to
|
|
15
|
+
* know which stream a message arrived on to enforce them. That is what
|
|
16
|
+
* {@link Draft20SessionFSM.receiveOn} and {@link Draft20SessionFSM.sendOn} are
|
|
17
|
+
* for.
|
|
18
|
+
*/
|
|
19
|
+
type RequestKind = 'subscription' | 'fetch' | 'track_status' | 'publish_namespace' | 'subscribe_namespace' | 'subscribe_tracks';
|
|
20
|
+
/** Whether the local endpoint or the peer is the publisher on a request stream. */
|
|
21
|
+
type PublisherSide = 'local' | 'remote';
|
|
22
|
+
type FillFetchStreamPhase = 'open' | 'complete' | 'reset' | 'cancelled';
|
|
23
|
+
/**
|
|
24
|
+
* One fill fetch stream — draft-20 Section 5.1.3, new in draft-20.
|
|
25
|
+
*
|
|
26
|
+
* A unidirectional stream that begins with FETCH_HEADER and is delivered
|
|
27
|
+
* exactly as a FETCH response, opened because a SUBSCRIBE or REQUEST_UPDATE
|
|
28
|
+
* carried FILL_PARAMETERS. It is NOT a FETCH: there is no FETCH request, no
|
|
29
|
+
* FETCH_OK and no REQUEST_ERROR for it, so it never appears in
|
|
30
|
+
* {@link Draft20SessionFSM.fetches}.
|
|
31
|
+
*/
|
|
32
|
+
interface FillFetchStreamState {
|
|
33
|
+
/**
|
|
34
|
+
* The Request ID of the message that opened it — the SUBSCRIBE's for the
|
|
35
|
+
* initial fill, the REQUEST_UPDATE's for a later one (Section 5.1.3). This
|
|
36
|
+
* is what the stream's FETCH_HEADER carries, and it is how a subscription's
|
|
37
|
+
* concurrent fills are told apart.
|
|
38
|
+
*/
|
|
39
|
+
readonly requestId: bigint;
|
|
40
|
+
/** The Request ID of the subscription the fill belongs to. */
|
|
41
|
+
readonly subscribeId: bigint;
|
|
42
|
+
readonly phase: FillFetchStreamPhase;
|
|
43
|
+
}
|
|
44
|
+
declare class Draft20SessionFSM {
|
|
45
|
+
private _phase;
|
|
46
|
+
private _role;
|
|
47
|
+
private _setupDirection;
|
|
48
|
+
private _subscriptions;
|
|
49
|
+
private _subscriptionMeta;
|
|
50
|
+
private _publishes;
|
|
51
|
+
private _fetches;
|
|
52
|
+
private _requests;
|
|
53
|
+
private _requestIds;
|
|
54
|
+
private _pendingSubscribes;
|
|
55
|
+
private _pendingPublishes;
|
|
56
|
+
private _pendingFetches;
|
|
57
|
+
/**
|
|
58
|
+
* The peer's MAX_REQUEST_UPDATES (Setup Option 0x08), learned from its SETUP.
|
|
59
|
+
* 0 means the peer does not limit REQUEST_UPDATE concurrency, and 0 is also
|
|
60
|
+
* the default when the option is absent.
|
|
61
|
+
*/
|
|
62
|
+
private _peerMaxRequestUpdates;
|
|
63
|
+
/** The local endpoint's own advertised MAX_REQUEST_UPDATES. */
|
|
64
|
+
private _localMaxRequestUpdates;
|
|
65
|
+
constructor(role: 'client' | 'server');
|
|
66
|
+
get phase(): SessionPhase;
|
|
67
|
+
get role(): 'client' | 'server';
|
|
68
|
+
get subscriptions(): ReadonlyMap<bigint, SubscriptionState>;
|
|
69
|
+
get announces(): ReadonlyMap<string, AnnounceState>;
|
|
70
|
+
get publishes(): ReadonlyMap<bigint, PublishState>;
|
|
71
|
+
get fetches(): ReadonlyMap<bigint, FetchState>;
|
|
72
|
+
get legalOutgoing(): ReadonlySet<Draft20MessageType>;
|
|
73
|
+
get legalIncoming(): ReadonlySet<Draft20MessageType>;
|
|
74
|
+
/**
|
|
75
|
+
* Every fill fetch stream currently tracked, across all subscriptions, keyed
|
|
76
|
+
* by the Request ID that opened it.
|
|
77
|
+
*
|
|
78
|
+
* Fill fetch streams are unidirectional and carry no control messages, so
|
|
79
|
+
* nothing here is inferred from a message alone; the transport events that
|
|
80
|
+
* end one are reported with {@link closeFillFetchStream}.
|
|
81
|
+
*/
|
|
82
|
+
get fillFetchStreams(): ReadonlyMap<bigint, FillFetchStreamState>;
|
|
83
|
+
/** The fill fetch streams belonging to one subscription. */
|
|
84
|
+
fillFetchStreamsFor(subscribeId: bigint): ReadonlyMap<bigint, FillFetchStreamState>;
|
|
85
|
+
/** A subscription's current Forward State, or undefined if it is unknown here. */
|
|
86
|
+
forwardStateOf(subscribeId: bigint): 0 | 1 | undefined;
|
|
87
|
+
/** What kind of request a Request ID names, or undefined if it names none. */
|
|
88
|
+
requestKindOf(requestId: bigint): RequestKind | undefined;
|
|
89
|
+
private checkDuplicateRequestId;
|
|
90
|
+
validateOutgoing(message: Draft20Message): ValidationResult<Draft20MessageType>;
|
|
91
|
+
receive(message: Draft20Message): TransitionResult<Draft20MessageType>;
|
|
92
|
+
send(message: Draft20Message): TransitionResult<Draft20MessageType>;
|
|
93
|
+
/**
|
|
94
|
+
* Receive a message that arrived on a known request stream.
|
|
95
|
+
*
|
|
96
|
+
* Prefer this over {@link receive} for anything that carries no Request ID of
|
|
97
|
+
* its own — SUBSCRIBE_OK, REQUEST_OK, REQUEST_ERROR, PUBLISH_DONE, FETCH_OK
|
|
98
|
+
* and PUBLISH_STATE_NOTIFY. Without the stream, the request-kind and
|
|
99
|
+
* direction rules of Section 10.10 cannot be checked at all, and the
|
|
100
|
+
* response-matching below falls back to FIFO guessing.
|
|
101
|
+
*/
|
|
102
|
+
receiveOn(requestId: bigint, message: Draft20Message): TransitionResult<Draft20MessageType>;
|
|
103
|
+
/** Send a message on a known request stream. See {@link receiveOn}. */
|
|
104
|
+
sendOn(requestId: bigint, message: Draft20Message): TransitionResult<Draft20MessageType>;
|
|
105
|
+
private applyTransition;
|
|
106
|
+
private handleSetup;
|
|
107
|
+
private handleGoAway;
|
|
108
|
+
private requireReady;
|
|
109
|
+
private handleSubscribe;
|
|
110
|
+
/**
|
|
111
|
+
* Open a fill fetch stream if this message asked for one — draft-20 Sections
|
|
112
|
+
* 5.1.3 and 5.1.3.1, both new in draft-20.
|
|
113
|
+
*
|
|
114
|
+
* Three rules, all of which the draft states as bullets and all of which are
|
|
115
|
+
* easy to get wrong by analogy with draft-19's Joining FETCH:
|
|
116
|
+
*
|
|
117
|
+
* 1. Presence of FILL_PARAMETERS is the request. There is no separate
|
|
118
|
+
* message and no Fetch Type; an empty FILL_PARAMETERS still opens a
|
|
119
|
+
* stream, with every setting inherited from the subscription.
|
|
120
|
+
* 2. It only opens one "while Forward State is 1". FILL_PARAMETERS carried
|
|
121
|
+
* while Forward State is 0 opens nothing, and later transitioning to
|
|
122
|
+
* Forward State 1 without re-sending FILL_PARAMETERS opens nothing
|
|
123
|
+
* either — so this is checked at the moment the message is processed and
|
|
124
|
+
* never retried.
|
|
125
|
+
* 3. Streams accumulate. The new one is keyed by the opening message's
|
|
126
|
+
* Request ID and does not disturb any stream already open on the same
|
|
127
|
+
* subscription.
|
|
128
|
+
*
|
|
129
|
+
* The opened stream has no FETCH_OK: per DECISIONS.md D7 (SPEC-DELTA Section
|
|
130
|
+
* 11 Q9) there is no End Location and no End Of Track for a fill, and stream
|
|
131
|
+
* FIN is the only completion signal. Nothing here synthesizes one, and the
|
|
132
|
+
* stream is deliberately absent from {@link fetches}.
|
|
133
|
+
*/
|
|
134
|
+
private applyFillParameters;
|
|
135
|
+
/**
|
|
136
|
+
* Report the transport event that ended a fill fetch stream.
|
|
137
|
+
*
|
|
138
|
+
* A fill fetch stream carries no control message of its own, so its end is
|
|
139
|
+
* never inferable from the message sequence:
|
|
140
|
+
*
|
|
141
|
+
* - `'complete'` — the publisher FINed the stream. Section 5.1.3.1 makes
|
|
142
|
+
* that the ONLY completion signal; there is no FETCH_OK to read an End
|
|
143
|
+
* Location or an End Of Track flag from (DECISIONS.md D7 / Q9).
|
|
144
|
+
* - `'reset'` — the publisher reset it, which is how a fill failure is
|
|
145
|
+
* signalled, "because there is no REQUEST_ERROR associated with a fill
|
|
146
|
+
* fetch stream".
|
|
147
|
+
* - `'cancelled'` — the subscriber sent STOP_SENDING.
|
|
148
|
+
*
|
|
149
|
+
* Either way "Resetting or cancelling a fill fetch stream, by either
|
|
150
|
+
* endpoint, does not affect the subscription, which continues to deliver
|
|
151
|
+
* objects using subscribe subgroups and datagrams", so the subscription's
|
|
152
|
+
* own state is untouched here.
|
|
153
|
+
*/
|
|
154
|
+
closeFillFetchStream(requestId: bigint, phase: Exclude<FillFetchStreamPhase, 'open'>): SideEffect[];
|
|
155
|
+
private handleSubscribeOk;
|
|
156
|
+
private handleRequestUpdate;
|
|
157
|
+
/**
|
|
158
|
+
* PUBLISH_STATE_NOTIFY — draft-20 Section 10.10, new in draft-20.
|
|
159
|
+
*
|
|
160
|
+
* Three properties set it apart from every other control message, and all
|
|
161
|
+
* three are enforced here:
|
|
162
|
+
*
|
|
163
|
+
* - **Unilateral.** "The receiver does not respond with REQUEST_OK or
|
|
164
|
+
* REQUEST_ERROR", so nothing is queued as pending and nothing is
|
|
165
|
+
* dequeued. A REQUEST_OK arriving later belongs to some other request.
|
|
166
|
+
* - **Not rate-limited.** "The message is not subject to the
|
|
167
|
+
* MAX_REQUEST_UPDATES limit", so `outstandingUpdates` is deliberately not
|
|
168
|
+
* touched — that counter exists only for REQUEST_UPDATE.
|
|
169
|
+
* - **Publisher to subscriber, subscriptions only.** "An endpoint that
|
|
170
|
+
* receives a PUBLISH_STATE_NOTIFY for any other request type, or from the
|
|
171
|
+
* subscriber, MUST close the session with a PROTOCOL_VIOLATION."
|
|
172
|
+
*
|
|
173
|
+
* The last one needs the request stream, because the message has no Request
|
|
174
|
+
* ID field. Called through {@link receive}/{@link send} without one, the
|
|
175
|
+
* kind and direction rules cannot be evaluated and the message is allowed
|
|
176
|
+
* through unchecked rather than guessed at.
|
|
177
|
+
*/
|
|
178
|
+
private handlePublishStateNotify;
|
|
179
|
+
private handlePublish;
|
|
180
|
+
private handlePublishDone;
|
|
181
|
+
private handleFetch;
|
|
182
|
+
private handleFetchOk;
|
|
183
|
+
private handleRequestError;
|
|
184
|
+
private handleRequestOk;
|
|
185
|
+
private handleGenericRequest;
|
|
186
|
+
private restoreUpdateCredit;
|
|
187
|
+
private dropPending;
|
|
188
|
+
private dequeuePending;
|
|
189
|
+
private handleReadyPhaseMessage;
|
|
190
|
+
reset(): void;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare function createDraft20SessionState(role: 'client' | 'server'): Draft20SessionFSM;
|
|
194
|
+
|
|
195
|
+
export { Draft20SessionFSM, type FillFetchStreamPhase, type FillFetchStreamState, type PublisherSide, type RequestKind, SessionPhase, SideEffect, TransitionResult, ValidationResult, createDraft20SessionState };
|
package/dist/draft20.cjs
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var _chunkMAXEHYVBcjs = require('./chunk-MAXEHYVB.cjs');
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var _chunkBMJMY6FXcjs = require('./chunk-BMJMY6FX.cjs');
|
|
58
|
+
require('./chunk-4XLYCT5Q.cjs');
|
|
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
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
exports.BIDIRECTIONAL_MESSAGES = _chunkBMJMY6FXcjs.BIDIRECTIONAL_MESSAGES; exports.CLIENT_ONLY_MESSAGES = _chunkBMJMY6FXcjs.CLIENT_ONLY_MESSAGES; exports.CONTROL_MESSAGES = _chunkBMJMY6FXcjs.CONTROL_MESSAGES; exports.DRAFT_VERSION = DRAFT_VERSION; exports.DataStreamResetCode = DataStreamResetCode; exports.Draft20SessionFSM = _chunkBMJMY6FXcjs.Draft20SessionFSM; exports.MESSAGE_ID_MAP = _chunkMAXEHYVBcjs.MESSAGE_ID_MAP; exports.MESSAGE_TYPE_MAP = _chunkMAXEHYVBcjs.MESSAGE_TYPE_MAP; exports.MSG_FETCH = _chunkMAXEHYVBcjs.MSG_FETCH; exports.MSG_FETCH_OK = _chunkMAXEHYVBcjs.MSG_FETCH_OK; exports.MSG_GOAWAY = _chunkMAXEHYVBcjs.MSG_GOAWAY; exports.MSG_NAMESPACE = _chunkMAXEHYVBcjs.MSG_NAMESPACE; exports.MSG_NAMESPACE_DONE = _chunkMAXEHYVBcjs.MSG_NAMESPACE_DONE; exports.MSG_PUBLISH = _chunkMAXEHYVBcjs.MSG_PUBLISH; exports.MSG_PUBLISH_DONE = _chunkMAXEHYVBcjs.MSG_PUBLISH_DONE; exports.MSG_PUBLISH_NAMESPACE = _chunkMAXEHYVBcjs.MSG_PUBLISH_NAMESPACE; exports.MSG_PUBLISH_OK = _chunkMAXEHYVBcjs.MSG_PUBLISH_OK; exports.MSG_PUBLISH_SKIPPED = _chunkMAXEHYVBcjs.MSG_PUBLISH_SKIPPED; exports.MSG_PUBLISH_STATE_NOTIFY = _chunkMAXEHYVBcjs.MSG_PUBLISH_STATE_NOTIFY; exports.MSG_REQUEST_ERROR = _chunkMAXEHYVBcjs.MSG_REQUEST_ERROR; exports.MSG_REQUEST_OK = _chunkMAXEHYVBcjs.MSG_REQUEST_OK; exports.MSG_REQUEST_UPDATE = _chunkMAXEHYVBcjs.MSG_REQUEST_UPDATE; exports.MSG_SETUP = _chunkMAXEHYVBcjs.MSG_SETUP; exports.MSG_SUBSCRIBE = _chunkMAXEHYVBcjs.MSG_SUBSCRIBE; exports.MSG_SUBSCRIBE_NAMESPACE = _chunkMAXEHYVBcjs.MSG_SUBSCRIBE_NAMESPACE; exports.MSG_SUBSCRIBE_OK = _chunkMAXEHYVBcjs.MSG_SUBSCRIBE_OK; exports.MSG_SUBSCRIBE_TRACKS = _chunkMAXEHYVBcjs.MSG_SUBSCRIBE_TRACKS; exports.MSG_TRACK_STATUS = _chunkMAXEHYVBcjs.MSG_TRACK_STATUS; exports.PROTOCOL_STRING = PROTOCOL_STRING; exports.PublishDoneCode = PublishDoneCode; exports.REQUEST_STREAM_OPENERS = _chunkBMJMY6FXcjs.REQUEST_STREAM_OPENERS; exports.RETIRED_PUBLISH_DONE_CODES = RETIRED_PUBLISH_DONE_CODES; exports.RETIRED_REQUEST_ERROR_CODES = RETIRED_REQUEST_ERROR_CODES; exports.RETIRED_SESSION_TERMINATION_CODES = RETIRED_SESSION_TERMINATION_CODES; exports.RequestErrorCode = RequestErrorCode; exports.SERVER_ONLY_MESSAGES = _chunkBMJMY6FXcjs.SERVER_ONLY_MESSAGES; exports.SETUP_OPT_AUTHORITY = _chunkMAXEHYVBcjs.SETUP_OPT_AUTHORITY; exports.SETUP_OPT_AUTHORIZATION_TOKEN = _chunkMAXEHYVBcjs.SETUP_OPT_AUTHORIZATION_TOKEN; exports.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE = _chunkMAXEHYVBcjs.SETUP_OPT_MAX_AUTH_TOKEN_CACHE_SIZE; exports.SETUP_OPT_MAX_FILTER_RANGES = _chunkMAXEHYVBcjs.SETUP_OPT_MAX_FILTER_RANGES; exports.SETUP_OPT_MAX_REQUEST_UPDATES = _chunkMAXEHYVBcjs.SETUP_OPT_MAX_REQUEST_UPDATES; exports.SETUP_OPT_MOQT_IMPLEMENTATION = _chunkMAXEHYVBcjs.SETUP_OPT_MOQT_IMPLEMENTATION; exports.SETUP_OPT_PATH = _chunkMAXEHYVBcjs.SETUP_OPT_PATH; exports.SessionTerminationCode = SessionTerminationCode; exports.UNKNOWN_STREAM_COUNT = _chunkMAXEHYVBcjs.UNKNOWN_STREAM_COUNT; exports.createDataStreamDecoder = _chunkMAXEHYVBcjs.createDataStreamDecoder; exports.createDraft20Codec = _chunkMAXEHYVBcjs.createDraft20Codec; exports.createDraft20SessionState = _chunkBMJMY6FXcjs.createDraft20SessionState; exports.createFetchStreamDecoder = _chunkMAXEHYVBcjs.createFetchStreamDecoder; exports.createStreamDecoder = _chunkMAXEHYVBcjs.createStreamDecoder; exports.createSubgroupStreamDecoder = _chunkMAXEHYVBcjs.createSubgroupStreamDecoder; exports.decodeDataStream = _chunkMAXEHYVBcjs.decodeDataStream; exports.decodeDatagram = _chunkMAXEHYVBcjs.decodeDatagram; exports.decodeFetchStream = _chunkMAXEHYVBcjs.decodeFetchStream; exports.decodeMessage = _chunkMAXEHYVBcjs.decodeMessage; exports.decodeSubgroupStream = _chunkMAXEHYVBcjs.decodeSubgroupStream; exports.encodeDatagram = _chunkMAXEHYVBcjs.encodeDatagram; exports.encodeFetchStream = _chunkMAXEHYVBcjs.encodeFetchStream; exports.encodeMessage = _chunkMAXEHYVBcjs.encodeMessage; exports.encodeSubgroupStream = _chunkMAXEHYVBcjs.encodeSubgroupStream; exports.getLegalIncoming = _chunkBMJMY6FXcjs.getLegalIncoming; exports.getLegalOutgoing = _chunkBMJMY6FXcjs.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-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 };
|