@norskvideo/moq-net 0.1.4 → 0.1.6
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/origin.d.ts +1 -1
- package/origin.d.ts.map +1 -1
- package/origin.js +1 -1
- package/origin.js.map +1 -1
- package/package.json +3 -4
- package/zod.d.ts +1 -1
- package/zod.d.ts.map +1 -1
- package/zod.js.map +1 -1
package/origin.d.ts
CHANGED
package/origin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,8DAGR,CAAC;AAElB,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,MAA+B,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAOrC"}
|
package/origin.js
CHANGED
package/origin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../src/origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,IAAI,GAAG,EAAE,8CAA8C,CAAC,CAAC;KAC5G,KAAK,CAAC,QAAQ,CAAC,CAAC;AAIlB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC3B,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC5B,mBAAmB;IACnB,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,iBAAoB,CAAC;IAC1C,yDAAyD;IACzD,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Endpoint identity within a hop chain, shared by both wire protocols.\n *\n * moq-lite carries these natively on every announcement; moq-transport carries them\n * via the MoQ Cluster extension (see `ietf/cluster.ts`). Mirrors `Origin` in\n * `rs/moq-net`.\n *\n * @module\n */\nimport * as z from \"zod/mini\";\n\n/**\n * A relay origin id, encoded as a 62-bit varint on the wire.\n *\n * The {@link OriginSchema} validates any incoming value and brands it so the\n * type system enforces \"only validated origins flow into hop lists.\" Internal\n * code that synthesizes an id (e.g. {@link randomOrigin}) uses\n * `OriginSchema.parse(...)` to produce a branded value from the raw bigint.\n */\nexport const OriginSchema = z\n\t.bigint()\n\t.check(z.refine((value) => value >= 0n && value < 1n << 62n, \"Origin must be a non-negative 62-bit integer\"))\n\t.brand(\"Origin\");\n\nexport type Origin = z.infer<typeof OriginSchema>;\n\n/**\n * The reserved id 0, meaning \"no identity\".\n *\n * It stands in for an endpoint that never declared one, and any number of endpoints can\n * be 0, so it identifies nothing: it is never a loop, never a publisher two chains have\n * in common, and never excluded from an advertisement.\n */\nexport const UNKNOWN_ORIGIN: Origin = OriginSchema.parse(0n);\n\n/**\n * Maximum length of a hop chain. Must match `MAX_HOPS` in Rust's `model/origin.rs`.\n *\n * Broadcasts with longer chains are rejected, which bounds loop detection and rejects\n * pathological announcements across clusters with unbounded forwarding.\n */\nexport const MAX_HOPS = 32;\n\n/**\n * Generate a fresh origin with a random non-zero id.\n *\n * `crypto.getRandomValues` is overkill for best-effort loop detection, but\n * used for slightly better distribution than `Math.random` at negligible cost.\n *\n * TEMPORARY: the wire format allows 62 bits, but older `@moq/lite` JS clients\n * decode `AnnounceInterest.exclude_hop` as a u53 (number) and throw on anything\n * > 2^53-1. To keep those clients alive against fresh peers, we cap the random\n * id at 53 bits. Restore to 62 bits once the u62 fix has propagated to deployed\n * bundles. Mirrors `Origin::random` in rs/moq-net.\n */\nexport function randomOrigin(): Origin {\n\tconst buf = new BigUint64Array(1);\n\tcrypto.getRandomValues(buf);\n\t// Mask to 53 bits.\n\tconst raw = buf[0] & 0x1f_ffff_ffff_ffffn;\n\t// Guard against the (astronomically unlikely) zero draw.\n\treturn OriginSchema.parse(raw === 0n ? 1n : raw);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norskvideo/moq-net",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"description": "The networking layer for Media over QUIC: real-time pub/sub with built-in caching, fan-out, and prioritization.",
|
|
6
6
|
"license": "(MIT OR Apache-2.0)",
|
|
7
7
|
"repository": "github:moq-dev/moq",
|
|
@@ -20,10 +20,9 @@
|
|
|
20
20
|
"@moq/qmux": "^0.3.3",
|
|
21
21
|
"async-mutex": "^0.5.0",
|
|
22
22
|
"bowser": "^2.14.1",
|
|
23
|
-
"@norskvideo/moq-signals": "^0.1.
|
|
23
|
+
"@norskvideo/moq-signals": "^0.1.6"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"zod": "^4.5.0"
|
|
26
|
+
"zod": "^4.4.3"
|
|
28
27
|
}
|
|
29
28
|
}
|
package/zod.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type * as z from "
|
|
6
|
+
import type * as z from "zod/mini";
|
|
7
7
|
import type * as group from "./group";
|
|
8
8
|
import type * as track from "./track";
|
|
9
9
|
/** Read the next JSON frame and validate it against the schema. Returns undefined at end of stream. */
|
package/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,uGAAuG;AACvG,wBAAsB,IAAI,CAAC,CAAC,GAAG,OAAO,EACrC,MAAM,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,QAAQ,EACzC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAIxB;AAED,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAG7G"}
|
package/zod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,uGAAuG;AACvG,MAAM,CAAC,KAAK,UAAU,IAAI,CACzB,MAAyC,EACzC,MAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC,CAAC,sDAAsD;IAChG,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,KAAK,CAAc,MAAuC,EAAE,KAAQ,EAAE,MAAwB;IAC7G,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Helpers for reading and writing Zod-validated JSON frames on a track or group.\n *\n * @module\n */\n\nimport type * as z from \"
|
|
1
|
+
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,uGAAuG;AACvG,MAAM,CAAC,KAAK,UAAU,IAAI,CACzB,MAAyC,EACzC,MAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC,CAAC,sDAAsD;IAChG,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,KAAK,CAAc,MAAuC,EAAE,KAAQ,EAAE,MAAwB;IAC7G,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC","sourcesContent":["/**\n * Helpers for reading and writing Zod-validated JSON frames on a track or group.\n *\n * @module\n */\n\nimport type * as z from \"zod/mini\";\nimport type * as group from \"./group.ts\";\nimport type * as track from \"./track.ts\";\n\n/** Read the next JSON frame and validate it against the schema. Returns undefined at end of stream. */\nexport async function read<T = unknown>(\n\tsource: track.Subscriber | group.Consumer,\n\tschema: z.ZodMiniType<T>,\n): Promise<T | undefined> {\n\tconst next = await source.readJson();\n\tif (next === undefined) return undefined; // only treat undefined as EOF, not other falsy values\n\treturn schema.parse(next);\n}\n\n/** Validate a value against the schema, then write it as a JSON frame. */\nexport function write<T = unknown>(source: track.Producer | group.Producer, value: T, schema: z.ZodMiniType<T>) {\n\tconst valid = schema.parse(value);\n\tsource.writeJson(valid);\n}\n"]}
|