Skip to content

Releases: 4lessandrodev/rich-domain

v1.23.1

02 May 03:37
Compare
Choose a tag to compare

What's Changed

  • 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

28 Apr 19:18
Compare
Choose a tag to compare

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

21 Apr 20:58
Compare
Choose a tag to compare

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

v1.22.0

14 Apr 03:59
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.21.0...v1.22.0

v1.21.0

12 Apr 20:17
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.20.3...v1.21.0

v1.20.3

25 Mar 17:54
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.20.2...v1.20.3

v1.20.2

25 Mar 14:39
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.20.0...v1.20.2

v1.20.0

18 Mar 12:45
13c99d6
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.19.2...1.20.0

v1.19.2

15 Mar 18:53
Compare
Choose a tag to compare

What's Changed

  • chore: update deps by @4lessandrodev in #105
  • chore(deps-dev): bump @types/node from 20.10.4 to 20.10.5 by @dependabot in #106
  • chore(deps-dev): bump @types/node from 20.10.5 to 20.10.6 by @dependabot in #107
  • chore(deps-dev): bump @types/node from 20.10.6 to 20.10.7 by @dependabot in #108
  • chore(deps-dev): bump @types/node from 20.10.7 to 20.11.2 by @dependabot in #109
  • chore(deps-dev): bump @types/node from 20.11.2 to 20.11.5 by @dependabot in #110
  • chore(deps-dev): bump @types/node from 20.11.5 to 20.11.10 by @dependabot in #111
  • chore(deps-dev): bump @types/node from 20.11.10 to 20.11.17 by @dependabot in #113
  • chore(deps-dev): bump @types/node from 20.11.17 to 20.11.19 by @dependabot in #114
  • chore(deps-dev): bump @types/node from 20.11.19 to 20.11.20 by @dependabot in #115
  • chore(deps-dev): bump @types/node from 20.11.20 to 20.11.24 by @dependabot in #116
  • chore(deps-dev): bump typescript from 5.3.3 to 5.4.2 by @dependabot in #118
  • chore(deps-dev): bump @types/node from 20.11.24 to 20.11.25 by @dependabot in #117

Full Changelog: v1.19.1...v1.19.2

v1.19.1

16 Dec 02:23
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.19.0...v1.19.1