@toa.io/boot 1.0.0-alpha.314 → 1.0.0-alpha.316
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 +17 -0
- package/package.json +7 -7
- package/src/map.js +12 -2
- package/src/remote.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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.316](https://github.com/toa-io/toa/compare/v1.0.0-alpha.315...v1.0.0-alpha.316) (2026-09-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @toa.io/boot
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.0.0-alpha.315](https://github.com/toa-io/toa/compare/v1.0.0-alpha.314...v1.0.0-alpha.315) (2026-09-23)
|
|
15
|
+
|
|
16
|
+
* feat(map)!: leave out of a contract what the runtime gives every component ([b81837a](https://github.com/toa-io/toa/commit/b81837a3bc4771d7ee1c10fe613c9a1d7501bf1a))
|
|
17
|
+
|
|
18
|
+
### BREAKING CHANGES
|
|
19
|
+
|
|
20
|
+
* the deployed component map is `/etc/toa/.map.json.gz`.
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [1.0.0-alpha.314](https://github.com/toa-io/toa/compare/v1.0.0-alpha.313...v1.0.0-alpha.314) (2026-09-19)
|
|
7
24
|
|
|
8
25
|
* feat(core)!: let an operation state how long its calls are remembered ([af177c2](https://github.com/toa-io/toa/commit/af177c2ab3d00d475840b5ef9e612f04e82b72bd))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/boot",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.316",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa Boot",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@toa.io/atomicity": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
26
|
-
"@toa.io/definitions": "1.0.0-alpha.
|
|
24
|
+
"@toa.io/atomicity": "1.0.0-alpha.315",
|
|
25
|
+
"@toa.io/core": "1.0.0-alpha.315",
|
|
26
|
+
"@toa.io/definitions": "1.0.0-alpha.316",
|
|
27
27
|
"@toa.io/generic": "1.0.0-alpha.311",
|
|
28
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
28
|
+
"@toa.io/norm": "1.0.0-alpha.316",
|
|
29
29
|
"@toa.io/schemas": "1.0.0-alpha.311",
|
|
30
30
|
"clone-deep": "4.0.1",
|
|
31
|
-
"dotenv": "
|
|
31
|
+
"dotenv": "18.0.0",
|
|
32
32
|
"openspan": "1.0.0-alpha.305"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "1a873a2f74dc27cc82cc523aa4557a38f23593c6"
|
|
35
35
|
}
|
package/src/map.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
|
+
import { gunzipSync } from 'node:zlib'
|
|
2
3
|
import { readFile } from 'node:fs/promises'
|
|
3
4
|
import * as core from '@toa.io/core'
|
|
4
5
|
|
|
@@ -78,6 +79,9 @@ export const contract = async (id) => {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/**
|
|
82
|
+
* A map is read gzipped where it is deployed and plain where it is not, so what it is is told by
|
|
83
|
+
* its first two bytes rather than by its name.
|
|
84
|
+
*
|
|
81
85
|
* @param {string} path
|
|
82
86
|
* @returns {Promise<Record<string, import('@toa.io/core').Contract>>}
|
|
83
87
|
*/
|
|
@@ -85,13 +89,19 @@ async function read(path) {
|
|
|
85
89
|
let contents
|
|
86
90
|
|
|
87
91
|
try {
|
|
88
|
-
contents = await readFile(path
|
|
92
|
+
contents = await readFile(path)
|
|
89
93
|
} catch (cause) {
|
|
90
94
|
throw new Error(`Cannot read the component map '${path}'`, { cause })
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
try {
|
|
94
|
-
|
|
98
|
+
if (contents[0] === 0x1f && contents[1] === 0x8b) contents = gunzipSync(contents)
|
|
99
|
+
} catch (cause) {
|
|
100
|
+
throw new Error(`The component map '${path}' is not readable gzip`, { cause })
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
return JSON.parse(contents.toString('utf8'))
|
|
95
105
|
} catch (cause) {
|
|
96
106
|
throw new Error(`The component map '${path}' is not JSON`, { cause })
|
|
97
107
|
}
|
package/src/remote.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Remote, exceptions } from '@toa.io/core'
|
|
1
|
+
import { Remote, contract as coreContract, exceptions } from '@toa.io/core'
|
|
2
2
|
import { remap } from '@toa.io/generic'
|
|
3
3
|
|
|
4
4
|
import * as boot from './index.js'
|
|
@@ -11,13 +11,17 @@ import * as boot from './index.js'
|
|
|
11
11
|
* tenant announced — and absent it, what the map this process was given states.
|
|
12
12
|
*/
|
|
13
13
|
export const remote = async (locator, source, options = {}) => {
|
|
14
|
-
const
|
|
14
|
+
const stated = options.contract ?? (await boot.map.contract(locator.id))
|
|
15
15
|
|
|
16
|
-
if (
|
|
16
|
+
if (stated === undefined)
|
|
17
17
|
throw new exceptions.UnstatedException(
|
|
18
18
|
`Cannot call '${locator.id}': the component map states nothing of it. Run \`toa map\`.`
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
+
// a contract states once, or not at all, what the runtime gives every component; the calls
|
|
22
|
+
// are made from the whole of it
|
|
23
|
+
const contract = coreContract.restore(stated)
|
|
24
|
+
|
|
21
25
|
// a call binds its consumers, which are loaded rather than required
|
|
22
26
|
const calls =
|
|
23
27
|
contract.operations === undefined
|