diff --git a/.changeset/clear-state-construction.md b/.changeset/clear-state-construction.md deleted file mode 100644 index db306cc..0000000 --- a/.changeset/clear-state-construction.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -"@typeonce/effect-machine": minor ---- - -Make state construction modes explicit and allow one topology target to replace a retained valued owner atomically. - -Valued builders are no longer callable. Replace `target(value)` and nested `builder(value, ...)` calls with `.decoded(value, ...)`; keep `.from(input, ...)` for schema make input. Plain state-update resolvers now expose the decoded owner as `current` and its construction builder as `owner`, replacing the previous `ancestors` plus `target` pattern. - -Declare a combined transition with `.updating(ownerSelector)`. The resolver must finish destination construction with `.update(...)`, so the owner replacement cannot be omitted: - -```ts -to.local.SavingPlan() - .updating(to.branch.Ready) - .resolve(({ current, owner, target }) => - target.from({ request }).update( - owner.decoded(new Ready({ ...current, notice: null })) - ) - ) -``` - -Transition inspection and retained microsteps now include an `updates` array naming replaced owners. diff --git a/CHANGELOG.md b/CHANGELOG.md index 4decefa..06e3f4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # @typeonce/effect-machine +## 0.22.0 + +### Minor Changes + +- 6d080f5: Make state construction modes explicit and allow one topology target to replace a retained valued owner atomically. + + Valued builders are no longer callable. Replace `target(value)` and nested `builder(value, ...)` calls with `.decoded(value, ...)`; keep `.from(input, ...)` for schema make input. Plain state-update resolvers now expose the decoded owner as `current` and its construction builder as `owner`, replacing the previous `ancestors` plus `target` pattern. + + Declare a combined transition with `.updating(ownerSelector)`. The resolver must finish destination construction with `.update(...)`, so the owner replacement cannot be omitted: + + ```ts + to.local + .SavingPlan() + .updating(to.branch.Ready) + .resolve(({ current, owner, target }) => + target + .from({ request }) + .update(owner.decoded(new Ready({ ...current, notice: null }))) + ) + ``` + + Transition inspection and retained microsteps now include an `updates` array naming replaced owners. + ## 0.21.0 ### Minor Changes diff --git a/package.json b/package.json index 32c325a..c909bb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@typeonce/effect-machine", - "version": "0.21.0", + "version": "0.22.0", "description": "Schema-first state machines and statecharts for Effect", "author": "Sandro Maglione", "repository": {