Comparing version 0.5.0 to 0.5.1
@@ -1,1 +0,1 @@ | ||
import{merge as t,trimUndefined as e,encodeParams as r,XiorTimeoutError as n,anySignal as i,isAbsoluteURL as s,joinPath as o,XiorError as a}from"xior/utils";export*from"xior/utils";function u(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(t){r(t);return}a.done?e(u):Promise.resolve(u).then(n,i)}function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let c="application/",h=`${c}x-www-form-urlencoded`,f=`${c}json`;function p(){var n;return n=function*(n){let i=n.paramsSerializer||r,s=!1!==n.encodeURI,o=n.method?n.method.toUpperCase():"GET",a=n.url||"",u=a,c=n.data,p=c,d=(null==n?void 0:n.headers)||{},y=n.params||{},m=function(t="GET"){return["HEAD","GET","OPTIONS"].includes(t)}(o);if(c&&!(c instanceof FormData)){let r="";if(null==n?void 0:n.headers){let t=Object.keys(n.headers).find(t=>"content-type"===t.toLowerCase());t&&(r=n.headers[t],n.headers["Content-Type"]=r,"Content-Type"!==t&&delete n.headers[t])}r||(r=m?h:f,d["Content-Type"]=r),m&&n.params&&(y=t({},c||{},y)),r===f?p=JSON.stringify(e(c)):!m&&r===h&&c&&"object"==typeof c&&(p=i(c))}if(Object.keys(y).length>0){let t=i(y,s);a+=a.includes("?")?`&${t}`:`?${t}`}return l({},n,{_data:p,_url:a,data:c,url:u,method:o,headers:d,isGet:m})},(p=function(){var t=this,e=arguments;return new Promise(function(r,i){var s=n.apply(t,e);function o(t){u(s,r,i,o,a,"next",t)}function a(t){u(s,r,i,o,a,"throw",t)}o(void 0)})}).apply(this,arguments)}function d(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(t){r(t);return}a.done?e(u):Promise.resolve(u).then(n,i)}function y(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(t){d(s,n,i,o,a,"next",t)}function a(t){d(s,n,i,o,a,"throw",t)}o(void 0)})}}function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let v=void 0,E=typeof AbortController!=`${v}`;function P(){return(P=y(function*(t,e){let r;if(!e||!t.ok||["text","json"].includes(e)){if((r=yield t.text())&&"text"!==e)try{r=JSON.parse(r)}catch(t){}}else if("blob"===e)return t.blob();else if("arraybuffer"===e)return t.arrayBuffer();return r})).apply(this,arguments)}class b{static create(t){return new b(t)}get interceptors(){return{request:{use:(t,e,r)=>(this.REQI.push(t),t),eject:t=>{this.REQI=this.REQI.filter(e=>e!==t)},clear:()=>{this.REQI=[]}},response:{use:(t,e)=>(this.RESI.push({fn:t,onRejected:e}),t),eject:t=>{this.RESI=this.RESI.filter(e=>e.fn!==t)},clear:()=>{this.RESI=[]}}}}get plugins(){return{use:t=>(this.P.push(t),t),eject:t=>{this.P=this.P.filter(e=>e!==t)},clear:()=>{this.P=[]}}}request(e){var n=this;return y(function*(){let i=t({},n.config||{},n.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});for(let t of(i.paramsSerializer||(i.paramsSerializer=r),n.REQI))i=yield t(i);let s=n.fetch.bind(n);return n.P.forEach(t=>{s=t(s,n)}),s(i)})()}fetch(t){var e=this;return y(function*(){let r;let u=yield function(t){return p.apply(this,arguments)}(t),{url:l,method:c,headers:h,timeout:f,signal:d,data:b,_data:g,_url:O,isGet:R}=u,I=function(t,e){if(null==t)return{};var r,n,i={},s=Object.keys(t);for(n=0;n<s.length;n++)e.indexOf(r=s[n])>=0||(i[r]=t[r]);return i}(u,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);t._url=O;let T=[],S=v;if(f&&E){let e=new AbortController;S=setTimeout(()=>{e.abort(new n(`timeout of ${f}ms exceeded`,t))},f),T.push(e.signal)}d&&T.push(d),r=T[0],T.length>1&&(r=i(T,()=>{clearTimeout(S)}));let j=O||l||"";t.baseURL&&!s(j)&&(j=o(t.baseURL,j));let w=0,x=fetch(j,m({body:R?v:g},I,{signal:r,method:c,headers:h})).then(y(function*(e){let{responseType:r}=t,n={data:yield function(t,e){return P.apply(this,arguments)}(e,r),response:e,config:t,request:t,status:e.status,statusText:e.statusText,headers:e.headers};return e.ok?n:Promise.reject(new a(e.status?`Request failed with status code ${e.status}`:"Network error",t,n))})).finally(()=>{var t;S&&clearTimeout(S),null==r||null==(t=r.clear)||t.call(r)}),G=[];for(e.RESI.forEach(function(t){G.push(t.fn,t.onRejected)});G.length>w;)x=x.then(G[w++],G[w++]);return x})()}cG(t){return(e,r)=>this.request(r?m({},r,{method:t,url:e}):{method:t,url:e})}cP(t){return(e,r,n)=>this.request(n?m({},n,{method:t,url:e,data:r}):{method:t,url:e,data:r})}get(t,e){return this.cG("GET")(t,e)}head(t,e){return this.cG("HEAD")(t,e)}post(t,e,r){return this.cP("POST")(t,e,r)}put(t,e,r){return this.cP("PUT")(t,e,r)}patch(t,e,r){return this.cP("PATCH")(t,e,r)}delete(t,e){return this.cG("DELETE")(t,e)}options(t,e){return this.cG("OPTIONS")(t,e)}constructor(t){this.REQI=[],this.RESI=[],this.P=[],this.config=t,this.defaults={params:{},headers:{}}}}b.VERSION="0.5.0";let g=Object.assign(b.create(),{create:b.create,VERSION:b.VERSION});export{b as Xior,g as default}; | ||
import{merge as t,trimUndefined as e,encodeParams as r,XiorTimeoutError as n,anySignal as i,isAbsoluteURL as s,joinPath as a,XiorError as o}from"xior/utils";export*from"xior/utils";function u(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){r(t);return}o.done?e(u):Promise.resolve(u).then(n,i)}function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let c="application/",h=`${c}x-www-form-urlencoded`,f=`${c}json`;function p(){var n;return n=function*(n){let i=n.paramsSerializer||r,s=!1!==n.encodeURI,a=n.method?n.method.toUpperCase():"GET",o=n.url||"",u=o,c=n.data,p=c,d=(null==n?void 0:n.headers)||{},y=n.params||{},m=function(t="GET"){return["HEAD","GET","OPTIONS"].includes(t)}(a);if(c&&!(c instanceof FormData)){let r="";if(null==n?void 0:n.headers){let t=Object.keys(n.headers).find(t=>"content-type"===t.toLowerCase());t&&(r=n.headers[t],n.headers["Content-Type"]=r,"Content-Type"!==t&&delete n.headers[t])}r||(r=m?h:f,d["Content-Type"]=r),m&&n.params&&(y=t({},c||{},y)),r===f?p=JSON.stringify(e(c)):!m&&r===h&&c&&"object"==typeof c&&(p=i(c))}if(Object.keys(y).length>0){let t=i(y,s);o+=o.includes("?")?`&${t}`:`?${t}`}return l({},n,{_data:p,_url:o,data:c,url:u,method:a,headers:d,isGet:m})},(p=function(){var t=this,e=arguments;return new Promise(function(r,i){var s=n.apply(t,e);function a(t){u(s,r,i,a,o,"next",t)}function o(t){u(s,r,i,a,o,"throw",t)}a(void 0)})}).apply(this,arguments)}function d(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){r(t);return}o.done?e(u):Promise.resolve(u).then(n,i)}function y(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function a(t){d(s,n,i,a,o,"next",t)}function o(t){d(s,n,i,a,o,"throw",t)}a(void 0)})}}function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}let v=void 0,E=typeof AbortController!=`${v}`;function P(){return(P=y(function*(t,e){let r;if(!e||!t.ok||["text","json"].includes(e)){if((r=yield t.text())&&"text"!==e)try{r=JSON.parse(r)}catch(t){}}else if("blob"===e)return t.blob();else if("arraybuffer"===e)return t.arrayBuffer();return r})).apply(this,arguments)}class b{static create(t){return new b(t)}get interceptors(){return{request:{use:(t,e,r)=>(this.REQI.push(t),t),eject:t=>{this.REQI=this.REQI.filter(e=>e!==t)},clear:()=>{this.REQI=[]}},response:{use:(t,e)=>(this.RESI.push({fn:t,onRejected:e}),t),eject:t=>{this.RESI=this.RESI.filter(e=>e.fn!==t)},clear:()=>{this.RESI=[]}}}}get plugins(){return{use:t=>(this.P.push(t),t),eject:t=>{this.P=this.P.filter(e=>e!==t)},clear:()=>{this.P=[]}}}request(e){var n=this;return y(function*(){let i=t({},n.config||{},n.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});for(let t of(i.withCredentials&&!i.credentials&&(i.credentials="include"),i.paramsSerializer||(i.paramsSerializer=r),n.REQI))i=yield t(i);let s=n.fetch.bind(n);return n.P.forEach(t=>{s=t(s,n)}),s(i)})()}fetch(t){var e=this;return y(function*(){let r;let u=yield function(t){return p.apply(this,arguments)}(t),{url:l,method:c,headers:h,timeout:f,signal:d,data:b,_data:g,_url:O,isGet:R}=u,I=function(t,e){if(null==t)return{};var r,n,i={},s=Object.keys(t);for(n=0;n<s.length;n++)e.indexOf(r=s[n])>=0||(i[r]=t[r]);return i}(u,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);t._url=O;let T=[],w=v;if(f&&E){let e=new AbortController;w=setTimeout(()=>{e.abort(new n(`timeout of ${f}ms exceeded`,t))},f),T.push(e.signal)}d&&T.push(d),r=T[0],T.length>1&&(r=i(T,()=>{clearTimeout(w)}));let S=O||l||"";t.baseURL&&!s(S)&&(S=a(t.baseURL,S));let j=0,x=fetch(S,m({body:R?v:g},I,{signal:r,method:c,headers:h})).then(y(function*(e){let{responseType:r}=t,n={data:yield function(t,e){return P.apply(this,arguments)}(e,r),response:e,config:t,request:t,status:e.status,statusText:e.statusText,headers:e.headers};return e.ok?n:Promise.reject(new o(e.status?`Request failed with status code ${e.status}`:"Network error",t,n))})).finally(()=>{var t;w&&clearTimeout(w),null==r||null==(t=r.clear)||t.call(r)}),G=[];for(e.RESI.forEach(function(t){G.push(t.fn,t.onRejected)});G.length>j;)x=x.then(G[j++],G[j++]);return x})()}cG(t){return(e,r)=>this.request(r?m({},r,{method:t,url:e}):{method:t,url:e})}cP(t){return(e,r,n)=>this.request(n?m({},n,{method:t,url:e,data:r}):{method:t,url:e,data:r})}get(t,e){return this.cG("GET")(t,e)}head(t,e){return this.cG("HEAD")(t,e)}post(t,e,r){return this.cP("POST")(t,e,r)}put(t,e,r){return this.cP("PUT")(t,e,r)}patch(t,e,r){return this.cP("PATCH")(t,e,r)}delete(t,e){return this.cG("DELETE")(t,e)}options(t,e){return this.cG("OPTIONS")(t,e)}constructor(t){this.REQI=[],this.RESI=[],this.P=[],this.config=t,this.defaults={params:{},headers:{}}}}b.VERSION="0.5.1";let g=Object.assign(b.create(),{create:b.create,VERSION:b.VERSION});export{b as Xior,g as default}; |
@@ -22,2 +22,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -24,0 +25,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xior=t():e.xior=t()}(this,(()=>{return e={699:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function o(e){r.abort(e),i()}const n=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){o(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{o(t.reason)};n.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},509:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const i=r(895);n(r(895),t),n(r(340),t),n(r(121),t);const s=Object.assign(i.Xior.create(),{create:i.Xior.create,VERSION:i.Xior.VERSION});t.default=s},393:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.likeGET=void 0;const n=r(121),i=r(976),s="application/",u=`${s}x-www-form-urlencoded`,a=`${s}json`;function c(e="GET"){return["HEAD","GET","OPTIONS"].includes(e)}t.likeGET=c,t.default=function(e){return o(this,void 0,void 0,(function*(){const t=e.paramsSerializer||n.encodeParams,r=!1!==e.encodeURI,o=e.method?e.method.toUpperCase():"GET";let s=e.url||"";const l=s,d=e.data;let f=d;const h=(null==e?void 0:e.headers)||{};let p=e.params||{};const y=c(o);if(d&&!(d instanceof FormData)){let r="";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>"content-type"===e.toLowerCase()));t&&(r=e.headers[t],e.headers["Content-Type"]=r,"Content-Type"!==t&&delete e.headers[t])}r||(r=y?u:a,h["Content-Type"]=r),y&&e.params&&(p=(0,n.merge)({},d||{},p)),r===a?f=JSON.stringify((0,i.trimUndefined)(d)):!y&&r===u&&d&&"object"==typeof d&&(f=t(d))}if(Object.keys(p).length>0){const e=t(p,r);s+=s.includes("?")?`&${e}`:`?${e}`}return Object.assign(Object.assign({},e),{_data:f,_url:s,data:d,url:l,method:o,headers:h,isGet:y})}))}},729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const o=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return o.merge}})},629:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let o=t?r(t):"";o&&(o=e+(e.includes("?")?"&":"?")+o);const[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e}},99:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const n=o(r(629));t.buildSortedURL=n.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},340:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},976:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isXiorError=t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.trimUndefined=t.encodeParams=void 0,n(r(699),t),n(r(729),t),n(r(99),t);const i=void 0;t.encodeParams=function e(t,r=!0,o=null){if(t===i||null===t)return"";const n=[],s=r?encodeURIComponent:e=>e;for(const u in t)if(Object.prototype.hasOwnProperty.call(t,u)){const a=t[u];if(a!==i){const t=o?`${o}[${s(u)}]`:s(u);if("object"==typeof a){const o=e(a,r,t);""!==o&&n.push(o)}else Array.isArray(a)?a.forEach(((e,r)=>{const o=`${t}[${r}]`;n.push(`${s(o)}=${s(e)}`)})):n.push(`${s(t)}=${s(a)}`)}}return n.join("&")},t.trimUndefined=function e(t){return Array.isArray(t)?t.map(e):(t&&"object"==typeof t&&Object.keys(t).forEach((r=>{const o=t[r];if(o!==i)return e(o);delete t[r]})),t)},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+("/"===t[0]?t.slice(1):t):e};class s extends Error{constructor(e,t,r){super(e),this.name="XiorError",this.request=t,this.config=t,this.response=r}}t.XiorError=s,t.XiorTimeoutError=class extends s{constructor(e,t,r){super(e),this.name="XiorTimeoutError",this.request=t,this.config=t,this.response=r}},t.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name}},895:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function u(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((o=o.apply(e,t||[])).next())}))},n=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Xior=void 0;const s=r(121),u=i(r(393)),a=void 0,c="undefined"!=typeof AbortController;class l{static create(e){return new l(e)}constructor(e){this.REQI=[],this.RESI=[],this.P=[],this.config=e,this.defaults={params:{},headers:{}}}get interceptors(){return{request:{use:(e,t,r)=>(this.REQI.push(e),e),eject:e=>{this.REQI=this.REQI.filter((t=>t!==e))},clear:()=>{this.REQI=[]}},response:{use:(e,t)=>(this.RESI.push({fn:e,onRejected:t}),e),eject:e=>{this.RESI=this.RESI.filter((t=>t.fn!==e))},clear:()=>{this.RESI=[]}}}}get plugins(){return{use:e=>(this.P.push(e),e),eject:e=>{this.P=this.P.filter((t=>t!==e))},clear:()=>{this.P=[]}}}request(e){return o(this,void 0,void 0,(function*(){let t=(0,s.merge)({},this.config||{},this.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});t.paramsSerializer||(t.paramsSerializer=s.encodeParams);for(const e of this.REQI)t=yield e(t);let r=this.fetch.bind(this);return this.P.forEach((e=>{r=e(r,this)})),r(t)}))}fetch(e){return o(this,void 0,void 0,(function*(){const t=yield(0,u.default)(e),{url:r,method:i,headers:l,timeout:d,signal:f,data:h,_data:p,_url:y,isGet:b}=t,m=n(t,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);let v;e._url=y;const g=[];let j=a;if(d&&c){const t=new AbortController;j=setTimeout((()=>{t.abort(new s.XiorTimeoutError(`timeout of ${d}ms exceeded`,e))}),d),g.push(t.signal)}f&&g.push(f),v=g[0],g.length>1&&(v=(0,s.anySignal)(g,(()=>{clearTimeout(j)})));let O=y||r||"";e.baseURL&&!(0,s.isAbsoluteURL)(O)&&(O=(0,s.joinPath)(e.baseURL,O));let E=0,_=fetch(O,Object.assign(Object.assign({body:b?a:p},m),{signal:v,method:i,headers:l})).then((t=>o(this,void 0,void 0,(function*(){const{responseType:r}=e,n=yield function(e,t){return o(this,void 0,void 0,(function*(){let r;if(t&&e.ok&&!["text","json"].includes(t)){if("blob"===t)return e.blob();if("arraybuffer"===t)return e.arrayBuffer()}else if(r=yield e.text(),r&&"text"!==t)try{r=JSON.parse(r)}catch(e){}return r}))}(t,r),i={data:n,response:t,config:e,request:e,status:t.status,statusText:t.statusText,headers:t.headers};if(!t.ok){const r=new s.XiorError(t.status?`Request failed with status code ${t.status}`:"Network error",e,i);return Promise.reject(r)}return i})))).finally((()=>{var e;j&&clearTimeout(j),null===(e=null==v?void 0:v.clear)||void 0===e||e.call(v)}));const P=[];for(this.RESI.forEach((function(e){P.push(e.fn,e.onRejected)}));P.length>E;)_=_.then(P[E++],P[E++]);return _}))}cG(e){return(t,r)=>this.request(r?Object.assign(Object.assign({},r),{method:e,url:t}):{method:e,url:t})}cP(e){return(t,r,o)=>this.request(o?Object.assign(Object.assign({},o),{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.cG("GET")(e,t)}head(e,t){return this.cG("HEAD")(e,t)}post(e,t,r){return this.cP("POST")(e,t,r)}put(e,t,r){return this.cP("PUT")(e,t,r)}patch(e,t,r){return this.cP("PATCH")(e,t,r)}delete(e,t){return this.cG("DELETE")(e,t)}options(e,t){return this.cG("OPTIONS")(e,t)}}t.Xior=l,l.VERSION="0.5.0"},602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,o)=>{if(Array.isArray(o))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(o).forEach((n=>{["__proto__","constructor","prototype"].includes(n)||(Array.isArray(e[n])&&Array.isArray(o[n])?e[n]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[n].concat(o[n]))):[...e[n],...o[n]]:o[n]:r(e[n])&&r(o[n])?e[n]=(0,t.merge)(e[n],o[n]):e[n]=void 0===o[n]?t.merge.options.allowUndefinedOverrides?o[n]:e[n]:o[n])})),e}),{});const o={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=o,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},o),e);const n=(0,t.merge)(...r);return t.merge.options=o,n}},121:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var o=r(602);const n=void 0;class i extends Error{constructor(e,t,r){super(e),this.name="XiorError",this.request=t,this.config=t,this.response=r}}Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return o.merge}}),t.XiorError=i,t.XiorTimeoutError=class extends i{constructor(e,t,r){super(e),this.name="XiorTimeoutError",this.request=t,this.config=t,this.response=r}},t.anySignal=function(e,t){let r=new globalThis.AbortController;function o(e){r.abort(e),i()}let n=[];for(let t of e){if(!0===(null==t?void 0:t.aborted)){o(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){let e=()=>{o(t.reason)};n.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==t||t()}let s=r.signal;return s.clear=i,s},t.buildSortedURL=function(e,t,r){let o=t?r(t):"";o&&(o=e+(e.includes("?")?"&":"?")+o);let[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e},t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))},t.encodeParams=function e(t,r=!0,o=null){if(t===n||null===t)return"";let i=[],s=r?encodeURIComponent:e=>e;for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let a=t[u];if(a!==n){let t=o?`${o}[${s(u)}]`:s(u);if("object"==typeof a){let o=e(a,r,t);""!==o&&i.push(o)}else Array.isArray(a)?a.forEach(((e,r)=>{let o=`${t}[${r}]`;i.push(`${s(o)}=${s(e)}`)})):i.push(`${s(t)}=${s(a)}`)}}return i.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+("/"===t[0]?t.slice(1):t):e},t.trimUndefined=function e(t){return Array.isArray(t)?t.map(e):(t&&"object"==typeof t&&Object.keys(t).forEach((r=>{let o=t[r];if(o!==n)return e(o);delete t[r]})),t)}}},t={},function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}(509).default;var e,t})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xior=t():e.xior=t()}(this,(()=>{return e={699:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.anySignal=void 0,t.anySignal=function(e,t){const r=new globalThis.AbortController;function n(e){r.abort(e),i()}const o=[];for(const t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){const e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){o.forEach((e=>{e()})),null==t||t()}const s=r.signal;return s.clear=i,s}},509:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});const i=r(895);o(r(895),t),o(r(340),t),o(r(121),t);const s=Object.assign(i.Xior.create(),{create:i.Xior.create,VERSION:i.Xior.VERSION});t.default=s},393:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.likeGET=void 0;const o=r(121),i=r(976),s="application/",u=`${s}x-www-form-urlencoded`,a=`${s}json`;function c(e="GET"){return["HEAD","GET","OPTIONS"].includes(e)}t.likeGET=c,t.default=function(e){return n(this,void 0,void 0,(function*(){const t=e.paramsSerializer||o.encodeParams,r=!1!==e.encodeURI,n=e.method?e.method.toUpperCase():"GET";let s=e.url||"";const l=s,d=e.data;let f=d;const h=(null==e?void 0:e.headers)||{};let p=e.params||{};const y=c(n);if(d&&!(d instanceof FormData)){let r="";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>"content-type"===e.toLowerCase()));t&&(r=e.headers[t],e.headers["Content-Type"]=r,"Content-Type"!==t&&delete e.headers[t])}r||(r=y?u:a,h["Content-Type"]=r),y&&e.params&&(p=(0,o.merge)({},d||{},p)),r===a?f=JSON.stringify((0,i.trimUndefined)(d)):!y&&r===u&&d&&"object"==typeof d&&(f=t(d))}if(Object.keys(p).length>0){const e=t(p,r);s+=s.includes("?")?`&${e}`:`?${e}`}return Object.assign(Object.assign({},e),{_data:f,_url:s,data:d,url:l,method:n,headers:h,isGet:y})}))}},729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const n=r(602);Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}})},629:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=t?r(t):"";n&&(n=e+(e.includes("?")?"&":"?")+n);const[o,i]=n.split("?");return i?`${o}?${i.split("&").sort().join("&")}`:n||e}},99:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.delay=t.buildSortedURL=void 0;const o=n(r(629));t.buildSortedURL=o.default,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))}},340:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},976:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isXiorError=t.XiorTimeoutError=t.XiorError=t.joinPath=t.isAbsoluteURL=t.trimUndefined=t.encodeParams=void 0,o(r(699),t),o(r(729),t),o(r(99),t);const i=void 0;t.encodeParams=function e(t,r=!0,n=null){if(t===i||null===t)return"";const o=[],s=r?encodeURIComponent:e=>e;for(const u in t)if(Object.prototype.hasOwnProperty.call(t,u)){const a=t[u];if(a!==i){const t=n?`${n}[${s(u)}]`:s(u);if("object"==typeof a){const n=e(a,r,t);""!==n&&o.push(n)}else Array.isArray(a)?a.forEach(((e,r)=>{const n=`${t}[${r}]`;o.push(`${s(n)}=${s(e)}`)})):o.push(`${s(t)}=${s(a)}`)}}return o.join("&")},t.trimUndefined=function e(t){return Array.isArray(t)?t.map(e):(t&&"object"==typeof t&&Object.keys(t).forEach((r=>{const n=t[r];if(n!==i)return e(n);delete t[r]})),t)},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+("/"===t[0]?t.slice(1):t):e};class s extends Error{constructor(e,t,r){super(e),this.name="XiorError",this.request=t,this.config=t,this.response=r}}t.XiorError=s,t.XiorTimeoutError=class extends s{constructor(e,t,r){super(e),this.name="XiorTimeoutError",this.request=t,this.config=t,this.response=r}},t.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name}},895:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Xior=void 0;const s=r(121),u=i(r(393)),a=void 0,c="undefined"!=typeof AbortController;class l{static create(e){return new l(e)}constructor(e){this.REQI=[],this.RESI=[],this.P=[],this.config=e,this.defaults={params:{},headers:{}}}get interceptors(){return{request:{use:(e,t,r)=>(this.REQI.push(e),e),eject:e=>{this.REQI=this.REQI.filter((t=>t!==e))},clear:()=>{this.REQI=[]}},response:{use:(e,t)=>(this.RESI.push({fn:e,onRejected:t}),e),eject:e=>{this.RESI=this.RESI.filter((t=>t.fn!==e))},clear:()=>{this.RESI=[]}}}}get plugins(){return{use:e=>(this.P.push(e),e),eject:e=>{this.P=this.P.filter((t=>t!==e))},clear:()=>{this.P=[]}}}request(e){return n(this,void 0,void 0,(function*(){let t=(0,s.merge)({},this.config||{},this.defaults||{},"string"==typeof e?{url:e}:e||{},{headers:{},params:{}});t.withCredentials&&!t.credentials&&(t.credentials="include"),t.paramsSerializer||(t.paramsSerializer=s.encodeParams);for(const e of this.REQI)t=yield e(t);let r=this.fetch.bind(this);return this.P.forEach((e=>{r=e(r,this)})),r(t)}))}fetch(e){return n(this,void 0,void 0,(function*(){const t=yield(0,u.default)(e),{url:r,method:i,headers:l,timeout:d,signal:f,data:h,_data:p,_url:y,isGet:b}=t,m=o(t,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);let v;e._url=y;const g=[];let j=a;if(d&&c){const t=new AbortController;j=setTimeout((()=>{t.abort(new s.XiorTimeoutError(`timeout of ${d}ms exceeded`,e))}),d),g.push(t.signal)}f&&g.push(f),v=g[0],g.length>1&&(v=(0,s.anySignal)(g,(()=>{clearTimeout(j)})));let O=y||r||"";e.baseURL&&!(0,s.isAbsoluteURL)(O)&&(O=(0,s.joinPath)(e.baseURL,O));let E=0,_=fetch(O,Object.assign(Object.assign({body:b?a:p},m),{signal:v,method:i,headers:l})).then((t=>n(this,void 0,void 0,(function*(){const{responseType:r}=e,o=yield function(e,t){return n(this,void 0,void 0,(function*(){let r;if(t&&e.ok&&!["text","json"].includes(t)){if("blob"===t)return e.blob();if("arraybuffer"===t)return e.arrayBuffer()}else if(r=yield e.text(),r&&"text"!==t)try{r=JSON.parse(r)}catch(e){}return r}))}(t,r),i={data:o,response:t,config:e,request:e,status:t.status,statusText:t.statusText,headers:t.headers};if(!t.ok){const r=new s.XiorError(t.status?`Request failed with status code ${t.status}`:"Network error",e,i);return Promise.reject(r)}return i})))).finally((()=>{var e;j&&clearTimeout(j),null===(e=null==v?void 0:v.clear)||void 0===e||e.call(v)}));const P=[];for(this.RESI.forEach((function(e){P.push(e.fn,e.onRejected)}));P.length>E;)_=_.then(P[E++],P[E++]);return _}))}cG(e){return(t,r)=>this.request(r?Object.assign(Object.assign({},r),{method:e,url:t}):{method:e,url:t})}cP(e){return(t,r,n)=>this.request(n?Object.assign(Object.assign({},n),{method:e,url:t,data:r}):{method:e,url:t,data:r})}get(e,t){return this.cG("GET")(e,t)}head(e,t){return this.cG("HEAD")(e,t)}post(e,t,r){return this.cP("POST")(e,t,r)}put(e,t,r){return this.cP("PUT")(e,t,r)}patch(e,t,r){return this.cP("PATCH")(e,t,r)}delete(e,t){return this.cG("DELETE")(e,t)}options(e,t){return this.cG("OPTIONS")(e,t)}}t.Xior=l,l.VERSION="0.5.1"},602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.merge=void 0;const r=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}return"[object Object]"===Object.prototype.toString.call(e)}return!1};t.merge=(...e)=>e.reduce(((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach((o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(e[o])&&Array.isArray(n[o])?e[o]=t.merge.options.mergeArrays?t.merge.options.uniqueArrayItems?Array.from(new Set(e[o].concat(n[o]))):[...e[o],...n[o]]:n[o]:r(e[o])&&r(n[o])?e[o]=(0,t.merge)(e[o],n[o]):e[o]=void 0===n[o]?t.merge.options.allowUndefinedOverrides?n[o]:e[o]:n[o])})),e}),{});const n={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};t.merge.options=n,t.merge.withOptions=(e,...r)=>{t.merge.options=Object.assign(Object.assign({},n),e);const o=(0,t.merge)(...r);return t.merge.options=n,o}},121:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(602);const o=void 0;class i extends Error{constructor(e,t,r){super(e),this.name="XiorError",this.request=t,this.config=t,this.response=r}}Object.defineProperty(t,"merge",{enumerable:!0,get:function(){return n.merge}}),t.XiorError=i,t.XiorTimeoutError=class extends i{constructor(e,t,r){super(e),this.name="XiorTimeoutError",this.request=t,this.config=t,this.response=r}},t.anySignal=function(e,t){let r=new globalThis.AbortController;function n(e){r.abort(e),i()}let o=[];for(let t of e){if(!0===(null==t?void 0:t.aborted)){n(t.reason);break}if(null!=(null==t?void 0:t.addEventListener)){let e=()=>{n(t.reason)};o.push((()=>{null!=(null==t?void 0:t.removeEventListener)&&t.removeEventListener("abort",e)})),t.addEventListener("abort",e)}}function i(){o.forEach((e=>{e()})),null==t||t()}let s=r.signal;return s.clear=i,s},t.buildSortedURL=function(e,t,r){let n=t?r(t):"";n&&(n=e+(e.includes("?")?"&":"?")+n);let[o,i]=n.split("?");return i?`${o}?${i.split("&").sort().join("&")}`:n||e},t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t("ok")}),e)}))},t.encodeParams=function e(t,r=!0,n=null){if(t===o||null===t)return"";let i=[],s=r?encodeURIComponent:e=>e;for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let a=t[u];if(a!==o){let t=n?`${n}[${s(u)}]`:s(u);if("object"==typeof a){let n=e(a,r,t);""!==n&&i.push(n)}else Array.isArray(a)?a.forEach(((e,r)=>{let n=`${t}[${r}]`;i.push(`${s(n)}=${s(e)}`)})):i.push(`${s(t)}=${s(a)}`)}}return i.join("&")},t.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},t.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name},t.joinPath=function(e,t){return t?(e.endsWith("/")?e:e+"/")+("/"===t[0]?t.slice(1):t):e},t.trimUndefined=function e(t){return Array.isArray(t)?t.map(e):(t&&"object"==typeof t&&Object.keys(t).forEach((r=>{let n=t[r];if(n!==o)return e(n);delete t[r]})),t)}}},t={},function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}(509).default;var e,t})); |
{ | ||
"name": "xior", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A lite request lib based on fetch with plugin support and similar API to axios.", | ||
@@ -5,0 +5,0 @@ "repository": "suhaotian/xior", |
@@ -88,2 +88,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -90,0 +91,0 @@ /** |
@@ -79,2 +79,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -81,0 +82,0 @@ /** |
@@ -88,2 +88,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -90,0 +91,0 @@ /** |
@@ -79,2 +79,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -81,0 +82,0 @@ /** |
@@ -79,2 +79,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -81,0 +82,0 @@ /** |
@@ -79,2 +79,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -81,0 +82,0 @@ /** |
@@ -88,2 +88,3 @@ import { XiorError } from 'xior/utils'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -90,0 +91,0 @@ /** |
@@ -102,3 +102,3 @@ [![Build](https://github.com/suhaotian/xior/actions/workflows/check.yml/badge.svg)](https://github.com/suhaotian/xior/actions/workflows/check.yml) | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
@@ -118,3 +118,3 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
@@ -566,5 +566,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/error-retry.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/error-retry.umd.js"></script> | ||
@@ -582,6 +582,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/error-retry.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/error-retry.umd.js"></script> | ||
@@ -679,5 +679,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/throttle.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/throttle.umd.js"></script> | ||
@@ -695,6 +695,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/throttle.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/throttle.umd.js"></script> | ||
@@ -754,5 +754,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/dedupe.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/dedupe.umd.js"></script> | ||
@@ -770,6 +770,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/dedupe.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/dedupe.umd.js"></script> | ||
@@ -836,5 +836,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/error-cache.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/error-cache.umd.js"></script> | ||
@@ -852,6 +852,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/error-cache.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/error-cache.umd.js"></script> | ||
@@ -1001,5 +1001,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/progress.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/progress.umd.js"></script> | ||
@@ -1017,6 +1017,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/progress.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/progress.umd.js"></script> | ||
@@ -1128,5 +1128,5 @@ <!-- Usage --> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.0/plugins/mock.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.1/plugins/mock.umd.js"></script> | ||
@@ -1144,6 +1144,6 @@ <!-- Usage --> | ||
```html | ||
<script src="https://unpkg.com/xior@0.5.0/dist/xior.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/dist/xior.umd.js"></script> | ||
<!-- Load plugin --> | ||
<script src="https://unpkg.com/xior@0.5.0/plugins/mock.umd.js"></script> | ||
<script src="https://unpkg.com/xior@0.5.1/plugins/mock.umd.js"></script> | ||
@@ -1150,0 +1150,0 @@ <!-- Usage --> |
@@ -21,2 +21,3 @@ export { merge } from 'ts-deepmerge'; | ||
_url?: string; | ||
/** @deprecated if `true`, will set `credentials=true`, or you can just use fetch's config `credentials: 'include' | 'omit' | 'same-origin'` */ | ||
withCredentials?: boolean; | ||
@@ -23,0 +24,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
251932
1527