@toa.io/bridges.node 1.0.0-alpha.136 → 1.0.0-alpha.143

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/bridges.node",
3
- "version": "1.0.0-alpha.136",
3
+ "version": "1.0.0-alpha.143",
4
4
  "description": "Toa Node Bridge (inproc)",
5
5
  "homepage": "https://toa.io",
6
6
  "author": {
@@ -36,5 +36,5 @@
36
36
  "devDependencies": {
37
37
  "clone-deep": "4.0.1"
38
38
  },
39
- "gitHead": "73722f06d137283915ca8710ae09e5e53307e1f9"
39
+ "gitHead": "a98d593cac7077f15ef3d178c35dbb9f5742af47"
40
40
  }
@@ -8,6 +8,7 @@ const { stash } = require('./stash')
8
8
  const { storages } = require('./storages')
9
9
  const { pubsub } = require('./pubsub')
10
10
  const { logs } = require('./logs')
11
+ const { mail } = require('./mail')
11
12
 
12
13
  exports.http = http
13
14
  exports.amqp = amqp
@@ -17,3 +18,4 @@ exports.stash = stash
17
18
  exports.storages = storages
18
19
  exports.pubsub = pubsub
19
20
  exports.logs = logs
21
+ exports.mail = mail
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+
3
+ const { underlay } = require('@toa.io/generic')
4
+
5
+ /** @type {toa.node.shortcut} */
6
+ function mail (context, aspect) {
7
+ context.mail = underlay(async (segs, args) => {
8
+ if (segs.length !== 1)
9
+ throw new Error(`Mail aspect call should have 1 segment, [${segs.join(', ')}] given`)
10
+
11
+ const method = segs[0]
12
+
13
+ return aspect.invoke(method, ...args)
14
+ })
15
+ }
16
+
17
+ exports.mail = mail