@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.
Files changed (141) hide show
  1. package/announced.d.ts +4 -0
  2. package/announced.d.ts.map +1 -1
  3. package/announced.js +5 -0
  4. package/announced.js.map +1 -1
  5. package/bandwidth.js +1 -0
  6. package/broadcast.d.ts +5 -1
  7. package/broadcast.d.ts.map +1 -1
  8. package/broadcast.js +4 -0
  9. package/broadcast.js.map +1 -1
  10. package/connection/accept.d.ts +2 -1
  11. package/connection/accept.d.ts.map +1 -1
  12. package/connection/accept.js +1 -0
  13. package/connection/accept.js.map +1 -1
  14. package/connection/cert.test.js +1 -0
  15. package/connection/connect.d.ts +5 -1
  16. package/connection/connect.d.ts.map +1 -1
  17. package/connection/connect.js +5 -1
  18. package/connection/connect.js.map +1 -1
  19. package/connection/established.d.ts +13 -5
  20. package/connection/established.d.ts.map +1 -1
  21. package/connection/established.js +1 -0
  22. package/connection/established.js.map +1 -1
  23. package/connection/handshake.d.ts +2 -2
  24. package/connection/handshake.js +1 -0
  25. package/connection/index.d.ts +4 -4
  26. package/connection/index.js +1 -0
  27. package/connection/reload.d.ts +18 -3
  28. package/connection/reload.d.ts.map +1 -1
  29. package/connection/reload.js +13 -4
  30. package/connection/reload.js.map +1 -1
  31. package/group.d.ts +13 -0
  32. package/group.d.ts.map +1 -1
  33. package/group.js +14 -0
  34. package/group.js.map +1 -1
  35. package/ietf/adapter.d.ts +2 -2
  36. package/ietf/adapter.js +1 -0
  37. package/ietf/connection.d.ts +6 -6
  38. package/ietf/connection.js +1 -0
  39. package/ietf/control.d.ts +11 -11
  40. package/ietf/control.js +1 -0
  41. package/ietf/fetch.d.ts +3 -3
  42. package/ietf/fetch.js +1 -0
  43. package/ietf/goaway.d.ts +2 -2
  44. package/ietf/goaway.js +1 -0
  45. package/ietf/ietf.test.js +1 -0
  46. package/ietf/index.d.ts +17 -17
  47. package/ietf/index.js +1 -0
  48. package/ietf/message.d.ts +1 -1
  49. package/ietf/message.js +1 -0
  50. package/ietf/namespace.d.ts +2 -2
  51. package/ietf/namespace.js +1 -0
  52. package/ietf/object.d.ts +2 -2
  53. package/ietf/object.js +1 -0
  54. package/ietf/parameters.d.ts +2 -2
  55. package/ietf/parameters.js +1 -0
  56. package/ietf/properties.d.ts +2 -2
  57. package/ietf/properties.js +1 -0
  58. package/ietf/publish.d.ts +3 -3
  59. package/ietf/publish.js +1 -0
  60. package/ietf/publish_namespace.d.ts +3 -3
  61. package/ietf/publish_namespace.js +1 -0
  62. package/ietf/publisher.d.ts +7 -7
  63. package/ietf/publisher.js +1 -0
  64. package/ietf/request.d.ts +3 -3
  65. package/ietf/request.js +1 -0
  66. package/ietf/setup.d.ts +3 -3
  67. package/ietf/setup.js +1 -0
  68. package/ietf/subscribe.d.ts +3 -3
  69. package/ietf/subscribe.js +1 -0
  70. package/ietf/subscribe_namespace.d.ts +3 -3
  71. package/ietf/subscribe_namespace.js +1 -0
  72. package/ietf/subscriber.d.ts +8 -8
  73. package/ietf/subscriber.js +1 -0
  74. package/ietf/track.d.ts +3 -3
  75. package/ietf/track.js +1 -0
  76. package/ietf/version.js +1 -0
  77. package/index.d.ts +20 -9
  78. package/index.d.ts.map +1 -1
  79. package/index.js +7 -0
  80. package/index.js.map +1 -1
  81. package/integration.test.js +1 -0
  82. package/lite/announce.d.ts +4 -4
  83. package/lite/announce.js +1 -0
  84. package/lite/connection.d.ts +9 -9
  85. package/lite/connection.js +1 -0
  86. package/lite/fetch.d.ts +3 -3
  87. package/lite/fetch.js +1 -0
  88. package/lite/goaway.d.ts +2 -2
  89. package/lite/goaway.js +1 -0
  90. package/lite/group.d.ts +1 -1
  91. package/lite/group.js +1 -0
  92. package/lite/index.d.ts +10 -10
  93. package/lite/index.js +1 -0
  94. package/lite/message.d.ts +1 -1
  95. package/lite/message.js +1 -0
  96. package/lite/origin.js +1 -0
  97. package/lite/probe.d.ts +2 -2
  98. package/lite/probe.js +1 -0
  99. package/lite/publisher.d.ts +7 -7
  100. package/lite/publisher.js +1 -0
  101. package/lite/session.d.ts +2 -2
  102. package/lite/session.js +1 -0
  103. package/lite/stream.d.ts +5 -5
  104. package/lite/stream.js +1 -0
  105. package/lite/subscribe.d.ts +3 -3
  106. package/lite/subscribe.js +1 -0
  107. package/lite/subscriber.d.ts +9 -9
  108. package/lite/subscriber.js +1 -0
  109. package/lite/version.js +1 -0
  110. package/mock.js +1 -0
  111. package/package.json +2 -2
  112. package/path.d.ts +2 -0
  113. package/path.d.ts.map +1 -1
  114. package/path.js +3 -0
  115. package/path.js.map +1 -1
  116. package/path.test.js +1 -0
  117. package/stream.d.ts +1 -1
  118. package/stream.js +1 -0
  119. package/stream.test.js +1 -0
  120. package/time.d.ts +8 -0
  121. package/time.d.ts.map +1 -1
  122. package/time.js +5 -0
  123. package/time.js.map +1 -1
  124. package/track.d.ts +14 -1
  125. package/track.d.ts.map +1 -1
  126. package/track.js +14 -1
  127. package/track.js.map +1 -1
  128. package/track.test.js +1 -0
  129. package/util/error.js +1 -0
  130. package/util/hex.js +1 -0
  131. package/util/index.d.ts +1 -1
  132. package/util/index.js +1 -0
  133. package/varint.d.ts +8 -0
  134. package/varint.d.ts.map +1 -1
  135. package/varint.js +9 -0
  136. package/varint.js.map +1 -1
  137. package/varint.test.js +1 -0
  138. package/zod.d.ts +9 -2
  139. package/zod.d.ts.map +1 -1
  140. package/zod.js +8 -1
  141. package/zod.js.map +1 -1
