Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xior

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xior - npm Package Compare versions

Comparing version 0.5.5 to 0.6.0

2

dist/index.esm.js

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

import{merge as t,encodeParams as e,XiorTimeoutError as r,anySignal as n,isAbsoluteURL as i,joinPath as s,XiorError as a}from"xior/utils";export*from"xior/utils";import{trimUndefined as o}from"../utils/index.mjs";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/",f=`${c}x-www-form-urlencoded`,h=`${c}json`,d="undefined"!=typeof URLSearchParams;function p(){var r;return r=function*(r){let n=r.paramsSerializer||e,i=!1!==r.encodeURI,s=r.method?r.method.toUpperCase():"GET",a=r.url||"",u=a,c=d&&r.data&&r.data instanceof URLSearchParams,p=c?Object.fromEntries(r.data):r.data,m=p,y=(null==r?void 0:r.headers)||{},E=r.params||{},v=function(t="GET"){return["HEAD","GET","OPTIONS"].includes(t)}(s);if(p&&!(p instanceof FormData)){let e="",i="content-type";if(null==r?void 0:r.headers){let t=Object.keys(r.headers).find(t=>t.toLowerCase()===i);t&&(i=t,e=r.headers[t])}(!e||c)&&(e=v||c?f:h,y[i]=e),"object"!=typeof p||(v&&r.params&&(E=t({},p||{},E)),e===h?m=JSON.stringify(o(p)):v||e!==f||(m=n(p)))}if(Object.keys(E).length>0){let t=n(E,i);a+=a.includes("?")?`&${t}`:`?${t}`}return l({},r,{_data:m,_url:a,data:p,url:u,method:s,headers:y,isGet:v})},(p=function(){var t=this,e=arguments;return new Promise(function(n,i){var s=r.apply(t,e);function a(t){u(s,n,i,a,o,"next",t)}function o(t){u(s,n,i,a,o,"throw",t)}a(void 0)})}).apply(this,arguments)}function m(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){m(s,n,i,a,o,"next",t)}function o(t){m(s,n,i,a,o,"throw",t)}a(void 0)})}}function E(){return(E=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,P=typeof AbortController!=`${v}`;function b(){return(b=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 O{static create(t){return new O(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(r){var n=this;return y(function*(){let i=t({},n.config||{},n.defaults||{},"string"==typeof r?{url:r}:r||{},{headers:{},params:{}});for(let t of(i.withCredentials&&!i.credentials&&(i.credentials="include"),i.paramsSerializer||(i.paramsSerializer=e),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 o;let u=yield function(t){return p.apply(this,arguments)}(t),{url:l,method:c,headers:f,timeout:h,signal:d,data:m,_data:O,_url:R,isGet:g}=u,S=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=R;let j=[],I=v;if(h&&P){let e=new AbortController;I=setTimeout(()=>{e.abort(new r(`timeout of ${h}ms exceeded`,t))},h),j.push(e.signal)}d&&j.push(d),o=j[0],j.length>1&&(o=n(j,()=>{clearTimeout(I)}));let w=R||l||"";t.baseURL&&!i(w)&&(w=s(t.baseURL,w));let x=0,T=fetch(w,E({body:g?v:O},S,{signal:o,method:c,headers:f})).then(y(function*(e){let{responseType:r}=t,n={data:yield function(t,e){return b.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;I&&clearTimeout(I),null==o||null==(t=o.clear)||t.call(o)}),G=[];for(e.RESI.forEach(function(t){G.push(t.fn,t.onRejected)});G.length>x;)T=T.then(G[x++],G[x++]);return T})()}cG(t){return(e,r)=>this.request(r?E({},r,{method:t,url:e}):{method:t,url:e})}cP(t){return(e,r,n)=>this.request(n?E({},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:{}}}}O.VERSION="0.5.5";let R=Object.assign(O.create(),{create:O.create,VERSION:O.VERSION});export{O as Xior,R as default};
import{merge as t,encodeParams as e,XiorTimeoutError as r,anySignal as n,isAbsoluteURL as i,joinPath as s,XiorError as a}from"xior/utils";export*from"xior/utils";import{trimUndefined as o}from"../utils/index.mjs";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/",f=`${c}x-www-form-urlencoded`,h=`${c}json`,d="undefined"!=typeof URLSearchParams;function p(){var r;return r=function*(r){let n=r.paramsSerializer||e,i=!1!==r.encodeURI,s=r.method?r.method.toUpperCase():"GET",a=r.url||"",u=a,c=d&&r.data&&r.data instanceof URLSearchParams,p=c?Object.fromEntries(r.data):r.data,m=p,y=(null==r?void 0:r.headers)||{},E=r.params||{},v=function(t="GET"){return["HEAD","GET","OPTIONS"].includes(t)}(s);if(p&&!(p instanceof FormData)){let e="",i="content-type";if(null==r?void 0:r.headers){let t=Object.keys(r.headers).find(t=>t.toLowerCase()===i);t&&(i=t,e=r.headers[t])}(!e||c)&&(e=v||c?f:h,y[i]=e),"object"!=typeof p||(v&&r.params&&(E=t({},p||{},E)),e===h?m=JSON.stringify(o(p)):v||e!==f||(m=n(p)))}if(Object.keys(E).length>0){let t=n(E,i);a+=a.includes("?")?`&${t}`:`?${t}`}return l({},r,{_data:m,_url:a,data:p,url:u,method:s,headers:y,isGet:v})},(p=function(){var t=this,e=arguments;return new Promise(function(n,i){var s=r.apply(t,e);function a(t){u(s,n,i,a,o,"next",t)}function o(t){u(s,n,i,a,o,"throw",t)}a(void 0)})}).apply(this,arguments)}function m(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){m(s,n,i,a,o,"next",t)}function o(t){m(s,n,i,a,o,"throw",t)}a(void 0)})}}function E(){return(E=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,P=typeof AbortController!=`${v}`;function b(){return(b=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 O{static create(t){return new O(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(r){var n=this;return y(function*(){let i=t({},n.config||{},n.defaults||{},"string"==typeof r?{url:r}:r||{},{headers:{},params:{}});for(let t of(i.withCredentials&&!i.credentials&&(i.credentials="include"),i.paramsSerializer||(i.paramsSerializer=e),n.REQI))i=yield t(i);let s=n.fetch.bind(n);n.P.forEach(t=>{s=t(s,n)});let a=s(i),o=0,u=[];for(n.RESI.forEach(function(t){u.push(t.fn,t.onRejected)});u.length>o;)a=a.then(u[o++],u[o++]);return a})()}fetch(t){return y(function*(){let e;let o=yield function(t){return p.apply(this,arguments)}(t),{url:u,method:l,headers:c,timeout:f,signal:h,data:d,_data:m,_url:O,isGet:R}=o,g=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}(o,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);t._url=O;let S=[],j=v;if(f&&P){let e=new AbortController;j=setTimeout(()=>{e.abort(new r(`timeout of ${f}ms exceeded`,t))},f),S.push(e.signal)}h&&S.push(h),e=S[0],S.length>1&&(e=n(S,()=>{clearTimeout(j)}));let I=O||u;return t.baseURL&&!i(I)&&(I=s(t.baseURL,I)),fetch(I,E({body:R?v:m},g,{signal:e,method:l,headers:c})).then(y(function*(e){let{responseType:r}=t,n={data:yield function(t,e){return b.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;j&&clearTimeout(j),null==e||null==(t=e.clear)||t.call(e)})})()}cG(t){return(e,r)=>this.request(r?E({},r,{method:t,url:e}):{method:t,url:e})}cP(t){return(e,r,n)=>this.request(n?E({},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:{}}}}O.VERSION="0.6.0";let R=Object.assign(O.create(),{create:O.create,VERSION:O.VERSION});export{O as Xior,R as default};

