@waku/interfaces 0.0.21 → 0.0.23-070b625.0
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 +23 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/connection_manager.d.ts +6 -5
- package/dist/connection_manager.js +1 -0
- package/dist/connection_manager.js.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/dns_discovery.d.ts +1 -1
- package/dist/enr.d.ts +2 -2
- package/dist/filter.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/libp2p.d.ts +3 -3
- package/dist/light_push.d.ts +4 -2
- package/dist/local_storage.d.ts +4 -0
- package/dist/local_storage.js +2 -0
- package/dist/local_storage.js.map +1 -0
- package/dist/message.d.ts +1 -1
- package/dist/metadata.d.ts +8 -5
- package/dist/peer_exchange.d.ts +8 -7
- package/dist/protocols.d.ts +47 -12
- package/dist/protocols.js +17 -12
- package/dist/protocols.js.map +1 -1
- package/dist/store.d.ts +9 -5
- package/dist/store.js.map +1 -1
- package/dist/waku.d.ts +9 -10
- package/package.json +1 -66
- package/src/connection_manager.ts +6 -5
- package/src/constants.ts +5 -0
- package/src/dns_discovery.ts +1 -1
- package/src/enr.ts +2 -2
- package/src/filter.ts +3 -3
- package/src/index.ts +1 -0
- package/src/libp2p.ts +3 -3
- package/src/light_push.ts +3 -2
- package/src/local_storage.ts +4 -0
- package/src/message.ts +1 -1
- package/src/metadata.ts +14 -5
- package/src/peer_exchange.ts +9 -7
- package/src/protocols.ts +61 -12
- package/src/store.ts +15 -8
- package/src/waku.ts +9 -10
package/src/store.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import { proto_store as proto } from "@waku/proto";
|
2
|
+
|
1
3
|
import type { IDecodedMessage, IDecoder } from "./message.js";
|
2
|
-
import type {
|
4
|
+
import type { IBaseProtocolCore, IBaseProtocolSDK } from "./protocols.js";
|
3
5
|
|
4
6
|
export enum PageDirection {
|
5
7
|
BACKWARD = "backward",
|
@@ -42,10 +44,19 @@ export type StoreQueryOptions = {
|
|
42
44
|
* Cursor as an index to start a query from. Must be generated from a Waku
|
43
45
|
* Message.
|
44
46
|
*/
|
45
|
-
cursor?:
|
47
|
+
cursor?: proto.Index;
|
46
48
|
};
|
47
49
|
|
48
|
-
export
|
50
|
+
export type IStoreCore = IBaseProtocolCore;
|
51
|
+
|
52
|
+
export type IStoreSDK = IBaseProtocolSDK & {
|
53
|
+
protocol: IBaseProtocolCore;
|
54
|
+
createCursor(message: IDecodedMessage): Cursor;
|
55
|
+
queryGenerator: <T extends IDecodedMessage>(
|
56
|
+
decoders: IDecoder<T>[],
|
57
|
+
options?: StoreQueryOptions
|
58
|
+
) => AsyncGenerator<Promise<T | undefined>[]>;
|
59
|
+
|
49
60
|
queryWithOrderedCallback: <T extends IDecodedMessage>(
|
50
61
|
decoders: IDecoder<T>[],
|
51
62
|
callback: (message: T) => Promise<void | boolean> | boolean | void,
|
@@ -58,8 +69,4 @@ export interface IStore extends IBaseProtocol {
|
|
58
69
|
) => Promise<void | boolean> | boolean | void,
|
59
70
|
options?: StoreQueryOptions
|
60
71
|
) => Promise<void>;
|
61
|
-
|
62
|
-
decoders: IDecoder<T>[],
|
63
|
-
options?: StoreQueryOptions
|
64
|
-
) => AsyncGenerator<Promise<T | undefined>[]>;
|
65
|
-
}
|
72
|
+
};
|
package/src/waku.ts
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
-
import type { Stream } from "@libp2p/interface
|
2
|
-
import type { PeerId } from "@libp2p/interface/peer-id";
|
1
|
+
import type { PeerId, Stream } from "@libp2p/interface";
|
3
2
|
import type { Multiaddr } from "@multiformats/multiaddr";
|
4
3
|
|
5
4
|
import { IConnectionManager } from "./connection_manager.js";
|
6
5
|
import type { IFilter } from "./filter.js";
|
7
6
|
import type { Libp2p } from "./libp2p.js";
|
8
|
-
import type {
|
7
|
+
import type { ILightPushSDK } from "./light_push.js";
|
9
8
|
import { Protocols } from "./protocols.js";
|
10
9
|
import type { IRelay } from "./relay.js";
|
11
|
-
import type {
|
10
|
+
import type { IStoreSDK } from "./store.js";
|
12
11
|
|
13
12
|
export interface Waku {
|
14
13
|
libp2p: Libp2p;
|
15
14
|
relay?: IRelay;
|
16
|
-
store?:
|
15
|
+
store?: IStoreSDK;
|
17
16
|
filter?: IFilter;
|
18
|
-
lightPush?:
|
17
|
+
lightPush?: ILightPushSDK;
|
19
18
|
|
20
19
|
connectionManager: IConnectionManager;
|
21
20
|
|
@@ -32,9 +31,9 @@ export interface Waku {
|
|
32
31
|
|
33
32
|
export interface LightNode extends Waku {
|
34
33
|
relay: undefined;
|
35
|
-
store:
|
34
|
+
store: IStoreSDK;
|
36
35
|
filter: IFilter;
|
37
|
-
lightPush:
|
36
|
+
lightPush: ILightPushSDK;
|
38
37
|
}
|
39
38
|
|
40
39
|
export interface RelayNode extends Waku {
|
@@ -46,7 +45,7 @@ export interface RelayNode extends Waku {
|
|
46
45
|
|
47
46
|
export interface FullNode extends Waku {
|
48
47
|
relay: IRelay;
|
49
|
-
store:
|
48
|
+
store: IStoreSDK;
|
50
49
|
filter: IFilter;
|
51
|
-
lightPush:
|
50
|
+
lightPush: ILightPushSDK;
|
52
51
|
}
|