@@ -1,11 +1,11 @@
1
- import { Announced } from "../announced.ts";
2
- import { Broadcast } from "../broadcast.ts";
3
- import * as Path from "../path.ts";
4
- import type { Reader, Stream } from "../stream.ts";
5
- import type { Session } from "./adapter.ts";
6
- import { type Group as GroupMessage } from "./object.ts";
7
- import { type Publish } from "./publish.ts";
8
- import type { PublishNamespace } from "./publish_namespace.ts";
1
+ import { Announced } from "../announced";
2
+ import { Broadcast } from "../broadcast";
3
+ import * as Path from "../path";
4
+ import type { Reader, Stream } from "../stream";
5
+ import type { Session } from "./adapter";
6
+ import { type Group as GroupMessage } from "./object";
7
+ import { type Publish } from "./publish";
8
+ import type { PublishNamespace } from "./publish_namespace";
9
9
  /**
10
10
  * Handles subscribing to broadcasts using moq-transport protocol.
11
11
  * Uses the stream-per-request pattern (real bidi streams for v17, virtual for v14-v16).
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./subscriber.d.ts" */
1
2
  import { Announced } from "../announced.js";
2
3
  import { Broadcast } from "../broadcast.js";
3
4
  import { Group } from "../group.js";
package/ietf/track.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type * as Path from "../path.ts";
2
- import type { Reader, Writer } from "../stream.ts";
3
- import { type IetfVersion } from "./version.ts";
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 TrackStatusRequest {
5
5
  #private;
6
6
  static id: number;
package/ietf/track.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./track.d.ts" */
1
2
  import * as Message from "./message.js";
2
3
  import * as Namespace from "./namespace.js";
3
4
  import { Parameters } from "./parameters.js";
package/ietf/version.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./version.d.ts" */
1
2
  /**
2
3
  * Supported MoQ Transport protocol versions
3
4
  */
package/index.d.ts CHANGED
@@ -1,11 +1,22 @@
1
+ /**
2
+ * MoQ networking layer for browsers: connect to a relay, then publish and consume
3
+ * broadcasts, tracks, groups, and frames over WebTransport (or a WebSocket fallback).
4
+ *
5
+ * @module
6
+ */
7
+ /** Re-export of {@link https://jsr.io/@moq/signals | @moq/signals}, the reactive primitives used throughout this package. */
1
8
  export * as Signals from "@moq/signals";
2
- export * from "./announced.ts";
3
- export * from "./bandwidth.ts";
4
- export * from "./broadcast.ts";
5
- export * as Connection from "./connection/index.ts";
6
- export * from "./group.ts";
7
- export * as Path from "./path.ts";
8
- export * as Time from "./time.ts";
9
- export * from "./track.ts";
10
- export * as Varint from "./varint.ts";
9
+ export * from "./announced";
10
+ export * from "./bandwidth";
11
+ export * from "./broadcast";
12
+ /** Connection helpers: connect to or accept a MoQ session and reconnect on failure. */
13
+ export * as Connection from "./connection/index";
14
+ export * from "./group";
15
+ /** Broadcast path utilities with delimiter-aware prefix matching. */
16
+ export * as Path from "./path";
17
+ /** Branded time types (nanoseconds, microseconds, milliseconds, seconds) with conversions. */
18
+ export * as Time from "./time";
19
+ export * from "./track";
20
+ /** QUIC variable-length integer encoding and decoding. */
21
+ export * as Varint from "./varint";
11
22
  //# 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,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
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,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,uFAAuF;AACvF,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,cAAc,YAAY,CAAC;AAC3B,qEAAqE;AACrE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,8FAA8F;AAC9F,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,0DAA0D;AAC1D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
package/index.js CHANGED
@@ -1,3 +1,10 @@
1
+ /* @ts-self-types="./index.d.ts" */
2
+ /**
3
+ * MoQ networking layer for browsers: connect to a relay, then publish and consume
4
+ * broadcasts, tracks, groups, and frames over WebTransport (or a WebSocket fallback).
5
+ *
6
+ * @module
7
+ */
1
8
  import * as Signals_1 from "@moq/signals";
2
9
  export { Signals_1 as Signals };
3
10
  export * from "./announced.js";
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"2BAAyB,cAAc;sBAA3B,OAAO;AACnB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;8BACH,uBAAuB;yBAAvC,UAAU;AACtB,cAAc,YAAY,CAAC;wBACL,WAAW;mBAArB,IAAI;wBACM,WAAW;mBAArB,IAAI;AAChB,cAAc,YAAY,CAAC;0BACH,aAAa;qBAAzB,MAAM","sourcesContent":["export * as Signals from \"@moq/signals\";\nexport * from \"./announced.ts\";\nexport * from \"./bandwidth.ts\";\nexport * from \"./broadcast.ts\";\nexport * as Connection from \"./connection/index.ts\";\nexport * from \"./group.ts\";\nexport * as Path from \"./path.ts\";\nexport * as Time from \"./time.ts\";\nexport * from \"./track.ts\";\nexport * as Varint from \"./varint.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;2BAGsB,cAAc;sBAA3B,OAAO;AACnB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;8BAEH,uBAAuB;yBAAvC,UAAU;AACtB,cAAc,YAAY,CAAC;wBAEL,WAAW;mBAArB,IAAI;wBAEM,WAAW;mBAArB,IAAI;AAChB,cAAc,YAAY,CAAC;0BAEH,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\";\nexport * from \"./announced.ts\";\nexport * from \"./bandwidth.ts\";\nexport * from \"./broadcast.ts\";\n/** Connection helpers: connect to or accept a MoQ session and reconnect on failure. */\nexport * as Connection from \"./connection/index.ts\";\nexport * from \"./group.ts\";\n/** Broadcast path utilities with delimiter-aware prefix matching. */\nexport * as Path from \"./path.ts\";\n/** Branded time types (nanoseconds, microseconds, milliseconds, seconds) with conversions. */\nexport * as Time from \"./time.ts\";\nexport * from \"./track.ts\";\n/** QUIC variable-length integer encoding and decoding. */\nexport * as Varint from \"./varint.ts\";\n"]}
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./integration.test.d.ts" */
1
2
  import { expect, test } from "bun:test";
