@uxland/fetch-client
Advanced tools
Comparing version 1.0.1-alpha.6 to 1.0.1-alpha.7
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.0.1-alpha.7](https://github.com/uxland/uxland/compare/@uxland/fetch-client@1.0.1-alpha.6...@uxland/fetch-client@1.0.1-alpha.7) (2021-03-11) | ||
**Note:** Version bump only for package @uxland/fetch-client | ||
## [1.0.1-alpha.6](https://github.com/uxland/uxland/compare/@uxland/fetch-client@1.0.1-alpha.5...@uxland/fetch-client@1.0.1-alpha.6) (2021-03-11) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
(()=>{(()=>{var e=1;e=1,e=1;var n=class{constructor(a,m){this.messageType=a,this.callback=m}handle(a){a instanceof this.messageType&&this.callback.call(null,a)}},r=(a,m,u)=>{try{a(m,u)}catch(l){console.error(l)}},o=(a,m)=>{try{a.handle(m)}catch(u){console.error(u)}},s=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(a,m){let u,l;if(!a)throw new Error("Event channel/type is invalid.");if(typeof a=="string"){if(u=this.eventLookup[a],u)for(u=u.slice(),l=u.length;l--;)r(u[l],m,a)}else for(u=this.messageHandlers.slice(),l=u.length;l--;)o(u[l],a)}subscribe(a,m){let u,l;if(!a)throw new Error("Event channel/type is invalid.");return typeof a=="string"?(u=m,l=this.eventLookup[a]||(this.eventLookup[a]=[])):(u=new n(a,m),l=this.messageHandlers),l.push(u),{dispose(){let y=l.indexOf(u);y!==-1&&l.splice(y,1)}}}subscribeOnce(a,m){let u=this.subscribe(a,(l,y)=>(u.dispose(),m(l,y)));return u}},t=new s,c=t.subscribe.bind(t),J=t.subscribeOnce.bind(t),B=t.publish.bind(t);console.log("@uxland/event-aggregator loaded")})();var R="UXL-FETCH:INVALID_CREDENTIALS_EVENT",j="UXL-FETCH:INVALID_REQUEST_EVENT",N=async e=>{let n=()=>new Promise(r=>r());if(!e.ok){let r;try{let o=await e.json();r={...new Error,data:o,status:e.status,statusText:e.statusText}}catch(o){r={...new Error,status:e.status,statusText:e.statusText}}throw e.status===401?(await n(),(void 0)(R,r)):(await n(),(void 0)(j,r)),r}return e};var U="Content-Type",S="application/json",A=e=>{var r;let n=(r=e.headers)==null?void 0:r.get(U);return(n==null?void 0:n.indexOf(S))!==-1},v=async(e,n=[])=>A(e)?await e.json().then(r=>n.reduce((o,s)=>s(o),r)):await e.text();var w=function(e){return e===null||typeof e=="undefined"?"":encodeURIComponent(e)};var P=function(e){let n=[];for(let r in e){let o=e[r];n.push(o!==null&&typeof o=="object"?`${encodeURIComponent(r)}=${JSON.stringify(o)}`:encodeURIComponent(r)+"="+w(o))}return n.join("&")};var V=/^([a-z][a-z0-9+\-.]*:)?\/\//i,k={},C=function(e,n,r={}){if(V.test(n))return n;let o=(e||"")+(n||""),s=P({...k,...r});return s?o+"?"+s:o};function i(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function d(e){return function n(r){return arguments.length===0||i(r)?n:e.apply(this,arguments)}}function f(e){return function n(r,o){switch(arguments.length){case 0:return n;case 1:return i(r)?n:d(function(s){return e(r,s)});default:return i(r)&&i(o)?n:i(r)?d(function(s){return e(s,o)}):i(o)?d(function(s){return e(r,s)}):e(r,o)}}}function g(e){return function n(r,o,s){switch(arguments.length){case 0:return n;case 1:return i(r)?n:f(function(t,c){return e(r,t,c)});case 2:return i(r)&&i(o)?n:i(r)?f(function(t,c){return e(t,o,c)}):i(o)?f(function(t,c){return e(r,t,c)}):d(function(t){return e(r,o,t)});default:return i(r)&&i(o)&&i(s)?n:i(r)&&i(o)?f(function(t,c){return e(t,c,s)}):i(r)&&i(s)?f(function(t,c){return e(t,o,c)}):i(o)&&i(s)?f(function(t,c){return e(r,t,c)}):i(r)?d(function(t){return e(t,o,s)}):i(o)?d(function(t){return e(r,t,s)}):i(s)?d(function(t){return e(r,o,t)}):e(r,o,s)}}}function h(e,n){return Object.prototype.hasOwnProperty.call(n,e)}var Q=d(function(n){return n==null}),H=Q;function _(e){return Object.prototype.toString.call(e)==="[object Object]"}var K=g(function(n,r,o){var s={},t;for(t in r)h(t,r)&&(s[t]=h(t,o)?n(t,r[t],o[t]):r[t]);for(t in o)h(t,o)&&!h(t,s)&&(s[t]=o[t]);return s}),I=K;var W=g(function e(n,r,o){return I(function(s,t,c){return _(t)&&_(c)?e(n,t,c):n(s,t,c)},r,o)}),O=W;var q=f(function(n,r){return O(function(o,s,t){return t},n,r)}),b=q;var D=(e,n)=>H(n)?e:b(e,n);var z="application/json",x,T=[],L={"Content-Type":z},p={headers:{...L},credentials:"include",mode:"cors"},De=e=>x=e,Le=()=>x,Ue=e=>{T.push(e)},Se=()=>T,Ae=e=>{p={...p,...e}},Ve=()=>p,ke=e=>{p={...p,headers:{...p.headers,...e}}},Qe=()=>p==null?void 0:p.headers,Ke=e=>{(p==null?void 0:p.headers[e])&&delete p.headers[e]},We=()=>{p={...p,headers:{...L}}},qe=async(e,n,r)=>{let o=await fetch(C(x,e,r),D(n,p)),s=await N(o);return await v(s,T)};console.log("@uxland/fetch-client loaded");})(); | ||
(()=>{var _=1;_=1,_=1;var E=class{constructor(t,r){this.messageType=t,this.callback=r}handle(t){t instanceof this.messageType&&this.callback.call(null,t)}},L=(e,t,r)=>{try{e(t,r)}catch(n){console.error(n)}},U=(e,t)=>{try{e.handle(t)}catch(r){console.error(r)}},x=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(t,r){let n,s;if(!t)throw new Error("Event channel/type is invalid.");if(typeof t=="string"){if(n=this.eventLookup[t],n)for(n=n.slice(),s=n.length;s--;)L(n[s],r,t)}else for(n=this.messageHandlers.slice(),s=n.length;s--;)U(n[s],t)}subscribe(t,r){let n,s;if(!t)throw new Error("Event channel/type is invalid.");return typeof t=="string"?(n=r,s=this.eventLookup[t]||(this.eventLookup[t]=[])):(n=new E(t,r),s=this.messageHandlers),s.push(n),{dispose(){let o=s.indexOf(n);o!==-1&&s.splice(o,1)}}}subscribeOnce(t,r){let n=this.subscribe(t,(s,o)=>(n.dispose(),r(s,o)));return n}},p=new x,F=p.subscribe.bind(p),X=p.subscribeOnce.bind(p),h=p.publish.bind(p);console.log("@uxland/event-aggregator loaded");var T="UXL-FETCH:INVALID_CREDENTIALS_EVENT",R="UXL-FETCH:INVALID_REQUEST_EVENT",j=async e=>{let t=()=>new Promise(r=>r());if(!e.ok){let r;try{let n=await e.json();r={...new Error,data:n,status:e.status,statusText:e.statusText}}catch(n){r={...new Error,status:e.status,statusText:e.statusText}}throw e.status===401?(await t(),h(T,r)):(await t(),h(R,r)),r}return e};var A="Content-Type",S="application/json",V=e=>{var r;let t=(r=e.headers)==null?void 0:r.get(A);return(t==null?void 0:t.indexOf(S))!==-1},N=async(e,t=[])=>V(e)?await e.json().then(r=>t.reduce((n,s)=>s(n),r)):await e.text();var v=function(e){return e===null||typeof e=="undefined"?"":encodeURIComponent(e)};var b=function(e){let t=[];for(let r in e){let n=e[r];t.push(n!==null&&typeof n=="object"?`${encodeURIComponent(r)}=${JSON.stringify(n)}`:encodeURIComponent(r)+"="+v(n))}return t.join("&")};var k=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Q={},w=function(e,t,r={}){if(k.test(t))return t;let n=(e||"")+(t||""),s=b({...Q,...r});return s?n+"?"+s:n};function i(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function c(e){return function t(r){return arguments.length===0||i(r)?t:e.apply(this,arguments)}}function l(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return i(r)?t:c(function(s){return e(r,s)});default:return i(r)&&i(n)?t:i(r)?c(function(s){return e(s,n)}):i(n)?c(function(s){return e(r,s)}):e(r,n)}}}function d(e){return function t(r,n,s){switch(arguments.length){case 0:return t;case 1:return i(r)?t:l(function(o,u){return e(r,o,u)});case 2:return i(r)&&i(n)?t:i(r)?l(function(o,u){return e(o,n,u)}):i(n)?l(function(o,u){return e(r,o,u)}):c(function(o){return e(r,n,o)});default:return i(r)&&i(n)&&i(s)?t:i(r)&&i(n)?l(function(o,u){return e(o,u,s)}):i(r)&&i(s)?l(function(o,u){return e(o,n,u)}):i(n)&&i(s)?l(function(o,u){return e(r,o,u)}):i(r)?c(function(o){return e(o,n,s)}):i(n)?c(function(o){return e(r,o,s)}):i(s)?c(function(o){return e(r,n,o)}):e(r,n,s)}}}function m(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var K=c(function(t){return t==null}),P=K;function f(e){return Object.prototype.toString.call(e)==="[object Object]"}var W=d(function(t,r,n){var s={},o;for(o in r)m(o,r)&&(s[o]=m(o,n)?t(o,r[o],n[o]):r[o]);for(o in n)m(o,n)&&!m(o,s)&&(s[o]=n[o]);return s}),C=W;var q=d(function e(t,r,n){return C(function(s,o,u){return f(o)&&f(u)?e(t,o,u):t(s,o,u)},r,n)}),O=q;var z=l(function(t,r){return O(function(n,s,o){return o},t,r)}),H=z;var I=(e,t)=>P(t)?e:H(e,t);var J="application/json",g,y=[],D={"Content-Type":J},a={headers:{...D},credentials:"include",mode:"cors"},Ae=e=>g=e,Se=()=>g,Ve=e=>{y.push(e)},ke=()=>y,Qe=e=>{a={...a,...e}},Ke=()=>a,We=e=>{a={...a,headers:{...a.headers,...e}}},qe=()=>a==null?void 0:a.headers,ze=e=>{(a==null?void 0:a.headers[e])&&delete a.headers[e]},Je=()=>{a={...a,headers:{...D}}},Be=async(e,t,r)=>{let n=await fetch(w(g,e,r),I(t,a)),s=await j(n);return await N(s,y)};console.log("@uxland/fetch-client loaded");})(); | ||
/* | ||
@@ -3,0 +3,0 @@ * @license |
{ | ||
"name": "@uxland/fetch-client", | ||
"version": "1.0.1-alpha.6", | ||
"version": "1.0.1-alpha.7", | ||
"description": "Fetch Client", | ||
@@ -8,8 +8,8 @@ "author": "UXLand <dev@uxland.es>", | ||
"license": "BSD-4-Clause", | ||
"main": "lib/index", | ||
"module": "es/index.js", | ||
"main": "index", | ||
"module": "index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"!*.config.js", | ||
"lib", | ||
"es", | ||
"dist", | ||
@@ -79,6 +79,6 @@ "README.md", | ||
"dependencies": { | ||
"@uxland/event-aggregator": "^1.0.1-alpha.6", | ||
"@uxland/event-aggregator": "^1.0.1-alpha.7", | ||
"ramda": "^0.27.1" | ||
}, | ||
"gitHead": "d0e4f243bb8418d9c57643b400048588f7338bd2" | ||
"gitHead": "4307c36b1f61b166f41bb0be99ee370862978977" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23022
1