@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.
- package/dist/{chunk-YBSEOSSP.js → chunk-A27S7HW7.js} +5 -1
- package/dist/{chunk-5WFXFLL4.cjs → chunk-FUFTMAQD.cjs} +96 -63
- package/dist/{chunk-2NARXGVA.cjs → chunk-FWISIR26.cjs} +5 -1
- package/dist/{chunk-23YG7F46.js → chunk-IXHOBNXA.js} +117 -17
- package/dist/{chunk-3BSZ55L3.cjs → chunk-NLYTRGXA.cjs} +153 -19
- package/dist/{chunk-GDRGWFEK.cjs → chunk-NPWHHWXT.cjs} +249 -37
- package/dist/{chunk-IQPDRQVC.js → chunk-U2B3B42P.js} +62 -29
- package/dist/{chunk-WNTXF3DE.cjs → chunk-YBZD3DU5.cjs} +127 -27
- package/dist/{chunk-DC4L6ZIT.js → chunk-YTXLWKOR.js} +153 -19
- package/dist/{chunk-YPXLV5YK.js → chunk-Z66WDWHI.js} +249 -37
- package/dist/{codec-qPzfmLNu.d.ts → codec-B2mc2g3i.d.ts} +5 -5
- package/dist/{codec-CTvFtQQI.d.cts → codec-Bvr7rFtj.d.cts} +5 -5
- package/dist/draft14-session.cjs +2 -2
- package/dist/draft14-session.d.cts +4 -4
- package/dist/draft14-session.d.ts +4 -4
- package/dist/draft14-session.js +1 -1
- package/dist/draft14.cjs +4 -4
- package/dist/draft14.d.cts +15 -15
- package/dist/draft14.d.ts +15 -15
- package/dist/draft14.js +3 -3
- package/dist/draft7-session.cjs +2 -2
- package/dist/draft7-session.d.cts +3 -3
- package/dist/draft7-session.d.ts +3 -3
- package/dist/draft7-session.js +1 -1
- package/dist/draft7.cjs +5 -5
- package/dist/draft7.d.cts +10 -10
- package/dist/draft7.d.ts +10 -10
- package/dist/draft7.js +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -3
- package/dist/{session-types-B9NIf7_F.d.ts → session-types-DFjMk4HH.d.ts} +20 -20
- package/dist/{session-types-CCo-oA-d.d.cts → session-types-DW1RSZX_.d.cts} +20 -20
- package/dist/session.cjs +4 -4
- package/dist/session.d.cts +3 -3
- package/dist/session.d.ts +3 -3
- package/dist/session.js +2 -2
- package/dist/{types-CIk5W10V.d.ts → types-BTFeKYCb.d.cts} +37 -37
- package/dist/{types-CIk5W10V.d.cts → types-BTFeKYCb.d.ts} +37 -37
- package/dist/{types-ClXELFGN.d.cts → types-DPYE49t0.d.cts} +36 -36
- package/dist/{types-ClXELFGN.d.ts → types-DPYE49t0.d.ts} +36 -36
- package/package.json +7 -7
- package/src/core/buffer-reader.ts +16 -9
- package/src/core/buffer-writer.ts +2 -2
- package/src/core/errors.ts +1 -1
- package/src/core/session-types.ts +28 -41
- package/src/core/types.ts +70 -70
- package/src/drafts/draft07/announce-fsm.ts +1 -1
- package/src/drafts/draft07/codec.ts +195 -86
- package/src/drafts/draft07/index.ts +43 -44
- package/src/drafts/draft07/messages.ts +1 -1
- package/src/drafts/draft07/parameters.ts +2 -2
- package/src/drafts/draft07/rules.ts +68 -37
- package/src/drafts/draft07/session-fsm.ts +330 -117
- package/src/drafts/draft07/session.ts +10 -10
- package/src/drafts/draft07/subscription-fsm.ts +1 -1
- package/src/drafts/draft07/varint.ts +4 -4
- package/src/drafts/draft14/codec.ts +339 -189
- package/src/drafts/draft14/index.ts +103 -108
- package/src/drafts/draft14/messages.ts +61 -61
- package/src/drafts/draft14/rules.ts +77 -34
- package/src/drafts/draft14/session-fsm.ts +458 -146
- package/src/drafts/draft14/session.ts +13 -13
- package/src/drafts/draft14/types.ts +68 -68
- package/src/index.ts +66 -31
- package/src/session.ts +20 -20
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MoqtMessage, MoqtMessageType } from "./types.js";
|
|
2
2
|
|
|
3
|
-
export type SessionPhase =
|
|
4
|
-
| 'idle'
|
|
5
|
-
| 'setup'
|
|
6
|
-
| 'ready'
|
|
7
|
-
| 'draining'
|
|
8
|
-
| 'closed'
|
|
9
|
-
| 'error';
|
|
3
|
+
export type SessionPhase = "idle" | "setup" | "ready" | "draining" | "closed" | "error";
|
|
10
4
|
|
|
11
|
-
export type SubscriptionPhase =
|
|
12
|
-
| 'pending'
|
|
13
|
-
| 'active'
|
|
14
|
-
| 'error'
|
|
15
|
-
| 'done';
|
|
5
|
+
export type SubscriptionPhase = "pending" | "active" | "error" | "done";
|
|
16
6
|
|
|
17
|
-
export type AnnouncePhase =
|
|
18
|
-
| 'pending'
|
|
19
|
-
| 'active'
|
|
20
|
-
| 'error';
|
|
7
|
+
export type AnnouncePhase = "pending" | "active" | "error";
|
|
21
8
|
|
|
22
|
-
export type PublishPhase =
|
|
9
|
+
export type PublishPhase = "pending" | "active" | "error" | "done";
|
|
23
10
|
|
|
24
|
-
export type FetchPhase =
|
|
11
|
+
export type FetchPhase = "pending" | "active" | "error" | "cancelled";
|
|
25
12
|
|
|
26
13
|
export interface SubscriptionState {
|
|
27
14
|
readonly subscribeId: bigint;
|
|
@@ -47,12 +34,12 @@ export interface FetchState {
|
|
|
47
34
|
|
|
48
35
|
export interface SessionStateOptions {
|
|
49
36
|
codec: { draft: string };
|
|
50
|
-
role:
|
|
37
|
+
role: "client" | "server";
|
|
51
38
|
}
|
|
52
39
|
|
|
53
40
|
export interface SessionState<M = MoqtMessage, T extends string = MoqtMessageType> {
|
|
54
41
|
readonly phase: SessionPhase;
|
|
55
|
-
readonly role:
|
|
42
|
+
readonly role: "client" | "server";
|
|
56
43
|
receive(message: M): TransitionResult<T>;
|
|
57
44
|
validateOutgoing(message: M): ValidationResult<T>;
|
|
58
45
|
send(message: M): TransitionResult<T>;
|
|
@@ -79,25 +66,25 @@ export interface ProtocolViolation<T extends string = MoqtMessageType> {
|
|
|
79
66
|
}
|
|
80
67
|
|
|
81
68
|
export type ProtocolViolationCode =
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
69
|
+
| "MESSAGE_BEFORE_SETUP"
|
|
70
|
+
| "UNEXPECTED_MESSAGE"
|
|
71
|
+
| "DUPLICATE_SUBSCRIBE_ID"
|
|
72
|
+
| "UNKNOWN_SUBSCRIBE_ID"
|
|
73
|
+
| "DUPLICATE_REQUEST_ID"
|
|
74
|
+
| "UNKNOWN_REQUEST_ID"
|
|
75
|
+
| "ROLE_VIOLATION"
|
|
76
|
+
| "STATE_VIOLATION"
|
|
77
|
+
| "SETUP_VIOLATION";
|
|
91
78
|
|
|
92
79
|
export type SideEffect =
|
|
93
|
-
| { type:
|
|
94
|
-
| { type:
|
|
95
|
-
| { type:
|
|
96
|
-
| { type:
|
|
97
|
-
| { type:
|
|
98
|
-
| { type:
|
|
99
|
-
| { type:
|
|
100
|
-
| { type:
|
|
101
|
-
| { type:
|
|
102
|
-
| { type:
|
|
103
|
-
| { type:
|
|
80
|
+
| { type: "subscription-activated"; subscribeId: bigint }
|
|
81
|
+
| { type: "subscription-ended"; subscribeId: bigint; reason: string }
|
|
82
|
+
| { type: "announce-activated"; namespace: string[] }
|
|
83
|
+
| { type: "announce-ended"; namespace: string[] }
|
|
84
|
+
| { type: "publish-activated"; requestId: bigint }
|
|
85
|
+
| { type: "publish-ended"; requestId: bigint; reason: string }
|
|
86
|
+
| { type: "fetch-activated"; requestId: bigint }
|
|
87
|
+
| { type: "fetch-ended"; requestId: bigint; reason: string }
|
|
88
|
+
| { type: "session-ready" }
|
|
89
|
+
| { type: "session-draining"; goAwayUri: string }
|
|
90
|
+
| { type: "session-closed" };
|
package/src/core/types.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
// Draft identifiers
|
|
2
|
-
export type Draft =
|
|
3
|
-
export type DraftShorthand =
|
|
2
|
+
export type Draft = "draft-ietf-moq-transport-07" | "draft-ietf-moq-transport-14";
|
|
3
|
+
export type DraftShorthand = "07" | "14";
|
|
4
4
|
|
|
5
5
|
// All MoQT message type tags
|
|
6
6
|
export type MoqtMessageType =
|
|
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
|
-
|
|
|
7
|
+
| "client_setup"
|
|
8
|
+
| "server_setup"
|
|
9
|
+
| "subscribe"
|
|
10
|
+
| "subscribe_ok"
|
|
11
|
+
| "subscribe_error"
|
|
12
|
+
| "subscribe_done"
|
|
13
|
+
| "subscribe_update"
|
|
14
|
+
| "unsubscribe"
|
|
15
|
+
| "announce"
|
|
16
|
+
| "announce_ok"
|
|
17
|
+
| "announce_error"
|
|
18
|
+
| "announce_cancel"
|
|
19
|
+
| "unannounce"
|
|
20
|
+
| "track_status_request"
|
|
21
|
+
| "track_status"
|
|
22
|
+
| "object_stream"
|
|
23
|
+
| "object_datagram"
|
|
24
|
+
| "stream_header_track"
|
|
25
|
+
| "stream_header_group"
|
|
26
|
+
| "stream_header_subgroup"
|
|
27
|
+
| "goaway"
|
|
28
|
+
| "subscribe_announces"
|
|
29
|
+
| "subscribe_announces_ok"
|
|
30
|
+
| "subscribe_announces_error"
|
|
31
|
+
| "unsubscribe_announces"
|
|
32
|
+
| "max_subscribe_id"
|
|
33
|
+
| "fetch"
|
|
34
|
+
| "fetch_ok"
|
|
35
|
+
| "fetch_error"
|
|
36
|
+
| "fetch_cancel";
|
|
37
37
|
|
|
38
38
|
// Base message interface
|
|
39
39
|
export interface BaseMessage {
|
|
@@ -42,20 +42,20 @@ export interface BaseMessage {
|
|
|
42
42
|
|
|
43
43
|
// Setup messages
|
|
44
44
|
export interface ClientSetup extends BaseMessage {
|
|
45
|
-
readonly type:
|
|
45
|
+
readonly type: "client_setup";
|
|
46
46
|
readonly supportedVersions: bigint[];
|
|
47
47
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export interface ServerSetup extends BaseMessage {
|
|
51
|
-
readonly type:
|
|
51
|
+
readonly type: "server_setup";
|
|
52
52
|
readonly selectedVersion: bigint;
|
|
53
53
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Subscribe messages
|
|
57
57
|
export interface Subscribe extends BaseMessage {
|
|
58
|
-
readonly type:
|
|
58
|
+
readonly type: "subscribe";
|
|
59
59
|
readonly subscribeId: bigint;
|
|
60
60
|
readonly trackAlias: bigint;
|
|
61
61
|
readonly trackNamespace: string[];
|
|
@@ -70,10 +70,10 @@ export interface Subscribe extends BaseMessage {
|
|
|
70
70
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export type FilterType =
|
|
73
|
+
export type FilterType = "latest_group" | "latest_object" | "absolute_start" | "absolute_range";
|
|
74
74
|
|
|
75
75
|
export interface SubscribeOk extends BaseMessage {
|
|
76
|
-
readonly type:
|
|
76
|
+
readonly type: "subscribe_ok";
|
|
77
77
|
readonly subscribeId: bigint;
|
|
78
78
|
readonly expires: bigint;
|
|
79
79
|
readonly groupOrder: GroupOrderValue;
|
|
@@ -83,10 +83,10 @@ export interface SubscribeOk extends BaseMessage {
|
|
|
83
83
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export type GroupOrderValue =
|
|
86
|
+
export type GroupOrderValue = "ascending" | "descending" | "original";
|
|
87
87
|
|
|
88
88
|
export interface SubscribeError extends BaseMessage {
|
|
89
|
-
readonly type:
|
|
89
|
+
readonly type: "subscribe_error";
|
|
90
90
|
readonly subscribeId: bigint;
|
|
91
91
|
readonly errorCode: bigint;
|
|
92
92
|
readonly reasonPhrase: string;
|
|
@@ -94,7 +94,7 @@ export interface SubscribeError extends BaseMessage {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export interface SubscribeDone extends BaseMessage {
|
|
97
|
-
readonly type:
|
|
97
|
+
readonly type: "subscribe_done";
|
|
98
98
|
readonly subscribeId: bigint;
|
|
99
99
|
readonly statusCode: bigint;
|
|
100
100
|
readonly reasonPhrase: string;
|
|
@@ -104,7 +104,7 @@ export interface SubscribeDone extends BaseMessage {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export interface SubscribeUpdate extends BaseMessage {
|
|
107
|
-
readonly type:
|
|
107
|
+
readonly type: "subscribe_update";
|
|
108
108
|
readonly subscribeId: bigint;
|
|
109
109
|
readonly startGroup: bigint;
|
|
110
110
|
readonly startObject: bigint;
|
|
@@ -115,50 +115,50 @@ export interface SubscribeUpdate extends BaseMessage {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
export interface Unsubscribe extends BaseMessage {
|
|
118
|
-
readonly type:
|
|
118
|
+
readonly type: "unsubscribe";
|
|
119
119
|
readonly subscribeId: bigint;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// Announce messages
|
|
123
123
|
export interface Announce extends BaseMessage {
|
|
124
|
-
readonly type:
|
|
124
|
+
readonly type: "announce";
|
|
125
125
|
readonly trackNamespace: string[];
|
|
126
126
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
export interface AnnounceOk extends BaseMessage {
|
|
130
|
-
readonly type:
|
|
130
|
+
readonly type: "announce_ok";
|
|
131
131
|
readonly trackNamespace: string[];
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export interface AnnounceError extends BaseMessage {
|
|
135
|
-
readonly type:
|
|
135
|
+
readonly type: "announce_error";
|
|
136
136
|
readonly trackNamespace: string[];
|
|
137
137
|
readonly errorCode: bigint;
|
|
138
138
|
readonly reasonPhrase: string;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export interface AnnounceCancel extends BaseMessage {
|
|
142
|
-
readonly type:
|
|
142
|
+
readonly type: "announce_cancel";
|
|
143
143
|
readonly trackNamespace: string[];
|
|
144
144
|
readonly errorCode: bigint;
|
|
145
145
|
readonly reasonPhrase: string;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
export interface Unannounce extends BaseMessage {
|
|
149
|
-
readonly type:
|
|
149
|
+
readonly type: "unannounce";
|
|
150
150
|
readonly trackNamespace: string[];
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// Track status
|
|
154
154
|
export interface TrackStatusRequest extends BaseMessage {
|
|
155
|
-
readonly type:
|
|
155
|
+
readonly type: "track_status_request";
|
|
156
156
|
readonly trackNamespace: string[];
|
|
157
157
|
readonly trackName: string;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export interface TrackStatus extends BaseMessage {
|
|
161
|
-
readonly type:
|
|
161
|
+
readonly type: "track_status";
|
|
162
162
|
readonly trackNamespace: string[];
|
|
163
163
|
readonly trackName: string;
|
|
164
164
|
readonly statusCode: bigint;
|
|
@@ -168,7 +168,7 @@ export interface TrackStatus extends BaseMessage {
|
|
|
168
168
|
|
|
169
169
|
// Object/stream messages
|
|
170
170
|
export interface ObjectStream extends BaseMessage {
|
|
171
|
-
readonly type:
|
|
171
|
+
readonly type: "object_stream";
|
|
172
172
|
readonly subscribeId: bigint;
|
|
173
173
|
readonly trackAlias: bigint;
|
|
174
174
|
readonly groupId: bigint;
|
|
@@ -179,7 +179,7 @@ export interface ObjectStream extends BaseMessage {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
export interface ObjectDatagram extends BaseMessage {
|
|
182
|
-
readonly type:
|
|
182
|
+
readonly type: "object_datagram";
|
|
183
183
|
readonly subscribeId: bigint;
|
|
184
184
|
readonly trackAlias: bigint;
|
|
185
185
|
readonly groupId: bigint;
|
|
@@ -190,14 +190,14 @@ export interface ObjectDatagram extends BaseMessage {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
export interface StreamHeaderTrack extends BaseMessage {
|
|
193
|
-
readonly type:
|
|
193
|
+
readonly type: "stream_header_track";
|
|
194
194
|
readonly subscribeId: bigint;
|
|
195
195
|
readonly trackAlias: bigint;
|
|
196
196
|
readonly publisherPriority: number;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
export interface StreamHeaderGroup extends BaseMessage {
|
|
200
|
-
readonly type:
|
|
200
|
+
readonly type: "stream_header_group";
|
|
201
201
|
readonly subscribeId: bigint;
|
|
202
202
|
readonly trackAlias: bigint;
|
|
203
203
|
readonly groupId: bigint;
|
|
@@ -205,7 +205,7 @@ export interface StreamHeaderGroup extends BaseMessage {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export interface StreamHeaderSubgroup extends BaseMessage {
|
|
208
|
-
readonly type:
|
|
208
|
+
readonly type: "stream_header_subgroup";
|
|
209
209
|
readonly subscribeId: bigint;
|
|
210
210
|
readonly trackAlias: bigint;
|
|
211
211
|
readonly groupId: bigint;
|
|
@@ -215,24 +215,24 @@ export interface StreamHeaderSubgroup extends BaseMessage {
|
|
|
215
215
|
|
|
216
216
|
// GoAway
|
|
217
217
|
export interface GoAway extends BaseMessage {
|
|
218
|
-
readonly type:
|
|
218
|
+
readonly type: "goaway";
|
|
219
219
|
readonly newSessionUri: string;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
// Subscribe Announces
|
|
223
223
|
export interface SubscribeAnnounces extends BaseMessage {
|
|
224
|
-
readonly type:
|
|
224
|
+
readonly type: "subscribe_announces";
|
|
225
225
|
readonly trackNamespace: string[];
|
|
226
226
|
readonly parameters: Map<bigint, Uint8Array>;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
export interface SubscribeAnnouncesOk extends BaseMessage {
|
|
230
|
-
readonly type:
|
|
230
|
+
readonly type: "subscribe_announces_ok";
|
|
231
231
|
readonly trackNamespace: string[];
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
export interface SubscribeAnnouncesError extends BaseMessage {
|
|
235
|
-
readonly type:
|
|
235
|
+
readonly type: "subscribe_announces_error";
|
|
236
236
|
readonly trackNamespace: string[];
|
|
237
237
|
readonly errorCode: bigint;
|
|
238
238
|
readonly reasonPhrase: string;
|
|
@@ -240,19 +240,19 @@ export interface SubscribeAnnouncesError extends BaseMessage {
|
|
|
240
240
|
|
|
241
241
|
// Unsubscribe Announces
|
|
242
242
|
export interface UnsubscribeAnnounces extends BaseMessage {
|
|
243
|
-
readonly type:
|
|
243
|
+
readonly type: "unsubscribe_announces";
|
|
244
244
|
readonly trackNamespace: string[];
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// Max Subscribe ID
|
|
248
248
|
export interface MaxSubscribeId extends BaseMessage {
|
|
249
|
-
readonly type:
|
|
249
|
+
readonly type: "max_subscribe_id";
|
|
250
250
|
readonly subscribeId: bigint;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
// Fetch
|
|
254
254
|
export interface Fetch extends BaseMessage {
|
|
255
|
-
readonly type:
|
|
255
|
+
readonly type: "fetch";
|
|
256
256
|
readonly subscribeId: bigint;
|
|
257
257
|
readonly trackNamespace: string[];
|
|
258
258
|
readonly trackName: string;
|
|
@@ -266,7 +266,7 @@ export interface Fetch extends BaseMessage {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
export interface FetchOk extends BaseMessage {
|
|
269
|
-
readonly type:
|
|
269
|
+
readonly type: "fetch_ok";
|
|
270
270
|
readonly subscribeId: bigint;
|
|
271
271
|
readonly groupOrder: GroupOrderValue;
|
|
272
272
|
readonly endOfTrack: boolean;
|
|
@@ -276,14 +276,14 @@ export interface FetchOk extends BaseMessage {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
export interface FetchError extends BaseMessage {
|
|
279
|
-
readonly type:
|
|
279
|
+
readonly type: "fetch_error";
|
|
280
280
|
readonly subscribeId: bigint;
|
|
281
281
|
readonly errorCode: bigint;
|
|
282
282
|
readonly reasonPhrase: string;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
export interface FetchCancel extends BaseMessage {
|
|
286
|
-
readonly type:
|
|
286
|
+
readonly type: "fetch_cancel";
|
|
287
287
|
readonly subscribeId: bigint;
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -344,11 +344,11 @@ export type DecodeResult<T> =
|
|
|
344
344
|
| { ok: false; error: DecodeError };
|
|
345
345
|
|
|
346
346
|
export type DecodeErrorCode =
|
|
347
|
-
|
|
|
348
|
-
|
|
|
349
|
-
|
|
|
350
|
-
|
|
|
351
|
-
|
|
|
347
|
+
| "UNEXPECTED_END"
|
|
348
|
+
| "INVALID_VARINT"
|
|
349
|
+
| "UNKNOWN_MESSAGE_TYPE"
|
|
350
|
+
| "INVALID_PARAMETER"
|
|
351
|
+
| "CONSTRAINT_VIOLATION";
|
|
352
352
|
|
|
353
353
|
export class DecodeError extends Error {
|
|
354
354
|
readonly code: DecodeErrorCode;
|
|
@@ -356,7 +356,7 @@ export class DecodeError extends Error {
|
|
|
356
356
|
|
|
357
357
|
constructor(code: DecodeErrorCode, message: string, offset: number) {
|
|
358
358
|
super(message);
|
|
359
|
-
this.name =
|
|
359
|
+
this.name = "DecodeError";
|
|
360
360
|
this.code = code;
|
|
361
361
|
this.offset = offset;
|
|
362
362
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Announce state tracking is integrated into SessionFSM.
|
|
2
|
-
export type {
|
|
2
|
+
export type { AnnouncePhase, AnnounceState } from "../../core/session-types.js";
|