Releases: arucard21/SimplyRESTful-client-ts
Improve stability and reliability
The client now explicitly asks for the plain JSON representation of the API service document. This should make the client more stable and predictable in the presence of other representations, like a HAL+JSON representation or a newer version of the service document in the future.
Support streaming API resources as server-sent events
This release adds support for receiving API resources as server-sent events. This can be used as an alternative to paging when you want to get all API resources.
This works by having the API set up a one-directional connection to the client, then sending each API resource (in JSON format) over that connection. Once all API resources are sent, an event marking the end of the collection is sent and the connection is closed.
This functionality requires the API to use at least version 1.1.0 of SimplyRESTful and to have the stream()
functionality implemented. It is also strongly recommended to use HTTP/2 due to limitations with the amount of connections that can be made in earlier versions of HTTP.
Use plain JSON media type
This release switches no longer uses HAL+JSON as media type to represent the API resources when accessing the API. Support for HAL+JSON was dropped in SimplyRESTful version 1.0.0. Instead, this TypeScript client now uses plain JSON by detecting the custom media type for the API resources.
This is a breaking change since HALResource
and HALCollectionV2
were renamed to APIResource
and APICollection
. Instead of HALLink
from the hal-types
library, this now uses a custom Link
object. These objects are also defined as interface instead of type now. Since type and interface are practically interchangeable, this release only provides the flexibility to choose which one you prefer instead of requiring an intersection type as it did before.
Migrating to this release mainly requires changing the names to their updated versions. Optionally, you can change your own API resource from an intersection type that intersects with HALResource
to an interface that extends APIResource
.
Fix for custom errors
This is a quick fix for the new custom errors in the TypeScript client. These errors were not exported so they could not be used yet, which would be necessary for checking their type. With this release, the errors are now correctly exported.
Custom errors for TS client
The TypeScript client now throws custom errors that correspond to the HTTP status code when an error occurs. This provides more details about the actual nature of the error that occurred which should allow for better error handling. The custom errors contains a cause
field that contains more information about exactly why that type of error might have occurred. These custom errors were modeled after their Java Exception counterparts provided in JAX-RS.
Fix for relative URI usage (re-release)
When using relative URIs with the TypeScript client, the query parameters were not included when the actual request was made. This is now fixed and all query parameters are correctly included.
This was supposed to be released as v0.18.4 (or v0.18.5) but an outdated build was accidentally used. So this is the correct release for this fix.
Skipped release
This was an unsuccessful attempt to correctly publish v0.18.4. Use v0.18.6 instead.
Support for relative URIs
The TypeScript client now supports using relative URIs to access the API. As this is passed to the Fetch API, the exact behavior when resolving the relative URI is determined by the Fetch API.
Additionally, the parameters for the list()
method now use a destructured object so you can easily pass only 1 or 2 parameters to the method.
Fix for relative URI usage
Note: This was incorrectly published, use v0.18.6 (or later) instead.
When using relative URIs with the TypeScript client, the query parameters were not included when the actual request was made. This is now fixed and all query parameters are correctly included.
Updated dependencies
The dependencies used by the TypeScript client have been updated.