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.1.0 to 3.1.1

20

CHANGELOG.md

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

#### 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
* add empty data array spec ([122387a1](https://github.com/wopian/kitsu/commit/122387a1262a9908fc130dceabf29feb207d3b5d))
### 3.1.0 (2017-11-07)

@@ -2,0 +22,0 @@

0

DOCS.md

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

2

lib/kitsu.js

@@ -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,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});
(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,'undefined'==typeof b){a.next=17;break}if(!Array.isArray(b)){a.next=7;break}return a.next=5,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 5:a.next=17;break;case 7:if(!(b.attributes&&b.attributes.constructor===Object)){a.next=17;break}return a.next=10,b.attributes;case 10:a.t0=d.keys(a.sent);case 11:if((a.t1=a.t0()).done){a.next=16;break}c=a.t1.value,b[c]=b.attributes[c],a.next=11;break;case 16:delete b.attributes;case 17:return a.abrupt('return',b);case 20:throw a.prev=20,a.t2=a['catch'](0),a.t2;case 23:case'end':return a.stop();}},a,this,[[0,20]])}));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]||{id:e,type:f});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,t,u;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=59;break}if(f=a.t1.value,!(e[f].data&&Array.isArray(e[f].data))){a.next=46;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=30;break}return n=m.value,o=n.id,p=n.type,a.t3=k,a.next=22,l(c,{id:o,type:p});case 22:return a.t4=a.sent,a.next=25,(0,a.t3)(a.t4);case 25:q=a.sent,'undefined'!=typeof q&&(!b[f]&&(b[f]=[]),b[f].push(q));case 27:g=!0,a.next=16;break;case 30:a.next=36;break;case 32:a.prev=32,a.t5=a['catch'](11),h=!0,i=a.t5;case 36:a.prev=36,a.prev=37,!g&&j.return&&j.return();case 39:if(a.prev=39,!h){a.next=42;break}throw i;case 42:return a.finish(39);case 43:return a.finish(36);case 44:a.next=57;break;case 46:if(!e[f].data){a.next=57;break}return r=e[f].data,s=r.id,t=r.type,a.t6=k,a.next=51,l(c,{id:s,type:t});case 51:return a.t7=a.sent,a.next=54,(0,a.t6)(a.t7);case 54:u=a.sent,'undefined'==typeof u||b[f]||(b[f]=u),delete b[f].relationships;case 57:a.next=5;break;case 59:return delete b.relationships,a.abrupt('return',b);case 63:throw a.prev=63,a.t8=a['catch'](0),a.t8;case 66:case'end':return a.stop();}},a,this,[[0,63],[11,32,36,44],[37,,39,43]])}));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.1.0",
"version": "3.1.1",
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs",

@@ -18,3 +18,3 @@ "license": "MIT",

"release:build": "jest && yarn build",
"release:push": "git push origin && git push origin --tags && npm publish && git stash pop",
"release:push": "git push origin && git push origin --tags && yarn publish && git stash pop",
"release:commit": "git add package.json && git add DOCS.md && git add CHANGELOG.md && git commit -m \"update changelog\" && git stash",

@@ -21,0 +21,0 @@ "release:major": "yarn release:build && changelog -M && yarn release:commit && npm version major && yarn release:push",

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