You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			1 line
		
	
	
		
			8.1 KiB
		
	
	
	
		
			JavaScript
		
	
		
		
			
		
	
	
			1 line
		
	
	
		
			8.1 KiB
		
	
	
	
		
			JavaScript
		
	
| 
											9 months ago
										 | (()=>{"use strict";var e={448:function(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const n=o(361);const s=r(o(937));const i=r(o(457));const c=s.default("agent-base");function isAgent(e){return Boolean(e)&&typeof e.addRequest==="function"}function isSecureEndpoint(){const{stack:e}=new Error;if(typeof e!=="string")return false;return e.split("\n").some((e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1))}function createAgent(e,t){return new createAgent.Agent(e,t)}(function(e){class Agent extends n.EventEmitter{constructor(e,t){super();let o=t;if(typeof e==="function"){this.callback=e}else if(e){o=e}this.timeout=null;if(o&&typeof o.timeout==="number"){this.timeout=o.timeout}this.maxFreeSockets=1;this.maxSockets=1;this.maxTotalSockets=Infinity;this.sockets={};this.freeSockets={};this.requests={};this.options={}}get defaultPort(){if(typeof this.explicitDefaultPort==="number"){return this.explicitDefaultPort}return isSecureEndpoint()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){if(typeof this.explicitProtocol==="string"){return this.explicitProtocol}return isSecureEndpoint()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const o=Object.assign({},t);if(typeof o.secureEndpoint!=="boolean"){o.secureEndpoint=isSecureEndpoint()}if(o.host==null){o.host="localhost"}if(o.port==null){o.port=o.secureEndpoint?443:80}if(o.protocol==null){o.protocol=o.secureEndpoint?"https:":"http:"}if(o.host&&o.path){delete o.path}delete o.agent;delete o.hostname;delete o._defaultAgent;delete o.defaultPort;delete o.createConnection;e._last=true;e.shouldKeepAlive=false;let r=false;let n=null;const s=o.timeout||this.timeout;const onerror=t=>{if(e._hadError)return;e.emit("error",t);e._hadError=true};const ontimeout=()=>{n=null;r=true;const e=new Error(`A "socket" was not created for HTTP request before ${s}ms`);e.code="ETIMEOUT";onerror(e)};const callbackError=e=>{if(r)return;if(n!==null){clearTimeout(n);n=null}onerror(e)};const onsocket=t=>{if(r)return;if(n!=null){clearTimeout(n);n=null}if(isAgent(t)){c("Callback returned another Agent instance %o",t.constructor.name);t.addRequest(e,o);return}if(t){t.once("free",(()=>{this.freeSocket(t,o)}));e.onSocket(t);return}const s=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);onerror(s)};if(typeof this.callback!=="function"){onerror(new Error("`callback` is not defined"));return}if(!this.promisifiedCallback){if(this.callback.length>=3){c("Converting legacy callback function to promise");this.promisifiedCallback=i.default(this.callback)}else{this.promisifiedCallback=this.callback}}if(typeof s==="number"&&s>0){n=setTimeout(ontimeout,s)}if("port"in o&&typeof o.port!=="number"){o.port=Number(o.port)}try{c("Resolving socket for %o request: %o",o.protocol,`${e.method} ${e.path}`);Promise.resolve(this.promisifiedCallback(e,o)).then(onsocket,callbackError)}catch(e){Promise.reject(e).catch(callbackError)}}freeSocket(e,t){c("Freeing socket %o %o",e.constructor.name,t);e.destroy()}destroy(){c("Destroying agent %o",this.constructor.name)}}e.Agent=Agent;e.prototype=e.Agent.prototype})(createAgent||(createAgent={}));e.exports=createAgent},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function promisify(e){return function(t,o){return new Promise(((r,n)=>{e.call(this,t,o,((e,t)=>{if(e){n(e)}else{r(t)}}))}))}}t["default"]=promisify},44:function(e,t,o){var r=this&&this.__awaiter||function(e,t,o,r){function adopt(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,n){function fulfilled(e){try{step(r.next(e))}catch(e){n(e)}}function rejected(e){try{step(r["throw"](e))}catch(e){n(e)}}function step(e){e.done?o(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())}))};var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule" |