@waku/interfaces 0.0.11 → 0.0.12

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 CHANGED
@@ -5,6 +5,13 @@ 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.12](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.11...interfaces-v0.0.12) (2023-05-09)
9
+
10
+
11
+ ### Features
12
+
13
+ * ToSubscriptionIterator impl for IReceiver ([#1307](https://github.com/waku-org/js-waku/issues/1307)) ([7daa9d0](https://github.com/waku-org/js-waku/commit/7daa9d05bf44b33296b56df214f5d5901887a129))
14
+
8
15
  ## [0.0.11](https://github.com/waku-org/js-waku/compare/interfaces-v0.0.10...interfaces-v0.0.11) (2023-04-03)
9
16
 
10
17
 
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from "./waku.js";
10
10
  export * from "./connection_manager.js";
11
11
  export * from "./sender.js";
12
12
  export * from "./receiver.js";
13
+ export * from "./misc.js";
package/dist/index.js CHANGED
@@ -10,4 +10,5 @@ export * from "./waku.js";
10
10
  export * from "./connection_manager.js";
11
11
  export * from "./sender.js";
12
12
  export * from "./receiver.js";
13
+ export * from "./misc.js";
13
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
package/dist/misc.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type { IDecodedMessage } from "./message.js";
2
+ export interface IAsyncIterator<T extends IDecodedMessage> {
3
+ iterator: AsyncIterator<T>;
4
+ stop: Unsubscribe;
5
+ }
6
+ export type Unsubscribe = () => void | Promise<void>;
7
+ export type PubSubTopic = string;
8
+ export type ContentTopic = string;
package/dist/misc.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"misc.js","sourceRoot":"","sources":["../src/misc.ts"],"names":[],"mappings":""}
@@ -1,11 +1,9 @@
1
1
  import type { IDecodedMessage, IDecoder } from "./message.js";
2
+ import type { ContentTopic, IAsyncIterator, PubSubTopic, Unsubscribe } from "./misc.js";
2
3
  import type { Callback, ProtocolOptions } from "./protocols.js";
3
- type Unsubscribe = () => void | Promise<void>;
4
- type PubSubTopic = string;
5
- type ContentTopic = string;
6
4
  export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
7
5
  export interface IReceiver {
6
+ toSubscriptionIterator: <T extends IDecodedMessage>(decoders: IDecoder<T> | IDecoder<T>[], opts?: ProtocolOptions) => Promise<IAsyncIterator<T>>;
8
7
  subscribe: <T extends IDecodedMessage>(decoders: IDecoder<T> | IDecoder<T>[], callback: Callback<T>, opts?: ProtocolOptions) => Unsubscribe | Promise<Unsubscribe>;
9
8
  getActiveSubscriptions: () => ActiveSubscriptions;
10
9
  }
11
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waku/interfaces",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Definition of Waku interfaces",
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -35,11 +35,9 @@
35
35
  "build": "run-s build:**",
36
36
  "build:esm": "tsc",
37
37
  "fix": "run-s fix:*",
38
- "fix:prettier": "prettier . --write",
39
38
  "fix:lint": "eslint src --fix",
40
39
  "check": "run-s check:*",
41
40
  "check:lint": "eslint src",
42
- "check:prettier": "prettier . --list-different",
43
41
  "check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
44
42
  "check:tsc": "tsc -p tsconfig.dev.json",
45
43
  "prepublish": "npm run build",
@@ -68,7 +66,7 @@
68
66
  "eslint-plugin-import": "^2.27.5",
69
67
  "eslint-plugin-prettier": "^4.2.1",
70
68
  "npm-run-all": "^4.1.5",
71
- "prettier": "^2.8.4",
69
+ "prettier": "^2.8.8",
72
70
  "typescript": "^4.9.5"
73
71
  },
74
72
  "typedoc": {
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from "./waku.js";
10
10
  export * from "./connection_manager.js";
11
11
  export * from "./sender.js";
12
12
  export * from "./receiver.js";
13
+ export * from "./misc.js";
package/src/misc.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { IDecodedMessage } from "./message.js";
2
+
3
+ export interface IAsyncIterator<T extends IDecodedMessage> {
4
+ iterator: AsyncIterator<T>;
5
+ stop: Unsubscribe;
6
+ }
7
+
8
+ export type Unsubscribe = () => void | Promise<void>;
9
+
10
+ export type PubSubTopic = string;
11
+ export type ContentTopic = string;
package/src/receiver.ts CHANGED
@@ -1,13 +1,19 @@
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
8
  import type { Callback, ProtocolOptions } from "./protocols.js";
3
9
 
4
- type Unsubscribe = () => void | Promise<void>;
5
- type PubSubTopic = string;
6
- type ContentTopic = string;
7
-
8
10
  export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
9
11
 
10
12
  export interface IReceiver {
13
+ toSubscriptionIterator: <T extends IDecodedMessage>(
14
+ decoders: IDecoder<T> | IDecoder<T>[],
15
+ opts?: ProtocolOptions
16
+ ) => Promise<IAsyncIterator<T>>;
11
17
  subscribe: <T extends IDecodedMessage>(
12
18
  decoders: IDecoder<T> | IDecoder<T>[],
13
19
  callback: Callback<T>,