create-request 1.4.3-rc.2 → 1.4.3-rc.4
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/README.md +150 -20
- package/dist/library/BaseRequest.d.ts +182 -37
- package/dist/library/BodyRequest.d.ts +56 -10
- package/dist/library/RequestError.d.ts +99 -1
- package/dist/library/ResponseWrapper.d.ts +53 -10
- package/dist/library/apiBuilder.d.ts +20 -20
- package/dist/library/index.cjs +435 -62
- package/dist/library/index.cjs.map +1 -1
- package/dist/library/index.d.ts +21 -1
- package/dist/library/index.esm.js +435 -62
- package/dist/library/index.esm.js.map +1 -1
- package/dist/library/index.esm.min.js +1 -1
- package/dist/library/index.esm.min.js.map +1 -1
- package/dist/library/index.min.cjs +1 -1
- package/dist/library/index.min.cjs.map +1 -1
- package/dist/library/types.d.ts +233 -19
- package/package.json +15 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e,r,s,i,o,n,h,c;exports.HttpMethod=void 0,(t=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",t.PUT="PUT",t.POST="POST",t.HEAD="HEAD",t.PATCH="PATCH",t.DELETE="DELETE",t.OPTIONS="OPTIONS",exports.RequestPriority=void 0,(e=exports.RequestPriority||(exports.RequestPriority={})).LOW="low",e.HIGH="high",e.AUTO="auto",exports.CredentialsPolicy=void 0,(r=exports.CredentialsPolicy||(exports.CredentialsPolicy={})).OMIT="omit",r.INCLUDE="include",r.SAME_ORIGIN="same-origin",exports.RequestMode=void 0,(s=exports.RequestMode||(exports.RequestMode={})).CORS="cors",s.NO_CORS="no-cors",s.SAME_ORIGIN="same-origin",s.NAVIGATE="navigate",exports.RedirectMode=void 0,(i=exports.RedirectMode||(exports.RedirectMode={})).ERROR="error",i.FOLLOW="follow",i.MANUAL="manual",exports.SameSitePolicy=void 0,(o=exports.SameSitePolicy||(exports.SameSitePolicy={})).LAX="Lax",o.NONE="None",o.STRICT="Strict",function(t){t.JSON="json",t.STRING="string",t.BINARY="binary"}(n||(n={})),exports.ReferrerPolicy=void 0,(h=exports.ReferrerPolicy||(exports.ReferrerPolicy={})).ORIGIN="origin",h.UNSAFE_URL="unsafe-url",h.SAME_ORIGIN="same-origin",h.NO_REFERRER="no-referrer",h.STRICT_ORIGIN="strict-origin",h.ORIGIN_WHEN_CROSS_ORIGIN="origin-when-cross-origin",h.NO_REFERRER_WHEN_DOWNGRADE="no-referrer-when-downgrade",h.STRICT_ORIGIN_WHEN_CROSS_ORIGIN="strict-origin-when-cross-origin",exports.CacheMode=void 0,(c=exports.CacheMode||(exports.CacheMode={})).RELOAD="reload",c.DEFAULT="default",c.NO_CACHE="no-cache",c.NO_STORE="no-store",c.FORCE_CACHE="force-cache",c.ONLY_IF_CACHED="only-if-cached";class a extends Error{status;response;url;method;isTimeout;isAborted;constructor(t,e,r,s={}){super(t,{cause:s.cause}),this.name="RequestError",this.url=e,this.method=r,this.status=s.status,this.response=s.response,this.isTimeout=s.isTimeout,this.isAborted=s.isAborted,Error.captureStackTrace&&Error.captureStackTrace(this,a),Object.setPrototypeOf(this,a.prototype)}static timeout(t,e,r){return new a(`Timeout ${r}ms`,t,e,{isTimeout:!0})}static fromResponse(t,e,r){return new a("HTTP "+t.status,e,r,{status:t.status,response:t})}static networkError(t,e,r){let s=r.message;const i=r.code,o=r.name,n=r.stack||"",h=s.toLowerCase(),c="TimeoutError"===o||h.includes("timeout")||h.includes("aborted due to timeout")||"ETIMEDOUT"===i||n.includes("TimeoutError")||n.includes("timeout");if("fetch failed"===s||"Failed to fetch"===s){const e="ENOTFOUND"===i||"EAI_AGAIN"===i||"EAI_NODATA"===i||n.includes("getaddrinfo")||n.includes("ENOTFOUND")||n.includes("EAI_AGAIN"),r=!c&&("ECONNREFUSED"===i||"ECONNRESET"===i||n.includes("ECONNREFUSED")||n.includes("connect"));s=c?"Timeout "+t:e?"DNS error "+t:r?"Connection refused "+t:"Network error "+t}const u=new a(s,t,e,{...c?{isTimeout:!0}:{}});return r.stack&&(u.stack=`${u.stack||""}\n\nCaused by: ${r.stack}`),u}static abortError(t,e){return new a("Aborted",t,e,{isAborted:!0})}}class u{url;method;response;graphQLOptions;cachedBlob;cachedText;cachedJson;cachedArrayBuffer;constructor(t,e,r,s){this.response=t,this.url=e,this.method=r,s&&(this.graphQLOptions={throwOnError:s.throwOnError})}get status(){return this.response.status}get statusText(){return this.response.statusText}get headers(){return this.response.headers}get ok(){return this.response.ok}get raw(){return this.response}checkBodyNotConsumed(){if(this.response.bodyUsed)throw new a("Body already consumed",this.url||"",this.method||"",{status:this.response.status,response:this.response})}checkGraphQLErrors(t){if(!this.graphQLOptions?.throwOnError||"object"!=typeof t||null===t)return;const e=t;if(!Array.isArray(e.errors)||0===e.errors.length)return;const r=e.errors.map((t=>"string"==typeof t?t:t&&"object"==typeof t&&"message"in t?(t.message||"Unknown error")+"":t+"")).join(", ");throw new a("GraphQL errors: "+r,this.url||"",this.method||"",{status:this.response.status,response:this.response})}async getJson(){if(void 0!==this.cachedJson)return this.cachedJson;this.checkBodyNotConsumed();try{const t=await this.response.json();return this.cachedJson=t,this.checkGraphQLErrors(t),t}catch(t){if(t instanceof a)throw t;throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getText(){if(void 0!==this.cachedText)return this.cachedText;this.checkBodyNotConsumed();try{const t=await this.response.text();return this.cachedText=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getBlob(){if(void 0!==this.cachedBlob)return this.cachedBlob;this.checkBodyNotConsumed();try{const t=await this.response.blob();return this.cachedBlob=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getArrayBuffer(){if(void 0!==this.cachedArrayBuffer)return this.cachedArrayBuffer;this.checkBodyNotConsumed();try{const t=await this.response.arrayBuffer();return this.cachedArrayBuffer=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}getBody(){return this.checkBodyNotConsumed(),this.response.body}async getData(t){try{const e=await this.getJson();return t?t(e):e}catch(e){if(e instanceof a)throw e;if(t)throw new a("Data selector failed: "+(e instanceof Error?e.message:e+""),this.url||"",this.method||"",{status:this.response.status,response:this.response});throw a.networkError(this.url||"",this.method||"",e instanceof Error?e:Error(e+""))}}}class f{static formatRequestCookies(t){const e=[];return Object.entries(t).forEach((([t,r])=>{let s;s="string"==typeof r?r:r.value,e.push(`${encodeURIComponent(t)}=${encodeURIComponent(s)}`)})),e.join("; ")}}class p{static getTokenFromMeta(t="csrf-token"){if("undefined"==typeof document)return null;const e=document.querySelector(`meta[name="${t}"]`);return e?.getAttribute("content")||null}static getTokenFromCookie(t="csrf-token"){if("undefined"==typeof document)return null;const e=document.cookie.split(";");for(const r of e){const[e,s]=r.trim().split("=");if(e===t)return decodeURIComponent(s)}return null}static isValidToken(t){return!("string"!=typeof t||8>t.length||t.length>10&&(!/^[A-Za-z0-9\-_=+/.]+$/.test(t)||2>[/[A-Z]/.test(t),/[a-z]/.test(t),/[0-9]/.test(t),/[-_=+/.]/.test(t)].filter(Boolean).length))}}class d{static instance;csrfHeaderName="X-CSRF-Token";xsrfCookieName="XSRF-TOKEN";xsrfHeaderName="X-XSRF-TOKEN";csrfToken=null;enableAutoXsrf=!0;enableAntiCsrf=!0;requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];nextInterceptorId=1;constructor(){}static getInstance(){return d.instance||(d.instance=new d),d.instance}setCsrfToken(t){return this.csrfToken=t,this}getCsrfToken(){return this.csrfToken}setCsrfHeaderName(t){return this.csrfHeaderName=t,this}getCsrfHeaderName(){return this.csrfHeaderName}setXsrfCookieName(t){return this.xsrfCookieName=t,this}getXsrfCookieName(){return this.xsrfCookieName}setXsrfHeaderName(t){return this.xsrfHeaderName=t,this}getXsrfHeaderName(){return this.xsrfHeaderName}setEnableAutoXsrf(t){return this.enableAutoXsrf=t,this}isAutoXsrfEnabled(){return this.enableAutoXsrf}setEnableAntiCsrf(t){return this.enableAntiCsrf=t,this}isAntiCsrfEnabled(){return this.enableAntiCsrf}addRequestInterceptor(t){const e=this.nextInterceptorId++;return this.requestInterceptors.push({id:e,interceptor:t}),e}addResponseInterceptor(t){const e=this.nextInterceptorId++;return this.responseInterceptors.push({id:e,interceptor:t}),e}addErrorInterceptor(t){const e=this.nextInterceptorId++;return this.errorInterceptors.push({id:e,interceptor:t}),e}removeRequestInterceptor(t){this.requestInterceptors=this.requestInterceptors.filter((e=>e.id!==t))}removeResponseInterceptor(t){this.responseInterceptors=this.responseInterceptors.filter((e=>e.id!==t))}removeErrorInterceptor(t){this.errorInterceptors=this.errorInterceptors.filter((e=>e.id!==t))}clearInterceptors(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRequestInterceptors(){return this.requestInterceptors.map((t=>t.interceptor))}getResponseInterceptors(){return this.responseInterceptors.map((t=>t.interceptor))}getErrorInterceptors(){return this.errorInterceptors.map((t=>t.interceptor))}reset(){return this.csrfToken=null,this.csrfHeaderName="X-CSRF-Token",this.enableAntiCsrf=!0,this.xsrfCookieName="XSRF-TOKEN",this.xsrfHeaderName="X-XSRF-TOKEN",this.enableAutoXsrf=!0,this.clearInterceptors(),this}}class l{url;requestOptions={headers:{}};abortController;queryParams=new URLSearchParams;autoApplyCsrfProtection=!0;requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];constructor(t){this.url=t}getGraphQLOptions(){}createFluentSetter(t,e){const r={};return Object.entries(e).forEach((([e,s])=>{r[e]=()=>(this.requestOptions[t]=s,this)})),Object.assign((e=>(this.requestOptions[t]=e,this)),r)}validateUrl(t){if(!t?.trim())throw new a("Invalid URL",t,this.method);if(t.includes("\0")||t.includes("\r")||t.includes("\n"))throw new a("Invalid URL",t,this.method);const e=t.trim();if(/^https?:\/\//.test(e))try{new URL(e)}catch{throw new a("Invalid URL",e,this.method)}}withHeaders(t){const e={};return Object.entries(t).forEach((([t,r])=>{null!=r&&(e[t]=r)})),this.requestOptions.headers={...this.getHeadersRecord(),...e},this}withHeader(t,e){return this.withHeaders({[t]:e})}withTimeout(t){if(!Number.isFinite(t)||0>=t)throw new a("Invalid timeout",this.url,this.method);return this.requestOptions.timeout=t,this}withRetries(t){if("number"==typeof t){if(!Number.isInteger(t)||0>t)throw new a("Invalid retries: "+t,this.url,this.method);this.requestOptions.retries=t}else{if(!Number.isInteger(t.attempts)||0>t.attempts)throw new a("Invalid attempts: "+t.attempts,this.url,this.method);if(void 0!==t.delay)if("number"==typeof t.delay){if(!Number.isFinite(t.delay)||0>t.delay)throw new a("Invalid delay: "+t.delay,this.url,this.method)}else if("function"!=typeof t.delay)throw new a("Invalid delay: "+typeof t.delay,this.url,this.method);this.requestOptions.retries=t}return this}onRetry(t){return this.requestOptions.onRetry=t,this}get withCredentials(){return this.createFluentSetter("credentials",{INCLUDE:exports.CredentialsPolicy.INCLUDE,OMIT:exports.CredentialsPolicy.OMIT,SAME_ORIGIN:exports.CredentialsPolicy.SAME_ORIGIN})}withAbortController(t){return this.abortController=t,this}withReferrer(t){return this.requestOptions.referrer=t,this}get withReferrerPolicy(){return this.createFluentSetter("referrerPolicy",{ORIGIN:exports.ReferrerPolicy.ORIGIN,UNSAFE_URL:exports.ReferrerPolicy.UNSAFE_URL,SAME_ORIGIN:exports.ReferrerPolicy.SAME_ORIGIN,NO_REFERRER:exports.ReferrerPolicy.NO_REFERRER,STRICT_ORIGIN:exports.ReferrerPolicy.STRICT_ORIGIN,ORIGIN_WHEN_CROSS_ORIGIN:exports.ReferrerPolicy.ORIGIN_WHEN_CROSS_ORIGIN,NO_REFERRER_WHEN_DOWNGRADE:exports.ReferrerPolicy.NO_REFERRER_WHEN_DOWNGRADE,STRICT_ORIGIN_WHEN_CROSS_ORIGIN:exports.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN})}get withRedirect(){return this.createFluentSetter("redirect",{FOLLOW:exports.RedirectMode.FOLLOW,ERROR:exports.RedirectMode.ERROR,MANUAL:exports.RedirectMode.MANUAL})}withKeepAlive(t){return this.requestOptions.keepalive=t,this}get withPriority(){return this.createFluentSetter("priority",{HIGH:exports.RequestPriority.HIGH,LOW:exports.RequestPriority.LOW,AUTO:exports.RequestPriority.AUTO})}withIntegrity(t){return this.requestOptions.integrity=t,this}get withCache(){return this.createFluentSetter("cache",{DEFAULT:"default",NO_STORE:"no-store",RELOAD:"reload",NO_CACHE:"no-cache",FORCE_CACHE:"force-cache",ONLY_IF_CACHED:"only-if-cached"})}withQueryParams(t){return Object.entries(t).forEach((([t,e])=>{null!=e&&(Array.isArray(e)?e.forEach((e=>this.queryParams.append(t,e+""))):this.queryParams.append(t,e+""))})),this}withQueryParam(t,e){return this.withQueryParams({[t]:e})}get withMode(){return this.createFluentSetter("mode",{CORS:exports.RequestMode.CORS,NO_CORS:exports.RequestMode.NO_CORS,SAME_ORIGIN:exports.RequestMode.SAME_ORIGIN,NAVIGATE:exports.RequestMode.NAVIGATE})}withContentType(t){return this.withHeader("Content-Type",t)}withAuthorization(t){return this.withHeader("Authorization",t)}withBasicAuth(t,e){const r=this.encodeBase64(`${t}:${e}`);return this.withAuthorization("Basic "+r)}encodeBase64(t){if("undefined"!=typeof TextEncoder&&"function"==typeof btoa){const e=(new TextEncoder).encode(t);return btoa(String.fromCharCode.call(null,...new Uint8Array(e)))}if("function"==typeof btoa)return btoa(t);if("undefined"!=typeof Buffer)return Buffer.from(t).toString("base64");throw new a("Encoding not supported",this.url,this.method)}withBearerToken(t){return this.withAuthorization("Bearer "+t)}getHeadersRecord(){return"object"==typeof this.requestOptions.headers&&null!==this.requestOptions.headers?this.requestOptions.headers:{}}hasHeader(t){const e=this.getHeadersRecord();return Object.keys(e).some((e=>e.toLowerCase()===t.toLowerCase()))}withCookies(t){if(0===Object.entries(t||{}).length)return this;const e=this.getHeadersRecord(),r=[],s=[];Object.keys(e).forEach((t=>{"cookie"===t.toLowerCase()&&(e[t]&&r.push(e[t]),s.push(t))}));const i=f.formatRequestCookies(t),o=s.length>0?s[0]:"Cookie",n=[...r,i].filter(Boolean).join("; "),h={...e};return s.forEach((t=>{delete h[t]})),this.requestOptions.headers={...h,[o]:n},this}withCookie(t,e){return this.withCookies({[t]:e})}withCsrfToken(t,e="X-CSRF-Token"){return this.withHeader(e,t)}withoutCsrfProtection(){return this.autoApplyCsrfProtection=!1,this}withAntiCsrfHeaders(){return this.withHeader("X-Requested-With","XMLHttpRequest")}withRequestInterceptor(t){return this.requestInterceptors.push(t),this}withResponseInterceptor(t){return this.responseInterceptors.push(t),this}withErrorInterceptor(t){return this.errorInterceptors.push(t),this}async getResponse(){const t=this.formatUrlWithQueryParams(this.url);this.applyCsrfProtection();const e={...this.requestOptions,method:this.method};return this.requestOptions.retries?this.executeWithRetries(t,e):this.executeRequest(t,e)}async getJson(){return(await this.getResponse()).getJson()}async getText(){return(await this.getResponse()).getText()}async getBlob(){return(await this.getResponse()).getBlob()}async getBody(){return(await this.getResponse()).getBody()}async getData(t){return(await this.getResponse()).getData(t)}applyCsrfProtection(){if(!this.autoApplyCsrfProtection)return;const t=d.getInstance();t.isAntiCsrfEnabled()&&this.withAntiCsrfHeaders();const e=t.getCsrfToken();if(e){const r=t.getCsrfHeaderName();this.hasHeader("X-CSRF-Token")||this.hasHeader(r)||this.withHeader(r,e)}if(t.isAutoXsrfEnabled()&&"undefined"!=typeof document){const e=p.getTokenFromCookie(t.getXsrfCookieName());if(e&&p.isValidToken(e)){const r=t.getXsrfHeaderName();this.hasHeader("X-XSRF-TOKEN")||this.hasHeader(r)||this.withHeader(r,e)}}}formatUrlWithQueryParams(t){const e=""+this.queryParams;if(!e)return t;try{const e=new URL(t);return this.queryParams.forEach(((t,r)=>{e.searchParams.append(r,t)})),""+e}catch(r){const s=t.includes("?");return`${t}${s?"&":"?"}${e}`}}async executeWithRetries(t,e){const r=this.requestOptions.retries,s="number"==typeof r?r:r?.attempts||0,i="string"==typeof e.method?e.method:"GET";for(let o=0;s>=o;o++)try{return await this.executeRequest(t,e)}catch(e){const n=e instanceof a?e:a.networkError(t,i,e instanceof Error?e:Error(e+""));if(o>=s)throw n;if(this.requestOptions.onRetry&&await this.requestOptions.onRetry({attempt:o+1,error:n}),"object"==typeof r&&void 0!==r.delay){const e="function"==typeof r.delay?r.delay({attempt:o+1,error:n}):r.delay;if("number"!=typeof e||!Number.isFinite(e)||0>e)throw new a("Invalid delay: "+e,t,i);e>0&&await new Promise((t=>setTimeout(t,e)))}}throw new a("EO",t,i)}async runRequestInterceptors(t){const e=[...d.getInstance().getRequestInterceptors(),...this.requestInterceptors];let r=t;for(let t=0;e.length>t;t++)try{const s=await e[t](r);if(s instanceof Response)return s;r=s}catch(t){throw new a("Req Interceptor failed: "+(t instanceof Error?t.message:t+""),r.url,r.method)}return r}async runResponseInterceptors(t){const e=d.getInstance().getResponseInterceptors(),r=[...this.responseInterceptors,...e.reverse()];let s=t;for(let t=0;r.length>t;t++)try{s=await r[t](s)}catch(t){throw new a("Res Interceptor failed: "+(t instanceof Error?t.message:t+""),s.url||"",s.method||"")}return s}async runErrorInterceptors(t){const e=d.getInstance().getErrorInterceptors(),r=[...this.errorInterceptors,...e.reverse()];let s=t;for(let e=0;r.length>e;e++)try{if(s instanceof u)return s;s=await r[e](s)}catch(r){s=r instanceof a?r:s instanceof a?new a(`Err Interceptor ${e+1} failed: ${r instanceof Error?r.message:r+""}`,s.url,s.method,{status:s.status,response:s.response}):a.networkError(t.url,t.method,r instanceof Error?r:Error(r+""))}return s}createAbortSignal(t,e){let r,s,i=!1;if(!t)return{signal:e?.signal,cleanup:()=>{},wasTimeout:()=>!1};const o="function"==typeof AbortSignal.any,n="function"==typeof AbortSignal.timeout,h=(()=>{if(n){const e=AbortSignal.timeout(t);return e.addEventListener("abort",(()=>i=!0),{once:!0}),e}return s=new AbortController,r=setTimeout((()=>{i=!0,s.abort()}),t),s.signal})();return{signal:e&&o?AbortSignal.any([e.signal,h]):e?this.combineSignalsManually(e.signal,h):h,cleanup:()=>{void 0!==r&&clearTimeout(r)},wasTimeout:()=>i}}combineSignalsManually(t,e){if(t.aborted)return t;if(e.aborted)return e;const r=new AbortController,s=()=>r.abort();return t.addEventListener("abort",s,{once:!0}),e.addEventListener("abort",s,{once:!0}),r.signal}createRequestConfig(t,e){return{url:t,method:"string"==typeof e.method?e.method:"GET",headers:this.getHeadersRecord(),body:e.body,signal:e.signal||void 0,credentials:e.credentials,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,keepalive:e.keepalive,priority:e.priority,integrity:e.integrity,cache:e.cache}}applyRequestConfig(t,e){e.headers=t.headers,void 0!==t.body&&(e.body=t.body),void 0!==t.integrity&&(e.integrity=t.integrity),void 0!==t.cache&&(e.cache=t.cache)}async executeRequest(t,e){const r="string"==typeof e.method?e.method:"GET",s=this.createAbortSignal(this.requestOptions.timeout,this.abortController);try{const i=this.createRequestConfig(t,e),o=await this.runRequestInterceptors(i);if(o instanceof Response){const t=this.getGraphQLOptions(),e=new u(o,this.url,this.method,t);return await this.runResponseInterceptors(e)}let n;this.validateUrl(t=o.url),this.applyRequestConfig(o,e),s.signal&&(e.signal=s.signal);try{n=await fetch(t,e)}catch(e){const i=e instanceof Error?e:Error(e+""),o=i.name,n=i.message.toLowerCase(),h=s.wasTimeout();if(e instanceof DOMException&&"AbortError"===e.name){if(h&&this.requestOptions.timeout)throw a.timeout(t,r,this.requestOptions.timeout);throw a.abortError(t,r)}if((h||"TimeoutError"===o||n.includes("timeout")||n.includes("aborted due to timeout"))&&this.requestOptions.timeout)throw a.timeout(t,r,this.requestOptions.timeout);throw a.networkError(t,r,i)}if(!n.ok)throw a.fromResponse(n,t,r);const h=this.getGraphQLOptions(),c=new u(n,t,r,h);return await this.runResponseInterceptors(c)}catch(e){let s;s=e instanceof a?e:a.networkError(t,r,e instanceof Error?e:Error(e+""));const i=await this.runErrorInterceptors(s);if(i instanceof u)return i;throw i}finally{s.cleanup()}}}class w extends l{body;bodyType;graphQLOptions=void 0;constructor(t){super(t)}withBody(t){if(this.body=t,"string"==typeof t)this.bodyType=n.STRING,this.setContentTypeIfNeeded("text/plain");else if(null===t||"object"!=typeof t||t instanceof FormData||t instanceof Blob||t instanceof File||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream)this.bodyType=n.BINARY;else{this.bodyType=n.JSON,this.setContentTypeIfNeeded("application/json");try{JSON.stringify(t)}catch(t){throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url,this.method)}}return this}withGraphQL(t,e,r){if("string"!=typeof t||0===t.length)throw new a("Invalid query",this.url,this.method);const s={query:t};if(void 0!==e){if("object"!=typeof e||null===e||Array.isArray(e))throw new a("Invalid vars",this.url,this.method);s.variables=e}if(void 0!==r){if("object"!=typeof r||null===r||Array.isArray(r))throw new a("Invalid options",this.url,this.method);this.graphQLOptions={throwOnError:"boolean"==typeof r.throwOnError?r.throwOnError:void 0}}try{JSON.stringify(s)}catch(t){throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url,this.method)}return this.body=s,this.bodyType=n.JSON,this.setContentTypeIfNeeded("application/json"),this}hasContentType(){const t=this.requestOptions.headers;return"object"==typeof t&&null!==t&&Object.keys(t).some((t=>"content-type"===t.toLowerCase()))}setContentTypeIfNeeded(t){this.hasContentType()||this.withContentType(t)}getGraphQLOptions(){return this.graphQLOptions}async getResponse(){return void 0!==this.body&&(this.requestOptions.body&&delete this.requestOptions.body,this.requestOptions.body=this.bodyType===n.JSON?JSON.stringify(this.body):this.body),super.getResponse()}}class y extends l{method=exports.HttpMethod.GET;constructor(t){super(t)}}class E extends l{method=exports.HttpMethod.HEAD;constructor(t){super(t)}}class m extends l{method=exports.HttpMethod.OPTIONS;constructor(t){super(t)}}class x extends l{method=exports.HttpMethod.DELETE;constructor(t){super(t)}}class R extends w{method=exports.HttpMethod.POST;constructor(t){super(t)}}class g extends w{method=exports.HttpMethod.PUT;constructor(t){super(t)}}class I extends w{method=exports.HttpMethod.PATCH;constructor(t){super(t)}}function b(t){return new y(t)}function O(t){return new R(t)}function T(t){return new g(t)}function N(t){return new x(t)}function A(t){return new I(t)}function C(t){return new E(t)}function v(t){return new m(t)}function S(t,e){if(!e)return t||"";if(!t)return e;if(/^https?:\/\//.test(e))return e;try{return""+new URL(e,t.endsWith("/")?t:t+"/")}catch{return t.replace(/\/$/,"")+(e.startsWith("/")?e:"/"+e)}}class L{baseURL;modifiers;withBaseURL(t){return this.baseURL=t,this}addModifier(t){return this.modifiers||(this.modifiers=[]),this.modifiers.push(t),this}get=t=>{const e=b(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};post=t=>{const e=O(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};put=t=>{const e=T(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};del=t=>{const e=N(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};patch=t=>{const e=A(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};head=t=>{const e=C(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};options=t=>{const e=v(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};constructor(){const t=new Proxy(this,{get(e,r){const s=e[r];if(void 0!==s)return"function"==typeof s?(...r)=>{const i=s.apply(e,r);return i===e?t:i}:s;if("string"==typeof r&&r.startsWith("with")&&"withBaseURL"!==r){if("withAbortController"===r||"withBody"===r||"withGraphQL"===r||"withQueryParam"===r||"withQueryParams"===r)return;const s=l.prototype[r];if("function"==typeof s)return(...r)=>(e.addModifier((t=>s.apply(t,r))),t)}}});return t}}function k(){return new L}const U={api:k,get:b,put:T,del:N,post:O,patch:A,head:C,options:v,config:d.getInstance()};exports.CookieUtils=f,exports.DeleteRequest=x,exports.GetRequest=y,exports.HeadRequest=E,exports.OptionsRequest=m,exports.PatchRequest=I,exports.PostRequest=R,exports.PutRequest=g,exports.RequestError=a,exports.ResponseWrapper=u,exports.api=k,exports.default=U,exports.del=N,exports.get=b,exports.head=C,exports.options=v,exports.patch=A,exports.post=O,exports.put=T;//# sourceMappingURL=index.min.cjs.map
|
|
1
|
+
"use strict";var t,e,r,s,i,o,n,h,c;exports.HttpMethod=void 0,(t=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",t.PUT="PUT",t.POST="POST",t.HEAD="HEAD",t.PATCH="PATCH",t.DELETE="DELETE",t.OPTIONS="OPTIONS",exports.RequestPriority=void 0,(e=exports.RequestPriority||(exports.RequestPriority={})).LOW="low",e.HIGH="high",e.AUTO="auto",exports.CredentialsPolicy=void 0,(r=exports.CredentialsPolicy||(exports.CredentialsPolicy={})).OMIT="omit",r.INCLUDE="include",r.SAME_ORIGIN="same-origin",exports.RequestMode=void 0,(s=exports.RequestMode||(exports.RequestMode={})).CORS="cors",s.NO_CORS="no-cors",s.SAME_ORIGIN="same-origin",s.NAVIGATE="navigate",exports.RedirectMode=void 0,(i=exports.RedirectMode||(exports.RedirectMode={})).ERROR="error",i.FOLLOW="follow",i.MANUAL="manual",exports.SameSitePolicy=void 0,(o=exports.SameSitePolicy||(exports.SameSitePolicy={})).LAX="Lax",o.NONE="None",o.STRICT="Strict",function(t){t.JSON="json",t.STRING="string",t.BINARY="binary"}(n||(n={})),exports.ReferrerPolicy=void 0,(h=exports.ReferrerPolicy||(exports.ReferrerPolicy={})).ORIGIN="origin",h.UNSAFE_URL="unsafe-url",h.SAME_ORIGIN="same-origin",h.NO_REFERRER="no-referrer",h.STRICT_ORIGIN="strict-origin",h.ORIGIN_WHEN_CROSS_ORIGIN="origin-when-cross-origin",h.NO_REFERRER_WHEN_DOWNGRADE="no-referrer-when-downgrade",h.STRICT_ORIGIN_WHEN_CROSS_ORIGIN="strict-origin-when-cross-origin",exports.CacheMode=void 0,(c=exports.CacheMode||(exports.CacheMode={})).RELOAD="reload",c.DEFAULT="default",c.NO_CACHE="no-cache",c.NO_STORE="no-store",c.FORCE_CACHE="force-cache",c.ONLY_IF_CACHED="only-if-cached";class a extends Error{status;response;url;method;isTimeout;isAborted;constructor(t,e,r,s={}){super(t,{cause:s.cause}),this.name="RequestError",this.url=e,this.method=r,this.status=s.status,this.response=s.response,this.isTimeout=s.isTimeout,this.isAborted=s.isAborted,Error.captureStackTrace&&Error.captureStackTrace(this,a),Object.setPrototypeOf(this,a.prototype)}static timeout(t,e,r){return new a(`Timeout ${r}ms`,t,e,{isTimeout:!0})}static fromResponse(t,e,r){return new a("HTTP "+t.status,e,r,{status:t.status,response:t})}static networkError(t,e,r){let s=r.message;const i=r.code,o=r.name,n=r.stack||"",h=s.toLowerCase(),c="TimeoutError"===o||h.includes("timeout")||h.includes("aborted due to timeout")||"ETIMEDOUT"===i||n.includes("TimeoutError")||n.includes("timeout");if("fetch failed"===s||"Failed to fetch"===s){const e="ENOTFOUND"===i||"EAI_AGAIN"===i||"EAI_NODATA"===i||n.includes("getaddrinfo")||n.includes("ENOTFOUND")||n.includes("EAI_AGAIN"),r=!c&&("ECONNREFUSED"===i||"ECONNRESET"===i||n.includes("ECONNREFUSED")||n.includes("connect"));s=c?"Timeout "+t:e?"DNS error "+t:r?"Connection refused "+t:"Network error "+t}const u=new a(s,t,e,{...c?{isTimeout:!0}:{}});return r.stack&&(u.stack=`${u.stack||""}\n\nCaused by: ${r.stack}`),u}static abortError(t,e){return new a("Aborted",t,e,{isAborted:!0})}}class u{url;method;response;graphQLOptions;cachedBlob;cachedText;cachedJson;cachedArrayBuffer;constructor(t,e,r,s){this.response=t,this.url=e,this.method=r,s&&(this.graphQLOptions={throwOnError:s.throwOnError})}get status(){return this.response.status}get statusText(){return this.response.statusText}get headers(){return this.response.headers}get ok(){return this.response.ok}get raw(){return this.response}checkBodyNotConsumed(){if(this.response.bodyUsed)throw new a("Body already consumed",this.url||"",this.method||"",{status:this.response.status,response:this.response})}checkGraphQLErrors(t){if(!this.graphQLOptions?.throwOnError||"object"!=typeof t||null===t)return;const e=t;if(!Array.isArray(e.errors)||0===e.errors.length)return;const r=e.errors.map((t=>{if("string"==typeof t)return t;if(t&&"object"==typeof t&&"message"in t){const e=t.message;if(null==e)return"Unknown error";if("string"==typeof e)return e;if("object"==typeof e)try{return JSON.stringify(e)}catch{return"Unknown error"}return e+""}return t+""})).join(", ");throw new a("GraphQL errors: "+r,this.url||"",this.method||"",{status:this.response.status,response:this.response})}async getJson(){if(void 0!==this.cachedJson)return this.cachedJson;this.checkBodyNotConsumed();try{const t=await this.response.json();return this.cachedJson=t,this.checkGraphQLErrors(t),t}catch(t){if(t instanceof a)throw t;throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getText(){if(void 0!==this.cachedText)return this.cachedText;this.checkBodyNotConsumed();try{const t=await this.response.text();return this.cachedText=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getBlob(){if(void 0!==this.cachedBlob)return this.cachedBlob;this.checkBodyNotConsumed();try{const t=await this.response.blob();return this.cachedBlob=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}async getArrayBuffer(){if(void 0!==this.cachedArrayBuffer)return this.cachedArrayBuffer;this.checkBodyNotConsumed();try{const t=await this.response.arrayBuffer();return this.cachedArrayBuffer=t,t}catch(t){throw new a("Read failed: "+(t instanceof Error?t.message:t+""),this.url||"",this.method||"",{status:this.response.status,response:this.response})}}getBody(){return this.checkBodyNotConsumed(),this.response.body}async getData(t){try{const e=await this.getJson();return t?t(e):e}catch(e){if(e instanceof a)throw e;if(t)throw new a("Data selector failed: "+(e instanceof Error?e.message:e+""),this.url||"",this.method||"",{status:this.response.status,response:this.response});throw a.networkError(this.url||"",this.method||"",e instanceof Error?e:Error(e+""))}}}class f{static formatRequestCookies(t){const e=[];return Object.entries(t).forEach((([t,r])=>{let s;s="string"==typeof r?r:r.value,e.push(`${encodeURIComponent(t)}=${encodeURIComponent(s)}`)})),e.join("; ")}}class p{static getTokenFromMeta(t="csrf-token"){if("undefined"==typeof document)return null;const e=document.querySelector(`meta[name="${t}"]`);return e?.getAttribute("content")||null}static getTokenFromCookie(t="csrf-token"){if("undefined"==typeof document)return null;const e=document.cookie.split(";");for(const r of e){const[e,s]=r.trim().split("=");if(e===t)return decodeURIComponent(s)}return null}static isValidToken(t){return!("string"!=typeof t||8>t.length||t.length>10&&(!/^[A-Za-z0-9\-_=+/.]+$/.test(t)||2>[/[A-Z]/.test(t),/[a-z]/.test(t),/[0-9]/.test(t),/[-_=+/.]/.test(t)].filter(Boolean).length))}}class d{static instance;csrfHeaderName="X-CSRF-Token";xsrfCookieName="XSRF-TOKEN";xsrfHeaderName="X-XSRF-TOKEN";csrfToken=null;enableAutoXsrf=!0;enableAntiCsrf=!0;requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];nextInterceptorId=1;constructor(){}static getInstance(){return d.instance||(d.instance=new d),d.instance}setCsrfToken(t){return this.csrfToken=t,this}getCsrfToken(){return this.csrfToken}setCsrfHeaderName(t){return this.csrfHeaderName=t,this}getCsrfHeaderName(){return this.csrfHeaderName}setXsrfCookieName(t){return this.xsrfCookieName=t,this}getXsrfCookieName(){return this.xsrfCookieName}setXsrfHeaderName(t){return this.xsrfHeaderName=t,this}getXsrfHeaderName(){return this.xsrfHeaderName}setEnableAutoXsrf(t){return this.enableAutoXsrf=t,this}isAutoXsrfEnabled(){return this.enableAutoXsrf}setEnableAntiCsrf(t){return this.enableAntiCsrf=t,this}isAntiCsrfEnabled(){return this.enableAntiCsrf}addRequestInterceptor(t){const e=this.nextInterceptorId++;return this.requestInterceptors.push({id:e,interceptor:t}),e}addResponseInterceptor(t){const e=this.nextInterceptorId++;return this.responseInterceptors.push({id:e,interceptor:t}),e}addErrorInterceptor(t){const e=this.nextInterceptorId++;return this.errorInterceptors.push({id:e,interceptor:t}),e}removeRequestInterceptor(t){this.requestInterceptors=this.requestInterceptors.filter((e=>e.id!==t))}removeResponseInterceptor(t){this.responseInterceptors=this.responseInterceptors.filter((e=>e.id!==t))}removeErrorInterceptor(t){this.errorInterceptors=this.errorInterceptors.filter((e=>e.id!==t))}clearInterceptors(){this.requestInterceptors=[],this.responseInterceptors=[],this.errorInterceptors=[]}getRequestInterceptors(){return this.requestInterceptors.map((t=>t.interceptor))}getResponseInterceptors(){return this.responseInterceptors.map((t=>t.interceptor))}getErrorInterceptors(){return this.errorInterceptors.map((t=>t.interceptor))}reset(){return this.csrfToken=null,this.csrfHeaderName="X-CSRF-Token",this.enableAntiCsrf=!0,this.xsrfCookieName="XSRF-TOKEN",this.xsrfHeaderName="X-XSRF-TOKEN",this.enableAutoXsrf=!0,this.clearInterceptors(),this}}class l{url;requestOptions={headers:{}};abortController;queryParams=new URLSearchParams;autoApplyCsrfProtection=!0;requestInterceptors=[];responseInterceptors=[];errorInterceptors=[];constructor(t){this.url=t}getGraphQLOptions(){}createFluentSetter(t,e){const r={};return Object.entries(e).forEach((([e,s])=>{r[e]=()=>(this.requestOptions[t]=s,this)})),Object.assign((e=>(this.requestOptions[t]=e,this)),r)}validateUrl(t){if(!t?.trim())throw new a("Invalid URL",t,this.method);if(t.includes("\0")||t.includes("\r")||t.includes("\n"))throw new a("Invalid URL",t,this.method);const e=t.trim();if(/^https?:\/\//.test(e))try{new URL(e)}catch{throw new a("Invalid URL",e,this.method)}}withHeaders(t){const e={};return Object.entries(t).forEach((([t,r])=>{null!=r&&(e[t]=r)})),this.requestOptions.headers={...this.getHeadersRecord(),...e},this}withHeader(t,e){return this.withHeaders({[t]:e})}withTimeout(t){if(!Number.isFinite(t)||0>=t)throw new a("Invalid timeout",this.url,this.method);return this.requestOptions.timeout=t,this}withRetries(t){if("number"==typeof t){if(!Number.isInteger(t)||0>t)throw new a("Invalid retries: "+t,this.url,this.method);this.requestOptions.retries=t}else{if(!Number.isInteger(t.attempts)||0>t.attempts)throw new a("Invalid attempts: "+t.attempts,this.url,this.method);if(void 0!==t.delay)if("number"==typeof t.delay){if(!Number.isFinite(t.delay)||0>t.delay)throw new a("Invalid delay: "+t.delay,this.url,this.method)}else if("function"!=typeof t.delay)throw new a("Invalid delay: "+typeof t.delay,this.url,this.method);this.requestOptions.retries=t}return this}onRetry(t){return this.requestOptions.onRetry=t,this}get withCredentials(){return this.createFluentSetter("credentials",{INCLUDE:exports.CredentialsPolicy.INCLUDE,OMIT:exports.CredentialsPolicy.OMIT,SAME_ORIGIN:exports.CredentialsPolicy.SAME_ORIGIN})}withAbortController(t){return this.abortController=t,this}withReferrer(t){return this.requestOptions.referrer=t,this}get withReferrerPolicy(){return this.createFluentSetter("referrerPolicy",{ORIGIN:exports.ReferrerPolicy.ORIGIN,UNSAFE_URL:exports.ReferrerPolicy.UNSAFE_URL,SAME_ORIGIN:exports.ReferrerPolicy.SAME_ORIGIN,NO_REFERRER:exports.ReferrerPolicy.NO_REFERRER,STRICT_ORIGIN:exports.ReferrerPolicy.STRICT_ORIGIN,ORIGIN_WHEN_CROSS_ORIGIN:exports.ReferrerPolicy.ORIGIN_WHEN_CROSS_ORIGIN,NO_REFERRER_WHEN_DOWNGRADE:exports.ReferrerPolicy.NO_REFERRER_WHEN_DOWNGRADE,STRICT_ORIGIN_WHEN_CROSS_ORIGIN:exports.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN})}get withRedirect(){return this.createFluentSetter("redirect",{FOLLOW:exports.RedirectMode.FOLLOW,ERROR:exports.RedirectMode.ERROR,MANUAL:exports.RedirectMode.MANUAL})}withKeepAlive(t){return this.requestOptions.keepalive=t,this}get withPriority(){return this.createFluentSetter("priority",{HIGH:exports.RequestPriority.HIGH,LOW:exports.RequestPriority.LOW,AUTO:exports.RequestPriority.AUTO})}withIntegrity(t){return this.requestOptions.integrity=t,this}get withCache(){return this.createFluentSetter("cache",{DEFAULT:"default",NO_STORE:"no-store",RELOAD:"reload",NO_CACHE:"no-cache",FORCE_CACHE:"force-cache",ONLY_IF_CACHED:"only-if-cached"})}withQueryParams(t){return Object.entries(t).forEach((([t,e])=>{null!=e&&(Array.isArray(e)?e.forEach((e=>this.queryParams.append(t,e+""))):this.queryParams.append(t,e+""))})),this}withQueryParam(t,e){return this.withQueryParams({[t]:e})}get withMode(){return this.createFluentSetter("mode",{CORS:exports.RequestMode.CORS,NO_CORS:exports.RequestMode.NO_CORS,SAME_ORIGIN:exports.RequestMode.SAME_ORIGIN,NAVIGATE:exports.RequestMode.NAVIGATE})}withContentType(t){return this.withHeader("Content-Type",t)}withAuthorization(t){return this.withHeader("Authorization",t)}withBasicAuth(t,e){const r=this.encodeBase64(`${t}:${e}`);return this.withAuthorization("Basic "+r)}encodeBase64(t){if("undefined"!=typeof TextEncoder&&"function"==typeof btoa){const e=(new TextEncoder).encode(t);return btoa(String.fromCharCode.call(null,...new Uint8Array(e)))}if("function"==typeof btoa)return btoa(t);if("undefined"!=typeof Buffer)return Buffer.from(t).toString("base64");throw new a("Encoding not supported",this.url,this.method)}withBearerToken(t){return this.withAuthorization("Bearer "+t)}getHeadersRecord(){return"object"==typeof this.requestOptions.headers&&null!==this.requestOptions.headers?this.requestOptions.headers:{}}hasHeader(t){const e=this.getHeadersRecord();return Object.keys(e).some((e=>e.toLowerCase()===t.toLowerCase()))}withCookies(t){if(0===Object.entries(t||{}).length)return this;const e=this.getHeadersRecord(),r=[],s=[];Object.keys(e).forEach((t=>{"cookie"===t.toLowerCase()&&(e[t]&&r.push(e[t]),s.push(t))}));const i=f.formatRequestCookies(t),o=s.length>0?s[0]:"Cookie",n=[...r,i].filter(Boolean).join("; "),h={...e};return s.forEach((t=>{delete h[t]})),this.requestOptions.headers={...h,[o]:n},this}withCookie(t,e){return this.withCookies({[t]:e})}withCsrfToken(t,e="X-CSRF-Token"){return this.withHeader(e,t)}withoutCsrfProtection(){return this.autoApplyCsrfProtection=!1,this}withAntiCsrfHeaders(){return this.withHeader("X-Requested-With","XMLHttpRequest")}withRequestInterceptor(t){return this.requestInterceptors.push(t),this}withResponseInterceptor(t){return this.responseInterceptors.push(t),this}withErrorInterceptor(t){return this.errorInterceptors.push(t),this}async getResponse(){const t=this.formatUrlWithQueryParams(this.url);this.applyCsrfProtection();const e={...this.requestOptions,method:this.method};return this.requestOptions.retries?this.executeWithRetries(t,e):this.executeRequest(t,e)}async getJson(){return(await this.getResponse()).getJson()}async getText(){return(await this.getResponse()).getText()}async getBlob(){return(await this.getResponse()).getBlob()}async getBody(){return(await this.getResponse()).getBody()}async getData(t){return(await this.getResponse()).getData(t)}applyCsrfProtection(){if(!this.autoApplyCsrfProtection)return;const t=d.getInstance();t.isAntiCsrfEnabled()&&this.withAntiCsrfHeaders();const e=t.getCsrfToken();if(e){const r=t.getCsrfHeaderName();this.hasHeader("X-CSRF-Token")||this.hasHeader(r)||this.withHeader(r,e)}if(t.isAutoXsrfEnabled()&&"undefined"!=typeof document){const e=p.getTokenFromCookie(t.getXsrfCookieName());if(e&&p.isValidToken(e)){const r=t.getXsrfHeaderName();this.hasHeader("X-XSRF-TOKEN")||this.hasHeader(r)||this.withHeader(r,e)}}}formatUrlWithQueryParams(t){const e=""+this.queryParams;if(!e)return t;try{const e=new URL(t);return this.queryParams.forEach(((t,r)=>{e.searchParams.append(r,t)})),""+e}catch(r){const s=t.includes("?");return`${t}${s?"&":"?"}${e}`}}async executeWithRetries(t,e){const r=this.requestOptions.retries,s="number"==typeof r?r:r?.attempts||0,i="string"==typeof e.method?e.method:"GET";for(let o=0;s>=o;o++)try{return await this.executeRequest(t,e)}catch(e){const n=e instanceof a?e:a.networkError(t,i,e instanceof Error?e:Error(e+""));if(o>=s)throw n;if(this.requestOptions.onRetry&&await this.requestOptions.onRetry({attempt:o+1,error:n}),"object"==typeof r&&void 0!==r.delay){const e="function"==typeof r.delay?r.delay({attempt:o+1,error:n}):r.delay;if("number"!=typeof e||!Number.isFinite(e)||0>e)throw new a("Invalid delay: "+e,t,i);e>0&&await new Promise((t=>setTimeout(t,e)))}}throw new a("EO",t,i)}async runRequestInterceptors(t){const e=[...d.getInstance().getRequestInterceptors(),...this.requestInterceptors];let r=t;for(let t=0;e.length>t;t++)try{const s=await e[t](r);if(s instanceof Response)return s;r=s}catch(t){throw new a("Req Interceptor failed: "+(t instanceof Error?t.message:t+""),r.url,r.method)}return r}async runResponseInterceptors(t){const e=d.getInstance().getResponseInterceptors(),r=[...this.responseInterceptors,...e.reverse()];let s=t;for(let t=0;r.length>t;t++)try{s=await r[t](s)}catch(t){throw new a("Res Interceptor failed: "+(t instanceof Error?t.message:t+""),s.url||"",s.method||"")}return s}async runErrorInterceptors(t){const e=d.getInstance().getErrorInterceptors(),r=[...this.errorInterceptors,...e.reverse()];let s=t;for(let e=0;r.length>e;e++)try{if(s instanceof u)return s;s=await r[e](s)}catch(r){s=r instanceof a?r:s instanceof a?new a(`Err Interceptor ${e+1} failed: ${r instanceof Error?r.message:r+""}`,s.url,s.method,{status:s.status,response:s.response}):a.networkError(t.url,t.method,r instanceof Error?r:Error(r+""))}return s}createAbortSignal(t,e){let r,s,i=!1;if(!t)return{signal:e?.signal,cleanup:()=>{},wasTimeout:()=>!1};const o="function"==typeof AbortSignal.any,n="function"==typeof AbortSignal.timeout,h=(()=>{if(n){const e=AbortSignal.timeout(t);return e.addEventListener("abort",(()=>i=!0),{once:!0}),e}return s=new AbortController,r=setTimeout((()=>{i=!0,s.abort()}),t),s.signal})();return{signal:e&&o?AbortSignal.any([e.signal,h]):e?this.combineSignalsManually(e.signal,h):h,cleanup:()=>{void 0!==r&&clearTimeout(r)},wasTimeout:()=>i}}combineSignalsManually(t,e){if(t.aborted)return t;if(e.aborted)return e;const r=new AbortController,s=()=>r.abort();return t.addEventListener("abort",s,{once:!0}),e.addEventListener("abort",s,{once:!0}),r.signal}createRequestConfig(t,e){return{url:t,method:"string"==typeof e.method?e.method:"GET",headers:this.getHeadersRecord(),body:e.body,signal:e.signal||void 0,credentials:e.credentials,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,keepalive:e.keepalive,priority:e.priority,integrity:e.integrity,cache:e.cache}}applyRequestConfig(t,e){e.headers=t.headers,void 0!==t.body&&(e.body=t.body),void 0!==t.integrity&&(e.integrity=t.integrity),void 0!==t.cache&&(e.cache=t.cache)}async executeRequest(t,e){const r="string"==typeof e.method?e.method:"GET",s=this.createAbortSignal(this.requestOptions.timeout,this.abortController);try{const i=this.createRequestConfig(t,e),o=await this.runRequestInterceptors(i);if(o instanceof Response){const t=this.getGraphQLOptions(),e=new u(o,this.url,this.method,t);return await this.runResponseInterceptors(e)}let n;this.validateUrl(t=o.url),this.applyRequestConfig(o,e),s.signal&&(e.signal=s.signal);try{n=await fetch(t,e)}catch(e){const i=e instanceof Error?e:Error(e+""),o=i.name,n=i.message.toLowerCase(),h=s.wasTimeout();if(e instanceof DOMException&&"AbortError"===e.name){if(h&&this.requestOptions.timeout)throw a.timeout(t,r,this.requestOptions.timeout);throw a.abortError(t,r)}if((h||"TimeoutError"===o||n.includes("timeout")||n.includes("aborted due to timeout"))&&this.requestOptions.timeout)throw a.timeout(t,r,this.requestOptions.timeout);throw a.networkError(t,r,i)}if(!n.ok)throw a.fromResponse(n,t,r);const h=this.getGraphQLOptions(),c=new u(n,t,r,h);return await this.runResponseInterceptors(c)}catch(e){let s;s=e instanceof a?e:a.networkError(t,r,e instanceof Error?e:Error(e+""));const i=await this.runErrorInterceptors(s);if(i instanceof u)return i;throw i}finally{s.cleanup()}}}class w extends l{body;bodyType;graphQLOptions=void 0;constructor(t){super(t)}withBody(t){if(this.body=t,"string"==typeof t)this.bodyType=n.STRING,this.setContentTypeIfNeeded("text/plain");else if(null===t||"object"!=typeof t||t instanceof FormData||t instanceof Blob||t instanceof File||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof URLSearchParams||t instanceof ReadableStream)this.bodyType=n.BINARY;else{this.bodyType=n.JSON,this.setContentTypeIfNeeded("application/json");try{JSON.stringify(t)}catch(t){throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url,this.method)}}return this}withGraphQL(t,e,r){if("string"!=typeof t||0===t.length)throw new a("Invalid query",this.url,this.method);const s={query:t};if(void 0!==e){if("object"!=typeof e||null===e||Array.isArray(e))throw new a("Invalid vars",this.url,this.method);s.variables=e}if(void 0!==r){if("object"!=typeof r||null===r||Array.isArray(r))throw new a("Invalid options",this.url,this.method);this.graphQLOptions={throwOnError:"boolean"==typeof r.throwOnError?r.throwOnError:void 0}}try{JSON.stringify(s)}catch(t){throw new a("Invalid JSON: "+(t instanceof Error?t.message:t+""),this.url,this.method)}return this.body=s,this.bodyType=n.JSON,this.setContentTypeIfNeeded("application/json"),this}hasContentType(){const t=this.requestOptions.headers;return"object"==typeof t&&null!==t&&Object.keys(t).some((t=>"content-type"===t.toLowerCase()))}setContentTypeIfNeeded(t){this.hasContentType()||this.withContentType(t)}getGraphQLOptions(){return this.graphQLOptions}async getResponse(){return void 0!==this.body&&(this.requestOptions.body&&delete this.requestOptions.body,this.requestOptions.body=this.bodyType===n.JSON?JSON.stringify(this.body):this.body),super.getResponse()}}class y extends l{method=exports.HttpMethod.GET;constructor(t){super(t)}}class E extends l{method=exports.HttpMethod.HEAD;constructor(t){super(t)}}class m extends l{method=exports.HttpMethod.OPTIONS;constructor(t){super(t)}}class x extends l{method=exports.HttpMethod.DELETE;constructor(t){super(t)}}class R extends w{method=exports.HttpMethod.POST;constructor(t){super(t)}}class g extends w{method=exports.HttpMethod.PUT;constructor(t){super(t)}}class I extends w{method=exports.HttpMethod.PATCH;constructor(t){super(t)}}function b(t){return new y(t)}function O(t){return new R(t)}function N(t){return new g(t)}function T(t){return new x(t)}function A(t){return new I(t)}function C(t){return new E(t)}function v(t){return new m(t)}function S(t,e){if(!e)return t||"";if(!t)return e;if(/^https?:\/\//.test(e))return e;try{return""+new URL(e,t.endsWith("/")?t:t+"/")}catch{return t.replace(/\/$/,"")+(e.startsWith("/")?e:"/"+e)}}class k{baseURL;modifiers;withBaseURL(t){return this.baseURL=t,this}addModifier(t){return this.modifiers||(this.modifiers=[]),this.modifiers.push(t),this}get=t=>{const e=b(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};post=t=>{const e=O(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};put=t=>{const e=N(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};del=t=>{const e=T(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};patch=t=>{const e=A(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};head=t=>{const e=C(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};options=t=>{const e=v(S(this.baseURL,t));if(this.modifiers)for(const t of this.modifiers)t(e);return e};constructor(){const t=new Proxy(this,{get(e,r){const s=e[r];if(void 0!==s)return"function"==typeof s?(...r)=>{const i=s.apply(e,r);return i===e?t:i}:s;if("string"==typeof r&&r.startsWith("with")&&"withBaseURL"!==r){if("withAbortController"===r||"withBody"===r||"withGraphQL"===r||"withQueryParam"===r||"withQueryParams"===r)return;const s=l.prototype[r];if("function"==typeof s)return(...r)=>(e.addModifier((t=>s.apply(t,r))),t)}}});return t}}function L(){return new k}const U={api:L,get:b,put:N,del:T,post:O,patch:A,head:C,options:v,config:d.getInstance()};exports.CookieUtils=f,exports.DeleteRequest=x,exports.GetRequest=y,exports.HeadRequest=E,exports.OptionsRequest=m,exports.PatchRequest=I,exports.PostRequest=R,exports.PutRequest=g,exports.RequestError=a,exports.ResponseWrapper=u,exports.api=L,exports.default=U,exports.del=T,exports.get=b,exports.head=C,exports.options=v,exports.patch=A,exports.post=O,exports.put=N;//# sourceMappingURL=index.min.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.min.cjs","sources":["../../../src/enums.ts","../../../src/RequestError.ts","../../../src/ResponseWrapper.ts","../../../src/utils/CookieUtils.ts","../../../src/utils/CsrfUtils.ts","../../../src/utils/Config.ts","../../../src/BaseRequest.ts","../../../src/BodyRequest.ts","../../../src/requestMethods.ts","../../../src/requestFactories.ts","../../../src/apiBuilder.ts","../../../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["HttpMethod","RequestPriority","CredentialsPolicy","RequestMode","RedirectMode","SameSitePolicy","BodyType","ReferrerPolicy","CacheMode","RequestError","Error","status","response","url","method","isTimeout","isAborted","constructor","message","options","super","cause","this","name","captureStackTrace","Object","setPrototypeOf","prototype","timeout","timeoutMs","fromResponse","networkError","originalError","errorCode","code","errorName","stack","errorMessageLower","toLowerCase","isTimeoutError","includes","isDnsError","isConnectionError","error","abortError","ResponseWrapper","graphQLOptions","cachedBlob","cachedText","cachedJson","cachedArrayBuffer","throwOnError","statusText","headers","ok","raw","checkBodyNotConsumed","bodyUsed","checkGraphQLErrors","data","responseData","Array","isArray","errors","length","errorMessage","map","x","String","join","getJson","undefined","parsed","json","getText","text","e","getBlob","blob","getArrayBuffer","arrayBuffer","getBody","body","getData","selector","CookieUtils","formatRequestCookies","cookies","cookiePairs","entries","forEach","valueOrOptions","value","push","encodeURIComponent","CsrfUtils","getTokenFromMeta","metaName","document","meta","querySelector","getAttribute","getTokenFromCookie","cookieName","cookie","split","trim","decodeURIComponent","isValidToken","token","test","filter","Boolean","Config","static","csrfHeaderName","xsrfCookieName","xsrfHeaderName","csrfToken","enableAutoXsrf","enableAntiCsrf","requestInterceptors","responseInterceptors","errorInterceptors","nextInterceptorId","getInstance","instance","setCsrfToken","getCsrfToken","setCsrfHeaderName","getCsrfHeaderName","setXsrfCookieName","getXsrfCookieName","setXsrfHeaderName","getXsrfHeaderName","setEnableAutoXsrf","enable","isAutoXsrfEnabled","setEnableAntiCsrf","isAntiCsrfEnabled","addRequestInterceptor","interceptor","id","addResponseInterceptor","addErrorInterceptor","removeRequestInterceptor","item","removeResponseInterceptor","removeErrorInterceptor","clearInterceptors","getRequestInterceptors","getResponseInterceptors","getErrorInterceptors","reset","BaseRequest","requestOptions","abortController","queryParams","URLSearchParams","autoApplyCsrfProtection","getGraphQLOptions","createFluentSetter","optionName","fluent","key","assign","validateUrl","trimmed","URL","withHeaders","filteredHeaders","getHeadersRecord","withHeader","withTimeout","Number","isFinite","withRetries","retries","isInteger","attempts","delay","onRetry","callback","withCredentials","INCLUDE","OMIT","SAME_ORIGIN","withAbortController","controller","withReferrer","referrer","withReferrerPolicy","ORIGIN","UNSAFE_URL","NO_REFERRER","STRICT_ORIGIN","ORIGIN_WHEN_CROSS_ORIGIN","NO_REFERRER_WHEN_DOWNGRADE","STRICT_ORIGIN_WHEN_CROSS_ORIGIN","withRedirect","FOLLOW","ERROR","MANUAL","withKeepAlive","keepalive","withPriority","HIGH","LOW","AUTO","withIntegrity","integrity","withCache","DEFAULT","NO_STORE","RELOAD","NO_CACHE","FORCE_CACHE","ONLY_IF_CACHED","withQueryParams","params","v","append","withQueryParam","withMode","CORS","NO_CORS","NAVIGATE","withContentType","contentType","withAuthorization","authValue","withBasicAuth","username","password","credentials","encodeBase64","str","TextEncoder","btoa","bytes","encode","fromCharCode","apply","Uint8Array","Buffer","from","toString","withBearerToken","hasHeader","headerName","keys","some","withCookies","currentHeaders","cookieValues","cookieHeaderKeys","cookieString","combinedCookieValue","newHeaders","withCookie","withCsrfToken","withoutCsrfProtection","withAntiCsrfHeaders","withRequestInterceptor","withResponseInterceptor","withErrorInterceptor","getResponse","formatUrlWithQueryParams","applyCsrfProtection","fetchOptions","executeWithRetries","executeRequest","config","globalToken","xsrfToken","queryString","urlObj","searchParams","hasExistingParams","retriesConfig","maxRetries","attempt","requestError","Promise","resolve","setTimeout","runRequestInterceptors","configParam","allInterceptors","currentConfig","i","result","Response","runResponseInterceptors","globalInterceptors","reverse","currentResponse","runErrorInterceptors","currentError","interceptorError","createAbortSignal","externalController","timeoutId","timeoutController","signal","cleanup","wasTimeout","hasAbortSignalAny","AbortSignal","any","hasAbortSignalTimeout","timeoutSignal","addEventListener","once","AbortController","abort","createTimeoutSignal","combineSignalsManually","clearTimeout","signal1","signal2","aborted","createRequestConfig","mode","redirect","referrerPolicy","priority","cache","applyRequestConfig","abortSignal","requestConfig","interceptorResult","wrappedResponse","fetch","errorObj","isOurTimeout","DOMException","BodyRequest","bodyType","withBody","STRING","setContentTypeIfNeeded","FormData","Blob","File","ArrayBuffer","isView","ReadableStream","BINARY","JSON","stringify","withGraphQL","query","variables","graphQLBody","hasContentType","header","GetRequest","GET","HeadRequest","HEAD","OptionsRequest","OPTIONS","DeleteRequest","DELETE","PostRequest","POST","PutRequest","PUT","PatchRequest","PATCH","get","post","put","del","patch","head","resolveURL","baseURL","endsWith","replace","startsWith","ApiBuilder","modifiers","withBaseURL","addModifier","modifier","request","proxy","Proxy","target","prop","propertyValue","args","prototypeMethod","api","create"],"mappings":"AAAA,aAGA,IAAYA,EAaAC,EASAC,EASAC,EAUAC,EASAC,EASAC,EASAC,EAcAC,EAlFAR,QAQXA,gBAAA,GARWA,EAAAA,qBAAAA,QAAAA,WAQX,CAAA,IAPC,IAAA,MACAA,EAAA,IAAA,MACAA,EAAA,KAAA,OACAA,EAAA,KAAA,OACAA,EAAA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,QAAA,UAMUC,QAIXA,qBAAA,GAJWA,EAAAA,0BAAAA,QAAAA,gBAIX,CAAA,IAHC,IAAA,MACAA,EAAA,KAAA,OACAA,EAAA,KAAA,OAMUC,QAIXA,uBAAA,GAJWA,EAAAA,4BAAAA,QAAAA,kBAIX,CAAA,IAHC,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,YAAA,cAMUC,QAKXA,iBAAA,GALWA,EAAAA,sBAAAA,QAAAA,YAKX,CAAA,IAJC,KAAA,OACAA,EAAA,QAAA,UACAA,EAAA,YAAA,cACAA,EAAA,SAAA,WAMUC,QAIXA,kBAAA,GAJWA,EAAAA,uBAAAA,QAAAA,aAIX,CAAA,IAHC,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,OAAA,SAMUC,QAIXA,oB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,OAAOA,CACR,WAuBaO,IACd,OAAO,IAAIb,CACb,CC9OA,MAAMc,EAAS,CACbD,MACAxB,MACAE,MACAC,MACAF,OACAG,QACAC,OACArW,UACA6P,OAAQ/J,EAAOY"}
|
|
1
|
+
{"version":3,"file":"index.min.cjs","sources":["../../../src/enums.ts","../../../src/RequestError.ts","../../../src/ResponseWrapper.ts","../../../src/utils/CookieUtils.ts","../../../src/utils/CsrfUtils.ts","../../../src/utils/Config.ts","../../../src/BaseRequest.ts","../../../src/BodyRequest.ts","../../../src/requestMethods.ts","../../../src/requestFactories.ts","../../../src/apiBuilder.ts","../../../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null],"names":["HttpMethod","RequestPriority","CredentialsPolicy","RequestMode","RedirectMode","SameSitePolicy","BodyType","ReferrerPolicy","CacheMode","RequestError","Error","status","response","url","method","isTimeout","isAborted","constructor","message","options","super","cause","this","name","captureStackTrace","Object","setPrototypeOf","prototype","timeout","timeoutMs","fromResponse","networkError","originalError","errorCode","code","errorName","stack","errorMessageLower","toLowerCase","isTimeoutError","includes","isDnsError","isConnectionError","error","abortError","ResponseWrapper","graphQLOptions","cachedBlob","cachedText","cachedJson","cachedArrayBuffer","throwOnError","statusText","headers","ok","raw","checkBodyNotConsumed","bodyUsed","checkGraphQLErrors","data","responseData","Array","isArray","errors","length","errorMessage","map","x","JSON","stringify","String","join","getJson","undefined","parsed","json","getText","text","e","getBlob","blob","getArrayBuffer","arrayBuffer","getBody","body","getData","selector","CookieUtils","formatRequestCookies","cookies","cookiePairs","entries","forEach","valueOrOptions","value","push","encodeURIComponent","CsrfUtils","getTokenFromMeta","metaName","document","meta","querySelector","getAttribute","getTokenFromCookie","cookieName","cookie","split","trim","decodeURIComponent","isValidToken","token","test","filter","Boolean","Config","static","csrfHeaderName","xsrfCookieName","xsrfHeaderName","csrfToken","enableAutoXsrf","enableAntiCsrf","requestInterceptors","responseInterceptors","errorInterceptors","nextInterceptorId","getInstance","instance","setCsrfToken","getCsrfToken","setCsrfHeaderName","getCsrfHeaderName","setXsrfCookieName","getXsrfCookieName","setXsrfHeaderName","getXsrfHeaderName","setEnableAutoXsrf","enable","isAutoXsrfEnabled","setEnableAntiCsrf","isAntiCsrfEnabled","addRequestInterceptor","interceptor","id","addResponseInterceptor","addErrorInterceptor","removeRequestInterceptor","item","removeResponseInterceptor","removeErrorInterceptor","clearInterceptors","getRequestInterceptors","getResponseInterceptors","getErrorInterceptors","reset","BaseRequest","requestOptions","abortController","queryParams","URLSearchParams","autoApplyCsrfProtection","getGraphQLOptions","createFluentSetter","optionName","fluent","key","assign","validateUrl","trimmed","URL","withHeaders","filteredHeaders","getHeadersRecord","withHeader","withTimeout","Number","isFinite","withRetries","retries","isInteger","attempts","delay","onRetry","callback","withCredentials","INCLUDE","OMIT","SAME_ORIGIN","withAbortController","controller","withReferrer","referrer","withReferrerPolicy","ORIGIN","UNSAFE_URL","NO_REFERRER","STRICT_ORIGIN","ORIGIN_WHEN_CROSS_ORIGIN","NO_REFERRER_WHEN_DOWNGRADE","STRICT_ORIGIN_WHEN_CROSS_ORIGIN","withRedirect","FOLLOW","ERROR","MANUAL","withKeepAlive","keepalive","withPriority","HIGH","LOW","AUTO","withIntegrity","integrity","withCache","DEFAULT","NO_STORE","RELOAD","NO_CACHE","FORCE_CACHE","ONLY_IF_CACHED","withQueryParams","params","v","append","withQueryParam","withMode","CORS","NO_CORS","NAVIGATE","withContentType","contentType","withAuthorization","authValue","withBasicAuth","username","password","credentials","encodeBase64","str","TextEncoder","btoa","bytes","encode","fromCharCode","apply","Uint8Array","Buffer","from","toString","withBearerToken","hasHeader","headerName","keys","some","withCookies","currentHeaders","cookieValues","cookieHeaderKeys","cookieString","combinedCookieValue","newHeaders","withCookie","withCsrfToken","withoutCsrfProtection","withAntiCsrfHeaders","withRequestInterceptor","withResponseInterceptor","withErrorInterceptor","getResponse","formatUrlWithQueryParams","applyCsrfProtection","fetchOptions","executeWithRetries","executeRequest","config","globalToken","xsrfToken","queryString","urlObj","searchParams","_error","hasExistingParams","retriesConfig","maxRetries","attempt","requestError","Promise","resolve","setTimeout","runRequestInterceptors","configParam","allInterceptors","currentConfig","i","result","Response","runResponseInterceptors","globalInterceptors","reverse","currentResponse","runErrorInterceptors","currentError","interceptorError","createAbortSignal","externalController","timeoutId","timeoutController","signal","cleanup","wasTimeout","hasAbortSignalAny","AbortSignal","any","hasAbortSignalTimeout","timeoutSignal","addEventListener","once","AbortController","abort","createTimeoutSignal","combineSignalsManually","clearTimeout","signal1","signal2","aborted","createRequestConfig","mode","redirect","referrerPolicy","priority","cache","applyRequestConfig","abortSignal","requestConfig","interceptorResult","wrappedResponse","fetch","errorObj","isOurTimeout","DOMException","BodyRequest","bodyType","withBody","STRING","setContentTypeIfNeeded","FormData","Blob","File","ArrayBuffer","isView","ReadableStream","BINARY","withGraphQL","query","variables","graphQLBody","hasContentType","header","GetRequest","GET","HeadRequest","HEAD","OptionsRequest","OPTIONS","DeleteRequest","DELETE","PostRequest","POST","PutRequest","PUT","PatchRequest","PATCH","get","post","put","del","patch","head","resolveURL","baseURL","endsWith","replace","startsWith","ApiBuilder","modifiers","withBaseURL","addModifier","modifier","request","proxy","Proxy","target","prop","propertyValue","args","prototypeMethod","api","create"],"mappings":"AAAA,aAGA,IAAYA,EAaAC,EASAC,EASAC,EAUAC,EASAC,EASAC,EASAC,EAcAC,EAlFAR,QAQXA,gBAAA,GARWA,EAAAA,qBAAAA,QAAAA,WAQX,CAAA,IAPC,IAAA,MACAA,EAAA,IAAA,MACAA,EAAA,KAAA,OACAA,EAAA,KAAA,OACAA,EAAA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,QAAA,UAMUC,QAIXA,qBAAA,GAJWA,EAAAA,0BAAAA,QAAAA,gBAIX,CAAA,IAHC,IAAA,MACAA,EAAA,KAAA,OACAA,EAAA,KAAA,OAMUC,QAIXA,uBAAA,GAJWA,EAAAA,4BAAAA,QAAAA,kBAIX,CAAA,IAHC,KAAA,OACAA,E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AAA8V,CAAImB,EAAQC,GACV,MAAMC,EAAiBF,EAA4CC,GACnE,QAAsB/T,IAAlBgU,EACF,MAA6B,mBAAlBA,EACF,IAAIC,KACT,MAAMpG,EAAUmG,EAAkDrJ,MAAMmJ,EAAQG,GAChF,OAAOpG,IAAWiG,EAAUF,EAA6D/F,CAAM,EAG5FmG,EAET,GAAoB,iBAATD,GAAqBA,EAAKV,WAAW,SAAoB,gBAATU,EAAwB,CACjF,GAAa,wBAATA,GAA2C,aAATA,GAAgC,gBAATA,GAAmC,mBAATA,GAAsC,oBAATA,EAA4B,OAChJ,MAAMG,EAAmB/O,EAAYjI,UAAiD6W,GACtF,GAA+B,mBAApBG,EACT,MAAO,IAAID,KACTH,EAAOL,aAAaE,GAA0BO,EAAwDvJ,MAAMgJ,EAASM,KAC9GL,EAGZ,CAEF,IAEH,OAAOA,CACR,WAuBaO,IACd,OAAO,IAAIb,CACb,CC1NA,MAAMc,EAAS,CACbD,MACAxB,MACAE,MACAC,MACAF,OACAG,QACAC,OACAtW,UACA+P,OAAQ/J,EAAOY"}
|
package/dist/library/types.d.ts
CHANGED
|
@@ -1,38 +1,121 @@
|
|
|
1
1
|
import { HttpMethod, RequestPriority, CredentialsPolicy, RequestMode, RedirectMode, SameSitePolicy, CacheMode, type ReferrerPolicy } from "./enums";
|
|
2
2
|
import type { RequestError } from "./RequestError.js";
|
|
3
3
|
import type { ResponseWrapper } from "./ResponseWrapper.js";
|
|
4
|
+
/**
|
|
5
|
+
* Request body type that extends the standard BodyInit with support for JSON-serializable values.
|
|
6
|
+
* This allows you to pass plain objects and arrays directly, which will be automatically stringified.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // All of these are valid Body types:
|
|
11
|
+
* const body1: Body = { name: 'John', age: 30 }; // Object (auto-stringified)
|
|
12
|
+
* const body2: Body = [1, 2, 3]; // Array (auto-stringified)
|
|
13
|
+
* const body3: Body = 'plain text'; // String
|
|
14
|
+
* const body4: Body = new FormData(); // FormData
|
|
15
|
+
* const body5: Body = new Blob(['content']); // Blob
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
4
18
|
export type Body = BodyInit | Record<string, unknown> | unknown[];
|
|
19
|
+
/**
|
|
20
|
+
* Callback function invoked before each retry attempt.
|
|
21
|
+
* Can be used for logging, implementing custom backoff strategies, or other side effects.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Retry callback options
|
|
24
|
+
* @param options.attempt - The current retry attempt number (1-based, so first retry is 1)
|
|
25
|
+
* @param options.error - The RequestError that triggered this retry
|
|
26
|
+
* @returns `void` or a `Promise<void>` if the callback is async
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const onRetry: RetryCallback = ({ attempt, error }) => {
|
|
31
|
+
* console.log(`Retry attempt ${attempt} after error: ${error.message}`);
|
|
32
|
+
* };
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
5
35
|
export type RetryCallback = (options: {
|
|
6
36
|
attempt: number;
|
|
7
37
|
error: RequestError;
|
|
8
38
|
}) => void | Promise<void>;
|
|
9
39
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
40
|
+
* Function that calculates the delay (in milliseconds) before the next retry attempt.
|
|
41
|
+
* Allows for dynamic delay strategies like exponential backoff or error-based delays.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Delay calculation options
|
|
44
|
+
* @param options.attempt - The current retry attempt number (1-based, so first retry is 1)
|
|
45
|
+
* @param options.error - The RequestError that triggered this retry
|
|
46
|
+
* @returns The delay in milliseconds (must be non-negative)
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Exponential backoff
|
|
51
|
+
* const delayFn: RetryDelayFunction = ({ attempt }) => {
|
|
52
|
+
* return Math.min(1000 * Math.pow(2, attempt - 1), 10000);
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Error-based delay (longer delay for rate limits)
|
|
59
|
+
* const delayFn: RetryDelayFunction = ({ attempt, error }) => {
|
|
60
|
+
* if (error.status === 429) return 5000; // Rate limited, wait 5 seconds
|
|
61
|
+
* return attempt * 1000; // Otherwise, linear backoff
|
|
62
|
+
* };
|
|
63
|
+
* ```
|
|
12
64
|
*/
|
|
13
65
|
export type RetryDelayFunction = (options: {
|
|
14
66
|
attempt: number;
|
|
15
67
|
error: RequestError;
|
|
16
68
|
}) => number;
|
|
17
69
|
/**
|
|
18
|
-
* Configuration object for retry behavior
|
|
70
|
+
* Configuration object for retry behavior.
|
|
71
|
+
* Provides fine-grained control over how failed requests are retried.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* // Fixed delay
|
|
76
|
+
* const config: RetryConfig = {
|
|
77
|
+
* attempts: 3,
|
|
78
|
+
* delay: 1000 // Wait 1 second between retries
|
|
79
|
+
* };
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // Exponential backoff
|
|
85
|
+
* const config: RetryConfig = {
|
|
86
|
+
* attempts: 3,
|
|
87
|
+
* delay: ({ attempt }) => Math.min(1000 * Math.pow(2, attempt - 1), 10000)
|
|
88
|
+
* };
|
|
89
|
+
* ```
|
|
19
90
|
*/
|
|
20
91
|
export interface RetryConfig {
|
|
21
92
|
/**
|
|
22
|
-
* Number of retry attempts before
|
|
93
|
+
* Number of retry attempts before giving up.
|
|
94
|
+
* For example, `attempts: 3` means the request will be tried up to 4 times total (1 initial + 3 retries).
|
|
23
95
|
*/
|
|
24
96
|
attempts: number;
|
|
25
97
|
/**
|
|
26
|
-
* Delay between retries in milliseconds, or a function that calculates the delay
|
|
98
|
+
* Delay between retries in milliseconds, or a function that calculates the delay.
|
|
27
99
|
* - If a number: fixed delay in milliseconds (must be non-negative)
|
|
28
100
|
* - If a function: calculates delay synchronously based on attempt number and error
|
|
29
|
-
* - If not provided: no delay between retries
|
|
101
|
+
* - If not provided: no delay between retries (immediate retry)
|
|
30
102
|
*/
|
|
31
103
|
delay?: number | RetryDelayFunction;
|
|
32
104
|
}
|
|
33
105
|
/**
|
|
34
|
-
* Configuration object passed to request interceptors
|
|
35
|
-
* Contains all the information needed to make the request
|
|
106
|
+
* Configuration object passed to request interceptors.
|
|
107
|
+
* Contains all the information needed to make the request and can be modified by interceptors.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const interceptor: RequestInterceptor = (config) => {
|
|
112
|
+
* // Modify headers
|
|
113
|
+
* config.headers['X-Custom'] = 'value';
|
|
114
|
+
* // Change URL
|
|
115
|
+
* config.url = 'https://other-api.com' + config.url;
|
|
116
|
+
* return config;
|
|
117
|
+
* };
|
|
118
|
+
* ```
|
|
36
119
|
*/
|
|
37
120
|
export interface RequestConfig {
|
|
38
121
|
url: string;
|
|
@@ -51,38 +134,169 @@ export interface RequestConfig {
|
|
|
51
134
|
cache?: CacheMode | RequestCache;
|
|
52
135
|
}
|
|
53
136
|
/**
|
|
54
|
-
* Request interceptor that can modify the request configuration or return an early response
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
137
|
+
* Request interceptor function that can modify the request configuration or return an early response.
|
|
138
|
+
* Interceptors run before the request is sent. If an interceptor returns a Response object,
|
|
139
|
+
* the request is short-circuited and that response is used instead of making the actual request.
|
|
140
|
+
*
|
|
141
|
+
* @param config - The request configuration that can be modified
|
|
142
|
+
* @returns Either:
|
|
143
|
+
* - A modified `RequestConfig` object (request proceeds with modifications)
|
|
144
|
+
* - A `Response` object (request is short-circuited, this response is used)
|
|
145
|
+
* - A Promise resolving to either of the above
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const interceptor: RequestInterceptor = (config) => {
|
|
150
|
+
* // Add custom header
|
|
151
|
+
* config.headers['X-Request-ID'] = generateId();
|
|
152
|
+
* return config;
|
|
153
|
+
* };
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* // Short-circuit request (e.g., for caching)
|
|
159
|
+
* const cacheInterceptor: RequestInterceptor = (config) => {
|
|
160
|
+
* const cached = getFromCache(config.url);
|
|
161
|
+
* if (cached) {
|
|
162
|
+
* return new Response(JSON.stringify(cached));
|
|
163
|
+
* }
|
|
164
|
+
* return config;
|
|
165
|
+
* };
|
|
166
|
+
* ```
|
|
58
167
|
*/
|
|
59
168
|
export type RequestInterceptor = (config: RequestConfig) => RequestConfig | Response | Promise<RequestConfig | Response>;
|
|
60
169
|
/**
|
|
61
|
-
* Response interceptor that can transform the response
|
|
62
|
-
*
|
|
63
|
-
*
|
|
170
|
+
* Response interceptor function that can transform the response.
|
|
171
|
+
* Interceptors run after a successful request, allowing you to modify or log responses.
|
|
172
|
+
*
|
|
173
|
+
* @param response - The ResponseWrapper that can be modified or replaced
|
|
174
|
+
* @returns Either:
|
|
175
|
+
* - A modified `ResponseWrapper` object
|
|
176
|
+
* - A Promise resolving to a `ResponseWrapper`
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const interceptor: ResponseInterceptor = (response) => {
|
|
181
|
+
* console.log(`Response status: ${response.status}`);
|
|
182
|
+
* return response;
|
|
183
|
+
* };
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* // Transform response data
|
|
189
|
+
* const interceptor: ResponseInterceptor = async (response) => {
|
|
190
|
+
* const data = await response.getJson();
|
|
191
|
+
* // Modify data...
|
|
192
|
+
* // Note: You'd need to create a new ResponseWrapper with modified data
|
|
193
|
+
* return response;
|
|
194
|
+
* };
|
|
195
|
+
* ```
|
|
64
196
|
*/
|
|
65
197
|
export type ResponseInterceptor = (response: ResponseWrapper) => ResponseWrapper | Promise<ResponseWrapper>;
|
|
66
198
|
/**
|
|
67
|
-
* Error interceptor that can handle or transform errors
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
199
|
+
* Error interceptor function that can handle or transform errors.
|
|
200
|
+
* Interceptors run when a request fails, allowing you to handle errors, transform them,
|
|
201
|
+
* or recover by returning a ResponseWrapper.
|
|
202
|
+
*
|
|
203
|
+
* @param error - The RequestError that occurred
|
|
204
|
+
* @returns Either:
|
|
205
|
+
* - A modified `RequestError` (error is re-thrown with modifications)
|
|
206
|
+
* - A `ResponseWrapper` (error is recovered, request succeeds with this response)
|
|
207
|
+
* - A Promise resolving to either of the above
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* // Log errors
|
|
212
|
+
* const interceptor: ErrorInterceptor = (error) => {
|
|
213
|
+
* console.error('Request failed:', error);
|
|
214
|
+
* return error; // Re-throw the error
|
|
215
|
+
* };
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* // Recover from specific errors
|
|
221
|
+
* const interceptor: ErrorInterceptor = (error) => {
|
|
222
|
+
* if (error.status === 404) {
|
|
223
|
+
* // Return a default response instead of throwing
|
|
224
|
+
* return new ResponseWrapper(
|
|
225
|
+
* new Response(JSON.stringify({ data: [] }), { status: 200 })
|
|
226
|
+
* );
|
|
227
|
+
* }
|
|
228
|
+
* return error; // Re-throw other errors
|
|
229
|
+
* };
|
|
230
|
+
* ```
|
|
71
231
|
*/
|
|
72
232
|
export type ErrorInterceptor = (error: RequestError) => RequestError | ResponseWrapper | Promise<RequestError | ResponseWrapper>;
|
|
233
|
+
/**
|
|
234
|
+
* Options for setting cookie properties.
|
|
235
|
+
* Note: When used in request cookies (via `withCookies()`), these options are primarily
|
|
236
|
+
* for documentation purposes, as the Cookie header only sends name-value pairs.
|
|
237
|
+
* These options are more relevant when parsing Set-Cookie headers from responses.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* const cookieOptions: CookieOptions = {
|
|
242
|
+
* value: 'abc123',
|
|
243
|
+
* secure: true,
|
|
244
|
+
* httpOnly: true,
|
|
245
|
+
* sameSite: SameSitePolicy.STRICT,
|
|
246
|
+
* expires: new Date('2024-12-31'),
|
|
247
|
+
* path: '/',
|
|
248
|
+
* domain: '.example.com',
|
|
249
|
+
* maxAge: 3600 // 1 hour in seconds
|
|
250
|
+
* };
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
73
253
|
export interface CookieOptions {
|
|
254
|
+
/** The cookie value */
|
|
74
255
|
value: string;
|
|
256
|
+
/** Whether the cookie should only be sent over HTTPS */
|
|
75
257
|
secure?: boolean;
|
|
258
|
+
/** Whether the cookie should not be accessible via JavaScript (HttpOnly flag) */
|
|
76
259
|
httpOnly?: boolean;
|
|
260
|
+
/** SameSite policy for the cookie */
|
|
77
261
|
sameSite?: SameSitePolicy;
|
|
262
|
+
/** Expiration date for the cookie */
|
|
78
263
|
expires?: Date;
|
|
264
|
+
/** Path where the cookie is valid */
|
|
79
265
|
path?: string;
|
|
266
|
+
/** Domain where the cookie is valid */
|
|
80
267
|
domain?: string;
|
|
268
|
+
/** Maximum age of the cookie in seconds */
|
|
81
269
|
maxAge?: number;
|
|
82
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Record type for cookies.
|
|
273
|
+
* Keys are cookie names, values are either simple strings or CookieOptions objects.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* const cookies: CookiesRecord = {
|
|
278
|
+
* sessionId: 'abc123',
|
|
279
|
+
* token: { value: 'xyz789', secure: true }
|
|
280
|
+
* };
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
83
283
|
export type CookiesRecord = Record<string, string | CookieOptions>;
|
|
84
284
|
export { HttpMethod, RequestMode, RedirectMode, SameSitePolicy, RequestPriority, CredentialsPolicy, CacheMode };
|
|
285
|
+
/**
|
|
286
|
+
* Options for GraphQL requests.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const options: GraphQLOptions = {
|
|
291
|
+
* throwOnError: true // Throw RequestError if GraphQL response contains errors
|
|
292
|
+
* };
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
85
295
|
export interface GraphQLOptions {
|
|
296
|
+
/**
|
|
297
|
+
* If `true`, throws a RequestError when the GraphQL response contains errors.
|
|
298
|
+
* If `false` or undefined, errors are returned in the response data and must be checked manually.
|
|
299
|
+
*/
|
|
86
300
|
throwOnError?: boolean;
|
|
87
301
|
}
|
|
88
302
|
export interface RequestOptions extends Omit<RequestInit, "signal" | "body" | "method" | "credentials" | "mode" | "redirect" | "priority" | "cache"> {
|