@toa.io/userland 0.9.0 → 0.10.0-dev.1
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/example/components/echo/{beacon/manifest.toa.yaml → manifest.toa.yaml} +1 -2
- package/example/context.toa.yaml +1 -1
- package/example/stage/call.test.js +11 -10
- package/example/stage/events.test.js +1 -1
- package/example/stage/invoke.test.js +1 -1
- package/package.json +5 -5
- package/stage/src/remote.js +5 -2
- /package/example/components/echo/{beacon/operations → operations}/signal.js +0 -0
- /package/example/components/echo/{beacon/samples → samples}/signal.yaml +0 -0
- /package/example/components/{math/calculations → math.calculations}/manifest.toa.yaml +0 -0
- /package/example/components/{math/calculations → math.calculations}/operations/add.js +0 -0
- /package/example/components/{math/calculations → math.calculations}/operations/increment.js +0 -0
- /package/example/components/{math/calculations → math.calculations}/samples/add.yaml +0 -0
- /package/example/components/{math/calculations → math.calculations}/samples/increment.yaml +0 -0
- /package/example/components/{math/proxy → math.proxy}/manifest.toa.yaml +0 -0
- /package/example/components/{math/proxy → math.proxy}/operations/add.js +0 -0
- /package/example/components/{math/proxy → math.proxy}/samples/add.yaml +0 -0
- /package/example/components/{tea/pots → tea.pots}/manifest.toa.yaml +0 -0
- /package/example/components/{tea/pots → tea.pots}/operations/same.js +0 -0
- /package/example/components/{tea/pots → tea.pots}/receivers/store.orders.created.js +0 -0
- /package/example/components/{tea/pots → tea.pots}/samples/messages/store.orders.created.yaml +0 -0
- /package/example/components/{tea/pots → tea.pots}/samples/same.yaml +0 -0
- /package/example/components/{tea/pots → tea.pots}/samples/transit.yaml +0 -0
package/example/context.toa.yaml
CHANGED
|
@@ -7,14 +7,18 @@ const stage = require('@toa.io/userland/stage')
|
|
|
7
7
|
const root = resolve(__dirname, '../components')
|
|
8
8
|
|
|
9
9
|
/** @type {toa.core.Component} */
|
|
10
|
-
let
|
|
10
|
+
let echo
|
|
11
|
+
|
|
12
|
+
/** @type {toa.core.Component} */
|
|
13
|
+
let math
|
|
11
14
|
|
|
12
15
|
beforeAll(async () => {
|
|
13
|
-
const
|
|
16
|
+
const paths = ['echo', 'math.calculations'].map((rel) => resolve(root, rel))
|
|
14
17
|
|
|
15
|
-
await stage.composition(
|
|
18
|
+
await stage.composition(paths)
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
echo = await stage.remote('echo')
|
|
21
|
+
math = await stage.remote('math.calculations')
|
|
18
22
|
})
|
|
19
23
|
|
|
20
24
|
afterAll(async () => {
|
|
@@ -22,18 +26,15 @@ afterAll(async () => {
|
|
|
22
26
|
})
|
|
23
27
|
|
|
24
28
|
it('should call endpoint', async () => {
|
|
25
|
-
const
|
|
26
|
-
const b = Math.random()
|
|
27
|
-
|
|
28
|
-
const reply = await remote.invoke('add', { input: { a, b } })
|
|
29
|
+
const reply = await echo.invoke('signal', {})
|
|
29
30
|
|
|
30
|
-
expect(reply.output).toStrictEqual(
|
|
31
|
+
expect(reply.output).toStrictEqual('quack')
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
it('should throw on invalid input', async () => {
|
|
34
35
|
const a = 'not a number'
|
|
35
36
|
const b = 'neither'
|
|
36
37
|
|
|
37
|
-
await expect(
|
|
38
|
+
await expect(math.invoke('add', { input: { a, b } }))
|
|
38
39
|
.rejects.toBeInstanceOf(RequestContractException)
|
|
39
40
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/userland",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-dev.1",
|
|
4
4
|
"description": "Toa development kit",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"main": "src/index.js",
|
|
25
25
|
"types": "types/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@toa.io/boot": "0.8.
|
|
27
|
+
"@toa.io/boot": "0.8.1-dev.1",
|
|
28
28
|
"@toa.io/core": "0.8.0",
|
|
29
29
|
"@toa.io/filesystem": "0.7.1",
|
|
30
30
|
"@toa.io/generic": "0.8.0",
|
|
31
|
-
"@toa.io/norm": "0.
|
|
32
|
-
"@toa.io/schemas": "0.8.0",
|
|
31
|
+
"@toa.io/norm": "0.10.0-dev.1",
|
|
32
|
+
"@toa.io/schemas": "0.8.1-dev.0",
|
|
33
33
|
"@toa.io/yaml": "0.7.2",
|
|
34
34
|
"tap": "16.3.4"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "cec62c1e23f4f16baff9baf6e71935ecccf786e5"
|
|
37
37
|
}
|
package/stage/src/remote.js
CHANGED
|
@@ -7,9 +7,12 @@ const { state } = require('./state')
|
|
|
7
7
|
|
|
8
8
|
/** @type {toa.stage.Remote} */
|
|
9
9
|
const remote = async (id) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const segments = id.split('.')
|
|
11
|
+
|
|
12
|
+
if (segments.length === 1) segments.unshift('default')
|
|
12
13
|
|
|
14
|
+
const [namespace, name] = segments
|
|
15
|
+
const locator = new Locator(name, namespace)
|
|
13
16
|
const remote = await boot.remote(locator)
|
|
14
17
|
|
|
15
18
|
await remote.connect()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/example/components/{tea/pots → tea.pots}/samples/messages/store.orders.created.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|