{"_id":"@apicase/jsonapi","_rev":"5-f4839cb4a29fbca3be40589baf4e76f4","name":"@apicase/jsonapi","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@apicase/jsonapi","version":"0.1.0","description":"JSON API plugin for Apicase (jsonapi.org)","module":"index.js","main":"index.cjs.js","repository":{"type":"git","url":"https://github.com/apicase/jsonapi"},"author":{"name":"Anton Kosykh","email":"kelin2025@yandex.ru"},"license":"MIT","scripts":{"lint":"eslint --fix *.js","build":"babel index.js --out-file index.cjs.js"},"dependencies":{"json-api-normalize":"^1.1.5"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-plugin-transform-es2015-modules-simple-commonjs":"^0.3.0","eslint":"^4.16.0","eslint-config-standard":"^11.0.0-beta.0","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","ghooks":"^2.0.2"},"_id":"@apicase/jsonapi@0.1.0","dist":{"shasum":"ed5de613cfbfe6e61aa2bc730cf86ef572fe3e2b","tarball":"https://registry.npmjs.org/@apicase/jsonapi/-/jsonapi-0.1.0.tgz","fileCount":6,"unpackedSize":3563,"integrity":"sha512-tQVgA6SEljFUHQsGT3219vgbyqiYib3RwSnATLuR8zJFH96QQwTy5fUAdYkKFjKKdt0slTR/FUFkfErRYT9ukw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCA4sd1qjlexOYPAHZTnFQQuWuye3ebUvMKLFowHbiuLgIhANLmXlAOKgoar40Dk8dhZK/EJyZqK/G5BQhCFKjYY6/+"}]},"maintainers":[{"name":"kelin2025","email":"vasya-petruha@yandex.ru"}],"_npmUser":{"name":"kelin2025","email":"vasya-petruha@yandex.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonapi_0.1.0_1523634020222_0.2807975314650919"},"_hasShrinkwrap":false},"0.1.1":{"name":"@apicase/jsonapi","version":"0.1.1","description":"JSON API plugin for Apicase (jsonapi.org)","module":"index.js","main":"index.cjs.js","repository":{"type":"git","url":"git+https://github.com/apicase/jsonapi.git"},"author":{"name":"Anton Kosykh","email":"kelin2025@yandex.ru"},"license":"MIT","scripts":{"lint":"eslint --fix *.js","build":"babel index.js --out-file index.cjs.js"},"dependencies":{"json-api-normalize":"^1.1.5"},"devDependencies":{"babel-cli":"^6.26.0","babel-core":"^6.26.0","babel-plugin-transform-es2015-modules-simple-commonjs":"^0.3.0","eslint":"^4.16.0","eslint-config-standard":"^11.0.0-beta.0","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","ghooks":"^2.0.2"},"gitHead":"4f7a7169853512a95b7dce3594b52684c0d55a84","bugs":{"url":"https://github.com/apicase/jsonapi/issues"},"homepage":"https://github.com/apicase/jsonapi#readme","_id":"@apicase/jsonapi@0.1.1","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"kelin2025","email":"vasya-petruha@yandex.ru"},"dist":{"integrity":"sha512-MXyQERAbTrYPUMyA9cdsXL+CXJABKY1sfmwOJqyz8l0IZjXu+pcViAdreMGG8cbbpPjpqEpmvQUNDXGz7U9dpw==","shasum":"98d8bc799fe827b3b7797926f42c56549d1069a3","tarball":"https://registry.npmjs.org/@apicase/jsonapi/-/jsonapi-0.1.1.tgz","fileCount":5,"unpackedSize":76486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbSKDWCRA9TVsSAnZWagAALJ4QAJBdPw++ndk6gijtdF3y\njENys+pk5rvDWx+RCqGU+bt4T2UZAk0fBJNqyqsXNuwsIGMtyAWmP8pRtW6S\neihoKHEx6j8x3JticB6KhR7jaJlvn29BQxD/1cwjHAQZPgBxVNv6jEG51jxv\nT+XApfhYq3xU6qvGdbmEf40e+mGEobdu9Am6j+F3KzI7iBXaHnGRindmv6z4\n75cYZOnhdXZ7QBD6djfg3tkfTVPiNZmn7PxlW+2uyfMbZSmr0ocr29oAQcZq\nn0s+E/1yuBOccLxmYxILOJ2Mab0BWiQHCM2h28kYdSGRJI+dcNHdy6Vm/drW\nfhYnJwbQX/XAuVKFdvaXajM2e2KEhXamzCOUUJbR1IFvB7w685rmVI0SXm1N\nyce5okCqa9HC0/ndqVQPkE66cdQPW70ZrMR87y2g2Bcaapqb+pz1SD7FqIJ0\nTreyCS6P+hAUmB5ZNM0zkED4HWj/c7CTcL6a2AHHFas4yurZLyZGl74Idwvg\nv6pBoid9jt5GH/PrT8XWyOd0fdMHpIuqND5RtTrKwrvM33STo4Z3ZRkjvAZh\nUzstVi1TO2lYD/P+1qr47hT1oEPtmSLI4KfA7UIPK2v72ZkFNH10qIEbw6do\n3xqYUFtXxZ5YjOnfvXA/k7Pl2vU1G/CK2R3dHeyPfr+b3lLNcBNnRRCY8iEI\njmwl\r\n=OxvP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCICHr5TB75h824L+V4V8wZqfN5xt/lpBEYTHbyWJxRxlGAh97sBxqC0dtM4dOY9VjrGOMMcD54ZZPLXTsbVJoY/L2"}]},"maintainers":[{"name":"kelin2025","email":"vasya-petruha@yandex.ru"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonapi_0.1.1_1531486422276_0.25632761824927375"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-13T15:40:20.170Z","0.1.0":"2018-04-13T15:40:20.307Z","modified":"2022-06-12T14:43:39.879Z","0.1.1":"2018-07-13T12:53:42.348Z"},"maintainers":[{"name":"kelin2025","email":"vasya-petruha@yandex.ru"}],"description":"JSON API plugin for Apicase (jsonapi.org)","repository":{"type":"git","url":"git+https://github.com/apicase/jsonapi.git"},"author":{"name":"Anton Kosykh","email":"kelin2025@yandex.ru"},"license":"MIT","readme":"# Apicase JSON API\n\nApicase plugin that helps you work with JSON API (based on [**json-api-normalize**](https://github.com/dbrekalo/json-api-normalize))\n\n## Read JSON API specification\n\n[**click here**](http://jsonapi.org/)\n\n## Installation\n\n```\nnpm install @apicase/jsonapi\n```\n\n```javascript\nimport fetch from \"@apicase/adapter-fetch\"\nimport { ApiService } from \"@apicase/core\"\nimport { jsonApiPlugin } from \"@apicase/jsonapi\"\n\nconst Root = new ApiService(fetch, {\n  url: \"/api\"\n}).use(jsonApiPlugin) // <- Add this line\n```\n\n## Usage\n\nImagine that we have API route with the following `result.body`:\n\n```json\n{\n  \"data\": [\n    {\n      \"id\": \"1\",\n      \"type\": \"post\",\n      \"attributes\": {\n        \"title\": \"Hello world\",\n        \"text\": \"Lorem Ipsum Dolor ...\"\n      },\n      \"relationships\": {\n        \"author\": {\n          \"data\": {\n            \"id\": \"1\",\n            \"type\": \"user\"\n          }\n        }\n      }\n    }\n  ],\n  \"included\": [\n    {\n      \"id\": \"1\",\n      \"type\": \"user\",\n      \"attributes\": {\n        \"name\": \"Anton\",\n        \"surname\": \"Kosykh\"\n      }\n    }\n  ]\n}\n```\n\nWe'll create a service with `meta.normalize` options:\n\n```javascript\nconst GetPosts = Root.extend({\n  meta: {\n    normalize: [\"id\", \"title\", \"text\", \"author.id\", \"author.name\"]\n  }\n})\n\nGetPosts\n  .doRequest()\n  .then(({ result }) => {\n    console.log(result.body)\n  })\n```\n\nIt will convert `result.body` to:\n\n```json\n[\n  {\n    \"id\": \"1\",\n    \"title\": \"Hello world\",\n    \"text\": \"Lorem Ipsum Dolor ...\",\n    \"author\": {\n      \"id\": \"1\",\n      \"name\": \"Anton\"\n    }\n  }\n]\n```\n\nIf you need `links` or another options from original body, it's stored in `result.rawBody`:\n\n```javascript\nconsole.log(result.rawBody.included)\n/*\n  [{\n    \"id\": \"1\",\n    \"type\": \"user\",\n    \"attributes\": {\n      \"name\": \"Anton\",\n      \"surname\": \"Kosykh\"\n    }\n  }]\n*/\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/apicase/jsonapi#readme","bugs":{"url":"https://github.com/apicase/jsonapi/issues"}}