@npora/request 1.18.3 → 1.19.0
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 +13 -0
- package/dist/{MockAdapter--6ZwMMQ8.d.ts → MockAdapter-C-0Hh1uW.d.ts} +2 -2
- package/dist/{MockAdapter-BrXOqgTA.d.cts → MockAdapter-zyLuXWEm.d.cts} +2 -2
- package/dist/{Plugin-DYSeSZ6O.d.cts → Plugin-9Z-IZ_NJ.d.cts} +1 -1
- package/dist/{Plugin-C5P_tBXo.d.ts → Plugin-Dx5Jby_c.d.ts} +1 -1
- package/dist/{SchemaValidationError-BANH6INo.d.cts → SchemaValidationError-B2bnpz8J.d.ts} +11 -5
- package/dist/{SchemaValidationError-ljhan6YH.d.ts → SchemaValidationError-MUg6trpg.d.cts} +11 -5
- package/dist/{adapter-CBaLHCEm.d.ts → adapter-c5-nyUCy.d.ts} +1 -1
- package/dist/{adapter-DlZ5Qbou.d.cts → adapter-phBJ1R70.d.cts} +1 -1
- package/dist/{authPlugin-DpE4afbz.d.cts → authPlugin-BtPHJ7EZ.d.cts} +1 -1
- package/dist/{authPlugin-USKx_XNX.d.ts → authPlugin-CVgJvxsA.d.ts} +1 -1
- package/dist/{cachePlugin-CJU2DL8v.cjs → cachePlugin-0cb8h9cY.cjs} +1 -1
- package/dist/{cachePlugin-CCIVn0Vg.js → cachePlugin-C3FQUhLv.js} +1 -1
- package/dist/{cachePlugin-DJGfieqN.d.cts → cachePlugin-DANU1VAL.d.cts} +2 -2
- package/dist/{cachePlugin-XXrPNTfx.d.ts → cachePlugin-DxzbF294.d.ts} +2 -2
- package/dist/{circuitBreakerPlugin-D12NHWon.d.ts → circuitBreakerPlugin-D77O9CVl.d.ts} +2 -2
- package/dist/{circuitBreakerPlugin-tbwS-j5u.d.cts → circuitBreakerPlugin-DHyLSvdy.d.cts} +2 -2
- package/dist/{concurrencyPlugin-W84oJyJP.d.ts → concurrencyPlugin-CizobNMf.d.ts} +2 -2
- package/dist/{concurrencyPlugin-Dvsgel94.d.cts → concurrencyPlugin-D4YMInT5.d.cts} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +5 -5
- package/dist/core.d.ts +5 -5
- package/dist/core.js +1 -1
- package/dist/{createClient-ICkQQqcE.cjs → createClient-BNcd9hoJ.cjs} +1 -1
- package/dist/createClient-BtpOdm47.js +1 -0
- package/dist/{downloadPlugin-DJDuMLwT.d.cts → downloadPlugin-C4ugCtc1.d.cts} +1 -1
- package/dist/{downloadPlugin-DjCZgsVL.d.ts → downloadPlugin-DexFPPeR.d.ts} +1 -1
- package/dist/{errorResponseTimeout-CuRn9Icm.js → errorResponseTimeout-BFkSLlXS.js} +1 -1
- package/dist/{errorResponseTimeout-CUZ0Bx-G.cjs → errorResponseTimeout-ENMLOzj4.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.js +1 -1
- package/dist/isBinaryBody-C7V7uzZ6.js +1 -0
- package/dist/isBinaryBody-CdXW3TxQ.cjs +1 -0
- package/dist/isReadableStream-4C8oyfa_.cjs +1 -0
- package/dist/isReadableStream-CRq9INpv.js +1 -0
- package/dist/loggerPlugin-CSWyHhxS.d.cts +6 -0
- package/dist/loggerPlugin-IGqtnWzy.d.ts +6 -0
- package/dist/{openTelemetryMetricsPlugin-BqUiYPda.d.cts → openTelemetryMetricsPlugin-BtO0nwPY.d.cts} +2 -2
- package/dist/{openTelemetryMetricsPlugin-0UQ5jqvv.d.ts → openTelemetryMetricsPlugin-De76vmwq.d.ts} +2 -2
- package/dist/{openTelemetryPlugin-w3t3yoCr.d.ts → openTelemetryPlugin-BeykGhuv.d.ts} +2 -2
- package/dist/{openTelemetryPlugin-Cuap7zKx.d.cts → openTelemetryPlugin-DX-5cpbR.d.cts} +2 -2
- package/dist/plugins/auth.d.cts +1 -1
- package/dist/plugins/auth.d.ts +1 -1
- package/dist/plugins/cache.cjs +1 -1
- package/dist/plugins/cache.d.cts +1 -1
- package/dist/plugins/cache.d.ts +1 -1
- package/dist/plugins/cache.js +1 -1
- package/dist/plugins/circuit-breaker.d.cts +1 -1
- package/dist/plugins/circuit-breaker.d.ts +1 -1
- package/dist/plugins/concurrency.d.cts +1 -1
- package/dist/plugins/concurrency.d.ts +1 -1
- package/dist/plugins/download.cjs +1 -1
- package/dist/plugins/download.d.cts +1 -1
- package/dist/plugins/download.d.ts +1 -1
- package/dist/plugins/download.js +1 -1
- package/dist/plugins/logger.d.cts +1 -1
- package/dist/plugins/logger.d.ts +1 -1
- package/dist/plugins/memory-cache.d.cts +1 -1
- package/dist/plugins/memory-cache.d.ts +1 -1
- package/dist/plugins/opentelemetry-metrics.cjs +1 -1
- package/dist/plugins/opentelemetry-metrics.d.cts +1 -1
- package/dist/plugins/opentelemetry-metrics.d.ts +1 -1
- package/dist/plugins/opentelemetry-metrics.js +1 -1
- package/dist/plugins/opentelemetry.d.cts +1 -1
- package/dist/plugins/opentelemetry.d.ts +1 -1
- package/dist/plugins/rate-limit.d.cts +1 -1
- package/dist/plugins/rate-limit.d.ts +1 -1
- package/dist/plugins/retry.cjs +1 -1
- package/dist/plugins/retry.d.cts +1 -1
- package/dist/plugins/retry.d.ts +1 -1
- package/dist/plugins/retry.js +1 -1
- package/dist/plugins/upload.cjs +1 -1
- package/dist/plugins/upload.d.cts +1 -1
- package/dist/plugins/upload.d.ts +1 -1
- package/dist/plugins/upload.js +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +12 -12
- package/dist/plugins.d.ts +12 -12
- package/dist/plugins.js +1 -1
- package/dist/{rateLimitPlugin-KOSUTbvE.d.cts → rateLimitPlugin-C357f6EC.d.cts} +2 -2
- package/dist/{rateLimitPlugin-cU0qI8TH.d.ts → rateLimitPlugin-e_IjO32D.d.ts} +2 -2
- package/dist/{response-BmBc0r8_.d.cts → response-BJacGco5.d.cts} +10 -1
- package/dist/{response-BmBc0r8_.d.ts → response-BJacGco5.d.ts} +10 -1
- package/dist/retryPlugin-JAQQ0CbN.d.ts +6 -0
- package/dist/retryPlugin-lpF9dskF.d.cts +6 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{uploadPlugin-CAHUGiz4.d.cts → uploadPlugin-Db0fMNLg.d.cts} +1 -1
- package/dist/{uploadPlugin-C8CgYCKh.d.ts → uploadPlugin-DdVkxO9B.d.ts} +1 -1
- package/dist/validateResponseStatus-CkUhntvh.js +6 -0
- package/dist/validateResponseStatus-DhsoZTyz.cjs +6 -0
- package/dist/{xhrTransport-DUYOjIFO.cjs → xhrTransport-BoLJnrNS.cjs} +1 -1
- package/dist/{xhrTransport-BmjwPxJj.js → xhrTransport-DiFlcZRG.js} +1 -1
- package/package.json +4 -2
- package/dist/createClient-BJInwX7D.js +0 -1
- package/dist/isBinaryBody-B0414zDU.cjs +0 -1
- package/dist/isBinaryBody-i4r46MoJ.js +0 -1
- package/dist/isReadableStream-0eF9O4Xl.cjs +0 -1
- package/dist/isReadableStream-O-PmslRY.js +0 -1
- package/dist/loggerPlugin-DFIXW1B1.d.ts +0 -6
- package/dist/loggerPlugin-DZlxRUT0.d.cts +0 -6
- package/dist/retryPlugin-Df4T3WEv.d.ts +0 -6
- package/dist/retryPlugin-Ir1VPUHq.d.cts +0 -6
- package/dist/validateResponseStatus-CYU2N49m.cjs +0 -6
- package/dist/validateResponseStatus-JYSqdThE.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./RequestError-B0HIY1zK.js";import{
|
|
1
|
+
import{n as e,t}from"./RequestError-B0HIY1zK.js";import{d as n}from"./validateResponseStatus-CkUhntvh.js";import{n as r,r as i,t as a}from"./isBinaryBody-C7V7uzZ6.js";import{t as o}from"./isReadableStream-CRq9INpv.js";function createTimeoutSignal(e,n,r=`Request timeout after ${n}ms`){if(!n||n<=0||e?.aborted)return{signal:e,clear:noop$1};let i=new AbortController,a,onAbort,clear=()=>{if(a!==void 0&&(clearTimeout(a),a=void 0),e&&onAbort){try{e.removeEventListener(`abort`,onAbort)}catch{}onAbort=void 0}};if(e){onAbort=()=>{clear(),i.abort(e.reason??new t(`Request aborted`,{code:`ABORT_ERROR`}))};try{e.addEventListener(`abort`,onAbort,{once:!0})}catch(e){throw clear(),e}if(e.aborted&&!i.signal.aborted&&onAbort(),i.signal.aborted)return{signal:i.signal,clear}}try{a=setTimeout(()=>{clear(),i.abort(new t(r,{code:`TIMEOUT_ERROR`}))},n)}catch(e){throw clear(),e}return i.signal.aborted&&clear(),{signal:i.signal,clear}}function noop$1(){}const s=Object.prototype.hasOwnProperty,c=Symbol(`nativeRequest`);function isRequest(e){if(typeof e!=`object`||!e||typeof Request>`u`)return!1;try{let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null)return!1;let n=Object.getOwnPropertyDescriptor(Request.prototype,`url`)?.get;return n?(n.call(e),!0):!1}catch{return!1}}function rememberRequestBody(e,t,n=t.body){e[c]={request:t,body:n}}function getRequestForBody(e,t){let n=e[c];return n&&n.body===t?n.request:void 0}const l={json:`application/json`,text:`text/*`,blob:`*/*`,arrayBuffer:`*/*`,bytes:`*/*`,formData:`multipart/form-data`,stream:`*/*`,sse:`text/event-stream`,ndjson:`application/x-ndjson, application/ndjson`},u=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function buildRequest(e){return buildRequestWithHeaders(e,new Headers(e.headers))}function buildRequestWithHeaders(e,t){setAccept(t,e.responseType);let n=buildBody(e,t);validateRequestBodySize(n,e);let r={},i=n;n=limitStreamingRequestBody(n,e,r);let a=buildURL(e),s=resolveNativeRequestInput(e,n,a,e.method),c={...e.fetchOptions,method:e.method??`GET`,headers:t,signal:e.signal};s||(c.body=n,n&&o(n)&&(c.duplex=`half`));let l=e.timeout&&e.timeout>0?createTimeoutSignal(e.signal,e.timeout):void 0;return l&&(c.signal=l.signal),{url:a,input:s,useNativeInput:s?canUseNativeInput(s,c,e.fetchOptions):!1,init:c,clear:l?.clear??noop,bodyError:n===i?void 0:r}}function canUseNativeInput(e,t,n){return t.method!==e.method||t.signal!==e.signal||!headersEqual(e.headers,t.headers)?!1:n===void 0||n.cache===e.cache&&n.credentials===e.credentials&&n.integrity===e.integrity&&n.keepalive===e.keepalive&&n.mode===e.mode&&n.redirect===e.redirect&&n.referrer===e.referrer&&n.referrerPolicy===e.referrerPolicy&&Reflect.ownKeys(n).length===8}function headersEqual(e,t){let n=new Headers(t),r=0;for(let[t,i]of e){if(n.get(t)!==i)return!1;r+=1}for(let e of n)--r;return r===0}function resolveNativeRequestInput(e,t,n,r){let i=getRequestForBody(e,t);return i?.url===n&&i.method===(r??`GET`)?i:void 0}function setAccept(e,t){!t||e.has(`accept`)||e.set(`accept`,l[t])}function buildURL(e){let t=joinURL(e.baseURL,String(e.url));if(!e.query&&!e.searchParams)return t;let n=serializeQuery(e);if(!n)return t;let r=t.indexOf(`#`),i=r===-1?t:t.slice(0,r),a=r===-1?``:t.slice(r),o=i.charCodeAt(i.length-1);return`${i}${i.includes(`?`)?o===63||o===38?``:`&`:`?`}${n}${a}`}function serializeQuery(e){if(e.searchParams)return e.searchParams.toString();let n=e.query;if(!e.querySerializer)return stringifyQuery(n);let r;try{r=e.querySerializer(n)}catch(n){throw new t(`Request query serialization failed`,{code:`CONFIG_ERROR`,config:e,cause:n})}if(typeof r!=`string`)throw new t(`Request querySerializer must return a string`,{code:`CONFIG_ERROR`,config:e});return r.startsWith(`?`)?r.slice(1):r}function joinURL(e,t){if(!e||isAbsoluteURL(t))return t;if(!t)return e;let n=e.includes(`?`)||e.includes(`#`),r=t.charCodeAt(0);if(!n&&r!==63&&r!==35)return joinURLPath(e,t);let i=u.exec(e),a=u.exec(t),o=joinURLPath(i[1],a[1]),s=i[2]??``,c=a[2]??``,l=s&&c?`${s}&${c}`:s||c,d=a[3]||i[3]||``;return`${o}${l?`?${l}`:``}${d}`}function joinURLPath(e,t){if(!t)return e;let n=e.length,r=0;for(;n>0&&e.charCodeAt(n-1)===47;)--n;for(;r<t.length&&t.charCodeAt(r)===47;)r+=1;return`${e.slice(0,n)}/${t.slice(r)}`}function isAbsoluteURL(e){if(e.startsWith(`//`))return!0;let t=e.indexOf(`:`);return t<=0?!1:/^[a-z][a-z\d+\-.]*$/i.test(e.slice(0,t))}function stringifyQuery(e){let t=new URLSearchParams;for(let n in e)s.call(e,n)&&appendQuery(t,n,e[n]);return t.toString()}function appendQuery(e,t,n){if(n!==void 0){if(n===null){e.append(t,``);return}if(Array.isArray(n)){for(let r of n)r!==void 0&&e.append(t,r===null?``:String(r));return}e.append(t,String(n))}}function buildBody(e,t){if(e.json!==void 0)return setContentType(t,`application/json`),stringifyJson(e.json,e);if(e.form!==void 0)return setContentType(t,`application/x-www-form-urlencoded;charset=UTF-8`),buildURLSearchParams(e.form);if(e.formData!==void 0)return buildFormData(e.formData,e.maxFormDataDepth);if(e.body!==null&&e.body!==void 0)return isPlainObject(e.body)?(setContentType(t,`application/json`),stringifyJson(e.body,e)):e.body}function stringifyJson(e,t){let n=t.stringifyJson?t.stringifyJson(e):JSON.stringify(e);if(typeof n!=`string`)throw TypeError(`Request JSON stringifier must return a string`);return n}function buildURLSearchParams(e){if(i(e))return e;let t=new URLSearchParams;for(let n in e)s.call(e,n)&&appendQuery(t,n,e[n]);return t}function buildFormData(e,t=32){if(n(e))return e;let r=new FormData,i=new WeakSet;for(let n in e)s.call(e,n)&&appendFormDataValue(r,n,e[n],0,t,i);return r}function appendFormDataValue(e,t,n,i,a,o){if(n!=null){if(Array.isArray(n)){if(o.has(n))throw TypeError(`FormData arrays cannot contain circular references`);let r=i+1;if(r>a)throw RangeError(`FormData array depth exceeds maxFormDataDepth ${a}`);o.add(n);try{for(let i of n)appendFormDataValue(e,t,i,r,a,o)}finally{o.delete(n)}return}if(r(n)){e.append(t,n);return}e.append(t,String(n))}}function setContentType(e,t){e.has(`content-type`)||e.set(`content-type`,t)}function validateRequestBodySize(e,n){let r=n.maxRequestSize;if(!Number.isFinite(r)||e===void 0)return;let i=getRequestBodySize(e);if(i!==void 0&&i>(r??1/0))throw new t(`Request body exceeds maxRequestSize ${r}`,{code:`REQUEST_TOO_LARGE`,config:n})}function getRequestBodySize(e){if(typeof e==`string`)return utf8ByteLength(e);if(i(e))return utf8ByteLength(e.toString());if(r(e))return e.size;if(a(e)||ArrayBuffer.isView(e))return e.byteLength}function limitStreamingRequestBody(e,n,r){let i=n.maxRequestSize;if(!o(e)||!Number.isFinite(i))return e;let a=e,s,c=0;return new ReadableStream({async pull(e){s??(s=a.getReader());try{let a=await s.read();if(a.done){s.releaseLock(),s=void 0,e.close();return}if(c+=a.value.byteLength,c>(i??1/0)){let e=new t(`Request body exceeds maxRequestSize ${i}`,{code:`REQUEST_TOO_LARGE`,config:n});throw r.current=e,s.cancel(e).catch(()=>{}),s.releaseLock(),s=void 0,e}e.enqueue(a.value)}catch(e){throw s&&(s.releaseLock(),s=void 0),e}},async cancel(e){if(s)try{await s.cancel(e)}finally{s.releaseLock(),s=void 0}else a.locked||await a.cancel(e)}})}function utf8ByteLength(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r<128)t+=1;else if(r<2048)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=4,n+=1):t+=3}else t+=3}return t}function isPlainObject(e){return Object.prototype.toString.call(e)===`[object Object]`}function noop(){}function resolveErrorResponseSizeLimit(e){let t=e.maxErrorResponseSize??10485760,n=e.maxResponseSize;return Number.isFinite(t)&&(!Number.isFinite(n)||t<(n??1/0))?t:void 0}const d=Symbol(`ERROR_RESPONSE_DATA_UNAVAILABLE`);async function withErrorResponseTimeout(n,r,i){let a=n.timeout??0,o=a>0?a:1e4,s=new AbortController,c,l=!1,u,cancelOperation=()=>{try{i?.()}catch{}s.abort()};try{let i=new Promise((e,r)=>{c=setTimeout(()=>{if(l=!0,cancelOperation(),a>0){r(new t(`Request timeout after ${a}ms`,{code:`TIMEOUT_ERROR`,config:n}));return}e(d)},o)});u=r(s.signal);try{return await Promise.race([u,i])}catch(t){if(e(t)&&t.code===`PARSER_ERROR`)return d;throw t}}finally{c!==void 0&&!l&&clearTimeout(c),u?.catch(()=>{})}}export{buildRequestWithHeaders as a,rememberRequestBody as c,buildRequest as i,s as l,withErrorResponseTimeout as n,isAbsoluteURL as o,resolveErrorResponseSizeLimit as r,isRequest as s,d as t,createTimeoutSignal as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./validateResponseStatus-
|
|
1
|
+
const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./validateResponseStatus-DhsoZTyz.cjs"),n=require("./isBinaryBody-CdXW3TxQ.cjs"),r=require("./isReadableStream-4C8oyfa_.cjs");function createTimeoutSignal(t,n,r=`Request timeout after ${n}ms`){if(!n||n<=0||t?.aborted)return{signal:t,clear:noop$1};let i=new AbortController,a,onAbort,clear=()=>{if(a!==void 0&&(clearTimeout(a),a=void 0),t&&onAbort){try{t.removeEventListener(`abort`,onAbort)}catch{}onAbort=void 0}};if(t){onAbort=()=>{clear(),i.abort(t.reason??new e.t(`Request aborted`,{code:`ABORT_ERROR`}))};try{t.addEventListener(`abort`,onAbort,{once:!0})}catch(e){throw clear(),e}if(t.aborted&&!i.signal.aborted&&onAbort(),i.signal.aborted)return{signal:i.signal,clear}}try{a=setTimeout(()=>{clear(),i.abort(new e.t(r,{code:`TIMEOUT_ERROR`}))},n)}catch(e){throw clear(),e}return i.signal.aborted&&clear(),{signal:i.signal,clear}}function noop$1(){}const i=Object.prototype.hasOwnProperty,a=Symbol(`nativeRequest`);function isRequest(e){if(typeof e!=`object`||!e||typeof Request>`u`)return!1;try{let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null)return!1;let n=Object.getOwnPropertyDescriptor(Request.prototype,`url`)?.get;return n?(n.call(e),!0):!1}catch{return!1}}function rememberRequestBody(e,t,n=t.body){e[a]={request:t,body:n}}function getRequestForBody(e,t){let n=e[a];return n&&n.body===t?n.request:void 0}const o={json:`application/json`,text:`text/*`,blob:`*/*`,arrayBuffer:`*/*`,bytes:`*/*`,formData:`multipart/form-data`,stream:`*/*`,sse:`text/event-stream`,ndjson:`application/x-ndjson, application/ndjson`},s=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function buildRequest(e){return buildRequestWithHeaders(e,new Headers(e.headers))}function buildRequestWithHeaders(e,t){setAccept(t,e.responseType);let n=buildBody(e,t);validateRequestBodySize(n,e);let i={},a=n;n=limitStreamingRequestBody(n,e,i);let o=buildURL(e),s=resolveNativeRequestInput(e,n,o,e.method),c={...e.fetchOptions,method:e.method??`GET`,headers:t,signal:e.signal};s||(c.body=n,n&&r.t(n)&&(c.duplex=`half`));let l=e.timeout&&e.timeout>0?createTimeoutSignal(e.signal,e.timeout):void 0;return l&&(c.signal=l.signal),{url:o,input:s,useNativeInput:s?canUseNativeInput(s,c,e.fetchOptions):!1,init:c,clear:l?.clear??noop,bodyError:n===a?void 0:i}}function canUseNativeInput(e,t,n){return t.method!==e.method||t.signal!==e.signal||!headersEqual(e.headers,t.headers)?!1:n===void 0||n.cache===e.cache&&n.credentials===e.credentials&&n.integrity===e.integrity&&n.keepalive===e.keepalive&&n.mode===e.mode&&n.redirect===e.redirect&&n.referrer===e.referrer&&n.referrerPolicy===e.referrerPolicy&&Reflect.ownKeys(n).length===8}function headersEqual(e,t){let n=new Headers(t),r=0;for(let[t,i]of e){if(n.get(t)!==i)return!1;r+=1}for(let e of n)--r;return r===0}function resolveNativeRequestInput(e,t,n,r){let i=getRequestForBody(e,t);return i?.url===n&&i.method===(r??`GET`)?i:void 0}function setAccept(e,t){!t||e.has(`accept`)||e.set(`accept`,o[t])}function buildURL(e){let t=joinURL(e.baseURL,String(e.url));if(!e.query&&!e.searchParams)return t;let n=serializeQuery(e);if(!n)return t;let r=t.indexOf(`#`),i=r===-1?t:t.slice(0,r),a=r===-1?``:t.slice(r),o=i.charCodeAt(i.length-1);return`${i}${i.includes(`?`)?o===63||o===38?``:`&`:`?`}${n}${a}`}function serializeQuery(t){if(t.searchParams)return t.searchParams.toString();let n=t.query;if(!t.querySerializer)return stringifyQuery(n);let r;try{r=t.querySerializer(n)}catch(n){throw new e.t(`Request query serialization failed`,{code:`CONFIG_ERROR`,config:t,cause:n})}if(typeof r!=`string`)throw new e.t(`Request querySerializer must return a string`,{code:`CONFIG_ERROR`,config:t});return r.startsWith(`?`)?r.slice(1):r}function joinURL(e,t){if(!e||isAbsoluteURL(t))return t;if(!t)return e;let n=e.includes(`?`)||e.includes(`#`),r=t.charCodeAt(0);if(!n&&r!==63&&r!==35)return joinURLPath(e,t);let i=s.exec(e),a=s.exec(t),o=joinURLPath(i[1],a[1]),c=i[2]??``,l=a[2]??``,u=c&&l?`${c}&${l}`:c||l,d=a[3]||i[3]||``;return`${o}${u?`?${u}`:``}${d}`}function joinURLPath(e,t){if(!t)return e;let n=e.length,r=0;for(;n>0&&e.charCodeAt(n-1)===47;)--n;for(;r<t.length&&t.charCodeAt(r)===47;)r+=1;return`${e.slice(0,n)}/${t.slice(r)}`}function isAbsoluteURL(e){if(e.startsWith(`//`))return!0;let t=e.indexOf(`:`);return t<=0?!1:/^[a-z][a-z\d+\-.]*$/i.test(e.slice(0,t))}function stringifyQuery(e){let t=new URLSearchParams;for(let n in e)i.call(e,n)&&appendQuery(t,n,e[n]);return t.toString()}function appendQuery(e,t,n){if(n!==void 0){if(n===null){e.append(t,``);return}if(Array.isArray(n)){for(let r of n)r!==void 0&&e.append(t,r===null?``:String(r));return}e.append(t,String(n))}}function buildBody(e,t){if(e.json!==void 0)return setContentType(t,`application/json`),stringifyJson(e.json,e);if(e.form!==void 0)return setContentType(t,`application/x-www-form-urlencoded;charset=UTF-8`),buildURLSearchParams(e.form);if(e.formData!==void 0)return buildFormData(e.formData,e.maxFormDataDepth);if(e.body!==null&&e.body!==void 0)return isPlainObject(e.body)?(setContentType(t,`application/json`),stringifyJson(e.body,e)):e.body}function stringifyJson(e,t){let n=t.stringifyJson?t.stringifyJson(e):JSON.stringify(e);if(typeof n!=`string`)throw TypeError(`Request JSON stringifier must return a string`);return n}function buildURLSearchParams(e){if(n.r(e))return e;let t=new URLSearchParams;for(let n in e)i.call(e,n)&&appendQuery(t,n,e[n]);return t}function buildFormData(e,n=32){if(t.d(e))return e;let r=new FormData,a=new WeakSet;for(let t in e)i.call(e,t)&&appendFormDataValue(r,t,e[t],0,n,a);return r}function appendFormDataValue(e,t,r,i,a,o){if(r!=null){if(Array.isArray(r)){if(o.has(r))throw TypeError(`FormData arrays cannot contain circular references`);let n=i+1;if(n>a)throw RangeError(`FormData array depth exceeds maxFormDataDepth ${a}`);o.add(r);try{for(let i of r)appendFormDataValue(e,t,i,n,a,o)}finally{o.delete(r)}return}if(n.n(r)){e.append(t,r);return}e.append(t,String(r))}}function setContentType(e,t){e.has(`content-type`)||e.set(`content-type`,t)}function validateRequestBodySize(t,n){let r=n.maxRequestSize;if(!Number.isFinite(r)||t===void 0)return;let i=getRequestBodySize(t);if(i!==void 0&&i>(r??1/0))throw new e.t(`Request body exceeds maxRequestSize ${r}`,{code:`REQUEST_TOO_LARGE`,config:n})}function getRequestBodySize(e){if(typeof e==`string`)return utf8ByteLength(e);if(n.r(e))return utf8ByteLength(e.toString());if(n.n(e))return e.size;if(n.t(e)||ArrayBuffer.isView(e))return e.byteLength}function limitStreamingRequestBody(t,n,i){let a=n.maxRequestSize;if(!r.t(t)||!Number.isFinite(a))return t;let o=t,s,c=0;return new ReadableStream({async pull(t){s??(s=o.getReader());try{let r=await s.read();if(r.done){s.releaseLock(),s=void 0,t.close();return}if(c+=r.value.byteLength,c>(a??1/0)){let t=new e.t(`Request body exceeds maxRequestSize ${a}`,{code:`REQUEST_TOO_LARGE`,config:n});throw i.current=t,s.cancel(t).catch(()=>{}),s.releaseLock(),s=void 0,t}t.enqueue(r.value)}catch(e){throw s&&(s.releaseLock(),s=void 0),e}},async cancel(e){if(s)try{await s.cancel(e)}finally{s.releaseLock(),s=void 0}else o.locked||await o.cancel(e)}})}function utf8ByteLength(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r<128)t+=1;else if(r<2048)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=4,n+=1):t+=3}else t+=3}return t}function isPlainObject(e){return Object.prototype.toString.call(e)===`[object Object]`}function noop(){}function resolveErrorResponseSizeLimit(e){let t=e.maxErrorResponseSize??10485760,n=e.maxResponseSize;return Number.isFinite(t)&&(!Number.isFinite(n)||t<(n??1/0))?t:void 0}const c=Symbol(`ERROR_RESPONSE_DATA_UNAVAILABLE`);async function withErrorResponseTimeout(t,n,r){let i=t.timeout??0,a=i>0?i:1e4,o=new AbortController,s,l=!1,u,cancelOperation=()=>{try{r?.()}catch{}o.abort()};try{let r=new Promise((n,r)=>{s=setTimeout(()=>{if(l=!0,cancelOperation(),i>0){r(new e.t(`Request timeout after ${i}ms`,{code:`TIMEOUT_ERROR`,config:t}));return}n(c)},a)});u=n(o.signal);try{return await Promise.race([u,r])}catch(t){if(e.n(t)&&t.code===`PARSER_ERROR`)return c;throw t}}finally{s!==void 0&&!l&&clearTimeout(s),u?.catch(()=>{})}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return buildRequestWithHeaders}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return rememberRequestBody}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return buildRequest}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return withErrorResponseTimeout}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return isAbsoluteURL}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return resolveErrorResponseSizeLimit}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return isRequest}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return createTimeoutSignal}});
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./validateResponseStatus-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./validateResponseStatus-DhsoZTyz.cjs"),n=require("./createClient-BNcd9hoJ.cjs"),r=require("./testing.cjs"),i=require("./PluginError-DT3VnlUB.cjs"),a=require("./plugins/auth.cjs"),o=require("./cachePlugin-0cb8h9cY.cjs"),s=require("./plugins/circuit-breaker.cjs"),c=require("./plugins/concurrency.cjs"),l=require("./plugins/download.cjs"),u=require("./plugins/logger.cjs"),d=require("./plugins/opentelemetry.cjs"),f=require("./plugins/opentelemetry-metrics.cjs"),p=require("./rateLimitPlugin-CtwD8U0P.cjs"),m=require("./plugins/retry.cjs"),h=require("./plugins/upload.cjs");require("./plugins.cjs"),exports.Client=n.n,exports.FetchAdapter=n.i,exports.IndexedDBCacheStore=o.r,exports.InterceptorManager=n.r,exports.MemoryCacheStore=o.i,exports.MockAdapter=r.MockAdapter,exports.PluginError=i.t,exports.RequestError=e.t,exports.SchemaValidationError=t.f,exports.TieredCacheStore=o.n,exports.WebStorageCacheStore=o.a,exports.authPlugin=a.authPlugin,exports.cachePlugin=o.t,exports.circuitBreakerPlugin=s.circuitBreakerPlugin,exports.concurrencyPlugin=c.concurrencyPlugin,exports.createClient=n.t,exports.downloadPlugin=l.downloadPlugin,exports.isRequestError=e.n,exports.isSchemaValidationError=t.p,exports.loggerPlugin=u.loggerPlugin,exports.openTelemetryMetricsPlugin=f.openTelemetryMetricsPlugin,exports.openTelemetryPlugin=d.openTelemetryPlugin,exports.rateLimitPlugin=p.t,exports.retryPlugin=m.retryPlugin,exports.uploadPlugin=h.uploadPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { t as Adapter } from "./adapter-
|
|
3
|
-
import { a as RequestErrorOptions, c as createClient, i as RequestErrorCode, l as Client, n as isSchemaValidationError, o as isRequestError, r as RequestError, s as FetchAdapter, t as SchemaValidationError, u as ClientOptions } from "./SchemaValidationError-
|
|
4
|
-
import { a as MockReplyHandler, c as MockRoute, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, r as MockHandler, s as MockResponseOptions, t as MockAdapter } from "./MockAdapter-
|
|
5
|
-
import { a as PluginInterceptorManager, c as InterceptorOptions, i as PluginHookManager, n as PluginCleanup, o as Interceptor, r as PluginContext, s as InterceptorManager, t as Plugin } from "./Plugin-
|
|
1
|
+
import { A as MemoryCacheOptions, B as TransferProgress, C as ConcurrencyOptions, D as ErrorLogEntry, E as DownloadProgress, F as RequestLogEntry, G as HttpMethod, H as UploadOptions, I as RequestLogger, L as ResponseLogEntry, M as OpenTelemetryMetricsOptions, N as OpenTelemetryOptions, O as LoggerEntry, P as RateLimitOptions, R as RetryEvent, S as CircuitState, T as DownloadOutput, U as UploadProgress, V as UploadData, W as StandardSchemaV1, _ as ResponseType, a as FetchFunction, b as CircuitBreakerOptions, c as JsonParserContext, d as QuerySerializer, f as QueryValue, g as RequestURL, h as RequestInputConfig, i as StreamingSchemaLocation, j as OpenTelemetryAttributeValue, k as LoggerOptions, l as JsonStringifier, m as RequestExtensions, n as ServerSentEvent, o as FetchOptions, p as RequestConfig, r as SseReconnectOptions, s as JsonParser, t as NporaResponse, u as QueryParams, v as AuthOptions, w as DownloadOptions, x as CircuitBreakerStateChange, y as CacheOptions, z as RetryOptions } from "./response-BJacGco5.cjs";
|
|
2
|
+
import { t as Adapter } from "./adapter-phBJ1R70.cjs";
|
|
3
|
+
import { a as RequestErrorOptions, c as createClient, i as RequestErrorCode, l as Client, n as isSchemaValidationError, o as isRequestError, r as RequestError, s as FetchAdapter, t as SchemaValidationError, u as ClientOptions } from "./SchemaValidationError-MUg6trpg.cjs";
|
|
4
|
+
import { a as MockReplyHandler, c as MockRoute, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, r as MockHandler, s as MockResponseOptions, t as MockAdapter } from "./MockAdapter-zyLuXWEm.cjs";
|
|
5
|
+
import { a as PluginInterceptorManager, c as InterceptorOptions, i as PluginHookManager, n as PluginCleanup, o as Interceptor, r as PluginContext, s as InterceptorManager, t as Plugin } from "./Plugin-9Z-IZ_NJ.cjs";
|
|
6
6
|
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-DVP3pUt_.cjs";
|
|
7
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-
|
|
8
|
-
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "./cachePlugin-
|
|
9
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-
|
|
10
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-
|
|
11
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-
|
|
12
|
-
import { t as loggerPlugin } from "./loggerPlugin-
|
|
13
|
-
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "./openTelemetryPlugin-
|
|
14
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-
|
|
15
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-
|
|
16
|
-
import { t as retryPlugin } from "./retryPlugin-
|
|
17
|
-
import { t as uploadPlugin } from "./uploadPlugin-
|
|
18
|
-
export { Adapter, AuthOptions, AuthPluginOptions, AuthTokenStorage, type CacheEntry, type CacheEvent, type CacheEventType, CacheOptions, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, CircuitBreakerOptions, CircuitBreakerPlugin, CircuitBreakerPluginOptions, CircuitBreakerStateChange, CircuitState, Client, ClientOptions, ConcurrencyOptions, ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, DownloadOptions, DownloadOutput, DownloadPluginOptions, DownloadProgress, DownloadTransport, ErrorLogEntry, FetchAdapter, FetchFunction, FetchOptions, HttpMethod, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, Interceptor, InterceptorManager, InterceptorOptions, JsonParser, JsonParserContext, JsonStringifier, LoggerEntry, LoggerOptions, MemoryCacheOptions, MemoryCacheStore, type MemoryCacheStoreOptions, MockAdapter, MockAdapterOptions, MockHandler, MockReply, MockReplyHandler, MockRequestMatcher, MockResponseOptions, MockRoute, MockURLMatcher, NporaResponse, OpenTelemetryAttributeValue, OpenTelemetryContextApi, OpenTelemetryCounter, OpenTelemetryHeaderSetter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsOptions, OpenTelemetryMetricsPluginOptions, OpenTelemetryOptions, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, Plugin, PluginCleanup, PluginContext, PluginError, PluginErrorCode, PluginErrorOptions, PluginHookManager, PluginInterceptorManager, QueryParams, QuerySerializer, QueryValue, RateLimitOptions, RateLimitPlugin, RateLimitPluginOptions, RateLimitState, RequestConfig, RequestError, RequestErrorCode, RequestErrorOptions, RequestExtensions, RequestInputConfig, RequestLogEntry, RequestLogger, RequestURL, ResponseLogEntry, ResponseType, RetryEvent, RetryOptions, SchemaValidationError, ServerSentEvent, StandardSchemaV1, StreamingSchemaLocation, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, TransferProgress, UploadData, UploadOptions, UploadProgress, WebStorageCacheStore, type WebStorageCacheStoreOptions, authPlugin, cachePlugin, circuitBreakerPlugin, concurrencyPlugin, createClient, downloadPlugin, isRequestError, isSchemaValidationError, loggerPlugin, openTelemetryMetricsPlugin, openTelemetryPlugin, rateLimitPlugin, retryPlugin, uploadPlugin };
|
|
7
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-BtPHJ7EZ.cjs";
|
|
8
|
+
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "./cachePlugin-DANU1VAL.cjs";
|
|
9
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-DHyLSvdy.cjs";
|
|
10
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-D4YMInT5.cjs";
|
|
11
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-C4ugCtc1.cjs";
|
|
12
|
+
import { t as loggerPlugin } from "./loggerPlugin-CSWyHhxS.cjs";
|
|
13
|
+
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "./openTelemetryPlugin-DX-5cpbR.cjs";
|
|
14
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-BtO0nwPY.cjs";
|
|
15
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-C357f6EC.cjs";
|
|
16
|
+
import { t as retryPlugin } from "./retryPlugin-lpF9dskF.cjs";
|
|
17
|
+
import { t as uploadPlugin } from "./uploadPlugin-Db0fMNLg.cjs";
|
|
18
|
+
export { Adapter, AuthOptions, AuthPluginOptions, AuthTokenStorage, type CacheEntry, type CacheEvent, type CacheEventType, CacheOptions, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, CircuitBreakerOptions, CircuitBreakerPlugin, CircuitBreakerPluginOptions, CircuitBreakerStateChange, CircuitState, Client, ClientOptions, ConcurrencyOptions, ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, DownloadOptions, DownloadOutput, DownloadPluginOptions, DownloadProgress, DownloadTransport, ErrorLogEntry, FetchAdapter, FetchFunction, FetchOptions, HttpMethod, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, Interceptor, InterceptorManager, InterceptorOptions, JsonParser, JsonParserContext, JsonStringifier, LoggerEntry, LoggerOptions, MemoryCacheOptions, MemoryCacheStore, type MemoryCacheStoreOptions, MockAdapter, MockAdapterOptions, MockHandler, MockReply, MockReplyHandler, MockRequestMatcher, MockResponseOptions, MockRoute, MockURLMatcher, NporaResponse, OpenTelemetryAttributeValue, OpenTelemetryContextApi, OpenTelemetryCounter, OpenTelemetryHeaderSetter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsOptions, OpenTelemetryMetricsPluginOptions, OpenTelemetryOptions, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, Plugin, PluginCleanup, PluginContext, PluginError, PluginErrorCode, PluginErrorOptions, PluginHookManager, PluginInterceptorManager, QueryParams, QuerySerializer, QueryValue, RateLimitOptions, RateLimitPlugin, RateLimitPluginOptions, RateLimitState, RequestConfig, RequestError, RequestErrorCode, RequestErrorOptions, RequestExtensions, RequestInputConfig, RequestLogEntry, RequestLogger, RequestURL, ResponseLogEntry, ResponseType, RetryEvent, RetryOptions, SchemaValidationError, ServerSentEvent, SseReconnectOptions, StandardSchemaV1, StreamingSchemaLocation, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, TransferProgress, UploadData, UploadOptions, UploadProgress, WebStorageCacheStore, type WebStorageCacheStoreOptions, authPlugin, cachePlugin, circuitBreakerPlugin, concurrencyPlugin, createClient, downloadPlugin, isRequestError, isSchemaValidationError, loggerPlugin, openTelemetryMetricsPlugin, openTelemetryPlugin, rateLimitPlugin, retryPlugin, uploadPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { t as Adapter } from "./adapter-
|
|
3
|
-
import { a as RequestErrorOptions, c as createClient, i as RequestErrorCode, l as Client, n as isSchemaValidationError, o as isRequestError, r as RequestError, s as FetchAdapter, t as SchemaValidationError, u as ClientOptions } from "./SchemaValidationError-
|
|
4
|
-
import { a as MockReplyHandler, c as MockRoute, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, r as MockHandler, s as MockResponseOptions, t as MockAdapter } from "./MockAdapter
|
|
5
|
-
import { a as PluginInterceptorManager, c as InterceptorOptions, i as PluginHookManager, n as PluginCleanup, o as Interceptor, r as PluginContext, s as InterceptorManager, t as Plugin } from "./Plugin-
|
|
1
|
+
import { A as MemoryCacheOptions, B as TransferProgress, C as ConcurrencyOptions, D as ErrorLogEntry, E as DownloadProgress, F as RequestLogEntry, G as HttpMethod, H as UploadOptions, I as RequestLogger, L as ResponseLogEntry, M as OpenTelemetryMetricsOptions, N as OpenTelemetryOptions, O as LoggerEntry, P as RateLimitOptions, R as RetryEvent, S as CircuitState, T as DownloadOutput, U as UploadProgress, V as UploadData, W as StandardSchemaV1, _ as ResponseType, a as FetchFunction, b as CircuitBreakerOptions, c as JsonParserContext, d as QuerySerializer, f as QueryValue, g as RequestURL, h as RequestInputConfig, i as StreamingSchemaLocation, j as OpenTelemetryAttributeValue, k as LoggerOptions, l as JsonStringifier, m as RequestExtensions, n as ServerSentEvent, o as FetchOptions, p as RequestConfig, r as SseReconnectOptions, s as JsonParser, t as NporaResponse, u as QueryParams, v as AuthOptions, w as DownloadOptions, x as CircuitBreakerStateChange, y as CacheOptions, z as RetryOptions } from "./response-BJacGco5.js";
|
|
2
|
+
import { t as Adapter } from "./adapter-c5-nyUCy.js";
|
|
3
|
+
import { a as RequestErrorOptions, c as createClient, i as RequestErrorCode, l as Client, n as isSchemaValidationError, o as isRequestError, r as RequestError, s as FetchAdapter, t as SchemaValidationError, u as ClientOptions } from "./SchemaValidationError-B2bnpz8J.js";
|
|
4
|
+
import { a as MockReplyHandler, c as MockRoute, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, r as MockHandler, s as MockResponseOptions, t as MockAdapter } from "./MockAdapter-C-0Hh1uW.js";
|
|
5
|
+
import { a as PluginInterceptorManager, c as InterceptorOptions, i as PluginHookManager, n as PluginCleanup, o as Interceptor, r as PluginContext, s as InterceptorManager, t as Plugin } from "./Plugin-Dx5Jby_c.js";
|
|
6
6
|
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-DVP3pUt_.js";
|
|
7
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-
|
|
8
|
-
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "./cachePlugin-
|
|
9
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-
|
|
10
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-
|
|
11
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-
|
|
12
|
-
import { t as loggerPlugin } from "./loggerPlugin-
|
|
13
|
-
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "./openTelemetryPlugin-
|
|
14
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-
|
|
15
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-
|
|
16
|
-
import { t as retryPlugin } from "./retryPlugin-
|
|
17
|
-
import { t as uploadPlugin } from "./uploadPlugin-
|
|
18
|
-
export { Adapter, AuthOptions, AuthPluginOptions, AuthTokenStorage, type CacheEntry, type CacheEvent, type CacheEventType, CacheOptions, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, CircuitBreakerOptions, CircuitBreakerPlugin, CircuitBreakerPluginOptions, CircuitBreakerStateChange, CircuitState, Client, ClientOptions, ConcurrencyOptions, ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, DownloadOptions, DownloadOutput, DownloadPluginOptions, DownloadProgress, DownloadTransport, ErrorLogEntry, FetchAdapter, FetchFunction, FetchOptions, HttpMethod, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, Interceptor, InterceptorManager, InterceptorOptions, JsonParser, JsonParserContext, JsonStringifier, LoggerEntry, LoggerOptions, MemoryCacheOptions, MemoryCacheStore, type MemoryCacheStoreOptions, MockAdapter, MockAdapterOptions, MockHandler, MockReply, MockReplyHandler, MockRequestMatcher, MockResponseOptions, MockRoute, MockURLMatcher, NporaResponse, OpenTelemetryAttributeValue, OpenTelemetryContextApi, OpenTelemetryCounter, OpenTelemetryHeaderSetter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsOptions, OpenTelemetryMetricsPluginOptions, OpenTelemetryOptions, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, Plugin, PluginCleanup, PluginContext, PluginError, PluginErrorCode, PluginErrorOptions, PluginHookManager, PluginInterceptorManager, QueryParams, QuerySerializer, QueryValue, RateLimitOptions, RateLimitPlugin, RateLimitPluginOptions, RateLimitState, RequestConfig, RequestError, RequestErrorCode, RequestErrorOptions, RequestExtensions, RequestInputConfig, RequestLogEntry, RequestLogger, RequestURL, ResponseLogEntry, ResponseType, RetryEvent, RetryOptions, SchemaValidationError, ServerSentEvent, StandardSchemaV1, StreamingSchemaLocation, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, TransferProgress, UploadData, UploadOptions, UploadProgress, WebStorageCacheStore, type WebStorageCacheStoreOptions, authPlugin, cachePlugin, circuitBreakerPlugin, concurrencyPlugin, createClient, downloadPlugin, isRequestError, isSchemaValidationError, loggerPlugin, openTelemetryMetricsPlugin, openTelemetryPlugin, rateLimitPlugin, retryPlugin, uploadPlugin };
|
|
7
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-CVgJvxsA.js";
|
|
8
|
+
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "./cachePlugin-DxzbF294.js";
|
|
9
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-D77O9CVl.js";
|
|
10
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-CizobNMf.js";
|
|
11
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-DexFPPeR.js";
|
|
12
|
+
import { t as loggerPlugin } from "./loggerPlugin-IGqtnWzy.js";
|
|
13
|
+
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "./openTelemetryPlugin-BeykGhuv.js";
|
|
14
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-De76vmwq.js";
|
|
15
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-e_IjO32D.js";
|
|
16
|
+
import { t as retryPlugin } from "./retryPlugin-JAQQ0CbN.js";
|
|
17
|
+
import { t as uploadPlugin } from "./uploadPlugin-DdVkxO9B.js";
|
|
18
|
+
export { Adapter, AuthOptions, AuthPluginOptions, AuthTokenStorage, type CacheEntry, type CacheEvent, type CacheEventType, CacheOptions, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, CircuitBreakerOptions, CircuitBreakerPlugin, CircuitBreakerPluginOptions, CircuitBreakerStateChange, CircuitState, Client, ClientOptions, ConcurrencyOptions, ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, DownloadOptions, DownloadOutput, DownloadPluginOptions, DownloadProgress, DownloadTransport, ErrorLogEntry, FetchAdapter, FetchFunction, FetchOptions, HttpMethod, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, Interceptor, InterceptorManager, InterceptorOptions, JsonParser, JsonParserContext, JsonStringifier, LoggerEntry, LoggerOptions, MemoryCacheOptions, MemoryCacheStore, type MemoryCacheStoreOptions, MockAdapter, MockAdapterOptions, MockHandler, MockReply, MockReplyHandler, MockRequestMatcher, MockResponseOptions, MockRoute, MockURLMatcher, NporaResponse, OpenTelemetryAttributeValue, OpenTelemetryContextApi, OpenTelemetryCounter, OpenTelemetryHeaderSetter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsOptions, OpenTelemetryMetricsPluginOptions, OpenTelemetryOptions, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, Plugin, PluginCleanup, PluginContext, PluginError, PluginErrorCode, PluginErrorOptions, PluginHookManager, PluginInterceptorManager, QueryParams, QuerySerializer, QueryValue, RateLimitOptions, RateLimitPlugin, RateLimitPluginOptions, RateLimitState, RequestConfig, RequestError, RequestErrorCode, RequestErrorOptions, RequestExtensions, RequestInputConfig, RequestLogEntry, RequestLogger, RequestURL, ResponseLogEntry, ResponseType, RetryEvent, RetryOptions, SchemaValidationError, ServerSentEvent, SseReconnectOptions, StandardSchemaV1, StreamingSchemaLocation, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, TransferProgress, UploadData, UploadOptions, UploadProgress, WebStorageCacheStore, type WebStorageCacheStoreOptions, authPlugin, cachePlugin, circuitBreakerPlugin, concurrencyPlugin, createClient, downloadPlugin, isRequestError, isSchemaValidationError, loggerPlugin, openTelemetryMetricsPlugin, openTelemetryPlugin, rateLimitPlugin, retryPlugin, uploadPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./RequestError-B0HIY1zK.js";import{
|
|
1
|
+
import{n as e,t}from"./RequestError-B0HIY1zK.js";import{f as n,p as r}from"./validateResponseStatus-CkUhntvh.js";import{i,n as a,r as o,t as s}from"./createClient-BtpOdm47.js";import{MockAdapter as c}from"./testing.js";import{t as l}from"./PluginError-CcuPSIRv.js";import{authPlugin as u}from"./plugins/auth.js";import{a as d,i as f,n as p,r as m,t as h}from"./cachePlugin-C3FQUhLv.js";import{circuitBreakerPlugin as g}from"./plugins/circuit-breaker.js";import{concurrencyPlugin as _}from"./plugins/concurrency.js";import{downloadPlugin as v}from"./plugins/download.js";import{loggerPlugin as y}from"./plugins/logger.js";import{openTelemetryPlugin as b}from"./plugins/opentelemetry.js";import{openTelemetryMetricsPlugin as x}from"./plugins/opentelemetry-metrics.js";import{t as S}from"./rateLimitPlugin-EyoriWyF.js";import{retryPlugin as C}from"./plugins/retry.js";import{uploadPlugin as w}from"./plugins/upload.js";import"./plugins.js";export{a as Client,i as FetchAdapter,m as IndexedDBCacheStore,o as InterceptorManager,f as MemoryCacheStore,c as MockAdapter,l as PluginError,t as RequestError,n as SchemaValidationError,p as TieredCacheStore,d as WebStorageCacheStore,u as authPlugin,h as cachePlugin,g as circuitBreakerPlugin,_ as concurrencyPlugin,s as createClient,v as downloadPlugin,e as isRequestError,r as isSchemaValidationError,y as loggerPlugin,x as openTelemetryMetricsPlugin,b as openTelemetryPlugin,S as rateLimitPlugin,C as retryPlugin,w as uploadPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isURLSearchParams(e){if(typeof e!=`object`||!e||typeof URLSearchParams>`u`)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null?!1:(URLSearchParams.prototype.entries.call(e),!0)}catch{return!1}}function isBlob(e){return typeof Blob<`u`&&hasNativeGetter(Blob.prototype,`size`,e)}function isArrayBuffer(e){return typeof ArrayBuffer<`u`&&hasNativeGetter(ArrayBuffer.prototype,`byteLength`,e)}function hasNativeGetter(e,t,n){if(typeof n!=`object`||!n)return!1;let r=Object.getOwnPropertyDescriptor(e,t)?.get;if(!r)return!1;try{return r.call(n),!0}catch{return!1}}export{isBlob as n,isURLSearchParams as r,isArrayBuffer as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isURLSearchParams(e){if(typeof e!=`object`||!e||typeof URLSearchParams>`u`)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null?!1:(URLSearchParams.prototype.entries.call(e),!0)}catch{return!1}}function isBlob(e){return typeof Blob<`u`&&hasNativeGetter(Blob.prototype,`size`,e)}function isArrayBuffer(e){return typeof ArrayBuffer<`u`&&hasNativeGetter(ArrayBuffer.prototype,`byteLength`,e)}function hasNativeGetter(e,t,n){if(typeof n!=`object`||!n)return!1;let r=Object.getOwnPropertyDescriptor(e,t)?.get;if(!r)return!1;try{return r.call(n),!0}catch{return!1}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return isBlob}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return isURLSearchParams}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return isArrayBuffer}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isReadableStream(e){if(typeof e!=`object`||!e||typeof ReadableStream>`u`)return!1;let t=Object.getOwnPropertyDescriptor(ReadableStream.prototype,`locked`)?.get;if(!t)return!1;try{return t.call(e),!0}catch{return!1}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return isReadableStream}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isReadableStream(e){if(typeof e!=`object`||!e||typeof ReadableStream>`u`)return!1;let t=Object.getOwnPropertyDescriptor(ReadableStream.prototype,`locked`)?.get;if(!t)return!1;try{return t.call(e),!0}catch{return!1}}export{isReadableStream as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { k as LoggerOptions } from "./response-BJacGco5.cjs";
|
|
2
|
+
import { t as Plugin } from "./Plugin-9Z-IZ_NJ.cjs";
|
|
3
|
+
//#region src/plugins/loggerPlugin.d.ts
|
|
4
|
+
declare function loggerPlugin(defaultOptions?: LoggerOptions): Plugin;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { loggerPlugin as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { k as LoggerOptions } from "./response-BJacGco5.js";
|
|
2
|
+
import { t as Plugin } from "./Plugin-Dx5Jby_c.js";
|
|
3
|
+
//#region src/plugins/loggerPlugin.d.ts
|
|
4
|
+
declare function loggerPlugin(defaultOptions?: LoggerOptions): Plugin;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { loggerPlugin as t };
|
package/dist/{openTelemetryMetricsPlugin-BqUiYPda.d.cts → openTelemetryMetricsPlugin-BtO0nwPY.d.cts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
1
|
+
import { j as OpenTelemetryAttributeValue, p as RequestConfig } from "./response-BJacGco5.cjs";
|
|
2
|
+
import { t as Plugin } from "./Plugin-9Z-IZ_NJ.cjs";
|
|
3
3
|
//#region src/plugins/openTelemetryMetricsPlugin.d.ts
|
|
4
4
|
type OpenTelemetryMetricAttributes = Readonly<Record<string, OpenTelemetryAttributeValue>>;
|
|
5
5
|
interface OpenTelemetryCounter {
|
package/dist/{openTelemetryMetricsPlugin-0UQ5jqvv.d.ts → openTelemetryMetricsPlugin-De76vmwq.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
1
|
+
import { j as OpenTelemetryAttributeValue, p as RequestConfig } from "./response-BJacGco5.js";
|
|
2
|
+
import { t as Plugin } from "./Plugin-Dx5Jby_c.js";
|
|
3
3
|
//#region src/plugins/openTelemetryMetricsPlugin.d.ts
|
|
4
4
|
type OpenTelemetryMetricAttributes = Readonly<Record<string, OpenTelemetryAttributeValue>>;
|
|
5
5
|
interface OpenTelemetryCounter {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
1
|
+
import { j as OpenTelemetryAttributeValue, p as RequestConfig } from "./response-BJacGco5.js";
|
|
2
|
+
import { t as Plugin } from "./Plugin-Dx5Jby_c.js";
|
|
3
3
|
//#region src/plugins/openTelemetryPlugin.d.ts
|
|
4
4
|
interface OpenTelemetrySpan {
|
|
5
5
|
setAttribute(name: string, value: OpenTelemetryAttributeValue): this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
1
|
+
import { j as OpenTelemetryAttributeValue, p as RequestConfig } from "./response-BJacGco5.cjs";
|
|
2
|
+
import { t as Plugin } from "./Plugin-9Z-IZ_NJ.cjs";
|
|
3
3
|
//#region src/plugins/openTelemetryPlugin.d.ts
|
|
4
4
|
interface OpenTelemetrySpan {
|
|
5
5
|
setAttribute(name: string, value: OpenTelemetryAttributeValue): this;
|
package/dist/plugins/auth.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "../authPlugin-
|
|
1
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "../authPlugin-BtPHJ7EZ.cjs";
|
|
2
2
|
export { AuthPluginOptions, AuthTokenStorage, authPlugin };
|
package/dist/plugins/auth.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "../authPlugin-
|
|
1
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "../authPlugin-CVgJvxsA.js";
|
|
2
2
|
export { AuthPluginOptions, AuthTokenStorage, authPlugin };
|
package/dist/plugins/cache.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cachePlugin-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cachePlugin-0cb8h9cY.cjs");exports.IndexedDBCacheStore=e.r,exports.MemoryCacheStore=e.i,exports.TieredCacheStore=e.n,exports.WebStorageCacheStore=e.a,exports.cachePlugin=e.t;
|
package/dist/plugins/cache.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "../cachePlugin-
|
|
1
|
+
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "../cachePlugin-DANU1VAL.cjs";
|
|
2
2
|
export { type CacheEntry, type CacheEvent, type CacheEventType, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, MemoryCacheStore, type MemoryCacheStoreOptions, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, WebStorageCacheStore, type WebStorageCacheStoreOptions, cachePlugin };
|
package/dist/plugins/cache.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "../cachePlugin-
|
|
1
|
+
import { C as WebStorageCacheStore, S as MemoryCacheStoreOptions, _ as CacheStats, a as TieredCacheStoreOptions, b as CacheStore, c as IndexedDBCacheCompactionResult, d as IndexedDBCacheUsage, f as CacheEvent, g as CacheSetOptions, h as CachePluginOptions, i as TieredCacheStore, l as IndexedDBCacheStoreEvent, m as CachePlugin, n as TieredCacheBroadcastOptions, o as IndexedDBCacheStore, p as CacheEventType, r as TieredCacheCoordinationOptions, s as IndexedDBCacheCompactionOptions, t as cachePlugin, u as IndexedDBCacheStoreOptions, v as CacheEntry, w as WebStorageCacheStoreOptions, x as MemoryCacheStore, y as CacheRefreshLease } from "../cachePlugin-DxzbF294.js";
|
|
2
2
|
export { type CacheEntry, type CacheEvent, type CacheEventType, type CachePlugin, type CachePluginOptions, type CacheRefreshLease, type CacheSetOptions, type CacheStats, type CacheStore, type IndexedDBCacheCompactionOptions, type IndexedDBCacheCompactionResult, IndexedDBCacheStore, type IndexedDBCacheStoreEvent, type IndexedDBCacheStoreOptions, type IndexedDBCacheUsage, MemoryCacheStore, type MemoryCacheStoreOptions, type TieredCacheBroadcastOptions, type TieredCacheCoordinationOptions, TieredCacheStore, type TieredCacheStoreOptions, WebStorageCacheStore, type WebStorageCacheStoreOptions, cachePlugin };
|
package/dist/plugins/cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,r,t as i}from"../cachePlugin-
|
|
1
|
+
import{a as e,i as t,n,r,t as i}from"../cachePlugin-C3FQUhLv.js";export{r as IndexedDBCacheStore,t as MemoryCacheStore,n as TieredCacheStore,e as WebStorageCacheStore,i as cachePlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "../circuitBreakerPlugin-
|
|
1
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "../circuitBreakerPlugin-DHyLSvdy.cjs";
|
|
2
2
|
export { CircuitBreakerPlugin, CircuitBreakerPluginOptions, circuitBreakerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "../circuitBreakerPlugin-
|
|
1
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "../circuitBreakerPlugin-D77O9CVl.js";
|
|
2
2
|
export { CircuitBreakerPlugin, CircuitBreakerPluginOptions, circuitBreakerPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "../concurrencyPlugin-
|
|
1
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "../concurrencyPlugin-D4YMInT5.cjs";
|
|
2
2
|
export { ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, concurrencyPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "../concurrencyPlugin-
|
|
1
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "../concurrencyPlugin-CizobNMf.js";
|
|
2
2
|
export { ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, concurrencyPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../validateResponseStatus-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../validateResponseStatus-DhsoZTyz.cjs"),n=require("../isBinaryBody-CdXW3TxQ.cjs"),r=require("../isReadableStream-4C8oyfa_.cjs"),i=require("../resolveExtensionConfig-BHHfQwjF.cjs"),a=require("../xhrTransport-BoLJnrNS.cjs");function downloadPlugin(n={}){let o=new WeakSet;return{name:`download`,install(s){s.interceptors.request.use(e=>{let t=i.t(e,`download`);if(!t)return e;if(resolveDownloadOutput(t.output,e)===`stream`)return validateStreamOutput(n.transport,e),{...e,responseType:`stream`};let r=t.onProgress&&!shouldUseXHR(n.transport)?`stream`:e.responseType??`blob`;return{...e,responseType:r}}),s.hooks.onTransport(async t=>{if(t.response)return;let r=i.t(t.config,`download`),s=r?.onProgress;if(!(r?.output===`stream`||!s||!shouldUseXHR(n.transport))){if(typeof XMLHttpRequest>`u`)throw new e.t(`XMLHttpRequest is unavailable for download progress`,{code:`CONFIG_ERROR`,config:t.config});t.response=await a.t(t.config,{onDownloadProgress:s,preserveRaw:t.preserveRaw}),o.add(t)}},{priority:-3e3}),s.hooks.onResponse(async e=>{if(o.has(e))return;let n=e.response;if(!n)return;let a=i.t(n.config,`download`),s=a?.onProgress;if(!a)return;let c=n.data;if(a.output===`stream`){if(c===void 0&&t.r(n.config.method,n.status,n.raw.type)&&(c=createEmptyDownloadStream()),!r.t(c))throw unavailableDownloadStream(n);s&&(e.response={...n,data:monitorDownloadStream(c,n,s)});return}if(!s)return;if(!r.t(c))throw unavailableDownloadStream(n);let l=await consumeDownloadStream(c,n,s);e.response={...n,data:l}},{requiresRawResponse:!1})}}}function createEmptyDownloadStream(){return new ReadableStream({start(e){e.close()}})}function resolveDownloadOutput(t,n){if(t===void 0||t===`blob`)return`blob`;if(t===`stream`)return t;throw new e.t(`Download output must be "blob" or "stream"`,{code:`CONFIG_ERROR`,config:n})}function validateStreamOutput(t,n){if(t===`xhr`)throw new e.t(`Stream downloads require the Fetch transport`,{code:`CONFIG_ERROR`,config:n});if(!supportsFetchResponseStream())throw new e.t(`Fetch response streams are unavailable`,{code:`CONFIG_ERROR`,config:n})}function unavailableDownloadStream(t){return new e.t(`Download response stream is unavailable`,{code:`PARSER_ERROR`,status:t.status,config:t.config})}function shouldUseXHR(e=`auto`){return e===`xhr`||e!==`fetch`&&!supportsFetchResponseStream()&&typeof XMLHttpRequest<`u`}function supportsFetchResponseStream(){return typeof ReadableStream<`u`&&typeof Response<`u`&&`body`in Response.prototype}async function consumeDownloadStream(e,t,n){let r=e.getReader(),i=[],o=parseContentLength(t.headers.get(`content-length`)),s=a.n(),c=0,l=!1;try{for(;;){let e=await r.read();if(e.done)break;let t=e.value;i.push(toDownloadBuffer(t)),c+=t.byteLength,l=!0,n(s(c,o))}l||n(s(0,o))}catch(e){try{await r.cancel(e)}catch{}throw e}finally{r.releaseLock()}return new Blob(i,{type:t.headers.get(`content-type`)??``})}function monitorDownloadStream(e,t,n){let r=e.getReader(),i=parseContentLength(t.headers.get(`content-length`)),o=a.n(),s=0,c=!1,l=!1,release=()=>{l||(l=!0,r.releaseLock())};return new ReadableStream({async pull(e){try{let t=await r.read();if(t.done){c||n(o(0,i)),release(),e.close();return}s+=t.value.byteLength,c=!0,n(o(s,i)),e.enqueue(t.value)}catch(t){try{await r.cancel(t)}catch{}release(),e.error(t)}},async cancel(e){try{await r.cancel(e)}finally{release()}}},{highWaterMark:0})}function toDownloadBuffer(e){if(n.t(e.buffer))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function parseContentLength(e){if(!e)return;let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}exports.downloadPlugin=downloadPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "../downloadPlugin-
|
|
1
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "../downloadPlugin-C4ugCtc1.cjs";
|
|
2
2
|
export { DownloadPluginOptions, DownloadTransport, downloadPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "../downloadPlugin-
|
|
1
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "../downloadPlugin-DexFPPeR.js";
|
|
2
2
|
export { DownloadPluginOptions, DownloadTransport, downloadPlugin };
|
package/dist/plugins/download.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../RequestError-B0HIY1zK.js";import{r as t}from"../validateResponseStatus-
|
|
1
|
+
import{t as e}from"../RequestError-B0HIY1zK.js";import{r as t}from"../validateResponseStatus-CkUhntvh.js";import{t as n}from"../isBinaryBody-C7V7uzZ6.js";import{t as r}from"../isReadableStream-CRq9INpv.js";import{t as i}from"../resolveExtensionConfig-QAFHZVte.js";import{n as a,t as o}from"../xhrTransport-DiFlcZRG.js";function downloadPlugin(n={}){let a=new WeakSet;return{name:`download`,install(s){s.interceptors.request.use(e=>{let t=i(e,`download`);if(!t)return e;if(resolveDownloadOutput(t.output,e)===`stream`)return validateStreamOutput(n.transport,e),{...e,responseType:`stream`};let r=t.onProgress&&!shouldUseXHR(n.transport)?`stream`:e.responseType??`blob`;return{...e,responseType:r}}),s.hooks.onTransport(async t=>{if(t.response)return;let r=i(t.config,`download`),s=r?.onProgress;if(!(r?.output===`stream`||!s||!shouldUseXHR(n.transport))){if(typeof XMLHttpRequest>`u`)throw new e(`XMLHttpRequest is unavailable for download progress`,{code:`CONFIG_ERROR`,config:t.config});t.response=await o(t.config,{onDownloadProgress:s,preserveRaw:t.preserveRaw}),a.add(t)}},{priority:-3e3}),s.hooks.onResponse(async e=>{if(a.has(e))return;let n=e.response;if(!n)return;let o=i(n.config,`download`),s=o?.onProgress;if(!o)return;let c=n.data;if(o.output===`stream`){if(c===void 0&&t(n.config.method,n.status,n.raw.type)&&(c=createEmptyDownloadStream()),!r(c))throw unavailableDownloadStream(n);s&&(e.response={...n,data:monitorDownloadStream(c,n,s)});return}if(!s)return;if(!r(c))throw unavailableDownloadStream(n);let l=await consumeDownloadStream(c,n,s);e.response={...n,data:l}},{requiresRawResponse:!1})}}}function createEmptyDownloadStream(){return new ReadableStream({start(e){e.close()}})}function resolveDownloadOutput(t,n){if(t===void 0||t===`blob`)return`blob`;if(t===`stream`)return t;throw new e(`Download output must be "blob" or "stream"`,{code:`CONFIG_ERROR`,config:n})}function validateStreamOutput(t,n){if(t===`xhr`)throw new e(`Stream downloads require the Fetch transport`,{code:`CONFIG_ERROR`,config:n});if(!supportsFetchResponseStream())throw new e(`Fetch response streams are unavailable`,{code:`CONFIG_ERROR`,config:n})}function unavailableDownloadStream(t){return new e(`Download response stream is unavailable`,{code:`PARSER_ERROR`,status:t.status,config:t.config})}function shouldUseXHR(e=`auto`){return e===`xhr`||e!==`fetch`&&!supportsFetchResponseStream()&&typeof XMLHttpRequest<`u`}function supportsFetchResponseStream(){return typeof ReadableStream<`u`&&typeof Response<`u`&&`body`in Response.prototype}async function consumeDownloadStream(e,t,n){let r=e.getReader(),i=[],o=parseContentLength(t.headers.get(`content-length`)),s=a(),c=0,l=!1;try{for(;;){let e=await r.read();if(e.done)break;let t=e.value;i.push(toDownloadBuffer(t)),c+=t.byteLength,l=!0,n(s(c,o))}l||n(s(0,o))}catch(e){try{await r.cancel(e)}catch{}throw e}finally{r.releaseLock()}return new Blob(i,{type:t.headers.get(`content-type`)??``})}function monitorDownloadStream(e,t,n){let r=e.getReader(),i=parseContentLength(t.headers.get(`content-length`)),o=a(),s=0,c=!1,l=!1,release=()=>{l||(l=!0,r.releaseLock())};return new ReadableStream({async pull(e){try{let t=await r.read();if(t.done){c||n(o(0,i)),release(),e.close();return}s+=t.value.byteLength,c=!0,n(o(s,i)),e.enqueue(t.value)}catch(t){try{await r.cancel(t)}catch{}release(),e.error(t)}},async cancel(e){try{await r.cancel(e)}finally{release()}}},{highWaterMark:0})}function toDownloadBuffer(e){if(n(e.buffer))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let t=new Uint8Array(e.byteLength);return t.set(e),t.buffer}function parseContentLength(e){if(!e)return;let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}export{downloadPlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as loggerPlugin } from "../loggerPlugin-
|
|
1
|
+
import { t as loggerPlugin } from "../loggerPlugin-CSWyHhxS.cjs";
|
|
2
2
|
export { loggerPlugin };
|
package/dist/plugins/logger.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as loggerPlugin } from "../loggerPlugin-
|
|
1
|
+
import { t as loggerPlugin } from "../loggerPlugin-IGqtnWzy.js";
|
|
2
2
|
export { loggerPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isReadableStream-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isReadableStream-4C8oyfa_.cjs"),n=require("../resolveExtensionConfig-BHHfQwjF.cjs");function openTelemetryMetricsPlugin(e){validateOptions(e);let t=e.semconv??`npora`,[r,i,a,o,s,c,l]=t===`stable`?[]:[safeCreateHistogram(e.meter,`npora.client.request.duration`,`ms`),safeCreateHistogram(e.meter,`npora.client.rate_limit.wait.duration`,`ms`),safeCreateUpDownCounter(e.meter,`npora.client.active_requests`,`{request}`),safeCreateCounter(e.meter,`npora.client.retry.attempts`,`{attempt}`),safeCreateCounter(e.meter,`npora.client.cache.requests`,`{request}`),safeCreateHistogram(e.meter,`npora.client.stream.duration`,`ms`),safeCreateUpDownCounter(e.meter,`npora.client.active_streams`,`{stream}`)],u=t===`npora`?void 0:safeCreateHistogram(e.meter,`http.client.request.duration`,`s`),d=new WeakMap,f=new Set,p=new Set;return{name:`opentelemetry-metrics`,priority:-2e3,install(t){t.hooks.onRequest(t=>{let r;try{r=n.t(t.config,`openTelemetryMetrics`)}catch{return}if(r?.enabled===!1||!e.includeBackground&&t.background||!shouldRecord(e,t.config))return;let i;try{let n=createAttributes(e,t.config,r),a=u?{...n}:void 0;if(a)try{let e=t.config,n=e.baseURL?new URL(e.url,e.baseURL):new URL(e.url);a[`server.address`]=n.hostname,n.port&&(a[`server.port`]=+n.port)}catch{}i={attributes:n,httpAttrs:a,startedAt:t.startTime,retries:0,measureStream:r?.measureStreamConsumption??e.measureStreamConsumption??!0}}catch{return}d.set(t,i),f.add(i),safeAdd(a,1,i.attributes)},{priority:2**53-1}),t.hooks.onTransport(e=>{let t=d.get(e);t&&(u&&(t.attemptStart=Date.now()),e.attempt>0&&(t.retries+=1))});let recordAttempt=e=>{let t=d.get(e);!t?.httpAttrs||t.attemptStart===void 0||(safeRecord(u,Math.max(0,Date.now()-t.attemptStart)/1e3,createResultAttributes(t.httpAttrs,e)),t.attemptStart=void 0)};return t.hooks.onResponse(recordAttempt,{requiresRawResponse:!1}),t.hooks.onError(recordAttempt),t.hooks.onSettled(e=>{let t=d.get(e);if(!t)return;let n=createResultAttributes(t.attributes,e,!0);safeRecord(r,Math.max(0,Date.now()-t.startedAt),n),t.retries>0&&safeAdd(o,t.retries,n),e.rateLimitApplied&&safeRecord(i,e.rateLimitWaitTime,n),isCacheEnabled(e.config)&&safeAdd(s,1,{...n,"cache.result":e.cacheHit?`hit`:`miss`}),e.response&&t.measureStream&&instrumentStreamConsumption(e,n,c,l,p),finishState(t,f,a),d.delete(e)}),()=>{for(let e of f)finishState(e,f,a);for(let e of p)finishStreamState(e,`instrumentation_removed`,p,l,c)}}}}function instrumentStreamConsumption(e,n,r,i,a){let o=e.response;if(!o)return;let s=o.data,c=resolveStreamType(s,o);if(!c)return;let l={attributes:{...n,"stream.type":c},startedAt:Date.now()},finish=e=>{finishStreamState(l,e,a,i,r)};try{if(t.t(s)){let e=measureReadableStream(s,finish),t=createStreamResponse(o.raw,e);o.data=t.body,o.raw=t}else if(isAsyncIterable(s))o.data=measureAsyncIterable(s,finish);else return}catch{return}a.add(l),safeAdd(i,1,l.attributes)}function measureAsyncIterable(e,t){return(async function*(){let n;try{yield*e,n=`complete`}catch(e){throw n=`error`,e}finally{t(n??`cancelled`)}})()}function measureReadableStream(e,t){let n=e.getReader(),r=!1,settle=e=>{if(!r){r=!0;try{n.releaseLock()}catch{}t(e)}};return new ReadableStream({async pull(e){try{let t=await n.read();if(t.done){settle(`complete`),e.close();return}e.enqueue(t.value)}catch(t){settle(`error`),e.error(t)}},async cancel(e){try{await n.cancel(e)}finally{settle(`cancelled`)}}})}function createStreamResponse(e,t){let n=new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers});for(let t of[`url`,`redirected`,`type`])try{Object.defineProperty(n,t,{value:e[t],configurable:!0})}catch{}return n}function resolveStreamType(e,n){if(!(typeof e!=`object`||!e)){try{if(`getReader`in e&&t.t(e))return`bytes`;if(!(Symbol.asyncIterator in e))return}catch{return}return(n.headers.get(`content-type`)?.toLowerCase())?.includes(`text/event-stream`)?`sse`:`ndjson`}}function isAsyncIterable(e){return typeof e==`object`&&!!e&&Symbol.asyncIterator in e}function finishStreamState(e,t,n,r,i){if(!n.delete(e))return;let a={...e.attributes,"stream.outcome":t};safeRecord(i,Math.max(0,Date.now()-e.startedAt),a),safeAdd(r,-1,e.attributes)}function isCacheEnabled(e){try{return n.t(e,`cache`)?.enabled===!0}catch{return!1}}function createAttributes(e,t,n){return{...e.attributes,...n?.attributes,"http.request.method":t.method??`GET`}}function createResultAttributes(t,n,r=!1){let i={...t};r&&(i[`request.outcome`]=n.error?`error`:`success`);let a=n.response?.status??(e.n(n.error)?n.error.status:void 0);return a!==void 0&&(i[`http.response.status_code`]=a),n.error&&(i[`error.type`]=resolveErrorType(n.error)),i}function resolveErrorType(t){return e.n(t)?t.status===void 0?t.code:String(t.status):`_OTHER`}function finishState(e,t,n){t.delete(e)&&safeAdd(n,-1,e.attributes)}function shouldRecord(e,t){try{return e.shouldRecord?.(t)??!0}catch{return!1}}function safeCreateCounter(e,t,n){try{return e.createCounter(t,{unit:n})}catch{return}}function safeCreateUpDownCounter(e,t,n){try{return e.createUpDownCounter(t,{unit:n})}catch{return}}function safeCreateHistogram(e,t,n){try{return e.createHistogram(t,{unit:n})}catch{return}}function safeAdd(e,t,n){try{e?.add(t,n)}catch{}}function safeRecord(e,t,n){try{e?.record(t,n)}catch{}}function validateOptions(e){if(!e||typeof e.meter?.createCounter!=`function`||typeof e.meter?.createUpDownCounter!=`function`||typeof e.meter?.createHistogram!=`function`)throw TypeError()}exports.openTelemetryMetricsPlugin=openTelemetryMetricsPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "../openTelemetryMetricsPlugin-
|
|
1
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "../openTelemetryMetricsPlugin-BtO0nwPY.cjs";
|
|
2
2
|
export { OpenTelemetryCounter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsPluginOptions, openTelemetryMetricsPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "../openTelemetryMetricsPlugin-
|
|
1
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "../openTelemetryMetricsPlugin-De76vmwq.js";
|
|
2
2
|
export { OpenTelemetryCounter, OpenTelemetryHistogram, OpenTelemetryMeter, OpenTelemetryMetricAttributes, OpenTelemetryMetricsPluginOptions, openTelemetryMetricsPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../RequestError-B0HIY1zK.js";import{t}from"../isReadableStream-
|
|
1
|
+
import{n as e}from"../RequestError-B0HIY1zK.js";import{t}from"../isReadableStream-CRq9INpv.js";import{t as n}from"../resolveExtensionConfig-QAFHZVte.js";function openTelemetryMetricsPlugin(e){validateOptions(e);let t=e.semconv??`npora`,[r,i,a,o,s,c,l]=t===`stable`?[]:[safeCreateHistogram(e.meter,`npora.client.request.duration`,`ms`),safeCreateHistogram(e.meter,`npora.client.rate_limit.wait.duration`,`ms`),safeCreateUpDownCounter(e.meter,`npora.client.active_requests`,`{request}`),safeCreateCounter(e.meter,`npora.client.retry.attempts`,`{attempt}`),safeCreateCounter(e.meter,`npora.client.cache.requests`,`{request}`),safeCreateHistogram(e.meter,`npora.client.stream.duration`,`ms`),safeCreateUpDownCounter(e.meter,`npora.client.active_streams`,`{stream}`)],u=t===`npora`?void 0:safeCreateHistogram(e.meter,`http.client.request.duration`,`s`),d=new WeakMap,f=new Set,p=new Set;return{name:`opentelemetry-metrics`,priority:-2e3,install(t){t.hooks.onRequest(t=>{let r;try{r=n(t.config,`openTelemetryMetrics`)}catch{return}if(r?.enabled===!1||!e.includeBackground&&t.background||!shouldRecord(e,t.config))return;let i;try{let n=createAttributes(e,t.config,r),a=u?{...n}:void 0;if(a)try{let e=t.config,n=e.baseURL?new URL(e.url,e.baseURL):new URL(e.url);a[`server.address`]=n.hostname,n.port&&(a[`server.port`]=+n.port)}catch{}i={attributes:n,httpAttrs:a,startedAt:t.startTime,retries:0,measureStream:r?.measureStreamConsumption??e.measureStreamConsumption??!0}}catch{return}d.set(t,i),f.add(i),safeAdd(a,1,i.attributes)},{priority:2**53-1}),t.hooks.onTransport(e=>{let t=d.get(e);t&&(u&&(t.attemptStart=Date.now()),e.attempt>0&&(t.retries+=1))});let recordAttempt=e=>{let t=d.get(e);!t?.httpAttrs||t.attemptStart===void 0||(safeRecord(u,Math.max(0,Date.now()-t.attemptStart)/1e3,createResultAttributes(t.httpAttrs,e)),t.attemptStart=void 0)};return t.hooks.onResponse(recordAttempt,{requiresRawResponse:!1}),t.hooks.onError(recordAttempt),t.hooks.onSettled(e=>{let t=d.get(e);if(!t)return;let n=createResultAttributes(t.attributes,e,!0);safeRecord(r,Math.max(0,Date.now()-t.startedAt),n),t.retries>0&&safeAdd(o,t.retries,n),e.rateLimitApplied&&safeRecord(i,e.rateLimitWaitTime,n),isCacheEnabled(e.config)&&safeAdd(s,1,{...n,"cache.result":e.cacheHit?`hit`:`miss`}),e.response&&t.measureStream&&instrumentStreamConsumption(e,n,c,l,p),finishState(t,f,a),d.delete(e)}),()=>{for(let e of f)finishState(e,f,a);for(let e of p)finishStreamState(e,`instrumentation_removed`,p,l,c)}}}}function instrumentStreamConsumption(e,n,r,i,a){let o=e.response;if(!o)return;let s=o.data,c=resolveStreamType(s,o);if(!c)return;let l={attributes:{...n,"stream.type":c},startedAt:Date.now()},finish=e=>{finishStreamState(l,e,a,i,r)};try{if(t(s)){let e=measureReadableStream(s,finish),t=createStreamResponse(o.raw,e);o.data=t.body,o.raw=t}else if(isAsyncIterable(s))o.data=measureAsyncIterable(s,finish);else return}catch{return}a.add(l),safeAdd(i,1,l.attributes)}function measureAsyncIterable(e,t){return(async function*(){let n;try{yield*e,n=`complete`}catch(e){throw n=`error`,e}finally{t(n??`cancelled`)}})()}function measureReadableStream(e,t){let n=e.getReader(),r=!1,settle=e=>{if(!r){r=!0;try{n.releaseLock()}catch{}t(e)}};return new ReadableStream({async pull(e){try{let t=await n.read();if(t.done){settle(`complete`),e.close();return}e.enqueue(t.value)}catch(t){settle(`error`),e.error(t)}},async cancel(e){try{await n.cancel(e)}finally{settle(`cancelled`)}}})}function createStreamResponse(e,t){let n=new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers});for(let t of[`url`,`redirected`,`type`])try{Object.defineProperty(n,t,{value:e[t],configurable:!0})}catch{}return n}function resolveStreamType(e,n){if(!(typeof e!=`object`||!e)){try{if(`getReader`in e&&t(e))return`bytes`;if(!(Symbol.asyncIterator in e))return}catch{return}return(n.headers.get(`content-type`)?.toLowerCase())?.includes(`text/event-stream`)?`sse`:`ndjson`}}function isAsyncIterable(e){return typeof e==`object`&&!!e&&Symbol.asyncIterator in e}function finishStreamState(e,t,n,r,i){if(!n.delete(e))return;let a={...e.attributes,"stream.outcome":t};safeRecord(i,Math.max(0,Date.now()-e.startedAt),a),safeAdd(r,-1,e.attributes)}function isCacheEnabled(e){try{return n(e,`cache`)?.enabled===!0}catch{return!1}}function createAttributes(e,t,n){return{...e.attributes,...n?.attributes,"http.request.method":t.method??`GET`}}function createResultAttributes(t,n,r=!1){let i={...t};r&&(i[`request.outcome`]=n.error?`error`:`success`);let a=n.response?.status??(e(n.error)?n.error.status:void 0);return a!==void 0&&(i[`http.response.status_code`]=a),n.error&&(i[`error.type`]=resolveErrorType(n.error)),i}function resolveErrorType(t){return e(t)?t.status===void 0?t.code:String(t.status):`_OTHER`}function finishState(e,t,n){t.delete(e)&&safeAdd(n,-1,e.attributes)}function shouldRecord(e,t){try{return e.shouldRecord?.(t)??!0}catch{return!1}}function safeCreateCounter(e,t,n){try{return e.createCounter(t,{unit:n})}catch{return}}function safeCreateUpDownCounter(e,t,n){try{return e.createUpDownCounter(t,{unit:n})}catch{return}}function safeCreateHistogram(e,t,n){try{return e.createHistogram(t,{unit:n})}catch{return}}function safeAdd(e,t,n){try{e?.add(t,n)}catch{}}function safeRecord(e,t,n){try{e?.record(t,n)}catch{}}function validateOptions(e){if(!e||typeof e.meter?.createCounter!=`function`||typeof e.meter?.createUpDownCounter!=`function`||typeof e.meter?.createHistogram!=`function`)throw TypeError()}export{openTelemetryMetricsPlugin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "../openTelemetryPlugin-
|
|
1
|
+
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "../openTelemetryPlugin-DX-5cpbR.cjs";
|
|
2
2
|
export { OpenTelemetryContextApi, OpenTelemetryHeaderSetter, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, openTelemetryPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "../openTelemetryPlugin-
|
|
1
|
+
import { a as OpenTelemetrySpan, c as openTelemetryPlugin, i as OpenTelemetryPropagationApi, n as OpenTelemetryHeaderSetter, o as OpenTelemetryTraceApi, r as OpenTelemetryPluginOptions, s as OpenTelemetryTracer, t as OpenTelemetryContextApi } from "../openTelemetryPlugin-BeykGhuv.js";
|
|
2
2
|
export { OpenTelemetryContextApi, OpenTelemetryHeaderSetter, OpenTelemetryPluginOptions, OpenTelemetryPropagationApi, OpenTelemetrySpan, OpenTelemetryTraceApi, OpenTelemetryTracer, openTelemetryPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "../rateLimitPlugin-
|
|
1
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "../rateLimitPlugin-C357f6EC.cjs";
|
|
2
2
|
export { RateLimitPlugin, RateLimitPluginOptions, RateLimitState, rateLimitPlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "../rateLimitPlugin-
|
|
1
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "../rateLimitPlugin-e_IjO32D.js";
|
|
2
2
|
export { RateLimitPlugin, RateLimitPluginOptions, RateLimitState, rateLimitPlugin };
|