Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .changeset/aggregate-carries-version.md

This file was deleted.

12 changes: 0 additions & 12 deletions .changeset/aggregate-requires-identity.md

This file was deleted.

30 changes: 30 additions & 0 deletions packages/entity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# @btravstack/entity

## 0.9.0

### Minor Changes

- 1af25ee: **Breaking:** an aggregate's decision now carries everything a repository
needs to save it.

- `Entity.Decision` gains `expectedVersion`, the version the store must still
be at, and its `events` now hold **every** event decided since the aggregate
was loaded. A chain of commands saves as one decision without losing the
earlier events; reusing an already-saved state yields a conflict, never an
overwrite.
- An aggregate's `make` requires the version: `make(row, { version })`.
`replay` takes the stream's length, and `start` is version `0`.
- The version is kept beside the instance, not on it: no reserved field name,
nothing in `toJSON()`, and the package never interprets the number.

To migrate, pass `{ version }` to an aggregate's `make`, and drop the separate
version argument from a repository's `save`: read `decision.expectedVersion`
instead. `Entity`'s `make` is unchanged.

- 2370c4d: **Breaking:** `Entity.aggregate` now requires at least one field flagged
`identity: true`. An aggregate root is what other aggregates reference and what
a repository loads, so a field map without one is a compile error, and a
declaration that gets past the types throws while it runs. `sameIdentityAs` is
therefore always available on an aggregate.

To migrate, flag the aggregate's id: `id: Entity.field(SomeId, { identity: true })`.
`Entity` is unchanged: identity stays optional there.

## 0.8.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/entity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@btravstack/entity",
"version": "0.8.0",
"version": "0.9.0",
"description": "A domain-entity builder on zod v4: branded fields, immutable data, sealed construction, and Result instead of throws",
"keywords": [
"ddd",
Expand Down
Loading