@toa.io/userland 1.2.0-dev.2 → 1.2.0-dev.3

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.
@@ -1,7 +1,15 @@
1
1
  'use strict'
2
2
 
3
- async function computation (input, context) {
4
- return context.configuration.signal
3
+ class Computation {
4
+ #context
5
+
6
+ async mount (context) {
7
+ this.#context = context
8
+ }
9
+
10
+ async execute () {
11
+ return this.#context.configuration.signal
12
+ }
5
13
  }
6
14
 
7
- exports.computation = computation
15
+ exports.Computation = Computation
@@ -1,7 +1,6 @@
1
1
  title: Should add numbers
2
2
  input:
3
- a: 1
4
- b: 2
3
+ $import: assets/ab.yaml
5
4
  output: 3
6
5
  ---
7
6
  title: Should add negative numbers
@@ -2,6 +2,10 @@
2
2
 
3
3
  async function computation (_, context) {
4
4
  const response = await context.http.dev.path.to.resource.get()
5
+ const type = response.headers.get('content-type')
6
+
7
+ if (type !== 'application/json') return { error: { code: 0, message: 'Unsupported media type ' + type } }
8
+
5
9
  const output = await response.json()
6
10
 
7
11
  return { output }
@@ -1,5 +1,7 @@
1
1
  title: Should return response
2
2
  http:
3
+ headers:
4
+ get:sync: 'application/json'
3
5
  json:async:
4
6
  foo: bar
5
7
  output:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/userland",
3
- "version": "1.2.0-dev.2",
3
+ "version": "1.2.0-dev.3",
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": "1.0.2-dev.2",
28
- "@toa.io/core": "1.1.0-dev.2",
29
- "@toa.io/filesystem": "1.0.2-dev.2",
30
- "@toa.io/generic": "0.11.0-dev.2",
31
- "@toa.io/norm": "1.0.2-dev.2",
32
- "@toa.io/schemas": "0.8.4-dev.2",
33
- "@toa.io/yaml": "0.7.6-dev.2",
27
+ "@toa.io/boot": "1.0.2-dev.3",
28
+ "@toa.io/core": "1.1.0-dev.3",
29
+ "@toa.io/filesystem": "1.0.2-dev.3",
30
+ "@toa.io/generic": "0.11.0-dev.3",
31
+ "@toa.io/norm": "1.0.2-dev.3",
32
+ "@toa.io/schemas": "0.8.4-dev.3",
33
+ "@toa.io/yaml": "0.7.6-dev.3",
34
34
  "tap": "16.3.4"
35
35
  },
36
- "gitHead": "416e6aa02364a347b47adaaeb3f944b7b39fbf68"
36
+ "gitHead": "7883a684c43fdcfd0f1b231fb395ac2901a6a616"
37
37
  }
package/samples/readme.md CHANGED
@@ -92,6 +92,40 @@ context (so as required extensions). See [examples](../example/samples).
92
92
 
93
93
  ## Replay
94
94
 
95
+ ### CLI
96
+
95
97
  Samples may be *replayed* using [`toa replay`](/runtime/cli/readme.md#replay) command.
96
98
 
97
99
  > Replaying samples requires local deployment environment.
100
+
101
+ See [features](/features/cli/replay.feature).
102
+
103
+ ### Framework
104
+
105
+ `async components(paths: string[], options?): boolean`
106
+
107
+ Replay component samples.
108
+
109
+ `async components(paths: string[], options?): boolean`
110
+
111
+ Replay context and its components' samples.
112
+
113
+ #### Options
114
+
115
+ <dl>
116
+ <dt><code><strong>id</strong>: string</code></dt>
117
+ <dd>Replay samples for a specified component</dd>
118
+
119
+ <dt><code><strong>integration</strong>: string</code></dt>
120
+ <dd>Replay samples for a specified component only</dd>
121
+ <dd></dd>
122
+
123
+ <dt><code><strong>operation</strong>: string</code></dt>
124
+ <dd>Replay samples for specified operation</dd>
125
+
126
+ <dt><code><strong>title</strong>: string</code></dt>
127
+ <dd>Replay samples with titles matching given regexp</dd>
128
+
129
+ </dl>
130
+
131
+ See [types](types/suite.d.ts).