# js-data-jsonapi
This adapter implements the JsonApi Protocol and ties it to a js-data data store.
It ties
See the Project Wiki site for more information and examples (under construction)
Goal | Status | Tests |
---|---|---|
Serialize JsonApi requests | code complete | Yes |
When deserializing JsonApi data add 'ParentIds' so that js-data belongsTo relationships can work | code complete | Yes |
When deserializing JsonApi data add 'LocalKey/LocalKeys' or 'ForeignKeys' depending on js-data configurations so that js-data hasOne and hasMany relationships can work | code complete | Yes |
Add metadata to indicate if an object is a jsonApi reference, indicating that it is partially populated only | code complete | Yes |
Transparently request full objects when requested from js-data cache and object is a jsonApi reference only, e.g. Not fully populated | code complete | Yes |
Store hyperlinking data within metadata of stored data | code complete | Yes |
Use metadata hyperlinks to request related data from JsonApi data store | complete | Yes |
Use metadata hyperlinks to add new items to relationships | In Progress | Yes |
npm install --save js-data js-data-http js-data-jsonapi
or bower install --save js-data js-data-http js-data-jsonapi
.
Load js-data-jsonapi.js
after js-data-http.js
and after js-data.js
.
var adapter = new DSJsonApiAdapter.JsonApiAdapter();
var store = new JSData.DS();
store.registerAdapter('jsonApi', adapter, { default: true });
// "store" will now use the jsonApi adapter for all async operations
Or alternatively to use an existing HttpAdapter for example when using js-data-angular
.run(function(DS, DSHttpAdapter) {
var options = {adapter:DSHttpAdapter};
var adapter = new DSJsonApiAdapter.JsonApiAdapter(options);
DS.registerAdapter('jsonApi', adapter, { default: true });
....
}
0.0.0-alpha.21
js-data-jsonapi uses a number of open source projects to work properly:
The MIT License (MIT)
Copyright (c) 2015-2016 Blair Jacobs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.