mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-03-22 06:43:14 +00:00
* rename all PubSub patterns * feat: forbid identifiers with camelcase pubSub (#1709) --------- Co-authored-by: Arseniy Klempner <adklempner@gmail.com>
21 lines
665 B
TypeScript
21 lines
665 B
TypeScript
import type { PubsubTopic, ShardInfo } from "@waku/interfaces";
|
|
|
|
export const shardInfoToPubsubTopics = (
|
|
shardInfo: ShardInfo
|
|
): PubsubTopic[] => {
|
|
return shardInfo.indexList.map(
|
|
(index) => `/waku/2/rs/${shardInfo.cluster}/${index}`
|
|
);
|
|
};
|
|
|
|
export function ensurePubsubTopicIsConfigured(
|
|
pubsubTopic: PubsubTopic,
|
|
configuredTopics: PubsubTopic[]
|
|
): void {
|
|
if (!configuredTopics.includes(pubsubTopic)) {
|
|
throw new Error(
|
|
`Pubsub topic ${pubsubTopic} has not been configured on this instance. Configured topics are: ${configuredTopics}. Please update your configuration by passing in the topic during Waku node instantiation.`
|
|
);
|
|
}
|
|
}
|