@moqtap/codec 0.7.0 → 0.8.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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
  var _chunkKTVN4P6Jcjs = require('./chunk-KTVN4P6J.cjs');
4
4
 
@@ -6,7 +6,7 @@ var _chunkKTVN4P6Jcjs = require('./chunk-KTVN4P6J.cjs');
6
6
  var _chunkMH7537FBcjs = require('./chunk-MH7537FB.cjs');
7
7
 
8
8
 
9
- var _chunkY4FRXYX6cjs = require('./chunk-Y4FRXYX6.cjs');
9
+ var _chunkBQHLUT37cjs = require('./chunk-BQHLUT37.cjs');
10
10
 
11
11
 
12
12
  var _chunkJ3ASFPCXcjs = require('./chunk-J3ASFPCX.cjs');
@@ -41,6 +41,54 @@ var _chunkCZNW3R5Ecjs = require('./chunk-CZNW3R5E.cjs');
41
41
 
42
42
  var _chunk4XLYCT5Qcjs = require('./chunk-4XLYCT5Q.cjs');
43
43
 
44
+ // src/core/accessors.ts
45
+ function pick(msg, names) {
46
+ for (const name of names) {
47
+ const value = msg[name];
48
+ if (value != null) return value;
49
+ }
50
+ return void 0;
51
+ }
52
+ function bigintOf(value) {
53
+ if (value == null) return void 0;
54
+ if (typeof value === "bigint") return value;
55
+ if (typeof value === "number" || typeof value === "string") {
56
+ try {
57
+ return BigInt(value);
58
+ } catch (e) {
59
+ return void 0;
60
+ }
61
+ }
62
+ return void 0;
63
+ }
64
+ function requestIdOf(msg) {
65
+ return bigintOf(pick(msg, ["request_id", "requestId", "subscribe_id", "subscribeId"]));
66
+ }
67
+ function trackAliasOf(msg) {
68
+ return bigintOf(pick(msg, ["track_alias", "trackAlias"]));
69
+ }
70
+ function trackOf(msg) {
71
+ const source = _nullishCoalesce(pick(msg, ["standalone"]), () => ( msg));
72
+ const name = pick(source, ["track_name", "trackName"]);
73
+ if (typeof name !== "string") return void 0;
74
+ const namespace = pick(source, ["track_namespace", "trackNamespace"]);
75
+ return {
76
+ namespace: Array.isArray(namespace) ? namespace.map(String) : [],
77
+ name
78
+ };
79
+ }
80
+ function joiningRequestIdOf(msg) {
81
+ const source = _nullishCoalesce(pick(msg, ["joining"]), () => ( msg));
82
+ return bigintOf(
83
+ pick(source, [
84
+ "joining_request_id",
85
+ "joiningRequestId",
86
+ "joining_subscribe_id",
87
+ "joiningSubscribeId"
88
+ ])
89
+ );
90
+ }
91
+
44
92
  // src/index.ts