@@ -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 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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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/",a=`${s}x-www-form-urlencoded`,u=`${s}json`;function c(e="GET"){return["HEAD","GET","OPTIONS"].includes(e)}t.likeGET=c;const l="undefined"!=typeof URLSearchParams;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 f=s,d=l&&e.data&&e.data instanceof URLSearchParams,h=d?Object.fromEntries(e.data):e.data;let p=h;const m=(null==e?void 0:e.headers)||{};let b=e.params||{};const y=c(n);if(h&&!(h instanceof FormData)){let r="",n="content-type";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>e.toLowerCase()===n));t&&(n=t,r=e.headers[t])}r&&!d||(r=y||d?a:u,m[n]=r),"object"==typeof h&&(y&&e.params&&(b=(0,o.merge)({},h||{},b)),r===u?p=JSON.stringify((0,i.trimUndefined)(h)):y||r!==a||(p=t(h)))}if(Object.keys(b).length>0){const e=t(b,r);s+=s.includes("?")?`&${e}`:`?${e}`}return Object.assign(Object.assign({},e),{_data:p,_url:s,data:h,url:f,method:n,headers:m,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,o){if(t===i||null===t)return"";const s=[],a=r?encodeURIComponent:e=>e,u=Array.isArray(t),{arrayFormat:c,allowDots:l,serializeDate:f}=o||{},d=e=>{if(l&&!u)return`.${e}`;if(u){if("brackets"===c)return"[]";if("repeat"===c)return""}return`[${e}]`};for(const u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let c=t[u];if(c!==i){const t=n?`${n}${d(u)}`:u;if(!isNaN(c)&&c instanceof Date&&(c=f?f(c):c.toISOString()),"object"==typeof c){const n=e(c,r,t,o);""!==n&&s.push(n)}else s.push(`${a(t)}=${a(c)}`)}}return s.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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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),a=i(r(393)),u=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,a.default)(e),{url:r,method:i,headers:l,timeout:f,signal:d,data:h,_data:p,_url:m,isGet:b}=t,y=o(t,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);let v;e._url=m;const g=[];let O=u;if(f&&c){const t=new AbortController;O=setTimeout((()=>{t.abort(new s.XiorTimeoutError(`timeout of ${f}ms exceeded`,e))}),f),g.push(t.signal)}d&&g.push(d),v=g[0],g.length>1&&(v=(0,s.anySignal)(g,(()=>{clearTimeout(O)})));let j=m||r||"";e.baseURL&&!(0,s.isAbsoluteURL)(j)&&(j=(0,s.joinPath)(e.baseURL,j));let E=0,_=fetch(j,Object.assign(Object.assign({body:b?u:p},y),{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;O&&clearTimeout(O),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.5"},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,i){if(t===o||null===t)return"";let s=[],a=r?encodeURIComponent:e=>e,u=Array.isArray(t),{arrayFormat:c,allowDots:l,serializeDate:f}=i||{},d=e=>{if(l&&!u)return`.${e}`;if(u){if("brackets"===c)return"[]";if("repeat"===c)return""}return`[${e}]`};for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let c=t[u];if(c!==o){let t=n?`${n}${d(u)}`:u;if(!isNaN(c)&&c instanceof Date&&(c=f?f(c):c.toISOString()),"object"==typeof c){let n=e(c,r,t,i);""!==n&&s.push(n)}else s.push(`${a(t)}=${a(c)}`)}}return s.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}));
!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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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/",a=`${s}x-www-form-urlencoded`,u=`${s}json`;function c(e="GET"){return["HEAD","GET","OPTIONS"].includes(e)}t.likeGET=c;const l="undefined"!=typeof URLSearchParams;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 f=s,d=l&&e.data&&e.data instanceof URLSearchParams,h=d?Object.fromEntries(e.data):e.data;let p=h;const m=(null==e?void 0:e.headers)||{};let b=e.params||{};const y=c(n);if(h&&!(h instanceof FormData)){let r="",n="content-type";if(null==e?void 0:e.headers){const t=Object.keys(e.headers).find((e=>e.toLowerCase()===n));t&&(n=t,r=e.headers[t])}r&&!d||(r=y||d?a:u,m[n]=r),"object"==typeof h&&(y&&e.params&&(b=(0,o.merge)({},h||{},b)),r===u?p=JSON.stringify((0,i.trimUndefined)(h)):y||r!==a||(p=t(h)))}if(Object.keys(b).length>0){const e=t(b,r);s+=s.includes("?")?`&${e}`:`?${e}`}return Object.assign(Object.assign({},e),{_data:p,_url:s,data:h,url:f,method:n,headers:m,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,o){if(t===i||null===t)return"";const s=[],a=r?encodeURIComponent:e=>e,u=Array.isArray(t),{arrayFormat:c,allowDots:l,serializeDate:f}=o||{},d=e=>{if(l&&!u)return`.${e}`;if(u){if("brackets"===c)return"[]";if("repeat"===c)return""}return`[${e}]`};for(const u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let c=t[u];if(c!==i){const t=n?`${n}${d(u)}`:u;if(!isNaN(c)&&c instanceof Date&&(c=f?f(c):c.toISOString()),"object"==typeof c){const n=e(c,r,t,o);""!==n&&s.push(n)}else s.push(`${a(t)}=${a(c)}`)}}return s.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{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((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),a=i(r(393)),u=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);this.P.forEach((e=>{r=e(r,this)}));let n=r(t),o=0;const i=[];for(this.RESI.forEach((function(e){i.push(e.fn,e.onRejected)}));i.length>o;)n=n.then(i[o++],i[o++]);return n}))}fetch(e){return n(this,void 0,void 0,(function*(){const t=yield(0,a.default)(e),{url:r,method:i,headers:l,timeout:f,signal:d,data:h,_data:p,_url:m,isGet:b}=t,y=o(t,["url","method","headers","timeout","signal","data","_data","_url","isGet"]);let v;e._url=m;const g=[];let O=u;if(f&&c){const t=new AbortController;O=setTimeout((()=>{t.abort(new s.XiorTimeoutError(`timeout of ${f}ms exceeded`,e))}),f),g.push(t.signal)}d&&g.push(d),v=g[0],g.length>1&&(v=(0,s.anySignal)(g,(()=>{clearTimeout(O)})));let j=m||r;return e.baseURL&&!(0,s.isAbsoluteURL)(j)&&(j=(0,s.joinPath)(e.baseURL,j)),fetch(j,Object.assign(Object.assign({body:b?u:p},y),{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;O&&clearTimeout(O),null===(e=null==v?void 0:v.clear)||void 0===e||e.call(v)}))}))}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.6.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,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,i){if(t===o||null===t)return"";let s=[],a=r?encodeURIComponent:e=>e,u=Array.isArray(t),{arrayFormat:c,allowDots:l,serializeDate:f}=i||{},d=e=>{if(l&&!u)return`.${e}`;if(u){if("brackets"===c)return"[]";if("repeat"===c)return""}return`[${e}]`};for(let u in t)if(Object.prototype.hasOwnProperty.call(t,u)){let c=t[u];if(c!==o){let t=n?`${n}${d(u)}`:u;if(!isNaN(c)&&c instanceof Date&&(c=f?f(c):c.toISOString()),"object"==typeof c){let n=e(c,r,t,i);""!==n&&s.push(n)}else s.push(`${a(t)}=${a(c)}`)}}return s.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.5",
"version": "0.6.0",
"description": "A lite request lib based on fetch with plugin support and similar API to axios.",

@@ -5,0 +5,0 @@ "repository": "suhaotian/xior",

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

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.xiorErrorRetry=r():e.xiorErrorRetry=r()}(this,(()=>{return e={351:function(e,r,t){"use strict";var o=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))((function(n,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(s,u)}c((o=o.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0});const n=t(121);r.default=function(e={}){const{retryTimes:r,retryInterval:t,enableRetry:i,onRetry:s}=Object.assign({retryTimes:2,retryInterval:3e3},e||{});return function(e,u){return c=>o(this,void 0,void 0,(function*(){const{retryTimes:a=r,retryInterval:l=t,enableRetry:f=i,onRetry:d=s}=c;let y=!1,p=0;return function r(t=!1){return o(this,void 0,void 0,(function*(){if(t&&(null==u?void 0:u.REQI))for(const e of u.REQI)c=yield e(c);try{return yield e(c)}catch(e){const t="GET"===c.method||Boolean(c.isGet),o=typeof f;let i;if("function"===o&&(i=f(c,e)),void 0===i&&(i="undefined"===o?t:Boolean(f)),y=a===p,y||!i)throw e;const s="function"==typeof l?l(p,c,e):l;return s&&s>0&&p>0&&(yield(0,n.delay)(s)),p++,d&&d(c,e,p),r(!0)}}))}()}))}}},602:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.merge=void 0;const t=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const r=Object.getPrototypeOf(e);return r===Object.prototype||null===r}return"[object Object]"===Object.prototype.toString.call(e)}return!1};r.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]=r.merge.options.mergeArrays?r.merge.options.uniqueArrayItems?Array.from(new Set(e[n].concat(o[n]))):[...e[n],...o[n]]:o[n]:t(e[n])&&t(o[n])?e[n]=(0,r.merge)(e[n],o[n]):e[n]=void 0===o[n]?r.merge.options.allowUndefinedOverrides?o[n]:e[n]:o[n])})),e}),{});const o={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};r.merge.options=o,r.merge.withOptions=(e,...t)=>{r.merge.options=Object.assign(Object.assign({},o),e);const n=(0,r.merge)(...t);return r.merge.options=o,n}},121:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var o=t(602);const n=void 0;class i extends Error{constructor(e,r,t){super(e),this.name="XiorError",this.request=r,this.config=r,this.response=t}}Object.defineProperty(r,"merge",{enumerable:!0,get:function(){return o.merge}}),r.XiorError=i,r.XiorTimeoutError=class extends i{constructor(e,r,t){super(e),this.name="XiorTimeoutError",this.request=r,this.config=r,this.response=t}},r.anySignal=function(e,r){let t=new globalThis.AbortController;function o(e){t.abort(e),i()}let n=[];for(let r of e){if(!0===(null==r?void 0:r.aborted)){o(r.reason);break}if(null!=(null==r?void 0:r.addEventListener)){let e=()=>{o(r.reason)};n.push((()=>{null!=(null==r?void 0:r.removeEventListener)&&r.removeEventListener("abort",e)})),r.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==r||r()}let s=t.signal;return s.clear=i,s},r.buildSortedURL=function(e,r,t){let o=r?t(r):"";o&&(o=e+(e.includes("?")?"&":"?")+o);let[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e},r.delay=function(e){return new Promise((r=>{setTimeout((()=>{r("ok")}),e)}))},r.encodeParams=function e(r,t=!0,o=null,i){if(r===n||null===r)return"";let s=[],u=t?encodeURIComponent:e=>e,c=Array.isArray(r),{arrayFormat:a,allowDots:l,serializeDate:f}=i||{},d=e=>{if(l&&!c)return`.${e}`;if(c){if("brackets"===a)return"[]";if("repeat"===a)return""}return`[${e}]`};for(let c in r)if(Object.prototype.hasOwnProperty.call(r,c)){let a=r[c];if(a!==n){let r=o?`${o}${d(c)}`:c;if(!isNaN(a)&&a instanceof Date&&(a=f?f(a):a.toISOString()),"object"==typeof a){let o=e(a,t,r,i);""!==o&&s.push(o)}else s.push(`${u(r)}=${u(a)}`)}}return s.join("&")},r.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},r.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name},r.joinPath=function(e,r){return r?(e.endsWith("/")?e:e+"/")+("/"===r[0]?r.slice(1):r):e},r.trimUndefined=function e(r){return Array.isArray(r)?r.map(e):(r&&"object"==typeof r&&Object.keys(r).forEach((t=>{let o=r[t];if(o!==n)return e(o);delete r[t]})),r)}}},r={},function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return e[o].call(i.exports,i,i.exports,t),i.exports}(351).default;var e,r}));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.xiorErrorRetry=r():e.xiorErrorRetry=r()}(this,(()=>{return e={351:function(e,r,t){"use strict";var o=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))((function(n,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function u(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(s,u)}c((o=o.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0});const n=t(121);r.default=function(e={}){const{retryTimes:r,retryInterval:t,enableRetry:i,onRetry:s}=Object.assign({retryTimes:2,retryInterval:3e3},e||{});return function(e,u){return c=>o(this,void 0,void 0,(function*(){const{retryTimes:l=r,retryInterval:a=t,enableRetry:f=i,onRetry:d=s}=c;let y=!1,p=0;return function r(t=!1){var i;return o(this,void 0,void 0,(function*(){if(t&&(null==u?void 0:u.REQI))for(const e of u.REQI)c=yield e(c);try{return yield e(c)}catch(e){const t="GET"===c.method||Boolean(c.isGet),o=typeof f;let s;if("function"===o&&(s=f(c,e)),void 0===s&&(s="undefined"===o?t:Boolean(f)),y=l===p,y||!s)throw e;const m="function"==typeof a?a(p,c,e):a;m&&m>0&&p>0&&(yield(0,n.delay)(m)),p++,d&&d(c,e,p);try{for(const r of(null==u?void 0:u.RESI)||[])yield null===(i=null==r?void 0:r.onRejected)||void 0===i?void 0:i.call(r,e)}catch(e){}return r(!0)}}))}()}))}}},602:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.merge=void 0;const t=e=>{if("object"==typeof e&&null!==e){if("function"==typeof Object.getPrototypeOf){const r=Object.getPrototypeOf(e);return r===Object.prototype||null===r}return"[object Object]"===Object.prototype.toString.call(e)}return!1};r.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]=r.merge.options.mergeArrays?r.merge.options.uniqueArrayItems?Array.from(new Set(e[n].concat(o[n]))):[...e[n],...o[n]]:o[n]:t(e[n])&&t(o[n])?e[n]=(0,r.merge)(e[n],o[n]):e[n]=void 0===o[n]?r.merge.options.allowUndefinedOverrides?o[n]:e[n]:o[n])})),e}),{});const o={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};r.merge.options=o,r.merge.withOptions=(e,...t)=>{r.merge.options=Object.assign(Object.assign({},o),e);const n=(0,r.merge)(...t);return r.merge.options=o,n}},121:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var o=t(602);const n=void 0;class i extends Error{constructor(e,r,t){super(e),this.name="XiorError",this.request=r,this.config=r,this.response=t}}Object.defineProperty(r,"merge",{enumerable:!0,get:function(){return o.merge}}),r.XiorError=i,r.XiorTimeoutError=class extends i{constructor(e,r,t){super(e),this.name="XiorTimeoutError",this.request=r,this.config=r,this.response=t}},r.anySignal=function(e,r){let t=new globalThis.AbortController;function o(e){t.abort(e),i()}let n=[];for(let r of e){if(!0===(null==r?void 0:r.aborted)){o(r.reason);break}if(null!=(null==r?void 0:r.addEventListener)){let e=()=>{o(r.reason)};n.push((()=>{null!=(null==r?void 0:r.removeEventListener)&&r.removeEventListener("abort",e)})),r.addEventListener("abort",e)}}function i(){n.forEach((e=>{e()})),null==r||r()}let s=t.signal;return s.clear=i,s},r.buildSortedURL=function(e,r,t){let o=r?t(r):"";o&&(o=e+(e.includes("?")?"&":"?")+o);let[n,i]=o.split("?");return i?`${n}?${i.split("&").sort().join("&")}`:o||e},r.delay=function(e){return new Promise((r=>{setTimeout((()=>{r("ok")}),e)}))},r.encodeParams=function e(r,t=!0,o=null,i){if(r===n||null===r)return"";let s=[],u=t?encodeURIComponent:e=>e,c=Array.isArray(r),{arrayFormat:l,allowDots:a,serializeDate:f}=i||{},d=e=>{if(a&&!c)return`.${e}`;if(c){if("brackets"===l)return"[]";if("repeat"===l)return""}return`[${e}]`};for(let c in r)if(Object.prototype.hasOwnProperty.call(r,c)){let l=r[c];if(l!==n){let r=o?`${o}${d(c)}`:c;if(!isNaN(l)&&l instanceof Date&&(l=f?f(l):l.toISOString()),"object"==typeof l){let o=e(l,t,r,i);""!==o&&s.push(o)}else s.push(`${u(r)}=${u(l)}`)}}return s.join("&")},r.isAbsoluteURL=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},r.isXiorError=function(e){return"XiorError"===e.name||"XiorTimeoutError"===e.name},r.joinPath=function(e,r){return r?(e.endsWith("/")?e:e+"/")+("/"===r[0]?r.slice(1):r):e},r.trimUndefined=function e(r){return Array.isArray(r)?r.map(e):(r&&"object"==typeof r&&Object.keys(r).forEach((t=>{let o=r[t];if(o!==n)return e(o);delete r[t]})),r)}}},r={},function t(o){var n=r[o];if(void 0!==n)return n.exports;var i=r[o]={exports:{}};return e[o].call(i.exports,i,i.exports,t),i.exports}(351).default;var e,r}));

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

