1.0.1 • Published 4 years ago

@rocketseat/ddd-utils v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

DDD Utils

Shared utils to build Domain-Driven Design Node.js applications.

Installation

yarn add @rocketseat/ddd-utils

Domain utils

  • AggregateRoot: Used to add Domain Events funcionality to Entity;
  • Entity: Mark a class as a Entity;
  • UniqueEntityID: Create or gereate an unique ID using UUID;
  • ValueObject: Create a entity attribute with custom validations;
  • WatchedList: Create a list that memorize added or deleted items;

Domain events utils

  • DomainEvents: Used by Aggregate Root to add Domain Events to Entity;
  • IDomainEvent: Interface used when creating a new Domain Event;
  • IHandle: Interface used when creating a new Domain Event Handler;

Infra utils

  • BaseController: Extendable class used inside controllers in our application;
  • IMapper: Interface used when creating mappers (WIP);

Logic utils

  • AppError: Default errors caused by malfunctioning of our application;
  • Guard: Simple validation class used to validate domain entities;
  • Result: Result class, do not throw errors, use always the result class;
  • UseCaseError: Extendable class used to define a Use Case error;

Tests utils

  • BaseFakeRepo: Extendable class to create fake repositories used for testing;