diff --git a/packages/interfaces/src/relay.ts b/packages/interfaces/src/relay.ts index 5683b13b44..71c3b9b9c1 100644 --- a/packages/interfaces/src/relay.ts +++ b/packages/interfaces/src/relay.ts @@ -4,6 +4,13 @@ import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types"; import { IReceiver } from "./receiver.js"; import type { ISender } from "./sender.js"; +/** + * Interface representing the Relay API, providing control and information about the GossipSub protocol. + * + * @property gossipSub - The GossipSub instance used for managing pub/sub behavior. + * @property start - Function to start the relay, returning a Promise that resolves when initialization is complete. + * @property getMeshPeers - Function to retrieve the mesh peers for a given topic or all topics if none is specified. Returns an array of peer IDs as strings. + */ interface IRelayAPI { readonly gossipSub: GossipSub; start: () => Promise; diff --git a/packages/utils/src/common/to_async_iterator.ts b/packages/utils/src/common/to_async_iterator.ts index 77d9c60c27..cc6241673b 100644 --- a/packages/utils/src/common/to_async_iterator.ts +++ b/packages/utils/src/common/to_async_iterator.ts @@ -7,6 +7,12 @@ import type { Unsubscribe, } from "@waku/interfaces"; +/** + * Options for configuring the behavior of an iterator. + * + * @property timeoutMs - Optional timeout in milliseconds. If specified, the iterator will terminate after this time period. + * @property iteratorDelay - Optional delay in milliseconds between each iteration. Can be used to control the rate of iteration. + */ type IteratorOptions = { timeoutMs?: number; iteratorDelay?: number;