@toa.io/core 1.0.0-alpha.254 → 1.0.0-alpha.259

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 ADDED
@@ -0,0 +1,22 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [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
+
8
+
9
+ ### Features
10
+
11
+ * **runtime:** split component RC into preflight and settle ([0d648b3](https://github.com/toa-io/toa/commit/0d648b314e4aac226c254bf01a86affa04b59b34))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.0.0-alpha.257](https://github.com/toa-io/toa/compare/v1.0.0-alpha.256...v1.0.0-alpha.257) (2026-08-24)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **core:** lift tombstone on commit when transition leaves it untouched ([38c0d15](https://github.com/toa-io/toa/commit/38c0d15e946c3e2d559d4b18aecc33e0fda2471a))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/core",
3
- "version": "1.0.0-alpha.254",
3
+ "version": "1.0.0-alpha.259",
4
4
  "description": "Toa Core",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -27,5 +27,5 @@
27
27
  "openspan": "1.0.0-alpha.254",
28
28
  "uuid": "11.1.1"
29
29
  },
30
- "gitHead": "0538900d6604e97d8850fad732bb56fd6be4f208"
30
+ "gitHead": "3f557c2f855f078163128c317e7cb2f3629968aa"
31
31
  }
package/src/cascade.js CHANGED
@@ -6,16 +6,16 @@ class Cascade extends Connector {
6
6
  // #bridges
7
7
  #last
8
8
 
9
- constructor (bridges, rc) {
9
+ constructor (bridges, preflight) {
10
10
  super()
11
11
 
12
12
  // this.#bridges = bridges
13
13
  this.#last = bridges[bridges.length - 1]
14
14
 
15
- if (rc === undefined)
15
+ if (preflight === undefined)
16
16
  this.depends(bridges)
17
17
  else
18
- this.depends(bridges).depends(rc)
18
+ this.depends(bridges).depends(preflight)
19
19
  }
20
20
 
21
21
  async run (...args) {
@@ -38,6 +38,7 @@ class Entity {
38
38
  if (error !== null)
39
39
  throw new EntityContractException(error, value)
40
40
 
41
+ this.#revive(value)
41
42
  this.#set(value)
42
43
  }
43
44
 
@@ -69,6 +70,16 @@ class Entity {
69
70
  }
70
71
  }
71
72
 
73
+ // deletion is only expressed as a new _deleted timestamp,
74
+ // so committing over a tombstone without touching it means revival
75
+ #revive (value) {
76
+ if (this.#origin?._deleted == null || value._deleted !== this.#origin._deleted)
77
+ return
78
+
79
+ value._deleted = null
80
+ this.deleted = false
81
+ }
82
+
72
83
  #set (value) {
73
84
  if (!('_trailers' in value))
74
85
  Object.defineProperty(value, '_trailers', {
@@ -16,6 +16,34 @@ describe('argument', () => {
16
16
  })
17
17
  })
18
18
 
19
+ describe('tombstone', () => {
20
+ it('should lift tombstone when transition leaves _deleted untouched', () => {
21
+ const origin = fixtures.state()
22
+ const entity = new Entity(fixtures.schema, origin)
23
+ const state = entity.get()
24
+
25
+ state.foo = 'revived'
26
+ entity.set(state)
27
+
28
+ expect(entity.get()._deleted).toBeNull()
29
+ expect(entity.deleted).toBe(false)
30
+ expect(entity.event().changeset._deleted).toBeNull()
31
+ })
32
+
33
+ it('should keep tombstone written by transition', () => {
34
+ const origin = { ...fixtures.state(), _deleted: null }
35
+ const entity = new Entity(fixtures.schema, origin)
36
+ const state = entity.get()
37
+ const timestamp = Date.now()
38
+
39
+ state._deleted = timestamp
40
+ entity.set(state)
41
+
42
+ expect(entity.get()._deleted).toBe(timestamp)
43
+ expect(entity.deleted).toBe(true)
44
+ })
45
+ })
46
+
19
47
  it('should provide event', () => {
20
48
  const origin = fixtures.state()
21
49
  const entity = new Entity(fixtures.schema, origin)
package/types/bridges.ts CHANGED
@@ -29,5 +29,5 @@ export interface Factory {
29
29
 
30
30
  receiver?: (path: string, label: string) => Receiver
31
31
 
32
- rc?: (path: string, context: Context) => Promise<Connector>
32
+ rc?: (path: string, context: Context) => Promise<{ preflight?: Connector, settle?: Connector } | undefined>
33
33
  }