After a slight delay, we have the new release with general improvements. It also introduces some new features to the protocol, most notably:
Soft references
The RES Protocol - Resource reference has been extended with an optional "soft": true
parameter, which marks the link as soft:
{ "rid": "user.42.profile", "soft": true }
When marked as soft, Resgate will not embed the referred resource in the result, but instead treat it as a simple value. The client can then choose when (or if) to fetch the linked resource.
Also, for HTTP requests, the soft references resolves into hrefβs:
{
"name": "Jane Doe",
"profile": { "href": "/api/user/42/profile" } // soft reference
}
Kudos to @gbintz for suggesting this feature.
Data values
Models and collections can now have arrays and objects as values. Just put the json data in a wrapper object with a single "data"
key:
{ // Good
"name": "Jane Doe",
"roles": { "data": [ "admin", "moderator" ] }
}
{ // Bad
"name": "Jane Doe",
"roles": [ "admin", "moderator" ]
}
Just beware that these are values, and cannot be partially updated. Eg. if you want to add something to a data value array, you will have to replace the entire data value.
This need for arbitrary data has been requested by many. But special thanks to @greg_keys for the input that led to the final decision about this feature.
ResClient v2.2.0
A new version of ResClient has been released on NPM with support for the new protocol features.
Compatibility
As always, this version is completely backwards compatible with your existing services and clients.