@ivotoby/openapi-mcp-server 1.12.2 → 1.12.4

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.
Files changed (3) hide show
  1. package/dist/bundle.js +706 -327
  2. package/dist/cli.js +706 -327
  3. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -9976,6 +9976,7 @@ var require_es_set_tostringtag = __commonJS({
9976
9976
  // node_modules/form-data/lib/populate.js
9977
9977
  var require_populate = __commonJS({
9978
9978
  "node_modules/form-data/lib/populate.js"(exports, module) {
9979
+ "use strict";
9979
9980
  module.exports = function(dst, src) {
9980
9981
  Object.keys(src).forEach(function(prop) {
9981
9982
  dst[prop] = dst[prop] || src[prop];
@@ -9988,20 +9989,21 @@ var require_populate = __commonJS({
9988
9989
  // node_modules/form-data/lib/form_data.js
9989
9990
  var require_form_data = __commonJS({
9990
9991
  "node_modules/form-data/lib/form_data.js"(exports, module) {
9992
+ "use strict";
9991
9993
  var CombinedStream = require_combined_stream();
9992
9994
  var util3 = __require("util");
9993
9995
  var path2 = __require("path");
9994
- var http3 = __require("http");
9996
+ var http4 = __require("http");
9995
9997
  var https2 = __require("https");
9996
9998
  var parseUrl = __require("url").parse;
9997
9999
  var fs2 = __require("fs");
9998
10000
  var Stream = __require("stream").Stream;
10001
+ var crypto3 = __require("crypto");
9999
10002
  var mime = require_mime_types();
10000
10003
  var asynckit = require_asynckit();
10001
10004
  var setToStringTag = require_es_set_tostringtag();
10005
+ var hasOwn = require_hasown();
10002
10006
  var populate = require_populate();
10003
- module.exports = FormData3;
10004
- util3.inherits(FormData3, CombinedStream);
10005
10007
  function FormData3(options) {
10006
10008
  if (!(this instanceof FormData3)) {
10007
10009
  return new FormData3(options);
@@ -10015,16 +10017,17 @@ var require_form_data = __commonJS({
10015
10017
  this[option] = options[option];
10016
10018
  }
10017
10019
  }
10020
+ util3.inherits(FormData3, CombinedStream);
10018
10021
  FormData3.LINE_BREAK = "\r\n";
10019
10022
  FormData3.DEFAULT_CONTENT_TYPE = "application/octet-stream";
10020
10023
  FormData3.prototype.append = function(field, value, options) {
10021
10024
  options = options || {};
10022
- if (typeof options == "string") {
10025
+ if (typeof options === "string") {
10023
10026
  options = { filename: options };
10024
10027
  }
10025
10028
  var append2 = CombinedStream.prototype.append.bind(this);
10026
- if (typeof value == "number") {
10027
- value = "" + value;
10029
+ if (typeof value === "number" || value == null) {
10030
+ value = String(value);
10028
10031
  }
10029
10032
  if (Array.isArray(value)) {
10030
10033
  this._error(new Error("Arrays are not supported."));
@@ -10040,7 +10043,7 @@ var require_form_data = __commonJS({
10040
10043
  FormData3.prototype._trackLength = function(header, value, options) {
10041
10044
  var valueLength = 0;
10042
10045
  if (options.knownLength != null) {
10043
- valueLength += +options.knownLength;
10046
+ valueLength += Number(options.knownLength);
10044
10047
  } else if (Buffer.isBuffer(value)) {
10045
10048
  valueLength = value.length;
10046
10049
  } else if (typeof value === "string") {
@@ -10048,7 +10051,7 @@ var require_form_data = __commonJS({
10048
10051
  }
10049
10052
  this._valueLength += valueLength;
10050
10053
  this._overheadLength += Buffer.byteLength(header) + FormData3.LINE_BREAK.length;
10051
- if (!value || !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) && !(value instanceof Stream)) {
10054
+ if (!value || !value.path && !(value.readable && hasOwn(value, "httpVersion")) && !(value instanceof Stream)) {
10052
10055
  return;
10053
10056
  }
10054
10057
  if (!options.knownLength) {
@@ -10056,26 +10059,25 @@ var require_form_data = __commonJS({
10056
10059
  }
10057
10060
  };
10058
10061
  FormData3.prototype._lengthRetriever = function(value, callback) {
10059
- if (Object.prototype.hasOwnProperty.call(value, "fd")) {
10062
+ if (hasOwn(value, "fd")) {
10060
10063
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
10061
10064
  callback(null, value.end + 1 - (value.start ? value.start : 0));
10062
10065
  } else {
10063
10066
  fs2.stat(value.path, function(err, stat) {
10064
- var fileSize;
10065
10067
  if (err) {
10066
10068
  callback(err);
10067
10069
  return;
10068
10070
  }
10069
- fileSize = stat.size - (value.start ? value.start : 0);
10071
+ var fileSize = stat.size - (value.start ? value.start : 0);
10070
10072
  callback(null, fileSize);
10071
10073
  });
10072
10074
  }
10073
- } else if (Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
10074
- callback(null, +value.headers["content-length"]);
10075
- } else if (Object.prototype.hasOwnProperty.call(value, "httpModule")) {
10075
+ } else if (hasOwn(value, "httpVersion")) {
10076
+ callback(null, Number(value.headers["content-length"]));
10077
+ } else if (hasOwn(value, "httpModule")) {
10076
10078
  value.on("response", function(response) {
10077
10079
  value.pause();
10078
- callback(null, +response.headers["content-length"]);
10080
+ callback(null, Number(response.headers["content-length"]));
10079
10081
  });
10080
10082
  value.resume();
10081
10083
  } else {
@@ -10083,7 +10085,7 @@ var require_form_data = __commonJS({
10083
10085
  }
10084
10086
  };
10085
10087
  FormData3.prototype._multiPartHeader = function(field, value, options) {
10086
- if (typeof options.header == "string") {
10088
+ if (typeof options.header === "string") {
10087
10089
  return options.header;
10088
10090
  }
10089
10091
  var contentDisposition = this._getContentDisposition(value, options);
@@ -10095,12 +10097,12 @@ var require_form_data = __commonJS({
10095
10097
  // if no content type. allow it to be empty array
10096
10098
  "Content-Type": [].concat(contentType || [])
10097
10099
  };
10098
- if (typeof options.header == "object") {
10100
+ if (typeof options.header === "object") {
10099
10101
  populate(headers, options.header);
10100
10102
  }
10101
10103
  var header;
10102
10104
  for (var prop in headers) {
10103
- if (Object.prototype.hasOwnProperty.call(headers, prop)) {
10105
+ if (hasOwn(headers, prop)) {
10104
10106
  header = headers[prop];
10105
10107
  if (header == null) {
10106
10108
  continue;
@@ -10116,34 +10118,33 @@ var require_form_data = __commonJS({
10116
10118
  return "--" + this.getBoundary() + FormData3.LINE_BREAK + contents + FormData3.LINE_BREAK;
10117
10119
  };
10118
10120
  FormData3.prototype._getContentDisposition = function(value, options) {
10119
- var filename, contentDisposition;
10121
+ var filename;
10120
10122
  if (typeof options.filepath === "string") {
10121
10123
  filename = path2.normalize(options.filepath).replace(/\\/g, "/");
10122
- } else if (options.filename || value.name || value.path) {
10123
- filename = path2.basename(options.filename || value.name || value.path);
10124
- } else if (value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
10124
+ } else if (options.filename || value && (value.name || value.path)) {
10125
+ filename = path2.basename(options.filename || value && (value.name || value.path));
10126
+ } else if (value && value.readable && hasOwn(value, "httpVersion")) {
10125
10127
  filename = path2.basename(value.client._httpMessage.path || "");
10126
10128
  }
10127
10129
  if (filename) {
10128
- contentDisposition = 'filename="' + filename + '"';
10130
+ return 'filename="' + filename + '"';
10129
10131
  }
10130
- return contentDisposition;
10131
10132
  };
10132
10133
  FormData3.prototype._getContentType = function(value, options) {
10133
10134
  var contentType = options.contentType;
10134
- if (!contentType && value.name) {
10135
+ if (!contentType && value && value.name) {
10135
10136
  contentType = mime.lookup(value.name);
10136
10137
  }
10137
- if (!contentType && value.path) {
10138
+ if (!contentType && value && value.path) {
10138
10139
  contentType = mime.lookup(value.path);
10139
10140
  }
10140
- if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, "httpVersion")) {
10141
+ if (!contentType && value && value.readable && hasOwn(value, "httpVersion")) {
10141
10142
  contentType = value.headers["content-type"];
10142
10143
  }
10143
10144
  if (!contentType && (options.filepath || options.filename)) {
10144
10145
  contentType = mime.lookup(options.filepath || options.filename);
10145
10146
  }
10146
- if (!contentType && typeof value == "object") {
10147
+ if (!contentType && value && typeof value === "object") {
10147
10148
  contentType = FormData3.DEFAULT_CONTENT_TYPE;
10148
10149
  }
10149
10150
  return contentType;
@@ -10167,13 +10168,16 @@ var require_form_data = __commonJS({
10167
10168
  "content-type": "multipart/form-data; boundary=" + this.getBoundary()
10168
10169
  };
10169
10170
  for (header in userHeaders) {
10170
- if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
10171
+ if (hasOwn(userHeaders, header)) {
10171
10172
  formHeaders[header.toLowerCase()] = userHeaders[header];
10172
10173
  }
10173
10174
  }
10174
10175
  return formHeaders;
10175
10176
  };
10176
10177
  FormData3.prototype.setBoundary = function(boundary) {
10178
+ if (typeof boundary !== "string") {
10179
+ throw new TypeError("FormData boundary must be a string");
10180
+ }
10177
10181
  this._boundary = boundary;
10178
10182
  };
10179
10183
  FormData3.prototype.getBoundary = function() {
@@ -10200,11 +10204,7 @@ var require_form_data = __commonJS({
10200
10204
  return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
10201
10205
  };
10202
10206
  FormData3.prototype._generateBoundary = function() {
10203
- var boundary = "--------------------------";
10204
- for (var i = 0; i < 24; i++) {
10205
- boundary += Math.floor(Math.random() * 10).toString(16);
10206
- }
10207
- this._boundary = boundary;
10207
+ this._boundary = "--------------------------" + crypto3.randomBytes(12).toString("hex");
10208
10208
  };
10209
10209
  FormData3.prototype.getLengthSync = function() {
10210
10210
  var knownLength = this._overheadLength + this._valueLength;
@@ -10244,8 +10244,10 @@ var require_form_data = __commonJS({
10244
10244
  });
10245
10245
  };
10246
10246
  FormData3.prototype.submit = function(params, cb) {
10247
- var request, options, defaults2 = { method: "post" };
10248
- if (typeof params == "string") {
10247
+ var request;
10248
+ var options;
10249
+ var defaults2 = { method: "post" };
10250
+ if (typeof params === "string") {
10249
10251
  params = parseUrl(params);
10250
10252
  options = populate({
10251
10253
  port: params.port,
@@ -10256,14 +10258,14 @@ var require_form_data = __commonJS({
10256
10258
  } else {
10257
10259
  options = populate(params, defaults2);
10258
10260
  if (!options.port) {
10259
- options.port = options.protocol == "https:" ? 443 : 80;
10261
+ options.port = options.protocol === "https:" ? 443 : 80;
10260
10262
  }
10261
10263
  }
10262
10264
  options.headers = this.getHeaders(params.headers);
10263
- if (options.protocol == "https:") {
10265
+ if (options.protocol === "https:") {
10264
10266
  request = https2.request(options);
10265
10267
  } else {
10266
- request = http3.request(options);
10268
+ request = http4.request(options);
10267
10269
  }
10268
10270
  this.getLength(function(err, length) {
10269
10271
  if (err && err !== "Unknown stream") {
@@ -10298,7 +10300,8 @@ var require_form_data = __commonJS({
10298
10300
  FormData3.prototype.toString = function() {
10299
10301
  return "[object FormData]";
10300
10302
  };
10301
- setToStringTag(FormData3, "FormData");
10303
+ setToStringTag(FormData3.prototype, "FormData");
10304
+ module.exports = FormData3;
10302
10305
  }
10303
10306
  });
10304
10307
 
@@ -11160,7 +11163,7 @@ var require_follow_redirects = __commonJS({
11160
11163
  "node_modules/follow-redirects/index.js"(exports, module) {
11161
11164
  var url2 = __require("url");
11162
11165
  var URL2 = url2.URL;
11163
- var http3 = __require("http");
11166
+ var http4 = __require("http");
11164
11167
  var https2 = __require("https");
11165
11168
  var Writable = __require("stream").Writable;
11166
11169
  var assert = __require("assert");
@@ -11168,7 +11171,7 @@ var require_follow_redirects = __commonJS({
11168
11171
  (function detectUnsupportedEnvironment() {
11169
11172
  var looksLikeNode = typeof process !== "undefined";
11170
11173
  var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined";
11171
- var looksLikeV8 = isFunction3(Error.captureStackTrace);
11174
+ var looksLikeV8 = isFunction4(Error.captureStackTrace);
11172
11175
  if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) {
11173
11176
  console.warn("The follow-redirects package should be excluded from browser builds.");
11174
11177
  }
@@ -11263,7 +11266,7 @@ var require_follow_redirects = __commonJS({
11263
11266
  if (!isString2(data) && !isBuffer2(data)) {
11264
11267
  throw new TypeError("data should be a string, Buffer or Uint8Array");
11265
11268
  }
11266
- if (isFunction3(encoding)) {
11269
+ if (isFunction4(encoding)) {
11267
11270
  callback = encoding;
11268
11271
  encoding = null;
11269
11272
  }
@@ -11283,10 +11286,10 @@ var require_follow_redirects = __commonJS({
11283
11286
  }
11284
11287
  };
11285
11288
  RedirectableRequest.prototype.end = function(data, encoding, callback) {
11286
- if (isFunction3(data)) {
11289
+ if (isFunction4(data)) {
11287
11290
  callback = data;
11288
11291
  data = encoding = null;
11289
- } else if (isFunction3(encoding)) {
11292
+ } else if (isFunction4(encoding)) {
11290
11293
  callback = encoding;
11291
11294
  encoding = null;
11292
11295
  }
@@ -11487,7 +11490,7 @@ var require_follow_redirects = __commonJS({
11487
11490
  if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
11488
11491
  removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
11489
11492
  }
11490
- if (isFunction3(beforeRedirect)) {
11493
+ if (isFunction4(beforeRedirect)) {
11491
11494
  var responseDetails = {
11492
11495
  headers: response.headers,
11493
11496
  statusCode
@@ -11522,7 +11525,7 @@ var require_follow_redirects = __commonJS({
11522
11525
  options = validateUrl(input);
11523
11526
  input = { protocol };
11524
11527
  }
11525
- if (isFunction3(options)) {
11528
+ if (isFunction4(options)) {
11526
11529
  callback = options;
11527
11530
  options = null;
11528
11531
  }
@@ -11602,7 +11605,7 @@ var require_follow_redirects = __commonJS({
11602
11605
  }
11603
11606
  function createErrorType(code, message, baseClass) {
11604
11607
  function CustomError(properties) {
11605
- if (isFunction3(Error.captureStackTrace)) {
11608
+ if (isFunction4(Error.captureStackTrace)) {
11606
11609
  Error.captureStackTrace(this, this.constructor);
11607
11610
  }
11608
11611
  Object.assign(this, properties || {});
@@ -11637,7 +11640,7 @@ var require_follow_redirects = __commonJS({
11637
11640
  function isString2(value) {
11638
11641
  return typeof value === "string" || value instanceof String;
11639
11642
  }
11640
- function isFunction3(value) {
11643
+ function isFunction4(value) {
11641
11644
  return typeof value === "function";
11642
11645
  }
11643
11646
  function isBuffer2(value) {
@@ -11646,7 +11649,7 @@ var require_follow_redirects = __commonJS({
11646
11649
  function isURL(value) {
11647
11650
  return URL2 && value instanceof URL2;
11648
11651
  }
11649
- module.exports = wrap2({ http: http3, https: https2 });
11652
+ module.exports = wrap2({ http: http4, https: https2 });
11650
11653
  module.exports.wrap = wrap2;
11651
11654
  }
11652
11655
  });
@@ -12532,6 +12535,18 @@ function charFromCodepoint(c) {
12532
12535
  (c - 65536 & 1023) + 56320
12533
12536
  );
12534
12537
  }
12538
+ function setProperty(object, key, value) {
12539
+ if (key === "__proto__") {
12540
+ Object.defineProperty(object, key, {
12541
+ configurable: true,
12542
+ enumerable: true,
12543
+ writable: true,
12544
+ value
12545
+ });
12546
+ } else {
12547
+ object[key] = value;
12548
+ }
12549
+ }
12535
12550
  var simpleEscapeCheck = new Array(256);
12536
12551
  var simpleEscapeMap = new Array(256);
12537
12552
  for (i = 0; i < 256; i++) {
@@ -12651,7 +12666,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
12651
12666
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
12652
12667
  key = sourceKeys[index];
12653
12668
  if (!_hasOwnProperty$1.call(destination, key)) {
12654
- destination[key] = source[key];
12669
+ setProperty(destination, key, source[key]);
12655
12670
  overridableKeys[key] = true;
12656
12671
  }
12657
12672
  }
@@ -12691,16 +12706,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
12691
12706
  state.position = startPos || state.position;
12692
12707
  throwError(state, "duplicated mapping key");
12693
12708
  }
12694
- if (keyNode === "__proto__") {
12695
- Object.defineProperty(_result, keyNode, {
12696
- configurable: true,
12697
- enumerable: true,
12698
- writable: true,
12699
- value: valueNode
12700
- });
12701
- } else {
12702
- _result[keyNode] = valueNode;
12703
- }
12709
+ setProperty(_result, keyNode, valueNode);
12704
12710
  delete overridableKeys[keyNode];
12705
12711
  }
12706
12712
  return _result;
@@ -14288,7 +14294,6 @@ var jsYaml = {
14288
14294
  safeLoadAll,
14289
14295
  safeDump
14290
14296
  };
14291
- var js_yaml_default = jsYaml;
14292
14297
 
14293
14298
  // src/openapi-loader.ts
14294
14299
  import crypto from "crypto";
@@ -14493,7 +14498,9 @@ var OpenAPISpecLoader = class {
14493
14498
  return JSON.parse(specContent);
14494
14499
  } catch (jsonError) {
14495
14500
  try {
14496
- const yamlResult = js_yaml_default.load(specContent);
14501
+ const yamlResult = jsYaml.load(specContent, {
14502
+ schema: CORE_SCHEMA
14503
+ });
14497
14504
  if (!yamlResult || typeof yamlResult !== "object") {
14498
14505
  throw new Error("YAML parsing resulted in invalid object");
14499
14506
  }
@@ -14719,7 +14726,7 @@ var OpenAPISpecLoader = class {
14719
14726
  const name = this.abbreviateOperationId(nameSource);
14720
14727
  const tool = {
14721
14728
  name,
14722
- description: op.description || `Make a ${method.toUpperCase()} request to ${path2}`,
14729
+ description: op.description || op.summary || `Make a ${method.toUpperCase()} request to ${path2}`,
14723
14730
  inputSchema: {
14724
14731
  type: "object",
14725
14732
  properties: {}
@@ -15247,6 +15254,16 @@ var isPlainObject = (val) => {
15247
15254
  const prototype3 = getPrototypeOf(val);
15248
15255
  return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(toStringTag in val) && !(iterator in val);
15249
15256
  };
15257
+ var isEmptyObject = (val) => {
15258
+ if (!isObject2(val) || isBuffer(val)) {
15259
+ return false;
15260
+ }
15261
+ try {
15262
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
15263
+ } catch (e) {
15264
+ return false;
15265
+ }
15266
+ };
15250
15267
  var isDate = kindOfTest("Date");
15251
15268
  var isFile = kindOfTest("File");
15252
15269
  var isBlob = kindOfTest("Blob");
@@ -15274,6 +15291,9 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
15274
15291
  fn.call(null, obj[i], i, obj);
15275
15292
  }
15276
15293
  } else {
15294
+ if (isBuffer(obj)) {
15295
+ return;
15296
+ }
15277
15297
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
15278
15298
  const len = keys.length;
15279
15299
  let key;
@@ -15284,6 +15304,9 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
15284
15304
  }
15285
15305
  }
15286
15306
  function findKey(obj, key) {
15307
+ if (isBuffer(obj)) {
15308
+ return null;
15309
+ }
15287
15310
  key = key.toLowerCase();
15288
15311
  const keys = Object.keys(obj);
15289
15312
  let i = keys.length;
@@ -15302,7 +15325,7 @@ var _global = (() => {
15302
15325
  })();
15303
15326
  var isContextDefined = (context) => !isUndefined(context) && context !== _global;
15304
15327
  function merge2() {
15305
- const { caseless } = isContextDefined(this) && this || {};
15328
+ const { caseless, skipUndefined } = isContextDefined(this) && this || {};
15306
15329
  const result = {};
15307
15330
  const assignValue = (val, key) => {
15308
15331
  const targetKey = caseless && findKey(result, key) || key;
@@ -15312,7 +15335,7 @@ function merge2() {
15312
15335
  result[targetKey] = merge2({}, val);
15313
15336
  } else if (isArray(val)) {
15314
15337
  result[targetKey] = val.slice();
15315
- } else {
15338
+ } else if (!skipUndefined || !isUndefined(val)) {
15316
15339
  result[targetKey] = val;
15317
15340
  }
15318
15341
  };
@@ -15474,6 +15497,9 @@ var toJSONObject = (obj) => {
15474
15497
  if (stack.indexOf(source) >= 0) {
15475
15498
  return;
15476
15499
  }
15500
+ if (isBuffer(source)) {
15501
+ return source;
15502
+ }
15477
15503
  if (!("toJSON" in source)) {
15478
15504
  stack[i] = source;
15479
15505
  const target = isArray(source) ? [] : {};
@@ -15523,6 +15549,7 @@ var utils_default = {
15523
15549
  isBoolean: isBoolean2,
15524
15550
  isObject: isObject2,
15525
15551
  isPlainObject,
15552
+ isEmptyObject,
15526
15553
  isReadableStream,
15527
15554
  isRequest,
15528
15555
  isResponse,
@@ -15639,9 +15666,13 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
15639
15666
  }, (prop) => {
15640
15667
  return prop !== "isAxiosError";
15641
15668
  });
15642
- AxiosError.call(axiosError, error.message, code, config, request, response);
15643
- axiosError.cause = error;
15644
- axiosError.name = error.name;
15669
+ const msg = error && error.message ? error.message : "Error";
15670
+ const errCode = code == null && error ? error.code : code;
15671
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
15672
+ if (error && axiosError.cause == null) {
15673
+ Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
15674
+ }
15675
+ axiosError.name = error && error.name || "Error";
15645
15676
  customProps && Object.assign(axiosError, customProps);
15646
15677
  return axiosError;
15647
15678
  };
@@ -15801,7 +15832,7 @@ var AxiosURLSearchParams_default = AxiosURLSearchParams;
15801
15832
 
15802
15833
  // node_modules/axios/lib/helpers/buildURL.js
15803
15834
  function encode2(val) {
15804
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
15835
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
15805
15836
  }
15806
15837
  function buildURL(url2, params, options) {
15807
15838
  if (!params) {
@@ -15857,7 +15888,7 @@ var InterceptorManager = class {
15857
15888
  *
15858
15889
  * @param {Number} id The ID that was returned by `use`
15859
15890
  *
15860
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
15891
+ * @returns {void}
15861
15892
  */
15862
15893
  eject(id) {
15863
15894
  if (this.handlers[id]) {
@@ -15964,15 +15995,16 @@ var platform_default = {
15964
15995
 
15965
15996
  // node_modules/axios/lib/helpers/toURLEncodedForm.js
15966
15997
  function toURLEncodedForm(data, options) {
15967
- return toFormData_default(data, new platform_default.classes.URLSearchParams(), Object.assign({
15998
+ return toFormData_default(data, new platform_default.classes.URLSearchParams(), {
15968
15999
  visitor: function(value, key, path2, helpers) {
15969
16000
  if (platform_default.isNode && utils_default.isBuffer(value)) {
15970
16001
  this.append(key, value.toString("base64"));
15971
16002
  return false;
15972
16003
  }
15973
16004
  return helpers.defaultVisitor.apply(this, arguments);
15974
- }
15975
- }, options));
16005
+ },
16006
+ ...options
16007
+ });
15976
16008
  }
15977
16009
 
15978
16010
  // node_modules/axios/lib/helpers/formDataToJSON.js
@@ -16097,7 +16129,7 @@ var defaults = {
16097
16129
  const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
16098
16130
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
16099
16131
  try {
16100
- return JSON.parse(data);
16132
+ return JSON.parse(data, this.parseReviver);
16101
16133
  } catch (e) {
16102
16134
  if (strictJSONParsing) {
16103
16135
  if (e.name === "SyntaxError") {
@@ -16479,11 +16511,12 @@ var import_proxy_from_env = __toESM(require_proxy_from_env(), 1);
16479
16511
  var import_follow_redirects = __toESM(require_follow_redirects(), 1);
16480
16512
  import http from "http";
16481
16513
  import https from "https";
16514
+ import http2 from "http2";
16482
16515
  import util2 from "util";
16483
16516
  import zlib from "zlib";
16484
16517
 
16485
16518
  // node_modules/axios/lib/env/data.js
16486
- var VERSION = "1.10.0";
16519
+ var VERSION = "1.13.2";
16487
16520
 
16488
16521
  // node_modules/axios/lib/helpers/parseProtocol.js
16489
16522
  function parseProtocol(url2) {
@@ -16825,7 +16858,7 @@ function throttle(fn, freq) {
16825
16858
  clearTimeout(timer);
16826
16859
  timer = null;
16827
16860
  }
16828
- fn.apply(null, args);
16861
+ fn(...args);
16829
16862
  };
16830
16863
  const throttled = (...args) => {
16831
16864
  const now = Date.now();
@@ -16882,6 +16915,57 @@ var progressEventDecorator = (total, throttled) => {
16882
16915
  };
16883
16916
  var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
16884
16917
 
16918
+ // node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js
16919
+ function estimateDataURLDecodedBytes(url2) {
16920
+ if (!url2 || typeof url2 !== "string") return 0;
16921
+ if (!url2.startsWith("data:")) return 0;
16922
+ const comma = url2.indexOf(",");
16923
+ if (comma < 0) return 0;
16924
+ const meta = url2.slice(5, comma);
16925
+ const body = url2.slice(comma + 1);
16926
+ const isBase64 = /;base64/i.test(meta);
16927
+ if (isBase64) {
16928
+ let effectiveLen = body.length;
16929
+ const len = body.length;
16930
+ for (let i = 0; i < len; i++) {
16931
+ if (body.charCodeAt(i) === 37 && i + 2 < len) {
16932
+ const a = body.charCodeAt(i + 1);
16933
+ const b = body.charCodeAt(i + 2);
16934
+ const isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
16935
+ if (isHex) {
16936
+ effectiveLen -= 2;
16937
+ i += 2;
16938
+ }
16939
+ }
16940
+ }
16941
+ let pad = 0;
16942
+ let idx = len - 1;
16943
+ const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
16944
+ body.charCodeAt(j - 1) === 51 && // '3'
16945
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
16946
+ if (idx >= 0) {
16947
+ if (body.charCodeAt(idx) === 61) {
16948
+ pad++;
16949
+ idx--;
16950
+ } else if (tailIsPct3D(idx)) {
16951
+ pad++;
16952
+ idx -= 3;
16953
+ }
16954
+ }
16955
+ if (pad === 1 && idx >= 0) {
16956
+ if (body.charCodeAt(idx) === 61) {
16957
+ pad++;
16958
+ } else if (tailIsPct3D(idx)) {
16959
+ pad++;
16960
+ }
16961
+ }
16962
+ const groups = Math.floor(effectiveLen / 4);
16963
+ const bytes = groups * 3 - (pad || 0);
16964
+ return bytes > 0 ? bytes : 0;
16965
+ }
16966
+ return Buffer.byteLength(body, "utf8");
16967
+ }
16968
+
16885
16969
  // node_modules/axios/lib/adapters/http.js
16886
16970
  var zlibOptions = {
16887
16971
  flush: zlib.constants.Z_SYNC_FLUSH,
@@ -16901,6 +16985,76 @@ var flushOnFinish = (stream4, [throttled, flush]) => {
16901
16985
  stream4.on("end", flush).on("error", flush);
16902
16986
  return throttled;
16903
16987
  };
16988
+ var Http2Sessions = class {
16989
+ constructor() {
16990
+ this.sessions = /* @__PURE__ */ Object.create(null);
16991
+ }
16992
+ getSession(authority, options) {
16993
+ options = Object.assign({
16994
+ sessionTimeout: 1e3
16995
+ }, options);
16996
+ let authoritySessions = this.sessions[authority];
16997
+ if (authoritySessions) {
16998
+ let len = authoritySessions.length;
16999
+ for (let i = 0; i < len; i++) {
17000
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
17001
+ if (!sessionHandle.destroyed && !sessionHandle.closed && util2.isDeepStrictEqual(sessionOptions, options)) {
17002
+ return sessionHandle;
17003
+ }
17004
+ }
17005
+ }
17006
+ const session = http2.connect(authority, options);
17007
+ let removed;
17008
+ const removeSession = () => {
17009
+ if (removed) {
17010
+ return;
17011
+ }
17012
+ removed = true;
17013
+ let entries = authoritySessions, len = entries.length, i = len;
17014
+ while (i--) {
17015
+ if (entries[i][0] === session) {
17016
+ if (len === 1) {
17017
+ delete this.sessions[authority];
17018
+ } else {
17019
+ entries.splice(i, 1);
17020
+ }
17021
+ return;
17022
+ }
17023
+ }
17024
+ };
17025
+ const originalRequestFn = session.request;
17026
+ const { sessionTimeout } = options;
17027
+ if (sessionTimeout != null) {
17028
+ let timer;
17029
+ let streamsCount = 0;
17030
+ session.request = function() {
17031
+ const stream4 = originalRequestFn.apply(this, arguments);
17032
+ streamsCount++;
17033
+ if (timer) {
17034
+ clearTimeout(timer);
17035
+ timer = null;
17036
+ }
17037
+ stream4.once("close", () => {
17038
+ if (!--streamsCount) {
17039
+ timer = setTimeout(() => {
17040
+ timer = null;
17041
+ removeSession();
17042
+ }, sessionTimeout);
17043
+ }
17044
+ });
17045
+ return stream4;
17046
+ };
17047
+ }
17048
+ session.once("close", removeSession);
17049
+ let entry = [
17050
+ session,
17051
+ options
17052
+ ];
17053
+ authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
17054
+ return session;
17055
+ }
17056
+ };
17057
+ var http2Sessions = new Http2Sessions();
16904
17058
  function dispatchBeforeRedirect(options, responseDetails) {
16905
17059
  if (options.beforeRedirects.proxy) {
16906
17060
  options.beforeRedirects.proxy(options);
@@ -16973,14 +17127,54 @@ var resolveFamily = ({ address, family }) => {
16973
17127
  };
16974
17128
  };
16975
17129
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
17130
+ var http2Transport = {
17131
+ request(options, cb) {
17132
+ const authority = options.protocol + "//" + options.hostname + ":" + (options.port || 80);
17133
+ const { http2Options, headers } = options;
17134
+ const session = http2Sessions.getSession(authority, http2Options);
17135
+ const {
17136
+ HTTP2_HEADER_SCHEME,
17137
+ HTTP2_HEADER_METHOD,
17138
+ HTTP2_HEADER_PATH,
17139
+ HTTP2_HEADER_STATUS
17140
+ } = http2.constants;
17141
+ const http2Headers = {
17142
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
17143
+ [HTTP2_HEADER_METHOD]: options.method,
17144
+ [HTTP2_HEADER_PATH]: options.path
17145
+ };
17146
+ utils_default.forEach(headers, (header, name) => {
17147
+ name.charAt(0) !== ":" && (http2Headers[name] = header);
17148
+ });
17149
+ const req = session.request(http2Headers);
17150
+ req.once("response", (responseHeaders) => {
17151
+ const response = req;
17152
+ responseHeaders = Object.assign({}, responseHeaders);
17153
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
17154
+ delete responseHeaders[HTTP2_HEADER_STATUS];
17155
+ response.headers = responseHeaders;
17156
+ response.statusCode = +status;
17157
+ cb(response);
17158
+ });
17159
+ return req;
17160
+ }
17161
+ };
16976
17162
  var http_default = isHttpAdapterSupported && function httpAdapter(config) {
16977
17163
  return wrapAsync(async function dispatchHttpRequest(resolve6, reject, onDone) {
16978
- let { data, lookup, family } = config;
17164
+ let { data, lookup, family, httpVersion = 1, http2Options } = config;
16979
17165
  const { responseType, responseEncoding } = config;
16980
17166
  const method = config.method.toUpperCase();
16981
17167
  let isDone;
16982
17168
  let rejected = false;
16983
17169
  let req;
17170
+ httpVersion = +httpVersion;
17171
+ if (Number.isNaN(httpVersion)) {
17172
+ throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
17173
+ }
17174
+ if (httpVersion !== 1 && httpVersion !== 2) {
17175
+ throw TypeError(`Unsupported protocol version '${httpVersion}'`);
17176
+ }
17177
+ const isHttp2 = httpVersion === 2;
16984
17178
  if (lookup) {
16985
17179
  const _lookup = callbackify_default(lookup, (value) => utils_default.isArray(value) ? value : [value]);
16986
17180
  lookup = (hostname, opt, cb) => {
@@ -16993,7 +17187,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
16993
17187
  });
16994
17188
  };
16995
17189
  }
16996
- const emitter = new EventEmitter();
17190
+ const abortEmitter = new EventEmitter();
17191
+ function abort(reason) {
17192
+ try {
17193
+ abortEmitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config, req) : reason);
17194
+ } catch (err) {
17195
+ console.warn("emit error", err);
17196
+ }
17197
+ }
17198
+ abortEmitter.once("abort", reject);
16997
17199
  const onFinished = () => {
16998
17200
  if (config.cancelToken) {
16999
17201
  config.cancelToken.unsubscribe(abort);
@@ -17001,29 +17203,46 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17001
17203
  if (config.signal) {
17002
17204
  config.signal.removeEventListener("abort", abort);
17003
17205
  }
17004
- emitter.removeAllListeners();
17206
+ abortEmitter.removeAllListeners();
17005
17207
  };
17006
- onDone((value, isRejected) => {
17007
- isDone = true;
17008
- if (isRejected) {
17009
- rejected = true;
17010
- onFinished();
17011
- }
17012
- });
17013
- function abort(reason) {
17014
- emitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config, req) : reason);
17015
- }
17016
- emitter.once("abort", reject);
17017
17208
  if (config.cancelToken || config.signal) {
17018
17209
  config.cancelToken && config.cancelToken.subscribe(abort);
17019
17210
  if (config.signal) {
17020
17211
  config.signal.aborted ? abort() : config.signal.addEventListener("abort", abort);
17021
17212
  }
17022
17213
  }
17214
+ onDone((response, isRejected) => {
17215
+ isDone = true;
17216
+ if (isRejected) {
17217
+ rejected = true;
17218
+ onFinished();
17219
+ return;
17220
+ }
17221
+ const { data: data2 } = response;
17222
+ if (data2 instanceof stream3.Readable || data2 instanceof stream3.Duplex) {
17223
+ const offListeners = stream3.finished(data2, () => {
17224
+ offListeners();
17225
+ onFinished();
17226
+ });
17227
+ } else {
17228
+ onFinished();
17229
+ }
17230
+ });
17023
17231
  const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
17024
17232
  const parsed = new URL(fullPath, platform_default.hasBrowserEnv ? platform_default.origin : void 0);
17025
17233
  const protocol = parsed.protocol || supportedProtocols[0];
17026
17234
  if (protocol === "data:") {
17235
+ if (config.maxContentLength > -1) {
17236
+ const dataUrl = String(config.url || fullPath || "");
17237
+ const estimated = estimateDataURLDecodedBytes(dataUrl);
17238
+ if (estimated > config.maxContentLength) {
17239
+ return reject(new AxiosError_default(
17240
+ "maxContentLength size of " + config.maxContentLength + " exceeded",
17241
+ AxiosError_default.ERR_BAD_RESPONSE,
17242
+ config
17243
+ ));
17244
+ }
17245
+ }
17027
17246
  let convertedData;
17028
17247
  if (method !== "GET") {
17029
17248
  return settle(resolve6, reject, {
@@ -17174,7 +17393,8 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17174
17393
  protocol,
17175
17394
  family,
17176
17395
  beforeRedirect: dispatchBeforeRedirect,
17177
- beforeRedirects: {}
17396
+ beforeRedirects: {},
17397
+ http2Options
17178
17398
  };
17179
17399
  !utils_default.isUndefined(lookup) && (options.lookup = lookup);
17180
17400
  if (config.socketPath) {
@@ -17187,18 +17407,22 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17187
17407
  let transport;
17188
17408
  const isHttpsRequest = isHttps.test(options.protocol);
17189
17409
  options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
17190
- if (config.transport) {
17191
- transport = config.transport;
17192
- } else if (config.maxRedirects === 0) {
17193
- transport = isHttpsRequest ? https : http;
17410
+ if (isHttp2) {
17411
+ transport = http2Transport;
17194
17412
  } else {
17195
- if (config.maxRedirects) {
17196
- options.maxRedirects = config.maxRedirects;
17197
- }
17198
- if (config.beforeRedirect) {
17199
- options.beforeRedirects.config = config.beforeRedirect;
17413
+ if (config.transport) {
17414
+ transport = config.transport;
17415
+ } else if (config.maxRedirects === 0) {
17416
+ transport = isHttpsRequest ? https : http;
17417
+ } else {
17418
+ if (config.maxRedirects) {
17419
+ options.maxRedirects = config.maxRedirects;
17420
+ }
17421
+ if (config.beforeRedirect) {
17422
+ options.beforeRedirects.config = config.beforeRedirect;
17423
+ }
17424
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
17200
17425
  }
17201
- transport = isHttpsRequest ? httpsFollow : httpFollow;
17202
17426
  }
17203
17427
  if (config.maxBodyLength > -1) {
17204
17428
  options.maxBodyLength = config.maxBodyLength;
@@ -17211,7 +17435,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17211
17435
  req = transport.request(options, function handleResponse(res) {
17212
17436
  if (req.destroyed) return;
17213
17437
  const streams = [res];
17214
- const responseLength = +res.headers["content-length"];
17438
+ const responseLength = utils_default.toFiniteNumber(res.headers["content-length"]);
17215
17439
  if (onDownloadProgress || maxDownloadRate) {
17216
17440
  const transformStream = new AxiosTransformStream_default({
17217
17441
  maxRate: utils_default.toFiniteNumber(maxDownloadRate)
@@ -17253,10 +17477,6 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17253
17477
  }
17254
17478
  }
17255
17479
  responseStream = streams.length > 1 ? stream3.pipeline(streams, utils_default.noop) : streams[0];
17256
- const offListeners = stream3.finished(responseStream, () => {
17257
- offListeners();
17258
- onFinished();
17259
- });
17260
17480
  const response = {
17261
17481
  status: res.statusCode,
17262
17482
  statusText: res.statusMessage,
@@ -17276,7 +17496,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17276
17496
  if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
17277
17497
  rejected = true;
17278
17498
  responseStream.destroy();
17279
- reject(new AxiosError_default(
17499
+ abort(new AxiosError_default(
17280
17500
  "maxContentLength size of " + config.maxContentLength + " exceeded",
17281
17501
  AxiosError_default.ERR_BAD_RESPONSE,
17282
17502
  config,
@@ -17317,16 +17537,19 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17317
17537
  settle(resolve6, reject, response);
17318
17538
  });
17319
17539
  }
17320
- emitter.once("abort", (err) => {
17540
+ abortEmitter.once("abort", (err) => {
17321
17541
  if (!responseStream.destroyed) {
17322
17542
  responseStream.emit("error", err);
17323
17543
  responseStream.destroy();
17324
17544
  }
17325
17545
  });
17326
17546
  });
17327
- emitter.once("abort", (err) => {
17328
- reject(err);
17329
- req.destroy(err);
17547
+ abortEmitter.once("abort", (err) => {
17548
+ if (req.close) {
17549
+ req.close();
17550
+ } else {
17551
+ req.destroy(err);
17552
+ }
17330
17553
  });
17331
17554
  req.on("error", function handleRequestError(err) {
17332
17555
  reject(AxiosError_default.from(err, null, config, req));
@@ -17337,7 +17560,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17337
17560
  if (config.timeout) {
17338
17561
  const timeout = parseInt(config.timeout, 10);
17339
17562
  if (Number.isNaN(timeout)) {
17340
- reject(new AxiosError_default(
17563
+ abort(new AxiosError_default(
17341
17564
  "error trying to parse `config.timeout` to int",
17342
17565
  AxiosError_default.ERR_BAD_OPTION_VALUE,
17343
17566
  config,
@@ -17352,14 +17575,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17352
17575
  if (config.timeoutErrorMessage) {
17353
17576
  timeoutErrorMessage = config.timeoutErrorMessage;
17354
17577
  }
17355
- reject(new AxiosError_default(
17578
+ abort(new AxiosError_default(
17356
17579
  timeoutErrorMessage,
17357
17580
  transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
17358
17581
  config,
17359
17582
  req
17360
17583
  ));
17361
- abort();
17362
17584
  });
17585
+ } else {
17586
+ req.setTimeout(0);
17363
17587
  }
17364
17588
  if (utils_default.isStream(data)) {
17365
17589
  let ended = false;
@@ -17378,7 +17602,8 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17378
17602
  });
17379
17603
  data.pipe(req);
17380
17604
  } else {
17381
- req.end(data);
17605
+ data && req.write(data);
17606
+ req.end();
17382
17607
  }
17383
17608
  });
17384
17609
  };
@@ -17396,20 +17621,33 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
17396
17621
  var cookies_default = platform_default.hasStandardBrowserEnv ? (
17397
17622
  // Standard browser envs support document.cookie
17398
17623
  {
17399
- write(name, value, expires, path2, domain, secure) {
17400
- const cookie = [name + "=" + encodeURIComponent(value)];
17401
- utils_default.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
17402
- utils_default.isString(path2) && cookie.push("path=" + path2);
17403
- utils_default.isString(domain) && cookie.push("domain=" + domain);
17404
- secure === true && cookie.push("secure");
17624
+ write(name, value, expires, path2, domain, secure, sameSite) {
17625
+ if (typeof document === "undefined") return;
17626
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
17627
+ if (utils_default.isNumber(expires)) {
17628
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
17629
+ }
17630
+ if (utils_default.isString(path2)) {
17631
+ cookie.push(`path=${path2}`);
17632
+ }
17633
+ if (utils_default.isString(domain)) {
17634
+ cookie.push(`domain=${domain}`);
17635
+ }
17636
+ if (secure === true) {
17637
+ cookie.push("secure");
17638
+ }
17639
+ if (utils_default.isString(sameSite)) {
17640
+ cookie.push(`SameSite=${sameSite}`);
17641
+ }
17405
17642
  document.cookie = cookie.join("; ");
17406
17643
  },
17407
17644
  read(name) {
17408
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
17409
- return match ? decodeURIComponent(match[3]) : null;
17645
+ if (typeof document === "undefined") return null;
17646
+ const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
17647
+ return match ? decodeURIComponent(match[1]) : null;
17410
17648
  },
17411
17649
  remove(name) {
17412
- this.write(name, "", Date.now() - 864e5);
17650
+ this.write(name, "", Date.now() - 864e5, "/");
17413
17651
  }
17414
17652
  }
17415
17653
  ) : (
@@ -17497,7 +17735,7 @@ function mergeConfig(config1, config2) {
17497
17735
  validateStatus: mergeDirectKeys,
17498
17736
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
17499
17737
  };
17500
- utils_default.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
17738
+ utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
17501
17739
  const merge3 = mergeMap[prop] || mergeDeepProperties;
17502
17740
  const configValue = merge3(config1[prop], config2[prop], prop);
17503
17741
  utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config[prop] = configValue);
@@ -17517,13 +17755,17 @@ var resolveConfig_default = (config) => {
17517
17755
  "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
17518
17756
  );
17519
17757
  }
17520
- let contentType;
17521
17758
  if (utils_default.isFormData(data)) {
17522
17759
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
17523
17760
  headers.setContentType(void 0);
17524
- } else if ((contentType = headers.getContentType()) !== false) {
17525
- const [type2, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
17526
- headers.setContentType([type2 || "multipart/form-data", ...tokens].join("; "));
17761
+ } else if (utils_default.isFunction(data.getHeaders)) {
17762
+ const formHeaders = data.getHeaders();
17763
+ const allowedHeaders = ["content-type", "content-length"];
17764
+ Object.entries(formHeaders).forEach(([key, val]) => {
17765
+ if (allowedHeaders.includes(key.toLowerCase())) {
17766
+ headers.set(key, val);
17767
+ }
17768
+ });
17527
17769
  }
17528
17770
  }
17529
17771
  if (platform_default.hasStandardBrowserEnv) {
@@ -17603,8 +17845,11 @@ var xhr_default = isXHRAdapterSupported && function(config) {
17603
17845
  reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config, request));
17604
17846
  request = null;
17605
17847
  };
17606
- request.onerror = function handleError() {
17607
- reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request));
17848
+ request.onerror = function handleError(event) {
17849
+ const msg = event && event.message ? event.message : "Network Error";
17850
+ const err = new AxiosError_default(msg, AxiosError_default.ERR_NETWORK, config, request);
17851
+ err.event = event || null;
17852
+ reject(err);
17608
17853
  request = null;
17609
17854
  };
17610
17855
  request.ontimeout = function handleTimeout() {
@@ -17779,9 +18024,16 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
17779
18024
  };
17780
18025
 
17781
18026
  // node_modules/axios/lib/adapters/fetch.js
17782
- var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
17783
- var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
17784
- var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str2) => encoder.encode(str2))(new TextEncoder()) : async (str2) => new Uint8Array(await new Response(str2).arrayBuffer()));
18027
+ var DEFAULT_CHUNK_SIZE = 64 * 1024;
18028
+ var { isFunction: isFunction2 } = utils_default;
18029
+ var globalFetchAPI = (({ Request, Response }) => ({
18030
+ Request,
18031
+ Response
18032
+ }))(utils_default.global);
18033
+ var {
18034
+ ReadableStream: ReadableStream2,
18035
+ TextEncoder: TextEncoder2
18036
+ } = utils_default.global;
17785
18037
  var test = (fn, ...args) => {
17786
18038
  try {
17787
18039
  return !!fn(...args);
@@ -17789,164 +18041,204 @@ var test = (fn, ...args) => {
17789
18041
  return false;
17790
18042
  }
17791
18043
  };
17792
- var supportsRequestStream = isReadableStreamSupported && test(() => {
17793
- let duplexAccessed = false;
17794
- const hasContentType = new Request(platform_default.origin, {
17795
- body: new ReadableStream(),
17796
- method: "POST",
17797
- get duplex() {
17798
- duplexAccessed = true;
17799
- return "half";
17800
- }
17801
- }).headers.has("Content-Type");
17802
- return duplexAccessed && !hasContentType;
17803
- });
17804
- var DEFAULT_CHUNK_SIZE = 64 * 1024;
17805
- var supportsResponseStream = isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
17806
- var resolvers = {
17807
- stream: supportsResponseStream && ((res) => res.body)
17808
- };
17809
- isFetchSupported && ((res) => {
17810
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type2) => {
17811
- !resolvers[type2] && (resolvers[type2] = utils_default.isFunction(res[type2]) ? (res2) => res2[type2]() : (_, config) => {
17812
- throw new AxiosError_default(`Response type '${type2}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
17813
- });
17814
- });
17815
- })(new Response());
17816
- var getBodyLength = async (body) => {
17817
- if (body == null) {
17818
- return 0;
17819
- }
17820
- if (utils_default.isBlob(body)) {
17821
- return body.size;
18044
+ var factory = (env2) => {
18045
+ env2 = utils_default.merge.call({
18046
+ skipUndefined: true
18047
+ }, globalFetchAPI, env2);
18048
+ const { fetch: envFetch, Request, Response } = env2;
18049
+ const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
18050
+ const isRequestSupported = isFunction2(Request);
18051
+ const isResponseSupported = isFunction2(Response);
18052
+ if (!isFetchSupported) {
18053
+ return false;
17822
18054
  }
17823
- if (utils_default.isSpecCompliantForm(body)) {
17824
- const _request = new Request(platform_default.origin, {
18055
+ const isReadableStreamSupported = isFetchSupported && isFunction2(ReadableStream2);
18056
+ const encodeText = isFetchSupported && (typeof TextEncoder2 === "function" ? /* @__PURE__ */ ((encoder) => (str2) => encoder.encode(str2))(new TextEncoder2()) : async (str2) => new Uint8Array(await new Request(str2).arrayBuffer()));
18057
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
18058
+ let duplexAccessed = false;
18059
+ const hasContentType = new Request(platform_default.origin, {
18060
+ body: new ReadableStream2(),
17825
18061
  method: "POST",
17826
- body
17827
- });
17828
- return (await _request.arrayBuffer()).byteLength;
17829
- }
17830
- if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
17831
- return body.byteLength;
17832
- }
17833
- if (utils_default.isURLSearchParams(body)) {
17834
- body = body + "";
17835
- }
17836
- if (utils_default.isString(body)) {
17837
- return (await encodeText(body)).byteLength;
17838
- }
17839
- };
17840
- var resolveBodyLength = async (headers, body) => {
17841
- const length = utils_default.toFiniteNumber(headers.getContentLength());
17842
- return length == null ? getBodyLength(body) : length;
17843
- };
17844
- var fetch_default = isFetchSupported && (async (config) => {
17845
- let {
17846
- url: url2,
17847
- method,
17848
- data,
17849
- signal,
17850
- cancelToken,
17851
- timeout,
17852
- onDownloadProgress,
17853
- onUploadProgress,
17854
- responseType,
17855
- headers,
17856
- withCredentials = "same-origin",
17857
- fetchOptions
17858
- } = resolveConfig_default(config);
17859
- responseType = responseType ? (responseType + "").toLowerCase() : "text";
17860
- let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
17861
- let request;
17862
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
17863
- composedSignal.unsubscribe();
18062
+ get duplex() {
18063
+ duplexAccessed = true;
18064
+ return "half";
18065
+ }
18066
+ }).headers.has("Content-Type");
18067
+ return duplexAccessed && !hasContentType;
17864
18068
  });
17865
- let requestContentLength;
17866
- try {
17867
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
17868
- let _request = new Request(url2, {
17869
- method: "POST",
17870
- body: data,
17871
- duplex: "half"
18069
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
18070
+ const resolvers = {
18071
+ stream: supportsResponseStream && ((res) => res.body)
18072
+ };
18073
+ isFetchSupported && (() => {
18074
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type2) => {
18075
+ !resolvers[type2] && (resolvers[type2] = (res, config) => {
18076
+ let method = res && res[type2];
18077
+ if (method) {
18078
+ return method.call(res);
18079
+ }
18080
+ throw new AxiosError_default(`Response type '${type2}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
17872
18081
  });
17873
- let contentTypeHeader;
17874
- if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
17875
- headers.setContentType(contentTypeHeader);
17876
- }
17877
- if (_request.body) {
17878
- const [onProgress, flush] = progressEventDecorator(
17879
- requestContentLength,
17880
- progressEventReducer(asyncDecorator(onUploadProgress))
17881
- );
17882
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
17883
- }
18082
+ });
18083
+ })();
18084
+ const getBodyLength = async (body) => {
18085
+ if (body == null) {
18086
+ return 0;
17884
18087
  }
17885
- if (!utils_default.isString(withCredentials)) {
17886
- withCredentials = withCredentials ? "include" : "omit";
18088
+ if (utils_default.isBlob(body)) {
18089
+ return body.size;
17887
18090
  }
17888
- const isCredentialsSupported = "credentials" in Request.prototype;
17889
- request = new Request(url2, {
17890
- ...fetchOptions,
17891
- signal: composedSignal,
17892
- method: method.toUpperCase(),
17893
- headers: headers.normalize().toJSON(),
17894
- body: data,
17895
- duplex: "half",
17896
- credentials: isCredentialsSupported ? withCredentials : void 0
17897
- });
17898
- let response = await fetch(request, fetchOptions);
17899
- const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
17900
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
17901
- const options = {};
17902
- ["status", "statusText", "headers"].forEach((prop) => {
17903
- options[prop] = response[prop];
18091
+ if (utils_default.isSpecCompliantForm(body)) {
18092
+ const _request = new Request(platform_default.origin, {
18093
+ method: "POST",
18094
+ body
17904
18095
  });
17905
- const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
17906
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
17907
- responseContentLength,
17908
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
17909
- ) || [];
17910
- response = new Response(
17911
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
17912
- flush && flush();
17913
- unsubscribe && unsubscribe();
17914
- }),
17915
- options
17916
- );
18096
+ return (await _request.arrayBuffer()).byteLength;
17917
18097
  }
17918
- responseType = responseType || "text";
17919
- let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
17920
- !isStreamResponse && unsubscribe && unsubscribe();
17921
- return await new Promise((resolve6, reject) => {
17922
- settle(resolve6, reject, {
17923
- data: responseData,
17924
- headers: AxiosHeaders_default.from(response.headers),
17925
- status: response.status,
17926
- statusText: response.statusText,
17927
- config,
17928
- request
17929
- });
18098
+ if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
18099
+ return body.byteLength;
18100
+ }
18101
+ if (utils_default.isURLSearchParams(body)) {
18102
+ body = body + "";
18103
+ }
18104
+ if (utils_default.isString(body)) {
18105
+ return (await encodeText(body)).byteLength;
18106
+ }
18107
+ };
18108
+ const resolveBodyLength = async (headers, body) => {
18109
+ const length = utils_default.toFiniteNumber(headers.getContentLength());
18110
+ return length == null ? getBodyLength(body) : length;
18111
+ };
18112
+ return async (config) => {
18113
+ let {
18114
+ url: url2,
18115
+ method,
18116
+ data,
18117
+ signal,
18118
+ cancelToken,
18119
+ timeout,
18120
+ onDownloadProgress,
18121
+ onUploadProgress,
18122
+ responseType,
18123
+ headers,
18124
+ withCredentials = "same-origin",
18125
+ fetchOptions
18126
+ } = resolveConfig_default(config);
18127
+ let _fetch = envFetch || fetch;
18128
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
18129
+ let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
18130
+ let request = null;
18131
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
18132
+ composedSignal.unsubscribe();
17930
18133
  });
17931
- } catch (err) {
17932
- unsubscribe && unsubscribe();
17933
- if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
17934
- throw Object.assign(
17935
- new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request),
17936
- {
17937
- cause: err.cause || err
18134
+ let requestContentLength;
18135
+ try {
18136
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
18137
+ let _request = new Request(url2, {
18138
+ method: "POST",
18139
+ body: data,
18140
+ duplex: "half"
18141
+ });
18142
+ let contentTypeHeader;
18143
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
18144
+ headers.setContentType(contentTypeHeader);
17938
18145
  }
17939
- );
18146
+ if (_request.body) {
18147
+ const [onProgress, flush] = progressEventDecorator(
18148
+ requestContentLength,
18149
+ progressEventReducer(asyncDecorator(onUploadProgress))
18150
+ );
18151
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
18152
+ }
18153
+ }
18154
+ if (!utils_default.isString(withCredentials)) {
18155
+ withCredentials = withCredentials ? "include" : "omit";
18156
+ }
18157
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
18158
+ const resolvedOptions = {
18159
+ ...fetchOptions,
18160
+ signal: composedSignal,
18161
+ method: method.toUpperCase(),
18162
+ headers: headers.normalize().toJSON(),
18163
+ body: data,
18164
+ duplex: "half",
18165
+ credentials: isCredentialsSupported ? withCredentials : void 0
18166
+ };
18167
+ request = isRequestSupported && new Request(url2, resolvedOptions);
18168
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url2, resolvedOptions));
18169
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
18170
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
18171
+ const options = {};
18172
+ ["status", "statusText", "headers"].forEach((prop) => {
18173
+ options[prop] = response[prop];
18174
+ });
18175
+ const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
18176
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
18177
+ responseContentLength,
18178
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
18179
+ ) || [];
18180
+ response = new Response(
18181
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
18182
+ flush && flush();
18183
+ unsubscribe && unsubscribe();
18184
+ }),
18185
+ options
18186
+ );
18187
+ }
18188
+ responseType = responseType || "text";
18189
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
18190
+ !isStreamResponse && unsubscribe && unsubscribe();
18191
+ return await new Promise((resolve6, reject) => {
18192
+ settle(resolve6, reject, {
18193
+ data: responseData,
18194
+ headers: AxiosHeaders_default.from(response.headers),
18195
+ status: response.status,
18196
+ statusText: response.statusText,
18197
+ config,
18198
+ request
18199
+ });
18200
+ });
18201
+ } catch (err) {
18202
+ unsubscribe && unsubscribe();
18203
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
18204
+ throw Object.assign(
18205
+ new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request),
18206
+ {
18207
+ cause: err.cause || err
18208
+ }
18209
+ );
18210
+ }
18211
+ throw AxiosError_default.from(err, err && err.code, config, request);
17940
18212
  }
17941
- throw AxiosError_default.from(err, err && err.code, config, request);
18213
+ };
18214
+ };
18215
+ var seedCache = /* @__PURE__ */ new Map();
18216
+ var getFetch = (config) => {
18217
+ let env2 = config && config.env || {};
18218
+ const { fetch: fetch2, Request, Response } = env2;
18219
+ const seeds = [
18220
+ Request,
18221
+ Response,
18222
+ fetch2
18223
+ ];
18224
+ let len = seeds.length, i = len, seed, target, map2 = seedCache;
18225
+ while (i--) {
18226
+ seed = seeds[i];
18227
+ target = map2.get(seed);
18228
+ target === void 0 && map2.set(seed, target = i ? /* @__PURE__ */ new Map() : factory(env2));
18229
+ map2 = target;
17942
18230
  }
17943
- });
18231
+ return target;
18232
+ };
18233
+ var adapter = getFetch();
17944
18234
 
17945
18235
  // node_modules/axios/lib/adapters/adapters.js
17946
18236
  var knownAdapters = {
17947
18237
  http: http_default,
17948
18238
  xhr: xhr_default,
17949
- fetch: fetch_default
18239
+ fetch: {
18240
+ get: getFetch
18241
+ }
17950
18242
  };
17951
18243
  utils_default.forEach(knownAdapters, (fn, value) => {
17952
18244
  if (fn) {
@@ -17958,41 +18250,50 @@ utils_default.forEach(knownAdapters, (fn, value) => {
17958
18250
  }
17959
18251
  });
17960
18252
  var renderReason = (reason) => `- ${reason}`;
17961
- var isResolvedHandle = (adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false;
17962
- var adapters_default = {
17963
- getAdapter: (adapters) => {
17964
- adapters = utils_default.isArray(adapters) ? adapters : [adapters];
17965
- const { length } = adapters;
17966
- let nameOrAdapter;
17967
- let adapter;
17968
- const rejectedReasons = {};
17969
- for (let i = 0; i < length; i++) {
17970
- nameOrAdapter = adapters[i];
17971
- let id;
17972
- adapter = nameOrAdapter;
17973
- if (!isResolvedHandle(nameOrAdapter)) {
17974
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
17975
- if (adapter === void 0) {
17976
- throw new AxiosError_default(`Unknown adapter '${id}'`);
17977
- }
17978
- }
17979
- if (adapter) {
17980
- break;
17981
- }
17982
- rejectedReasons[id || "#" + i] = adapter;
17983
- }
17984
- if (!adapter) {
17985
- const reasons = Object.entries(rejectedReasons).map(
17986
- ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
17987
- );
17988
- let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
17989
- throw new AxiosError_default(
17990
- `There is no suitable adapter to dispatch the request ` + s,
17991
- "ERR_NOT_SUPPORT"
17992
- );
18253
+ var isResolvedHandle = (adapter2) => utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
18254
+ function getAdapter(adapters, config) {
18255
+ adapters = utils_default.isArray(adapters) ? adapters : [adapters];
18256
+ const { length } = adapters;
18257
+ let nameOrAdapter;
18258
+ let adapter2;
18259
+ const rejectedReasons = {};
18260
+ for (let i = 0; i < length; i++) {
18261
+ nameOrAdapter = adapters[i];
18262
+ let id;
18263
+ adapter2 = nameOrAdapter;
18264
+ if (!isResolvedHandle(nameOrAdapter)) {
18265
+ adapter2 = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
18266
+ if (adapter2 === void 0) {
18267
+ throw new AxiosError_default(`Unknown adapter '${id}'`);
18268
+ }
18269
+ }
18270
+ if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
18271
+ break;
17993
18272
  }
17994
- return adapter;
17995
- },
18273
+ rejectedReasons[id || "#" + i] = adapter2;
18274
+ }
18275
+ if (!adapter2) {
18276
+ const reasons = Object.entries(rejectedReasons).map(
18277
+ ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
18278
+ );
18279
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
18280
+ throw new AxiosError_default(
18281
+ `There is no suitable adapter to dispatch the request ` + s,
18282
+ "ERR_NOT_SUPPORT"
18283
+ );
18284
+ }
18285
+ return adapter2;
18286
+ }
18287
+ var adapters_default = {
18288
+ /**
18289
+ * Resolve an adapter from a list of adapter names or functions.
18290
+ * @type {Function}
18291
+ */
18292
+ getAdapter,
18293
+ /**
18294
+ * Exposes all known adapters
18295
+ * @type {Object<string, Function|Object>}
18296
+ */
17996
18297
  adapters: knownAdapters
17997
18298
  };
17998
18299
 
@@ -18015,8 +18316,8 @@ function dispatchRequest(config) {
18015
18316
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
18016
18317
  config.headers.setContentType("application/x-www-form-urlencoded", false);
18017
18318
  }
18018
- const adapter = adapters_default.getAdapter(config.adapter || defaults_default.adapter);
18019
- return adapter(config).then(function onAdapterResolution(response) {
18319
+ const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
18320
+ return adapter2(config).then(function onAdapterResolution(response) {
18020
18321
  throwIfCancellationRequested(config);
18021
18322
  response.data = transformData.call(
18022
18323
  config,
@@ -18211,8 +18512,8 @@ var Axios = class {
18211
18512
  let len;
18212
18513
  if (!synchronousRequestInterceptors) {
18213
18514
  const chain = [dispatchRequest.bind(this), void 0];
18214
- chain.unshift.apply(chain, requestInterceptorChain);
18215
- chain.push.apply(chain, responseInterceptorChain);
18515
+ chain.unshift(...requestInterceptorChain);
18516
+ chain.push(...responseInterceptorChain);
18216
18517
  len = chain.length;
18217
18518
  promise = Promise.resolve(config);
18218
18519
  while (i < len) {
@@ -18222,7 +18523,6 @@ var Axios = class {
18222
18523
  }
18223
18524
  len = requestInterceptorChain.length;
18224
18525
  let newConfig = config;
18225
- i = 0;
18226
18526
  while (i < len) {
18227
18527
  const onFulfilled = requestInterceptorChain[i++];
18228
18528
  const onRejected = requestInterceptorChain[i++];
@@ -18452,7 +18752,13 @@ var HttpStatusCode = {
18452
18752
  InsufficientStorage: 507,
18453
18753
  LoopDetected: 508,
18454
18754
  NotExtended: 510,
18455
- NetworkAuthenticationRequired: 511
18755
+ NetworkAuthenticationRequired: 511,
18756
+ WebServerIsDown: 521,
18757
+ ConnectionTimedOut: 522,
18758
+ OriginIsUnreachable: 523,
18759
+ TimeoutOccurred: 524,
18760
+ SslHandshakeFailed: 525,
18761
+ InvalidSslCertificate: 526
18456
18762
  };
18457
18763
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
18458
18764
  HttpStatusCode[value] = key;
@@ -18508,7 +18814,7 @@ var {
18508
18814
  AxiosHeaders: AxiosHeaders2,
18509
18815
  HttpStatusCode: HttpStatusCode2,
18510
18816
  formToJSON,
18511
- getAdapter,
18817
+ getAdapter: getAdapter2,
18512
18818
  mergeConfig: mergeConfig2
18513
18819
  } = axios_default;
18514
18820
 
@@ -18548,6 +18854,26 @@ function isGetLikeMethod(method) {
18548
18854
  }
18549
18855
 
18550
18856
  // src/api-client.ts
18857
+ var SYSTEM_CONTROLLED_HEADERS = /* @__PURE__ */ new Set([
18858
+ "host",
18859
+ // Controlled by HTTP client based on URL
18860
+ "content-length",
18861
+ // Calculated by HTTP client from body
18862
+ "transfer-encoding",
18863
+ // Managed by HTTP client for chunked encoding
18864
+ "connection",
18865
+ // HTTP connection management
18866
+ "upgrade",
18867
+ // Protocol upgrade (WebSocket, HTTP/2)
18868
+ "te",
18869
+ // Transfer encoding preferences
18870
+ "trailer",
18871
+ // Trailer fields in chunked transfer
18872
+ "proxy-connection",
18873
+ // Proxy connection management
18874
+ "keep-alive"
18875
+ // Connection keep-alive settings
18876
+ ]);
18551
18877
  var ApiClient = class {
18552
18878
  axiosInstance;
18553
18879
  toolsMap = /* @__PURE__ */ new Map();
@@ -18563,7 +18889,15 @@ var ApiClient = class {
18563
18889
  */
18564
18890
  constructor(baseUrl, authProviderOrHeaders, specLoader) {
18565
18891
  this.axiosInstance = axios_default.create({
18566
- baseURL: baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`
18892
+ baseURL: baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`,
18893
+ timeout: 3e4,
18894
+ // 30 second timeout to prevent indefinite hangs
18895
+ maxContentLength: 50 * 1024 * 1024,
18896
+ // 50MB response body limit
18897
+ maxBodyLength: 50 * 1024 * 1024,
18898
+ // 50MB request body limit
18899
+ maxRedirects: 5
18900
+ // Limit redirect chains to prevent abuse
18567
18901
  });
18568
18902
  if (!authProviderOrHeaders) {
18569
18903
  this.authProvider = new StaticAuthProvider();
@@ -18661,7 +18995,17 @@ var ApiClient = class {
18661
18995
  queryParams[key] = value;
18662
18996
  delete paramsCopy[key];
18663
18997
  } else if (paramLocation === "header") {
18664
- headerParams[key] = String(value);
18998
+ const headerName = key.toLowerCase();
18999
+ if (SYSTEM_CONTROLLED_HEADERS.has(headerName)) {
19000
+ throw new Error(
19001
+ `Cannot set system-controlled header "${key}". This header is managed by the HTTP client and cannot be overridden.`
19002
+ );
19003
+ }
19004
+ const headerValue = String(value);
19005
+ if (headerValue.includes("\r") || headerValue.includes("\n")) {
19006
+ throw new Error(`Header value for "${key}" contains invalid characters (CR/LF)`);
19007
+ }
19008
+ headerParams[key] = headerValue;
18665
19009
  delete paramsCopy[key];
18666
19010
  }
18667
19011
  }
@@ -18686,6 +19030,16 @@ var ApiClient = class {
18686
19030
  }
18687
19031
  }
18688
19032
  const authHeaders = await this.authProvider.getAuthHeaders();
19033
+ if (authHeaders && Object.keys(authHeaders).length > 0) {
19034
+ const authHeadersLower = Object.keys(authHeaders).map((k) => k.toLowerCase());
19035
+ for (const headerKey of Object.keys(headerParams)) {
19036
+ if (authHeadersLower.includes(headerKey.toLowerCase())) {
19037
+ throw new Error(
19038
+ `Cannot override authentication header "${headerKey}". This header is set by the authentication provider.`
19039
+ );
19040
+ }
19041
+ }
19042
+ }
18689
19043
  const config = {
18690
19044
  method: method.toLowerCase(),
18691
19045
  url: resolvedPath,
@@ -18716,7 +19070,10 @@ var ApiClient = class {
18716
19070
  }
18717
19071
  }
18718
19072
  throw new Error(
18719
- `API request failed: ${axiosError.message}${axiosError.response ? ` (${axiosError.response.status}: ${typeof axiosError.response.data === "object" ? JSON.stringify(axiosError.response.data) : axiosError.response.data})` : ""}`
19073
+ `API request failed: ${axiosError.message}${axiosError.response ? ` (${axiosError.response.status}: ${this.sanitizeErrorData(
19074
+ axiosError.response.data,
19075
+ axiosError.response.status
19076
+ )})` : ""}`
18720
19077
  );
18721
19078
  }
18722
19079
  throw error;
@@ -18749,6 +19106,25 @@ var ApiClient = class {
18749
19106
  }
18750
19107
  return result;
18751
19108
  }
19109
+ /**
19110
+ * Sanitize error data to prevent information disclosure
19111
+ * Redacts sensitive data from authentication errors and truncates large responses
19112
+ *
19113
+ * @param data - The error response data
19114
+ * @param statusCode - The HTTP status code
19115
+ * @returns Sanitized error data string
19116
+ */
19117
+ sanitizeErrorData(data, statusCode) {
19118
+ if (statusCode === 401 || statusCode === 403) {
19119
+ return "[Authentication/Authorization error - details redacted for security]";
19120
+ }
19121
+ const dataStr = typeof data === "object" ? JSON.stringify(data) : String(data);
19122
+ const MAX_ERROR_LENGTH = 1e3;
19123
+ if (dataStr.length > MAX_ERROR_LENGTH) {
19124
+ return dataStr.substring(0, MAX_ERROR_LENGTH) + "... [truncated]";
19125
+ }
19126
+ return dataStr;
19127
+ }
18752
19128
  /**
18753
19129
  * Handle the LIST-API-ENDPOINTS meta-tool
18754
19130
  * Returns a list of all available API endpoints from the loaded tools
@@ -18931,7 +19307,10 @@ var ApiClient = class {
18931
19307
  if (axios_default.isAxiosError(error)) {
18932
19308
  const axiosError = error;
18933
19309
  throw new Error(
18934
- `API request failed: ${axiosError.message}${axiosError.response ? ` (${axiosError.response.status}: ${typeof axiosError.response.data === "object" ? JSON.stringify(axiosError.response.data) : axiosError.response.data})` : ""}`
19310
+ `API request failed: ${axiosError.message}${axiosError.response ? ` (${axiosError.response.status}: ${this.sanitizeErrorData(
19311
+ axiosError.response.data,
19312
+ axiosError.response.status
19313
+ )})` : ""}`
18935
19314
  );
18936
19315
  }
18937
19316
  throw error;
@@ -21080,13 +21459,13 @@ function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => {
21080
21459
  throw err;
21081
21460
  }) {
21082
21461
  try {
21083
- const result = isFunction2(getResult) ? getResult() : getResult;
21462
+ const result = isFunction3(getResult) ? getResult() : getResult;
21084
21463
  return isPromise(result) ? result.then((result2) => resultHandler(result2)) : resultHandler(result);
21085
21464
  } catch (err) {
21086
21465
  return errorHandler(err);
21087
21466
  }
21088
21467
  }
21089
- function isFunction2(arg) {
21468
+ function isFunction3(arg) {
21090
21469
  return typeof arg === "function";
21091
21470
  }
21092
21471
 
@@ -24341,7 +24720,7 @@ import {
24341
24720
  isJSONRPCRequest,
24342
24721
  isJSONRPCResponse
24343
24722
  } from "@modelcontextprotocol/sdk/types.js";
24344
- import * as http2 from "http";
24723
+ import * as http3 from "http";
24345
24724
  import { randomUUID } from "crypto";
24346
24725
  var StreamableHttpServerTransport = class {
24347
24726
  // Track if using an external server
@@ -24368,7 +24747,7 @@ var StreamableHttpServerTransport = class {
24368
24747
  this.server = server;
24369
24748
  this.server.on("request", this.handleRequest.bind(this));
24370
24749
  } else {
24371
- this.server = http2.createServer(this.handleRequest.bind(this));
24750
+ this.server = http3.createServer(this.handleRequest.bind(this));
24372
24751
  }
24373
24752
  }
24374
24753
  server;
@@ -24952,7 +25331,7 @@ function parseContent(content, source) {
24952
25331
  return JSON.parse(content);
24953
25332
  } catch {
24954
25333
  try {
24955
- return js_yaml_default.load(content);
25334
+ return jsYaml.load(content);
24956
25335
  } catch (yamlError) {
24957
25336
  throw new Error(
24958
25337
  `Failed to parse ${source} as JSON or YAML: ${yamlError}`
@@ -25058,7 +25437,7 @@ mime-types/index.js:
25058
25437
  *)
25059
25438
 
25060
25439
  js-yaml/dist/js-yaml.mjs:
25061
- (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
25440
+ (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
25062
25441
 
25063
25442
  yargs-parser/build/lib/string-utils.js:
25064
25443
  yargs-parser/build/lib/tokenize-arg-string.js: