@norskvideo/moq-net 0.1.2 → 0.1.4
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 +1 -0
- package/announced.d.ts +111 -21
- package/announced.d.ts.map +1 -1
- package/announced.js +213 -40
- package/announced.js.map +1 -1
- package/broadcast.d.ts +80 -25
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +270 -49
- package/broadcast.js.map +1 -1
- package/connection/accept.d.ts +6 -0
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +42 -13
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts +5 -0
- package/connection/browser.d.ts.map +1 -0
- package/connection/browser.js +31 -0
- package/connection/browser.js.map +1 -0
- package/connection/connect.d.ts +43 -1
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +118 -123
- package/connection/connect.js.map +1 -1
- package/connection/established.d.ts +43 -16
- package/connection/established.d.ts.map +1 -1
- package/connection/established.js.map +1 -1
- package/connection/handshake.d.ts +12 -1
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +30 -14
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +8 -0
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +6 -0
- package/connection/index.js.map +1 -1
- package/connection/reload.d.ts +66 -9
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +192 -66
- package/connection/reload.js.map +1 -1
- package/connection/stats.d.ts +92 -0
- package/connection/stats.d.ts.map +1 -0
- package/connection/stats.js +35 -0
- package/connection/stats.js.map +1 -0
- package/connection/transport.d.ts +10 -0
- package/connection/transport.d.ts.map +1 -0
- package/connection/transport.js +12 -0
- package/connection/transport.js.map +1 -0
- package/consume.d.ts +44 -0
- package/consume.d.ts.map +1 -0
- package/consume.js +60 -0
- package/consume.js.map +1 -0
- package/datagram.d.ts +23 -0
- package/datagram.d.ts.map +1 -0
- package/datagram.js +3 -0
- package/datagram.js.map +1 -0
- package/error.d.ts +76 -0
- package/error.d.ts.map +1 -0
- package/error.js +107 -0
- package/error.js.map +1 -0
- package/group.d.ts +143 -38
- package/group.d.ts.map +1 -1
- package/group.js +270 -68
- package/group.js.map +1 -1
- package/ietf/adapter.d.ts +2 -2
- package/ietf/adapter.d.ts.map +1 -1
- package/ietf/adapter.js +20 -10
- package/ietf/adapter.js.map +1 -1
- package/ietf/aliases.d.ts +73 -5
- package/ietf/aliases.d.ts.map +1 -1
- package/ietf/aliases.js +121 -14
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +141 -0
- package/ietf/cluster.d.ts.map +1 -0
- package/ietf/cluster.js +204 -0
- package/ietf/cluster.js.map +1 -0
- package/ietf/connection.d.ts +39 -6
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +73 -12
- package/ietf/connection.js.map +1 -1
- package/ietf/fetch.d.ts +17 -0
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +21 -0
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +87 -0
- package/ietf/filter.d.ts.map +1 -0
- package/ietf/filter.js +292 -0
- package/ietf/filter.js.map +1 -0
- package/ietf/index.d.ts +2 -0
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +3 -0
- package/ietf/index.js.map +1 -1
- package/ietf/namespace.d.ts +6 -0
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +27 -2
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +54 -6
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +178 -25
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +35 -10
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +236 -45
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +5 -0
- package/ietf/priority.d.ts.map +1 -0
- package/ietf/priority.js +10 -0
- package/ietf/priority.js.map +1 -0
- package/ietf/properties.d.ts +13 -2
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +65 -8
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +13 -3
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +16 -2
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +25 -6
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.d.ts +40 -7
- package/ietf/publisher.d.ts.map +1 -1
- package/ietf/publisher.js +751 -134
- package/ietf/publisher.js.map +1 -1
- package/ietf/request.js +1 -1
- package/ietf/request.js.map +1 -1
- package/ietf/solicit.d.ts +41 -0
- package/ietf/solicit.d.ts.map +1 -0
- package/ietf/solicit.js +47 -0
- package/ietf/solicit.js.map +1 -0
- package/ietf/subscribe.d.ts +41 -2
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +103 -22
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +21 -7
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +31 -14
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.d.ts +20 -7
- package/ietf/subscriber.d.ts.map +1 -1
- package/ietf/subscriber.js +512 -142
- package/ietf/subscriber.js.map +1 -1
- package/ietf/version.d.ts +7 -1
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +7 -0
- package/ietf/version.js.map +1 -1
- package/index.d.ts +10 -5
- package/index.d.ts.map +1 -1
- package/index.js +10 -5
- package/index.js.map +1 -1
- package/internal.d.ts +29 -0
- package/internal.d.ts.map +1 -0
- package/internal.js +8 -0
- package/internal.js.map +1 -0
- package/lite/announce.d.ts +62 -15
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +230 -94
- package/lite/announce.js.map +1 -1
- package/lite/connection.d.ts +69 -20
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +128 -81
- package/lite/connection.js.map +1 -1
- package/lite/datagram.d.ts +23 -0
- package/lite/datagram.d.ts.map +1 -0
- package/lite/datagram.js +57 -0
- package/lite/datagram.js.map +1 -0
- package/lite/datagram_stream.d.ts +8 -0
- package/lite/datagram_stream.d.ts.map +1 -0
- package/lite/datagram_stream.js +44 -0
- package/lite/datagram_stream.js.map +1 -0
- package/lite/fetch.d.ts.map +1 -1
- package/lite/fetch.js +2 -2
- package/lite/fetch.js.map +1 -1
- package/lite/index.d.ts +3 -0
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +3 -0
- package/lite/index.js.map +1 -1
- package/lite/priority.d.ts +67 -0
- package/lite/priority.d.ts.map +1 -0
- package/lite/priority.js +114 -0
- package/lite/priority.js.map +1 -0
- package/lite/probe.d.ts +18 -2
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +24 -22
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +14 -7
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +406 -84
- package/lite/publisher.js.map +1 -1
- package/lite/setup.d.ts +83 -6
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +203 -31
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +12 -3
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +7 -4
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +37 -23
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +70 -55
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +29 -23
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +689 -112
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +25 -13
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +60 -35
- package/lite/track.js.map +1 -1
- package/lite/version.d.ts +39 -4
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +139 -17
- package/lite/version.js.map +1 -1
- package/mock.d.ts +53 -3
- package/mock.d.ts.map +1 -1
- package/mock.js +110 -21
- package/mock.js.map +1 -1
- package/{lite/origin.d.ts → origin.d.ts} +25 -1
- package/origin.d.ts.map +1 -0
- package/{lite/origin.js → origin.js} +25 -1
- package/origin.js.map +1 -0
- package/package.json +6 -4
- package/path.d.ts +67 -0
- package/path.d.ts.map +1 -1
- package/path.js +128 -0
- package/path.js.map +1 -1
- package/stream.d.ts +94 -4
- package/stream.d.ts.map +1 -1
- package/stream.js +128 -17
- package/stream.js.map +1 -1
- package/time.d.ts +109 -86
- package/time.d.ts.map +1 -1
- package/time.js +80 -30
- package/time.js.map +1 -1
- package/track.d.ts +298 -47
- package/track.d.ts.map +1 -1
- package/track.js +721 -109
- package/track.js.map +1 -1
- package/util/timeout.d.ts +5 -0
- package/util/timeout.d.ts.map +1 -0
- package/util/timeout.js +18 -0
- package/util/timeout.js.map +1 -0
- package/util/utf8.d.ts +3 -0
- package/util/utf8.d.ts.map +1 -0
- package/util/utf8.js +7 -0
- package/util/utf8.js.map +1 -0
- package/varint.d.ts +14 -3
- package/varint.d.ts.map +1 -1
- package/varint.js +23 -12
- package/varint.js.map +1 -1
- package/zod.d.ts +5 -5
- package/zod.d.ts.map +1 -1
- package/zod.js.map +1 -1
- package/bandwidth.d.ts +0 -11
- package/bandwidth.d.ts.map +0 -1
- package/bandwidth.js +0 -7
- package/bandwidth.js.map +0 -1
- package/connection/cert.test.d.ts +0 -2
- package/connection/cert.test.d.ts.map +0 -1
- package/connection/cert.test.js +0 -26
- package/connection/cert.test.js.map +0 -1
- package/connection/reload.test.d.ts +0 -2
- package/connection/reload.test.d.ts.map +0 -1
- package/connection/reload.test.js +0 -39
- package/connection/reload.test.js.map +0 -1
- package/group.test.d.ts +0 -2
- package/group.test.d.ts.map +0 -1
- package/group.test.js +0 -66
- package/group.test.js.map +0 -1
- package/ietf/aliases.test.d.ts +0 -2
- package/ietf/aliases.test.d.ts.map +0 -1
- package/ietf/aliases.test.js +0 -30
- package/ietf/aliases.test.js.map +0 -1
- package/ietf/ietf.test.d.ts +0 -2
- package/ietf/ietf.test.d.ts.map +0 -1
- package/ietf/ietf.test.js +0 -873
- package/ietf/ietf.test.js.map +0 -1
- package/integration.test.d.ts +0 -2
- package/integration.test.d.ts.map +0 -1
- package/integration.test.js +0 -90
- package/integration.test.js.map +0 -1
- package/lite/origin.d.ts.map +0 -1
- package/lite/origin.js.map +0 -1
- package/lite/subscriber.test.d.ts +0 -2
- package/lite/subscriber.test.d.ts.map +0 -1
- package/lite/subscriber.test.js +0 -30
- package/lite/subscriber.test.js.map +0 -1
- package/lite/track.test.d.ts +0 -2
- package/lite/track.test.d.ts.map +0 -1
- package/lite/track.test.js +0 -53
- package/lite/track.test.js.map +0 -1
- package/path.test.d.ts +0 -2
- package/path.test.d.ts.map +0 -1
- package/path.test.js +0 -169
- package/path.test.js.map +0 -1
- package/stream.test.d.ts +0 -2
- package/stream.test.d.ts.map +0 -1
- package/stream.test.js +0 -210
- package/stream.test.js.map +0 -1
- package/track.test.d.ts +0 -2
- package/track.test.d.ts.map +0 -1
- package/track.test.js +0 -56
- package/track.test.js.map +0 -1
- package/util/error.d.ts +0 -3
- package/util/error.d.ts.map +0 -1
- package/util/error.js +0 -9
- package/util/error.js.map +0 -1
- package/util/index.d.ts +0 -2
- package/util/index.d.ts.map +0 -1
- package/util/index.js +0 -3
- package/util/index.js.map +0 -1
- package/varint.test.d.ts +0 -2
- package/varint.test.d.ts.map +0 -1
- package/varint.test.js +0 -106
- package/varint.test.js.map +0 -1
|
@@ -1,27 +1,54 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import type { Broadcast } from "../broadcast";
|
|
1
|
+
import type { Getter } from "@norskvideo/moq-signals";
|
|
2
|
+
import type * as announce from "../announced";
|
|
3
|
+
import type * as broadcast from "../broadcast";
|
|
5
4
|
import type * as Path from "../path";
|
|
6
|
-
import type
|
|
5
|
+
import type { Probe, Stats } from "./stats";
|
|
6
|
+
import type { Transport } from "./transport";
|
|
7
7
|
/** An established MoQ session, implemented by both the moq-lite and moq-ietf protocols. */
|
|
8
8
|
export interface Established {
|
|
9
9
|
/** URL of the connected server. */
|
|
10
10
|
readonly url: URL;
|
|
11
11
|
/** Negotiated wire protocol version. */
|
|
12
12
|
readonly version: string;
|
|
13
|
-
/**
|
|
14
|
-
readonly
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
/** The wire transport this session runs over. */
|
|
14
|
+
readonly transport: Transport;
|
|
15
|
+
/**
|
|
16
|
+
* Estimates measured by the peer, updated as PROBE messages arrive. Stays empty on
|
|
17
|
+
* versions without PROBE. See {@link Stats} for what the local transport counts.
|
|
18
|
+
*/
|
|
19
|
+
readonly probe: Getter<Probe>;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the relay supports broadcast discovery: announcing which broadcasts exist under a
|
|
22
|
+
* prefix. When false, {@link announced} never yields, so a consumer must subscribe blind
|
|
23
|
+
* rather than wait for an announcement. Set via `discovery` on the connect options.
|
|
24
|
+
*/
|
|
25
|
+
readonly discovery: boolean;
|
|
26
|
+
/** Subscribe to broadcast announcements under an optional path prefix, returning paths relative to that prefix. */
|
|
27
|
+
announced(prefix?: Path.Valid): announce.Consumer;
|
|
21
28
|
/** Publish a broadcast at the given path. */
|
|
22
|
-
publish(path: Path.Valid, broadcast:
|
|
23
|
-
/**
|
|
24
|
-
|
|
29
|
+
publish(path: Path.Valid, broadcast: broadcast.Producer): void;
|
|
30
|
+
/**
|
|
31
|
+
* Consume the broadcast at the given path, immediately.
|
|
32
|
+
*
|
|
33
|
+
* The subscription is reset if nobody publishes the path, so use
|
|
34
|
+
* {@link announcedBroadcast} instead when the broadcast may not be online yet.
|
|
35
|
+
*/
|
|
36
|
+
consume(path: Path.Valid): broadcast.Consumer;
|
|
37
|
+
/**
|
|
38
|
+
* A reactive handle to the broadcast at the given path, live only while it is announced.
|
|
39
|
+
*
|
|
40
|
+
* The announcement-gated counterpart to {@link consume}: it waits for the broadcast to come
|
|
41
|
+
* online instead of resetting, and drops back to `undefined` when it goes away. See
|
|
42
|
+
* {@link announce.Broadcast}. Close the handle when done.
|
|
43
|
+
*/
|
|
44
|
+
announcedBroadcast(path: Path.Valid): announce.Broadcast;
|
|
45
|
+
/**
|
|
46
|
+
* Snapshot the transport's counters, querying it fresh on each call.
|
|
47
|
+
*
|
|
48
|
+
* Resolves to an empty snapshot on a transport without `getStats()`. Sample it on
|
|
49
|
+
* whatever schedule you need rather than expecting the library to poll for you.
|
|
50
|
+
*/
|
|
51
|
+
stats(): Promise<Stats>;
|
|
25
52
|
/** Close the session. */
|
|
26
53
|
close(): void;
|
|
27
54
|
/** Resolves when the session closes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"established.d.ts","sourceRoot":"","sources":["../../src/connection/established.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"established.d.ts","sourceRoot":"","sources":["../../src/connection/established.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,IAAI,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAElB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,mHAAmH;IACnH,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAElD,6CAA6C;IAC7C,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;IAE/D;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC;IAE9C;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC;IAEzD;;;;;OAKG;IACH,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAExB,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAAC;IAEd,wCAAwC;IACxC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"established.js","sourceRoot":"","sources":["../../src/connection/established.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"established.js","sourceRoot":"","sources":["../../src/connection/established.ts"],"names":[],"mappings":"","sourcesContent":["import type { Getter } from \"@moq/signals\";\nimport type * as announce from \"../announced.ts\";\nimport type * as broadcast from \"../broadcast.ts\";\nimport type * as Path from \"../path.ts\";\nimport type { Probe, Stats } from \"./stats.ts\";\nimport type { Transport } from \"./transport.ts\";\n\n/** An established MoQ session, implemented by both the moq-lite and moq-ietf protocols. */\nexport interface Established {\n\t/** URL of the connected server. */\n\treadonly url: URL;\n\n\t/** Negotiated wire protocol version. */\n\treadonly version: string;\n\n\t/** The wire transport this session runs over. */\n\treadonly transport: Transport;\n\n\t/**\n\t * Estimates measured by the peer, updated as PROBE messages arrive. Stays empty on\n\t * versions without PROBE. See {@link Stats} for what the local transport counts.\n\t */\n\treadonly probe: Getter<Probe>;\n\n\t/**\n\t * Whether the relay supports broadcast discovery: announcing which broadcasts exist under a\n\t * prefix. When false, {@link announced} never yields, so a consumer must subscribe blind\n\t * rather than wait for an announcement. Set via `discovery` on the connect options.\n\t */\n\treadonly discovery: boolean;\n\n\t/** Subscribe to broadcast announcements under an optional path prefix, returning paths relative to that prefix. */\n\tannounced(prefix?: Path.Valid): announce.Consumer;\n\n\t/** Publish a broadcast at the given path. */\n\tpublish(path: Path.Valid, broadcast: broadcast.Producer): void;\n\n\t/**\n\t * Consume the broadcast at the given path, immediately.\n\t *\n\t * The subscription is reset if nobody publishes the path, so use\n\t * {@link announcedBroadcast} instead when the broadcast may not be online yet.\n\t */\n\tconsume(path: Path.Valid): broadcast.Consumer;\n\n\t/**\n\t * A reactive handle to the broadcast at the given path, live only while it is announced.\n\t *\n\t * The announcement-gated counterpart to {@link consume}: it waits for the broadcast to come\n\t * online instead of resetting, and drops back to `undefined` when it goes away. See\n\t * {@link announce.Broadcast}. Close the handle when done.\n\t */\n\tannouncedBroadcast(path: Path.Valid): announce.Broadcast;\n\n\t/**\n\t * Snapshot the transport's counters, querying it fresh on each call.\n\t *\n\t * Resolves to an empty snapshot on a transport without `getStats()`. Sample it on\n\t * whatever schedule you need rather than expecting the library to poll for you.\n\t */\n\tstats(): Promise<Stats>;\n\n\t/** Close the session. */\n\tclose(): void;\n\n\t/** Resolves when the session closes. */\n\tclosed: Promise<void>;\n}\n"]}
|
|
@@ -5,6 +5,17 @@ import { Stream } from "../stream";
|
|
|
5
5
|
* message, and reads the peer's Setup off an incoming uni stream. The two
|
|
6
6
|
* halves run in parallel and the protocol is symmetric, so both `connect`
|
|
7
7
|
* (client) and `accept` (server) use this same function.
|
|
8
|
+
*
|
|
9
|
+
* Returns the control stream plus what the peer's SETUP declared: whether it requires
|
|
10
|
+
* solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit
|
|
11
|
+
* extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on
|
|
12
|
+
* every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited
|
|
13
|
+
* advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop
|
|
14
|
+
* ID can withhold the advertisements that already flowed through us.
|
|
8
15
|
*/
|
|
9
|
-
export declare function exchangeSetup(transport: WebTransport, version: Ietf.IetfVersion, implementation: string): Promise<
|
|
16
|
+
export declare function exchangeSetup(transport: WebTransport, version: Ietf.IetfVersion, implementation: string): Promise<{
|
|
17
|
+
control: Stream;
|
|
18
|
+
solicit: boolean | undefined;
|
|
19
|
+
cluster: Ietf.Cluster.Hops;
|
|
20
|
+
}>;
|
|
10
21
|
//# sourceMappingURL=handshake.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAU,MAAM,EAAU,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;CAAE,CAAC,CAuBxF"}
|
package/connection/handshake.js
CHANGED
|
@@ -1,34 +1,47 @@
|
|
|
1
1
|
/* @ts-self-types="./handshake.d.ts" */
|
|
2
2
|
import * as Ietf from "../ietf/index.js";
|
|
3
|
+
import { randomOrigin } from "../origin.js";
|
|
3
4
|
import { Reader, Stream, Writer } from "../stream.js";
|
|
4
5
|
/**
|
|
5
6
|
* Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup
|
|
6
7
|
* message, and reads the peer's Setup off an incoming uni stream. The two
|
|
7
8
|
* halves run in parallel and the protocol is symmetric, so both `connect`
|
|
8
9
|
* (client) and `accept` (server) use this same function.
|
|
10
|
+
*
|
|
11
|
+
* Returns the control stream plus what the peer's SETUP declared: whether it requires
|
|
12
|
+
* solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit
|
|
13
|
+
* extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on
|
|
14
|
+
* every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited
|
|
15
|
+
* advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop
|
|
16
|
+
* ID can withhold the advertisements that already flowed through us.
|
|
9
17
|
*/
|
|
10
18
|
export async function exchangeSetup(transport, version, implementation) {
|
|
11
19
|
const encoder = new TextEncoder();
|
|
12
20
|
const params = new Ietf.SetupOptions();
|
|
13
21
|
params.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));
|
|
22
|
+
Ietf.solicitIntoSetup(params);
|
|
23
|
+
// One id per session, like the moq-lite connection: nothing in this process forwards
|
|
24
|
+
// between sessions, so there is nothing for a shared id to detect.
|
|
25
|
+
const self = randomOrigin();
|
|
26
|
+
Ietf.Cluster.intoSetup(params, self, version);
|
|
14
27
|
const setupMsg = new Ietf.Setup({ parameters: params });
|
|
15
|
-
const [
|
|
28
|
+
const [writer, received] = await Promise.all([
|
|
16
29
|
sendSetup(transport, version, setupMsg),
|
|
17
30
|
receiveSetup(transport, version),
|
|
18
31
|
]);
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
32
|
+
return {
|
|
33
|
+
control: new Stream({ writer, reader: received.reader }),
|
|
34
|
+
solicit: received.solicit,
|
|
35
|
+
cluster: { self, peer: received.cluster },
|
|
36
|
+
};
|
|
25
37
|
}
|
|
26
38
|
async function sendSetup(transport, version, setupMsg) {
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
// Via Writer.open for its deadline: a peer can advertise a stream limit of zero and
|
|
40
|
+
// never raise it, which would otherwise hang the handshake rather than failing it.
|
|
41
|
+
const writer = await Writer.open(transport, { version });
|
|
29
42
|
await writer.u53(Ietf.Setup.id); // 0x2F00 stream type
|
|
30
43
|
await setupMsg.encode(writer, version);
|
|
31
|
-
return
|
|
44
|
+
return writer;
|
|
32
45
|
}
|
|
33
46
|
async function receiveSetup(transport, version) {
|
|
34
47
|
const uniReader = transport.incomingUnidirectionalStreams.getReader();
|
|
@@ -36,13 +49,16 @@ async function receiveSetup(transport, version) {
|
|
|
36
49
|
uniReader.releaseLock();
|
|
37
50
|
if (next.done)
|
|
38
51
|
throw new Error("no incoming uni stream for SETUP");
|
|
39
|
-
const
|
|
40
|
-
const reader = new Reader(readable, undefined, version);
|
|
52
|
+
const reader = new Reader(next.value, undefined, version);
|
|
41
53
|
const streamType = await reader.u53();
|
|
42
54
|
if (streamType !== Ietf.Setup.id) {
|
|
43
55
|
throw new Error(`unexpected stream type on setup uni: 0x${streamType.toString(16)}`);
|
|
44
56
|
}
|
|
45
|
-
await Ietf.Setup.decode(reader, version);
|
|
46
|
-
return {
|
|
57
|
+
const setup = await Ietf.Setup.decode(reader, version);
|
|
58
|
+
return {
|
|
59
|
+
reader,
|
|
60
|
+
solicit: Ietf.solicitFromSetup(setup.parameters),
|
|
61
|
+
cluster: Ietf.Cluster.fromSetup(setup.parameters, version),
|
|
62
|
+
};
|
|
47
63
|
}
|
|
48
64
|
//# sourceMappingURL=handshake.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,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MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvD,OAAO;QACN,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;QAChD,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;KAC1D,CAAC;AACH,CAAC","sourcesContent":["import * as Ietf from \"../ietf/index.ts\";\nimport { type Origin, randomOrigin } from \"../origin.ts\";\nimport { Reader, Stream, Writer } from \"../stream.ts\";\n\n/**\n * Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup\n * message, and reads the peer's Setup off an incoming uni stream. The two\n * halves run in parallel and the protocol is symmetric, so both `connect`\n * (client) and `accept` (server) use this same function.\n *\n * Returns the control stream plus what the peer's SETUP declared: whether it requires\n * solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit\n * extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on\n * every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited\n * advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop\n * ID can withhold the advertisements that already flowed through us.\n */\nexport async function exchangeSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n\timplementation: string,\n): Promise<{ control: Stream; solicit: boolean | undefined; cluster: Ietf.Cluster.Hops }> {\n\tconst encoder = new TextEncoder();\n\tconst params = new Ietf.SetupOptions();\n\tparams.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));\n\tIetf.solicitIntoSetup(params);\n\n\t// One id per session, like the moq-lite connection: nothing in this process forwards\n\t// between sessions, so there is nothing for a shared id to detect.\n\tconst self = randomOrigin();\n\tIetf.Cluster.intoSetup(params, self, version);\n\n\tconst setupMsg = new Ietf.Setup({ parameters: params });\n\n\tconst [writer, received] = await Promise.all([\n\t\tsendSetup(transport, version, setupMsg),\n\t\treceiveSetup(transport, version),\n\t]);\n\n\treturn {\n\t\tcontrol: new Stream({ writer, reader: received.reader }),\n\t\tsolicit: received.solicit,\n\t\tcluster: { self, peer: received.cluster },\n\t};\n}\n\nasync function sendSetup(transport: WebTransport, version: Ietf.IetfVersion, setupMsg: Ietf.Setup): Promise<Writer> {\n\t// Via Writer.open for its deadline: a peer can advertise a stream limit of zero and\n\t// never raise it, which would otherwise hang the handshake rather than failing it.\n\tconst writer = await Writer.open(transport, { version });\n\tawait writer.u53(Ietf.Setup.id); // 0x2F00 stream type\n\tawait setupMsg.encode(writer, version);\n\treturn writer;\n}\n\nasync function receiveSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n): Promise<{ reader: Reader; solicit: boolean | undefined; cluster: Origin | undefined }> {\n\tconst uniReader = transport.incomingUnidirectionalStreams.getReader() as ReadableStreamDefaultReader<\n\t\tReadableStream<Uint8Array>\n\t>;\n\tconst next = await uniReader.read();\n\tuniReader.releaseLock();\n\tif (next.done) throw new Error(\"no incoming uni stream for SETUP\");\n\n\tconst reader = new Reader(next.value, undefined, version);\n\n\tconst streamType = await reader.u53();\n\tif (streamType !== Ietf.Setup.id) {\n\t\tthrow new Error(`unexpected stream type on setup uni: 0x${streamType.toString(16)}`);\n\t}\n\tconst setup = await Ietf.Setup.decode(reader, version);\n\n\treturn {\n\t\treader,\n\t\tsolicit: Ietf.solicitFromSetup(setup.parameters),\n\t\tcluster: Ietf.Cluster.fromSetup(setup.parameters, version),\n\t};\n}\n"]}
|
package/connection/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection helpers: connect to or accept a MoQ session and reconnect on failure.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
1
6
|
export * from "./accept";
|
|
7
|
+
export { isWebTransportSupported } from "./browser";
|
|
2
8
|
export * from "./connect";
|
|
3
9
|
export * from "./established";
|
|
4
10
|
export * from "./reload";
|
|
11
|
+
export type { Probe, Stats } from "./stats";
|
|
12
|
+
export type { Transport } from "./transport";
|
|
5
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/connection/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/* @ts-self-types="./index.d.ts" */
|
|
2
|
+
/**
|
|
3
|
+
* Connection helpers: connect to or accept a MoQ session and reconnect on failure.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
2
7
|
export * from "./accept.js";
|
|
8
|
+
export { isWebTransportSupported } from "./browser.js";
|
|
3
9
|
export * from "./connect.js";
|
|
4
10
|
export * from "./established.js";
|
|
5
11
|
export * from "./reload.js";
|
package/connection/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC","sourcesContent":["/**\n * Connection helpers: connect to or accept a MoQ session and reconnect on failure.\n *\n * @module\n */\nexport * from \"./accept.ts\";\nexport { isWebTransportSupported } from \"./browser.ts\";\nexport * from \"./connect.ts\";\nexport * from \"./established.ts\";\nexport * from \"./reload.ts\";\nexport type { Probe, Stats } from \"./stats.ts\";\nexport type { Transport } from \"./transport.ts\";\n"]}
|
package/connection/reload.d.ts
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Getter, Signal } from "@norskvideo/moq-signals";
|
|
2
|
+
import * as Announce from "../announced";
|
|
2
3
|
import type * as Path from "../path";
|
|
3
4
|
import { type ConnectProps, type WebSocketOptions, type WebTransportProps } from "./connect";
|
|
4
5
|
import type { Established } from "./established";
|
|
5
|
-
|
|
6
|
+
import type { Probe, Stats } from "./stats";
|
|
7
|
+
/**
|
|
8
|
+
* Exponential backoff settings for {@link Reload}'s reconnect loop.
|
|
9
|
+
*
|
|
10
|
+
* The delays carry jitter, so a fleet of tabs knocked offline together doesn't reconnect in
|
|
11
|
+
* lockstep. Every failure is retried; {@link ReloadDelay.timeout} is what stops the loop.
|
|
12
|
+
*/
|
|
6
13
|
export type ReloadDelay = {
|
|
14
|
+
/** The delay in milliseconds before reconnecting (default: 1000). */
|
|
7
15
|
initial: DOMHighResTimeStamp;
|
|
16
|
+
/** The multiplier for the delay (default: 2). */
|
|
8
17
|
multiplier: number;
|
|
18
|
+
/** The maximum delay in milliseconds (default: 5000). */
|
|
9
19
|
max: DOMHighResTimeStamp;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum total time in milliseconds to spend retrying before giving up (default:
|
|
22
|
+
* 10000). Resets after each successful connection. Set to 0 for unlimited retries.
|
|
23
|
+
*/
|
|
10
24
|
timeout?: DOMHighResTimeStamp;
|
|
11
25
|
};
|
|
12
|
-
/**
|
|
13
|
-
export type ReloadProps = ConnectProps & {
|
|
26
|
+
/** Connection and retry options for {@link Reload}. */
|
|
27
|
+
export type ReloadProps = Omit<ConnectProps, "signal"> & {
|
|
28
|
+
/** Whether to reload the connection when it disconnects (default: true). */
|
|
14
29
|
enabled?: boolean | Signal<boolean>;
|
|
30
|
+
/** The URL of the relay server. */
|
|
15
31
|
url?: URL | Signal<URL | undefined>;
|
|
32
|
+
/** Backoff settings for the reconnect loop. */
|
|
16
33
|
delay?: ReloadDelay;
|
|
17
34
|
};
|
|
18
35
|
/** Current state of a {@link Reload} connection. */
|
|
@@ -28,19 +45,59 @@ export declare class Reload {
|
|
|
28
45
|
status: Signal<ReloadStatus>;
|
|
29
46
|
/** The currently established session, or undefined while disconnected. */
|
|
30
47
|
established: Signal<Established | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The current connection's PROBE estimates, spanning reconnects.
|
|
50
|
+
*
|
|
51
|
+
* Undefined while disconnected: the estimates belong to a single connection.
|
|
52
|
+
* See {@link Established.probe}.
|
|
53
|
+
*/
|
|
54
|
+
readonly probe: Getter<Probe | undefined>;
|
|
33
55
|
/** WebTransport options applied to each connection attempt (not reactive). */
|
|
34
56
|
webtransport?: WebTransportProps;
|
|
35
57
|
/** WebSocket fallback options applied to each connection attempt (not reactive). */
|
|
36
58
|
websocket: WebSocketOptions | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the relay supports broadcast discovery, applied to each connection attempt (not
|
|
61
|
+
* reactive). Undefined defers to the default for the URL. See {@link Established.discovery}.
|
|
62
|
+
*/
|
|
63
|
+
discovery?: boolean;
|
|
37
64
|
/** Backoff settings for the reconnect loop. */
|
|
38
65
|
delay: ReloadDelay;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Resolves when the reconnect loop stops via {@link Reload.close}.
|
|
68
|
+
*
|
|
69
|
+
* Rejects when the loop gives up instead, carrying the failure that was in flight when the
|
|
70
|
+
* retry window expired.
|
|
71
|
+
*/
|
|
42
72
|
closed: Promise<void>;
|
|
43
73
|
constructor(props?: ReloadProps);
|
|
74
|
+
/**
|
|
75
|
+
* Subscribe to broadcast announcements under an optional prefix, spanning reconnects.
|
|
76
|
+
*
|
|
77
|
+
* The same {@link Announce.Consumer} stream as {@link Established.announced}, but everything active
|
|
78
|
+
* is retracted (an `active: false` update) whenever the connection drops and re-announced on
|
|
79
|
+
* reconnect, so a consumer draining `next()` never clings to a dead route across a reconnect.
|
|
80
|
+
*
|
|
81
|
+
* Stays empty while the relay lacks {@link Established.discovery}.
|
|
82
|
+
*/
|
|
83
|
+
announced(prefix?: Path.Valid): Announce.Consumer;
|
|
84
|
+
/**
|
|
85
|
+
* A reactive handle to one broadcast, spanning reconnects.
|
|
86
|
+
*
|
|
87
|
+
* The same {@link Announce.Broadcast} as {@link Established.announcedBroadcast}, but it
|
|
88
|
+
* follows the reconnect loop: the broadcast drops to `undefined` when the connection dies
|
|
89
|
+
* and resolves again once the new connection announces the path. Use it instead of
|
|
90
|
+
* consuming off {@link Reload.established} whenever the broadcast may come online after you
|
|
91
|
+
* do, which is exactly the case a blind `consume` loses.
|
|
92
|
+
*
|
|
93
|
+
* Close the handle when done; {@link Reload.close} only drops it to `undefined`.
|
|
94
|
+
*/
|
|
95
|
+
announcedBroadcast(path: Path.Valid): Announce.Broadcast;
|
|
96
|
+
/**
|
|
97
|
+
* Snapshot the live connection's transport counters, or undefined while disconnected.
|
|
98
|
+
* See {@link Established.stats}.
|
|
99
|
+
*/
|
|
100
|
+
stats(): Promise<Stats | undefined>;
|
|
44
101
|
/** Stop reconnecting, close the current connection, and resolve {@link Reload.closed}. */
|
|
45
102
|
close(): void;
|
|
46
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,KAAK,IAAI,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,KAAK,YAAY,EAAW,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,qEAAqE;IACrE,OAAO,EAAE,mBAAmB,CAAC;IAE7B,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IAEnB,yDAAyD;IACzD,GAAG,EAAE,mBAAmB,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IACxD,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAEpC,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAEpC,+CAA+C;IAC/C,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAUF,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAEvE,uFAAuF;AACvF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