@toa.io/norm 1.0.0-alpha.305 → 1.0.0-alpha.306
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 +8 -0
- package/package.json +4 -4
- package/src/index.js +1 -0
- package/src/map.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.306](https://github.com/toa-io/toa/compare/v1.0.0-alpha.305...v1.0.0-alpha.306) (2026-09-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @toa.io/norm
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [1.0.0-alpha.305](https://github.com/toa-io/toa/compare/v1.0.0-alpha.304...v1.0.0-alpha.305) (2026-09-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @toa.io/norm
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/norm",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.306",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa declarations normalization and validation",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/definitions": "1.0.0-alpha.
|
|
24
|
+
"@toa.io/core": "1.0.0-alpha.306",
|
|
25
|
+
"@toa.io/definitions": "1.0.0-alpha.306",
|
|
26
26
|
"@toa.io/generic": "1.0.0-alpha.304",
|
|
27
27
|
"@toa.io/prototype": "1.0.0-alpha.301",
|
|
28
28
|
"@toa.io/schemas": "1.0.0-alpha.304",
|
|
29
29
|
"fast-glob": "3.3.3"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "0693d180a8053a7d07dca879dac2a3c4784d6d45"
|
|
32
32
|
}
|
package/src/index.js
CHANGED
package/src/map.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every component a Context has, with the version it runs: its own, the ones its extensions
|
|
3
|
+
* bring, and the ones it evicts. A map is not rendered into a workload the way variables are, and
|
|
4
|
+
* an evicted component is called like any other, so it is looked up like any other.
|
|
5
|
+
*
|
|
6
|
+
* @param {toa.norm.Context} context
|
|
7
|
+
* @returns {Record<string, string>}
|
|
8
|
+
*/
|
|
9
|
+
export const map = (context) => {
|
|
10
|
+
const versions = new Map()
|
|
11
|
+
|
|
12
|
+
for (const component of context.components ?? [])
|
|
13
|
+
versions.set(component.locator.id, component.version)
|
|
14
|
+
|
|
15
|
+
// what an extension brings reaches a context as an instance of what it depends on
|
|
16
|
+
for (const instances of Object.values(context.dependencies ?? {}))
|
|
17
|
+
for (const { component } of instances)
|
|
18
|
+
versions.set(component.locator.id, component.version)
|
|
19
|
+
|
|
20
|
+
return Object.fromEntries([...versions].sort(([one], [other]) => one.localeCompare(other)))
|
|
21
|
+
}
|