opencommit 3.2.19 → 3.2.21
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/out/cli.cjs +1525 -978
- package/package.json +7 -8
package/out/cli.cjs
CHANGED
|
@@ -1545,7 +1545,7 @@ var require_signal_exit = __commonJS({
|
|
|
1545
1545
|
};
|
|
1546
1546
|
};
|
|
1547
1547
|
} else {
|
|
1548
|
-
|
|
1548
|
+
assert2 = require("assert");
|
|
1549
1549
|
signals = require_signals();
|
|
1550
1550
|
isWin = /^win/i.test(process9.platform);
|
|
1551
1551
|
EE = require("events");
|
|
@@ -1568,7 +1568,7 @@ var require_signal_exit = __commonJS({
|
|
|
1568
1568
|
return function() {
|
|
1569
1569
|
};
|
|
1570
1570
|
}
|
|
1571
|
-
|
|
1571
|
+
assert2.equal(typeof cb, "function", "a callback must be provided for exit handler");
|
|
1572
1572
|
if (loaded === false) {
|
|
1573
1573
|
load();
|
|
1574
1574
|
}
|
|
@@ -1674,7 +1674,7 @@ var require_signal_exit = __commonJS({
|
|
|
1674
1674
|
}
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
|
-
var
|
|
1677
|
+
var assert2;
|
|
1678
1678
|
var signals;
|
|
1679
1679
|
var isWin;
|
|
1680
1680
|
var EE;
|
|
@@ -2043,11 +2043,11 @@ var require_main = __commonJS({
|
|
|
2043
2043
|
function configDotenv(options) {
|
|
2044
2044
|
const dotenvPath = path5.resolve(process.cwd(), ".env");
|
|
2045
2045
|
let encoding = "utf8";
|
|
2046
|
-
const
|
|
2046
|
+
const debug5 = Boolean(options && options.debug);
|
|
2047
2047
|
if (options && options.encoding) {
|
|
2048
2048
|
encoding = options.encoding;
|
|
2049
2049
|
} else {
|
|
2050
|
-
if (
|
|
2050
|
+
if (debug5) {
|
|
2051
2051
|
_debug("No encoding is specified. UTF-8 is used by default");
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
@@ -2069,7 +2069,7 @@ var require_main = __commonJS({
|
|
|
2069
2069
|
const parsed = DotenvModule.parse(fs7.readFileSync(path6, { encoding }));
|
|
2070
2070
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
2071
2071
|
} catch (e3) {
|
|
2072
|
-
if (
|
|
2072
|
+
if (debug5) {
|
|
2073
2073
|
_debug(`Failed to load ${path6} ${e3.message}`);
|
|
2074
2074
|
}
|
|
2075
2075
|
lastError = e3;
|
|
@@ -2125,7 +2125,7 @@ var require_main = __commonJS({
|
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
2127
|
function populate(processEnv, parsed, options = {}) {
|
|
2128
|
-
const
|
|
2128
|
+
const debug5 = Boolean(options && options.debug);
|
|
2129
2129
|
const override = Boolean(options && options.override);
|
|
2130
2130
|
if (typeof parsed !== "object") {
|
|
2131
2131
|
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
@@ -2137,7 +2137,7 @@ var require_main = __commonJS({
|
|
|
2137
2137
|
if (override === true) {
|
|
2138
2138
|
processEnv[key] = parsed[key];
|
|
2139
2139
|
}
|
|
2140
|
-
if (
|
|
2140
|
+
if (debug5) {
|
|
2141
2141
|
if (override === true) {
|
|
2142
2142
|
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
2143
2143
|
} else {
|
|
@@ -5581,7 +5581,7 @@ var require_URL = __commonJS({
|
|
|
5581
5581
|
return;
|
|
5582
5582
|
}
|
|
5583
5583
|
const ctorRegistry = utils.initCtorRegistry(globalObject);
|
|
5584
|
-
class
|
|
5584
|
+
class URL3 {
|
|
5585
5585
|
constructor(url2) {
|
|
5586
5586
|
if (arguments.length < 1) {
|
|
5587
5587
|
throw new globalObject.TypeError(
|
|
@@ -5874,7 +5874,7 @@ var require_URL = __commonJS({
|
|
|
5874
5874
|
return Impl.implementation.canParse(...args);
|
|
5875
5875
|
}
|
|
5876
5876
|
}
|
|
5877
|
-
Object.defineProperties(
|
|
5877
|
+
Object.defineProperties(URL3.prototype, {
|
|
5878
5878
|
toJSON: { enumerable: true },
|
|
5879
5879
|
href: { enumerable: true },
|
|
5880
5880
|
toString: { enumerable: true },
|
|
@@ -5891,18 +5891,18 @@ var require_URL = __commonJS({
|
|
|
5891
5891
|
hash: { enumerable: true },
|
|
5892
5892
|
[Symbol.toStringTag]: { value: "URL", configurable: true }
|
|
5893
5893
|
});
|
|
5894
|
-
Object.defineProperties(
|
|
5895
|
-
ctorRegistry[interfaceName] =
|
|
5894
|
+
Object.defineProperties(URL3, { parse: { enumerable: true }, canParse: { enumerable: true } });
|
|
5895
|
+
ctorRegistry[interfaceName] = URL3;
|
|
5896
5896
|
Object.defineProperty(globalObject, interfaceName, {
|
|
5897
5897
|
configurable: true,
|
|
5898
5898
|
writable: true,
|
|
5899
|
-
value:
|
|
5899
|
+
value: URL3
|
|
5900
5900
|
});
|
|
5901
5901
|
if (globalNames.includes("Window")) {
|
|
5902
5902
|
Object.defineProperty(globalObject, "webkitURL", {
|
|
5903
5903
|
configurable: true,
|
|
5904
5904
|
writable: true,
|
|
5905
|
-
value:
|
|
5905
|
+
value: URL3
|
|
5906
5906
|
});
|
|
5907
5907
|
}
|
|
5908
5908
|
};
|
|
@@ -5914,9 +5914,9 @@ var require_URL = __commonJS({
|
|
|
5914
5914
|
var require_webidl2js_wrapper = __commonJS({
|
|
5915
5915
|
"node_modules/whatwg-url/webidl2js-wrapper.js"(exports2) {
|
|
5916
5916
|
"use strict";
|
|
5917
|
-
var
|
|
5917
|
+
var URL3 = require_URL();
|
|
5918
5918
|
var URLSearchParams2 = require_URLSearchParams();
|
|
5919
|
-
exports2.URL =
|
|
5919
|
+
exports2.URL = URL3;
|
|
5920
5920
|
exports2.URLSearchParams = URLSearchParams2;
|
|
5921
5921
|
}
|
|
5922
5922
|
});
|
|
@@ -5925,11 +5925,11 @@ var require_webidl2js_wrapper = __commonJS({
|
|
|
5925
5925
|
var require_whatwg_url = __commonJS({
|
|
5926
5926
|
"node_modules/whatwg-url/index.js"(exports2) {
|
|
5927
5927
|
"use strict";
|
|
5928
|
-
var { URL:
|
|
5928
|
+
var { URL: URL3, URLSearchParams: URLSearchParams2 } = require_webidl2js_wrapper();
|
|
5929
5929
|
var urlStateMachine = require_url_state_machine();
|
|
5930
5930
|
var percentEncoding = require_percent_encoding();
|
|
5931
5931
|
var sharedGlobalObject = { Array, Object, Promise, String, TypeError };
|
|
5932
|
-
|
|
5932
|
+
URL3.install(sharedGlobalObject, ["Window"]);
|
|
5933
5933
|
URLSearchParams2.install(sharedGlobalObject, ["Window"]);
|
|
5934
5934
|
exports2.URL = sharedGlobalObject.URL;
|
|
5935
5935
|
exports2.URLSearchParams = sharedGlobalObject.URLSearchParams;
|
|
@@ -5958,7 +5958,7 @@ var require_lib2 = __commonJS({
|
|
|
5958
5958
|
return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
|
|
5959
5959
|
}
|
|
5960
5960
|
var Stream3 = _interopDefault(require("stream"));
|
|
5961
|
-
var
|
|
5961
|
+
var http4 = _interopDefault(require("http"));
|
|
5962
5962
|
var Url = _interopDefault(require("url"));
|
|
5963
5963
|
var whatwgUrl = _interopDefault(require_whatwg_url());
|
|
5964
5964
|
var https3 = _interopDefault(require("https"));
|
|
@@ -6628,10 +6628,10 @@ var require_lib2 = __commonJS({
|
|
|
6628
6628
|
return [k7.toLowerCase(), headers[MAP][k7].join(", ")];
|
|
6629
6629
|
});
|
|
6630
6630
|
}
|
|
6631
|
-
var
|
|
6631
|
+
var INTERNAL2 = Symbol("internal");
|
|
6632
6632
|
function createHeadersIterator(target, kind3) {
|
|
6633
6633
|
const iterator2 = Object.create(HeadersIteratorPrototype);
|
|
6634
|
-
iterator2[
|
|
6634
|
+
iterator2[INTERNAL2] = {
|
|
6635
6635
|
target,
|
|
6636
6636
|
kind: kind3,
|
|
6637
6637
|
index: 0
|
|
@@ -6643,7 +6643,7 @@ var require_lib2 = __commonJS({
|
|
|
6643
6643
|
if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
|
|
6644
6644
|
throw new TypeError("Value of `this` is not a HeadersIterator");
|
|
6645
6645
|
}
|
|
6646
|
-
var _INTERNAL = this[
|
|
6646
|
+
var _INTERNAL = this[INTERNAL2];
|
|
6647
6647
|
const target = _INTERNAL.target, kind3 = _INTERNAL.kind, index = _INTERNAL.index;
|
|
6648
6648
|
const values = getHeaders2(target, kind3);
|
|
6649
6649
|
const len = values.length;
|
|
@@ -6653,7 +6653,7 @@ var require_lib2 = __commonJS({
|
|
|
6653
6653
|
done: true
|
|
6654
6654
|
};
|
|
6655
6655
|
}
|
|
6656
|
-
this[
|
|
6656
|
+
this[INTERNAL2].index = index + 1;
|
|
6657
6657
|
return {
|
|
6658
6658
|
value: values[index],
|
|
6659
6659
|
done: false
|
|
@@ -6698,7 +6698,7 @@ var require_lib2 = __commonJS({
|
|
|
6698
6698
|
return headers;
|
|
6699
6699
|
}
|
|
6700
6700
|
var INTERNALS$1 = Symbol("Response internals");
|
|
6701
|
-
var STATUS_CODES =
|
|
6701
|
+
var STATUS_CODES = http4.STATUS_CODES;
|
|
6702
6702
|
var Response6 = class _Response {
|
|
6703
6703
|
constructor() {
|
|
6704
6704
|
let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
@@ -6774,12 +6774,12 @@ var require_lib2 = __commonJS({
|
|
|
6774
6774
|
configurable: true
|
|
6775
6775
|
});
|
|
6776
6776
|
var INTERNALS$2 = Symbol("Request internals");
|
|
6777
|
-
var
|
|
6777
|
+
var URL3 = Url.URL || whatwgUrl.URL;
|
|
6778
6778
|
var parse_url = Url.parse;
|
|
6779
6779
|
var format_url = Url.format;
|
|
6780
6780
|
function parseURL(urlStr) {
|
|
6781
6781
|
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
|
|
6782
|
-
urlStr = new
|
|
6782
|
+
urlStr = new URL3(urlStr).toString();
|
|
6783
6783
|
}
|
|
6784
6784
|
return parse_url(urlStr);
|
|
6785
6785
|
}
|
|
@@ -6951,7 +6951,7 @@ var require_lib2 = __commonJS({
|
|
|
6951
6951
|
return new fetch4.Promise(function(resolve, reject) {
|
|
6952
6952
|
const request3 = new Request6(url2, opts);
|
|
6953
6953
|
const options = getNodeRequestOptions(request3);
|
|
6954
|
-
const send = (options.protocol === "https:" ? https3 :
|
|
6954
|
+
const send = (options.protocol === "https:" ? https3 : http4).request;
|
|
6955
6955
|
const signal = request3.signal;
|
|
6956
6956
|
let response = null;
|
|
6957
6957
|
const abort = function abort2() {
|
|
@@ -9409,7 +9409,7 @@ var require_agent = __commonJS({
|
|
|
9409
9409
|
"use strict";
|
|
9410
9410
|
var OriginalAgent = require("http").Agent;
|
|
9411
9411
|
var ms = require_humanize_ms();
|
|
9412
|
-
var
|
|
9412
|
+
var debug5 = require("util").debuglog("agentkeepalive");
|
|
9413
9413
|
var {
|
|
9414
9414
|
INIT_SOCKET,
|
|
9415
9415
|
CURRENT_ID,
|
|
@@ -9429,7 +9429,7 @@ var require_agent = __commonJS({
|
|
|
9429
9429
|
function deprecate2(message) {
|
|
9430
9430
|
console.log("[agentkeepalive:deprecated] %s", message);
|
|
9431
9431
|
}
|
|
9432
|
-
var
|
|
9432
|
+
var Agent6 = class extends OriginalAgent {
|
|
9433
9433
|
constructor(options) {
|
|
9434
9434
|
options = options || {};
|
|
9435
9435
|
options.keepAlive = options.keepAlive !== false;
|
|
@@ -9511,7 +9511,7 @@ var require_agent = __commonJS({
|
|
|
9511
9511
|
return true;
|
|
9512
9512
|
}
|
|
9513
9513
|
if (customTimeout <= 0) {
|
|
9514
|
-
|
|
9514
|
+
debug5(
|
|
9515
9515
|
"%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",
|
|
9516
9516
|
socket[SOCKET_NAME],
|
|
9517
9517
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9534,10 +9534,10 @@ var require_agent = __commonJS({
|
|
|
9534
9534
|
const agentTimeout = this.options.timeout;
|
|
9535
9535
|
if (getSocketTimeout(socket) !== agentTimeout) {
|
|
9536
9536
|
socket.setTimeout(agentTimeout);
|
|
9537
|
-
|
|
9537
|
+
debug5("%s reset timeout to %sms", socket[SOCKET_NAME], agentTimeout);
|
|
9538
9538
|
}
|
|
9539
9539
|
socket[SOCKET_REQUEST_COUNT]++;
|
|
9540
|
-
|
|
9540
|
+
debug5(
|
|
9541
9541
|
"%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",
|
|
9542
9542
|
socket[SOCKET_NAME],
|
|
9543
9543
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9615,12 +9615,12 @@ var require_agent = __commonJS({
|
|
|
9615
9615
|
return socket.timeout || socket._idleTimeout;
|
|
9616
9616
|
}
|
|
9617
9617
|
function installListeners(agent, socket, options) {
|
|
9618
|
-
|
|
9618
|
+
debug5("%s create, timeout %sms", socket[SOCKET_NAME], getSocketTimeout(socket));
|
|
9619
9619
|
function onFree() {
|
|
9620
9620
|
if (!socket._httpMessage && socket[SOCKET_REQUEST_COUNT] === 1) return;
|
|
9621
9621
|
socket[SOCKET_REQUEST_FINISHED_COUNT]++;
|
|
9622
9622
|
agent.requestCount++;
|
|
9623
|
-
|
|
9623
|
+
debug5(
|
|
9624
9624
|
"%s(requests: %s, finished: %s) free",
|
|
9625
9625
|
socket[SOCKET_NAME],
|
|
9626
9626
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9629,7 +9629,7 @@ var require_agent = __commonJS({
|
|
|
9629
9629
|
const name = agent.getName(options);
|
|
9630
9630
|
if (socket.writable && agent.requests[name] && agent.requests[name].length) {
|
|
9631
9631
|
socket[SOCKET_REQUEST_COUNT]++;
|
|
9632
|
-
|
|
9632
|
+
debug5(
|
|
9633
9633
|
"%s(requests: %s, finished: %s) will be reuse on agent free event",
|
|
9634
9634
|
socket[SOCKET_NAME],
|
|
9635
9635
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9639,7 +9639,7 @@ var require_agent = __commonJS({
|
|
|
9639
9639
|
}
|
|
9640
9640
|
socket.on("free", onFree);
|
|
9641
9641
|
function onClose(isError2) {
|
|
9642
|
-
|
|
9642
|
+
debug5(
|
|
9643
9643
|
"%s(requests: %s, finished: %s) close, isError: %s",
|
|
9644
9644
|
socket[SOCKET_NAME],
|
|
9645
9645
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9654,7 +9654,7 @@ var require_agent = __commonJS({
|
|
|
9654
9654
|
const timeout = getSocketTimeout(socket);
|
|
9655
9655
|
const req = socket._httpMessage;
|
|
9656
9656
|
const reqTimeoutListenerCount = req && req.listeners("timeout").length || 0;
|
|
9657
|
-
|
|
9657
|
+
debug5(
|
|
9658
9658
|
"%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",
|
|
9659
9659
|
socket[SOCKET_NAME],
|
|
9660
9660
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9665,15 +9665,15 @@ var require_agent = __commonJS({
|
|
|
9665
9665
|
!!req,
|
|
9666
9666
|
reqTimeoutListenerCount
|
|
9667
9667
|
);
|
|
9668
|
-
if (
|
|
9669
|
-
|
|
9668
|
+
if (debug5.enabled) {
|
|
9669
|
+
debug5("timeout listeners: %s", socket.listeners("timeout").map((f4) => f4.name).join(", "));
|
|
9670
9670
|
}
|
|
9671
9671
|
agent.timeoutSocketCount++;
|
|
9672
9672
|
const name = agent.getName(options);
|
|
9673
9673
|
if (agent.freeSockets[name] && agent.freeSockets[name].indexOf(socket) !== -1) {
|
|
9674
9674
|
socket.destroy();
|
|
9675
9675
|
agent.removeSocket(socket, options);
|
|
9676
|
-
|
|
9676
|
+
debug5("%s is free, destroy quietly", socket[SOCKET_NAME]);
|
|
9677
9677
|
} else {
|
|
9678
9678
|
if (reqTimeoutListenerCount === 0) {
|
|
9679
9679
|
const error = new Error("Socket timeout");
|
|
@@ -9681,14 +9681,14 @@ var require_agent = __commonJS({
|
|
|
9681
9681
|
error.timeout = timeout;
|
|
9682
9682
|
socket.destroy(error);
|
|
9683
9683
|
agent.removeSocket(socket, options);
|
|
9684
|
-
|
|
9684
|
+
debug5("%s destroy with timeout error", socket[SOCKET_NAME]);
|
|
9685
9685
|
}
|
|
9686
9686
|
}
|
|
9687
9687
|
}
|
|
9688
9688
|
socket.on("timeout", onTimeout);
|
|
9689
9689
|
function onError(err) {
|
|
9690
9690
|
const listenerCount = socket.listeners("error").length;
|
|
9691
|
-
|
|
9691
|
+
debug5(
|
|
9692
9692
|
"%s(requests: %s, finished: %s) error: %s, listenerCount: %s",
|
|
9693
9693
|
socket[SOCKET_NAME],
|
|
9694
9694
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9698,14 +9698,14 @@ var require_agent = __commonJS({
|
|
|
9698
9698
|
);
|
|
9699
9699
|
agent.errorSocketCount++;
|
|
9700
9700
|
if (listenerCount === 1) {
|
|
9701
|
-
|
|
9701
|
+
debug5("%s emit uncaught error event", socket[SOCKET_NAME]);
|
|
9702
9702
|
socket.removeListener("error", onError);
|
|
9703
9703
|
socket.emit("error", err);
|
|
9704
9704
|
}
|
|
9705
9705
|
}
|
|
9706
9706
|
socket.on("error", onError);
|
|
9707
9707
|
function onRemove() {
|
|
9708
|
-
|
|
9708
|
+
debug5(
|
|
9709
9709
|
"%s(requests: %s, finished: %s) agentRemove",
|
|
9710
9710
|
socket[SOCKET_NAME],
|
|
9711
9711
|
socket[SOCKET_REQUEST_COUNT],
|
|
@@ -9719,7 +9719,7 @@ var require_agent = __commonJS({
|
|
|
9719
9719
|
}
|
|
9720
9720
|
socket.on("agentRemove", onRemove);
|
|
9721
9721
|
}
|
|
9722
|
-
module2.exports =
|
|
9722
|
+
module2.exports = Agent6;
|
|
9723
9723
|
function inspect3(obj) {
|
|
9724
9724
|
const res = {};
|
|
9725
9725
|
for (const key in obj) {
|
|
@@ -9740,7 +9740,7 @@ var require_https_agent = __commonJS({
|
|
|
9740
9740
|
INIT_SOCKET,
|
|
9741
9741
|
CREATE_HTTPS_CONNECTION
|
|
9742
9742
|
} = require_constants();
|
|
9743
|
-
var
|
|
9743
|
+
var HttpsAgent2 = class extends HttpAgent {
|
|
9744
9744
|
constructor(options) {
|
|
9745
9745
|
super(options);
|
|
9746
9746
|
this.defaultPort = 443;
|
|
@@ -9760,7 +9760,7 @@ var require_https_agent = __commonJS({
|
|
|
9760
9760
|
return socket;
|
|
9761
9761
|
}
|
|
9762
9762
|
};
|
|
9763
|
-
|
|
9763
|
+
HttpsAgent2.prototype[CREATE_HTTPS_CONNECTION] = OriginalHttpsAgent.prototype.createConnection;
|
|
9764
9764
|
[
|
|
9765
9765
|
"getName",
|
|
9766
9766
|
"_getSession",
|
|
@@ -9769,10 +9769,10 @@ var require_https_agent = __commonJS({
|
|
|
9769
9769
|
"_evictSession"
|
|
9770
9770
|
].forEach(function(method) {
|
|
9771
9771
|
if (typeof OriginalHttpsAgent.prototype[method] === "function") {
|
|
9772
|
-
|
|
9772
|
+
HttpsAgent2.prototype[method] = OriginalHttpsAgent.prototype[method];
|
|
9773
9773
|
}
|
|
9774
9774
|
});
|
|
9775
|
-
module2.exports =
|
|
9775
|
+
module2.exports = HttpsAgent2;
|
|
9776
9776
|
}
|
|
9777
9777
|
});
|
|
9778
9778
|
|
|
@@ -14857,46 +14857,46 @@ var init_fileFromPath = __esm({
|
|
|
14857
14857
|
var require_common = __commonJS({
|
|
14858
14858
|
"node_modules/debug/src/common.js"(exports2, module2) {
|
|
14859
14859
|
function setup(env2) {
|
|
14860
|
-
|
|
14861
|
-
|
|
14862
|
-
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14860
|
+
createDebug3.debug = createDebug3;
|
|
14861
|
+
createDebug3.default = createDebug3;
|
|
14862
|
+
createDebug3.coerce = coerce;
|
|
14863
|
+
createDebug3.disable = disable2;
|
|
14864
|
+
createDebug3.enable = enable2;
|
|
14865
|
+
createDebug3.enabled = enabled2;
|
|
14866
|
+
createDebug3.humanize = require_ms();
|
|
14867
|
+
createDebug3.destroy = destroy2;
|
|
14868
14868
|
Object.keys(env2).forEach((key) => {
|
|
14869
|
-
|
|
14869
|
+
createDebug3[key] = env2[key];
|
|
14870
14870
|
});
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14871
|
+
createDebug3.names = [];
|
|
14872
|
+
createDebug3.skips = [];
|
|
14873
|
+
createDebug3.formatters = {};
|
|
14874
14874
|
function selectColor(namespace) {
|
|
14875
14875
|
let hash = 0;
|
|
14876
14876
|
for (let i3 = 0; i3 < namespace.length; i3++) {
|
|
14877
14877
|
hash = (hash << 5) - hash + namespace.charCodeAt(i3);
|
|
14878
14878
|
hash |= 0;
|
|
14879
14879
|
}
|
|
14880
|
-
return
|
|
14880
|
+
return createDebug3.colors[Math.abs(hash) % createDebug3.colors.length];
|
|
14881
14881
|
}
|
|
14882
|
-
|
|
14883
|
-
function
|
|
14882
|
+
createDebug3.selectColor = selectColor;
|
|
14883
|
+
function createDebug3(namespace) {
|
|
14884
14884
|
let prevTime;
|
|
14885
14885
|
let enableOverride = null;
|
|
14886
14886
|
let namespacesCache;
|
|
14887
14887
|
let enabledCache;
|
|
14888
|
-
function
|
|
14889
|
-
if (!
|
|
14888
|
+
function debug5(...args) {
|
|
14889
|
+
if (!debug5.enabled) {
|
|
14890
14890
|
return;
|
|
14891
14891
|
}
|
|
14892
|
-
const self2 =
|
|
14892
|
+
const self2 = debug5;
|
|
14893
14893
|
const curr = Number(/* @__PURE__ */ new Date());
|
|
14894
14894
|
const ms = curr - (prevTime || curr);
|
|
14895
14895
|
self2.diff = ms;
|
|
14896
14896
|
self2.prev = prevTime;
|
|
14897
14897
|
self2.curr = curr;
|
|
14898
14898
|
prevTime = curr;
|
|
14899
|
-
args[0] =
|
|
14899
|
+
args[0] = createDebug3.coerce(args[0]);
|
|
14900
14900
|
if (typeof args[0] !== "string") {
|
|
14901
14901
|
args.unshift("%O");
|
|
14902
14902
|
}
|
|
@@ -14906,7 +14906,7 @@ var require_common = __commonJS({
|
|
|
14906
14906
|
return "%";
|
|
14907
14907
|
}
|
|
14908
14908
|
index++;
|
|
14909
|
-
const formatter =
|
|
14909
|
+
const formatter = createDebug3.formatters[format];
|
|
14910
14910
|
if (typeof formatter === "function") {
|
|
14911
14911
|
const val = args[index];
|
|
14912
14912
|
match = formatter.call(self2, val);
|
|
@@ -14915,25 +14915,25 @@ var require_common = __commonJS({
|
|
|
14915
14915
|
}
|
|
14916
14916
|
return match;
|
|
14917
14917
|
});
|
|
14918
|
-
|
|
14919
|
-
const logFn = self2.log ||
|
|
14918
|
+
createDebug3.formatArgs.call(self2, args);
|
|
14919
|
+
const logFn = self2.log || createDebug3.log;
|
|
14920
14920
|
logFn.apply(self2, args);
|
|
14921
14921
|
}
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
Object.defineProperty(
|
|
14922
|
+
debug5.namespace = namespace;
|
|
14923
|
+
debug5.useColors = createDebug3.useColors();
|
|
14924
|
+
debug5.color = createDebug3.selectColor(namespace);
|
|
14925
|
+
debug5.extend = extend3;
|
|
14926
|
+
debug5.destroy = createDebug3.destroy;
|
|
14927
|
+
Object.defineProperty(debug5, "enabled", {
|
|
14928
14928
|
enumerable: true,
|
|
14929
14929
|
configurable: false,
|
|
14930
14930
|
get: () => {
|
|
14931
14931
|
if (enableOverride !== null) {
|
|
14932
14932
|
return enableOverride;
|
|
14933
14933
|
}
|
|
14934
|
-
if (namespacesCache !==
|
|
14935
|
-
namespacesCache =
|
|
14936
|
-
enabledCache =
|
|
14934
|
+
if (namespacesCache !== createDebug3.namespaces) {
|
|
14935
|
+
namespacesCache = createDebug3.namespaces;
|
|
14936
|
+
enabledCache = createDebug3.enabled(namespace);
|
|
14937
14937
|
}
|
|
14938
14938
|
return enabledCache;
|
|
14939
14939
|
},
|
|
@@ -14941,21 +14941,21 @@ var require_common = __commonJS({
|
|
|
14941
14941
|
enableOverride = v5;
|
|
14942
14942
|
}
|
|
14943
14943
|
});
|
|
14944
|
-
if (typeof
|
|
14945
|
-
|
|
14944
|
+
if (typeof createDebug3.init === "function") {
|
|
14945
|
+
createDebug3.init(debug5);
|
|
14946
14946
|
}
|
|
14947
|
-
return
|
|
14947
|
+
return debug5;
|
|
14948
14948
|
}
|
|
14949
14949
|
function extend3(namespace, delimiter) {
|
|
14950
|
-
const newDebug =
|
|
14950
|
+
const newDebug = createDebug3(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
14951
14951
|
newDebug.log = this.log;
|
|
14952
14952
|
return newDebug;
|
|
14953
14953
|
}
|
|
14954
14954
|
function enable2(namespaces) {
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14955
|
+
createDebug3.save(namespaces);
|
|
14956
|
+
createDebug3.namespaces = namespaces;
|
|
14957
|
+
createDebug3.names = [];
|
|
14958
|
+
createDebug3.skips = [];
|
|
14959
14959
|
let i3;
|
|
14960
14960
|
const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
14961
14961
|
const len = split.length;
|
|
@@ -14965,18 +14965,18 @@ var require_common = __commonJS({
|
|
|
14965
14965
|
}
|
|
14966
14966
|
namespaces = split[i3].replace(/\*/g, ".*?");
|
|
14967
14967
|
if (namespaces[0] === "-") {
|
|
14968
|
-
|
|
14968
|
+
createDebug3.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
|
|
14969
14969
|
} else {
|
|
14970
|
-
|
|
14970
|
+
createDebug3.names.push(new RegExp("^" + namespaces + "$"));
|
|
14971
14971
|
}
|
|
14972
14972
|
}
|
|
14973
14973
|
}
|
|
14974
14974
|
function disable2() {
|
|
14975
14975
|
const namespaces = [
|
|
14976
|
-
...
|
|
14977
|
-
...
|
|
14976
|
+
...createDebug3.names.map(toNamespace),
|
|
14977
|
+
...createDebug3.skips.map(toNamespace).map((namespace) => "-" + namespace)
|
|
14978
14978
|
].join(",");
|
|
14979
|
-
|
|
14979
|
+
createDebug3.enable("");
|
|
14980
14980
|
return namespaces;
|
|
14981
14981
|
}
|
|
14982
14982
|
function enabled2(name) {
|
|
@@ -14985,13 +14985,13 @@ var require_common = __commonJS({
|
|
|
14985
14985
|
}
|
|
14986
14986
|
let i3;
|
|
14987
14987
|
let len;
|
|
14988
|
-
for (i3 = 0, len =
|
|
14989
|
-
if (
|
|
14988
|
+
for (i3 = 0, len = createDebug3.skips.length; i3 < len; i3++) {
|
|
14989
|
+
if (createDebug3.skips[i3].test(name)) {
|
|
14990
14990
|
return false;
|
|
14991
14991
|
}
|
|
14992
14992
|
}
|
|
14993
|
-
for (i3 = 0, len =
|
|
14994
|
-
if (
|
|
14993
|
+
for (i3 = 0, len = createDebug3.names.length; i3 < len; i3++) {
|
|
14994
|
+
if (createDebug3.names[i3].test(name)) {
|
|
14995
14995
|
return true;
|
|
14996
14996
|
}
|
|
14997
14997
|
}
|
|
@@ -15009,8 +15009,8 @@ var require_common = __commonJS({
|
|
|
15009
15009
|
function destroy2() {
|
|
15010
15010
|
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
15011
15011
|
}
|
|
15012
|
-
|
|
15013
|
-
return
|
|
15012
|
+
createDebug3.enable(createDebug3.load());
|
|
15013
|
+
return createDebug3;
|
|
15014
15014
|
}
|
|
15015
15015
|
module2.exports = setup;
|
|
15016
15016
|
}
|
|
@@ -15454,11 +15454,11 @@ var require_node = __commonJS({
|
|
|
15454
15454
|
function load() {
|
|
15455
15455
|
return process.env.DEBUG;
|
|
15456
15456
|
}
|
|
15457
|
-
function init(
|
|
15458
|
-
|
|
15457
|
+
function init(debug5) {
|
|
15458
|
+
debug5.inspectOpts = {};
|
|
15459
15459
|
const keys = Object.keys(exports2.inspectOpts);
|
|
15460
15460
|
for (let i3 = 0; i3 < keys.length; i3++) {
|
|
15461
|
-
|
|
15461
|
+
debug5.inspectOpts[keys[i3]] = exports2.inspectOpts[keys[i3]];
|
|
15462
15462
|
}
|
|
15463
15463
|
}
|
|
15464
15464
|
module2.exports = require_common()(exports2);
|
|
@@ -15485,471 +15485,6 @@ var require_src2 = __commonJS({
|
|
|
15485
15485
|
}
|
|
15486
15486
|
});
|
|
15487
15487
|
|
|
15488
|
-
// node_modules/agent-base/dist/helpers.js
|
|
15489
|
-
var require_helpers = __commonJS({
|
|
15490
|
-
"node_modules/agent-base/dist/helpers.js"(exports2) {
|
|
15491
|
-
"use strict";
|
|
15492
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
15493
|
-
if (k22 === void 0) k22 = k7;
|
|
15494
|
-
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
15495
|
-
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
15496
|
-
desc = { enumerable: true, get: function() {
|
|
15497
|
-
return m5[k7];
|
|
15498
|
-
} };
|
|
15499
|
-
}
|
|
15500
|
-
Object.defineProperty(o3, k22, desc);
|
|
15501
|
-
} : function(o3, m5, k7, k22) {
|
|
15502
|
-
if (k22 === void 0) k22 = k7;
|
|
15503
|
-
o3[k22] = m5[k7];
|
|
15504
|
-
});
|
|
15505
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
15506
|
-
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
15507
|
-
} : function(o3, v5) {
|
|
15508
|
-
o3["default"] = v5;
|
|
15509
|
-
});
|
|
15510
|
-
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
15511
|
-
if (mod && mod.__esModule) return mod;
|
|
15512
|
-
var result = {};
|
|
15513
|
-
if (mod != null) {
|
|
15514
|
-
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
15515
|
-
}
|
|
15516
|
-
__setModuleDefault(result, mod);
|
|
15517
|
-
return result;
|
|
15518
|
-
};
|
|
15519
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15520
|
-
exports2.req = exports2.json = exports2.toBuffer = void 0;
|
|
15521
|
-
var http3 = __importStar(require("http"));
|
|
15522
|
-
var https3 = __importStar(require("https"));
|
|
15523
|
-
async function toBuffer(stream4) {
|
|
15524
|
-
let length = 0;
|
|
15525
|
-
const chunks = [];
|
|
15526
|
-
for await (const chunk of stream4) {
|
|
15527
|
-
length += chunk.length;
|
|
15528
|
-
chunks.push(chunk);
|
|
15529
|
-
}
|
|
15530
|
-
return Buffer.concat(chunks, length);
|
|
15531
|
-
}
|
|
15532
|
-
exports2.toBuffer = toBuffer;
|
|
15533
|
-
async function json(stream4) {
|
|
15534
|
-
const buf = await toBuffer(stream4);
|
|
15535
|
-
const str2 = buf.toString("utf8");
|
|
15536
|
-
try {
|
|
15537
|
-
return JSON.parse(str2);
|
|
15538
|
-
} catch (_err) {
|
|
15539
|
-
const err = _err;
|
|
15540
|
-
err.message += ` (input: ${str2})`;
|
|
15541
|
-
throw err;
|
|
15542
|
-
}
|
|
15543
|
-
}
|
|
15544
|
-
exports2.json = json;
|
|
15545
|
-
function req(url2, opts = {}) {
|
|
15546
|
-
const href = typeof url2 === "string" ? url2 : url2.href;
|
|
15547
|
-
const req2 = (href.startsWith("https:") ? https3 : http3).request(url2, opts);
|
|
15548
|
-
const promise = new Promise((resolve, reject) => {
|
|
15549
|
-
req2.once("response", resolve).once("error", reject).end();
|
|
15550
|
-
});
|
|
15551
|
-
req2.then = promise.then.bind(promise);
|
|
15552
|
-
return req2;
|
|
15553
|
-
}
|
|
15554
|
-
exports2.req = req;
|
|
15555
|
-
}
|
|
15556
|
-
});
|
|
15557
|
-
|
|
15558
|
-
// node_modules/agent-base/dist/index.js
|
|
15559
|
-
var require_dist = __commonJS({
|
|
15560
|
-
"node_modules/agent-base/dist/index.js"(exports2) {
|
|
15561
|
-
"use strict";
|
|
15562
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
15563
|
-
if (k22 === void 0) k22 = k7;
|
|
15564
|
-
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
15565
|
-
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
15566
|
-
desc = { enumerable: true, get: function() {
|
|
15567
|
-
return m5[k7];
|
|
15568
|
-
} };
|
|
15569
|
-
}
|
|
15570
|
-
Object.defineProperty(o3, k22, desc);
|
|
15571
|
-
} : function(o3, m5, k7, k22) {
|
|
15572
|
-
if (k22 === void 0) k22 = k7;
|
|
15573
|
-
o3[k22] = m5[k7];
|
|
15574
|
-
});
|
|
15575
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
15576
|
-
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
15577
|
-
} : function(o3, v5) {
|
|
15578
|
-
o3["default"] = v5;
|
|
15579
|
-
});
|
|
15580
|
-
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
15581
|
-
if (mod && mod.__esModule) return mod;
|
|
15582
|
-
var result = {};
|
|
15583
|
-
if (mod != null) {
|
|
15584
|
-
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
15585
|
-
}
|
|
15586
|
-
__setModuleDefault(result, mod);
|
|
15587
|
-
return result;
|
|
15588
|
-
};
|
|
15589
|
-
var __exportStar = exports2 && exports2.__exportStar || function(m5, exports3) {
|
|
15590
|
-
for (var p4 in m5) if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p4)) __createBinding(exports3, m5, p4);
|
|
15591
|
-
};
|
|
15592
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15593
|
-
exports2.Agent = void 0;
|
|
15594
|
-
var net = __importStar(require("net"));
|
|
15595
|
-
var http3 = __importStar(require("http"));
|
|
15596
|
-
var https_1 = require("https");
|
|
15597
|
-
__exportStar(require_helpers(), exports2);
|
|
15598
|
-
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
15599
|
-
var Agent4 = class extends http3.Agent {
|
|
15600
|
-
constructor(opts) {
|
|
15601
|
-
super(opts);
|
|
15602
|
-
this[INTERNAL] = {};
|
|
15603
|
-
}
|
|
15604
|
-
/**
|
|
15605
|
-
* Determine whether this is an `http` or `https` request.
|
|
15606
|
-
*/
|
|
15607
|
-
isSecureEndpoint(options) {
|
|
15608
|
-
if (options) {
|
|
15609
|
-
if (typeof options.secureEndpoint === "boolean") {
|
|
15610
|
-
return options.secureEndpoint;
|
|
15611
|
-
}
|
|
15612
|
-
if (typeof options.protocol === "string") {
|
|
15613
|
-
return options.protocol === "https:";
|
|
15614
|
-
}
|
|
15615
|
-
}
|
|
15616
|
-
const { stack } = new Error();
|
|
15617
|
-
if (typeof stack !== "string")
|
|
15618
|
-
return false;
|
|
15619
|
-
return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1);
|
|
15620
|
-
}
|
|
15621
|
-
// In order to support async signatures in `connect()` and Node's native
|
|
15622
|
-
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
15623
|
-
// has to be updated synchronously. This is so the length of the array is
|
|
15624
|
-
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
15625
|
-
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
15626
|
-
// `totalSocketCount`.
|
|
15627
|
-
incrementSockets(name) {
|
|
15628
|
-
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
15629
|
-
return null;
|
|
15630
|
-
}
|
|
15631
|
-
if (!this.sockets[name]) {
|
|
15632
|
-
this.sockets[name] = [];
|
|
15633
|
-
}
|
|
15634
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
15635
|
-
this.sockets[name].push(fakeSocket);
|
|
15636
|
-
this.totalSocketCount++;
|
|
15637
|
-
return fakeSocket;
|
|
15638
|
-
}
|
|
15639
|
-
decrementSockets(name, socket) {
|
|
15640
|
-
if (!this.sockets[name] || socket === null) {
|
|
15641
|
-
return;
|
|
15642
|
-
}
|
|
15643
|
-
const sockets = this.sockets[name];
|
|
15644
|
-
const index = sockets.indexOf(socket);
|
|
15645
|
-
if (index !== -1) {
|
|
15646
|
-
sockets.splice(index, 1);
|
|
15647
|
-
this.totalSocketCount--;
|
|
15648
|
-
if (sockets.length === 0) {
|
|
15649
|
-
delete this.sockets[name];
|
|
15650
|
-
}
|
|
15651
|
-
}
|
|
15652
|
-
}
|
|
15653
|
-
// In order to properly update the socket pool, we need to call `getName()` on
|
|
15654
|
-
// the core `https.Agent` if it is a secureEndpoint.
|
|
15655
|
-
getName(options) {
|
|
15656
|
-
const secureEndpoint = typeof options.secureEndpoint === "boolean" ? options.secureEndpoint : this.isSecureEndpoint(options);
|
|
15657
|
-
if (secureEndpoint) {
|
|
15658
|
-
return https_1.Agent.prototype.getName.call(this, options);
|
|
15659
|
-
}
|
|
15660
|
-
return super.getName(options);
|
|
15661
|
-
}
|
|
15662
|
-
createSocket(req, options, cb) {
|
|
15663
|
-
const connectOpts = {
|
|
15664
|
-
...options,
|
|
15665
|
-
secureEndpoint: this.isSecureEndpoint(options)
|
|
15666
|
-
};
|
|
15667
|
-
const name = this.getName(connectOpts);
|
|
15668
|
-
const fakeSocket = this.incrementSockets(name);
|
|
15669
|
-
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
15670
|
-
this.decrementSockets(name, fakeSocket);
|
|
15671
|
-
if (socket instanceof http3.Agent) {
|
|
15672
|
-
return socket.addRequest(req, connectOpts);
|
|
15673
|
-
}
|
|
15674
|
-
this[INTERNAL].currentSocket = socket;
|
|
15675
|
-
super.createSocket(req, options, cb);
|
|
15676
|
-
}, (err) => {
|
|
15677
|
-
this.decrementSockets(name, fakeSocket);
|
|
15678
|
-
cb(err);
|
|
15679
|
-
});
|
|
15680
|
-
}
|
|
15681
|
-
createConnection() {
|
|
15682
|
-
const socket = this[INTERNAL].currentSocket;
|
|
15683
|
-
this[INTERNAL].currentSocket = void 0;
|
|
15684
|
-
if (!socket) {
|
|
15685
|
-
throw new Error("No socket was returned in the `connect()` function");
|
|
15686
|
-
}
|
|
15687
|
-
return socket;
|
|
15688
|
-
}
|
|
15689
|
-
get defaultPort() {
|
|
15690
|
-
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
15691
|
-
}
|
|
15692
|
-
set defaultPort(v5) {
|
|
15693
|
-
if (this[INTERNAL]) {
|
|
15694
|
-
this[INTERNAL].defaultPort = v5;
|
|
15695
|
-
}
|
|
15696
|
-
}
|
|
15697
|
-
get protocol() {
|
|
15698
|
-
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
15699
|
-
}
|
|
15700
|
-
set protocol(v5) {
|
|
15701
|
-
if (this[INTERNAL]) {
|
|
15702
|
-
this[INTERNAL].protocol = v5;
|
|
15703
|
-
}
|
|
15704
|
-
}
|
|
15705
|
-
};
|
|
15706
|
-
exports2.Agent = Agent4;
|
|
15707
|
-
}
|
|
15708
|
-
});
|
|
15709
|
-
|
|
15710
|
-
// node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
15711
|
-
var require_parse_proxy_response = __commonJS({
|
|
15712
|
-
"node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
|
|
15713
|
-
"use strict";
|
|
15714
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
15715
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
15716
|
-
};
|
|
15717
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15718
|
-
exports2.parseProxyResponse = void 0;
|
|
15719
|
-
var debug_1 = __importDefault(require_src2());
|
|
15720
|
-
var debug3 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
15721
|
-
function parseProxyResponse(socket) {
|
|
15722
|
-
return new Promise((resolve, reject) => {
|
|
15723
|
-
let buffersLength = 0;
|
|
15724
|
-
const buffers = [];
|
|
15725
|
-
function read() {
|
|
15726
|
-
const b7 = socket.read();
|
|
15727
|
-
if (b7)
|
|
15728
|
-
ondata(b7);
|
|
15729
|
-
else
|
|
15730
|
-
socket.once("readable", read);
|
|
15731
|
-
}
|
|
15732
|
-
function cleanup() {
|
|
15733
|
-
socket.removeListener("end", onend);
|
|
15734
|
-
socket.removeListener("error", onerror);
|
|
15735
|
-
socket.removeListener("readable", read);
|
|
15736
|
-
}
|
|
15737
|
-
function onend() {
|
|
15738
|
-
cleanup();
|
|
15739
|
-
debug3("onend");
|
|
15740
|
-
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
15741
|
-
}
|
|
15742
|
-
function onerror(err) {
|
|
15743
|
-
cleanup();
|
|
15744
|
-
debug3("onerror %o", err);
|
|
15745
|
-
reject(err);
|
|
15746
|
-
}
|
|
15747
|
-
function ondata(b7) {
|
|
15748
|
-
buffers.push(b7);
|
|
15749
|
-
buffersLength += b7.length;
|
|
15750
|
-
const buffered = Buffer.concat(buffers, buffersLength);
|
|
15751
|
-
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
15752
|
-
if (endOfHeaders === -1) {
|
|
15753
|
-
debug3("have not received end of HTTP headers yet...");
|
|
15754
|
-
read();
|
|
15755
|
-
return;
|
|
15756
|
-
}
|
|
15757
|
-
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
15758
|
-
const firstLine = headerParts.shift();
|
|
15759
|
-
if (!firstLine) {
|
|
15760
|
-
socket.destroy();
|
|
15761
|
-
return reject(new Error("No header received from proxy CONNECT response"));
|
|
15762
|
-
}
|
|
15763
|
-
const firstLineParts = firstLine.split(" ");
|
|
15764
|
-
const statusCode = +firstLineParts[1];
|
|
15765
|
-
const statusText = firstLineParts.slice(2).join(" ");
|
|
15766
|
-
const headers = {};
|
|
15767
|
-
for (const header of headerParts) {
|
|
15768
|
-
if (!header)
|
|
15769
|
-
continue;
|
|
15770
|
-
const firstColon = header.indexOf(":");
|
|
15771
|
-
if (firstColon === -1) {
|
|
15772
|
-
socket.destroy();
|
|
15773
|
-
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
15774
|
-
}
|
|
15775
|
-
const key = header.slice(0, firstColon).toLowerCase();
|
|
15776
|
-
const value = header.slice(firstColon + 1).trimStart();
|
|
15777
|
-
const current = headers[key];
|
|
15778
|
-
if (typeof current === "string") {
|
|
15779
|
-
headers[key] = [current, value];
|
|
15780
|
-
} else if (Array.isArray(current)) {
|
|
15781
|
-
current.push(value);
|
|
15782
|
-
} else {
|
|
15783
|
-
headers[key] = value;
|
|
15784
|
-
}
|
|
15785
|
-
}
|
|
15786
|
-
debug3("got proxy server response: %o %o", firstLine, headers);
|
|
15787
|
-
cleanup();
|
|
15788
|
-
resolve({
|
|
15789
|
-
connect: {
|
|
15790
|
-
statusCode,
|
|
15791
|
-
statusText,
|
|
15792
|
-
headers
|
|
15793
|
-
},
|
|
15794
|
-
buffered
|
|
15795
|
-
});
|
|
15796
|
-
}
|
|
15797
|
-
socket.on("error", onerror);
|
|
15798
|
-
socket.on("end", onend);
|
|
15799
|
-
read();
|
|
15800
|
-
});
|
|
15801
|
-
}
|
|
15802
|
-
exports2.parseProxyResponse = parseProxyResponse;
|
|
15803
|
-
}
|
|
15804
|
-
});
|
|
15805
|
-
|
|
15806
|
-
// node_modules/https-proxy-agent/dist/index.js
|
|
15807
|
-
var require_dist2 = __commonJS({
|
|
15808
|
-
"node_modules/https-proxy-agent/dist/index.js"(exports2) {
|
|
15809
|
-
"use strict";
|
|
15810
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
15811
|
-
if (k22 === void 0) k22 = k7;
|
|
15812
|
-
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
15813
|
-
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
15814
|
-
desc = { enumerable: true, get: function() {
|
|
15815
|
-
return m5[k7];
|
|
15816
|
-
} };
|
|
15817
|
-
}
|
|
15818
|
-
Object.defineProperty(o3, k22, desc);
|
|
15819
|
-
} : function(o3, m5, k7, k22) {
|
|
15820
|
-
if (k22 === void 0) k22 = k7;
|
|
15821
|
-
o3[k22] = m5[k7];
|
|
15822
|
-
});
|
|
15823
|
-
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
15824
|
-
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
15825
|
-
} : function(o3, v5) {
|
|
15826
|
-
o3["default"] = v5;
|
|
15827
|
-
});
|
|
15828
|
-
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
15829
|
-
if (mod && mod.__esModule) return mod;
|
|
15830
|
-
var result = {};
|
|
15831
|
-
if (mod != null) {
|
|
15832
|
-
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
15833
|
-
}
|
|
15834
|
-
__setModuleDefault(result, mod);
|
|
15835
|
-
return result;
|
|
15836
|
-
};
|
|
15837
|
-
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
15838
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
15839
|
-
};
|
|
15840
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15841
|
-
exports2.HttpsProxyAgent = void 0;
|
|
15842
|
-
var net = __importStar(require("net"));
|
|
15843
|
-
var tls = __importStar(require("tls"));
|
|
15844
|
-
var assert_1 = __importDefault(require("assert"));
|
|
15845
|
-
var debug_1 = __importDefault(require_src2());
|
|
15846
|
-
var agent_base_1 = require_dist();
|
|
15847
|
-
var url_1 = require("url");
|
|
15848
|
-
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
15849
|
-
var debug3 = (0, debug_1.default)("https-proxy-agent");
|
|
15850
|
-
var HttpsProxyAgent5 = class extends agent_base_1.Agent {
|
|
15851
|
-
constructor(proxy, opts) {
|
|
15852
|
-
super(opts);
|
|
15853
|
-
this.options = { path: void 0 };
|
|
15854
|
-
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
15855
|
-
this.proxyHeaders = opts?.headers ?? {};
|
|
15856
|
-
debug3("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
15857
|
-
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
15858
|
-
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
15859
|
-
this.connectOpts = {
|
|
15860
|
-
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
15861
|
-
ALPNProtocols: ["http/1.1"],
|
|
15862
|
-
...opts ? omit(opts, "headers") : null,
|
|
15863
|
-
host,
|
|
15864
|
-
port
|
|
15865
|
-
};
|
|
15866
|
-
}
|
|
15867
|
-
/**
|
|
15868
|
-
* Called when the node-core HTTP client library is creating a
|
|
15869
|
-
* new HTTP request.
|
|
15870
|
-
*/
|
|
15871
|
-
async connect(req, opts) {
|
|
15872
|
-
const { proxy } = this;
|
|
15873
|
-
if (!opts.host) {
|
|
15874
|
-
throw new TypeError('No "host" provided');
|
|
15875
|
-
}
|
|
15876
|
-
let socket;
|
|
15877
|
-
if (proxy.protocol === "https:") {
|
|
15878
|
-
debug3("Creating `tls.Socket`: %o", this.connectOpts);
|
|
15879
|
-
const servername = this.connectOpts.servername || this.connectOpts.host;
|
|
15880
|
-
socket = tls.connect({
|
|
15881
|
-
...this.connectOpts,
|
|
15882
|
-
servername: servername && net.isIP(servername) ? void 0 : servername
|
|
15883
|
-
});
|
|
15884
|
-
} else {
|
|
15885
|
-
debug3("Creating `net.Socket`: %o", this.connectOpts);
|
|
15886
|
-
socket = net.connect(this.connectOpts);
|
|
15887
|
-
}
|
|
15888
|
-
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
15889
|
-
const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
15890
|
-
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
15891
|
-
`;
|
|
15892
|
-
if (proxy.username || proxy.password) {
|
|
15893
|
-
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
15894
|
-
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
15895
|
-
}
|
|
15896
|
-
headers.Host = `${host}:${opts.port}`;
|
|
15897
|
-
if (!headers["Proxy-Connection"]) {
|
|
15898
|
-
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
15899
|
-
}
|
|
15900
|
-
for (const name of Object.keys(headers)) {
|
|
15901
|
-
payload += `${name}: ${headers[name]}\r
|
|
15902
|
-
`;
|
|
15903
|
-
}
|
|
15904
|
-
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
15905
|
-
socket.write(`${payload}\r
|
|
15906
|
-
`);
|
|
15907
|
-
const { connect, buffered } = await proxyResponsePromise;
|
|
15908
|
-
req.emit("proxyConnect", connect);
|
|
15909
|
-
this.emit("proxyConnect", connect, req);
|
|
15910
|
-
if (connect.statusCode === 200) {
|
|
15911
|
-
req.once("socket", resume);
|
|
15912
|
-
if (opts.secureEndpoint) {
|
|
15913
|
-
debug3("Upgrading socket connection to TLS");
|
|
15914
|
-
const servername = opts.servername || opts.host;
|
|
15915
|
-
return tls.connect({
|
|
15916
|
-
...omit(opts, "host", "path", "port"),
|
|
15917
|
-
socket,
|
|
15918
|
-
servername: net.isIP(servername) ? void 0 : servername
|
|
15919
|
-
});
|
|
15920
|
-
}
|
|
15921
|
-
return socket;
|
|
15922
|
-
}
|
|
15923
|
-
socket.destroy();
|
|
15924
|
-
const fakeSocket = new net.Socket({ writable: false });
|
|
15925
|
-
fakeSocket.readable = true;
|
|
15926
|
-
req.once("socket", (s2) => {
|
|
15927
|
-
debug3("Replaying proxy buffer for failed request");
|
|
15928
|
-
(0, assert_1.default)(s2.listenerCount("data") > 0);
|
|
15929
|
-
s2.push(buffered);
|
|
15930
|
-
s2.push(null);
|
|
15931
|
-
});
|
|
15932
|
-
return fakeSocket;
|
|
15933
|
-
}
|
|
15934
|
-
};
|
|
15935
|
-
HttpsProxyAgent5.protocols = ["http", "https"];
|
|
15936
|
-
exports2.HttpsProxyAgent = HttpsProxyAgent5;
|
|
15937
|
-
function resume(socket) {
|
|
15938
|
-
socket.resume();
|
|
15939
|
-
}
|
|
15940
|
-
function omit(obj, ...keys) {
|
|
15941
|
-
const ret = {};
|
|
15942
|
-
let key;
|
|
15943
|
-
for (key in obj) {
|
|
15944
|
-
if (!keys.includes(key)) {
|
|
15945
|
-
ret[key] = obj[key];
|
|
15946
|
-
}
|
|
15947
|
-
}
|
|
15948
|
-
return ret;
|
|
15949
|
-
}
|
|
15950
|
-
}
|
|
15951
|
-
});
|
|
15952
|
-
|
|
15953
15488
|
// node_modules/delayed-stream/lib/delayed_stream.js
|
|
15954
15489
|
var require_delayed_stream = __commonJS({
|
|
15955
15490
|
"node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
|
|
@@ -25059,7 +24594,7 @@ var require_form_data = __commonJS({
|
|
|
25059
24594
|
var CombinedStream = require_combined_stream();
|
|
25060
24595
|
var util4 = require("util");
|
|
25061
24596
|
var path5 = require("path");
|
|
25062
|
-
var
|
|
24597
|
+
var http4 = require("http");
|
|
25063
24598
|
var https3 = require("https");
|
|
25064
24599
|
var parseUrl = require("url").parse;
|
|
25065
24600
|
var fs7 = require("fs");
|
|
@@ -25329,7 +24864,7 @@ var require_form_data = __commonJS({
|
|
|
25329
24864
|
if (options.protocol == "https:") {
|
|
25330
24865
|
request3 = https3.request(options);
|
|
25331
24866
|
} else {
|
|
25332
|
-
request3 =
|
|
24867
|
+
request3 = http4.request(options);
|
|
25333
24868
|
}
|
|
25334
24869
|
this.getLength(function(err, length) {
|
|
25335
24870
|
if (err && err !== "Unknown stream") {
|
|
@@ -25440,19 +24975,19 @@ var require_proxy_from_env = __commonJS({
|
|
|
25440
24975
|
// node_modules/follow-redirects/debug.js
|
|
25441
24976
|
var require_debug = __commonJS({
|
|
25442
24977
|
"node_modules/follow-redirects/debug.js"(exports2, module2) {
|
|
25443
|
-
var
|
|
24978
|
+
var debug5;
|
|
25444
24979
|
module2.exports = function() {
|
|
25445
|
-
if (!
|
|
24980
|
+
if (!debug5) {
|
|
25446
24981
|
try {
|
|
25447
|
-
|
|
24982
|
+
debug5 = require_src2()("follow-redirects");
|
|
25448
24983
|
} catch (error) {
|
|
25449
24984
|
}
|
|
25450
|
-
if (typeof
|
|
25451
|
-
|
|
24985
|
+
if (typeof debug5 !== "function") {
|
|
24986
|
+
debug5 = function() {
|
|
25452
24987
|
};
|
|
25453
24988
|
}
|
|
25454
24989
|
}
|
|
25455
|
-
|
|
24990
|
+
debug5.apply(null, arguments);
|
|
25456
24991
|
};
|
|
25457
24992
|
}
|
|
25458
24993
|
});
|
|
@@ -25461,15 +24996,15 @@ var require_debug = __commonJS({
|
|
|
25461
24996
|
var require_follow_redirects = __commonJS({
|
|
25462
24997
|
"node_modules/follow-redirects/index.js"(exports2, module2) {
|
|
25463
24998
|
var url2 = require("url");
|
|
25464
|
-
var
|
|
25465
|
-
var
|
|
24999
|
+
var URL3 = url2.URL;
|
|
25000
|
+
var http4 = require("http");
|
|
25466
25001
|
var https3 = require("https");
|
|
25467
25002
|
var Writable = require("stream").Writable;
|
|
25468
|
-
var
|
|
25469
|
-
var
|
|
25003
|
+
var assert2 = require("assert");
|
|
25004
|
+
var debug5 = require_debug();
|
|
25470
25005
|
var useNativeURL = false;
|
|
25471
25006
|
try {
|
|
25472
|
-
|
|
25007
|
+
assert2(new URL3());
|
|
25473
25008
|
} catch (error) {
|
|
25474
25009
|
useNativeURL = error.code === "ERR_INVALID_URL";
|
|
25475
25010
|
}
|
|
@@ -25775,7 +25310,7 @@ var require_follow_redirects = __commonJS({
|
|
|
25775
25310
|
var currentHost = currentHostHeader || currentUrlParts.host;
|
|
25776
25311
|
var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url2.format(Object.assign(currentUrlParts, { host: currentHost }));
|
|
25777
25312
|
var redirectUrl = resolveUrl(location, currentUrl);
|
|
25778
|
-
|
|
25313
|
+
debug5("redirecting to", redirectUrl.href);
|
|
25779
25314
|
this._isRedirect = true;
|
|
25780
25315
|
spreadUrlObject(redirectUrl, this._options);
|
|
25781
25316
|
if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
|
|
@@ -25828,8 +25363,8 @@ var require_follow_redirects = __commonJS({
|
|
|
25828
25363
|
if (!isString2(options.host) && !isString2(options.hostname)) {
|
|
25829
25364
|
options.hostname = "::1";
|
|
25830
25365
|
}
|
|
25831
|
-
|
|
25832
|
-
|
|
25366
|
+
assert2.equal(options.protocol, protocol, "protocol mismatch");
|
|
25367
|
+
debug5("options", options);
|
|
25833
25368
|
return new RedirectableRequest(options, callback);
|
|
25834
25369
|
}
|
|
25835
25370
|
function get(input, options, callback) {
|
|
@@ -25849,7 +25384,7 @@ var require_follow_redirects = __commonJS({
|
|
|
25849
25384
|
function parseUrl(input) {
|
|
25850
25385
|
var parsed;
|
|
25851
25386
|
if (useNativeURL) {
|
|
25852
|
-
parsed = new
|
|
25387
|
+
parsed = new URL3(input);
|
|
25853
25388
|
} else {
|
|
25854
25389
|
parsed = validateUrl(url2.parse(input));
|
|
25855
25390
|
if (!isString2(parsed.protocol)) {
|
|
@@ -25859,7 +25394,7 @@ var require_follow_redirects = __commonJS({
|
|
|
25859
25394
|
return parsed;
|
|
25860
25395
|
}
|
|
25861
25396
|
function resolveUrl(relative, base) {
|
|
25862
|
-
return useNativeURL ? new
|
|
25397
|
+
return useNativeURL ? new URL3(relative, base) : parseUrl(url2.resolve(base, relative));
|
|
25863
25398
|
}
|
|
25864
25399
|
function validateUrl(input) {
|
|
25865
25400
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -25922,7 +25457,7 @@ var require_follow_redirects = __commonJS({
|
|
|
25922
25457
|
request3.destroy(error);
|
|
25923
25458
|
}
|
|
25924
25459
|
function isSubdomain(subdomain, domain) {
|
|
25925
|
-
|
|
25460
|
+
assert2(isString2(subdomain) && isString2(domain));
|
|
25926
25461
|
var dot = subdomain.length - domain.length - 1;
|
|
25927
25462
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
25928
25463
|
}
|
|
@@ -25936,9 +25471,9 @@ var require_follow_redirects = __commonJS({
|
|
|
25936
25471
|
return typeof value === "object" && "length" in value;
|
|
25937
25472
|
}
|
|
25938
25473
|
function isURL(value) {
|
|
25939
|
-
return
|
|
25474
|
+
return URL3 && value instanceof URL3;
|
|
25940
25475
|
}
|
|
25941
|
-
module2.exports = wrap({ http:
|
|
25476
|
+
module2.exports = wrap({ http: http4, https: https3 });
|
|
25942
25477
|
module2.exports.wrap = wrap;
|
|
25943
25478
|
}
|
|
25944
25479
|
});
|
|
@@ -26324,6 +25859,478 @@ var require_tiktoken = __commonJS({
|
|
|
26324
25859
|
}
|
|
26325
25860
|
});
|
|
26326
25861
|
|
|
25862
|
+
// node_modules/agent-base/dist/helpers.js
|
|
25863
|
+
var require_helpers = __commonJS({
|
|
25864
|
+
"node_modules/agent-base/dist/helpers.js"(exports2) {
|
|
25865
|
+
"use strict";
|
|
25866
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
25867
|
+
if (k22 === void 0) k22 = k7;
|
|
25868
|
+
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
25869
|
+
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
25870
|
+
desc = { enumerable: true, get: function() {
|
|
25871
|
+
return m5[k7];
|
|
25872
|
+
} };
|
|
25873
|
+
}
|
|
25874
|
+
Object.defineProperty(o3, k22, desc);
|
|
25875
|
+
} : function(o3, m5, k7, k22) {
|
|
25876
|
+
if (k22 === void 0) k22 = k7;
|
|
25877
|
+
o3[k22] = m5[k7];
|
|
25878
|
+
});
|
|
25879
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
25880
|
+
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
25881
|
+
} : function(o3, v5) {
|
|
25882
|
+
o3["default"] = v5;
|
|
25883
|
+
});
|
|
25884
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
25885
|
+
if (mod && mod.__esModule) return mod;
|
|
25886
|
+
var result = {};
|
|
25887
|
+
if (mod != null) {
|
|
25888
|
+
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
25889
|
+
}
|
|
25890
|
+
__setModuleDefault(result, mod);
|
|
25891
|
+
return result;
|
|
25892
|
+
};
|
|
25893
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25894
|
+
exports2.req = exports2.json = exports2.toBuffer = void 0;
|
|
25895
|
+
var http4 = __importStar(require("http"));
|
|
25896
|
+
var https3 = __importStar(require("https"));
|
|
25897
|
+
async function toBuffer(stream4) {
|
|
25898
|
+
let length = 0;
|
|
25899
|
+
const chunks = [];
|
|
25900
|
+
for await (const chunk of stream4) {
|
|
25901
|
+
length += chunk.length;
|
|
25902
|
+
chunks.push(chunk);
|
|
25903
|
+
}
|
|
25904
|
+
return Buffer.concat(chunks, length);
|
|
25905
|
+
}
|
|
25906
|
+
exports2.toBuffer = toBuffer;
|
|
25907
|
+
async function json(stream4) {
|
|
25908
|
+
const buf = await toBuffer(stream4);
|
|
25909
|
+
const str2 = buf.toString("utf8");
|
|
25910
|
+
try {
|
|
25911
|
+
return JSON.parse(str2);
|
|
25912
|
+
} catch (_err) {
|
|
25913
|
+
const err = _err;
|
|
25914
|
+
err.message += ` (input: ${str2})`;
|
|
25915
|
+
throw err;
|
|
25916
|
+
}
|
|
25917
|
+
}
|
|
25918
|
+
exports2.json = json;
|
|
25919
|
+
function req(url2, opts = {}) {
|
|
25920
|
+
const href = typeof url2 === "string" ? url2 : url2.href;
|
|
25921
|
+
const req2 = (href.startsWith("https:") ? https3 : http4).request(url2, opts);
|
|
25922
|
+
const promise = new Promise((resolve, reject) => {
|
|
25923
|
+
req2.once("response", resolve).once("error", reject).end();
|
|
25924
|
+
});
|
|
25925
|
+
req2.then = promise.then.bind(promise);
|
|
25926
|
+
return req2;
|
|
25927
|
+
}
|
|
25928
|
+
exports2.req = req;
|
|
25929
|
+
}
|
|
25930
|
+
});
|
|
25931
|
+
|
|
25932
|
+
// node_modules/agent-base/dist/index.js
|
|
25933
|
+
var require_dist = __commonJS({
|
|
25934
|
+
"node_modules/agent-base/dist/index.js"(exports2) {
|
|
25935
|
+
"use strict";
|
|
25936
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
25937
|
+
if (k22 === void 0) k22 = k7;
|
|
25938
|
+
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
25939
|
+
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
25940
|
+
desc = { enumerable: true, get: function() {
|
|
25941
|
+
return m5[k7];
|
|
25942
|
+
} };
|
|
25943
|
+
}
|
|
25944
|
+
Object.defineProperty(o3, k22, desc);
|
|
25945
|
+
} : function(o3, m5, k7, k22) {
|
|
25946
|
+
if (k22 === void 0) k22 = k7;
|
|
25947
|
+
o3[k22] = m5[k7];
|
|
25948
|
+
});
|
|
25949
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
25950
|
+
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
25951
|
+
} : function(o3, v5) {
|
|
25952
|
+
o3["default"] = v5;
|
|
25953
|
+
});
|
|
25954
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
25955
|
+
if (mod && mod.__esModule) return mod;
|
|
25956
|
+
var result = {};
|
|
25957
|
+
if (mod != null) {
|
|
25958
|
+
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
25959
|
+
}
|
|
25960
|
+
__setModuleDefault(result, mod);
|
|
25961
|
+
return result;
|
|
25962
|
+
};
|
|
25963
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m5, exports3) {
|
|
25964
|
+
for (var p4 in m5) if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p4)) __createBinding(exports3, m5, p4);
|
|
25965
|
+
};
|
|
25966
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
25967
|
+
exports2.Agent = void 0;
|
|
25968
|
+
var net3 = __importStar(require("net"));
|
|
25969
|
+
var http4 = __importStar(require("http"));
|
|
25970
|
+
var https_1 = require("https");
|
|
25971
|
+
__exportStar(require_helpers(), exports2);
|
|
25972
|
+
var INTERNAL2 = Symbol("AgentBaseInternalState");
|
|
25973
|
+
var Agent6 = class extends http4.Agent {
|
|
25974
|
+
constructor(opts) {
|
|
25975
|
+
super(opts);
|
|
25976
|
+
this[INTERNAL2] = {};
|
|
25977
|
+
}
|
|
25978
|
+
/**
|
|
25979
|
+
* Determine whether this is an `http` or `https` request.
|
|
25980
|
+
*/
|
|
25981
|
+
isSecureEndpoint(options) {
|
|
25982
|
+
if (options) {
|
|
25983
|
+
if (typeof options.secureEndpoint === "boolean") {
|
|
25984
|
+
return options.secureEndpoint;
|
|
25985
|
+
}
|
|
25986
|
+
if (typeof options.protocol === "string") {
|
|
25987
|
+
return options.protocol === "https:";
|
|
25988
|
+
}
|
|
25989
|
+
}
|
|
25990
|
+
const { stack } = new Error();
|
|
25991
|
+
if (typeof stack !== "string")
|
|
25992
|
+
return false;
|
|
25993
|
+
return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1);
|
|
25994
|
+
}
|
|
25995
|
+
// In order to support async signatures in `connect()` and Node's native
|
|
25996
|
+
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
25997
|
+
// has to be updated synchronously. This is so the length of the array is
|
|
25998
|
+
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
25999
|
+
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
26000
|
+
// `totalSocketCount`.
|
|
26001
|
+
incrementSockets(name) {
|
|
26002
|
+
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
26003
|
+
return null;
|
|
26004
|
+
}
|
|
26005
|
+
if (!this.sockets[name]) {
|
|
26006
|
+
this.sockets[name] = [];
|
|
26007
|
+
}
|
|
26008
|
+
const fakeSocket = new net3.Socket({ writable: false });
|
|
26009
|
+
this.sockets[name].push(fakeSocket);
|
|
26010
|
+
this.totalSocketCount++;
|
|
26011
|
+
return fakeSocket;
|
|
26012
|
+
}
|
|
26013
|
+
decrementSockets(name, socket) {
|
|
26014
|
+
if (!this.sockets[name] || socket === null) {
|
|
26015
|
+
return;
|
|
26016
|
+
}
|
|
26017
|
+
const sockets = this.sockets[name];
|
|
26018
|
+
const index = sockets.indexOf(socket);
|
|
26019
|
+
if (index !== -1) {
|
|
26020
|
+
sockets.splice(index, 1);
|
|
26021
|
+
this.totalSocketCount--;
|
|
26022
|
+
if (sockets.length === 0) {
|
|
26023
|
+
delete this.sockets[name];
|
|
26024
|
+
}
|
|
26025
|
+
}
|
|
26026
|
+
}
|
|
26027
|
+
// In order to properly update the socket pool, we need to call `getName()` on
|
|
26028
|
+
// the core `https.Agent` if it is a secureEndpoint.
|
|
26029
|
+
getName(options) {
|
|
26030
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
26031
|
+
if (secureEndpoint) {
|
|
26032
|
+
return https_1.Agent.prototype.getName.call(this, options);
|
|
26033
|
+
}
|
|
26034
|
+
return super.getName(options);
|
|
26035
|
+
}
|
|
26036
|
+
createSocket(req, options, cb) {
|
|
26037
|
+
const connectOpts = {
|
|
26038
|
+
...options,
|
|
26039
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
26040
|
+
};
|
|
26041
|
+
const name = this.getName(connectOpts);
|
|
26042
|
+
const fakeSocket = this.incrementSockets(name);
|
|
26043
|
+
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
26044
|
+
this.decrementSockets(name, fakeSocket);
|
|
26045
|
+
if (socket instanceof http4.Agent) {
|
|
26046
|
+
try {
|
|
26047
|
+
return socket.addRequest(req, connectOpts);
|
|
26048
|
+
} catch (err) {
|
|
26049
|
+
return cb(err);
|
|
26050
|
+
}
|
|
26051
|
+
}
|
|
26052
|
+
this[INTERNAL2].currentSocket = socket;
|
|
26053
|
+
super.createSocket(req, options, cb);
|
|
26054
|
+
}, (err) => {
|
|
26055
|
+
this.decrementSockets(name, fakeSocket);
|
|
26056
|
+
cb(err);
|
|
26057
|
+
});
|
|
26058
|
+
}
|
|
26059
|
+
createConnection() {
|
|
26060
|
+
const socket = this[INTERNAL2].currentSocket;
|
|
26061
|
+
this[INTERNAL2].currentSocket = void 0;
|
|
26062
|
+
if (!socket) {
|
|
26063
|
+
throw new Error("No socket was returned in the `connect()` function");
|
|
26064
|
+
}
|
|
26065
|
+
return socket;
|
|
26066
|
+
}
|
|
26067
|
+
get defaultPort() {
|
|
26068
|
+
return this[INTERNAL2].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
26069
|
+
}
|
|
26070
|
+
set defaultPort(v5) {
|
|
26071
|
+
if (this[INTERNAL2]) {
|
|
26072
|
+
this[INTERNAL2].defaultPort = v5;
|
|
26073
|
+
}
|
|
26074
|
+
}
|
|
26075
|
+
get protocol() {
|
|
26076
|
+
return this[INTERNAL2].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
26077
|
+
}
|
|
26078
|
+
set protocol(v5) {
|
|
26079
|
+
if (this[INTERNAL2]) {
|
|
26080
|
+
this[INTERNAL2].protocol = v5;
|
|
26081
|
+
}
|
|
26082
|
+
}
|
|
26083
|
+
};
|
|
26084
|
+
exports2.Agent = Agent6;
|
|
26085
|
+
}
|
|
26086
|
+
});
|
|
26087
|
+
|
|
26088
|
+
// node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
26089
|
+
var require_parse_proxy_response = __commonJS({
|
|
26090
|
+
"node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports2) {
|
|
26091
|
+
"use strict";
|
|
26092
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
26093
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
26094
|
+
};
|
|
26095
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
26096
|
+
exports2.parseProxyResponse = void 0;
|
|
26097
|
+
var debug_1 = __importDefault(require_src2());
|
|
26098
|
+
var debug5 = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
26099
|
+
function parseProxyResponse2(socket) {
|
|
26100
|
+
return new Promise((resolve, reject) => {
|
|
26101
|
+
let buffersLength = 0;
|
|
26102
|
+
const buffers = [];
|
|
26103
|
+
function read() {
|
|
26104
|
+
const b7 = socket.read();
|
|
26105
|
+
if (b7)
|
|
26106
|
+
ondata(b7);
|
|
26107
|
+
else
|
|
26108
|
+
socket.once("readable", read);
|
|
26109
|
+
}
|
|
26110
|
+
function cleanup() {
|
|
26111
|
+
socket.removeListener("end", onend);
|
|
26112
|
+
socket.removeListener("error", onerror);
|
|
26113
|
+
socket.removeListener("readable", read);
|
|
26114
|
+
}
|
|
26115
|
+
function onend() {
|
|
26116
|
+
cleanup();
|
|
26117
|
+
debug5("onend");
|
|
26118
|
+
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
26119
|
+
}
|
|
26120
|
+
function onerror(err) {
|
|
26121
|
+
cleanup();
|
|
26122
|
+
debug5("onerror %o", err);
|
|
26123
|
+
reject(err);
|
|
26124
|
+
}
|
|
26125
|
+
function ondata(b7) {
|
|
26126
|
+
buffers.push(b7);
|
|
26127
|
+
buffersLength += b7.length;
|
|
26128
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
26129
|
+
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
26130
|
+
if (endOfHeaders === -1) {
|
|
26131
|
+
debug5("have not received end of HTTP headers yet...");
|
|
26132
|
+
read();
|
|
26133
|
+
return;
|
|
26134
|
+
}
|
|
26135
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
26136
|
+
const firstLine = headerParts.shift();
|
|
26137
|
+
if (!firstLine) {
|
|
26138
|
+
socket.destroy();
|
|
26139
|
+
return reject(new Error("No header received from proxy CONNECT response"));
|
|
26140
|
+
}
|
|
26141
|
+
const firstLineParts = firstLine.split(" ");
|
|
26142
|
+
const statusCode = +firstLineParts[1];
|
|
26143
|
+
const statusText = firstLineParts.slice(2).join(" ");
|
|
26144
|
+
const headers = {};
|
|
26145
|
+
for (const header of headerParts) {
|
|
26146
|
+
if (!header)
|
|
26147
|
+
continue;
|
|
26148
|
+
const firstColon = header.indexOf(":");
|
|
26149
|
+
if (firstColon === -1) {
|
|
26150
|
+
socket.destroy();
|
|
26151
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
26152
|
+
}
|
|
26153
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
26154
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
26155
|
+
const current = headers[key];
|
|
26156
|
+
if (typeof current === "string") {
|
|
26157
|
+
headers[key] = [current, value];
|
|
26158
|
+
} else if (Array.isArray(current)) {
|
|
26159
|
+
current.push(value);
|
|
26160
|
+
} else {
|
|
26161
|
+
headers[key] = value;
|
|
26162
|
+
}
|
|
26163
|
+
}
|
|
26164
|
+
debug5("got proxy server response: %o %o", firstLine, headers);
|
|
26165
|
+
cleanup();
|
|
26166
|
+
resolve({
|
|
26167
|
+
connect: {
|
|
26168
|
+
statusCode,
|
|
26169
|
+
statusText,
|
|
26170
|
+
headers
|
|
26171
|
+
},
|
|
26172
|
+
buffered
|
|
26173
|
+
});
|
|
26174
|
+
}
|
|
26175
|
+
socket.on("error", onerror);
|
|
26176
|
+
socket.on("end", onend);
|
|
26177
|
+
read();
|
|
26178
|
+
});
|
|
26179
|
+
}
|
|
26180
|
+
exports2.parseProxyResponse = parseProxyResponse2;
|
|
26181
|
+
}
|
|
26182
|
+
});
|
|
26183
|
+
|
|
26184
|
+
// node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/index.js
|
|
26185
|
+
var require_dist2 = __commonJS({
|
|
26186
|
+
"node_modules/@azure/core-rest-pipeline/node_modules/https-proxy-agent/dist/index.js"(exports2) {
|
|
26187
|
+
"use strict";
|
|
26188
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o3, m5, k7, k22) {
|
|
26189
|
+
if (k22 === void 0) k22 = k7;
|
|
26190
|
+
var desc = Object.getOwnPropertyDescriptor(m5, k7);
|
|
26191
|
+
if (!desc || ("get" in desc ? !m5.__esModule : desc.writable || desc.configurable)) {
|
|
26192
|
+
desc = { enumerable: true, get: function() {
|
|
26193
|
+
return m5[k7];
|
|
26194
|
+
} };
|
|
26195
|
+
}
|
|
26196
|
+
Object.defineProperty(o3, k22, desc);
|
|
26197
|
+
} : function(o3, m5, k7, k22) {
|
|
26198
|
+
if (k22 === void 0) k22 = k7;
|
|
26199
|
+
o3[k22] = m5[k7];
|
|
26200
|
+
});
|
|
26201
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o3, v5) {
|
|
26202
|
+
Object.defineProperty(o3, "default", { enumerable: true, value: v5 });
|
|
26203
|
+
} : function(o3, v5) {
|
|
26204
|
+
o3["default"] = v5;
|
|
26205
|
+
});
|
|
26206
|
+
var __importStar = exports2 && exports2.__importStar || function(mod) {
|
|
26207
|
+
if (mod && mod.__esModule) return mod;
|
|
26208
|
+
var result = {};
|
|
26209
|
+
if (mod != null) {
|
|
26210
|
+
for (var k7 in mod) if (k7 !== "default" && Object.prototype.hasOwnProperty.call(mod, k7)) __createBinding(result, mod, k7);
|
|
26211
|
+
}
|
|
26212
|
+
__setModuleDefault(result, mod);
|
|
26213
|
+
return result;
|
|
26214
|
+
};
|
|
26215
|
+
var __importDefault = exports2 && exports2.__importDefault || function(mod) {
|
|
26216
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
26217
|
+
};
|
|
26218
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
26219
|
+
exports2.HttpsProxyAgent = void 0;
|
|
26220
|
+
var net3 = __importStar(require("net"));
|
|
26221
|
+
var tls2 = __importStar(require("tls"));
|
|
26222
|
+
var assert_1 = __importDefault(require("assert"));
|
|
26223
|
+
var debug_1 = __importDefault(require_src2());
|
|
26224
|
+
var agent_base_1 = require_dist();
|
|
26225
|
+
var url_1 = require("url");
|
|
26226
|
+
var parse_proxy_response_1 = require_parse_proxy_response();
|
|
26227
|
+
var debug5 = (0, debug_1.default)("https-proxy-agent");
|
|
26228
|
+
var setServernameFromNonIpHost2 = (options) => {
|
|
26229
|
+
if (options.servername === void 0 && options.host && !net3.isIP(options.host)) {
|
|
26230
|
+
return {
|
|
26231
|
+
...options,
|
|
26232
|
+
servername: options.host
|
|
26233
|
+
};
|
|
26234
|
+
}
|
|
26235
|
+
return options;
|
|
26236
|
+
};
|
|
26237
|
+
var HttpsProxyAgent3 = class extends agent_base_1.Agent {
|
|
26238
|
+
constructor(proxy, opts) {
|
|
26239
|
+
super(opts);
|
|
26240
|
+
this.options = { path: void 0 };
|
|
26241
|
+
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
26242
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
26243
|
+
debug5("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
26244
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
26245
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
26246
|
+
this.connectOpts = {
|
|
26247
|
+
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
26248
|
+
ALPNProtocols: ["http/1.1"],
|
|
26249
|
+
...opts ? omit2(opts, "headers") : null,
|
|
26250
|
+
host,
|
|
26251
|
+
port
|
|
26252
|
+
};
|
|
26253
|
+
}
|
|
26254
|
+
/**
|
|
26255
|
+
* Called when the node-core HTTP client library is creating a
|
|
26256
|
+
* new HTTP request.
|
|
26257
|
+
*/
|
|
26258
|
+
async connect(req, opts) {
|
|
26259
|
+
const { proxy } = this;
|
|
26260
|
+
if (!opts.host) {
|
|
26261
|
+
throw new TypeError('No "host" provided');
|
|
26262
|
+
}
|
|
26263
|
+
let socket;
|
|
26264
|
+
if (proxy.protocol === "https:") {
|
|
26265
|
+
debug5("Creating `tls.Socket`: %o", this.connectOpts);
|
|
26266
|
+
socket = tls2.connect(setServernameFromNonIpHost2(this.connectOpts));
|
|
26267
|
+
} else {
|
|
26268
|
+
debug5("Creating `net.Socket`: %o", this.connectOpts);
|
|
26269
|
+
socket = net3.connect(this.connectOpts);
|
|
26270
|
+
}
|
|
26271
|
+
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
26272
|
+
const host = net3.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
26273
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
26274
|
+
`;
|
|
26275
|
+
if (proxy.username || proxy.password) {
|
|
26276
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
26277
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
26278
|
+
}
|
|
26279
|
+
headers.Host = `${host}:${opts.port}`;
|
|
26280
|
+
if (!headers["Proxy-Connection"]) {
|
|
26281
|
+
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
26282
|
+
}
|
|
26283
|
+
for (const name of Object.keys(headers)) {
|
|
26284
|
+
payload += `${name}: ${headers[name]}\r
|
|
26285
|
+
`;
|
|
26286
|
+
}
|
|
26287
|
+
const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
|
|
26288
|
+
socket.write(`${payload}\r
|
|
26289
|
+
`);
|
|
26290
|
+
const { connect: connect3, buffered } = await proxyResponsePromise;
|
|
26291
|
+
req.emit("proxyConnect", connect3);
|
|
26292
|
+
this.emit("proxyConnect", connect3, req);
|
|
26293
|
+
if (connect3.statusCode === 200) {
|
|
26294
|
+
req.once("socket", resume2);
|
|
26295
|
+
if (opts.secureEndpoint) {
|
|
26296
|
+
debug5("Upgrading socket connection to TLS");
|
|
26297
|
+
return tls2.connect({
|
|
26298
|
+
...omit2(setServernameFromNonIpHost2(opts), "host", "path", "port"),
|
|
26299
|
+
socket
|
|
26300
|
+
});
|
|
26301
|
+
}
|
|
26302
|
+
return socket;
|
|
26303
|
+
}
|
|
26304
|
+
socket.destroy();
|
|
26305
|
+
const fakeSocket = new net3.Socket({ writable: false });
|
|
26306
|
+
fakeSocket.readable = true;
|
|
26307
|
+
req.once("socket", (s2) => {
|
|
26308
|
+
debug5("Replaying proxy buffer for failed request");
|
|
26309
|
+
(0, assert_1.default)(s2.listenerCount("data") > 0);
|
|
26310
|
+
s2.push(buffered);
|
|
26311
|
+
s2.push(null);
|
|
26312
|
+
});
|
|
26313
|
+
return fakeSocket;
|
|
26314
|
+
}
|
|
26315
|
+
};
|
|
26316
|
+
HttpsProxyAgent3.protocols = ["http", "https"];
|
|
26317
|
+
exports2.HttpsProxyAgent = HttpsProxyAgent3;
|
|
26318
|
+
function resume2(socket) {
|
|
26319
|
+
socket.resume();
|
|
26320
|
+
}
|
|
26321
|
+
function omit2(obj, ...keys) {
|
|
26322
|
+
const ret = {};
|
|
26323
|
+
let key;
|
|
26324
|
+
for (key in obj) {
|
|
26325
|
+
if (!keys.includes(key)) {
|
|
26326
|
+
ret[key] = obj[key];
|
|
26327
|
+
}
|
|
26328
|
+
}
|
|
26329
|
+
return ret;
|
|
26330
|
+
}
|
|
26331
|
+
}
|
|
26332
|
+
});
|
|
26333
|
+
|
|
26327
26334
|
// node_modules/http-proxy-agent/dist/index.js
|
|
26328
26335
|
var require_dist3 = __commonJS({
|
|
26329
26336
|
"node_modules/http-proxy-agent/dist/index.js"(exports2) {
|
|
@@ -26360,23 +26367,23 @@ var require_dist3 = __commonJS({
|
|
|
26360
26367
|
};
|
|
26361
26368
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
26362
26369
|
exports2.HttpProxyAgent = void 0;
|
|
26363
|
-
var
|
|
26364
|
-
var
|
|
26370
|
+
var net3 = __importStar(require("net"));
|
|
26371
|
+
var tls2 = __importStar(require("tls"));
|
|
26365
26372
|
var debug_1 = __importDefault(require_src2());
|
|
26366
26373
|
var events_1 = require("events");
|
|
26367
26374
|
var agent_base_1 = require_dist();
|
|
26368
26375
|
var url_1 = require("url");
|
|
26369
|
-
var
|
|
26376
|
+
var debug5 = (0, debug_1.default)("http-proxy-agent");
|
|
26370
26377
|
var HttpProxyAgent2 = class extends agent_base_1.Agent {
|
|
26371
26378
|
constructor(proxy, opts) {
|
|
26372
26379
|
super(opts);
|
|
26373
26380
|
this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
|
|
26374
26381
|
this.proxyHeaders = opts?.headers ?? {};
|
|
26375
|
-
|
|
26382
|
+
debug5("Creating new HttpProxyAgent instance: %o", this.proxy.href);
|
|
26376
26383
|
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
26377
26384
|
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
26378
26385
|
this.connectOpts = {
|
|
26379
|
-
...opts ?
|
|
26386
|
+
...opts ? omit2(opts, "headers") : null,
|
|
26380
26387
|
host,
|
|
26381
26388
|
port
|
|
26382
26389
|
};
|
|
@@ -26418,22 +26425,22 @@ var require_dist3 = __commonJS({
|
|
|
26418
26425
|
}
|
|
26419
26426
|
let first;
|
|
26420
26427
|
let endOfHeaders;
|
|
26421
|
-
|
|
26428
|
+
debug5("Regenerating stored HTTP header string for request");
|
|
26422
26429
|
req._implicitHeader();
|
|
26423
26430
|
if (req.outputData && req.outputData.length > 0) {
|
|
26424
|
-
|
|
26431
|
+
debug5("Patching connection write() output buffer with updated header");
|
|
26425
26432
|
first = req.outputData[0].data;
|
|
26426
26433
|
endOfHeaders = first.indexOf("\r\n\r\n") + 4;
|
|
26427
26434
|
req.outputData[0].data = req._header + first.substring(endOfHeaders);
|
|
26428
|
-
|
|
26435
|
+
debug5("Output buffer: %o", req.outputData[0].data);
|
|
26429
26436
|
}
|
|
26430
26437
|
let socket;
|
|
26431
26438
|
if (this.proxy.protocol === "https:") {
|
|
26432
|
-
|
|
26433
|
-
socket =
|
|
26439
|
+
debug5("Creating `tls.Socket`: %o", this.connectOpts);
|
|
26440
|
+
socket = tls2.connect(this.connectOpts);
|
|
26434
26441
|
} else {
|
|
26435
|
-
|
|
26436
|
-
socket =
|
|
26442
|
+
debug5("Creating `net.Socket`: %o", this.connectOpts);
|
|
26443
|
+
socket = net3.connect(this.connectOpts);
|
|
26437
26444
|
}
|
|
26438
26445
|
await (0, events_1.once)(socket, "connect");
|
|
26439
26446
|
return socket;
|
|
@@ -26441,7 +26448,7 @@ var require_dist3 = __commonJS({
|
|
|
26441
26448
|
};
|
|
26442
26449
|
HttpProxyAgent2.protocols = ["http", "https"];
|
|
26443
26450
|
exports2.HttpProxyAgent = HttpProxyAgent2;
|
|
26444
|
-
function
|
|
26451
|
+
function omit2(obj, ...keys) {
|
|
26445
26452
|
const ret = {};
|
|
26446
26453
|
let key;
|
|
26447
26454
|
for (key in obj) {
|
|
@@ -47752,11 +47759,11 @@ var require_constants2 = __commonJS({
|
|
|
47752
47759
|
var require_util2 = __commonJS({
|
|
47753
47760
|
"node_modules/undici/lib/core/util.js"(exports2, module2) {
|
|
47754
47761
|
"use strict";
|
|
47755
|
-
var
|
|
47762
|
+
var assert2 = require("assert");
|
|
47756
47763
|
var { kDestroyed, kBodyUsed } = require_symbols();
|
|
47757
47764
|
var { IncomingMessage } = require("http");
|
|
47758
47765
|
var stream4 = require("stream");
|
|
47759
|
-
var
|
|
47766
|
+
var net3 = require("net");
|
|
47760
47767
|
var { InvalidArgumentError } = require_errors3();
|
|
47761
47768
|
var { Blob: Blob5 } = require("buffer");
|
|
47762
47769
|
var nodeUtil = require("util");
|
|
@@ -47834,7 +47841,7 @@ var require_util2 = __commonJS({
|
|
|
47834
47841
|
function getHostname(host) {
|
|
47835
47842
|
if (host[0] === "[") {
|
|
47836
47843
|
const idx2 = host.indexOf("]");
|
|
47837
|
-
|
|
47844
|
+
assert2(idx2 !== -1);
|
|
47838
47845
|
return host.substring(1, idx2);
|
|
47839
47846
|
}
|
|
47840
47847
|
const idx = host.indexOf(":");
|
|
@@ -47845,9 +47852,9 @@ var require_util2 = __commonJS({
|
|
|
47845
47852
|
if (!host) {
|
|
47846
47853
|
return null;
|
|
47847
47854
|
}
|
|
47848
|
-
|
|
47855
|
+
assert2.strictEqual(typeof host, "string");
|
|
47849
47856
|
const servername = getHostname(host);
|
|
47850
|
-
if (
|
|
47857
|
+
if (net3.isIP(servername)) {
|
|
47851
47858
|
return "";
|
|
47852
47859
|
}
|
|
47853
47860
|
return servername;
|
|
@@ -50448,7 +50455,7 @@ var require_util3 = __commonJS({
|
|
|
50448
50455
|
var { getGlobalOrigin } = require_global();
|
|
50449
50456
|
var { performance: performance2 } = require("perf_hooks");
|
|
50450
50457
|
var { isBlobLike: isBlobLike3, toUSVString, ReadableStreamFrom } = require_util2();
|
|
50451
|
-
var
|
|
50458
|
+
var assert2 = require("assert");
|
|
50452
50459
|
var { isUint8Array } = require("util/types");
|
|
50453
50460
|
var supportedHashes = [];
|
|
50454
50461
|
var crypto3;
|
|
@@ -50638,7 +50645,7 @@ var require_util3 = __commonJS({
|
|
|
50638
50645
|
}
|
|
50639
50646
|
function determineRequestsReferrer(request3) {
|
|
50640
50647
|
const policy = request3.referrerPolicy;
|
|
50641
|
-
|
|
50648
|
+
assert2(policy);
|
|
50642
50649
|
let referrerSource = null;
|
|
50643
50650
|
if (request3.referrer === "client") {
|
|
50644
50651
|
const globalOrigin = getGlobalOrigin();
|
|
@@ -50696,7 +50703,7 @@ var require_util3 = __commonJS({
|
|
|
50696
50703
|
}
|
|
50697
50704
|
}
|
|
50698
50705
|
function stripURLForReferrer(url2, originOnly) {
|
|
50699
|
-
|
|
50706
|
+
assert2(url2 instanceof URL);
|
|
50700
50707
|
if (url2.protocol === "file:" || url2.protocol === "about:" || url2.protocol === "blank:") {
|
|
50701
50708
|
return "no-referrer";
|
|
50702
50709
|
}
|
|
@@ -50875,7 +50882,7 @@ var require_util3 = __commonJS({
|
|
|
50875
50882
|
if (result === void 0) {
|
|
50876
50883
|
throw new TypeError("Value is not JSON serializable");
|
|
50877
50884
|
}
|
|
50878
|
-
|
|
50885
|
+
assert2(typeof result === "string");
|
|
50879
50886
|
return result;
|
|
50880
50887
|
}
|
|
50881
50888
|
var esIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
|
@@ -50969,7 +50976,7 @@ var require_util3 = __commonJS({
|
|
|
50969
50976
|
}
|
|
50970
50977
|
function isomorphicEncode(input) {
|
|
50971
50978
|
for (let i3 = 0; i3 < input.length; i3++) {
|
|
50972
|
-
|
|
50979
|
+
assert2(input.charCodeAt(i3) <= 255);
|
|
50973
50980
|
}
|
|
50974
50981
|
return input;
|
|
50975
50982
|
}
|
|
@@ -50989,7 +50996,7 @@ var require_util3 = __commonJS({
|
|
|
50989
50996
|
}
|
|
50990
50997
|
}
|
|
50991
50998
|
function urlIsLocal(url2) {
|
|
50992
|
-
|
|
50999
|
+
assert2("protocol" in url2);
|
|
50993
51000
|
const protocol = url2.protocol;
|
|
50994
51001
|
return protocol === "about:" || protocol === "blob:" || protocol === "data:";
|
|
50995
51002
|
}
|
|
@@ -51000,7 +51007,7 @@ var require_util3 = __commonJS({
|
|
|
51000
51007
|
return url2.protocol === "https:";
|
|
51001
51008
|
}
|
|
51002
51009
|
function urlIsHttpHttpsScheme(url2) {
|
|
51003
|
-
|
|
51010
|
+
assert2("protocol" in url2);
|
|
51004
51011
|
const protocol = url2.protocol;
|
|
51005
51012
|
return protocol === "http:" || protocol === "https:";
|
|
51006
51013
|
}
|
|
@@ -51442,7 +51449,7 @@ var require_webidl = __commonJS({
|
|
|
51442
51449
|
// node_modules/undici/lib/fetch/dataURL.js
|
|
51443
51450
|
var require_dataURL = __commonJS({
|
|
51444
51451
|
"node_modules/undici/lib/fetch/dataURL.js"(exports2, module2) {
|
|
51445
|
-
var
|
|
51452
|
+
var assert2 = require("assert");
|
|
51446
51453
|
var { atob: atob2 } = require("buffer");
|
|
51447
51454
|
var { isomorphicDecode } = require_util3();
|
|
51448
51455
|
var encoder = new TextEncoder();
|
|
@@ -51450,7 +51457,7 @@ var require_dataURL = __commonJS({
|
|
|
51450
51457
|
var HTTP_WHITESPACE_REGEX = /(\u000A|\u000D|\u0009|\u0020)/;
|
|
51451
51458
|
var HTTP_QUOTED_STRING_TOKENS = /[\u0009|\u0020-\u007E|\u0080-\u00FF]/;
|
|
51452
51459
|
function dataURLProcessor(dataURL) {
|
|
51453
|
-
|
|
51460
|
+
assert2(dataURL.protocol === "data:");
|
|
51454
51461
|
let input = URLSerializer(dataURL, true);
|
|
51455
51462
|
input = input.slice(5);
|
|
51456
51463
|
const position = { position: 0 };
|
|
@@ -51636,7 +51643,7 @@ var require_dataURL = __commonJS({
|
|
|
51636
51643
|
function collectAnHTTPQuotedString(input, position, extractValue) {
|
|
51637
51644
|
const positionStart = position.position;
|
|
51638
51645
|
let value = "";
|
|
51639
|
-
|
|
51646
|
+
assert2(input[position.position] === '"');
|
|
51640
51647
|
position.position++;
|
|
51641
51648
|
while (true) {
|
|
51642
51649
|
value += collectASequenceOfCodePoints(
|
|
@@ -51657,7 +51664,7 @@ var require_dataURL = __commonJS({
|
|
|
51657
51664
|
value += input[position.position];
|
|
51658
51665
|
position.position++;
|
|
51659
51666
|
} else {
|
|
51660
|
-
|
|
51667
|
+
assert2(quoteOrBackslash === '"');
|
|
51661
51668
|
break;
|
|
51662
51669
|
}
|
|
51663
51670
|
}
|
|
@@ -51667,7 +51674,7 @@ var require_dataURL = __commonJS({
|
|
|
51667
51674
|
return input.slice(positionStart, position.position);
|
|
51668
51675
|
}
|
|
51669
51676
|
function serializeAMimeType(mimeType) {
|
|
51670
|
-
|
|
51677
|
+
assert2(mimeType !== "failure");
|
|
51671
51678
|
const { parameters, essence } = mimeType;
|
|
51672
51679
|
let serialization = essence;
|
|
51673
51680
|
for (let [name, value] of parameters.entries()) {
|
|
@@ -52086,7 +52093,7 @@ var require_body = __commonJS({
|
|
|
52086
52093
|
var { DOMException: DOMException3, structuredClone: structuredClone2 } = require_constants3();
|
|
52087
52094
|
var { Blob: Blob5, File: NativeFile } = require("buffer");
|
|
52088
52095
|
var { kBodyUsed } = require_symbols();
|
|
52089
|
-
var
|
|
52096
|
+
var assert2 = require("assert");
|
|
52090
52097
|
var { isErrored } = require_util2();
|
|
52091
52098
|
var { isUint8Array, isArrayBuffer: isArrayBuffer3 } = require("util/types");
|
|
52092
52099
|
var { File: UndiciFile } = require_file();
|
|
@@ -52124,7 +52131,7 @@ var require_body = __commonJS({
|
|
|
52124
52131
|
type: void 0
|
|
52125
52132
|
});
|
|
52126
52133
|
}
|
|
52127
|
-
|
|
52134
|
+
assert2(isReadableStreamLike(stream4));
|
|
52128
52135
|
let action = null;
|
|
52129
52136
|
let source = null;
|
|
52130
52137
|
let length = null;
|
|
@@ -52240,8 +52247,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
52240
52247
|
ReadableStream7 = require("stream/web").ReadableStream;
|
|
52241
52248
|
}
|
|
52242
52249
|
if (object instanceof ReadableStream7) {
|
|
52243
|
-
|
|
52244
|
-
|
|
52250
|
+
assert2(!util4.isDisturbed(object), "The body has already been consumed.");
|
|
52251
|
+
assert2(!object.locked, "The stream is locked.");
|
|
52245
52252
|
}
|
|
52246
52253
|
return extractBody(object, keepalive);
|
|
52247
52254
|
}
|
|
@@ -52452,7 +52459,7 @@ var require_request = __commonJS({
|
|
|
52452
52459
|
InvalidArgumentError,
|
|
52453
52460
|
NotSupportedError
|
|
52454
52461
|
} = require_errors3();
|
|
52455
|
-
var
|
|
52462
|
+
var assert2 = require("assert");
|
|
52456
52463
|
var { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = require_symbols();
|
|
52457
52464
|
var util4 = require_util2();
|
|
52458
52465
|
var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/;
|
|
@@ -52633,8 +52640,8 @@ var require_request = __commonJS({
|
|
|
52633
52640
|
}
|
|
52634
52641
|
}
|
|
52635
52642
|
onConnect(abort) {
|
|
52636
|
-
|
|
52637
|
-
|
|
52643
|
+
assert2(!this.aborted);
|
|
52644
|
+
assert2(!this.completed);
|
|
52638
52645
|
if (this.error) {
|
|
52639
52646
|
abort(this.error);
|
|
52640
52647
|
} else {
|
|
@@ -52642,21 +52649,21 @@ var require_request = __commonJS({
|
|
|
52642
52649
|
return this[kHandler].onConnect(abort);
|
|
52643
52650
|
}
|
|
52644
52651
|
}
|
|
52645
|
-
onHeaders(statusCode, headers,
|
|
52646
|
-
|
|
52647
|
-
|
|
52652
|
+
onHeaders(statusCode, headers, resume2, statusText) {
|
|
52653
|
+
assert2(!this.aborted);
|
|
52654
|
+
assert2(!this.completed);
|
|
52648
52655
|
if (channels.headers.hasSubscribers) {
|
|
52649
52656
|
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
|
|
52650
52657
|
}
|
|
52651
52658
|
try {
|
|
52652
|
-
return this[kHandler].onHeaders(statusCode, headers,
|
|
52659
|
+
return this[kHandler].onHeaders(statusCode, headers, resume2, statusText);
|
|
52653
52660
|
} catch (err) {
|
|
52654
52661
|
this.abort(err);
|
|
52655
52662
|
}
|
|
52656
52663
|
}
|
|
52657
52664
|
onData(chunk) {
|
|
52658
|
-
|
|
52659
|
-
|
|
52665
|
+
assert2(!this.aborted);
|
|
52666
|
+
assert2(!this.completed);
|
|
52660
52667
|
try {
|
|
52661
52668
|
return this[kHandler].onData(chunk);
|
|
52662
52669
|
} catch (err) {
|
|
@@ -52665,13 +52672,13 @@ var require_request = __commonJS({
|
|
|
52665
52672
|
}
|
|
52666
52673
|
}
|
|
52667
52674
|
onUpgrade(statusCode, headers, socket) {
|
|
52668
|
-
|
|
52669
|
-
|
|
52675
|
+
assert2(!this.aborted);
|
|
52676
|
+
assert2(!this.completed);
|
|
52670
52677
|
return this[kHandler].onUpgrade(statusCode, headers, socket);
|
|
52671
52678
|
}
|
|
52672
52679
|
onComplete(trailers) {
|
|
52673
52680
|
this.onFinally();
|
|
52674
|
-
|
|
52681
|
+
assert2(!this.aborted);
|
|
52675
52682
|
this.completed = true;
|
|
52676
52683
|
if (channels.trailers.hasSubscribers) {
|
|
52677
52684
|
channels.trailers.publish({ request: this, trailers });
|
|
@@ -53001,11 +53008,11 @@ var require_dispatcher_base = __commonJS({
|
|
|
53001
53008
|
var require_connect = __commonJS({
|
|
53002
53009
|
"node_modules/undici/lib/core/connect.js"(exports2, module2) {
|
|
53003
53010
|
"use strict";
|
|
53004
|
-
var
|
|
53005
|
-
var
|
|
53011
|
+
var net3 = require("net");
|
|
53012
|
+
var assert2 = require("assert");
|
|
53006
53013
|
var util4 = require_util2();
|
|
53007
53014
|
var { InvalidArgumentError, ConnectTimeoutError } = require_errors3();
|
|
53008
|
-
var
|
|
53015
|
+
var tls2;
|
|
53009
53016
|
var SessionCache;
|
|
53010
53017
|
if (global.FinalizationRegistry && !process.env.NODE_V8_COVERAGE) {
|
|
53011
53018
|
SessionCache = class WeakSessionCache {
|
|
@@ -53063,17 +53070,17 @@ var require_connect = __commonJS({
|
|
|
53063
53070
|
const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions);
|
|
53064
53071
|
timeout = timeout == null ? 1e4 : timeout;
|
|
53065
53072
|
allowH2 = allowH2 != null ? allowH2 : false;
|
|
53066
|
-
return function
|
|
53073
|
+
return function connect3({ hostname, host, protocol, port, servername, localAddress, httpSocket }, callback) {
|
|
53067
53074
|
let socket;
|
|
53068
53075
|
if (protocol === "https:") {
|
|
53069
|
-
if (!
|
|
53070
|
-
|
|
53076
|
+
if (!tls2) {
|
|
53077
|
+
tls2 = require("tls");
|
|
53071
53078
|
}
|
|
53072
53079
|
servername = servername || options.servername || util4.getServerName(host) || null;
|
|
53073
53080
|
const sessionKey = servername || hostname;
|
|
53074
53081
|
const session = sessionCache.get(sessionKey) || null;
|
|
53075
|
-
|
|
53076
|
-
socket =
|
|
53082
|
+
assert2(sessionKey);
|
|
53083
|
+
socket = tls2.connect({
|
|
53077
53084
|
highWaterMark: 16384,
|
|
53078
53085
|
// TLS in node can't have bigger HWM anyway...
|
|
53079
53086
|
...options,
|
|
@@ -53091,8 +53098,8 @@ var require_connect = __commonJS({
|
|
|
53091
53098
|
sessionCache.set(sessionKey, session2);
|
|
53092
53099
|
});
|
|
53093
53100
|
} else {
|
|
53094
|
-
|
|
53095
|
-
socket =
|
|
53101
|
+
assert2(!httpSocket, "httpSocket can only be sent on TLS update");
|
|
53102
|
+
socket = net3.connect({
|
|
53096
53103
|
highWaterMark: 64 * 1024,
|
|
53097
53104
|
// Same as nodejs fs streams.
|
|
53098
53105
|
...options,
|
|
@@ -53500,7 +53507,7 @@ var require_RedirectHandler = __commonJS({
|
|
|
53500
53507
|
"use strict";
|
|
53501
53508
|
var util4 = require_util2();
|
|
53502
53509
|
var { kBodyUsed } = require_symbols();
|
|
53503
|
-
var
|
|
53510
|
+
var assert2 = require("assert");
|
|
53504
53511
|
var { InvalidArgumentError } = require_errors3();
|
|
53505
53512
|
var EE = require("events");
|
|
53506
53513
|
var redirectableStatusCodes = [300, 301, 302, 303, 307, 308];
|
|
@@ -53511,7 +53518,7 @@ var require_RedirectHandler = __commonJS({
|
|
|
53511
53518
|
this[kBodyUsed] = false;
|
|
53512
53519
|
}
|
|
53513
53520
|
async *[Symbol.asyncIterator]() {
|
|
53514
|
-
|
|
53521
|
+
assert2(!this[kBodyUsed], "disturbed");
|
|
53515
53522
|
this[kBodyUsed] = true;
|
|
53516
53523
|
yield* this[kBody];
|
|
53517
53524
|
}
|
|
@@ -53532,7 +53539,7 @@ var require_RedirectHandler = __commonJS({
|
|
|
53532
53539
|
if (util4.isStream(this.opts.body)) {
|
|
53533
53540
|
if (util4.bodyLength(this.opts.body) === 0) {
|
|
53534
53541
|
this.opts.body.on("data", function() {
|
|
53535
|
-
|
|
53542
|
+
assert2(false);
|
|
53536
53543
|
});
|
|
53537
53544
|
}
|
|
53538
53545
|
if (typeof this.opts.body.readableDidRead !== "boolean") {
|
|
@@ -53557,13 +53564,13 @@ var require_RedirectHandler = __commonJS({
|
|
|
53557
53564
|
onError(error) {
|
|
53558
53565
|
this.handler.onError(error);
|
|
53559
53566
|
}
|
|
53560
|
-
onHeaders(statusCode, headers,
|
|
53567
|
+
onHeaders(statusCode, headers, resume2, statusText) {
|
|
53561
53568
|
this.location = this.history.length >= this.maxRedirections || util4.isDisturbed(this.opts.body) ? null : parseLocation(statusCode, headers);
|
|
53562
53569
|
if (this.opts.origin) {
|
|
53563
53570
|
this.history.push(new URL(this.opts.path, this.opts.origin));
|
|
53564
53571
|
}
|
|
53565
53572
|
if (!this.location) {
|
|
53566
|
-
return this.handler.onHeaders(statusCode, headers,
|
|
53573
|
+
return this.handler.onHeaders(statusCode, headers, resume2, statusText);
|
|
53567
53574
|
}
|
|
53568
53575
|
const { origin: origin2, pathname, search } = util4.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
53569
53576
|
const path5 = search ? `${pathname}${search}` : pathname;
|
|
@@ -53636,7 +53643,7 @@ var require_RedirectHandler = __commonJS({
|
|
|
53636
53643
|
}
|
|
53637
53644
|
}
|
|
53638
53645
|
} else {
|
|
53639
|
-
|
|
53646
|
+
assert2(headers == null, "headers must be an object or an array");
|
|
53640
53647
|
}
|
|
53641
53648
|
return ret;
|
|
53642
53649
|
}
|
|
@@ -53684,9 +53691,9 @@ var require_llhttp_simd_wasm = __commonJS({
|
|
|
53684
53691
|
var require_client = __commonJS({
|
|
53685
53692
|
"node_modules/undici/lib/client.js"(exports2, module2) {
|
|
53686
53693
|
"use strict";
|
|
53687
|
-
var
|
|
53688
|
-
var
|
|
53689
|
-
var
|
|
53694
|
+
var assert2 = require("assert");
|
|
53695
|
+
var net3 = require("net");
|
|
53696
|
+
var http4 = require("http");
|
|
53690
53697
|
var { pipeline } = require("stream");
|
|
53691
53698
|
var util4 = require_util2();
|
|
53692
53699
|
var timers = require_timers();
|
|
@@ -53814,11 +53821,11 @@ var require_client = __commonJS({
|
|
|
53814
53821
|
keepAliveTimeoutThreshold,
|
|
53815
53822
|
socketPath,
|
|
53816
53823
|
pipelining,
|
|
53817
|
-
tls,
|
|
53824
|
+
tls: tls2,
|
|
53818
53825
|
strictContentLength,
|
|
53819
53826
|
maxCachedSessions,
|
|
53820
53827
|
maxRedirections,
|
|
53821
|
-
connect:
|
|
53828
|
+
connect: connect4,
|
|
53822
53829
|
maxRequestsPerClient,
|
|
53823
53830
|
localAddress,
|
|
53824
53831
|
maxResponseSize,
|
|
@@ -53868,7 +53875,7 @@ var require_client = __commonJS({
|
|
|
53868
53875
|
if (bodyTimeout != null && (!Number.isInteger(bodyTimeout) || bodyTimeout < 0)) {
|
|
53869
53876
|
throw new InvalidArgumentError("bodyTimeout must be a positive integer or zero");
|
|
53870
53877
|
}
|
|
53871
|
-
if (
|
|
53878
|
+
if (connect4 != null && typeof connect4 !== "function" && typeof connect4 !== "object") {
|
|
53872
53879
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
53873
53880
|
}
|
|
53874
53881
|
if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
|
|
@@ -53877,7 +53884,7 @@ var require_client = __commonJS({
|
|
|
53877
53884
|
if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
|
|
53878
53885
|
throw new InvalidArgumentError("maxRequestsPerClient must be a positive number");
|
|
53879
53886
|
}
|
|
53880
|
-
if (localAddress != null && (typeof localAddress !== "string" ||
|
|
53887
|
+
if (localAddress != null && (typeof localAddress !== "string" || net3.isIP(localAddress) === 0)) {
|
|
53881
53888
|
throw new InvalidArgumentError("localAddress must be valid string IP address");
|
|
53882
53889
|
}
|
|
53883
53890
|
if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
|
|
@@ -53892,23 +53899,23 @@ var require_client = __commonJS({
|
|
|
53892
53899
|
if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== "number" || maxConcurrentStreams < 1)) {
|
|
53893
53900
|
throw new InvalidArgumentError("maxConcurrentStreams must be a possitive integer, greater than 0");
|
|
53894
53901
|
}
|
|
53895
|
-
if (typeof
|
|
53896
|
-
|
|
53897
|
-
...
|
|
53902
|
+
if (typeof connect4 !== "function") {
|
|
53903
|
+
connect4 = buildConnector({
|
|
53904
|
+
...tls2,
|
|
53898
53905
|
maxCachedSessions,
|
|
53899
53906
|
allowH2,
|
|
53900
53907
|
socketPath,
|
|
53901
53908
|
timeout: connectTimeout,
|
|
53902
53909
|
...util4.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
53903
|
-
...
|
|
53910
|
+
...connect4
|
|
53904
53911
|
});
|
|
53905
53912
|
}
|
|
53906
53913
|
this[kInterceptors] = interceptors && interceptors.Client && Array.isArray(interceptors.Client) ? interceptors.Client : [createRedirectInterceptor({ maxRedirections })];
|
|
53907
53914
|
this[kUrl] = util4.parseOrigin(url2);
|
|
53908
|
-
this[kConnector] =
|
|
53915
|
+
this[kConnector] = connect4;
|
|
53909
53916
|
this[kSocket] = null;
|
|
53910
53917
|
this[kPipelining] = pipelining != null ? pipelining : 1;
|
|
53911
|
-
this[kMaxHeadersSize] = maxHeaderSize ||
|
|
53918
|
+
this[kMaxHeadersSize] = maxHeaderSize || http4.maxHeaderSize;
|
|
53912
53919
|
this[kKeepAliveDefaultTimeout] = keepAliveTimeout == null ? 4e3 : keepAliveTimeout;
|
|
53913
53920
|
this[kKeepAliveMaxTimeout] = keepAliveMaxTimeout == null ? 6e5 : keepAliveMaxTimeout;
|
|
53914
53921
|
this[kKeepAliveTimeoutThreshold] = keepAliveTimeoutThreshold == null ? 1e3 : keepAliveTimeoutThreshold;
|
|
@@ -53945,7 +53952,7 @@ var require_client = __commonJS({
|
|
|
53945
53952
|
}
|
|
53946
53953
|
set pipelining(value) {
|
|
53947
53954
|
this[kPipelining] = value;
|
|
53948
|
-
|
|
53955
|
+
resume2(this, true);
|
|
53949
53956
|
}
|
|
53950
53957
|
get [kPending]() {
|
|
53951
53958
|
return this[kQueue].length - this[kPendingIdx];
|
|
@@ -53965,7 +53972,7 @@ var require_client = __commonJS({
|
|
|
53965
53972
|
}
|
|
53966
53973
|
/* istanbul ignore: only used for test */
|
|
53967
53974
|
[kConnect](cb) {
|
|
53968
|
-
|
|
53975
|
+
connect3(this);
|
|
53969
53976
|
this.once("connect", cb);
|
|
53970
53977
|
}
|
|
53971
53978
|
[kDispatch](opts, handler) {
|
|
@@ -53975,9 +53982,9 @@ var require_client = __commonJS({
|
|
|
53975
53982
|
if (this[kResuming]) {
|
|
53976
53983
|
} else if (util4.bodyLength(request3.body) == null && util4.isIterable(request3.body)) {
|
|
53977
53984
|
this[kResuming] = 1;
|
|
53978
|
-
process.nextTick(
|
|
53985
|
+
process.nextTick(resume2, this);
|
|
53979
53986
|
} else {
|
|
53980
|
-
|
|
53987
|
+
resume2(this, true);
|
|
53981
53988
|
}
|
|
53982
53989
|
if (this[kResuming] && this[kNeedDrain] !== 2 && this[kBusy]) {
|
|
53983
53990
|
this[kNeedDrain] = 2;
|
|
@@ -54017,12 +54024,12 @@ var require_client = __commonJS({
|
|
|
54017
54024
|
} else {
|
|
54018
54025
|
util4.destroy(this[kSocket].on("close", callback), err);
|
|
54019
54026
|
}
|
|
54020
|
-
|
|
54027
|
+
resume2(this);
|
|
54021
54028
|
});
|
|
54022
54029
|
}
|
|
54023
54030
|
};
|
|
54024
54031
|
function onHttp2SessionError(err) {
|
|
54025
|
-
|
|
54032
|
+
assert2(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
54026
54033
|
this[kSocket][kError] = err;
|
|
54027
54034
|
onError(this[kClient], err);
|
|
54028
54035
|
}
|
|
@@ -54043,7 +54050,7 @@ var require_client = __commonJS({
|
|
|
54043
54050
|
client[kSocket] = null;
|
|
54044
54051
|
client[kHTTP2Session] = null;
|
|
54045
54052
|
if (client.destroyed) {
|
|
54046
|
-
|
|
54053
|
+
assert2(this[kPending] === 0);
|
|
54047
54054
|
const requests = client[kQueue].splice(client[kRunningIdx]);
|
|
54048
54055
|
for (let i3 = 0; i3 < requests.length; i3++) {
|
|
54049
54056
|
const request3 = requests[i3];
|
|
@@ -54055,14 +54062,14 @@ var require_client = __commonJS({
|
|
|
54055
54062
|
errorRequest(client, request3, err);
|
|
54056
54063
|
}
|
|
54057
54064
|
client[kPendingIdx] = client[kRunningIdx];
|
|
54058
|
-
|
|
54065
|
+
assert2(client[kRunning] === 0);
|
|
54059
54066
|
client.emit(
|
|
54060
54067
|
"disconnect",
|
|
54061
54068
|
client[kUrl],
|
|
54062
54069
|
[client],
|
|
54063
54070
|
err
|
|
54064
54071
|
);
|
|
54065
|
-
|
|
54072
|
+
resume2(client);
|
|
54066
54073
|
}
|
|
54067
54074
|
var constants3 = require_constants4();
|
|
54068
54075
|
var createRedirectInterceptor = require_redirectInterceptor();
|
|
@@ -54082,35 +54089,35 @@ var require_client = __commonJS({
|
|
|
54082
54089
|
return 0;
|
|
54083
54090
|
},
|
|
54084
54091
|
wasm_on_status: (p4, at2, len) => {
|
|
54085
|
-
|
|
54092
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54086
54093
|
const start = at2 - currentBufferPtr + currentBufferRef.byteOffset;
|
|
54087
54094
|
return currentParser.onStatus(new FastBuffer(currentBufferRef.buffer, start, len)) || 0;
|
|
54088
54095
|
},
|
|
54089
54096
|
wasm_on_message_begin: (p4) => {
|
|
54090
|
-
|
|
54097
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54091
54098
|
return currentParser.onMessageBegin() || 0;
|
|
54092
54099
|
},
|
|
54093
54100
|
wasm_on_header_field: (p4, at2, len) => {
|
|
54094
|
-
|
|
54101
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54095
54102
|
const start = at2 - currentBufferPtr + currentBufferRef.byteOffset;
|
|
54096
54103
|
return currentParser.onHeaderField(new FastBuffer(currentBufferRef.buffer, start, len)) || 0;
|
|
54097
54104
|
},
|
|
54098
54105
|
wasm_on_header_value: (p4, at2, len) => {
|
|
54099
|
-
|
|
54106
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54100
54107
|
const start = at2 - currentBufferPtr + currentBufferRef.byteOffset;
|
|
54101
54108
|
return currentParser.onHeaderValue(new FastBuffer(currentBufferRef.buffer, start, len)) || 0;
|
|
54102
54109
|
},
|
|
54103
54110
|
wasm_on_headers_complete: (p4, statusCode, upgrade, shouldKeepAlive) => {
|
|
54104
|
-
|
|
54111
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54105
54112
|
return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0;
|
|
54106
54113
|
},
|
|
54107
54114
|
wasm_on_body: (p4, at2, len) => {
|
|
54108
|
-
|
|
54115
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54109
54116
|
const start = at2 - currentBufferPtr + currentBufferRef.byteOffset;
|
|
54110
54117
|
return currentParser.onBody(new FastBuffer(currentBufferRef.buffer, start, len)) || 0;
|
|
54111
54118
|
},
|
|
54112
54119
|
wasm_on_message_complete: (p4) => {
|
|
54113
|
-
|
|
54120
|
+
assert2.strictEqual(currentParser.ptr, p4);
|
|
54114
54121
|
return currentParser.onMessageComplete() || 0;
|
|
54115
54122
|
}
|
|
54116
54123
|
/* eslint-enable camelcase */
|
|
@@ -54129,7 +54136,7 @@ var require_client = __commonJS({
|
|
|
54129
54136
|
var TIMEOUT_IDLE = 3;
|
|
54130
54137
|
var Parser = class {
|
|
54131
54138
|
constructor(client, socket, { exports: exports3 }) {
|
|
54132
|
-
|
|
54139
|
+
assert2(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
|
|
54133
54140
|
this.llhttp = exports3;
|
|
54134
54141
|
this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
|
|
54135
54142
|
this.client = client;
|
|
@@ -54175,10 +54182,10 @@ var require_client = __commonJS({
|
|
|
54175
54182
|
if (this.socket.destroyed || !this.paused) {
|
|
54176
54183
|
return;
|
|
54177
54184
|
}
|
|
54178
|
-
|
|
54179
|
-
|
|
54185
|
+
assert2(this.ptr != null);
|
|
54186
|
+
assert2(currentParser == null);
|
|
54180
54187
|
this.llhttp.llhttp_resume(this.ptr);
|
|
54181
|
-
|
|
54188
|
+
assert2(this.timeoutType === TIMEOUT_BODY);
|
|
54182
54189
|
if (this.timeout) {
|
|
54183
54190
|
if (this.timeout.refresh) {
|
|
54184
54191
|
this.timeout.refresh();
|
|
@@ -54198,9 +54205,9 @@ var require_client = __commonJS({
|
|
|
54198
54205
|
}
|
|
54199
54206
|
}
|
|
54200
54207
|
execute(data) {
|
|
54201
|
-
|
|
54202
|
-
|
|
54203
|
-
|
|
54208
|
+
assert2(this.ptr != null);
|
|
54209
|
+
assert2(currentParser == null);
|
|
54210
|
+
assert2(!this.paused);
|
|
54204
54211
|
const { socket, llhttp } = this;
|
|
54205
54212
|
if (data.length > currentBufferSize) {
|
|
54206
54213
|
if (currentBufferPtr) {
|
|
@@ -54242,8 +54249,8 @@ var require_client = __commonJS({
|
|
|
54242
54249
|
}
|
|
54243
54250
|
}
|
|
54244
54251
|
destroy() {
|
|
54245
|
-
|
|
54246
|
-
|
|
54252
|
+
assert2(this.ptr != null);
|
|
54253
|
+
assert2(currentParser == null);
|
|
54247
54254
|
this.llhttp.llhttp_free(this.ptr);
|
|
54248
54255
|
this.ptr = null;
|
|
54249
54256
|
timers.clearTimeout(this.timeout);
|
|
@@ -54300,17 +54307,17 @@ var require_client = __commonJS({
|
|
|
54300
54307
|
}
|
|
54301
54308
|
onUpgrade(head) {
|
|
54302
54309
|
const { upgrade, client, socket, headers, statusCode } = this;
|
|
54303
|
-
|
|
54310
|
+
assert2(upgrade);
|
|
54304
54311
|
const request3 = client[kQueue][client[kRunningIdx]];
|
|
54305
|
-
|
|
54306
|
-
|
|
54307
|
-
|
|
54308
|
-
|
|
54309
|
-
|
|
54312
|
+
assert2(request3);
|
|
54313
|
+
assert2(!socket.destroyed);
|
|
54314
|
+
assert2(socket === client[kSocket]);
|
|
54315
|
+
assert2(!this.paused);
|
|
54316
|
+
assert2(request3.upgrade || request3.method === "CONNECT");
|
|
54310
54317
|
this.statusCode = null;
|
|
54311
54318
|
this.statusText = "";
|
|
54312
54319
|
this.shouldKeepAlive = null;
|
|
54313
|
-
|
|
54320
|
+
assert2(this.headers.length % 2 === 0);
|
|
54314
54321
|
this.headers = [];
|
|
54315
54322
|
this.headersSize = 0;
|
|
54316
54323
|
socket.unshift(head);
|
|
@@ -54327,7 +54334,7 @@ var require_client = __commonJS({
|
|
|
54327
54334
|
} catch (err) {
|
|
54328
54335
|
util4.destroy(socket, err);
|
|
54329
54336
|
}
|
|
54330
|
-
|
|
54337
|
+
resume2(client);
|
|
54331
54338
|
}
|
|
54332
54339
|
onHeadersComplete(statusCode, upgrade, shouldKeepAlive) {
|
|
54333
54340
|
const { client, socket, headers, statusText } = this;
|
|
@@ -54338,8 +54345,8 @@ var require_client = __commonJS({
|
|
|
54338
54345
|
if (!request3) {
|
|
54339
54346
|
return -1;
|
|
54340
54347
|
}
|
|
54341
|
-
|
|
54342
|
-
|
|
54348
|
+
assert2(!this.upgrade);
|
|
54349
|
+
assert2(this.statusCode < 200);
|
|
54343
54350
|
if (statusCode === 100) {
|
|
54344
54351
|
util4.destroy(socket, new SocketError("bad response", util4.getSocketInfo(socket)));
|
|
54345
54352
|
return -1;
|
|
@@ -54348,7 +54355,7 @@ var require_client = __commonJS({
|
|
|
54348
54355
|
util4.destroy(socket, new SocketError("bad upgrade", util4.getSocketInfo(socket)));
|
|
54349
54356
|
return -1;
|
|
54350
54357
|
}
|
|
54351
|
-
|
|
54358
|
+
assert2.strictEqual(this.timeoutType, TIMEOUT_HEADERS);
|
|
54352
54359
|
this.statusCode = statusCode;
|
|
54353
54360
|
this.shouldKeepAlive = shouldKeepAlive || // Override llhttp value which does not allow keepAlive for HEAD.
|
|
54354
54361
|
request3.method === "HEAD" && !socket[kReset] && this.connection.toLowerCase() === "keep-alive";
|
|
@@ -54361,16 +54368,16 @@ var require_client = __commonJS({
|
|
|
54361
54368
|
}
|
|
54362
54369
|
}
|
|
54363
54370
|
if (request3.method === "CONNECT") {
|
|
54364
|
-
|
|
54371
|
+
assert2(client[kRunning] === 1);
|
|
54365
54372
|
this.upgrade = true;
|
|
54366
54373
|
return 2;
|
|
54367
54374
|
}
|
|
54368
54375
|
if (upgrade) {
|
|
54369
|
-
|
|
54376
|
+
assert2(client[kRunning] === 1);
|
|
54370
54377
|
this.upgrade = true;
|
|
54371
54378
|
return 2;
|
|
54372
54379
|
}
|
|
54373
|
-
|
|
54380
|
+
assert2(this.headers.length % 2 === 0);
|
|
54374
54381
|
this.headers = [];
|
|
54375
54382
|
this.headersSize = 0;
|
|
54376
54383
|
if (this.shouldKeepAlive && client[kPipelining]) {
|
|
@@ -54403,7 +54410,7 @@ var require_client = __commonJS({
|
|
|
54403
54410
|
}
|
|
54404
54411
|
if (socket[kBlocking]) {
|
|
54405
54412
|
socket[kBlocking] = false;
|
|
54406
|
-
|
|
54413
|
+
resume2(client);
|
|
54407
54414
|
}
|
|
54408
54415
|
return pause ? constants3.ERROR.PAUSED : 0;
|
|
54409
54416
|
}
|
|
@@ -54413,14 +54420,14 @@ var require_client = __commonJS({
|
|
|
54413
54420
|
return -1;
|
|
54414
54421
|
}
|
|
54415
54422
|
const request3 = client[kQueue][client[kRunningIdx]];
|
|
54416
|
-
|
|
54417
|
-
|
|
54423
|
+
assert2(request3);
|
|
54424
|
+
assert2.strictEqual(this.timeoutType, TIMEOUT_BODY);
|
|
54418
54425
|
if (this.timeout) {
|
|
54419
54426
|
if (this.timeout.refresh) {
|
|
54420
54427
|
this.timeout.refresh();
|
|
54421
54428
|
}
|
|
54422
54429
|
}
|
|
54423
|
-
|
|
54430
|
+
assert2(statusCode >= 200);
|
|
54424
54431
|
if (maxResponseSize > -1 && this.bytesRead + buf.length > maxResponseSize) {
|
|
54425
54432
|
util4.destroy(socket, new ResponseExceededMaxSizeError());
|
|
54426
54433
|
return -1;
|
|
@@ -54439,15 +54446,15 @@ var require_client = __commonJS({
|
|
|
54439
54446
|
return;
|
|
54440
54447
|
}
|
|
54441
54448
|
const request3 = client[kQueue][client[kRunningIdx]];
|
|
54442
|
-
|
|
54443
|
-
|
|
54449
|
+
assert2(request3);
|
|
54450
|
+
assert2(statusCode >= 100);
|
|
54444
54451
|
this.statusCode = null;
|
|
54445
54452
|
this.statusText = "";
|
|
54446
54453
|
this.bytesRead = 0;
|
|
54447
54454
|
this.contentLength = "";
|
|
54448
54455
|
this.keepAlive = "";
|
|
54449
54456
|
this.connection = "";
|
|
54450
|
-
|
|
54457
|
+
assert2(this.headers.length % 2 === 0);
|
|
54451
54458
|
this.headers = [];
|
|
54452
54459
|
this.headersSize = 0;
|
|
54453
54460
|
if (statusCode < 200) {
|
|
@@ -54460,7 +54467,7 @@ var require_client = __commonJS({
|
|
|
54460
54467
|
request3.onComplete(headers);
|
|
54461
54468
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
54462
54469
|
if (socket[kWriting]) {
|
|
54463
|
-
|
|
54470
|
+
assert2.strictEqual(client[kRunning], 0);
|
|
54464
54471
|
util4.destroy(socket, new InformationalError("reset"));
|
|
54465
54472
|
return constants3.ERROR.PAUSED;
|
|
54466
54473
|
} else if (!shouldKeepAlive) {
|
|
@@ -54470,9 +54477,9 @@ var require_client = __commonJS({
|
|
|
54470
54477
|
util4.destroy(socket, new InformationalError("reset"));
|
|
54471
54478
|
return constants3.ERROR.PAUSED;
|
|
54472
54479
|
} else if (client[kPipelining] === 1) {
|
|
54473
|
-
setImmediate(
|
|
54480
|
+
setImmediate(resume2, client);
|
|
54474
54481
|
} else {
|
|
54475
|
-
|
|
54482
|
+
resume2(client);
|
|
54476
54483
|
}
|
|
54477
54484
|
}
|
|
54478
54485
|
};
|
|
@@ -54480,7 +54487,7 @@ var require_client = __commonJS({
|
|
|
54480
54487
|
const { socket, timeoutType, client } = parser;
|
|
54481
54488
|
if (timeoutType === TIMEOUT_HEADERS) {
|
|
54482
54489
|
if (!socket[kWriting] || socket.writableNeedDrain || client[kRunning] > 1) {
|
|
54483
|
-
|
|
54490
|
+
assert2(!parser.paused, "cannot be paused while waiting for headers");
|
|
54484
54491
|
util4.destroy(socket, new HeadersTimeoutError());
|
|
54485
54492
|
}
|
|
54486
54493
|
} else if (timeoutType === TIMEOUT_BODY) {
|
|
@@ -54488,7 +54495,7 @@ var require_client = __commonJS({
|
|
|
54488
54495
|
util4.destroy(socket, new BodyTimeoutError());
|
|
54489
54496
|
}
|
|
54490
54497
|
} else if (timeoutType === TIMEOUT_IDLE) {
|
|
54491
|
-
|
|
54498
|
+
assert2(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]);
|
|
54492
54499
|
util4.destroy(socket, new InformationalError("socket idle timeout"));
|
|
54493
54500
|
}
|
|
54494
54501
|
}
|
|
@@ -54500,7 +54507,7 @@ var require_client = __commonJS({
|
|
|
54500
54507
|
}
|
|
54501
54508
|
function onSocketError(err) {
|
|
54502
54509
|
const { [kClient]: client, [kParser]: parser } = this;
|
|
54503
|
-
|
|
54510
|
+
assert2(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
54504
54511
|
if (client[kHTTPConnVersion] !== "h2") {
|
|
54505
54512
|
if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
|
|
54506
54513
|
parser.onMessageComplete();
|
|
@@ -54512,13 +54519,13 @@ var require_client = __commonJS({
|
|
|
54512
54519
|
}
|
|
54513
54520
|
function onError(client, err) {
|
|
54514
54521
|
if (client[kRunning] === 0 && err.code !== "UND_ERR_INFO" && err.code !== "UND_ERR_SOCKET") {
|
|
54515
|
-
|
|
54522
|
+
assert2(client[kPendingIdx] === client[kRunningIdx]);
|
|
54516
54523
|
const requests = client[kQueue].splice(client[kRunningIdx]);
|
|
54517
54524
|
for (let i3 = 0; i3 < requests.length; i3++) {
|
|
54518
54525
|
const request3 = requests[i3];
|
|
54519
54526
|
errorRequest(client, request3, err);
|
|
54520
54527
|
}
|
|
54521
|
-
|
|
54528
|
+
assert2(client[kSize] === 0);
|
|
54522
54529
|
}
|
|
54523
54530
|
}
|
|
54524
54531
|
function onSocketEnd() {
|
|
@@ -54543,7 +54550,7 @@ var require_client = __commonJS({
|
|
|
54543
54550
|
const err = this[kError] || new SocketError("closed", util4.getSocketInfo(this));
|
|
54544
54551
|
client[kSocket] = null;
|
|
54545
54552
|
if (client.destroyed) {
|
|
54546
|
-
|
|
54553
|
+
assert2(client[kPending] === 0);
|
|
54547
54554
|
const requests = client[kQueue].splice(client[kRunningIdx]);
|
|
54548
54555
|
for (let i3 = 0; i3 < requests.length; i3++) {
|
|
54549
54556
|
const request3 = requests[i3];
|
|
@@ -54555,19 +54562,19 @@ var require_client = __commonJS({
|
|
|
54555
54562
|
errorRequest(client, request3, err);
|
|
54556
54563
|
}
|
|
54557
54564
|
client[kPendingIdx] = client[kRunningIdx];
|
|
54558
|
-
|
|
54565
|
+
assert2(client[kRunning] === 0);
|
|
54559
54566
|
client.emit("disconnect", client[kUrl], [client], err);
|
|
54560
|
-
|
|
54567
|
+
resume2(client);
|
|
54561
54568
|
}
|
|
54562
|
-
async function
|
|
54563
|
-
|
|
54564
|
-
|
|
54569
|
+
async function connect3(client) {
|
|
54570
|
+
assert2(!client[kConnecting]);
|
|
54571
|
+
assert2(!client[kSocket]);
|
|
54565
54572
|
let { host, hostname, protocol, port } = client[kUrl];
|
|
54566
54573
|
if (hostname[0] === "[") {
|
|
54567
54574
|
const idx = hostname.indexOf("]");
|
|
54568
|
-
|
|
54575
|
+
assert2(idx !== -1);
|
|
54569
54576
|
const ip = hostname.substring(1, idx);
|
|
54570
|
-
|
|
54577
|
+
assert2(net3.isIP(ip));
|
|
54571
54578
|
hostname = ip;
|
|
54572
54579
|
}
|
|
54573
54580
|
client[kConnecting] = true;
|
|
@@ -54607,7 +54614,7 @@ var require_client = __commonJS({
|
|
|
54607
54614
|
return;
|
|
54608
54615
|
}
|
|
54609
54616
|
client[kConnecting] = false;
|
|
54610
|
-
|
|
54617
|
+
assert2(socket);
|
|
54611
54618
|
const isH2 = socket.alpnProtocol === "h2";
|
|
54612
54619
|
if (isH2) {
|
|
54613
54620
|
if (!h2ExperimentalWarned) {
|
|
@@ -54683,7 +54690,7 @@ var require_client = __commonJS({
|
|
|
54683
54690
|
});
|
|
54684
54691
|
}
|
|
54685
54692
|
if (err.code === "ERR_TLS_CERT_ALTNAME_INVALID") {
|
|
54686
|
-
|
|
54693
|
+
assert2(client[kRunning] === 0);
|
|
54687
54694
|
while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
|
|
54688
54695
|
const request3 = client[kQueue][client[kPendingIdx]++];
|
|
54689
54696
|
errorRequest(client, request3, err);
|
|
@@ -54693,13 +54700,13 @@ var require_client = __commonJS({
|
|
|
54693
54700
|
}
|
|
54694
54701
|
client.emit("connectionError", client[kUrl], [client], err);
|
|
54695
54702
|
}
|
|
54696
|
-
|
|
54703
|
+
resume2(client);
|
|
54697
54704
|
}
|
|
54698
54705
|
function emitDrain(client) {
|
|
54699
54706
|
client[kNeedDrain] = 0;
|
|
54700
54707
|
client.emit("drain", client[kUrl], [client]);
|
|
54701
54708
|
}
|
|
54702
|
-
function
|
|
54709
|
+
function resume2(client, sync) {
|
|
54703
54710
|
if (client[kResuming] === 2) {
|
|
54704
54711
|
return;
|
|
54705
54712
|
}
|
|
@@ -54715,7 +54722,7 @@ var require_client = __commonJS({
|
|
|
54715
54722
|
function _resume(client, sync) {
|
|
54716
54723
|
while (true) {
|
|
54717
54724
|
if (client.destroyed) {
|
|
54718
|
-
|
|
54725
|
+
assert2(client[kPending] === 0);
|
|
54719
54726
|
return;
|
|
54720
54727
|
}
|
|
54721
54728
|
if (client[kClosedResolve] && !client[kSize]) {
|
|
@@ -54778,7 +54785,7 @@ var require_client = __commonJS({
|
|
|
54778
54785
|
return;
|
|
54779
54786
|
}
|
|
54780
54787
|
if (!socket && !client[kHTTP2Session]) {
|
|
54781
|
-
|
|
54788
|
+
connect3(client);
|
|
54782
54789
|
return;
|
|
54783
54790
|
}
|
|
54784
54791
|
if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
|
@@ -54887,13 +54894,13 @@ upgrade: ${upgrade}\r
|
|
|
54887
54894
|
\r
|
|
54888
54895
|
`, "latin1");
|
|
54889
54896
|
} else {
|
|
54890
|
-
|
|
54897
|
+
assert2(contentLength === null, "no body must not have content length");
|
|
54891
54898
|
socket.write(`${header}\r
|
|
54892
54899
|
`, "latin1");
|
|
54893
54900
|
}
|
|
54894
54901
|
request3.onRequestSent();
|
|
54895
54902
|
} else if (util4.isBuffer(body)) {
|
|
54896
|
-
|
|
54903
|
+
assert2(contentLength === body.byteLength, "buffer body must have content length");
|
|
54897
54904
|
socket.cork();
|
|
54898
54905
|
socket.write(`${header}content-length: ${contentLength}\r
|
|
54899
54906
|
\r
|
|
@@ -54916,7 +54923,7 @@ upgrade: ${upgrade}\r
|
|
|
54916
54923
|
} else if (util4.isIterable(body)) {
|
|
54917
54924
|
writeIterable({ body, client, request: request3, socket, contentLength, header, expectsPayload });
|
|
54918
54925
|
} else {
|
|
54919
|
-
|
|
54926
|
+
assert2(false);
|
|
54920
54927
|
}
|
|
54921
54928
|
return true;
|
|
54922
54929
|
}
|
|
@@ -54985,7 +54992,7 @@ upgrade: ${upgrade}\r
|
|
|
54985
54992
|
process.emitWarning(new RequestContentLengthMismatchError());
|
|
54986
54993
|
}
|
|
54987
54994
|
if (contentLength != null) {
|
|
54988
|
-
|
|
54995
|
+
assert2(body, "no body must not have content length");
|
|
54989
54996
|
headers[HTTP2_HEADER_CONTENT_LENGTH] = `${contentLength}`;
|
|
54990
54997
|
}
|
|
54991
54998
|
session.ref();
|
|
@@ -55041,7 +55048,7 @@ upgrade: ${upgrade}\r
|
|
|
55041
55048
|
if (!body) {
|
|
55042
55049
|
request3.onRequestSent();
|
|
55043
55050
|
} else if (util4.isBuffer(body)) {
|
|
55044
|
-
|
|
55051
|
+
assert2(contentLength === body.byteLength, "buffer body must have content length");
|
|
55045
55052
|
stream4.cork();
|
|
55046
55053
|
stream4.write(body);
|
|
55047
55054
|
stream4.uncork();
|
|
@@ -55095,12 +55102,12 @@ upgrade: ${upgrade}\r
|
|
|
55095
55102
|
socket: client[kSocket]
|
|
55096
55103
|
});
|
|
55097
55104
|
} else {
|
|
55098
|
-
|
|
55105
|
+
assert2(false);
|
|
55099
55106
|
}
|
|
55100
55107
|
}
|
|
55101
55108
|
}
|
|
55102
55109
|
function writeStream({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) {
|
|
55103
|
-
|
|
55110
|
+
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
55104
55111
|
if (client[kHTTPConnVersion] === "h2") {
|
|
55105
55112
|
let onPipeData = function(chunk) {
|
|
55106
55113
|
request3.onBodySent(chunk);
|
|
@@ -55158,7 +55165,7 @@ upgrade: ${upgrade}\r
|
|
|
55158
55165
|
return;
|
|
55159
55166
|
}
|
|
55160
55167
|
finished = true;
|
|
55161
|
-
|
|
55168
|
+
assert2(socket.destroyed || socket[kWriting] && client[kRunning] <= 1);
|
|
55162
55169
|
socket.off("drain", onDrain).off("error", onFinished);
|
|
55163
55170
|
body.removeListener("data", onData).removeListener("end", onFinished).removeListener("error", onFinished).removeListener("close", onAbort);
|
|
55164
55171
|
if (!err) {
|
|
@@ -55182,7 +55189,7 @@ upgrade: ${upgrade}\r
|
|
|
55182
55189
|
socket.on("drain", onDrain).on("error", onFinished);
|
|
55183
55190
|
}
|
|
55184
55191
|
async function writeBlob({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) {
|
|
55185
|
-
|
|
55192
|
+
assert2(contentLength === body.size, "blob body must have content length");
|
|
55186
55193
|
const isH2 = client[kHTTPConnVersion] === "h2";
|
|
55187
55194
|
try {
|
|
55188
55195
|
if (contentLength != null && contentLength !== body.size) {
|
|
@@ -55206,13 +55213,13 @@ upgrade: ${upgrade}\r
|
|
|
55206
55213
|
if (!expectsPayload) {
|
|
55207
55214
|
socket[kReset] = true;
|
|
55208
55215
|
}
|
|
55209
|
-
|
|
55216
|
+
resume2(client);
|
|
55210
55217
|
} catch (err) {
|
|
55211
55218
|
util4.destroy(isH2 ? h2stream : socket, err);
|
|
55212
55219
|
}
|
|
55213
55220
|
}
|
|
55214
55221
|
async function writeIterable({ h2stream, body, client, request: request3, socket, contentLength, header, expectsPayload }) {
|
|
55215
|
-
|
|
55222
|
+
assert2(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
|
55216
55223
|
let callback = null;
|
|
55217
55224
|
function onDrain() {
|
|
55218
55225
|
if (callback) {
|
|
@@ -55222,7 +55229,7 @@ upgrade: ${upgrade}\r
|
|
|
55222
55229
|
}
|
|
55223
55230
|
}
|
|
55224
55231
|
const waitForDrain = () => new Promise((resolve, reject) => {
|
|
55225
|
-
|
|
55232
|
+
assert2(callback === null);
|
|
55226
55233
|
if (socket[kError]) {
|
|
55227
55234
|
reject(socket[kError]);
|
|
55228
55235
|
} else {
|
|
@@ -55364,13 +55371,13 @@ ${len.toString(16)}\r
|
|
|
55364
55371
|
socket[kParser].timeout.refresh();
|
|
55365
55372
|
}
|
|
55366
55373
|
}
|
|
55367
|
-
|
|
55374
|
+
resume2(client);
|
|
55368
55375
|
}
|
|
55369
55376
|
destroy(err) {
|
|
55370
55377
|
const { socket, client } = this;
|
|
55371
55378
|
socket[kWriting] = false;
|
|
55372
55379
|
if (err) {
|
|
55373
|
-
|
|
55380
|
+
assert2(client[kRunning] <= 1, "pipeline should only contain this request");
|
|
55374
55381
|
util4.destroy(socket, err);
|
|
55375
55382
|
}
|
|
55376
55383
|
}
|
|
@@ -55378,7 +55385,7 @@ ${len.toString(16)}\r
|
|
|
55378
55385
|
function errorRequest(client, request3, err) {
|
|
55379
55386
|
try {
|
|
55380
55387
|
request3.onError(err);
|
|
55381
|
-
|
|
55388
|
+
assert2(request3.aborted);
|
|
55382
55389
|
} catch (err2) {
|
|
55383
55390
|
client.emit("error", err2);
|
|
55384
55391
|
}
|
|
@@ -55659,9 +55666,9 @@ var require_pool = __commonJS({
|
|
|
55659
55666
|
constructor(origin2, {
|
|
55660
55667
|
connections,
|
|
55661
55668
|
factory = defaultFactory,
|
|
55662
|
-
connect,
|
|
55669
|
+
connect: connect3,
|
|
55663
55670
|
connectTimeout,
|
|
55664
|
-
tls,
|
|
55671
|
+
tls: tls2,
|
|
55665
55672
|
maxCachedSessions,
|
|
55666
55673
|
socketPath,
|
|
55667
55674
|
autoSelectFamily,
|
|
@@ -55676,24 +55683,24 @@ var require_pool = __commonJS({
|
|
|
55676
55683
|
if (typeof factory !== "function") {
|
|
55677
55684
|
throw new InvalidArgumentError("factory must be a function.");
|
|
55678
55685
|
}
|
|
55679
|
-
if (
|
|
55686
|
+
if (connect3 != null && typeof connect3 !== "function" && typeof connect3 !== "object") {
|
|
55680
55687
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
55681
55688
|
}
|
|
55682
|
-
if (typeof
|
|
55683
|
-
|
|
55684
|
-
...
|
|
55689
|
+
if (typeof connect3 !== "function") {
|
|
55690
|
+
connect3 = buildConnector({
|
|
55691
|
+
...tls2,
|
|
55685
55692
|
maxCachedSessions,
|
|
55686
55693
|
allowH2,
|
|
55687
55694
|
socketPath,
|
|
55688
55695
|
timeout: connectTimeout,
|
|
55689
55696
|
...util4.nodeHasAutoSelectFamily && autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
55690
|
-
...
|
|
55697
|
+
...connect3
|
|
55691
55698
|
});
|
|
55692
55699
|
}
|
|
55693
55700
|
this[kInterceptors] = options.interceptors && options.interceptors.Pool && Array.isArray(options.interceptors.Pool) ? options.interceptors.Pool : [];
|
|
55694
55701
|
this[kConnections] = connections || null;
|
|
55695
55702
|
this[kUrl] = util4.parseOrigin(origin2);
|
|
55696
|
-
this[kOptions] = { ...util4.deepClone(options), connect, allowH2 };
|
|
55703
|
+
this[kOptions] = { ...util4.deepClone(options), connect: connect3, allowH2 };
|
|
55697
55704
|
this[kOptions].interceptors = options.interceptors ? { ...options.interceptors } : void 0;
|
|
55698
55705
|
this[kFactory] = factory;
|
|
55699
55706
|
this.on("connectionError", (origin3, targets, error) => {
|
|
@@ -55921,23 +55928,23 @@ var require_agent2 = __commonJS({
|
|
|
55921
55928
|
function defaultFactory(origin2, opts) {
|
|
55922
55929
|
return opts && opts.connections === 1 ? new Client(origin2, opts) : new Pool(origin2, opts);
|
|
55923
55930
|
}
|
|
55924
|
-
var
|
|
55925
|
-
constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
55931
|
+
var Agent6 = class extends DispatcherBase {
|
|
55932
|
+
constructor({ factory = defaultFactory, maxRedirections = 0, connect: connect3, ...options } = {}) {
|
|
55926
55933
|
super();
|
|
55927
55934
|
if (typeof factory !== "function") {
|
|
55928
55935
|
throw new InvalidArgumentError("factory must be a function.");
|
|
55929
55936
|
}
|
|
55930
|
-
if (
|
|
55937
|
+
if (connect3 != null && typeof connect3 !== "function" && typeof connect3 !== "object") {
|
|
55931
55938
|
throw new InvalidArgumentError("connect must be a function or an object");
|
|
55932
55939
|
}
|
|
55933
55940
|
if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {
|
|
55934
55941
|
throw new InvalidArgumentError("maxRedirections must be a positive number");
|
|
55935
55942
|
}
|
|
55936
|
-
if (
|
|
55937
|
-
|
|
55943
|
+
if (connect3 && typeof connect3 !== "function") {
|
|
55944
|
+
connect3 = { ...connect3 };
|
|
55938
55945
|
}
|
|
55939
55946
|
this[kInterceptors] = options.interceptors && options.interceptors.Agent && Array.isArray(options.interceptors.Agent) ? options.interceptors.Agent : [createRedirectInterceptor({ maxRedirections })];
|
|
55940
|
-
this[kOptions] = { ...util4.deepClone(options), connect };
|
|
55947
|
+
this[kOptions] = { ...util4.deepClone(options), connect: connect3 };
|
|
55941
55948
|
this[kOptions].interceptors = options.interceptors ? { ...options.interceptors } : void 0;
|
|
55942
55949
|
this[kMaxRedirections] = maxRedirections;
|
|
55943
55950
|
this[kFactory] = factory;
|
|
@@ -56012,7 +56019,7 @@ var require_agent2 = __commonJS({
|
|
|
56012
56019
|
await Promise.all(destroyPromises);
|
|
56013
56020
|
}
|
|
56014
56021
|
};
|
|
56015
|
-
module2.exports =
|
|
56022
|
+
module2.exports = Agent6;
|
|
56016
56023
|
}
|
|
56017
56024
|
});
|
|
56018
56025
|
|
|
@@ -56020,7 +56027,7 @@ var require_agent2 = __commonJS({
|
|
|
56020
56027
|
var require_readable = __commonJS({
|
|
56021
56028
|
"node_modules/undici/lib/api/readable.js"(exports2, module2) {
|
|
56022
56029
|
"use strict";
|
|
56023
|
-
var
|
|
56030
|
+
var assert2 = require("assert");
|
|
56024
56031
|
var { Readable: Readable5 } = require("stream");
|
|
56025
56032
|
var { RequestAbortedError, NotSupportedError, InvalidArgumentError } = require_errors3();
|
|
56026
56033
|
var util4 = require_util2();
|
|
@@ -56035,7 +56042,7 @@ var require_readable = __commonJS({
|
|
|
56035
56042
|
};
|
|
56036
56043
|
module2.exports = class BodyReadable extends Readable5 {
|
|
56037
56044
|
constructor({
|
|
56038
|
-
resume,
|
|
56045
|
+
resume: resume2,
|
|
56039
56046
|
abort,
|
|
56040
56047
|
contentType = "",
|
|
56041
56048
|
highWaterMark = 64 * 1024
|
|
@@ -56043,7 +56050,7 @@ var require_readable = __commonJS({
|
|
|
56043
56050
|
}) {
|
|
56044
56051
|
super({
|
|
56045
56052
|
autoDestroy: true,
|
|
56046
|
-
read:
|
|
56053
|
+
read: resume2,
|
|
56047
56054
|
highWaterMark
|
|
56048
56055
|
});
|
|
56049
56056
|
this._readableState.dataEmitted = false;
|
|
@@ -56129,7 +56136,7 @@ var require_readable = __commonJS({
|
|
|
56129
56136
|
this[kBody] = ReadableStreamFrom(this);
|
|
56130
56137
|
if (this[kConsume]) {
|
|
56131
56138
|
this[kBody].getReader();
|
|
56132
|
-
|
|
56139
|
+
assert2(this[kBody].locked);
|
|
56133
56140
|
}
|
|
56134
56141
|
}
|
|
56135
56142
|
return this[kBody];
|
|
@@ -56180,7 +56187,7 @@ var require_readable = __commonJS({
|
|
|
56180
56187
|
if (isUnusable(stream4)) {
|
|
56181
56188
|
throw new TypeError("unusable");
|
|
56182
56189
|
}
|
|
56183
|
-
|
|
56190
|
+
assert2(!stream4[kConsume]);
|
|
56184
56191
|
return new Promise((resolve, reject) => {
|
|
56185
56192
|
stream4[kConsume] = {
|
|
56186
56193
|
type: type2,
|
|
@@ -56271,13 +56278,13 @@ var require_readable = __commonJS({
|
|
|
56271
56278
|
// node_modules/undici/lib/api/util.js
|
|
56272
56279
|
var require_util4 = __commonJS({
|
|
56273
56280
|
"node_modules/undici/lib/api/util.js"(exports2, module2) {
|
|
56274
|
-
var
|
|
56281
|
+
var assert2 = require("assert");
|
|
56275
56282
|
var {
|
|
56276
56283
|
ResponseStatusCodeError
|
|
56277
56284
|
} = require_errors3();
|
|
56278
56285
|
var { toUSVString } = require_util2();
|
|
56279
56286
|
async function getResolveErrorBodyCallback({ callback, body, contentType, statusCode, statusMessage, headers }) {
|
|
56280
|
-
|
|
56287
|
+
assert2(body);
|
|
56281
56288
|
let chunks = [];
|
|
56282
56289
|
let limit = 0;
|
|
56283
56290
|
for await (const chunk of body) {
|
|
@@ -56427,7 +56434,7 @@ var require_api_request = __commonJS({
|
|
|
56427
56434
|
this.abort = abort;
|
|
56428
56435
|
this.context = context;
|
|
56429
56436
|
}
|
|
56430
|
-
onHeaders(statusCode, rawHeaders,
|
|
56437
|
+
onHeaders(statusCode, rawHeaders, resume2, statusMessage) {
|
|
56431
56438
|
const { callback, opaque, abort, context, responseHeaders, highWaterMark } = this;
|
|
56432
56439
|
const headers = responseHeaders === "raw" ? util4.parseRawHeaders(rawHeaders) : util4.parseHeaders(rawHeaders);
|
|
56433
56440
|
if (statusCode < 200) {
|
|
@@ -56438,7 +56445,7 @@ var require_api_request = __commonJS({
|
|
|
56438
56445
|
}
|
|
56439
56446
|
const parsedHeaders = responseHeaders === "raw" ? util4.parseHeaders(rawHeaders) : headers;
|
|
56440
56447
|
const contentType = parsedHeaders["content-type"];
|
|
56441
|
-
const body = new Readable5({ resume, abort, contentType, highWaterMark });
|
|
56448
|
+
const body = new Readable5({ resume: resume2, abort, contentType, highWaterMark });
|
|
56442
56449
|
this.callback = null;
|
|
56443
56450
|
this.res = body;
|
|
56444
56451
|
if (callback !== null) {
|
|
@@ -56582,7 +56589,7 @@ var require_api_stream = __commonJS({
|
|
|
56582
56589
|
this.abort = abort;
|
|
56583
56590
|
this.context = context;
|
|
56584
56591
|
}
|
|
56585
|
-
onHeaders(statusCode, rawHeaders,
|
|
56592
|
+
onHeaders(statusCode, rawHeaders, resume2, statusMessage) {
|
|
56586
56593
|
const { factory, opaque, context, callback, responseHeaders } = this;
|
|
56587
56594
|
const headers = responseHeaders === "raw" ? util4.parseRawHeaders(rawHeaders) : util4.parseHeaders(rawHeaders);
|
|
56588
56595
|
if (statusCode < 200) {
|
|
@@ -56629,7 +56636,7 @@ var require_api_stream = __commonJS({
|
|
|
56629
56636
|
}
|
|
56630
56637
|
});
|
|
56631
56638
|
}
|
|
56632
|
-
res.on("drain",
|
|
56639
|
+
res.on("drain", resume2);
|
|
56633
56640
|
this.res = res;
|
|
56634
56641
|
const needDrain = res.writableNeedDrain !== void 0 ? res.writableNeedDrain : res._writableState && res._writableState.needDrain;
|
|
56635
56642
|
return needDrain !== true;
|
|
@@ -56705,7 +56712,7 @@ var require_api_pipeline = __commonJS({
|
|
|
56705
56712
|
var util4 = require_util2();
|
|
56706
56713
|
var { AsyncResource } = require("async_hooks");
|
|
56707
56714
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
56708
|
-
var
|
|
56715
|
+
var assert2 = require("assert");
|
|
56709
56716
|
var kResume = Symbol("resume");
|
|
56710
56717
|
var PipelineRequest = class extends Readable5 {
|
|
56711
56718
|
constructor() {
|
|
@@ -56713,10 +56720,10 @@ var require_api_pipeline = __commonJS({
|
|
|
56713
56720
|
this[kResume] = null;
|
|
56714
56721
|
}
|
|
56715
56722
|
_read() {
|
|
56716
|
-
const { [kResume]:
|
|
56717
|
-
if (
|
|
56723
|
+
const { [kResume]: resume2 } = this;
|
|
56724
|
+
if (resume2) {
|
|
56718
56725
|
this[kResume] = null;
|
|
56719
|
-
|
|
56726
|
+
resume2();
|
|
56720
56727
|
}
|
|
56721
56728
|
}
|
|
56722
56729
|
_destroy(err, callback) {
|
|
@@ -56725,9 +56732,9 @@ var require_api_pipeline = __commonJS({
|
|
|
56725
56732
|
}
|
|
56726
56733
|
};
|
|
56727
56734
|
var PipelineResponse = class extends Readable5 {
|
|
56728
|
-
constructor(
|
|
56735
|
+
constructor(resume2) {
|
|
56729
56736
|
super({ autoDestroy: true });
|
|
56730
|
-
this[kResume] =
|
|
56737
|
+
this[kResume] = resume2;
|
|
56731
56738
|
}
|
|
56732
56739
|
_read() {
|
|
56733
56740
|
this[kResume]();
|
|
@@ -56805,14 +56812,14 @@ var require_api_pipeline = __commonJS({
|
|
|
56805
56812
|
}
|
|
56806
56813
|
onConnect(abort, context) {
|
|
56807
56814
|
const { ret, res } = this;
|
|
56808
|
-
|
|
56815
|
+
assert2(!res, "pipeline cannot be retried");
|
|
56809
56816
|
if (ret.destroyed) {
|
|
56810
56817
|
throw new RequestAbortedError();
|
|
56811
56818
|
}
|
|
56812
56819
|
this.abort = abort;
|
|
56813
56820
|
this.context = context;
|
|
56814
56821
|
}
|
|
56815
|
-
onHeaders(statusCode, rawHeaders,
|
|
56822
|
+
onHeaders(statusCode, rawHeaders, resume2) {
|
|
56816
56823
|
const { opaque, handler, context } = this;
|
|
56817
56824
|
if (statusCode < 200) {
|
|
56818
56825
|
if (this.onInfo) {
|
|
@@ -56821,7 +56828,7 @@ var require_api_pipeline = __commonJS({
|
|
|
56821
56828
|
}
|
|
56822
56829
|
return;
|
|
56823
56830
|
}
|
|
56824
|
-
this.res = new PipelineResponse(
|
|
56831
|
+
this.res = new PipelineResponse(resume2);
|
|
56825
56832
|
let body;
|
|
56826
56833
|
try {
|
|
56827
56834
|
this.handler = null;
|
|
@@ -56894,7 +56901,7 @@ var require_api_upgrade = __commonJS({
|
|
|
56894
56901
|
var { AsyncResource } = require("async_hooks");
|
|
56895
56902
|
var util4 = require_util2();
|
|
56896
56903
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
56897
|
-
var
|
|
56904
|
+
var assert2 = require("assert");
|
|
56898
56905
|
var UpgradeHandler = class extends AsyncResource {
|
|
56899
56906
|
constructor(opts, callback) {
|
|
56900
56907
|
if (!opts || typeof opts !== "object") {
|
|
@@ -56927,7 +56934,7 @@ var require_api_upgrade = __commonJS({
|
|
|
56927
56934
|
}
|
|
56928
56935
|
onUpgrade(statusCode, rawHeaders, socket) {
|
|
56929
56936
|
const { callback, opaque, context } = this;
|
|
56930
|
-
|
|
56937
|
+
assert2.strictEqual(statusCode, 101);
|
|
56931
56938
|
removeSignal(this);
|
|
56932
56939
|
this.callback = null;
|
|
56933
56940
|
const headers = this.responseHeaders === "raw" ? util4.parseRawHeaders(rawHeaders) : util4.parseHeaders(rawHeaders);
|
|
@@ -57040,10 +57047,10 @@ var require_api_connect = __commonJS({
|
|
|
57040
57047
|
}
|
|
57041
57048
|
}
|
|
57042
57049
|
};
|
|
57043
|
-
function
|
|
57050
|
+
function connect3(opts, callback) {
|
|
57044
57051
|
if (callback === void 0) {
|
|
57045
57052
|
return new Promise((resolve, reject) => {
|
|
57046
|
-
|
|
57053
|
+
connect3.call(this, opts, (err, data) => {
|
|
57047
57054
|
return err ? reject(err) : resolve(data);
|
|
57048
57055
|
});
|
|
57049
57056
|
});
|
|
@@ -57059,7 +57066,7 @@ var require_api_connect = __commonJS({
|
|
|
57059
57066
|
queueMicrotask(() => callback(err, { opaque }));
|
|
57060
57067
|
}
|
|
57061
57068
|
}
|
|
57062
|
-
module2.exports =
|
|
57069
|
+
module2.exports = connect3;
|
|
57063
57070
|
}
|
|
57064
57071
|
});
|
|
57065
57072
|
|
|
@@ -57332,12 +57339,12 @@ var require_mock_utils = __commonJS({
|
|
|
57332
57339
|
const responseHeaders = generateKeyValues(headers);
|
|
57333
57340
|
const responseTrailers = generateKeyValues(trailers);
|
|
57334
57341
|
handler.abort = nop;
|
|
57335
|
-
handler.onHeaders(statusCode, responseHeaders,
|
|
57342
|
+
handler.onHeaders(statusCode, responseHeaders, resume2, getStatusText(statusCode));
|
|
57336
57343
|
handler.onData(Buffer.from(responseData));
|
|
57337
57344
|
handler.onComplete(responseTrailers);
|
|
57338
57345
|
deleteMockDispatch(mockDispatches, key);
|
|
57339
57346
|
}
|
|
57340
|
-
function
|
|
57347
|
+
function resume2() {
|
|
57341
57348
|
}
|
|
57342
57349
|
return true;
|
|
57343
57350
|
}
|
|
@@ -57745,7 +57752,7 @@ var require_mock_agent = __commonJS({
|
|
|
57745
57752
|
"node_modules/undici/lib/mock/mock-agent.js"(exports2, module2) {
|
|
57746
57753
|
"use strict";
|
|
57747
57754
|
var { kClients } = require_symbols();
|
|
57748
|
-
var
|
|
57755
|
+
var Agent6 = require_agent2();
|
|
57749
57756
|
var {
|
|
57750
57757
|
kAgent,
|
|
57751
57758
|
kMockAgentSet,
|
|
@@ -57780,7 +57787,7 @@ var require_mock_agent = __commonJS({
|
|
|
57780
57787
|
if (opts && opts.agent && typeof opts.agent.dispatch !== "function") {
|
|
57781
57788
|
throw new InvalidArgumentError("Argument opts.agent must implement Agent");
|
|
57782
57789
|
}
|
|
57783
|
-
const agent = opts && opts.agent ? opts.agent : new
|
|
57790
|
+
const agent = opts && opts.agent ? opts.agent : new Agent6(opts);
|
|
57784
57791
|
this[kAgent] = agent;
|
|
57785
57792
|
this[kClients] = agent[kClients];
|
|
57786
57793
|
this[kOptions] = buildMockOptions(opts);
|
|
@@ -57884,8 +57891,8 @@ var require_proxy_agent = __commonJS({
|
|
|
57884
57891
|
"node_modules/undici/lib/proxy-agent.js"(exports2, module2) {
|
|
57885
57892
|
"use strict";
|
|
57886
57893
|
var { kProxy, kClose, kDestroy, kInterceptors } = require_symbols();
|
|
57887
|
-
var { URL:
|
|
57888
|
-
var
|
|
57894
|
+
var { URL: URL3 } = require("url");
|
|
57895
|
+
var Agent6 = require_agent2();
|
|
57889
57896
|
var Pool = require_pool();
|
|
57890
57897
|
var DispatcherBase = require_dispatcher_base();
|
|
57891
57898
|
var { InvalidArgumentError, RequestAbortedError } = require_errors3();
|
|
@@ -57918,7 +57925,7 @@ var require_proxy_agent = __commonJS({
|
|
|
57918
57925
|
constructor(opts) {
|
|
57919
57926
|
super(opts);
|
|
57920
57927
|
this[kProxy] = buildProxyOptions(opts);
|
|
57921
|
-
this[kAgent] = new
|
|
57928
|
+
this[kAgent] = new Agent6(opts);
|
|
57922
57929
|
this[kInterceptors] = opts.interceptors && opts.interceptors.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent) ? opts.interceptors.ProxyAgent : [];
|
|
57923
57930
|
if (typeof opts === "string") {
|
|
57924
57931
|
opts = { uri: opts };
|
|
@@ -57933,7 +57940,7 @@ var require_proxy_agent = __commonJS({
|
|
|
57933
57940
|
this[kRequestTls] = opts.requestTls;
|
|
57934
57941
|
this[kProxyTls] = opts.proxyTls;
|
|
57935
57942
|
this[kProxyHeaders] = opts.headers || {};
|
|
57936
|
-
const resolvedUrl = new
|
|
57943
|
+
const resolvedUrl = new URL3(opts.uri);
|
|
57937
57944
|
const { origin: origin2, port, host, username, password } = resolvedUrl;
|
|
57938
57945
|
if (opts.auth && opts.token) {
|
|
57939
57946
|
throw new InvalidArgumentError("opts.auth cannot be used in combination with opts.token");
|
|
@@ -57944,10 +57951,10 @@ var require_proxy_agent = __commonJS({
|
|
|
57944
57951
|
} else if (username && password) {
|
|
57945
57952
|
this[kProxyHeaders]["proxy-authorization"] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString("base64")}`;
|
|
57946
57953
|
}
|
|
57947
|
-
const
|
|
57954
|
+
const connect3 = buildConnector({ ...opts.proxyTls });
|
|
57948
57955
|
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls });
|
|
57949
|
-
this[kClient] = clientFactory(resolvedUrl, { connect });
|
|
57950
|
-
this[kAgent] = new
|
|
57956
|
+
this[kClient] = clientFactory(resolvedUrl, { connect: connect3 });
|
|
57957
|
+
this[kAgent] = new Agent6({
|
|
57951
57958
|
...opts,
|
|
57952
57959
|
connect: async (opts2, callback) => {
|
|
57953
57960
|
let requestedHost = opts2.host;
|
|
@@ -57988,7 +57995,7 @@ var require_proxy_agent = __commonJS({
|
|
|
57988
57995
|
});
|
|
57989
57996
|
}
|
|
57990
57997
|
dispatch(opts, handler) {
|
|
57991
|
-
const { host } = new
|
|
57998
|
+
const { host } = new URL3(opts.origin);
|
|
57992
57999
|
const headers = buildHeaders(opts.headers);
|
|
57993
58000
|
throwIfProxyAuthIsSent(headers);
|
|
57994
58001
|
return this[kAgent].dispatch(
|
|
@@ -58034,7 +58041,7 @@ var require_proxy_agent = __commonJS({
|
|
|
58034
58041
|
// node_modules/undici/lib/handler/RetryHandler.js
|
|
58035
58042
|
var require_RetryHandler = __commonJS({
|
|
58036
58043
|
"node_modules/undici/lib/handler/RetryHandler.js"(exports2, module2) {
|
|
58037
|
-
var
|
|
58044
|
+
var assert2 = require("assert");
|
|
58038
58045
|
var { kRetryHandlerDefaultRetry } = require_symbols();
|
|
58039
58046
|
var { RequestRetryError } = require_errors3();
|
|
58040
58047
|
var { isDisturbed, parseHeaders, parseRangeHeader } = require_util2();
|
|
@@ -58162,7 +58169,7 @@ var require_RetryHandler = __commonJS({
|
|
|
58162
58169
|
state2.currentTimeout = retryTimeout;
|
|
58163
58170
|
setTimeout(() => cb(null), retryTimeout);
|
|
58164
58171
|
}
|
|
58165
|
-
onHeaders(statusCode, rawHeaders,
|
|
58172
|
+
onHeaders(statusCode, rawHeaders, resume2, statusMessage) {
|
|
58166
58173
|
const headers = parseHeaders(rawHeaders);
|
|
58167
58174
|
this.retryCount += 1;
|
|
58168
58175
|
if (statusCode >= 300) {
|
|
@@ -58199,9 +58206,9 @@ var require_RetryHandler = __commonJS({
|
|
|
58199
58206
|
return false;
|
|
58200
58207
|
}
|
|
58201
58208
|
const { start, size, end = size } = contentRange;
|
|
58202
|
-
|
|
58203
|
-
|
|
58204
|
-
this.resume =
|
|
58209
|
+
assert2(this.start === start, "content-range mismatch");
|
|
58210
|
+
assert2(this.end == null || this.end === end, "content-range mismatch");
|
|
58211
|
+
this.resume = resume2;
|
|
58205
58212
|
return true;
|
|
58206
58213
|
}
|
|
58207
58214
|
if (this.end == null) {
|
|
@@ -58211,17 +58218,17 @@ var require_RetryHandler = __commonJS({
|
|
|
58211
58218
|
return this.handler.onHeaders(
|
|
58212
58219
|
statusCode,
|
|
58213
58220
|
rawHeaders,
|
|
58214
|
-
|
|
58221
|
+
resume2,
|
|
58215
58222
|
statusMessage
|
|
58216
58223
|
);
|
|
58217
58224
|
}
|
|
58218
58225
|
const { start, size, end = size } = range;
|
|
58219
|
-
|
|
58226
|
+
assert2(
|
|
58220
58227
|
start != null && Number.isFinite(start) && this.start !== start,
|
|
58221
58228
|
"content-range mismatch"
|
|
58222
58229
|
);
|
|
58223
|
-
|
|
58224
|
-
|
|
58230
|
+
assert2(Number.isFinite(start));
|
|
58231
|
+
assert2(
|
|
58225
58232
|
end != null && Number.isFinite(end) && this.end !== end,
|
|
58226
58233
|
"invalid content-length"
|
|
58227
58234
|
);
|
|
@@ -58232,17 +58239,17 @@ var require_RetryHandler = __commonJS({
|
|
|
58232
58239
|
const contentLength = headers["content-length"];
|
|
58233
58240
|
this.end = contentLength != null ? Number(contentLength) : null;
|
|
58234
58241
|
}
|
|
58235
|
-
|
|
58236
|
-
|
|
58242
|
+
assert2(Number.isFinite(this.start));
|
|
58243
|
+
assert2(
|
|
58237
58244
|
this.end == null || Number.isFinite(this.end),
|
|
58238
58245
|
"invalid content-length"
|
|
58239
58246
|
);
|
|
58240
|
-
this.resume =
|
|
58247
|
+
this.resume = resume2;
|
|
58241
58248
|
this.etag = headers.etag != null ? headers.etag : null;
|
|
58242
58249
|
return this.handler.onHeaders(
|
|
58243
58250
|
statusCode,
|
|
58244
58251
|
rawHeaders,
|
|
58245
|
-
|
|
58252
|
+
resume2,
|
|
58246
58253
|
statusMessage
|
|
58247
58254
|
);
|
|
58248
58255
|
}
|
|
@@ -58304,9 +58311,9 @@ var require_global2 = __commonJS({
|
|
|
58304
58311
|
"use strict";
|
|
58305
58312
|
var globalDispatcher = Symbol.for("undici.globalDispatcher.1");
|
|
58306
58313
|
var { InvalidArgumentError } = require_errors3();
|
|
58307
|
-
var
|
|
58314
|
+
var Agent6 = require_agent2();
|
|
58308
58315
|
if (getGlobalDispatcher() === void 0) {
|
|
58309
|
-
setGlobalDispatcher2(new
|
|
58316
|
+
setGlobalDispatcher2(new Agent6());
|
|
58310
58317
|
}
|
|
58311
58318
|
function setGlobalDispatcher2(agent) {
|
|
58312
58319
|
if (!agent || typeof agent.dispatch !== "function") {
|
|
@@ -58376,7 +58383,7 @@ var require_headers = __commonJS({
|
|
|
58376
58383
|
} = require_util3();
|
|
58377
58384
|
var util4 = require("util");
|
|
58378
58385
|
var { webidl } = require_webidl();
|
|
58379
|
-
var
|
|
58386
|
+
var assert2 = require("assert");
|
|
58380
58387
|
var kHeadersMap = Symbol("headers map");
|
|
58381
58388
|
var kHeadersSortedMap = Symbol("headers map sorted");
|
|
58382
58389
|
function isHTTPWhiteSpaceCharCode(code) {
|
|
@@ -58634,7 +58641,7 @@ var require_headers = __commonJS({
|
|
|
58634
58641
|
headers.push([name, cookies[j4]]);
|
|
58635
58642
|
}
|
|
58636
58643
|
} else {
|
|
58637
|
-
|
|
58644
|
+
assert2(value !== null);
|
|
58638
58645
|
headers.push([name, value]);
|
|
58639
58646
|
}
|
|
58640
58647
|
}
|
|
@@ -58780,7 +58787,7 @@ var require_response = __commonJS({
|
|
|
58780
58787
|
var { getGlobalOrigin } = require_global();
|
|
58781
58788
|
var { URLSerializer } = require_dataURL();
|
|
58782
58789
|
var { kHeadersList, kConstruct } = require_symbols();
|
|
58783
|
-
var
|
|
58790
|
+
var assert2 = require("assert");
|
|
58784
58791
|
var { types } = require("util");
|
|
58785
58792
|
var ReadableStream7 = globalThis.ReadableStream || require("stream/web").ReadableStream;
|
|
58786
58793
|
var textEncoder2 = new TextEncoder("utf-8");
|
|
@@ -58996,7 +59003,7 @@ var require_response = __commonJS({
|
|
|
58996
59003
|
return p4 in state2 ? state2[p4] : target[p4];
|
|
58997
59004
|
},
|
|
58998
59005
|
set(target, p4, value) {
|
|
58999
|
-
|
|
59006
|
+
assert2(!(p4 in state2));
|
|
59000
59007
|
target[p4] = value;
|
|
59001
59008
|
return true;
|
|
59002
59009
|
}
|
|
@@ -59030,11 +59037,11 @@ var require_response = __commonJS({
|
|
|
59030
59037
|
body: null
|
|
59031
59038
|
});
|
|
59032
59039
|
} else {
|
|
59033
|
-
|
|
59040
|
+
assert2(false);
|
|
59034
59041
|
}
|
|
59035
59042
|
}
|
|
59036
59043
|
function makeAppropriateNetworkError(fetchParams, err = null) {
|
|
59037
|
-
|
|
59044
|
+
assert2(isCancelled(fetchParams));
|
|
59038
59045
|
return isAborted(fetchParams) ? makeNetworkError(Object.assign(new DOMException3("The operation was aborted.", "AbortError"), { cause: err })) : makeNetworkError(Object.assign(new DOMException3("Request was cancelled."), { cause: err }));
|
|
59039
59046
|
}
|
|
59040
59047
|
function initializeResponse(response, init, body) {
|
|
@@ -59162,7 +59169,7 @@ var require_request2 = __commonJS({
|
|
|
59162
59169
|
var { getGlobalOrigin } = require_global();
|
|
59163
59170
|
var { URLSerializer } = require_dataURL();
|
|
59164
59171
|
var { kHeadersList, kConstruct } = require_symbols();
|
|
59165
|
-
var
|
|
59172
|
+
var assert2 = require("assert");
|
|
59166
59173
|
var { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = require("events");
|
|
59167
59174
|
var TransformStream3 = globalThis.TransformStream;
|
|
59168
59175
|
var kAbortController = Symbol("abortController");
|
|
@@ -59206,7 +59213,7 @@ var require_request2 = __commonJS({
|
|
|
59206
59213
|
request3 = makeRequest2({ urlList: [parsedURL] });
|
|
59207
59214
|
fallbackMode = "cors";
|
|
59208
59215
|
} else {
|
|
59209
|
-
|
|
59216
|
+
assert2(input instanceof _Request);
|
|
59210
59217
|
request3 = input[kState];
|
|
59211
59218
|
signal = input[kSignal];
|
|
59212
59219
|
}
|
|
@@ -59815,7 +59822,7 @@ var require_fetch = __commonJS({
|
|
|
59815
59822
|
urlHasHttpsScheme
|
|
59816
59823
|
} = require_util3();
|
|
59817
59824
|
var { kState, kHeaders, kGuard, kRealm } = require_symbols2();
|
|
59818
|
-
var
|
|
59825
|
+
var assert2 = require("assert");
|
|
59819
59826
|
var { safelyExtractBody } = require_body();
|
|
59820
59827
|
var {
|
|
59821
59828
|
redirectStatusSet,
|
|
@@ -59895,7 +59902,7 @@ var require_fetch = __commonJS({
|
|
|
59895
59902
|
requestObject.signal,
|
|
59896
59903
|
() => {
|
|
59897
59904
|
locallyAborted = true;
|
|
59898
|
-
|
|
59905
|
+
assert2(controller != null);
|
|
59899
59906
|
controller.abort(requestObject.signal.reason);
|
|
59900
59907
|
abortFetch(p4, request3, responseObject, requestObject.signal.reason);
|
|
59901
59908
|
}
|
|
@@ -60028,7 +60035,7 @@ var require_fetch = __commonJS({
|
|
|
60028
60035
|
taskDestination,
|
|
60029
60036
|
crossOriginIsolatedCapability
|
|
60030
60037
|
};
|
|
60031
|
-
|
|
60038
|
+
assert2(!request3.body || request3.body.stream);
|
|
60032
60039
|
if (request3.window === "client") {
|
|
60033
60040
|
request3.window = request3.client?.globalObject?.constructor?.name === "Window" ? request3.client : "no-window";
|
|
60034
60041
|
}
|
|
@@ -60121,7 +60128,7 @@ var require_fetch = __commonJS({
|
|
|
60121
60128
|
} else if (request3.responseTainting === "opaque") {
|
|
60122
60129
|
response = filterResponse(response, "opaque");
|
|
60123
60130
|
} else {
|
|
60124
|
-
|
|
60131
|
+
assert2(false);
|
|
60125
60132
|
}
|
|
60126
60133
|
}
|
|
60127
60134
|
let internalResponse = response.status === 0 ? response : response.internalResponse;
|
|
@@ -60313,7 +60320,7 @@ var require_fetch = __commonJS({
|
|
|
60313
60320
|
} else if (request3.redirect === "follow") {
|
|
60314
60321
|
response = await httpRedirectFetch(fetchParams, response);
|
|
60315
60322
|
} else {
|
|
60316
|
-
|
|
60323
|
+
assert2(false);
|
|
60317
60324
|
}
|
|
60318
60325
|
}
|
|
60319
60326
|
response.timingInfo = timingInfo;
|
|
@@ -60366,7 +60373,7 @@ var require_fetch = __commonJS({
|
|
|
60366
60373
|
request3.headersList.delete("host");
|
|
60367
60374
|
}
|
|
60368
60375
|
if (request3.body != null) {
|
|
60369
|
-
|
|
60376
|
+
assert2(request3.body.source != null);
|
|
60370
60377
|
request3.body = safelyExtractBody(request3.body.source)[0];
|
|
60371
60378
|
}
|
|
60372
60379
|
const timingInfo = fetchParams.timingInfo;
|
|
@@ -60499,7 +60506,7 @@ var require_fetch = __commonJS({
|
|
|
60499
60506
|
return response;
|
|
60500
60507
|
}
|
|
60501
60508
|
async function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
|
|
60502
|
-
|
|
60509
|
+
assert2(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed);
|
|
60503
60510
|
fetchParams.controller.connection = {
|
|
60504
60511
|
abort: null,
|
|
60505
60512
|
destroyed: false,
|
|
@@ -60688,7 +60695,7 @@ var require_fetch = __commonJS({
|
|
|
60688
60695
|
this.abort = connection.abort = abort;
|
|
60689
60696
|
}
|
|
60690
60697
|
},
|
|
60691
|
-
onHeaders(status, headersList,
|
|
60698
|
+
onHeaders(status, headersList, resume2, statusText) {
|
|
60692
60699
|
if (status < 200) {
|
|
60693
60700
|
return;
|
|
60694
60701
|
}
|
|
@@ -60718,7 +60725,7 @@ var require_fetch = __commonJS({
|
|
|
60718
60725
|
headers[kHeadersList].append(key, val);
|
|
60719
60726
|
}
|
|
60720
60727
|
}
|
|
60721
|
-
this.body = new Readable5({ read:
|
|
60728
|
+
this.body = new Readable5({ read: resume2 });
|
|
60722
60729
|
const decoders = [];
|
|
60723
60730
|
const willFollow = request3.redirect === "follow" && location && redirectStatusSet.has(status);
|
|
60724
60731
|
if (request3.method !== "HEAD" && request3.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
|
|
@@ -61634,7 +61641,7 @@ var require_symbols4 = __commonJS({
|
|
|
61634
61641
|
var require_util6 = __commonJS({
|
|
61635
61642
|
"node_modules/undici/lib/cache/util.js"(exports2, module2) {
|
|
61636
61643
|
"use strict";
|
|
61637
|
-
var
|
|
61644
|
+
var assert2 = require("assert");
|
|
61638
61645
|
var { URLSerializer } = require_dataURL();
|
|
61639
61646
|
var { isValidHeaderName: isValidHeaderName2 } = require_util3();
|
|
61640
61647
|
function urlEquals(A5, B3, excludeFragment = false) {
|
|
@@ -61643,7 +61650,7 @@ var require_util6 = __commonJS({
|
|
|
61643
61650
|
return serializedA === serializedB;
|
|
61644
61651
|
}
|
|
61645
61652
|
function fieldValues(header) {
|
|
61646
|
-
|
|
61653
|
+
assert2(header !== null);
|
|
61647
61654
|
const values = [];
|
|
61648
61655
|
for (let value of header.split(",")) {
|
|
61649
61656
|
value = value.trim();
|
|
@@ -61677,7 +61684,7 @@ var require_cache = __commonJS({
|
|
|
61677
61684
|
var { kState, kHeaders, kGuard, kRealm } = require_symbols2();
|
|
61678
61685
|
var { fetching } = require_fetch();
|
|
61679
61686
|
var { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = require_util3();
|
|
61680
|
-
var
|
|
61687
|
+
var assert2 = require("assert");
|
|
61681
61688
|
var { getGlobalDispatcher } = require_global2();
|
|
61682
61689
|
var Cache = class _Cache {
|
|
61683
61690
|
/**
|
|
@@ -61938,7 +61945,7 @@ var require_cache = __commonJS({
|
|
|
61938
61945
|
return false;
|
|
61939
61946
|
}
|
|
61940
61947
|
} else {
|
|
61941
|
-
|
|
61948
|
+
assert2(typeof request3 === "string");
|
|
61942
61949
|
r3 = new Request6(request3)[kState];
|
|
61943
61950
|
}
|
|
61944
61951
|
const operations = [];
|
|
@@ -62047,7 +62054,7 @@ var require_cache = __commonJS({
|
|
|
62047
62054
|
}
|
|
62048
62055
|
for (const requestResponse of requestResponses) {
|
|
62049
62056
|
const idx = cache.indexOf(requestResponse);
|
|
62050
|
-
|
|
62057
|
+
assert2(idx !== -1);
|
|
62051
62058
|
cache.splice(idx, 1);
|
|
62052
62059
|
}
|
|
62053
62060
|
} else if (operation.type === "put") {
|
|
@@ -62079,7 +62086,7 @@ var require_cache = __commonJS({
|
|
|
62079
62086
|
requestResponses = this.#queryCache(operation.request);
|
|
62080
62087
|
for (const requestResponse of requestResponses) {
|
|
62081
62088
|
const idx = cache.indexOf(requestResponse);
|
|
62082
|
-
|
|
62089
|
+
assert2(idx !== -1);
|
|
62083
62090
|
cache.splice(idx, 1);
|
|
62084
62091
|
}
|
|
62085
62092
|
cache.push([operation.request, operation.response]);
|
|
@@ -62466,7 +62473,7 @@ var require_parse3 = __commonJS({
|
|
|
62466
62473
|
var { maxNameValuePairSize, maxAttributeValueSize } = require_constants5();
|
|
62467
62474
|
var { isCTLExcludingHtab } = require_util7();
|
|
62468
62475
|
var { collectASequenceOfCodePointsFast } = require_dataURL();
|
|
62469
|
-
var
|
|
62476
|
+
var assert2 = require("assert");
|
|
62470
62477
|
function parseSetCookie(header) {
|
|
62471
62478
|
if (isCTLExcludingHtab(header)) {
|
|
62472
62479
|
return null;
|
|
@@ -62508,7 +62515,7 @@ var require_parse3 = __commonJS({
|
|
|
62508
62515
|
if (unparsedAttributes.length === 0) {
|
|
62509
62516
|
return cookieAttributeList;
|
|
62510
62517
|
}
|
|
62511
|
-
|
|
62518
|
+
assert2(unparsedAttributes[0] === ";");
|
|
62512
62519
|
unparsedAttributes = unparsedAttributes.slice(1);
|
|
62513
62520
|
let cookieAv = "";
|
|
62514
62521
|
if (unparsedAttributes.includes(";")) {
|
|
@@ -63976,7 +63983,7 @@ var require_undici = __commonJS({
|
|
|
63976
63983
|
var errors = require_errors3();
|
|
63977
63984
|
var Pool = require_pool();
|
|
63978
63985
|
var BalancedPool = require_balanced_pool();
|
|
63979
|
-
var
|
|
63986
|
+
var Agent6 = require_agent2();
|
|
63980
63987
|
var util4 = require_util2();
|
|
63981
63988
|
var { InvalidArgumentError } = errors;
|
|
63982
63989
|
var api = require_api();
|
|
@@ -64003,7 +64010,7 @@ var require_undici = __commonJS({
|
|
|
64003
64010
|
module2.exports.Client = Client;
|
|
64004
64011
|
module2.exports.Pool = Pool;
|
|
64005
64012
|
module2.exports.BalancedPool = BalancedPool;
|
|
64006
|
-
module2.exports.Agent =
|
|
64013
|
+
module2.exports.Agent = Agent6;
|
|
64007
64014
|
module2.exports.ProxyAgent = ProxyAgent2;
|
|
64008
64015
|
module2.exports.RetryHandler = RetryHandler;
|
|
64009
64016
|
module2.exports.DecoratorHandler = DecoratorHandler;
|
|
@@ -65266,7 +65273,7 @@ function G3(t2, e3) {
|
|
|
65266
65273
|
// package.json
|
|
65267
65274
|
var package_default = {
|
|
65268
65275
|
name: "opencommit",
|
|
65269
|
-
version: "3.2.
|
|
65276
|
+
version: "3.2.21",
|
|
65270
65277
|
description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
65271
65278
|
keywords: [
|
|
65272
65279
|
"git",
|
|
@@ -65315,9 +65322,10 @@ var package_default = {
|
|
|
65315
65322
|
deploy: "npm publish --tag latest",
|
|
65316
65323
|
"deploy:build": "npm run build:push && git push --tags && npm run deploy",
|
|
65317
65324
|
"deploy:patch": "npm version patch && npm run deploy:build",
|
|
65318
|
-
lint: "
|
|
65319
|
-
|
|
65320
|
-
|
|
65325
|
+
lint: "biome check . --diagnostic-level=error && tsc --noEmit",
|
|
65326
|
+
typecheck: "tsc --noEmit",
|
|
65327
|
+
format: 'prettier --write "src/**/*.{ts,js,json,md}" "test/**/*.{ts,js,json,md}" ".github/**/*.{yml,yaml}" "*.{js,json,ts,md,yml,yaml}"',
|
|
65328
|
+
"format:check": 'prettier --check "src/**/*.{ts,js,json,md}" "test/**/*.{ts,js,json,md}" ".github/**/*.{yml,yaml}" "*.{js,json,ts,md,yml,yaml}"',
|
|
65321
65329
|
test: "node --no-warnings --experimental-vm-modules $( [ -f ./node_modules/.bin/jest ] && echo ./node_modules/.bin/jest || which jest ) test/unit",
|
|
65322
65330
|
"test:all": "npm run test:unit:docker && npm run test:e2e:docker",
|
|
65323
65331
|
"test:docker-build": "docker build -t oco-test -f test/Dockerfile .",
|
|
@@ -65327,7 +65335,7 @@ var package_default = {
|
|
|
65327
65335
|
"test:e2e:smoke": "npm run build && npm run test:e2e:smoke:run",
|
|
65328
65336
|
"test:e2e:smoke:run": "OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/smoke.test.ts",
|
|
65329
65337
|
"test:e2e:core": "npm run build && npm run test:e2e:core:run",
|
|
65330
|
-
"test:e2e:core:run": "OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/cliBehavior.test.ts test/e2e/gitPush.test.ts test/e2e/oneFile.test.ts test/e2e/noChanges.test.ts",
|
|
65338
|
+
"test:e2e:core:run": "OCO_TEST_SKIP_VERSION_CHECK=true jest test/e2e/cliBehavior.test.ts test/e2e/geminiBehavior.test.ts test/e2e/gitPush.test.ts test/e2e/oneFile.test.ts test/e2e/noChanges.test.ts",
|
|
65331
65339
|
"test:e2e:setup": "npm run test:e2e:prompt-module:setup",
|
|
65332
65340
|
"test:e2e:prompt-module:setup": "sh test/e2e/setup.sh",
|
|
65333
65341
|
"test:e2e:prompt-module": "npm run build && npm run test:e2e:prompt-module:run",
|
|
@@ -65336,17 +65344,15 @@ var package_default = {
|
|
|
65336
65344
|
"mlx:start": "OCO_AI_PROVIDER='mlx' node ./out/cli.cjs"
|
|
65337
65345
|
},
|
|
65338
65346
|
devDependencies: {
|
|
65347
|
+
"@biomejs/biome": "2.4.11",
|
|
65339
65348
|
"@commitlint/types": "^17.4.4",
|
|
65340
65349
|
"@types/ini": "^1.3.31",
|
|
65341
65350
|
"@types/inquirer": "^9.0.3",
|
|
65342
65351
|
"@types/jest": "^29.5.12",
|
|
65343
65352
|
"@types/node": "^16.18.14",
|
|
65344
|
-
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
65345
|
-
"@typescript-eslint/parser": "^8.29.0",
|
|
65346
65353
|
"cli-testing-library": "^2.0.2",
|
|
65347
65354
|
dotenv: "^16.0.3",
|
|
65348
65355
|
esbuild: "^0.25.5",
|
|
65349
|
-
eslint: "^9.24.0",
|
|
65350
65356
|
jest: "^29.7.0",
|
|
65351
65357
|
prettier: "^2.8.4",
|
|
65352
65358
|
rimraf: "^6.0.1",
|
|
@@ -70700,8 +70706,321 @@ var { AnthropicError: AnthropicError2, APIError: APIError2, APIConnectionError:
|
|
|
70700
70706
|
})(Anthropic || (Anthropic = {}));
|
|
70701
70707
|
var sdk_default = Anthropic;
|
|
70702
70708
|
|
|
70703
|
-
//
|
|
70704
|
-
var
|
|
70709
|
+
// node_modules/https-proxy-agent/dist/index.js
|
|
70710
|
+
var net2 = __toESM(require("net"), 1);
|
|
70711
|
+
var tls = __toESM(require("tls"), 1);
|
|
70712
|
+
var import_assert = __toESM(require("assert"), 1);
|
|
70713
|
+
var import_debug2 = __toESM(require_src2(), 1);
|
|
70714
|
+
|
|
70715
|
+
// node_modules/https-proxy-agent/node_modules/agent-base/dist/index.js
|
|
70716
|
+
var net = __toESM(require("net"), 1);
|
|
70717
|
+
var http = __toESM(require("http"), 1);
|
|
70718
|
+
var import_https = require("https");
|
|
70719
|
+
var INTERNAL = Symbol("AgentBaseInternalState");
|
|
70720
|
+
var Agent2 = class extends http.Agent {
|
|
70721
|
+
constructor(opts) {
|
|
70722
|
+
super(opts);
|
|
70723
|
+
this[INTERNAL] = {};
|
|
70724
|
+
}
|
|
70725
|
+
/**
|
|
70726
|
+
* Determine whether this is an `http` or `https` request.
|
|
70727
|
+
*/
|
|
70728
|
+
isSecureEndpoint(options) {
|
|
70729
|
+
if (options) {
|
|
70730
|
+
if (typeof options.secureEndpoint === "boolean") {
|
|
70731
|
+
return options.secureEndpoint;
|
|
70732
|
+
}
|
|
70733
|
+
if (typeof options.protocol === "string") {
|
|
70734
|
+
return options.protocol === "https:";
|
|
70735
|
+
}
|
|
70736
|
+
}
|
|
70737
|
+
const { stack } = new Error();
|
|
70738
|
+
if (typeof stack !== "string")
|
|
70739
|
+
return false;
|
|
70740
|
+
return stack.split("\n").some((l3) => l3.indexOf("(https.js:") !== -1 || l3.indexOf("node:https:") !== -1);
|
|
70741
|
+
}
|
|
70742
|
+
// In order to support async signatures in `connect()` and Node's native
|
|
70743
|
+
// connection pooling in `http.Agent`, the array of sockets for each origin
|
|
70744
|
+
// has to be updated synchronously. This is so the length of the array is
|
|
70745
|
+
// accurate when `addRequest()` is next called. We achieve this by creating a
|
|
70746
|
+
// fake socket and adding it to `sockets[origin]` and incrementing
|
|
70747
|
+
// `totalSocketCount`.
|
|
70748
|
+
incrementSockets(name) {
|
|
70749
|
+
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
|
70750
|
+
return null;
|
|
70751
|
+
}
|
|
70752
|
+
if (!this.sockets[name]) {
|
|
70753
|
+
this.sockets[name] = [];
|
|
70754
|
+
}
|
|
70755
|
+
const fakeSocket = new net.Socket({ writable: false });
|
|
70756
|
+
this.sockets[name].push(fakeSocket);
|
|
70757
|
+
this.totalSocketCount++;
|
|
70758
|
+
return fakeSocket;
|
|
70759
|
+
}
|
|
70760
|
+
decrementSockets(name, socket) {
|
|
70761
|
+
if (!this.sockets[name] || socket === null) {
|
|
70762
|
+
return;
|
|
70763
|
+
}
|
|
70764
|
+
const sockets = this.sockets[name];
|
|
70765
|
+
const index = sockets.indexOf(socket);
|
|
70766
|
+
if (index !== -1) {
|
|
70767
|
+
sockets.splice(index, 1);
|
|
70768
|
+
this.totalSocketCount--;
|
|
70769
|
+
if (sockets.length === 0) {
|
|
70770
|
+
delete this.sockets[name];
|
|
70771
|
+
}
|
|
70772
|
+
}
|
|
70773
|
+
}
|
|
70774
|
+
// In order to properly update the socket pool, we need to call `getName()` on
|
|
70775
|
+
// the core `https.Agent` if it is a secureEndpoint.
|
|
70776
|
+
getName(options) {
|
|
70777
|
+
const secureEndpoint = this.isSecureEndpoint(options);
|
|
70778
|
+
if (secureEndpoint) {
|
|
70779
|
+
return import_https.Agent.prototype.getName.call(this, options);
|
|
70780
|
+
}
|
|
70781
|
+
return super.getName(options);
|
|
70782
|
+
}
|
|
70783
|
+
createSocket(req, options, cb) {
|
|
70784
|
+
const connectOpts = {
|
|
70785
|
+
...options,
|
|
70786
|
+
secureEndpoint: this.isSecureEndpoint(options)
|
|
70787
|
+
};
|
|
70788
|
+
const name = this.getName(connectOpts);
|
|
70789
|
+
const fakeSocket = this.incrementSockets(name);
|
|
70790
|
+
Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
|
|
70791
|
+
this.decrementSockets(name, fakeSocket);
|
|
70792
|
+
if (socket instanceof http.Agent) {
|
|
70793
|
+
try {
|
|
70794
|
+
return socket.addRequest(req, connectOpts);
|
|
70795
|
+
} catch (err) {
|
|
70796
|
+
return cb(err);
|
|
70797
|
+
}
|
|
70798
|
+
}
|
|
70799
|
+
this[INTERNAL].currentSocket = socket;
|
|
70800
|
+
super.createSocket(req, options, cb);
|
|
70801
|
+
}, (err) => {
|
|
70802
|
+
this.decrementSockets(name, fakeSocket);
|
|
70803
|
+
cb(err);
|
|
70804
|
+
});
|
|
70805
|
+
}
|
|
70806
|
+
createConnection() {
|
|
70807
|
+
const socket = this[INTERNAL].currentSocket;
|
|
70808
|
+
this[INTERNAL].currentSocket = void 0;
|
|
70809
|
+
if (!socket) {
|
|
70810
|
+
throw new Error("No socket was returned in the `connect()` function");
|
|
70811
|
+
}
|
|
70812
|
+
return socket;
|
|
70813
|
+
}
|
|
70814
|
+
get defaultPort() {
|
|
70815
|
+
return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
|
|
70816
|
+
}
|
|
70817
|
+
set defaultPort(v5) {
|
|
70818
|
+
if (this[INTERNAL]) {
|
|
70819
|
+
this[INTERNAL].defaultPort = v5;
|
|
70820
|
+
}
|
|
70821
|
+
}
|
|
70822
|
+
get protocol() {
|
|
70823
|
+
return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
|
|
70824
|
+
}
|
|
70825
|
+
set protocol(v5) {
|
|
70826
|
+
if (this[INTERNAL]) {
|
|
70827
|
+
this[INTERNAL].protocol = v5;
|
|
70828
|
+
}
|
|
70829
|
+
}
|
|
70830
|
+
};
|
|
70831
|
+
|
|
70832
|
+
// node_modules/https-proxy-agent/dist/index.js
|
|
70833
|
+
var import_url = require("url");
|
|
70834
|
+
|
|
70835
|
+
// node_modules/https-proxy-agent/dist/parse-proxy-response.js
|
|
70836
|
+
var import_debug = __toESM(require_src2(), 1);
|
|
70837
|
+
var debug2 = (0, import_debug.default)("https-proxy-agent:parse-proxy-response");
|
|
70838
|
+
function parseProxyResponse(socket) {
|
|
70839
|
+
return new Promise((resolve, reject) => {
|
|
70840
|
+
let buffersLength = 0;
|
|
70841
|
+
const buffers = [];
|
|
70842
|
+
function read() {
|
|
70843
|
+
const b7 = socket.read();
|
|
70844
|
+
if (b7)
|
|
70845
|
+
ondata(b7);
|
|
70846
|
+
else
|
|
70847
|
+
socket.once("readable", read);
|
|
70848
|
+
}
|
|
70849
|
+
function cleanup() {
|
|
70850
|
+
socket.removeListener("end", onend);
|
|
70851
|
+
socket.removeListener("error", onerror);
|
|
70852
|
+
socket.removeListener("readable", read);
|
|
70853
|
+
}
|
|
70854
|
+
function onend() {
|
|
70855
|
+
cleanup();
|
|
70856
|
+
debug2("onend");
|
|
70857
|
+
reject(new Error("Proxy connection ended before receiving CONNECT response"));
|
|
70858
|
+
}
|
|
70859
|
+
function onerror(err) {
|
|
70860
|
+
cleanup();
|
|
70861
|
+
debug2("onerror %o", err);
|
|
70862
|
+
reject(err);
|
|
70863
|
+
}
|
|
70864
|
+
function ondata(b7) {
|
|
70865
|
+
buffers.push(b7);
|
|
70866
|
+
buffersLength += b7.length;
|
|
70867
|
+
const buffered = Buffer.concat(buffers, buffersLength);
|
|
70868
|
+
const endOfHeaders = buffered.indexOf("\r\n\r\n");
|
|
70869
|
+
if (endOfHeaders === -1) {
|
|
70870
|
+
debug2("have not received end of HTTP headers yet...");
|
|
70871
|
+
read();
|
|
70872
|
+
return;
|
|
70873
|
+
}
|
|
70874
|
+
const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
|
|
70875
|
+
const firstLine = headerParts.shift();
|
|
70876
|
+
if (!firstLine) {
|
|
70877
|
+
socket.destroy();
|
|
70878
|
+
return reject(new Error("No header received from proxy CONNECT response"));
|
|
70879
|
+
}
|
|
70880
|
+
const firstLineParts = firstLine.split(" ");
|
|
70881
|
+
const statusCode = +firstLineParts[1];
|
|
70882
|
+
const statusText = firstLineParts.slice(2).join(" ");
|
|
70883
|
+
const headers = {};
|
|
70884
|
+
for (const header of headerParts) {
|
|
70885
|
+
if (!header)
|
|
70886
|
+
continue;
|
|
70887
|
+
const firstColon = header.indexOf(":");
|
|
70888
|
+
if (firstColon === -1) {
|
|
70889
|
+
socket.destroy();
|
|
70890
|
+
return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
|
|
70891
|
+
}
|
|
70892
|
+
const key = header.slice(0, firstColon).toLowerCase();
|
|
70893
|
+
const value = header.slice(firstColon + 1).trimStart();
|
|
70894
|
+
const current = headers[key];
|
|
70895
|
+
if (typeof current === "string") {
|
|
70896
|
+
headers[key] = [current, value];
|
|
70897
|
+
} else if (Array.isArray(current)) {
|
|
70898
|
+
current.push(value);
|
|
70899
|
+
} else {
|
|
70900
|
+
headers[key] = value;
|
|
70901
|
+
}
|
|
70902
|
+
}
|
|
70903
|
+
debug2("got proxy server response: %o %o", firstLine, headers);
|
|
70904
|
+
cleanup();
|
|
70905
|
+
resolve({
|
|
70906
|
+
connect: {
|
|
70907
|
+
statusCode,
|
|
70908
|
+
statusText,
|
|
70909
|
+
headers
|
|
70910
|
+
},
|
|
70911
|
+
buffered
|
|
70912
|
+
});
|
|
70913
|
+
}
|
|
70914
|
+
socket.on("error", onerror);
|
|
70915
|
+
socket.on("end", onend);
|
|
70916
|
+
read();
|
|
70917
|
+
});
|
|
70918
|
+
}
|
|
70919
|
+
|
|
70920
|
+
// node_modules/https-proxy-agent/dist/index.js
|
|
70921
|
+
var debug3 = (0, import_debug2.default)("https-proxy-agent");
|
|
70922
|
+
var setServernameFromNonIpHost = (options) => {
|
|
70923
|
+
if (options.servername === void 0 && options.host && !net2.isIP(options.host)) {
|
|
70924
|
+
return {
|
|
70925
|
+
...options,
|
|
70926
|
+
servername: options.host
|
|
70927
|
+
};
|
|
70928
|
+
}
|
|
70929
|
+
return options;
|
|
70930
|
+
};
|
|
70931
|
+
var HttpsProxyAgent = class extends Agent2 {
|
|
70932
|
+
constructor(proxy, opts) {
|
|
70933
|
+
super(opts);
|
|
70934
|
+
this.options = { path: void 0 };
|
|
70935
|
+
this.proxy = typeof proxy === "string" ? new import_url.URL(proxy) : proxy;
|
|
70936
|
+
this.proxyHeaders = opts?.headers ?? {};
|
|
70937
|
+
debug3("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
|
|
70938
|
+
const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
|
|
70939
|
+
const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
|
|
70940
|
+
this.connectOpts = {
|
|
70941
|
+
// Attempt to negotiate http/1.1 for proxy servers that support http/2
|
|
70942
|
+
ALPNProtocols: ["http/1.1"],
|
|
70943
|
+
...opts ? omit(opts, "headers") : null,
|
|
70944
|
+
host,
|
|
70945
|
+
port
|
|
70946
|
+
};
|
|
70947
|
+
}
|
|
70948
|
+
/**
|
|
70949
|
+
* Called when the node-core HTTP client library is creating a
|
|
70950
|
+
* new HTTP request.
|
|
70951
|
+
*/
|
|
70952
|
+
async connect(req, opts) {
|
|
70953
|
+
const { proxy } = this;
|
|
70954
|
+
if (!opts.host) {
|
|
70955
|
+
throw new TypeError('No "host" provided');
|
|
70956
|
+
}
|
|
70957
|
+
let socket;
|
|
70958
|
+
if (proxy.protocol === "https:") {
|
|
70959
|
+
debug3("Creating `tls.Socket`: %o", this.connectOpts);
|
|
70960
|
+
socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
|
|
70961
|
+
} else {
|
|
70962
|
+
debug3("Creating `net.Socket`: %o", this.connectOpts);
|
|
70963
|
+
socket = net2.connect(this.connectOpts);
|
|
70964
|
+
}
|
|
70965
|
+
const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
|
|
70966
|
+
const host = net2.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
|
|
70967
|
+
let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
|
|
70968
|
+
`;
|
|
70969
|
+
if (proxy.username || proxy.password) {
|
|
70970
|
+
const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
70971
|
+
headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
|
|
70972
|
+
}
|
|
70973
|
+
headers.Host = `${host}:${opts.port}`;
|
|
70974
|
+
if (!headers["Proxy-Connection"]) {
|
|
70975
|
+
headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
|
|
70976
|
+
}
|
|
70977
|
+
for (const name of Object.keys(headers)) {
|
|
70978
|
+
payload += `${name}: ${headers[name]}\r
|
|
70979
|
+
`;
|
|
70980
|
+
}
|
|
70981
|
+
const proxyResponsePromise = parseProxyResponse(socket);
|
|
70982
|
+
socket.write(`${payload}\r
|
|
70983
|
+
`);
|
|
70984
|
+
const { connect: connect3, buffered } = await proxyResponsePromise;
|
|
70985
|
+
req.emit("proxyConnect", connect3);
|
|
70986
|
+
this.emit("proxyConnect", connect3, req);
|
|
70987
|
+
if (connect3.statusCode === 200) {
|
|
70988
|
+
req.once("socket", resume);
|
|
70989
|
+
if (opts.secureEndpoint) {
|
|
70990
|
+
debug3("Upgrading socket connection to TLS");
|
|
70991
|
+
return tls.connect({
|
|
70992
|
+
...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
|
|
70993
|
+
socket
|
|
70994
|
+
});
|
|
70995
|
+
}
|
|
70996
|
+
return socket;
|
|
70997
|
+
}
|
|
70998
|
+
socket.destroy();
|
|
70999
|
+
const fakeSocket = new net2.Socket({ writable: false });
|
|
71000
|
+
fakeSocket.readable = true;
|
|
71001
|
+
req.once("socket", (s2) => {
|
|
71002
|
+
debug3("Replaying proxy buffer for failed request");
|
|
71003
|
+
(0, import_assert.default)(s2.listenerCount("data") > 0);
|
|
71004
|
+
s2.push(buffered);
|
|
71005
|
+
s2.push(null);
|
|
71006
|
+
});
|
|
71007
|
+
return fakeSocket;
|
|
71008
|
+
}
|
|
71009
|
+
};
|
|
71010
|
+
HttpsProxyAgent.protocols = ["http", "https"];
|
|
71011
|
+
function resume(socket) {
|
|
71012
|
+
socket.resume();
|
|
71013
|
+
}
|
|
71014
|
+
function omit(obj, ...keys) {
|
|
71015
|
+
const ret = {};
|
|
71016
|
+
let key;
|
|
71017
|
+
for (key in obj) {
|
|
71018
|
+
if (!keys.includes(key)) {
|
|
71019
|
+
ret[key] = obj[key];
|
|
71020
|
+
}
|
|
71021
|
+
}
|
|
71022
|
+
return ret;
|
|
71023
|
+
}
|
|
70705
71024
|
|
|
70706
71025
|
// node_modules/axios/lib/helpers/bind.js
|
|
70707
71026
|
function bind(fn, thisArg) {
|
|
@@ -71405,8 +71724,8 @@ var transitional_default = {
|
|
|
71405
71724
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
71406
71725
|
|
|
71407
71726
|
// node_modules/axios/lib/platform/node/classes/URLSearchParams.js
|
|
71408
|
-
var
|
|
71409
|
-
var URLSearchParams_default =
|
|
71727
|
+
var import_url2 = __toESM(require("url"), 1);
|
|
71728
|
+
var URLSearchParams_default = import_url2.default.URLSearchParams;
|
|
71410
71729
|
|
|
71411
71730
|
// node_modules/axios/lib/platform/node/index.js
|
|
71412
71731
|
var ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
|
@@ -71977,7 +72296,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
71977
72296
|
// node_modules/axios/lib/adapters/http.js
|
|
71978
72297
|
var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
|
|
71979
72298
|
var import_http = __toESM(require("http"), 1);
|
|
71980
|
-
var
|
|
72299
|
+
var import_https2 = __toESM(require("https"), 1);
|
|
71981
72300
|
var import_util4 = __toESM(require("util"), 1);
|
|
71982
72301
|
var import_follow_redirects = __toESM(require_follow_redirects(), 1);
|
|
71983
72302
|
var import_zlib = __toESM(require("zlib"), 1);
|
|
@@ -72690,7 +73009,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config8) {
|
|
|
72690
73009
|
if (config8.transport) {
|
|
72691
73010
|
transport = config8.transport;
|
|
72692
73011
|
} else if (config8.maxRedirects === 0) {
|
|
72693
|
-
transport = isHttpsRequest ?
|
|
73012
|
+
transport = isHttpsRequest ? import_https2.default : import_http.default;
|
|
72694
73013
|
} else {
|
|
72695
73014
|
if (config8.maxRedirects) {
|
|
72696
73015
|
options.maxRedirects = config8.maxRedirects;
|
|
@@ -74513,7 +74832,7 @@ var AnthropicEngine = class {
|
|
|
74513
74832
|
const clientOptions = { apiKey: this.config.apiKey };
|
|
74514
74833
|
const proxy = config8.proxy;
|
|
74515
74834
|
if (proxy) {
|
|
74516
|
-
clientOptions.httpAgent = new
|
|
74835
|
+
clientOptions.httpAgent = new HttpsProxyAgent(proxy);
|
|
74517
74836
|
}
|
|
74518
74837
|
this.client = new sdk_default(clientOptions);
|
|
74519
74838
|
}
|
|
@@ -74667,11 +74986,11 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
74667
74986
|
function verb(n2) {
|
|
74668
74987
|
if (g5[n2]) i3[n2] = function(v5) {
|
|
74669
74988
|
return new Promise(function(a4, b7) {
|
|
74670
|
-
q6.push([n2, v5, a4, b7]) > 1 ||
|
|
74989
|
+
q6.push([n2, v5, a4, b7]) > 1 || resume2(n2, v5);
|
|
74671
74990
|
});
|
|
74672
74991
|
};
|
|
74673
74992
|
}
|
|
74674
|
-
function
|
|
74993
|
+
function resume2(n2, v5) {
|
|
74675
74994
|
try {
|
|
74676
74995
|
step(g5[n2](v5));
|
|
74677
74996
|
} catch (e3) {
|
|
@@ -74682,13 +75001,13 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
74682
75001
|
r3.value instanceof __await ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q6[0][2], r3);
|
|
74683
75002
|
}
|
|
74684
75003
|
function fulfill(value) {
|
|
74685
|
-
|
|
75004
|
+
resume2("next", value);
|
|
74686
75005
|
}
|
|
74687
75006
|
function reject(value) {
|
|
74688
|
-
|
|
75007
|
+
resume2("throw", value);
|
|
74689
75008
|
}
|
|
74690
75009
|
function settle2(f4, v5) {
|
|
74691
|
-
if (f4(v5), q6.shift(), q6.length)
|
|
75010
|
+
if (f4(v5), q6.shift(), q6.length) resume2(q6[0][0], q6[0][1]);
|
|
74692
75011
|
}
|
|
74693
75012
|
}
|
|
74694
75013
|
function __asyncValues(o3) {
|
|
@@ -74956,14 +75275,14 @@ function disable() {
|
|
|
74956
75275
|
return result;
|
|
74957
75276
|
}
|
|
74958
75277
|
function createDebugger(namespace) {
|
|
74959
|
-
const newDebugger = Object.assign(
|
|
75278
|
+
const newDebugger = Object.assign(debug5, {
|
|
74960
75279
|
enabled: enabled(namespace),
|
|
74961
75280
|
destroy,
|
|
74962
75281
|
log: debugObj.log,
|
|
74963
75282
|
namespace,
|
|
74964
75283
|
extend: extend2
|
|
74965
75284
|
});
|
|
74966
|
-
function
|
|
75285
|
+
function debug5(...args) {
|
|
74967
75286
|
if (!newDebugger.enabled) {
|
|
74968
75287
|
return;
|
|
74969
75288
|
}
|
|
@@ -76324,7 +76643,7 @@ function createPipelineFromOptions(options) {
|
|
|
76324
76643
|
}
|
|
76325
76644
|
|
|
76326
76645
|
// node_modules/@azure/core-rest-pipeline/dist/esm/nodeHttpClient.js
|
|
76327
|
-
var
|
|
76646
|
+
var http3 = __toESM(require("node:http"), 1);
|
|
76328
76647
|
var https2 = __toESM(require("node:https"), 1);
|
|
76329
76648
|
var zlib2 = __toESM(require("node:zlib"), 1);
|
|
76330
76649
|
var import_node_stream3 = require("node:stream");
|
|
@@ -76481,7 +76800,7 @@ var NodeHttpClient = class {
|
|
|
76481
76800
|
headers: request3.headers.toJSON({ preserveCase: true })
|
|
76482
76801
|
};
|
|
76483
76802
|
return new Promise((resolve, reject) => {
|
|
76484
|
-
const req = isInsecure ?
|
|
76803
|
+
const req = isInsecure ? http3.request(options, resolve) : https2.request(options, resolve);
|
|
76485
76804
|
req.once("error", (err) => {
|
|
76486
76805
|
var _a6;
|
|
76487
76806
|
reject(new RestError(err.message, { code: (_a6 = err.code) !== null && _a6 !== void 0 ? _a6 : RestError.REQUEST_SEND_ERROR, request: request3 }));
|
|
@@ -76512,10 +76831,10 @@ var NodeHttpClient = class {
|
|
|
76512
76831
|
const disableKeepAlive = request3.disableKeepAlive;
|
|
76513
76832
|
if (isInsecure) {
|
|
76514
76833
|
if (disableKeepAlive) {
|
|
76515
|
-
return
|
|
76834
|
+
return http3.globalAgent;
|
|
76516
76835
|
}
|
|
76517
76836
|
if (!this.cachedHttpAgent) {
|
|
76518
|
-
this.cachedHttpAgent = new
|
|
76837
|
+
this.cachedHttpAgent = new http3.Agent({ keepAlive: true });
|
|
76519
76838
|
}
|
|
76520
76839
|
return this.cachedHttpAgent;
|
|
76521
76840
|
} else {
|
|
@@ -78387,6 +78706,27 @@ var FlowiseEngine = class {
|
|
|
78387
78706
|
};
|
|
78388
78707
|
|
|
78389
78708
|
// node_modules/@google/generative-ai/dist/index.mjs
|
|
78709
|
+
var SchemaType;
|
|
78710
|
+
(function(SchemaType2) {
|
|
78711
|
+
SchemaType2["STRING"] = "string";
|
|
78712
|
+
SchemaType2["NUMBER"] = "number";
|
|
78713
|
+
SchemaType2["INTEGER"] = "integer";
|
|
78714
|
+
SchemaType2["BOOLEAN"] = "boolean";
|
|
78715
|
+
SchemaType2["ARRAY"] = "array";
|
|
78716
|
+
SchemaType2["OBJECT"] = "object";
|
|
78717
|
+
})(SchemaType || (SchemaType = {}));
|
|
78718
|
+
var ExecutableCodeLanguage;
|
|
78719
|
+
(function(ExecutableCodeLanguage2) {
|
|
78720
|
+
ExecutableCodeLanguage2["LANGUAGE_UNSPECIFIED"] = "language_unspecified";
|
|
78721
|
+
ExecutableCodeLanguage2["PYTHON"] = "python";
|
|
78722
|
+
})(ExecutableCodeLanguage || (ExecutableCodeLanguage = {}));
|
|
78723
|
+
var Outcome;
|
|
78724
|
+
(function(Outcome2) {
|
|
78725
|
+
Outcome2["OUTCOME_UNSPECIFIED"] = "outcome_unspecified";
|
|
78726
|
+
Outcome2["OUTCOME_OK"] = "outcome_ok";
|
|
78727
|
+
Outcome2["OUTCOME_FAILED"] = "outcome_failed";
|
|
78728
|
+
Outcome2["OUTCOME_DEADLINE_EXCEEDED"] = "outcome_deadline_exceeded";
|
|
78729
|
+
})(Outcome || (Outcome = {}));
|
|
78390
78730
|
var POSSIBLE_ROLES = ["user", "model", "function", "system"];
|
|
78391
78731
|
var HarmCategory;
|
|
78392
78732
|
(function(HarmCategory2) {
|
|
@@ -78395,6 +78735,7 @@ var HarmCategory;
|
|
|
78395
78735
|
HarmCategory2["HARM_CATEGORY_SEXUALLY_EXPLICIT"] = "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
78396
78736
|
HarmCategory2["HARM_CATEGORY_HARASSMENT"] = "HARM_CATEGORY_HARASSMENT";
|
|
78397
78737
|
HarmCategory2["HARM_CATEGORY_DANGEROUS_CONTENT"] = "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
78738
|
+
HarmCategory2["HARM_CATEGORY_CIVIC_INTEGRITY"] = "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
78398
78739
|
})(HarmCategory || (HarmCategory = {}));
|
|
78399
78740
|
var HarmBlockThreshold;
|
|
78400
78741
|
(function(HarmBlockThreshold2) {
|
|
@@ -78425,6 +78766,11 @@ var FinishReason;
|
|
|
78425
78766
|
FinishReason2["MAX_TOKENS"] = "MAX_TOKENS";
|
|
78426
78767
|
FinishReason2["SAFETY"] = "SAFETY";
|
|
78427
78768
|
FinishReason2["RECITATION"] = "RECITATION";
|
|
78769
|
+
FinishReason2["LANGUAGE"] = "LANGUAGE";
|
|
78770
|
+
FinishReason2["BLOCKLIST"] = "BLOCKLIST";
|
|
78771
|
+
FinishReason2["PROHIBITED_CONTENT"] = "PROHIBITED_CONTENT";
|
|
78772
|
+
FinishReason2["SPII"] = "SPII";
|
|
78773
|
+
FinishReason2["MALFORMED_FUNCTION_CALL"] = "MALFORMED_FUNCTION_CALL";
|
|
78428
78774
|
FinishReason2["OTHER"] = "OTHER";
|
|
78429
78775
|
})(FinishReason || (FinishReason = {}));
|
|
78430
78776
|
var TaskType;
|
|
@@ -78443,15 +78789,11 @@ var FunctionCallingMode;
|
|
|
78443
78789
|
FunctionCallingMode2["ANY"] = "ANY";
|
|
78444
78790
|
FunctionCallingMode2["NONE"] = "NONE";
|
|
78445
78791
|
})(FunctionCallingMode || (FunctionCallingMode = {}));
|
|
78446
|
-
var
|
|
78447
|
-
(function(
|
|
78448
|
-
|
|
78449
|
-
|
|
78450
|
-
|
|
78451
|
-
FunctionDeclarationSchemaType2["BOOLEAN"] = "BOOLEAN";
|
|
78452
|
-
FunctionDeclarationSchemaType2["ARRAY"] = "ARRAY";
|
|
78453
|
-
FunctionDeclarationSchemaType2["OBJECT"] = "OBJECT";
|
|
78454
|
-
})(FunctionDeclarationSchemaType || (FunctionDeclarationSchemaType = {}));
|
|
78792
|
+
var DynamicRetrievalMode;
|
|
78793
|
+
(function(DynamicRetrievalMode2) {
|
|
78794
|
+
DynamicRetrievalMode2["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
78795
|
+
DynamicRetrievalMode2["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
78796
|
+
})(DynamicRetrievalMode || (DynamicRetrievalMode = {}));
|
|
78455
78797
|
var GoogleGenerativeAIError = class extends Error {
|
|
78456
78798
|
constructor(message) {
|
|
78457
78799
|
super(`[GoogleGenerativeAI Error]: ${message}`);
|
|
@@ -78473,9 +78815,11 @@ var GoogleGenerativeAIFetchError = class extends GoogleGenerativeAIError {
|
|
|
78473
78815
|
};
|
|
78474
78816
|
var GoogleGenerativeAIRequestInputError = class extends GoogleGenerativeAIError {
|
|
78475
78817
|
};
|
|
78818
|
+
var GoogleGenerativeAIAbortError = class extends GoogleGenerativeAIError {
|
|
78819
|
+
};
|
|
78476
78820
|
var DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com";
|
|
78477
78821
|
var DEFAULT_API_VERSION = "v1beta";
|
|
78478
|
-
var PACKAGE_VERSION = "0.
|
|
78822
|
+
var PACKAGE_VERSION = "0.24.1";
|
|
78479
78823
|
var PACKAGE_LOG_HEADER = "genai-js";
|
|
78480
78824
|
var Task;
|
|
78481
78825
|
(function(Task2) {
|
|
@@ -78513,11 +78857,12 @@ function getClientHeaders(requestOptions) {
|
|
|
78513
78857
|
return clientHeaders.join(" ");
|
|
78514
78858
|
}
|
|
78515
78859
|
async function getHeaders(url2) {
|
|
78860
|
+
var _a5;
|
|
78516
78861
|
const headers = new Headers();
|
|
78517
78862
|
headers.append("Content-Type", "application/json");
|
|
78518
78863
|
headers.append("x-goog-api-client", getClientHeaders(url2.requestOptions));
|
|
78519
78864
|
headers.append("x-goog-api-key", url2.apiKey);
|
|
78520
|
-
let customHeaders = url2.requestOptions.customHeaders;
|
|
78865
|
+
let customHeaders = (_a5 = url2.requestOptions) === null || _a5 === void 0 ? void 0 : _a5.customHeaders;
|
|
78521
78866
|
if (customHeaders) {
|
|
78522
78867
|
if (!(customHeaders instanceof Headers)) {
|
|
78523
78868
|
try {
|
|
@@ -78537,53 +78882,67 @@ async function getHeaders(url2) {
|
|
|
78537
78882
|
}
|
|
78538
78883
|
return headers;
|
|
78539
78884
|
}
|
|
78540
|
-
async function
|
|
78885
|
+
async function constructModelRequest(model, task, apiKey, stream4, body, requestOptions) {
|
|
78541
78886
|
const url2 = new RequestUrl(model, task, apiKey, stream4, requestOptions);
|
|
78542
78887
|
return {
|
|
78543
78888
|
url: url2.toString(),
|
|
78544
78889
|
fetchOptions: Object.assign(Object.assign({}, buildFetchOptions(requestOptions)), { method: "POST", headers: await getHeaders(url2), body })
|
|
78545
78890
|
};
|
|
78546
78891
|
}
|
|
78547
|
-
async function
|
|
78548
|
-
|
|
78892
|
+
async function makeModelRequest(model, task, apiKey, stream4, body, requestOptions = {}, fetchFn = fetch) {
|
|
78893
|
+
const { url: url2, fetchOptions } = await constructModelRequest(model, task, apiKey, stream4, body, requestOptions);
|
|
78894
|
+
return makeRequest(url2, fetchOptions, fetchFn);
|
|
78549
78895
|
}
|
|
78550
|
-
async function
|
|
78551
|
-
const url2 = new RequestUrl(model, task, apiKey, stream4, requestOptions);
|
|
78896
|
+
async function makeRequest(url2, fetchOptions, fetchFn = fetch) {
|
|
78552
78897
|
let response;
|
|
78553
78898
|
try {
|
|
78554
|
-
|
|
78555
|
-
response = await fetchFn(request3.url, request3.fetchOptions);
|
|
78556
|
-
if (!response.ok) {
|
|
78557
|
-
let message = "";
|
|
78558
|
-
let errorDetails;
|
|
78559
|
-
try {
|
|
78560
|
-
const json = await response.json();
|
|
78561
|
-
message = json.error.message;
|
|
78562
|
-
if (json.error.details) {
|
|
78563
|
-
message += ` ${JSON.stringify(json.error.details)}`;
|
|
78564
|
-
errorDetails = json.error.details;
|
|
78565
|
-
}
|
|
78566
|
-
} catch (e3) {
|
|
78567
|
-
}
|
|
78568
|
-
throw new GoogleGenerativeAIFetchError(`Error fetching from ${url2.toString()}: [${response.status} ${response.statusText}] ${message}`, response.status, response.statusText, errorDetails);
|
|
78569
|
-
}
|
|
78899
|
+
response = await fetchFn(url2, fetchOptions);
|
|
78570
78900
|
} catch (e3) {
|
|
78571
|
-
|
|
78572
|
-
|
|
78573
|
-
|
|
78574
|
-
|
|
78575
|
-
}
|
|
78576
|
-
throw err;
|
|
78901
|
+
handleResponseError(e3, url2);
|
|
78902
|
+
}
|
|
78903
|
+
if (!response.ok) {
|
|
78904
|
+
await handleResponseNotOk(response, url2);
|
|
78577
78905
|
}
|
|
78578
78906
|
return response;
|
|
78579
78907
|
}
|
|
78908
|
+
function handleResponseError(e3, url2) {
|
|
78909
|
+
let err = e3;
|
|
78910
|
+
if (err.name === "AbortError") {
|
|
78911
|
+
err = new GoogleGenerativeAIAbortError(`Request aborted when fetching ${url2.toString()}: ${e3.message}`);
|
|
78912
|
+
err.stack = e3.stack;
|
|
78913
|
+
} else if (!(e3 instanceof GoogleGenerativeAIFetchError || e3 instanceof GoogleGenerativeAIRequestInputError)) {
|
|
78914
|
+
err = new GoogleGenerativeAIError(`Error fetching from ${url2.toString()}: ${e3.message}`);
|
|
78915
|
+
err.stack = e3.stack;
|
|
78916
|
+
}
|
|
78917
|
+
throw err;
|
|
78918
|
+
}
|
|
78919
|
+
async function handleResponseNotOk(response, url2) {
|
|
78920
|
+
let message = "";
|
|
78921
|
+
let errorDetails;
|
|
78922
|
+
try {
|
|
78923
|
+
const json = await response.json();
|
|
78924
|
+
message = json.error.message;
|
|
78925
|
+
if (json.error.details) {
|
|
78926
|
+
message += ` ${JSON.stringify(json.error.details)}`;
|
|
78927
|
+
errorDetails = json.error.details;
|
|
78928
|
+
}
|
|
78929
|
+
} catch (e3) {
|
|
78930
|
+
}
|
|
78931
|
+
throw new GoogleGenerativeAIFetchError(`Error fetching from ${url2.toString()}: [${response.status} ${response.statusText}] ${message}`, response.status, response.statusText, errorDetails);
|
|
78932
|
+
}
|
|
78580
78933
|
function buildFetchOptions(requestOptions) {
|
|
78581
78934
|
const fetchOptions = {};
|
|
78582
|
-
if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) >= 0) {
|
|
78583
|
-
const
|
|
78584
|
-
|
|
78585
|
-
|
|
78586
|
-
|
|
78935
|
+
if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.signal) !== void 0 || (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) >= 0) {
|
|
78936
|
+
const controller = new AbortController();
|
|
78937
|
+
if ((requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeout) >= 0) {
|
|
78938
|
+
setTimeout(() => controller.abort(), requestOptions.timeout);
|
|
78939
|
+
}
|
|
78940
|
+
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.signal) {
|
|
78941
|
+
requestOptions.signal.addEventListener("abort", () => {
|
|
78942
|
+
controller.abort();
|
|
78943
|
+
});
|
|
78944
|
+
}
|
|
78945
|
+
fetchOptions.signal = controller.signal;
|
|
78587
78946
|
}
|
|
78588
78947
|
return fetchOptions;
|
|
78589
78948
|
}
|
|
@@ -78641,6 +79000,12 @@ function getText(response) {
|
|
|
78641
79000
|
if (part.text) {
|
|
78642
79001
|
textStrings.push(part.text);
|
|
78643
79002
|
}
|
|
79003
|
+
if (part.executableCode) {
|
|
79004
|
+
textStrings.push("\n```" + part.executableCode.language + "\n" + part.executableCode.code + "\n```\n");
|
|
79005
|
+
}
|
|
79006
|
+
if (part.codeExecutionResult) {
|
|
79007
|
+
textStrings.push("\n```\n" + part.codeExecutionResult.output + "\n```\n");
|
|
79008
|
+
}
|
|
78644
79009
|
}
|
|
78645
79010
|
}
|
|
78646
79011
|
if (textStrings.length > 0) {
|
|
@@ -78665,7 +79030,11 @@ function getFunctionCalls(response) {
|
|
|
78665
79030
|
return void 0;
|
|
78666
79031
|
}
|
|
78667
79032
|
}
|
|
78668
|
-
var badFinishReasons = [
|
|
79033
|
+
var badFinishReasons = [
|
|
79034
|
+
FinishReason.RECITATION,
|
|
79035
|
+
FinishReason.SAFETY,
|
|
79036
|
+
FinishReason.LANGUAGE
|
|
79037
|
+
];
|
|
78669
79038
|
function hadBadFinishReason(candidate) {
|
|
78670
79039
|
return !!candidate.finishReason && badFinishReasons.includes(candidate.finishReason);
|
|
78671
79040
|
}
|
|
@@ -78703,11 +79072,11 @@ function __asyncGenerator2(thisArg, _arguments, generator) {
|
|
|
78703
79072
|
function verb(n2) {
|
|
78704
79073
|
if (g5[n2]) i3[n2] = function(v5) {
|
|
78705
79074
|
return new Promise(function(a4, b7) {
|
|
78706
|
-
q6.push([n2, v5, a4, b7]) > 1 ||
|
|
79075
|
+
q6.push([n2, v5, a4, b7]) > 1 || resume2(n2, v5);
|
|
78707
79076
|
});
|
|
78708
79077
|
};
|
|
78709
79078
|
}
|
|
78710
|
-
function
|
|
79079
|
+
function resume2(n2, v5) {
|
|
78711
79080
|
try {
|
|
78712
79081
|
step(g5[n2](v5));
|
|
78713
79082
|
} catch (e3) {
|
|
@@ -78718,13 +79087,13 @@ function __asyncGenerator2(thisArg, _arguments, generator) {
|
|
|
78718
79087
|
r3.value instanceof __await2 ? Promise.resolve(r3.value.v).then(fulfill, reject) : settle2(q6[0][2], r3);
|
|
78719
79088
|
}
|
|
78720
79089
|
function fulfill(value) {
|
|
78721
|
-
|
|
79090
|
+
resume2("next", value);
|
|
78722
79091
|
}
|
|
78723
79092
|
function reject(value) {
|
|
78724
|
-
|
|
79093
|
+
resume2("throw", value);
|
|
78725
79094
|
}
|
|
78726
79095
|
function settle2(f4, v5) {
|
|
78727
|
-
if (f4(v5), q6.shift(), q6.length)
|
|
79096
|
+
if (f4(v5), q6.shift(), q6.length) resume2(q6[0][0], q6[0][1]);
|
|
78728
79097
|
}
|
|
78729
79098
|
}
|
|
78730
79099
|
var responseLineRE = /^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;
|
|
@@ -78791,6 +79160,15 @@ function getResponseStream(inputStream) {
|
|
|
78791
79160
|
match = currentText.match(responseLineRE);
|
|
78792
79161
|
}
|
|
78793
79162
|
return pump();
|
|
79163
|
+
}).catch((e3) => {
|
|
79164
|
+
let err = e3;
|
|
79165
|
+
err.stack = e3.stack;
|
|
79166
|
+
if (err.name === "AbortError") {
|
|
79167
|
+
err = new GoogleGenerativeAIAbortError("Request aborted when reading from the stream");
|
|
79168
|
+
} else {
|
|
79169
|
+
err = new GoogleGenerativeAIError("Error reading from the stream");
|
|
79170
|
+
}
|
|
79171
|
+
throw err;
|
|
78794
79172
|
});
|
|
78795
79173
|
}
|
|
78796
79174
|
}
|
|
@@ -78804,23 +79182,24 @@ function aggregateResponses(responses) {
|
|
|
78804
79182
|
};
|
|
78805
79183
|
for (const response of responses) {
|
|
78806
79184
|
if (response.candidates) {
|
|
79185
|
+
let candidateIndex = 0;
|
|
78807
79186
|
for (const candidate of response.candidates) {
|
|
78808
|
-
const i3 = candidate.index;
|
|
78809
79187
|
if (!aggregatedResponse.candidates) {
|
|
78810
79188
|
aggregatedResponse.candidates = [];
|
|
78811
79189
|
}
|
|
78812
|
-
if (!aggregatedResponse.candidates[
|
|
78813
|
-
aggregatedResponse.candidates[
|
|
78814
|
-
index:
|
|
79190
|
+
if (!aggregatedResponse.candidates[candidateIndex]) {
|
|
79191
|
+
aggregatedResponse.candidates[candidateIndex] = {
|
|
79192
|
+
index: candidateIndex
|
|
78815
79193
|
};
|
|
78816
79194
|
}
|
|
78817
|
-
aggregatedResponse.candidates[
|
|
78818
|
-
aggregatedResponse.candidates[
|
|
78819
|
-
aggregatedResponse.candidates[
|
|
78820
|
-
aggregatedResponse.candidates[
|
|
79195
|
+
aggregatedResponse.candidates[candidateIndex].citationMetadata = candidate.citationMetadata;
|
|
79196
|
+
aggregatedResponse.candidates[candidateIndex].groundingMetadata = candidate.groundingMetadata;
|
|
79197
|
+
aggregatedResponse.candidates[candidateIndex].finishReason = candidate.finishReason;
|
|
79198
|
+
aggregatedResponse.candidates[candidateIndex].finishMessage = candidate.finishMessage;
|
|
79199
|
+
aggregatedResponse.candidates[candidateIndex].safetyRatings = candidate.safetyRatings;
|
|
78821
79200
|
if (candidate.content && candidate.content.parts) {
|
|
78822
|
-
if (!aggregatedResponse.candidates[
|
|
78823
|
-
aggregatedResponse.candidates[
|
|
79201
|
+
if (!aggregatedResponse.candidates[candidateIndex].content) {
|
|
79202
|
+
aggregatedResponse.candidates[candidateIndex].content = {
|
|
78824
79203
|
role: candidate.content.role || "user",
|
|
78825
79204
|
parts: []
|
|
78826
79205
|
};
|
|
@@ -78833,19 +79212,29 @@ function aggregateResponses(responses) {
|
|
|
78833
79212
|
if (part.functionCall) {
|
|
78834
79213
|
newPart.functionCall = part.functionCall;
|
|
78835
79214
|
}
|
|
79215
|
+
if (part.executableCode) {
|
|
79216
|
+
newPart.executableCode = part.executableCode;
|
|
79217
|
+
}
|
|
79218
|
+
if (part.codeExecutionResult) {
|
|
79219
|
+
newPart.codeExecutionResult = part.codeExecutionResult;
|
|
79220
|
+
}
|
|
78836
79221
|
if (Object.keys(newPart).length === 0) {
|
|
78837
79222
|
newPart.text = "";
|
|
78838
79223
|
}
|
|
78839
|
-
aggregatedResponse.candidates[
|
|
79224
|
+
aggregatedResponse.candidates[candidateIndex].content.parts.push(newPart);
|
|
78840
79225
|
}
|
|
78841
79226
|
}
|
|
78842
79227
|
}
|
|
79228
|
+
candidateIndex++;
|
|
79229
|
+
}
|
|
79230
|
+
if (response.usageMetadata) {
|
|
79231
|
+
aggregatedResponse.usageMetadata = response.usageMetadata;
|
|
78843
79232
|
}
|
|
78844
79233
|
}
|
|
78845
79234
|
return aggregatedResponse;
|
|
78846
79235
|
}
|
|
78847
79236
|
async function generateContentStream(apiKey, model, params, requestOptions) {
|
|
78848
|
-
const response = await
|
|
79237
|
+
const response = await makeModelRequest(
|
|
78849
79238
|
model,
|
|
78850
79239
|
Task.STREAM_GENERATE_CONTENT,
|
|
78851
79240
|
apiKey,
|
|
@@ -78857,7 +79246,7 @@ async function generateContentStream(apiKey, model, params, requestOptions) {
|
|
|
78857
79246
|
return processStream(response);
|
|
78858
79247
|
}
|
|
78859
79248
|
async function generateContent(apiKey, model, params, requestOptions) {
|
|
78860
|
-
const response = await
|
|
79249
|
+
const response = await makeModelRequest(
|
|
78861
79250
|
model,
|
|
78862
79251
|
Task.GENERATE_CONTENT,
|
|
78863
79252
|
apiKey,
|
|
@@ -78927,6 +79316,32 @@ function assignRoleToPartsAndValidateSendMessageRequest(parts) {
|
|
|
78927
79316
|
}
|
|
78928
79317
|
return functionContent;
|
|
78929
79318
|
}
|
|
79319
|
+
function formatCountTokensInput(params, modelParams) {
|
|
79320
|
+
var _a5;
|
|
79321
|
+
let formattedGenerateContentRequest = {
|
|
79322
|
+
model: modelParams === null || modelParams === void 0 ? void 0 : modelParams.model,
|
|
79323
|
+
generationConfig: modelParams === null || modelParams === void 0 ? void 0 : modelParams.generationConfig,
|
|
79324
|
+
safetySettings: modelParams === null || modelParams === void 0 ? void 0 : modelParams.safetySettings,
|
|
79325
|
+
tools: modelParams === null || modelParams === void 0 ? void 0 : modelParams.tools,
|
|
79326
|
+
toolConfig: modelParams === null || modelParams === void 0 ? void 0 : modelParams.toolConfig,
|
|
79327
|
+
systemInstruction: modelParams === null || modelParams === void 0 ? void 0 : modelParams.systemInstruction,
|
|
79328
|
+
cachedContent: (_a5 = modelParams === null || modelParams === void 0 ? void 0 : modelParams.cachedContent) === null || _a5 === void 0 ? void 0 : _a5.name,
|
|
79329
|
+
contents: []
|
|
79330
|
+
};
|
|
79331
|
+
const containsGenerateContentRequest = params.generateContentRequest != null;
|
|
79332
|
+
if (params.contents) {
|
|
79333
|
+
if (containsGenerateContentRequest) {
|
|
79334
|
+
throw new GoogleGenerativeAIRequestInputError("CountTokensRequest must have one of contents or generateContentRequest, not both.");
|
|
79335
|
+
}
|
|
79336
|
+
formattedGenerateContentRequest.contents = params.contents;
|
|
79337
|
+
} else if (containsGenerateContentRequest) {
|
|
79338
|
+
formattedGenerateContentRequest = Object.assign(Object.assign({}, formattedGenerateContentRequest), params.generateContentRequest);
|
|
79339
|
+
} else {
|
|
79340
|
+
const content = formatNewContent(params);
|
|
79341
|
+
formattedGenerateContentRequest.contents = [content];
|
|
79342
|
+
}
|
|
79343
|
+
return { generateContentRequest: formattedGenerateContentRequest };
|
|
79344
|
+
}
|
|
78930
79345
|
function formatGenerateContentInput(params) {
|
|
78931
79346
|
let formattedRequest;
|
|
78932
79347
|
if (params.contents) {
|
|
@@ -78951,12 +79366,14 @@ var VALID_PART_FIELDS = [
|
|
|
78951
79366
|
"text",
|
|
78952
79367
|
"inlineData",
|
|
78953
79368
|
"functionCall",
|
|
78954
|
-
"functionResponse"
|
|
79369
|
+
"functionResponse",
|
|
79370
|
+
"executableCode",
|
|
79371
|
+
"codeExecutionResult"
|
|
78955
79372
|
];
|
|
78956
79373
|
var VALID_PARTS_PER_ROLE = {
|
|
78957
79374
|
user: ["text", "inlineData"],
|
|
78958
79375
|
function: ["functionResponse"],
|
|
78959
|
-
model: ["text", "functionCall"],
|
|
79376
|
+
model: ["text", "functionCall", "executableCode", "codeExecutionResult"],
|
|
78960
79377
|
// System instructions shouldn't be in history anyway.
|
|
78961
79378
|
system: ["text"]
|
|
78962
79379
|
};
|
|
@@ -78981,7 +79398,9 @@ function validateChatHistory(history) {
|
|
|
78981
79398
|
inlineData: 0,
|
|
78982
79399
|
functionCall: 0,
|
|
78983
79400
|
functionResponse: 0,
|
|
78984
|
-
fileData: 0
|
|
79401
|
+
fileData: 0,
|
|
79402
|
+
executableCode: 0,
|
|
79403
|
+
codeExecutionResult: 0
|
|
78985
79404
|
};
|
|
78986
79405
|
for (const part of parts) {
|
|
78987
79406
|
for (const key of VALID_PART_FIELDS) {
|
|
@@ -78999,12 +79418,34 @@ function validateChatHistory(history) {
|
|
|
78999
79418
|
prevContent = true;
|
|
79000
79419
|
}
|
|
79001
79420
|
}
|
|
79421
|
+
function isValidResponse(response) {
|
|
79422
|
+
var _a5;
|
|
79423
|
+
if (response.candidates === void 0 || response.candidates.length === 0) {
|
|
79424
|
+
return false;
|
|
79425
|
+
}
|
|
79426
|
+
const content = (_a5 = response.candidates[0]) === null || _a5 === void 0 ? void 0 : _a5.content;
|
|
79427
|
+
if (content === void 0) {
|
|
79428
|
+
return false;
|
|
79429
|
+
}
|
|
79430
|
+
if (content.parts === void 0 || content.parts.length === 0) {
|
|
79431
|
+
return false;
|
|
79432
|
+
}
|
|
79433
|
+
for (const part of content.parts) {
|
|
79434
|
+
if (part === void 0 || Object.keys(part).length === 0) {
|
|
79435
|
+
return false;
|
|
79436
|
+
}
|
|
79437
|
+
if (part.text !== void 0 && part.text === "") {
|
|
79438
|
+
return false;
|
|
79439
|
+
}
|
|
79440
|
+
}
|
|
79441
|
+
return true;
|
|
79442
|
+
}
|
|
79002
79443
|
var SILENT_ERROR = "SILENT_ERROR";
|
|
79003
79444
|
var ChatSession = class {
|
|
79004
|
-
constructor(apiKey, model, params,
|
|
79445
|
+
constructor(apiKey, model, params, _requestOptions = {}) {
|
|
79005
79446
|
this.model = model;
|
|
79006
79447
|
this.params = params;
|
|
79007
|
-
this.
|
|
79448
|
+
this._requestOptions = _requestOptions;
|
|
79008
79449
|
this._history = [];
|
|
79009
79450
|
this._sendPromise = Promise.resolve();
|
|
79010
79451
|
this._apiKey = apiKey;
|
|
@@ -79024,10 +79465,14 @@ var ChatSession = class {
|
|
|
79024
79465
|
}
|
|
79025
79466
|
/**
|
|
79026
79467
|
* Sends a chat message and receives a non-streaming
|
|
79027
|
-
* {@link GenerateContentResult}
|
|
79468
|
+
* {@link GenerateContentResult}.
|
|
79469
|
+
*
|
|
79470
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79471
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79472
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79028
79473
|
*/
|
|
79029
|
-
async sendMessage(request3) {
|
|
79030
|
-
var _a5, _b2, _c2, _d2, _e2;
|
|
79474
|
+
async sendMessage(request3, requestOptions = {}) {
|
|
79475
|
+
var _a5, _b2, _c2, _d2, _e2, _f;
|
|
79031
79476
|
await this._sendPromise;
|
|
79032
79477
|
const newContent = formatNewContent(request3);
|
|
79033
79478
|
const generateContentRequest = {
|
|
@@ -79036,12 +79481,14 @@ var ChatSession = class {
|
|
|
79036
79481
|
tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools,
|
|
79037
79482
|
toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig,
|
|
79038
79483
|
systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction,
|
|
79484
|
+
cachedContent: (_f = this.params) === null || _f === void 0 ? void 0 : _f.cachedContent,
|
|
79039
79485
|
contents: [...this._history, newContent]
|
|
79040
79486
|
};
|
|
79487
|
+
const chatSessionRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79041
79488
|
let finalResult;
|
|
79042
|
-
this._sendPromise = this._sendPromise.then(() => generateContent(this._apiKey, this.model, generateContentRequest,
|
|
79489
|
+
this._sendPromise = this._sendPromise.then(() => generateContent(this._apiKey, this.model, generateContentRequest, chatSessionRequestOptions)).then((result) => {
|
|
79043
79490
|
var _a6;
|
|
79044
|
-
if (result.response
|
|
79491
|
+
if (isValidResponse(result.response)) {
|
|
79045
79492
|
this._history.push(newContent);
|
|
79046
79493
|
const responseContent = Object.assign({
|
|
79047
79494
|
parts: [],
|
|
@@ -79056,6 +79503,9 @@ var ChatSession = class {
|
|
|
79056
79503
|
}
|
|
79057
79504
|
}
|
|
79058
79505
|
finalResult = result;
|
|
79506
|
+
}).catch((e3) => {
|
|
79507
|
+
this._sendPromise = Promise.resolve();
|
|
79508
|
+
throw e3;
|
|
79059
79509
|
});
|
|
79060
79510
|
await this._sendPromise;
|
|
79061
79511
|
return finalResult;
|
|
@@ -79064,9 +79514,13 @@ var ChatSession = class {
|
|
|
79064
79514
|
* Sends a chat message and receives the response as a
|
|
79065
79515
|
* {@link GenerateContentStreamResult} containing an iterable stream
|
|
79066
79516
|
* and a response promise.
|
|
79517
|
+
*
|
|
79518
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79519
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79520
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79067
79521
|
*/
|
|
79068
|
-
async sendMessageStream(request3) {
|
|
79069
|
-
var _a5, _b2, _c2, _d2, _e2;
|
|
79522
|
+
async sendMessageStream(request3, requestOptions = {}) {
|
|
79523
|
+
var _a5, _b2, _c2, _d2, _e2, _f;
|
|
79070
79524
|
await this._sendPromise;
|
|
79071
79525
|
const newContent = formatNewContent(request3);
|
|
79072
79526
|
const generateContentRequest = {
|
|
@@ -79075,13 +79529,15 @@ var ChatSession = class {
|
|
|
79075
79529
|
tools: (_c2 = this.params) === null || _c2 === void 0 ? void 0 : _c2.tools,
|
|
79076
79530
|
toolConfig: (_d2 = this.params) === null || _d2 === void 0 ? void 0 : _d2.toolConfig,
|
|
79077
79531
|
systemInstruction: (_e2 = this.params) === null || _e2 === void 0 ? void 0 : _e2.systemInstruction,
|
|
79532
|
+
cachedContent: (_f = this.params) === null || _f === void 0 ? void 0 : _f.cachedContent,
|
|
79078
79533
|
contents: [...this._history, newContent]
|
|
79079
79534
|
};
|
|
79080
|
-
const
|
|
79535
|
+
const chatSessionRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79536
|
+
const streamPromise = generateContentStream(this._apiKey, this.model, generateContentRequest, chatSessionRequestOptions);
|
|
79081
79537
|
this._sendPromise = this._sendPromise.then(() => streamPromise).catch((_ignored) => {
|
|
79082
79538
|
throw new Error(SILENT_ERROR);
|
|
79083
79539
|
}).then((streamResult) => streamResult.response).then((response) => {
|
|
79084
|
-
if (response
|
|
79540
|
+
if (isValidResponse(response)) {
|
|
79085
79541
|
this._history.push(newContent);
|
|
79086
79542
|
const responseContent = Object.assign({}, response.candidates[0].content);
|
|
79087
79543
|
if (!responseContent.role) {
|
|
@@ -79102,24 +79558,25 @@ var ChatSession = class {
|
|
|
79102
79558
|
return streamPromise;
|
|
79103
79559
|
}
|
|
79104
79560
|
};
|
|
79105
|
-
async function countTokens(apiKey, model, params,
|
|
79106
|
-
const response = await
|
|
79561
|
+
async function countTokens(apiKey, model, params, singleRequestOptions) {
|
|
79562
|
+
const response = await makeModelRequest(model, Task.COUNT_TOKENS, apiKey, false, JSON.stringify(params), singleRequestOptions);
|
|
79107
79563
|
return response.json();
|
|
79108
79564
|
}
|
|
79109
79565
|
async function embedContent(apiKey, model, params, requestOptions) {
|
|
79110
|
-
const response = await
|
|
79566
|
+
const response = await makeModelRequest(model, Task.EMBED_CONTENT, apiKey, false, JSON.stringify(params), requestOptions);
|
|
79111
79567
|
return response.json();
|
|
79112
79568
|
}
|
|
79113
79569
|
async function batchEmbedContents(apiKey, model, params, requestOptions) {
|
|
79114
79570
|
const requestsWithModel = params.requests.map((request3) => {
|
|
79115
79571
|
return Object.assign(Object.assign({}, request3), { model });
|
|
79116
79572
|
});
|
|
79117
|
-
const response = await
|
|
79573
|
+
const response = await makeModelRequest(model, Task.BATCH_EMBED_CONTENTS, apiKey, false, JSON.stringify({ requests: requestsWithModel }), requestOptions);
|
|
79118
79574
|
return response.json();
|
|
79119
79575
|
}
|
|
79120
79576
|
var GenerativeModel = class {
|
|
79121
|
-
constructor(apiKey, modelParams,
|
|
79577
|
+
constructor(apiKey, modelParams, _requestOptions = {}) {
|
|
79122
79578
|
this.apiKey = apiKey;
|
|
79579
|
+
this._requestOptions = _requestOptions;
|
|
79123
79580
|
if (modelParams.model.includes("/")) {
|
|
79124
79581
|
this.model = modelParams.model;
|
|
79125
79582
|
} else {
|
|
@@ -79130,52 +79587,88 @@ var GenerativeModel = class {
|
|
|
79130
79587
|
this.tools = modelParams.tools;
|
|
79131
79588
|
this.toolConfig = modelParams.toolConfig;
|
|
79132
79589
|
this.systemInstruction = formatSystemInstruction(modelParams.systemInstruction);
|
|
79133
|
-
this.
|
|
79590
|
+
this.cachedContent = modelParams.cachedContent;
|
|
79134
79591
|
}
|
|
79135
79592
|
/**
|
|
79136
79593
|
* Makes a single non-streaming call to the model
|
|
79137
79594
|
* and returns an object containing a single {@link GenerateContentResponse}.
|
|
79595
|
+
*
|
|
79596
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79597
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79598
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79138
79599
|
*/
|
|
79139
|
-
async generateContent(request3) {
|
|
79600
|
+
async generateContent(request3, requestOptions = {}) {
|
|
79601
|
+
var _a5;
|
|
79140
79602
|
const formattedParams = formatGenerateContentInput(request3);
|
|
79141
|
-
|
|
79603
|
+
const generativeModelRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79604
|
+
return generateContent(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (_a5 = this.cachedContent) === null || _a5 === void 0 ? void 0 : _a5.name }, formattedParams), generativeModelRequestOptions);
|
|
79142
79605
|
}
|
|
79143
79606
|
/**
|
|
79144
|
-
* Makes a single streaming call to the model
|
|
79145
|
-
*
|
|
79146
|
-
*
|
|
79147
|
-
*
|
|
79607
|
+
* Makes a single streaming call to the model and returns an object
|
|
79608
|
+
* containing an iterable stream that iterates over all chunks in the
|
|
79609
|
+
* streaming response as well as a promise that returns the final
|
|
79610
|
+
* aggregated response.
|
|
79611
|
+
*
|
|
79612
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79613
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79614
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79148
79615
|
*/
|
|
79149
|
-
async generateContentStream(request3) {
|
|
79616
|
+
async generateContentStream(request3, requestOptions = {}) {
|
|
79617
|
+
var _a5;
|
|
79150
79618
|
const formattedParams = formatGenerateContentInput(request3);
|
|
79151
|
-
|
|
79619
|
+
const generativeModelRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79620
|
+
return generateContentStream(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (_a5 = this.cachedContent) === null || _a5 === void 0 ? void 0 : _a5.name }, formattedParams), generativeModelRequestOptions);
|
|
79152
79621
|
}
|
|
79153
79622
|
/**
|
|
79154
79623
|
* Gets a new {@link ChatSession} instance which can be used for
|
|
79155
79624
|
* multi-turn chats.
|
|
79156
79625
|
*/
|
|
79157
79626
|
startChat(startChatParams) {
|
|
79158
|
-
|
|
79627
|
+
var _a5;
|
|
79628
|
+
return new ChatSession(this.apiKey, this.model, Object.assign({ generationConfig: this.generationConfig, safetySettings: this.safetySettings, tools: this.tools, toolConfig: this.toolConfig, systemInstruction: this.systemInstruction, cachedContent: (_a5 = this.cachedContent) === null || _a5 === void 0 ? void 0 : _a5.name }, startChatParams), this._requestOptions);
|
|
79159
79629
|
}
|
|
79160
79630
|
/**
|
|
79161
79631
|
* Counts the tokens in the provided request.
|
|
79632
|
+
*
|
|
79633
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79634
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79635
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79162
79636
|
*/
|
|
79163
|
-
async countTokens(request3) {
|
|
79164
|
-
const formattedParams =
|
|
79165
|
-
|
|
79637
|
+
async countTokens(request3, requestOptions = {}) {
|
|
79638
|
+
const formattedParams = formatCountTokensInput(request3, {
|
|
79639
|
+
model: this.model,
|
|
79640
|
+
generationConfig: this.generationConfig,
|
|
79641
|
+
safetySettings: this.safetySettings,
|
|
79642
|
+
tools: this.tools,
|
|
79643
|
+
toolConfig: this.toolConfig,
|
|
79644
|
+
systemInstruction: this.systemInstruction,
|
|
79645
|
+
cachedContent: this.cachedContent
|
|
79646
|
+
});
|
|
79647
|
+
const generativeModelRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79648
|
+
return countTokens(this.apiKey, this.model, formattedParams, generativeModelRequestOptions);
|
|
79166
79649
|
}
|
|
79167
79650
|
/**
|
|
79168
79651
|
* Embeds the provided content.
|
|
79652
|
+
*
|
|
79653
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79654
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79655
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79169
79656
|
*/
|
|
79170
|
-
async embedContent(request3) {
|
|
79657
|
+
async embedContent(request3, requestOptions = {}) {
|
|
79171
79658
|
const formattedParams = formatEmbedContentInput(request3);
|
|
79172
|
-
|
|
79659
|
+
const generativeModelRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79660
|
+
return embedContent(this.apiKey, this.model, formattedParams, generativeModelRequestOptions);
|
|
79173
79661
|
}
|
|
79174
79662
|
/**
|
|
79175
79663
|
* Embeds an array of {@link EmbedContentRequest}s.
|
|
79664
|
+
*
|
|
79665
|
+
* Fields set in the optional {@link SingleRequestOptions} parameter will
|
|
79666
|
+
* take precedence over the {@link RequestOptions} values provided to
|
|
79667
|
+
* {@link GoogleGenerativeAI.getGenerativeModel }.
|
|
79176
79668
|
*/
|
|
79177
|
-
async batchEmbedContents(batchEmbedContentRequest) {
|
|
79178
|
-
|
|
79669
|
+
async batchEmbedContents(batchEmbedContentRequest, requestOptions = {}) {
|
|
79670
|
+
const generativeModelRequestOptions = Object.assign(Object.assign({}, this._requestOptions), requestOptions);
|
|
79671
|
+
return batchEmbedContents(this.apiKey, this.model, batchEmbedContentRequest, generativeModelRequestOptions);
|
|
79179
79672
|
}
|
|
79180
79673
|
};
|
|
79181
79674
|
var GoogleGenerativeAI = class {
|
|
@@ -79191,9 +79684,67 @@ var GoogleGenerativeAI = class {
|
|
|
79191
79684
|
}
|
|
79192
79685
|
return new GenerativeModel(this.apiKey, modelParams, requestOptions);
|
|
79193
79686
|
}
|
|
79687
|
+
/**
|
|
79688
|
+
* Creates a {@link GenerativeModel} instance from provided content cache.
|
|
79689
|
+
*/
|
|
79690
|
+
getGenerativeModelFromCachedContent(cachedContent, modelParams, requestOptions) {
|
|
79691
|
+
if (!cachedContent.name) {
|
|
79692
|
+
throw new GoogleGenerativeAIRequestInputError("Cached content must contain a `name` field.");
|
|
79693
|
+
}
|
|
79694
|
+
if (!cachedContent.model) {
|
|
79695
|
+
throw new GoogleGenerativeAIRequestInputError("Cached content must contain a `model` field.");
|
|
79696
|
+
}
|
|
79697
|
+
const disallowedDuplicates = ["model", "systemInstruction"];
|
|
79698
|
+
for (const key of disallowedDuplicates) {
|
|
79699
|
+
if ((modelParams === null || modelParams === void 0 ? void 0 : modelParams[key]) && cachedContent[key] && (modelParams === null || modelParams === void 0 ? void 0 : modelParams[key]) !== cachedContent[key]) {
|
|
79700
|
+
if (key === "model") {
|
|
79701
|
+
const modelParamsComp = modelParams.model.startsWith("models/") ? modelParams.model.replace("models/", "") : modelParams.model;
|
|
79702
|
+
const cachedContentComp = cachedContent.model.startsWith("models/") ? cachedContent.model.replace("models/", "") : cachedContent.model;
|
|
79703
|
+
if (modelParamsComp === cachedContentComp) {
|
|
79704
|
+
continue;
|
|
79705
|
+
}
|
|
79706
|
+
}
|
|
79707
|
+
throw new GoogleGenerativeAIRequestInputError(`Different value for "${key}" specified in modelParams (${modelParams[key]}) and cachedContent (${cachedContent[key]})`);
|
|
79708
|
+
}
|
|
79709
|
+
}
|
|
79710
|
+
const modelParamsFromCache = Object.assign(Object.assign({}, modelParams), { model: cachedContent.model, tools: cachedContent.tools, toolConfig: cachedContent.toolConfig, systemInstruction: cachedContent.systemInstruction, cachedContent });
|
|
79711
|
+
return new GenerativeModel(this.apiKey, modelParamsFromCache, requestOptions);
|
|
79712
|
+
}
|
|
79194
79713
|
};
|
|
79195
79714
|
|
|
79196
79715
|
// src/engine/gemini.ts
|
|
79716
|
+
var GEMINI_BLOCKING_FINISH_REASONS = /* @__PURE__ */ new Set([
|
|
79717
|
+
FinishReason.RECITATION,
|
|
79718
|
+
FinishReason.SAFETY,
|
|
79719
|
+
FinishReason.LANGUAGE
|
|
79720
|
+
]);
|
|
79721
|
+
var formatGeminiBlockMessage = (response) => {
|
|
79722
|
+
const promptFeedback = response.promptFeedback;
|
|
79723
|
+
if (promptFeedback?.blockReason) {
|
|
79724
|
+
return promptFeedback.blockReasonMessage ? `Gemini response was blocked due to ${promptFeedback.blockReason}: ${promptFeedback.blockReasonMessage}` : `Gemini response was blocked due to ${promptFeedback.blockReason}`;
|
|
79725
|
+
}
|
|
79726
|
+
const firstCandidate = response.candidates?.[0];
|
|
79727
|
+
if (firstCandidate?.finishReason) {
|
|
79728
|
+
return firstCandidate.finishMessage ? `Gemini response was blocked due to ${firstCandidate.finishReason}: ${firstCandidate.finishMessage}` : `Gemini response was blocked due to ${firstCandidate.finishReason}`;
|
|
79729
|
+
}
|
|
79730
|
+
return "Gemini response did not contain usable text";
|
|
79731
|
+
};
|
|
79732
|
+
var extractGeminiText = (response) => {
|
|
79733
|
+
const firstCandidate = response.candidates?.[0];
|
|
79734
|
+
if (firstCandidate?.finishReason && GEMINI_BLOCKING_FINISH_REASONS.has(firstCandidate.finishReason)) {
|
|
79735
|
+
throw new Error(formatGeminiBlockMessage(response));
|
|
79736
|
+
}
|
|
79737
|
+
const text = firstCandidate?.content?.parts?.flatMap(
|
|
79738
|
+
(part) => "text" in part && typeof part.text === "string" ? [part.text] : []
|
|
79739
|
+
).join("");
|
|
79740
|
+
if (typeof text === "string" && text.length > 0) {
|
|
79741
|
+
return text;
|
|
79742
|
+
}
|
|
79743
|
+
if (response.promptFeedback?.blockReason) {
|
|
79744
|
+
throw new Error(formatGeminiBlockMessage(response));
|
|
79745
|
+
}
|
|
79746
|
+
return "";
|
|
79747
|
+
};
|
|
79197
79748
|
var GeminiEngine = class {
|
|
79198
79749
|
constructor(config8) {
|
|
79199
79750
|
this.client = new GoogleGenerativeAI(config8.apiKey);
|
|
@@ -79243,7 +79794,7 @@ var GeminiEngine = class {
|
|
|
79243
79794
|
topP: 0.1
|
|
79244
79795
|
}
|
|
79245
79796
|
});
|
|
79246
|
-
const content = result.response
|
|
79797
|
+
const content = extractGeminiText(result.response);
|
|
79247
79798
|
return removeContentTags(content, "think");
|
|
79248
79799
|
} catch (error) {
|
|
79249
79800
|
throw normalizeEngineError(error, "gemini", this.config.model);
|
|
@@ -79881,7 +80432,7 @@ var _AbstractPage_client2;
|
|
|
79881
80432
|
async function defaultParseResponse2(props) {
|
|
79882
80433
|
const { response } = props;
|
|
79883
80434
|
if (props.options.stream) {
|
|
79884
|
-
|
|
80435
|
+
debug4("response", response.status, response.url, response.headers, response.body);
|
|
79885
80436
|
if (props.options.__streamClass) {
|
|
79886
80437
|
return props.options.__streamClass.fromSSEResponse(response, props.controller);
|
|
79887
80438
|
}
|
|
@@ -79897,11 +80448,11 @@ async function defaultParseResponse2(props) {
|
|
|
79897
80448
|
const isJSON = contentType?.includes("application/json") || contentType?.includes("application/vnd.api+json");
|
|
79898
80449
|
if (isJSON) {
|
|
79899
80450
|
const json = await response.json();
|
|
79900
|
-
|
|
80451
|
+
debug4("response", response.status, response.url, response.headers, json);
|
|
79901
80452
|
return json;
|
|
79902
80453
|
}
|
|
79903
80454
|
const text = await response.text();
|
|
79904
|
-
|
|
80455
|
+
debug4("response", response.status, response.url, response.headers, text);
|
|
79905
80456
|
return text;
|
|
79906
80457
|
}
|
|
79907
80458
|
var APIPromise2 = class _APIPromise extends Promise {
|
|
@@ -80120,7 +80671,7 @@ var APIClient2 = class {
|
|
|
80120
80671
|
await this.prepareOptions(options);
|
|
80121
80672
|
const { req, url: url2, timeout } = this.buildRequest(options);
|
|
80122
80673
|
await this.prepareRequest(req, { url: url2, options });
|
|
80123
|
-
|
|
80674
|
+
debug4("request", url2, options, req.headers);
|
|
80124
80675
|
if (options.signal?.aborted) {
|
|
80125
80676
|
throw new APIUserAbortError3();
|
|
80126
80677
|
}
|
|
@@ -80142,14 +80693,14 @@ var APIClient2 = class {
|
|
|
80142
80693
|
if (!response.ok) {
|
|
80143
80694
|
if (retriesRemaining && this.shouldRetry(response)) {
|
|
80144
80695
|
const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`;
|
|
80145
|
-
|
|
80696
|
+
debug4(`response (error; ${retryMessage2})`, response.status, url2, responseHeaders);
|
|
80146
80697
|
return this.retryRequest(options, retriesRemaining, responseHeaders);
|
|
80147
80698
|
}
|
|
80148
80699
|
const errText = await response.text().catch((e3) => castToError2(e3).message);
|
|
80149
80700
|
const errJSON = safeJSON2(errText);
|
|
80150
80701
|
const errMessage = errJSON ? void 0 : errText;
|
|
80151
80702
|
const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`;
|
|
80152
|
-
|
|
80703
|
+
debug4(`response (error; ${retryMessage})`, response.status, url2, responseHeaders, errMessage);
|
|
80153
80704
|
const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders);
|
|
80154
80705
|
throw err;
|
|
80155
80706
|
}
|
|
@@ -80513,7 +81064,7 @@ function applyHeadersMut2(targetHeaders, newHeaders) {
|
|
|
80513
81064
|
}
|
|
80514
81065
|
}
|
|
80515
81066
|
}
|
|
80516
|
-
function
|
|
81067
|
+
function debug4(action, ...args) {
|
|
80517
81068
|
if (typeof process !== "undefined" && process?.env?.["DEBUG"] === "true") {
|
|
80518
81069
|
console.log(`OpenAI:DEBUG:${action}`, ...args);
|
|
80519
81070
|
}
|
|
@@ -83990,9 +84541,6 @@ var { OpenAIError: OpenAIError2, APIError: APIError4, APIConnectionError: APICon
|
|
|
83990
84541
|
OpenAI2.Uploads = Uploads;
|
|
83991
84542
|
})(OpenAI || (OpenAI = {}));
|
|
83992
84543
|
|
|
83993
|
-
// src/engine/openAi.ts
|
|
83994
|
-
var import_https_proxy_agent3 = __toESM(require_dist2(), 1);
|
|
83995
|
-
|
|
83996
84544
|
// src/utils/customHeaders.ts
|
|
83997
84545
|
function parseCustomHeaders(headers) {
|
|
83998
84546
|
let parsedHeaders = {};
|
|
@@ -84050,7 +84598,7 @@ var OpenAiEngine = class {
|
|
|
84050
84598
|
}
|
|
84051
84599
|
const proxy = config8.proxy;
|
|
84052
84600
|
if (proxy) {
|
|
84053
|
-
clientOptions.httpAgent = new
|
|
84601
|
+
clientOptions.httpAgent = new HttpsProxyAgent(proxy);
|
|
84054
84602
|
}
|
|
84055
84603
|
if (config8.customHeaders) {
|
|
84056
84604
|
const headers = parseCustomHeaders(config8.customHeaders);
|
|
@@ -84231,7 +84779,6 @@ var OpenRouterEngine = class {
|
|
|
84231
84779
|
};
|
|
84232
84780
|
|
|
84233
84781
|
// src/utils/proxy.ts
|
|
84234
|
-
var import_https_proxy_agent4 = __toESM(require_dist2(), 1);
|
|
84235
84782
|
var import_undici = __toESM(require_undici(), 1);
|
|
84236
84783
|
function resolveProxy(proxySetting) {
|
|
84237
84784
|
if (proxySetting === null) {
|
|
@@ -84260,7 +84807,7 @@ function setupProxy(proxySetting) {
|
|
|
84260
84807
|
}
|
|
84261
84808
|
const dispatcher = new import_undici.ProxyAgent(proxySetting);
|
|
84262
84809
|
(0, import_undici.setGlobalDispatcher)(dispatcher);
|
|
84263
|
-
const agent = new
|
|
84810
|
+
const agent = new HttpsProxyAgent(proxySetting);
|
|
84264
84811
|
axios_default.defaults.httpAgent = agent;
|
|
84265
84812
|
axios_default.defaults.httpsAgent = agent;
|
|
84266
84813
|
axios_default.defaults.proxy = false;
|