@waku/interfaces 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/filter.d.ts +16 -1
- package/dist/misc.d.ts +1 -0
- package/dist/protocols.d.ts +6 -0
- package/dist/protocols.js.map +1 -1
- package/dist/receiver.d.ts +3 -2
- package/dist/waku.d.ts +4 -4
- package/package.json +1 -1
- package/src/filter.ts +30 -1
- package/src/misc.ts +2 -0
- package/src/protocols.ts +6 -0
- package/src/receiver.ts +3 -7
- package/src/waku.ts +4 -4
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The file is maintained by [Release Please](https://github.com/googleapis/release-please) based on [Conventional Commits](https://www.conventionalcommits.org) specification,
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.0.14](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.13...interfaces-v0.0.14) (2023-05-26)
|
9
|
+
|
10
|
+
|
11
|
+
### ⚠ BREAKING CHANGES
|
12
|
+
|
13
|
+
* filter v2 ([#1332](https://github.com/waku-org/js-waku/issues/1332))
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
* Filter v2 ([#1332](https://github.com/waku-org/js-waku/issues/1332)) ([8d0e647](https://github.com/waku-org/js-waku/commit/8d0e64796695fbafad0a033552eb4412bdff3d78))
|
18
|
+
|
8
19
|
## [0.0.13](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.12...interfaces-v0.0.13) (2023-05-18)
|
9
20
|
|
10
21
|
|
package/dist/filter.d.ts
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
|
+
import type { IDecodedMessage, IDecoder } from "./message.js";
|
3
|
+
import type { ContentTopic } from "./misc.js";
|
4
|
+
import type { Callback, PointToPointProtocol } from "./protocols.js";
|
2
5
|
import type { IReceiver } from "./receiver.js";
|
6
|
+
export type ContentFilter = {
|
7
|
+
contentTopic: string;
|
8
|
+
};
|
3
9
|
export type IFilter = IReceiver & PointToPointProtocol;
|
10
|
+
export interface IFilterV2Subscription {
|
11
|
+
subscribe<T extends IDecodedMessage>(decoders: IDecoder<T> | IDecoder<T>[], callback: Callback<T>): Promise<void>;
|
12
|
+
unsubscribe(contentTopics: ContentTopic[]): Promise<void>;
|
13
|
+
ping(): Promise<void>;
|
14
|
+
unsubscribeAll(): Promise<void>;
|
15
|
+
}
|
16
|
+
export type IFilterV2 = IReceiver & PointToPointProtocol & {
|
17
|
+
createSubscription(pubSubTopic?: string, peerId?: PeerId): Promise<IFilterV2Subscription>;
|
18
|
+
};
|
package/dist/misc.d.ts
CHANGED
package/dist/protocols.d.ts
CHANGED
@@ -45,6 +45,12 @@ export type ProtocolCreateOptions = {
|
|
45
45
|
* Use recommended bootstrap method to discovery and connect to new nodes.
|
46
46
|
*/
|
47
47
|
defaultBootstrap?: boolean;
|
48
|
+
/**
|
49
|
+
* FilterV2 has been set to default
|
50
|
+
* Use this flag to enable the previous version of the filter protocol
|
51
|
+
* See [Improved Filter protocol specifications](https://github.com/vacp2p/rfc/pull/562)
|
52
|
+
*/
|
53
|
+
useFilterV1?: boolean;
|
48
54
|
};
|
49
55
|
export type ProtocolOptions = {
|
50
56
|
/**
|
package/dist/protocols.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../src/protocols.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;
|
1
|
+
{"version":3,"file":"protocols.js","sourceRoot":"","sources":["../src/protocols.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AA2DD,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,2CAA8B,CAAA;IAC9B,+CAAkC,CAAA;IAClC,+CAAkC,CAAA;IAClC,6CAAgC,CAAA;IAChC,gDAAmC,CAAA;AACrC,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB"}
|
package/dist/receiver.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import type { IDecodedMessage, IDecoder } from "./message.js";
|
2
|
-
import type {
|
2
|
+
import type { IAsyncIterator, PubSubTopic, Unsubscribe } from "./misc.js";
|
3
3
|
import type { Callback, ProtocolOptions } from "./protocols.js";
|
4
|
+
type ContentTopic = string;
|
4
5
|
export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
|
5
6
|
export interface IReceiver {
|
6
7
|
toSubscriptionIterator: <T extends IDecodedMessage>(decoders: IDecoder<T> | IDecoder<T>[], opts?: ProtocolOptions) => Promise<IAsyncIterator<T>>;
|
7
8
|
subscribe: <T extends IDecodedMessage>(decoders: IDecoder<T> | IDecoder<T>[], callback: Callback<T>, opts?: ProtocolOptions) => Unsubscribe | Promise<Unsubscribe>;
|
8
|
-
getActiveSubscriptions: () => ActiveSubscriptions;
|
9
9
|
}
|
10
|
+
export {};
|
package/dist/waku.d.ts
CHANGED
@@ -2,7 +2,7 @@ import type { Stream } from "@libp2p/interface-connection";
|
|
2
2
|
import type { Libp2p } from "@libp2p/interface-libp2p";
|
3
3
|
import type { PeerId } from "@libp2p/interface-peer-id";
|
4
4
|
import type { Multiaddr } from "@multiformats/multiaddr";
|
5
|
-
import type { IFilter } from "./filter.js";
|
5
|
+
import type { IFilter, IFilterV2 } from "./filter.js";
|
6
6
|
import type { ILightPush } from "./light_push.js";
|
7
7
|
import { Protocols } from "./protocols.js";
|
8
8
|
import type { IRelay } from "./relay.js";
|
@@ -11,7 +11,7 @@ export interface Waku {
|
|
11
11
|
libp2p: Libp2p;
|
12
12
|
relay?: IRelay;
|
13
13
|
store?: IStore;
|
14
|
-
filter?: IFilter;
|
14
|
+
filter?: IFilter | IFilterV2;
|
15
15
|
lightPush?: ILightPush;
|
16
16
|
dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise<Stream>;
|
17
17
|
start(): Promise<void>;
|
@@ -21,7 +21,7 @@ export interface Waku {
|
|
21
21
|
export interface LightNode extends Waku {
|
22
22
|
relay: undefined;
|
23
23
|
store: IStore;
|
24
|
-
filter: IFilter;
|
24
|
+
filter: IFilter | IFilterV2;
|
25
25
|
lightPush: ILightPush;
|
26
26
|
}
|
27
27
|
export interface RelayNode extends Waku {
|
@@ -33,6 +33,6 @@ export interface RelayNode extends Waku {
|
|
33
33
|
export interface FullNode extends Waku {
|
34
34
|
relay: IRelay;
|
35
35
|
store: IStore;
|
36
|
-
filter: IFilter;
|
36
|
+
filter: IFilter | IFilterV2;
|
37
37
|
lightPush: ILightPush;
|
38
38
|
}
|
package/package.json
CHANGED
package/src/filter.ts
CHANGED
@@ -1,4 +1,33 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
|
+
|
3
|
+
import type { IDecodedMessage, IDecoder } from "./message.js";
|
4
|
+
import type { ContentTopic } from "./misc.js";
|
5
|
+
import type { Callback, PointToPointProtocol } from "./protocols.js";
|
2
6
|
import type { IReceiver } from "./receiver.js";
|
3
7
|
|
8
|
+
export type ContentFilter = {
|
9
|
+
contentTopic: string;
|
10
|
+
};
|
11
|
+
|
4
12
|
export type IFilter = IReceiver & PointToPointProtocol;
|
13
|
+
|
14
|
+
export interface IFilterV2Subscription {
|
15
|
+
subscribe<T extends IDecodedMessage>(
|
16
|
+
decoders: IDecoder<T> | IDecoder<T>[],
|
17
|
+
callback: Callback<T>
|
18
|
+
): Promise<void>;
|
19
|
+
|
20
|
+
unsubscribe(contentTopics: ContentTopic[]): Promise<void>;
|
21
|
+
|
22
|
+
ping(): Promise<void>;
|
23
|
+
|
24
|
+
unsubscribeAll(): Promise<void>;
|
25
|
+
}
|
26
|
+
|
27
|
+
export type IFilterV2 = IReceiver &
|
28
|
+
PointToPointProtocol & {
|
29
|
+
createSubscription(
|
30
|
+
pubSubTopic?: string,
|
31
|
+
peerId?: PeerId
|
32
|
+
): Promise<IFilterV2Subscription>;
|
33
|
+
};
|
package/src/misc.ts
CHANGED
package/src/protocols.ts
CHANGED
@@ -49,6 +49,12 @@ export type ProtocolCreateOptions = {
|
|
49
49
|
* Use recommended bootstrap method to discovery and connect to new nodes.
|
50
50
|
*/
|
51
51
|
defaultBootstrap?: boolean;
|
52
|
+
/**
|
53
|
+
* FilterV2 has been set to default
|
54
|
+
* Use this flag to enable the previous version of the filter protocol
|
55
|
+
* See [Improved Filter protocol specifications](https://github.com/vacp2p/rfc/pull/562)
|
56
|
+
*/
|
57
|
+
useFilterV1?: boolean;
|
52
58
|
};
|
53
59
|
|
54
60
|
export type ProtocolOptions = {
|
package/src/receiver.ts
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import type { IDecodedMessage, IDecoder } from "./message.js";
|
2
|
-
import type {
|
3
|
-
ContentTopic,
|
4
|
-
IAsyncIterator,
|
5
|
-
PubSubTopic,
|
6
|
-
Unsubscribe,
|
7
|
-
} from "./misc.js";
|
2
|
+
import type { IAsyncIterator, PubSubTopic, Unsubscribe } from "./misc.js";
|
8
3
|
import type { Callback, ProtocolOptions } from "./protocols.js";
|
9
4
|
|
5
|
+
type ContentTopic = string;
|
6
|
+
|
10
7
|
export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
|
11
8
|
|
12
9
|
export interface IReceiver {
|
@@ -19,5 +16,4 @@ export interface IReceiver {
|
|
19
16
|
callback: Callback<T>,
|
20
17
|
opts?: ProtocolOptions
|
21
18
|
) => Unsubscribe | Promise<Unsubscribe>;
|
22
|
-
getActiveSubscriptions: () => ActiveSubscriptions;
|
23
19
|
}
|
package/src/waku.ts
CHANGED
@@ -3,7 +3,7 @@ import type { Libp2p } from "@libp2p/interface-libp2p";
|
|
3
3
|
import type { PeerId } from "@libp2p/interface-peer-id";
|
4
4
|
import type { Multiaddr } from "@multiformats/multiaddr";
|
5
5
|
|
6
|
-
import type { IFilter } from "./filter.js";
|
6
|
+
import type { IFilter, IFilterV2 } from "./filter.js";
|
7
7
|
import type { ILightPush } from "./light_push.js";
|
8
8
|
import { Protocols } from "./protocols.js";
|
9
9
|
import type { IRelay } from "./relay.js";
|
@@ -13,7 +13,7 @@ export interface Waku {
|
|
13
13
|
libp2p: Libp2p;
|
14
14
|
relay?: IRelay;
|
15
15
|
store?: IStore;
|
16
|
-
filter?: IFilter;
|
16
|
+
filter?: IFilter | IFilterV2;
|
17
17
|
lightPush?: ILightPush;
|
18
18
|
|
19
19
|
dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise<Stream>;
|
@@ -28,7 +28,7 @@ export interface Waku {
|
|
28
28
|
export interface LightNode extends Waku {
|
29
29
|
relay: undefined;
|
30
30
|
store: IStore;
|
31
|
-
filter: IFilter;
|
31
|
+
filter: IFilter | IFilterV2;
|
32
32
|
lightPush: ILightPush;
|
33
33
|
}
|
34
34
|
|
@@ -42,6 +42,6 @@ export interface RelayNode extends Waku {
|
|
42
42
|
export interface FullNode extends Waku {
|
43
43
|
relay: IRelay;
|
44
44
|
store: IStore;
|
45
|
-
filter: IFilter;
|
45
|
+
filter: IFilter | IFilterV2;
|
46
46
|
lightPush: ILightPush;
|
47
47
|
}
|