@toa.io/boot 1.0.0-alpha.320 → 1.0.0-alpha.322

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,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.322](https://github.com/toa-io/toa/compare/v1.0.0-alpha.321...v1.0.0-alpha.322) (2026-09-29)
7
+
8
+ **Note:** Version bump only for package @toa.io/boot
9
+
10
+
11
+
12
+
13
+
14
+ # [1.0.0-alpha.321](https://github.com/toa-io/toa/compare/v1.0.0-alpha.320...v1.0.0-alpha.321) (2026-09-28)
15
+
16
+ ### Features
17
+
18
+ * **core:** give a destination that carries changes to other regions what the regional ones write ([a7d2fd1](https://github.com/toa-io/toa/commit/a7d2fd1eecd50645d14f7cb5c588069c3073ba72))
19
+
20
+
6
21
  # [1.0.0-alpha.320](https://github.com/toa-io/toa/compare/v1.0.0-alpha.319...v1.0.0-alpha.320) (2026-09-28)
7
22
 
8
23
  **Note:** Version bump only for package @toa.io/boot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/boot",
3
- "version": "1.0.0-alpha.320",
3
+ "version": "1.0.0-alpha.322",
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.320",
25
- "@toa.io/core": "1.0.0-alpha.320",
26
- "@toa.io/definitions": "1.0.0-alpha.320",
24
+ "@toa.io/atomicity": "1.0.0-alpha.322",
25
+ "@toa.io/core": "1.0.0-alpha.322",
26
+ "@toa.io/definitions": "1.0.0-alpha.322",
27
27
  "@toa.io/generic": "1.0.0-alpha.311",
28
- "@toa.io/norm": "1.0.0-alpha.320",
28
+ "@toa.io/norm": "1.0.0-alpha.322",
29
29
  "@toa.io/schemas": "1.0.0-alpha.311",
30
30
  "clone-deep": "4.0.1",
31
31
  "dotenv": "18.0.3",
32
32
  "openspan": "1.0.0-alpha.305"
33
33
  },
34
- "gitHead": "5ef92ab939a596e4ac820965c59c015820eba7b2"
34
+ "gitHead": "ef65352a8bd7bc0ef400fcc8cde0e19a3bb92199"
35
35
  }
package/src/component.js CHANGED
@@ -38,6 +38,9 @@ const create = async (manifest, locator) => {
38
38
  // a destination that renders the component's events renders them with its context
39
39
  await boot.rendering(manifest, destinations, context)
40
40
 
41
+ // and one that carries a change to other regions carries what the regional ones write
42
+ boot.regional(destinations)
43
+
41
44
  const outbox = boot.outbox(manifest, storage, emission, destinations)
42
45
 
43
46
  let state
package/src/index.js CHANGED
@@ -23,6 +23,7 @@ export { operation } from './operation.js'
23
23
  export { receivers, receive } from './receivers.js'
24
24
  export { remote } from './remote.js'
25
25
  export { rendering } from './rendering.js'
26
+ export { regional } from './regional.js'
26
27
  export { storage } from './storage.js'
27
28
  export { guards } from './guards.js'
28
29
  export { host } from './host.js'
@@ -0,0 +1,18 @@
1
+ import { Regional } from '@toa.io/core'
2
+
3
+ /**
4
+ * Gives every destination that carries a change to other regions the others that write to
5
+ * something each region keeps for itself. Neither knows what the other is: the carrier is given
6
+ * what they export, and hands back what arrives.
7
+ *
8
+ * @param {import('@toa.io/core/types').outbox.Destination[]} destinations
9
+ * @returns {void}
10
+ */
11
+ export const regional = (destinations) => {
12
+ const regionals = destinations.filter((destination) => Regional.is(destination))
13
+
14
+ if (regionals.length === 0) return
15
+
16
+ for (const destination of destinations)
17
+ if (destination.carries === true) destination.regional = new Regional(regionals)
18
+ }
@@ -0,0 +1,28 @@
1
+ import { it } from 'node:test'
2
+ import assert from 'node:assert/strict'
3
+
4
+ import { regional } from './regional.js'
5
+
6
+ const regionalDestination = (name) => ({
7
+ name,
8
+ export: async () => [name],
9
+ import: async () => undefined
10
+ })
11
+
12
+ it('should give a carrier the regional destinations', async () => {
13
+ const carrier = { name: 'convergence', carries: true }
14
+ const events = { name: 'events' }
15
+
16
+ regional([events, carrier, regionalDestination('realtime')])
17
+
18
+ assert.deepEqual(await carrier.regional.export({}), { realtime: ['realtime'] })
19
+ assert.equal('regional' in events, false)
20
+ })
21
+
22
+ it('should give a carrier nothing where no destination is regional', () => {
23
+ const carrier = { name: 'convergence', carries: true }
24
+
25
+ regional([carrier, { name: 'events' }])
26
+
27
+ assert.equal(carrier.regional, undefined)
28
+ })