@npora/request 1.21.4 → 1.22.1
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 +2 -1
- package/dist/{MockAdapter-Hi5uqQ8K.d.ts → MockAdapter-B0p0_AIH.d.cts} +44 -5
- package/dist/MockAdapter-BZwg5VWz.cjs +2 -0
- package/dist/{MockAdapter-CDWlJKqY.d.cts → MockAdapter-Cm79wcJx.d.ts} +44 -5
- package/dist/MockAdapter-DCnauo5Q.js +2 -0
- package/dist/{Plugin-BG4NQC3T.d.ts → Plugin-BQcrWrNm.d.cts} +1 -9
- package/dist/{Plugin-CCFavD-_.d.cts → Plugin-C3xZTHbG.d.ts} +1 -9
- package/dist/{PluginError-DVP3pUt_.d.cts → PluginError-Cq0DhZCF.d.cts} +0 -2
- package/dist/{PluginError-DVP3pUt_.d.ts → PluginError-Cq0DhZCF.d.ts} +0 -2
- package/dist/{SchemaValidationError-DV3aqGe0.d.cts → SchemaValidationError-B2fAMMkM.d.ts} +4 -18
- package/dist/{SchemaValidationError-D-Bg0Wc9.d.ts → SchemaValidationError-ClFDgxry.d.cts} +4 -18
- package/dist/{adapter-CcfItVkl.d.ts → adapter-B-L43hnj.d.ts} +1 -3
- package/dist/{adapter-Cq9y_Fww.d.cts → adapter-Q6uDyqF2.d.cts} +1 -3
- package/dist/{authPlugin-DRCFibHZ.d.ts → authPlugin-BCkcwFcq.d.ts} +1 -3
- package/dist/{authPlugin-DWpsWoVD.d.cts → authPlugin-DzMlmEGT.d.cts} +1 -3
- package/dist/{cachePlugin-D2ONW9sl.d.ts → cachePlugin-CnAMq7UC.d.ts} +2 -14
- package/dist/cachePlugin-JU-Rob4m.js +1 -0
- package/dist/{cachePlugin-BlsRZKN2.d.cts → cachePlugin-XF9k2IyP.d.cts} +2 -14
- package/dist/cachePlugin-XacR7ADG.cjs +1 -0
- package/dist/{circuitBreakerPlugin-DUyVrQlA.d.ts → circuitBreakerPlugin-CiH1p3kW.d.ts} +2 -4
- package/dist/{circuitBreakerPlugin-BL5Pxslz.d.cts → circuitBreakerPlugin-De7zlDeV.d.cts} +2 -4
- package/dist/{concurrencyPlugin-DM66h5PD.d.ts → concurrencyPlugin-DMkVFc5N.d.cts} +2 -4
- package/dist/{concurrencyPlugin-DId5qkk9.d.cts → concurrencyPlugin-lcwDZPqe.d.ts} +2 -4
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +6 -6
- package/dist/core.d.ts +6 -6
- package/dist/core.js +1 -1
- package/dist/createClient-B5Oxq2Fj.js +1 -0
- package/dist/createClient-CXvspA_F.cjs +1 -0
- package/dist/{downloadPlugin-BY3BVNw4.d.ts → downloadPlugin-BxIWgvyl.d.ts} +1 -3
- package/dist/{downloadPlugin-DtOzKGt_.d.cts → downloadPlugin-Cj2Zfocy.d.cts} +1 -3
- package/dist/errorResponseTimeout-CLPv3sv8.js +5 -0
- package/dist/errorResponseTimeout-CZWn7IpX.cjs +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/loggerPlugin-BtV0PYwO.d.ts +4 -0
- package/dist/loggerPlugin-Ck_c7bz8.d.cts +4 -0
- package/dist/{openTelemetryMetricsPlugin-BEoeRl3q.d.ts → openTelemetryMetricsPlugin-ClUnV57s.d.ts} +2 -4
- package/dist/{openTelemetryMetricsPlugin-DuF9OWoT.d.cts → openTelemetryMetricsPlugin-DrkR3Zpi.d.cts} +2 -4
- package/dist/{openTelemetryPlugin-DOhBE_uZ.d.ts → openTelemetryPlugin-BHs7ZJau.d.ts} +2 -4
- package/dist/{openTelemetryPlugin-Dpz6-bEj.d.cts → openTelemetryPlugin-Cd26lwLW.d.cts} +2 -4
- package/dist/plugins/auth.cjs +1 -1
- package/dist/plugins/auth.d.cts +1 -1
- package/dist/plugins/auth.d.ts +1 -1
- package/dist/plugins/auth.js +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.cjs +1 -1
- package/dist/plugins/circuit-breaker.d.cts +1 -1
- package/dist/plugins/circuit-breaker.d.ts +1 -1
- package/dist/plugins/circuit-breaker.js +1 -1
- package/dist/plugins/concurrency.cjs +1 -1
- package/dist/plugins/concurrency.d.cts +1 -1
- package/dist/plugins/concurrency.d.ts +1 -1
- package/dist/plugins/concurrency.js +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.cjs +1 -1
- package/dist/plugins/logger.d.cts +1 -1
- package/dist/plugins/logger.d.ts +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/plugins/memory-cache.cjs +1 -1
- package/dist/plugins/memory-cache.d.cts +4 -7
- package/dist/plugins/memory-cache.d.ts +4 -7
- package/dist/plugins/memory-cache.js +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.cjs +1 -1
- package/dist/plugins/opentelemetry.d.cts +1 -1
- package/dist/plugins/opentelemetry.d.ts +1 -1
- package/dist/plugins/opentelemetry.js +1 -1
- package/dist/plugins/rate-limit.cjs +1 -1
- package/dist/plugins/rate-limit.d.cts +1 -1
- package/dist/plugins/rate-limit.d.ts +1 -1
- package/dist/plugins/rate-limit.js +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 +13 -13
- package/dist/plugins.d.ts +13 -13
- package/dist/plugins.js +1 -1
- package/dist/rateLimitPlugin-C9CKjRyU.js +1 -0
- package/dist/{rateLimitPlugin-Ce3bjrRw.d.ts → rateLimitPlugin-Cbsw-Sxy.d.ts} +2 -4
- package/dist/rateLimitPlugin-D4to499s.cjs +1 -0
- package/dist/{rateLimitPlugin-CRpne4Qz.d.cts → rateLimitPlugin-D4zu4Jn2.d.cts} +2 -4
- package/dist/{response-BhOBjarL.d.ts → response-BepuyaMD.d.ts} +1 -9
- package/dist/{response-CXF5lNlw.d.cts → response-DFr_buHv.d.cts} +1 -9
- package/dist/retryPlugin-0I4ijOYE.d.ts +4 -0
- package/dist/retryPlugin-CA9VnS6H.d.cts +4 -0
- package/dist/schema-errors.d.cts +3 -6
- package/dist/schema-errors.d.ts +3 -6
- package/dist/{standardSchema-CjWI0T2o.d.cts → standardSchema-DkCdVLKc.d.cts} +0 -2
- package/dist/{standardSchema-CjWI0T2o.d.ts → standardSchema-DkCdVLKc.d.ts} +0 -2
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/uploadPlugin-CpVEqYGb.d.cts +3 -0
- package/dist/uploadPlugin-DOpXTqGy.d.ts +3 -0
- package/dist/waitForSignal-DXgmbuoa.js +1 -0
- package/dist/xhrTransport-B1vH5k3x.js +1 -0
- package/dist/{xhrTransport-BeC2XSM2.cjs → xhrTransport-CdBsCzpX.cjs} +1 -1
- package/package.json +3 -3
- package/dist/cachePlugin-BGfwCJRI.js +0 -1
- package/dist/cachePlugin-C9gu5JD0.cjs +0 -1
- package/dist/createClient-BQ1PXox6.cjs +0 -1
- package/dist/createClient-CVcpypA9.js +0 -1
- package/dist/errorResponseTimeout-BEEJV0xA.js +0 -5
- package/dist/errorResponseTimeout-zXdbsbDE.cjs +0 -5
- package/dist/loggerPlugin-ChJJN0ZA.d.ts +0 -6
- package/dist/loggerPlugin-DDEGhC31.d.cts +0 -6
- package/dist/rateLimitPlugin--8oHGS7_.js +0 -1
- package/dist/rateLimitPlugin-D8KaOpyW.cjs +0 -1
- package/dist/retryPlugin-5vYHV92i.d.ts +0 -6
- package/dist/retryPlugin-uC02f2sm.d.cts +0 -6
- package/dist/uploadPlugin-CNdvddnT.d.ts +0 -5
- package/dist/uploadPlugin-_xtlBLNY.d.cts +0 -5
- package/dist/waitForSignal-BcVEtAgx.js +0 -1
- package/dist/xhrTransport--NHaimro.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./isBinaryBody-DNjjEzFS.cjs"),n=require("./validateResponseStatus-6FKeKyEV.cjs"),r=require("./isReadableStream-uWhOa7eR.cjs"),i=require("./waitForSignal-9c9DAqqS.cjs"),a=require("./isPromiseLike-B4LL7DlV.cjs"),o=Symbol.for(`@npora/request/SchemaValidationError`);var SchemaValidationError=class extends e.t{constructor(e,t,n,r=[],i,a){super(e,{code:`SCHEMA_ERROR`,response:t,cause:i}),Object.defineProperty(this,o,{value:!0}),this.name=`SchemaValidationError`,this.issues=r,this.schemaVendor=n,this.itemIndex=a?.itemIndex,this.lineNumber=a?.lineNumber,this.event=a?.event,this.eventId=a?.eventId,Object.setPrototypeOf(this,new.target.prototype)}};function isSchemaValidationError(e){if(typeof e!=`object`&&typeof e!=`function`||e===null)return!1;try{return Reflect.get(e,o)===!0}catch{return!1}}function s(t,n,r=`Request timeout after ${n}ms`){if(!n||n<=0||t?.aborted)return{signal:t,clear:c};let i=new AbortController,a,o,s=()=>{if(a!==void 0&&(clearTimeout(a),a=void 0),t&&o){try{t.removeEventListener(`abort`,o)}catch{}o=void 0}};if(t){o=()=>{s(),i.abort(t.reason??new e.t(`Request aborted`,{code:`ABORT_ERROR`}))};try{t.addEventListener(`abort`,o,{once:!0})}catch(e){throw s(),e}if(t.aborted&&!i.signal.aborted&&o(),i.signal.aborted)return{signal:i.signal,clear:s}}try{a=setTimeout(()=>{s(),i.abort(new e.t(r,{code:`TIMEOUT_ERROR`}))},n)}catch(e){throw s(),e}return i.signal.aborted&&s(),{signal:i.signal,clear:s}}function c(){}const l=Object.prototype.hasOwnProperty,u=Symbol(`nativeRequest`);function d(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 f(e,t,n=t.body){e[u]={request:t,body:n}}function p(e,t){let n=e[u];return n&&n.body===t?n.request:void 0}const m={json:`application/json`,text:`text/*`,blob:`*/*`,arrayBuffer:`*/*`,bytes:`*/*`,formData:`multipart/form-data`,stream:`*/*`,sse:`text/event-stream`,ndjson:`application/x-ndjson, application/ndjson`},h=/^([^?#]*)(?:\?([^#]*))?(#.*)?$/;function g(e){return _(e,new Headers(e.headers))}function _(e,t){y(t,e.responseType);let n=oe(e,t);E(n,e);let i={},a=n;n=O(n,e,i);let o=ne(e),c=te(e,n,o,e.method),l={...e.fetchOptions,method:e.method??`GET`,headers:t,signal:e.signal};c||(l.body=n,n&&r.t(n)&&(l.duplex=`half`));let u=e.timeout&&e.timeout>0?s(e.signal,e.timeout):void 0;return u&&(l.signal=u.signal),{url:o,input:c,useNativeInput:c?v(c,l,e.fetchOptions):!1,init:l,clear:u?.clear??ue,bodyError:n===a?void 0:i}}function v(e,t,n){return t.method!==e.method||t.signal!==e.signal||!ee(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 ee(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 te(e,t,n,r){let i=p(e,t);return i?.url===n&&i.method===(r??`GET`)?i:void 0}function y(e,t){t&&!e.has(`accept`)&&e.set(`accept`,m[t])}function ne(e){let t=ie(e.baseURL,String(e.url));if(!e.query&&!e.searchParams)return t;let n=re(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 re(t){if(t.searchParams)return t.searchParams.toString();let n=t.query;if(!t.querySerializer)return ae(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 ie(e,t){if(!e||x(t))return t;if(!t)return e;let n=e.includes(`?`)||e.includes(`#`),r=t.charCodeAt(0);if(!n&&r!==63&&r!==35)return b(e,t);let i=h.exec(e),a=h.exec(t),o=b(i[1],a[1]),s=i[2]??``,c=a[2]??``,l=s&&c?`${s}&${c}`:s||c,u=a[3]||i[3]||``;return`${o}${l?`?${l}`:``}${u}`}function b(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 x(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 ae(e){let t=new URLSearchParams;for(let n in e)l.call(e,n)&&S(t,n,e[n]);return t.toString()}function S(e,t,n){if(n!==void 0){if(n===null)e.append(t,``);else if(Array.isArray(n))for(let r of n)r!==void 0&&e.append(t,r===null?``:String(r));else e.append(t,String(n))}}function oe(e,t){if(e.json!==void 0)return T(t,`application/json`),C(e.json,e);if(e.form!==void 0)return T(t,`application/x-www-form-urlencoded;charset=UTF-8`),se(e.form);if(e.formData!==void 0)return ce(e.formData,e.maxFormDataDepth);if(e.body!==null&&e.body!==void 0)return le(e.body)?(T(t,`application/json`),C(e.body,e)):e.body}function C(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 se(e){if(t.r(e))return e;let n=new URLSearchParams;for(let t in e)l.call(e,t)&&S(n,t,e[t]);return n}function ce(e,t=32){if(n.r(e))return e;let r=new FormData,i=new WeakSet;for(let n in e)l.call(e,n)&&w(r,n,e[n],0,t,i);return r}function w(e,n,r,i,a,o){if(r!=null){if(Array.isArray(r)){if(o.has(r))throw TypeError(`FormData arrays cannot contain circular references`);let t=i+1;if(t>a)throw RangeError(`FormData array depth exceeds maxFormDataDepth ${a}`);o.add(r);try{for(let i of r)w(e,n,i,t,a,o)}finally{o.delete(r)}}else t.n(r)?e.append(n,r):e.append(n,String(r))}}function T(e,t){e.has(`content-type`)||e.set(`content-type`,t)}function E(t,n){let r=n.maxRequestSize;if(!Number.isFinite(r)||t===void 0)return;let i=D(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 D(e){if(typeof e==`string`)return k(e);if(t.r(e))return k(e.toString());if(t.n(e))return e.size;if(t.t(e)||ArrayBuffer.isView(e))return e.byteLength}function O(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 k(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 le(e){return Object.prototype.toString.call(e)===`[object Object]`}function ue(){}async function A(e,t,n,r){let o,s=`unknown`;i.i(n.config);try{let r=e[`~standard`];s=r.vendor;let c=r.validate(t);o=a.t(c)?await i.t(c,n.config):c,i.i(n.config)}catch(e){throw i.i(n.config),new SchemaValidationError(r.failed,n,s,[],e,r.location)}if(typeof o!=`object`||!o)throw j(r,n,s,`Expected a Standard Schema result`);let c=`issues`in o?o.issues:void 0;if(c!==void 0)throw Array.isArray(c)?new SchemaValidationError(r.rejected,n,s,c,void 0,r.location):j(r,n,s,`Expected Standard Schema issues to be an array`);if(!(`value`in o))throw j(r,n,s,`Expected a Standard Schema value`);return o.value}function j(e,t,n,r){return new SchemaValidationError(e.invalid,t,n,[],TypeError(r),e.location)}function M(e,t){let n=!1,r,i=e(()=>{n=!0});for(let e of[`return`,`throw`]){let a=i[e];i[e]=e=>{let o=!n;n=!0;let s=a.call(i,e);return!o&&!r?s:(o&&(r=Promise.resolve().then(t).catch(()=>{})),Promise.allSettled([s,r]).then(([e])=>{if(e.status===`rejected`)throw e.reason;return e.value}))}}return i}const de=new TextEncoder;function fe(e,t,n,r=t.signal){return M(i=>N(e.body,{config:t,response:e,signal:r,start:i},n),()=>e.body?.cancel())}function pe(e,t,n=t.signal){return M(r=>P(e.body,{config:t,response:e,signal:n,start:r}),()=>e.body?.cancel())}async function*N(e,t,n){t.start();let r=[],i=``,a=n?.initialId??``,o=n?.initialRetry,s=0;for await(let c of I(e,t,!0)){if(c===``){if(r.length>0){let e={data:r.join(`
|
|
2
|
+
`),event:i||`message`,id:a,...o===void 0?{}:{retry:o}};yield await F(e,t,{itemIndex:s,event:e.event,eventId:e.id},`SSE`),s+=1}r=[],i=``;continue}if(c.startsWith(`:`))continue;let e=c.indexOf(`:`),l=e===-1?c:c.slice(0,e),u=e===-1?``:c.slice(e+1);switch(u.startsWith(` `)&&(u=u.slice(1)),l){case`data`:r.push(u);break;case`event`:i=u;break;case`id`:u.includes(`\0`)||(a=u,n?.onId?.(u));break;case`retry`:if(/^\d+$/.test(u)){let e=Number(u);Number.isSafeInteger(e)&&(o=e,n?.onRetry?.(e))}}}}async function*P(t,n){n.start();let r=0,i=0;for await(let a of I(t,n))if(r+=1,a.trim()!==``)try{yield await F(JSON.parse(a),n,{itemIndex:i,lineNumber:r},`NDJSON`),i+=1}catch(t){throw e.n(t)?t:z(`Failed to parse NDJSON at line ${r}`,n,t)}}async function F(e,t,n,r){L(t);let i=t.config.itemSchema;if(!i)return e;let a={data:e,status:t.response.status,statusText:t.response.statusText,headers:t.response.headers,config:t.schemaConfig??t.config,raw:t.response},o=r===`NDJSON`?`item ${n.itemIndex+1} at line ${n.lineNumber}`:`item ${n.itemIndex+1}`;return await A(i,e,a,{failed:`${r} ${o} schema validator failed`,invalid:`${r} ${o} schema validator returned an invalid result`,rejected:`${r} ${o} schema validation failed`,location:n})}async function*I(t,n,r=!1){if(!t)return;let i=t.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=[],s=!1,c=!1,l=0,u=0,d,f=n.config.itemSchema?new AbortController:void 0;if(f){let e=[f.signal];n.config.signal&&e.push(n.config.signal),n.signal&&n.signal!==n.config.signal&&e.push(n.signal),n.schemaConfig={...n.config,signal:e.length===1?f.signal:AbortSignal.any(e)}}i.closed.catch(t=>{d=t,f?.abort(e.n(t)?t:z(`Failed to parse streaming response`,n,t))});let p=()=>{if(L(n),d!==void 0)throw d},m=n.config.maxStreamLineSize,h=r?n.config.maxSseEventSize:void 0,g=e=>{(Number.isFinite(m)||Number.isFinite(h))&&(l+=de.encode(e).byteLength,R(l,m,`maxStreamLineSize`,n),R(u+l,h,`maxSseEventSize`,n))};try{for(;;){p();let e=await i.read();p(),c=e.done;let t=c?a.decode():a.decode(e.value,{stream:!0}),n=0;s&&t.length>0&&(t[0]===`
|
|
3
|
+
`&&(n=1),s=!1);for(let e=n;e<t.length;e+=1){let r=t[e];if(r!==`
|
|
4
|
+
`&&r!==`\r`)continue;let i=t.slice(n,e);g(i),o.length>0&&(o.push(i),i=o.join(``),o=[]),r===`\r`&&(t[e+1]===`
|
|
5
|
+
`?e+=1:e+1===t.length&&(s=!0)),n=e+1,u=i===``?0:u+l,p(),yield i,l=0}if(n<t.length){let e=t.slice(n);g(e),o.push(e)}if(c)break}p(),o.length>0&&(yield o.join(``))}catch(t){throw e.n(t)?t:z(`Failed to parse streaming response`,n,t)}finally{try{c||i.cancel().catch(()=>{})}catch{}finally{i.releaseLock()}}}function L(e){if(e.config.signal?.aborted)throw i.r(e.config.signal.reason,e.config);if(e.signal?.aborted)throw i.r(e.signal.reason,e.config)}function R(t,n,r,i){if(n!==void 0&&t>n)throw new e.t(`Streaming response exceeds ${r} ${n}`,{code:`RESPONSE_TOO_LARGE`,status:i.response.status,config:i.config})}function z(t,n,r){return new e.t(t,{code:`PARSER_ERROR`,status:n.response.status,config:n.config,cause:r})}const B=Symbol(`npora.sseControl`);function me(e,t){return{...e,[B]:t}}function he(e){return e[B]}const V=new TextDecoder;function ge(e,t){let n=t.maxResponseSize;if(n===void 0||!Number.isFinite(n)||!e.body)return e;H(e,n,t);let r=new Response(J(e,t,n),{status:e.status,statusText:e.statusText,headers:e.headers});return Z(e,r),r}function _e(e,t,n,r,i=1/0,a=n.streamIdleTimeout){if(!e.body)return r(),e;H(e,i,n);let o=J(e,n,i,t,r,a),s=new Response(o,{status:e.status,statusText:e.statusText,headers:e.headers});return Z(e,s),s}async function ve(t,n,r,i=n.maxResponseSize,a){let o=r??K(t,n),s=i;try{if(G(o))return s!==void 0&&Number.isFinite(s)&&(H(t,s,n),t=new Response(t.body?J(t,n,s):null,t)),xe(t,o,n,a);if(a||s!==void 0&&Number.isFinite(s)){let e=Number.isFinite(s)?s:1/0;return H(t,e,n),await ye(await U(t,e,n,a),o,t,n)}switch(o){case`json`:return n.parseJson?await W(await t.text(),n,t):await t.json();case`text`:return await t.text();case`blob`:return await t.blob();case`arrayBuffer`:return await t.arrayBuffer();case`bytes`:return await be(t);case`formData`:return await t.formData();default:return await t.text()}}catch(r){throw e.n(r)?r:new e.t(`Failed to parse response`,{code:`PARSER_ERROR`,status:t.status,config:n,cause:r})}}function H(e,t,n){let r=Number(e.headers.get(`content-length`));if(!Number.isFinite(r)||r<=t)return;let i=Y(e,t,n);throw e.body?.cancel(i).catch(()=>{}),i}async function U(e,t,n,r){if(!e.body)return new Uint8Array;let i=e.body.getReader(),a=[],o=0,s,c=r?()=>{s=r.reason??new DOMException(`The operation was aborted`,`AbortError`),i.cancel(s).catch(()=>{})}:void 0;try{for(r?.addEventListener(`abort`,c,{once:!0}),r?.aborted&&c();;){let r=await i.read();if(s!==void 0)throw s;if(r.done)break;if(o+=r.value.byteLength,o>t){let r=Y(e,t,n);throw i.cancel(r).catch(()=>{}),r}a.push(r.value)}}finally{if(c)try{r?.removeEventListener(`abort`,c)}catch{}i.releaseLock()}let l=new Uint8Array(o),u=0;for(let e of a)l.set(e,u),u+=e.byteLength;return l}async function ye(e,t,n,r){switch(t){case`json`:return await W(V.decode(e),r,n);case`blob`:return new Blob([q(e)],{type:n.headers.get(`content-type`)??``});case`arrayBuffer`:return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case`bytes`:return e;case`formData`:return await new Response(q(e),{headers:n.headers}).formData();default:return V.decode(e)}}function W(e,t,n){return t.parseJson?t.parseJson(e,{config:t,response:n}):JSON.parse(e)}async function be(e){let t=e.bytes;return typeof t==`function`?t.call(e):new Uint8Array(await e.arrayBuffer())}function xe(e,t,n,r){switch(t){case`sse`:return fe(e,n,he(n),r);case`ndjson`:return pe(e,n,r);default:return e.body}}function G(e){return e===`stream`||e===`sse`||e===`ndjson`}function K(e,t){return t.responseType??Se(e)}function q(e){return t.t(e.buffer)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):Uint8Array.from(e).buffer}function J(t,n,r,i,a,o){let s=t.body.getReader(),c=0,l=!1,u,d,f,p,m=()=>{p!==void 0&&clearTimeout(p),p=void 0},h=()=>{if(!l){if(l=!0,m(),d){try{i?.removeEventListener(`abort`,d)}catch{}d=void 0}s.releaseLock(),a?.()}},g=new ReadableStream({start(e){f=e},async pull(a){try{o&&(p=setTimeout(()=>_(new e.t(`Streaming response idle timeout after ${o}ms`,{code:`TIMEOUT_ERROR`,status:t.status,config:n})),o));let i=await s.read();if(m(),u){let e=u;h(),a.error(e);return}if(l)return;if(i.done){h(),a.close();return}if(c+=i.value.byteLength,c>r){_(Y(t,r,n));return}a.enqueue(i.value)}catch(e){if(l)return;h(),a.error(X(e,i,n))}},cancel(e){try{return s.cancel(e)}finally{h()}}});function _(e){l||(u=e,s.cancel(e).catch(()=>{}),h(),f.error(e))}if(i){d=()=>{l||u!==void 0||_(X(i.reason,i,n))};try{i.addEventListener(`abort`,d,{once:!0}),i.aborted&&d?.()}catch(e){throw s.cancel(e).catch(()=>{}).finally(h),e}}return g}function Y(t,n,r){return new e.t(`Response body exceeds maxResponseSize ${n}`,{code:`RESPONSE_TOO_LARGE`,status:t.status,config:r})}function X(t,n,r){return n?.aborted?e.n(n.reason)?new e.t(n.reason.message,{code:n.reason.code,status:n.reason.status,data:n.reason.data,response:n.reason.response,config:r,cause:n.reason}):new e.t(`Request aborted while consuming response`,{code:`ABORT_ERROR`,config:r,cause:n.reason??t}):t}function Z(e,t){for(let n of[`url`,`redirected`,`type`])try{Object.defineProperty(t,n,{value:e[n],configurable:!0})}catch{}}function Se(e){let t=e.headers.get(`content-type`);if(!t||t===`text/plain`)return`text`;if(t===`application/json`)return`json`;let n=t.indexOf(`;`),r=t.slice(0,n===-1?void 0:n).trim().toLowerCase();return r===`text/event-stream`?`sse`:r===`application/x-ndjson`||r===`application/ndjson`||Q(r,`+ndjson`)?`ndjson`:r===`application/json`||Q(r,`+json`)?`json`:`text`}function Q(e,t){let n=e.indexOf(`/`),r=e.length-t.length;return n>0&&r>n+1&&e.endsWith(t)}function Ce(e){let t=e.maxErrorResponseSize??10485760,n=e.maxResponseSize;return Number.isFinite(t)&&(!Number.isFinite(n)||t<(n??1/0))?t:void 0}const $=Symbol(`ERROR_RESPONSE_DATA_UNAVAILABLE`);async function we(t,n,r){let i=t.timeout??0,a=i>0?i:1e4,o=new AbortController,s,c=!1,l,u=()=>{try{r?.()}catch{}o.abort()};try{let r=new Promise((n,r)=>{s=setTimeout(()=>{c=!0,u(),i>0?r(new e.t(`Request timeout after ${i}ms`,{code:`TIMEOUT_ERROR`,config:t})):n($)},a)});l=n(o.signal);try{return await Promise.race([l,r])}catch(t){if(e.n(t)&&t.code===`PARSER_ERROR`)return $;throw t}}finally{s!==void 0&&!c&&clearTimeout(s),l?.catch(()=>{})}}Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return SchemaValidationError}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return isSchemaValidationError}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return s}});
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./errorResponseTimeout-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./RequestError-DrCr_lwO.cjs"),t=require("./errorResponseTimeout-CZWn7IpX.cjs"),n=require("./createClient-CXvspA_F.cjs"),r=require("./MockAdapter-BZwg5VWz.cjs"),i=require("./PluginError-DT3VnlUB.cjs"),a=require("./plugins/auth.cjs"),o=require("./cachePlugin-XacR7ADG.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-D4to499s.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.t,exports.PluginError=i.t,exports.RequestError=e.t,exports.SchemaValidationError=t.b,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.x,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,19 +1,19 @@
|
|
|
1
|
-
import { A as LoggerEntry, B as RetryEvent, C as CircuitBreakerStateChange, D as DownloadOutput, E as DownloadOptions, F as OpenTelemetryOptions, G as UploadProgress, H as TransferProgress, I as RateLimitOptions, K as HttpMethod, L as RequestLogEntry, M as MemoryCacheOptions, N as OpenTelemetryAttributeValue, O as DownloadProgress, P as OpenTelemetryMetricsOptions, R as RequestLogger, S as CircuitBreakerOptions, T as ConcurrencyOptions, U as UploadData, V as RetryOptions, W as UploadOptions, _ as RequestInputConfig, a as SseStateObserver, b as AuthOptions, c as FetchOptions, d as JsonStringifier, f as QueryParams, g as RequestExtensions, h as RequestConfig, i as SseState, j as LoggerOptions, k as ErrorLogEntry, l as JsonParser, m as QueryValue, n as ServerSentEvent, o as StreamingSchemaLocation, p as QuerySerializer, r as SseReconnectOptions, s as FetchFunction, t as NporaResponse, u as JsonParserContext, v as RequestURL, w as CircuitState, x as CacheOptions, y as ResponseType, z as ResponseLogEntry } from "./response-
|
|
2
|
-
import { t as StandardSchemaV1 } from "./standardSchema-
|
|
3
|
-
import { t as Adapter } from "./adapter-
|
|
4
|
-
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-
|
|
5
|
-
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-
|
|
6
|
-
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-
|
|
7
|
-
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-
|
|
8
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-
|
|
9
|
-
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-
|
|
10
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-
|
|
11
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-
|
|
12
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-
|
|
13
|
-
import { t as loggerPlugin } from "./loggerPlugin-
|
|
14
|
-
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-
|
|
15
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-
|
|
16
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-
|
|
17
|
-
import { t as retryPlugin } from "./retryPlugin-
|
|
18
|
-
import { t as uploadPlugin } from "./uploadPlugin-
|
|
19
|
-
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, SseState, SseStateObserver, 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 };
|
|
1
|
+
import { A as LoggerEntry, B as RetryEvent, C as CircuitBreakerStateChange, D as DownloadOutput, E as DownloadOptions, F as OpenTelemetryOptions, G as UploadProgress, H as TransferProgress, I as RateLimitOptions, K as HttpMethod, L as RequestLogEntry, M as MemoryCacheOptions, N as OpenTelemetryAttributeValue, O as DownloadProgress, P as OpenTelemetryMetricsOptions, R as RequestLogger, S as CircuitBreakerOptions, T as ConcurrencyOptions, U as UploadData, V as RetryOptions, W as UploadOptions, _ as RequestInputConfig, a as SseStateObserver, b as AuthOptions, c as FetchOptions, d as JsonStringifier, f as QueryParams, g as RequestExtensions, h as RequestConfig, i as SseState, j as LoggerOptions, k as ErrorLogEntry, l as JsonParser, m as QueryValue, n as ServerSentEvent, o as StreamingSchemaLocation, p as QuerySerializer, r as SseReconnectOptions, s as FetchFunction, t as NporaResponse, u as JsonParserContext, v as RequestURL, w as CircuitState, x as CacheOptions, y as ResponseType, z as ResponseLogEntry } from "./response-DFr_buHv.cjs";
|
|
2
|
+
import { t as StandardSchemaV1 } from "./standardSchema-DkCdVLKc.cjs";
|
|
3
|
+
import { t as Adapter } from "./adapter-Q6uDyqF2.cjs";
|
|
4
|
+
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-ClFDgxry.cjs";
|
|
5
|
+
import { a as MockReplyHandler, c as MockRoute, d as MockRecordedData, f as MockRecording, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, p as MockRecordingStats, r as MockHandler, s as MockResponseOptions, t as MockAdapter, u as MockRecordOptions } from "./MockAdapter-B0p0_AIH.cjs";
|
|
6
|
+
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-BQcrWrNm.cjs";
|
|
7
|
+
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-Cq0DhZCF.cjs";
|
|
8
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-DzMlmEGT.cjs";
|
|
9
|
+
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-XF9k2IyP.cjs";
|
|
10
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-De7zlDeV.cjs";
|
|
11
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-DMkVFc5N.cjs";
|
|
12
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-Cj2Zfocy.cjs";
|
|
13
|
+
import { t as loggerPlugin } from "./loggerPlugin-Ck_c7bz8.cjs";
|
|
14
|
+
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-Cd26lwLW.cjs";
|
|
15
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-DrkR3Zpi.cjs";
|
|
16
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-D4zu4Jn2.cjs";
|
|
17
|
+
import { t as retryPlugin } from "./retryPlugin-CA9VnS6H.cjs";
|
|
18
|
+
import { t as uploadPlugin } from "./uploadPlugin-CpVEqYGb.cjs";
|
|
19
|
+
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, type MockRecordOptions, type MockRecordedData, type MockRecording, type MockRecordingStats, 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, SseState, SseStateObserver, 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,19 +1,19 @@
|
|
|
1
|
-
import { A as LoggerEntry, B as RetryEvent, C as CircuitBreakerStateChange, D as DownloadOutput, E as DownloadOptions, F as OpenTelemetryOptions, G as UploadProgress, H as TransferProgress, I as RateLimitOptions, K as HttpMethod, L as RequestLogEntry, M as MemoryCacheOptions, N as OpenTelemetryAttributeValue, O as DownloadProgress, P as OpenTelemetryMetricsOptions, R as RequestLogger, S as CircuitBreakerOptions, T as ConcurrencyOptions, U as UploadData, V as RetryOptions, W as UploadOptions, _ as RequestInputConfig, a as SseStateObserver, b as AuthOptions, c as FetchOptions, d as JsonStringifier, f as QueryParams, g as RequestExtensions, h as RequestConfig, i as SseState, j as LoggerOptions, k as ErrorLogEntry, l as JsonParser, m as QueryValue, n as ServerSentEvent, o as StreamingSchemaLocation, p as QuerySerializer, r as SseReconnectOptions, s as FetchFunction, t as NporaResponse, u as JsonParserContext, v as RequestURL, w as CircuitState, x as CacheOptions, y as ResponseType, z as ResponseLogEntry } from "./response-
|
|
2
|
-
import { t as StandardSchemaV1 } from "./standardSchema-
|
|
3
|
-
import { t as Adapter } from "./adapter-
|
|
4
|
-
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-
|
|
5
|
-
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-
|
|
6
|
-
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-
|
|
7
|
-
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-
|
|
8
|
-
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-
|
|
9
|
-
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-
|
|
10
|
-
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-
|
|
11
|
-
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-
|
|
12
|
-
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-
|
|
13
|
-
import { t as loggerPlugin } from "./loggerPlugin-
|
|
14
|
-
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-
|
|
15
|
-
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-
|
|
16
|
-
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-
|
|
17
|
-
import { t as retryPlugin } from "./retryPlugin-
|
|
18
|
-
import { t as uploadPlugin } from "./uploadPlugin-
|
|
19
|
-
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, SseState, SseStateObserver, 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 };
|
|
1
|
+
import { A as LoggerEntry, B as RetryEvent, C as CircuitBreakerStateChange, D as DownloadOutput, E as DownloadOptions, F as OpenTelemetryOptions, G as UploadProgress, H as TransferProgress, I as RateLimitOptions, K as HttpMethod, L as RequestLogEntry, M as MemoryCacheOptions, N as OpenTelemetryAttributeValue, O as DownloadProgress, P as OpenTelemetryMetricsOptions, R as RequestLogger, S as CircuitBreakerOptions, T as ConcurrencyOptions, U as UploadData, V as RetryOptions, W as UploadOptions, _ as RequestInputConfig, a as SseStateObserver, b as AuthOptions, c as FetchOptions, d as JsonStringifier, f as QueryParams, g as RequestExtensions, h as RequestConfig, i as SseState, j as LoggerOptions, k as ErrorLogEntry, l as JsonParser, m as QueryValue, n as ServerSentEvent, o as StreamingSchemaLocation, p as QuerySerializer, r as SseReconnectOptions, s as FetchFunction, t as NporaResponse, u as JsonParserContext, v as RequestURL, w as CircuitState, x as CacheOptions, y as ResponseType, z as ResponseLogEntry } from "./response-BepuyaMD.js";
|
|
2
|
+
import { t as StandardSchemaV1 } from "./standardSchema-DkCdVLKc.js";
|
|
3
|
+
import { t as Adapter } from "./adapter-B-L43hnj.js";
|
|
4
|
+
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-B2fAMMkM.js";
|
|
5
|
+
import { a as MockReplyHandler, c as MockRoute, d as MockRecordedData, f as MockRecording, i as MockReply, l as MockURLMatcher, n as MockAdapterOptions, o as MockRequestMatcher, p as MockRecordingStats, r as MockHandler, s as MockResponseOptions, t as MockAdapter, u as MockRecordOptions } from "./MockAdapter-Cm79wcJx.js";
|
|
6
|
+
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-C3xZTHbG.js";
|
|
7
|
+
import { n as PluginErrorCode, r as PluginErrorOptions, t as PluginError } from "./PluginError-Cq0DhZCF.js";
|
|
8
|
+
import { n as AuthTokenStorage, r as authPlugin, t as AuthPluginOptions } from "./authPlugin-BCkcwFcq.js";
|
|
9
|
+
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-CnAMq7UC.js";
|
|
10
|
+
import { n as CircuitBreakerPluginOptions, r as circuitBreakerPlugin, t as CircuitBreakerPlugin } from "./circuitBreakerPlugin-CiH1p3kW.js";
|
|
11
|
+
import { i as concurrencyPlugin, n as ConcurrencyPluginOptions, r as ConcurrencyState, t as ConcurrencyPlugin } from "./concurrencyPlugin-lcwDZPqe.js";
|
|
12
|
+
import { n as DownloadTransport, r as downloadPlugin, t as DownloadPluginOptions } from "./downloadPlugin-BxIWgvyl.js";
|
|
13
|
+
import { t as loggerPlugin } from "./loggerPlugin-BtV0PYwO.js";
|
|
14
|
+
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-BHs7ZJau.js";
|
|
15
|
+
import { a as OpenTelemetryMetricsPluginOptions, i as OpenTelemetryMetricAttributes, n as OpenTelemetryHistogram, o as openTelemetryMetricsPlugin, r as OpenTelemetryMeter, t as OpenTelemetryCounter } from "./openTelemetryMetricsPlugin-ClUnV57s.js";
|
|
16
|
+
import { i as rateLimitPlugin, n as RateLimitPluginOptions, r as RateLimitState, t as RateLimitPlugin } from "./rateLimitPlugin-Cbsw-Sxy.js";
|
|
17
|
+
import { t as retryPlugin } from "./retryPlugin-0I4ijOYE.js";
|
|
18
|
+
import { t as uploadPlugin } from "./uploadPlugin-DOpXTqGy.js";
|
|
19
|
+
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, type MockRecordOptions, type MockRecordedData, type MockRecording, type MockRecordingStats, 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, SseState, SseStateObserver, 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 isRequestError,t as e}from"./RequestError-B0HIY1zK.js";import{b as t,x as isSchemaValidationError}from"./errorResponseTimeout-
|
|
1
|
+
import{n as isRequestError,t as e}from"./RequestError-B0HIY1zK.js";import{b as t,x as isSchemaValidationError}from"./errorResponseTimeout-CLPv3sv8.js";import{i as n,n as r,r as i,t as createClient}from"./createClient-B5Oxq2Fj.js";import{t as a}from"./MockAdapter-DCnauo5Q.js";import{t as o}from"./PluginError-CcuPSIRv.js";import{authPlugin}from"./plugins/auth.js";import{a as s,i as c,n as l,r as u,t as cachePlugin}from"./cachePlugin-JU-Rob4m.js";import{circuitBreakerPlugin}from"./plugins/circuit-breaker.js";import{concurrencyPlugin}from"./plugins/concurrency.js";import{downloadPlugin}from"./plugins/download.js";import{loggerPlugin}from"./plugins/logger.js";import{openTelemetryPlugin}from"./plugins/opentelemetry.js";import{openTelemetryMetricsPlugin}from"./plugins/opentelemetry-metrics.js";import{t as rateLimitPlugin}from"./rateLimitPlugin-C9CKjRyU.js";import{retryPlugin}from"./plugins/retry.js";import{uploadPlugin}from"./plugins/upload.js";import"./plugins.js";export{r as Client,n as FetchAdapter,u as IndexedDBCacheStore,i as InterceptorManager,c as MemoryCacheStore,a as MockAdapter,o as PluginError,e as RequestError,t as SchemaValidationError,l as TieredCacheStore,s as WebStorageCacheStore,authPlugin,cachePlugin,circuitBreakerPlugin,concurrencyPlugin,createClient,downloadPlugin,isRequestError,isSchemaValidationError,loggerPlugin,openTelemetryMetricsPlugin,openTelemetryPlugin,rateLimitPlugin,retryPlugin,uploadPlugin};
|
package/dist/{openTelemetryMetricsPlugin-BEoeRl3q.d.ts → openTelemetryMetricsPlugin-ClUnV57s.d.ts}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
3
|
-
//#region src/plugins/openTelemetryMetricsPlugin.d.ts
|
|
1
|
+
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-BepuyaMD.js";
|
|
2
|
+
import { t as Plugin } from "./Plugin-C3xZTHbG.js";
|
|
4
3
|
type OpenTelemetryMetricAttributes = Readonly<Record<string, OpenTelemetryAttributeValue>>;
|
|
5
4
|
interface OpenTelemetryCounter {
|
|
6
5
|
add(value: number, attributes?: OpenTelemetryMetricAttributes): void;
|
|
@@ -40,5 +39,4 @@ interface OpenTelemetryMetricsPluginOptions {
|
|
|
40
39
|
* runtime dependency on an OpenTelemetry SDK.
|
|
41
40
|
*/
|
|
42
41
|
declare function openTelemetryMetricsPlugin(options: OpenTelemetryMetricsPluginOptions): Plugin;
|
|
43
|
-
//#endregion
|
|
44
42
|
export { OpenTelemetryMetricsPluginOptions as a, OpenTelemetryMetricAttributes as i, OpenTelemetryHistogram as n, openTelemetryMetricsPlugin as o, OpenTelemetryMeter as r, OpenTelemetryCounter as t };
|
package/dist/{openTelemetryMetricsPlugin-DuF9OWoT.d.cts → openTelemetryMetricsPlugin-DrkR3Zpi.d.cts}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
3
|
-
//#region src/plugins/openTelemetryMetricsPlugin.d.ts
|
|
1
|
+
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-DFr_buHv.cjs";
|
|
2
|
+
import { t as Plugin } from "./Plugin-BQcrWrNm.cjs";
|
|
4
3
|
type OpenTelemetryMetricAttributes = Readonly<Record<string, OpenTelemetryAttributeValue>>;
|
|
5
4
|
interface OpenTelemetryCounter {
|
|
6
5
|
add(value: number, attributes?: OpenTelemetryMetricAttributes): void;
|
|
@@ -40,5 +39,4 @@ interface OpenTelemetryMetricsPluginOptions {
|
|
|
40
39
|
* runtime dependency on an OpenTelemetry SDK.
|
|
41
40
|
*/
|
|
42
41
|
declare function openTelemetryMetricsPlugin(options: OpenTelemetryMetricsPluginOptions): Plugin;
|
|
43
|
-
//#endregion
|
|
44
42
|
export { OpenTelemetryMetricsPluginOptions as a, OpenTelemetryMetricAttributes as i, OpenTelemetryHistogram as n, openTelemetryMetricsPlugin as o, OpenTelemetryMeter as r, OpenTelemetryCounter as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
3
|
-
//#region src/plugins/openTelemetryPlugin.d.ts
|
|
1
|
+
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-BepuyaMD.js";
|
|
2
|
+
import { t as Plugin } from "./Plugin-C3xZTHbG.js";
|
|
4
3
|
interface OpenTelemetrySpan {
|
|
5
4
|
setAttribute(name: string, value: OpenTelemetryAttributeValue): this;
|
|
6
5
|
setStatus(status: {
|
|
@@ -53,5 +52,4 @@ interface OpenTelemetryPluginOptions {
|
|
|
53
52
|
* Trace each actual HTTP transport attempt without depending on an OTel SDK.
|
|
54
53
|
*/
|
|
55
54
|
declare function openTelemetryPlugin(options: OpenTelemetryPluginOptions): Plugin;
|
|
56
|
-
//#endregion
|
|
57
55
|
export { OpenTelemetrySpan as a, openTelemetryPlugin as c, OpenTelemetryPropagationApi as i, OpenTelemetryHeaderSetter as n, OpenTelemetryTraceApi as o, OpenTelemetryPluginOptions as r, OpenTelemetryTracer as s, OpenTelemetryContextApi as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-
|
|
2
|
-
import { t as Plugin } from "./Plugin-
|
|
3
|
-
//#region src/plugins/openTelemetryPlugin.d.ts
|
|
1
|
+
import { N as OpenTelemetryAttributeValue, h as RequestConfig } from "./response-DFr_buHv.cjs";
|
|
2
|
+
import { t as Plugin } from "./Plugin-BQcrWrNm.cjs";
|
|
4
3
|
interface OpenTelemetrySpan {
|
|
5
4
|
setAttribute(name: string, value: OpenTelemetryAttributeValue): this;
|
|
6
5
|
setStatus(status: {
|
|
@@ -53,5 +52,4 @@ interface OpenTelemetryPluginOptions {
|
|
|
53
52
|
* Trace each actual HTTP transport attempt without depending on an OTel SDK.
|
|
54
53
|
*/
|
|
55
54
|
declare function openTelemetryPlugin(options: OpenTelemetryPluginOptions): Plugin;
|
|
56
|
-
//#endregion
|
|
57
55
|
export { OpenTelemetrySpan as a, openTelemetryPlugin as c, OpenTelemetryPropagationApi as i, OpenTelemetryHeaderSetter as n, OpenTelemetryTraceApi as o, OpenTelemetryPluginOptions as r, OpenTelemetryTracer as s, OpenTelemetryContextApi as t };
|
package/dist/plugins/auth.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isReadableStream-uWhOa7eR.cjs"),n=require("../waitForSignal-9c9DAqqS.cjs"),r=require("../isPromiseLike-B4LL7DlV.cjs"),i=require("../resolveExtensionConfig-D_eh4DjS.cjs");function authPlugin(i={}){let
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isReadableStream-uWhOa7eR.cjs"),n=require("../waitForSignal-9c9DAqqS.cjs"),r=require("../isPromiseLike-B4LL7DlV.cjs"),i=require("../resolveExtensionConfig-D_eh4DjS.cjs");function authPlugin(i={}){let o,c=new WeakSet;return{name:`auth`,install(u){let p=!0,m={};u.interceptors.request.use(e=>e.signal?n.n(()=>a(e,i),e):a(e,i)),u.hooks.onRetry(e=>{let r=i.refreshToken;if(r&&e.error&&!t.t(e.config.body)&&!c.has(e)){if(i.shouldRefresh)return n.n(()=>Promise.resolve(i.shouldRefresh(e.error)),e.config).then(t=>p&&t?h(e,r):void 0);if(f(e.error))return h(e,r)}});async function h(t,a){c.add(t);try{let e=await n.n(()=>l(a,m),t.config);if(!p)return;let o=s(t.config,i,typeof e==`string`?e:void 0),c=r.t(o)?await n.n(()=>Promise.resolve(o),t.config):o;return!p||!c.token?void 0:(t.config=d(t.config,c.token,c.scheme),{retry:!0,delay:0})}catch(r){let i=t.config.signal;if(i?.aborted)throw e.n(r)?r:n.r(i.reason,t.config,r);return}}return()=>{p=!1,o?.installations.delete(m),o?.installations.size===0&&(o=void 0)}}};async function l(e,t){if(o)o.installations.add(t);else{let n={installations:new Set([t]),promise:Promise.resolve(e()).then(e=>{if(!e||n.installations.size===0)return e;let t=i.storage?.set(e);return r.t(t)?Promise.resolve(t).then(()=>e):e}).finally(()=>{o===n&&(o=void 0)})};o=n}return o.promise}}function a(e,t){if(typeof t.token==`string`&&t.token&&e.extensions?.auth===void 0)return d(e,t.token,t.scheme);let n=s(e,t);return r.t(n)?Promise.resolve(n).then(t=>o(e,t)):o(e,n)}function o(e,t){return t.token?d(e,t.token,t.scheme):e}function s(e,t,n){let a=i.t(e,`auth`),o=n??(a?.token?u(a.token):c(t)),s=a?.scheme??t.scheme;return r.t(o)?Promise.resolve(o).then(e=>({token:e,scheme:s})):{token:o,scheme:s}}function c(e){let t=u(e.token);return r.t(t)?Promise.resolve(t).then(t=>t||l(e.storage)):t||l(e.storage)}function l(e){let t=e?.get();return r.t(t)?Promise.resolve(t).then(e=>e??``):t??``}function u(e){return e?typeof e==`function`?e():e:``}function d(e,t,n=`Bearer`){let r=`${n} ${t}`;if(e.headers===void 0)return{...e,headers:{authorization:r}};let i=new Headers(e.headers);return i.set(`authorization`,r),{...e,headers:i}}function f(t){return e.n(t)&&t.code===`HTTP_ERROR`&&t.status===401}exports.authPlugin=authPlugin;
|
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-DzMlmEGT.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-BCkcwFcq.js";
|
|
2
2
|
export { AuthPluginOptions, AuthTokenStorage, authPlugin };
|
package/dist/plugins/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as isRequestError}from"../RequestError-B0HIY1zK.js";import{t}from"../isReadableStream-DBMPCr6B.js";import{n,r}from"../waitForSignal-
|
|
1
|
+
import{n as isRequestError}from"../RequestError-B0HIY1zK.js";import{t as e}from"../isReadableStream-DBMPCr6B.js";import{n as t,r as n}from"../waitForSignal-DXgmbuoa.js";import{t as r}from"../isPromiseLike-B6ok3Q-C.js";import{t as i}from"../resolveExtensionConfig-C_MshvkE.js";function authPlugin(i={}){let o,c=new WeakSet;return{name:`auth`,install(u){let p=!0,m={};u.interceptors.request.use(e=>e.signal?t(()=>a(e,i),e):a(e,i)),u.hooks.onRetry(n=>{let r=i.refreshToken;if(r&&n.error&&!e(n.config.body)&&!c.has(n)){if(i.shouldRefresh)return t(()=>Promise.resolve(i.shouldRefresh(n.error)),n.config).then(e=>p&&e?h(n,r):void 0);if(f(n.error))return h(n,r)}});async function h(e,a){c.add(e);try{let n=await t(()=>l(a,m),e.config);if(!p)return;let o=s(e.config,i,typeof n==`string`?n:void 0),c=r(o)?await t(()=>Promise.resolve(o),e.config):o;return!p||!c.token?void 0:(e.config=d(e.config,c.token,c.scheme),{retry:!0,delay:0})}catch(t){let r=e.config.signal;if(r?.aborted)throw isRequestError(t)?t:n(r.reason,e.config,t);return}}return()=>{p=!1,o?.installations.delete(m),o?.installations.size===0&&(o=void 0)}}};async function l(e,t){if(o)o.installations.add(t);else{let n={installations:new Set([t]),promise:Promise.resolve(e()).then(e=>{if(!e||n.installations.size===0)return e;let t=i.storage?.set(e);return r(t)?Promise.resolve(t).then(()=>e):e}).finally(()=>{o===n&&(o=void 0)})};o=n}return o.promise}}function a(e,t){if(typeof t.token==`string`&&t.token&&e.extensions?.auth===void 0)return d(e,t.token,t.scheme);let n=s(e,t);return r(n)?Promise.resolve(n).then(t=>o(e,t)):o(e,n)}function o(e,t){return t.token?d(e,t.token,t.scheme):e}function s(e,t,n){let a=i(e,`auth`),o=n??(a?.token?u(a.token):c(t)),s=a?.scheme??t.scheme;return r(o)?Promise.resolve(o).then(e=>({token:e,scheme:s})):{token:o,scheme:s}}function c(e){let t=u(e.token);return r(t)?Promise.resolve(t).then(t=>t||l(e.storage)):t||l(e.storage)}function l(e){let t=e?.get();return r(t)?Promise.resolve(t).then(e=>e??``):t??``}function u(e){return e?typeof e==`function`?e():e:``}function d(e,t,n=`Bearer`){let r=`${n} ${t}`;if(e.headers===void 0)return{...e,headers:{authorization:r}};let i=new Headers(e.headers);return i.set(`authorization`,r),{...e,headers:i}}function f(e){return isRequestError(e)&&e.code===`HTTP_ERROR`&&e.status===401}export{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-XacR7ADG.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-XF9k2IyP.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-CnAMq7UC.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
|
-
|
|
1
|
+
export{r as IndexedDBCacheStore,i as MemoryCacheStore,n as TieredCacheStore,a as WebStorageCacheStore,t as cachePlugin}from"../cachePlugin-JU-Rob4m.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../waitForSignal-9c9DAqqS.cjs"),n=require("../isPromiseLike-B4LL7DlV.cjs"),r=require("../resolveExtensionConfig-D_eh4DjS.cjs"),i=require("../resolveRequestOrigin-DD-JxnBO.cjs");function circuitBreakerPlugin(e={}){let i=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../waitForSignal-9c9DAqqS.cjs"),n=require("../isPromiseLike-B4LL7DlV.cjs"),r=require("../resolveExtensionConfig-D_eh4DjS.cjs"),i=require("../resolveRequestOrigin-DD-JxnBO.cjs");function circuitBreakerPlugin(e={}){let i=s(e),c=new Map,l,f=0;return{name:`circuit-breaker`,getState(e){return c.get(e)?.state??`closed`},reset(e){e===void 0?(c.clear(),l=void 0):(c.get(e)===l&&(l=void 0),c.delete(e))},install(e){let s=new Map,m=!0;return f+=1,e.hooks.onRequest(e=>{let t=r.t(e.config,`circuitBreaker`);if(t?.enabled===!1)return;let n=u(t?.key??i.createKey(e.config)),a=c.get(n),o=a??d(c,n,i.maxCircuits);if(a&&o!==l&&(c.delete(n),c.set(n,o)),l=o,o.state===`open`&&Date.now()-o.openedAt>=i.resetTimeout&&p(o,n,`half-open`,i),o.state===`open`)throw g(n,e.config);let f=o.state===`half-open`;if(f&&o.probes>=i.halfOpenMaxRequests)throw g(n,e.config);f&&(o.probes+=1),o.activeRequests+=1,s.set(e,{key:n,generation:o.generation,probe:f,record:o})}),e.hooks.onSettled(e=>{let r=s.get(e);if(!r)return;let l=()=>{s.delete(e),o(r,c,i.maxCircuits)},u=r.record;if(!m||c.get(r.key)!==u||u.generation!==r.generation){l();return}if(!e.error&&e.response){u.failures=0,r.probe&&u.state===`half-open`&&(u.successes+=1,u.successes>=i.successThreshold&&p(u,r.key,`closed`,i)),l();return}let d;try{d=i.shouldCountFailure(e.error,e.config),e.config.signal&&n.t(d)&&(d=t.n(()=>d,e.config))}catch(e){throw l(),e}if(n.t(d))return Promise.resolve(d).then(e=>{a(e,m,c,r,i)}).finally(l);try{a(d,m,c,r,i)}finally{l()}}),()=>{m=!1,--f;for(let e of s.values())o(e,c,i.maxCircuits);s.clear(),f===0&&(l=void 0,c.clear())}}}}function a(e,t,n,r,i){let a=r.record;t&&n.get(r.key)===a&&a.generation===r.generation&&e&&(r.probe&&a.state===`half-open`?p(a,r.key,`open`,i):a.state===`closed`&&(a.failures+=1,a.failures>=i.failureThreshold&&p(a,r.key,`open`,i)))}function o(e,t,n){if(e.released)return;e.released=!0;let r=e.record;e.probe&&(r.probes=Math.max(0,r.probes-1)),r.activeRequests=Math.max(0,r.activeRequests-1),f(t,n)}function s(e){return{failureThreshold:c(e.failureThreshold,5),successThreshold:c(e.successThreshold,1),resetTimeout:l(e.resetTimeout,3e4),halfOpenMaxRequests:c(e.halfOpenMaxRequests,1),maxCircuits:c(e.maxCircuits,1e3),createKey:e.createKey??i.t,shouldCountFailure:e.shouldCountFailure??_,onStateChange:e.onStateChange}}function c(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}function l(e,t){return e===void 0?t:Number.isFinite(e)?Math.max(0,e):e>0?2**53-1:0}function u(e){return e||`default`}function d(e,t,n){f(e,n-1);let r={state:`closed`,failures:0,successes:0,openedAt:0,probes:0,generation:0,activeRequests:0};return e.set(t,r),r}function f(e,t){for(;e.size>t;){let t;for(let[n,r]of e)if(r.activeRequests===0){t=n;break}if(t===void 0)return;e.delete(t)}}function p(e,t,n,r){if(e.state===n){n===`open`&&(e.openedAt=Date.now(),e.successes=0,e.probes=0,e.generation+=1);return}let i=e.state;e.state=n,e.successes=0,e.probes=0,e.generation+=1,n===`open`?e.openedAt=Date.now():n===`closed`&&(e.failures=0,e.openedAt=0),m(r.onStateChange,{key:t,previousState:i,state:n,timestamp:Date.now(),failures:e.failures})}function m(e,t){if(e)try{let r=e(t);n.t(r)&&Promise.resolve(r).catch(h)}catch{}}function h(){}function g(t,n){return new e.t(`Circuit is open for ${t}`,{code:`CIRCUIT_OPEN`,config:n})}function _(t){return!e.n(t)||t.code===`NETWORK_ERROR`||t.code===`TIMEOUT_ERROR`||t.code===`HTTP_ERROR`&&(t.status===429||t.status!==void 0&&t.status>=500)}exports.circuitBreakerPlugin=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-De7zlDeV.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-CiH1p3kW.js";
|
|
2
2
|
export { CircuitBreakerPlugin, CircuitBreakerPluginOptions, circuitBreakerPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as isRequestError,t}from"../RequestError-B0HIY1zK.js";import{n}from"../waitForSignal-
|
|
1
|
+
import{n as isRequestError,t as e}from"../RequestError-B0HIY1zK.js";import{n as t}from"../waitForSignal-DXgmbuoa.js";import{t as n}from"../isPromiseLike-B6ok3Q-C.js";import{t as r}from"../resolveExtensionConfig-C_MshvkE.js";import{t as i}from"../resolveRequestOrigin-BkNgllfS.js";function circuitBreakerPlugin(e={}){let i=s(e),c=new Map,l,f=0;return{name:`circuit-breaker`,getState(e){return c.get(e)?.state??`closed`},reset(e){e===void 0?(c.clear(),l=void 0):(c.get(e)===l&&(l=void 0),c.delete(e))},install(e){let s=new Map,m=!0;return f+=1,e.hooks.onRequest(e=>{let t=r(e.config,`circuitBreaker`);if(t?.enabled===!1)return;let n=u(t?.key??i.createKey(e.config)),a=c.get(n),o=a??d(c,n,i.maxCircuits);if(a&&o!==l&&(c.delete(n),c.set(n,o)),l=o,o.state===`open`&&Date.now()-o.openedAt>=i.resetTimeout&&p(o,n,`half-open`,i),o.state===`open`)throw g(n,e.config);let f=o.state===`half-open`;if(f&&o.probes>=i.halfOpenMaxRequests)throw g(n,e.config);f&&(o.probes+=1),o.activeRequests+=1,s.set(e,{key:n,generation:o.generation,probe:f,record:o})}),e.hooks.onSettled(e=>{let r=s.get(e);if(!r)return;let l=()=>{s.delete(e),o(r,c,i.maxCircuits)},u=r.record;if(!m||c.get(r.key)!==u||u.generation!==r.generation){l();return}if(!e.error&&e.response){u.failures=0,r.probe&&u.state===`half-open`&&(u.successes+=1,u.successes>=i.successThreshold&&p(u,r.key,`closed`,i)),l();return}let d;try{d=i.shouldCountFailure(e.error,e.config),e.config.signal&&n(d)&&(d=t(()=>d,e.config))}catch(e){throw l(),e}if(n(d))return Promise.resolve(d).then(e=>{a(e,m,c,r,i)}).finally(l);try{a(d,m,c,r,i)}finally{l()}}),()=>{m=!1,--f;for(let e of s.values())o(e,c,i.maxCircuits);s.clear(),f===0&&(l=void 0,c.clear())}}}}function a(e,t,n,r,i){let a=r.record;t&&n.get(r.key)===a&&a.generation===r.generation&&e&&(r.probe&&a.state===`half-open`?p(a,r.key,`open`,i):a.state===`closed`&&(a.failures+=1,a.failures>=i.failureThreshold&&p(a,r.key,`open`,i)))}function o(e,t,n){if(e.released)return;e.released=!0;let r=e.record;e.probe&&(r.probes=Math.max(0,r.probes-1)),r.activeRequests=Math.max(0,r.activeRequests-1),f(t,n)}function s(e){return{failureThreshold:c(e.failureThreshold,5),successThreshold:c(e.successThreshold,1),resetTimeout:l(e.resetTimeout,3e4),halfOpenMaxRequests:c(e.halfOpenMaxRequests,1),maxCircuits:c(e.maxCircuits,1e3),createKey:e.createKey??i,shouldCountFailure:e.shouldCountFailure??_,onStateChange:e.onStateChange}}function c(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}function l(e,t){return e===void 0?t:Number.isFinite(e)?Math.max(0,e):e>0?2**53-1:0}function u(e){return e||`default`}function d(e,t,n){f(e,n-1);let r={state:`closed`,failures:0,successes:0,openedAt:0,probes:0,generation:0,activeRequests:0};return e.set(t,r),r}function f(e,t){for(;e.size>t;){let t;for(let[n,r]of e)if(r.activeRequests===0){t=n;break}if(t===void 0)return;e.delete(t)}}function p(e,t,n,r){if(e.state===n){n===`open`&&(e.openedAt=Date.now(),e.successes=0,e.probes=0,e.generation+=1);return}let i=e.state;e.state=n,e.successes=0,e.probes=0,e.generation+=1,n===`open`?e.openedAt=Date.now():n===`closed`&&(e.failures=0,e.openedAt=0),m(r.onStateChange,{key:t,previousState:i,state:n,timestamp:Date.now(),failures:e.failures})}function m(e,t){if(e)try{let r=e(t);n(r)&&Promise.resolve(r).catch(h)}catch{}}function h(){}function g(t,n){return new e(`Circuit is open for ${t}`,{code:`CIRCUIT_OPEN`,config:n})}function _(e){return!isRequestError(e)||e.code===`NETWORK_ERROR`||e.code===`TIMEOUT_ERROR`||e.code===`HTTP_ERROR`&&(e.status===429||e.status!==void 0&&e.status>=500)}export{circuitBreakerPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../maxTimerDelay-NH5XeTXb.cjs"),n=require("../resolveExtensionConfig-D_eh4DjS.cjs"),r=require("../resolveRequestOrigin-DD-JxnBO.cjs");function concurrencyPlugin(e={}){let t=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../maxTimerDelay-NH5XeTXb.cjs"),n=require("../resolveExtensionConfig-D_eh4DjS.cjs"),r=require("../resolveRequestOrigin-DD-JxnBO.cjs");function concurrencyPlugin(e={}){let t=f(e),r=new Map,s=0;return{name:`concurrency`,getState(e){let t=r.get(g(e));return{active:t?.active??0,queued:t?.size??0}},install(e){let c=new Map,l={};s+=1;let u=!0;return e.hooks.onRequest(e=>{let a=n.t(e.config,`concurrency`);if(a?.enabled===!1)return;let s=g(a?.key??t.createKey(e.config)),d=o(r,s,t.maxKeys);if(d.active<t.maxConcurrent)d.active+=1,c.set(e,d);else{if(e.config.signal?.aborted)throw v(e.config.signal.reason,e.config);if(d.size>=t.maxQueue)throw _(`Concurrency queue is full`,e.config);return i(d,e,h(a?.queueTimeout,t.queueTimeout),l,()=>{c.set(e,d)}).then(()=>{if(!u)throw y(e.config)})}}),e.hooks.onSettled(e=>{let n=c.get(e);n&&(c.delete(e),u&&r.get(n.key)===n&&a(n,r,t.maxKeys))}),()=>{u=!1,--s;for(let e of r.values()){let t=e.head;for(;t;){let n=t.next;t.owner===l&&(d(e,t),t.reject(y(t.config))),t=n}}for(let e of c.values())a(e,r,t.maxKeys);c.clear(),s===0&&r.clear()}}}}function i(e,t,n,r,i){let{config:a}=t,o=a.signal;return o?.aborted?Promise.reject(v(o.reason,a)):n<=0?Promise.reject(_(`Concurrency queue wait timed out`,a)):new Promise((t,s)=>{let c,u=!1,f=()=>d(e,y),p=()=>{c!==void 0&&(clearTimeout(c),c=void 0);try{o?.removeEventListener(`abort`,g)}catch{}},m=e=>{u||(u=!0,p(),s(e))},h=()=>{u||(u=!0,p(),i(),t())},g=()=>{f(),m(v(o?.reason,a))},y={owner:r,config:a,linked:!1,resolve:h,reject:m};try{o?.addEventListener(`abort`,g,{once:!0})}catch(e){m(e);return}if(o?.aborted&&g(),!u){if(Number.isFinite(n)){try{c=setTimeout(()=>{f(),m(_(`Concurrency queue wait timed out`,a))},n)}catch(e){m(e);return}if(u){clearTimeout(c),c=void 0;return}}l(e,y)}})}function a(e,t,n){let r=u(e);r?r.resolve():(e.active=Math.max(0,e.active-1),e.active===0&&(s(t,e.key,e),c(t,n)))}function o(e,t,n){let r=e.get(t);if(r)return r;c(e,Math.max(0,n-1));let i={key:t,active:0,size:0};return e.set(t,i),i}function s(e,t,n){e.delete(t),e.set(t,n)}function c(e,t){if(!(e.size<=t))for(let[n,r]of e){if(e.size<=t)return;r.active===0&&r.size===0&&e.delete(n)}}function l(e,t){t.prev=e.tail,t.next=void 0,t.linked=!0,e.tail?e.tail.next=t:e.head=t,e.tail=t,e.size+=1}function u(e){let t=e.head;return t&&d(e,t),t}function d(e,t){if(!t.linked)return;let{prev:n,next:r}=t;n?n.next=r:e.head=r,r?r.prev=n:e.tail=n,t.prev=void 0,t.next=void 0,t.linked=!1,--e.size}function f(e){return{maxConcurrent:p(e.maxConcurrent,10),maxQueue:m(e.maxQueue,1e3),queueTimeout:h(e.queueTimeout,3e4),maxKeys:p(e.maxKeys,1e3),createKey:e.createKey??r.t}}function p(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}function m(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(0,Math.floor(e))}function h(e,n){return e===void 0?n:Number.isFinite(e)?Math.min(Math.max(0,e),t.t):e>0?1/0:0}function g(e){return String(e).trim()||`default`}function _(t,n){return new e.t(t,{code:`CONCURRENCY_LIMIT`,config:n})}function v(t,n){return e.n(t)?t:new e.t(`Request aborted while waiting for concurrency permit`,{code:`ABORT_ERROR`,config:n,cause:t})}function y(t){return new e.t(`Concurrency plugin removed while request was queued`,{code:`ABORT_ERROR`,config:t})}exports.concurrencyPlugin=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-DMkVFc5N.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-lcwDZPqe.js";
|
|
2
2
|
export { ConcurrencyPlugin, ConcurrencyPluginOptions, ConcurrencyState, concurrencyPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as isRequestError,t}from"../RequestError-B0HIY1zK.js";import{t
|
|
1
|
+
import{n as isRequestError,t as e}from"../RequestError-B0HIY1zK.js";import{t}from"../maxTimerDelay-Hn7X0Wuh.js";import{t as n}from"../resolveExtensionConfig-C_MshvkE.js";import{t as r}from"../resolveRequestOrigin-BkNgllfS.js";function concurrencyPlugin(e={}){let t=f(e),r=new Map,s=0;return{name:`concurrency`,getState(e){let t=r.get(g(e));return{active:t?.active??0,queued:t?.size??0}},install(e){let c=new Map,l={};s+=1;let u=!0;return e.hooks.onRequest(e=>{let a=n(e.config,`concurrency`);if(a?.enabled===!1)return;let s=g(a?.key??t.createKey(e.config)),d=o(r,s,t.maxKeys);if(d.active<t.maxConcurrent)d.active+=1,c.set(e,d);else{if(e.config.signal?.aborted)throw v(e.config.signal.reason,e.config);if(d.size>=t.maxQueue)throw _(`Concurrency queue is full`,e.config);return i(d,e,h(a?.queueTimeout,t.queueTimeout),l,()=>{c.set(e,d)}).then(()=>{if(!u)throw y(e.config)})}}),e.hooks.onSettled(e=>{let n=c.get(e);n&&(c.delete(e),u&&r.get(n.key)===n&&a(n,r,t.maxKeys))}),()=>{u=!1,--s;for(let e of r.values()){let t=e.head;for(;t;){let n=t.next;t.owner===l&&(d(e,t),t.reject(y(t.config))),t=n}}for(let e of c.values())a(e,r,t.maxKeys);c.clear(),s===0&&r.clear()}}}}function i(e,t,n,r,i){let{config:a}=t,o=a.signal;return o?.aborted?Promise.reject(v(o.reason,a)):n<=0?Promise.reject(_(`Concurrency queue wait timed out`,a)):new Promise((t,s)=>{let c,u=!1,f=()=>d(e,y),p=()=>{c!==void 0&&(clearTimeout(c),c=void 0);try{o?.removeEventListener(`abort`,g)}catch{}},m=e=>{u||(u=!0,p(),s(e))},h=()=>{u||(u=!0,p(),i(),t())},g=()=>{f(),m(v(o?.reason,a))},y={owner:r,config:a,linked:!1,resolve:h,reject:m};try{o?.addEventListener(`abort`,g,{once:!0})}catch(e){m(e);return}if(o?.aborted&&g(),!u){if(Number.isFinite(n)){try{c=setTimeout(()=>{f(),m(_(`Concurrency queue wait timed out`,a))},n)}catch(e){m(e);return}if(u){clearTimeout(c),c=void 0;return}}l(e,y)}})}function a(e,t,n){let r=u(e);r?r.resolve():(e.active=Math.max(0,e.active-1),e.active===0&&(s(t,e.key,e),c(t,n)))}function o(e,t,n){let r=e.get(t);if(r)return r;c(e,Math.max(0,n-1));let i={key:t,active:0,size:0};return e.set(t,i),i}function s(e,t,n){e.delete(t),e.set(t,n)}function c(e,t){if(!(e.size<=t))for(let[n,r]of e){if(e.size<=t)return;r.active===0&&r.size===0&&e.delete(n)}}function l(e,t){t.prev=e.tail,t.next=void 0,t.linked=!0,e.tail?e.tail.next=t:e.head=t,e.tail=t,e.size+=1}function u(e){let t=e.head;return t&&d(e,t),t}function d(e,t){if(!t.linked)return;let{prev:n,next:r}=t;n?n.next=r:e.head=r,r?r.prev=n:e.tail=n,t.prev=void 0,t.next=void 0,t.linked=!1,--e.size}function f(e){return{maxConcurrent:p(e.maxConcurrent,10),maxQueue:m(e.maxQueue,1e3),queueTimeout:h(e.queueTimeout,3e4),maxKeys:p(e.maxKeys,1e3),createKey:e.createKey??r}}function p(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}function m(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(0,Math.floor(e))}function h(e,n){return e===void 0?n:Number.isFinite(e)?Math.min(Math.max(0,e),t):e>0?1/0:0}function g(e){return String(e).trim()||`default`}function _(t,n){return new e(t,{code:`CONCURRENCY_LIMIT`,config:n})}function v(t,n){return isRequestError(t)?t:new e(`Request aborted while waiting for concurrency permit`,{code:`ABORT_ERROR`,config:n,cause:t})}function y(t){return new e(`Concurrency plugin removed while request was queued`,{code:`ABORT_ERROR`,config:t})}export{concurrencyPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isBinaryBody-DNjjEzFS.cjs"),n=require("../validateResponseStatus-6FKeKyEV.cjs"),r=require("../isReadableStream-uWhOa7eR.cjs"),i=require("../resolveExtensionConfig-D_eh4DjS.cjs"),a=require("../xhrTransport-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isBinaryBody-DNjjEzFS.cjs"),n=require("../validateResponseStatus-6FKeKyEV.cjs"),r=require("../isReadableStream-uWhOa7eR.cjs"),i=require("../resolveExtensionConfig-D_eh4DjS.cjs"),a=require("../xhrTransport-CdBsCzpX.cjs");function downloadPlugin(t={}){let l=new WeakSet;return{name:`download`,install(f){f.interceptors.request.use(e=>{let n=i.t(e,`download`);if(!n)return e;if(o(n.output,e)===`stream`)return s(t.transport,e),{...e,responseType:`stream`};let r=n.onProgress&&!c(t.transport)?`stream`:e.responseType??`blob`;return{...e,responseType:r}}),f.hooks.onTransport(async n=>{if(n.response)return;let r=i.t(n.config,`download`),o=r?.onProgress;if(r?.output!==`stream`&&o&&c(t.transport)){if(typeof XMLHttpRequest>`u`)throw new e.t(`XMLHttpRequest is unavailable for download progress`,{code:`CONFIG_ERROR`,config:n.config});n.response=await a.t(n.config,{onDownloadProgress:o,preserveRaw:n.preserveRaw}),l.add(n)}},{priority:-3e3}),f.hooks.onResponse(async t=>{if(l.has(t))return;let a=t.response;if(!a)return;let o=i.t(a.config,`download`),s=o?.onProgress;if(!o)return;let c=a.data,f=o.output===`stream`;if(c===void 0&&n.n(a.config.method,a.status,a.raw.type)){if(!f){s?.({loaded:0,total:0,bytes:0});return}c=new ReadableStream({start(e){e.close()}})}if(!f&&!s)return;if(!r.t(c))throw new e.t(`Download response stream is unavailable`,{code:`PARSER_ERROR`,status:a.status,config:a.config});if(f){t.response={...a,data:s?d(c,a,s):c};return}if(!s)return;let p=await u(c,a,s);t.response={...a,data:p}},{requiresRawResponse:!1})}}}function o(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 s(t,n){if(t===`xhr`)throw new e.t(`Stream downloads require the Fetch transport`,{code:`CONFIG_ERROR`,config:n});if(!l())throw new e.t(`Fetch response streams are unavailable`,{code:`CONFIG_ERROR`,config:n})}function c(e=`auto`){return e===`xhr`||e!==`fetch`&&!l()&&typeof XMLHttpRequest<`u`}function l(){return typeof ReadableStream<`u`&&typeof Response<`u`&&`body`in Response.prototype}async function u(e,t,n){let r=e.getReader(),i=[],o=p(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(f(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 d(e,t,n){let r=e.getReader(),i=p(t.headers.get(`content-length`)),o=a.n(),s=0,c=!1,l=!1,u=()=>{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)),u(),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{}u(),e.error(t)}},async cancel(e){try{await r.cancel(e)}finally{u()}}},{highWaterMark:0})}function f(e){if(t.t(e.buffer))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=new Uint8Array(e.byteLength);return n.set(e),n.buffer}function p(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-Cj2Zfocy.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-BxIWgvyl.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{t}from"../isBinaryBody-D-Wp2IPk.js";import{n}from"../validateResponseStatus-BzkEtZZi.js";import{t as r}from"../isReadableStream-DBMPCr6B.js";import{t as i}from"../resolveExtensionConfig-C_MshvkE.js";import{n as a,t as o}from"../xhrTransport
|
|
1
|
+
import{t as e}from"../RequestError-B0HIY1zK.js";import{t}from"../isBinaryBody-D-Wp2IPk.js";import{n}from"../validateResponseStatus-BzkEtZZi.js";import{t as r}from"../isReadableStream-DBMPCr6B.js";import{t as i}from"../resolveExtensionConfig-C_MshvkE.js";import{n as a,t as o}from"../xhrTransport-B1vH5k3x.js";function downloadPlugin(t={}){let a=new WeakSet;return{name:`download`,install(u){u.interceptors.request.use(e=>{let n=i(e,`download`);if(!n)return e;if(s(n.output,e)===`stream`)return c(t.transport,e),{...e,responseType:`stream`};let r=n.onProgress&&!l(t.transport)?`stream`:e.responseType??`blob`;return{...e,responseType:r}}),u.hooks.onTransport(async n=>{if(n.response)return;let r=i(n.config,`download`),s=r?.onProgress;if(r?.output!==`stream`&&s&&l(t.transport)){if(typeof XMLHttpRequest>`u`)throw new e(`XMLHttpRequest is unavailable for download progress`,{code:`CONFIG_ERROR`,config:n.config});n.response=await o(n.config,{onDownloadProgress:s,preserveRaw:n.preserveRaw}),a.add(n)}},{priority:-3e3}),u.hooks.onResponse(async t=>{if(a.has(t))return;let o=t.response;if(!o)return;let s=i(o.config,`download`),c=s?.onProgress;if(!s)return;let l=o.data,u=s.output===`stream`;if(l===void 0&&n(o.config.method,o.status,o.raw.type)){if(!u){c?.({loaded:0,total:0,bytes:0});return}l=new ReadableStream({start(e){e.close()}})}if(!u&&!c)return;if(!r(l))throw new e(`Download response stream is unavailable`,{code:`PARSER_ERROR`,status:o.status,config:o.config});if(u){t.response={...o,data:c?f(l,o,c):l};return}if(!c)return;let p=await d(l,o,c);t.response={...o,data:p}},{requiresRawResponse:!1})}}}function s(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 c(t,n){if(t===`xhr`)throw new e(`Stream downloads require the Fetch transport`,{code:`CONFIG_ERROR`,config:n});if(!u())throw new e(`Fetch response streams are unavailable`,{code:`CONFIG_ERROR`,config:n})}function l(e=`auto`){return e===`xhr`||e!==`fetch`&&!u()&&typeof XMLHttpRequest<`u`}function u(){return typeof ReadableStream<`u`&&typeof Response<`u`&&`body`in Response.prototype}async function d(e,t,n){let r=e.getReader(),i=[],o=m(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(p(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 f(e,t,n){let r=e.getReader(),i=m(t.headers.get(`content-length`)),o=a(),s=0,c=!1,l=!1,u=()=>{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)),u(),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{}u(),e.error(t)}},async cancel(e){try{await r.cancel(e)}finally{u()}}},{highWaterMark:0})}function p(e){if(t(e.buffer))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=new Uint8Array(e.byteLength);return n.set(e),n.buffer}function m(e){if(!e)return;let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}export{downloadPlugin};
|
package/dist/plugins/logger.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isPromiseLike-B4LL7DlV.cjs"),n=require("../resolveExtensionConfig-D_eh4DjS.cjs");function loggerPlugin(e={}){let t=0,
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../RequestError-DrCr_lwO.cjs"),t=require("../isPromiseLike-B4LL7DlV.cjs"),n=require("../resolveExtensionConfig-D_eh4DjS.cjs");function loggerPlugin(e={}){let t=0,i=new WeakMap;return{name:`logger`,install(a){a.hooks.onRequest(r=>{let a=n.t(r.config,`logger`)??e;if(a.enabled===!1)return;let s=String(r.config.url),c={requestId:a.createRequestId?.()??`request-${++t}`,options:a,url:s,redactedURL:u(s)};i.set(r,c),o(a,{type:`request`,requestId:c.requestId,timestamp:r.startTime,method:r.config.method??`GET`,url:c.redactedURL})}),a.hooks.onResponse(e=>{let t=i.get(e);if(!t||!e.response)return;let n=Date.now();o(t.options,{type:`response`,requestId:t.requestId,timestamp:n,duration:Math.max(0,n-e.startTime),attempts:e.attempt+1,method:e.config.method??`GET`,url:r(t,String(e.config.url)),status:e.response.status})}),a.hooks.onError(a=>{let c=i.get(a);if(!c){let r=n.t(a.config,`logger`)??e;if(r.enabled===!1)return;let s=String(a.config.url);c={requestId:r.createRequestId?.()??`request-${++t}`,options:r,url:s,redactedURL:u(s)},i.set(a,c),o(r,{type:`request`,requestId:c.requestId,timestamp:a.startTime,method:a.config.method??`GET`,url:c.redactedURL})}let l=Date.now();s(c.options,p(a.error,c.requestId,l,Math.max(0,l-a.startTime),a.attempt+1,a.config.method??`GET`,r(c,String(a.config.url))))})}}}function r(e,t){return t===e.url?e.redactedURL:u(t)}const i={info(e,t){console.log(e,t)},error(e,t){console.error(e,t)}};function a(e){return e.logger??i}function o(e,n){try{let r=a(e).info(`[Npora Request]`,n);t.t(r)&&Promise.resolve(r).catch(c)}catch{}}function s(e,n){try{let r=a(e).error(`[Npora Request]`,n);t.t(r)&&Promise.resolve(r).catch(c)}catch{}}function c(){}const l=new Set([`access_token`,`api-key`,`api_key`,`apikey`,`authorization`,`client_secret`,`password`,`refresh_token`,`secret`,`sig`,`signature`,`token`]);function u(e){let t=d(e),n=t.indexOf(`?`);if(n===-1)return t;let r=t.indexOf(`#`,n),i=t.slice(0,n),a=t.slice(n+1,r===-1?void 0:r),o=r===-1?``:t.slice(r),s=new URLSearchParams(a);for(let e of s.keys())l.has(e.toLowerCase())&&s.set(e,`[REDACTED]`);let c=s.toString();return`${i}${c?`?${c}`:``}${o}`}function d(e){let t=e.indexOf(`://`),n=t===-1?e.startsWith(`//`)?2:-1:t+3;if(n===-1)return e;let r=f(e,n),i=e.lastIndexOf(`@`,r-1);return i<n?e:`${e.slice(0,n)}[REDACTED]@`+e.slice(i+1)}function f(e,t){for(let n=t;n<e.length;n+=1){let t=e[n];if(t===`/`||t===`?`||t===`#`)return n}return e.length}function p(t,n,r,i,a,o,s){let c={type:`error`,requestId:n,timestamp:r,duration:i,attempt:a,method:o,url:s};return e.n(t)?{...c,name:t.name,message:t.message,code:t.code,status:t.status}:t instanceof Error?{...c,name:t.name,message:t.message}:{...c,name:`UnknownError`,message:String(t)}}exports.loggerPlugin=loggerPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as loggerPlugin } from "../loggerPlugin-
|
|
1
|
+
import { t as loggerPlugin } from "../loggerPlugin-Ck_c7bz8.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-BtV0PYwO.js";
|
|
2
2
|
export { loggerPlugin };
|