- Use the
title=
attribute from the HTTP Link header, if it exists.
- Added 'finally()' to custom follower promises.
- All representors are now exported in the
representor
namespace.
- Correct return type on followAll, so it may be chained with preFetch. This was only an issue when doing 'multiple hops'.
- #173: De-duplicate HAL links if they appear in _embedded and _links.
- Support for the Collection+json format.
- Added a
preferTransclude()
method on the Follower objects. This automatically adds aPrefer: tranclude="rel"
header.
- Update all dependencies.
- This version is the exact same as the previous alpha.
- Added
hasLink
on Resources and Representations.
- Fixed a bug in
getOptions()
- Added a
preferPush()
method to 'Follower' objects, allowing you to automatically sendPrefer-Push
headers when following links. - Moved all functionality related to the 'Repreprentor' in a utility class,
making both the
Ketting
andResource
classes simpler. - Simplified
Resource.refresh()
, making it easier to read and do less work. - When calling
.post()
, the function will only return a new resource if the HTTP response code was201
. - If the HTTP response code to a
post()
call was205
, it will now return the current resource. - Removed the logic for automatically adding
Prefer-Push
headers. This was unreliable, and usually did the wrong thing. The new system is 100% opt-in and developer-driven. - Added
Ketting.getOptions()
to return a list of options that were passed to Ketting. The options will be enhanced with OAuth2 refresh and access tokens as they become available, meaning that it can be used to place in LocalStorage to remember sessions. This feature is experimental and incomplete. It might change even in minor versions.
- This version is identical to the last, but fixes an issue on npmjs.com. Updating is not needed.
- It's now possible to tell Ketting to prefetch every resource when following
links via
Resource.follow('foo').preFetch()
. Link
andLinkNotFound
are now both exported.- Documentation overhaul.
- Slight tweak to the webpack build, so that other typescript + webpack projects can use the webpack build and use the minified files.
- Now supports the 'invalidates' link rel. When specified in a HTTP response, Ketting will automatically clear the cache of any related resources. See draft-nottingham-linked-cache-inv-04.
- Support for the Siren format.
- Rewrite of the 'representation' system, which is responsible for supporting all the different media types. This results in a few small BC breaks.
- NEW:
follow()
andfollowAll()
now throwLinkNotFound
instead of the genericError
when a link could not be found. - NEW: Resources now have a
link(rel: string)
function, which returns a a singleLink
object. - BC BREAK:
Ketting.getRepresentor()
is nowKetting.createRepresentation()
and is responsible for constructing the object instead of just returning a constructor. - BC Break:
body
,links
andembedded
onRepresentor
objects are all gone and replaced withgetBody()
,getLinks()
andgetEmbedded()
. - BUG: Hal is now more lenient with broken responses.
- NEW: Compatible with Typescript's
strictNullChecks
setting. Overall stronger typing all around. - NEW: Hal responses from the HAL representor are now properly typed.
- CHANGE: Link chaining system has been rewritten, opening the door to new features that weren't possible before.
- This version is identical to the last, but fixes an issue on npmjs.com. Updating is not needed.
- The internal resource cache will now evict items for any non-safe HTTP method.
- Broke Typescript exports again
- Fix Typescript defintion files so Ketting may be imported correctly.
- #129: Using the package in non-typescript node.js now works with a simple
const Ketting = require('ketting')
. - #129: Fixed the browser distribution. the
Ketting
constructor is registered globally again.
- The old format for OAuth2 setup is now no longer supported.
- It's now possible to specify per-domain authentication using wildcards. This allows you to set up specific authentication credentials for specific domains. This might be useful in case you talk to multiple API's with a single client.
- If Ketting anticipates that a user might want to fetch multiple resources
in sequence (a follow chain), it will now add
Prefer-Push
header and aPrefer: transclude
header. Both are experimental internet drafts to suggest to a server to do a HTTP/2 push or embed a child resource respecitvely. This feature is experimental and might change as these drafts change.
- A mistake was made when releasing version 3. A branched was not merged in entirely, which caused some of the new OAuth2 features to be partially missing. This has now been corrected.
- Updated dependencies
- Switched OAuth2 implementation from
client-oauth2
tofetch-mw-oauth2
. This adds support forauthorization_code
auth, removes 11 dependencies and reduces the minified Ketting build from 69KB to 28KB. - OAuth2 options now have a new format. The old format is still supported, but will be removed from a future version.
- The
baseHref
propertyname was renamed toContext
on theLink
type. The new name matches the name from RFC8288. This is a small BC break.
- #120: The system that de-duplicates identical requests will cache failures forever. This is now fixed. Highly recommended update.
- Basic JSON:API support. Currently only links appearing in the top-level document are supported.
- #113: Support for Typescript environments that don't have
esModuleInterop
set to true. - Added a 'go' function for easily getting resources based on relative uris.
- If a link appears in both
_embedded
and_links
, they will be de-duplicated. HAL technically requires links to appear in both places, so scanning_embedded
should not be needed. However, most implementations will not add links_links
if they were already_embedded
. This change caters both usages.
- The
Resource
class is now a generic typescript type. This allows a user of the library to define specific 'types of resources' and leverage static typing forGET
andPUT
requests. - A few documentation updates.
- Better handling of
Content-Types
. When following HAL links that have atype
parameter, the type is rememebered and used inAccept
andContent-Type
headers, forGET
,PUT
andPOST
requests. - If no
type
was provided, it will use the lastContent-Type
header fromGET
response. - If that
GET
request never happened, it uses the first 'default'Content-Type
from client.contentTypes, and enumerates all mime-types from that list forAccept
headers. - No longer incorrectly sends
text/plain
Content-Types. - Optimization: If multiple calls are made to ask for a Resource's current
representation, all these calls are coalesced into one. The big benefit is
that there are no longer multiple parallel
GET
requests. - Webpack browser build is set to 'production' mode.
- Fixed: After refreshing an OAuth2 token, the new access token wasn't used.
- Refreshing OAuth2 tokens without having a refresh_token.
client_credentials
in particular shouldn't return arefresh_token
, so for these cases, new access tokens are acquired using a newclient_credentials
request.
- Support for OAuth2
client_credentials
grant.
- No longer ships with
cross-fetch
andwhatwg-fetch
. To use this library in a browser, you must run this in a browser that supportsfetch
or provide your own polyfill. - Updated dependencies
- Fixed bug: HAL title values weren't parsed.
- Exporting 'Resource' for TS purposes.
- Updated dependencies
- Fixed a typescript definition problem.
- Same as last build.
- #71: Total conversion to Typescript.
- BC break: Minified files are now in the
browser/
directory, not thedist/
directory. - #78: Webpack build had a broken version of
querystring
, which causedLink:
header parsing to fail in browsers. - #80:
resource.fetch()
would throw an exception with some combinations of arguments. - #90:
get()
andrefresh()
will now throw an Error when a server did not include a content-type. - #89: Refactored OAuth utility to be a bit more clear.
- #83: Support for
resource.patch()
. The implementation is pretty basic. Let us know how you would like to use it!
- #70: Moved all source from
lib/
tosrc/
. This is prepping for typescript support. - #73: Mocha tests can now be ran in a browser.
- #76: Fixed a browser bug: Headers is not a constructor.
- #66: Support for Accept header weighing with the q= parameter.
- #68: Updated all dependencies to their latest version.
- #63: It was not possible to expand templated links with variables after more than one chained hop. (@mhum).
- #62: It was not possible to override headers such as
Content-Type
when callingResource.fetch()
, if these were also set in thefetchInit
defaults. (@mhum).
- #60: Chaining more than 2
follow
statements did not work.
- #19: Support for OAuth2 access and refresh tokens. When used, the library
can automatically refresh the access token if the previous one expired. It
can also supports the
client_credentials
OAuth2 grant (@mhum).
- #52: Now using the new URL object in browsers for resolving relative urls, and falling back to a DOM based url resolving mechanism if it's not available. This causes the browser distribution to drop another 10KB to 46KB.
- Moved a bunch of utility objects into a
util/
directory, so it's more clear what the important API's are. - #55: Fixed another problem related to the fetchInit function in firefox.
- Including the sourcemap file in the NPM distribution.
- #53: Regression related to the new 'fetchInit' option.
- Now generating source maps.
- #50: Allow Fetch settings to be passed to the constructor of Ketting, so that
settings such as
credentials: include
may be passed.
- #49: Removed support for expanding CURIEs in HAL. This was in conflict with the HAL standard. The canonical relation type is the prefix in the REL, not the expanded CURIE uri.
- Lots of documentation updates.
- Including web distribution in NPM package.
- This library is now called Ketting. It used to be called Restl. Ketting is the dutch word for chain.
- Automatically expanding Curies in the HAL
_link
object.
- #15: Browser support via webpack!
- #45: Removed Bluebird dependency.
- #16: Parsing the HTTP
Link
header (RFC5988). - #30: Added support for automatically parsing
application/problem+json
error responses and throwing better exceptions. (RFC7807). - #47: Link object now uses an object as its only constructor argument.
- #41: Support for parsing HTML5. The library can now extract
link
anda
elements withrel
attributes. - Removed the
accept
option. This should now be controlled with thecontentTypes
property. - #40: Removed support for the Requests library. This library now only used the Fetch API, to make it compatible with browsers in the future.
- #39: Making it easier to fire off custom HTTP requests on a resource using
the Fetch API. You can now just provide the
init
argument without providing a url.
- #38: Add HTTP response to HTTP-related exceptions.
- #37: Support for templated uris.
- #33: Support for OAuth2 Bearer token.
- #31: Support for setting a standard
Content-Type
HTTP header.
- #28: Support for Basic Authentication
- #27: Fixed exception messages, they missed the HTTP status code.
- #17: Now using the Fetch API instead of the requests library. The requests library is kept around for BC purposes, but this will eventually be removed.
- #25: the resourceCache was accidentally shared between Client instances.
- #11: Added test framework.
- #11: Added
follow()
function on Client object for an easy shortcut.
- #10: Returning the response body from the
refresh()
function, similar toGET
but cache-defeating.
- #7: Strip
_embedded
and_links
fromRepresentation.body
. They are already available throughRepresentation.embedded
andRepresentation.links
. - Added a cache for resources in the Client object, which ensures that if you request the same resource twice, you'll end up with the same object.
- #6: Automatically parse
_embedded
and treat items in this object as real resources. - Fixed a bug in
post()
. - Allowing custom headers to be set, and allowing default headers to be overridden.
- Automatically resolve all urls from
links()
.
- Bugfixes.
- Linting with eslint.
- Now using Bluebird for promises, so we can extend them.
- #2: Custom requests are now possible on
Resource
objects. - #3: Promises returned from
follow()
now have afollow()
function themselves, making it extremely easy to hop from link to link. - Added a
post()
method for making new resources. This function returns aResource
object again if the response contained aLocation
header. - #4: Things in the
_embedded
property are now also treated as links and can be followed. - The
links()
method on Resource now have arel
argument for easy filtering. - Added a
followAll()
function for getting collections.
PUT
request.DELETE
request.
- First version!
- Parses HAL
_links
. - Follows links.
GET
requests.refresh()
function.