2
3
  import { Broadcast } from "./broadcast.js";
3
4
  import { accept, connect } from "./connection/index.js";
@@ -1,7 +1,7 @@
1
- import * as Path from "../path.ts";
2
- import type { Reader, Writer } from "../stream.ts";
3
- import { type Origin } from "./origin.ts";
4
- import { Version } from "./version.ts";
1
+ import * as Path from "../path";
2
+ import type { Reader, Writer } from "../stream";
3
+ import { type Origin } from "./origin";
4
+ import { Version } from "./version";
5
5
  export declare const MAX_HOPS = 32;
6
6
  export declare class Announce {
7
7
  #private;
package/lite/announce.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./announce.d.ts" */
1
2
  import * as Path from "../path.js";
2
3
  import * as Message from "./message.js";
3
4
  import { OriginSchema } from "./origin.js";
@@ -1,13 +1,13 @@
1
1
  import { Signal } from "@moq/signals";
2
- import type { Announced } from "../announced.ts";
3
- import { type Bandwidth } from "../bandwidth.ts";
4
- import type { Broadcast } from "../broadcast.ts";
5
- import type { Established } from "../connection/established.ts";
6
- import * as Path from "../path.ts";
7
- import { Stream } from "../stream.ts";
8
- import type * as Time from "../time.ts";
9
- import { type Origin } from "./origin.ts";
10
- import { Version } from "./version.ts";
2
+ import type { Announced } from "../announced";
3
+ import { type Bandwidth } from "../bandwidth";
4
+ import type { Broadcast } from "../broadcast";
5
+ import type { Established } from "../connection/established";
6
+ import * as Path from "../path";
7
+ import { Stream } from "../stream";
8
+ import type * as Time from "../time";
9
+ import { type Origin } from "./origin";
10
+ import { Version } from "./version";
11
11
  /**
12
12
  * Represents a connection to a MoQ server.
13
13
  *
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./connection.d.ts" */
1
2
  import { Signal } from "@moq/signals";
2
3
  import { createBandwidth } from "../bandwidth.js";
3
4
  import * as Path from "../path.js";
package/lite/fetch.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as Path from "../path.ts";
2
- import type { Reader, Writer } from "../stream.ts";
3
- import { Version } from "./version.ts";
1
+ import * as Path from "../path";
2
+ import type { Reader, Writer } from "../stream";
3
+ import { Version } from "./version";
4
4
  export declare class Fetch {
5
5
  #private;
6
6
  broadcast: Path.Valid;
package/lite/fetch.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./fetch.d.ts" */
1
2
  import * as Path from "../path.js";
2
3
  import * as Message from "./message.js";
3
4
  import { Version } from "./version.js";
package/lite/goaway.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Reader, Writer } from "../stream.ts";
2
- import { Version } from "./version.ts";
1
+ import type { Reader, Writer } from "../stream";
2
+ import { Version } from "./version";
3
3
  export declare class Goaway {
4
4
  #private;
5
5
  uri: string;
package/lite/goaway.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./goaway.d.ts" */
1
2
  import * as Message from "./message.js";
2
3
  import { Version } from "./version.js";
3
4
  function guardGoaway(version) {
package/lite/group.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Reader, Writer } from "../stream.ts";
1
+ import type { Reader, Writer } from "../stream";
2
2
  export declare class Group {
3
3
  #private;
4
4
  subscribe: bigint;
package/lite/group.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./group.d.ts" */
1
2
  import * as Message from "./message.js";
2
3
  export class Group {
3
4
  subscribe;
package/lite/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export * from "./announce.ts";
2
- export * from "./connection.ts";
3
- export * from "./fetch.ts";
4
- export * from "./goaway.ts";
5
- export * from "./group.ts";
6
- export * from "./probe.ts";
7
- export * from "./session.ts";
8
- export * from "./stream.ts";
9
- export * from "./subscribe.ts";
10
- export * from "./version.ts";
1
+ export * from "./announce";
2
+ export * from "./connection";
3
+ export * from "./fetch";
4
+ export * from "./goaway";
5
+ export * from "./group";
6
+ export * from "./probe";
7
+ export * from "./session";
8
+ export * from "./stream";
9
+ export * from "./subscribe";
10
+ export * from "./version";
11
11
  //# sourceMappingURL=index.d.ts.map
package/lite/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./index.d.ts" */
1
2
  export * from "./announce.js";
2
3
  export * from "./connection.js";
3
4
  export * from "./fetch.js";
package/lite/message.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Reader, Writer } from "../stream.ts";
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
  export declare function decodeMaybe<T>(reader: Reader, f: (r: Reader) => Promise<T>): Promise<T | undefined>;
package/lite/message.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./message.d.ts" */
1
2
  import { Reader, Writer } from "../stream.js";
2
3
  export async function encode(writer, f) {
3
4
  let scratch = new Uint8Array();
package/lite/origin.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./origin.d.ts" */
1
2
  import * as z from "zod/mini";
2
3
  /**
3
4
  * A relay origin id, encoded as a 62-bit varint on the wire.
package/lite/probe.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Reader, Writer } from "../stream.ts";
2
- import { Version } from "./version.ts";
1
+ import type { Reader, Writer } from "../stream";
2
+ import { Version } from "./version";
3
3
  export declare class Probe {
4
4
  #private;
5
5
  bitrate: number;
package/lite/probe.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./probe.d.ts" */
1
2
  import * as Message from "./message.js";
2
3
  import { Version } from "./version.js";
3
4
  function guardProbe(version) {
@@ -1,10 +1,10 @@
1
- import type { Broadcast } from "../broadcast.ts";
2
- import * as Path from "../path.ts";
3
- import { type Stream } from "../stream.ts";
4
- import { type AnnounceInterest } from "./announce.ts";
5
- import type { Origin } from "./origin.ts";
6
- import { type Subscribe } from "./subscribe.ts";
7
- import { Version } from "./version.ts";
1
+ import type { Broadcast } from "../broadcast";
2
+ import * as Path from "../path";
3
+ import { type Stream } from "../stream";
4
+ import { type AnnounceInterest } from "./announce";
5
+ import type { Origin } from "./origin";
6
+ import { type Subscribe } from "./subscribe";
7
+ import { Version } from "./version";
8
8
  /**
9
9
  * Handles publishing broadcasts and managing their lifecycle.
10
10
  *
package/lite/publisher.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./publisher.d.ts" */
1
2
  import { Signal } from "@moq/signals";
2
3
  import * as Path from "../path.js";
3
4
  import { Writer } from "../stream.js";
package/lite/session.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { Reader, Writer } from "../stream.ts";
2
- import { Version } from "./version.ts";
1
+ import type { Reader, Writer } from "../stream";
2
+ import { Version } from "./version";
3
3
  export declare class Extensions {
4
4
  entries: Map<bigint, Uint8Array>;
5
5
  constructor();
package/lite/session.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./session.d.ts" */
1
2
  import * as Message from "./message.js";
2
3
  import { Version } from "./version.js";
3
4
  export class Extensions {
package/lite/stream.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { AnnounceInterest } from "./announce.ts";
2
- import type { Goaway } from "./goaway.ts";
3
- import type { Group } from "./group.ts";
4
- import type { SessionClient } from "./session.ts";
5
- import type { Subscribe } from "./subscribe.ts";
1
+ import type { AnnounceInterest } from "./announce";
2
+ import type { Goaway } from "./goaway";
3
+ import type { Group } from "./group";
4
+ import type { SessionClient } from "./session";
5
+ import type { Subscribe } from "./subscribe";
6
6
  export type StreamBi = SessionClient | AnnounceInterest | Subscribe | Goaway;
7
7
  export type StreamUni = Group;
8
8
  export declare const StreamId: {
package/lite/stream.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./stream.d.ts" */
1
2
  export const StreamId = {
2
3
  Session: 0,
3
4
  Announce: 1,
@@ -1,6 +1,6 @@
1
- import * as Path from "../path.ts";
2
- import type { Reader, Writer } from "../stream.ts";
3
- import { Version } from "./version.ts";
1
+ import * as Path from "../path";
2
+ import type { Reader, Writer } from "../stream";
3
+ import { Version } from "./version";
4
4
  export declare class SubscribeUpdate {
5
5
  #private;
6
6
  priority: number;
package/lite/subscribe.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./subscribe.d.ts" */
1
2
  import * as Path from "../path.js";
2
3
  import * as Message from "./message.js";
3
4
  import { Version } from "./version.js";
@@ -1,13 +1,13 @@
1
1
  import type { Signal } from "@moq/signals";
2
- import { Announced } from "../announced.ts";
3
- import type { Bandwidth } from "../bandwidth.ts";
4
- import { Broadcast } from "../broadcast.ts";
5
- import * as Path from "../path.ts";
6
- import { type Reader } from "../stream.ts";
7
- import type * as Time from "../time.ts";
8
- import type { Group as GroupMessage } from "./group.ts";
9
- import type { Origin } from "./origin.ts";
10
- import { Version } from "./version.ts";
2
+ import { Announced } from "../announced";
3
+ import type { Bandwidth } from "../bandwidth";
4
+ import { Broadcast } from "../broadcast";
5
+ import * as Path from "../path";
6
+ import { type Reader } from "../stream";
7
+ import type * as Time from "../time";
8
+ import type { Group as GroupMessage } from "./group";
9
+ import type { Origin } from "./origin";
10
+ import { Version } from "./version";
11
11
  /**
12
12
  * Options accepted by {@link Subscriber.announced}.
13
13
  */
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./subscriber.d.ts" */
1
2
  import { Announced } from "../announced.js";
2
3
  import { Broadcast } from "../broadcast.js";
3
4
  import { Group } from "../group.js";
package/lite/version.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./version.d.ts" */
1
2
  export const Version = {
2
3
  DRAFT_01: 0xff0dad01,
3
4
  DRAFT_02: 0xff0dad02,
package/mock.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./mock.d.ts" */
1
2
  /**
2
3
  * Mock WebTransport implementation for in-process testing.
3
4
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moq/net",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
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",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@moq/qmux": "^0.0.6",
21
- "@moq/signals": "^0.1.8",
21
+ "@moq/signals": "^0.1.9",
22
22
  "async-mutex": "^0.5.0"
23
23
  },
24
24
  "peerDependencies": {
package/path.d.ts CHANGED
@@ -31,6 +31,7 @@
31
31
  export type Valid = string & {
32
32
  __brand: "Name";
33
33
  };
34
+ /** Build a path from one or more components, joining with "/" and trimming redundant slashes. */
34
35
  export declare function from(...paths: string[]): Valid;
35
36
  /**
36
37
  * Check if a path has the given prefix, respecting path boundaries.
@@ -83,5 +84,6 @@ export declare function stripPrefix(prefix: Valid, path: Valid): Valid | null;
83
84
  * ```
84
85
  */
85
86
  export declare function join(path: Valid, other: Valid): Valid;
87
+ /** The empty path, which is a prefix of every path. */
86
88
  export declare function empty(): Valid;
87
89
  //# sourceMappingURL=path.d.ts.map
package/path.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,wBAAgB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAI9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAgB7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAiBpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CASrD;AAED,wBAAgB,KAAK,IAAI,KAAK,CAE7B"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,iGAAiG;AACjG,wBAAgB,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAI9C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,CAgB7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAiBpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CASrD;AAED,uDAAuD;AACvD,wBAAgB,KAAK,IAAI,KAAK,CAE7B"}
package/path.js CHANGED
@@ -1,3 +1,5 @@
1
+ /* @ts-self-types="./path.d.ts" */
2
+ /** Build a path from one or more components, joining with "/" and trimming redundant slashes. */
1
3
  export function from(...paths) {
2
4
  // Join paths with "/" and then remove leading and trailing slashes, and collapse multiple slashes into one.
3
5
  const joined = paths.join("/");
@@ -92,6 +94,7 @@ export function join(path, other) {
92
94
  return `${path}/${other}`;
93
95
  }
94
96
  }
97
+ /** The empty path, which is a prefix of every path. */
95
98
  export function empty() {
96
99
  return "";
97
100
  }
package/path.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAgCA,MAAM,UAAU,IAAI,CAAC,GAAG,KAAe;IACtC,4GAA4G;IAC5G,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAU,CAAC;AACrF,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,SAAS,CAAC,MAAa,EAAE,IAAW;IACnD,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACd,CAAC;IAED,yCAAyC;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,kEAAkE;IAClE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAa,EAAE,IAAW;IACrD,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,2BAA2B;IAC3B,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,0CAA0C;IAC1C,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,EAAW,CAAC;IACpB,CAAC;IAED,+EAA+E;IAC/E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAU,CAAC;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,IAAI,CAAC,IAAW,EAAE,KAAY;IAC7C,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACd,CAAC;SAAM,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;SAAM,CAAC;QACP,yDAAyD;QACzD,OAAO,GAAG,IAAI,IAAI,KAAK,EAAW,CAAC;IACpC,CAAC;AACF,CAAC;AAED,MAAM,UAAU,KAAK;IACpB,OAAO,EAAW,CAAC;AACpB,CAAC","sourcesContent":["/**\n * A broadcast path that provides safe prefix matching operations.\n *\n * This module provides path-aware operations that respect delimiter boundaries,\n * preventing issues like \"foo\" matching \"foobar\".\n *\n * Paths are automatically trimmed of leading and trailing slashes on creation,\n * making all slashes implicit at boundaries.\n * All paths are RELATIVE; you cannot join with a leading slash to make an absolute path.\n *\n * @example\n * ```typescript\n * // Creation automatically trims slashes\n * const path1 = Path.from(\"/foo/bar/\");\n * const path2 = Path.from(\"foo/bar\");\n * console.log(path1 === path2); // true\n *\n * // Multiple arguments are joined with \"/\"\n * const path3 = Path.from(\"api\", \"v1\", \"users\");\n * console.log(path3); // \"api/v1/users\"\n *\n * // Safe prefix matching\n * const base = Path.from(\"api/v1\");\n * console.log(Path.hasPrefix(Path.from(\"api\"), base)); // true\n * console.log(Path.hasPrefix(Path.from(\"api/v1\"), base)); // true\n *\n * const joined = Path.join(base, Path.from(\"users\"));\n * console.log(joined); // \"api/v1/users\"\n * ```\n */\nexport type Valid = string & { __brand: \"Name\" };\n\nexport function from(...paths: string[]): Valid {\n\t// Join paths with \"/\" and then remove leading and trailing slashes, and collapse multiple slashes into one.\n\tconst joined = paths.join(\"/\");\n\treturn joined.replace(/\\/+/g, \"/\").replace(/^\\/+/, \"\").replace(/\\/+$/, \"\") as Valid;\n}\n\n/**\n * Check if a path has the given prefix, respecting path boundaries.\n *\n * Unlike String.startsWith, this ensures that \"foo\" does not match \"foobar\".\n * The prefix must either:\n * - Be exactly equal to the path\n * - Be followed by a '/' delimiter in the original path\n * - Be empty (matches everything)\n *\n * @example\n * ```typescript\n * const path = Path.from(\"foo/bar\");\n * console.log(Path.hasPrefix(Path.from(\"foo\"), path)); // true\n * console.log(Path.hasPrefix(Path.from(\"foo/\"), path)); // true (trailing slash ignored)\n * console.log(Path.hasPrefix(Path.from(\"fo\"), path)); // false\n *\n * const path2 = Path.from(\"foobar\");\n * console.log(Path.hasPrefix(Path.from(\"foo\"), path2)); // false\n * ```\n */\nexport function hasPrefix(prefix: Valid, path: Valid): boolean {\n\tif (prefix === \"\") {\n\t\treturn true;\n\t}\n\n\tif (!path.startsWith(prefix)) {\n\t\treturn false;\n\t}\n\n\t// Check if the prefix is the exact match\n\tif (path.length === prefix.length) {\n\t\treturn true;\n\t}\n\n\t// Otherwise, ensure the character after the prefix is a delimiter\n\treturn path[prefix.length] === \"/\";\n}\n\n/**\n * Strip the given prefix from a path, returning the suffix.\n *\n * Returns null if the prefix doesn't match according to hasPrefix rules.\n *\n * @example\n * ```typescript\n * const path = Path.from(\"foo/bar/baz\");\n * const suffix = Path.stripPrefix(Path.from(\"foo\"), path);\n * console.log(suffix); // \"bar/baz\"\n *\n * const suffix2 = Path.stripPrefix(Path.from(\"foo/\"), path);\n * console.log(suffix2); // \"bar/baz\"\n *\n * const noMatch = Path.stripPrefix(Path.from(\"notfound\"), path);\n * console.log(noMatch); // null\n * ```\n */\nexport function stripPrefix(prefix: Valid, path: Valid): Valid | null {\n\tif (!hasPrefix(prefix, path)) {\n\t\treturn null;\n\t}\n\n\t// Handle empty prefix case\n\tif (prefix === \"\") {\n\t\treturn path;\n\t}\n\n\t// If prefix matches exactly, return empty\n\tif (path.length === prefix.length) {\n\t\treturn \"\" as Valid;\n\t}\n\n\t// For non-empty prefix that's shorter, skip the prefix and the following slash\n\treturn path.slice(prefix.length + 1) as Valid;\n}\n\n/**\n * Join two path components together.\n *\n * @example\n * ```typescript\n * const base = Path.from(\"foo\");\n * const joined = Path.join(base, Path.from(\"bar\"));\n * console.log(joined); // \"foo/bar\"\n * ```\n */\nexport function join(path: Valid, other: Valid): Valid {\n\tif (path === \"\") {\n\t\treturn other;\n\t} else if (other === \"\") {\n\t\treturn path;\n\t} else {\n\t\t// Since paths are trimmed, we always need to add a slash\n\t\treturn `${path}/${other}` as Valid;\n\t}\n}\n\nexport function empty(): Valid {\n\treturn \"\" as Valid;\n}\n"]}
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAgCA,iGAAiG;AACjG,MAAM,UAAU,IAAI,CAAC,GAAG,KAAe;IACtC,4GAA4G;IAC5G,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC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AC;QACP,yDAAyD;QACzD,OAAO,GAAG,IAAI,IAAI,KAAK,EAAW,CAAC;IACpC,CAAC;AACF,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,KAAK;IACpB,OAAO,EAAW,CAAC;AACpB,CAAC","sourcesContent":["/**\n * A broadcast path that provides safe prefix matching operations.\n *\n * This module provides path-aware operations that respect delimiter boundaries,\n * preventing issues like \"foo\" matching \"foobar\".\n *\n * Paths are automatically trimmed of leading and trailing slashes on creation,\n * making all slashes implicit at boundaries.\n * All paths are RELATIVE; you cannot join with a leading slash to make an absolute path.\n *\n * @example\n * ```typescript\n * // Creation automatically trims slashes\n * const path1 = Path.from(\"/foo/bar/\");\n * const path2 = Path.from(\"foo/bar\");\n * console.log(path1 === path2); // true\n *\n * // Multiple arguments are joined with \"/\"\n * const path3 = Path.from(\"api\", \"v1\", \"users\");\n * console.log(path3); // \"api/v1/users\"\n *\n * // Safe prefix matching\n * const base = Path.from(\"api/v1\");\n * console.log(Path.hasPrefix(Path.from(\"api\"), base)); // true\n * console.log(Path.hasPrefix(Path.from(\"api/v1\"), base)); // true\n *\n * const joined = Path.join(base, Path.from(\"users\"));\n * console.log(joined); // \"api/v1/users\"\n * ```\n */\nexport type Valid = string & { __brand: \"Name\" };\n\n/** Build a path from one or more components, joining with \"/\" and trimming redundant slashes. */\nexport function from(...paths: string[]): Valid {\n\t// Join paths with \"/\" and then remove leading and trailing slashes, and collapse multiple slashes into one.\n\tconst joined = paths.join(\"/\");\n\treturn joined.replace(/\\/+/g, \"/\").replace(/^\\/+/, \"\").replace(/\\/+$/, \"\") as Valid;\n}\n\n/**\n * Check if a path has the given prefix, respecting path boundaries.\n *\n * Unlike String.startsWith, this ensures that \"foo\" does not match \"foobar\".\n * The prefix must either:\n * - Be exactly equal to the path\n * - Be followed by a '/' delimiter in the original path\n * - Be empty (matches everything)\n *\n * @example\n * ```typescript\n * const path = Path.from(\"foo/bar\");\n * console.log(Path.hasPrefix(Path.from(\"foo\"), path)); // true\n * console.log(Path.hasPrefix(Path.from(\"foo/\"), path)); // true (trailing slash ignored)\n * console.log(Path.hasPrefix(Path.from(\"fo\"), path)); // false\n *\n * const path2 = Path.from(\"foobar\");\n * console.log(Path.hasPrefix(Path.from(\"foo\"), path2)); // false\n * ```\n */\nexport function hasPrefix(prefix: Valid, path: Valid): boolean {\n\tif (prefix === \"\") {\n\t\treturn true;\n\t}\n\n\tif (!path.startsWith(prefix)) {\n\t\treturn false;\n\t}\n\n\t// Check if the prefix is the exact match\n\tif (path.length === prefix.length) {\n\t\treturn true;\n\t}\n\n\t// Otherwise, ensure the character after the prefix is a delimiter\n\treturn path[prefix.length] === \"/\";\n}\n\n/**\n * Strip the given prefix from a path, returning the suffix.\n *\n * Returns null if the prefix doesn't match according to hasPrefix rules.\n *\n * @example\n * ```typescript\n * const path = Path.from(\"foo/bar/baz\");\n * const suffix = Path.stripPrefix(Path.from(\"foo\"), path);\n * console.log(suffix); // \"bar/baz\"\n *\n * const suffix2 = Path.stripPrefix(Path.from(\"foo/\"), path);\n * console.log(suffix2); // \"bar/baz\"\n *\n * const noMatch = Path.stripPrefix(Path.from(\"notfound\"), path);\n * console.log(noMatch); // null\n * ```\n */\nexport function stripPrefix(prefix: Valid, path: Valid): Valid | null {\n\tif (!hasPrefix(prefix, path)) {\n\t\treturn null;\n\t}\n\n\t// Handle empty prefix case\n\tif (prefix === \"\") {\n\t\treturn path;\n\t}\n\n\t// If prefix matches exactly, return empty\n\tif (path.length === prefix.length) {\n\t\treturn \"\" as Valid;\n\t}\n\n\t// For non-empty prefix that's shorter, skip the prefix and the following slash\n\treturn path.slice(prefix.length + 1) as Valid;\n}\n\n/**\n * Join two path components together.\n *\n * @example\n * ```typescript\n * const base = Path.from(\"foo\");\n * const joined = Path.join(base, Path.from(\"bar\"));\n * console.log(joined); // \"foo/bar\"\n * ```\n */\nexport function join(path: Valid, other: Valid): Valid {\n\tif (path === \"\") {\n\t\treturn other;\n\t} else if (other === \"\") {\n\t\treturn path;\n\t} else {\n\t\t// Since paths are trimmed, we always need to add a slash\n\t\treturn `${path}/${other}` as Valid;\n\t}\n}\n\n/** The empty path, which is a prefix of every path. */\nexport function empty(): Valid {\n\treturn \"\" as Valid;\n}\n"]}
package/path.test.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./path.test.d.ts" */
1
2
  import { expect, test } from "bun:test";
2
3
  import * as Path from "./path.js";
3
4
  test("Path constructor trims leading and trailing slashes", () => {
package/stream.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IetfVersion } from "./ietf/version.ts";
1
+ import type { IetfVersion } from "./ietf/version";
2
2
  export declare class Stream {
3
3
  reader: Reader;
4
4
  writer: Writer;
package/stream.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./stream.d.ts" */
1
2
  import { Version } from "./ietf/version.js";
2
3
  import * as Varint from "./varint.js";
3
4
  const MAX_U31 = 2 ** 31 - 1;
package/stream.test.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* @ts-self-types="./stream.test.d.ts" */
1
2
  import { expect, test } from "bun:test";
2
3
  import { Reader, Writer } from "./stream.js";
3
4
  // Helper to create a writable stream that captures written data
package/time.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ /** A duration in nanoseconds, branded so it can't be mixed with other units. */
1
2
  export type Nano = number & {
2
3
  readonly _brand: "nano";
3
4
  };
5
+ /** Constructors, conversions, and arithmetic for {@link Nano} values. */
4
6
  export declare const Nano: {
5
7
  readonly zero: Nano;
6
8
  readonly fromMicro: (us: Micro) => Nano;
@@ -17,9 +19,11 @@ export declare const Nano: {
17
19
  readonly max: (a: Nano, b: Nano) => Nano;
18
20
  readonly min: (a: Nano, b: Nano) => Nano;
19
21
  };
22
+ /** A duration in microseconds, branded so it can't be mixed with other units. */
20
23
  export type Micro = number & {
21
24
  readonly _brand: "micro";
22
25
  };
26
+ /** Constructors, conversions, and arithmetic for {@link Micro} values. */
23
27
  export declare const Micro: {
24
28
  readonly zero: Micro;
25
29
  readonly fromNano: (ns: Nano) => Micro;
@@ -36,9 +40,11 @@ export declare const Micro: {
36
40
  readonly max: (a: Micro, b: Micro) => Micro;
37
41
  readonly min: (a: Micro, b: Micro) => Micro;
38
42
  };
43
+ /** A duration in milliseconds, branded so it can't be mixed with other units. */
39
44
  export type Milli = number & {
40
45
  readonly _brand: "milli";
41
46
  };
47
+ /** Constructors, conversions, and arithmetic for {@link Milli} values. */
42
48
  export declare const Milli: {
43
49
  readonly zero: Milli;
44
50
  readonly fromNano: (ns: Nano) => Milli;
@@ -55,9 +61,11 @@ export declare const Milli: {
55
61
  readonly max: (a: Milli, b: Milli) => Milli;
56
62
  readonly min: (a: Milli, b: Milli) => Milli;
57
63
  };
64
+ /** A duration in seconds, branded so it can't be mixed with other units. */
58
65
  export type Second = number & {
59
66
  readonly _brand: "second";
60
67
  };
68
+ /** Constructors, conversions, and arithmetic for {@link Second} values. */
61
69
  export declare const Second: {
62
70
  readonly zero: Second;
63
71
  readonly fromNano: (ns: Nano) => Second;
package/time.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,eAAO,MAAM,IAAI;mBACL,IAAI;6BACC,KAAK,KAAG,IAAI;6BACZ,KAAK,KAAG,IAAI;6BACZ,MAAM,KAAG,IAAI;2BACf,IAAI,KAAG,KAAK;2BACZ,IAAI,KAAG,KAAK;4BACX,IAAI,KAAG,MAAM;wBACnB,IAAI;sBACJ,IAAI,KAAK,IAAI,KAAG,IAAI;sBACpB,IAAI,KAAK,IAAI,KAAG,IAAI;sBACpB,IAAI,KAAK,MAAM,KAAG,IAAI;sBACtB,IAAI,KAAK,MAAM,KAAG,IAAI;sBACtB,IAAI,KAAK,IAAI,KAAG,IAAI;sBACpB,IAAI,KAAK,I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AAM;sBACN,MAAM,KAAK,MAAM,KAAG,MAAM;sBAC1B,MAAM,KAAK,MAAM,KAAG,MAAM;sBAC1B,MAAM,KAAK,MAAM,KAAG,MAAM;sBAC1B,MAAM,KAAK,MAAM,KAAG,MAAM;sBAC1B,MAAM,KAAK,MAAM,KAAG,MAAM;sBAC1B,MAAM,KAAK,MAAM,KAAG,MAAM;CAC1B,CAAC"}
package/time.js CHANGED
@@ -1,3 +1,5 @@
1
+ /* @ts-self-types="./time.d.ts" */
2
+ /** Constructors, conversions, and arithmetic for {@link Nano} values. */
1
3
  export const Nano = {
2
4
  zero: 0,
3
5
  fromMicro: (us) => (us * 1_000),
@@ -14,6 +16,7 @@ export const Nano = {
14
16
  max: (a, b) => Math.max(a, b),
15
17
  min: (a, b) => Math.min(a, b),
16
18
  };
19
+ /** Constructors, conversions, and arithmetic for {@link Micro} values. */
17
20
  export const Micro = {
18
21
  zero: 0,
19
22
  fromNano: (ns) => (ns / 1_000),
@@ -30,6 +33,7 @@ export const Micro = {
30
33
  max: (a, b) => Math.max(a, b),
31
34
  min: (a, b) => Math.min(a, b),
32
35
  };
36
+ /** Constructors, conversions, and arithmetic for {@link Milli} values. */
33
37
  export const Milli = {
34
38
  zero: 0,
35
39
  fromNano: (ns) => (ns / 1_000_000),
@@ -46,6 +50,7 @@ export const Milli = {
46
50
  max: (a, b) => Math.max(a, b),
47
51
  min: (a, b) => Math.min(a, b),
48
52
  };
53
+ /** Constructors, conversions, and arithmetic for {@link Second} values. */
49
54
  export const Second = {
50
55
  zero: 0,
51
56
  fromNano: (ns) => (ns / 1_000_000_000),