Javascript/Typescript library mapping objects and their interrelations to JSON API, with a clean, fluent ActiveRecord-like (e.g. similar to Laravel's Eloquent) syntax for creating, retrieving, updating and deleting model objects.
jsonApiBaseUrl
and setting jsonApiType
has been slightly altered, moving to exclusive use of static properties. Check the readme to see for how they are set now.Fixes
Improvements
Artist
.get() // Now a Promise<PluralResult<Artist>>, no longer a
// Promise<PluralResult<Model>>
Improvements
error-stack-parser
under the hoodSingularResponse
or a PluralResponse
is now known by the type system, so no more casting is neededFeatures
.query()
method on the model is now statically availableFixes
.fresh()
method was not reloading nested relations.fresh()
method has been added, which can be called on any Model
instance to obtain a fresh version of that model from the API.limit()
method has been added to the query builder, which allows you to limit the number of results returned by a query.const allStudentsQuery = Student
.with('university');
const firstYearStudentsQuery = allStudentsQuery
.where('year', 1);
In version <2
, the second statement would have mutated allStudentsQuery
as well, and both queries would have been exactly the same. From this release, both allStudentsQuery
and firstYearStudentsQuery
are what their names describe them to be.