{"id":17937755,"url":"https://github.com/blairallegrotech/js-data-jsonapi","last_synced_at":"2025-03-24T08:33:45.314Z","repository":{"id":57282998,"uuid":"49360069","full_name":"BlairAllegroTech/js-data-jsonapi","owner":"BlairAllegroTech","description":"JsonApi Adapter for js-data","archived":false,"fork":false,"pushed_at":"2017-04-12T23:41:36.000Z","size":483,"stargazers_count":15,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"js-data-jsonapi","last_synced_at":"2025-03-19T03:37:30.012Z","etag":null,"topics":["javascript","js-data","jsonapi","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlairAllegroTech.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-10T08:57:16.000Z","updated_at":"2018-07-18T13:04:46.000Z","dependencies_parsed_at":"2022-09-09T06:01:52.552Z","dependency_job_id":null,"html_url":"https://github.com/BlairAllegroTech/js-data-jsonapi","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlairAllegroTech%2Fjs-data-jsonapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlairAllegroTech%2Fjs-data-jsonapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlairAllegroTech%2Fjs-data-jsonapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlairAllegroTech%2Fjs-data-jsonapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlairAllegroTech","download_url":"https://codeload.github.com/BlairAllegroTech/js-data-jsonapi/tar.gz/refs/heads/js-data-jsonapi","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245235846,"owners_count":20582324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","js-data","jsonapi","typescript"],"created_at":"2024-10-28T23:07:30.107Z","updated_at":"2025-03-24T08:33:44.968Z","avatar_url":"https://github.com/BlairAllegroTech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿﻿# js-data-jsonapi\n\n[![npm version][npm_v_badge]][npm_link]\n[![npm downloads][npm_dwn_badge]][npm_link]\n[![cicleci build][circleci_badge]][circleci_link]\n[![Coveralls][coverage_badge]][coverage_link]\n\n### JsonApi Adapter for [js-data](http://www.js-data.io) \nThis adapter implements the [JsonApi Protocol](http://jsonapi.org/) and ties it to a js-data data store.\n\nIt ties \n- JsonApi **types** to js-data **resource**\n- JsonApi **relations** to js-data **toOne, toMany Relationships**\n\nSee the [Project Wiki](https://github.com/BlairAllegroTech/js-data-jsonapi/wiki) site for more information and examples (under construction)\n\n\n## Goals\n\n|Goal|Status|Tests|\n|----|------|-----|\n|Serialize JsonApi requests|code complete |Yes|\n|When deserializing JsonApi data add 'ParentIds' so that js-data **belongsTo** relationships can work|code complete|Yes|\n|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|\n|Add metadata to indicate if an object is a jsonApi reference, indicating that it is partially populated only|code complete|Yes|\n|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|\n|Store hyperlinking data within metadata of stored data|code complete|Yes|\n|Use metadata hyperlinks to request related data from JsonApi data store|complete|Yes|\n|Use metadata hyperlinks to add new items to relationships|In Progress|Yes|\n\n### Known Issues\n1. Test coverage is pretty good.~~Testing is by no means complete, there are many more scenarios that need to be covered off~~ \n    * **(Done)**.\n2. None of the xxxxAll adapter methods have been tested yet. e.g  ~~findAll,~~ destroyAll, updateAll\n    * findAll **(done)**\n3. ~~Bower package has not been tested\n4. The code creates the DSHttpDataAdapter internally.\n    * Allow the adapter to be injected or a constructor function passed via constructor options. **(Done)**\n5. Code is some what brittle in terms of requiring your js-data configuration to match very closely your jsonApi\n    * Could look at adding additional configuration to allow flexible mapping between js-data and jsonapi\n    * Further documentation required illustrating the relationships between JsonApi data structure and js-data configuration **(Partially Done)**\n6. I haven't actually tested this against a 3rd part JsonApi implementation yet like ember.\n    * More testing to be done...... **(In Progress)**\n\n\n### Quick Start\n`npm install --save js-data js-data-http js-data-jsonapi` or `bower install --save js-data js-data-http js-data-jsonapi`.\n\nLoad `js-data-jsonapi.js` after  `js-data-http.js` and after `js-data.js`.\n\n```js\nvar adapter = new DSJsonApiAdapter.JsonApiAdapter();\n\nvar store = new JSData.DS();\nstore.registerAdapter('jsonApi', adapter, { default: true });\n\n// \"store\" will now use the jsonApi adapter for all async operations\n```\n\nOr alternatively to use an existing HttpAdapter for example when using js-data-angular\n\n```js\n.run(function(DS, DSHttpAdapter) {\n    \n    var options = {adapter:DSHttpAdapter};\n    var adapter = new DSJsonApiAdapter.JsonApiAdapter(options);\n    DS.registerAdapter('jsonApi', adapter, { default: true });\n    ....\n}\n```\n\n### Version\n0.0.0-alpha.21\n\n### Tech\n\njs-data-jsonapi uses a number of open source projects to work properly:\n\n* [js-data](https://github.com/js-data/js-data) - makes use of js-data apis for integration\n* [js-data-http](https://github.com/js-data/js-data-http) - Provides HTTP services!\n\n### License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015-2016 Blair Jacobs\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[npm_link]: https://www.npmjs.com/package/js-data-jsonapi\n[npm_v_badge]: https://img.shields.io/npm/v/js-data-jsonapi.svg\n[npm_dwn_badge]: https://img.shields.io/npm/dm/js-data-jsonapi.svg\n[circleci_link]: https://circleci.com/gh/BlairAllegroTech/js-data-jsonapi/tree/master\n[circleci_badge]: https://circleci.com/gh/BlairAllegroTech/js-data-jsonapi.svg?style=shield\n[coverage_badge]: https://coveralls.io/repos/github/BlairAllegroTech/js-data-jsonapi/badge.svg?branch=js-data-jsonapi\n[coverage_link]: https://coveralls.io/github/BlairAllegroTech/js-data-jsonapi?branch=js-data-jsonapi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblairallegrotech%2Fjs-data-jsonapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblairallegrotech%2Fjs-data-jsonapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblairallegrotech%2Fjs-data-jsonapi/lists"}