45
93
  var DRAFT_VERSIONS = {
46
94
  "07": 0xff000007n,
@@ -81,7 +129,7 @@ Supported draft values: ${Object.keys(DRAFT_VERSIONS).join(", ")}`
81
129
  case "13":
82
130
  return _chunkKCH4BQXKcjs.createDraft13Codec.call(void 0, );
83
131
  case "14":
84
- return _chunkY4FRXYX6cjs.createDraft14Codec.call(void 0, );
132
+ return _chunkBQHLUT37cjs.createDraft14Codec.call(void 0, );
85
133
  case "15":
86
134
  return _chunkJ3ASFPCXcjs.createDraft15Codec.call(void 0, );
87
135
  case "16":
@@ -100,4 +148,8 @@ Supported draft values: ${Object.keys(DRAFT_VERSIONS).join(", ")}`
100
148
 
101
149
 
102
150
 
103
- exports.DRAFT_VERSIONS = DRAFT_VERSIONS; exports.DecodeError = _chunk4XLYCT5Qcjs.DecodeError; exports.createCodec = createCodec;
151
+
152
+
153
+
154
+
155
+ exports.DRAFT_VERSIONS = DRAFT_VERSIONS; exports.DecodeError = _chunk4XLYCT5Qcjs.DecodeError; exports.createCodec = createCodec; exports.joiningRequestIdOf = joiningRequestIdOf; exports.requestIdOf = requestIdOf; exports.trackAliasOf = trackAliasOf; exports.trackOf = trackOf;
package/dist/index.d.cts CHANGED
@@ -7,7 +7,7 @@ import { D as Draft10Codec } from './codec-BOyrk_C9.cjs';
7
7
  import { D as Draft11Codec } from './codec-cou9XBMF.cjs';
8
8
  import { D as Draft12Codec } from './codec-BOtv3R5j.cjs';
9
9
  import { D as Draft13Codec } from './codec-hvkJfCF5.cjs';
10
- import { D as Draft14Codec } from './codec-B1snaM9L.cjs';
10
+ import { D as Draft14Codec } from './codec-BnamSx7L.cjs';
11
11
  import { D as Draft15Codec } from './codec-BqqoYdh_.cjs';
12
12
  import { D as Draft16Codec } from './codec-CyApDKwf.cjs';
13
13
  import { D as Draft17Codec } from './codec-NMsTK0GX.cjs';
@@ -20,13 +20,83 @@ import './types-0IWbU9Z_.cjs';
20
20
  import './types-Ck45Ex5S.cjs';
21
21
  import './types-Bio-91Rt.cjs';
22
22
  import './types-CXlSn0I9.cjs';
23
- import './types-DjmrHp_s.cjs';
23
+ import './types-CVeKIk7A.cjs';
24
24
  import './types-CPaYBsMG.cjs';
25
25
  import './types-Cm9fjeYC.cjs';
26
26
  import './types-D9eiB_9A.cjs';
27
27
  import './types-Cqp10JtB.cjs';
28
28
  import './types-zHgCS6o5.cjs';
29
29
 
30
+ /**
31
+ * Draft-agnostic readers for decoded control messages.
32
+ *
33
+ * The codec keeps one message model per draft, because the drafts genuinely
34
+ * disagree: a track alias travels in SUBSCRIBE through draft-11 and in
35
+ * SUBSCRIBE_OK from draft-12; a request was a `subscribe_id` through draft-10
36
+ * and a `request_id` after it; a joining FETCH points at a
37
+ * `joining_subscribe_id` through draft-13 and a `joining_request_id` after it.
38
+ * Faithfulness to each draft is the point of the codec.
39
+ *
40
+ * What consumers usually want is the answer, not the archaeology — and every
41
+ * one of them that has asked has written the same field-spelling ladder by
42
+ * hand. These accessors are that ladder, written once.
43
+ *
44
+ * Each returns `undefined` when the message does not carry the field, which
45
+ * includes the cases where the draft has not assigned it yet: `trackAliasOf`
46
+ * on a draft-14 SUBSCRIBE is `undefined` because the publisher has not chosen
47
+ * the alias until SUBSCRIBE_OK.
48
+ *
49
+ * Both snake_case (what this codec emits) and camelCase spellings are read, so
50
+ * these also work on messages recovered from qlog-style traces written by
51
+ * other tools.
52
+ */
53
+ /** Any decoded control message, from any draft. */
54
+ type AnyMessage = Readonly<Record<string, unknown>>;
55
+ /** A track's full identity: the namespace tuple plus the name within it. */
56
+ interface TrackIdentity {
57
+ readonly namespace: string[];
58
+ readonly name: string;
59
+ }
60
+ /**
61
+ * The request this message belongs to.
62
+ *
63
+ * Named `subscribe_id` through draft-10 and `request_id` from draft-11, when
64
+ * the id space widened to cover every request type rather than subscriptions
65
+ * alone.
66
+ *
67
+ * Returns `undefined` for draft-17+ responses, which carry no id at all: each
68
+ * request there has its own bidirectional stream, and that stream — not a
69
+ * field — is what ties a response to its request.
70
+ */
71
+ declare function requestIdOf(msg: AnyMessage): bigint | undefined;
72
+ /**
73
+ * The track alias this message assigns or refers to, if any.
74
+ *
75
+ * Which message carries it moved: SUBSCRIBE through draft-11, then SUBSCRIBE_OK
76
+ * from draft-12, when assigning the alias became the publisher's job. PUBLISH
77
+ * carries it alongside the track name in every draft that has PUBLISH.
78
+ */
79
+ declare function trackAliasOf(msg: AnyMessage): bigint | undefined;
80
+ /**
81
+ * The track this message names, or `undefined` if it names none.
82
+ *
83
+ * Covers SUBSCRIBE, PUBLISH, TRACK_STATUS and a standalone FETCH — whose track
84
+ * sits under `standalone` in most drafts and flat in draft-07, which predates
85
+ * joining fetch. A joining FETCH names no track of its own; use
86
+ * {@link joiningRequestIdOf} to find the request whose track it continues.
87
+ *
88
+ * PUBLISH_NAMESPACE and its relatives are namespace-only and yield
89
+ * `undefined`: a namespace is not a track.
90
+ */
91
+ declare function trackOf(msg: AnyMessage): TrackIdentity | undefined;
92
+ /**
93
+ * For a joining FETCH, the request whose track it continues.
94
+ *
95
+ * Spelled `joining_subscribe_id` through draft-13 and `joining_request_id`
96
+ * after it, nested under `joining` in every draft that has one.
97
+ */
98
+ declare function joiningRequestIdOf(msg: AnyMessage): bigint | undefined;
99
+
30
100
  /**
31
101
  * @moqtap/codec — MoQT wire-format codec
32
102
  *
@@ -91,4 +161,4 @@ declare function createCodec(options: CodecOptions & {
91
161
  */
92
162
  declare function createCodec(options: CodecOptions): Draft07Codec | Draft08Codec | Draft09Codec | Draft10Codec | Draft11Codec | Draft12Codec | Draft13Codec | Draft14Codec | Draft15Codec | Draft16Codec | Draft17Codec | Draft18Codec | Draft19Codec;
93
163
 
94
- export { CodecOptions, DRAFT_VERSIONS, createCodec };
164
+ export { type AnyMessage, CodecOptions, DRAFT_VERSIONS, type TrackIdentity, createCodec, joiningRequestIdOf, requestIdOf, trackAliasOf, trackOf };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { D as Draft10Codec } from './codec-BLYAy2OP.js';
7
7
  import { D as Draft11Codec } from './codec-DL0njGkL.js';
8
8
  import { D as Draft12Codec } from './codec-D47r_-Rl.js';
9
9
  import { D as Draft13Codec } from './codec-CWj5iTxA.js';
10
- import { D as Draft14Codec } from './codec-D49OofBr.js';
10
+ import { D as Draft14Codec } from './codec-CFhUGTu2.js';
11
11
  import { D as Draft15Codec } from './codec-BNS3gS77.js';
12
12
  import { D as Draft16Codec } from './codec-D2JbI2tp.js';
13
13
  import { D as Draft17Codec } from './codec-DJmV04i0.js';
@@ -20,13 +20,83 @@ import './types-0IWbU9Z_.js';
20
20
  import './types-Ck45Ex5S.js';
21
21
  import './types-Bio-91Rt.js';
22
22
  import './types-CXlSn0I9.js';
23
- import './types-DjmrHp_s.js';
23
+ import './types-CVeKIk7A.js';
24
24
  import './types-CPaYBsMG.js';
25
25
  import './types-Cm9fjeYC.js';
26
26
  import './types-D9eiB_9A.js';
27
27
  import './types-Cqp10JtB.js';
28
28
  import './types-zHgCS6o5.js';
29
29
 
30
+ /**
31
+ * Draft-agnostic readers for decoded control messages.
32
+ *
33
+ * The codec keeps one message model per draft, because the drafts genuinely
34
+ * disagree: a track alias travels in SUBSCRIBE through draft-11 and in
35
+ * SUBSCRIBE_OK from draft-12; a request was a `subscribe_id` through draft-10
36
+ * and a `request_id` after it; a joining FETCH points at a
37
+ * `joining_subscribe_id` through draft-13 and a `joining_request_id` after it.
38
+ * Faithfulness to each draft is the point of the codec.
39
+ *
40
+ * What consumers usually want is the answer, not the archaeology — and every
41
+ * one of them that has asked has written the same field-spelling ladder by
42
+ * hand. These accessors are that ladder, written once.
43
+ *
44
+ * Each returns `undefined` when the message does not carry the field, which
45
+ * includes the cases where the draft has not assigned it yet: `trackAliasOf`
46
+ * on a draft-14 SUBSCRIBE is `undefined` because the publisher has not chosen
47
+ * the alias until SUBSCRIBE_OK.
48
+ *
49
+ * Both snake_case (what this codec emits) and camelCase spellings are read, so
50
+ * these also work on messages recovered from qlog-style traces written by
51
+ * other tools.
52
+ */
53
+ /** Any decoded control message, from any draft. */
54
+ type AnyMessage = Readonly<Record<string, unknown>>;
55
+ /** A track's full identity: the namespace tuple plus the name within it. */
56
+ interface TrackIdentity {
57
+ readonly namespace: string[];
58
+ readonly name: string;
59
+ }
60
+ /**
61
+ * The request this message belongs to.
62
+ *
63
+ * Named `subscribe_id` through draft-10 and `request_id` from draft-11, when
64
+ * the id space widened to cover every request type rather than subscriptions
65
+ * alone.
66
+ *
67
+ * Returns `undefined` for draft-17+ responses, which carry no id at all: each
68
+ * request there has its own bidirectional stream, and that stream — not a
69
+ * field — is what ties a response to its request.
70
+ */
71
+ declare function requestIdOf(msg: AnyMessage): bigint | undefined;
72
+ /**
73
+ * The track alias this message assigns or refers to, if any.
74
+ *
75
+ * Which message carries it moved: SUBSCRIBE through draft-11, then SUBSCRIBE_OK
76
+ * from draft-12, when assigning the alias became the publisher's job. PUBLISH
77
+ * carries it alongside the track name in every draft that has PUBLISH.
78
+ */
79
+ declare function trackAliasOf(msg: AnyMessage): bigint | undefined;
80
+ /**
81
+ * The track this message names, or `undefined` if it names none.
82
+ *
83
+ * Covers SUBSCRIBE, PUBLISH, TRACK_STATUS and a standalone FETCH — whose track
84
+ * sits under `standalone` in most drafts and flat in draft-07, which predates
85
+ * joining fetch. A joining FETCH names no track of its own; use
86
+ * {@link joiningRequestIdOf} to find the request whose track it continues.
87
+ *
88
+ * PUBLISH_NAMESPACE and its relatives are namespace-only and yield
89
+ * `undefined`: a namespace is not a track.
90
+ */
91
+ declare function trackOf(msg: AnyMessage): TrackIdentity | undefined;
92
+ /**
93
+ * For a joining FETCH, the request whose track it continues.
94
+ *
95
+ * Spelled `joining_subscribe_id` through draft-13 and `joining_request_id`
96
+ * after it, nested under `joining` in every draft that has one.
97
+ */
98
+ declare function joiningRequestIdOf(msg: AnyMessage): bigint | undefined;
99
+
30
100
  /**
31
101
  * @moqtap/codec — MoQT wire-format codec
32
102
  *
@@ -91,4 +161,4 @@ declare function createCodec(options: CodecOptions & {
91
161
  */
92
162
  declare function createCodec(options: CodecOptions): Draft07Codec | Draft08Codec | Draft09Codec | Draft10Codec | Draft11Codec | Draft12Codec | Draft13Codec | Draft14Codec | Draft15Codec | Draft16Codec | Draft17Codec | Draft18Codec | Draft19Codec;
93
163
 
94
- export { CodecOptions, DRAFT_VERSIONS, createCodec };
164
+ export { type AnyMessage, CodecOptions, DRAFT_VERSIONS, type TrackIdentity, createCodec, joiningRequestIdOf, requestIdOf, trackAliasOf, trackOf };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-APTV6F72.js";
7
7
  import {
8
8
  createDraft14Codec
9
- } from "./chunk-DORX55MO.js";
9
+ } from "./chunk-JJEN2VG5.js";
10
10
  import {
11
11
  createDraft15Codec
12
12
  } from "./chunk-MD2OA7SE.js";