import{delay as t}from"xior/utils";function r(t,r,n,e,o,i,u){try{var f=t[i](u),l=f.value}catch(t){n(t);return}f.done?r(l):Promise.resolve(l).then(e,o)}function n(t){return function(){var n=this,e=arguments;return new Promise(function(o,i){var u=t.apply(n,e);function f(t){r(u,o,i,f,l,"next",t)}function l(t){r(u,o,i,f,l,"throw",t)}f(void 0)})}}function e(){return(e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}).apply(this,arguments)}function o(r={}){let{retryTimes:i,retryInterval:u,enableRetry:f,onRetry:l}=e({},{retryTimes:2,retryInterval:3e3},r||{});return function(r,e){return n(function*(o){let{retryTimes:c=i,retryInterval:a=u,enableRetry:y=f,onRetry:p=l}=o,s=0;function v(){return h.apply(this,arguments)}function h(){return(h=n(function*(n=!1){if(n&&(null==e?void 0:e.REQI))for(let t of e.REQI)o=yield t(o);try{return yield r(o)}catch(u){let r;let n="GET"===o.method||!!o.isGet,e=typeof y;if("function"===e&&(r=y(o,u)),void 0===r&&(r="undefined"===e?n:!!y),c===s||!r)throw u;let i="function"==typeof a?a(s,o,u):a;return i&&i>0&&s>0&&(yield t(i)),s++,p&&p(o,u,s),v(!0)}})).apply(this,arguments)}return v()})}}export{o as default};
import{delay as t}from"xior/utils";function r(t,r,n,e,o,i,u){try{var l=t[i](u),f=l.value}catch(t){n(t);return}l.done?r(f):Promise.resolve(f).then(e,o)}function n(t){return function(){var n=this,e=arguments;return new Promise(function(o,i){var u=t.apply(n,e);function l(t){r(u,o,i,l,f,"next",t)}function f(t){r(u,o,i,l,f,"throw",t)}l(void 0)})}}function e(){return(e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t}).apply(this,arguments)}function o(r={}){let{retryTimes:i,retryInterval:u,enableRetry:l,onRetry:f}=e({},{retryTimes:2,retryInterval:3e3},r||{});return function(r,e){return n(function*(o){let{retryTimes:c=i,retryInterval:a=u,enableRetry:y=l,onRetry:v=f}=o,d=0;function p(){return s.apply(this,arguments)}function s(){return(s=n(function*(n=!1){if(n&&(null==e?void 0:e.REQI))for(let t of e.REQI)o=yield t(o);try{return yield r(o)}catch(f){let r;let n="GET"===o.method||!!o.isGet,u=typeof y;if("function"===u&&(r=y(o,f)),void 0===r&&(r="undefined"===u?n:!!y),c===d||!r)throw f;let l="function"==typeof a?a(d,o,f):a;l&&l>0&&d>0&&(yield t(l)),d++,v&&v(o,f,d);try{for(let t of(null==e?void 0:e.RESI)||[]){var i;yield null==t?void 0:null==(i=t.onRejected)?void 0:i.call(t,f)}}catch(t){}return p(!0)}})).apply(this,arguments)}return p()})}}export{o as default};

