@stryke/http 0.12.14 → 0.12.15
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/CHANGELOG.md +7 -0
- package/dist/{chunk-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
- package/dist/agent.cjs +2 -1
- package/dist/agent.d.cts +40 -2
- package/dist/agent.d.cts.map +1 -0
- package/dist/agent.d.mts +40 -2
- package/dist/agent.d.mts.map +1 -0
- package/dist/agent.mjs +3 -1
- package/dist/agent.mjs.map +1 -0
- package/dist/fetch.cjs +1 -1
- package/dist/fetch.d.cts +24 -2
- package/dist/fetch.d.cts.map +1 -0
- package/dist/fetch.d.mts +24 -2
- package/dist/fetch.d.mts.map +1 -0
- package/dist/fetch.mjs +2 -1
- package/dist/fetch.mjs.map +1 -0
- package/dist/format-data-uri.cjs +1 -1
- package/dist/format-data-uri.d.cts +50 -2
- package/dist/format-data-uri.d.cts.map +1 -0
- package/dist/format-data-uri.d.mts +50 -2
- package/dist/format-data-uri.d.mts.map +1 -0
- package/dist/format-data-uri.mjs +2 -1
- package/dist/format-data-uri.mjs.map +1 -0
- package/dist/get-free-port.cjs +1 -1
- package/dist/get-free-port.d.cts +10 -2
- package/dist/get-free-port.d.cts.map +1 -0
- package/dist/get-free-port.d.mts +10 -2
- package/dist/get-free-port.d.mts.map +1 -0
- package/dist/get-free-port.mjs +2 -1
- package/dist/get-free-port.mjs.map +1 -0
- package/dist/http-proxy.cjs +3 -1
- package/dist/http-proxy.d.cts +40 -2
- package/dist/http-proxy.d.cts.map +1 -0
- package/dist/http-proxy.d.mts +40 -2
- package/dist/http-proxy.d.mts.map +1 -0
- package/dist/http-proxy.mjs +4 -1
- package/dist/http-proxy.mjs.map +1 -0
- package/dist/https-proxy.cjs +1 -1
- package/dist/https-proxy.d.cts +43 -2
- package/dist/https-proxy.d.cts.map +1 -0
- package/dist/https-proxy.d.mts +43 -2
- package/dist/https-proxy.d.mts.map +1 -0
- package/dist/https-proxy.mjs +2 -1
- package/dist/https-proxy.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +1 -1
- package/dist/parse-response.cjs +4 -1
- package/dist/parse-response.d.cts +23 -2
- package/dist/parse-response.d.cts.map +1 -0
- package/dist/parse-response.d.mts +23 -2
- package/dist/parse-response.d.mts.map +1 -0
- package/dist/parse-response.mjs +5 -1
- package/dist/parse-response.mjs.map +1 -0
- package/dist/proxy-agent.cjs +1 -1
- package/dist/proxy-agent.d.cts +13 -2
- package/dist/proxy-agent.d.cts.map +1 -0
- package/dist/proxy-agent.d.mts +13 -2
- package/dist/proxy-agent.d.mts.map +1 -0
- package/dist/proxy-agent.mjs +2 -1
- package/dist/proxy-agent.mjs.map +1 -0
- package/dist/type-checks/src/index.cjs +1 -0
- package/dist/type-checks/src/index.mjs +1 -0
- package/dist/type-checks/src/is-boolean.cjs +1 -0
- package/dist/type-checks/src/is-boolean.mjs +2 -0
- package/dist/type-checks/src/is-boolean.mjs.map +1 -0
- package/dist/type-checks/src/is-buffer.cjs +1 -0
- package/dist/type-checks/src/is-buffer.mjs +2 -0
- package/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/type-checks/src/is-collection.cjs +1 -0
- package/dist/type-checks/src/is-collection.mjs +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-set-string.cjs +1 -0
- package/dist/type-checks/src/is-set-string.mjs +2 -0
- package/dist/type-checks/src/is-set-string.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/type-checks/src/is-string.cjs +1 -0
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/type-checks/src/type-detect.cjs +1 -0
- package/dist/type-checks/src/type-detect.mjs +2 -0
- package/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/url/src/helpers.cjs +1 -0
- package/dist/url/src/helpers.mjs +2 -0
- package/dist/url/src/helpers.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/agent-Cc4PYJ-j.d.cts +0 -40
- package/dist/agent-Cc4PYJ-j.d.cts.map +0 -1
- package/dist/agent-DKevd8Ll.cjs +0 -2
- package/dist/agent-DXIpD4O5.d.mts +0 -40
- package/dist/agent-DXIpD4O5.d.mts.map +0 -1
- package/dist/agent-DrFvt4od.mjs +0 -3
- package/dist/agent-DrFvt4od.mjs.map +0 -1
- package/dist/fetch-BYPFJG9Y.d.cts +0 -24
- package/dist/fetch-BYPFJG9Y.d.cts.map +0 -1
- package/dist/fetch-D3masEhH.d.mts +0 -24
- package/dist/fetch-D3masEhH.d.mts.map +0 -1
- package/dist/fetch-DXVSCX2B.cjs +0 -1
- package/dist/fetch-DgPaAZTB.mjs +0 -2
- package/dist/fetch-DgPaAZTB.mjs.map +0 -1
- package/dist/format-data-uri-B-rw3THu.d.cts +0 -50
- package/dist/format-data-uri-B-rw3THu.d.cts.map +0 -1
- package/dist/format-data-uri-C59EgrXn.cjs +0 -1
- package/dist/format-data-uri-D864kwXt.d.mts +0 -50
- package/dist/format-data-uri-D864kwXt.d.mts.map +0 -1
- package/dist/format-data-uri-WSwfftd0.mjs +0 -2
- package/dist/format-data-uri-WSwfftd0.mjs.map +0 -1
- package/dist/get-free-port-Bf-x1nt8.d.cts +0 -10
- package/dist/get-free-port-Bf-x1nt8.d.cts.map +0 -1
- package/dist/get-free-port-BwvXPXFs.d.mts +0 -10
- package/dist/get-free-port-BwvXPXFs.d.mts.map +0 -1
- package/dist/get-free-port-D9hjek4b.cjs +0 -1
- package/dist/get-free-port-DvWNGhhy.mjs +0 -2
- package/dist/get-free-port-DvWNGhhy.mjs.map +0 -1
- package/dist/http-proxy-CJqbqeZN.cjs +0 -3
- package/dist/http-proxy-ChUYEQ71.mjs +0 -4
- package/dist/http-proxy-ChUYEQ71.mjs.map +0 -1
- package/dist/http-proxy-CzvOBKWd.d.cts +0 -40
- package/dist/http-proxy-CzvOBKWd.d.cts.map +0 -1
- package/dist/http-proxy-DuPPyvFw.d.mts +0 -40
- package/dist/http-proxy-DuPPyvFw.d.mts.map +0 -1
- package/dist/https-proxy-B8w-jm17.d.cts +0 -43
- package/dist/https-proxy-B8w-jm17.d.cts.map +0 -1
- package/dist/https-proxy-f4-C_EL8.d.mts +0 -43
- package/dist/https-proxy-f4-C_EL8.d.mts.map +0 -1
- package/dist/https-proxy-k0GW_xX8.cjs +0 -1
- package/dist/https-proxy-rNc_8MiC.mjs +0 -2
- package/dist/https-proxy-rNc_8MiC.mjs.map +0 -1
- package/dist/parse-response-BRlQF_8K.cjs +0 -4
- package/dist/parse-response-CGkjN9j0.mjs +0 -5
- package/dist/parse-response-CGkjN9j0.mjs.map +0 -1
- package/dist/parse-response-CS657Hki.d.cts +0 -23
- package/dist/parse-response-CS657Hki.d.cts.map +0 -1
- package/dist/parse-response-ujHVHmwG.d.mts +0 -23
- package/dist/parse-response-ujHVHmwG.d.mts.map +0 -1
- package/dist/proxy-agent-BrxQeFy2.d.mts +0 -13
- package/dist/proxy-agent-BrxQeFy2.d.mts.map +0 -1
- package/dist/proxy-agent-CnWrJ59l.d.cts +0 -13
- package/dist/proxy-agent-CnWrJ59l.d.cts.map +0 -1
- package/dist/proxy-agent-DMsOloiQ.cjs +0 -1
- package/dist/proxy-agent-uGI03t_I.mjs +0 -2
- package/dist/proxy-agent-uGI03t_I.m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,MAAA;EA/IK,IAAK,WAAA,CAAA,CAAA,EAAA,MAAA;EAAK,IAAA,WAAA,CAAA,CAAA,EAAA,MAAA"}
|
package/dist/agent-DKevd8Ll.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:http`);t=e.t(t);let n=require(`node:net`);n=e.t(n);const r=e=>{try{return e===null}catch{return!1}},i=e=>e===void 0,a=e=>{try{return i(e)||r(e)}catch{return!1}},o=e=>{try{return e instanceof Boolean||typeof e==`boolean`||!!e===e}catch{return!1}},s=typeof Buffer<`u`,c=s?Buffer.isBuffer.bind(Buffer):function(e){return!1},l=(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype),u=e=>{try{return typeof e==`string`}catch{return!1}},d=e=>{try{return!a(e)}catch{return!1}},f=e=>{try{return d(e)&&u(e)&&e.length>0}catch{return!1}},p=Symbol(`Agent`);var m=class extends t.Agent{[p];options;keepAlive;constructor(e){super(e),this[p]={}}isSecureEndpoint(e){if(e){if(o(e.secureEndpoint))return e.secureEndpoint;if(u(e.protocol))return e.protocol===`https:`}let{stack:t}=Error(` `);return u(t)?t.split(`
|
|
2
|
-
`).some(e=>e.includes(`(https.js:`)||e.includes(`node:https:`)):!1}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]??=[];let t=new n.Socket({writable:!1});return this.sockets[e].push(t),this.totalSocketCount++,t}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let n=this.sockets[e],r=n.indexOf(t);r!==-1&&(n.splice(r,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?HttpsAgent.prototype.getName.call(this,e):super.getName(e)}createSocket(e,n,r){let i={...n,secureEndpoint:this.isSecureEndpoint(n)},a=this.getName(i),o=this.incrementSockets(a);Promise.resolve().then(async()=>this.connect(e,i)).then(s=>{if(this.decrementSockets(a,o),s instanceof t.Agent)try{return s.addRequest(e,i)}catch(e){return r(e)}this[p].currentSocket=s,super.createSocket(e,n,r)},e=>{this.decrementSockets(a,o),r(e)})}createConnection(){let e=this[p].currentSocket;if(this[p].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[p].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[p]&&(this[p].defaultPort=e)}get protocol(){return this[p].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[p]&&(this[p].protocol=e)}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return m}});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as http from "node:http";
|
|
2
|
-
import * as net from "node:net";
|
|
3
|
-
import * as tls from "node:tls";
|
|
4
|
-
import { Duplex } from "node:stream";
|
|
5
|
-
|
|
6
|
-
//#region src/agent.d.ts
|
|
7
|
-
interface HttpConnectOpts extends net.TcpNetConnectOpts {
|
|
8
|
-
secureEndpoint: false;
|
|
9
|
-
protocol?: string;
|
|
10
|
-
}
|
|
11
|
-
interface HttpsConnectOpts extends tls.ConnectionOptions {
|
|
12
|
-
secureEndpoint: true;
|
|
13
|
-
protocol?: string;
|
|
14
|
-
port: number;
|
|
15
|
-
}
|
|
16
|
-
type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
|
|
17
|
-
declare const SYMBOL_INTERNAL: unique symbol;
|
|
18
|
-
declare abstract class Agent extends http.Agent {
|
|
19
|
-
private [SYMBOL_INTERNAL];
|
|
20
|
-
options: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;
|
|
21
|
-
keepAlive: boolean;
|
|
22
|
-
constructor(opts?: http.AgentOptions);
|
|
23
|
-
abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<Duplex | http.Agent> | Duplex | http.Agent;
|
|
24
|
-
/**
|
|
25
|
-
* Determine whether this is an `http` or `https` request.
|
|
26
|
-
*/
|
|
27
|
-
isSecureEndpoint(options?: AgentConnectOpts): boolean;
|
|
28
|
-
private incrementSockets;
|
|
29
|
-
private decrementSockets;
|
|
30
|
-
getName(options?: AgentConnectOpts): string;
|
|
31
|
-
createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void;
|
|
32
|
-
createConnection(): Duplex;
|
|
33
|
-
get defaultPort(): number;
|
|
34
|
-
set defaultPort(v: number);
|
|
35
|
-
get protocol(): string;
|
|
36
|
-
set protocol(v: string);
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { AgentConnectOpts as n, Agent as t };
|
|
40
|
-
//# sourceMappingURL=agent-DXIpD4O5.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-DXIpD4O5.d.mts","names":[],"sources":["../src/agent.ts"],"sourcesContent":[],"mappings":";;;;;;UAyBU,eAAA,SAAwB,GAAA,CAAI;;EAA5B,QAAA,CAAA,EAAA,MAAA;AAA6C;AAWvD,UANU,gBAAA,SAAyB,GAAA,CAAI,iBAMU,CAAA;EAE3C,cAAA,EAAA,IAAiC;EAQjB,QAAM,CAAA,EAAA,MAAA;EACjB,IAAA,EAAA,MAAA;;AAGqC,KAdpC,gBAAA,GAAmB,eAciB,GAdC,gBAcD;cAZ1C,eAYM,EAAA,OAAA,MAAA;AAIc,uBARJ,KAAA,SAAc,IAAA,CAAK,KAAA,CAQf;EAMjB,SAbE,eAAA;EAcE,OAAA,EAXD,OAWC,CAXO,GAAA,CAAI,iBAWX,GAX+B,GAAA,CAAI,iBAWnC,CAAA;EACA,SAAA,EAAA,OAAA;EAAS,WAAK,CAAA,IAAA,CAAA,EARN,IAAA,CAAK,YAQC;EAAtB,SAAA,OAAA,CAAA,GAAA,EAFI,IAAA,CAAK,aAET,EAAA,OAAA,EADQ,gBACR,CAAA,EAAA,OAAA,CAAQ,MAAR,GAAiB,IAAA,CAAK,KAAtB,CAAA,GAA+B,MAA/B,GAAwC,IAAA,CAAK,KAA7C;EAA+B;;;EAgFP,gBAAA,CAAA,OAAA,CAAA,EA3EA,gBA2EA,CAAA,EAAA,OAAA;EAWpB,QAAK,gBAAA;EACD,QAAA,gBAAA;EACC,OAAA,CAAA,OAAA,CAAA,EAbe,gBAaf,CAAA,EAAA,MAAA;EAAkB,YAAA,CAAA,GAAA,EAFvB,IAAA,CAAK,aAEkB,EAAA,OAAA,EADnB,gBACmB,EAAA,EAAA,EAAA,CAAA,GAAA,EAAlB,KAAkB,GAAA,IAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA,CAAA,EAAA,IAAA;EAkCD,gBAAA,CAAA,CAAA,EAAA,MAAA;EA/IK,IAAK,WAAA,CAAA,CAAA,EAAA,MAAA;EAAK,IAAA,WAAA,CAAA,CAAA,EAAA,MAAA"}
|
package/dist/agent-DrFvt4od.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import*as e from"node:http";import*as t from"node:net";const n=e=>{try{return e===null}catch{return!1}},r=e=>e===void 0,i=e=>{try{return r(e)||n(e)}catch{return!1}},a=e=>{try{return e instanceof Boolean||typeof e==`boolean`||!!e===e}catch{return!1}};typeof Buffer<`u`&&Buffer.isBuffer.bind(Buffer),(e=>(typeof globalThis==`object`||Object.defineProperty(e,`typeDetectGlobalObject`,{get(){return this},configurable:!0}),globalThis))(Object.prototype);const o=e=>{try{return typeof e==`string`}catch{return!1}},s=e=>{try{return!i(e)}catch{return!1}},c=e=>{try{return s(e)&&o(e)&&e.length>0}catch{return!1}},l=Symbol(`Agent`);var u=class extends e.Agent{[l];options;keepAlive;constructor(e){super(e),this[l]={}}isSecureEndpoint(e){if(e){if(a(e.secureEndpoint))return e.secureEndpoint;if(o(e.protocol))return e.protocol===`https:`}let{stack:t}=Error(` `);return o(t)?t.split(`
|
|
2
|
-
`).some(e=>e.includes(`(https.js:`)||e.includes(`node:https:`)):!1}incrementSockets(e){if(this.maxSockets===1/0&&this.maxTotalSockets===1/0)return null;this.sockets[e]??=[];let n=new t.Socket({writable:!1});return this.sockets[e].push(n),this.totalSocketCount++,n}decrementSockets(e,t){if(!this.sockets[e]||t===null)return;let n=this.sockets[e],r=n.indexOf(t);r!==-1&&(n.splice(r,1),this.totalSocketCount--,n.length===0&&delete this.sockets[e])}getName(e){return this.isSecureEndpoint(e)?HttpsAgent.prototype.getName.call(this,e):super.getName(e)}createSocket(t,n,r){let i={...n,secureEndpoint:this.isSecureEndpoint(n)},a=this.getName(i),o=this.incrementSockets(a);Promise.resolve().then(async()=>this.connect(t,i)).then(s=>{if(this.decrementSockets(a,o),s instanceof e.Agent)try{return s.addRequest(t,i)}catch(e){return r(e)}this[l].currentSocket=s,super.createSocket(t,n,r)},e=>{this.decrementSockets(a,o),r(e)})}createConnection(){let e=this[l].currentSocket;if(this[l].currentSocket=void 0,!e)throw Error("No socket was returned in the `connect()` function");return e}get defaultPort(){return this[l].defaultPort??(this.protocol===`https:`?443:80)}set defaultPort(e){this[l]&&(this[l].defaultPort=e)}get protocol(){return this[l].protocol??(this.isSecureEndpoint()?`https:`:`http:`)}set protocol(e){this[l]&&(this[l].protocol=e)}};export{c as n,u as t};
|
|
3
|
-
//# sourceMappingURL=agent-DrFvt4od.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-DrFvt4od.mjs","names":["isBuffer: typeof Buffer.isBuffer","isBuffer","err: unknown"],"sources":["../../type-checks/src/is-null.ts","../../type-checks/src/is-undefined.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-boolean.ts","../../type-checks/src/is-buffer.ts","../../type-checks/src/type-detect.ts","../../type-checks/src/is-string.ts","../../type-checks/src/is-set.ts","../../type-checks/src/is-set-string.ts","../src/agent.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Check if the provided value's type is `boolean`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `boolean`\n */\nexport const isBoolean = (value: unknown): value is boolean => {\n try {\n return (\n value instanceof Boolean ||\n typeof value === \"boolean\" ||\n Boolean(value) === value\n );\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isBufferExists = typeof Buffer !== \"undefined\";\n\n/**\n * Check if the provided value's type is `Buffer`\n */\nexport const isBuffer: typeof Buffer.isBuffer = isBufferExists\n ? Buffer.isBuffer.bind(Buffer)\n : /**\n * Check if the provided value's type is `Buffer`\n\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Buffer`\n */\n function isBuffer(\n value: Parameters<typeof Buffer.isBuffer>[0]\n ): value is Buffer {\n return false;\n };\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBuffer } from \"./is-buffer\";\n\nconst globalObject = (Obj => {\n if (typeof globalThis === \"object\") {\n return globalThis;\n }\n Object.defineProperty(Obj, \"typeDetectGlobalObject\", {\n get() {\n return this;\n },\n configurable: true\n });\n\n // // biome-ignore lint/correctness/noUndeclaredVariables: <explanation>\n // const global = typeDetectGlobalObject;\n\n // // biome-ignore lint/performance/noDelete: <explanation>\n // delete Obj.typeDetectGlobalObject;\n return globalThis;\n})(Object.prototype);\n\nexport function typeDetect(obj: unknown): string {\n // NOTE: isBuffer must execute before type-detect,\n // because type-detect returns 'Uint8Array'.\n if (isBuffer(obj)) {\n return \"Buffer\";\n }\n\n const typeofObj = typeof obj;\n if (typeofObj !== \"object\") {\n return typeofObj;\n }\n\n if (obj === null) {\n return \"null\";\n }\n\n if (obj === globalObject) {\n return \"global\";\n }\n\n if (\n Array.isArray(obj) &&\n (Symbol.toStringTag === undefined || !(Symbol.toStringTag in obj))\n ) {\n return \"Array\";\n }\n\n // https://html.spec.whatwg.org/multipage/browsers.html#location\n if (typeof globalThis === \"object\" && globalThis !== null) {\n if (\n typeof (globalThis as any).location === \"object\" &&\n obj === (globalThis as any).location\n ) {\n return \"Location\";\n }\n\n // https://html.spec.whatwg.org/#document\n if (\n typeof (globalThis as any).document === \"object\" &&\n obj === (globalThis as any).document\n ) {\n return \"Document\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray\n if (typeof (globalThis as any).navigator === \"object\") {\n if (\n typeof (globalThis as any).navigator.mimeTypes === \"object\" &&\n obj === (globalThis as any).navigator.mimeTypes\n ) {\n return \"MimeTypeArray\";\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n typeof (globalThis as any).navigator.plugins === \"object\" &&\n obj === (globalThis as any).navigator.plugins\n ) {\n return \"PluginArray\";\n }\n }\n\n // https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray\n if (\n (typeof (globalThis as any).HTMLElement === \"function\" ||\n typeof (globalThis as any).HTMLElement === \"object\") &&\n obj instanceof (globalThis as any).HTMLElement\n ) {\n if ((obj as any).tagName === \"BLOCKQUOTE\") {\n return \"HTMLQuoteElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltabledatacellelement\n if ((obj as any).tagName === \"TD\") {\n return \"HTMLTableDataCellElement\";\n }\n\n // https://html.spec.whatwg.org/#htmltableheadercellelement\n if ((obj as any).tagName === \"TH\") {\n return \"HTMLTableHeaderCellElement\";\n }\n }\n }\n\n const stringTag =\n Symbol.toStringTag !== undefined && (obj as any)[Symbol.toStringTag];\n if (typeof stringTag === \"string\") {\n return stringTag;\n }\n\n const objPrototype = Object.getPrototypeOf(obj);\n if (objPrototype === RegExp.prototype) {\n return \"RegExp\";\n }\n\n if (objPrototype === Date.prototype) {\n return \"Date\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag\n if (typeof Promise !== \"undefined\" && objPrototype === Promise.prototype) {\n return \"Promise\";\n }\n\n if (typeof Set !== \"undefined\" && objPrototype === Set.prototype) {\n return \"Set\";\n }\n\n if (typeof Map !== \"undefined\" && objPrototype === Map.prototype) {\n return \"Map\";\n }\n\n if (typeof WeakSet !== \"undefined\" && objPrototype === WeakSet.prototype) {\n return \"WeakSet\";\n }\n\n if (typeof WeakMap !== \"undefined\" && objPrototype === WeakMap.prototype) {\n return \"WeakMap\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag\n if (typeof DataView !== \"undefined\" && objPrototype === DataView.prototype) {\n return \"DataView\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag\n if (\n typeof Map !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Map().entries())\n ) {\n return \"Map Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag\n if (\n typeof Set !== \"undefined\" &&\n objPrototype === Object.getPrototypeOf(new Set().entries())\n ) {\n return \"Set Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag\n if (\n typeof Array.prototype[Symbol.iterator] === \"function\" &&\n objPrototype === Object.getPrototypeOf([][Symbol.iterator]())\n ) {\n return \"Array Iterator\";\n }\n\n // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag\n if (\n Symbol.iterator !== undefined &&\n typeof String.prototype[Symbol.iterator] === \"function\" &&\n Object.getPrototypeOf(\"\"[Symbol.iterator]()) &&\n objPrototype === Object.getPrototypeOf(\"\"[Symbol.iterator]())\n ) {\n return \"String Iterator\";\n }\n\n if (objPrototype === null) {\n return \"Object\";\n }\n\n return Object.prototype.toString.call(obj).slice(8, -1);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSet } from \"./is-set\";\nimport { isString } from \"./is-string\";\n\n/**\n * Determine if the type is string and is not empty (length greater than zero)\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `string` and length greater than zero\n */\nexport const isSetString = (value: unknown): value is NonNullable<string> => {\n try {\n return isSet(value) && isString(value) && value.length > 0;\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean, isString } from \"@stryke/type-checks\";\nimport * as http from \"node:http\";\nimport type { Agent as HttpsAgent } from \"node:https\";\nimport * as net from \"node:net\";\nimport type { Duplex } from \"node:stream\";\nimport type * as tls from \"node:tls\";\n\ninterface HttpConnectOpts extends net.TcpNetConnectOpts {\n secureEndpoint: false;\n protocol?: string;\n}\n\ninterface HttpsConnectOpts extends tls.ConnectionOptions {\n secureEndpoint: true;\n protocol?: string;\n port: number;\n}\n\nexport type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;\n\nconst SYMBOL_INTERNAL = Symbol(\"Agent\");\n\ninterface InternalState {\n defaultPort?: number;\n protocol?: string;\n currentSocket?: Duplex;\n}\n\nexport abstract class Agent extends http.Agent {\n private [SYMBOL_INTERNAL]: InternalState;\n\n // Set by `http.Agent` - missing from `@types/node`\n options!: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;\n\n keepAlive!: boolean;\n\n constructor(opts?: http.AgentOptions) {\n super(opts);\n this[SYMBOL_INTERNAL] = {};\n }\n\n abstract connect(\n req: http.ClientRequest,\n options: AgentConnectOpts\n ): Promise<Duplex | http.Agent> | Duplex | http.Agent;\n\n /**\n * Determine whether this is an `http` or `https` request.\n */\n isSecureEndpoint(options?: AgentConnectOpts): boolean {\n if (options) {\n // First check the `secureEndpoint` property explicitly, since this\n // means that a parent `Agent` is \"passing through\" to this instance.\n if (isBoolean((options as any).secureEndpoint)) {\n return options.secureEndpoint;\n }\n\n // If no explicit `secure` endpoint, check if `protocol` property is\n // set. This will usually be the case since using a full string URL\n // or `URL` instance should be the most common usage.\n if (isString(options.protocol)) {\n return options.protocol === \"https:\";\n }\n }\n\n // Finally, if no `protocol` property was set, then fall back to\n // checking the stack trace of the current call stack, and try to\n // detect the \"https\" module.\n const { stack } = new Error(\" \");\n if (!isString(stack)) {\n return false;\n }\n\n return stack\n .split(\"\\n\")\n .some(l => l.includes(\"(https.js:\") || l.includes(\"node:https:\"));\n }\n\n // In order to support async signatures in `connect()` and Node's native\n // connection pooling in `http.Agent`, the array of sockets for each origin\n // has to be updated synchronously. This is so the length of the array is\n // accurate when `addRequest()` is next called. We achieve this by creating a\n // fake socket and adding it to `sockets[origin]` and incrementing\n // `totalSocketCount`.\n private incrementSockets(name: string) {\n // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no\n // need to create a fake socket because Node.js native connection pooling\n // will never be invoked.\n if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {\n return null;\n }\n // All instances of `sockets` are expected TypeScript errors. The\n // alternative is to add it as a private property of this class but that\n // will break TypeScript sub-classing.\n\n // @ts-expect-error `sockets` is readonly in `@types/node`\n this.sockets[name] ??= [];\n\n const fakeSocket = new net.Socket({ writable: false });\n this.sockets[name].push(fakeSocket);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount++;\n return fakeSocket;\n }\n\n private decrementSockets(name: string, socket: null | net.Socket) {\n if (!this.sockets[name] || socket === null) {\n return;\n }\n const sockets = this.sockets[name];\n const index = sockets.indexOf(socket);\n if (index !== -1) {\n sockets.splice(index, 1);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount--;\n if (sockets.length === 0) {\n // @ts-expect-error `sockets` is readonly in `@types/node`\n delete this.sockets[name];\n }\n }\n }\n\n // In order to properly update the socket pool, we need to call `getName()` on\n // the core `https.Agent` if it is a secureEndpoint.\n override getName(options?: AgentConnectOpts): string {\n const secureEndpoint = this.isSecureEndpoint(options);\n if (secureEndpoint) {\n // @ts-expect-error `getName()` isn't defined in `@types/node`\n return HttpsAgent.prototype.getName.call(this, options);\n }\n\n return super.getName(options);\n }\n\n createSocket(\n req: http.ClientRequest,\n options: AgentConnectOpts,\n cb: (err: Error | null, s?: Duplex) => void\n ) {\n const connectOpts = {\n ...options,\n secureEndpoint: this.isSecureEndpoint(options)\n };\n const name = this.getName(connectOpts);\n const fakeSocket = this.incrementSockets(name);\n Promise.resolve()\n .then(async () => this.connect(req, connectOpts))\n .then(\n socket => {\n this.decrementSockets(name, fakeSocket);\n if (socket instanceof http.Agent) {\n try {\n // @ts-expect-error `addRequest()` isn't defined in `@types/node`\n // eslint-disable-next-line ts/no-unsafe-call\n return socket.addRequest(req, connectOpts);\n } catch (err: unknown) {\n return cb(err as Error);\n }\n }\n this[SYMBOL_INTERNAL].currentSocket = socket;\n // @ts-expect-error `createSocket()` isn't defined in `@types/node`\n // eslint-disable-next-line ts/no-unsafe-call\n super.createSocket(req, options, cb);\n },\n err => {\n this.decrementSockets(name, fakeSocket);\n cb(err);\n }\n );\n }\n\n override createConnection(): Duplex {\n const socket = this[SYMBOL_INTERNAL].currentSocket;\n this[SYMBOL_INTERNAL].currentSocket = undefined;\n if (!socket) {\n throw new Error(\"No socket was returned in the `connect()` function\");\n }\n return socket;\n }\n\n get defaultPort(): number {\n return (\n this[SYMBOL_INTERNAL].defaultPort ??\n (this.protocol === \"https:\" ? 443 : 80)\n );\n }\n\n set defaultPort(v: number) {\n if (this[SYMBOL_INTERNAL]) {\n this[SYMBOL_INTERNAL].defaultPort = v;\n }\n }\n\n get protocol(): string {\n return (\n this[SYMBOL_INTERNAL].protocol ??\n (this.isSecureEndpoint() ? \"https:\" : \"http:\")\n );\n }\n\n set protocol(v: string) {\n if (this[SYMBOL_INTERNAL]) {\n this[SYMBOL_INTERNAL].protocol = v;\n }\n }\n}\n"],"mappings":"uDAkBA,MAAa,EAAU,GAAkC,CACvD,GAAI,CACF,OAAO,IAAU,UACX,CACN,MAAO,KCJE,EAAe,GACnB,IAAU,IAAA,GCYN,EAAW,GAAmB,CACzC,GAAI,CACF,OAAO,EAAY,EAAM,EAAI,EAAO,EAAM,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iB,WACrB,KAAK,kBAAkB,CAAG,SAAW,SAI1C,IAAI,SAAS,EAAW,CAClB,KAAK,KACP,KAAK,GAAiB,SAAW"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as undici0 from "undici";
|
|
2
|
-
import { RequestInfo } from "undici";
|
|
3
|
-
|
|
4
|
-
//#region src/fetch.d.ts
|
|
5
|
-
type FetchRequestOptions = RequestInit & {
|
|
6
|
-
/**
|
|
7
|
-
* Timeout in milliseconds
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue 5000
|
|
10
|
-
*/
|
|
11
|
-
timeout?: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Fetches a resource from a URL.
|
|
15
|
-
*
|
|
16
|
-
* @param input - The URL to fetch.
|
|
17
|
-
* @param options - Additional fetch options.
|
|
18
|
-
* @returns The fetched response.
|
|
19
|
-
*/
|
|
20
|
-
declare function fetchRequest(input: RequestInfo, options?: FetchRequestOptions): Promise<undici0.Response>;
|
|
21
|
-
declare const fetch: typeof fetchRequest;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { fetch as n, fetchRequest as r, FetchRequestOptions as t };
|
|
24
|
-
//# sourceMappingURL=fetch-BYPFJG9Y.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-BYPFJG9Y.d.cts","names":[],"sources":["../src/fetch.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,mBAAA,GAAsB;;;AAAlC;AAgBA;;EAEW,OAAA,CAAA,EAAA,MAAA;CAAwB;;;AAyBnC;;;;;iBA3BsB,YAAA,QACb,uBACE,sBAAwB,QAAA,OAAA,CAAA,QAAA;cAyBtB,cAAK"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as undici0 from "undici";
|
|
2
|
-
import { RequestInfo } from "undici";
|
|
3
|
-
|
|
4
|
-
//#region src/fetch.d.ts
|
|
5
|
-
type FetchRequestOptions = RequestInit & {
|
|
6
|
-
/**
|
|
7
|
-
* Timeout in milliseconds
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue 5000
|
|
10
|
-
*/
|
|
11
|
-
timeout?: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Fetches a resource from a URL.
|
|
15
|
-
*
|
|
16
|
-
* @param input - The URL to fetch.
|
|
17
|
-
* @param options - Additional fetch options.
|
|
18
|
-
* @returns The fetched response.
|
|
19
|
-
*/
|
|
20
|
-
declare function fetchRequest(input: RequestInfo, options?: FetchRequestOptions): Promise<undici0.Response>;
|
|
21
|
-
declare const fetch$1: typeof fetchRequest;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { fetch$1 as n, fetchRequest as r, FetchRequestOptions as t };
|
|
24
|
-
//# sourceMappingURL=fetch-D3masEhH.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-D3masEhH.d.mts","names":[],"sources":["../src/fetch.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,mBAAA,GAAsB;;;AAAlC;AAgBA;;EAEW,OAAA,CAAA,EAAA,MAAA;CAAwB;;;AAyBnC;;;;;iBA3BsB,YAAA,QACb,uBACE,sBAAwB,QAAA,OAAA,CAAA,QAAA;cAyBtB,gBAAK"}
|
package/dist/fetch-DXVSCX2B.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./agent-DKevd8Ll.cjs`),n=require(`./proxy-agent-DMsOloiQ.cjs`);let r=require(`defu`),i=require(`undici`);function a(e){return/(?:https?:\/\/.)?(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=]*/.test(e)}async function o(e,o={}){if(t.n(e)&&!a(e))throw Error(`Invalid URL format provided: ${e}`);let s=new AbortController;return setTimeout(()=>s.abort(),o.timeout??5e3),(0,i.fetch)(e,(0,r.defu)(o,{agent:n.t(),signal:s.signal,headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`}}))}const s=o;Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
package/dist/fetch-DgPaAZTB.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./agent-DrFvt4od.mjs";import{t}from"./proxy-agent-uGI03t_I.mjs";import{defu as n}from"defu";import{fetch as r}from"undici";function i(e){return/(?:https?:\/\/.)?(?:www\.)?[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b[-\w@:%+.~#?&/=]*/.test(e)}async function a(a,o={}){if(e(a)&&!i(a))throw Error(`Invalid URL format provided: ${a}`);let s=new AbortController;return setTimeout(()=>s.abort(),o.timeout??5e3),r(a,n(o,{agent:t(),signal:s.signal,headers:{"User-Agent":`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`}}))}const o=a;export{a as n,o as t};
|
|
2
|
-
//# sourceMappingURL=fetch-DgPaAZTB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-DgPaAZTB.mjs","names":["undiciFetch","fetch"],"sources":["../../url/src/helpers.ts","../src/fetch.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport function formatLocalePath(locale: string) {\n let result = locale;\n if (result.includes(\"_\")) {\n result = result.replace(/_/g, \"-\");\n }\n\n if (result.includes(\"-\")) {\n const parts = result.split(\"-\");\n if (parts.length > 1) {\n const lang = parts[0];\n const region = parts[1];\n if (lang && region) {\n result = `${lang}-${region}`;\n }\n }\n }\n\n return result.toLowerCase();\n}\n\n/**\n * Check if a string has a valid URL format.\n *\n * @param str - The string to check.\n * @returns `true` if the string is a valid URL, otherwise `false`.\n */\nexport function isValidURL(str: string): boolean {\n return /(?:https?:\\/\\/.)?(?:www\\.)?[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b[-\\w@:%+.~#?&/=]*/.test(\n str\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isValidURL } from \"@stryke/url/helpers\";\nimport { defu } from \"defu\";\nimport type { RequestInfo } from \"undici\";\nimport { fetch as undiciFetch } from \"undici\";\nimport { getProxyAgent } from \"./proxy-agent\";\n\nexport type FetchRequestOptions = RequestInit & {\n /**\n * Timeout in milliseconds\n *\n * @defaultValue 5000\n */\n timeout?: number;\n};\n\n/**\n * Fetches a resource from a URL.\n *\n * @param input - The URL to fetch.\n * @param options - Additional fetch options.\n * @returns The fetched response.\n */\nexport async function fetchRequest(\n input: RequestInfo,\n options: FetchRequestOptions = {}\n) {\n if (isSetString(input) && !isValidURL(input)) {\n throw new Error(`Invalid URL format provided: ${input}`);\n }\n\n const abort = new AbortController();\n setTimeout(() => abort.abort(), options.timeout ?? 5000);\n\n return undiciFetch(\n input,\n defu(options, {\n agent: getProxyAgent(),\n signal: abort.signal,\n headers: {\n // The file format is based off of the user agent, make sure woff2 files are fetched\n \"User-Agent\":\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) \" +\n \"AppleWebKit/537.36 (KHTML, like Gecko) \" +\n \"Chrome/104.0.0.0 Safari/537.36\"\n }\n })\n );\n}\n\nexport const fetch = fetchRequest;\n"],"mappings":"8IA4CA,SAAgB,EAAW,EAAsB,CAC/C,MAAO,iFAAiF,KACtF,EACD,CCNH,eAAsB,EACpB,EACA,EAA+B,EAAE,CACjC,CACA,GAAI,EAAY,EAAM,EAAI,CAAC,EAAW,EAAM,CAC1C,MAAU,MAAM,gCAAgC,IAAQ,CAG1D,IAAM,EAAQ,IAAI,gBAGlB,OAFA,eAAiB,EAAM,OAAO,CAAE,EAAQ,SAAW,IAAK,CAEjDA,EACL,EACA,EAAK,EAAS,CACZ,MAAO,GAAe,CACtB,OAAQ,EAAM,OACd,QAAS,CAEP,aACE,wHAGH,CACF,CAAC,CACH,CAGH,MAAaC,EAAQ"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//#region src/format-data-uri.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Creates a data URI from a string of data.
|
|
4
|
-
*
|
|
5
|
-
* @param data - The data to convert to a data URI.
|
|
6
|
-
* @param mime - The MIME type of the data.
|
|
7
|
-
* @returns The data URI.
|
|
8
|
-
*/
|
|
9
|
-
declare const formatDataURI: (data: string, mime: string) => string;
|
|
10
|
-
interface ParsedDataURI {
|
|
11
|
-
type: string;
|
|
12
|
-
typeFull: string;
|
|
13
|
-
charset: string;
|
|
14
|
-
buffer: ArrayBuffer;
|
|
15
|
-
}
|
|
16
|
-
interface BufferConversionsInterface {
|
|
17
|
-
base64ToArrayBuffer: (base64: string) => ArrayBuffer;
|
|
18
|
-
stringToBuffer: (str: string) => ArrayBuffer;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns a `Buffer` instance from the given data URI `uri`.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import { makeDataUriToBuffer } from "@stryke/core/http";
|
|
26
|
-
*
|
|
27
|
-
* const dataUriToBuffer = makeDataUriToBuffer({
|
|
28
|
-
* base64ToArrayBuffer: (base64) => Buffer.from(base64, "base64").buffer,
|
|
29
|
-
* stringToBuffer: (str) => Buffer.from(str, "utf8")https://avatars.githubusercontent.com/u/99053093?s=64&v=4.buffer,
|
|
30
|
-
* });
|
|
31
|
-
* const parsed = dataUriToBuffer("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==");
|
|
32
|
-
* console.log(parsed);
|
|
33
|
-
* // {
|
|
34
|
-
* // type: 'text/plain',
|
|
35
|
-
* // typeFull: 'text/plain;base64',
|
|
36
|
-
* // charset: '',
|
|
37
|
-
* // buffer: ArrayBuffer { ... }
|
|
38
|
-
* // }
|
|
39
|
-
* console.log(Buffer.from(parsed.buffer).toString("utf8"));
|
|
40
|
-
* // Hello, World!
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param convert - Conversion functions
|
|
44
|
-
* @returns An object containing the parsed data URI properties and the decoded data as a Buffer instance.
|
|
45
|
-
* @throws `TypeError` if `uri` is not a valid Data URI
|
|
46
|
-
*/
|
|
47
|
-
declare const makeDataUriToBuffer: (convert: BufferConversionsInterface) => (uri: string | URL) => ParsedDataURI;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { makeDataUriToBuffer as i, ParsedDataURI as n, formatDataURI as r, BufferConversionsInterface as t };
|
|
50
|
-
//# sourceMappingURL=format-data-uri-B-rw3THu.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-data-uri-B-rw3THu.d.cts","names":[],"sources":["../src/format-data-uri.ts"],"sourcesContent":[],"mappings":";;AAyBA;AAGA;AAOA;AAgCA;;;AAEuB,cA5CV,aA4CU,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAsDpB,UA/Fc,aAAA,CA+Fd;;;;UA3FO;;UAGO,0BAAA;2CAC0B;mCACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BtB,+BACD,8CACK,QAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=(e,t)=>`data:${t};utf8,${encodeURIComponent(e)}`,t=e=>t=>{if(t=String(t),!/^data:/i.test(t))throw Error('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,``);let n=t.indexOf(`,`);if(n===-1||n<=4)throw Error(`malformed data: URI`);let r=t.substring(5,n).split(`;`),i=``,a=!1,o=r[0]||`text/plain`,s=o;for(let e=1;e<r.length;e++)r[e]===`base64`?a=!0:r[e]&&(s+=`;${r[e]}`,r[e]?.indexOf(`charset=`)===0&&(i=r[e].substring(8)));!r[0]&&!i.length&&(s+=`;charset=US-ASCII`,i=`US-ASCII`);let c=unescape(t.substring(n+1)),l=a?e.base64ToArrayBuffer(c):e.stringToBuffer(c);return{type:o,typeFull:s,charset:i,buffer:l}};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//#region src/format-data-uri.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Creates a data URI from a string of data.
|
|
4
|
-
*
|
|
5
|
-
* @param data - The data to convert to a data URI.
|
|
6
|
-
* @param mime - The MIME type of the data.
|
|
7
|
-
* @returns The data URI.
|
|
8
|
-
*/
|
|
9
|
-
declare const formatDataURI: (data: string, mime: string) => string;
|
|
10
|
-
interface ParsedDataURI {
|
|
11
|
-
type: string;
|
|
12
|
-
typeFull: string;
|
|
13
|
-
charset: string;
|
|
14
|
-
buffer: ArrayBuffer;
|
|
15
|
-
}
|
|
16
|
-
interface BufferConversionsInterface {
|
|
17
|
-
base64ToArrayBuffer: (base64: string) => ArrayBuffer;
|
|
18
|
-
stringToBuffer: (str: string) => ArrayBuffer;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns a `Buffer` instance from the given data URI `uri`.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import { makeDataUriToBuffer } from "@stryke/core/http";
|
|
26
|
-
*
|
|
27
|
-
* const dataUriToBuffer = makeDataUriToBuffer({
|
|
28
|
-
* base64ToArrayBuffer: (base64) => Buffer.from(base64, "base64").buffer,
|
|
29
|
-
* stringToBuffer: (str) => Buffer.from(str, "utf8")https://avatars.githubusercontent.com/u/99053093?s=64&v=4.buffer,
|
|
30
|
-
* });
|
|
31
|
-
* const parsed = dataUriToBuffer("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==");
|
|
32
|
-
* console.log(parsed);
|
|
33
|
-
* // {
|
|
34
|
-
* // type: 'text/plain',
|
|
35
|
-
* // typeFull: 'text/plain;base64',
|
|
36
|
-
* // charset: '',
|
|
37
|
-
* // buffer: ArrayBuffer { ... }
|
|
38
|
-
* // }
|
|
39
|
-
* console.log(Buffer.from(parsed.buffer).toString("utf8"));
|
|
40
|
-
* // Hello, World!
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param convert - Conversion functions
|
|
44
|
-
* @returns An object containing the parsed data URI properties and the decoded data as a Buffer instance.
|
|
45
|
-
* @throws `TypeError` if `uri` is not a valid Data URI
|
|
46
|
-
*/
|
|
47
|
-
declare const makeDataUriToBuffer: (convert: BufferConversionsInterface) => (uri: string | URL) => ParsedDataURI;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { makeDataUriToBuffer as i, ParsedDataURI as n, formatDataURI as r, BufferConversionsInterface as t };
|
|
50
|
-
//# sourceMappingURL=format-data-uri-D864kwXt.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-data-uri-D864kwXt.d.mts","names":[],"sources":["../src/format-data-uri.ts"],"sourcesContent":[],"mappings":";;AAyBA;AAGA;AAOA;AAgCA;;;AAEuB,cA5CV,aA4CU,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AAsDpB,UA/Fc,aAAA,CA+Fd;;;;UA3FO;;UAGO,0BAAA;2CAC0B;mCACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BtB,+BACD,8CACK,QAAM"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=(e,t)=>`data:${t};utf8,${encodeURIComponent(e)}`,t=e=>t=>{if(t=String(t),!/^data:/i.test(t))throw Error('`uri` does not appear to be a Data URI (must begin with "data:")');t=t.replace(/\r?\n/g,``);let n=t.indexOf(`,`);if(n===-1||n<=4)throw Error(`malformed data: URI`);let r=t.substring(5,n).split(`;`),i=``,a=!1,o=r[0]||`text/plain`,s=o;for(let e=1;e<r.length;e++)r[e]===`base64`?a=!0:r[e]&&(s+=`;${r[e]}`,r[e]?.indexOf(`charset=`)===0&&(i=r[e].substring(8)));!r[0]&&!i.length&&(s+=`;charset=US-ASCII`,i=`US-ASCII`);let c=unescape(t.substring(n+1)),l=a?e.base64ToArrayBuffer(c):e.stringToBuffer(c);return{type:o,typeFull:s,charset:i,buffer:l}};export{t as n,e as t};
|
|
2
|
-
//# sourceMappingURL=format-data-uri-WSwfftd0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-data-uri-WSwfftd0.mjs","names":[],"sources":["../src/format-data-uri.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Creates a data URI from a string of data.\n *\n * @param data - The data to convert to a data URI.\n * @param mime - The MIME type of the data.\n * @returns The data URI.\n */\nexport const formatDataURI = (data: string, mime: string): string =>\n `data:${mime};utf8,${encodeURIComponent(data)}`;\n\nexport interface ParsedDataURI {\n type: string;\n typeFull: string;\n charset: string;\n buffer: ArrayBuffer;\n}\n\nexport interface BufferConversionsInterface {\n base64ToArrayBuffer: (base64: string) => ArrayBuffer;\n stringToBuffer: (str: string) => ArrayBuffer;\n}\n\n/**\n * Returns a `Buffer` instance from the given data URI `uri`.\n *\n * @example\n * ```typescript\n * import { makeDataUriToBuffer } from \"@stryke/core/http\";\n *\n * const dataUriToBuffer = makeDataUriToBuffer({\n * base64ToArrayBuffer: (base64) => Buffer.from(base64, \"base64\").buffer,\n * stringToBuffer: (str) => Buffer.from(str, \"utf8\")https://avatars.githubusercontent.com/u/99053093?s=64&v=4.buffer,\n * });\n * const parsed = dataUriToBuffer(\"data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==\");\n * console.log(parsed);\n * // {\n * // type: 'text/plain',\n * // typeFull: 'text/plain;base64',\n * // charset: '',\n * // buffer: ArrayBuffer { ... }\n * // }\n * console.log(Buffer.from(parsed.buffer).toString(\"utf8\"));\n * // Hello, World!\n * ```\n *\n * @param convert - Conversion functions\n * @returns An object containing the parsed data URI properties and the decoded data as a Buffer instance.\n * @throws `TypeError` if `uri` is not a valid Data URI\n */\nexport const makeDataUriToBuffer =\n (convert: BufferConversionsInterface) =>\n (uri: string | URL): ParsedDataURI => {\n uri = String(uri);\n\n if (!/^data:/i.test(uri)) {\n throw new Error(\n '`uri` does not appear to be a Data URI (must begin with \"data:\")'\n );\n }\n\n // strip newlines\n uri = uri.replace(/\\r?\\n/g, \"\");\n\n // split the URI up into the \"metadata\" and the \"data\" portions\n const firstComma = uri.indexOf(\",\");\n if (firstComma === -1 || firstComma <= 4) {\n throw new Error(\"malformed data: URI\");\n }\n\n // remove the \"data:\" scheme and parse the metadata\n const meta = uri.substring(5, firstComma).split(\";\");\n\n let charset = \"\";\n let base64 = false;\n const type = meta[0] || \"text/plain\";\n let typeFull = type;\n for (let i = 1; i < meta.length; i++) {\n if (meta[i] === \"base64\") {\n base64 = true;\n } else if (meta[i]) {\n typeFull += `;${meta[i]}`;\n if (meta[i]?.indexOf(\"charset=\") === 0) {\n charset = meta[i]!.substring(8);\n }\n }\n }\n\n // defaults to US-ASCII only if type is not provided\n if (!meta[0] && !charset.length) {\n typeFull += \";charset=US-ASCII\";\n charset = \"US-ASCII\";\n }\n\n // get the encoded data portion and decode URI-encoded chars\n const data = unescape(uri.substring(firstComma + 1));\n const buffer = base64\n ? convert.base64ToArrayBuffer(data)\n : convert.stringToBuffer(data);\n\n return {\n type,\n typeFull,\n charset,\n buffer\n };\n };\n"],"mappings":"AAyBA,MAAa,GAAiB,EAAc,IAC1C,QAAQ,EAAK,QAAQ,mBAAmB,EAAK,GAyClC,EACV,GACA,GAAqC,CAGpC,GAFA,EAAM,OAAO,EAAI,CAEb,CAAC,UAAU,KAAK,EAAI,CACtB,MAAU,MACR,mEACD,CAIH,EAAM,EAAI,QAAQ,SAAU,GAAG,CAG/B,IAAM,EAAa,EAAI,QAAQ,IAAI,CACnC,GAAI,IAAe,IAAM,GAAc,EACrC,MAAU,MAAM,sBAAsB,CAIxC,IAAM,EAAO,EAAI,UAAU,EAAG,EAAW,CAAC,MAAM,IAAI,CAEhD,EAAU,GACV,EAAS,GACP,EAAO,EAAK,IAAM,aACpB,EAAW,EACf,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAC3B,EAAK,KAAO,SACd,EAAS,GACA,EAAK,KACd,GAAY,IAAI,EAAK,KACjB,EAAK,IAAI,QAAQ,WAAW,GAAK,IACnC,EAAU,EAAK,GAAI,UAAU,EAAE,GAMjC,CAAC,EAAK,IAAM,CAAC,EAAQ,SACvB,GAAY,oBACZ,EAAU,YAIZ,IAAM,EAAO,SAAS,EAAI,UAAU,EAAa,EAAE,CAAC,CAC9C,EAAS,EACX,EAAQ,oBAAoB,EAAK,CACjC,EAAQ,eAAe,EAAK,CAEhC,MAAO,CACL,OACA,WACA,UACA,SACD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/get-free-port.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Finds and returns a free port on the local machine by creating a temporary server that listens on port 0. The operating system assigns an available port, which is then retrieved and returned.
|
|
4
|
-
*
|
|
5
|
-
* @returns A promise that resolves to a free port number.
|
|
6
|
-
*/
|
|
7
|
-
declare function getFreePort(): Promise<number>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { getFreePort as t };
|
|
10
|
-
//# sourceMappingURL=get-free-port-Bf-x1nt8.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-free-port-Bf-x1nt8.d.cts","names":[],"sources":["../src/get-free-port.ts"],"sourcesContent":[],"mappings":";;AAyBA;;;;iBAAsB,WAAA,CAAA,GAAe"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/get-free-port.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Finds and returns a free port on the local machine by creating a temporary server that listens on port 0. The operating system assigns an available port, which is then retrieved and returned.
|
|
4
|
-
*
|
|
5
|
-
* @returns A promise that resolves to a free port number.
|
|
6
|
-
*/
|
|
7
|
-
declare function getFreePort(): Promise<number>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { getFreePort as t };
|
|
10
|
-
//# sourceMappingURL=get-free-port-BwvXPXFs.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-free-port-BwvXPXFs.d.mts","names":[],"sources":["../src/get-free-port.ts"],"sourcesContent":[],"mappings":";;AAyBA;;;;iBAAsB,WAAA,CAAA,GAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`node:http`);async function n(){return new Promise((e,n)=>{let r=(0,t.createServer)(()=>{});r.listen(0,()=>{let t=r.address();r.close(),t&&typeof t==`object`?e(t.port):n(Error(`invalid address from server: ${t?.toString()}`))})})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createServer as e}from"node:http";async function t(){return new Promise((t,n)=>{let r=e(()=>{});r.listen(0,()=>{let e=r.address();r.close(),e&&typeof e==`object`?t(e.port):n(Error(`invalid address from server: ${e?.toString()}`))})})}export{t};
|
|
2
|
-
//# sourceMappingURL=get-free-port-DvWNGhhy.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-free-port-DvWNGhhy.mjs","names":[],"sources":["../src/get-free-port.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { createServer } from \"node:http\";\n\n/**\n * Finds and returns a free port on the local machine by creating a temporary server that listens on port 0. The operating system assigns an available port, which is then retrieved and returned.\n *\n * @returns A promise that resolves to a free port number.\n */\nexport async function getFreePort(): Promise<number> {\n return new Promise((resolve, reject) => {\n const server = createServer(() => {});\n server.listen(0, () => {\n const address = server.address();\n server.close();\n\n if (address && typeof address === \"object\") {\n resolve(address.port);\n } else {\n reject(\n new Error(`invalid address from server: ${address?.toString()}`)\n );\n }\n });\n });\n}\n"],"mappings":"yCAyBA,eAAsB,GAA+B,CACnD,OAAO,IAAI,SAAS,EAAS,IAAW,CACtC,IAAM,EAAS,MAAmB,GAAG,CACrC,EAAO,OAAO,MAAS,CACrB,IAAM,EAAU,EAAO,SAAS,CAChC,EAAO,OAAO,CAEV,GAAW,OAAO,GAAY,SAChC,EAAQ,EAAQ,KAAK,CAErB,EACM,MAAM,gCAAgC,GAAS,UAAU,GAAG,CACjE,EAEH,EACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./agent-DKevd8Ll.cjs`);let n=require(`node:net`);n=e.t(n);let r=require(`node:buffer`),i=require(`node:events`),a=require(`node:tls`);a=e.t(a);let o=require(`node:url`);var s=class extends t.t{static protocols=[`http`,`https`];proxy;proxyHeaders;connectOpts;constructor(e,t){super(t),this.proxy=typeof e==`string`?new o.URL(e):e,this.proxyHeaders=t?.headers??{};let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?Number.parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={...t?c(t,`headers`):null,host:n,port:r}}addRequest(e,t){e._header=null,this.setRequestProps(e,t),super.addRequest(e,t)}setRequestProps(e,t){let{proxy:n}=this,i=t.secureEndpoint?`https:`:`http:`,a=e.getHeader(`host`)||`localhost`,s=`${i}//${Array.isArray(a)?a.join(``):a}`,c=new o.URL(e.path,s);t.port!==80&&(c.port=String(t.port)),e.path=String(c);let l=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders};if(n.username||n.password){let e=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;l[`Proxy-Authorization`]=`Basic ${r.Buffer.from(e).toString(`base64`)}`}l[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let t of Object.keys(l)){let n=l[t];n&&e.setHeader(t,n)}}async connect(e,t){e._header=null,e.path.includes(`://`)||this.setRequestProps(e,t);let r,o;e._implicitHeader(),e.outputData&&e.outputData.length>0&&(r=e.outputData[0].data,o=r.indexOf(`\r
|
|
2
|
-
\r
|
|
3
|
-
`)+4,e.outputData[0].data=e._header+r.substring(o));let s;return s=this.proxy.protocol===`https:`?a.connect(this.connectOpts):n.connect(this.connectOpts),await(0,i.once)(s,`connect`),s}};function c(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./agent-DrFvt4od.mjs";import*as t from"node:net";import{Buffer as n}from"node:buffer";import{once as r}from"node:events";import*as i from"node:tls";import{URL as a}from"node:url";var o=class extends e{static protocols=[`http`,`https`];proxy;proxyHeaders;connectOpts;constructor(e,t){super(t),this.proxy=typeof e==`string`?new a(e):e,this.proxyHeaders=t?.headers??{};let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,``),r=this.proxy.port?Number.parseInt(this.proxy.port,10):this.proxy.protocol===`https:`?443:80;this.connectOpts={...t?s(t,`headers`):null,host:n,port:r}}addRequest(e,t){e._header=null,this.setRequestProps(e,t),super.addRequest(e,t)}setRequestProps(e,t){let{proxy:r}=this,i=t.secureEndpoint?`https:`:`http:`,o=e.getHeader(`host`)||`localhost`,s=`${i}//${Array.isArray(o)?o.join(``):o}`,c=new a(e.path,s);t.port!==80&&(c.port=String(t.port)),e.path=String(c);let l=typeof this.proxyHeaders==`function`?this.proxyHeaders():{...this.proxyHeaders};if(r.username||r.password){let e=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;l[`Proxy-Authorization`]=`Basic ${n.from(e).toString(`base64`)}`}l[`Proxy-Connection`]||=this.keepAlive?`Keep-Alive`:`close`;for(let t of Object.keys(l)){let n=l[t];n&&e.setHeader(t,n)}}async connect(e,n){e._header=null,e.path.includes(`://`)||this.setRequestProps(e,n);let a,o;e._implicitHeader(),e.outputData&&e.outputData.length>0&&(a=e.outputData[0].data,o=a.indexOf(`\r
|
|
2
|
-
\r
|
|
3
|
-
`)+4,e.outputData[0].data=e._header+a.substring(o));let s;return s=this.proxy.protocol===`https:`?i.connect(this.connectOpts):t.connect(this.connectOpts),await r(s,`connect`),s}};function s(e,...t){let n={},r;for(r in e)t.includes(r)||(n[r]=e[r]);return n}export{o as t};
|
|
4
|
-
//# sourceMappingURL=http-proxy-ChUYEQ71.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-proxy-ChUYEQ71.mjs","names":["headers: OutgoingHttpHeaders","first: string","endOfHeaders: number","socket: net.Socket","key: keyof typeof obj"],"sources":["../src/http-proxy.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AgentConnectOpts } from \"agent-base\";\nimport { Buffer } from \"node:buffer\";\nimport { once } from \"node:events\";\nimport type {\n AgentOptions,\n ClientRequest,\n OutgoingHttpHeaders\n} from \"node:http\";\nimport * as net from \"node:net\";\nimport * as tls from \"node:tls\";\nimport { URL } from \"node:url\";\nimport { Agent } from \"./agent\";\n\ntype Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;\n\ninterface ConnectOptsMap {\n http: Omit<net.TcpNetConnectOpts, \"host\" | \"port\">;\n https: Omit<tls.ConnectionOptions, \"host\" | \"port\">;\n}\n\ntype ConnectOpts<T> = {\n [P in keyof ConnectOptsMap]: Protocol<T> extends P\n ? ConnectOptsMap[P]\n : never;\n}[keyof ConnectOptsMap];\n\nexport type HttpProxyAgentOptions<T> = ConnectOpts<T> &\n AgentOptions & {\n headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n };\n\ninterface HttpProxyAgentClientRequest extends ClientRequest {\n outputData?: {\n data: string;\n }[];\n _header?: string | null;\n _implicitHeader: () => void;\n}\n\n/**\n * The `HttpProxyAgent` implements an HTTP Agent subclass that connects to the specified \"HTTP proxy server\" in order to proxy HTTP requests.\n */\nexport class HttpProxyAgent<Uri extends string> extends Agent {\n static protocols = [\"http\", \"https\"] as const;\n\n readonly proxy: URL;\n\n proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);\n\n connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;\n\n constructor(proxy: Uri | URL, opts?: HttpProxyAgentOptions<Uri>) {\n super(opts);\n this.proxy = typeof proxy === \"string\" ? new URL(proxy) : proxy;\n this.proxyHeaders = opts?.headers ?? {};\n\n // Trim off the brackets from IPv6 addresses\n const host = (this.proxy.hostname || this.proxy.host).replace(\n /^\\[|\\]$/g,\n \"\"\n );\n const port = this.proxy.port\n ? Number.parseInt(this.proxy.port, 10)\n : this.proxy.protocol === \"https:\"\n ? 443\n : 80;\n this.connectOpts = {\n ...(opts ? omit(opts, \"headers\") : null),\n host,\n port\n };\n }\n\n addRequest(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): void {\n req._header = null;\n this.setRequestProps(req, opts);\n\n // @ts-expect-error `addRequest()` isn't defined in `@types/node`\n // eslint-disable-next-line ts/no-unsafe-call\n super.addRequest(req, opts);\n }\n\n setRequestProps(\n req: HttpProxyAgentClientRequest,\n opts: AgentConnectOpts\n ): void {\n const { proxy } = this;\n const protocol = opts.secureEndpoint ? \"https:\" : \"http:\";\n const hostname = req.getHeader(\"host\") || \"localhost\";\n const base = `${protocol}//${Array.isArray(hostname) ? hostname.join(\"\") : hostname}`;\n const url = new URL(req.path, base);\n if (opts.port !== 80) {\n url.port = String(opts.port);\n }\n\n // Change the `http.ClientRequest` instance's \"path\" field\n // to the absolute path of the URL that will be requested.\n req.path = String(url);\n\n // Inject the `Proxy-Authorization` header if necessary.\n\n const headers: OutgoingHttpHeaders =\n typeof this.proxyHeaders === \"function\"\n ? this.proxyHeaders()\n : { ...this.proxyHeaders };\n if (proxy.username || proxy.password) {\n const auth = `${decodeURIComponent(\n proxy.username\n )}:${decodeURIComponent(proxy.password)}`;\n headers[\"Proxy-Authorization\"] = `Basic ${Buffer.from(auth).toString(\n \"base64\"\n )}`;\n }\n\n if (!headers[\"Proxy-Connection\"]) {\n headers[\"Proxy-Connection\"] = this.keepAlive ? \"Keep-Alive\" : \"close\";\n }\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n if (value) {\n req.setHeader(name, value);\n }\n }\n }\n\n async connect(\n req: HttpProxyAgentClientRequest,\n opts: AgentConnectOpts\n ): Promise<net.Socket> {\n req._header = null;\n\n if (!req.path.includes(\"://\")) {\n this.setRequestProps(req, opts);\n }\n\n // At this point, the http ClientRequest's internal `_header` field\n // might have already been set. If this is the case then we'll need\n // to re-generate the string since we just changed the `req.path`.\n let first: string;\n let endOfHeaders: number;\n\n req._implicitHeader();\n if (req.outputData && req.outputData.length > 0) {\n first = req.outputData[0]!.data;\n endOfHeaders = first.indexOf(\"\\r\\n\\r\\n\") + 4;\n req.outputData[0]!.data = req._header + first.substring(endOfHeaders);\n }\n\n // Create a socket connection to the proxy server.\n let socket: net.Socket;\n if (this.proxy.protocol === \"https:\") {\n socket = tls.connect(this.connectOpts);\n } else {\n socket = net.connect(this.connectOpts);\n }\n\n // Wait for the socket's `connect` event, so that this `callback()`\n // function throws instead of the `http` request machinery. This is\n // important for i.e. `PacProxyAgent` which determines a failed proxy\n // connection via the `callback()` function throwing.\n await once(socket, \"connect\");\n\n return socket;\n }\n}\n\nfunction omit<T extends object, K extends [...(keyof T)[]]>(\n obj: T,\n ...keys: K\n): {\n [K2 in Exclude<keyof T, K[number]>]: T[K2];\n} {\n const ret = {} as {\n [K in keyof typeof obj]: (typeof obj)[K];\n };\n let key: keyof typeof obj;\n for (key in obj) {\n if (!keys.includes(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n"],"mappings":"sMA4DA,IAAa,EAAb,cAAwD,CAAM,C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E,CACvC,IAAM,EAAQ,EAAQ,GAClB,GACF,EAAI,UAAU,EAAM,EAAM,EAKhC,MAAM,QACJ,EACA,EACqB,CACrB,EAAI,QAAU,KAET,EAAI,KAAK,SAAS,MAAM,EAC3B,KAAK,gBAAgB,EAAK,EAAK,CAMjC,IAAIC,EACAC,EAEJ,EAAI,iBAAiB,CACjB,EAAI,YAAc,EAAI,WAAW,OAAS,IAC5C,EAAQ,EAAI,WAAW,GAAI,KAC3B,EAAe,EAAM,QAAQ;;EAAW,CAAG,EAC3C,EAAI,WAAW,GAAI,KAAO,EAAI,QAAU,EAAM,UAAU,EAAa,EAIvE,IAAIC,EAaJ,MAZA,CAGE,EAHE,KAAK,MAAM,WAAa,SACjB,EAAI,QAAQ,KAAK,YAAY,CAE7B,EAAI,QAAQ,KAAK,YAAY,CAOxC,MAAM,EAAK,EAAQ,UAAU,CAEtB,IAIX,SAAS,EACP,EACA,GAAG,EAGH,CACA,IAAM,EAAM,EAAE,CAGVC,EACJ,IAAK,KAAO,EACL,EAAK,SAAS,EAAI,GACrB,EAAI,GAAO,EAAI,IAGnB,OAAO"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { t as Agent$1 } from "./agent-Cc4PYJ-j.cjs";
|
|
2
|
-
import { AgentOptions, ClientRequest, OutgoingHttpHeaders } from "node:http";
|
|
3
|
-
import * as net from "node:net";
|
|
4
|
-
import * as tls from "node:tls";
|
|
5
|
-
import { AgentConnectOpts } from "agent-base";
|
|
6
|
-
import { URL } from "node:url";
|
|
7
|
-
|
|
8
|
-
//#region src/http-proxy.d.ts
|
|
9
|
-
type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
|
|
10
|
-
interface ConnectOptsMap {
|
|
11
|
-
http: Omit<net.TcpNetConnectOpts, "host" | "port">;
|
|
12
|
-
https: Omit<tls.ConnectionOptions, "host" | "port">;
|
|
13
|
-
}
|
|
14
|
-
type ConnectOpts<T> = { [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never }[keyof ConnectOptsMap];
|
|
15
|
-
type HttpProxyAgentOptions<T> = ConnectOpts<T> & AgentOptions & {
|
|
16
|
-
headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
17
|
-
};
|
|
18
|
-
interface HttpProxyAgentClientRequest extends ClientRequest {
|
|
19
|
-
outputData?: {
|
|
20
|
-
data: string;
|
|
21
|
-
}[];
|
|
22
|
-
_header?: string | null;
|
|
23
|
-
_implicitHeader: () => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The `HttpProxyAgent` implements an HTTP Agent subclass that connects to the specified "HTTP proxy server" in order to proxy HTTP requests.
|
|
27
|
-
*/
|
|
28
|
-
declare class HttpProxyAgent<Uri extends string> extends Agent$1 {
|
|
29
|
-
static protocols: readonly ["http", "https"];
|
|
30
|
-
readonly proxy: URL;
|
|
31
|
-
proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
32
|
-
connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;
|
|
33
|
-
constructor(proxy: Uri | URL, opts?: HttpProxyAgentOptions<Uri>);
|
|
34
|
-
addRequest(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): void;
|
|
35
|
-
setRequestProps(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): void;
|
|
36
|
-
connect(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): Promise<net.Socket>;
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { HttpProxyAgentOptions as n, HttpProxyAgent as t };
|
|
40
|
-
//# sourceMappingURL=http-proxy-CzvOBKWd.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-proxy-CzvOBKWd.d.cts","names":[],"sources":["../src/http-proxy.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA+BK,cAAc;UAET,cAAA;EAFL,IAAA,EAGG,IAHH,CAGQ,GAAA,CAAI,iBAHG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/EoC,EAAA,IAAA,EAgFnC,gBAhFmC,CAAA,EAiFxC,OAjFwC,CAiFhC,GAAA,CAAI,MAjF4B,CAAA"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { t as Agent$1 } from "./agent-DXIpD4O5.mjs";
|
|
2
|
-
import { AgentOptions, ClientRequest, OutgoingHttpHeaders } from "node:http";
|
|
3
|
-
import * as net from "node:net";
|
|
4
|
-
import * as tls from "node:tls";
|
|
5
|
-
import { URL } from "node:url";
|
|
6
|
-
import { AgentConnectOpts } from "agent-base";
|
|
7
|
-
|
|
8
|
-
//#region src/http-proxy.d.ts
|
|
9
|
-
type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
|
|
10
|
-
interface ConnectOptsMap {
|
|
11
|
-
http: Omit<net.TcpNetConnectOpts, "host" | "port">;
|
|
12
|
-
https: Omit<tls.ConnectionOptions, "host" | "port">;
|
|
13
|
-
}
|
|
14
|
-
type ConnectOpts<T> = { [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never }[keyof ConnectOptsMap];
|
|
15
|
-
type HttpProxyAgentOptions<T> = ConnectOpts<T> & AgentOptions & {
|
|
16
|
-
headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
17
|
-
};
|
|
18
|
-
interface HttpProxyAgentClientRequest extends ClientRequest {
|
|
19
|
-
outputData?: {
|
|
20
|
-
data: string;
|
|
21
|
-
}[];
|
|
22
|
-
_header?: string | null;
|
|
23
|
-
_implicitHeader: () => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The `HttpProxyAgent` implements an HTTP Agent subclass that connects to the specified "HTTP proxy server" in order to proxy HTTP requests.
|
|
27
|
-
*/
|
|
28
|
-
declare class HttpProxyAgent<Uri extends string> extends Agent$1 {
|
|
29
|
-
static protocols: readonly ["http", "https"];
|
|
30
|
-
readonly proxy: URL;
|
|
31
|
-
proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
32
|
-
connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;
|
|
33
|
-
constructor(proxy: Uri | URL, opts?: HttpProxyAgentOptions<Uri>);
|
|
34
|
-
addRequest(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): void;
|
|
35
|
-
setRequestProps(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): void;
|
|
36
|
-
connect(req: HttpProxyAgentClientRequest, opts: AgentConnectOpts): Promise<net.Socket>;
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { HttpProxyAgentOptions as n, HttpProxyAgent as t };
|
|
40
|
-
//# sourceMappingURL=http-proxy-DuPPyvFw.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-proxy-DuPPyvFw.d.mts","names":[],"sources":["../src/http-proxy.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA+BK,cAAc;UAET,cAAA;EAFL,IAAA,EAGG,IAHH,CAGQ,GAAA,CAAI,iBAHG,EAAA,MAAA,GAAA,MAAA,CAAA;EAEV,KAAA,EAED,IAFC,CAEI,GAAA,CAAI,iBAFM,EAAA,MAAA,GAAA,MAAA,CAAA;;KAKnB,WAJG,CAAA,CAAA,CAAA,GAAA,QACU,MAIJ,cAJI,GAIa,QAJb,CAIsB,CAJtB,CAAA,SAIiC,CAJjC,GAKZ,cALY,CAKG,CALH,CAAA,GAAA,KAAA,EAAT,CAAA,MAOD,cAPC,CAAA;AAAI,KASD,qBATC,CAAA,CAAA,CAAA,GAS0B,WAT1B,CASsC,CATtC,CAAA,GAUX,YAVW,GAAA;EAGR,OAAA,CAAA,EAQS,mBARE,GAAA,CAAA,GAAA,GAQ2B,mBAR3B,CAAA;CACF;UAUJ,2BAAA,SAAoC,aAVN,CAAA;EAAT,UAAA,CAAA,EAAA;IAAoB,IAAA,EAAA,MAAA;EAC7C,CAAA,EAAA;EAAe,OAAA,CAAA,EAAA,MAAA,GAAA,IAAA;EAEb,eAAA,EAAA,GAAA,GAAA,IAAA;;AAER;;;AACE,cAeW,cAfX,CAAA,YAAA,MAAA,CAAA,SAesD,OAAA,CAftD;EACY,OAAA,SAAA,EAAA,SAAA,CAAA,MAAA,EAAA,OAAA,CAAA;EAA6B,SAAA,KAAA,EAiBzB,GAjByB;EAAmB,YAAA,EAmB9C,mBAnB8C,GAAA,CAAA,GAAA,GAmBjB,mBAnBiB,CAAA;EAGpD,WAAA,EAkBK,GAAA,CAAI,iBAlBmB,GAkBC,GAAA,CAAI,iBAlBgB;EAW9C,WAAA,CAAA,KAAc,EASN,GATM,GASA,GATA,EAAA,IAAA,CAAA,EASY,qBATZ,CASkC,GATlC,CAAA;EAGT,UAAA,CAAA,GAAA,EA4BA,2BA5BA,EAAA,IAAA,EA4BmC,gBA5BnC,CAAA,EAAA,IAAA;EAEF,eAAA,CAAA,GAAA,EAoCP,2BApCO,EAAA,IAAA,EAqCN,gBArCM,CAAA,EAAA,IAAA;EAA6B,OAAA,CAAA,GAAA,EA+EpC,2BA/EoC,EAAA,IAAA,EAgFnC,gBAhFmC,CAAA,EAiFxC,OAjFwC,CAiFhC,GAAA,CAAI,MAjF4B,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as http from "node:http";
|
|
2
|
-
import { OutgoingHttpHeaders } from "node:http";
|
|
3
|
-
import * as net from "node:net";
|
|
4
|
-
import * as tls from "node:tls";
|
|
5
|
-
import { Agent, AgentConnectOpts } from "agent-base";
|
|
6
|
-
import { URL } from "node:url";
|
|
7
|
-
|
|
8
|
-
//#region src/https-proxy.d.ts
|
|
9
|
-
type Protocol<T> = T extends `${infer Protocol}:${infer _}` ? Protocol : never;
|
|
10
|
-
interface ConnectOptsMap {
|
|
11
|
-
http: Omit<net.TcpNetConnectOpts, "host" | "port">;
|
|
12
|
-
https: Omit<tls.ConnectionOptions, "host" | "port">;
|
|
13
|
-
}
|
|
14
|
-
type ConnectOpts<T> = { [P in keyof ConnectOptsMap]: Protocol<T> extends P ? ConnectOptsMap[P] : never }[keyof ConnectOptsMap];
|
|
15
|
-
type HttpsProxyAgentOptions<T> = ConnectOpts<T> & http.AgentOptions & {
|
|
16
|
-
headers?: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
|
|
20
|
-
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
|
|
21
|
-
*
|
|
22
|
-
* Outgoing HTTP requests are first tunneled through the proxy server using the
|
|
23
|
-
* `CONNECT` HTTP request method to establish a connection to the proxy server,
|
|
24
|
-
* and then the proxy server connects to the destination target and issues the
|
|
25
|
-
* HTTP request from the proxy server.
|
|
26
|
-
*
|
|
27
|
-
* `https:` requests have their socket connection upgraded to TLS once
|
|
28
|
-
* the connection to the proxy server has been established.
|
|
29
|
-
*/
|
|
30
|
-
declare class HttpsProxyAgent<Uri extends string> extends Agent {
|
|
31
|
-
static protocols: readonly ["http", "https"];
|
|
32
|
-
readonly proxy: URL;
|
|
33
|
-
proxyHeaders: OutgoingHttpHeaders | (() => OutgoingHttpHeaders);
|
|
34
|
-
connectOpts: net.TcpNetConnectOpts & tls.ConnectionOptions;
|
|
35
|
-
constructor(proxy: Uri | URL, opts?: HttpsProxyAgentOptions<Uri>);
|
|
36
|
-
/**
|
|
37
|
-
* Called when the node-core HTTP client library is creating a new HTTP request.
|
|
38
|
-
*/
|
|
39
|
-
connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<net.Socket>;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { HttpsProxyAgentOptions as n, HttpsProxyAgent as t };
|
|
43
|
-
//# sourceMappingURL=https-proxy-B8w-jm17.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"https-proxy-B8w-jm17.d.cts","names":[],"sources":["../src/https-proxy.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA+CK,cAA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