@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/userland",
3
- "version": "0.20.0-alpha.0",
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.0",
28
- "@toa.io/core": "0.20.0-alpha.0",
29
- "@toa.io/filesystem": "0.20.0-alpha.0",
30
- "@toa.io/generic": "0.20.0-alpha.0",
31
- "@toa.io/norm": "0.20.0-alpha.0",
32
- "@toa.io/schemas": "0.20.0-alpha.0",
33
- "@toa.io/storages.null": "0.20.0-alpha.0",
34
- "@toa.io/yaml": "0.20.0-alpha.0",
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": "d047190899218b5249901a01a2a4caec5b34cf09"
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 operation
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 described using YAML.
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 above code snippet, the `state` Aspect returns a `values` field of type Map.
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.
@@ -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
- /** @type {toa.boot.composition.Options} */
11
- const options = { bindings: [binding] }
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()
@@ -10,6 +10,7 @@ const binding = require('./binding')
10
10
  exports.manifest = manifest
11
11
  exports.component = component
12
12
  exports.composition = composition
13
+ exports.compose = composition
13
14
  exports.remote = remote
14
15
  exports.shutdown = shutdown
15
16
  exports.binding = binding
@@ -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
- declare namespace toa.stage {
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
- interface Stage {
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 type Stage = toa.stage.Stage
9
+ export function composition (paths: string[], options?: _composition.Options): Promise<void>
22
10
 
23
- export const manifest: toa.stage.Manifest
24
- export const component: toa.stage.Component
25
- export const composition: toa.stage.Composition
26
- export const remote: toa.stage.Remote
27
- export const shutdown: toa.stage.Shutdown
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'