@kronos-integration/service-swarm 2.0.5 → 3.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service-swarm",
3
- "version": "2.0.5",
3
+ "version": "3.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -21,57 +21,53 @@ export class ServiceSwarm extends Service {
21
21
  return "swarm";
22
22
  }
23
23
 
24
- static get configurationAttributes() {
25
- return mergeAttributeDefinitions(
26
- prepareAttributesDefinitions({
27
- server: {
28
- needsRestart: true,
29
- default: false,
30
- type: "boolean"
31
- },
32
- client: {
33
- needsRestart: true,
34
- default: false,
35
- type: "boolean"
36
- },
37
- dht: {
38
- description: "well known dht addresses",
39
- needsRestart: true,
40
- type: "object"
41
- },
42
- maxPeers: {
43
- description: "total amount of peers that this peer will connect to",
44
- default: 10,
45
- needsRestart: true,
46
- type: "integer"
47
- },
48
- key: {
49
- description: "topic initial key",
50
- needsRestart: true,
51
- private: true,
52
- type: "string"
53
- }
54
- }),
55
- super.configurationAttributes
56
- );
57
- }
24
+ static attributes = mergeAttributeDefinitions(
25
+ prepareAttributesDefinitions({
26
+ server: {
27
+ needsRestart: true,
28
+ default: false,
29
+ type: "boolean"
30
+ },
31
+ client: {
32
+ needsRestart: true,
33
+ default: false,
34
+ type: "boolean"
35
+ },
36
+ dht: {
37
+ description: "well known dht addresses",
38
+ needsRestart: true,
39
+ type: "object"
40
+ },
41
+ maxPeers: {
42
+ description: "total amount of peers that this peer will connect to",
43
+ default: 10,
44
+ needsRestart: true,
45
+ type: "integer"
46
+ },
47
+ key: {
48
+ description: "topic initial key",
49
+ needsRestart: true,
50
+ private: true,
51
+ type: "string"
52
+ }
53
+ }),
54
+ Service.attributes
55
+ );
58
56
 
59
- get topics()
60
- {
61
- if(!this._topics) {
62
- this._topics = new Map();
63
- }
64
- return this._topics;
57
+ get topics() {
58
+ if (!this._topics) {
59
+ this._topics = new Map();
60
+ }
61
+ return this._topics;
65
62
  }
66
63
 
67
- get topicsByName()
68
- {
69
- if(!this._topicsByName) {
70
- this._topicsByName = new Map();
64
+ get topicsByName() {
65
+ if (!this._topicsByName) {
66
+ this._topicsByName = new Map();
71
67
  }
72
68
  return this._topicsByName;
73
69
  }
74
-
70
+
75
71
  createTopic(name, options) {
76
72
  let topic = this.topicsByName.get(name);
77
73
  if (!topic) {
@@ -102,11 +98,12 @@ export class ServiceSwarm extends Service {
102
98
  }
103
99
 
104
100
  async _start() {
105
- const swarm = this.swarm = new Hyperswarm({
101
+ const swarm = (this.swarm = new Hyperswarm({
106
102
  dht: this.dht,
107
- maxPeers: this.maxPeers});
103
+ maxPeers: this.maxPeers
104
+ }));
108
105
 
109
- /*
106
+ /*
110
107
  this.discovery = swarm.join(
111
108
  topic,
112
109
  ? {