diff --git a/dist/jso.js b/dist/jso.js index b793ff5..a346d4f 100644 --- a/dist/jso.js +++ b/dist/jso.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jso=t():e.jso=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=86)}([function(e,t,n){var r=n(37)("wks"),o=n(25),i=n(1).Symbol,u="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=u&&i[e]||(u?i:o)("Symbol."+e))}).store=r},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(9);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(15),o=n(40);e.exports=n(8)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports={}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(1),o=n(4),i=n(6),u=n(25)("src"),c=Function.toString,a=(""+c).split("toString");n(3).inspectSource=function(e){return c.call(e)},(e.exports=function(e,t,n,c){var s="function"==typeof n;s&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(s&&(i(n,u)||o(n,u,e[t]?""+e[t]:a.join(String(t)))),e===r?e[t]=n:c?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(e,t,n){e.exports=!n(27)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(1),o=n(3),i=n(4),u=n(7),c=n(14),a=function(e,t,n){var s,f,l,p,h=e&a.F,d=e&a.G,v=e&a.S,y=e&a.P,g=e&a.B,b=d?r:v?r[t]||(r[t]={}):(r[t]||{}).prototype,m=d?o:o[t]||(o[t]={}),_=m.prototype||(m.prototype={});for(s in d&&(n=t),n)l=((f=!h&&b&&void 0!==b[s])?b:n)[s],p=g&&f?c(l,r):y&&"function"==typeof l?c(Function.call,l):l,b&&u(b,s,l,e&a.U),m[s]!=l&&i(m,s,p),y&&_[s]!=l&&(_[s]=l)};r.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n1?console.log("[JSO]",arguments):console.log("[JSO]",e))},encodeURL:function(e,t){var n,r=e,o=0,i=-1===e.indexOf("?")?"?":"&";for(n in t)r+=(0==o++?i:"&")+encodeURIComponent(n)+"="+encodeURIComponent(t[n]);return r}};t.default=r},function(e,t,n){"use strict";var r=n(13);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){var r=n(15).f,o=n(6),i=n(0)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(12),o=n(0)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,u;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(u=r(t))&&"function"==typeof t.callee?"Arguments":u}},function(e,t,n){var r=n(37)("keys"),o=n(25);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(39),o=n(22);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(80),o=n(36);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(9),o=n(1).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(2),o=n(9),i=n(17);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r,o,i,u=n(14),c=n(57),a=n(32),s=n(26),f=n(1),l=f.process,p=f.setImmediate,h=f.clearImmediate,d=f.MessageChannel,v=f.Dispatch,y=0,g={},b=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},m=function(e){b.call(e.data)};p&&h||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++y]=function(){c("function"==typeof e?e:Function(e),t)},r(y),y},h=function(e){delete g[e]},"process"==n(12)(l)?r=function(e){l.nextTick(u(b,e,1))}:v&&v.now?r=function(e){v.now(u(b,e,1))}:d?(i=(o=new d).port2,o.port1.onmessage=m,r=u(i.postMessage,i,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(r=function(e){f.postMessage(e+"","*")},f.addEventListener("message",m,!1)):r="onreadystatechange"in s("script")?function(e){a.appendChild(s("script")).onreadystatechange=function(){a.removeChild(this),b.call(e)}}:function(e){setTimeout(u(b,e,1),0)}),e.exports={set:p,clear:h}},function(e,t,n){var r=n(2),o=n(13),i=n(0)("species");e.exports=function(e,t){var n,u=r(e).constructor;return void 0===u||void 0==(n=r(u)[i])?t:o(n)}},function(e,t,n){var r=n(1).document;e.exports=r&&r.documentElement},function(e,t){e.exports=!1},function(e,t,n){"use strict";var r=n(33),o=n(10),i=n(7),u=n(4),c=n(6),a=n(5),s=n(71),f=n(18),l=n(68),p=n(0)("iterator"),h=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,n,v,y,g,b){s(n,t,v);var m,_,w,x=function(e){if(!h&&e in P)return P[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},k=t+" Iterator",O="values"==y,j=!1,P=e.prototype,S=P[p]||P["@@iterator"]||y&&P[y],T=!h&&S||x(y),E=y?O?x("entries"):T:void 0,L="Array"==t&&P.entries||S;if(L&&(w=l(L.call(new e)))!==Object.prototype&&w.next&&(f(w,k,!0),r||c(w,p)||u(w,p,d)),O&&S&&"values"!==S.name&&(j=!0,T=function(){return S.call(this)}),r&&!b||!h&&!j&&P[p]||u(P,p,T),a[t]=T,a[k]=d,y)if(m={values:O?T:x("values"),keys:g?T:x("keys"),entries:E},b)for(_ in m)_ in P||i(P,_,m[_]);else o(o.P+o.F*(h||j),t,m);return m}},function(e,t,n){var r=n(22);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(1),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t,n){var r=n(21),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(12);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e){e.exports={name:"jso",version:"4.0.1",description:"OAuth 2.0 implementation in Javascript",main:"dist/jso.js",module:"src/JSO.js",scripts:{test:"true",preversion:"npm test",version:"npm run build && git add -A dist",postversion:"git push && git push --tags && npm publish",build:"webpack --mode production --config webpack.config.js"},babel:{presets:["env"]},repository:{type:"git",url:"https://github.com/andreassolberg/jso.git"},keywords:["oauth","authentication","authorization","rest","api","ajax","jquery"],files:["src"],eslintConfig:{env:{es6:!0,browser:!0,node:!1}},devDependencies:{"babel-core":"^6.26.0","babel-loader":"^7.1.4","babel-preset-env":"^1.6.1","babel-preset-react":"^6.24.1",qunit:"^2.5.1",webpack:"^4.1.1"},author:"Andreas Åkre Solberg",license:"LGPL-2.1",bugs:{url:"https://github.com/andreassolberg/jso/issues"},homepage:"https://github.com/andreassolberg/jso",dependencies:{"webpack-cli":"^2.0.12"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n2)throw new Error("Reccursion error. Expired tokens deleted and tried again multiple times.");var o={},u={mode:"cors"};return t&&(u=t,Object.assign(u,t)),t&&t.jso&&Object.assign(o,t.jso),this.jso.getToken(o).catch(function(e){console.error("Error fetching token to use ",e)}).then(function(o){return u.headers||(u.headers={}),u.headers.Authorization="Bearer "+o.access_token,r._fetch(e,u).catch(function(o){if(o instanceof i)return console.error("Token was expired. Deleting all tokens for this provider and get a new one",o),r.jso.wipeTokens(),r.fetch(e,t,n+1)})})}}]),e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;nm;m++)if((y=t?b(u(d=e[m])[0],d[1]):b(e[m]))===s||y===f)return y}else for(v=g.call(e);!(d=v.next()).done;)if((y=o(v,b,d.value,t))===s||y===f)return y}).BREAK=s,t.RETURN=f},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r,o,i,u,c=n(33),a=n(1),s=n(14),f=n(19),l=n(10),p=n(9),h=n(13),d=n(62),v=n(61),y=n(31),g=n(30).set,b=n(56)(),m=n(17),_=n(29),w=n(28),x=a.TypeError,k=a.process,O=a.Promise,j="process"==f(k),P=function(){},S=o=m.f,T=!!function(){try{var e=O.resolve(1),t=(e.constructor={})[n(0)("species")]=function(e){e(P,P)};return(j||"function"==typeof PromiseRejectionEvent)&&e.then(P)instanceof t}catch(e){}}(),E=function(e){var t;return!(!p(e)||"function"!=typeof(t=e.then))&&t},L=function(e,t){if(!e._n){e._n=!0;var n=e._c;b(function(){for(var r=e._v,o=1==e._s,i=0,u=function(t){var n,i,u=o?t.ok:t.fail,c=t.resolve,a=t.reject,s=t.domain;try{u?(o||(2==e._h&&M(e),e._h=1),!0===u?n=r:(s&&s.enter(),n=u(r),s&&s.exit()),n===t.promise?a(x("Promise-chain cycle")):(i=E(n))?i.call(n,c,a):c(n)):a(r)}catch(e){a(e)}};n.length>i;)u(n[i++]);e._c=[],e._n=!1,t&&!e._h&&C(e)})}},C=function(e){g.call(a,function(){var t,n,r,o=e._v,i=R(e);if(i&&(t=_(function(){j?k.emit("unhandledRejection",o,e):(n=a.onunhandledrejection)?n({promise:e,reason:o}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",o)}),e._h=j||R(e)?2:1),e._a=void 0,i&&t.e)throw t.v})},R=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){g.call(a,function(){var t;j?k.emit("rejectionHandled",e):(t=a.onrejectionhandled)&&t({promise:e,reason:e._v})})},I=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),L(t,!0))},A=function(e){var t,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===e)throw x("Promise can't be resolved itself");(t=E(e))?b(function(){var r={_w:n,_d:!1};try{t.call(e,s(A,r,1),s(I,r,1))}catch(e){I.call(r,e)}}):(n._v=e,n._s=1,L(n,!1))}catch(e){I.call({_w:n,_d:!1},e)}}};T||(O=function(e){d(this,O,"Promise","_h"),h(e),r.call(this);try{e(s(A,this,1),s(I,this,1))}catch(e){I.call(this,e)}},(r=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n(55)(O.prototype,{then:function(e,t){var n=S(y(this,O));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=j?k.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&L(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new r;this.promise=e,this.resolve=s(A,e,1),this.reject=s(I,e,1)},m.f=S=function(e){return e===O||e===u?new i(e):o(e)}),l(l.G+l.W+l.F*!T,{Promise:O}),n(18)(O,"Promise"),n(54)("Promise"),u=n(3).Promise,l(l.S+l.F*!T,"Promise",{reject:function(e){var t=S(this);return(0,t.reject)(e),t.promise}}),l(l.S+l.F*(c||!T),"Promise",{resolve:function(e){return w(c&&this===u?O:this,e)}}),l(l.S+l.F*!(T&&n(53)(function(e){O.all(e).catch(P)})),"Promise",{all:function(e){var t=this,n=S(t),r=n.resolve,o=n.reject,i=_(function(){var n=[],i=0,u=1;v(e,!1,function(e){var c=i++,a=!1;n.push(void 0),u++,t.resolve(e).then(function(e){a||(a=!0,n[c]=e,--u||r(n))},o)}),--u||r(n)});return i.e&&o(i.v),n.promise},race:function(e){var t=this,n=S(t),r=n.reject,o=_(function(){v(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return o.e&&r(o.v),n.promise}})},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(0)("unscopables"),o=Array.prototype;void 0==o[r]&&n(4)(o,r,{}),e.exports=function(e){o[r][e]=!0}},function(e,t,n){"use strict";var r=n(65),o=n(64),i=n(5),u=n(23);e.exports=n(34)(Array,"Array",function(e,t){this._t=u(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t,n){for(var r=n(66),o=n(24),i=n(7),u=n(1),c=n(4),a=n(5),s=n(0),f=s("iterator"),l=s("toStringTag"),p=a.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(h),v=0;va;)r.f(e,n=u[a++],t[n]);return e}},function(e,t,n){var r=n(2),o=n(69),i=n(36),u=n(20)("IE_PROTO"),c=function(){},a=function(){var e,t=n(26)("iframe"),r=i.length;for(t.style.display="none",n(32).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("