diff --git a/.changeset/gentle-hoops-repeat.md b/.changeset/gentle-hoops-repeat.md deleted file mode 100644 index a300477..0000000 --- a/.changeset/gentle-hoops-repeat.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@btravstack/entity": patch ---- - -Point the package README at the new documentation site, -, instead of the Markdown files in the -repository. No code change. diff --git a/.changeset/no-release-first-publish.md b/.changeset/no-release-first-publish.md deleted file mode 100644 index 02bb977..0000000 --- a/.changeset/no-release-first-publish.md +++ /dev/null @@ -1,6 +0,0 @@ ---- ---- - -Release plumbing only, deliberately no bump: the 0.1.0 CHANGELOG is written by -hand because the changesets it replaces described migrations between states that -were never published. diff --git a/.changeset/wide-entity-declaration-emit.md b/.changeset/wide-entity-declaration-emit.md deleted file mode 100644 index 501a91d..0000000 --- a/.changeset/wide-entity-declaration-emit.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -"@btravstack/entity": minor ---- - -**Declaration emit no longer expands the whole static surface into every consumer's `.d.ts`.** - -`EntityStatic` — what `Entity(tag)(fields, options)` returns — was not exported, -so TypeScript had no name to write for it and serialised the entire static -surface structurally into any downstream package compiling with -`declaration: true`: the construct signature, all four `ZodObject`s, both zod -slots, the four phantom carriers and `make`/`extend`/`factory`, with the field -map repeated a dozen times over. A **one-field** entity emitted a 274,048-byte -declaration; it is now 240. - -That expansion was two build failures, not a verbosity problem: - -- a realistically wide domain enum (30 members, ordinary DDD widths) pushed the - repeated field map past the compiler's serialisation ceiling — `TS7056`, - fixable only by abandoning `z.enum` for a branded string and losing both - runtime membership validation and compile-time exhaustiveness ([#31]); -- a **branded object** field (`z.object({…}).brand("X")`) was expanded through - `DeepReadonly` until zod's module-private `$brand` symbol reached - computed-key position, where it cannot be named across a module boundary — - `TS4020` ([#32]). Branded objects now work, and stay deep-readonly; the - "model it as a nested entity instead" workaround is no longer needed. - -Both surfaced only at the consuming package's build, long after `tsc --noEmit`, -the tests and everything else had gone green. - -`EntityStatic` is now a top-level export, and `Entity.Static` for anyone -annotating by hand. Both regressions are pinned by the consumer fixture. - -`EntityUnion` and `UnionMember` are exported for the same reason, one type -further along: an exported `const` holding an `Entity.union(...)` had no -top-level name either, so TypeScript expanded its members structurally and -reached `$brand` through any branded field — `TS4023: Exported variable 'X' has -or is using name '$brand' … but cannot be named`. Reported as the second error -in [#32], and reproduced by declaring a union over an entity with a branded -`Money` field. - -**The zod peer range widens from `^4.4.0` to `^4.3.0`.** Nothing in the -implementation needed 4.4; the range was simply the version current at the -initial release. The floor is measured — the full surface typechecks, emits -declarations and passes its runtime assertions on 4.3.0. Monorepos that pin one -zod across every package no longer have to move the whole catalog, or relax the -peer locally, to adopt this ([#33]). - -[#31]: https://github.com/btravstack/entity/issues/31 -[#32]: https://github.com/btravstack/entity/issues/32 -[#33]: https://github.com/btravstack/entity/issues/33 diff --git a/packages/entity/CHANGELOG.md b/packages/entity/CHANGELOG.md index 9efaa23..225751b 100644 --- a/packages/entity/CHANGELOG.md +++ b/packages/entity/CHANGELOG.md @@ -1,5 +1,62 @@ # @btravstack/entity +## 0.2.0 + +### Minor Changes + +- b5758a5: **Declaration emit no longer expands the whole static surface into every consumer's `.d.ts`.** + + `EntityStatic` — what `Entity(tag)(fields, options)` returns — was not exported, + so TypeScript had no name to write for it and serialised the entire static + surface structurally into any downstream package compiling with + `declaration: true`: the construct signature, all four `ZodObject`s, both zod + slots, the four phantom carriers and `make`/`extend`/`factory`, with the field + map repeated a dozen times over. A **one-field** entity emitted a 274,048-byte + declaration; it is now 240. + + That expansion was two build failures, not a verbosity problem: + + - a realistically wide domain enum (30 members, ordinary DDD widths) pushed the + repeated field map past the compiler's serialisation ceiling — `TS7056`, + fixable only by abandoning `z.enum` for a branded string and losing both + runtime membership validation and compile-time exhaustiveness ([#31]); + - a **branded object** field (`z.object({…}).brand("X")`) was expanded through + `DeepReadonly` until zod's module-private `$brand` symbol reached + computed-key position, where it cannot be named across a module boundary — + `TS4020` ([#32]). Branded objects now work, and stay deep-readonly; the + "model it as a nested entity instead" workaround is no longer needed. + + Both surfaced only at the consuming package's build, long after `tsc --noEmit`, + the tests and everything else had gone green. + + `EntityStatic` is now a top-level export, and `Entity.Static` for anyone + annotating by hand. Both regressions are pinned by the consumer fixture. + + `EntityUnion` and `UnionMember` are exported for the same reason, one type + further along: an exported `const` holding an `Entity.union(...)` had no + top-level name either, so TypeScript expanded its members structurally and + reached `$brand` through any branded field — `TS4023: Exported variable 'X' has +or is using name '$brand' … but cannot be named`. Reported as the second error + in [#32], and reproduced by declaring a union over an entity with a branded + `Money` field. + + **The zod peer range widens from `^4.4.0` to `^4.3.0`.** Nothing in the + implementation needed 4.4; the range was simply the version current at the + initial release. The floor is measured — the full surface typechecks, emits + declarations and passes its runtime assertions on 4.3.0. Monorepos that pin one + zod across every package no longer have to move the whole catalog, or relax the + peer locally, to adopt this ([#33]). + + [#31]: https://github.com/btravstack/entity/issues/31 + [#32]: https://github.com/btravstack/entity/issues/32 + [#33]: https://github.com/btravstack/entity/issues/33 + +### Patch Changes + +- 9503929: Point the package README at the new documentation site, + , instead of the Markdown files in the + repository. No code change. + ## 0.1.0 Initial release. diff --git a/packages/entity/package.json b/packages/entity/package.json index c23e518..7446cf4 100644 --- a/packages/entity/package.json +++ b/packages/entity/package.json @@ -1,6 +1,6 @@ { "name": "@btravstack/entity", - "version": "0.1.0", + "version": "0.2.0", "description": "A domain-entity builder on zod v4: branded fields, immutable data, sealed construction, and Result instead of throws", "keywords": [ "ddd",