@waku/interfaces 0.0.13 → 0.0.15
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 +18 -0
- package/dist/connection_manager.d.ts +4 -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 +3 -3
- package/src/connection_manager.ts +4 -0
- 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,24 @@ 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.15](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.14...interfaces-v0.0.15) (2023-06-08)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* Allow passing of multiple ENR URLs to DNS Discovery & dial multiple peers in parallel ([#1379](https://github.com/waku-org/js-waku/issues/1379)) ([f32d7d9](https://github.com/waku-org/js-waku/commit/f32d7d9fe0b930b4fa9c46b8644e6d21be45d5c1))
|
14
|
+
|
15
|
+
## [0.0.14](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.13...interfaces-v0.0.14) (2023-05-26)
|
16
|
+
|
17
|
+
|
18
|
+
### ⚠ BREAKING CHANGES
|
19
|
+
|
20
|
+
* filter v2 ([#1332](https://github.com/waku-org/js-waku/issues/1332))
|
21
|
+
|
22
|
+
### Features
|
23
|
+
|
24
|
+
* Filter v2 ([#1332](https://github.com/waku-org/js-waku/issues/1332)) ([8d0e647](https://github.com/waku-org/js-waku/commit/8d0e64796695fbafad0a033552eb4412bdff3d78))
|
25
|
+
|
8
26
|
## [0.0.13](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.12...interfaces-v0.0.13) (2023-05-18)
|
9
27
|
|
10
28
|
|
@@ -13,4 +13,8 @@ export interface ConnectionManagerOptions {
|
|
13
13
|
* This is used to increase intention of dialing non-bootstrap peers, found using other discovery mechanisms (like Peer Exchange)
|
14
14
|
*/
|
15
15
|
maxBootstrapPeersAllowed: number;
|
16
|
+
/**
|
17
|
+
* Max number of parallel dials allowed
|
18
|
+
*/
|
19
|
+
maxParallelDials: number;
|
16
20
|
}
|
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
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@waku/interfaces",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.15",
|
4
4
|
"description": "Definition of Waku interfaces",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"module": "./dist/index.js",
|
@@ -57,9 +57,9 @@
|
|
57
57
|
"@libp2p/interface-registrar": "^2.0.8",
|
58
58
|
"@multiformats/multiaddr": "^12.0.0",
|
59
59
|
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
60
|
-
"@typescript-eslint/parser": "^5.
|
60
|
+
"@typescript-eslint/parser": "^5.59.8",
|
61
61
|
"cspell": "^6.31.1",
|
62
|
-
"eslint": "^8.
|
62
|
+
"eslint": "^8.41.0",
|
63
63
|
"eslint-config-prettier": "^8.6.0",
|
64
64
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
65
65
|
"eslint-plugin-functional": "^5.0.4",
|
@@ -14,4 +14,8 @@ export interface ConnectionManagerOptions {
|
|
14
14
|
* This is used to increase intention of dialing non-bootstrap peers, found using other discovery mechanisms (like Peer Exchange)
|
15
15
|
*/
|
16
16
|
maxBootstrapPeersAllowed: number;
|
17
|
+
/**
|
18
|
+
* Max number of parallel dials allowed
|
19
|
+
*/
|
20
|
+
maxParallelDials: number;
|
17
21
|
}
|
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
|
}
|