@toa.io/userland 0.20.0-alpha.0 → 0.20.0-alpha.2
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 +10 -10
- package/samples/readme.md +5 -5
- package/stage/src/composition.js +3 -3
- package/stage/src/index.js +1 -0
- package/stage/types/index.d.ts +8 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/userland",
|
|
3
|
-
"version": "0.20.0-alpha.
|
|
3
|
+
"version": "0.20.0-alpha.2",
|
|
4
4
|
"description": "Toa development kit",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"main": "src/index.js",
|
|
25
25
|
"types": "types/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@toa.io/boot": "0.20.0-alpha.
|
|
28
|
-
"@toa.io/core": "0.20.0-alpha.
|
|
29
|
-
"@toa.io/filesystem": "0.20.0-alpha.
|
|
30
|
-
"@toa.io/generic": "0.20.0-alpha.
|
|
31
|
-
"@toa.io/norm": "0.20.0-alpha.
|
|
32
|
-
"@toa.io/schemas": "0.20.0-alpha.
|
|
33
|
-
"@toa.io/storages.null": "0.20.0-alpha.
|
|
34
|
-
"@toa.io/yaml": "0.20.0-alpha.
|
|
27
|
+
"@toa.io/boot": "0.20.0-alpha.2",
|
|
28
|
+
"@toa.io/core": "0.20.0-alpha.2",
|
|
29
|
+
"@toa.io/filesystem": "0.20.0-alpha.2",
|
|
30
|
+
"@toa.io/generic": "0.20.0-alpha.2",
|
|
31
|
+
"@toa.io/norm": "0.20.0-alpha.2",
|
|
32
|
+
"@toa.io/schemas": "0.20.0-alpha.2",
|
|
33
|
+
"@toa.io/storages.null": "0.20.0-alpha.2",
|
|
34
|
+
"@toa.io/yaml": "0.20.0-alpha.2",
|
|
35
35
|
"tap": "16.3.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d6e8c5bdae26e2beb66f4d7f37f71a3494fe9fcb"
|
|
38
38
|
}
|
package/samples/readme.md
CHANGED
|
@@ -33,7 +33,8 @@ and `name` must match corresponding component, therefore are optional.
|
|
|
33
33
|
## Message Samples
|
|
34
34
|
|
|
35
35
|
Message Sample is an object containing receiver's input (`payload`) to be substituted and
|
|
36
|
-
outcomes (`input` and `query`) to be verified. Message sample may contain the corresponding
|
|
36
|
+
outcomes (`input` and `query`) to be verified. Message sample may contain the corresponding
|
|
37
|
+
operation
|
|
37
38
|
sample. See its [schema](./src/.replay/.suite/translate/schemas/message.cos.yaml).
|
|
38
39
|
|
|
39
40
|
> Message samples are only supported at [context level](#autonomy).
|
|
@@ -52,7 +53,8 @@ label of the event receiver is consuming.
|
|
|
52
53
|
|
|
53
54
|
#### Aspect Result Type Hints
|
|
54
55
|
|
|
55
|
-
When using aspect calls, there might be situations where the returned values cannot be adequately
|
|
56
|
+
When using aspect calls, there might be situations where the returned values cannot be adequately
|
|
57
|
+
described using YAML.
|
|
56
58
|
To address this issue, type hints can be used.
|
|
57
59
|
|
|
58
60
|
```yaml
|
|
@@ -62,7 +64,7 @@ state:
|
|
|
62
64
|
bar: 2
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
In the
|
|
67
|
+
In the code snippet above, the `state` Aspect returns a `values` field of type Map.
|
|
66
68
|
|
|
67
69
|
```yaml
|
|
68
70
|
state:
|
|
@@ -92,8 +94,6 @@ context (so as required extensions). See [examples](../example/samples).
|
|
|
92
94
|
|
|
93
95
|
## Replay
|
|
94
96
|
|
|
95
|
-
> Replaying samples requires local deployment environment.
|
|
96
|
-
|
|
97
97
|
### CLI
|
|
98
98
|
|
|
99
99
|
Samples may be replayed using [`toa replay`](/runtime/cli/readme.md#replay) command.
|
package/stage/src/composition.js
CHANGED
|
@@ -6,9 +6,9 @@ const { state } = require('./state')
|
|
|
6
6
|
const binding = require.resolve('./binding')
|
|
7
7
|
|
|
8
8
|
/** @type {toa.stage.Composition} */
|
|
9
|
-
const composition = async (paths) => {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const composition = async (paths, options) => {
|
|
10
|
+
options ??= { bindings: [binding] }
|
|
11
|
+
|
|
12
12
|
const composition = await boot.composition(paths, options)
|
|
13
13
|
|
|
14
14
|
await composition.connect()
|
package/stage/src/index.js
CHANGED
package/stage/types/index.d.ts
CHANGED
|
@@ -2,28 +2,16 @@ import * as _core from '@toa.io/core/types'
|
|
|
2
2
|
import * as _norm from '@toa.io/norm/types'
|
|
3
3
|
import * as _composition from '@toa.io/boot/types/composition'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
type Manifest = (path: string) => Promise<_norm.Component>
|
|
7
|
-
type Component = (path: string, options?: _composition.Options) => Promise<_core.Component>
|
|
8
|
-
type Composition = (paths: string[]) => Promise<void>
|
|
9
|
-
type Remote = (id: string) => Promise<_core.Component>
|
|
10
|
-
type Shutdown = () => Promise<void>
|
|
5
|
+
export function manifest (path: string): Promise<_norm.Component>
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
manifest: toa.stage.Manifest
|
|
14
|
-
component: toa.stage.Component
|
|
15
|
-
composition: toa.stage.Composition
|
|
16
|
-
remote: toa.stage.Remote
|
|
17
|
-
shutdown: toa.stage.Shutdown
|
|
18
|
-
}
|
|
19
|
-
}
|
|
7
|
+
export function component (path: string): Promise<_core.Component>
|
|
20
8
|
|
|
21
|
-
export
|
|
9
|
+
export function composition (paths: string[], options?: _composition.Options): Promise<void>
|
|
22
10
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
export
|
|
11
|
+
export function compose (paths: string[]): Promise<void>
|
|
12
|
+
|
|
13
|
+
export function remote (id: string): Promise<_core.Component>
|
|
14
|
+
|
|
15
|
+
export function shutdown (): Promise<void>
|
|
28
16
|
|
|
29
17
|
export * as binding from './binding'
|