Repository navigation
v4.0.4
Changes
- fix(deps): ⬆️ update dependency @haskou/value-objects to ^8.4.3
Release details
- npm: https://www.npmjs.com/package/@haskou/ddd-kernel/v/4.0.4
- Pull request: #96
- Source branch:
renovate/non-major-runtime-dependencies - Version bump:
patch
Pull request notes
This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| @haskou/value-objects (source) | ^8.3.4 → ^8.4.3 |
Release Notes
haskou/value-objects (@haskou/value-objects)
v8.4.3
Changes
- fix(exports): 🐛 Export ComparableItem and SerializedValue
Release details
- npm: https://www.npmjs.com/package/@haskou/value-objects/v/8.4.3
- Pull request: #101
- Source branch:
fix/export-comparable-item-serialized-value - Version bump:
patch
Pull request notes
What
ComparableItem (constraint of UniqueObjectArray<T>) and SerializedValue (constraint of PrimitiveOf<T>) appear in the public signatures but were not exported, so consumers could not name them.
ComparableItemmoves tosrc/interfaces/ComparableItem.ts.SerializedValuemoves tosrc/types/SerializedValue.ts.- Both are re-exported through the existing
interfacesandtypesbarrels, so they are available from the package root. UniqueObjectArray.tsandPrimitiveOf.tsnow import them instead of declaring them.
Notes
- Neither type was exported in any earlier release I checked (8.3.4, 8.4.2). This adds exports, it does not restore removed ones.
- Pure type-level change, no runtime behaviour change.
Verification
yarn test (717 tests) and yarn build pass. Coverage stays at 100%. dist/index.d.cts declares both with export, and a throwaway consumer importing them from dist compiled under --strict.
v8.4.2
Changes
- fix(positive-integer): 🐛 Extend PositiveNumber instead of Integer
Release details
- npm: https://www.npmjs.com/package/@haskou/value-objects/v/8.4.2
- Pull request: #100
- Source branch:
fix/positive-integer-extends-positive-number - Version bump:
patch
Pull request notes
What
PositiveInteger now extends PositiveNumber instead of Integer. PositiveNumber validates the sign and PositiveInteger adds the integer check (InvalidIntegerError).
Behaviour changes
new PositiveInteger(1) instanceof Integeris nowfalse. Code typing a parameter asIntegerand passing aPositiveIntegerwill stop compiling.FileSizeis the only consumer in this repo and is unaffected.- The sign is validated first, so
new PositiveInteger(-0.5)throwsInvalidPositiveNumberError(it used to throwInvalidIntegerError). - The
% 1 === 0check now exists in bothIntegerandPositiveInteger.
Docs and tests
docs/reference/positive-integer.md updated (signature and notes). Spec now asserts inheritance from PositiveNumber, no inheritance from Integer, and the new error for -0.5.
Verification
yarn test (717 tests) and yarn build pass. Coverage stays at 100%.
v8.4.1
Changes
- fix(file-size): 🐛 Type FileSize add and subtract as FileSize
Release details
- npm: https://www.npmjs.com/package/@haskou/value-objects/v/8.4.1
- Pull request: #99
- Source branch:
fix/file-size-arithmetic-types - Version bump:
patch
Pull request notes
What
FileSize.add and FileSize.subtract were typed as NumberValueObject (inherited), although at runtime they return a FileSize. They are now declared as add(other: FileSize): FileSize and subtract(other: FileSize): FileSize.
Notes
- Adding or subtracting two
FileSizeis a closed operation, so the return type is exact.NumberValueObjectis unchanged: its arithmetic can fail on subclass invariants, sothiswould be a wrong promise there. - Implemented with
clone(), so subclasses ofFileSizekeep their own type at runtime. - Breaking at type level:
size.add(100)with a plain number no longer compiles. Passnew FileSize(100). - Docs for
FileSizeupdated with the new signatures and the negative-result error.
Verification
yarn test, yarn build pass. Coverage stays at 100%. The arithmetic test calls FileSize.to() on the results, so it only compiles if both return FileSize.
v8.4.0
Changes
- feat(file-size): ✨ Add FileSize, FileSizeUnit and PositiveInteger value objects
Release details
- npm: https://www.npmjs.com/package/@haskou/value-objects/v/8.4.0
- Pull request: #98
- Source branch:
feat/file-size - Version bump:
minor
Pull request notes
What
PositiveInteger(extendsInteger, accepts0).FileSizeUnit(extendsEnum): SI (kB..PB, base 1000) and IEC (KiB..PiB, base 1024) units, with a single typed bytes-per-unit table andFileSizeUnit.SI/FileSizeUnit.IECsets.FileSize(extendsPositiveInteger, stored in bytes):fromBytes,from(value, unit),parse,toBytes,to(unit),toHumanReadable(units), plus inherited arithmetic.
Behaviour worth reviewing
toHumanReadablereturns{ value, unit }: no formatting or rounding in the domain.fromandparseround to the nearest byte.multiply/dividedo not round and throwInvalidIntegerErroron non-integer results.subtractbelow zero throwsInvalidPositiveNumberError.- Static factories use the
this: new (...) => Tpattern from #94, so subclasses get their own type (covered inSubclassFactories.spec.ts). parseunits are exact and case-sensitive (KBis invalid).
Docs
Reference pages for the three classes, plus sidebar, reference index, docs home and README entries. The README table was re-aligned by prettier.
Verification
yarn test, yarn build and yarn docs:build pass. Coverage is 100% (statements, branches, functions, lines).
Configuration
📅 Schedule: (in timezone Europe/Madrid)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.