@waku/interfaces 0.0.26-ce62600.0 → 0.0.26-f387f59.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/dist/.tsbuildinfo +1 -1
- package/dist/connection_manager.d.ts +2 -0
- package/dist/connection_manager.js.map +1 -1
- package/dist/constants.d.ts +6 -4
- package/dist/constants.js +8 -4
- package/dist/constants.js.map +1 -1
- package/dist/enr.d.ts +1 -4
- package/dist/filter.d.ts +20 -3
- package/dist/health_manager.d.ts +21 -0
- package/dist/health_manager.js +7 -0
- package/dist/health_manager.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/libp2p.d.ts +5 -0
- package/dist/metadata.d.ts +4 -4
- package/dist/protocols.d.ts +33 -37
- package/dist/protocols.js +5 -0
- package/dist/protocols.js.map +1 -1
- package/dist/receiver.d.ts +3 -1
- package/dist/sharding.d.ts +10 -0
- package/dist/sharding.js +2 -0
- package/dist/sharding.js.map +1 -0
- package/dist/store.d.ts +59 -35
- package/dist/store.js +1 -5
- package/dist/store.js.map +1 -1
- package/dist/waku.d.ts +2 -0
- package/package.json +1 -1
- package/src/connection_manager.ts +3 -0
- package/src/constants.ts +11 -4
- package/src/enr.ts +2 -5
- package/src/filter.ts +28 -7
- package/src/health_manager.ts +26 -0
- package/src/index.ts +2 -0
- package/src/libp2p.ts +5 -0
- package/src/metadata.ts +4 -4
- package/src/protocols.ts +33 -39
- package/src/receiver.ts +6 -4
- package/src/sharding.ts +12 -0
- package/src/store.ts +65 -36
- package/src/waku.ts +3 -0
package/src/sharding.ts
ADDED
package/src/store.ts
CHANGED
@@ -1,72 +1,101 @@
|
|
1
|
-
import { proto_store as proto } from "@waku/proto";
|
2
|
-
|
3
1
|
import type { IDecodedMessage, IDecoder } from "./message.js";
|
4
2
|
import type { IBaseProtocolCore, IBaseProtocolSDK } from "./protocols.js";
|
5
3
|
|
6
|
-
export
|
7
|
-
BACKWARD = "backward",
|
8
|
-
FORWARD = "forward"
|
9
|
-
}
|
4
|
+
export type StoreCursor = Uint8Array;
|
10
5
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
/**
|
7
|
+
* Parameters for a store query request, as specified in the Waku Store v3 RFC.
|
8
|
+
*/
|
9
|
+
export type QueryRequestParams = {
|
10
|
+
/**
|
11
|
+
* Whether to include the full message data in the response.
|
12
|
+
* - `true`: The response will include the message content and associated pubsub topic for each matching message.
|
13
|
+
* - `false`: The response will only include the message hashes for each matching message.
|
14
|
+
* @default true
|
15
|
+
*/
|
16
|
+
includeData: boolean;
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
/**
|
19
|
+
* The pubsub topic to query. This field is mandatory.
|
20
|
+
* The query will only return messages that were published on this specific pubsub topic.
|
21
|
+
*/
|
20
22
|
pubsubTopic: string;
|
21
|
-
}
|
22
23
|
|
23
|
-
export type StoreQueryOptions = {
|
24
24
|
/**
|
25
|
-
* The
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
* Note: This does not affect the ordering of messages with the page
|
30
|
-
* (the oldest message is always first).
|
31
|
-
*
|
32
|
-
* @default { @link PageDirection.BACKWARD }
|
25
|
+
* The content topics to filter the messages.
|
26
|
+
* The query will only return messages that have a content topic included in this array.
|
27
|
+
* This field MUST be populated together with the `pubsubTopic` field for content topic filtering to be applied.
|
28
|
+
* If either `contentTopics` or `pubsubTopic` is not provided or empty, no content topic filtering will be applied.
|
33
29
|
*/
|
34
|
-
|
30
|
+
contentTopics: string[];
|
31
|
+
|
35
32
|
/**
|
36
|
-
* The
|
33
|
+
* The start time for the time range filter.
|
34
|
+
* The query will only return messages with a timestamp greater than or equal to `timeStart`.
|
35
|
+
* If not provided, no start time filtering will be applied.
|
37
36
|
*/
|
38
|
-
|
37
|
+
timeStart?: Date;
|
38
|
+
|
39
39
|
/**
|
40
|
-
*
|
40
|
+
* The end time for the time range filter.
|
41
|
+
* The query will only return messages with a timestamp strictly less than `timeEnd`.
|
42
|
+
* If not provided, no end time filtering will be applied.
|
41
43
|
*/
|
42
|
-
|
44
|
+
timeEnd?: Date;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* The message hashes to lookup.
|
48
|
+
* If provided, the query will be a message hash lookup query and will only return messages that match the specified hashes.
|
49
|
+
* If not provided or empty, the query will be a content filtered query based on the other filter parameters.
|
50
|
+
* @default undefined
|
51
|
+
*/
|
52
|
+
messageHashes?: Uint8Array[];
|
53
|
+
|
54
|
+
/**
|
55
|
+
* The cursor to start the query from.
|
56
|
+
* The cursor represents the message hash of the last message returned in the previous query.
|
57
|
+
* The query will start from the message immediately following the cursor, excluding the message at the cursor itself.
|
58
|
+
* If not provided, the query will start from the beginning or end of the store, depending on the `paginationForward` option.
|
59
|
+
* @default undefined
|
60
|
+
*/
|
61
|
+
paginationCursor?: Uint8Array;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* The direction of pagination.
|
65
|
+
* - `true`: Forward pagination, starting from the oldest message and moving towards the newest.
|
66
|
+
* - `false`: Backward pagination, starting from the newest message and moving towards the oldest.
|
67
|
+
* @default false
|
68
|
+
*/
|
69
|
+
paginationForward: boolean;
|
70
|
+
|
43
71
|
/**
|
44
|
-
*
|
45
|
-
*
|
72
|
+
* The maximum number of messages to retrieve per page.
|
73
|
+
* If not provided, the store's default pagination limit will be used.
|
74
|
+
* @default undefined
|
46
75
|
*/
|
47
|
-
|
76
|
+
paginationLimit?: number;
|
48
77
|
};
|
49
78
|
|
50
79
|
export type IStoreCore = IBaseProtocolCore;
|
51
80
|
|
52
81
|
export type IStoreSDK = IBaseProtocolSDK & {
|
53
82
|
protocol: IBaseProtocolCore;
|
54
|
-
createCursor(message: IDecodedMessage):
|
83
|
+
createCursor(message: IDecodedMessage): StoreCursor;
|
55
84
|
queryGenerator: <T extends IDecodedMessage>(
|
56
85
|
decoders: IDecoder<T>[],
|
57
|
-
options?:
|
86
|
+
options?: Partial<QueryRequestParams>
|
58
87
|
) => AsyncGenerator<Promise<T | undefined>[]>;
|
59
88
|
|
60
89
|
queryWithOrderedCallback: <T extends IDecodedMessage>(
|
61
90
|
decoders: IDecoder<T>[],
|
62
91
|
callback: (message: T) => Promise<void | boolean> | boolean | void,
|
63
|
-
options?:
|
92
|
+
options?: Partial<QueryRequestParams>
|
64
93
|
) => Promise<void>;
|
65
94
|
queryWithPromiseCallback: <T extends IDecodedMessage>(
|
66
95
|
decoders: IDecoder<T>[],
|
67
96
|
callback: (
|
68
97
|
message: Promise<T | undefined>
|
69
98
|
) => Promise<void | boolean> | boolean | void,
|
70
|
-
options?:
|
99
|
+
options?: Partial<QueryRequestParams>
|
71
100
|
) => Promise<void>;
|
72
101
|
};
|
package/src/waku.ts
CHANGED
@@ -3,6 +3,7 @@ import type { MultiaddrInput } from "@multiformats/multiaddr";
|
|
3
3
|
|
4
4
|
import { IConnectionManager } from "./connection_manager.js";
|
5
5
|
import type { IFilterSDK } from "./filter.js";
|
6
|
+
import { IHealthManager } from "./health_manager.js";
|
6
7
|
import type { Libp2p } from "./libp2p.js";
|
7
8
|
import type { ILightPushSDK } from "./light_push.js";
|
8
9
|
import { Protocols } from "./protocols.js";
|
@@ -27,6 +28,8 @@ export interface Waku {
|
|
27
28
|
isStarted(): boolean;
|
28
29
|
|
29
30
|
isConnected(): boolean;
|
31
|
+
|
32
|
+
health: IHealthManager;
|
30
33
|
}
|
31
34
|
|
32
35
|
export interface LightNode extends Waku {
|