@@ -41,6 +41,54 @@ import {
41
41
  DecodeError
42
42
  } from "./chunk-KLPWJU6W.js";
43
43
 
44
+ // src/core/accessors.ts
45
+ function pick(msg, names) {
46
+ for (const name of names) {
47
+ const value = msg[name];
48
+ if (value != null) return value;
49
+ }
50
+ return void 0;
51
+ }
52
+ function bigintOf(value) {
53
+ if (value == null) return void 0;
54
+ if (typeof value === "bigint") return value;
55
+ if (typeof value === "number" || typeof value === "string") {
56
+ try {
57
+ return BigInt(value);
58
+ } catch {
59
+ return void 0;
60
+ }
61
+ }
62
+ return void 0;
63
+ }
64
+ function requestIdOf(msg) {
65
+ return bigintOf(pick(msg, ["request_id", "requestId", "subscribe_id", "subscribeId"]));
66
+ }
67
+ function trackAliasOf(msg) {
68
+ return bigintOf(pick(msg, ["track_alias", "trackAlias"]));
69
+ }
70
+ function trackOf(msg) {
71
+ const source = pick(msg, ["standalone"]) ?? msg;
72
+ const name = pick(source, ["track_name", "trackName"]);
73
+ if (typeof name !== "string") return void 0;
74
+ const namespace = pick(source, ["track_namespace", "trackNamespace"]);
75
+ return {
76
+ namespace: Array.isArray(namespace) ? namespace.map(String) : [],
77
+ name
78
+ };
79
+ }
80
+ function joiningRequestIdOf(msg) {
81
+ const source = pick(msg, ["joining"]) ?? msg;
82
+ return bigintOf(
83
+ pick(source, [
84
+ "joining_request_id",
85
+ "joiningRequestId",
86
+ "joining_subscribe_id",
87
+ "joiningSubscribeId"
88
+ ])
89
+ );
90
+ }
91
+
44
92
  // src/index.ts
