Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kitsu

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitsu - npm Package Compare versions

Comparing version 3.0.4 to 3.1.0

13

CHANGELOG.md

@@ -0,1 +1,14 @@

### 3.1.0 (2017-11-07)
##### Chores
* add kitsu.io to npm tags ([fec517ba](https://github.com/wopian/kitsu/commit/fec517badb4103a36e23cb63330316333d46448c))
* disable lockfile maintenance ([aef0a52b](https://github.com/wopian/kitsu/commit/aef0a52b1d829fed8f48ac55d672710e1d996749))
* enable renovate (#60) ([27608b1f](https://github.com/wopian/kitsu/commit/27608b1f14914ed0346b0829a38e9fc2de198059))
* **deps:** update lock file (#61) ([dd37a4c6](https://github.com/wopian/kitsu/commit/dd37a4c6efb0986441d65ac065d32e70c8625989))
##### New Features
* allow additional headers with requests ([6872b4e5](https://github.com/wopian/kitsu/commit/6872b4e512dc31ea8e14a5aa307d2d4328d58802))
#### 3.0.4 (2017-11-02)

@@ -2,0 +15,0 @@

9

DOCS.md

@@ -95,2 +95,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->

- `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 `{}`)

@@ -124,3 +125,3 @@ **Examples**

- `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
- `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

@@ -133,2 +134,3 @@ - `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.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 `{}`)

@@ -187,2 +189,3 @@ **Examples**

- `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 `{}`)

@@ -206,5 +209,6 @@ **Examples**

- `params` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** JSON-API request queries
- `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 `{}`)

@@ -236,2 +240,3 @@ **Examples**

- `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 `{}`)

@@ -238,0 +243,0 @@ **Examples**

@@ -1,1 +0,1 @@

(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('pluralize'),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','pluralize','babel-runtime/helpers/typeof','camelcase'],b):a.kitsu=b(a._classCallCheck,a._createClass,a.axios,a._regeneratorRuntime,a._asyncToGenerator,a.kebab,a.plural,a._typeof,a.camel)})(this,function(a,b,c,d,e,f,g,h,i){'use strict';function j(a){try{var b='',c=function(c){'object'===h(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}}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,i=i&&i.hasOwnProperty('default')?i['default']:i;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,(0,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,(0,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,h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},j=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,h.constructor===Object&&0!==Object.keys(h).length){a.next=3;break}throw new Error(j+' requires a JSON object body');case 3:if(c=g(i(b)),e={type:c},'POST'===j||'undefined'!=typeof h.id){a.next=7;break}throw new Error(j+' requires an ID for the '+c+' type');case 7:for(f in'POST'!==j&&(e.id=h.id),h)null!==h[f]&&h[f].constructor===Object&&('string'==typeof h[f].id||'string'==typeof h[f].type)?('undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof h[f].type&&(h[f].type=g(i(f))),e.relationships[f]={data:Object.assign(h[f])}):'id'!==f&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[f]=h[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 h,i,j;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,this.axios.defaults.headers.Authorization){a.next=3;break}throw new Error('Not logged in');case 3:return a.t0=this.axios,a.t1=g(f(b)),a.next=7,o(b,c);case 7:return a.t2=a.sent.data,a.t3=this.headers,a.t4={data:a.t2,headers:a.t3},a.next=12,a.t0.post.call(a.t0,a.t1,a.t4);case 12:return h=a.sent,i=h.data,a.abrupt('return',i);case 17:return a.prev=17,a.t5=a['catch'](0),j=a.t5.response.data,a.abrupt('return',j.errors?j.errors:j);case 21:case'end':return a.stop();}},a,this,[[0,17]])}));return function(){return a.apply(this,arguments)}}(),q=function(){var a=e(d.mark(function a(b,c){var h,i,k;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,this.axios.get(g(f(b)),{params:c,paramsSerializer:function(b){return j(b)},headers:this.headers});case 3:return h=a.sent,i=h.data,a.abrupt('return',n(i));case 8:return a.prev=8,a.t0=a['catch'](0),k=a.t0.response.data,a.abrupt('return',k.errors?k.errors:k);case 12: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 h,i,j;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,a.t0=console,a.next=4,o(b,{id:c},'DELETE');case 4:if(a.t1=a.sent,a.t0.log.call(a.t0,a.t1),this.axios.defaults.headers.Authorization){a.next=8;break}throw new Error('Not logged in');case 8:return a.t2=this.axios,a.t3=g(f(b))+'/'+c,a.next=12,o(b,{id:c},'DELETE');case 12:return a.t4=a.sent.data,a.t5=this.headers,a.t6={data:a.t4,headers:a.t5},a.next=17,a.t2.delete.call(a.t2,a.t3,a.t6);case 17:return h=a.sent,i=h.data,a.abrupt('return',i);case 22:return a.prev=22,a.t7=a['catch'](0),j=a.t7.response.data,a.abrupt('return',j.errors?j.errors:j);case 26:case'end':return a.stop();}},a,this,[[0,22]])}));return function(){return a.apply(this,arguments)}}(),s=function(){var a=e(d.mark(function a(b){var c,e;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}},b));case 3:return c=a.sent,e=c.data,a.abrupt('return',e[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 h,i,j;return d.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,this.axios.defaults.headers.Authorization){a.next=3;break}throw new Error('Not logged in');case 3:if('undefined'!=typeof c.id){a.next=5;break}throw new Error('Updating a resource requires an ID');case 5:return a.t0=this.axios,a.t1=g(f(b))+'/'+c.id,a.next=9,o(b,c,'PATCH');case 9:return a.t2=a.sent.data,a.t3=this.headers,a.t4={data:a.t2,headers:a.t3},a.next=14,a.t0.patch.call(a.t0,a.t1,a.t4);case 14:return h=a.sent,i=h.data,a.abrupt('return',i);case 19:return a.prev=19,a.t5=a['catch'](0),j=a.t5.response.data,a.abrupt('return',j.errors?j.errors:j);case 23:case'end':return a.stop();}},a,this,[[0,19]])}));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,headers:this.headers})}return b(d,[{key:'headers',value:function(){return this.headers}},{key:'isAuth',get:function(){return'undefined'!=typeof this.headers.authorization}}]),d}();return v});
(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('pluralize'),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','pluralize','babel-runtime/helpers/typeof','camelcase'],b):a.kitsu=b(a._classCallCheck,a._createClass,a.axios,a._regeneratorRuntime,a._asyncToGenerator,a.kebab,a.plural,a._typeof,a.camel)})(this,function(a,b,c,d,e,f,g,h,i){'use strict';function j(a){try{var b='',c=function(c){'object'===h(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}}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,i=i&&i.hasOwnProperty('default')?i['default']:i;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,(0,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,(0,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,h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},j=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,h.constructor===Object&&0!==Object.keys(h).length){a.next=3;break}throw new Error(j+' requires a JSON object body');case 3:if(c=g(i(b)),e={type:c},'POST'===j||'undefined'!=typeof h.id){a.next=7;break}throw new Error(j+' requires an ID for the '+c+' type');case 7:for(f in'POST'!==j&&(e.id=h.id),h)null!==h[f]&&h[f].constructor===Object&&('string'==typeof h[f].id||'string'==typeof h[f].type)?('undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof h[f].type&&(h[f].type=g(i(f))),e.relationships[f]={data:Object.assign(h[f])}):'id'!==f&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[f]=h[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 h,i,j,e=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,this.axios.defaults.headers.Authorization){a.next=3;break}throw new Error('Not logged in');case 3:return a.t0=this.axios,a.t1=g(f(b)),a.next=7,o(b,c);case 7:return a.t2=a.sent.data,a.t3=Object.assign(this.headers,e),a.t4={data:a.t2,headers:a.t3},a.next=12,a.t0.post.call(a.t0,a.t1,a.t4);case 12:return h=a.sent,i=h.data,a.abrupt('return',i);case 17:return a.prev=17,a.t5=a['catch'](0),j=a.t5.response.data,a.abrupt('return',j.errors?j.errors:j);case 21:case'end':return a.stop();}},a,this,[[0,17]])}));return function(){return a.apply(this,arguments)}}(),q=function(){var a=e(d.mark(function a(b){var c,h,i,e=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},k=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(g(f(b)),{params:e,paramsSerializer:function(b){return j(b)},headers:Object.assign(this.headers,k)});case 3:return c=a.sent,h=c.data,a.abrupt('return',n(h));case 8:return a.prev=8,a.t0=a['catch'](0),i=a.t0.response.data,a.abrupt('return',i.errors?i.errors:i);case 12: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 h,i,j,e=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,this.axios.defaults.headers.Authorization){a.next=3;break}throw new Error('Not logged in');case 3:return a.t0=this.axios,a.t1=g(f(b))+'/'+c,a.next=7,o(b,{id:c},'DELETE');case 7:return a.t2=a.sent.data,a.t3=Object.assign(this.headers,e),a.t4={data:a.t2,headers:a.t3},a.next=12,a.t0.delete.call(a.t0,a.t1,a.t4);case 12:return h=a.sent,i=h.data,a.abrupt('return',i);case 17:return a.prev=17,a.t5=a['catch'](0),j=a.t5.response.data,a.abrupt('return',j.errors?j.errors:j);case 21:case'end':return a.stop();}},a,this,[[0,17]])}));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 h,i,j,e=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,this.axios.defaults.headers.Authorization){a.next=3;break}throw new Error('Not logged in');case 3:if('undefined'!=typeof c.id){a.next=5;break}throw new Error('Updating a resource requires an ID');case 5:return a.t0=this.axios,a.t1=g(f(b))+'/'+c.id,a.next=9,o(b,c,'PATCH');case 9:return a.t2=a.sent.data,a.t3=Object.assign(this.headers,e),a.t4={data:a.t2,headers:a.t3},a.next=14,a.t0.patch.call(a.t0,a.t1,a.t4);case 14:return h=a.sent,i=h.data,a.abrupt('return',i);case 19:return a.prev=19,a.t5=a['catch'](0),j=a.t5.response.data,a.abrupt('return',j.errors?j.errors:j);case 23:case'end':return a.stop();}},a,this,[[0,19]])}));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,headers:this.headers})}return b(d,[{key:'headers',value:function(){return this.headers}},{key:'isAuth',get:function(){return'undefined'!=typeof this.headers.authorization}}]),d}();return v});
{
"name": "kitsu",
"version": "3.0.4",
"version": "3.1.0",
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs",

@@ -32,5 +32,7 @@ "license": "MIT",

"kitsu",
"kitsu.io",
"anime",
"manga",
"drama",
"json",
"api",

@@ -94,3 +96,54 @@ "wrapper",

}
},
"renovate": {
"extends": [
"config:base"
],
"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"
}
]
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc