@ahoo-wang/fetcher 2.6.8 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fetchExchange.d.ts +1 -1
- package/dist/fetchExchange.d.ts.map +1 -1
- package/dist/index.es.js +60 -60
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(s,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(s=typeof globalThis<"u"?globalThis:s||self,h(s.Fetcher={}))})(this,(function(s){"use strict";function h(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function B(t,e){return h(e)?e:e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}var H=(t=>(t[t.UriTemplate=0]="UriTemplate",t[t.Express=1]="Express",t))(H||{});function G(t){return t===1?j:V}function b(t,e,r){return r?t.replace(e,(n,o)=>{const u=r[o];if(u===void 0)throw new Error(`Missing required path parameter: ${o}`);return encodeURIComponent(u)}):t}function F(t,e){const r=[];let n;for(;(n=e.exec(t))!==null;)r.push(n[1]);return r}const d=class d{extractPathParams(e){return F(e,d.PATH_PARAM_REGEX)}resolve(e,r){return b(e,d.PATH_PARAM_REGEX,r)}};d.PATH_PARAM_REGEX=/{([^}]+)}/g;let f=d;const V=new f,m=class m{extractPathParams(e){return F(e,m.PATH_PARAM_REGEX)}resolve(e,r){return b(e,m.PATH_PARAM_REGEX,r)}};m.PATH_PARAM_REGEX=/:([^/]+)/g;let A=m;const j=new A;class ${constructor(e,r){this.baseURL=e,this.urlTemplateResolver=G(r)}build(e,r){const n=r?.path,o=r?.query,u=B(this.baseURL,e);let a=this.urlTemplateResolver.resolve(u,n);if(o){const c=new URLSearchParams(o).toString();c&&(a+="?"+c)}return a}resolveRequestUrl(e){return this.build(e.url,e.urlParams)}}class l extends Error{constructor(e,r){const n=e||r?.message||"An error occurred in the fetcher";super(n),this.cause=r,this.name="FetcherError",r?.stack&&(this.stack=r.stack),Object.setPrototypeOf(this,l.prototype)}}class _ extends l{constructor(e){const r=e.method||"GET",n=`Request timeout of ${e.timeout}ms exceeded for ${r} ${e.url}`;super(n),this.name="FetchTimeoutError",this.request=e,Object.setPrototypeOf(this,_.prototype)}}function X(t,e){return typeof t<"u"?t:e}async function J(t){const e=t.url,r=t.timeout,n=t;if(t.signal)return await fetch(e,n);if(!r)return t.abortController&&(n.signal=t.abortController.signal),await fetch(e,n);const o=t.abortController??new AbortController;t.abortController=o,n.signal=o.signal;let u=null;const a=new Promise((c,M)=>{u=setTimeout(()=>{u&&clearTimeout(u);const de=new _(t);o.abort(de),M(de)},r)});try{return await Promise.race([fetch(e,n),a])}finally{u&&clearTimeout(u)}}const k="UrlResolveInterceptor",q=Number.MIN_SAFE_INTEGER+1e3;class Q{constructor(){this.name=k,this.order=q}intercept(e){const r=e.request;r.url=e.fetcher.urlBuilder.resolveRequestUrl(r)}}var i=(t=>(t.GET="GET",t.POST="POST",t.PUT="PUT",t.DELETE="DELETE",t.PATCH="PATCH",t.HEAD="HEAD",t.OPTIONS="OPTIONS",t.TRACE="TRACE",t))(i||{});const E="Content-Type",S=class S{};S.APPLICATION_JSON="application/json",S.TEXT_EVENT_STREAM="text/event-stream";let R=S;const Y="RequestBodyInterceptor",z=q+1e3;class x{constructor(){this.name=Y,this.order=z}isSupportedComplexBodyType(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream}isAutoAppendContentType(e){return e instanceof Blob||e instanceof File||e instanceof FormData||e instanceof URLSearchParams}intercept(e){const r=e.request;if(r.body===void 0||r.body===null||typeof r.body!="object")return;const n=e.ensureRequestHeaders();if(this.isAutoAppendContentType(r.body)){n[E]&&delete n[E];return}this.isSupportedComplexBodyType(r.body)||(e.request.body=JSON.stringify(r.body),n[E]||(n[E]=R.APPLICATION_JSON))}}const K="FetchInterceptor",W=Number.MAX_SAFE_INTEGER-1e3;class Z{constructor(){this.name=K,this.order=W}async intercept(e){e.response=await J(e.request)}}function P(t,e){return e?t.filter(e).sort((r,n)=>r.order-n.order):[...t].sort((r,n)=>r.order-n.order)}class p{constructor(e=[]){this.sortedInterceptors=[],this.sortedInterceptors=P(e)}get name(){return this.constructor.name}get order(){return Number.MIN_SAFE_INTEGER}get interceptors(){return[...this.sortedInterceptors]}use(e){return this.sortedInterceptors.some(r=>r.name===e.name)?!1:(this.sortedInterceptors=P([...this.sortedInterceptors,e]),!0)}eject(e){const r=this.sortedInterceptors;return this.sortedInterceptors=P(r,n=>n.name!==e),r.length!==this.sortedInterceptors.length}clear(){this.sortedInterceptors=[]}async intercept(e){for(const r of this.sortedInterceptors)await r.intercept(e)}}class O extends l{constructor(e){super(`Request failed with status code ${e.response?.status} for ${e.request.url}`),this.exchange=e,this.name="HttpStatusValidationError",Object.setPrototypeOf(this,O.prototype)}}const me=t=>t>=200&&t<300,ee="ValidateStatusInterceptor",te=Number.MAX_SAFE_INTEGER-1e3;class re{constructor(e=me){this.validateStatus=e}get name(){return ee}get order(){return te}intercept(e){if(!e.response)return;const r=e.response.status;if(!this.validateStatus(r))throw new O(e)}}class T extends l{constructor(e,r){const n=r||e.error?.message||e.response?.statusText||`Request to ${e.request.url} failed during exchange`;super(n,e.error),this.exchange=e,this.name="ExchangeError",Object.setPrototypeOf(this,T.prototype)}}class se{constructor(){this.request=new p([new Q,new x,new Z]),this.response=new p([new re]),this.error=new p}async exchange(e){try{return await this.request.intercept(e),await this.response.intercept(e),e}catch(r){if(e.error=r,await this.error.intercept(e),!e.hasError())return e;throw new T(e)}}}const ne=t=>t,oe=t=>t.requiredResponse,ue=t=>t.requiredResponse.json(),ie=t=>t.requiredResponse.text(),ae=t=>t.requiredResponse.blob(),ce=t=>t.requiredResponse.arrayBuffer(),he=t=>t.requiredResponse.bytes(),g={Exchange:ne,Response:oe,Json:ue,Text:ie,Blob:ae,ArrayBuffer:ce,Bytes:he};function C(t,e){if(!(t===void 0&&e===void 0))return e===void 0?t:t===void 0?e:{...t,...e}}function le(t,e){if(e??=new Map,!t)return e;if(t instanceof Map){for(const[r,n]of t)e.set(r,n);return e}for(const[r,n]of Object.entries(t))e.set(r,n);return e}class Ee{constructor(e){this.fetcher=e.fetcher,this.request=e.request,this.resultExtractor=e.resultExtractor??g.Exchange,this.attributes=le(e.attributes),this._response=e.response,this.error=e.error}ensureRequestHeaders(){return this.request.headers||(this.request.headers={}),this.request.headers}ensureRequestUrlParams(){return this.request.urlParams||(this.request.urlParams={path:{},query:{}}),this.request.urlParams.path||(this.request.urlParams.path={}),this.request.urlParams.query||(this.request.urlParams.query={}),this.request.urlParams}hasError(){return!!this.error}set response(e){this._response=e,this.cachedExtractedResult=void 0}get response(){return this._response}hasResponse(){return!!this.response}get requiredResponse(){if(!this.response)throw new T(this,`Request to ${this.request.url} failed with no response`);return this.response}extractResult(){return this.cachedExtractedResult!==void 0?this.cachedExtractedResult:(this.cachedExtractedResult=this.resultExtractor(this),this.cachedExtractedResult)}}function fe(t,e){if(Object.keys(t).length===0)return e;if(Object.keys(e).length===0)return t;const r={path:C(t.urlParams?.path,e.urlParams?.path),query:C(t.urlParams?.query,e.urlParams?.query)},n={...t.headers,...e.headers},o=e.method??t.method,u=e.body??t.body,a=e.timeout??t.timeout,c=e.signal??t.signal,M=e.abortController??t.abortController;return{...t,...e,method:o,urlParams:r,headers:n,body:u,timeout:a,signal:c,abortController:M}}function y(t,e){return e&&e.resultExtractor&&e.attributes?e:{resultExtractor:e?.resultExtractor??t?.resultExtractor??D.resultExtractor,attributes:e?.attributes??t?.attributes}}const U={[E]:R.APPLICATION_JSON},w={baseURL:"",headers:U},D={resultExtractor:g.Exchange},L={resultExtractor:g.Response};class v{constructor(e=w){this.headers=U,this.urlBuilder=new $(e.baseURL,e.urlTemplateStyle),this.headers=e.headers??U,this.timeout=e.timeout,this.interceptors=e.interceptors??new se}async exchange(e,r){const n={...this.headers,...e.headers},o={...e,headers:n,timeout:X(e.timeout,this.timeout)},{resultExtractor:u,attributes:a}=y(D,r),c=new Ee({fetcher:this,request:o,resultExtractor:u,attributes:a});return this.interceptors.exchange(c)}async request(e,r){return(await this.exchange(e,r)).extractResult()}async fetch(e,r={},n){const o={...r,url:e};return this.request(o,y(L,n))}async methodFetch(e,r,n={},o){const u={...n,url:r,method:e};return this.request(u,y(L,o))}async get(e,r={},n){return this.methodFetch(i.GET,e,r,n)}async put(e,r={},n){return this.methodFetch(i.PUT,e,r,n)}async post(e,r={},n){return this.methodFetch(i.POST,e,r,n)}async patch(e,r={},n){return this.methodFetch(i.PATCH,e,r,n)}async delete(e,r={},n){return this.methodFetch(i.DELETE,e,r,n)}async head(e,r={},n){return this.methodFetch(i.HEAD,e,r,n)}async options(e,r={},n){return this.methodFetch(i.OPTIONS,e,r,n)}async trace(e,r={},n){return this.methodFetch(i.TRACE,e,r,n)}}const I="default";class Re{constructor(){this.registrar=new Map}register(e,r){this.registrar.set(e,r)}unregister(e){return this.registrar.delete(e)}get(e){return this.registrar.get(e)}requiredGet(e){const r=this.get(e);if(!r)throw new Error(`Fetcher ${e} not found`);return r}get default(){return this.requiredGet(I)}set default(e){this.register(I,e)}get fetchers(){return new Map(this.registrar)}}const N=new Re;function Ae(t,e){return t?t instanceof v?t:N.requiredGet(t):e??N.default}class Te extends v{constructor(e,r=w){super(r),this.name=e,N.register(e,this)}}const _e=new Te(I);s.ArrayBufferResultExtractor=ce,s.BlobResultExtractor=ae,s.BytesResultExtractor=he,s.CONTENT_TYPE_HEADER=E,s.ContentTypeValues=R,s.DEFAULT_FETCHER_NAME=I,s.DEFAULT_FETCH_OPTIONS=L,s.DEFAULT_OPTIONS=w,s.DEFAULT_REQUEST_OPTIONS=D,s.ExchangeError=T,s.ExchangeResultExtractor=ne,s.ExpressUrlTemplateResolver=A,s.FETCH_INTERCEPTOR_NAME=K,s.FETCH_INTERCEPTOR_ORDER=W,s.FetchExchange=Ee,s.FetchInterceptor=Z,s.FetchTimeoutError=_,s.Fetcher=v,s.FetcherError=l,s.FetcherRegistrar=Re,s.HttpMethod=i,s.HttpStatusValidationError=O,s.InterceptorManager=se,s.InterceptorRegistry=p,s.JsonResultExtractor=ue,s.NamedFetcher=Te,s.REQUEST_BODY_INTERCEPTOR_NAME=Y,s.REQUEST_BODY_INTERCEPTOR_ORDER=z,s.RequestBodyInterceptor=x,s.ResponseResultExtractor=oe,s.ResultExtractors=g,s.TextResultExtractor=ie,s.URL_RESOLVE_INTERCEPTOR_NAME=k,s.URL_RESOLVE_INTERCEPTOR_ORDER=q,s.UriTemplateResolver=f,s.UrlBuilder=$,s.UrlResolveInterceptor=Q,s.UrlTemplateStyle=H,s.VALIDATE_STATUS_INTERCEPTOR_NAME=ee,s.VALIDATE_STATUS_INTERCEPTOR_ORDER=te,s.ValidateStatusInterceptor=re,s.combineURLs=B,s.expressUrlTemplateResolver=j,s.fetcher=_e,s.fetcherRegistrar=N,s.getFetcher=Ae,s.getUrlTemplateResolver=G,s.isAbsoluteURL=h,s.mergeRecordToMap=le,s.mergeRecords=C,s.mergeRequest=fe,s.mergeRequestOptions=y,s.resolveTimeout=X,s.timeoutFetch=J,s.toSorted=P,s.uriTemplateResolver=V,s.urlTemplateRegexExtract=F,s.urlTemplateRegexResolve=b,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(s,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(s=typeof globalThis<"u"?globalThis:s||self,h(s.Fetcher={}))})(this,(function(s){"use strict";function h(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function B(t,e){return h(e)?e:e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}var H=(t=>(t[t.UriTemplate=0]="UriTemplate",t[t.Express=1]="Express",t))(H||{});function G(t){return t===1?j:V}function w(t,e,r){return r?t.replace(e,(n,o)=>{const a=r[o];if(a===void 0)throw new Error(`Missing required path parameter: ${o}`);return encodeURIComponent(a)}):t}function b(t,e){const r=[];let n;for(;(n=e.exec(t))!==null;)r.push(n[1]);return r}const d=class d{extractPathParams(e){return b(e,d.PATH_PARAM_REGEX)}resolve(e,r){return w(e,d.PATH_PARAM_REGEX,r)}};d.PATH_PARAM_REGEX=/{([^}]+)}/g;let f=d;const V=new f,m=class m{extractPathParams(e){return b(e,m.PATH_PARAM_REGEX)}resolve(e,r){return w(e,m.PATH_PARAM_REGEX,r)}};m.PATH_PARAM_REGEX=/:([^/]+)/g;let A=m;const j=new A;class ${constructor(e,r){this.baseURL=e,this.urlTemplateResolver=G(r)}build(e,r){const n=r?.path,o=r?.query,a=B(this.baseURL,e);let u=this.urlTemplateResolver.resolve(a,n);if(o){const c=new URLSearchParams(o).toString();c&&(u+="?"+c)}return u}resolveRequestUrl(e){return this.build(e.url,e.urlParams)}}class l extends Error{constructor(e,r){const n=e||r?.message||"An error occurred in the fetcher";super(n),this.cause=r,this.name="FetcherError",r?.stack&&(this.stack=r.stack),Object.setPrototypeOf(this,l.prototype)}}class _ extends l{constructor(e){const r=e.method||"GET",n=`Request timeout of ${e.timeout}ms exceeded for ${r} ${e.url}`;super(n),this.name="FetchTimeoutError",this.request=e,Object.setPrototypeOf(this,_.prototype)}}function X(t,e){return typeof t<"u"?t:e}async function J(t){const e=t.url,r=t.timeout,n=t;if(t.signal)return await fetch(e,n);if(!r)return t.abortController&&(n.signal=t.abortController.signal),await fetch(e,n);const o=t.abortController??new AbortController;t.abortController=o,n.signal=o.signal;let a=null;const u=new Promise((c,M)=>{a=setTimeout(()=>{a&&clearTimeout(a);const de=new _(t);o.abort(de),M(de)},r)});try{return await Promise.race([fetch(e,n),u])}finally{a&&clearTimeout(a)}}const k="UrlResolveInterceptor",F=Number.MIN_SAFE_INTEGER+1e3;class Q{constructor(){this.name=k,this.order=F}intercept(e){const r=e.request;r.url=e.fetcher.urlBuilder.resolveRequestUrl(r)}}var i=(t=>(t.GET="GET",t.POST="POST",t.PUT="PUT",t.DELETE="DELETE",t.PATCH="PATCH",t.HEAD="HEAD",t.OPTIONS="OPTIONS",t.TRACE="TRACE",t))(i||{});const E="Content-Type",S=class S{};S.APPLICATION_JSON="application/json",S.TEXT_EVENT_STREAM="text/event-stream";let R=S;const Y="RequestBodyInterceptor",z=F+1e3;class x{constructor(){this.name=Y,this.order=z}isSupportedComplexBodyType(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream}isAutoAppendContentType(e){return e instanceof Blob||e instanceof File||e instanceof FormData||e instanceof URLSearchParams}intercept(e){const r=e.request;if(r.body===void 0||r.body===null||typeof r.body!="object")return;const n=e.ensureRequestHeaders();if(this.isAutoAppendContentType(r.body)){n[E]&&delete n[E];return}this.isSupportedComplexBodyType(r.body)||(e.request.body=JSON.stringify(r.body),n[E]||(n[E]=R.APPLICATION_JSON))}}const K="FetchInterceptor",W=Number.MAX_SAFE_INTEGER-1e3;class Z{constructor(){this.name=K,this.order=W}async intercept(e){e.response=await J(e.request)}}function P(t,e){return e?t.filter(e).sort((r,n)=>r.order-n.order):[...t].sort((r,n)=>r.order-n.order)}class p{constructor(e=[]){this.sortedInterceptors=[],this.sortedInterceptors=P(e)}get name(){return this.constructor.name}get order(){return Number.MIN_SAFE_INTEGER}get interceptors(){return[...this.sortedInterceptors]}use(e){return this.sortedInterceptors.some(r=>r.name===e.name)?!1:(this.sortedInterceptors=P([...this.sortedInterceptors,e]),!0)}eject(e){const r=this.sortedInterceptors;return this.sortedInterceptors=P(r,n=>n.name!==e),r.length!==this.sortedInterceptors.length}clear(){this.sortedInterceptors=[]}async intercept(e){for(const r of this.sortedInterceptors)await r.intercept(e)}}class O extends l{constructor(e){super(`Request failed with status code ${e.response?.status} for ${e.request.url}`),this.exchange=e,this.name="HttpStatusValidationError",Object.setPrototypeOf(this,O.prototype)}}const me=t=>t>=200&&t<300,ee="ValidateStatusInterceptor",te=Number.MAX_SAFE_INTEGER-1e3;class re{constructor(e=me){this.validateStatus=e}get name(){return ee}get order(){return te}intercept(e){if(!e.response)return;const r=e.response.status;if(!this.validateStatus(r))throw new O(e)}}class T extends l{constructor(e,r){const n=r||e.error?.message||e.response?.statusText||`Request to ${e.request.url} failed during exchange`;super(n,e.error),this.exchange=e,this.name="ExchangeError",Object.setPrototypeOf(this,T.prototype)}}class se{constructor(){this.request=new p([new Q,new x,new Z]),this.response=new p([new re]),this.error=new p}async exchange(e){try{return await this.request.intercept(e),await this.response.intercept(e),e}catch(r){if(e.error=r,await this.error.intercept(e),!e.hasError())return e;throw new T(e)}}}const ne=t=>t,oe=t=>t.requiredResponse,ae=t=>t.requiredResponse.json(),ie=t=>t.requiredResponse.text(),ue=t=>t.requiredResponse.blob(),ce=t=>t.requiredResponse.arrayBuffer(),he=t=>t.requiredResponse.bytes(),g={Exchange:ne,Response:oe,Json:ae,Text:ie,Blob:ue,ArrayBuffer:ce,Bytes:he};function q(t,e){if(!(t===void 0&&e===void 0))return e===void 0?t:t===void 0?e:{...t,...e}}function le(t,e){if(e??=new Map,!t)return e;if(t instanceof Map){for(const[r,n]of t)e.set(r,n);return e}for(const[r,n]of Object.entries(t))e.set(r,n);return e}class Ee{constructor(e){this.fetcher=e.fetcher,this.request=e.request,this.resultExtractor=e.resultExtractor??g.Exchange,this.attributes=le(e.attributes),this._response=e.response,this.error=e.error}ensureRequestHeaders(){return this.request.headers||(this.request.headers={}),this.request.headers}ensureRequestUrlParams(){return this.request.urlParams||(this.request.urlParams={path:{},query:{}}),this.request.urlParams.path||(this.request.urlParams.path={}),this.request.urlParams.query||(this.request.urlParams.query={}),this.request.urlParams}hasError(){return!!this.error}set response(e){this._response=e,this.cachedExtractedResult=void 0}get response(){return this._response}hasResponse(){return!!this.response}get requiredResponse(){if(!this.response)throw new T(this,`Request to ${this.request.url} failed with no response`);return this.response}async extractResult(){return this.cachedExtractedResult!==void 0?await this.cachedExtractedResult:(this.cachedExtractedResult=this.resultExtractor(this),await this.cachedExtractedResult)}}function fe(t,e){if(Object.keys(t).length===0)return e;if(Object.keys(e).length===0)return t;const r={path:q(t.urlParams?.path,e.urlParams?.path),query:q(t.urlParams?.query,e.urlParams?.query)},n={...t.headers,...e.headers},o=e.method??t.method,a=e.body??t.body,u=e.timeout??t.timeout,c=e.signal??t.signal,M=e.abortController??t.abortController;return{...t,...e,method:o,urlParams:r,headers:n,body:a,timeout:u,signal:c,abortController:M}}function y(t,e){return e&&e.resultExtractor&&e.attributes?e:{resultExtractor:e?.resultExtractor??t?.resultExtractor??D.resultExtractor,attributes:e?.attributes??t?.attributes}}const C={[E]:R.APPLICATION_JSON},U={baseURL:"",headers:C},D={resultExtractor:g.Exchange},L={resultExtractor:g.Response};class v{constructor(e=U){this.headers=C,this.urlBuilder=new $(e.baseURL,e.urlTemplateStyle),this.headers=e.headers??C,this.timeout=e.timeout,this.interceptors=e.interceptors??new se}async exchange(e,r){const n={...this.headers,...e.headers},o={...e,headers:n,timeout:X(e.timeout,this.timeout)},{resultExtractor:a,attributes:u}=y(D,r),c=new Ee({fetcher:this,request:o,resultExtractor:a,attributes:u});return await this.interceptors.exchange(c)}async request(e,r){return await(await this.exchange(e,r)).extractResult()}async fetch(e,r={},n){const o={...r,url:e};return await this.request(o,y(L,n))}async methodFetch(e,r,n={},o){const a={...n,url:r,method:e};return await this.request(a,y(L,o))}async get(e,r={},n){return await this.methodFetch(i.GET,e,r,n)}async put(e,r={},n){return await this.methodFetch(i.PUT,e,r,n)}async post(e,r={},n){return await this.methodFetch(i.POST,e,r,n)}async patch(e,r={},n){return await this.methodFetch(i.PATCH,e,r,n)}async delete(e,r={},n){return await this.methodFetch(i.DELETE,e,r,n)}async head(e,r={},n){return await this.methodFetch(i.HEAD,e,r,n)}async options(e,r={},n){return await this.methodFetch(i.OPTIONS,e,r,n)}async trace(e,r={},n){return await this.methodFetch(i.TRACE,e,r,n)}}const I="default";class Re{constructor(){this.registrar=new Map}register(e,r){this.registrar.set(e,r)}unregister(e){return this.registrar.delete(e)}get(e){return this.registrar.get(e)}requiredGet(e){const r=this.get(e);if(!r)throw new Error(`Fetcher ${e} not found`);return r}get default(){return this.requiredGet(I)}set default(e){this.register(I,e)}get fetchers(){return new Map(this.registrar)}}const N=new Re;function Ae(t,e){return t?t instanceof v?t:N.requiredGet(t):e??N.default}class Te extends v{constructor(e,r=U){super(r),this.name=e,N.register(e,this)}}const _e=new Te(I);s.ArrayBufferResultExtractor=ce,s.BlobResultExtractor=ue,s.BytesResultExtractor=he,s.CONTENT_TYPE_HEADER=E,s.ContentTypeValues=R,s.DEFAULT_FETCHER_NAME=I,s.DEFAULT_FETCH_OPTIONS=L,s.DEFAULT_OPTIONS=U,s.DEFAULT_REQUEST_OPTIONS=D,s.ExchangeError=T,s.ExchangeResultExtractor=ne,s.ExpressUrlTemplateResolver=A,s.FETCH_INTERCEPTOR_NAME=K,s.FETCH_INTERCEPTOR_ORDER=W,s.FetchExchange=Ee,s.FetchInterceptor=Z,s.FetchTimeoutError=_,s.Fetcher=v,s.FetcherError=l,s.FetcherRegistrar=Re,s.HttpMethod=i,s.HttpStatusValidationError=O,s.InterceptorManager=se,s.InterceptorRegistry=p,s.JsonResultExtractor=ae,s.NamedFetcher=Te,s.REQUEST_BODY_INTERCEPTOR_NAME=Y,s.REQUEST_BODY_INTERCEPTOR_ORDER=z,s.RequestBodyInterceptor=x,s.ResponseResultExtractor=oe,s.ResultExtractors=g,s.TextResultExtractor=ie,s.URL_RESOLVE_INTERCEPTOR_NAME=k,s.URL_RESOLVE_INTERCEPTOR_ORDER=F,s.UriTemplateResolver=f,s.UrlBuilder=$,s.UrlResolveInterceptor=Q,s.UrlTemplateStyle=H,s.VALIDATE_STATUS_INTERCEPTOR_NAME=ee,s.VALIDATE_STATUS_INTERCEPTOR_ORDER=te,s.ValidateStatusInterceptor=re,s.combineURLs=B,s.expressUrlTemplateResolver=j,s.fetcher=_e,s.fetcherRegistrar=N,s.getFetcher=Ae,s.getUrlTemplateResolver=G,s.isAbsoluteURL=h,s.mergeRecordToMap=le,s.mergeRecords=q,s.mergeRequest=fe,s.mergeRequestOptions=y,s.resolveTimeout=X,s.timeoutFetch=J,s.toSorted=P,s.uriTemplateResolver=V,s.urlTemplateRegexExtract=b,s.urlTemplateRegexResolve=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|