@toa.io/userland 1.0.0-alpha.272 → 1.0.0-alpha.274

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 CHANGED
@@ -3,6 +3,211 @@
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.274](https://github.com/toa-io/toa/compare/v1.0.0-alpha.273...v1.0.0-alpha.274) (2026-09-02)
7
+
8
+
9
+ * Configuration is served by a component, followed live, and kept per epoch (#1017) ([b05997d](https://github.com/toa-io/toa/commit/b05997d3adb784f238a222cb46878b23859339a2)), closes [#1017](https://github.com/toa-io/toa/issues/1017)
10
+
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * a secret configuration value is an object, not a string;
15
+ read it with `unwrap()`.
16
+
17
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
18
+
19
+ * test(configuration): wait for the second round rather than assume it
20
+
21
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
22
+
23
+ * refactor(configuration)!: read a secret with its own unwrap
24
+
25
+ Component code depends on no Toa package, so a secret is read as
26
+ `context.configuration.apiKey.unwrap()` and the helper in `@toa.io/generic`
27
+ goes. A value a component reads as a secret is therefore given as a reference:
28
+ `identity.basic` no longer defaults `pepper` to `''`, the development context
29
+ and the feature harness give the token keys, the federation client secret and
30
+ the signing key as references, and the harness has a step for the secrets a
31
+ scenario refers to. CONTRIBUTING states the rule.
32
+ * `identity.basic` `pepper` has no default; a value read as a
33
+ secret must be given as a `$NAME` reference.
34
+
35
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
36
+
37
+ * feat(configuration): list the configurations
38
+
39
+ `configuration.values.list` returns every component's configuration for its
40
+ deployed epoch, by component name, and `GET /configuration/values/` serves it
41
+ behind `system:configuration:get`.
42
+
43
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
44
+
45
+ * fix(exposition): write a value in YAML the way its toJSON says
46
+
47
+ A redacted secret in a reply was dumped as an empty object; it is written as
48
+ `<REDACTED>`, as JSON and msgpack already write it.
49
+
50
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
51
+
52
+ * test(configuration): a secret is an object, and stays redacted in a reply
53
+
54
+ A component with `{ a: 1, b: $SECRET_B }` returns its configuration as
55
+ `{ a: 1, b: '<REDACTED>' }` and the secret itself through `unwrap()`. The reply
56
+ step also accepts a reply as a caller across a process boundary receives it,
57
+ since a call within the process hands the object over as it is.
58
+
59
+ Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
60
+
61
+ * chore(schemas): bump the dependencies
62
+
63
+ ajv 8.18.0 to 8.20.0, ajv-formats 2.1.1 to 3.0.1, better-ajv-errors 1.2.0
64
+ to 2.0.3, fast-glob 3.2.12 to 3.3.3 and js-yaml 4.3.1 to 5.4.1 — the version
65
+ exposition already uses. The three majors keep the CommonJS entry points this
66
+ library calls: ajv-formats as a function, better-ajv-errors as .default, and
67
+ js-yaml's load.
68
+
69
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
70
+
71
+ * feat(configuration)!: serve the schema with the value
72
+
73
+ GET /configuration/values/:component/ answers { configuration, schema, epoch }
74
+ where it answered with the configuration alone, and list carries the schema of
75
+ every component. Nothing reads a configuration without needing to know what it
76
+ is checked against, and the schema was only ever on the values service.
77
+
78
+ An epoch the deployment does not know has no schema; the value stored for it
79
+ is still returned.
80
+
81
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
82
+
83
+ * feat(configuration): publish a configuration UI
84
+
85
+ The values service serves a page at /.configuration on port 8003, out of the
86
+ directory ui builds: the configured components, a screen per component showing
87
+ what it holds now, and a dialog creating the next one. Reading needs
88
+ system:configuration:get and creating needs system:configuration:create.
89
+
90
+ A configuration is immutable, so the dialog opens on the current value and what
91
+ is left out of it is left out of the component. The editor takes YAML, the
92
+ schema is applied before anything is sent, and a secret is a reference the page
93
+ never shows.
94
+
95
+ The page is always published: the annotation is the per-component values map
96
+ and has nowhere to carry a switch.
97
+
98
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
99
+
100
+ * feat(introspection): link a component to its configuration
101
+
102
+ A card carrying @toa.io/extensions.configuration reads that extension as a link
103
+ to the configuration UI rather than as a name, and configuration joins the
104
+ namespaces the runtime provides, so its components band under System.
105
+
106
+ Deployed, both pages sit behind the same ingress and the path alone is right;
107
+ locally each console has its own port.
108
+
109
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
110
+
111
+ * feat(introspection): scroll the map, zoom with a modifier
112
+
113
+ The map was grabbed to move and zoomed with a bare wheel, which is neither what
114
+ a page does nor what the wheel does anywhere else. A plain scroll now pans on
115
+ both axes and the wheel scales only with the modifier held — a trackpad pinch
116
+ arrives as one of those on every platform.
117
+
118
+ A card's own scrollable box keeps its wheel, in both paths.
119
+
120
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
121
+
122
+ * refactor(introspection): centre the filter in the header
123
+
124
+ The sides take equal space, which is what leaves the filter between them.
125
+ Neither side may shrink under what it holds, or the tabs run out from under
126
+ their side and across the filter, and the filter across the sign-out button;
127
+ the title gives way instead.
128
+
129
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
130
+
131
+ * fix(configuration): connect the UI to the values service
132
+
133
+ The page was declared as a dependency from inside `open`, and a connector connects
134
+ what it depends on before `open` runs — so the server was constructed and never
135
+ listened. Nothing caught it: the UI feature builds the server itself.
136
+
137
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
138
+
139
+ * feat(configuration)!: reserve resources in the annotation
140
+
141
+ The values service deploys like any other and must state what it may take, but the
142
+ annotation is a map of component ids and had nowhere to put it — so `toa env` failed
143
+ for every context using configuration unless it declared a context-wide `resources`.
144
+
145
+ `resources` is now the service's own, read the way `introspection` and `realtime` read
146
+ theirs. A component actually named `resources` is written `default.resources`, which is
147
+ what its id is anyway.
148
+
149
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
150
+
151
+ * feat(configuration): follow the system colour scheme
152
+
153
+ The dark tokens were behind a `.dark` class nothing sets, and the `dark:` variant was
154
+ pointed at that class too — so a component's own dark styling never applied either.
155
+ Both now key off `prefers-color-scheme`, and `color-scheme` hands the native chrome
156
+ the same answer.
157
+
158
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
159
+
160
+ * feat(introspection): follow the system colour scheme
161
+
162
+ The dark tokens were behind a `.dark` class nothing sets, and the `dark:` variant was
163
+ pointed at that class too — so a component's own dark styling never applied either.
164
+ Both now key off `prefers-color-scheme`, and `color-scheme` hands the native chrome
165
+ the same answer.
166
+
167
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
168
+
169
+ * feat(configuration): present a change as an edit of what is there
170
+
171
+ A configuration is immutable and creating one replaces the whole of it, but the dialog
172
+ opens on the current value and the page never shows an older one — so what the reader
173
+ does is edit. The words follow: Edit rather than New, Update rather than Create, and
174
+ the paragraph explaining the model goes, along with the field's label, which the title
175
+ above it already said.
176
+
177
+ The editor also stayed as wide as its longest line — `field-sizing: content` sizes to
178
+ content, and no `max-width` clamps that — so a long value painted outside the dialog.
179
+ It is fixed now, the dialog takes the width the screen has rather than a fixed step,
180
+ and the band held for errors no longer leaves a gap when there are none.
181
+
182
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
183
+
184
+ * feat(configuration): mark a component that keeps a secret
185
+
186
+ A key after the name on the row, wherever the configuration holds a reference, however
187
+ deep. The predicate reads the same lines the value screen renders, so the two cannot
188
+ disagree about what counts as a secret.
189
+
190
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
191
+
192
+ * feat(configuration): lead back to the list from the title
193
+
194
+ Every address ends in a slash, so the way up is the address itself on the list and one
195
+ level above it on a component's screen — which holds wherever the page is mounted.
196
+
197
+ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
198
+
199
+
200
+
201
+
202
+
203
+ # [1.0.0-alpha.273](https://github.com/toa-io/toa/compare/v1.0.0-alpha.272...v1.0.0-alpha.273) (2026-09-02)
204
+
205
+ **Note:** Version bump only for package @toa.io/userland
206
+
207
+
208
+
209
+
210
+
6
211
  # [1.0.0-alpha.272](https://github.com/toa-io/toa/compare/v1.0.0-alpha.271...v1.0.0-alpha.272) (2026-09-01)
7
212
 
8
213
  **Note:** Version bump only for package @toa.io/userland
@@ -2,12 +2,16 @@ name: echo
2
2
 
3
3
  operations:
4
4
  signal:
5
- output: string
5
+ output:
6
+ type: string
6
7
  get:
7
- output: string
8
+ output:
9
+ type: string
8
10
  resolve:
9
- input: string
10
- output: string
11
+ input:
12
+ type: string
13
+ output:
14
+ type: string
11
15
 
12
16
  configuration:
13
17
  schema:
@@ -4,11 +4,22 @@ namespace: math
4
4
  operations:
5
5
  add:
6
6
  input:
7
- a: number
8
- b: number
9
- output: number
7
+ properties:
8
+ a:
9
+ type: number
10
+ b:
11
+ type: number
12
+ type: object
13
+ output:
14
+ type: number
10
15
  increment:
11
16
  input:
12
- value: number
13
- times: 1
14
- output: number
17
+ properties:
18
+ value:
19
+ type: number
20
+ times:
21
+ type: number
22
+ default: 1
23
+ type: object
24
+ output:
25
+ type: number
@@ -4,6 +4,11 @@ namespace: math
4
4
  operations:
5
5
  add:
6
6
  input:
7
- a: number
8
- b: number
9
- output: number
7
+ properties:
8
+ a:
9
+ type: number
10
+ b:
11
+ type: number
12
+ type: object
13
+ output:
14
+ type: number
@@ -4,20 +4,43 @@ namespace: tea
4
4
  entity:
5
5
  storage: mongodb
6
6
  schema:
7
- material*: [glass, ceramic, steel]
8
- volume: number
9
- booked: false
7
+ properties:
8
+ volume:
9
+ type: number
10
+ booked:
11
+ type: boolean
12
+ default: false
13
+ material:
14
+ type: string
15
+ enum:
16
+ - glass
17
+ - ceramic
18
+ - steel
19
+ type: object
20
+ required:
21
+ - material
10
22
 
11
23
  operations:
12
24
  transit:
13
25
  concurrency: none
14
26
  input:
15
- material: .
16
- volume: .
17
- booked: .
27
+ properties:
28
+ material:
29
+ type: string
30
+ default: .
31
+ volume:
32
+ type: string
33
+ default: .
34
+ booked:
35
+ type: string
36
+ default: .
37
+ type: object
18
38
  same:
19
- input: .material
20
- output: array
39
+ input:
40
+ type: string
41
+ default: .material
42
+ output:
43
+ type: array
21
44
 
22
45
  receivers:
23
46
  store.orders.created:
@@ -2,4 +2,5 @@ name: web
2
2
 
3
3
  operations:
4
4
  get:
5
- output: object
5
+ output:
6
+ type: object
@@ -11,6 +11,8 @@ let math
11
11
 
12
12
  beforeAll(async () => {
13
13
  process.env.TOA_DEV = '1'
14
+ process.env.TOA_CONFIGURATION_DEFAULT_ECHO = '{}'
15
+ process.env.TOA_CONFIGURATION_TEA_POTS = '{}'
14
16
 
15
17
  const paths = ['echo', 'math.calculations'].map((rel) => resolve(root, rel))
16
18
 
@@ -1,51 +1,97 @@
1
1
  'use strict'
2
2
 
3
3
  const { resolve } = require('node:path')
4
+ const boot = require('@toa.io/boot')
5
+ const { Connector, Locator } = require('@toa.io/core')
6
+ const { timeout } = require('@toa.io/generic')
4
7
  const stage = require('@toa.io/userland/stage')
5
8
 
6
- const binding = stage.binding.binding
7
9
  const root = resolve(__dirname, '../components')
8
10
 
9
11
  let remote
12
+ let emitter
13
+ let consumer
10
14
 
11
15
  beforeAll(async () => {
12
16
  process.env.TOA_DEV = '1'
17
+ process.env.TOA_CONFIGURATION_TEA_POTS = '{}'
18
+
19
+ // the outbox pumps on a tick; at the default five seconds a test would end before it ran
20
+ process.env.TOA_OUTBOX_INTERVAL = '100'
13
21
 
14
22
  const path = resolve(root, 'tea.pots')
15
23
 
16
24
  await stage.composition([path])
17
25
 
18
26
  remote = await stage.remote('tea.pots')
27
+
28
+ // what `store.orders` would emit, sent the way it would send it
29
+ emitter = boot.bindings.emit(AMQP, new Locator('orders', 'store'), 'created')
30
+
31
+ await emitter.connect()
19
32
  })
20
33
 
21
34
  afterAll(async () => {
35
+ await consumer?.disconnect()
36
+ await emitter.disconnect()
22
37
  await stage.shutdown()
23
38
 
24
39
  delete process.env.TOA_DEV
40
+ delete process.env.TOA_CONFIGURATION_TEA_POTS
41
+ delete process.env.TOA_OUTBOX_INTERVAL
25
42
  })
26
43
 
27
44
  it('should receive event', async () => {
28
45
  const created = await remote.invoke('transit', { input: { material: 'glass' } })
29
46
  const id = created.id
30
- const payload = { pot: id }
31
- const message = { payload }
32
47
  const request = { query: { id } }
33
48
 
34
- await binding.emit('store.orders.created', message)
49
+ await emitter.emit({ payload: { pot: id } })
50
+
51
+ // the receiver books the pot on delivery, which is asynchronous
52
+ const deadline = Date.now() + 5000
35
53
 
36
- const reply = await remote.invoke('observe', request)
54
+ let reply
55
+
56
+ do {
57
+ await timeout(50)
58
+
59
+ reply = await remote.invoke('observe', request)
60
+ } while (reply.booked !== true && Date.now() < deadline)
37
61
 
38
62
  expect(reply.booked).toStrictEqual(true)
39
63
  })
40
64
 
41
65
  it('should emit event', async () => {
42
- expect.assertions(1)
43
-
44
66
  const material = 'steel'
45
67
 
46
- await binding.subscribe('tea.pots.created', (pot) => {
47
- expect(pot.payload.material).toStrictEqual(material)
68
+ const received = new Promise((resolve) => {
69
+ consumer = boot.receive('tea.pots.created', new Subscriber(resolve))
48
70
  })
49
71
 
72
+ consumer = await consumer
73
+
74
+ await consumer.connect()
50
75
  await remote.invoke('transit', { input: { material } })
76
+
77
+ const payload = await received
78
+
79
+ expect(payload.material).toStrictEqual(material)
51
80
  })
81
+
82
+ /** What the event consumer hands deliveries to. */
83
+ class Subscriber extends Connector {
84
+ #handler
85
+
86
+ constructor (handler) {
87
+ super()
88
+
89
+ this.#handler = handler
90
+ }
91
+
92
+ async receive (message) {
93
+ this.#handler(message.payload)
94
+ }
95
+ }
96
+
97
+ const AMQP = '@toa.io/bindings.amqp'
@@ -10,6 +10,8 @@ let component
10
10
 
11
11
  beforeAll(async () => {
12
12
  process.env.TOA_DEV = '1'
13
+ process.env.TOA_CONFIGURATION_DEFAULT_ECHO = '{}'
14
+ process.env.TOA_CONFIGURATION_TEA_POTS = '{}'
13
15
 
14
16
  const path = resolve(root, 'math.calculations')
15
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/userland",
3
- "version": "1.0.0-alpha.272",
3
+ "version": "1.0.0-alpha.274",
4
4
  "description": "Toa development kit",
5
5
  "homepage": "https://toa.io",
6
6
  "author": {
@@ -24,14 +24,13 @@
24
24
  "main": "src/index.js",
25
25
  "types": "types/index.d.ts",
26
26
  "dependencies": {
27
- "@toa.io/boot": "1.0.0-alpha.272",
28
- "@toa.io/core": "1.0.0-alpha.272",
29
- "@toa.io/filesystem": "1.0.0-alpha.272",
30
- "@toa.io/generic": "1.0.0-alpha.272",
31
- "@toa.io/norm": "1.0.0-alpha.272",
32
- "@toa.io/schemas": "1.0.0-alpha.272",
27
+ "@toa.io/boot": "1.0.0-alpha.274",
28
+ "@toa.io/core": "1.0.0-alpha.273",
29
+ "@toa.io/generic": "1.0.0-alpha.273",
30
+ "@toa.io/norm": "1.0.0-alpha.274",
31
+ "@toa.io/schemas": "1.0.0-alpha.274",
33
32
  "@toa.io/storages.null": "0.22.0",
34
- "@toa.io/yaml": "1.0.0-alpha.272"
33
+ "js-yaml": "4.3.1"
35
34
  },
36
- "gitHead": "1a451755445935c04cf5b373bcc73942cac0bb10"
35
+ "gitHead": "7df32eb2872155c45681c299036b1efbeefd6518"
37
36
  }