Comparing version 3.1.0 to 3.2.0-rc.1
@@ -0,1 +1,30 @@ | ||
### 3.2.0-rc.1 (2017-11-11) | ||
The `pluralization` dependency has been removed in this candidate. This is a quick fix to resolve issues with models that end with numeric values and will be resolved and `pluralization` re-added with configuration in the proper release. | ||
As a side effect, the body of `POST`, `PATCH` and `DELETE` requests **must** contain an `id` and `type`. | ||
Do not upgrade to this candidate if the model pluralization has not been affecting you. | ||
##### Chores | ||
* remove pluralisation tests ([624f1287](https://github.com/wopian/kitsu/commit/624f12874680eed921c5059e633b422b652518fa)) | ||
* drop pluralize from serialiser ([cc111b90](https://github.com/wopian/kitsu/commit/cc111b9050f9e94f38d4c75a59bbf9c6ca7c8c43)) | ||
* strip stray console logging from being bundled ([da72d534](https://github.com/wopian/kitsu/commit/da72d534231c0384411f6f3efcf1a277250c2ca9)) | ||
##### Continuous Integration | ||
* **travis:** | ||
* fix latest node version ([d4a1d71d](https://github.com/wopian/kitsu/commit/d4a1d71d948d26a39e4c2ad4baaaff09b6473aba)) | ||
* add comments for when LTS ends ([15cf0e94](https://github.com/wopian/kitsu/commit/15cf0e9445e1f210d2b161f5c76f1df59a064a96)) | ||
* **appveyor:** drop testing node 7 and add 8 ([ae4dbb94](https://github.com/wopian/kitsu/commit/ae4dbb94e021a38289c7defae5f3eee3643c6147)) | ||
##### Bug Fixes | ||
* drop pluralisation of request models ([053706a0](https://github.com/wopian/kitsu/commit/053706a02c2b34b408e170aff00b06b69c23ba09)) | ||
##### Tests | ||
* fix pluralisation ([f028768a](https://github.com/wopian/kitsu/commit/f028768af5130e0c82f7bd65523c0e19ae6a246a)) | ||
### 3.1.0 (2017-11-07) | ||
@@ -2,0 +31,0 @@ |
@@ -0,0 +0,0 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> |
@@ -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('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','babel-runtime/helpers/typeof','camelcase'],b):a.kitsu=b(a._classCallCheck,a._createClass,a.axios,a._regeneratorRuntime,a._asyncToGenerator,a.kebab,a._typeof,a.camel)})(this,function(a,b,c,d,e,f,g,h){'use strict';function i(a){try{var b='',c=function(c){'object'===g(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;var j=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,j(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)}}(),k=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)}}(),l=function(){var a=e(d.mark(function a(b,c){var e,f,g,h,i,l,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,l=a.sent[a.t2]();case 16:if(g=(m=l.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=j,a.next=24,k(c,{id:o,type:p});case 24:return a.t5=a.sent,a.next=27,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&&l.return&&l.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=j,a.next=54,k(c,{id:r,type:s});case 54:return a.t9=a.sent,a.next=57,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)}}(),m=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,l(i,b.included);case 15:i=a.sent;case 16:if(!i.attributes){a.next=20;break}return a.next=19,j(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,l(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,j(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)}}(),n=function(){var a=e(d.mark(function a(b){var c,e,f,g=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},i=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,g.constructor===Object&&0!==Object.keys(g).length){a.next=3;break}throw new Error(i+' requires a JSON object body');case 3:if(c=h(b),e={type:c},'POST'===i||'undefined'!=typeof g.id){a.next=7;break}throw new Error(i+' requires an ID for the '+c+' type');case 7:for(f in'POST'!==i&&(e.id=g.id),g)null!==g[f]&&g[f].constructor===Object&&('string'==typeof g[f].id||'string'==typeof g[f].type)?('undefined'==typeof e.relationships&&(e.relationships={}),'undefined'==typeof g[f].type&&(g[f].type=h(f)),e.relationships[f]={data:Object.assign(g[f])}):'id'!==f&&('undefined'==typeof e.attributes&&(e.attributes={}),e.attributes[f]=g[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)}}(),o=function(){var a=e(d.mark(function a(b,c){var g,h,i,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=f(b),a.next=7,n(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 g=a.sent,h=g.data,a.abrupt('return',h);case 17:return a.prev=17,a.t5=a['catch'](0),i=a.t5.response.data,a.abrupt('return',i.errors?i.errors:i);case 21:case'end':return a.stop();}},a,this,[[0,17]])}));return function(){return a.apply(this,arguments)}}(),p=function(){var a=e(d.mark(function a(b){var c,g,h,e=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},j=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(f(b),{params:e,paramsSerializer:function(b){return i(b)},headers:Object.assign(this.headers,j)});case 3:return c=a.sent,g=c.data,a.abrupt('return',m(g));case 8:return a.prev=8,a.t0=a['catch'](0),h=a.t0.response.data,a.abrupt('return',h.errors?h.errors:h);case 12:case'end':return a.stop();}},a,this,[[0,8]])}));return function(){return a.apply(this,arguments)}}(),q=function(){var a=e(d.mark(function a(b,c){var g,h,i,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=f(b)+'/'+c,a.next=7,n(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 g=a.sent,h=g.data,a.abrupt('return',h);case 17:return a.prev=17,a.t5=a['catch'](0),i=a.t5.response.data,a.abrupt('return',i.errors?i.errors:i);case 21:case'end':return a.stop();}},a,this,[[0,17]])}));return function(){return a.apply(this,arguments)}}(),r=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,p.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)}}(),s=function(){var a=e(d.mark(function a(b,c){var g,h,i,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=f(b)+'/'+c.id,a.next=9,n(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 g=a.sent,h=g.data,a.abrupt('return',h);case 19:return a.prev=19,a.t5=a['catch'](0),i=a.t5.response.data,a.abrupt('return',i.errors?i.errors:i);case 23:case'end':return a.stop();}},a,this,[[0,19]])}));return function(){return a.apply(this,arguments)}}(),t='https://kitsu.io/api',u=function(){function d(){var b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};a(this,d),this.fetch=p.bind(this),this.update=s.bind(this),this.create=o.bind(this),this.remove=q.bind(this),this.self=r.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||t,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===t?'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 u}); |
{ | ||
"name": "kitsu", | ||
"version": "3.1.0", | ||
"version": "3.2.0-rc.1", | ||
"description": "Simple & lightweight JSON-API client for Kitsu and other compliant APIs", | ||
@@ -61,4 +61,3 @@ "license": "MIT", | ||
"camelcase": "^4.1.0", | ||
"decamelize": "^1.2.0", | ||
"pluralize": "^7.0.0" | ||
"decamelize": "^1.2.0" | ||
}, | ||
@@ -65,0 +64,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
55557
4
84
2
- Removedpluralize@^7.0.0
- Removedpluralize@7.0.0(transitive)