Comparing version 10.0.0-alpha.12 to 10.0.0-alpha.13
@@ -6,2 +6,13 @@ # Change Log | ||
# [10.0.0-alpha.13](https://github.com/wopian/kitsu/compare/v10.0.0-alpha.12...v10.0.0-alpha.13) (2021-06-07) | ||
### Bug Fixes | ||
* **kitsu:** apply resCase setting to ID-less resource relationships ([a165983](https://github.com/wopian/kitsu/commit/a165983257fe8f0277e66792adc2f0f08e4fc4ba)) | ||
# [10.0.0-alpha.12](https://github.com/wopian/kitsu/compare/v10.0.0-alpha.11...v10.0.0-alpha.12) (2021-06-07) | ||
@@ -8,0 +19,0 @@ |
@@ -1,1 +0,1 @@ | ||
"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,p,d]=a.split("/");let u=this.plural(this.resCase(i));h&&(u+=`/${h}`),p&&(u+=`/${this.resCase(p)}`),d&&(u+=`/${this.resCase(d)}`);const{data:o}=await this.axios.get(u,{headers:r,params:t,paramsSerializer:a=>e.query(a)});return e.deserialise(o)}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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),d=e.serialise(h,s,"PATCH",{camelCaseTypes:this.camel,pluralTypes:this.plural}),u=null!=s&&s.id?`${p}/${s.id}`:p,{data:o}=await this.axios.patch(u,d,{headers:t,params:i,paramsSerializer:a=>e.query(a)});return e.deserialise(o)}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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),{data:d}=await this.axios.post(p,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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural});let d,u;Array.isArray(s)?(d=p,u=s.map((e=>({id:e})))):(d=`${p}/${s}`,u={id:s});const{data:o}=await this.axios.delete(d,{data:e.serialise(h,u,"DELETE",{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:t,params:i,paramsSerializer:a=>e.query(a)});return o}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 p;s=(null===(p=s)||void 0===p?void 0:p.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)}}}; | ||
"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,p,d]=a.split("/");let u=this.plural(this.resCase(i));h&&(u+=`/${this.resCase(h)}`),p&&(u+=`/${this.resCase(p)}`),d&&(u+=`/${this.resCase(d)}`);const{data:o}=await this.axios.get(u,{headers:r,params:t,paramsSerializer:a=>e.query(a)});return e.deserialise(o)}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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),d=e.serialise(h,s,"PATCH",{camelCaseTypes:this.camel,pluralTypes:this.plural}),u=null!=s&&s.id?`${p}/${s.id}`:p,{data:o}=await this.axios.patch(u,d,{headers:t,params:i,paramsSerializer:a=>e.query(a)});return e.deserialise(o)}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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural}),{data:d}=await this.axios.post(p,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,p]=e.splitModel(a,{resourceCase:this.resCase,pluralModel:this.plural});let d,u;Array.isArray(s)?(d=p,u=s.map((e=>({id:e})))):(d=`${p}/${s}`,u={id:s});const{data:o}=await this.axios.delete(d,{data:e.serialise(h,u,"DELETE",{camelCaseTypes:this.camel,pluralTypes:this.plural}),headers:t,params:i,paramsSerializer:a=>e.query(a)});return o}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 p;s=(null===(p=s)||void 0===p?void 0:p.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.12", | ||
"version": "10.0.0-alpha.13", | ||
"name": "kitsu", | ||
@@ -53,3 +53,3 @@ "description": "A simple, lightweight & framework agnostic JSON:API client using Axios", | ||
"axios": "^0.21.1", | ||
"kitsu-core": "^10.0.0-alpha.12", | ||
"kitsu-core": "^10.0.0-alpha.13", | ||
"merge-options": "^3.0.0", | ||
@@ -70,3 +70,3 @@ "pluralize": "^8.0.0" | ||
], | ||
"gitHead": "29269fa01d994bc6b31e2f2dd4c45864ff86caac", | ||
"gitHead": "57c200fdfa6f50a594c10fc8f1d1124cb99b704b", | ||
"devDependencies": { | ||
@@ -73,0 +73,0 @@ "@size-limit/preset-small-lib": "~4.11.0" |
@@ -245,3 +245,3 @@ <h1 align=center>Kitsu</h1> | ||
[packages/kitsu/src/index.js:31-506](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L31-L506 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:31-513](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L31-L513 "Source code on GitHub") | ||
@@ -291,3 +291,3 @@ Creates a new `kitsu` instance | ||
[packages/kitsu/src/index.js:53-54](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L53-L54 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:53-54](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L53-L54 "Source code on GitHub") | ||
@@ -311,3 +311,3 @@ * **See**: <https://www.npmjs.com/package/pluralize> for documentation | ||
[packages/kitsu/src/index.js:68-68](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L68-L68 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:68-68](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L68-L68 "Source code on GitHub") | ||
@@ -340,3 +340,3 @@ Get the current headers or add additional headers | ||
[packages/kitsu/src/index.js:113-113](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L113-L113 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:113-113](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L113-L113 "Source code on GitHub") | ||
@@ -388,3 +388,3 @@ * **See**: <https://github.com/axios/axios#interceptors> for documentation | ||
[packages/kitsu/src/index.js:210-231](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L210-L231 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:210-238](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L210-L238 "Source code on GitHub") | ||
@@ -525,3 +525,3 @@ Fetch resources (alias `fetch`) | ||
[packages/kitsu/src/index.js:266-293](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L266-L293 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:273-300](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L273-L300 "Source code on GitHub") | ||
@@ -587,3 +587,3 @@ Update a resource (alias `update`) | ||
[packages/kitsu/src/index.js:323-348](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L323-L348 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:330-355](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L330-L355 "Source code on GitHub") | ||
@@ -632,3 +632,3 @@ Create a new resource (alias `create`) | ||
[packages/kitsu/src/index.js:365-398](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L365-L398 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:372-405](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L372-L405 "Source code on GitHub") | ||
@@ -664,3 +664,3 @@ Remove a resource (alias `remove`) | ||
[packages/kitsu/src/index.js:421-430](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L421-L430 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:428-437](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L428-L437 "Source code on GitHub") | ||
@@ -702,3 +702,3 @@ Get the authenticated user's data | ||
[packages/kitsu/src/index.js:484-505](https://github.com/wopian/kitsu/blob/510529454e3b28b8d0877f2c7f6076bedad06323/packages/kitsu/src/index.js#L484-L505 "Source code on GitHub") | ||
[packages/kitsu/src/index.js:491-512](https://github.com/wopian/kitsu/blob/521a395decb33e0e92ba75be73665a410f4127b9/packages/kitsu/src/index.js#L491-L512 "Source code on GitHub") | ||
@@ -705,0 +705,0 @@ Send arbitrary requests |
Sorry, the diff of this file is not supported yet
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
73387
Updatedkitsu-core@^10.0.0-alpha.13