@norskvideo/moq-net 0.1.8 → 0.2.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 +2 -2
- package/announce.d.ts +7 -0
- package/announce.d.ts.map +1 -0
- package/announce.js +8 -0
- package/announce.js.map +1 -0
- package/announced.d.ts +49 -91
- package/announced.d.ts.map +1 -1
- package/announced.js +21 -156
- package/announced.js.map +1 -1
- package/bandwidth.d.ts +163 -0
- package/bandwidth.d.ts.map +1 -0
- package/bandwidth.js +304 -0
- package/bandwidth.js.map +1 -0
- package/bandwidth_api.d.ts +7 -0
- package/bandwidth_api.d.ts.map +1 -0
- package/bandwidth_api.js +8 -0
- package/bandwidth_api.js.map +1 -0
- package/broadcast.d.ts +44 -35
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +104 -60
- package/broadcast.js.map +1 -1
- package/connection/accept.d.ts +16 -1
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +52 -28
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +9 -7
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +30 -6
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +110 -54
- package/connection/connect.js.map +1 -1
- package/connection/established.d.ts +17 -21
- package/connection/established.d.ts.map +1 -1
- package/connection/established.js.map +1 -1
- package/connection/forward.d.ts +2 -0
- package/connection/forward.d.ts.map +1 -0
- package/connection/forward.js +173 -0
- package/connection/forward.js.map +1 -0
- package/connection/handshake.d.ts +1 -0
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +5 -2
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +5 -5
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +4 -5
- package/connection/index.js.map +1 -1
- package/connection/pool.d.ts +186 -0
- package/connection/pool.d.ts.map +1 -0
- package/connection/pool.js +361 -0
- package/connection/pool.js.map +1 -0
- package/connection/reload.d.ts +14 -93
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +217 -81
- package/connection/reload.js.map +1 -1
- package/connection/stats.d.ts +3 -26
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js.map +1 -1
- package/connection/transport.d.ts +0 -7
- package/connection/transport.d.ts.map +1 -1
- package/consume.d.ts +1 -43
- package/consume.d.ts.map +1 -1
- package/consume.js +1 -1
- package/consume.js.map +1 -1
- package/error.d.ts +180 -29
- package/error.d.ts.map +1 -1
- package/error.js +331 -16
- package/error.js.map +1 -1
- package/errors.d.ts +7 -0
- package/errors.d.ts.map +1 -0
- package/errors.js +8 -0
- package/errors.js.map +1 -0
- package/group.d.ts +9 -43
- package/group.d.ts.map +1 -1
- package/group.js +284 -69
- package/group.js.map +1 -1
- package/hop.d.ts +115 -0
- package/hop.d.ts.map +1 -0
- package/hop.js +119 -0
- package/hop.js.map +1 -0
- package/ietf/adapter.d.ts +5 -1
- package/ietf/adapter.d.ts.map +1 -1
- package/ietf/adapter.js +105 -60
- package/ietf/adapter.js.map +1 -1
- package/ietf/aliases.d.ts +1 -78
- package/ietf/aliases.d.ts.map +1 -1
- package/ietf/cluster.d.ts +9 -123
- package/ietf/cluster.d.ts.map +1 -1
- package/ietf/cluster.js +84 -44
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +6 -72
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +62 -56
- package/ietf/connection.js.map +1 -1
- package/ietf/error.d.ts +11 -0
- package/ietf/error.d.ts.map +1 -0
- package/ietf/error.js +193 -0
- package/ietf/error.js.map +1 -0
- package/ietf/fetch.d.ts +7 -20
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +52 -22
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +2 -0
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +10 -1
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -5
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.d.ts +2 -0
- package/ietf/hidden.d.ts.map +1 -0
- package/ietf/hidden.js +30 -0
- package/ietf/hidden.js.map +1 -0
- package/ietf/index.d.ts +2 -0
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +2 -0
- package/ietf/index.js.map +1 -1
- package/ietf/object.d.ts +15 -8
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +51 -36
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +14 -2
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +97 -29
- package/ietf/parameters.js.map +1 -1
- package/ietf/properties.d.ts +1 -0
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +14 -0
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +19 -2
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +40 -6
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +25 -0
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +63 -0
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.d.ts +1 -82
- package/ietf/publisher.d.ts.map +1 -1
- package/ietf/publisher.js +483 -235
- package/ietf/publisher.js.map +1 -1
- package/ietf/solicit.d.ts +1 -40
- package/ietf/solicit.d.ts.map +1 -1
- package/ietf/subscribe.d.ts +8 -6
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +33 -27
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +8 -2
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +18 -8
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.d.ts +1 -65
- package/ietf/subscriber.d.ts.map +1 -1
- package/ietf/subscriber.js +337 -123
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.d.ts +2 -0
- package/ietf/token.d.ts.map +1 -0
- package/ietf/token.js +99 -0
- package/ietf/token.js.map +1 -0
- package/ietf/track.d.ts +4 -0
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +6 -20
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +12 -1
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +13 -0
- package/ietf/version.js.map +1 -1
- package/index.d.ts +12 -7
- package/index.d.ts.map +1 -1
- package/index.js +10 -5
- package/index.js.map +1 -1
- package/internal.d.ts +115 -1
- package/internal.d.ts.map +1 -1
- package/internal.js +108 -0
- package/internal.js.map +1 -1
- package/lite/announce.d.ts +60 -10
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +176 -31
- package/lite/announce.js.map +1 -1
- package/lite/connection.d.ts +9 -59
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +34 -35
- package/lite/connection.js.map +1 -1
- package/lite/datagram.d.ts +3 -2
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +7 -8
- package/lite/datagram.js.map +1 -1
- package/lite/fetch.d.ts +15 -1
- package/lite/fetch.d.ts.map +1 -1
- package/lite/fetch.js +39 -7
- package/lite/fetch.js.map +1 -1
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +7 -1
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +30 -12
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +68 -26
- package/lite/group.js.map +1 -1
- package/lite/message.d.ts +2 -2
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +14 -5
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +1 -61
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +4 -5
- package/lite/priority.js.map +1 -1
- package/lite/publisher.d.ts +1 -69
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +630 -262
- package/lite/publisher.js.map +1 -1
- package/lite/setup.d.ts +8 -8
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +33 -30
- package/lite/setup.js.map +1 -1
- package/lite/subscribe.d.ts +71 -17
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +205 -53
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +15 -56
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +451 -247
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +4 -10
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +34 -29
- package/lite/track.js.map +1 -1
- package/lite/version.d.ts +42 -6
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +126 -10
- package/lite/version.js.map +1 -1
- package/origin.d.ts +256 -29
- package/origin.d.ts.map +1 -1
- package/origin.js +1427 -37
- package/origin.js.map +1 -1
- package/package.json +8 -3
- package/path.d.ts +25 -7
- package/path.d.ts.map +1 -1
- package/path.js +5 -3
- package/path.js.map +1 -1
- package/stream.d.ts +73 -14
- package/stream.d.ts.map +1 -1
- package/stream.js +372 -141
- package/stream.js.map +1 -1
- package/tail.d.ts +18 -0
- package/tail.d.ts.map +1 -0
- package/tail.js +167 -0
- package/tail.js.map +1 -0
- package/time.d.ts +15 -2
- package/time.d.ts.map +1 -1
- package/time.js +28 -9
- package/time.js.map +1 -1
- package/track.d.ts +211 -83
- package/track.d.ts.map +1 -1
- package/track.js +816 -205
- package/track.js.map +1 -1
- package/util/abort.d.ts +2 -0
- package/util/abort.d.ts.map +1 -0
- package/util/abort.js +20 -0
- package/util/abort.js.map +1 -0
- package/util/log.d.ts +5 -0
- package/util/log.d.ts.map +1 -0
- package/util/log.js +17 -0
- package/util/log.js.map +1 -0
- package/util/u64.d.ts +39 -0
- package/util/u64.d.ts.map +1 -0
- package/util/u64.js +83 -0
- package/util/u64.js.map +1 -0
- package/util/varint.d.ts +29 -0
- package/util/varint.d.ts.map +1 -0
- package/util/varint.js +198 -0
- package/util/varint.js.map +1 -0
- package/varint.d.ts +10 -6
- package/varint.d.ts.map +1 -1
- package/varint.js +40 -237
- package/varint.js.map +1 -1
- package/wire.d.ts +80 -0
- package/wire.d.ts.map +1 -0
- package/wire.js +32 -0
- package/wire.js.map +1 -0
- package/zod.d.ts +1 -1
- package/zod.d.ts.map +1 -1
- package/zod.js.map +1 -1
- package/mock.d.ts +0 -66
- package/mock.d.ts.map +0 -1
- package/mock.js +0 -243
- package/mock.js.map +0 -1
package/ietf/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/ietf/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO;IACnB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;aACH,QAAQ,EAAE,UAAU;CACX,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAG7D,eAAO,MAAM,IAAI;aAChB,QAAQ,EAAE,QAAQ;aAClB,QAAQ,EAAE,SAAS;aACnB,QAAQ,EAAE,SAAS;aACnB,QAAQ,EAAE,SAAS;aACnB,QAAQ,EAAE,SAAS;aACnB,QAAQ,EAAE,SAAS;aACnB,QAAQ,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACH,MAAM,MAAM,WAAW,GACpB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO,CAAC,QAAQ,GACvB,OAAO,OAAO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AgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAE9C"}
|
package/ietf/version.js
CHANGED
|
@@ -43,6 +43,15 @@ export const Version = {
|
|
|
43
43
|
* https://www.ietf.org/archive/id/draft-ietf-moq-transport-20.txt
|
|
44
44
|
*/
|
|
45
45
|
DRAFT_20: 0xff000014,
|
|
46
|
+
/**
|
|
47
|
+
* draft-ietf-moq-transport-21
|
|
48
|
+
* https://www.ietf.org/archive/id/draft-ietf-moq-transport-21.txt
|
|
49
|
+
*/
|
|
50
|
+
DRAFT_21: 0xff000015,
|
|
51
|
+
/**
|
|
52
|
+
* draft-ietf-moq-transport-22 (unpublished, wire-identical to draft-21)
|
|
53
|
+
*/
|
|
54
|
+
DRAFT_22: 0xff000016,
|
|
46
55
|
};
|
|
47
56
|
// ALPN / WebTransport subprotocol identifiers for draft versions.
|
|
48
57
|
export const ALPN = {
|
|
@@ -53,6 +62,8 @@ export const ALPN = {
|
|
|
53
62
|
DRAFT_18: "moqt-18",
|
|
54
63
|
DRAFT_19: "moqt-19",
|
|
55
64
|
DRAFT_20: "moqt-20",
|
|
65
|
+
DRAFT_21: "moqt-21",
|
|
66
|
+
DRAFT_22: "moqt-22",
|
|
56
67
|
};
|
|
57
68
|
const VERSION_NAMES = {
|
|
58
69
|
[Version.DRAFT_07]: "moq-transport-07",
|
|
@@ -63,6 +74,8 @@ const VERSION_NAMES = {
|
|
|
63
74
|
[Version.DRAFT_18]: "moq-transport-18",
|
|
64
75
|
[Version.DRAFT_19]: "moq-transport-19",
|
|
65
76
|
[Version.DRAFT_20]: "moq-transport-20",
|
|
77
|
+
[Version.DRAFT_21]: "moq-transport-21",
|
|
78
|
+
[Version.DRAFT_22]: "moq-transport-22",
|
|
66
79
|
};
|
|
67
80
|
export function versionName(v) {
|
|
68
81
|
return VERSION_NAMES[v] ?? `unknown(0x${v.toString(16)})`;
|
package/ietf/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/ietf/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;CACX,CAAC;AAIX,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG;IACnB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACV,CAAC;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/ietf/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;;OAGG;IACH,QAAQ,EAAE,UAAU;IAEpB;;OAEG;IACH,QAAQ,EAAE,UAAU;CACX,CAAC;AAIX,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG;IACnB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACV,CAAC;AAiBX,MAAM,aAAa,GAA2B;IAC7C,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;IACtC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,kBAAkB;CACtC,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,CAAU;IACrC,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Supported MoQ Transport protocol versions\n */\nexport const Version = {\n\t/**\n\t * draft-ietf-moq-transport-07\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-07.txt\n\t */\n\tDRAFT_07: 0xff000007,\n\n\t/**\n\t * draft-ietf-moq-transport-14\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-14.txt\n\t */\n\tDRAFT_14: 0xff00000e,\n\n\t/**\n\t * draft-ietf-moq-transport-15\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-15.txt\n\t */\n\tDRAFT_15: 0xff00000f,\n\n\t/**\n\t * draft-ietf-moq-transport-16\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-16.txt\n\t */\n\tDRAFT_16: 0xff000010,\n\n\t/**\n\t * draft-ietf-moq-transport-17\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-17.txt\n\t */\n\tDRAFT_17: 0xff000011,\n\n\t/**\n\t * draft-ietf-moq-transport-18\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-18.txt\n\t */\n\tDRAFT_18: 0xff000012,\n\n\t/**\n\t * draft-ietf-moq-transport-19\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-19.txt\n\t */\n\tDRAFT_19: 0xff000013,\n\n\t/**\n\t * draft-ietf-moq-transport-20\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-20.txt\n\t */\n\tDRAFT_20: 0xff000014,\n\n\t/**\n\t * draft-ietf-moq-transport-21\n\t * https://www.ietf.org/archive/id/draft-ietf-moq-transport-21.txt\n\t */\n\tDRAFT_21: 0xff000015,\n\n\t/**\n\t * draft-ietf-moq-transport-22 (unpublished, wire-identical to draft-21)\n\t */\n\tDRAFT_22: 0xff000016,\n} as const;\n\nexport type Version = (typeof Version)[keyof typeof Version];\n\n// ALPN / WebTransport subprotocol identifiers for draft versions.\nexport const ALPN = {\n\tDRAFT_14: \"moq-00\",\n\tDRAFT_15: \"moqt-15\",\n\tDRAFT_16: \"moqt-16\",\n\tDRAFT_17: \"moqt-17\",\n\tDRAFT_18: \"moqt-18\",\n\tDRAFT_19: \"moqt-19\",\n\tDRAFT_20: \"moqt-20\",\n\tDRAFT_21: \"moqt-21\",\n\tDRAFT_22: \"moqt-22\",\n} as const;\n\n/**\n * IETF protocol versions used by the ietf/ module.\n * Use this narrower type for version-branched encode/decode to get exhaustive matching.\n */\nexport type IetfVersion =\n\t| typeof Version.DRAFT_14\n\t| typeof Version.DRAFT_15\n\t| typeof Version.DRAFT_16\n\t| typeof Version.DRAFT_17\n\t| typeof Version.DRAFT_18\n\t| typeof Version.DRAFT_19\n\t| typeof Version.DRAFT_20\n\t| typeof Version.DRAFT_21\n\t| typeof Version.DRAFT_22;\n\nconst VERSION_NAMES: Record<number, string> = {\n\t[Version.DRAFT_07]: \"moq-transport-07\",\n\t[Version.DRAFT_14]: \"moq-transport-14\",\n\t[Version.DRAFT_15]: \"moq-transport-15\",\n\t[Version.DRAFT_16]: \"moq-transport-16\",\n\t[Version.DRAFT_17]: \"moq-transport-17\",\n\t[Version.DRAFT_18]: \"moq-transport-18\",\n\t[Version.DRAFT_19]: \"moq-transport-19\",\n\t[Version.DRAFT_20]: \"moq-transport-20\",\n\t[Version.DRAFT_21]: \"moq-transport-21\",\n\t[Version.DRAFT_22]: \"moq-transport-22\",\n};\n\nexport function versionName(v: Version): string {\n\treturn VERSION_NAMES[v] ?? `unknown(0x${v.toString(16)})`;\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -7,21 +7,26 @@
|
|
|
7
7
|
/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */
|
|
8
8
|
export * as Signals from "@norskvideo/moq-signals";
|
|
9
9
|
/** Broadcast announcement streams. */
|
|
10
|
-
export * as Announce from "./
|
|
10
|
+
export * as Announce from "./announce";
|
|
11
|
+
/** Send-side bandwidth estimates split among the tracks sharing a connection. */
|
|
12
|
+
export * as Bandwidth from "./bandwidth_api";
|
|
11
13
|
/** Broadcast role handles. */
|
|
12
14
|
export * as Broadcast from "./broadcast";
|
|
13
|
-
/**
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/** A reconnecting, shareable handle on a MoQ session. */
|
|
16
|
+
export { Connection } from "./connection/index";
|
|
17
|
+
export { SessionCode, StreamCode } from "./error";
|
|
18
|
+
/** Session and stream errors, each carrying a code from its own registry. */
|
|
19
|
+
export * as Error from "./errors";
|
|
17
20
|
/** Group role handles and frame helpers. */
|
|
18
21
|
export * as Group from "./group";
|
|
19
|
-
/** Broadcast
|
|
22
|
+
/** Broadcast routing tables, independent of any connection. */
|
|
23
|
+
export * as Origin from "./origin";
|
|
24
|
+
/** Broadcast path utilities with delimiter-aware prefix matching. Path patterns are re-exported from `@norskvideo/moq-pattern`. */
|
|
20
25
|
export * as Path from "./path";
|
|
21
26
|
/** Branded time types (nanoseconds, microseconds, milliseconds, seconds) with conversions. */
|
|
22
27
|
export * as Time from "./time";
|
|
23
28
|
/** Track role handles. */
|
|
24
29
|
export * as Track from "./track";
|
|
25
|
-
/**
|
|
30
|
+
/** Varint encoding and decoding, in QUIC's format and moq-transport's leading-ones format. */
|
|
26
31
|
export * as Varint from "./varint";
|
|
27
32
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6HAA6H;AAC7H,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,sCAAsC;AACtC,OAAO,KAAK,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6HAA6H;AAC7H,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,sCAAsC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,iFAAiF;AACjF,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAChD,8BAA8B;AAC9B,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrD,6EAA6E;AAC7E,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,4CAA4C;AAC5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,+DAA+D;AAC/D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,wHAAwH;AACxH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,8FAA8F;AAC9F,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,0BAA0B;AAC1B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,8FAA8F;AAC9F,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
package/index.js
CHANGED
|
@@ -7,16 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as Signals_1 from "@norskvideo/moq-signals";
|
|
9
9
|
export { Signals_1 as Signals };
|
|
10
|
-
import * as Announce_1 from "./
|
|
10
|
+
import * as Announce_1 from "./announce.js";
|
|
11
11
|
export { Announce_1 as Announce };
|
|
12
|
+
import * as Bandwidth_1 from "./bandwidth_api.js";
|
|
13
|
+
export { Bandwidth_1 as Bandwidth };
|
|
12
14
|
import * as Broadcast_1 from "./broadcast.js";
|
|
13
15
|
export { Broadcast_1 as Broadcast };
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/** A reconnecting, shareable handle on a MoQ session. */
|
|
17
|
+
export { Connection } from "./connection/index.js";
|
|
18
|
+
export { SessionCode, StreamCode } from "./error.js";
|
|
19
|
+
import * as Error_1 from "./errors.js";
|
|
20
|
+
export { Error_1 as Error };
|
|
18
21
|
import * as Group_1 from "./group.js";
|
|
19
22
|
export { Group_1 as Group };
|
|
23
|
+
import * as Origin_1 from "./origin.js";
|
|
24
|
+
export { Origin_1 as Origin };
|
|
20
25
|
import * as Path_1 from "./path.js";
|
|
21
26
|
export { Path_1 as Path };
|
|
22
27
|
import * as Time_1 from "./time.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;2BAGsB,cAAc;sBAA3B,OAAO;4BAEO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;2BAGsB,cAAc;sBAA3B,OAAO;4BAEO,eAAe;uBAA7B,QAAQ;6BAEO,oBAAoB;wBAAnC,SAAS;6BAEM,gBAAgB;wBAA/B,SAAS;AACrB,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;yBAE9B,aAAa;oBAAxB,KAAK;yBAEM,YAAY;oBAAvB,KAAK;0BAEO,aAAa;qBAAzB,MAAM;wBAEI,WAAW;mBAArB,IAAI;wBAEM,WAAW;mBAArB,IAAI;yBAEO,YAAY;oBAAvB,KAAK;0BAEO,aAAa;qBAAzB,MAAM","sourcesContent":["/**\n * MoQ networking layer for browsers: connect to a relay, then publish and consume\n * broadcasts, tracks, groups, and frames over WebTransport (or a WebSocket fallback).\n *\n * @module\n */\n\n/** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */\nexport * as Signals from \"@moq/signals\";\n/** Broadcast announcement streams. */\nexport * as Announce from \"./announce.ts\";\n/** Send-side bandwidth estimates split among the tracks sharing a connection. */\nexport * as Bandwidth from \"./bandwidth_api.ts\";\n/** Broadcast role handles. */\nexport * as Broadcast from \"./broadcast.ts\";\n/** A reconnecting, shareable handle on a MoQ session. */\nexport { Connection } from \"./connection/index.ts\";\nexport { SessionCode, StreamCode } from \"./error.ts\";\n/** Session and stream errors, each carrying a code from its own registry. */\nexport * as Error from \"./errors.ts\";\n/** Group role handles and frame helpers. */\nexport * as Group from \"./group.ts\";\n/** Broadcast routing tables, independent of any connection. */\nexport * as Origin from \"./origin.ts\";\n/** Broadcast path utilities with delimiter-aware prefix matching. Path patterns are re-exported from `@moq/pattern`. */\nexport * as Path from \"./path.ts\";\n/** Branded time types (nanoseconds, microseconds, milliseconds, seconds) with conversions. */\nexport * as Time from \"./time.ts\";\n/** Track role handles. */\nexport * as Track from \"./track.ts\";\n/** Varint encoding and decoding, in QUIC's format and moq-transport's leading-ones format. */\nexport * as Varint from \"./varint.ts\";\n"]}
|
package/internal.d.ts
CHANGED
|
@@ -5,7 +5,75 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { Dispose, Getter } from "@norskvideo/moq-signals";
|
|
9
|
+
import type { Consumer as BroadcastConsumer, Producer as BroadcastProducer } from "./broadcast";
|
|
10
|
+
import type { Frame, Consumer as GroupConsumer } from "./group";
|
|
11
|
+
import type { Route } from "./hop";
|
|
12
|
+
import * as Path from "./path";
|
|
13
|
+
import type { Timestamp } from "./time";
|
|
14
|
+
import type { Groups, Producer, Request, Subscriber } from "./track";
|
|
15
|
+
import type { Advertised, Advertisements } from "./wire";
|
|
16
|
+
/** Normalize public group bounds into an inclusive start and exclusive end. */
|
|
17
|
+
export declare function groupBounds(groups?: Groups): {
|
|
18
|
+
start: number;
|
|
19
|
+
end?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.
|
|
23
|
+
* The peer echoes every suffix beneath it, and the caller filters what arrives.
|
|
24
|
+
*/
|
|
25
|
+
export declare function scopeHead(scope: Path.Pattern): Path.Valid;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce
|
|
28
|
+
* discovery unless the request opts in. A path at or above the prefix never hides.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hiddenBelow(prefix: Path.Valid, path: Path.Valid): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Where each carried route lands under the requested prefix: its suffix beneath the
|
|
33
|
+
* prefix, or the empty suffix for a route above it, where the most specific such route
|
|
34
|
+
* wins the way a request through the prefix would resolve.
|
|
35
|
+
*/
|
|
36
|
+
export declare function presented(prefix: Path.Valid, table: Advertisements, carries: (covered: Path.Valid) => boolean): Map<Path.Valid, Advertised>;
|
|
37
|
+
/** Whether the announced prefix's subtree overlaps `scope`. */
|
|
38
|
+
export declare function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean;
|
|
39
|
+
/** What `scope` captures from an exact announced prefix, if it pins every wildcard. */
|
|
40
|
+
export declare function scopeCaptures(scope: Path.Pattern, prefix: Path.Valid): Path.Pattern[] | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* What a non-blocking group read found, which is everything the caller needs to decide what
|
|
43
|
+
* to do next: no second look at the track's closed state, and no ordering rule to get wrong.
|
|
44
|
+
*/
|
|
45
|
+
export type Recv =
|
|
46
|
+
/** A group to serve. It has already left the buffer, so dropping this is dropping the group. */
|
|
47
|
+
{
|
|
48
|
+
kind: "group";
|
|
49
|
+
group: GroupConsumer;
|
|
50
|
+
}
|
|
51
|
+
/** Nothing readable, but the track is live and may produce more. */
|
|
52
|
+
| {
|
|
53
|
+
kind: "idle";
|
|
54
|
+
}
|
|
55
|
+
/** The producer finished, yet groups above the cap are still held: raising it releases them. */
|
|
56
|
+
| {
|
|
57
|
+
kind: "boundary";
|
|
58
|
+
}
|
|
59
|
+
/** The producer finished and the buffer is drained. Nothing can follow. */
|
|
60
|
+
| {
|
|
61
|
+
kind: "done";
|
|
62
|
+
}
|
|
63
|
+
/** The track aborted. */
|
|
64
|
+
| {
|
|
65
|
+
kind: "error";
|
|
66
|
+
error: Error;
|
|
67
|
+
};
|
|
68
|
+
/** A package-internal frame read the wire publisher completes once written. */
|
|
69
|
+
export interface ReadGroupFrame {
|
|
70
|
+
/** Frame sequence within the group. */
|
|
71
|
+
sequence: number;
|
|
72
|
+
/** Frame returned to the publisher. */
|
|
73
|
+
frame: Frame;
|
|
74
|
+
/** Mark the frame delivered or deliberately skipped by the wire publisher. */
|
|
75
|
+
complete(): void;
|
|
76
|
+
}
|
|
9
77
|
/** The next group or datagram sequence shared by dynamic producers of one broadcast track. */
|
|
10
78
|
export interface TrackSequence {
|
|
11
79
|
next: number;
|
|
@@ -20,10 +88,56 @@ export interface TrackRequestOptions {
|
|
|
20
88
|
producer: Producer;
|
|
21
89
|
/** Sequence namespaces shared by the broadcast generation. */
|
|
22
90
|
sequences: TrackSequences;
|
|
91
|
+
/** Requests not yet accepted or rejected by the publisher. */
|
|
92
|
+
pending: Set<Request>;
|
|
23
93
|
}
|
|
24
94
|
/** Hooks assigned in static blocks by the owning class. */
|
|
25
95
|
export declare const hooks: {
|
|
26
96
|
/** Mint a track {@link Request}; assigned by `track.ts`. */
|
|
27
97
|
makeRequest: (options: TrackRequestOptions) => Request;
|
|
98
|
+
/** Access the existing producer while a request awaits immutable wire metadata. */
|
|
99
|
+
pendingTrackProducer: (request: Request) => Producer;
|
|
100
|
+
/**
|
|
101
|
+
* Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.
|
|
102
|
+
*
|
|
103
|
+
* Synchronous so a caller can pop a group and act on it in the same turn. Park on
|
|
104
|
+
* {@link groupChanged} when it reports `idle` or `boundary`.
|
|
105
|
+
*/
|
|
106
|
+
tryRecvGroup: (subscriber: Subscriber) => Recv;
|
|
107
|
+
/** Wake once a subscriber's group cursor may read differently; assigned by `track.ts`. */
|
|
108
|
+
groupChanged: (subscriber: Subscriber, fn: () => void) => Dispose;
|
|
109
|
+
/**
|
|
110
|
+
* Exempt a subscriber from live-delivery policy for a one-shot FETCH scan: it names one
|
|
111
|
+
* old group explicitly, so it is neither late against the live edge nor bound by the start
|
|
112
|
+
* a live subscription resolves to.
|
|
113
|
+
*/
|
|
114
|
+
exemptFetch: (subscriber: Subscriber) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Replace a serving cursor. An omitted start keeps the current floor; a provided start
|
|
117
|
+
* can lower it. Wire publishers apply SUBSCRIBE_UPDATE here rather than through
|
|
118
|
+
* `setGroups`, which never rewinds.
|
|
119
|
+
*/
|
|
120
|
+
replaceGroups: (subscriber: Subscriber, groups: Groups) => void;
|
|
121
|
+
/** Return a group's first timestamp, retained even after its first frame is read. */
|
|
122
|
+
groupTimestamp: (group: GroupConsumer) => Timestamp | undefined;
|
|
123
|
+
groupLatest: (group: GroupConsumer) => Timestamp | undefined;
|
|
124
|
+
/** Keep applying a subscription's drift policy after it hands a group out. */
|
|
125
|
+
expireGroup: (group: GroupConsumer, expiry: {
|
|
126
|
+
expired: () => boolean;
|
|
127
|
+
changed: readonly Getter<unknown>[];
|
|
128
|
+
}) => void;
|
|
129
|
+
/** Start a group operation unless the handed-out group has expired, and stop it if the group expires mid-flight. */
|
|
130
|
+
guardGroup: <T>(group: GroupConsumer, operation: () => Promise<T>) => Promise<T>;
|
|
131
|
+
/** Read a frame the wire publisher completes (or skips) once written. */
|
|
132
|
+
readGroupFrame: (group: GroupConsumer, from?: number) => Promise<ReadGroupFrame | undefined>;
|
|
133
|
+
/** Make an evicted mirror terminal while its track timeline still contains it. */
|
|
134
|
+
evictGroup: (group: GroupConsumer) => void;
|
|
135
|
+
/** Attach the origin advertisement of a created broadcast. */
|
|
136
|
+
attachAnnouncer: (producer: BroadcastProducer, announcer: {
|
|
137
|
+
announce(route: Route): void;
|
|
138
|
+
unannounce(): void;
|
|
139
|
+
}) => void;
|
|
140
|
+
/** Name a broadcast handle by the path an origin created or resolved it at. */
|
|
141
|
+
stampPath: (target: BroadcastProducer | BroadcastConsumer, path: Path.Valid) => void;
|
|
28
142
|
};
|
|
29
143
|
//# sourceMappingURL=internal.d.ts.map
|
package/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,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IAClF,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,8DAA8D;IAC9D,eAAe,EAAE,CAChB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QAAC,UAAU,IAAI,IAAI,CAAA;KAAE,KAC3D,IAAI,CAAC;IACV,+EAA+E;IAC/E,SAAS,EAAE,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC;CA4CrF,CAAC"}
|
package/internal.js
CHANGED
|
@@ -1,8 +1,116 @@
|
|
|
1
1
|
/* @ts-self-types="./internal.d.ts" */
|
|
2
|
+
import * as Path from "./path.js";
|
|
3
|
+
/** Normalize public group bounds into an inclusive start and exclusive end. */
|
|
4
|
+
export function groupBounds(groups = {}) {
|
|
5
|
+
const bound = (value, start) => {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
if ((value.included === undefined) === (value.excluded === undefined)) {
|
|
9
|
+
throw new Error("a group bound must be either included or excluded");
|
|
10
|
+
}
|
|
11
|
+
const sequence = value.included ?? value.excluded;
|
|
12
|
+
if (sequence === undefined || !Number.isSafeInteger(sequence) || sequence < 0) {
|
|
13
|
+
throw new Error("a group bound must be a non-negative safe integer");
|
|
14
|
+
}
|
|
15
|
+
return sequence + (start ? Number(value.excluded !== undefined) : Number(value.included !== undefined));
|
|
16
|
+
};
|
|
17
|
+
return { start: bound(groups.start, true) ?? 0, end: bound(groups.end, false) };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.
|
|
21
|
+
* The peer echoes every suffix beneath it, and the caller filters what arrives.
|
|
22
|
+
*/
|
|
23
|
+
export function scopeHead(scope) {
|
|
24
|
+
return Path.from(scope.head);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce
|
|
28
|
+
* discovery unless the request opts in. A path at or above the prefix never hides.
|
|
29
|
+
*/
|
|
30
|
+
export function hiddenBelow(prefix, path) {
|
|
31
|
+
const below = Path.stripPrefix(prefix, path);
|
|
32
|
+
return below !== null && Path.parts(below).some((part) => part.startsWith("."));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Where each carried route lands under the requested prefix: its suffix beneath the
|
|
36
|
+
* prefix, or the empty suffix for a route above it, where the most specific such route
|
|
37
|
+
* wins the way a request through the prefix would resolve.
|
|
38
|
+
*/
|
|
39
|
+
export function presented(prefix, table, carries) {
|
|
40
|
+
const out = new Map();
|
|
41
|
+
let rootLen = -1;
|
|
42
|
+
const requested = Path.Pattern.subtree(prefix);
|
|
43
|
+
for (const [covered, candidates] of table) {
|
|
44
|
+
if (!carries(covered))
|
|
45
|
+
continue;
|
|
46
|
+
if (Path.hasPrefix(covered, prefix)) {
|
|
47
|
+
if (covered.length < rootLen)
|
|
48
|
+
continue;
|
|
49
|
+
// A scoped route covers only what it claims, so the best one that can serve the prefix wins.
|
|
50
|
+
const snap = candidates.find((candidate) => !candidate.claim || candidate.claim.overlaps(requested));
|
|
51
|
+
if (!snap)
|
|
52
|
+
continue;
|
|
53
|
+
rootLen = covered.length;
|
|
54
|
+
out.set(Path.empty(), snap);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const suffix = Path.stripPrefix(prefix, covered);
|
|
58
|
+
if (suffix !== null && candidates.length > 0)
|
|
59
|
+
out.set(suffix, candidates[0]);
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/** Whether the announced prefix's subtree overlaps `scope`. */
|
|
64
|
+
export function scopeOverlaps(scope, prefix) {
|
|
65
|
+
return scope.overlaps(Path.Pattern.subtree(prefix));
|
|
66
|
+
}
|
|
67
|
+
/** What `scope` captures from an exact announced prefix, if it pins every wildcard. */
|
|
68
|
+
export function scopeCaptures(scope, prefix) {
|
|
69
|
+
return scope.captures(Path.Pattern.literal(prefix));
|
|
70
|
+
}
|
|
2
71
|
/** Hooks assigned in static blocks by the owning class. */
|
|
3
72
|
export const hooks = {
|
|
4
73
|
makeRequest: () => {
|
|
5
74
|
throw new Error("track.ts not loaded");
|
|
6
75
|
},
|
|
76
|
+
pendingTrackProducer: () => {
|
|
77
|
+
throw new Error("track.ts not loaded");
|
|
78
|
+
},
|
|
79
|
+
tryRecvGroup: () => {
|
|
80
|
+
throw new Error("track.ts not loaded");
|
|
81
|
+
},
|
|
82
|
+
groupChanged: () => {
|
|
83
|
+
throw new Error("track.ts not loaded");
|
|
84
|
+
},
|
|
85
|
+
exemptFetch: () => {
|
|
86
|
+
throw new Error("track.ts not loaded");
|
|
87
|
+
},
|
|
88
|
+
replaceGroups: () => {
|
|
89
|
+
throw new Error("track.ts not loaded");
|
|
90
|
+
},
|
|
91
|
+
groupTimestamp: () => {
|
|
92
|
+
throw new Error("group.ts not loaded");
|
|
93
|
+
},
|
|
94
|
+
groupLatest: () => {
|
|
95
|
+
throw new Error("group.ts not loaded");
|
|
96
|
+
},
|
|
97
|
+
expireGroup: () => {
|
|
98
|
+
throw new Error("group.ts not loaded");
|
|
99
|
+
},
|
|
100
|
+
guardGroup: () => {
|
|
101
|
+
throw new Error("group.ts not loaded");
|
|
102
|
+
},
|
|
103
|
+
readGroupFrame: () => {
|
|
104
|
+
throw new Error("group.ts not loaded");
|
|
105
|
+
},
|
|
106
|
+
evictGroup: () => {
|
|
107
|
+
throw new Error("group.ts not loaded");
|
|
108
|
+
},
|
|
109
|
+
attachAnnouncer: () => {
|
|
110
|
+
throw new Error("broadcast.ts not loaded");
|
|
111
|
+
},
|
|
112
|
+
stampPath: () => {
|
|
113
|
+
throw new Error("broadcast.ts not loaded");
|
|
114
|
+
},
|
|
7
115
|
};
|
|
8
116
|
//# sourceMappingURL=internal.js.map
|
package/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AA2BA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,KAAK,GAGd;IACH,WAAW,EAAE,GAAG,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;CACD,CAAC","sourcesContent":["/**\n * Package-internal constructor hooks. Classes keep their constructors private so consumers\n * can't mint detached handles; sibling modules create instances through these hooks instead.\n * Not exported from the package entrypoint.\n *\n * @module\n */\nimport type { Producer, Request } from \"./track.ts\";\n\n/** The next group or datagram sequence shared by dynamic producers of one broadcast track. */\nexport interface TrackSequence {\n\tnext: number;\n}\n\n/** Per-track sequence namespaces owned by one broadcast generation. */\nexport type TrackSequences = Map<string, TrackSequence>;\n\n/** Inputs for creating a package-internal track request. */\nexport interface TrackRequestOptions {\n\t/** The requested track name. */\n\tname: string;\n\t/** The producer that will serve the request. */\n\tproducer: Producer;\n\t/** Sequence namespaces shared by the broadcast generation. */\n\tsequences: TrackSequences;\n}\n\n/** Hooks assigned in static blocks by the owning class. */\nexport const hooks: {\n\t/** Mint a track {@link Request}; assigned by `track.ts`. */\n\tmakeRequest: (options: TrackRequestOptions) => Request;\n} = {\n\tmakeRequest: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n};\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAKlC,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,MAAM,GAAW,EAAE;IAC9C,MAAM,KAAK,GAAG,CAAC,KAAkC,EAAE,KAAc,EAAsB,EAAE;QACxF,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC1C,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,Q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I,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;IACD,SAAS,EAAE,GAAG,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC5C,CAAC;CACD,CAAC","sourcesContent":["/**\n * Package-internal constructor hooks. Classes keep their constructors private so consumers\n * can't mint detached handles; sibling modules create instances through these hooks instead.\n * Not exported from the package entrypoint.\n *\n * @module\n */\nimport type { Dispose, Getter } from \"@moq/signals\";\nimport type { Consumer as BroadcastConsumer, Producer as BroadcastProducer } from \"./broadcast.ts\";\nimport type { Frame, Consumer as GroupConsumer } from \"./group.ts\";\nimport type { Route } from \"./hop.ts\";\nimport * as Path from \"./path.ts\";\nimport type { Timestamp } from \"./time.ts\";\nimport type { Groups, Producer, Request, Subscriber } from \"./track.ts\";\nimport type { Advertised, Advertisements } from \"./wire.ts\";\n\n/** Normalize public group bounds into an inclusive start and exclusive end. */\nexport function groupBounds(groups: Groups = {}): { start: number; end?: number } {\n\tconst bound = (value: Groups[\"start\"] | undefined, start: boolean): number | undefined => {\n\t\tif (value === undefined) return undefined;\n\t\tif ((value.included === undefined) === (value.excluded === undefined)) {\n\t\t\tthrow new Error(\"a group bound must be either included or excluded\");\n\t\t}\n\t\tconst sequence = value.included ?? value.excluded;\n\t\tif (sequence === undefined || !Number.isSafeInteger(sequence) || sequence < 0) {\n\t\t\tthrow new Error(\"a group bound must be a non-negative safe integer\");\n\t\t}\n\t\treturn sequence + (start ? Number(value.excluded !== undefined) : Number(value.included !== undefined));\n\t};\n\treturn { start: bound(groups.start, true) ?? 0, end: bound(groups.end, false) };\n}\n\n/**\n * The announce-interest prefix a scope needs on a prefix-shaped wire: its literal head.\n * The peer echoes every suffix beneath it, and the caller filters what arrives.\n */\nexport function scopeHead(scope: Path.Pattern): Path.Valid {\n\treturn Path.from(scope.head);\n}\n\n/**\n * Whether a segment of `path` below `prefix` starts with `.`, which hides it from announce\n * discovery unless the request opts in. A path at or above the prefix never hides.\n */\nexport function hiddenBelow(prefix: Path.Valid, path: Path.Valid): boolean {\n\tconst below = Path.stripPrefix(prefix, path);\n\treturn below !== null && Path.parts(below).some((part) => part.startsWith(\".\"));\n}\n\n/**\n * Where each carried route lands under the requested prefix: its suffix beneath the\n * prefix, or the empty suffix for a route above it, where the most specific such route\n * wins the way a request through the prefix would resolve.\n */\nexport function presented(\n\tprefix: Path.Valid,\n\ttable: Advertisements,\n\tcarries: (covered: Path.Valid) => boolean,\n): Map<Path.Valid, Advertised> {\n\tconst out = new Map<Path.Valid, Advertised>();\n\tlet rootLen = -1;\n\tconst requested = Path.Pattern.subtree(prefix);\n\tfor (const [covered, candidates] of table) {\n\t\tif (!carries(covered)) continue;\n\t\tif (Path.hasPrefix(covered, prefix)) {\n\t\t\tif (covered.length < rootLen) continue;\n\t\t\t// A scoped route covers only what it claims, so the best one that can serve the prefix wins.\n\t\t\tconst snap = candidates.find((candidate) => !candidate.claim || candidate.claim.overlaps(requested));\n\t\t\tif (!snap) continue;\n\t\t\trootLen = covered.length;\n\t\t\tout.set(Path.empty(), snap);\n\t\t\tcontinue;\n\t\t}\n\t\tconst suffix = Path.stripPrefix(prefix, covered);\n\t\tif (suffix !== null && candidates.length > 0) out.set(suffix, candidates[0]);\n\t}\n\treturn out;\n}\n\n/** Whether the announced prefix's subtree overlaps `scope`. */\nexport function scopeOverlaps(scope: Path.Pattern, prefix: Path.Valid): boolean {\n\treturn scope.overlaps(Path.Pattern.subtree(prefix));\n}\n\n/** What `scope` captures from an exact announced prefix, if it pins every wildcard. */\nexport function scopeCaptures(scope: Path.Pattern, prefix: Path.Valid): Path.Pattern[] | undefined {\n\treturn scope.captures(Path.Pattern.literal(prefix));\n}\n\n/**\n * What a non-blocking group read found, which is everything the caller needs to decide what\n * to do next: no second look at the track's closed state, and no ordering rule to get wrong.\n */\nexport type Recv =\n\t/** A group to serve. It has already left the buffer, so dropping this is dropping the group. */\n\t| { kind: \"group\"; group: GroupConsumer }\n\t/** Nothing readable, but the track is live and may produce more. */\n\t| { kind: \"idle\" }\n\t/** The producer finished, yet groups above the cap are still held: raising it releases them. */\n\t| { kind: \"boundary\" }\n\t/** The producer finished and the buffer is drained. Nothing can follow. */\n\t| { kind: \"done\" }\n\t/** The track aborted. */\n\t| { kind: \"error\"; error: Error };\n\n/** A package-internal frame read the wire publisher completes once written. */\nexport interface ReadGroupFrame {\n\t/** Frame sequence within the group. */\n\tsequence: number;\n\t/** Frame returned to the publisher. */\n\tframe: Frame;\n\t/** Mark the frame delivered or deliberately skipped by the wire publisher. */\n\tcomplete(): void;\n}\n\n/** The next group or datagram sequence shared by dynamic producers of one broadcast track. */\nexport interface TrackSequence {\n\tnext: number;\n}\n\n/** Per-track sequence namespaces owned by one broadcast generation. */\nexport type TrackSequences = Map<string, TrackSequence>;\n\n/** Inputs for creating a package-internal track request. */\nexport interface TrackRequestOptions {\n\t/** The requested track name. */\n\tname: string;\n\t/** The producer that will serve the request. */\n\tproducer: Producer;\n\t/** Sequence namespaces shared by the broadcast generation. */\n\tsequences: TrackSequences;\n\t/** Requests not yet accepted or rejected by the publisher. */\n\tpending: Set<Request>;\n}\n\n/** Hooks assigned in static blocks by the owning class. */\nexport const hooks: {\n\t/** Mint a track {@link Request}; assigned by `track.ts`. */\n\tmakeRequest: (options: TrackRequestOptions) => Request;\n\t/** Access the existing producer while a request awaits immutable wire metadata. */\n\tpendingTrackProducer: (request: Request) => Producer;\n\t/**\n\t * Take the next group the subscriber's cursor allows, without waiting; assigned by `track.ts`.\n\t *\n\t * Synchronous so a caller can pop a group and act on it in the same turn. Park on\n\t * {@link groupChanged} when it reports `idle` or `boundary`.\n\t */\n\ttryRecvGroup: (subscriber: Subscriber) => Recv;\n\t/** Wake once a subscriber's group cursor may read differently; assigned by `track.ts`. */\n\tgroupChanged: (subscriber: Subscriber, fn: () => void) => Dispose;\n\t/**\n\t * Exempt a subscriber from live-delivery policy for a one-shot FETCH scan: it names one\n\t * old group explicitly, so it is neither late against the live edge nor bound by the start\n\t * a live subscription resolves to.\n\t */\n\texemptFetch: (subscriber: Subscriber) => void;\n\t/**\n\t * Replace a serving cursor. An omitted start keeps the current floor; a provided start\n\t * can lower it. Wire publishers apply SUBSCRIBE_UPDATE here rather than through\n\t * `setGroups`, which never rewinds.\n\t */\n\treplaceGroups: (subscriber: Subscriber, groups: Groups) => void;\n\t/** Return a group's first timestamp, retained even after its first frame is read. */\n\tgroupTimestamp: (group: GroupConsumer) => Timestamp | undefined;\n\tgroupLatest: (group: GroupConsumer) => Timestamp | undefined;\n\t/** Keep applying a subscription's drift policy after it hands a group out. */\n\texpireGroup: (\n\t\tgroup: GroupConsumer,\n\t\texpiry: { expired: () => boolean; changed: readonly Getter<unknown>[] },\n\t) => void;\n\t/** Start a group operation unless the handed-out group has expired, and stop it if the group expires mid-flight. */\n\tguardGroup: <T>(group: GroupConsumer, operation: () => Promise<T>) => Promise<T>;\n\t/** Read a frame the wire publisher completes (or skips) once written. */\n\treadGroupFrame: (group: GroupConsumer, from?: number) => Promise<ReadGroupFrame | undefined>;\n\t/** Make an evicted mirror terminal while its track timeline still contains it. */\n\tevictGroup: (group: GroupConsumer) => void;\n\t/** Attach the origin advertisement of a created broadcast. */\n\tattachAnnouncer: (\n\t\tproducer: BroadcastProducer,\n\t\tannouncer: { announce(route: Route): void; unannounce(): void },\n\t) => void;\n\t/** Name a broadcast handle by the path an origin created or resolved it at. */\n\tstampPath: (target: BroadcastProducer | BroadcastConsumer, path: Path.Valid) => void;\n} = {\n\tmakeRequest: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tpendingTrackProducer: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\ttryRecvGroup: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupChanged: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\texemptFetch: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\treplaceGroups: () => {\n\t\tthrow new Error(\"track.ts not loaded\");\n\t},\n\tgroupTimestamp: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tgroupLatest: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\texpireGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tguardGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\treadGroupFrame: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tevictGroup: () => {\n\t\tthrow new Error(\"group.ts not loaded\");\n\t},\n\tattachAnnouncer: () => {\n\t\tthrow new Error(\"broadcast.ts not loaded\");\n\t},\n\tstampPath: () => {\n\t\tthrow new Error(\"broadcast.ts not loaded\");\n\t},\n};\n"]}
|
package/lite/announce.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Cost, type Hop } from "../hop";
|
|
2
2
|
import * as Path from "../path";
|
|
3
3
|
import type { Reader, Writer } from "../stream";
|
|
4
4
|
import { Version } from "./version";
|
|
5
|
+
export type { Cost };
|
|
6
|
+
/**
|
|
7
|
+
* Lite-07: copy `keep` path segments (from the head) or hops (from the tail) of the
|
|
8
|
+
* live announcement `distance` back from the stream's next Announce ID, where 1 is the
|
|
9
|
+
* latest ANNOUNCE_START. Resolved by {@link AnnounceHistory}.
|
|
10
|
+
*/
|
|
11
|
+
export type Base = {
|
|
12
|
+
distance: bigint;
|
|
13
|
+
keep: number;
|
|
14
|
+
};
|
|
5
15
|
/**
|
|
6
16
|
* An announcement on the Announce Stream, advertising or retracting a broadcast.
|
|
7
17
|
*
|
|
@@ -14,12 +24,16 @@ import { Version } from "./version";
|
|
|
14
24
|
*/
|
|
15
25
|
export type AnnounceBroadcast =
|
|
16
26
|
/** A broadcast is now available, carrying the path suffix, the hop chain, and
|
|
17
|
-
* (lite-06+) the route cost. An absent cost encodes as zero
|
|
27
|
+
* (lite-06+) the route cost. An absent cost encodes as zero; it decodes as
|
|
28
|
+
* `undefined` on a wire with no room for one. On lite-07, `suffix` follows the
|
|
29
|
+
* segments `pathBase` copies and `hops` precede the ones `hopBase` copies. */
|
|
18
30
|
{
|
|
19
31
|
status: "active";
|
|
20
32
|
suffix: Path.Valid;
|
|
21
|
-
hops:
|
|
22
|
-
cost?:
|
|
33
|
+
hops: Hop[];
|
|
34
|
+
cost?: Cost;
|
|
35
|
+
pathBase?: Base;
|
|
36
|
+
hopBase?: Base;
|
|
23
37
|
}
|
|
24
38
|
/** Pre-lite-06: a broadcast is no longer available, retracted by path. */
|
|
25
39
|
| {
|
|
@@ -37,8 +51,13 @@ export type AnnounceBroadcast =
|
|
|
37
51
|
| {
|
|
38
52
|
status: "restart";
|
|
39
53
|
id: bigint;
|
|
40
|
-
hops:
|
|
41
|
-
cost?:
|
|
54
|
+
hops: Hop[];
|
|
55
|
+
cost?: Cost;
|
|
56
|
+
hopBase?: Base;
|
|
57
|
+
}
|
|
58
|
+
/** An unknown lite-06+ announce type, skipped by length. Does not assign an id. */
|
|
59
|
+
| {
|
|
60
|
+
status: "skipped";
|
|
42
61
|
};
|
|
43
62
|
/** Encode one announcement, including its type discriminator (lite-06+) and length prefix. */
|
|
44
63
|
export declare function encodeAnnounceBroadcast(w: Writer, msg: AnnounceBroadcast, version: Version): Promise<void>;
|
|
@@ -46,6 +65,33 @@ export declare function encodeAnnounceBroadcast(w: Writer, msg: AnnounceBroadcas
|
|
|
46
65
|
export declare function decodeAnnounceBroadcast(r: Reader, version: Version): Promise<AnnounceBroadcast>;
|
|
47
66
|
/** Like {@link decodeAnnounceBroadcast} but resolves `undefined` on a clean FIN. */
|
|
48
67
|
export declare function decodeAnnounceBroadcastMaybe(r: Reader, version: Version): Promise<AnnounceBroadcast | undefined>;
|
|
68
|
+
type Advertised = {
|
|
69
|
+
suffix: Path.Valid;
|
|
70
|
+
hops: Hop[];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The live announcements on one lite-06+ announce stream, by Announce ID: what
|
|
74
|
+
* ANNOUNCE_END and ANNOUNCE_UPDATE reference, and what a lite-07 base copies from.
|
|
75
|
+
* Every violation throws {@link ProtocolViolation}.
|
|
76
|
+
*/
|
|
77
|
+
export declare class AnnounceHistory {
|
|
78
|
+
#private;
|
|
79
|
+
/** An ANNOUNCE_START: resolve it and assign it the next id. */
|
|
80
|
+
start(msg: {
|
|
81
|
+
suffix: Path.Valid;
|
|
82
|
+
hops: Hop[];
|
|
83
|
+
pathBase?: Base;
|
|
84
|
+
hopBase?: Base;
|
|
85
|
+
}): Advertised;
|
|
86
|
+
/** An ANNOUNCE_UPDATE: resolve its chain before replacing the old one, which it may be based on. */
|
|
87
|
+
update(msg: {
|
|
88
|
+
id: bigint;
|
|
89
|
+
hops: Hop[];
|
|
90
|
+
hopBase?: Base;
|
|
91
|
+
}): Advertised;
|
|
92
|
+
/** An ANNOUNCE_END: retire the id, returning its suffix. */
|
|
93
|
+
end(id: bigint): Path.Valid;
|
|
94
|
+
}
|
|
49
95
|
/**
|
|
50
96
|
* ANNOUNCE_REQUEST: sent by the subscriber to request ANNOUNCE_BROADCAST messages
|
|
51
97
|
* for a path prefix. Renamed from `AnnounceInterest` in lite-05.
|
|
@@ -53,14 +99,18 @@ export declare function decodeAnnounceBroadcastMaybe(r: Reader, version: Version
|
|
|
53
99
|
export declare class AnnounceRequest {
|
|
54
100
|
#private;
|
|
55
101
|
prefix: Path.Valid;
|
|
56
|
-
/** Lite04/05 only: the 62-bit
|
|
102
|
+
/** Lite04/05 only: the 62-bit Hop id of the peer asking for announces, which the
|
|
57
103
|
* publisher uses to skip announces that already passed through it. Zero means "no
|
|
58
104
|
* exclusion". Not on the wire elsewhere, so a value set here is ignored when encoding
|
|
59
105
|
* for another version and decodes as zero.
|
|
60
106
|
*
|
|
61
107
|
* Must be a bigint: peer origins are up to 62 bits and overflow u53. */
|
|
62
108
|
excludeHop: bigint;
|
|
63
|
-
|
|
109
|
+
/** Lite07+: also announce routes with a `.`-prefixed segment below the prefix. Not on
|
|
110
|
+
* the wire earlier, so a value set here is ignored when encoding for an older version
|
|
111
|
+
* and decodes as false. */
|
|
112
|
+
hidden: boolean;
|
|
113
|
+
constructor(prefix: Path.Valid, excludeHop?: bigint, hidden?: boolean);
|
|
64
114
|
encode(w: Writer, version: Version): Promise<void>;
|
|
65
115
|
static decode(r: Reader, version: Version): Promise<AnnounceRequest>;
|
|
66
116
|
}
|
|
@@ -73,9 +123,9 @@ export declare class AnnounceInit {
|
|
|
73
123
|
}
|
|
74
124
|
export declare class AnnounceOk {
|
|
75
125
|
#private;
|
|
76
|
-
|
|
126
|
+
hop: Hop;
|
|
77
127
|
active: number;
|
|
78
|
-
constructor(
|
|
128
|
+
constructor(hop: Hop, active: number);
|
|
79
129
|
encode(w: Writer, version: Version): Promise<void>;
|
|
80
130
|
static decode(r: Reader, version: Version): Promise<AnnounceOk>;
|
|
81
131
|
}
|
package/lite/announce.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/lite/announce.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/lite/announce.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,GAAG,EAAoC,MAAM,WAAW,CAAC;AAClF,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAON,OAAO,EACP,MAAM,cAAc,CAAC;AActB,YAAY,EAAE,IAAI,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,MAAM,IAAI,GAAG;IAA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