diff --git a/.changeset/variant-union-dispatch.md b/.changeset/variant-union-dispatch.md deleted file mode 100644 index 739925d..0000000 --- a/.changeset/variant-union-dispatch.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'fetchium': minor ---- - -Add `t.variant(value)`: a variant tag for union members that share a typename. `t.typename` keeps establishing entity identity (the `[typename, id]` cache key); `t.variant` selects which shape a payload parses as, so one entity type can have multiple shapes discriminated by a separate tag field. Parsing and live-collection event routing dispatch on the variant wherever members share a typename. - -Two behavior changes: - -- Unions now throw at definition time when two members share a typename without declaring variants, or collide on a `(typename, variant)` pair. Previously the last member silently overwrote the first, so payloads of the other shape failed validation and were dropped from arrays and mutation events. -- Live collections whose entity defs share a typename without variants (possible via `t.liveValue`, which involves no union) previously checked every event against the last def only; events now route to the first def the entity's data satisfies. diff --git a/packages/fetchium/CHANGELOG.md b/packages/fetchium/CHANGELOG.md index f9bbb85..aaa3b89 100644 --- a/packages/fetchium/CHANGELOG.md +++ b/packages/fetchium/CHANGELOG.md @@ -1,5 +1,15 @@ # fetchium +## 0.5.0 + +### Minor Changes + +- 98cb4e9: Add `t.variant(value)`: a variant tag for union members that share a typename. `t.typename` keeps establishing entity identity (the `[typename, id]` cache key); `t.variant` selects which shape a payload parses as, so one entity type can have multiple shapes discriminated by a separate tag field. Parsing and live-collection event routing dispatch on the variant wherever members share a typename. + + Two behavior changes: + - Unions now throw at definition time when two members share a typename without declaring variants, or collide on a `(typename, variant)` pair. Previously the last member silently overwrote the first, so payloads of the other shape failed validation and were dropped from arrays and mutation events. + - Live collections whose entity defs share a typename without variants (possible via `t.liveValue`, which involves no union) previously checked every event against the last def only; events now route to the first def the entity's data satisfies. + ## 0.4.7 ### Patch Changes diff --git a/packages/fetchium/package.json b/packages/fetchium/package.json index 7226938..31e70d4 100644 --- a/packages/fetchium/package.json +++ b/packages/fetchium/package.json @@ -1,6 +1,6 @@ { "name": "fetchium", - "version": "0.4.7", + "version": "0.5.0", "type": "module", "repository": { "type": "git",