mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-16 15:03:10 +00:00
* feat: deprecate named sharding & protocols adhere simplify network config type, all protocols use pubsub topic internally * chore: update tests * tests: rm application info * chore: use static sharding and auto sharding terminologies * chore: update docs for network config * chore: update interfaces * tests: update tests error message * chore: remove `ShardingParams` type and fix test
31 lines
891 B
TypeScript
31 lines
891 B
TypeScript
import type { Multiaddr } from "@multiformats/multiaddr";
|
|
export * from "./is_defined.js";
|
|
export * from "./random_subset.js";
|
|
export * from "./group_by.js";
|
|
export * from "./to_async_iterator.js";
|
|
export * from "./is_size_valid.js";
|
|
export * from "./sharding/index.js";
|
|
export * from "./push_or_init_map.js";
|
|
export * from "./relay_shard_codec.js";
|
|
export * from "./delay.js";
|
|
|
|
export function removeItemFromArray(arr: unknown[], value: unknown): unknown[] {
|
|
const index = arr.indexOf(value);
|
|
if (index > -1) {
|
|
arr.splice(index, 1);
|
|
}
|
|
return arr;
|
|
}
|
|
|
|
export function getWsMultiaddrFromMultiaddrs(
|
|
addresses: Multiaddr[]
|
|
): Multiaddr {
|
|
const wsMultiaddr = addresses.find(
|
|
(addr) => addr.toString().includes("ws") || addr.toString().includes("wss")
|
|
);
|
|
if (!wsMultiaddr) {
|
|
throw new Error("No ws multiaddr found in the given addresses");
|
|
}
|
|
return wsMultiaddr;
|
|
}
|