@moq/net 0.1.4 → 0.1.5
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/announced.d.ts +4 -0
- package/announced.d.ts.map +1 -1
- package/announced.js +5 -0
- package/announced.js.map +1 -1
- package/bandwidth.js +1 -0
- package/broadcast.d.ts +5 -1
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +4 -0
- package/broadcast.js.map +1 -1
- package/connection/accept.d.ts +2 -1
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +1 -0
- package/connection/accept.js.map +1 -1
- package/connection/cert.test.js +1 -0
- package/connection/connect.d.ts +5 -1
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +5 -1
- package/connection/connect.js.map +1 -1
- package/connection/established.d.ts +13 -5
- package/connection/established.d.ts.map +1 -1
- package/connection/established.js +1 -0
- package/connection/established.js.map +1 -1
- package/connection/handshake.d.ts +2 -2
- package/connection/handshake.js +1 -0
- package/connection/index.d.ts +4 -4
- package/connection/index.js +1 -0
- package/connection/reload.d.ts +18 -3
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +13 -4
- package/connection/reload.js.map +1 -1
- package/group.d.ts +13 -0
- package/group.d.ts.map +1 -1
- package/group.js +14 -0
- package/group.js.map +1 -1
- package/ietf/adapter.d.ts +2 -2
- package/ietf/adapter.js +1 -0
- package/ietf/connection.d.ts +6 -6
- package/ietf/connection.js +1 -0
- package/ietf/control.d.ts +11 -11
- package/ietf/control.js +1 -0
- package/ietf/fetch.d.ts +3 -3
- package/ietf/fetch.js +1 -0
- package/ietf/goaway.d.ts +2 -2
- package/ietf/goaway.js +1 -0
- package/ietf/ietf.test.js +1 -0
- package/ietf/index.d.ts +17 -17
- package/ietf/index.js +1 -0
- package/ietf/message.d.ts +1 -1
- package/ietf/message.js +1 -0
- package/ietf/namespace.d.ts +2 -2
- package/ietf/namespace.js +1 -0
- package/ietf/object.d.ts +2 -2
- package/ietf/object.js +1 -0
- package/ietf/parameters.d.ts +2 -2
- package/ietf/parameters.js +1 -0
- package/ietf/properties.d.ts +2 -2
- package/ietf/properties.js +1 -0
- package/ietf/publish.d.ts +3 -3
- package/ietf/publish.js +1 -0
- package/ietf/publish_namespace.d.ts +3 -3
- package/ietf/publish_namespace.js +1 -0
- package/ietf/publisher.d.ts +7 -7
- package/ietf/publisher.js +1 -0
- package/ietf/request.d.ts +3 -3
- package/ietf/request.js +1 -0
- package/ietf/setup.d.ts +3 -3
- package/ietf/setup.js +1 -0
- package/ietf/subscribe.d.ts +3 -3
- package/ietf/subscribe.js +1 -0
- package/ietf/subscribe_namespace.d.ts +3 -3
- package/ietf/subscribe_namespace.js +1 -0
- package/ietf/subscriber.d.ts +8 -8
- package/ietf/subscriber.js +1 -0
- package/ietf/track.d.ts +3 -3
- package/ietf/track.js +1 -0
- package/ietf/version.js +1 -0
- package/index.d.ts +20 -9
- package/index.d.ts.map +1 -1
- package/index.js +7 -0
- package/index.js.map +1 -1
- package/integration.test.js +1 -0
- package/lite/announce.d.ts +4 -4
- package/lite/announce.js +1 -0
- package/lite/connection.d.ts +9 -9
- package/lite/connection.js +1 -0
- package/lite/fetch.d.ts +3 -3
- package/lite/fetch.js +1 -0
- package/lite/goaway.d.ts +2 -2
- package/lite/goaway.js +1 -0
- package/lite/group.d.ts +1 -1
- package/lite/group.js +1 -0
- package/lite/index.d.ts +10 -10
- package/lite/index.js +1 -0
- package/lite/message.d.ts +1 -1
- package/lite/message.js +1 -0
- package/lite/origin.js +1 -0
- package/lite/probe.d.ts +2 -2
- package/lite/probe.js +1 -0
- package/lite/publisher.d.ts +7 -7
- package/lite/publisher.js +1 -0
- package/lite/session.d.ts +2 -2
- package/lite/session.js +1 -0
- package/lite/stream.d.ts +5 -5
- package/lite/stream.js +1 -0
- package/lite/subscribe.d.ts +3 -3
- package/lite/subscribe.js +1 -0
- package/lite/subscriber.d.ts +9 -9
- package/lite/subscriber.js +1 -0
- package/lite/version.js +1 -0
- package/mock.js +1 -0
- package/package.json +2 -2
- package/path.d.ts +2 -0
- package/path.d.ts.map +1 -1
- package/path.js +3 -0
- package/path.js.map +1 -1
- package/path.test.js +1 -0
- package/stream.d.ts +1 -1
- package/stream.js +1 -0
- package/stream.test.js +1 -0
- package/time.d.ts +8 -0
- package/time.d.ts.map +1 -1
- package/time.js +5 -0
- package/time.js.map +1 -1
- package/track.d.ts +14 -1
- package/track.d.ts.map +1 -1
- package/track.js +14 -1
- package/track.js.map +1 -1
- package/track.test.js +1 -0
- package/util/error.js +1 -0
- package/util/hex.js +1 -0
- package/util/index.d.ts +1 -1
- package/util/index.js +1 -0
- package/varint.d.ts +8 -0
- package/varint.d.ts.map +1 -1
- package/varint.js +9 -0
- package/varint.js.map +1 -1
- package/varint.test.js +1 -0
- package/zod.d.ts +9 -2
- package/zod.d.ts.map +1 -1
- package/zod.js +8 -1
- package/zod.js.map +1 -1
package/connection/reload.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
/* @ts-self-types="./reload.d.ts" */
|
|
1
2
|
import { Effect, Signal } from "@moq/signals";
|
|
2
3
|
import { empty as emptyPath } from "../path.js";
|
|
3
4
|
import { connect } from "./connect.js";
|
|
5
|
+
/** Maintains a MoQ connection, reconnecting with exponential backoff when it drops. */
|
|
4
6
|
export class Reload {
|
|
7
|
+
/** Relay URL to connect to; updating it triggers a reconnect. */
|
|
5
8
|
url;
|
|
9
|
+
/** Whether reconnecting is active. */
|
|
6
10
|
enabled;
|
|
11
|
+
/** Current connection status. */
|
|
7
12
|
status = new Signal("disconnected");
|
|
13
|
+
/** The currently established session, or undefined while disconnected. */
|
|
8
14
|
established = new Signal(undefined);
|
|
9
15
|
// All actively announced broadcast paths, updated reactively.
|
|
10
16
|
#announced = new Signal(new Set());
|
|
17
|
+
/** The set of broadcast paths currently announced by the server, updated reactively. */
|
|
11
18
|
announced = this.#announced;
|
|
12
|
-
|
|
19
|
+
/** WebTransport options applied to each connection attempt (not reactive). */
|
|
13
20
|
webtransport;
|
|
14
|
-
|
|
21
|
+
/** WebSocket fallback options applied to each connection attempt (not reactive). */
|
|
15
22
|
websocket;
|
|
16
|
-
|
|
23
|
+
/** Backoff settings for the reconnect loop. */
|
|
17
24
|
delay;
|
|
25
|
+
/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */
|
|
18
26
|
signals = new Effect();
|
|
19
|
-
|
|
27
|
+
/** Resolves when the reconnect loop stops via {@link Reload.close} or the retry timeout. */
|
|
20
28
|
closed;
|
|
21
29
|
#closedResolve;
|
|
22
30
|
#closedReject;
|
|
@@ -120,6 +128,7 @@ export class Reload {
|
|
|
120
128
|
}
|
|
121
129
|
});
|
|
122
130
|
}
|
|
131
|
+
/** Stop reconnecting, close the current connection, and resolve {@link Reload.closed}. */
|
|
123
132
|
close() {
|
|
124
133
|
this.signals.close();
|
|
125
134
|
this.#closedResolve();
|
package/connection/reload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAqB,OAAO,EAAiD,MAAM,cAAc,CAAC;AAoCzG,MAAM,OAAO,MAAM;IAClB,GAAG,CAA0B;IAC7B,OAAO,CAAkB;IAEzB,MAAM,GAAG,IAAI,MAAM,CAAe,cAAc,CAAC,CAAC;IAClD,WAAW,GAAG,IAAI,MAAM,CAA0B,SAAS,CAAC,CAAC;IAE7D,8DAA8D;IAC9D,UAAU,GAAG,IAAI,MAAM,CAAkB,IAAI,GAAG,EAAE,CAAC,CAAC;IAC3C,SAAS,GAA4B,IAAI,CAAC,UAAU,CAAC;IAE9D,uCAAuC;IACvC,YAAY,CAAqB;IAEjC,+CAA+C;IAC/C,SAAS,CAA+B;IAExC,oCAAoC;IACpC,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BACF,CAAC,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;gBAC/B,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { Effect, type Getter, Signal } from \"@moq/signals\";\nimport type * as Path from \"../path.ts\";\nimport { empty as emptyPath } from \"../path.ts\";\nimport { type ConnectProps, connect, type WebSocketOptions, type WebTransportProps } from \"./connect.ts\";\nimport type { Established } from \"./established.ts\";\n\nexport type ReloadDelay = {\n\t// The delay in milliseconds before reconnecting.\n\t// default: 1000\n\tinitial: DOMHighResTimeStamp;\n\n\t// The multiplier for the delay.\n\t// default: 2\n\tmultiplier: number;\n\n\t// The maximum delay in milliseconds.\n\t// default: 30000\n\tmax: DOMHighResTimeStamp;\n\n\t// Maximum total time in milliseconds to spend retrying before giving up.\n\t// Resets after each successful connection. Set to 0 for unlimited retries.\n\t// default: 300000 (5 minutes)\n\ttimeout?: DOMHighResTimeStamp;\n};\n\nexport type ReloadProps = ConnectProps & {\n\t// Whether to reload the connection when it disconnects.\n\t// default: true\n\tenabled?: boolean | Signal<boolean>;\n\n\t// The URL of the relay server.\n\turl?: URL | Signal<URL | undefined>;\n\n\t// The delay for the reload.\n\tdelay?: ReloadDelay;\n};\n\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\nexport class Reload {\n\turl: Signal<URL | undefined>;\n\tenabled: Signal<boolean>;\n\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\testablished = new Signal<Established | undefined>(undefined);\n\n\t// All actively announced broadcast paths, updated reactively.\n\t#announced = new Signal<Set<Path.Valid>>(new Set());\n\treadonly announced: Getter<Set<Path.Valid>> = this.#announced;\n\n\t// WebTransport options (not reactive).\n\twebtransport?: WebTransportProps;\n\n\t// WebSocket (fallback) options (not reactive).\n\twebsocket: WebSocketOptions | undefined;\n\n\t// Not reactive, but can be updated.\n\tdelay: ReloadDelay;\n\n\tsignals = new Effect();\n\n\t// Resolves when the reconnect loop stops (close() or timeout).\n\tclosed: Promise<void>;\n\t#closedResolve!: () => void;\n\t#closedReject!: (err: Error) => void;\n\n\t#delay: DOMHighResTimeStamp;\n\n\t// Timestamp when the current retry sequence started (for timeout).\n\t#retryStart: DOMHighResTimeStamp | undefined;\n\n\t// Increased by 1 each time to trigger a reload.\n\t#tick = new Signal(0);\n\n\tconstructor(props?: ReloadProps) {\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? false);\n\t\tthis.delay = props?.delay ?? { initial: 1000, multiplier: 2, max: 30000 };\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\n\t\tthis.#delay = this.delay.initial;\n\n\t\tthis.closed = new Promise((resolve, reject) => {\n\t\t\tthis.#closedResolve = resolve;\n\t\t\tthis.#closedReject = reject;\n\t\t});\n\n\t\t// Create a reactive root so cleanup is easier.\n\t\tthis.signals.run(this.#connect.bind(this));\n\t\tthis.signals.run(this.#runAnnounced.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) return;\n\n\t\tconst url = effect.get(this.url);\n\t\tif (!url) return;\n\n\t\teffect.set(this.status, \"connecting\", \"disconnected\");\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tconst pending = connect(url, { websocket: this.websocket, webtransport: this.webtransport });\n\n\t\t\t\tconst connection = await Promise.race([effect.cancel, pending]);\n\t\t\t\tif (!connection) {\n\t\t\t\t\tpending.then((conn) => conn.close()).catch(() => {});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\teffect.set(this.established, connection);\n\t\t\t\teffect.cleanup(() => connection.close());\n\n\t\t\t\teffect.set(this.status, \"connected\", \"disconnected\");\n\n\t\t\t\t// Reset the exponential backoff and timeout on success.\n\t\t\t\tthis.#delay = this.delay.initial;\n\t\t\t\tthis.#retryStart = undefined;\n\n\t\t\t\tawait Promise.race([effect.cancel, connection.closed]);\n\t\t\t} catch (err) {\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\n\t\t\t\t// Track retry start for timeout.\n\t\t\t\tthis.#retryStart ??= performance.now();\n\n\t\t\t\tconst timeout = this.delay.timeout ?? 300000;\n\t\t\t\tif (timeout > 0) {\n\t\t\t\t\tconst elapsed = performance.now() - this.#retryStart;\n\t\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\t\t\t\tthis.#closedReject(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst tick = this.#tick.peek() + 1;\n\t\t\t\teffect.timer(() => this.#tick.update((prev) => Math.max(prev, tick)), this.#delay);\n\n\t\t\t\tthis.#delay = Math.min(this.#delay * this.delay.multiplier, this.delay.max);\n\t\t\t}\n\t\t});\n\t}\n\n\t#runAnnounced(effect: Effect): void {\n\t\tthis.#announced.set(new Set());\n\n\t\tconst conn = effect.get(this.established);\n\t\tif (!conn) return;\n\n\t\teffect.cleanup(() => this.#announced.set(new Set()));\n\n\t\t// Cloudflare's relay does not yet support SUBSCRIBE_NAMESPACE, so\n\t\t// skip announce subscriptions entirely for those hosts.\n\t\tif (conn.url.hostname.endsWith(\"mediaoverquic.com\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst announced = conn.announced(emptyPath());\n\t\teffect.cleanup(() => announced.close());\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst entry = await Promise.race([effect.cancel, announced.next()]);\n\t\t\t\t\tif (!entry) break;\n\n\t\t\t\t\tthis.#announced.mutate((active) => {\n\t\t\t\t\t\tif (entry.active) {\n\t\t\t\t\t\t\tactive.add(entry.path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactive.delete(entry.path);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tthis.#announced.set(new Set());\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\tclose() {\n\t\tthis.signals.close();\n\t\tthis.#closedResolve();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAqB,OAAO,EAAiD,MAAM,cAAc,CAAC;AAuCzG,uFAAuF;AACvF,MAAM,OAAO,MAAM;IAClB,iEAAiE;IACjE,GAAG,CAA0B;IAE7B,sCAAsC;IACtC,OAAO,CAAkB;IAEzB,iCAAiC;IACjC,MAAM,GAAG,IAAI,MAAM,CAAe,cAAc,CAAC,CAAC;IAElD,0EAA0E;IAC1E,WAAW,GAAG,IAAI,MAAM,CAA0B,SAAS,CAAC,CAAC;IAE7D,8DAA8D;IAC9D,UAAU,GAAG,IAAI,MAAM,CAAkB,IAAI,GAAG,EAAE,CAAC,CAAC;IAEpD,wFAAwF;IAC/E,SAAS,GAA4B,IAAI,CAAC,UAAU,CAAC;IAE9D,8EAA8E;IAC9E,YAAY,CAAqB;IAEjC,oFAAoF;IACpF,SAAS,CAA+B;IAExC,+CAA+C;IAC/C,KAAK,CAAc;IAEnB,0FAA0F;IAC1F,OAAO,GAAG,IAAI,MAAM,EAAE,CAAC;IAEvB,4FAA4F;IAC5F,MAAM,CAAgB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AAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;gBAC/B,MAAM,GAAG,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,0FAA0F;IAC1F,KAAK;QACJ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { Effect, type Getter, Signal } from \"@moq/signals\";\nimport type * as Path from \"../path.ts\";\nimport { empty as emptyPath } from \"../path.ts\";\nimport { type ConnectProps, connect, type WebSocketOptions, type WebTransportProps } from \"./connect.ts\";\nimport type { Established } from \"./established.ts\";\n\n/** Exponential backoff settings for {@link Reload}'s reconnect loop. */\nexport type ReloadDelay = {\n\t// The delay in milliseconds before reconnecting.\n\t// default: 1000\n\tinitial: DOMHighResTimeStamp;\n\n\t// The multiplier for the delay.\n\t// default: 2\n\tmultiplier: number;\n\n\t// The maximum delay in milliseconds.\n\t// default: 30000\n\tmax: DOMHighResTimeStamp;\n\n\t// Maximum total time in milliseconds to spend retrying before giving up.\n\t// Resets after each successful connection. Set to 0 for unlimited retries.\n\t// default: 300000 (5 minutes)\n\ttimeout?: DOMHighResTimeStamp;\n};\n\n/** Options for {@link Reload}: connect options plus reactive URL/enabled signals and backoff tuning. */\nexport type ReloadProps = ConnectProps & {\n\t// Whether to reload the connection when it disconnects.\n\t// default: true\n\tenabled?: boolean | Signal<boolean>;\n\n\t// The URL of the relay server.\n\turl?: URL | Signal<URL | undefined>;\n\n\t// The delay for the reload.\n\tdelay?: ReloadDelay;\n};\n\n/** Current state of a {@link Reload} connection. */\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\n/** Maintains a MoQ connection, reconnecting with exponential backoff when it drops. */\nexport class Reload {\n\t/** Relay URL to connect to; updating it triggers a reconnect. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether reconnecting is active. */\n\tenabled: Signal<boolean>;\n\n\t/** Current connection status. */\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\n\t/** The currently established session, or undefined while disconnected. */\n\testablished = new Signal<Established | undefined>(undefined);\n\n\t// All actively announced broadcast paths, updated reactively.\n\t#announced = new Signal<Set<Path.Valid>>(new Set());\n\n\t/** The set of broadcast paths currently announced by the server, updated reactively. */\n\treadonly announced: Getter<Set<Path.Valid>> = this.#announced;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportProps;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket: WebSocketOptions | undefined;\n\n\t/** Backoff settings for the reconnect loop. */\n\tdelay: ReloadDelay;\n\n\t/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */\n\tsignals = new Effect();\n\n\t/** Resolves when the reconnect loop stops via {@link Reload.close} or the retry timeout. */\n\tclosed: Promise<void>;\n\t#closedResolve!: () => void;\n\t#closedReject!: (err: Error) => void;\n\n\t#delay: DOMHighResTimeStamp;\n\n\t// Timestamp when the current retry sequence started (for timeout).\n\t#retryStart: DOMHighResTimeStamp | undefined;\n\n\t// Increased by 1 each time to trigger a reload.\n\t#tick = new Signal(0);\n\n\tconstructor(props?: ReloadProps) {\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? false);\n\t\tthis.delay = props?.delay ?? { initial: 1000, multiplier: 2, max: 30000 };\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\n\t\tthis.#delay = this.delay.initial;\n\n\t\tthis.closed = new Promise((resolve, reject) => {\n\t\t\tthis.#closedResolve = resolve;\n\t\t\tthis.#closedReject = reject;\n\t\t});\n\n\t\t// Create a reactive root so cleanup is easier.\n\t\tthis.signals.run(this.#connect.bind(this));\n\t\tthis.signals.run(this.#runAnnounced.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) return;\n\n\t\tconst url = effect.get(this.url);\n\t\tif (!url) return;\n\n\t\teffect.set(this.status, \"connecting\", \"disconnected\");\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tconst pending = connect(url, { websocket: this.websocket, webtransport: this.webtransport });\n\n\t\t\t\tconst connection = await Promise.race([effect.cancel, pending]);\n\t\t\t\tif (!connection) {\n\t\t\t\t\tpending.then((conn) => conn.close()).catch(() => {});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\teffect.set(this.established, connection);\n\t\t\t\teffect.cleanup(() => connection.close());\n\n\t\t\t\teffect.set(this.status, \"connected\", \"disconnected\");\n\n\t\t\t\t// Reset the exponential backoff and timeout on success.\n\t\t\t\tthis.#delay = this.delay.initial;\n\t\t\t\tthis.#retryStart = undefined;\n\n\t\t\t\tawait Promise.race([effect.cancel, connection.closed]);\n\t\t\t} catch (err) {\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\n\t\t\t\t// Track retry start for timeout.\n\t\t\t\tthis.#retryStart ??= performance.now();\n\n\t\t\t\tconst timeout = this.delay.timeout ?? 300000;\n\t\t\t\tif (timeout > 0) {\n\t\t\t\t\tconst elapsed = performance.now() - this.#retryStart;\n\t\t\t\t\tif (elapsed >= timeout) {\n\t\t\t\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\t\t\t\tthis.#closedReject(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst tick = this.#tick.peek() + 1;\n\t\t\t\teffect.timer(() => this.#tick.update((prev) => Math.max(prev, tick)), this.#delay);\n\n\t\t\t\tthis.#delay = Math.min(this.#delay * this.delay.multiplier, this.delay.max);\n\t\t\t}\n\t\t});\n\t}\n\n\t#runAnnounced(effect: Effect): void {\n\t\tthis.#announced.set(new Set());\n\n\t\tconst conn = effect.get(this.established);\n\t\tif (!conn) return;\n\n\t\teffect.cleanup(() => this.#announced.set(new Set()));\n\n\t\t// Cloudflare's relay does not yet support SUBSCRIBE_NAMESPACE, so\n\t\t// skip announce subscriptions entirely for those hosts.\n\t\tif (conn.url.hostname.endsWith(\"mediaoverquic.com\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst announced = conn.announced(emptyPath());\n\t\teffect.cleanup(() => announced.close());\n\n\t\teffect.spawn(async () => {\n\t\t\ttry {\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst entry = await Promise.race([effect.cancel, announced.next()]);\n\t\t\t\t\tif (!entry) break;\n\n\t\t\t\t\tthis.#announced.mutate((active) => {\n\t\t\t\t\t\tif (entry.active) {\n\t\t\t\t\t\t\tactive.add(entry.path);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactive.delete(entry.path);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tthis.#announced.set(new Set());\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Stop reconnecting, close the current connection, and resolve {@link Reload.closed}. */\n\tclose() {\n\t\tthis.signals.close();\n\t\tthis.#closedResolve();\n\t}\n}\n"]}
|
package/group.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Signal } from "@moq/signals";
|
|
2
|
+
/** Reactive backing state for a {@link Group}: buffered frames, a closed flag, and the running frame count. */
|
|
2
3
|
export declare class GroupState {
|
|
3
4
|
frames: Signal<Uint8Array<ArrayBufferLike>[]>;
|
|
4
5
|
closed: Signal<boolean | Error>;
|
|
5
6
|
total: Signal<number>;
|
|
6
7
|
}
|
|
8
|
+
/** An ordered stream of frames within a track, delivered over a single QUIC stream. */
|
|
7
9
|
export declare class Group {
|
|
10
|
+
/** Sequence number of this group within its track. */
|
|
8
11
|
readonly sequence: number;
|
|
12
|
+
/** Reactive backing state. */
|
|
9
13
|
state: GroupState;
|
|
14
|
+
/** Resolves with the abort error (or undefined) once closed. */
|
|
10
15
|
readonly closed: Promise<Error | undefined>;
|
|
11
16
|
constructor(sequence: number);
|
|
12
17
|
/**
|
|
@@ -14,21 +19,29 @@ export declare class Group {
|
|
|
14
19
|
* @param frame - The frame to write
|
|
15
20
|
*/
|
|
16
21
|
writeFrame(frame: Uint8Array): void;
|
|
22
|
+
/** Write a string as a single UTF-8 encoded frame. */
|
|
17
23
|
writeString(str: string): void;
|
|
24
|
+
/** Write a value as a single JSON-encoded frame. */
|
|
18
25
|
writeJson(json: unknown): void;
|
|
26
|
+
/** Write a boolean as a single one-byte frame. */
|
|
19
27
|
writeBool(bool: boolean): void;
|
|
20
28
|
/**
|
|
21
29
|
* Reads the next frame from the group.
|
|
22
30
|
* @returns A promise that resolves to the next frame or undefined
|
|
23
31
|
*/
|
|
24
32
|
readFrame(): Promise<Uint8Array | undefined>;
|
|
33
|
+
/** Reads the next frame along with its sequence number within the group. */
|
|
25
34
|
readFrameSequence(): Promise<{
|
|
26
35
|
sequence: number;
|
|
27
36
|
data: Uint8Array;
|
|
28
37
|
} | undefined>;
|
|
38
|
+
/** Reads the next frame and decodes it as a UTF-8 string. */
|
|
29
39
|
readString(): Promise<string | undefined>;
|
|
40
|
+
/** Reads the next frame and parses it as JSON. */
|
|
30
41
|
readJson(): Promise<unknown | undefined>;
|
|
42
|
+
/** Reads the next frame and decodes it as a one-byte boolean. */
|
|
31
43
|
readBool(): Promise<boolean | undefined>;
|
|
44
|
+
/** Closes the group, optionally with an error to abort readers. */
|
|
32
45
|
close(abort?: Error): void;
|
|
33
46
|
}
|
|
34
47
|
//# sourceMappingURL=group.d.ts.map
|
package/group.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,qBAAa,UAAU;IACtB,MAAM,wCAAgC;IACtC,MAAM,0BAAsC;IAC5C,KAAK,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C,EAAE,KAAK;CAGnB"}
|
package/group.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
/* @ts-self-types="./group.d.ts" */
|
|
1
2
|
import { Signal } from "@moq/signals";
|
|
3
|
+
/** Reactive backing state for a {@link Group}: buffered frames, a closed flag, and the running frame count. */
|
|
2
4
|
export class GroupState {
|
|
3
5
|
frames = new Signal([]);
|
|
4
6
|
closed = new Signal(false);
|
|
5
7
|
total = new Signal(0); // The total number of frames in the group thus far
|
|
6
8
|
}
|
|
9
|
+
/** An ordered stream of frames within a track, delivered over a single QUIC stream. */
|
|
7
10
|
export class Group {
|
|
11
|
+
/** Sequence number of this group within its track. */
|
|
8
12
|
sequence;
|
|
13
|
+
/** Reactive backing state. */
|
|
9
14
|
state = new GroupState();
|
|
15
|
+
/** Resolves with the abort error (or undefined) once closed. */
|
|
10
16
|
closed;
|
|
11
17
|
constructor(sequence) {
|
|
12
18
|
this.sequence = sequence;
|
|
@@ -32,12 +38,15 @@ export class Group {
|
|
|
32
38
|
});
|
|
33
39
|
this.state.total.update((total) => total + 1);
|
|
34
40
|
}
|
|
41
|
+
/** Write a string as a single UTF-8 encoded frame. */
|
|
35
42
|
writeString(str) {
|
|
36
43
|
this.writeFrame(new TextEncoder().encode(str));
|
|
37
44
|
}
|
|
45
|
+
/** Write a value as a single JSON-encoded frame. */
|
|
38
46
|
writeJson(json) {
|
|
39
47
|
this.writeString(JSON.stringify(json));
|
|
40
48
|
}
|
|
49
|
+
/** Write a boolean as a single one-byte frame. */
|
|
41
50
|
writeBool(bool) {
|
|
42
51
|
this.writeFrame(new Uint8Array([bool ? 1 : 0]));
|
|
43
52
|
}
|
|
@@ -59,6 +68,7 @@ export class Group {
|
|
|
59
68
|
await Signal.race(this.state.frames, this.state.closed);
|
|
60
69
|
}
|
|
61
70
|
}
|
|
71
|
+
/** Reads the next frame along with its sequence number within the group. */
|
|
62
72
|
async readFrameSequence() {
|
|
63
73
|
for (;;) {
|
|
64
74
|
const frames = this.state.frames.peek();
|
|
@@ -73,18 +83,22 @@ export class Group {
|
|
|
73
83
|
await Signal.race(this.state.frames, this.state.closed);
|
|
74
84
|
}
|
|
75
85
|
}
|
|
86
|
+
/** Reads the next frame and decodes it as a UTF-8 string. */
|
|
76
87
|
async readString() {
|
|
77
88
|
const frame = await this.readFrame();
|
|
78
89
|
return frame ? new TextDecoder().decode(frame) : undefined;
|
|
79
90
|
}
|
|
91
|
+
/** Reads the next frame and parses it as JSON. */
|
|
80
92
|
async readJson() {
|
|
81
93
|
const frame = await this.readString();
|
|
82
94
|
return frame ? JSON.parse(frame) : undefined;
|
|
83
95
|
}
|
|
96
|
+
/** Reads the next frame and decodes it as a one-byte boolean. */
|
|
84
97
|
async readBool() {
|
|
85
98
|
const frame = await this.readFrame();
|
|
86
99
|
return frame ? frame[0] === 1 : undefined;
|
|
87
100
|
}
|
|
101
|
+
/** Closes the group, optionally with an error to abort readers. */
|
|
88
102
|
close(abort) {
|
|
89
103
|
this.state.closed.set(abort ?? true);
|
|
90
104
|
}
|
package/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,OAAO,UAAU;IACtB,MAAM,GAAG,IAAI,MAAM,CAAe,EAAE,CAAC,CAAC;IACtC,MAAM,GAAG,IAAI,MAAM,CAAkB,KAAK,CAAC,CAAC;IAC5C,KAAK,GAAG,IAAI,MAAM,CAAS,CAAC,CAAC,CAAC,CAAC,mDAAmD;CAClF;AAED,MAAM,OAAO,KAAK;
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../src/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,+GAA+G;AAC/G,MAAM,OAAO,UAAU;IACtB,MAAM,GAAG,IAAI,MAAM,CAAe,EAAE,CA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link Group}: buffered frames, a closed flag, and the running frame count. */\nexport class GroupState {\n\tframes = new Signal<Uint8Array[]>([]);\n\tclosed = new Signal<boolean | Error>(false);\n\ttotal = new Signal<number>(0); // The total number of frames in the group thus far\n}\n\n/** An ordered stream of frames within a track, delivered over a single QUIC stream. */\nexport class Group {\n\t/** Sequence number of this group within its track. */\n\treadonly sequence: number;\n\n\t/** Reactive backing state. */\n\tstate = new GroupState();\n\n\t/** Resolves with the abort error (or undefined) once closed. */\n\treadonly closed: Promise<Error | undefined>;\n\n\tconstructor(sequence: number) {\n\t\tthis.sequence = sequence;\n\n\t\t// Cache the closed promise to avoid recreating it every time.\n\t\tthis.closed = new Promise((resolve) => {\n\t\t\tconst dispose = this.state.closed.subscribe((closed) => {\n\t\t\t\tif (!closed) return;\n\t\t\t\tresolve(closed instanceof Error ? closed : undefined);\n\t\t\t\tdispose();\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Writes a frame to the group.\n\t * @param frame - The frame to write\n\t */\n\twriteFrame(frame: Uint8Array) {\n\t\tif (this.state.closed.peek()) throw new Error(\"group is closed\");\n\n\t\tthis.state.frames.mutate((frames) => {\n\t\t\tframes.push(frame);\n\t\t});\n\n\t\tthis.state.total.update((total) => total + 1);\n\t}\n\n\t/** Write a string as a single UTF-8 encoded frame. */\n\twriteString(str: string) {\n\t\tthis.writeFrame(new TextEncoder().encode(str));\n\t}\n\n\t/** Write a value as a single JSON-encoded frame. */\n\twriteJson(json: unknown) {\n\t\tthis.writeString(JSON.stringify(json));\n\t}\n\n\t/** Write a boolean as a single one-byte frame. */\n\twriteBool(bool: boolean) {\n\t\tthis.writeFrame(new Uint8Array([bool ? 1 : 0]));\n\t}\n\n\t/**\n\t * Reads the next frame from the group.\n\t * @returns A promise that resolves to the next frame or undefined\n\t */\n\tasync readFrame(): Promise<Uint8Array | undefined> {\n\t\tfor (;;) {\n\t\t\tconst frames = this.state.frames.peek();\n\t\t\tconst frame = frames.shift();\n\t\t\tif (frame) return frame;\n\n\t\t\tconst closed = this.state.closed.peek();\n\t\t\tif (closed instanceof Error) throw closed;\n\t\t\tif (closed) return;\n\n\t\t\tawait Signal.race(this.state.frames, this.state.closed);\n\t\t}\n\t}\n\n\t/** Reads the next frame along with its sequence number within the group. */\n\tasync readFrameSequence(): Promise<{ sequence: number; data: Uint8Array } | undefined> {\n\t\tfor (;;) {\n\t\t\tconst frames = this.state.frames.peek();\n\t\t\tconst frame = frames.shift();\n\t\t\tif (frame) return { sequence: this.state.total.peek() - frames.length - 1, data: frame };\n\n\t\t\tconst closed = this.state.closed.peek();\n\t\t\tif (closed instanceof Error) throw closed;\n\t\t\tif (closed) return;\n\n\t\t\tawait Signal.race(this.state.frames, this.state.closed);\n\t\t}\n\t}\n\n\t/** Reads the next frame and decodes it as a UTF-8 string. */\n\tasync readString(): Promise<string | undefined> {\n\t\tconst frame = await this.readFrame();\n\t\treturn frame ? new TextDecoder().decode(frame) : undefined;\n\t}\n\n\t/** Reads the next frame and parses it as JSON. */\n\tasync readJson(): Promise<unknown | undefined> {\n\t\tconst frame = await this.readString();\n\t\treturn frame ? JSON.parse(frame) : undefined;\n\t}\n\n\t/** Reads the next frame and decodes it as a one-byte boolean. */\n\tasync readBool(): Promise<boolean | undefined> {\n\t\tconst frame = await this.readFrame();\n\t\treturn frame ? frame[0] === 1 : undefined;\n\t}\n\n\t/** Closes the group, optionally with an error to abort readers. */\n\tclose(abort?: Error) {\n\t\tthis.state.closed.set(abort ?? true);\n\t}\n}\n"]}
|
package/ietf/adapter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Stream } from "../stream
|
|
2
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import { Stream } from "../stream";
|
|
2
|
+
import { type IetfVersion } from "./version";
|
|
3
3
|
/**
|
|
4
4
|
* Interface for opening outgoing bidi streams and allocating request IDs.
|
|
5
5
|
* Implemented by both ControlStreamAdapter (v14-v16) and NativeSession (v17).
|
package/ietf/adapter.js
CHANGED
package/ietf/connection.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Announced } from "../announced
|
|
2
|
-
import type { Broadcast } from "../broadcast
|
|
3
|
-
import type { Established } from "../connection/established
|
|
4
|
-
import * as Path from "../path
|
|
5
|
-
import { type Stream } from "../stream
|
|
6
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Announced } from "../announced";
|
|
2
|
+
import type { Broadcast } from "../broadcast";
|
|
3
|
+
import type { Established } from "../connection/established";
|
|
4
|
+
import * as Path from "../path";
|
|
5
|
+
import { type Stream } from "../stream";
|
|
6
|
+
import { type IetfVersion } from "./version";
|
|
7
7
|
/**
|
|
8
8
|
* Represents a connection to a MoQ server using moq-transport protocol.
|
|
9
9
|
*
|
package/ietf/connection.js
CHANGED
package/ietf/control.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Stream as StreamInner } from "../stream
|
|
2
|
-
import { Fetch, FetchCancel, FetchError, FetchOk } from "./fetch
|
|
3
|
-
import { GoAway } from "./goaway
|
|
4
|
-
import { Publish, PublishDone, PublishError, PublishOk } from "./publish
|
|
5
|
-
import { PublishNamespace, PublishNamespaceCancel, PublishNamespaceDone, PublishNamespaceError, PublishNamespaceOk } from "./publish_namespace
|
|
6
|
-
import { MaxRequestId, RequestError, RequestOk, RequestsBlocked } from "./request
|
|
7
|
-
import * as Setup from "./setup
|
|
8
|
-
import { Subscribe, SubscribeError, SubscribeOk, SubscribeUpdate, Unsubscribe } from "./subscribe
|
|
9
|
-
import { SubscribeNamespaceError, SubscribeNamespaceLegacy, SubscribeNamespaceOk, UnsubscribeNamespace } from "./subscribe_namespace
|
|
10
|
-
import { TrackStatus, TrackStatusRequest } from "./track
|
|
11
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Stream as StreamInner } from "../stream";
|
|
2
|
+
import { Fetch, FetchCancel, FetchError, FetchOk } from "./fetch";
|
|
3
|
+
import { GoAway } from "./goaway";
|
|
4
|
+
import { Publish, PublishDone, PublishError, PublishOk } from "./publish";
|
|
5
|
+
import { PublishNamespace, PublishNamespaceCancel, PublishNamespaceDone, PublishNamespaceError, PublishNamespaceOk } from "./publish_namespace";
|
|
6
|
+
import { MaxRequestId, RequestError, RequestOk, RequestsBlocked } from "./request";
|
|
7
|
+
import * as Setup from "./setup";
|
|
8
|
+
import { Subscribe, SubscribeError, SubscribeOk, SubscribeUpdate, Unsubscribe } from "./subscribe";
|
|
9
|
+
import { SubscribeNamespaceError, SubscribeNamespaceLegacy, SubscribeNamespaceOk, UnsubscribeNamespace } from "./subscribe_namespace";
|
|
10
|
+
import { TrackStatus, TrackStatusRequest } from "./track";
|
|
11
|
+
import { type IetfVersion } from "./version";
|
|
12
12
|
declare const MessagesV14: {
|
|
13
13
|
readonly [Setup.ClientSetup.id]: typeof Setup.ClientSetup;
|
|
14
14
|
readonly [Setup.ServerSetup.id]: typeof Setup.ServerSetup;
|
package/ietf/control.js
CHANGED
package/ietf/fetch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
3
|
-
import type { IetfVersion } from "./version
|
|
1
|
+
import type * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import type { IetfVersion } from "./version";
|
|
4
4
|
export declare class Fetch {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/fetch.js
CHANGED
package/ietf/goaway.d.ts
CHANGED
package/ietf/goaway.js
CHANGED
package/ietf/ietf.test.js
CHANGED
package/ietf/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export * from "./adapter
|
|
2
|
-
export * from "./connection
|
|
3
|
-
export * from "./control
|
|
4
|
-
export * from "./fetch
|
|
5
|
-
export * from "./goaway
|
|
6
|
-
export * from "./object
|
|
7
|
-
export * from "./parameters
|
|
8
|
-
export * from "./publish
|
|
9
|
-
export * from "./publish_namespace
|
|
10
|
-
export * from "./publisher
|
|
11
|
-
export * from "./request
|
|
12
|
-
export * from "./setup
|
|
13
|
-
export * from "./subscribe
|
|
14
|
-
export * from "./subscribe_namespace
|
|
15
|
-
export * from "./subscriber
|
|
16
|
-
export * from "./track
|
|
17
|
-
export * from "./version
|
|
1
|
+
export * from "./adapter";
|
|
2
|
+
export * from "./connection";
|
|
3
|
+
export * from "./control";
|
|
4
|
+
export * from "./fetch";
|
|
5
|
+
export * from "./goaway";
|
|
6
|
+
export * from "./object";
|
|
7
|
+
export * from "./parameters";
|
|
8
|
+
export * from "./publish";
|
|
9
|
+
export * from "./publish_namespace";
|
|
10
|
+
export * from "./publisher";
|
|
11
|
+
export * from "./request";
|
|
12
|
+
export * from "./setup";
|
|
13
|
+
export * from "./subscribe";
|
|
14
|
+
export * from "./subscribe_namespace";
|
|
15
|
+
export * from "./subscriber";
|
|
16
|
+
export * from "./track";
|
|
17
|
+
export * from "./version";
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/ietf/index.js
CHANGED
package/ietf/message.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Reader, Writer } from "../stream
|
|
1
|
+
import { Reader, Writer } from "../stream";
|
|
2
2
|
export declare function encode(writer: Writer, f: (w: Writer) => Promise<void>): Promise<void>;
|
|
3
3
|
export declare function decode<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T>;
|
|
4
4
|
//# sourceMappingURL=message.d.ts.map
|
package/ietf/message.js
CHANGED
package/ietf/namespace.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
1
|
+
import * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
3
|
export declare function encode(w: Writer, namespace: Path.Valid): Promise<void>;
|
|
4
4
|
export declare function decode(r: Reader): Promise<Path.Valid>;
|
|
5
5
|
//# sourceMappingURL=namespace.d.ts.map
|
package/ietf/namespace.js
CHANGED
package/ietf/object.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Reader, Writer } from "../stream
|
|
2
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
import { type IetfVersion } from "./version";
|
|
3
3
|
export interface GroupFlags {
|
|
4
4
|
hasExtensions: boolean;
|
|
5
5
|
hasSubgroup: boolean;
|
package/ietf/object.js
CHANGED
package/ietf/parameters.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Reader, Writer } from "../stream
|
|
2
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
import { type IetfVersion } from "./version";
|
|
3
3
|
export declare const SetupOption: {
|
|
4
4
|
readonly Path: 1n;
|
|
5
5
|
readonly MaxRequestId: 2n;
|
package/ietf/parameters.js
CHANGED
package/ietf/properties.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Reader } from "../stream
|
|
2
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Reader } from "../stream";
|
|
2
|
+
import { type IetfVersion } from "./version";
|
|
3
3
|
export declare function skip(r: Reader, version: IetfVersion): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=properties.d.ts.map
|
package/ietf/properties.js
CHANGED
package/ietf/publish.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class Publish {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/publish.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class PublishNamespace {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/publisher.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Broadcast } from "../broadcast
|
|
2
|
-
import * as Path from "../path
|
|
3
|
-
import { type Stream } from "../stream
|
|
4
|
-
import type { Session } from "./adapter
|
|
5
|
-
import { type Subscribe } from "./subscribe
|
|
6
|
-
import { type SubscribeNamespace } from "./subscribe_namespace
|
|
7
|
-
import { type TrackStatusRequest } from "./track
|
|
1
|
+
import type { Broadcast } from "../broadcast";
|
|
2
|
+
import * as Path from "../path";
|
|
3
|
+
import { type Stream } from "../stream";
|
|
4
|
+
import type { Session } from "./adapter";
|
|
5
|
+
import { type Subscribe } from "./subscribe";
|
|
6
|
+
import { type SubscribeNamespace } from "./subscribe_namespace";
|
|
7
|
+
import { type TrackStatusRequest } from "./track";
|
|
8
8
|
/**
|
|
9
9
|
* Handles publishing broadcasts using moq-transport protocol.
|
|
10
10
|
* Uses the stream-per-request pattern (real bidi streams for v17, virtual for v14-v16).
|
package/ietf/publisher.js
CHANGED
package/ietf/request.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Reader, Writer } from "../stream
|
|
2
|
-
import { Parameters } from "./parameters
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
import { Parameters } from "./parameters";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class MaxRequestId {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/request.js
CHANGED
package/ietf/setup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Reader, Writer } from "../stream
|
|
2
|
-
import { SetupOptions } from "./parameters
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type { Reader, Writer } from "../stream";
|
|
2
|
+
import { SetupOptions } from "./parameters";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class Setup {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/setup.js
CHANGED
package/ietf/subscribe.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class Subscribe {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|
package/ietf/subscribe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type * as Path from "../path
|
|
2
|
-
import type { Reader, Writer } from "../stream
|
|
3
|
-
import { type IetfVersion } from "./version
|
|
1
|
+
import type * as Path from "../path";
|
|
2
|
+
import type { Reader, Writer } from "../stream";
|
|
3
|
+
import { type IetfVersion } from "./version";
|
|
4
4
|
export declare class SubscribeNamespace {
|
|
5
5
|
#private;
|
|
6
6
|
static id: number;
|