Comparing version 3.2.0-rc.2 to 4.0.0
169
CHANGELOG.md
@@ -1,24 +0,122 @@ | ||
#### 3.2.0-rc.2 (2017-11-11) | ||
## 4.0.0 (2018-01-03) | ||
##### Breaking Changes | ||
* change default camelCase conversion from snake_case to kebab-case ([60181d7a](https://github.com/wopian/kitsu/commit/60181d7a165a21bdf825799c151b4d55cdd1a7ec)) | ||
* create legacy bundle for IE8, 9, 10 and 11 support ([e8a31c78](https://github.com/wopian/kitsu/commit/e8a31c78e4aca6f040905b76c562788c8693e87e)) | ||
* merge API version into baseURL ([d9d8c4f7](https://github.com/wopian/kitsu/commit/d9d8c4f7709959edc595eb0520103cd67a64ace3)) | ||
* exclude ie mobile ([90b84346](https://github.com/wopian/kitsu/commit/90b843462ff14277a47f78d452aa5323fcc6b1cf)) | ||
* **fix:** error object can now be destructured ([af067881](https://github.com/wopian/kitsu/commit/af067881be603a4d6f920fc5edc2873a6b06257d)) | ||
##### Build System / Dependencies | ||
* add spellchecker and library size reporter ([c4e20dad](https://github.com/wopian/kitsu/commit/c4e20dad28e33433d9a1d87681f660d72142f91e)) | ||
* update globals location ([9c9436ae](https://github.com/wopian/kitsu/commit/9c9436aea317551f5600d79197faa06117bade03)) | ||
* cleanup rollup config ([425a24e0](https://github.com/wopian/kitsu/commit/425a24e075c8974f98a220430e4d6c873c8c4d5c)) | ||
* remove unused runtime helpers ([1bb4310c](https://github.com/wopian/kitsu/commit/1bb4310c1aef901394b6862a6f8ba7803b54d4f0)) | ||
* lint docs ([1a76938d](https://github.com/wopian/kitsu/commit/1a76938d6f58706a5e7fa7a0857b5f3c5f5b0902)) | ||
##### Chores | ||
* **deps:** | ||
* update lockfile ([b7ae9d20](https://github.com/wopian/kitsu/commit/b7ae9d20bc3d0c4a483cf12ceaf1e52a744a2a97)) | ||
* lock file maintenance ([#83](https://github.com/wopian/kitsu/pull/83)) ([135e85c8](https://github.com/wopian/kitsu/commit/135e85c8dc9d49184c0c91f07151cd4c67987350)) | ||
* update babel-eslint to ~8.1.0 ([#79](https://github.com/wopian/kitsu/pull/79)) ([3343ebbb](https://github.com/wopian/kitsu/commit/3343ebbbe8e1375ef3d47e7570603b91124678e2)) | ||
* update eslint to ~4.14.0 ([#77](https://github.com/wopian/kitsu/pull/77)) ([fb8fcb86](https://github.com/wopian/kitsu/commit/fb8fcb8692e4ff6a083775167d070156c87f5449)) | ||
* update rollup to ~0.53.0 ([#78](https://github.com/wopian/kitsu/pull/78)) ([e283a28e](https://github.com/wopian/kitsu/commit/e283a28e6ff7ca3a4fb67ef938487488fc35c5bc)) | ||
* update jest to ~22.0.0 ([#75](https://github.com/wopian/kitsu/pull/75)) ([bf501352](https://github.com/wopian/kitsu/commit/bf50135220190c59e3e8eb908f86e39b10474e38)) | ||
* add missing eslint plugins ([6b8253f2](https://github.com/wopian/kitsu/commit/6b8253f23d8811407c5f077f83aea9b2fec2e35f)) | ||
* update generate-changelog to ~1.7.0 ([#72](https://github.com/wopian/kitsu/pull/72)) ([2a5a3da3](https://github.com/wopian/kitsu/commit/2a5a3da3fc273317bdbe6fe95b9f0815d8c21e90)) | ||
* update eslint-plugin-jest to ~21.5.0 ([#71](https://github.com/wopian/kitsu/pull/71)) ([eb87da70](https://github.com/wopian/kitsu/commit/eb87da7016d9c68308e548da7287a7ed044ac7a2)) | ||
* **npm:** | ||
* ignore test usecases and spec files ([8d83c8c7](https://github.com/wopian/kitsu/commit/8d83c8c711f4165b6a00aeb020ff7f2c658e931e)) | ||
* remove non-existent ignores ([279f882e](https://github.com/wopian/kitsu/commit/279f882e40c73f10b855421c521296541702fcca)) | ||
* include source code in releases ([154ebd97](https://github.com/wopian/kitsu/commit/154ebd970ae2b09f3969e33732544e60e09296a1)) | ||
* move serialise into directory ([87637c5f](https://github.com/wopian/kitsu/commit/87637c5f31b3d9ba18092d28145bc2c1093b81bc)) | ||
* update renovate config ([936013c4](https://github.com/wopian/kitsu/commit/936013c4a08a6d422fcbcbf6e78c0e2661f11807)) | ||
* **readme:** combine usage and docs section ([2c586b38](https://github.com/wopian/kitsu/commit/2c586b384c2da278534008d74422336485bfa20d)) | ||
* **renovate:** | ||
* fix commit type ([a8344e97](https://github.com/wopian/kitsu/commit/a8344e9793984c3eb043bd21954cd9f3f2f56163)) | ||
* remove linters config ([c541abb4](https://github.com/wopian/kitsu/commit/c541abb44461c24cbbcc191410a0d3f865b41756)) | ||
* remove schedule ([e15c066e](https://github.com/wopian/kitsu/commit/e15c066e83e1c84b4aa854a608bd22b5508f6fe2)) | ||
* remove assign ([d3462de1](https://github.com/wopian/kitsu/commit/d3462de177778ad7cf112f90e5d810bb82fcccc4)) | ||
* stop displaying fix(deps) commits ([cd19bf3a](https://github.com/wopian/kitsu/commit/cd19bf3a4e8cfa1b670c546b9a0259400e19c525)) | ||
##### Continuous Integration | ||
* enforce eslint formatting rules ([f1f7df20](https://github.com/wopian/kitsu/commit/f1f7df2073cb645fb53459bf1cde29f344e2af91)) | ||
* **codeclimate:** | ||
* migrate config to version 2 ([869288e4](https://github.com/wopian/kitsu/commit/869288e4f264c7f083fc2aa7a11b701a019d7751)) | ||
* ignore __cases__ directory ([e0842177](https://github.com/wopian/kitsu/commit/e08421777f0d731f70a5240cddd961acd35ce536)) | ||
* **appveyor:** | ||
* update config ([d840e1b2](https://github.com/wopian/kitsu/commit/d840e1b287110c53f06b4f0edfff6dc541ae521d)) | ||
* stop testing with 32bit ([fc6bfcc2](https://github.com/wopian/kitsu/commit/fc6bfcc2ad84ea3cea0ff8c6160605b38cfb5326)) | ||
* don't mutate lockfile when testing ([0534ec21](https://github.com/wopian/kitsu/commit/0534ec21597b079bae22bd064f3e47bfce55688d)) | ||
* **travis:** | ||
* disable macOS builds due to backlog ([5118fe14](https://github.com/wopian/kitsu/commit/5118fe1484f41242701b3a55e67c3921c491754d)) | ||
* force test node environment ([91140570](https://github.com/wopian/kitsu/commit/91140570eb4a80a950d1d42f73182d83c7840cfe)) | ||
##### Documentation Changes | ||
* add 4.x migration guide ([ef714744](https://github.com/wopian/kitsu/commit/ef7147440513d0cdc2dd110e69a0ae0324713f05)) | ||
* update links ([2f66c1bc](https://github.com/wopian/kitsu/commit/2f66c1bccf9525d07d21ef1fbfb22dd3f44f71fe)) | ||
* fix codeclimate coverage badge again ([78177dde](https://github.com/wopian/kitsu/commit/78177ddee87204a3837c5fba7b1c2a5725c8f69c)) | ||
* fix codeclimate coverage badge ([b3719e36](https://github.com/wopian/kitsu/commit/b3719e36d75abfa993fd96e3b1f7410d9b3a22dc)) | ||
* version tag link to docs ([77985497](https://github.com/wopian/kitsu/commit/779854973e8c2a8f0e1db632c3a438167ba755f3)) | ||
* resolve lint warnings ([79589d7f](https://github.com/wopian/kitsu/commit/79589d7f7d8cd31d8d06f1bf5050b04d85898365)) | ||
* add patreon ([854b3a08](https://github.com/wopian/kitsu/commit/854b3a0878adb0f24cf36ac24d64f01d4fcba9c6)) | ||
* **contributing:** add test section ([c0c71657](https://github.com/wopian/kitsu/commit/c0c716572a92529e4c16a14c54ac27b3805b3d5a)) | ||
##### New Features | ||
* use pluralisation and camelisation options for data serialisation ([74a290f5](https://github.com/wopian/kitsu/commit/74a290f56f6058f5f4000a6dec7a7e01484a9f36)) | ||
* allow disabling pluralize and decamelize ([#69](https://github.com/wopian/kitsu/pull/69)) ([aaa0c876](https://github.com/wopian/kitsu/commit/aaa0c87674afce6343ec40df24ad7f84e752b594)) | ||
* support all browsers with usage higher than 0.1% (reverts 379ac32) ([432cdb16](https://github.com/wopian/kitsu/commit/432cdb16eef3799b581c39578594c370b6b7e78d)) | ||
* drop browser support for ie ([379ac329](https://github.com/wopian/kitsu/commit/379ac32934aefe207b1f1a41c530ebf97e5dad3e)) | ||
##### Bug Fixes | ||
* use header objects for Authorization checks ([a6d4b11b](https://github.com/wopian/kitsu/commit/a6d4b11bd49d9dfb66dc050ca4851b396566e129)) | ||
* prevent pluralising {baseURL}/resources/1 as {baseURL}/resource/1S ([91da8f09](https://github.com/wopian/kitsu/commit/91da8f09670476afedf9ecf170153563c89605b3)) | ||
* handle relationship arrays (fixes [#80](https://github.com/wopian/kitsu/pull/80)) ([#81](https://github.com/wopian/kitsu/pull/81)) ([596ff898](https://github.com/wopian/kitsu/commit/596ff8980d9e59e51c7fe020460946134f450ea0)) | ||
##### Other Changes | ||
* mock axios and add response test cases ([937169a8](https://github.com/wopian/kitsu/commit/937169a8fcb92ec2facbd57166918aa088692f3a)) | ||
##### Refactors | ||
* reduce error logging size ([064833b6](https://github.com/wopian/kitsu/commit/064833b6b3fd4f5bc9cf26521dde49cfc20341d1)) | ||
* avoid using template literal ([48c61150](https://github.com/wopian/kitsu/commit/48c61150c2c878eb699a9a59a65536fbddfd2793)) | ||
* use own isAuth getter to check auth header ([fafcdc0e](https://github.com/wopian/kitsu/commit/fafcdc0e594b1a14f82145da1b6d7be1e38fea7f)) | ||
* clean up source ([905ef7b0](https://github.com/wopian/kitsu/commit/905ef7b090120933ff44bf7457e94121718ce776)) | ||
* don't bind methods to class ([da4efadd](https://github.com/wopian/kitsu/commit/da4efadd8d488ad50fb7a1819e4079b5ad67e573)) | ||
* cleaner method imports ([8ece462d](https://github.com/wopian/kitsu/commit/8ece462d0f66a70ed209a692b4567a697a69da61)) | ||
### 3.2.0-rc.1 (2017-11-11) | ||
##### Reverts | ||
The `pluralization` dependency has been removed in this candidate. This is a quick fix to resolve issues with models that end with numeric values and will be resolved and `pluralization` re-added with configuration in the proper release. | ||
* **renovate:** add assignee back ([bff492f0](https://github.com/wopian/kitsu/commit/bff492f0ccd25bc3d3444568fb513d160a7b4b1f)) | ||
* force test node environment ([77c1dbb2](https://github.com/wopian/kitsu/commit/77c1dbb28e884a11a98f0ce5cf102c2b4025b602)) | ||
As a side effect, the body of `POST`, `PATCH` and `DELETE` requests **must** contain an `id` and `type`. | ||
##### Tests | ||
Do not upgrade to this candidate if the model pluralization has not been affecting you. | ||
* use exact url paths for axios mocking ([99568a53](https://github.com/wopian/kitsu/commit/99568a534179560f4922cd9ed8e86d5e274e58a3)) | ||
* use toThrowError for serialise array test ([2cf31406](https://github.com/wopian/kitsu/commit/2cf31406f5d0c0acf03bc05135d597df859f818f)) | ||
* add basic patch, post and delete tests ([89f2b45c](https://github.com/wopian/kitsu/commit/89f2b45c72d56d4c06a4a426de83221c99d02c54)) | ||
* add more get test cases ([9dc2ce02](https://github.com/wopian/kitsu/commit/9dc2ce02a2e4b6fe2de4a258d5ed486ac36d4387)) | ||
* add a few patch test cases ([3631d24b](https://github.com/wopian/kitsu/commit/3631d24bad15a67d061f5ddbf1f8390e45b488d5)) | ||
* add Kitsu constructor tests ([17519c6e](https://github.com/wopian/kitsu/commit/17519c6e6ee523cdffbc06de98fb7e028803b7d0)) | ||
#### 3.1.4 (2017-12-12) | ||
##### Chores | ||
* remove pluralisation tests ([624f1287](https://github.com/wopian/kitsu/commit/624f12874680eed921c5059e633b422b652518fa)) | ||
* drop pluralize from serialiser ([cc111b90](https://github.com/wopian/kitsu/commit/cc111b9050f9e94f38d4c75a59bbf9c6ca7c8c43)) | ||
* strip stray console logging from being bundled ([da72d534](https://github.com/wopian/kitsu/commit/da72d534231c0384411f6f3efcf1a277250c2ca9)) | ||
* update release scripts ([6f81ed9a](https://github.com/wopian/kitsu/commit/6f81ed9ac521f434fc3c169faf4c773ab3499f1c)) | ||
* remove 3.1.2 commits from 3.1.3 changelog ([64acafd5](https://github.com/wopian/kitsu/commit/64acafd55bb623d1464afcd4ed8027ba66e7b46a)) | ||
* fix changelog versioning ([53c10dab](https://github.com/wopian/kitsu/commit/53c10dab5f539adc8b1c81566da7831ff2eb6159)) | ||
* update build scripts ([bc3b1807](https://github.com/wopian/kitsu/commit/bc3b1807238391afbe536a0f65271abf56da12c6)) | ||
* use common error function ([c25e4dc2](https://github.com/wopian/kitsu/commit/c25e4dc2cf81c7f4058239039ecdd5bff8604270)) | ||
* **deps:** | ||
* renovate eslint packages (#68) ([151405ff](https://github.com/wopian/kitsu/commit/151405ff5df73b9c2b41b833699a8a61575357a5)) | ||
* renovate eslint packages (#67) ([b8c66c25](https://github.com/wopian/kitsu/commit/b8c66c256f96733636e6bb605956ee265d240b4f)) | ||
* update generate-changelog to ~1.6.0 (#65) ([563fc22b](https://github.com/wopian/kitsu/commit/563fc22bf2af8fc5b15b8d844d22fb15d5591700)) | ||
* update rollup to ~0.52.0 (#66) ([853fa39d](https://github.com/wopian/kitsu/commit/853fa39d6b2e8a017428324493a4f8b123d5cdfc)) | ||
@@ -28,13 +126,54 @@ ##### Continuous Integration | ||
* **travis:** | ||
* fix latest node version ([d4a1d71d](https://github.com/wopian/kitsu/commit/d4a1d71d948d26a39e4c2ad4baaaff09b6473aba)) | ||
* add comments for when LTS ends ([15cf0e94](https://github.com/wopian/kitsu/commit/15cf0e9445e1f210d2b161f5c76f1df59a064a96)) | ||
* **appveyor:** drop testing node 7 and add 8 ([ae4dbb94](https://github.com/wopian/kitsu/commit/ae4dbb94e021a38289c7defae5f3eee3643c6147)) | ||
* use existing oauth token ([1f7f8373](https://github.com/wopian/kitsu/commit/1f7f83733796774b4941600cd43b7f2138a5a7d7)) | ||
* add package files to github releases ([2c6e577e](https://github.com/wopian/kitsu/commit/2c6e577e9a7712dfc2305f319bc28ef436aac4a2)) | ||
* test against LTS node versions ([184ee6f7](https://github.com/wopian/kitsu/commit/184ee6f7b4a0bcf909fea3ef9594155f89b0f605)) | ||
##### Documentation Changes | ||
* add contributors badge ([7bb04ba8](https://github.com/wopian/kitsu/commit/7bb04ba8860f3741285a9dba1c04074c4fbf0439)) | ||
* fix kitsu.io docs url ([39b337a1](https://github.com/wopian/kitsu/commit/39b337a1ea61de2ff7194dee17e280f163a93a69)) | ||
* update donation link ([c43b10b3](https://github.com/wopian/kitsu/commit/c43b10b38cd053f8608f3ae1816044143e97d216)) | ||
* use https for kitsu.io api docs link ([c0494cbc](https://github.com/wopian/kitsu/commit/c0494cbc1fa51fb465c2888e8ca9edb1170d8cf6)) | ||
* update badges and add example response comparison ([70be0a71](https://github.com/wopian/kitsu/commit/70be0a71707b81cc2a19e324f7ff1485faedcbed)) | ||
##### Bug Fixes | ||
* drop pluralisation of request models ([053706a0](https://github.com/wopian/kitsu/commit/053706a02c2b34b408e170aff00b06b69c23ba09)) | ||
* add parentheses to fix short-circuiting of URL version (#64) ([b74fd7e3](https://github.com/wopian/kitsu/commit/b74fd7e37c9913a20b6efbe6a96503b48473817c)) | ||
#### 3.1.3 (2017-11-26) | ||
##### Bug Fixes | ||
* add parentheses to fix short-circuiting of URL version (#64) ([b74fd7e3](https://github.com/wopian/kitsu/commit/b74fd7e37c9913a20b6efbe6a96503b48473817c)) | ||
#### 3.1.2 (2017-11-24) | ||
##### Chores | ||
* update build scripts ([bc3b1807](https://github.com/wopian/kitsu/commit/bc3b1807238391afbe536a0f65271abf56da12c6)) | ||
* use common error function ([c25e4dc2](https://github.com/wopian/kitsu/commit/c25e4dc2cf81c7f4058239039ecdd5bff8604270)) | ||
##### Continuous Integration | ||
* test against LTS node versions ([184ee6f7](https://github.com/wopian/kitsu/commit/184ee6f7b4a0bcf909fea3ef9594155f89b0f605)) | ||
#### 3.1.1 (2017-11-24) | ||
##### Chores | ||
* **deps:** | ||
* renovate eslint packages (#62) ([115a8b0d](https://github.com/wopian/kitsu/commit/115a8b0d2bb1f3b2f4b200db7713d0540f655ea0)) | ||
* update rollup to ~0.51.0 (#63) ([0b4ae24f](https://github.com/wopian/kitsu/commit/0b4ae24fb88fc6269e13a01bd145ebe0f55c044f)) | ||
##### Continuous Integration | ||
* **travis:** remove greenkeeper integrations ([bfae4aae](https://github.com/wopian/kitsu/commit/bfae4aae8d9aefee2e37b38acc32af2e021ae458)) | ||
##### Bug Fixes | ||
* handle empty data arrays ([d95f0593](https://github.com/wopian/kitsu/commit/d95f059364d4083cb362c4ff487050878a8a0850)) | ||
##### Tests | ||
* fix pluralisation ([f028768a](https://github.com/wopian/kitsu/commit/f028768af5130e0c82f7bd65523c0e19ae6a246a)) | ||
* add empty data array spec ([122387a1](https://github.com/wopian/kitsu/commit/122387a1262a9908fc130dceabf29feb207d3b5d)) | ||
@@ -41,0 +180,0 @@ ### 3.1.0 (2017-11-07) |
246
DOCS.md
@@ -6,21 +6,23 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- [Kitsu](#kitsu) | ||
- [get](#get) | ||
- [headers](#headers) | ||
- [isAuth](#isauth) | ||
- [create](#create) | ||
- [fetch](#fetch) | ||
- [patch](#patch) | ||
- [post](#post) | ||
- [remove](#remove) | ||
- [self](#self) | ||
- [update](#update) | ||
## Kitsu | ||
A simple, lightweight & framework agnostic JSON-API client JSON API | ||
A simple framework agnostic JSON-API client JSON API | ||
**Parameters** | ||
- `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`) | ||
- `options.baseURL` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Override the HTTP API endpoint (default \`<https://kitsu.io/api>) | ||
- `options.version` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Override the HTTP API version (default `edge` if kitsu.io, else defaults to an empty `String`) | ||
- `options.timeout` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Override the request timeout in milliseconds (default `30000`) | ||
- `options.headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with requests | ||
- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options | ||
- `options.baseURL` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Set the API endpoint (default `https://kitsu.io/api/edge`) | ||
- `options.headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with requests | ||
- `options.camelCaseTypes` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If true, the `type` value will be camelCased, e.g `library-entries` and `library_entries` become `libraryEntries` (default `true`) | ||
- `options.resourceCase` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** `kebab`, `snake` or `none`. If `kebab`, `/libraryEntries` will become `/library-entries`. If `snake`, `/libraryEntries` will become `/library_entries`, If `none`, `/libraryEntries` will be unchanged (default `kebab`) | ||
- `options.pluralize` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** If `true`, `/user` will become `/users` in the URL request and `type` will be pluralized in post, patch and delete requests - `user` -> `users` (default `true`) | ||
- `options.timeout` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Set the request timeout in milliseconds (default `30000`) | ||
@@ -30,3 +32,3 @@ **Examples** | ||
```javascript | ||
// Basic | ||
// If using Kitsu.io's API | ||
const api = new Kitsu() | ||
@@ -36,7 +38,14 @@ ``` | ||
```javascript | ||
// Set a `user-agent` and pre-existing `authorization` token | ||
// If using another API server | ||
const api = new Kitsu({ | ||
baseURL: 'https://api.example.org/2' | ||
}) | ||
``` | ||
```javascript | ||
// Set a `user-agent` and an `authorization` token | ||
const api = new Kitsu({ | ||
headers: { | ||
'user-agent': 'MyApp/1.0.0 (github.com/username/repo)', | ||
authorization: 'Bearer 1234567890' | ||
'User-Agent': 'MyApp/1.0.0 (github.com/username/repo)', | ||
Authorization: 'Bearer 1234567890' | ||
} | ||
@@ -46,9 +55,63 @@ }) | ||
### get | ||
Fetch resources | ||
Aliases: `fetch` | ||
**Parameters** | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to fetch data from | ||
- `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries (optional, default `{}`) | ||
- `params.page` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** jsonapi.org/format/#fetching-pagination | ||
- `params.page.limit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of resources to return in request (Max `20` for Kitsu.io except on `libraryEntries` which has a max of `500`) | ||
- `params.page.offset` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of resources to offset the dataset by | ||
- `params.fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Return a sparse fieldset with only the included attributes/relationships jsonapi.org/format/#fetching-sparse-fieldsets | ||
- `params.filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Filter dataset by attribute values jsonapi.org/format/#fetching-filtering | ||
- `params.sort` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Sort dataset by one or more comma separated attributes (prepend `-` for descending order) jsonapi.org/format/#fetching-sorting | ||
- `params.include` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Include relationship data jsonapi.org/format/#fetching-includes | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
**Examples** | ||
```javascript | ||
// Use a different JSON-API backend | ||
const api = new Kitsu({ | ||
baseURL: 'https://api.example.org' | ||
// Get a specific user's name & birthday | ||
api.get('users', { | ||
fields: { | ||
users: 'name,birthday' | ||
}, | ||
filter: { | ||
name: 'wopian' | ||
} | ||
}) | ||
``` | ||
```javascript | ||
// Get a collection of anime resources and their categories | ||
api.get('anime', { | ||
include: 'categories' | ||
}) | ||
``` | ||
```javascript | ||
// Get a single resource and its relationships by ID (method one) | ||
api.get('anime', { | ||
include: 'categories', | ||
filter: { id: '2' } | ||
}) | ||
``` | ||
```javascript | ||
// Get a single resource and its relationships by ID (method two) | ||
api.get('anime/2', { | ||
include: 'categories' | ||
}) | ||
``` | ||
```javascript | ||
// Get a resource's relationship data only | ||
api.get('anime/2/categories') | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
### headers | ||
@@ -62,3 +125,3 @@ | ||
// Receive all the headers | ||
console.log(api.headers) | ||
api.headers | ||
``` | ||
@@ -68,3 +131,3 @@ | ||
// Receive a specific header | ||
console.log(api.headers['user-agent']) | ||
api.headers['User-Agent'] | ||
``` | ||
@@ -74,10 +137,10 @@ | ||
// Add or update a header | ||
api.headers['authorization'] = 'Bearer 1234567890' | ||
api.headers['Authorization'] = 'Bearer 1234567890' | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** All the current headers | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** All the current headers | ||
### isAuth | ||
Check if the client is authenticated (oAuth2) | ||
Check if the client is authenticated (oAuth2/Authorization header) | ||
@@ -91,14 +154,14 @@ **Examples** | ||
Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** | ||
### create | ||
### patch | ||
Create a new resource | ||
Aliases: `post` | ||
Update a resource | ||
Aliases: `update` | ||
**Parameters** | ||
- `model` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to create a resource under | ||
- `body` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data to send in the request | ||
- `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to update data in | ||
- `body` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data to send in the request | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
@@ -108,35 +171,21 @@ **Examples** | ||
```javascript | ||
// Post a comment to a user's own profile | ||
api.post('posts', { | ||
content: 'Hello World', | ||
targetUser: { | ||
id: '42603', | ||
type: 'users' | ||
}, | ||
user: { | ||
id: '42603', | ||
type: 'users' | ||
} | ||
// Update a user's post (Note: For Kitsu.io, posts cannot be edited 30 minutes after creation) | ||
api.update('posts', { | ||
id: '12345678', | ||
content: 'Goodbye World' | ||
}) | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
### fetch | ||
### post | ||
Fetch resources | ||
Aliases: `get`, `find`, `findAll` | ||
Create a new resource | ||
Aliases: `create` | ||
**Parameters** | ||
- `model` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to fetch data from | ||
- `params` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries (optional, default `{}`) | ||
- `params.page` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** jsonapi.org/format/#fetching-pagination | ||
- `params.page.limit` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of resources to return in request (Max `20` for Kitsu.io except on `libraryEntries` which has a max of `500`) | ||
- `params.page.offset` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Number of resources to offset the dataset by | ||
- `params.fields` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Return a sparse fieldset with only the included attributes/relationships jsonapi.org/format/#fetching-sparse-fieldsets | ||
- `params.filter` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Filter dataset by attribute values jsonapi.org/format/#fetching-filtering | ||
- `params.sort` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Sort dataset by one or more comma separated attributes (prepend `-` for descending order) jsonapi.org/format/#fetching-sorting | ||
- `params.include` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Include relationship data jsonapi.org/format/#fetching-includes | ||
- `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to create a resource under | ||
- `body` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data to send in the request | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
@@ -146,9 +195,12 @@ **Examples** | ||
```javascript | ||
// Get a specific user's name & birthday | ||
api.get('users', { | ||
fields: { | ||
users: 'name,birthday' | ||
// Post to a user's own profile | ||
api.create('posts', { | ||
content: 'Hello World', | ||
targetUser: { | ||
id: '42603', | ||
type: 'users' | ||
}, | ||
filter: { | ||
name: 'wopian' | ||
user: { | ||
id: '42603', | ||
type: 'users' | ||
} | ||
@@ -158,41 +210,13 @@ }) | ||
```javascript | ||
// Get a collection of anime resources and their categories | ||
api.get('anime', { | ||
include: 'categories' | ||
}) | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
```javascript | ||
// Get a single resource and its relationships by ID (method one) | ||
api.get('anime', { | ||
include: 'categories', | ||
filter: { id: '2' } | ||
}) | ||
``` | ||
```javascript | ||
// Get a single resource and its relationships by ID (method two) | ||
api.get('anime/2', { | ||
include: 'categories' | ||
}) | ||
``` | ||
```javascript | ||
// Get a resource's relationship data only | ||
api.get('anime/2/categories') | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
### remove | ||
Remove a resource | ||
Aliases: `destroy` | ||
**Parameters** | ||
- `model` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to remove data from | ||
- `id` **([String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number))** Resource ID to remove | ||
- `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
- `model` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to remove data from | ||
- `id` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \| [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))** Resource ID to remove | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
@@ -206,16 +230,15 @@ **Examples** | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
### self | ||
Fetch user data of the authenticated user | ||
Note: Requires the JSON-API server to support `filter[self]=true` | ||
Aliases: `whoAmI` | ||
Get the authenticated user's data | ||
Note: Requires the JSON:API server to support `filter[self]=true` | ||
**Parameters** | ||
- `params` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries (optional, default `{}`) | ||
- `params.fields` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Return a sparse fieldset with only the included attributes/relationships jsonapi.org/format/#fetching-sparse-fieldsets | ||
- `params.include` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Include relationship data jsonapi.org/format/#fetching-includes | ||
- `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
- `params` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries (optional, default `{}`) | ||
- `params.fields` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Return a sparse fieldset with only the included attributes/relationships jsonapi.org/format/#fetching-sparse-fieldsets | ||
- `params.include` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Include relationship data jsonapi.org/format/#fetching-includes | ||
- `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
@@ -236,25 +259,2 @@ **Examples** | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
### update | ||
Update a resource | ||
Aliases: `patch` | ||
**Parameters** | ||
- `model` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Model to update data in | ||
- `body` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Data to send in the request | ||
- `headers` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Additional headers to send with request (optional, default `{}`) | ||
**Examples** | ||
```javascript | ||
// Update a user's post (Note: For Kitsu.io, posts cannot be edited 30 minutes after creation) | ||
api.update('posts', { | ||
id: '12345678', | ||
content: 'Goodbye World' | ||
}) | ||
``` | ||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response | ||
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-parsed response |
@@ -1,1 +0,2 @@ | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/helpers/classCallCheck'),require('babel-runtime/helpers/createClass'),require('axios'),require('babel-runtime/regenerator'),require('babel-runtime/helpers/asyncToGenerator'),require('decamelize'),require('babel-runtime/helpers/typeof'),require('camelcase')):'function'==typeof define&&define.amd?define(['babel-runtime/helpers/classCallCheck','babel-runtime/helpers/createClass','axios','babel-runtime/regenerator','babel-runtime/helpers/asyncToGenerator','decamelize','babel-runtime/helpers/typeof','camelcase'],b):a.kitsu=b(a._classCallCheck,a._createClass,a.axios,a._regeneratorRuntime,a._asyncToGenerator,a.kebab,a._typeof,a.camel)})(this,function(a,b,c,d,e,f,g,h){'use strict';function i(a){try{var b='',c=function(c){'object'===g(a[c])?Object.keys(a[c]).forEach(function(d){b+='&'+c+'['+d+']='+a[c][d]}):'string'==typeof a[c]&&(b+='&'+c+'='+a[c])};for(var d in a)c(d);return a?b.slice(1):''}catch(a){throw a}}function j(a){if(a.response){var b=a.response.data;return b.errors?b.errors:b}throw a}a=a&&a.hasOwnProperty('default')?a['default']:a,b=b&&b.hasOwnProperty('default')?b['default']:b,c=c&&c.hasOwnProperty('default')?c['default']:c,d=d&&d.hasOwnProperty('default')?d['default']:d,e=e&&e.hasOwnProperty('default')?e['default']:e,f=f&&f.hasOwnProperty('default')?f['default']:f,g=g&&g.hasOwnProperty('default')?g['default']:g,h=h&&h.hasOwnProperty('default')?h['default']:h;var k=function(){var a=e(d.mark(function a(b){var c,f=this;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,b.constructor!==Array){a.next=6;break}return a.next=4,b.forEach(function(){var a=e(d.mark(function a(c,e){return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,k(c);case 2:b[e]=a.sent;case 3:case'end':return a.stop();}},a,f)}));return function(){return a.apply(this,arguments)}}());case 4:a.next=16;break;case 6:if(!(b.attributes&&b.attributes.constructor===Object)){a.next=16;break}return a.next=9,b.attributes;case 9:a.t0=d.keys(a.sent);case 10:if((a.t1=a.t0()).done){a.next=15;break}c=a.t1.value,b[c]=b.attributes[c],a.next=10;break;case 15:delete b.attributes;case 16:return a.abrupt('return',b);case 19:throw a.prev=19,a.t2=a['catch'](0),a.t2;case 22:case'end':return a.stop();}},a,this,[[0,19]])}));return function(){return a.apply(this,arguments)}}(),l=function(){var a=e(d.mark(function a(b,c){var e=c.id,f=c.type;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.abrupt('return',b.filter(function(a){return a.id===e&&a.type===f})[0]);case 4:throw a.prev=4,a.t0=a['catch'](0),a.t0;case 7:case'end':return a.stop();}},a,this,[[0,4]])}));return function(){return a.apply(this,arguments)}}(),m=function(){var a=e(d.mark(function a(b,c){var e,f,g,h,i,j,m,n,o,p,q,r,s;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,e=b.relationships,a.next=4,e;case 4:a.t0=d.keys(a.sent);case 5:if((a.t1=a.t0()).done){a.next=61;break}if(f=a.t1.value,!(e[f].data&&e[f].data.constructor===Array)){a.next=48;break}return g=!0,h=!1,i=void 0,a.prev=11,a.next=14,e[f].data;case 14:a.t2=Symbol.iterator,j=a.sent[a.t2]();case 16:if(g=(m=j.next()).done){a.next=32;break}return n=m.value,o=n.id,p=n.type,b[f]||(b[f]=[]),a.t3=b[f],a.t4=k,a.next=24,l(c,{id:o,type:p});case 24:return a.t5=a.sent,a.next=27,a.t4(a.t5);case 27:a.t6=a.sent,a.t3.push.call(a.t3,a.t6);case 29:g=!0,a.next=16;break;case 32:a.next=38;break;case 34:a.prev=34,a.t7=a['catch'](11),h=!0,i=a.t7;case 38:a.prev=38,a.prev=39,!g&&j.return&&j.return();case 41:if(a.prev=41,!h){a.next=44;break}throw i;case 44:return a.finish(41);case 45:return a.finish(38);case 46:a.next=59;break;case 48:if(!e[f].data){a.next=59;break}if(q=e[f].data,r=q.id,s=q.type,b[f]){a.next=58;break}return a.t8=k,a.next=54,l(c,{id:r,type:s});case 54:return a.t9=a.sent,a.next=57,a.t8(a.t9);case 57:b[f]=a.sent;case 58:delete b[f].relationships;case 59:a.next=5;break;case 61:return delete b.relationships,a.abrupt('return',b);case 65:throw a.prev=65,a.t10=a['catch'](0),a.t10;case 68:case'end':return a.stop();}},a,this,[[0,65],[11,34,38,46],[39,,41,45]])}));return function(){return a.apply(this,arguments)}}(),n=function(){var a=e(d.mark(function a(b){var c,e,f,g,h,i;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,!(b.data&&b.data.constructor===Array)){a.next=40;break}return c=!0,e=!1,f=void 0,a.prev=5,a.next=8,b.data;case 8:a.t0=Symbol.iterator,g=a.sent[a.t0]();case 10:if(c=(h=g.next()).done){a.next=24;break}if(i=h.value,!b.included){a.next=16;break}return a.next=15,m(i,b.included);case 15:i=a.sent;case 16:if(!i.attributes){a.next=20;break}return a.next=19,k(i);case 19:i=a.sent;case 20:b.data[b.data.indexOf(i)]=i;case 21:c=!0,a.next=10;break;case 24:a.next=30;break;case 26:a.prev=26,a.t1=a['catch'](5),e=!0,f=a.t1;case 30:a.prev=30,a.prev=31,!c&&g.return&&g.return();case 33:if(a.prev=33,!e){a.next=36;break}throw f;case 36:return a.finish(33);case 37:return a.finish(30);case 38:a.next=44;break;case 40:if(!b.included){a.next=44;break}return a.next=43,m(b.data,b.included);case 43:b.data=a.sent;case 44:if(delete b.included,!b.data.attributes){a.next=49;break}return a.next=48,k(b.data);case 48:b.data=a.sent;case 49:return a.abrupt('return',b);case 52:throw a.prev=52,a.t2=a['catch'](0),a.t2;case 55:case'end':return a.stop();}},a,this,[[0,52],[5,26,30,38],[31,,33,37]])}));return function(){return a.apply(this,arguments)}}(),o=function(){var a=e(d.mark(function a(b){var c,e,f,g=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:'POST';return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,g.constructor===Object&&0!==Object.keys(g).length){a.next=3;break}throw new Error(i+' requires a JSON object body');case 3:if(c=h(b),e={type:c},'POST'===i||'undefined'!=typeof g.id){a.next=7;break}throw new Error(i+' requires an ID for the '+c+' type');case 7:for(f in'POST'!==i&&(e.id=g.id),g)null!==g[f]&&g[f].constructor===Object&&('string'==typeof g[f].id||'string'==typeof g[f].type)?('undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof g[f].type&&(g[f].type=h(f)),e.relationships[f]={data:Object.assign(g[f])}):'id'!==f&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[f]=g[f]);return a.abrupt('return',{data:e});case 12:throw a.prev=12,a.t0=a['catch'](0),a.t0;case 15:case'end':return a.stop();}},a,this,[[0,12]])}));return function(){return a.apply(this,arguments)}}(),p=function(){var a=e(d.mark(function a(b,c){var e,g,h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,h=Object.assign(this.headers,h),h.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=f(b),a.next=8,o(b,c);case 8:return a.t2=a.sent.data,a.t3=h,a.t4={data:a.t2,headers:a.t3},a.next=13,a.t0.post.call(a.t0,a.t1,a.t4);case 13:return e=a.sent,g=e.data,a.abrupt('return',g);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',j(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),q=function(){var a=e(d.mark(function a(b){var c,e,g=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.axios.get(f(b),{params:g,paramsSerializer:function(b){return i(b)},headers:Object.assign(this.headers,h)});case 3:return c=a.sent,e=c.data,a.abrupt('return',n(e));case 8:return a.prev=8,a.t0=a['catch'](0),a.abrupt('return',j(a.t0));case 11:case'end':return a.stop();}},a,this,[[0,8]])}));return function(){return a.apply(this,arguments)}}(),r=function(){var a=e(d.mark(function a(b,c){var e,g,h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,h=Object.assign(this.headers,h),h.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=f(b)+'/'+c,a.next=8,o(b,{id:c},'DELETE');case 8:return a.t2=a.sent,a.t3=h,a.t4={data:a.t2,headers:a.t3},a.next=13,a.t0.delete.call(a.t0,a.t1,a.t4);case 13:return e=a.sent,g=e.data,a.abrupt('return',g);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',j(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),s=function(){var a=e(d.mark(function a(){var b,c,e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},f=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,q.bind(this)('users',Object.assign({filter:{self:!0}},e),f);case 3:return b=a.sent,c=b.data,a.abrupt('return',c[0]);case 8:return a.prev=8,a.t0=a['catch'](0),a.abrupt('return',a.t0);case 11:case'end':return a.stop();}},a,this,[[0,8]])}));return function(){return a.apply(this,arguments)}}(),t=function(){var a=e(d.mark(function a(b,c){var e,g,h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,h=Object.assign(this.headers,h),h.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:if('undefined'!=typeof c.id){a.next=6;break}throw new Error('Updating a resource requires an ID');case 6:return a.t0=this.axios,a.t1=f(b)+'/'+c.id,a.next=10,o(b,c,'PATCH');case 10:return a.t2=a.sent.data,a.t3=h,a.t4={data:a.t2,headers:a.t3},a.next=15,a.t0.patch.call(a.t0,a.t1,a.t4);case 15:return e=a.sent,g=e.data,a.abrupt('return',g);case 20:return a.prev=20,a.t5=a['catch'](0),a.abrupt('return',j(a.t5));case 23:case'end':return a.stop();}},a,this,[[0,20]])}));return function(){return a.apply(this,arguments)}}(),u='https://kitsu.io/api',v=function(){function d(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};a(this,d),this.fetch=q.bind(this),this.update=t.bind(this),this.create=p.bind(this),this.remove=r.bind(this),this.self=s.bind(this),this.get=this.fetch,this.find=this.fetch,this.findAll=this.fetch,this.patch=this.update,this.post=this.create,this.destroy=this.remove,this.whoAmI=this.self,this.baseURL=b.baseURL||u,this.headers=Object.assign(b.headers?b.headers:{},{accept:'application/vnd.api+json',"content-type":'application/vnd.api+json'}),this.axios=c.create({baseURL:this.baseURL+'/'+(b.version||this.baseURL===u?'edge':''),timeout:b.timeout||3e4})}return b(d,[{key:'headers',value:function(){return this.headers}},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),d}();return v}); | ||
(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b(require('babel-runtime/helpers/slicedToArray'),require('babel-runtime/helpers/asyncToGenerator'),require('axios')):'function'==typeof define&&define.amd?define(['babel-runtime/helpers/slicedToArray','babel-runtime/helpers/asyncToGenerator','axios'],b):a.kitsu=b(a._slicedToArray,a._asyncToGenerator,a.axios)})(this,function(l,e,m){'use strict';function b(c){if(c.response){const a=c.response.data;if(a)return a}throw c}function c(e){try{let a='';for(let b in e)'object'==typeof e[b]?Object.keys(e[b]).forEach((c)=>{a+=`&${b}[${c}]=${e[b][c]}`}):'string'==typeof e[b]&&(a+=`&${b}=${e[b]}`);return e?a.slice(1):''}catch(c){b(c)}}l=l&&l.hasOwnProperty('default')?l['default']:l,e=e&&e.hasOwnProperty('default')?e['default']:e,m=m&&m.hasOwnProperty('default')?m['default']:m;let k=(()=>{var c=e(function*(d){try{if('undefined'!=typeof d)if(Array.isArray(d))yield d.forEach((()=>{var a=e(function*(a,b){d[b]=yield k(a)});return function(){return a.apply(this,arguments)}})());else if(d.attributes&&d.attributes.constructor===Object){for(let a in yield d.attributes)d[a]=d.attributes[a];delete d.attributes}return d}catch(c){b(c)}});return function(){return c.apply(this,arguments)}})(),d=(()=>{var c=e(function*(g){try{var h,a=!0,d=!1;try{for(var c,e=(yield g.data)[Symbol.iterator]();!(a=(c=e.next()).done);a=!0){let a=c.value;g.included&&(a=yield f(a,g.included)),a.attributes&&(a=yield k(a)),g.data[g.data.indexOf(a)]=a}}catch(b){d=!0,h=b}finally{try{!a&&e.return&&e.return()}finally{if(d)throw h}}return g}catch(c){b(c)}});return function(){return c.apply(this,arguments)}})(),n=(()=>{var c=e(function*(c){try{return c.data&&c.data.constructor===Array?c=yield d(c):c.included&&(c.data=yield f(c.data,c.included)),delete c.included,c.data.attributes&&(c.data=yield k(c.data)),c}catch(c){b(c)}});return function(){return c.apply(this,arguments)}})(),o=(()=>{var c=e(function*(d,{id:e,type:f}){try{return d.filter(function(b){return b.id===e&&b.type===f})[0]||{id:e,type:f}}catch(c){b(c)}});return function(){return c.apply(this,arguments)}})(),f=(()=>{var c=e(function*(l,a){try{const b=l.relationships;for(let h in yield b)if(b[h].data&&Array.isArray(b[h].data)){var m=!0,i=!1,d=void 0;try{for(var n,e=(yield b[h].data)[Symbol.iterator]();!(m=(n=e.next()).done);m=!0){let b=n.value,c=b.id,f=b.type;const i=yield k((yield o(a,{id:c,type:f})));'undefined'!=typeof i&&(!l[h]&&(l[h]=[]),l[h].push(i))}}catch(b){i=!0,d=b}finally{try{!m&&e.return&&e.return()}finally{if(i)throw d}}}else if(b[h].data){var f=b[h].data;const g=f.id,i=f.type,j=yield k((yield o(a,{id:g,type:i})));'undefined'==typeof j||l[h]||(l[h]=j),delete l[h].relationships}return delete l.relationships,l}catch(c){b(c)}});return function(){return c.apply(this,arguments)}})(),h=(()=>{var b=e(function*(g,h={},b='POST'){try{if(h.constructor!==Object||0===Object.keys(h).length)throw new Error(`${b} requires a JSON object body`);const a=this.plural(this.camel(g)),d={type:a};if('POST'!==b&&'undefined'==typeof h.id)throw new Error(`${b} requires an ID for the ${a} type`);for(let f in'POST'!==b&&(d.id=h.id),h)if(null!==h[f]&&h[f].constructor===Object&&('string'==typeof h[f].id||'string'==typeof h[f].type))'undefined'==typeof d.relationships&&(d.relationships={}),'undefined'==typeof h[f].type&&(h[f].type=this.plural(this.camel(f))),d.relationships[f]={data:Object.assign(h[f])};else if(null!==h[f]&&h[f].constructor===Array){const a=this.plural(this.camel(f));for(var c=0;c<h[f].length;c++)if('string'==typeof h[f][c].id||'string'==typeof h[f][c].type)'undefined'==typeof h[f][c].type&&(h[f][c].type=a);else throw new Error(`${b} requires an ID for the ${f} relationships`);'undefined'==typeof d.relationships&&(d.relationships={}),d.relationships[f]={data:Object.assign(h[f])}}else'id'!=f&&('undefined'==typeof d.attributes&&(d.attributes={}),d.attributes[f]=h[f]);return{data:d}}catch(b){throw b}});return function(){return b.apply(this,arguments)}})();var g=(b)=>b.replace(/[-_][a-z\u00E0-\u00F6\u00F8-\u00FE]/g,(b)=>b.slice(1).toUpperCase()),i=(b)=>b.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(b)=>'-'+b.toLowerCase()),j=(b)=>b.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(b)=>'_'+b.toLowerCase());const a='application/vnd.api+json',p={Accept:a,"Content-Type":a};class q{constructor(b={}){this.fetch=this.get,this.update=this.patch,this.create=this.post,this.camel=!1===b.camelCaseTypes?(b)=>b:g,this.resCase='none'===b.resourceCase?(b)=>b:'snake'===b.resourceCase?j:i,this.plural=!1===b.pluralize?(b)=>b:require('pluralize'),this.headers=Object.assign({},b.headers,p),m.defaults.baseURL=b.baseURL||'https://kitsu.io/api/edge',m.defaults.timeout=b.timeout||3e4}get isAuth(){return!!this.headers.Authorization}get(o,a={},q={}){var r=this;return e(function*(){try{var d=o.split('/'),e=l(d,2);let g=e[0],h=e[1];const i=r.plural(r.resCase(g))+(h?'/'+h:'');var f=yield m.get(i,{params:a,paramsSerializer:function(b){return c(b)},headers:Object.assign(r.headers,q,p)});const j=f.data;return n(j)}catch(c){return b(c)}})()}patch(i,a,j={}){var k=this;return e(function*(){try{if(j=Object.assign(k.headers,j,p),!k.isAuth)throw new Error('Not logged in');if('undefined'==typeof a.id)throw new Error('Updating a resource requires an ID');const b=k.plural(k.resCase(i))+'/'+a.id;var d=yield m.patch(b,{data:(yield h.apply(k,[i,a,'PATCH'])).data,headers:j});const e=d.data;return e}catch(c){return b(c)}})()}post(i,a,j={}){var k=this;return e(function*(){try{if(j=Object.assign(k.headers,j,p),!k.isAuth)throw new Error('Not logged in');const b=k.plural(k.resCase(i));var d=yield m.post(b,{data:(yield h.apply(k,[i,a])).data,headers:j});const e=d.data;return e}catch(c){return b(c)}})()}remove(i,a,j={}){var k=this;return e(function*(){try{if(j=Object.assign(k.headers,j,p),!k.isAuth)throw new Error('Not logged in');const e=k.plural(k.resCase(i))+'/'+a;var d=yield m.delete(e,{data:(yield h.apply(k,[i,{id:a},'DELETE'])).data,headers:j});const f=d.data;return f}catch(c){return b(c)}})()}self(f={},a={}){var g=this;return e(function*(){try{var c=yield g.get('users',Object.assign({filter:{self:!0}},f),a);const b=c.data;return b[0]}catch(c){return b(c)}})()}}return q}); | ||
//# sourceMappingURL=kitsu.js.map |
@@ -0,0 +0,0 @@ MIT License |
132
package.json
{ | ||
"name": "kitsu", | ||
"version": "3.2.0-rc.2", | ||
"version": "4.0.0", | ||
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs", | ||
@@ -14,11 +14,14 @@ "license": "MIT", | ||
":build": "jest && yarn build", | ||
":commit": "git add package.json && git add DOCS.md && git add CHANGELOG.md && git commit -m \"update changelog\"", | ||
":publish": "git push origin && git push origin --tags && yarn publish", | ||
":commit": "git add package.json && git add DOCS.md && git add CHANGELOG.md && git commit -m \"update changelog\"", | ||
":major": "yarn :build && changelog -M && yarn :commit && yarn:publish", | ||
":minor": "yarn :build && changelog -m && yarn :commit && yarn:publish", | ||
":patch": "yarn :build && changelog -p && yarn :commit && yarn:publish", | ||
"test": "jest --coverage", | ||
":major": "yarn :build && changelog -M && yarn :commit && npm version major && yarn :publish", | ||
":minor": "yarn :build && changelog -m && yarn :commit && npm version minor && yarn :publish", | ||
":patch": "yarn :build && changelog -p && yarn :commit && npm version patch && yarn :publish", | ||
"test": "jest --coverage && yarn lint && yarn spellcheck", | ||
"docs": "documentation build src/index.js -f md -o DOCS.md --sort-order alpha", | ||
"lint": "eslint src", | ||
"lintdocs": "documentation lint src/index.js", | ||
"build": "yarn docs && yarn rollup", | ||
"spellcheck": "yaspeller-ci README.md MIGRATING.md DOCS.md CONTRIBUTING.md", | ||
"size": "size-limit", | ||
"build": "yarn docs && yarn lintdocs && yarn rollup && yarn size", | ||
"rollup": "cross-env NODE_ENV=production rollup -c --environment BUILD:production", | ||
@@ -28,4 +31,3 @@ "start": "yarn example:basic", | ||
"example:async": "babel-node ./example/async", | ||
"example:auth": "babel-node ./example/auth", | ||
"example:test": "babel-node ./example/test" | ||
"example:auth": "babel-node ./example/auth" | ||
}, | ||
@@ -62,9 +64,9 @@ "keywords": [ | ||
"babel-runtime": "^6.26.0", | ||
"camelcase": "^4.1.0", | ||
"decamelize": "^1.2.0" | ||
"pluralize": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"axios-mock-adapter": "~1.10.0", | ||
"babel-cli": "~6.26.0", | ||
"babel-core": "~6.26.0", | ||
"babel-eslint": "~8.0.1", | ||
"babel-eslint": "~8.1.0", | ||
"babel-plugin-transform-runtime": "~6.23.0", | ||
@@ -75,18 +77,37 @@ "babel-preset-env": "~1.6.0", | ||
"documentation": "~5.3.3", | ||
"eslint": "~4.10.0", | ||
"eslint-plugin-jest": "~21.2.0", | ||
"generate-changelog": "~1.5.0", | ||
"jest": "~21.2.1", | ||
"eslint": "~4.14.0", | ||
"eslint-config-standard": "~11.0.0-beta.0", | ||
"eslint-plugin-import": "~2.8.0", | ||
"eslint-plugin-jest": "~21.5.0", | ||
"eslint-plugin-node": "~5.2.1", | ||
"eslint-plugin-promise": "~3.6.0", | ||
"eslint-plugin-standard": "~3.0.1", | ||
"generate-changelog": "~1.7.0", | ||
"jest": "~22.0.0", | ||
"js-beautify": "~1.7.4", | ||
"rollup": "~0.50.0", | ||
"rollup": "~0.53.0", | ||
"rollup-plugin-babel": "~3.0.1", | ||
"rollup-plugin-babel-minify": "~3.1.2", | ||
"rollup-plugin-cleanup": "~2.0.0", | ||
"rollup-plugin-json": "~2.3.0", | ||
"rollup-plugin-local-resolve": "~1.0.7", | ||
"standard": "~10.0.2" | ||
"size-limit": "^0.13.2", | ||
"standard": "~10.0.2", | ||
"yaspeller-ci": "~1.0.0" | ||
}, | ||
"size-limit": [ | ||
{ | ||
"path": "./lib/kitsu.js", | ||
"limit": "15 kb" | ||
}, | ||
{ | ||
"path": "./lib/kitsu.mjs", | ||
"limit": "15 kb" | ||
}, | ||
{ | ||
"path": "./lib/legacy/index.js" | ||
} | ||
], | ||
"jest": { | ||
"collectCoverageFrom": [ | ||
"src/**/*.js" | ||
"src/**/*.js", | ||
"!**/__cases__/**" | ||
], | ||
@@ -101,51 +122,26 @@ "coverageDirectory": "<rootDir>/coverage", | ||
"extends": [ | ||
"config:base" | ||
":npm", | ||
":preserveSemverRanges", | ||
":combinePatchMinorReleases", | ||
":renovatePrefix", | ||
":semanticCommits", | ||
":semanticCommitTypeAll(chore)", | ||
":rebaseStalePrs", | ||
":unpublishSafe", | ||
":prNotPending", | ||
":automergeDisabled", | ||
":maintainLockFilesMonthly", | ||
":ignoreUnstable", | ||
":updateNotScheduled", | ||
":label(dependencies)", | ||
":timezone(Europe/London)", | ||
":assignee(wopian)", | ||
"group:babelMonorepo", | ||
"group:jestMonorepo", | ||
"group:reactMonorepo", | ||
"group:storybookMonorepo" | ||
], | ||
"assignees": [ | ||
"wopian" | ||
], | ||
"pinVersions": false, | ||
"automerge": false, | ||
"commitMessage": "{{semanticPrefix}}update {{depName}} to {{newVersion}}", | ||
"labels": [ | ||
"dependencies" | ||
], | ||
"lockFileMaintenance": { | ||
"enabled": false | ||
}, | ||
"semanticCommits": true, | ||
"separateMajorReleases": false, | ||
"unpublishSafe": true, | ||
"schedule": [ | ||
"before 5am on monday" | ||
], | ||
"prCreation": "not-pending", | ||
"prTitle": "{{semanticPrefix}}{{#if isPin}}pin{{else}}update{{/if}} {{depName}} to {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}{{newVersionMajor}}.x{{else}}{{newVersion}}{{/if}}{{/if}}", | ||
"packageRules": [ | ||
{ | ||
"packagePatterns": [ | ||
"^eslint" | ||
], | ||
"groupName": "eslint" | ||
}, | ||
{ | ||
"packagePatterns": [ | ||
"^webpack" | ||
], | ||
"groupName": "webpack" | ||
}, | ||
{ | ||
"packagePatterns": [ | ||
"^babel" | ||
], | ||
"groupName": "babel" | ||
}, | ||
{ | ||
"packagePatterns": [ | ||
"^rollup" | ||
], | ||
"groupName": "rollup" | ||
} | ||
] | ||
"prTitle": "update {{depName}} to {{newVersion}}", | ||
"commitMessage": "update {{depName}} to {{newVersion}}" | ||
} | ||
} |
197
README.md
# Kitsu | ||
[![npm]][1] | ||
[![npm installs]][1] | ||
[![David]][7] | ||
[![npm badge]][npm] | ||
[![npm install badge]][npm] | ||
[![david badge]][david] | ||
[![contributors badge]][contributors] | ||
[![donate badge]][donate] | ||
[![Travis]][2] | ||
[![AppVeyor]][3] | ||
[![CC Coverage]][4] | ||
[![CC Score]][5] | ||
[![CC Issues]][6] | ||
[![travis badge]][travis] | ||
[![appveyor badge]][appveyor] | ||
[![david dev badge]][david dev] | ||
[![cc maintainability badge]][cc maintainability] | ||
[![cc coverage badge]][cc coverage] | ||
Simple, lightweight & framework agnostic [JSON-API][15] client for [Kitsu.io][KITSU] and other API backends | ||
A Simple and lightweight framework agnostic [JSON:API] client for [Kitsu.io] and other APIs | ||
*For breaking changes in 3.0, check the [CHANGELOG][16]* | ||
*Check out the [Migration Guide] for breaking changes and new features in `4.x`* | ||
## Features | ||
- Fully JSON-API compliant | ||
- JSON-API 1.0 compliant | ||
- Automatically links relationships to data | ||
- Works in Node and on the web | ||
- Uses the [Promise][10] API | ||
- Uses the [Promise] API | ||
- Configurable timeout handling | ||
@@ -26,42 +29,90 @@ | ||
### Yarn | ||
```bash | ||
yarn add kitsu | ||
npm install kitsu | ||
``` | ||
### NPM 5 | ||
## Browser Support | ||
```bash | ||
npm install kitsu | ||
| Package | Global<br>Usage | Chrome | Firefox | Safari | IE/Edge | ||
| ------- | --------------- | ------ | ------- | ------ | ------- | ||
| Default | [> 1%] | 61+ | 56+ | 10+ | Edge 15+ | ||
| Legacy | [> 0.1%] | 49+ | 48+ | 5.1+ | IE 8+, Edge 14+ | ||
[> 1%]:http://browserl.ist/?q=%3E1%25%2C+not+ie+%3C%3D+11%2C+not+ie_mob+%3C%3D+11 | ||
[> 0.1%]:http://browserl.ist/?q=%3E0.1%25 | ||
## Response Comparison | ||
A GET response by a JSON:API server returns: | ||
```json5 | ||
{ | ||
data: { | ||
id: '1' | ||
type: 'articles' | ||
attributes: { | ||
title: 'JSON API paints my bikeshed' | ||
} | ||
relationships: { | ||
author: { | ||
data: { | ||
id: '42' | ||
type: 'people' | ||
} | ||
} | ||
} | ||
} | ||
included: [ | ||
{ | ||
id: '42' | ||
type: 'people' | ||
attributes: { | ||
name: 'John' | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
A GET request with `kitsu` returns: | ||
```json5 | ||
{ | ||
data: { | ||
id: '1' | ||
type: 'articles' | ||
title: 'JSON API paints my bikeshed' | ||
author: { | ||
id: '42', | ||
type: 'people' | ||
name: 'John' | ||
} | ||
} | ||
} | ||
``` | ||
## Usage | ||
```javascript | ||
// ES2015+/Babel | ||
import Kitsu from 'kitsu' | ||
// CommonJS/Browserify | ||
const Kitsu = require('kitsu') | ||
import Kitsu from 'kitsu' // ES Modules and Babel | ||
const Kitsu = require('kitsu') // CommonJS and Browserify | ||
const Kitsu = require('kitsu/lib/legacy') // Legacy IE8+ support | ||
// For kitsu.io developers | ||
const api = new Kitsu() | ||
const api = new Kitsu() // For kitsu.io developers | ||
// For other JSON-API uses | ||
// e.g api.example.org/2 | ||
const api = new Kitsu({ | ||
baseURL: 'https://api.example.org', | ||
version: 2 | ||
const api = new Kitsu({ // For other JSON:API servers | ||
baseURL: 'https://api.example/2' // e.g https://api.example/2 | ||
}) | ||
// Get a collection of resources | ||
api.get('anime').then(res => console.log(res)) | ||
const { data } = api.get('anime') // Using with Promises | ||
.then(res => res) | ||
// Get a resource | ||
api.get('anime/1') | ||
const { data } = await api.get('anime') // Using with async/await | ||
// Get a resource's relationship | ||
api.get('anime/1/episodes') | ||
// Fetching resources with get() or fetch() | ||
api.get('anime') // Collection of resources | ||
api.get('anime/1') // Single resource | ||
api.get('anime/1/episodes') // Single resource's relationship | ||
// Create a resource | ||
// Creating resources with post() or create() | ||
api.create('post', { | ||
@@ -71,3 +122,3 @@ content: 'some content' | ||
// Update a resource | ||
// Updating resources with patch() or update() | ||
api.update('post', { | ||
@@ -78,20 +129,12 @@ id: '1', | ||
// Delete a resource | ||
// Deleting resources | ||
api.remove('post', 1) | ||
// Destructuring with Async/Await | ||
const { id } = await kitsu.get('users', { | ||
filter: { id: 2 } | ||
}) | ||
``` | ||
[More Examples][11] | ||
[Read the Documentation] | ||
## Docs | ||
[More Examples] | ||
You can find the kitsu package [documentation here][13] | ||
If you're working with [Kitsu.io]'s API, their [API docs][Kitsu.io API Docs] lists all available resources with their attributes and relationships | ||
If you're working with [Kitsu.io][KITSU]'s API, their [API documentation][12] lists all available | ||
models with their attributes and relationships | ||
## Contributing | ||
@@ -109,3 +152,10 @@ | ||
[KITSU]:https://kitsu.io | ||
[Kitsu.io]:https://kitsu.io | ||
[JSON:API]:http://jsonapi.org | ||
[Promise]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises | ||
[More Examples]:https://github.com/wopian/kitsu/tree/master/example | ||
[Read the Documentation]:https://github.com/wopian/kitsu/blob/v3.1.4/DOCS.md | ||
[Kitsu.io API Docs]:https://kitsu.docs.apiary.io | ||
[Migration Guide]:https://github.com/wopian/kitsu/blob/master/MIGRATING.md | ||
[CHANGELOG]:https://github.com/wopian/kitsu-inactivity-pruner/blob/master/CHANGELOG.md | ||
@@ -115,25 +165,26 @@ [CONTRIBUTING]:https://github.com/wopian/kitsu-inactivity-pruner/blob/master/CONTRIBUTING.md | ||
[npm]:https://img.shields.io/npm/v/kitsu.svg?style=flat-square | ||
[npm installs]:https://img.shields.io/npm/dt/kitsu.svg?style=flat-square | ||
[Travis]:https://img.shields.io/travis/wopian/kitsu/master.svg?style=flat-square&label=linux%20%26%20macOS | ||
[CC Coverage]:https://img.shields.io/codeclimate/coverage/github/wopian/kitsu.svg?style=flat-square | ||
[CC Score]:https://img.shields.io/codeclimate/github/wopian/kitsu.svg?style=flat-square | ||
[CC Issues]:https://img.shields.io/codeclimate/issues/github/wopian/kitsu.svg?style=flat-square | ||
[David]:https://img.shields.io/david/wopian/kitsu.svg?style=flat-square | ||
[AppVeyor]:https://img.shields.io/appveyor/ci/wopian/kitsu/master.svg?style=flat-square&label=windows | ||
[1]:https://www.npmjs.com/package/kitsu | ||
[2]:https://travis-ci.org/wopian/kitsu | ||
[3]:https://ci.appveyor.com/project/wopian/kitsu | ||
[4]:https://codeclimate.com/github/wopian/kitsu/coverage | ||
[5]:https://codeclimate.com/github/wopian/kitsu | ||
[6]:https://codeclimate.com/github/wopian/kitsu/issues | ||
[7]:https://david-dm.org/wopian/kitsu | ||
[8]:https://github.com/wopian/kitsu/blob/master/CHANGELOG.md | ||
[9]:https://github.com/wopian/kitsu/blob/master/LICENSE.md | ||
[10]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises | ||
[11]:https://github.com/wopian/kitsu/tree/master/example | ||
[12]:http://docs.kitsu.apiary.io | ||
[13]:https://github.com/wopian/kitsu/tree/master/DOCS.md | ||
[14]:http://jsonapi.org/implementations/#client-libraries-javascript | ||
[15]:http://jsonapi.org | ||
[16]:https://github.com/wopian/kitsu/blob/master/CHANGELOG.md#breaking-changes | ||
[npm]:https://www.npmjs.com/package/kitsu | ||
[npm badge]:https://img.shields.io/npm/v/kitsu.svg?style=flat-square | ||
[npm install badge]:https://img.shields.io/npm/dt/kitsu.svg?style=flat-square | ||
[travis]:https://travis-ci.org/wopian/kitsu | ||
[travis badge]:https://img.shields.io/travis/wopian/kitsu/master.svg?style=flat-square&label=linux%20%26%20macOS | ||
[appveyor]:https://ci.appveyor.com/project/wopian/kitsu | ||
[appveyor badge]:https://img.shields.io/appveyor/ci/wopian/kitsu/master.svg?style=flat-square&label=windows | ||
[cc coverage]:https://codeclimate.com/github/wopian/kitsu/code | ||
[cc coverage badge]:https://img.shields.io/codeclimate/c/wopian/kitsu.svg?style=flat-square | ||
[cc maintainability]:https://codeclimate.com/github/wopian/kitsu | ||
[cc maintainability badge]:https://img.shields.io/codeclimate/maintainability/wopian/kitsu.svg?style=flat-square | ||
[david]:https://david-dm.org/wopian/kitsu | ||
[david badge]:https://img.shields.io/david/wopian/kitsu.svg?style=flat-square | ||
[david dev]:https://david-dm.org/wopian/kitsu?type=dev | ||
[david dev badge]:https://img.shields.io/david/dev/wopian/kitsu.svg?style=flat-square | ||
[contributors]:https://github.com/wopian/kitsu/graphs/contributors | ||
[contributors badge]:https://img.shields.io/github/contributors/wopian/kitsu.svg?style=flat-square | ||
[donate]:https://www.patreon.com/wopian | ||
[donate badge]:https://img.shields.io/badge/patreon-donate-ff69b4.svg?style=flat-square |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
140881
3
11
99
186
1
26
+ Addedpluralize@^7.0.0
+ Addedpluralize@7.0.0(transitive)
- Removedcamelcase@^4.1.0
- Removeddecamelize@^1.2.0
- Removedcamelcase@4.1.0(transitive)
- Removeddecamelize@1.2.0(transitive)