diff --git a/dist/index.cjs b/dist/index.cjs index 32b6c0f..26ffdaa 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1,169 +1,170 @@ -var EIe=Object.create;var bz=Object.defineProperty;var CIe=Object.getOwnPropertyDescriptor;var yIe=Object.getOwnPropertyNames;var BIe=Object.getPrototypeOf,qIe=Object.prototype.hasOwnProperty;var s=(t,e)=>bz(t,"name",{value:e,configurable:!0});var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),DIe=(t,e)=>{for(var r in e)bz(t,r,{get:e[r],enumerable:!0})},IIe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yIe(e))!qIe.call(t,o)&&o!==r&&bz(t,o,{get:()=>e[o],enumerable:!(n=CIe(e,o))||n.enumerable});return t};var w=(t,e,r)=>(r=t!=null?EIe(BIe(t)):{},IIe(e||!t||!t.__esModule?bz(r,"default",{value:t,enumerable:!0}):r,t));var K9=m(lA=>{"use strict";var uB0=require("net"),WIe=require("tls"),rI=require("http"),Y9=require("https"),xIe=require("events"),pB0=require("assert"),TIe=require("util");lA.httpOverHttp=vIe;lA.httpsOverHttp=LIe;lA.httpOverHttps=_Ie;lA.httpsOverHttps=QIe;function vIe(t){var e=new gs(t);return e.request=rI.request,e}s(vIe,"httpOverHttp");function LIe(t){var e=new gs(t);return e.request=rI.request,e.createSocket=$9,e.defaultPort=443,e}s(LIe,"httpsOverHttp");function _Ie(t){var e=new gs(t);return e.request=Y9.request,e}s(_Ie,"httpOverHttps");function QIe(t){var e=new gs(t);return e.request=Y9.request,e.createSocket=$9,e.defaultPort=443,e}s(QIe,"httpsOverHttps");function gs(t){var e=this;e.options=t||{},e.proxyOptions=e.options.proxy||{},e.maxSockets=e.options.maxSockets||rI.Agent.defaultMaxSockets,e.requests=[],e.sockets=[],e.on("free",s(function(n,o,i,a){for(var c=j9(o,i,a),u=0,p=e.requests.length;u
=this.maxSockets){i.requests.push(a);return}i.createSocket(a,function(c){c.on("free",u),c.on("close",p),c.on("agentRemove",p),e.onSocket(c);function u(){i.emit("free",c,a)}s(u,"onFree");function p(A){i.removeSocket(c),c.removeListener("free",u),c.removeListener("close",p),c.removeListener("agentRemove",p)}s(p,"onCloseOrRemove")})},"addRequest");gs.prototype.createSocket=s(function(e,r){var n=this,o={};n.sockets.push(o);var i=nI({},n.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(i.localAddress=e.localAddress),i.proxyAuth&&(i.headers=i.headers||{},i.headers["Proxy-Authorization"]="Basic "+new Buffer(i.proxyAuth).toString("base64")),wa("making CONNECT request");var a=n.request(i);a.useChunkedEncodingByDefault=!1,a.once("response",c),a.once("upgrade",u),a.once("connect",p),a.once("error",A),a.end();function c(l){l.upgrade=!0}s(c,"onResponse");function u(l,b,M){process.nextTick(function(){p(l,b,M)})}s(u,"onUpgrade");function p(l,b,M){if(a.removeAllListeners(),b.removeAllListeners(),l.statusCode!==200){wa("tunneling socket could not be established, statusCode=%d",l.statusCode),b.destroy();var z=new Error("tunneling socket could not be established, statusCode="+l.statusCode);z.code="ECONNRESET",e.request.emit("error",z),n.removeSocket(o);return}if(M.length>0){wa("got illegal response body from proxy"),b.destroy();var z=new Error("got illegal response body from proxy");z.code="ECONNRESET",e.request.emit("error",z),n.removeSocket(o);return}return wa("tunneling connection has established"),n.sockets[n.sockets.indexOf(o)]=b,r(b)}s(p,"onConnect");function A(l){a.removeAllListeners(),wa(`tunneling socket could not be established, cause=%s
-`,l.message,l.stack);var b=new Error("tunneling socket could not be established, cause="+l.message);b.code="ECONNRESET",e.request.emit("error",b),n.removeSocket(o)}s(A,"onError")},"createSocket");gs.prototype.removeSocket=s(function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var n=this.requests.shift();n&&this.createSocket(n,function(o){n.request.onSocket(o)})}},"removeSocket");function $9(t,e){var r=this;gs.prototype.createSocket.call(r,t,function(n){var o=t.request.getHeader("host"),i=nI({},r.options,{socket:n,servername:o?o.replace(/:.*$/,""):t.host}),a=WIe.connect(0,i);r.sockets[r.sockets.indexOf(n)]=a,e(a)})}s($9,"createSecureSocket");function j9(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}s(j9,"toOptions");function nI(t){for(var e=1,r=arguments.length;e =this.maxSockets){s.requests.push(a);return}s.createSocket(a,function(c){c.on("free",u),c.on("close",p),c.on("agentRemove",p),e.onSocket(c);function u(){s.emit("free",c,a)}i(u,"onFree");function p(A){s.removeSocket(c),c.removeListener("free",u),c.removeListener("close",p),c.removeListener("agentRemove",p)}i(p,"onCloseOrRemove")})},"addRequest");gi.prototype.createSocket=i(function(e,r){var n=this,o={};n.sockets.push(o);var s=nI({},n.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:!1,headers:{host:e.host+":"+e.port}});e.localAddress&&(s.localAddress=e.localAddress),s.proxyAuth&&(s.headers=s.headers||{},s.headers["Proxy-Authorization"]="Basic "+new Buffer(s.proxyAuth).toString("base64")),wa("making CONNECT request");var a=n.request(s);a.useChunkedEncodingByDefault=!1,a.once("response",c),a.once("upgrade",u),a.once("connect",p),a.once("error",A),a.end();function c(l){l.upgrade=!0}i(c,"onResponse");function u(l,b,M){process.nextTick(function(){p(l,b,M)})}i(u,"onUpgrade");function p(l,b,M){if(a.removeAllListeners(),b.removeAllListeners(),l.statusCode!==200){wa("tunneling socket could not be established, statusCode=%d",l.statusCode),b.destroy();var z=new Error("tunneling socket could not be established, statusCode="+l.statusCode);z.code="ECONNRESET",e.request.emit("error",z),n.removeSocket(o);return}if(M.length>0){wa("got illegal response body from proxy"),b.destroy();var z=new Error("got illegal response body from proxy");z.code="ECONNRESET",e.request.emit("error",z),n.removeSocket(o);return}return wa("tunneling connection has established"),n.sockets[n.sockets.indexOf(o)]=b,r(b)}i(p,"onConnect");function A(l){a.removeAllListeners(),wa(`tunneling socket could not be established, cause=%s
+`,l.message,l.stack);var b=new Error("tunneling socket could not be established, cause="+l.message);b.code="ECONNRESET",e.request.emit("error",b),n.removeSocket(o)}i(A,"onError")},"createSocket");gi.prototype.removeSocket=i(function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var n=this.requests.shift();n&&this.createSocket(n,function(o){n.request.onSocket(o)})}},"removeSocket");function V9(t,e){var r=this;gi.prototype.createSocket.call(r,t,function(n){var o=t.request.getHeader("host"),s=nI({},r.options,{socket:n,servername:o?o.replace(/:.*$/,""):t.host}),a=kIe.connect(0,s);r.sockets[r.sockets.indexOf(n)]=a,e(a)})}i(V9,"createSecureSocket");function Y9(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}i(Y9,"toOptions");function nI(t){for(var e=1,r=arguments.length;e{"use strict";var $d=require("node:assert"),{kDestroyed:RU,kBodyUsed:dA,kListeners:II,kBody:IU}=k0(),{IncomingMessage:$Ie}=require("node:http"),Ez=require("node:stream"),jIe=require("node:net"),{Blob:KIe}=require("node:buffer"),ZIe=require("node:util"),{stringify:e5e}=require("node:querystring"),{EventEmitter:t5e}=require("node:events"),{InvalidArgumentError:Y1}=i0(),{headerNameLowerCasedRecord:r5e}=hz(),{tree:NU}=DU(),[n5e,o5e]=process.versions.node.split(".").map(t=>Number(t)),Oz=class{static{i(this,"BodyAsyncIterable")}constructor(e){this[IU]=e,this[dA]=!1}async*[Symbol.asyncIterator](){$d(!this[dA],"disturbed"),this[dA]=!0,yield*this[IU]}};function s5e(t){return Cz(t)?(xU(t)===0&&t.on("data",function(){$d(!1)}),typeof t.readableDidRead!="boolean"&&(t[dA]=!1,t5e.prototype.on.call(t,"data",function(){this[dA]=!0})),t):t&&typeof t.pipeTo=="function"?new Oz(t):t&&typeof t!="string"&&!ArrayBuffer.isView(t)&&WU(t)?new Oz(t):t}i(s5e,"wrapRequestBody");function i5e(){}i(i5e,"nop");function Cz(t){return t&&typeof t=="object"&&typeof t.pipe=="function"&&typeof t.on=="function"}i(Cz,"isStream");function wU(t){if(t===null)return!1;if(t instanceof KIe)return!0;if(typeof t!="object")return!1;{let e=t[Symbol.toStringTag];return(e==="Blob"||e==="File")&&("stream"in t&&typeof t.stream=="function"||"arrayBuffer"in t&&typeof t.arrayBuffer=="function")}}i(wU,"isBlobLike");function a5e(t,e){if(t.includes("?")||t.includes("#"))throw new Error('Query params cannot be passed when url already contains "?" or "#".');let r=e5e(e);return r&&(t+="?"+r),t}i(a5e,"buildURL");function SU(t){let e=parseInt(t,10);return e===Number(t)&&e>=0&&e<=65535}i(SU,"isValidPort");function gz(t){return t!=null&&t[0]==="h"&&t[1]==="t"&&t[2]==="t"&&t[3]==="p"&&(t[4]===":"||t[4]==="s"&&t[5]===":")}i(gz,"isHttpOrHttpsPrefixed");function FU(t){if(typeof t=="string"){if(t=new URL(t),!gz(t.origin||t.protocol))throw new Y1("Invalid URL protocol: the URL must start with `http:` or `https:`.");return t}if(!t||typeof t!="object")throw new Y1("Invalid URL: The URL argument must be a non-null object.");if(!(t instanceof URL)){if(t.port!=null&&t.port!==""&&SU(t.port)===!1)throw new Y1("Invalid URL: port must be a valid integer or a string representation of an integer.");if(t.path!=null&&typeof t.path!="string")throw new Y1("Invalid URL path: the path must be a string or null/undefined.");if(t.pathname!=null&&typeof t.pathname!="string")throw new Y1("Invalid URL pathname: the pathname must be a string or null/undefined.");if(t.hostname!=null&&typeof t.hostname!="string")throw new Y1("Invalid URL hostname: the hostname must be a string or null/undefined.");if(t.origin!=null&&typeof t.origin!="string")throw new Y1("Invalid URL origin: the origin must be a string or null/undefined.");if(!gz(t.origin||t.protocol))throw new Y1("Invalid URL protocol: the URL must start with `http:` or `https:`.");let e=t.port!=null?t.port:t.protocol==="https:"?443:80,r=t.origin!=null?t.origin:`${t.protocol||""}//${t.hostname||""}:${e}`,n=t.path!=null?t.path:`${t.pathname||""}${t.search||""}`;return r[r.length-1]==="/"&&(r=r.slice(0,r.length-1)),n&&n[0]!=="/"&&(n=`/${n}`),new URL(`${r}${n}`)}if(!gz(t.origin||t.protocol))throw new Y1("Invalid URL protocol: the URL must start with `http:` or `https:`.");return t}i(FU,"parseURL");function c5e(t){if(t=FU(t),t.pathname!=="/"||t.search||t.hash)throw new Y1("invalid url");return t}i(c5e,"parseOrigin");function u5e(t){if(t[0]==="["){let r=t.indexOf("]");return $d(r!==-1),t.substring(1,r)}let e=t.indexOf(":");return e===-1?t:t.substring(0,e)}i(u5e,"getHostname");function p5e(t){if(!t)return null;$d(typeof t=="string");let e=u5e(t);return jIe.isIP(e)?"":e}i(p5e,"getServerName");function A5e(t){return JSON.parse(JSON.stringify(t))}i(A5e,"deepClone");function l5e(t){return t!=null&&typeof t[Symbol.asyncIterator]=="function"}i(l5e,"isAsyncIterable");function WU(t){return t!=null&&(typeof t[Symbol.iterator]=="function"||typeof t[Symbol.asyncIterator]=="function")}i(WU,"isIterable");function xU(t){if(t==null)return 0;if(Cz(t)){let e=t._readableState;return e&&e.objectMode===!1&&e.ended===!0&&Number.isFinite(e.length)?e.length:null}else{if(wU(t))return t.size!=null?t.size:null;if(LU(t))return t.byteLength}return null}i(xU,"bodyLength");function TU(t){return t&&!!(t.destroyed||t[RU]||Ez.isDestroyed?.(t))}i(TU,"isDestroyed");function d5e(t,e){t==null||!Cz(t)||TU(t)||(typeof t.destroy=="function"?(Object.getPrototypeOf(t).constructor===$Ie&&(t.socket=null),t.destroy(e)):e&&queueMicrotask(()=>{t.emit("error",e)}),t.destroyed!==!0&&(t[RU]=!0))}i(d5e,"destroy");var b5e=/timeout=(\d+)/;function f5e(t){let e=t.toString().match(b5e);return e?parseInt(e[1],10)*1e3:null}i(f5e,"parseKeepAliveTimeout");function vU(t){return typeof t=="string"?r5e[t]??t.toLowerCase():NU.lookup(t)??t.toString("latin1").toLowerCase()}i(vU,"headerNameToString");function M5e(t){return NU.lookup(t)??t.toString("latin1").toLowerCase()}i(M5e,"bufferToLowerCasedHeaderName");function m5e(t,e){e===void 0&&(e={});for(let r=0;ro)throw _.errors.exception({header:"Integer conversion",message:`Value must be between ${s}-${o}, got ${a}.`});return a}return!Number.isNaN(a)&&n?.clamp===!0?(a=Math.min(Math.max(a,s),o),Math.floor(a)%2===0?a=Math.floor(a):a=Math.ceil(a),a):Number.isNaN(a)||a===0&&Object.is(0,a)||a===Number.POSITIVE_INFINITY||a===Number.NEGATIVE_INFINITY?0:(a=_.util.IntegerPart(a),a=a%Math.pow(2,e),r==="signed"&&a>=Math.pow(2,e)-1?a-Math.pow(2,e):a)};_.util.IntegerPart=function(t){let e=Math.floor(Math.abs(t));return t<0?-1*e:e};_.util.Stringify=function(t){switch(_.util.Type(t)){case"Symbol":return`Symbol(${t.description})`;case"Object":return URe(t);case"String":return`"${t}"`;default:return`${t}`}};_.sequenceConverter=function(t){return(e,r,n,o)=>{if(_.util.Type(e)!=="Object")throw _.errors.exception({header:r,message:`${n} (${_.util.Stringify(e)}) is not iterable.`});let s=typeof o=="function"?o():e?.[Symbol.iterator]?.(),a=[],c=0;if(s===void 0||typeof s.next!="function")throw _.errors.exception({header:r,message:`${n} is not iterable.`});for(;;){let{done:u,value:p}=s.next();if(u)break;a.push(t(p,r,`${n}[${c++}]`))}return a}};_.recordConverter=function(t,e){return(r,n,o)=>{if(_.util.Type(r)!=="Object")throw _.errors.exception({header:n,message:`${o} ("${_.util.Type(r)}") is not an Object.`});let s={};if(!Uo.isProxy(r)){let c=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(let u of c){let p=t(u,n,o),A=e(r[u],n,o);s[p]=A}return s}let a=Reflect.ownKeys(r);for(let c of a)if(Reflect.getOwnPropertyDescriptor(r,c)?.enumerable){let p=t(c,n,o),A=e(r[c],n,o);s[p]=A}return s}};_.interfaceConverter=function(t){return(e,r,n,o)=>{if(o?.strict!==!1&&!(e instanceof t))throw _.errors.exception({header:r,message:`Expected ${n} ("${_.util.Stringify(e)}") to be an instance of ${t.name}.`});return e}};_.dictionaryConverter=function(t){return(e,r,n)=>{let o=_.util.Type(e),s={};if(o==="Null"||o==="Undefined")return s;if(o!=="Object")throw _.errors.exception({header:r,message:`Expected ${e} to be one of: Null, Undefined, Object.`});for(let a of t){let{key:c,defaultValue:u,required:p,converter:A}=a;if(p===!0&&!Object.hasOwn(e,c))throw _.errors.exception({header:r,message:`Missing required key "${c}".`});let l=e[c],b=Object.hasOwn(a,"defaultValue");if(b&&l!==null&&(l??=u()),p||b||l!==void 0){if(l=A(l,r,`${n}.${c}`),a.allowedValues&&!a.allowedValues.includes(l))throw _.errors.exception({header:r,message:`${l} is not an accepted type. Expected one of ${a.allowedValues.join(", ")}.`});s[c]=l}}return s}};_.nullableConverter=function(t){return(e,r,n)=>e===null?e:t(e,r,n)};_.converters.DOMString=function(t,e,r,n){if(t===null&&n?.legacyNullToEmptyString)return"";if(typeof t=="symbol")throw _.errors.exception({header:e,message:`${r} is a symbol, which cannot be converted to a DOMString.`});return String(t)};_.converters.ByteString=function(t,e,r){let n=_.converters.DOMString(t,e,r);for(let o=0;o=0?u:p;n.length&&(c=[s,a])}return c}i(fee,"range")});var Bee=m((Vw0,yee)=>{var vke=lee(),hee=mee();yee.exports=_ke;var zee="\0SLASH"+Math.random()+"\0",gee="\0OPEN"+Math.random()+"\0",Rw="\0CLOSE"+Math.random()+"\0",Oee="\0COMMA"+Math.random()+"\0",Eee="\0PERIOD"+Math.random()+"\0";function Iw(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}i(Iw,"numeric");function Lke(t){return t.split("\\\\").join(zee).split("\\{").join(gee).split("\\}").join(Rw).split("\\,").join(Oee).split("\\.").join(Eee)}i(Lke,"escapeBraces");function Qke(t){return t.split(zee).join("\\").split(gee).join("{").split(Rw).join("}").split(Oee).join(",").split(Eee).join(".")}i(Qke,"unescapeBraces");function Cee(t){if(!t)return[""];var e=[],r=hee("{","}",t);if(!r)return t.split(",");var n=r.pre,o=r.body,s=r.post,a=n.split(",");a[a.length-1]+="{"+o+"}";var c=Cee(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),e.push.apply(e,a),e}i(Cee,"parseCommaParts");function _ke(t,e){if(!t)return[];e=e||{};var r=e.max==null?1/0:e.max;return t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),Ml(Lke(t),r,!0).map(Qke)}i(_ke,"expandTop");function Pke(t){return"{"+t+"}"}i(Pke,"embrace");function kke(t){return/^-?0\d/.test(t)}i(kke,"isPadded");function Uke(t,e){return t<=e}i(Uke,"lte");function Gke(t,e){return t>=e}i(Gke,"gte");function Ml(t,e,r){var n=[],o=hee("{","}",t);if(!o||/\$$/.test(o.pre))return[t];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),c=s||a,u=o.body.indexOf(",")>=0;if(!c&&!u)return o.post.match(/,(?!,).*\}/)?(t=o.pre+"{"+o.body+Rw+o.post,Ml(t,e,!0)):[t];var p;if(c)p=o.body.split(/\.\./);else if(p=Cee(o.body),p.length===1&&(p=Ml(p[0],e,!1).map(Pke),p.length===1)){var l=o.post.length?Ml(o.post,e,!1):[""];return l.map(function(Oe){return o.pre+p[0]+Oe})}var A=o.pre,l=o.post.length?Ml(o.post,e,!1):[""],b;if(c){var M=Iw(p[0]),z=Iw(p[1]),O=Math.max(p[0].length,p[1].length),y=p.length==3?Math.max(Math.abs(Iw(p[2])),1):1,E=Uke,B=z"u"?this.pattern:t,WO(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Hke(t)}i(Ree,"braceExpand");var Kke=1024*64,WO=i(function(t){if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>Kke)throw new TypeError("pattern is too long")},"assertValidPattern");ct.prototype.parse=Zke;var FO={};function Zke(t,e){WO(t);var r=this.options;if(t==="**")if(r.noglobstar)t="*";else return Sw;if(t==="")return"";var n="",o=!!r.nocase,s=!1,a=[],c=[],u,p=!1,A=-1,l=-1,b=t.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",M=this;function z(){if(u){switch(u){case"*":n+=ww,o=!0;break;case"?":n+=Nw,o=!0;break;default:n+="\\"+u;break}M.debug("clearStateChar %j %j",u,n),u=!1}}i(z,"clearStateChar");for(var O=0,y=t.length,E;O