@moqtap/codec 0.7.0 → 0.8.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/README.md +24 -0
- package/dist/{chunk-5XZKO2U5.js → chunk-2XH6PHXR.js} +62 -51
- package/dist/{chunk-APTV6F72.js → chunk-3YAR3I3S.js} +67 -51
- package/dist/{chunk-Y4FRXYX6.cjs → chunk-7ENEWAMZ.cjs} +52 -58
- 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-I55J3KXD.js → chunk-NH4L6NIY.js} +48 -33
- package/dist/{chunk-EQAYMCXO.cjs → chunk-PU2KV7VP.cjs} +48 -33
- package/dist/{chunk-HEO2JG6C.js → chunk-TMXRYOBS.js} +100 -92
- package/dist/{chunk-IEJULBKB.cjs → chunk-UA5XFP4O.cjs} +100 -92
- package/dist/{chunk-KTVN4P6J.cjs → chunk-UZO5Z2XT.cjs} +62 -51
- package/dist/{chunk-MH7537FB.cjs → chunk-VWXUT5R2.cjs} +67 -51
- package/dist/{chunk-DORX55MO.js → chunk-XQGEOFGE.js} +52 -58
- package/dist/{codec-B1snaM9L.d.cts → codec-N3g1lxQQ.d.cts} +1 -1
- package/dist/{codec-D49OofBr.d.ts → codec-v6Vloc7H.d.ts} +1 -1
- package/dist/draft12.cjs +2 -2
- package/dist/draft12.js +1 -1
- package/dist/draft14-session.d.cts +1 -1
- package/dist/draft14-session.d.ts +1 -1
- package/dist/draft14.cjs +2 -2
- package/dist/draft14.d.cts +3 -3
- package/dist/draft14.d.ts +3 -3
- package/dist/draft14.js +1 -1
- package/dist/draft15.cjs +2 -2
- package/dist/draft15.js +1 -1
- package/dist/draft16.cjs +2 -2
- package/dist/draft16.js +1 -1
- package/dist/draft17.cjs +2 -2
- package/dist/draft17.js +1 -1
- package/dist/draft18.cjs +2 -2
- package/dist/draft18.js +1 -1
- package/dist/draft19.cjs +2 -2
- package/dist/draft19.js +1 -1
- package/dist/index.cjs +68 -16
- package/dist/index.d.cts +73 -3
- package/dist/index.d.ts +73 -3
- package/dist/index.js +60 -8
- package/dist/session.d.cts +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/{types-DjmrHp_s.d.cts → types-HI_bbXka.d.cts} +29 -23
- package/dist/{types-DjmrHp_s.d.ts → types-HI_bbXka.d.ts} +29 -23
- package/package.json +2 -2
- package/src/core/accessors.ts +120 -0
- package/src/drafts/draft12/data-streams.ts +13 -4
- package/src/drafts/draft14/codec.ts +52 -58
- package/src/drafts/draft14/types.ts +31 -25
- 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 +94 -53
- package/src/index.ts +8 -0
|
@@ -987,112 +987,135 @@ function decodeTrackExtensions(reader) {
|
|
|
987
987
|
return result;
|
|
988
988
|
}
|
|
989
989
|
function encodeParams(params, writer) {
|
|
990
|
-
|
|
991
|
-
if (params.delivery_timeout !== void 0) count++;
|
|
992
|
-
if (params.authorization_token !== void 0) count++;
|
|
993
|
-
if (params.max_cache_duration !== void 0) count++;
|
|
994
|
-
if (params.expires !== void 0) count++;
|
|
995
|
-
if (params.largest_object !== void 0) count++;
|
|
996
|
-
if (params.publisher_priority !== void 0) count++;
|
|
997
|
-
if (params.forward !== void 0) count++;
|
|
998
|
-
if (params.subscriber_priority !== void 0) count++;
|
|
999
|
-
if (params.subscription_filter !== void 0) count++;
|
|
1000
|
-
if (params.group_order !== void 0) count++;
|
|
1001
|
-
if (params.dynamic_groups !== void 0) count++;
|
|
1002
|
-
if (params.new_group_request !== void 0) count++;
|
|
1003
|
-
writer.writeVarInt(count);
|
|
990
|
+
const entries = [];
|
|
1004
991
|
if (params.delivery_timeout !== void 0) {
|
|
1005
|
-
|
|
1006
|
-
|
|
992
|
+
entries.push({
|
|
993
|
+
type: PARAM_DELIVERY_TIMEOUT,
|
|
994
|
+
encode: (w) => w.writeVarInt(params.delivery_timeout)
|
|
995
|
+
});
|
|
1007
996
|
}
|
|
1008
997
|
if (params.authorization_token !== void 0) {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
998
|
+
entries.push({
|
|
999
|
+
type: PARAM_AUTHORIZATION_TOKEN,
|
|
1000
|
+
encode: (w) => {
|
|
1001
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(64);
|
|
1002
|
+
encodeAuthorizationToken(params.authorization_token, tmpW);
|
|
1003
|
+
const raw = tmpW.finish();
|
|
1004
|
+
w.writeVarInt(raw.byteLength);
|
|
1005
|
+
w.writeBytes(raw);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1015
1008
|
}
|
|
1016
1009
|
if (params.max_cache_duration !== void 0) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1010
|
+
entries.push({
|
|
1011
|
+
type: PARAM_MAX_CACHE_DURATION,
|
|
1012
|
+
encode: (w) => w.writeVarInt(params.max_cache_duration)
|
|
1013
|
+
});
|
|
1019
1014
|
}
|
|
1020
1015
|
if (params.expires !== void 0) {
|
|
1021
|
-
|
|
1022
|
-
writer.writeVarInt(params.expires);
|
|
1016
|
+
entries.push({ type: PARAM_EXPIRES, encode: (w) => w.writeVarInt(params.expires) });
|
|
1023
1017
|
}
|
|
1024
1018
|
if (params.largest_object !== void 0) {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1019
|
+
entries.push({
|
|
1020
|
+
type: PARAM_LARGEST_OBJECT,
|
|
1021
|
+
// Draft-16 has no per-parameter value encoding: a Key-Value-Pair whose
|
|
1022
|
+
// Type is odd carries a Length, and 0x09 is odd. Drafts 17 and later
|
|
1023
|
+
// replaced that with "the encoding is specified by each parameter
|
|
1024
|
+
// definition", which is where the same field loses its length.
|
|
1025
|
+
encode: (w) => {
|
|
1026
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(16);
|
|
1027
|
+
tmpW.writeVarInt(params.largest_object.group);
|
|
1028
|
+
tmpW.writeVarInt(params.largest_object.object);
|
|
1029
|
+
const raw = tmpW.finish();
|
|
1030
|
+
w.writeVarInt(raw.byteLength);
|
|
1031
|
+
w.writeBytes(raw);
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1032
1034
|
}
|
|
1033
1035
|
if (params.publisher_priority !== void 0) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
+
entries.push({
|
|
1037
|
+
type: PARAM_PUBLISHER_PRIORITY,
|
|
1038
|
+
encode: (w) => w.writeVarInt(params.publisher_priority)
|
|
1039
|
+
});
|
|
1036
1040
|
}
|
|
1037
1041
|
if (params.forward !== void 0) {
|
|
1038
|
-
|
|
1039
|
-
writer.writeVarInt(params.forward);
|
|
1042
|
+
entries.push({ type: PARAM_FORWARD, encode: (w) => w.writeVarInt(params.forward) });
|
|
1040
1043
|
}
|
|
1041
1044
|
if (params.subscriber_priority !== void 0) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1045
|
+
entries.push({
|
|
1046
|
+
type: PARAM_SUBSCRIBER_PRIORITY,
|
|
1047
|
+
encode: (w) => w.writeVarInt(params.subscriber_priority)
|
|
1048
|
+
});
|
|
1044
1049
|
}
|
|
1045
1050
|
if (params.subscription_filter !== void 0) {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1051
|
+
entries.push({
|
|
1052
|
+
type: PARAM_SUBSCRIPTION_FILTER,
|
|
1053
|
+
encode: (w) => {
|
|
1054
|
+
const tmpW = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(32);
|
|
1055
|
+
const f = params.subscription_filter;
|
|
1056
|
+
tmpW.writeVarInt(f.filter_type);
|
|
1057
|
+
if (f.filter_type === 3n || f.filter_type === 4n) {
|
|
1058
|
+
tmpW.writeVarInt(f.start_group);
|
|
1059
|
+
tmpW.writeVarInt(f.start_object);
|
|
1060
|
+
}
|
|
1061
|
+
if (f.filter_type === 4n) {
|
|
1062
|
+
tmpW.writeVarInt(f.end_group);
|
|
1063
|
+
}
|
|
1064
|
+
const raw = tmpW.finish();
|
|
1065
|
+
w.writeVarInt(raw.byteLength);
|
|
1066
|
+
w.writeBytes(raw);
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1060
1069
|
}
|
|
1061
1070
|
if (params.group_order !== void 0) {
|
|
1062
|
-
|
|
1063
|
-
writer.writeVarInt(params.group_order);
|
|
1071
|
+
entries.push({ type: PARAM_GROUP_ORDER, encode: (w) => w.writeVarInt(params.group_order) });
|
|
1064
1072
|
}
|
|
1065
1073
|
if (params.dynamic_groups !== void 0) {
|
|
1066
|
-
|
|
1067
|
-
|
|
1074
|
+
entries.push({
|
|
1075
|
+
type: PARAM_DYNAMIC_GROUPS,
|
|
1076
|
+
encode: (w) => w.writeVarInt(params.dynamic_groups)
|
|
1077
|
+
});
|
|
1068
1078
|
}
|
|
1069
1079
|
if (params.new_group_request !== void 0) {
|
|
1070
|
-
|
|
1071
|
-
|
|
1080
|
+
entries.push({
|
|
1081
|
+
type: PARAM_NEW_GROUP_REQUEST,
|
|
1082
|
+
encode: (w) => w.writeVarInt(params.new_group_request)
|
|
1083
|
+
});
|
|
1072
1084
|
}
|
|
1073
1085
|
if (params.unknown) {
|
|
1074
1086
|
for (const u of params.unknown) {
|
|
1075
1087
|
const id = BigInt(u.id);
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1088
|
+
entries.push({
|
|
1089
|
+
type: id,
|
|
1090
|
+
encode: (w) => {
|
|
1091
|
+
const raw = _chunk4XLYCT5Qcjs.hexToBytes.call(void 0, u.raw_hex);
|
|
1092
|
+
if (id % 2n === 0n) {
|
|
1093
|
+
w.writeVarInt(new (0, _chunk4XLYCT5Qcjs.BufferReader)(raw).readVarInt());
|
|
1094
|
+
} else {
|
|
1095
|
+
w.writeVarInt(raw.byteLength);
|
|
1096
|
+
w.writeBytes(raw);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1087
1100
|
}
|
|
1088
1101
|
}
|
|
1102
|
+
entries.sort((a, b) => a.type < b.type ? -1 : a.type > b.type ? 1 : 0);
|
|
1103
|
+
writer.writeVarInt(entries.length);
|
|
1104
|
+
let prevType = 0n;
|
|
1105
|
+
for (const entry of entries) {
|
|
1106
|
+
writer.writeVarInt(entry.type - prevType);
|
|
1107
|
+
entry.encode(writer);
|
|
1108
|
+
prevType = entry.type;
|
|
1109
|
+
}
|
|
1089
1110
|
}
|
|
1090
1111
|
function decodeParams(reader) {
|
|
1091
1112
|
const count = Number(reader.readVarInt());
|
|
1092
1113
|
const result = {};
|
|
1093
|
-
|
|
1114
|
+
let prevType = 0n;
|
|
1094
1115
|
for (let i = 0; i < count; i++) {
|
|
1095
|
-
const
|
|
1116
|
+
const delta = reader.readVarInt();
|
|
1117
|
+
const paramType = prevType + delta;
|
|
1118
|
+
prevType = paramType;
|
|
1096
1119
|
if (paramType === PARAM_DELIVERY_TIMEOUT) {
|
|
1097
1120
|
result.delivery_timeout = reader.readVarInt();
|
|
1098
1121
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
@@ -1138,29 +1161,14 @@ function decodeParams(reader) {
|
|
|
1138
1161
|
const consumed = reader.offset - startOff;
|
|
1139
1162
|
if (consumed < length) reader.readBytes(length - consumed);
|
|
1140
1163
|
result.subscription_filter = filter;
|
|
1141
|
-
} else if (paramType % 2n === 0n) {
|
|
1142
|
-
const value = reader.readVarInt();
|
|
1143
|
-
const tmpWriter = new (0, _chunk4XLYCT5Qcjs.BufferWriter)(16);
|
|
1144
|
-
tmpWriter.writeVarInt(value);
|
|
1145
|
-
const raw = tmpWriter.finish();
|
|
1146
|
-
unknown.push({
|
|
1147
|
-
id: `0x${paramType.toString(16)}`,
|
|
1148
|
-
length: raw.byteLength,
|
|
1149
|
-
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
|
|
1150
|
-
});
|
|
1151
1164
|
} else {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
|
|
1158
|
-
});
|
|
1165
|
+
throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
1166
|
+
"INVALID_PARAMETER",
|
|
1167
|
+
`Unknown Message Parameter type 0x${paramType.toString(16)}`,
|
|
1168
|
+
reader.offset
|
|
1169
|
+
);
|
|
1159
1170
|
}
|
|
1160
1171
|
}
|
|
1161
|
-
if (unknown.length > 0) {
|
|
1162
|
-
result.unknown = unknown;
|
|
1163
|
-
}
|
|
1164
1172
|
return result;
|
|
1165
1173
|
}
|
|
1166
1174
|
function encodeClientSetupPayload(msg, w) {
|
|
@@ -1103,6 +1103,33 @@ var PARAM_SUBSCRIPTION_FILTER = 0x21n;
|
|
|
1103
1103
|
var PARAM_GROUP_ORDER = 0x22n;
|
|
1104
1104
|
var PARAM_NEW_GROUP_REQUEST = 0x32n;
|
|
1105
1105
|
var PARAM_TRACK_NAMESPACE_PREFIX = 0x34n;
|
|
1106
|
+
var PARAMETER_SCOPE = /* @__PURE__ */ new Map([
|
|
1107
|
+
[0x02n, /* @__PURE__ */ new Set(["request_ok", "subscribe", "request_update"])],
|
|
1108
|
+
[
|
|
1109
|
+
0x03n,
|
|
1110
|
+
/* @__PURE__ */ new Set([
|
|
1111
|
+
"publish",
|
|
1112
|
+
"subscribe",
|
|
1113
|
+
"request_update",
|
|
1114
|
+
"subscribe_namespace",
|
|
1115
|
+
"subscribe_tracks",
|
|
1116
|
+
"publish_namespace",
|
|
1117
|
+
"track_status",
|
|
1118
|
+
"fetch"
|
|
1119
|
+
])
|
|
1120
|
+
],
|
|
1121
|
+
[0x04n, /* @__PURE__ */ new Set(["subscribe"])],
|
|
1122
|
+
[0x06n, /* @__PURE__ */ new Set(["request_ok", "subscribe", "request_update"])],
|
|
1123
|
+
[0x08n, /* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok"])],
|
|
1124
|
+
[0x09n, /* @__PURE__ */ new Set(["subscribe_ok", "publish", "request_ok"])],
|
|
1125
|
+
[0x0an, /* @__PURE__ */ new Set(["fetch"])],
|
|
1126
|
+
[0x10n, /* @__PURE__ */ new Set(["subscribe", "request_update", "publish", "request_ok", "subscribe_tracks"])],
|
|
1127
|
+
[0x20n, /* @__PURE__ */ new Set(["subscribe", "fetch", "request_update", "request_ok"])],
|
|
1128
|
+
[0x21n, /* @__PURE__ */ new Set(["subscribe", "request_ok", "request_update"])],
|
|
1129
|
+
[0x22n, /* @__PURE__ */ new Set(["subscribe", "request_ok", "fetch"])],
|
|
1130
|
+
[0x32n, /* @__PURE__ */ new Set(["request_ok", "subscribe", "request_update"])],
|
|
1131
|
+
[0x34n, /* @__PURE__ */ new Set(["request_update"])]
|
|
1132
|
+
]);
|
|
1106
1133
|
function encodeParams(params, writer) {
|
|
1107
1134
|
const entries = [];
|
|
1108
1135
|
if (params.object_delivery_timeout !== void 0) {
|
|
@@ -1144,13 +1171,12 @@ function encodeParams(params, writer) {
|
|
|
1144
1171
|
if (params.largest_object !== void 0) {
|
|
1145
1172
|
entries.push({
|
|
1146
1173
|
type: PARAM_LARGEST_OBJECT,
|
|
1174
|
+
// A Location is "Two consecutive varints (Group, Object)", which is a
|
|
1175
|
+
// different value encoding from "Length-prefixed". Nothing states the
|
|
1176
|
+
// length, so nothing writes one.
|
|
1147
1177
|
encode: (w) => {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
tmpW.writeVarInt(params.largest_object.object);
|
|
1151
|
-
const raw = tmpW.finish();
|
|
1152
|
-
w.writeVarInt(BigInt(raw.byteLength));
|
|
1153
|
-
w.writeBytes(raw);
|
|
1178
|
+
w.writeVarInt(params.largest_object.group);
|
|
1179
|
+
w.writeVarInt(params.largest_object.object);
|
|
1154
1180
|
}
|
|
1155
1181
|
});
|
|
1156
1182
|
}
|
|
@@ -1207,12 +1233,11 @@ function encodeParams(params, writer) {
|
|
|
1207
1233
|
if (params.track_namespace_prefix !== void 0) {
|
|
1208
1234
|
entries.push({
|
|
1209
1235
|
type: PARAM_TRACK_NAMESPACE_PREFIX,
|
|
1236
|
+
// The parameter "uses the Track Namespace encoding", which is a tuple
|
|
1237
|
+
// that states its own field count. That is not the Length-prefixed
|
|
1238
|
+
// encoding, so there is no byte length ahead of it.
|
|
1210
1239
|
encode: (w) => {
|
|
1211
|
-
|
|
1212
|
-
encodeNamespaceTuple(params.track_namespace_prefix, tmpW);
|
|
1213
|
-
const raw = tmpW.finish();
|
|
1214
|
-
w.writeVarInt(BigInt(raw.byteLength));
|
|
1215
|
-
w.writeBytes(raw);
|
|
1240
|
+
encodeNamespaceTuple(params.track_namespace_prefix, w);
|
|
1216
1241
|
}
|
|
1217
1242
|
});
|
|
1218
1243
|
}
|
|
@@ -1237,15 +1262,22 @@ function encodeParams(params, writer) {
|
|
|
1237
1262
|
prevType = entry.type;
|
|
1238
1263
|
}
|
|
1239
1264
|
}
|
|
1240
|
-
function decodeParams(reader) {
|
|
1265
|
+
function decodeParams(reader, messageType) {
|
|
1241
1266
|
const count = Number(reader.readVarInt());
|
|
1242
1267
|
const result = {};
|
|
1243
|
-
const unknown = [];
|
|
1244
1268
|
let prevType = 0n;
|
|
1245
1269
|
for (let i = 0; i < count; i++) {
|
|
1246
1270
|
const delta = reader.readVarInt();
|
|
1247
1271
|
const paramType = prevType + delta;
|
|
1248
1272
|
prevType = paramType;
|
|
1273
|
+
const scope = PARAMETER_SCOPE.get(paramType);
|
|
1274
|
+
if (scope !== void 0 && !scope.has(messageType)) {
|
|
1275
|
+
throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
1276
|
+
"CONSTRAINT_VIOLATION",
|
|
1277
|
+
`Message Parameter 0x${paramType.toString(16)} may not appear in ${messageType}`,
|
|
1278
|
+
reader.offset
|
|
1279
|
+
);
|
|
1280
|
+
}
|
|
1249
1281
|
if (paramType === PARAM_OBJECT_DELIVERY_TIMEOUT) {
|
|
1250
1282
|
result.object_delivery_timeout = reader.readVarInt();
|
|
1251
1283
|
} else if (paramType === PARAM_AUTHORIZATION_TOKEN) {
|
|
@@ -1259,12 +1291,8 @@ function decodeParams(reader) {
|
|
|
1259
1291
|
} else if (paramType === PARAM_EXPIRES) {
|
|
1260
1292
|
result.expires = reader.readVarInt();
|
|
1261
1293
|
} else if (paramType === PARAM_LARGEST_OBJECT) {
|
|
1262
|
-
const length = Number(reader.readVarInt());
|
|
1263
|
-
const startOff = reader.offset;
|
|
1264
1294
|
const group = reader.readVarInt();
|
|
1265
1295
|
const object = reader.readVarInt();
|
|
1266
|
-
const consumed = reader.offset - startOff;
|
|
1267
|
-
if (consumed < length) reader.readBytes(length - consumed);
|
|
1268
1296
|
result.largest_object = { group, object };
|
|
1269
1297
|
} else if (paramType === PARAM_FILL_TIMEOUT) {
|
|
1270
1298
|
result.fill_timeout = reader.readVarInt();
|
|
@@ -1292,32 +1320,15 @@ function decodeParams(reader) {
|
|
|
1292
1320
|
} else if (paramType === PARAM_NEW_GROUP_REQUEST) {
|
|
1293
1321
|
result.new_group_request = reader.readVarInt();
|
|
1294
1322
|
} else if (paramType === PARAM_TRACK_NAMESPACE_PREFIX) {
|
|
1295
|
-
|
|
1296
|
-
const bytes = reader.readBytes(length);
|
|
1297
|
-
result.track_namespace_prefix = decodeNamespaceTuple(new (0, _chunk4XLYCT5Qcjs.MoqtBufferReader)(bytes));
|
|
1323
|
+
result.track_namespace_prefix = decodeNamespaceTuple(reader);
|
|
1298
1324
|
} else {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
unknown.push({
|
|
1305
|
-
id: `0x${paramType.toString(16)}`,
|
|
1306
|
-
length: raw.byteLength,
|
|
1307
|
-
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, raw)
|
|
1308
|
-
});
|
|
1309
|
-
} else {
|
|
1310
|
-
const length = Number(reader.readVarInt());
|
|
1311
|
-
const bytes = reader.readBytes(length);
|
|
1312
|
-
unknown.push({
|
|
1313
|
-
id: `0x${paramType.toString(16)}`,
|
|
1314
|
-
length,
|
|
1315
|
-
raw_hex: _chunk4XLYCT5Qcjs.bytesToHex.call(void 0, bytes)
|
|
1316
|
-
});
|
|
1317
|
-
}
|
|
1325
|
+
throw new (0, _chunk4XLYCT5Qcjs.DecodeError)(
|
|
1326
|
+
"INVALID_PARAMETER",
|
|
1327
|
+
`Unknown Message Parameter type 0x${paramType.toString(16)}`,
|
|
1328
|
+
reader.offset
|
|
1329
|
+
);
|
|
1318
1330
|
}
|
|
1319
1331
|
}
|
|
1320
|
-
if (unknown.length > 0) result.unknown = unknown;
|
|
1321
1332
|
return result;
|
|
1322
1333
|
}
|
|
1323
1334
|
var TPROP_OBJECT_DELIVERY_TIMEOUT = 0x02n;
|
|
@@ -1579,7 +1590,7 @@ function decodeSubscribePayload(r) {
|
|
|
1579
1590
|
const request_id = r.readVarInt();
|
|
1580
1591
|
const track_namespace = r.readTuple();
|
|
1581
1592
|
const track_name = r.readString();
|
|
1582
|
-
const parameters = decodeParams(r);
|
|
1593
|
+
const parameters = decodeParams(r, "subscribe");
|
|
1583
1594
|
return {
|
|
1584
1595
|
type: "subscribe",
|
|
1585
1596
|
request_id,
|
|
@@ -1590,13 +1601,13 @@ function decodeSubscribePayload(r) {
|
|
|
1590
1601
|
}
|
|
1591
1602
|
function decodeSubscribeOkPayload(r, payloadEnd) {
|
|
1592
1603
|
const track_alias = r.readVarInt();
|
|
1593
|
-
const parameters = decodeParams(r);
|
|
1604
|
+
const parameters = decodeParams(r, "subscribe_ok");
|
|
1594
1605
|
const track_properties = decodeTrackProperties(r, payloadEnd);
|
|
1595
1606
|
return { type: "subscribe_ok", track_alias, parameters, track_properties };
|
|
1596
1607
|
}
|
|
1597
1608
|
function decodeRequestUpdatePayload(r) {
|
|
1598
1609
|
const request_id = r.readVarInt();
|
|
1599
|
-
const parameters = decodeParams(r);
|
|
1610
|
+
const parameters = decodeParams(r, "request_update");
|
|
1600
1611
|
return {
|
|
1601
1612
|
type: "request_update",
|
|
1602
1613
|
request_id,
|
|
@@ -1608,7 +1619,7 @@ function decodePublishPayload(r, payloadEnd) {
|
|
|
1608
1619
|
const track_namespace = r.readTuple();
|
|
1609
1620
|
const track_name = r.readString();
|
|
1610
1621
|
const track_alias = r.readVarInt();
|
|
1611
|
-
const parameters = decodeParams(r);
|
|
1622
|
+
const parameters = decodeParams(r, "publish");
|
|
1612
1623
|
const track_properties = decodeTrackProperties(r, payloadEnd);
|
|
1613
1624
|
return {
|
|
1614
1625
|
type: "publish",
|
|
@@ -1629,7 +1640,7 @@ function decodePublishDonePayload(r) {
|
|
|
1629
1640
|
function decodePublishNamespacePayload(r) {
|
|
1630
1641
|
const request_id = r.readVarInt();
|
|
1631
1642
|
const track_namespace = r.readTuple();
|
|
1632
|
-
const parameters = decodeParams(r);
|
|
1643
|
+
const parameters = decodeParams(r, "publish_namespace");
|
|
1633
1644
|
return {
|
|
1634
1645
|
type: "publish_namespace",
|
|
1635
1646
|
request_id,
|
|
@@ -1648,7 +1659,7 @@ function decodeNamespaceDonePayload(r) {
|
|
|
1648
1659
|
function decodeSubscribeNamespacePayload(r) {
|
|
1649
1660
|
const request_id = r.readVarInt();
|
|
1650
1661
|
const namespace_prefix = r.readTuple();
|
|
1651
|
-
const parameters = decodeParams(r);
|
|
1662
|
+
const parameters = decodeParams(r, "subscribe_namespace");
|
|
1652
1663
|
return {
|
|
1653
1664
|
type: "subscribe_namespace",
|
|
1654
1665
|
request_id,
|
|
@@ -1659,7 +1670,7 @@ function decodeSubscribeNamespacePayload(r) {
|
|
|
1659
1670
|
function decodeSubscribeTracksPayload(r) {
|
|
1660
1671
|
const request_id = r.readVarInt();
|
|
1661
1672
|
const namespace_prefix = r.readTuple();
|
|
1662
|
-
const parameters = decodeParams(r);
|
|
1673
|
+
const parameters = decodeParams(r, "subscribe_tracks");
|
|
1663
1674
|
return {
|
|
1664
1675
|
type: "subscribe_tracks",
|
|
1665
1676
|
request_id,
|
|
@@ -1701,7 +1712,7 @@ function decodeFetchPayload(r) {
|
|
|
1701
1712
|
const joining_start = r.readVarInt();
|
|
1702
1713
|
joining = { joining_request_id, joining_start };
|
|
1703
1714
|
}
|
|
1704
|
-
const parameters = decodeParams(r);
|
|
1715
|
+
const parameters = decodeParams(r, "fetch");
|
|
1705
1716
|
return {
|
|
1706
1717
|
type: "fetch",
|
|
1707
1718
|
request_id,
|
|
@@ -1715,7 +1726,7 @@ function decodeFetchOkPayload(r, payloadEnd) {
|
|
|
1715
1726
|
const end_of_track = r.readUint8();
|
|
1716
1727
|
const end_group = r.readVarInt();
|
|
1717
1728
|
const end_object = r.readVarInt();
|
|
1718
|
-
const parameters = decodeParams(r);
|
|
1729
|
+
const parameters = decodeParams(r, "fetch_ok");
|
|
1719
1730
|
const track_properties = decodeTrackProperties(r, payloadEnd);
|
|
1720
1731
|
return {
|
|
1721
1732
|
type: "fetch_ok",
|
|
@@ -1730,7 +1741,7 @@ function decodeTrackStatusPayload(r) {
|
|
|
1730
1741
|
const request_id = r.readVarInt();
|
|
1731
1742
|
const track_namespace = r.readTuple();
|
|
1732
1743
|
const track_name = r.readString();
|
|
1733
|
-
const parameters = decodeParams(r);
|
|
1744
|
+
const parameters = decodeParams(r, "track_status");
|
|
1734
1745
|
return {
|
|
1735
1746
|
type: "track_status",
|
|
1736
1747
|
request_id,
|
|
@@ -1740,7 +1751,7 @@ function decodeTrackStatusPayload(r) {
|
|
|
1740
1751
|
};
|
|
1741
1752
|
}
|
|
1742
1753
|
function decodeRequestOkPayload(r, payloadEnd) {
|
|
1743
|
-
const parameters = decodeParams(r);
|
|
1754
|
+
const parameters = decodeParams(r, "request_ok");
|
|
1744
1755
|
const track_properties = decodeTrackProperties(r, payloadEnd);
|
|
1745
1756
|
return { type: "request_ok", parameters, track_properties };
|
|
1746
1757
|
}
|