Comparing version 10.0.0-alpha.5 to 10.0.0-alpha.6
@@ -6,2 +6,18 @@ # Change Log | ||
# [10.0.0-alpha.6](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v10.0.0-alpha.5...v10.0.0-alpha.6) (2020-08-22) | ||
### Bug Fixes | ||
* **external:** pin axios to 0.19 to avoid breaking bug in 0.20 ([aa56def](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/aa56def)) | ||
### Chores | ||
* **release:** update documentation ([e71b1dc](https://github.com/wopian/kitsu/tree/master/packages/kitsu/commit/e71b1dc)) | ||
# [10.0.0-alpha.5](https://github.com/wopian/kitsu/tree/master/packages/kitsu/compare/v10.0.0-alpha.4...v10.0.0-alpha.5) (2020-08-04) | ||
@@ -8,0 +24,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var s=require("kitsu-core"),a=e(require("axios")),r=e(require("merge-options")),t=e(require("pluralize"));module.exports=class{constructor(e={}){!1===e.camelCaseTypes?this.camel=e=>e:this.camel=s.camel,"none"===e.resourceCase?this.resCase=e=>e:"snake"===e.resourceCase?this.resCase=s.snake:this.resCase=s.kebab,!1===e.pluralize?this.plural=e=>e:this.plural=t,this.headers=r({Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json"},e.headers),this.axios=a.create(r({baseURL:e.baseURL||"https://kitsu.io/api/edge",timeout:e.timeout||3e4},e.axiosOptions)),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.interceptors=this.axios.interceptors}async get(e,a={}){try{const t=r(this.headers,a.headers),i=r({},a.params),[l,h,o]=e.split("/");let p=this.plural(this.resCase(l));h&&(p+="/".concat(h)),o&&(p+="/".concat(this.resCase(o)));const{data:c}=await this.axios.get(p,{headers:t,params:i,paramsSerializer:e=>s.query(e)});return s.deserialise(c)}catch(e){throw s.error(e)}}async patch(e,a,t={}){try{const i=r(this.headers,t.headers),l=r({},t.params),[h,o]=s.splitModel(e,{resourceCase:this.resCase,pluralModel:this.plural}),p=s.serialise(h,a,"PATCH",{camelCaseTypes:this.camel,pluralTypes:this.plural}),c=(null==a?void 0:a.id)?"".concat(o,"/").concat(a.id):o,{data:d}=await this.axios.patch(c,p,{headers:i,params:l,paramsSerializer:e=>s.query(e)});return s.deserialise(d)}catch(e){throw s.error(e)}}async post(e,a,t={}){try{const i=r(this.headers,t.headers),l=r({},t.params),[h,o]=s.splitModel(e,{resourceCase:this.resCase,pluralModel:this.plural}),{data:p}=await this.axios.post(o,s.serialise(h,a,"POST",{camelCaseTypes:this.camel,pluralTypes:this.plural}),{headers:i,params:l,paramsSerializer:e=>s.query(e)});return s.deserialise(p)}catch(e){throw s.error(e)}}async delete(e,a,t={}){try{const i=r(this.headers,t.headers),l=r({},t.params),[h,o]=s.splitModel(e,{resourceCase:this.resCase,pluralModel:this.plural});let p,c;Array.isArray(a)?(p=o,c=a.map(e=>({id:e}))):(p="".concat(o,"/").concat(a),c={id:a});const{data:d}=await this.axios.delete(p,{data:s.serialise(h,c,"DELETE",{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:i,params:l,paramsSerializer:e=>s.query(e)});return d}catch(e){throw s.error(e)}}async self(e={}){try{const s=r(this.headers,e.headers),a=r(e.params,{filter:{self:!0}});return(await this.get("users",r({headers:s},{params:a}))).data[0]}catch(e){throw s.error(e)}}async request({body:e,method:a,params:t,type:i,url:l,headers:h}){try{var o;a=(null===(o=a)||void 0===o?void 0:o.toUpperCase())||"GET";const{data:p}=await this.axios.request({method:a,url:l,data:["GET","DELETE"].includes(a)?void 0:s.serialise(i,e,a,{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:r(this.headers,h),params:t,paramsSerializer:e=>s.query(e)});return s.deserialise(p)}catch(e){throw s.error(e)}}}; | ||
"use strict";var e=require("kitsu-core"),a=require("axios"),s=require("merge-options"),r=require("pluralize");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(a),l=t(s),h=t(r);module.exports=class{constructor(a={}){!1===a.camelCaseTypes?this.camel=e=>e:this.camel=e.camel,"none"===a.resourceCase?this.resCase=e=>e:"snake"===a.resourceCase?this.resCase=e.snake:this.resCase=e.kebab,!1===a.pluralize?this.plural=e=>e:this.plural=h.default,this.headers=l.default({Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json"},a.headers),this.axios=i.default.create(l.default({baseURL:a.baseURL||"https://kitsu.io/api/edge",timeout:a.timeout||3e4},a.axiosOptions)),this.fetch=this.get,this.update=this.patch,this.create=this.post,this.remove=this.delete,this.interceptors=this.axios.interceptors}async get(a,s={}){try{const r=l.default(this.headers,s.headers),t=l.default({},s.params),[i,h,o]=a.split("/");let d=this.plural(this.resCase(i));h&&(d+="/".concat(h)),o&&(d+="/".concat(this.resCase(o)));const{data:p}=await this.axios.get(d,{headers:r,params:t,paramsSerializer:a=>e.query(a)});return e.deserialise(p)}catch(a){throw e.error(a)}}async patch(a,s,r={}){try{const t=l.default(this.headers,r.headers),i=l.default({},r.params),[h,o]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),d=e.serialise(h,s,"PATCH",{camelCaseTypes:this.camel,pluralTypes:this.plural}),p=(null==s?void 0:s.id)?"".concat(o,"/").concat(s.id):o,{data:c}=await this.axios.patch(p,d,{headers:t,params:i,paramsSerializer:a=>e.query(a)});return e.deserialise(c)}catch(a){throw e.error(a)}}async post(a,s,r={}){try{const t=l.default(this.headers,r.headers),i=l.default({},r.params),[h,o]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),{data:d}=await this.axios.post(o,e.serialise(h,s,"POST",{camelCaseTypes:this.camel,pluralTypes:this.plural}),{headers:t,params:i,paramsSerializer:a=>e.query(a)});return e.deserialise(d)}catch(a){throw e.error(a)}}async delete(a,s,r={}){try{const t=l.default(this.headers,r.headers),i=l.default({},r.params),[h,o]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural});let d,p;Array.isArray(s)?(d=o,p=s.map(e=>({id:e}))):(d="".concat(o,"/").concat(s),p={id:s});const{data:c}=await this.axios.delete(d,{data:e.serialise(h,p,"DELETE",{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:t,params:i,paramsSerializer:a=>e.query(a)});return c}catch(a){throw e.error(a)}}async self(a={}){try{const e=l.default(this.headers,a.headers),s=l.default(a.params,{filter:{self:!0}});return(await this.get("users",l.default({headers:e},{params:s}))).data[0]}catch(a){throw e.error(a)}}async request({body:a,method:s,params:r,type:t,url:i,headers:h}){try{var o;s=(null===(o=s)||void 0===o?void 0:o.toUpperCase())||"GET";const{data:d}=await this.axios.request({method:s,url:i,data:["GET","DELETE"].includes(s)?void 0:e.serialise(t,a,s,{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:l.default(this.headers,h),params:r,paramsSerializer:a=>e.query(a)});return e.deserialise(d)}catch(a){throw e.error(a)}}}; |
{ | ||
"version": "10.0.0-alpha.5", | ||
"version": "10.0.0-alpha.6", | ||
"name": "kitsu", | ||
@@ -52,4 +52,4 @@ "description": "A simple, lightweight & framework agnostic JSON:API client using Axios", | ||
"dependencies": { | ||
"axios": "^0.19.0", | ||
"kitsu-core": "^10.0.0-alpha.5", | ||
"axios": "~0.19.2", | ||
"kitsu-core": "^10.0.0-alpha.6", | ||
"merge-options": "^2.0.0", | ||
@@ -70,3 +70,3 @@ "pluralize": "^8.0.0" | ||
], | ||
"gitHead": "cdac6310b820941638cd6cf77b4609d49293b0d1", | ||
"gitHead": "ab552d6a651f3ef925b7bde8cc9a11767c884a8e", | ||
"devDependencies": { | ||
@@ -73,0 +73,0 @@ "@size-limit/preset-small-lib": "~4.5.0" |
@@ -225,3 +225,3 @@ <h1 align=center>Kitsu</h1> | ||
[packages/kitsu/src/index.js:31-482](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L31-L482 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:31-482](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L31-L482 "Source code on GitHub") | ||
@@ -273,3 +273,3 @@ Creates a new `kitsu` instance | ||
[packages/kitsu/src/index.js:53-54](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L53-L54 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:53-54](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L53-L54 "Source code on GitHub") | ||
@@ -296,3 +296,3 @@ - **See: <https://www.npmjs.com/package/pluralize> for documentation | ||
[packages/kitsu/src/index.js:68-68](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L68-L68 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:68-68](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L68-L68 "Source code on GitHub") | ||
@@ -328,3 +328,3 @@ Get the current headers or add additional headers | ||
[packages/kitsu/src/index.js:113-113](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L113-L113 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:113-113](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L113-L113 "Source code on GitHub") | ||
@@ -380,3 +380,3 @@ - **See: <https://github.com/axios/axios#interceptors> for documentation | ||
[packages/kitsu/src/index.js:191-211](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L191-L211 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:191-211](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L191-L211 "Source code on GitHub") | ||
@@ -498,3 +498,3 @@ Fetch resources (alias `fetch`) | ||
[packages/kitsu/src/index.js:246-273](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L246-L273 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:246-273](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L246-L273 "Source code on GitHub") | ||
@@ -564,3 +564,3 @@ Update a resource (alias `update`) | ||
[packages/kitsu/src/index.js:303-328](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L303-L328 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:303-328](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L303-L328 "Source code on GitHub") | ||
@@ -610,3 +610,3 @@ Create a new resource (alias `create`) | ||
[packages/kitsu/src/index.js:345-378](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L345-L378 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:345-378](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L345-L378 "Source code on GitHub") | ||
@@ -643,3 +643,3 @@ Remove a resource (alias `remove`) | ||
[packages/kitsu/src/index.js:399-408](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L399-L408 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:399-408](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L399-L408 "Source code on GitHub") | ||
@@ -680,3 +680,3 @@ Get the authenticated user's data | ||
[packages/kitsu/src/index.js:462-481](https://github.com/wopian/kitsu/blob/e29946a6e887369340dfb6e3ff3a01e2397f040e/packages/kitsu/src/index.js#L462-L481 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:462-481](https://github.com/wopian/kitsu/blob/aa56def40bd02c3e0fd7bb26f7e67596cc5063ad/packages/kitsu/src/index.js#L462-L481 "Source code on GitHub") | ||
@@ -683,0 +683,0 @@ Send arbitrary requests |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69992
Updatedaxios@~0.19.2
Updatedkitsu-core@^10.0.0-alpha.6