@toa.io/bridges.node 0.20.0-dev.4 → 0.20.0-dev.40
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.
|
|
3
|
+
"version": "0.20.0-dev.40",
|
|
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.
|
|
30
|
-
"@toa.io/filesystem": "0.20.0-dev.
|
|
31
|
-
"@toa.io/generic": "0.20.0-dev.
|
|
29
|
+
"@toa.io/core": "0.20.0-dev.40",
|
|
30
|
+
"@toa.io/filesystem": "0.20.0-dev.40",
|
|
31
|
+
"@toa.io/generic": "0.20.0-dev.40",
|
|
32
32
|
"fast-glob": "3.2.7"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"clone-deep": "4.0.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "594543488de934deba3598ec5805744af1b3f4c0"
|
|
38
38
|
}
|
package/src/algorithms/runner.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { Connector } = require('@toa.io/core')
|
|
4
|
+
const { plain } = require('@toa.io/generic')
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @implements {toa.core.bridges.Algorithm}
|
|
@@ -40,7 +41,7 @@ class Runner extends Connector {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
function normalize (reply) {
|
|
43
|
-
const object =
|
|
44
|
+
const object = plain(reply)
|
|
44
45
|
const output = object && reply.output !== undefined
|
|
45
46
|
const error = object && reply.error !== undefined
|
|
46
47
|
|
|
@@ -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
|
|
package/src/shortcuts/index.js
CHANGED
|
@@ -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
|