v0.11.0
See milestone v0.11.0
Breaking Changes
-
src/core/@routable/routable.ts:HttpMethodrenamed toApiMethod(ApiMethod represents valid handlers for a routable class with a model attached to it) -
IRoutableOptionsexposeApitookHttpMethod[]but now takesApiMethod[]suppressApitookHttpMethod[]and now takesApiMethod[]
-
HttpMethodis now exported bysrc/core/@routable/route.tsand represents valid HTTP methods -
IRoutableMethodOptionsmethodis now more tightly constrained toHttpMethods | HttpMethods[] | HttpMethod | [HttpMethod](it previously took anystringtype)- Registering a dependency more than once will throw an error
Deprecations
SakuraApi.getModelByNamehas been marked deprecated (see #125)SakuraApi.getRoutableByNamehas been marked deprecated (see #125)
Changes
@Route now takes an array of HTTP methods or *
See #90.
You can now bind multiple HTTP methods to a handler. For example:
@Routable()
export class SomeApi {
@Route({
method: ['get', 'post', 'put']
})
someHandler(req, res, next) {
// route bound to GET, POST, or PUT / route
}
}
You can also now bind a handler to respond to all methods:
@Routable()
export class SomeApi {
@Route({
method: '*'
})
someHandler(req, res, next) {
// route bound to all methods for / route
}
}
@FormatToJson() and FormatFromJson() now support * context
See #137
This lets you decorate a method in your @Routable class with @FormatToJson('*') or FormatFromJson(*) so that it will be called while marshalling to JSON or from JSON in any context.
@Json() now supports * context
See #130
This lets you decorate a property in your @Rourable class with @Json('*') so that it will be marshalled to and from json in any context.
You can no long register a dependency more than once
See #132
This is mostly for unit testing. Unit Tests might accidentally recycle a service, model or routable between tests, which could lead to strange behavior. You should call deregisterDependencies() on your instance of SakuraApi in your afterEach jasmine method to clean up after a test that registers dependencies with its instance of SakuraApi.
Some polish
- #125 -
@Modeland@Routablehave updated dependency injection logic that brings them into alignment with hour@Injectableproviders work.SakuraApi.getModelByNamehas been marked deprecatedSakuraApi.getRoutableByNamehas been marked deprecated
- #133 - SakuraApi's unit tests are once again properly reporting their line numbers in TS if you happen to be working on SakuraApi.
- #134 - added a Contributing file... help wanted
- #135 - the never ending pursuit of updated npm packages
- #142 - the never ending tasking of improving debug and error output for a better developer experience (DX)
- #143 - better checking for
SakuraMongoDbConnection.addConnectionto make it more obvious that you accidentally passed in a config object rather than a config string.