45
93
  var DRAFT_VERSIONS = {
46
94
  "07": 0xff000007n,
@@ -99,5 +147,9 @@ Supported draft values: ${Object.keys(DRAFT_VERSIONS).join(", ")}`
99
147
  export {
100
148
  DRAFT_VERSIONS,
101
149
  DecodeError,
102
- createCodec
150
+ createCodec,
151
+ joiningRequestIdOf,
152
+ requestIdOf,
153
+ trackAliasOf,
154
+ trackOf
103
155
  };
@@ -8,7 +8,7 @@ import { D as Draft10Message, a as Draft10MessageType } from './types-0IWbU9Z_.c
8
8
  import { D as Draft11Message, a as Draft11MessageType } from './types-Ck45Ex5S.cjs';
9
9
  import { D as Draft12Message, a as Draft12MessageType } from './types-Bio-91Rt.cjs';
10
10
  import { D as Draft13Message, a as Draft13MessageType } from './types-CXlSn0I9.cjs';
11
- import { D as Draft14Message, a as Draft14MessageType } from './types-DjmrHp_s.cjs';
11
+ import { D as Draft14Message, a as Draft14MessageType } from './types-CVeKIk7A.cjs';
12
12
  import { D as Draft15Message, a as Draft15MessageType } from './types-CPaYBsMG.cjs';
13
13
  import { D as Draft16Message, a as Draft16MessageType } from './types-Cm9fjeYC.cjs';
14
14
  import { D as Draft17Message, a as Draft17MessageType } from './types-D9eiB_9A.cjs';
package/dist/session.d.ts CHANGED
@@ -8,7 +8,7 @@ import { D as Draft10Message, a as Draft10MessageType } from './types-0IWbU9Z_.j
8
8
  import { D as Draft11Message, a as Draft11MessageType } from './types-Ck45Ex5S.js';
9
9
  import { D as Draft12Message, a as Draft12MessageType } from './types-Bio-91Rt.js';
10
10
  import { D as Draft13Message, a as Draft13MessageType } from './types-CXlSn0I9.js';
11
- import { D as Draft14Message, a as Draft14MessageType } from './types-DjmrHp_s.js';
11
+ import { D as Draft14Message, a as Draft14MessageType } from './types-CVeKIk7A.js';
12
12
  import { D as Draft15Message, a as Draft15MessageType } from './types-CPaYBsMG.js';
13
13
  import { D as Draft16Message, a as Draft16MessageType } from './types-Cm9fjeYC.js';
14
14
  import { D as Draft17Message, a as Draft17MessageType } from './types-D9eiB_9A.js';
@@ -63,8 +63,8 @@ interface Draft14Subscribe extends Draft14BaseMessage {
63
63
  readonly request_id: bigint;
64
64
  readonly track_namespace: string[];
65
65
  readonly track_name: string;
66
- readonly subscriber_priority: bigint;
67
- readonly group_order: bigint;
66
+ readonly subscriber_priority: number;
67
+ readonly group_order: number;
68
68
  readonly forward: bigint;
69
69
  readonly filter_type: bigint;
70
70
  readonly start_group?: bigint;
@@ -77,7 +77,7 @@ interface Draft14SubscribeOk extends Draft14BaseMessage {
77
77
  readonly request_id: bigint;
78
78
  readonly track_alias: bigint;
79
79
  readonly expires: bigint;
80
- readonly group_order: bigint;
80
+ readonly group_order: number;
81
81
  readonly content_exists: bigint;
82
82
  readonly largest_location?: Location;
83
83
  readonly parameters: Draft14Params;
@@ -89,7 +89,7 @@ interface Draft14SubscribeUpdate extends Draft14BaseMessage {
89
89
  readonly start_group: bigint;
90
90
  readonly start_object: bigint;
91
91
  readonly end_group: bigint;
92
- readonly subscriber_priority: bigint;
92
+ readonly subscriber_priority: number;
93
93
  readonly forward: bigint;
94
94
  readonly parameters: Draft14Params;
95
95
  }
@@ -109,7 +109,7 @@ interface Draft14Publish extends Draft14BaseMessage {
109
109
  readonly track_namespace: string[];
110
110
  readonly track_name: string;
111
111
  readonly track_alias: bigint;
112
- readonly group_order: bigint;
112
+ readonly group_order: number;
113
113
  readonly content_exists: bigint;
114
114
  readonly largest_location?: Location;
115
115
  readonly forward: bigint;
@@ -119,8 +119,8 @@ interface Draft14PublishOk extends Draft14BaseMessage {
119
119
  readonly type: 'publish_ok';
120
120
  readonly request_id: bigint;
121
121
  readonly forward: bigint;
122
- readonly subscriber_priority: bigint;
123
- readonly group_order: bigint;
122
+ readonly subscriber_priority: number;
123
+ readonly group_order: number;
124
124
  readonly filter_type: bigint;
125
125
  readonly start_group?: bigint;
126
126
  readonly start_object?: bigint;
@@ -188,26 +188,34 @@ interface Draft14UnsubscribeNamespace extends Draft14BaseMessage {
188
188
  readonly type: 'unsubscribe_namespace';
189
189
  readonly track_namespace_prefix: string[];
190
190
  }
191
+ interface StandaloneFetch {
192
+ readonly track_namespace: string[];
193
+ readonly track_name: string;
194
+ readonly start_group: bigint;
195
+ readonly start_object: bigint;
196
+ readonly end_group: bigint;
197
+ readonly end_object: bigint;
198
+ }
199
+ interface JoiningFetch {
200
+ readonly joining_request_id: bigint;
201
+ readonly joining_start: bigint;
202
+ }
191
203
  interface Draft14Fetch extends Draft14BaseMessage {
192
204
  readonly type: 'fetch';
193
205
  readonly request_id: bigint;
194
- readonly subscriber_priority: bigint;
195
- readonly group_order: bigint;
206
+ readonly subscriber_priority: number;
207
+ readonly group_order: number;
196
208
  readonly fetch_type: bigint;
197
- readonly track_namespace?: string[];
198
- readonly track_name?: string;
199
- readonly start_group?: bigint;
200
- readonly start_object?: bigint;
201
- readonly end_group?: bigint;
202
- readonly end_object?: bigint;
203
- readonly joining_request_id?: bigint;
204
- readonly joining_start?: bigint;
209
+ /** Present when fetch_type = 1 */
210
+ readonly standalone?: StandaloneFetch;
211
+ /** Present when fetch_type = 2 or 3 */
212
+ readonly joining?: JoiningFetch;
205
213
  readonly parameters: Draft14Params;
206
214
  }
207
215
  interface Draft14FetchOk extends Draft14BaseMessage {
208
216
  readonly type: 'fetch_ok';
209
217
  readonly request_id: bigint;
210
- readonly group_order: bigint;
218
+ readonly group_order: number;
211
219
  readonly end_of_track: bigint;
212
220
  readonly end_location: Location;
213
221
  readonly parameters: Draft14Params;
@@ -227,8 +235,8 @@ interface Draft14TrackStatus extends Draft14BaseMessage {
227
235
  readonly request_id: bigint;
228
236
  readonly track_namespace: string[];
229
237
  readonly track_name: string;
230
- readonly subscriber_priority: bigint;
231
- readonly group_order: bigint;
238
+ readonly subscriber_priority: number;
239
+ readonly group_order: number;
232
240
  readonly forward: bigint;
233
241
  readonly filter_type: bigint;
234
242
  readonly start_group?: bigint;
@@ -240,7 +248,7 @@ interface Draft14TrackStatusOk extends Draft14BaseMessage {
240
248
  readonly request_id: bigint;
241
249
  readonly track_alias: bigint;
242
250
  readonly expires: bigint;
243
- readonly group_order: bigint;
251
+ readonly group_order: number;
244
252
  readonly content_exists: bigint;
245
253
  readonly largest_location?: Location;
246
254
  readonly parameters: Draft14Params;
@@ -63,8 +63,8 @@ interface Draft14Subscribe extends Draft14BaseMessage {
63
63
  readonly request_id: bigint;
64
64
  readonly track_namespace: string[];
65
65
  readonly track_name: string;
66
- readonly subscriber_priority: bigint;
67
- readonly group_order: bigint;
66
+ readonly subscriber_priority: number;
67
+ readonly group_order: number;
68
68
  readonly forward: bigint;
69
69
  readonly filter_type: bigint;
70
70
  readonly start_group?: bigint;
@@ -77,7 +77,7 @@ interface Draft14SubscribeOk extends Draft14BaseMessage {
77
77
  readonly request_id: bigint;
78
78
  readonly track_alias: bigint;
79
79
  readonly expires: bigint;
80
- readonly group_order: bigint;
80
+ readonly group_order: number;
81
81
  readonly content_exists: bigint;
82
82
  readonly largest_location?: Location;
83
83
  readonly parameters: Draft14Params;
@@ -89,7 +89,7 @@ interface Draft14SubscribeUpdate extends Draft14BaseMessage {
89
89
  readonly start_group: bigint;
90
90
  readonly start_object: bigint;
91
91
  readonly end_group: bigint;
92
- readonly subscriber_priority: bigint;
92
+ readonly subscriber_priority: number;
93
93
  readonly forward: bigint;
94
94
  readonly parameters: Draft14Params;
95
95
  }
@@ -109,7 +109,7 @@ interface Draft14Publish extends Draft14BaseMessage {
109
109
  readonly track_namespace: string[];
110
110
  readonly track_name: string;
111
111
  readonly track_alias: bigint;
112
- readonly group_order: bigint;
112
+ readonly group_order: number;
113
113
  readonly content_exists: bigint;
114
114
  readonly largest_location?: Location;
115
115
  readonly forward: bigint;
@@ -119,8 +119,8 @@ interface Draft14PublishOk extends Draft14BaseMessage {
119
119
  readonly type: 'publish_ok';
120
120
  readonly request_id: bigint;
121
121
  readonly forward: bigint;
122
- readonly subscriber_priority: bigint;
123
- readonly group_order: bigint;
122
+ readonly subscriber_priority: number;
123
+ readonly group_order: number;
124
124
  readonly filter_type: bigint;
125
125
  readonly start_group?: bigint;
126
126
  readonly start_object?: bigint;
@@ -188,26 +188,34 @@ interface Draft14UnsubscribeNamespace extends Draft14BaseMessage {
188
188
  readonly type: 'unsubscribe_namespace';
189
189
  readonly track_namespace_prefix: string[];
190
190
  }
191
+ interface StandaloneFetch {
192
+ readonly track_namespace: string[];
193
+ readonly track_name: string;
194
+ readonly start_group: bigint;
195
+ readonly start_object: bigint;
196
+ readonly end_group: bigint;
197
+ readonly end_object: bigint;
198
+ }
199
+ interface JoiningFetch {
200
+ readonly joining_request_id: bigint;
201
+ readonly joining_start: bigint;
202
+ }
191
203
  interface Draft14Fetch extends Draft14BaseMessage {
192
204
  readonly type: 'fetch';
193
205
  readonly request_id: bigint;
194
- readonly subscriber_priority: bigint;
195
- readonly group_order: bigint;
206
+ readonly subscriber_priority: number;
207
+ readonly group_order: number;
196
208
  readonly fetch_type: bigint;
197
- readonly track_namespace?: string[];
198
- readonly track_name?: string;
199
- readonly start_group?: bigint;
200
- readonly start_object?: bigint;
201
- readonly end_group?: bigint;
202
- readonly end_object?: bigint;
203
- readonly joining_request_id?: bigint;
204
- readonly joining_start?: bigint;
209
+ /** Present when fetch_type = 1 */
210
+ readonly standalone?: StandaloneFetch;
211
+ /** Present when fetch_type = 2 or 3 */
212
+ readonly joining?: JoiningFetch;
205
213
  readonly parameters: Draft14Params;
206
214
  }
207
215
  interface Draft14FetchOk extends Draft14BaseMessage {
208
216
  readonly type: 'fetch_ok';
209
217
  readonly request_id: bigint;
210
- readonly group_order: bigint;
218
+ readonly group_order: number;
211
219
  readonly end_of_track: bigint;
212
220
  readonly end_location: Location;
213
221
  readonly parameters: Draft14Params;
@@ -227,8 +235,8 @@ interface Draft14TrackStatus extends Draft14BaseMessage {
227
235
  readonly request_id: bigint;
228
236
  readonly track_namespace: string[];
229
237
  readonly track_name: string;
230
- readonly subscriber_priority: bigint;
231
- readonly group_order: bigint;
238
+ readonly subscriber_priority: number;
239
+ readonly group_order: number;
232
240
  readonly forward: bigint;
233
241
  readonly filter_type: bigint;
234
242
  readonly start_group?: bigint;
@@ -240,7 +248,7 @@ interface Draft14TrackStatusOk extends Draft14BaseMessage {
240
248
  readonly request_id: bigint;
241
249
  readonly track_alias: bigint;
242
250
  readonly expires: bigint;
243
- readonly group_order: bigint;
251
+ readonly group_order: number;
244
252
  readonly content_exists: bigint;
245
253
  readonly largest_location?: Location;
246
254
  readonly parameters: Draft14Params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moqtap/codec",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "MoQT wire-format codec and session state machine — multi-draft, zero dependencies",
5
5
  "type": "module",
6
6
  "license": "MIT",