@toa.io/userland 1.0.0-alpha.342 → 1.0.0-alpha.344
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/CHANGELOG.md +15 -0
- package/package.json +4 -4
- package/stage/readme.md +3 -2
- package/stage/src/component.js +3 -2
- package/stage/src/composition.js +3 -2
- package/stage/src/remote.js +3 -2
- package/stage/src/service.js +3 -2
- package/stage/src/workload.js +3 -2
- package/stage/test/shutdown.test.js +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.0.0-alpha.344](https://github.com/toa-io/toa/compare/v1.0.0-alpha.343...v1.0.0-alpha.344) (2026-11-04)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **stage:** stop what is still connecting when the stage stops ([dbdd30d](https://github.com/toa-io/toa/commit/dbdd30ddbbee6434df82c7c5fee01170d94c2611))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [1.0.0-alpha.343](https://github.com/toa-io/toa/compare/v1.0.0-alpha.342...v1.0.0-alpha.343) (2026-10-29)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @toa.io/userland
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# [1.0.0-alpha.342](https://github.com/toa-io/toa/compare/v1.0.0-alpha.341...v1.0.0-alpha.342) (2026-10-28)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @toa.io/userland
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/userland",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.344",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa development kit",
|
|
6
6
|
"homepage": "https://toa.io",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@toa.io/agent": "1.0.0-alpha.333",
|
|
36
|
-
"@toa.io/boot": "1.0.0-alpha.
|
|
36
|
+
"@toa.io/boot": "1.0.0-alpha.344",
|
|
37
37
|
"@toa.io/core": "1.0.0-alpha.333",
|
|
38
38
|
"@toa.io/generic": "1.0.0-alpha.332",
|
|
39
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
39
|
+
"@toa.io/norm": "1.0.0-alpha.344",
|
|
40
40
|
"@toa.io/schemas": "1.0.0-alpha.332",
|
|
41
41
|
"@toa.io/storages.null": "1.0.0-alpha.333"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "795a286affa7ce1b4445df6b41fc5bc04ce4900d"
|
|
44
44
|
}
|
package/stage/readme.md
CHANGED
|
@@ -36,6 +36,7 @@ Connect the remote.
|
|
|
36
36
|
|
|
37
37
|
## Shutdown
|
|
38
38
|
|
|
39
|
-
`async
|
|
39
|
+
`async shutdown(): void`
|
|
40
40
|
|
|
41
|
-
Shutdown all components, compositions and
|
|
41
|
+
Shutdown all components, compositions, workloads, services and remotes, those still connecting
|
|
42
|
+
included.
|
package/stage/src/component.js
CHANGED
|
@@ -6,9 +6,10 @@ export const component = async (path, options) => {
|
|
|
6
6
|
const manifest = await boot.manifest(path, options)
|
|
7
7
|
const component = await boot.component(manifest)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// held before it connects: one that is still connecting when the stage stops is stopped too
|
|
11
10
|
state.components.push(component)
|
|
12
11
|
|
|
12
|
+
await component.connect()
|
|
13
|
+
|
|
13
14
|
return component
|
|
14
15
|
}
|
package/stage/src/composition.js
CHANGED
|
@@ -5,7 +5,8 @@ import { state } from './state.js'
|
|
|
5
5
|
export const composition = async (paths, options) => {
|
|
6
6
|
const composition = await boot.composition(paths, options)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// held before it connects: one that is still connecting when the stage stops is stopped too
|
|
10
9
|
state.compositions.push(composition)
|
|
10
|
+
|
|
11
|
+
await composition.connect()
|
|
11
12
|
}
|
package/stage/src/remote.js
CHANGED
|
@@ -13,10 +13,11 @@ export const remote = async (id) => {
|
|
|
13
13
|
const locator = new Locator(name, namespace)
|
|
14
14
|
const remote = await boot.remote(locator, SOURCE)
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// held before it connects: one that is still connecting when the stage stops is stopped too
|
|
18
17
|
state.remotes.push(remote)
|
|
19
18
|
|
|
19
|
+
await remote.connect()
|
|
20
|
+
|
|
20
21
|
return remote
|
|
21
22
|
}
|
|
22
23
|
|
package/stage/src/service.js
CHANGED
|
@@ -13,9 +13,10 @@ export const service = async (ref) => {
|
|
|
13
13
|
const factory = new Factory(boot.host())
|
|
14
14
|
const service = await factory.service()
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
// held before it connects: one that is still connecting when the stage stops is stopped too
|
|
18
17
|
state.services.push(service)
|
|
19
18
|
|
|
19
|
+
await service.connect()
|
|
20
|
+
|
|
20
21
|
return service
|
|
21
22
|
}
|
package/stage/src/workload.js
CHANGED
|
@@ -45,9 +45,10 @@ export const workload = async (paths, options, services = []) => {
|
|
|
45
45
|
return root
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
// held before it connects: one that is still connecting when the stage stops is stopped too
|
|
50
49
|
state.workloads.push(workload)
|
|
51
50
|
|
|
51
|
+
await workload.connect()
|
|
52
|
+
|
|
52
53
|
return workload
|
|
53
54
|
}
|
|
@@ -44,6 +44,46 @@ it('should disconnect compositions', async () => {
|
|
|
44
44
|
assert.ok(composition.disconnect.mock.callCount() > 0)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
+
it('should disconnect a composition still connecting', async () => {
|
|
48
|
+
const paths = [generate(), generate()]
|
|
49
|
+
const connecting = {
|
|
50
|
+
connect: mocking.fn(() => new Promise(() => undefined)),
|
|
51
|
+
disconnect: mocking.fn(),
|
|
52
|
+
link: mocking.fn()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
mock.boot.composition.mock.mockImplementationOnce(async () => connecting)
|
|
56
|
+
|
|
57
|
+
void stage.composition(paths)
|
|
58
|
+
|
|
59
|
+
// booted, and connecting
|
|
60
|
+
while (connecting.connect.mock.callCount() === 0)
|
|
61
|
+
await new Promise((resolve) => setImmediate(resolve))
|
|
62
|
+
|
|
63
|
+
await stage.shutdown()
|
|
64
|
+
|
|
65
|
+
assert.ok(connecting.disconnect.mock.callCount() > 0)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('should disconnect a component still connecting', async () => {
|
|
69
|
+
const connecting = {
|
|
70
|
+
connect: mocking.fn(() => new Promise(() => undefined)),
|
|
71
|
+
disconnect: mocking.fn(),
|
|
72
|
+
link: mocking.fn()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
mock.boot.component.mock.mockImplementationOnce(async () => connecting)
|
|
76
|
+
|
|
77
|
+
void stage.component(generate())
|
|
78
|
+
|
|
79
|
+
while (connecting.connect.mock.callCount() === 0)
|
|
80
|
+
await new Promise((resolve) => setImmediate(resolve))
|
|
81
|
+
|
|
82
|
+
await stage.shutdown()
|
|
83
|
+
|
|
84
|
+
assert.ok(connecting.disconnect.mock.callCount() > 0)
|
|
85
|
+
})
|
|
86
|
+
|
|
47
87
|
it('should disconnect remotes', async () => {
|
|
48
88
|
const id = generate() + '.' + generate()
|
|
49
89
|
|