@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.
Files changed (23) hide show
  1. package/example/components/echo/{beacon/manifest.toa.yaml → manifest.toa.yaml} +1 -2
  2. package/example/context.toa.yaml +1 -1
  3. package/example/stage/call.test.js +11 -10
  4. package/example/stage/events.test.js +1 -1
  5. package/example/stage/invoke.test.js +1 -1
  6. package/package.json +5 -5
  7. package/stage/src/remote.js +5 -2
  8. /package/example/components/echo/{beacon/operations → operations}/signal.js +0 -0
  9. /package/example/components/echo/{beacon/samples → samples}/signal.yaml +0 -0
  10. /package/example/components/{math/calculations → math.calculations}/manifest.toa.yaml +0 -0
  11. /package/example/components/{math/calculations → math.calculations}/operations/add.js +0 -0
  12. /package/example/components/{math/calculations → math.calculations}/operations/increment.js +0 -0
  13. /package/example/components/{math/calculations → math.calculations}/samples/add.yaml +0 -0
  14. /package/example/components/{math/calculations → math.calculations}/samples/increment.yaml +0 -0
  15. /package/example/components/{math/proxy → math.proxy}/manifest.toa.yaml +0 -0
  16. /package/example/components/{math/proxy → math.proxy}/operations/add.js +0 -0
  17. /package/example/components/{math/proxy → math.proxy}/samples/add.yaml +0 -0
  18. /package/example/components/{tea/pots → tea.pots}/manifest.toa.yaml +0 -0
  19. /package/example/components/{tea/pots → tea.pots}/operations/same.js +0 -0
  20. /package/example/components/{tea/pots → tea.pots}/receivers/store.orders.created.js +0 -0
  21. /package/example/components/{tea/pots → tea.pots}/samples/messages/store.orders.created.yaml +0 -0
  22. /package/example/components/{tea/pots → tea.pots}/samples/same.yaml +0 -0
  23. /package/example/components/{tea/pots → tea.pots}/samples/transit.yaml +0 -0
@@ -1,5 +1,4 @@
1
- name: beacon
2
- namespace: echo
1
+ name: echo
3
2
 
4
3
  operations:
5
4
  signal:
@@ -1,3 +1,3 @@
1
1
  name: examples
2
- packages: components/*/*
2
+ packages: components/*
3
3
  registry: example
@@ -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 remote
10
+ let echo
11
+
12
+ /** @type {toa.core.Component} */
13
+ let math
11
14
 
12
15
  beforeAll(async () => {
13
- const path = resolve(root, 'math/calculations')
16
+ const paths = ['echo', 'math.calculations'].map((rel) => resolve(root, rel))
14
17
 
15
- await stage.composition([path])
18
+ await stage.composition(paths)
16
19
 
17
- remote = await stage.remote('math.calculations')
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 a = Math.random()
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(a + b)
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(remote.invoke('add', { input: { a, b } }))
38
+ await expect(math.invoke('add', { input: { a, b } }))
38
39
  .rejects.toBeInstanceOf(RequestContractException)
39
40
  })
@@ -10,7 +10,7 @@ const root = resolve(__dirname, '../components')
10
10
  let remote
11
11
 
12
12
  beforeAll(async () => {
13
- const path = resolve(root, 'tea/pots')
13
+ const path = resolve(root, 'tea.pots')
14
14
 
15
15
  await stage.composition([path])
16
16
 
@@ -9,7 +9,7 @@ const root = resolve(__dirname, '../components')
9
9
  let component
10
10
 
11
11
  beforeAll(async () => {
12
- const path = resolve(root, 'math/calculations')
12
+ const path = resolve(root, 'math.calculations')
13
13
 
14
14
  component = await stage.component(path)
15
15
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/userland",
3
- "version": "0.9.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.0",
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.9.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": "e0f4773f67000b28d5b332ce0a0094a31acf4ff3"
36
+ "gitHead": "cec62c1e23f4f16baff9baf6e71935ecccf786e5"
37
37
  }
@@ -7,9 +7,12 @@ const { state } = require('./state')
7
7
 
8
8
  /** @type {toa.stage.Remote} */
9
9
  const remote = async (id) => {
10
- const [namespace, name] = id.split('.')
11
- const locator = new Locator(name, namespace)
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()