@toa.io/bridges.node 0.20.0-dev.17 → 0.20.0-dev.19

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": "0.20.0-dev.17",
3
+ "version": "0.20.0-dev.19",
4
4
  "description": "Toa Node Bridge (inproc)",
5
5
  "homepage": "https://toa.io",
6
6
  "author": {
@@ -26,13 +26,13 @@
26
26
  "test": "echo \"Error: run tests from root\" && exit 1"
27
27
  },
28
28
  "dependencies": {
29
- "@toa.io/core": "0.20.0-dev.17",
30
- "@toa.io/filesystem": "0.20.0-dev.17",
31
- "@toa.io/generic": "0.20.0-dev.17",
29
+ "@toa.io/core": "0.20.0-dev.19",
30
+ "@toa.io/filesystem": "0.20.0-dev.19",
31
+ "@toa.io/generic": "0.20.0-dev.19",
32
32
  "fast-glob": "3.2.7"
33
33
  },
34
34
  "devDependencies": {
35
35
  "clone-deep": "4.0.1"
36
36
  },
37
- "gitHead": "cafb719d8e80d3e78a00904dc6ab6d6b0d5b568b"
37
+ "gitHead": "e10214f746cf4fc699af42dba90e099487177a43"
38
38
  }
@@ -26,7 +26,7 @@ it('should define shortcut', async () => {
26
26
  })
27
27
 
28
28
  it('should call invoke', async () => {
29
- const args = Array.from({ length: random(5) + 2 }, generate)
29
+ const args = Array.from({ length: random(5) + 2 }, () => generate())
30
30
 
31
31
  await context.amqp.test.emit(...args)
32
32
 
@@ -4,8 +4,10 @@ const { http } = require('./http')
4
4
  const { amqp } = require('./amqp')
5
5
  const { configuration } = require('./configuration')
6
6
  const { state } = require('./state')
7
+ const { stash } = require('./stash')
7
8
 
8
9
  exports.http = http
9
10
  exports.amqp = amqp
10
11
  exports.configuration = configuration
11
12
  exports.state = state
13
+ exports.stash = stash
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const { underlay } = require('@toa.io/generic')
4
+
5
+ /** @type {toa.node.shortcut} */
6
+ const stash = (context, aspect) => {
7
+ context.stash = underlay(async (segs, args) => {
8
+ if (segs.length !== 1) throw new Error(`Stash aspect call should have 1 segment, [${segs.join(', ')}] given`)
9
+
10
+ const method = segs[0]
11
+
12
+ return aspect.invoke(method, ...args)
13
+ })
14
+ }
15
+
16
+ exports.stash = stash