@toa.io/norm 1.0.0-alpha.259 → 1.0.0-alpha.262
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 +12 -0
- package/package.json +3 -3
- package/src/.component/.expand/extensions.js +2 -1
- package/src/.component/extensions.js +2 -1
- package/src/.context/.dependencies/extensions.js +9 -5
- package/src/.context/schema.yaml +15 -0
- package/src/shortcuts.js +2 -1
- package/test/component/normalize.test.js +2 -1
- package/types/context/declaration.d.ts +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.262](https://github.com/toa-io/toa/compare/v1.0.0-alpha.261...v1.0.0-alpha.262) (2026-08-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **introspection:** add the introspection extension ([a07ed86](https://github.com/toa-io/toa/commit/a07ed8651404258d544f3b6d8236e58cf4da09ac))
|
|
12
|
+
* **operations:** let a service claim a path prefix on the host ([02677d1](https://github.com/toa-io/toa/commit/02677d17fcd4222b07c3be458d93bcc496a016a8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
# [1.0.0-alpha.259](https://github.com/toa-io/toa/compare/v1.0.0-alpha.258...v1.0.0-alpha.259) (2026-08-24)
|
|
7
19
|
|
|
8
20
|
**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.262",
|
|
4
4
|
"description": "Toa declarations normalization and validation",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
23
|
+
"@toa.io/core": "1.0.0-alpha.262",
|
|
24
24
|
"@toa.io/generic": "1.0.0-alpha.254",
|
|
25
25
|
"@toa.io/schemas": "1.0.0-alpha.254",
|
|
26
26
|
"@toa.io/yaml": "1.0.0-alpha.254"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "e14059cf5cc364d933f2a4b3d7114f3b5ec0764f"
|
|
29
29
|
}
|
|
@@ -13,7 +13,8 @@ const SHORTCUTS = {
|
|
|
13
13
|
configuration: '@toa.io/extensions.configuration',
|
|
14
14
|
state: '@toa.io/extensions.state',
|
|
15
15
|
stash: '@toa.io/extensions.stash',
|
|
16
|
-
storages: '@toa.io/extensions.storages'
|
|
16
|
+
storages: '@toa.io/extensions.storages',
|
|
17
|
+
introspection: '@toa.io/extensions.introspection'
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
exports.extensions = extensions
|
|
@@ -34,7 +34,8 @@ const extensions = (manifest) => {
|
|
|
34
34
|
|
|
35
35
|
const PREDEFINED = {
|
|
36
36
|
'@toa.io/extensions.telemetry': null,
|
|
37
|
-
'@toa.io/extensions.fetch': null
|
|
37
|
+
'@toa.io/extensions.fetch': null,
|
|
38
|
+
'@toa.io/extensions.introspection': null
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
exports.extensions = extensions
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const extensions = async (context) => {
|
|
4
4
|
const extensions = {}
|
|
5
5
|
const components = context.components?.slice() ?? []
|
|
6
|
-
const extracted = await extractExtensionComponents(components, extensions)
|
|
6
|
+
const extracted = await extractExtensionComponents(components, extensions, context.annotations)
|
|
7
7
|
|
|
8
8
|
components.push(...extracted)
|
|
9
9
|
|
|
@@ -20,8 +20,9 @@ const extensions = async (context) => {
|
|
|
20
20
|
return { extensions, components: extracted }
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async function extractExtensionComponents (components, extensions) {
|
|
23
|
+
async function extractExtensionComponents (components, extensions, annotations) {
|
|
24
24
|
const { component: load } = require('../../component')
|
|
25
|
+
const { load: loadDependency } = require('./load')
|
|
25
26
|
|
|
26
27
|
const extracted = []
|
|
27
28
|
|
|
@@ -33,11 +34,14 @@ async function extractExtensionComponents (components, extensions) {
|
|
|
33
34
|
|
|
34
35
|
extensions[reference] = []
|
|
35
36
|
|
|
36
|
-
const mod =
|
|
37
|
+
const { metadata, module: mod } = loadDependency(reference)
|
|
37
38
|
|
|
38
39
|
if (mod.components === undefined) continue
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
// the annotation decides whether an extension contributes components at all
|
|
42
|
+
const annotation = annotations?.[metadata?.name ?? reference]
|
|
43
|
+
|
|
44
|
+
for (const path of mod.components(annotation).paths) {
|
|
41
45
|
const component = await load(path)
|
|
42
46
|
|
|
43
47
|
extracted.push(component)
|
|
@@ -48,7 +52,7 @@ async function extractExtensionComponents (components, extensions) {
|
|
|
48
52
|
if (extracted.length === 0)
|
|
49
53
|
return extracted
|
|
50
54
|
|
|
51
|
-
const deeper = await extractExtensionComponents(extracted, extensions)
|
|
55
|
+
const deeper = await extractExtensionComponents(extracted, extensions, annotations)
|
|
52
56
|
|
|
53
57
|
return extracted.concat(deeper)
|
|
54
58
|
}
|
package/src/.context/schema.yaml
CHANGED
|
@@ -86,6 +86,21 @@ properties:
|
|
|
86
86
|
type: string
|
|
87
87
|
minItems: 2
|
|
88
88
|
maxItems: 2
|
|
89
|
+
ingress:
|
|
90
|
+
type: object
|
|
91
|
+
additionalProperties: false
|
|
92
|
+
properties:
|
|
93
|
+
hosts:
|
|
94
|
+
type: array
|
|
95
|
+
minItems: 1
|
|
96
|
+
items:
|
|
97
|
+
type: string
|
|
98
|
+
class:
|
|
99
|
+
type: string
|
|
100
|
+
annotations:
|
|
101
|
+
type: object
|
|
102
|
+
default:
|
|
103
|
+
type: boolean
|
|
89
104
|
annotations:
|
|
90
105
|
type: object
|
|
91
106
|
required: [runtime, name, registry]
|
package/src/shortcuts.js
CHANGED
|
@@ -50,7 +50,8 @@ const SHORTCUTS = {
|
|
|
50
50
|
configuration: '@toa.io/extensions.configuration',
|
|
51
51
|
stash: '@toa.io/extensions.stash',
|
|
52
52
|
storages: '@toa.io/extensions.storages',
|
|
53
|
-
telemetry: '@toa.io/extensions.telemetry'
|
|
53
|
+
telemetry: '@toa.io/extensions.telemetry',
|
|
54
|
+
introspection: '@toa.io/extensions.introspection'
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
exports.recognize = recognize
|
|
@@ -15,6 +15,16 @@ export interface Mono {
|
|
|
15
15
|
resources?: Resources
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Cluster-level ingress configuration, applied to every service that declares one.
|
|
20
|
+
*/
|
|
21
|
+
export interface Ingress {
|
|
22
|
+
hosts?: string[]
|
|
23
|
+
class?: string
|
|
24
|
+
annotations?: Record<string, string>
|
|
25
|
+
default?: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
export interface Declaration {
|
|
19
29
|
name: string
|
|
20
30
|
description?: string
|
|
@@ -23,5 +33,6 @@ export interface Declaration {
|
|
|
23
33
|
registry?: Registry | string
|
|
24
34
|
compositions?: Composition[]
|
|
25
35
|
mono?: Mono
|
|
36
|
+
ingress?: Ingress
|
|
26
37
|
annotations?: Record<string, object>
|
|
27
38
|
}
|