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.
- Serializers now have access to the nesting level of included resources.
- Added a
SLDataSerializer
that only adds thedata
keyword on the first level, #72
- it is now possible to define include properties in snake_case, #67
- Many dev-dependencies were updated
The developer experience release!
With this release, we improved the integration of Bumblebee into your
application by allowing you to pass the Transformer by name, while also
improving performance by changing the defaultInclude
& availableInclude
methods to static getters. For a complete list of all changes, see the changelog
below.
An absolutely huge thank goes to @RomainLanz, who suggested and implemented many of the features we have in this release. Great work man! 👏
-
The
toArray()
was renamed totoJSON()
to be consistent with the rest of the framework. If you use thetoArray()
method, you should rename this it totoJSON()
. The signature and returned value remain the same. #29 -
Changed
defaultInclude
&availableInclude
methods to static getter for better performance. #29// before class BookTransformer extends TransformerAbstract { defaultInclude () { return ['author'] } } // after class BookTransformer extends TransformerAbstract { static get defaultInclude () { return ['author'] } }
- Transformers can now be automatically resolved when passed by name. #33
- Multiple transform methods can be defined and used with the new Transformer Variants feature. #32
- The
Adonis/Addons/Bumblebee/TransformerAbstract
class now has an optional shorter alias toBumblebee/Transformer
. #29
- The
toArray()
method was marked as deprecated. #29
- Updated dev-dependencies
- While refactoring a bug was introduced in the
adonis make:transformer
command that caused it to generate invalid transformers, #26 (by @vincentducorps)
- The
adonis make:transformer
command now supports subfolders, #23 (by @NeroOficial)
- You can now generate a transformer by calling
adonis make:transformer
, #22
- When an invalid transformer is passed, a better understandable error message is thrown, #21
Just a small update, nothing new in this release. Just upgrading some dependencies.
- Updated dev-dependency japa to version 2.0.
This maintenance release brings no new functionality, but fixes a few minor issues, updates dependencies and improves documentation and tests.
- Relations that were loaded but returned null will no longer be loaded twice, #16
- Methods that were marked as deprecated have been removed in this release.
Apart from deprecating a few methods that were only intended for internal use, this release also adds lots of code documentation.
- These methods were only intended for internal use and the alias will be removed in a future release:
processIncludedResources
,callIncludeFunction
,figureOutWhichIncludes
,createChildScopeFor
,eagerloadIncludedResource
- Includes can now be requested with underscores and hyphens as the separator and will be converted to camelCase, #15 (by @spamoom)
- Ensure that pagination data is always an integer by explicitly casting
.pages
to Numbers, #17 (by @spamoom)
- Model methods were not available in when using pagination because the model was passed through
toJSON
, #14 (by @spamoom) - Fixed pagination data not getting reset when setting new data without pagination.
- Lucid collection serialization still did not work as expected.
- Lucid models did not get correctly serialized and null was returned.
This update adds three new major features that did not quite make it into the initial release. Metadata and pagination are especially useful if you're building larger APIs.
- Serializers allow you to format the data after the transformation to a standard format.
- Metadata are used to add extra data to the response.
- Pagination to split large datasets into multiple parts.
- Renamed method
data
on the transform interface to_setData
to mark it as private. - Improved error handling. Exceptions now have a descriptive message that describes the problem.
- Prevent an exception that occurred when an already loaded relation was eager-loaded again.
This release adds a few new features. Nothing too exciting but they will help you write simpler and better performing APIs.
- Relations are now automatically eager-loaded if they are a lucid model and the include method is named like the relation, #8
- The
transform
method can now return a primitive type, #9 - You can now access the
context
from within an include function through the second parameter, #10
- Parsing includes from the request did not work as intended. Now the query parameters are parsed correctly, #7
- If null or undefined was passed to the
item
orcollection
method, an exception was thrown. Now null is returned.
This is the first official release of adonis-bumblebee.
- The Bumblebee Fluent Interface is now available as
Adonis/Addons/Bumblebee
- Lots of documentation
- If an include function does not return an instance of
ResourceAbstrace
, the returned value is used without transformation.
This release adds optional includes that can be requested on a per-transform basis. It is also possible to request nested includes which are going to be recursively resolved.
- Added
availableIncludes
to transformers. - Added
parseIncludes()
to request includes. - Added config values for recursion limit.
- Includes can be automatically parsed from the request parameters
- Use the current request context instead of creating a new one.
- Allow the transform function to be a promise
This release is a complete rewrite. The new architecture allows for a much more robust structure and makes it easier to add more features down the line.
- Complete rewrite
- Import the transformer through the http context in the controller.
- Allow transformers to define
defaultIncludes
that will be appended to the result. - 100% test coverage! ⭐
No new features. Only improvements for project management and a future release.
- Added first basic tests
- Added travis-ci integration
- Added configuration for coveralls
Initial release to npm.