Skip to content

Commit d483644

Browse files
chore!: remove filter v1 (#1433)
* rm: v1 * fix v2 imports * remove tests for filter v1 * set filter v1 as default and rm v2 completely * change import name for filter v2 * rename FilterV2 to Filter completely * fix run check
1 parent 92bb35a commit d483644

16 files changed

+38
-620
lines changed

.cspell.json

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
"exponentiate",
4040
"extip",
4141
"fanout",
42-
"Filterv1",
43-
"Filterv2",
4442
"floodsub",
4543
"fontsource",
4644
"globby",

.size-limit.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = [
3535
{
3636
name: "Light protocols",
3737
path: "packages/core/bundle/index.js",
38-
import: "{ wakuLightPush, wakuFilterV1, wakuFilterV2 }",
38+
import: "{ wakuLightPush, wakuFilter }",
3939
},
4040
{
4141
name: "History retrieval protocols",

packages/core/src/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ export * as message from "./lib/message/index.js";
1111
export * as waku from "./lib/waku.js";
1212
export { WakuNode, WakuOptions } from "./lib/waku.js";
1313

14-
export * as waku_filter_v1 from "./lib/filter/v1/index.js";
15-
export { wakuFilter as wakuFilterV1 } from "./lib/filter/v1/index.js";
16-
17-
export * as waku_filter_v2 from "./lib/filter/v2/index.js";
18-
export { wakuFilterV2 } from "./lib/filter/v2/index.js";
14+
export * as waku_filter from "./lib/filter/index.js";
15+
export { wakuFilter } from "./lib/filter/index.js";
1916

2017
export * as waku_light_push from "./lib/light_push/index.js";
2118
export { wakuLightPush, LightPushCodec } from "./lib/light_push/index.js";

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
IAsyncIterator,
99
IDecodedMessage,
1010
IDecoder,
11-
IFilterV2,
11+
IFilter,
1212
IProtoMessage,
1313
IReceiver,
1414
Libp2p,
@@ -25,8 +25,8 @@ import all from "it-all";
2525
import * as lp from "it-length-prefixed";
2626
import { pipe } from "it-pipe";
2727

28-
import { BaseProtocol } from "../../base_protocol.js";
29-
import { DefaultPubSubTopic } from "../../constants.js";
28+
import { BaseProtocol } from "../base_protocol.js";
29+
import { DefaultPubSubTopic } from "../constants.js";
3030

3131
import {
3232
FilterPushRpc,
@@ -41,7 +41,7 @@ type SubscriptionCallback<T extends IDecodedMessage> = {
4141
callback: Callback<T>;
4242
};
4343

44-
const FilterV2Codecs = {
44+
const FilterCodecs = {
4545
SUBSCRIBE: "/vac/waku/filter-subscribe/2.0.0-beta1",
4646
PUSH: "/vac/waku/filter-push/2.0.0-beta1",
4747
};
@@ -225,7 +225,7 @@ class Subscription {
225225
}
226226
}
227227

228-
class FilterV2 extends BaseProtocol implements IReceiver {
228+
class Filter extends BaseProtocol implements IReceiver {
229229
private readonly options: ProtocolCreateOptions;
230230
private activeSubscriptions = new Map<string, Subscription>();
231231

@@ -246,10 +246,10 @@ class FilterV2 extends BaseProtocol implements IReceiver {
246246
}
247247

248248
constructor(libp2p: Libp2p, options?: ProtocolCreateOptions) {
249-
super(FilterV2Codecs.SUBSCRIBE, libp2p.components);
249+
super(FilterCodecs.SUBSCRIBE, libp2p.components);
250250

251-
libp2p.handle(FilterV2Codecs.PUSH, this.onRequest.bind(this)).catch((e) => {
252-
log("Failed to register ", FilterV2Codecs.PUSH, e);
251+
libp2p.handle(FilterCodecs.PUSH, this.onRequest.bind(this)).catch((e) => {
252+
log("Failed to register ", FilterCodecs.PUSH, e);
253253
});
254254

255255
this.activeSubscriptions = new Map();
@@ -365,10 +365,10 @@ class FilterV2 extends BaseProtocol implements IReceiver {
365365
}
366366
}
367367

368-
export function wakuFilterV2(
368+
export function wakuFilter(
369369
init: Partial<ProtocolCreateOptions> = {}
370-
): (libp2p: Libp2p) => IFilterV2 {
371-
return (libp2p: Libp2p) => new FilterV2(libp2p, init);
370+
): (libp2p: Libp2p) => IFilter {
371+
return (libp2p: Libp2p) => new Filter(libp2p, init);
372372
}
373373

374374
async function pushMessage<T extends IDecodedMessage>(

packages/core/src/lib/filter/v1/filter_rpc.ts

-53
This file was deleted.

0 commit comments

Comments
 (0)