@@ -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.xiorTokenRefresh=t():e.xiorTokenRefresh=t()}(this,(()=>(()=>{"use strict";var e={};return{109:function(e,t){var n=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{f(o.next(e))}catch(e){r(e)}}function u(e){try{f(o.throw(e))}catch(e){r(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}f((o=o.apply(e,t||[])).next())}))};function o(e){return(null==e?void 0:e.status)&&[401].includes(e.status)}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultShouldRefresh=void 0,t.defaultShouldRefresh=o,t.default=function(e,t){const i=(null==t?void 0:t.shouldRefresh)||o;let r=!1;const s=[];e.interceptors.response.use((e=>n(this,void 0,void 0,(function*(){return e}))),(e=>n(this,void 0,void 0,(function*(){if((null==e?void 0:e.response)&&i(e.response))if(r)yield new Promise(((e,t)=>{s.push(e)}));else{r=!0;try{yield t.refreshToken(e)}finally{r=!1,s.forEach((e=>e()))}}return Promise.reject(e)}))))}}}[109](0,e),e.default})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.xiorTokenRefresh=t():e.xiorTokenRefresh=t()}(this,(()=>(()=>{"use strict";var e={};return{109:function(e,t){var n=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{f(o.next(e))}catch(e){r(e)}}function u(e){try{f(o.throw(e))}catch(e){r(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}f((o=o.apply(e,t||[])).next())}))};function o(e){return(null==e?void 0:e.status)&&[401].includes(e.status)}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultShouldRefresh=void 0,t.defaultShouldRefresh=o,t.default=function(e,t){const i=(null==t?void 0:t.shouldRefresh)||o;let r=!1;const s=[];e.interceptors.response.use((e=>n(this,void 0,void 0,(function*(){return e}))),(e=>n(this,void 0,void 0,(function*(){if((null==e?void 0:e.response)&&i(e.response))if(r)yield new Promise((e=>{s.push(e)}));else{r=!0;try{yield t.refreshToken(e)}finally{r=!1,s.forEach((e=>e()))}}return Promise.reject(e)}))))}}}[109](0,e),e.default})()));

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

