All notable changes to this project will be documented in this file.
- Atualizando lib core para nova versão
- rich-domain v1.25.0
- update rich-domain lib to check nullish type: now 'create' return a possibly null value in Result instance.
- Corrected
"files"
inpackage.json
to includeutils.js
andutils.d.ts
, resolving module not found errors during compilation in email and password.
- update: update rich-domain to v1.23.3
- refactor: change lib to individual packages
- Update core to v1.23.0
- check Core Changelog
- Update core
- Added support to multi context name
- Details Commit
// Example Usage
const context = Context.events();
const handler = (event) => console.log(event);
// Subscribing to events under different contexts
context.subscribe('Context-A:SIGNUP', handler);
context.subscribe('Context-B:SIGNUP', handler);
context.subscribe('Context-C:SIGNUP', handler);
context.subscribe('Context-B:NOTIFY', handler);
context.subscribe('Context-B:SEND-EMAIL', handler);
// Dispatching events to specific contexts
// Dispatches the SIGNUP event to Context-B
context.dispatchEvent('Context-B:SIGNUP');
// Dispatches the SIGNUP event to all contexts
context.dispatchEvent('*:SIGNUP');
// Dispatches all events to all contexts. Not recommended
context.dispatchEvent('*:*');
// Dispatches all events under Context-B
context.dispatchEvent('Context-B:*');
- Update core
- Added support to global events ChangeLog
- Update core
- Fix logger messages
- update deps core to v1.20.0 see changes
- update deps
- added support to nodejs v21
- update deps
- Update core
- update deps
- rich-domain: update lib core to 1.19.0
- remove support for deprecated history method
- improve performance and save memory usage
- Update core
- update deps
- rich-domain: update lib core to 1.18.4
- Update core
- rich-domain: update lib core to 1.18.3 #272 #282
- Update core
- rich-domain: update lib core to 1.18.2 #272
- Update core
- rich-domain: update lib core to 1.18.1
- Update core
- rich-domain: update lib core to 1.18.0 More
- Update core
- rich-domain: update lib core to 1.17.3
- validation to
url.value-object
use URL default validation and remove regex. by @ArturHamannRonconi
- added separator as optional param to
getInitials
method fromuser-name.value-object
- Update core
- rich-domain: update lib core to 1.17.1
- Update core
- rich-domain: update lib core to 1.17.0 check on pull request 33
// Example using set now
const changed = user.set("name").to(age);
console.log(changed);
> true
// Example using clone now
const copy = user.clone();
console.log(copy.get("name").get("value"))
> "Jane Doe"
- rich-domain: update lib core to 1.16.2
- rich-domain: update lib core to 1.16.1
- date.value-object: rename method from
isEqual
toisEqualDate
- rich-domain: update lib core to 1.16.0
- Entity: added method isEqual to compare current instance with another one.
- ValueObject: added method isEqual to compare current instance with another one. Issue 27
- custom-string.value-object: By: VinnyLima
- removeSpecialChars and onlyNumbers: Issue 223
- email.value-object: added MESSAGE as customizable value
- rich-domain: update lib core to 1.15.2
- node version: update requirements. node version required >=16 and < 19
- user-name.value-object: remove empty spaces. By: VinnyLima
- rich-domain: update lib core to 1.15.0
- value-objects: added MESSAGE attribute to instance
Now its possible to customize error message
Example:
// custom-user-name.ts
import { UserNameValueObject } from 'types-ddd';
Reflect.set(UserNameValueObject, "MIN_LENGTH", 3);
Reflect.set(UserNameValueObject, "MAX_LENGTH", 20);
Reflect.set(UserNameValueObject, "MESSAGE", "Username must be a maximum of 3 and a minimum of 20 characters");
const CustomName = UserNameValueObject;
export CustomName; // > import this to create your user name
export default CustomName;
- rich-domain: update lib core to 1.14.6
- rich-domain: update lib core to 1.14.5
- rich-domain: update lib core to 1.14.4
- rich-domain: update lib core to 1.14.3
- Ok and Fail: ensure export from lib
- chore: deps - update deps
- value-objects: calc validation
- value-objects: implement customization for value objects
- result: implement freeze result instance
- password: define protected props as MAX_LENGTH and MIN_LENGTH
- update deps: rich-domain
-
update deps: rich-domain
-
refactor: Fail
-
refactor: Ok
-
refactor: Result.Ok
-
refactor: Result.fail
Change generic types order for Result.fail
and Result.Ok
Now each method has your own order Example:
// for implementation:
IResult<Payload, Error, MetaData>;
// before the generic order was the same for both method.
// now for
Result.Ok
// the generic order is
Result.Ok<Payload, MetaData, Error>(payload metaData);
// for
Result.fail
//the generic order is
Result.fail<Error, MetaData, Payload>(error, metaData);
Changes made on Ok
import { Ok } from 'rich-domain';
// simple use case for success. no arg required
return Ok();
// arg required
return Ok<string>('my payload');
// arg and metaData required
interface MetaData {
arg: string;
}
return Ok<string, MetaData>('payload', { arg: 'sample' });
Changes made on Fail
import { Fail } from 'rich-domain';
// simple use case for success. no arg required
return Fail();
// arg required
return Fail<string>('my payload');
// arg and metaData required
interface MetaData {
arg: string;
}
return Fail<string, MetaData>('payload', { arg: 'sample' });
- update deps: rich-domain
- feat: implement function Fail
- feat: implement function Ok
- EmailValueObject: remove regex and added function validation
deps: update dependencies
- rich-domain to v1.12.0
deps: update dependencies
- rich-domain to v1.11.2
- typescript to 4.8.2
docs: update readme and documentation deps: update dependencies
ci: install dependabot to check deps
docs: update readme and documentation
- deps: update dependencies rich-domain to version 1.11.0
Change order validation args in value objects
// from
validation<Key extends keyof Props>(key: Key, value: Props[Key]): boolean {};
// to
validation<Key extends keyof Props>(value: Props[Key], key: Key): boolean {};
- deps: update dependencies rich-domain to version 1.10.0
- deps: update dependencies rich-domain to version 1.9.0
- deps: update dependencies
- change core (breaking changes). using now rich-domain lib npm rich-domain
- deps: update dependencies
- TSProxy: change context param from function to instance of class pull request
- deps: update dependencies
- TSProxy: added abstract class as proxy implementation pull request
- logger: make instance a singleton
- logger: update configs
- deps: update dependencies
- deps: update dependencies
- toObject: return string when there is a domainId as value-object attribute
- toObject: added support to convert a simple object on entity
- toObject: added support to convert a value object inside another one
- update dependencies
- update documentation
- toObject: fix adding support for string, boolean and numbers to domain entity attributes on call toObject method.
- create: ensure all domain entity implements create method
- clone: added method to clone a domain entity
- logs deactivation: now its possible deactivate all logs;
NODE_ENV=production # automatically turn off all logs
TYPES_DDD_LOGS=off # manual turn off logs
TYPES_DDD_LOGS=error # show only errors log
TYPES_DDD_LOGS=info # show only info log
TYPES_DDD_LOGS=warn # show only warn log
- toObject: ensure to convert a moderately complex value object
- toObject: update types on entity.toObject method
- update and change some documentation and examples
- mark IMapper interface as deprecated tool. Use TMapper instead
- Imports: Create shortcuts for imports : Issue #114
- AutoMapper: get string value when prop is DomainId or ShortDomainId
- DomainId: added clone method to create a new id from an instance
- ShortDomainId: added clone method to create a new id from an instance
- Available AutoMapper to convert Entity, Aggregate and ValueObject from domain instance to a persistence model
- DomainId and ShortDomainId: added property isNew to identify if is a new id
- Entity, Aggregate and ValueObject: added method toObject to convert domain instance to a persistence model
- Available AutoMapper to convert Entity, Aggregate and ValueObject from domain instance to a persistence model
- Entity: hasSomeTypes method to validate different types from instance keys
- Entity: isSome method > new accepted type: 'null'
- Entity: isAll method > new accepted type: 'null'
- State: addManyState<T, E> method add many results to state and return unique keys
- State: getStateByKeys<T, E> method get many results by keys
- Entity: toObject<T, E> method transform instance in persistence object
- Entity: added method checkProps to entity instance
- State: define exists method as protected
- State: added callback on state
- State: define exists method as protected
- Mapper: rename to State
- Mapper: added exists method
- Mapper: added logger if state key does not exits
- static method on domain entities
- buildFromDto > change to build
- buildFromModel > change to build
- buildToModel > change to build
- IMapper2 > change to TMapper
- static method on domain entities
- buildFromDto
- buildFromModel
- buildToModel
- abstract class Mapper with state management methods
- IMappers interface with new methods
- DomainId and ShortDomainId: make both compatible
- BaseDomainEntity: ID accept DomainId or ShortDomainId
- Entity: getHashCode - now returns uid value base value added to ID
- Breaking change - Remove methods from DomainId:
- toShort()
- shortUid
- ShortDomainId: export resource
- ShortDomainId: default short domain id - 16 bit
- PasswordValueObject: validate if instance value already is encrypted.
- DimensionValueObject: now update methods returns updated instance.
- PasswordValueObject: now encrypt method returns updated instance.
- UserNameValueObject: now capitalize method returns updated instance.
- WeightValueObject: now update methods returns updated instance.
- util: change regex to validate email (includes dot as valid char).
- entities and aggregates: getHashCode > combination of class name and id. Now using short uid.
- lib: publish only dist to keep lib small
- removeUndefinedKeysFromObject: do not remove dates
- DateValueObject: added comparators methods
- DateValueObject: added validation on create a new instance
- DateValueObject
- DomainId > change getters method
- DomainId > added toShort method
- DomainId > toShort method. Now you can choose length
- getUndefinedKeysAsObject > added new option to return as value
- CurrencyValueObject > added functions to compare values
- getUndefinedKeysAsObject > added option to get path as string
- removeUndefinedKeysFromObject
- dist > update build
- getUndefinedKeysAsObject > define value to be applied
- DimensionValueObject > validate unit before create value object
- WeightValueObject > validate unit before create value object
- DimensionEntity > changed to value object: DimensionValueObject
- WeightEntity > changed to value object: WeightValueObject
- dist: remove unused files on dist
- Lib utils: Imports path
- WeightUnitValueObject
- UnitOfMeasureValueObject
- DimensionEntity
- WeightEntity
- PinValueObject: Define pin props as optional
- Rename folder: from src to lib
- CPFValueObject
- CNPJValueObject
- CustomStringValueObject
- CustomNumberValueObject
- HEXColorValueObject: Ensure don't generate light color like white
- RGBColorValueObject: Ensure don't generate light color like white
- Update dependencies
- UrlValueObject: export value object
- PinValueObject: util value object
- CurrencyValueObject: docs - identify max safe number
- Result - Change default generic type on
combine
method tounknown
insteadany
- ChangesObserver - Fix added possibility to get all added results
getAllAddedResults
- Result - Fix possibility to return a void instance. Create a specific method
Result.success
- Result - Fix possibility to return a void instance
- Result - added an internationalization error message
- StatusCodeEnum
- Result - provide an enum as string declaration instead number
- SpecificationComposite
- IBaseRepository - rename params and doc comments
- colorGenerator
- index (exports)
- getUndefinedKeysAsArray
- getUndefinedKeysAsObject
- CurrencyValueObject
- ChangesObserver
- Result
- Result: new approach
- Dynamic types to Filter on IBaseRepository
- Entity
- DomainId
- AggregateRoot: new approach
- Entity: new approach
- Filter
- OrderStatusValueObject
- AggregateRoot
- BirthdayValueObject
- colorConverter
- colorGenerator
- RGBColorValueObject
- HEXColorValueObject
- RGBColorValueObject
- HEXColorValueObject
- PostalCodeValueObject
- UrlValueObject
- Result
- TrackingCodeValueObject
- Result StatusCode
- Logger
- HomePhoneValueObject
- MobilePhoneValueObject
- DomainId
- TrackingCodeValueObject
- PasswordValueObject
- passwordGenerator
- CurrencyValueObject
- EmailValueObject
- UserNameValueObject
- BirthdayValueObject
- Dynamic types to Filter
- Types validation to IBaseRepository
- Define Node crash version on package.json
- Update documentation