All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2023-03-30
- Make
_processBaseFilterand_processBaseFiltermethods ofBaseServiceprotectedto allow them to be overriden.
2023-01-10
- Update TypeORM version to
v0.3.x - Expose logger, so it can be integrated with Nest's logger
2022-03-15
This release brings breaking changes to most of the auxiliary methods of
BaseService, making them async where they were not so already, so that users
of this module can await on async operations at every stage of request
lifecycles handled via BaseService.
Most of these methods should have been async all along, similarly to
extendFindAllQuery(), in case module users need to perform async operations
throughout any of these lifecycle hooks.
- [BREAKING CHANGE]
BaseService.extendGetByIdQuery()is nowasync - [BREAKING CHANGE]
BaseService.extendCreateResult()andBaseService.actionAfterCreate()are nowasynctoo; alasactionAfterCreate()was alreadyasyncbut not beingawaited for - [BREAKING CHANGE]
BaseService.setFilters(),BaseService.setFiltersUpdate()andBaseService.setFiltersDelete()are nowasync - [BREAKING CHANGE]
BaseService.actionAfterUpdate()is nowasync - [BREAKING CHANGE]
BaseService.canBeRemoved()is nowasync
2021-11-18
- Move
@nestjs/commontopeerDependency
2021-11-18
- Update
nodejsrequirement to>=14.17instead of~14.17
2021-11-04
- Bumped
nodejsrequirement to v14.17+ - Updated all dependencies
- Added
typeormas apeerDependency
- Minor improvements to the deployment workflow.
- Remove broken
0.7.0release.
FetchSpecificationMiddlewareremoved.- Equivalent functionality has been moved into the
ProcessFetchSpecificationrequest parameter decorator.
- Equivalent functionality has been moved into the
ProcessFetchSpecificationdecorator now accepts an optional whitelist of filtering parameters it allows.BaseServicenow has a working basic built-in filtering functionality.
- Support for extending result DTO during create and update lifecycles (#12).
extendGetByIdQuery()was notawaited for. This has now been fixed.remove()was notawaited for inremoveMany(). This has now been fixed.
2021-04-30
- Ability to mute logger fully (e.g. for CI).
- [BREAKING CHANGE]
idPropertyis now part of the serviceoptionsprovided to the constructor.
2021-04-20
- Initial support for
ResultDTO-like processing: we don't support yet using aResultDTOdistinct fromEntityas generic parameters toBaseService, but if theEntityclass is set up to include properties that do not map directly to database columns it can be used as a sort of DTO, and the hooks added in this release allow to reshape/extend data after it has been fetched from db.
2021-03-25
fetchSpecificationis now optional as a parameter to most functions in the getAll/getById lifecycles; this is to accommodate uses cases where no fetch specification is needed or it cannot be provided for whatever reason.- Handling of id fields with name other than
idhas been refactored, removing the utter nonsense that my own earlier implementation was.
- Some verbose logging used during development of the initial FetchSpecification implementation has been removed.
2021-03-23
- Support for processing of meaningful parts of
FetchSpecification(included entities, sparse fieldsets and omitFields) for singular requests.
- [BREAKING CHANGE] Signatures of functions related to the
getAll()andgetById()request lifecycles have been simplified, to avoid duplication and inconsistencies. - [BREAKING CHANGE]
setFiltersGetById()has been renamed toextendGetByIdQuery()to clarify that it is not actually meant to set filters but to add joins and other conditions to the query being assembled. - Stricter typing where applicable.
2021-03-22
- Support for
filterquery params, e.g.filter[keyA]=val1,val2&filter[keyB]=val3,val4,val5.
2021-03-18
- Add support for a variant of
findAll()that returns raw results (to be used with a grain of salt and awareness of possible pitfalls).
- Refactor parts of
findAll()now shared withfindAllRaw().
2021-03-11
-
Remove double processing of sorting configuration. I am pretty sure I had actually removed this already, but probably misplaced it in some forgotten stash or in a messed-up conflict resolution 🤷.
-
Handle bool or bool string for the
disablePaginationvalue. The type of this should be properly enforced one level downstream, but for the moment the current guards should be enough.
2021-03-10
- Defaults for fetch specification parameters have been cleaned up for consistency and by adding typing where missing.
-
Handling of included resources is now done through the
includequery param, as per JSON:API specification. -
More
"-wrapping of entity and prop names introduced erroneously in previous release was undone. There are no instances left of this bug in the current code.
2021-03-04
- Query params processed by
FetchSpecificationMiddlewareshould not be left inreq.query- in theory, we should not be fiddling with query params in the request object in case these are needed by other middleware, but since this is an opinionated package, I think it's ok to do so. This release includes a change that does just this - all the query params processed in this middleware are deleted fromreq.queryat the end of the middleware function, and they live on as processed properties ofreq.fetchSpecification.
2021-03-03
- New fetch specification middleware: reflect fetch specification query parameters into the request object, where fetch specification handler code expects to find them. This middleware was left to downstream users of this module so far, just because there was a single downstream project and we were iterating it faster there. After some refactoring, we can now include the most recent middleware here.
- Add support for bypassing pagination (
?noPagination=true).
2021-03-02
- [BREAKING CHANGE]
BaseService.findAll()is nowasyncand allows to return partial entities in its type signature. This allows to implement features such as handling ofomitFieldsin classes that inherit fromBaseService.
2021-03-01
- Add support for listing fields to be omitted from a response via the
omitFieldsquery param. This is only allowed in terms of configuration, but fields listed asomitFieldsare not actually removed from results yet.
- [BREAKING CHANGE] Rename
PaginationUtilstoFetchUtils. - [BREAKING CHANGE] Rename
@Pagination()decorator to@ProcessFetchSpecification()(this will likely change again in the future: the new naming is closer to describing what the decorator is used for, but it doesn't align with general naming schemes in NestJS) - [BREAKING CHANGE] Processing of fetch specifications used to be done via the
static function
PaginationUtils.pagination(): this is now done viaFetchUtils.processFetchSpecification().
2021-02-25
- Add support for searching by id using arbitrary id column names.
2021-02-08
- Add initial support for pagination, for plural
GETrequests. - Add scaffolding for other fetch specification traits:
includes(resource inclusion),fields(sparse fieldsets),sort(sorting by specific fields).
2021-01-19
- [BREAKING CHANGE]
GenericServicehas been renamed toBaseService, aligning the class name to the package name, besides arguably better matching the intent of this service.
2021-01-14
Initial release
- Minimalist base service (
GenericService).