@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/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 { IBaseProtocol } from "./protocols.js";
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?: Cursor;
47
+ cursor?: proto.Index;
46
48
  };
47
49
 
48
- export interface IStore extends IBaseProtocol {
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
- queryGenerator: <T extends IDecodedMessage>(
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/connection";
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 { ILightPush } from "./light_push.js";
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 { IStore } from "./store.js";
10
+ import type { IStoreSDK } from "./store.js";
12
11
 
13
12
  export interface Waku {
14
13
  libp2p: Libp2p;
15
14
  relay?: IRelay;
16
- store?: IStore;
15
+ store?: IStoreSDK;
17
16
  filter?: IFilter;
18
- lightPush?: ILightPush;
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: IStore;
34
+ store: IStoreSDK;
36
35
  filter: IFilter;
37
- lightPush: ILightPush;
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: IStore;
48
+ store: IStoreSDK;
50
49
  filter: IFilter;
51
- lightPush: ILightPush;
50
+ lightPush: ILightPushSDK;
52
51
  }