Releases: 4lessandrodev/rich-domain
v1.25.1
v1.25.0
What's Changed
- chore(deps-dev): bump @types/node from 22.10.0 to 22.10.1 by @dependabot in #201
- chore(deps-dev): bump @types/node from 22.10.1 to 22.10.2 by @dependabot in #203
Full Changelog: v1.24.1...v1.25.0
v1.24.1
What's Changed
- fix: change type create method return null #194 by @4lessandrodev in #198
- fix(servereventmanager): change value emit for respect type Event by @GaetanCottrez in #200
Full Changelog: v1.24.0...v1.24.1
v1.24.0
What's Changed
- chore(deps-dev): bump @types/node from 22.5.5 to 22.6.0 by @dependabot in #186
- chore(deps-dev): bump @types/node from 22.6.0 to 22.7.4 by @dependabot in #187
- chore(deps-dev): bump @types/node from 22.7.4 to 22.7.5 by @dependabot in #189
- chore(deps-dev): bump typescript from 5.6.2 to 5.6.3 by @dependabot in #188
- chore(deps-dev): bump @types/node from 22.7.5 to 22.7.7 by @dependabot in #190
- chore(deps-dev): bump @types/node from 22.7.7 to 22.8.7 by @dependabot in #192
- chore(deps-dev): bump @types/node from 22.8.7 to 22.9.0 by @dependabot in #193
- Fix/194/nullish result value by @4lessandrodev in #195
- chore(deps-dev): bump @types/node from 22.9.0 to 22.9.3 by @dependabot in #197
- chore(deps-dev): bump typescript from 5.6.3 to 5.7.2 by @dependabot in #196
Full Changelog: v1.23.4...v1.24.0
v1.23.4
What's Changed
- fix: replace JSON.stringify fn to util one by @4lessandrodev in #172
- chore(deps-dev): bump @types/node from 20.14.12 to 22.5.2 by @dependabot in #179
- chore(deps-dev): bump typescript from 5.5.4 to 5.6.2 by @dependabot in #181
- chore(deps-dev): bump @types/node from 22.5.2 to 22.5.4 by @dependabot in #180
- chore(deps-dev): bump @types/node from 22.5.4 to 22.5.5 by @dependabot in #182
- fix(automapper): Add validator isObject in entityToObj if isSimpleValue by @GaetanCottrez in #184
- chore(package): update version by @4lessandrodev in #185
Full Changelog: v1.23.3...v1.23.4
v1.23.3
What's Changed
- Feat/init adapter type by @4lessandrodev in #159
- chore(deps-dev): bump @types/node from 20.12.12 to 20.14.0 by @dependabot in #160
- chore(deps-dev): bump @types/node from 20.14.0 to 20.14.2 by @dependabot in #161
- chore(deps-dev): bump typescript from 5.4.5 to 5.5.3 by @dependabot in #166
- chore(deps-dev): bump @types/node from 20.14.2 to 20.14.9 by @dependabot in #165
- chore(deps-dev): bump @types/node from 20.14.9 to 20.14.10 by @dependabot in #168
- fix(utils): fix circular ref json.stringify by @GaetanCottrez in #170
New Contributors
- @GaetanCottrez made their first contribution in #170
Full Changelog: v1.23.2...v1.23.3
v1.23.2
What's Changed
- Value Object Enhancements and Bug Fixes by @4lessandrodev in #153
- Value Object Enhancements and Bug Fixes by @4lessandrodev in #154
- chore(deps-dev): bump @types/node from 20.12.7 to 20.12.10 by @dependabot in #155
- chore(deps-dev): bump @types/node from 20.12.10 to 20.12.11 by @dependabot in #157
- chore(deps-dev): bump rimraf from 5.0.5 to 5.0.7 by @dependabot in #156
- chore(deps-dev): bump @types/node from 20.12.11 to 20.12.12 by @dependabot in #158
Full Changelog: v1.23.1...v1.23.2
v1.23.1
What's Changed
- Develop by @4lessandrodev in #147
- Fix/change to obj implementation by @4lessandrodev in #149
- [1.23.0] - 2024-04-28 by @4lessandrodev in #150
- test: added tools test by @4lessandrodev in #151
- Fix: Improved return typings in the
get
method of the value object. - Fix: Bug fix #152 when cloning an instance of a value object.
- Fix: Ensure that properties of an entity or aggregate will always be an object.
- Fix: Improved validations performed in the
isEqual
method of the value object.
Full Changelog: v1.23.0...v1.23.1
v1.23.0
Full Changelog: v1.22.1...v1.23.0
Changes
- Removed the
set
method from value object instances. - Changed the way the
toObject
method works. Path shortcutting of property access has been removed when props have only one attribute. - Implemented some improvements in how value objects handle primitive values.
Migrate from v1.22.1 to v1.23.0
- Break Change
If you are using the toObject
method in production to create a model from Aggregate, Entity, or Value Object domain instances, it is important to note that the property access path is no longer shortened.
Now the model object follows exactly the contract defined in props
.
For example:
If an object is defined in props
, even if props contains only one property, if it is an object, the toObject
method will generate a model according to props
.
Before v1.22.1
type Props = { value: number };
class Price extends ValueObject<Props>{};
const price = new Price({ value: 200 });
console.log(price.toObject());
// > 200
After v1.23.0
type Props = { value: number };
class Price extends ValueObject<Props>{};
const price = new Price({ value: 200 });
console.log(price.toObject());
// > { value: 200 }
If you want to maintain the return with primitive value without it being an object, use props
of primitive type.
class Price extends ValueObject<number>{};
const price = new Price(200);
console.log(price.toObject());
// > 200
Another alternative is to use an adapter.
class Adapter implements IAdapter<Domain, Model> {
adapt(domain: Domain): Result<Model> {
//...
}
}
price.toObject(new Adapter());
v1.22.1
What's Changed
- chore(deps-dev): bump typescript from 5.4.4 to 5.4.5 by @dependabot in #144
- chore(deps-dev): bump @types/node from 20.12.5 to 20.12.7 by @dependabot in #143
- #145 Feat: AutoMapperSerializer - add types for to object method by @hikinine in #146
Full Changelog: v1.22.0...v1.22.1