function e(e,n,r,t,o,u,s){try{var i=e[u](s),f=i.value}catch(e){r(e);return}i.done?n(f):Promise.resolve(f).then(t,o)}function n(n){return function(){var r=this,t=arguments;return new Promise(function(o,u){var s=n.apply(r,t);function i(n){e(s,o,u,i,f,"next",n)}function f(n){e(s,o,u,i,f,"throw",n)}i(void 0)})}}function r(e){return(null==e?void 0:e.status)&&[401].includes(e.status)}function t(e,t){let o=(null==t?void 0:t.shouldRefresh)||r,u=!1,s=[];e.interceptors.response.use(n(function*(e){return e}),n(function*(e){if((null==e?void 0:e.response)&&o(e.response)){if(u)yield new Promise((e,n)=>{s.push(e)});else{u=!0;try{yield t.refreshToken(e)}finally{u=!1,s.forEach(e=>e())}}}return Promise.reject(e)}))}export{t as default,r as defaultShouldRefresh};
function e(e,n,r,t,o,u,s){try{var i=e[u](s),f=i.value}catch(e){r(e);return}i.done?n(f):Promise.resolve(f).then(t,o)}function n(n){return function(){var r=this,t=arguments;return new Promise(function(o,u){var s=n.apply(r,t);function i(n){e(s,o,u,i,f,"next",n)}function f(n){e(s,o,u,i,f,"throw",n)}i(void 0)})}}function r(e){return(null==e?void 0:e.status)&&[401].includes(e.status)}function t(e,t){let o=(null==t?void 0:t.shouldRefresh)||r,u=!1,s=[];e.interceptors.response.use(n(function*(e){return e}),n(function*(e){if((null==e?void 0:e.response)&&o(e.response)){if(u)yield new Promise(e=>{s.push(e)});else{u=!0;try{yield t.refreshToken(e)}finally{u=!1,s.forEach(e=>e())}}}return Promise.reject(e)}))}export{t as default,r as defaultShouldRefresh};
[![Build](https://github.com/suhaotian/xior/actions/workflows/check.yml/badge.svg)](https://github.com/suhaotian/xior/actions/workflows/check.yml)
[![Size](https://deno.bundlejs.com/badge?q=xior@0.5.5&badge=detailed)](https://bundlejs.com/?q=xior%400.5.5)
[![Size](https://deno.bundlejs.com/badge?q=xior@0.6.0&badge=detailed)](https://bundlejs.com/?q=xior%400.6.0)
[![npm version](https://badgen.net/npm/v/xior?color=green)](https://www.npmjs.com/package/xior)

@@ -34,2 +34,3 @@ ![Downloads](https://img.shields.io/npm/dm/xior.svg?style=flat)

- [Using interceptors](#using-interceptors)
- [Cleanup interceptors](#cleanup-interceptors)
- [Timeout and Cancel request](#timeout-and-cancel-request)

@@ -49,2 +50,3 @@ - [Encrypt and Decrypt Example](#encrypt-and-decrypt-example)

- [Create your own custom plugin](#create-your-own-custom-plugin)
- [Cleanup plugins example](#cleanup-plugins-example)
- [Helper functions](#helper-functions)

@@ -103,3 +105,3 @@ - [FAQ](#faq)

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>

@@ -119,3 +121,3 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>

@@ -277,2 +279,8 @@ <!-- Usage -->

});
async function getData() {
const { data } = await http.get('/');
console.log(data);
return data;
}
```

@@ -302,4 +310,34 @@

);
async function getData() {
const { data } = await http.get('/');
console.log(data);
return data;
}
```
### Cleanup interceptors
```ts
import xior from 'xior';
const http = xior.create({});
// Cleanup request interceptors
const handler1 = http.interceptors.request.use((config) => {
return config;
});
http.interceptors.request.eject(handler1);
// Cleanup all request interceptors
// http.interceptors.request.clear()
// Cleanup response interceptors
const handler2 = http.interceptors.response.use((res) => {
return res;
});
http.interceptors.response.eject(handler2);
// Cleanup all response interceptors
// http.interceptors.response.clear()
```
### Timeout and Cancel request

@@ -401,3 +439,3 @@

How we do that? Use the xior's plugins:
How we do that? Use xior's plugins:

@@ -570,5 +608,5 @@ 1. If `GET` data error, at least have chance to retry;

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/error-retry.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/error-retry.umd.js"></script>

@@ -586,6 +624,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/error-retry.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/error-retry.umd.js"></script>

@@ -683,5 +721,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/throttle.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/throttle.umd.js"></script>

@@ -699,6 +737,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/throttle.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/throttle.umd.js"></script>

@@ -758,5 +796,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/dedupe.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/dedupe.umd.js"></script>

@@ -774,6 +812,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/dedupe.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/dedupe.umd.js"></script>

@@ -840,5 +878,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/error-cache.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/error-cache.umd.js"></script>

@@ -856,6 +894,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/error-cache.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/error-cache.umd.js"></script>

@@ -1005,5 +1043,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/progress.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/progress.umd.js"></script>

@@ -1021,6 +1059,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/progress.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/progress.umd.js"></script>

@@ -1132,5 +1170,5 @@ <!-- Usage -->

```html
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://cdn.jsdelivr.net/npm/xior@0.5.5/plugins/mock.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xior@0.6.0/plugins/mock.umd.js"></script>

@@ -1148,6 +1186,6 @@ <!-- Usage -->

```html
<script src="https://unpkg.com/xior@0.5.5/dist/xior.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/dist/xior.umd.js"></script>
<!-- Load plugin -->
<script src="https://unpkg.com/xior@0.5.5/plugins/mock.umd.js"></script>
<script src="https://unpkg.com/xior@0.6.0/plugins/mock.umd.js"></script>

@@ -1290,2 +1328,16 @@ <!-- Usage -->

### Cleanup plugins example
```ts
import xior from 'xior';
import errorRetryPlugin from 'xior/plugins/error-retry';
const http = xior.create();
const pluginHandler = http.plugins.use(errorRetryPlugin());
http.plugins.eject(pluginHandler);
// Cleanup all plugins
// http.plugins.clear()
```
## Helper functions

@@ -1292,0 +1344,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc