@toa.io/extensions.exposition 0.2.1-dev.3 → 0.2.1-dev.4

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": "@toa.io/extensions.exposition",
3
- "version": "0.2.1-dev.3",
3
+ "version": "0.2.1-dev.4",
4
4
  "description": "Toa Resources Exposition",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
package/src/exposition.js CHANGED
@@ -4,7 +4,7 @@ const { Connector } = require('@toa.io/core')
4
4
  const { console } = require('@toa.io/console')
5
5
 
6
6
  class Exposition extends Connector {
7
- /** @type {toa.core.bindings.Broadcaster} */
7
+ /** @type {toa.core.bindings.Broadcast} */
8
8
  #broadcast
9
9
 
10
10
  /** @type {toa.extensions.exposition.remotes.Factory} */
@@ -14,7 +14,7 @@ class Exposition extends Connector {
14
14
  #remotes = {}
15
15
 
16
16
  /**
17
- * @param {toa.core.bindings.Broadcaster} broadcast
17
+ * @param {toa.core.bindings.Broadcast} broadcast
18
18
  * @param {toa.extensions.exposition.remotes.Factory} connect
19
19
  */
20
20
  constructor (broadcast, connect) {
@@ -27,9 +27,9 @@ class Exposition extends Connector {
27
27
  }
28
28
 
29
29
  /** @override */
30
- async connection () {
30
+ async open () {
31
31
  await this.#broadcast.receive('expose', this.#expose.bind(this))
32
- this.#broadcast.send('ping', {}).then()
32
+ this.#broadcast.transmit('ping', {}).then()
33
33
 
34
34
  console.info(this.constructor.name + ' started')
35
35
  }
@@ -52,7 +52,7 @@ class Exposition extends Connector {
52
52
  /**
53
53
  * @param {string} namespace
54
54
  * @param {string} name
55
- * @returns {Promise<Remote>}
55
+ * @returns {Promise<toa.extensions.exposition.Remote>}
56
56
  */
57
57
  async #connect (namespace, name) {
58
58
  const remote = await this.#remote(namespace, name)
package/src/factory.js CHANGED
@@ -25,7 +25,7 @@ class Factory {
25
25
  }
26
26
 
27
27
  tenant (locator, declaration) {
28
- const broadcast = this.#boot.bindings.broadcast(BINDING, GROUP, locator.id)
28
+ const broadcast = this.#boot.bindings.broadcast(BINDING, NAME, locator.id)
29
29
 
30
30
  return new Tenant(broadcast, locator, declaration)
31
31
  }
@@ -35,7 +35,7 @@ class Factory {
35
35
  }
36
36
 
37
37
  #expose () {
38
- const broadcast = this.#boot.bindings.broadcast(BINDING, GROUP)
38
+ const broadcast = this.#boot.bindings.broadcast(BINDING, NAME)
39
39
  const connect = this.#connect.bind(this)
40
40
  const exposition = new Exposition(broadcast, connect)
41
41
 
@@ -71,6 +71,6 @@ class Factory {
71
71
  }
72
72
 
73
73
  const BINDING = '@toa.io/bindings.amqp'
74
- const GROUP = 'exposition'
74
+ const NAME = 'exposition'
75
75
 
76
76
  exports.Factory = Factory
package/src/remote.js CHANGED
@@ -9,7 +9,7 @@ const translate = require('./translate')
9
9
  * @implements {toa.extensions.exposition.Remote}
10
10
  */
11
11
  class Remote extends Connector {
12
- /** @type {toa.core.Runtime} */
12
+ /** @type {toa.core.Component} */
13
13
  #remote
14
14
 
15
15
  /** @type {toa.extensions.exposition.Tree} */
@@ -17,7 +17,7 @@ class Remote extends Connector {
17
17
 
18
18
  /**
19
19
  * @param {toa.extensions.exposition.Server} server
20
- * @param {toa.core.Runtime} remote
20
+ * @param {toa.core.Component} remote
21
21
  * @param {toa.extensions.exposition.Tree} tree
22
22
  */
23
23
  constructor (server, remote, tree) {
package/src/server.js CHANGED
@@ -42,7 +42,7 @@ class Server extends Connector {
42
42
  this.#app.use(route, callback)
43
43
  }
44
44
 
45
- async connection () {
45
+ async open () {
46
46
  console.info(`Starting HTTP server at :${PORT} ...`)
47
47
 
48
48
  return new Promise((resolve, reject) => {
@@ -59,7 +59,7 @@ class Server extends Connector {
59
59
  })
60
60
  }
61
61
 
62
- async disconnection () {
62
+ async close () {
63
63
  console.info(`Stopping HTTP server at :${PORT} ...`)
64
64
 
65
65
  return new Promise((resolve, reject) => {
package/src/tenant.js CHANGED
@@ -3,6 +3,7 @@
3
3
  const { Connector } = require('@toa.io/core')
4
4
 
5
5
  class Tenant extends Connector {
6
+ /** @type {toa.core.bindings.Broadcast} */
6
7
  #binding
7
8
  #declaration
8
9
 
@@ -15,13 +16,13 @@ class Tenant extends Connector {
15
16
  this.depends(binding)
16
17
  }
17
18
 
18
- async connection () {
19
+ async open () {
19
20
  await this.#binding.receive('ping', () => this.#expose())
20
21
  await this.#expose()
21
22
  }
22
23
 
23
24
  async #expose () {
24
- await this.#binding.send('expose', this.#declaration)
25
+ await this.#binding.transmit('expose', this.#declaration)
25
26
  }
26
27
  }
27
28