@toa.io/bridges.node 0.20.0 → 0.21.0-alpha.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": "@toa.io/bridges.node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0-alpha.0",
|
|
4
4
|
"description": "Toa Node Bridge (inproc)",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"nopeable": "*"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@toa.io/core": "0.
|
|
33
|
-
"@toa.io/filesystem": "0.20.0",
|
|
34
|
-
"@toa.io/generic": "0.20.0",
|
|
32
|
+
"@toa.io/core": "0.21.0-alpha.0",
|
|
33
|
+
"@toa.io/filesystem": "0.20.1-alpha.0",
|
|
34
|
+
"@toa.io/generic": "0.20.1-alpha.0",
|
|
35
35
|
"fast-glob": "3.2.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"clone-deep": "4.0.1"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "ed28dc0d2823022fbb1188bb28b994bc827a4432"
|
|
41
41
|
}
|
package/src/shortcuts/index.js
CHANGED
|
@@ -5,9 +5,11 @@ const { amqp } = require('./amqp')
|
|
|
5
5
|
const { configuration } = require('./configuration')
|
|
6
6
|
const { state } = require('./state')
|
|
7
7
|
const { stash } = require('./stash')
|
|
8
|
+
const { storages } = require('./storages')
|
|
8
9
|
|
|
9
10
|
exports.http = http
|
|
10
11
|
exports.amqp = amqp
|
|
11
12
|
exports.configuration = configuration
|
|
12
13
|
exports.state = state
|
|
13
14
|
exports.stash = stash
|
|
15
|
+
exports.storages = storages
|
package/src/shortcuts/stash.js
CHANGED
|
@@ -5,7 +5,8 @@ const { underlay } = require('@toa.io/generic')
|
|
|
5
5
|
/** @type {toa.node.shortcut} */
|
|
6
6
|
const stash = (context, aspect) => {
|
|
7
7
|
context.stash = underlay(async (segs, args) => {
|
|
8
|
-
if (segs.length !== 1)
|
|
8
|
+
if (segs.length !== 1)
|
|
9
|
+
throw new Error(`Stash aspect call should have 1 segment, [${segs.join(', ')}] given`)
|
|
9
10
|
|
|
10
11
|
const method = segs[0]
|
|
11
12
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { underlay } = require('@toa.io/generic')
|
|
4
|
+
|
|
5
|
+
function storages (context, aspect) {
|
|
6
|
+
context.storages = underlay(async (segs, args) => {
|
|
7
|
+
if (segs.length < 2)
|
|
8
|
+
throw new Error('Storages aspect expects at least 2 arguments')
|
|
9
|
+
|
|
10
|
+
const [storage, method] = segs
|
|
11
|
+
|
|
12
|
+
return aspect.invoke(storage, method, ...args)
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.storages = storages
|