@toa.io/userland 1.0.0-alpha.7 → 1.0.0-alpha.9
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 +9 -9
- package/readme.md +0 -2
- package/example/components/echo/samples/get.yaml +0 -12
- package/example/components/echo/samples/signal.yaml +0 -4
- package/example/components/math.calculations/samples/add.yaml +0 -10
- package/example/components/math.calculations/samples/assets/ab.yaml +0 -2
- package/example/components/math.calculations/samples/increment.yaml +0 -27
- package/example/components/math.proxy/samples/add.yaml +0 -11
- package/example/components/tea.pots/samples/same.yaml +0 -8
- package/example/components/tea.pots/samples/transit.yaml +0 -43
- package/example/components/web/samples/get.yaml +0 -8
- package/example/samples/math.proxy.add.yaml +0 -5
- package/example/samples/messages/store.orders.created.yaml +0 -8
- package/samples/docs/sampling-dark.jpg +0 -0
- package/samples/docs/sampling-light.jpg +0 -0
- package/samples/notes.md +0 -12
- package/samples/package.json +0 -5
- package/samples/readme.md +0 -131
- package/samples/src/.replay/.suite/component.js +0 -20
- package/samples/src/.replay/.suite/index.js +0 -7
- package/samples/src/.replay/.suite/messages.js +0 -39
- package/samples/src/.replay/.suite/operation.js +0 -28
- package/samples/src/.replay/.suite/operations.js +0 -20
- package/samples/src/.replay/.suite/translate/.message/index.js +0 -5
- package/samples/src/.replay/.suite/translate/.message/request.js +0 -31
- package/samples/src/.replay/.suite/translate/.operation/.prepare/cast.js +0 -20
- package/samples/src/.replay/.suite/translate/.operation/.prepare/cast.test.js +0 -94
- package/samples/src/.replay/.suite/translate/.operation/.prepare/expand.js +0 -14
- package/samples/src/.replay/.suite/translate/.operation/.prepare/index.js +0 -7
- package/samples/src/.replay/.suite/translate/.operation/.prepare/shortcuts/.aspect.js +0 -26
- package/samples/src/.replay/.suite/translate/.operation/.prepare/shortcuts/configuration.js +0 -5
- package/samples/src/.replay/.suite/translate/.operation/.prepare/shortcuts/http.js +0 -5
- package/samples/src/.replay/.suite/translate/.operation/.prepare/shortcuts/index.js +0 -9
- package/samples/src/.replay/.suite/translate/.operation/.prepare/shortcuts/state.js +0 -5
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/async.js +0 -3
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/cast.js +0 -26
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/index.js +0 -5
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/map.js +0 -3
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/set.js +0 -3
- package/samples/src/.replay/.suite/translate/.operation/.prepare/types/sync.js +0 -3
- package/samples/src/.replay/.suite/translate/.operation/calls.js +0 -49
- package/samples/src/.replay/.suite/translate/.operation/cleanup.js +0 -16
- package/samples/src/.replay/.suite/translate/.operation/events.js +0 -16
- package/samples/src/.replay/.suite/translate/.operation/index.js +0 -11
- package/samples/src/.replay/.suite/translate/.operation/prepare.js +0 -14
- package/samples/src/.replay/.suite/translate/index.js +0 -7
- package/samples/src/.replay/.suite/translate/message.js +0 -26
- package/samples/src/.replay/.suite/translate/operation.js +0 -47
- package/samples/src/.replay/.suite/translate/schemas/index.js +0 -7
- package/samples/src/.replay/.suite/translate/schemas/message.cos.yaml +0 -10
- package/samples/src/.replay/.suite/translate/schemas/operation.cos.yaml +0 -23
- package/samples/src/.replay/index.js +0 -7
- package/samples/src/.replay/stage.js +0 -60
- package/samples/src/.replay/suite.js +0 -23
- package/samples/src/.replay/test.js +0 -19
- package/samples/src/components.js +0 -13
- package/samples/src/context.js +0 -23
- package/samples/src/index.js +0 -9
- package/samples/src/replay.js +0 -16
- package/samples/src/suite/.read/filter.js +0 -15
- package/samples/src/suite/.read/index.js +0 -7
- package/samples/src/suite/.read/messages.js +0 -40
- package/samples/src/suite/.read/operations.js +0 -51
- package/samples/src/suite/.read/parse.js +0 -20
- package/samples/src/suite/components.js +0 -31
- package/samples/src/suite/context.js +0 -20
- package/samples/src/suite/index.js +0 -7
- package/samples/test/components.test.js +0 -42
- package/samples/test/context/components/dummy/manifest.toa.yaml +0 -2
- package/samples/test/context/components/dummy/samples/do.yaml +0 -11
- package/samples/test/context/components/dummy/samples/dummies.dummy.do.yaml +0 -11
- package/samples/test/context/components/dummy/samples/dummies.dummy.undo.yaml +0 -7
- package/samples/test/context/components/dummy/samples/messages/somewhere.something.happened.yaml +0 -6
- package/samples/test/context/components/pot/manifest.toa.yaml +0 -2
- package/samples/test/context/components/pot/samples/do.yaml +0 -11
- package/samples/test/context/components/pot/samples/messages/somewhere.something.happened.yaml +0 -6
- package/samples/test/context/context.toa.yaml +0 -3
- package/samples/test/context/samples/dummies.dummy.observe.yaml +0 -6
- package/samples/test/context/samples/dummies.dummy.transit.yaml +0 -10
- package/samples/test/context/samples/messages/somewhere.something.happened.yaml +0 -6
- package/samples/test/context.fixtures.js +0 -8
- package/samples/test/context.test.js +0 -82
- package/samples/test/replay.mock.js +0 -7
- package/samples/test/replay.test.js +0 -152
- package/samples/test/replay.translate.message.fixtures.js +0 -24
- package/samples/test/replay.translate.message.test.js +0 -119
- package/samples/test/replay.translate.mock.js +0 -17
- package/samples/test/replay.translate.operation.fixtures.js +0 -107
- package/samples/test/replay.translate.operation.test.js +0 -68
- package/samples/test/stage.mock.js +0 -30
- package/samples/test/suite.components.test.js +0 -122
- package/samples/test/suite.context.test.js +0 -79
- package/samples/test/suite.mock.js +0 -10
- package/samples/types/index.d.ts +0 -8
- package/samples/types/message.d.ts +0 -24
- package/samples/types/operation.d.ts +0 -36
- package/samples/types/replay.d.ts +0 -13
- package/samples/types/suite.d.ts +0 -31
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { generate } = require('randomstring')
|
|
4
|
-
const { flip } = require('@toa.io/generic')
|
|
5
|
-
|
|
6
|
-
const title = generate()
|
|
7
|
-
const input = generate()
|
|
8
|
-
const output = generate()
|
|
9
|
-
const reply = { output }
|
|
10
|
-
|
|
11
|
-
const context = {}
|
|
12
|
-
|
|
13
|
-
context.declaration = {
|
|
14
|
-
local: {
|
|
15
|
-
do: {
|
|
16
|
-
input: generate(),
|
|
17
|
-
output: generate()
|
|
18
|
-
},
|
|
19
|
-
undo: [
|
|
20
|
-
{
|
|
21
|
-
input: generate()
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
output: generate()
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
context.sample = {
|
|
31
|
-
local: {
|
|
32
|
-
do: [
|
|
33
|
-
{
|
|
34
|
-
request: {
|
|
35
|
-
input: context.declaration.local.do.input
|
|
36
|
-
},
|
|
37
|
-
reply: {
|
|
38
|
-
output: context.declaration.local.do.output
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
undo: [
|
|
43
|
-
{
|
|
44
|
-
request: {
|
|
45
|
-
input: context.declaration.local.undo[0].input
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
reply: {
|
|
50
|
-
output: context.declaration.local.undo[1].output
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const storage = {}
|
|
58
|
-
|
|
59
|
-
storage.declaration = {
|
|
60
|
-
current: flip() ? { foo: generate() } : [{ foo: generate() }], // object or array
|
|
61
|
-
next: { foo: generate() }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
storage.sample = {
|
|
65
|
-
current: storage.declaration.current,
|
|
66
|
-
next: storage.declaration.next
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const events = { declaration: {}, sample: {} }
|
|
70
|
-
const label = generate()
|
|
71
|
-
|
|
72
|
-
events.declaration[label] = { [generate()]: generate() }
|
|
73
|
-
events.sample[label] = { payload: events.declaration[label] }
|
|
74
|
-
|
|
75
|
-
const extension = () => ([{ permanent: flip() }])
|
|
76
|
-
|
|
77
|
-
/** @type {toa.samples.Extensions} */
|
|
78
|
-
const extensions = { [generate()]: extension() }
|
|
79
|
-
|
|
80
|
-
/** @type {toa.samples.Operation} */
|
|
81
|
-
const declaration = {
|
|
82
|
-
title,
|
|
83
|
-
input,
|
|
84
|
-
output,
|
|
85
|
-
...context.declaration,
|
|
86
|
-
...storage.declaration,
|
|
87
|
-
events: events.declaration,
|
|
88
|
-
extensions
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** @type {toa.sampling.Request} */
|
|
92
|
-
const expected = {
|
|
93
|
-
input,
|
|
94
|
-
sample: {
|
|
95
|
-
authentic: true,
|
|
96
|
-
autonomous: true,
|
|
97
|
-
title,
|
|
98
|
-
reply,
|
|
99
|
-
context: context.sample,
|
|
100
|
-
storage: storage.sample,
|
|
101
|
-
events: events.sample,
|
|
102
|
-
extensions
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
exports.declaration = declaration
|
|
107
|
-
exports.expected = expected
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const clone = require('clone-deep')
|
|
4
|
-
const { generate } = require('randomstring')
|
|
5
|
-
|
|
6
|
-
const fixtures = require('./replay.translate.operation.fixtures')
|
|
7
|
-
const { operation: translate } = require('../src/.replay/.suite/translate')
|
|
8
|
-
|
|
9
|
-
it('should be', () => {
|
|
10
|
-
expect(translate).toBeDefined()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
/** @type {toa.samples.Operation} */
|
|
14
|
-
let declaration
|
|
15
|
-
|
|
16
|
-
/** @type {toa.sampling.Request} */
|
|
17
|
-
let request
|
|
18
|
-
|
|
19
|
-
/** @type {toa.sampling.request.Sample} */
|
|
20
|
-
let expected
|
|
21
|
-
|
|
22
|
-
const autonomous = true
|
|
23
|
-
|
|
24
|
-
beforeEach(() => {
|
|
25
|
-
declaration = clone(fixtures.declaration)
|
|
26
|
-
expected = clone(fixtures.expected)
|
|
27
|
-
request = translate(declaration, autonomous)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('should translate input', () => {
|
|
31
|
-
expect(request).toStrictEqual(expected)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
describe('validation', () => {
|
|
35
|
-
it('should not allow additional properties', () => {
|
|
36
|
-
declaration.foo = generate()
|
|
37
|
-
|
|
38
|
-
expect(() => translate(declaration, true)).toThrow('not expected')
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
describe('specials', () => {
|
|
43
|
-
it('should transform configuration object to permanent sample', async () => {
|
|
44
|
-
const configuration = { foo: generate() }
|
|
45
|
-
const declaration = /** @type {toa.samples.Operation} */ { configuration }
|
|
46
|
-
const request = translate(declaration, true)
|
|
47
|
-
|
|
48
|
-
expect(request.sample.extensions.configuration).toStrictEqual([{
|
|
49
|
-
result: configuration,
|
|
50
|
-
permanent: true
|
|
51
|
-
}])
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('should throw if configuration is provided twice', async () => {
|
|
55
|
-
const configuration = { foo: generate() }
|
|
56
|
-
|
|
57
|
-
const declaration = {
|
|
58
|
-
configuration,
|
|
59
|
-
extensions: {
|
|
60
|
-
configuration: [{
|
|
61
|
-
result: configuration
|
|
62
|
-
}]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
expect(() => translate(declaration, true)).toThrow('ambiguous')
|
|
67
|
-
})
|
|
68
|
-
})
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// noinspection JSCheckFunctionSignatures
|
|
2
|
-
|
|
3
|
-
'use strict'
|
|
4
|
-
|
|
5
|
-
const { Locator } = require('@toa.io/core')
|
|
6
|
-
const stage = jest.requireActual('@toa.io/userland/stage')
|
|
7
|
-
|
|
8
|
-
const manifest = jest.fn(async (path) => stage.manifest(path))
|
|
9
|
-
const composition = jest.fn()
|
|
10
|
-
const shutdown = jest.fn()
|
|
11
|
-
|
|
12
|
-
const remote = jest.fn(async (id) => {
|
|
13
|
-
const [namespace, name] = id.split('.')
|
|
14
|
-
const locator = new Locator(name, namespace)
|
|
15
|
-
const invoke = jest.fn(async (endpoint, request) => request.reply)
|
|
16
|
-
const disconnect = jest.fn(async () => undefined)
|
|
17
|
-
|
|
18
|
-
return { locator, invoke, disconnect }
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const component = jest.fn(async () => {
|
|
22
|
-
const invoke = jest.fn(async (endpoint, request) => request.reply)
|
|
23
|
-
|
|
24
|
-
return { invoke }
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const emit = jest.fn()
|
|
28
|
-
const binding = { binding: { emit } }
|
|
29
|
-
|
|
30
|
-
exports.stage = { manifest, composition, component, remote, shutdown, binding }
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { resolve } = require('node:path')
|
|
4
|
-
const yaml = require('@toa.io/yaml')
|
|
5
|
-
|
|
6
|
-
const { components } = require('../src/suite')
|
|
7
|
-
|
|
8
|
-
it('should be', () => {
|
|
9
|
-
expect(components).toBeDefined()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const dummy = resolve(__dirname, 'context/components/dummy')
|
|
13
|
-
const pot = resolve(__dirname, 'context/components/pot')
|
|
14
|
-
const component = 'dummies.dummy'
|
|
15
|
-
|
|
16
|
-
/** @type {toa.samples.Suite} */
|
|
17
|
-
let suite
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
const paths = [dummy]
|
|
21
|
-
|
|
22
|
-
suite = await components(paths)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('should return object', () => {
|
|
26
|
-
expect(typeof suite).toStrictEqual('object')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('should set title', async () => {
|
|
30
|
-
expect(suite.title).toStrictEqual('Component samples')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('should define suite as autonomous', async () => {
|
|
34
|
-
expect(suite.autonomous).toStrictEqual(true)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('should load operation samples', async () => {
|
|
38
|
-
const expected = await operations()
|
|
39
|
-
|
|
40
|
-
expect(Object.keys(suite.operations)).toStrictEqual([component])
|
|
41
|
-
|
|
42
|
-
const set = suite.operations[component]
|
|
43
|
-
|
|
44
|
-
expect(Object.keys(set)).toStrictEqual(['do', 'undo'])
|
|
45
|
-
|
|
46
|
-
expect(set.do).toStrictEqual(expected.do)
|
|
47
|
-
expect(set.undo).toStrictEqual(expected.undo)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
describe('options', () => {
|
|
51
|
-
const paths = [dummy, pot]
|
|
52
|
-
|
|
53
|
-
it('should filter samples by component id', async () => {
|
|
54
|
-
/** @type {toa.samples.suite.Options} */
|
|
55
|
-
const options = { component: 'dummies.dummy' }
|
|
56
|
-
|
|
57
|
-
suite = await components(paths, options)
|
|
58
|
-
|
|
59
|
-
expect(suite.operations['dummies.pot']).toBeUndefined()
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('should filter samples by operation name', async () => {
|
|
63
|
-
/** @type {toa.samples.suite.Options} */
|
|
64
|
-
const options = { operation: 'do' }
|
|
65
|
-
|
|
66
|
-
suite = await components(paths, options)
|
|
67
|
-
|
|
68
|
-
expect('undo' in suite.operations['dummies.dummy']).toStrictEqual(false)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('should filter operation samples by title', async () => {
|
|
72
|
-
/** @type {toa.samples.suite.Options} */
|
|
73
|
-
const options = { title: 'Should not undo' }
|
|
74
|
-
|
|
75
|
-
suite = await components(paths, options)
|
|
76
|
-
|
|
77
|
-
expect('do' in suite.operations['dummies.dummy']).toStrictEqual(false)
|
|
78
|
-
expect(suite.operations['dummies.dummy'].undo.length).toStrictEqual(1)
|
|
79
|
-
expect(suite.operations['dummies.dummy'].undo[0].title).toStrictEqual(options.title)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('should filter operation samples by title as regexp', async () => {
|
|
83
|
-
/** @type {toa.samples.suite.Options} */
|
|
84
|
-
const options = { title: 'Should [a-z]{2}t undo' }
|
|
85
|
-
|
|
86
|
-
suite = await components(paths, options)
|
|
87
|
-
|
|
88
|
-
expect(suite.operations['dummies.dummy']?.do).toBeUndefined()
|
|
89
|
-
expect(suite.operations['dummies.dummy'].undo.length).toStrictEqual(1)
|
|
90
|
-
expect(suite.operations['dummies.dummy'].undo[0].title).toStrictEqual('Should not undo')
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('should filter operation samples by title', async () => {
|
|
94
|
-
/** @type {toa.samples.suite.Options} */
|
|
95
|
-
const options = { title: 'Should not undo' }
|
|
96
|
-
|
|
97
|
-
suite = await components(paths, options)
|
|
98
|
-
|
|
99
|
-
expect(Object.keys(suite.operations['dummies.dummy']).length).toStrictEqual(1)
|
|
100
|
-
expect(suite.operations['dummies.dummy'].undo[0].title).toStrictEqual(options.title)
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @returns {Promise<toa.samples.operations.Set>}
|
|
106
|
-
*/
|
|
107
|
-
const operations = async () => {
|
|
108
|
-
const path = resolve(dummy, 'samples')
|
|
109
|
-
|
|
110
|
-
/** @type {toa.samples.Operation[]} */
|
|
111
|
-
const do1 = (await yaml.load.all(resolve(path, 'do.yaml')))
|
|
112
|
-
|
|
113
|
-
/** @type {toa.samples.Operation[]} */
|
|
114
|
-
const do2 = (await yaml.load.all(resolve(path, 'dummies.dummy.do.yaml')))
|
|
115
|
-
|
|
116
|
-
/** @type {toa.samples.Operation[]} */
|
|
117
|
-
const undo = (await yaml.load.all(resolve(path, 'dummies.dummy.undo.yaml')))
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
do: [...do1, ...do2], undo
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const { join } = require('node:path')
|
|
4
|
-
const yaml = require('@toa.io/yaml')
|
|
5
|
-
|
|
6
|
-
const { context } = require('../src/suite')
|
|
7
|
-
|
|
8
|
-
it('should be', async () => {
|
|
9
|
-
expect(context).toBeDefined()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
const root = join(__dirname, 'context')
|
|
13
|
-
|
|
14
|
-
/** @type {toa.samples.Suite} */
|
|
15
|
-
let suite
|
|
16
|
-
|
|
17
|
-
beforeAll(async () => {
|
|
18
|
-
suite = await context(root)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
it('should return object', async () => {
|
|
22
|
-
expect(typeof suite).toStrictEqual('object')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('should set title', async () => {
|
|
26
|
-
expect(suite.title).toStrictEqual('Integration samples')
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('should define suite as non-autonomous', async () => {
|
|
30
|
-
expect(suite.autonomous).toStrictEqual(false)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('should load operation samples', async () => {
|
|
34
|
-
const expected = await operations()
|
|
35
|
-
|
|
36
|
-
expect(suite.operations).toStrictEqual(expected)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('should load message samples', async () => {
|
|
40
|
-
const expected = await messages()
|
|
41
|
-
|
|
42
|
-
expect(suite.messages).toStrictEqual(expected)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @returns {Promise<toa.samples.suite.Operations>}
|
|
47
|
-
*/
|
|
48
|
-
const operations = async () => {
|
|
49
|
-
const path = join(root, 'samples')
|
|
50
|
-
const component = 'dummies.dummy'
|
|
51
|
-
const endpoints = ['transit', 'observe']
|
|
52
|
-
|
|
53
|
-
/** @type {toa.samples.suite.Operations} */
|
|
54
|
-
const operations = {}
|
|
55
|
-
|
|
56
|
-
/** @type {toa.samples.operations.Set} */
|
|
57
|
-
const set = operations[component] = {}
|
|
58
|
-
|
|
59
|
-
for (const endpoint of endpoints) {
|
|
60
|
-
const filename = component + '.' + endpoint + '.yaml'
|
|
61
|
-
const filepath = join(path, filename)
|
|
62
|
-
|
|
63
|
-
set[endpoint] = /** @type {toa.samples.Operation[]} */ await yaml.load.all(filepath)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return operations
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @returns {Promise<toa.samples.messages.Set>}
|
|
71
|
-
*/
|
|
72
|
-
const messages = async () => {
|
|
73
|
-
const label = 'somewhere.something.happened'
|
|
74
|
-
const file = label + '.yaml'
|
|
75
|
-
const path = join(root, 'samples/messages', file)
|
|
76
|
-
const samples = /** @type {toa.samples.Message[]} */ await yaml.load.all(path)
|
|
77
|
-
|
|
78
|
-
return { [label]: samples }
|
|
79
|
-
}
|
package/samples/types/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type * as _core from '@toa.io/core'
|
|
2
|
-
import type * as _operation from './operation'
|
|
3
|
-
|
|
4
|
-
declare namespace toa.samples{
|
|
5
|
-
|
|
6
|
-
namespace messages{
|
|
7
|
-
|
|
8
|
-
type Set = Record<string, Message[]>
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type Message = {
|
|
13
|
-
title?: string
|
|
14
|
-
component: string
|
|
15
|
-
payload: Object
|
|
16
|
-
input?: any
|
|
17
|
-
query?: _core.Query
|
|
18
|
-
request?: _operation.Operation | null
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type Message = toa.samples.Message
|
|
24
|
-
export type Set = toa.samples.messages.Set
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as _core from '@toa.io/core'
|
|
2
|
-
import * as _sampling from '@toa.io/extensions.sampling/types/request'
|
|
3
|
-
|
|
4
|
-
declare namespace toa.samples{
|
|
5
|
-
|
|
6
|
-
namespace operations{
|
|
7
|
-
|
|
8
|
-
type Call = {
|
|
9
|
-
input?: any
|
|
10
|
-
output?: any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
type Calls = Record<string, Call[]>
|
|
14
|
-
|
|
15
|
-
type Events = Record<string, Object>
|
|
16
|
-
|
|
17
|
-
type Set = Record<string, Operation[]>
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type Operation = {
|
|
22
|
-
title?: string
|
|
23
|
-
input?: any
|
|
24
|
-
output?: any
|
|
25
|
-
current?: _core.storages.Record
|
|
26
|
-
next?: _core.storages.Record
|
|
27
|
-
remote?: operations.Calls
|
|
28
|
-
local?: operations.Calls
|
|
29
|
-
events?: operations.Events
|
|
30
|
-
extensions?: _sampling.Extensions
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type Operation = toa.samples.Operation
|
|
36
|
-
export type Set = toa.samples.operations.Set
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as _suite from './suite'
|
|
2
|
-
|
|
3
|
-
declare namespace toa.samples.replay {
|
|
4
|
-
|
|
5
|
-
type components = (paths: string[], options?: _suite.Options) => Promise<boolean>
|
|
6
|
-
type context = (path: string, options?: _suite.Options) => Promise<boolean>
|
|
7
|
-
type replay = (suite: _suite.Suite, paths: string[], options?: object) => Promise<boolean>
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type context = toa.samples.replay.context
|
|
12
|
-
export type components = toa.samples.replay.components
|
|
13
|
-
export type replay = toa.samples.replay.replay
|
package/samples/types/suite.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as _core from '@toa.io/core'
|
|
2
|
-
import * as _operations from './operation'
|
|
3
|
-
import * as _messages from './message'
|
|
4
|
-
|
|
5
|
-
declare namespace toa.samples{
|
|
6
|
-
|
|
7
|
-
namespace suite{
|
|
8
|
-
type Operations = Record<string, _operations.Set>
|
|
9
|
-
|
|
10
|
-
type Options = {
|
|
11
|
-
id?: string
|
|
12
|
-
component?: string
|
|
13
|
-
autonomous?: boolean
|
|
14
|
-
integration?: boolean
|
|
15
|
-
operation?: string
|
|
16
|
-
title?: string
|
|
17
|
-
runner?: object
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type Suite = {
|
|
22
|
-
title?: string
|
|
23
|
-
autonomous: boolean
|
|
24
|
-
operations?: suite.Operations
|
|
25
|
-
messages?: _messages.Set
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type Suite = toa.samples.Suite
|
|
31
|
-
export type Options = toa.samples.suite.Options
|