Skip to content

Commit e2e498d

Browse files
remove instances of PubSub namespace
1 parent 678635e commit e2e498d

File tree

17 files changed

+59
-59
lines changed

17 files changed

+59
-59
lines changed

.cspell.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"Привет",
124124
"مرحبا"
125125
],
126-
"flagWords": ["pubSub", "pubSubTopics", "pubSubTopic"],
126+
"flagWords": ["pubSub", "pubSubTopics", "pubSubTopic", "PubSub", "PubSubTopics", "PubSubTopic"],
127127
"ignorePaths": [
128128
"package.json",
129129
"package-lock.json",

packages/core/src/lib/connection_manager.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
IRelay,
1313
KeepAliveOptions,
1414
PeersByDiscoveryResult,
15-
PubSubTopic,
15+
PubsubTopic,
1616
ShardInfo
1717
} from "@waku/interfaces";
1818
import { Libp2p, Tags } from "@waku/interfaces";
@@ -45,7 +45,7 @@ export class ConnectionManager
4545
peerId: string,
4646
libp2p: Libp2p,
4747
keepAliveOptions: KeepAliveOptions,
48-
pubsubTopics: PubSubTopic[],
48+
pubsubTopics: PubsubTopic[],
4949
relay?: IRelay,
5050
options?: ConnectionManagerOptions
5151
): ConnectionManager {
@@ -111,7 +111,7 @@ export class ConnectionManager
111111
private constructor(
112112
libp2p: Libp2p,
113113
keepAliveOptions: KeepAliveOptions,
114-
private configuredPubSubTopics: PubSubTopic[],
114+
private configuredPubSubTopics: PubsubTopic[],
115115
relay?: IRelay,
116116
options?: Partial<ConnectionManagerOptions>
117117
) {

packages/core/src/lib/filter/index.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {
1313
Libp2p,
1414
PeerIdStr,
1515
ProtocolCreateOptions,
16-
PubSubTopic,
16+
PubsubTopic,
1717
Unsubscribe
1818
} from "@waku/interfaces";
1919
import { WakuMessage } from "@waku/proto";
@@ -50,7 +50,7 @@ export const FilterCodecs = {
5050

5151
class Subscription {
5252
private readonly peer: Peer;
53-
private readonly pubsubTopic: PubSubTopic;
53+
private readonly pubsubTopic: PubsubTopic;
5454
private newStream: (peer: Peer) => Promise<Stream>;
5555

5656
private subscriptionCallbacks: Map<
@@ -59,7 +59,7 @@ class Subscription {
5959
>;
6060

6161
constructor(
62-
pubsubTopic: PubSubTopic,
62+
pubsubTopic: PubsubTopic,
6363
remotePeer: Peer,
6464
newStream: (peer: Peer) => Promise<Stream>
6565
) {
@@ -256,19 +256,19 @@ class Subscription {
256256
}
257257

258258
class Filter extends BaseProtocol implements IReceiver {
259-
private readonly pubsubTopics: PubSubTopic[] = [];
259+
private readonly pubsubTopics: PubsubTopic[] = [];
260260
private activeSubscriptions = new Map<string, Subscription>();
261261
private readonly NUM_PEERS_PROTOCOL = 1;
262262

263263
private getActiveSubscription(
264-
pubsubTopic: PubSubTopic,
264+
pubsubTopic: PubsubTopic,
265265
peerIdStr: PeerIdStr
266266
): Subscription | undefined {
267267
return this.activeSubscriptions.get(`${pubsubTopic}_${peerIdStr}`);
268268
}
269269

270270
private setActiveSubscription(
271-
pubsubTopic: PubSubTopic,
271+
pubsubTopic: PubsubTopic,
272272
peerIdStr: PeerIdStr,
273273
subscription: Subscription
274274
): Subscription {
@@ -367,7 +367,7 @@ class Filter extends BaseProtocol implements IReceiver {
367367
}
368368

369369
if (!pubsubTopic) {
370-
log.error("PubSub topic missing from push message");
370+
log.error("Pubsub topic missing from push message");
371371
return;
372372
}
373373

@@ -408,7 +408,7 @@ export function wakuFilter(
408408

409409
async function pushMessage<T extends IDecodedMessage>(
410410
subscriptionCallback: SubscriptionCallback<T>,
411-
pubsubTopic: PubSubTopic,
411+
pubsubTopic: PubsubTopic,
412412
message: WakuMessage
413413
): Promise<void> {
414414
const { decoders, callback } = subscriptionCallback;

packages/core/src/lib/keep_alive_manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class KeepAliveManager {
116116
relayPeriodSecs: number,
117117
peerIdStr: PeerIdStr
118118
): NodeJS.Timeout[] {
119-
// send a ping message to each PubSubTopic the peer is part of
119+
// send a ping message to each PubsubTopic the peer is part of
120120
const intervals: NodeJS.Timeout[] = [];
121121
for (const topic of relay.pubsubTopics) {
122122
const meshPeers = relay.getMeshPeers(topic);

packages/core/src/lib/light_push/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
IMessage,
77
Libp2p,
88
ProtocolCreateOptions,
9-
PubSubTopic,
9+
PubsubTopic,
1010
SendError,
1111
SendResult
1212
} from "@waku/interfaces";
@@ -45,7 +45,7 @@ type PreparePushMessageResult =
4545
* Implements the [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).
4646
*/
4747
class LightPush extends BaseProtocol implements ILightPush {
48-
private readonly pubsubTopics: PubSubTopic[];
48+
private readonly pubsubTopics: PubsubTopic[];
4949
private readonly NUM_PEERS_PROTOCOL = 1;
5050

5151
constructor(libp2p: Libp2p, options?: ProtocolCreateOptions) {

packages/core/src/lib/message/version_0.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
IMetaSetter,
88
IProtoMessage,
99
IRateLimitProof,
10-
PubSubTopic
10+
PubsubTopic
1111
} from "@waku/interfaces";
1212
import { proto_message as proto } from "@waku/proto";
1313
import { Logger } from "@waku/utils";
@@ -76,7 +76,7 @@ export class Encoder implements IEncoder {
7676
constructor(
7777
public contentTopic: string,
7878
public ephemeral: boolean = false,
79-
public pubsubTopic: PubSubTopic,
79+
public pubsubTopic: PubsubTopic,
8080
public metaSetter?: IMetaSetter
8181
) {
8282
if (!contentTopic || contentTopic === "") {
@@ -129,7 +129,7 @@ export function createEncoder({
129129

130130
export class Decoder implements IDecoder<DecodedMessage> {
131131
constructor(
132-
public pubsubTopic: PubSubTopic,
132+
public pubsubTopic: PubsubTopic,
133133
public contentTopic: string
134134
) {
135135
if (!contentTopic || contentTopic === "") {
@@ -182,7 +182,7 @@ export class Decoder implements IDecoder<DecodedMessage> {
182182
*/
183183
export function createDecoder(
184184
contentTopic: string,
185-
pubsubTopic: PubSubTopic = DefaultPubSubTopic
185+
pubsubTopic: PubsubTopic = DefaultPubSubTopic
186186
): Decoder {
187187
return new Decoder(pubsubTopic, contentTopic);
188188
}

packages/core/src/lib/store/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
IStore,
88
Libp2p,
99
ProtocolCreateOptions,
10-
PubSubTopic
10+
PubsubTopic
1111
} from "@waku/interfaces";
1212
import { proto_store as proto } from "@waku/proto";
1313
import { ensurePubsubTopicIsConfigured, isDefined } from "@waku/utils";
@@ -75,7 +75,7 @@ export interface QueryOptions {
7575
* The Waku Store protocol can be used to retrieved historical messages.
7676
*/
7777
class Store extends BaseProtocol implements IStore {
78-
private readonly pubsubTopics: PubSubTopic[];
78+
private readonly pubsubTopics: PubsubTopic[];
7979
private readonly NUM_PEERS_PROTOCOL = 1;
8080

8181
constructor(libp2p: Libp2p, options?: ProtocolCreateOptions) {

packages/core/src/lib/waku.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
IRelay,
88
IStore,
99
Libp2p,
10-
PubSubTopic,
10+
PubsubTopic,
1111
Waku
1212
} from "@waku/interfaces";
1313
import { Protocols } from "@waku/interfaces";
@@ -53,7 +53,7 @@ export class WakuNode implements Waku {
5353

5454
constructor(
5555
options: WakuOptions,
56-
public readonly pubsubTopics: PubSubTopic[],
56+
public readonly pubsubTopics: PubsubTopic[],
5757
libp2p: Libp2p,
5858
store?: (libp2p: Libp2p) => IStore,
5959
lightPush?: (libp2p: Libp2p) => ILightPush,

packages/interfaces/src/message.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PubSubTopic } from "./misc.js";
1+
import type { PubsubTopic } from "./misc.js";
22

33
export interface IRateLimitProof {
44
proof: Uint8Array;
@@ -38,7 +38,7 @@ export interface IMetaSetter {
3838
}
3939

4040
export interface EncoderOptions {
41-
pubsubTopic?: PubSubTopic;
41+
pubsubTopic?: PubsubTopic;
4242
/** The content topic to set on outgoing messages. */
4343
contentTopic: string;
4444
/**
@@ -55,7 +55,7 @@ export interface EncoderOptions {
5555
}
5656

5757
export interface IEncoder {
58-
pubsubTopic: PubSubTopic;
58+
pubsubTopic: PubsubTopic;
5959
contentTopic: string;
6060
ephemeral: boolean;
6161
toWire: (message: IMessage) => Promise<Uint8Array | undefined>;
@@ -65,15 +65,15 @@ export interface IEncoder {
6565
export interface IDecodedMessage {
6666
payload: Uint8Array;
6767
contentTopic: string;
68-
pubsubTopic: PubSubTopic;
68+
pubsubTopic: PubsubTopic;
6969
timestamp: Date | undefined;
7070
rateLimitProof: IRateLimitProof | undefined;
7171
ephemeral: boolean | undefined;
7272
meta: Uint8Array | undefined;
7373
}
7474

7575
export interface IDecoder<T extends IDecodedMessage> {
76-
pubsubTopic: PubSubTopic;
76+
pubsubTopic: PubsubTopic;
7777
contentTopic: string;
7878
fromWireToProtoObj: (bytes: Uint8Array) => Promise<IProtoMessage | undefined>;
7979
fromProtoObj: (

packages/interfaces/src/misc.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface IAsyncIterator<T extends IDecodedMessage> {
77

88
export type Unsubscribe = () => void | Promise<void>;
99

10-
export type PubSubTopic = string;
10+
export type PubsubTopic = string;
1111
export type ContentTopic = string;
1212

1313
export type PeerIdStr = string;

packages/interfaces/src/protocols.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Peer, PeerStore } from "@libp2p/interface/peer-store";
44
import type { Libp2pOptions } from "libp2p";
55

66
import type { IDecodedMessage } from "./message.js";
7-
import type { PubSubTopic } from "./misc.js";
7+
import type { PubsubTopic } from "./misc.js";
88

99
export enum Protocols {
1010
Relay = "relay",
@@ -27,7 +27,7 @@ export type ProtocolCreateOptions = {
2727
* Waku implements sharding to achieve scalability
2828
* The format of the sharded topic is `/waku/2/rs/<shard_cluster_index>/<shard_number>`
2929
* To learn more about the sharding specifications implemented, see [Relay Sharding](https://rfc.vac.dev/spec/51/).
30-
* The PubSub Topic to use. Defaults to {@link @waku/core!DefaultPubSubTopic }.
30+
* The Pubsub Topic to use. Defaults to {@link @waku/core!DefaultPubSubTopic }.
3131
*
3232
* If no pubsub topic is specified, the default pubsub topic is used.
3333
* The set of pubsub topics that are used to initialize the Waku node, will need to be used by the protocols as well
@@ -39,7 +39,7 @@ export type ProtocolCreateOptions = {
3939
* See [Waku v2 Topic Usage Recommendations](https://rfc.vac.dev/spec/23/) for details.
4040
*
4141
*/
42-
pubsubTopics?: PubSubTopic[];
42+
pubsubTopics?: PubsubTopic[];
4343
/**
4444
* You can pass options to the `Libp2p` instance used by {@link @waku/core!WakuNode} using the `libp2p` property.
4545
* This property is the same type as the one passed to [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
@@ -88,8 +88,8 @@ export enum SendError {
8888
*/
8989
SIZE_TOO_BIG = "Size is too big",
9090
/**
91-
* The PubSubTopic passed to the send function is not configured on the Waku node.
92-
* Please ensure that the PubSubTopic is used when initializing the Waku node.
91+
* The PubsubTopic passed to the send function is not configured on the Waku node.
92+
* Please ensure that the PubsubTopic is used when initializing the Waku node.
9393
*/
9494
TOPIC_NOT_CONFIGURED = "Topic not configured",
9595
/**

packages/interfaces/src/receiver.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import type { IDecodedMessage, IDecoder } from "./message.js";
22
import type {
33
ContentTopic,
44
IAsyncIterator,
5-
PubSubTopic,
5+
PubsubTopic,
66
Unsubscribe
77
} from "./misc.js";
88
import type { Callback } from "./protocols.js";
99

10-
export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
10+
export type ActiveSubscriptions = Map<PubsubTopic, ContentTopic[]>;
1111

1212
export interface IReceiver {
1313
toSubscriptionIterator: <T extends IDecodedMessage>(

packages/interfaces/src/relay.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
22
import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types";
33

4-
import { PubSubTopic } from "./misc.js";
5-
import { IReceiver } from "./receiver.js";
4+
import type { PubsubTopic } from "./misc.js";
5+
import type { IReceiver } from "./receiver.js";
66
import type { ISender } from "./sender.js";
77

88
/**
@@ -13,7 +13,7 @@ import type { ISender } from "./sender.js";
1313
* @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.
1414
*/
1515
export interface IRelayAPI {
16-
readonly pubsubTopics: Set<PubSubTopic>;
16+
readonly pubsubTopics: Set<PubsubTopic>;
1717
readonly gossipSub: GossipSub;
1818
start: () => Promise<void>;
1919
getMeshPeers: (topic?: TopicStr) => PeerIdStr[];

packages/message-encryption/src/ecies.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DefaultPubSubTopic } from "@waku/core";
22
import { Decoder as DecoderV0 } from "@waku/core/lib/message/version_0";
3-
import { IMetaSetter, PubSubTopic } from "@waku/interfaces";
3+
import { IMetaSetter, PubsubTopic } from "@waku/interfaces";
44
import type {
55
EncoderOptions as BaseEncoderOptions,
66
IDecoder,
@@ -33,7 +33,7 @@ const log = new Logger("message-encryption:ecies");
3333

3434
class Encoder implements IEncoder {
3535
constructor(
36-
public pubsubTopic: PubSubTopic,
36+
public pubsubTopic: PubsubTopic,
3737
public contentTopic: string,
3838
private publicKey: Uint8Array,
3939
private sigPrivKey?: Uint8Array,
@@ -116,7 +116,7 @@ export function createEncoder({
116116

117117
class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
118118
constructor(
119-
pubsubTopic: PubSubTopic,
119+
pubsubTopic: PubsubTopic,
120120
contentTopic: string,
121121
private privateKey: Uint8Array
122122
) {
@@ -193,7 +193,7 @@ class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
193193
export function createDecoder(
194194
contentTopic: string,
195195
privateKey: Uint8Array,
196-
pubsubTopic: PubSubTopic = DefaultPubSubTopic
196+
pubsubTopic: PubsubTopic = DefaultPubSubTopic
197197
): Decoder {
198198
return new Decoder(pubsubTopic, contentTopic, privateKey);
199199
}

packages/message-encryption/src/symmetric.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
IMessage,
88
IMetaSetter,
99
IProtoMessage,
10-
PubSubTopic
10+
PubsubTopic
1111
} from "@waku/interfaces";
1212
import { WakuMessage } from "@waku/proto";
1313
import { Logger } from "@waku/utils";
@@ -29,7 +29,7 @@ const log = new Logger("message-encryption:symmetric");
2929

3030
class Encoder implements IEncoder {
3131
constructor(
32-
public pubsubTopic: PubSubTopic,
32+
public pubsubTopic: PubsubTopic,
3333
public contentTopic: string,
3434
private symKey: Uint8Array,
3535
private sigPrivKey?: Uint8Array,
@@ -112,7 +112,7 @@ export function createEncoder({
112112

113113
class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
114114
constructor(
115-
pubsubTopic: PubSubTopic,
115+
pubsubTopic: PubsubTopic,
116116
contentTopic: string,
117117
private symKey: Uint8Array
118118
) {
@@ -189,7 +189,7 @@ class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
189189
export function createDecoder(
190190
contentTopic: string,
191191
symKey: Uint8Array,
192-
pubsubTopic: PubSubTopic = DefaultPubSubTopic
192+
pubsubTopic: PubsubTopic = DefaultPubSubTopic
193193
): Decoder {
194194
return new Decoder(pubsubTopic, contentTopic, symKey);
195195
}

0 commit comments

Comments
 (0)