Releases: liamtan28/dactyl
Patch: DI Fixes
Fixes including:
- Memleak in request cache
- using wrong recursive resolution key for cached dependencies
Introduced: - Controller scopes
Introduced DI
The major delivery for this release is rudimentary DI. We are looking for contributors in this space currently.
The dactyl DependencyContainer
has been written for this framework and implemented. It allows autoinjection of registered dependencies via the constructor. It also supports 3 scopes, SINGLETON
, TRANSIENT
, and REQUEST
.
Remember, this is all in alpha and thus should not be used in production systems. The DI implementation does require some more work, including addressing:
- Prevent circular graph not relying on max dependency levels
TRANSIENT
dependencies causing some issues when the sameTRANSIENT
is required multiple times in the tree- Potential memory leaks, particularly around end of lifetimes of
REQUEST
scoped dependencies. The cached dependencies get
dumped, but the UUID for each request still potentially remains in the cache map.
First major alpha release: all baseline components
v0.1.0-alpha
This release introduces the baseline Dactyl API and bootstrapper. All components available are denoted in the repo, but in summary:
- Controller.ts - function decorator responsible for assigning controller metadata
- Application.ts - application class able to register controllers, and start the webserver
- HttpException - throwable exception inside controller actions,
Application
will then handle said errors at top level and send the appropriate HTTP status code and message. There is also a list of included predefinedHttpException
classes, see below - HttpStatus.ts - function decorator responsible for assigning default status codes for controller actions
- Method.ts -
@Get, @Post, @Put, @Patch, @Delete
function decorators responsible for defining routes on controller actions
For following - Arg.ts
-
@Param
decorator mapscontext.params
onto argument in controller action (returns wholeparams
object if no key specified) -
@Body
decorator mapscontext.request
async body onto argument in controller action (returns wholebody
object if no key specified) -
@Query
- mapscontext.url.searchParams
onto argument in controller action (returns wholequery
object if no key specified) -
@Header
- mapscontext.headers
onto argument in controller action (returns wholeheader
object if no key specified) -
@Context
- return whole OakRouterContext
object -
@Request
- return whole OakRequest
object -
@Response
- return whole OakResponse
object -
Router.ts - It is recommended that you use the
Application
to bootstrap, but you can use theRouter
class directly. This is a superclass of Oak's router, and exposes additional methods for mappingController
definitions onto routes.