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.2 to 3.1.3

15

CHANGELOG.md

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

#### 3.1.2 (2017-11-26)
##### 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))
##### 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)

@@ -2,0 +17,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,2 +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('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}}function k(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,i=i&&i.hasOwnProperty('default')?i['default']:i;var l=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,l(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)}}(),m=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)}}(),n=function(){var a=e(d.mark(function a(b,c){var e,f,g,h,i,j,k,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=(k=j.next()).done){a.next=30;break}return n=k.value,o=n.id,p=n.type,a.t3=l,a.next=22,m(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=l,a.next=51,m(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)}}(),o=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,n(i,b.included);case 15:i=a.sent;case 16:if(!i.attributes){a.next=20;break}return a.next=19,l(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,n(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,l(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)}}(),p=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)}}(),q=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=g(f(b)),a.next=8,p(b,c);case 8:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),r=function(){var a=e(d.mark(function a(b){var c,e,h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},i=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:h,paramsSerializer:function(b){return j(b)},headers:Object.assign(this.headers,i)});case 3:return c=a.sent,e=c.data,a.abrupt('return',o(e));case 8:return a.prev=8,a.t0=a['catch'](0),a.abrupt('return',k(a.t0));case 11:case'end':return a.stop();}},a,this,[[0,8]])}));return function(){return a.apply(this,arguments)}}(),s=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=g(f(b))+'/'+c,a.next=8,p(b,{id:c},'DELETE');case 8:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),t=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,r.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)}}(),u=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.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=g(f(b))+'/'+c.id,a.next=10,p(b,c,'PATCH');case 10:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 20:return a.prev=20,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 23:case'end':return a.stop();}},a,this,[[0,20]])}));return function(){return a.apply(this,arguments)}}(),v='https://kitsu.io/api',w=function(){function d(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};a(this,d),this.fetch=r.bind(this),this.update=u.bind(this),this.create=q.bind(this),this.remove=s.bind(this),this.self=t.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||v,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===v?'edge':''),timeout:b.timeout||3e4,headers:this.headers})}return b(d,[{key:'headers',value:function(){return this.headers}},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),d}();return w});
(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}}function k(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,i=i&&i.hasOwnProperty('default')?i['default']:i;var l=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,l(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)}}(),m=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)}}(),n=function(){var a=e(d.mark(function a(b,c){var e,f,g,h,i,j,k,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=(k=j.next()).done){a.next=30;break}return n=k.value,o=n.id,p=n.type,a.t3=l,a.next=22,m(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=l,a.next=51,m(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)}}(),o=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,n(i,b.included);case 15:i=a.sent;case 16:if(!i.attributes){a.next=20;break}return a.next=19,l(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,n(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,l(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)}}(),p=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)}}(),q=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=g(f(b)),a.next=8,p(b,c);case 8:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),r=function(){var a=e(d.mark(function a(b){var c,e,h=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},i=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:h,paramsSerializer:function(b){return j(b)},headers:Object.assign(this.headers,i)});case 3:return c=a.sent,e=c.data,a.abrupt('return',o(e));case 8:return a.prev=8,a.t0=a['catch'](0),a.abrupt('return',k(a.t0));case 11:case'end':return a.stop();}},a,this,[[0,8]])}));return function(){return a.apply(this,arguments)}}(),s=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.Authorization){a.next=4;break}throw new Error('Not logged in');case 4:return a.t0=this.axios,a.t1=g(f(b))+'/'+c,a.next=8,p(b,{id:c},'DELETE');case 8:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 18:return a.prev=18,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 21:case'end':return a.stop();}},a,this,[[0,18]])}));return function(){return a.apply(this,arguments)}}(),t=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,r.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)}}(),u=function(){var a=e(d.mark(function a(b,c){var e,h,i=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,i=Object.assign(this.headers,i),i.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=g(f(b))+'/'+c.id,a.next=10,p(b,c,'PATCH');case 10:return a.t2=a.sent.data,a.t3=i,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,h=e.data,a.abrupt('return',h);case 20:return a.prev=20,a.t5=a['catch'](0),a.abrupt('return',k(a.t5));case 23:case'end':return a.stop();}},a,this,[[0,20]])}));return function(){return a.apply(this,arguments)}}(),v='https://kitsu.io/api',w=function(){function d(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};a(this,d),this.fetch=r.bind(this),this.update=u.bind(this),this.create=q.bind(this),this.remove=s.bind(this),this.self=t.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||v,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===v?'edge':'')),timeout:b.timeout||3e4,headers:this.headers})}return b(d,[{key:'headers',value:function(){return this.headers}},{key:'isAuth',get:function(){return!!this.headers.Authorization}}]),d}();return w});
//# sourceMappingURL=kitsu.js.map

@@ -0,0 +0,0 @@ MIT License

{
"name": "kitsu",
"version": "3.1.2",
"version": "3.1.3",
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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