@ivotoby/openapi-mcp-server 1.12.4 → 1.13.0

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 (4) hide show
  1. package/README.md +64 -20
  2. package/dist/bundle.js +734 -438
  3. package/dist/cli.js +734 -438
  4. package/package.json +20 -7
package/dist/cli.js CHANGED
@@ -11659,6 +11659,8 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
11659
11659
 
11660
11660
  // src/server.ts
11661
11661
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
11662
+ import { readFileSync } from "node:fs";
11663
+ import { Agent as HttpsAgent } from "node:https";
11662
11664
  import {
11663
11665
  ListToolsRequestSchema,
11664
11666
  CallToolRequestSchema,
@@ -14834,11 +14836,14 @@ var OpenAPISpecLoader = class {
14834
14836
  continue;
14835
14837
  }
14836
14838
  let mediaTypeObj;
14839
+ let selectedContentType;
14837
14840
  if (requestBodyObj.content["application/json"]) {
14838
14841
  mediaTypeObj = requestBodyObj.content["application/json"];
14842
+ selectedContentType = "application/json";
14839
14843
  } else if (Object.keys(requestBodyObj.content).length > 0) {
14840
14844
  const firstContentType = Object.keys(requestBodyObj.content)[0];
14841
14845
  mediaTypeObj = requestBodyObj.content[firstContentType];
14846
+ selectedContentType = firstContentType;
14842
14847
  }
14843
14848
  if (mediaTypeObj?.schema) {
14844
14849
  const inlinedSchema = this.inlineSchema(
@@ -14876,6 +14881,10 @@ var OpenAPISpecLoader = class {
14876
14881
  requiredParams.push("body");
14877
14882
  }
14878
14883
  }
14884
+ if (selectedContentType) {
14885
+ ;
14886
+ tool.inputSchema["x-content-type"] = selectedContentType;
14887
+ }
14879
14888
  }
14880
14889
  if (requiredParams.length > 0) {
14881
14890
  tool.inputSchema.required = requiredParams;
@@ -15251,8 +15260,8 @@ var isPlainObject = (val) => {
15251
15260
  if (kindOf(val) !== "object") {
15252
15261
  return false;
15253
15262
  }
15254
- const prototype3 = getPrototypeOf(val);
15255
- return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(toStringTag in val) && !(iterator in val);
15263
+ const prototype2 = getPrototypeOf(val);
15264
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
15256
15265
  };
15257
15266
  var isEmptyObject = (val) => {
15258
15267
  if (!isObject2(val) || isBuffer(val)) {
@@ -15266,17 +15275,37 @@ var isEmptyObject = (val) => {
15266
15275
  };
15267
15276
  var isDate = kindOfTest("Date");
15268
15277
  var isFile = kindOfTest("File");
15278
+ var isReactNativeBlob = (value) => {
15279
+ return !!(value && typeof value.uri !== "undefined");
15280
+ };
15281
+ var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
15269
15282
  var isBlob = kindOfTest("Blob");
15270
15283
  var isFileList = kindOfTest("FileList");
15271
15284
  var isStream = (val) => isObject2(val) && isFunction(val.pipe);
15285
+ function getGlobal() {
15286
+ if (typeof globalThis !== "undefined") return globalThis;
15287
+ if (typeof self !== "undefined") return self;
15288
+ if (typeof window !== "undefined") return window;
15289
+ if (typeof global !== "undefined") return global;
15290
+ return {};
15291
+ }
15292
+ var G = getGlobal();
15293
+ var FormDataCtor = typeof G.FormData !== "undefined" ? G.FormData : void 0;
15272
15294
  var isFormData = (thing) => {
15273
15295
  let kind;
15274
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
15296
+ return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
15275
15297
  kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
15276
15298
  };
15277
15299
  var isURLSearchParams = kindOfTest("URLSearchParams");
15278
- var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
15279
- var trim = (str2) => str2.trim ? str2.trim() : str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
15300
+ var [isReadableStream, isRequest, isResponse, isHeaders] = [
15301
+ "ReadableStream",
15302
+ "Request",
15303
+ "Response",
15304
+ "Headers"
15305
+ ].map(kindOfTest);
15306
+ var trim = (str2) => {
15307
+ return str2.trim ? str2.trim() : str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
15308
+ };
15280
15309
  function forEach(obj, fn, { allOwnKeys = false } = {}) {
15281
15310
  if (obj === null || typeof obj === "undefined") {
15282
15311
  return;
@@ -15328,6 +15357,9 @@ function merge2() {
15328
15357
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
15329
15358
  const result = {};
15330
15359
  const assignValue = (val, key) => {
15360
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
15361
+ return;
15362
+ }
15331
15363
  const targetKey = caseless && findKey(result, key) || key;
15332
15364
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
15333
15365
  result[targetKey] = merge2(result[targetKey], val);
@@ -15345,13 +15377,27 @@ function merge2() {
15345
15377
  return result;
15346
15378
  }
15347
15379
  var extend3 = (a, b, thisArg, { allOwnKeys } = {}) => {
15348
- forEach(b, (val, key) => {
15349
- if (thisArg && isFunction(val)) {
15350
- a[key] = bind(val, thisArg);
15351
- } else {
15352
- a[key] = val;
15353
- }
15354
- }, { allOwnKeys });
15380
+ forEach(
15381
+ b,
15382
+ (val, key) => {
15383
+ if (thisArg && isFunction(val)) {
15384
+ Object.defineProperty(a, key, {
15385
+ value: bind(val, thisArg),
15386
+ writable: true,
15387
+ enumerable: true,
15388
+ configurable: true
15389
+ });
15390
+ } else {
15391
+ Object.defineProperty(a, key, {
15392
+ value: val,
15393
+ writable: true,
15394
+ enumerable: true,
15395
+ configurable: true
15396
+ });
15397
+ }
15398
+ },
15399
+ { allOwnKeys }
15400
+ );
15355
15401
  return a;
15356
15402
  };
15357
15403
  var stripBOM = (content) => {
@@ -15360,9 +15406,14 @@ var stripBOM = (content) => {
15360
15406
  }
15361
15407
  return content;
15362
15408
  };
15363
- var inherits = (constructor, superConstructor, props, descriptors2) => {
15364
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
15365
- constructor.prototype.constructor = constructor;
15409
+ var inherits = (constructor, superConstructor, props, descriptors) => {
15410
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
15411
+ Object.defineProperty(constructor.prototype, "constructor", {
15412
+ value: constructor,
15413
+ writable: true,
15414
+ enumerable: false,
15415
+ configurable: true
15416
+ });
15366
15417
  Object.defineProperty(constructor, "super", {
15367
15418
  value: superConstructor.prototype
15368
15419
  });
@@ -15433,19 +15484,16 @@ var matchAll = (regExp, str2) => {
15433
15484
  };
15434
15485
  var isHTMLForm = kindOfTest("HTMLFormElement");
15435
15486
  var toCamelCase = (str2) => {
15436
- return str2.toLowerCase().replace(
15437
- /[-_\s]([a-z\d])(\w*)/g,
15438
- function replacer(m, p1, p2) {
15439
- return p1.toUpperCase() + p2;
15440
- }
15441
- );
15487
+ return str2.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
15488
+ return p1.toUpperCase() + p2;
15489
+ });
15442
15490
  };
15443
15491
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
15444
15492
  var isRegExp = kindOfTest("RegExp");
15445
15493
  var reduceDescriptors = (obj, reducer) => {
15446
- const descriptors2 = Object.getOwnPropertyDescriptors(obj);
15494
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
15447
15495
  const reducedDescriptors = {};
15448
- forEach(descriptors2, (descriptor, name) => {
15496
+ forEach(descriptors, (descriptor, name) => {
15449
15497
  let ret;
15450
15498
  if ((ret = reducer(descriptor, name, obj)) !== false) {
15451
15499
  reducedDescriptors[name] = ret || descriptor;
@@ -15522,20 +15570,21 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
15522
15570
  return setImmediate;
15523
15571
  }
15524
15572
  return postMessageSupported ? ((token, callbacks) => {
15525
- _global.addEventListener("message", ({ source, data }) => {
15526
- if (source === _global && data === token) {
15527
- callbacks.length && callbacks.shift()();
15528
- }
15529
- }, false);
15573
+ _global.addEventListener(
15574
+ "message",
15575
+ ({ source, data }) => {
15576
+ if (source === _global && data === token) {
15577
+ callbacks.length && callbacks.shift()();
15578
+ }
15579
+ },
15580
+ false
15581
+ );
15530
15582
  return (cb) => {
15531
15583
  callbacks.push(cb);
15532
15584
  _global.postMessage(token, "*");
15533
15585
  };
15534
15586
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
15535
- })(
15536
- typeof setImmediate === "function",
15537
- isFunction(_global.postMessage)
15538
- );
15587
+ })(typeof setImmediate === "function", isFunction(_global.postMessage));
15539
15588
  var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
15540
15589
  var isIterable = (thing) => thing != null && isFunction(thing[iterator]);
15541
15590
  var utils_default = {
@@ -15557,6 +15606,8 @@ var utils_default = {
15557
15606
  isUndefined,
15558
15607
  isDate,
15559
15608
  isFile,
15609
+ isReactNativeBlob,
15610
+ isReactNative,
15560
15611
  isBlob,
15561
15612
  isRegExp,
15562
15613
  isFunction,
@@ -15600,25 +15651,47 @@ var utils_default = {
15600
15651
  };
15601
15652
 
15602
15653
  // node_modules/axios/lib/core/AxiosError.js
15603
- function AxiosError(message, code, config, request, response) {
15604
- Error.call(this);
15605
- if (Error.captureStackTrace) {
15606
- Error.captureStackTrace(this, this.constructor);
15607
- } else {
15608
- this.stack = new Error().stack;
15654
+ var AxiosError = class _AxiosError extends Error {
15655
+ static from(error, code, config, request, response, customProps) {
15656
+ const axiosError = new _AxiosError(error.message, code || error.code, config, request, response);
15657
+ axiosError.cause = error;
15658
+ axiosError.name = error.name;
15659
+ if (error.status != null && axiosError.status == null) {
15660
+ axiosError.status = error.status;
15661
+ }
15662
+ customProps && Object.assign(axiosError, customProps);
15663
+ return axiosError;
15609
15664
  }
15610
- this.message = message;
15611
- this.name = "AxiosError";
15612
- code && (this.code = code);
15613
- config && (this.config = config);
15614
- request && (this.request = request);
15615
- if (response) {
15616
- this.response = response;
15617
- this.status = response.status ? response.status : null;
15665
+ /**
15666
+ * Create an Error with the specified message, config, error code, request and response.
15667
+ *
15668
+ * @param {string} message The error message.
15669
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
15670
+ * @param {Object} [config] The config.
15671
+ * @param {Object} [request] The request.
15672
+ * @param {Object} [response] The response.
15673
+ *
15674
+ * @returns {Error} The created error.
15675
+ */
15676
+ constructor(message, code, config, request, response) {
15677
+ super(message);
15678
+ Object.defineProperty(this, "message", {
15679
+ value: message,
15680
+ enumerable: true,
15681
+ writable: true,
15682
+ configurable: true
15683
+ });
15684
+ this.name = "AxiosError";
15685
+ this.isAxiosError = true;
15686
+ code && (this.code = code);
15687
+ config && (this.config = config);
15688
+ request && (this.request = request);
15689
+ if (response) {
15690
+ this.response = response;
15691
+ this.status = response.status;
15692
+ }
15618
15693
  }
15619
- }
15620
- utils_default.inherits(AxiosError, Error, {
15621
- toJSON: function toJSON() {
15694
+ toJSON() {
15622
15695
  return {
15623
15696
  // Standard
15624
15697
  message: this.message,
@@ -15637,45 +15710,19 @@ utils_default.inherits(AxiosError, Error, {
15637
15710
  status: this.status
15638
15711
  };
15639
15712
  }
15640
- });
15641
- var prototype = AxiosError.prototype;
15642
- var descriptors = {};
15643
- [
15644
- "ERR_BAD_OPTION_VALUE",
15645
- "ERR_BAD_OPTION",
15646
- "ECONNABORTED",
15647
- "ETIMEDOUT",
15648
- "ERR_NETWORK",
15649
- "ERR_FR_TOO_MANY_REDIRECTS",
15650
- "ERR_DEPRECATED",
15651
- "ERR_BAD_RESPONSE",
15652
- "ERR_BAD_REQUEST",
15653
- "ERR_CANCELED",
15654
- "ERR_NOT_SUPPORT",
15655
- "ERR_INVALID_URL"
15656
- // eslint-disable-next-line func-names
15657
- ].forEach((code) => {
15658
- descriptors[code] = { value: code };
15659
- });
15660
- Object.defineProperties(AxiosError, descriptors);
15661
- Object.defineProperty(prototype, "isAxiosError", { value: true });
15662
- AxiosError.from = (error, code, config, request, response, customProps) => {
15663
- const axiosError = Object.create(prototype);
15664
- utils_default.toFlatObject(error, axiosError, function filter2(obj) {
15665
- return obj !== Error.prototype;
15666
- }, (prop) => {
15667
- return prop !== "isAxiosError";
15668
- });
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";
15676
- customProps && Object.assign(axiosError, customProps);
15677
- return axiosError;
15678
15713
  };
15714
+ AxiosError.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
15715
+ AxiosError.ERR_BAD_OPTION = "ERR_BAD_OPTION";
15716
+ AxiosError.ECONNABORTED = "ECONNABORTED";
15717
+ AxiosError.ETIMEDOUT = "ETIMEDOUT";
15718
+ AxiosError.ERR_NETWORK = "ERR_NETWORK";
15719
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
15720
+ AxiosError.ERR_DEPRECATED = "ERR_DEPRECATED";
15721
+ AxiosError.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
15722
+ AxiosError.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
15723
+ AxiosError.ERR_CANCELED = "ERR_CANCELED";
15724
+ AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
15725
+ AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
15679
15726
  var AxiosError_default = AxiosError;
15680
15727
 
15681
15728
  // node_modules/axios/lib/platform/node/classes/FormData.js
@@ -15707,13 +15754,18 @@ function toFormData(obj, formData, options) {
15707
15754
  throw new TypeError("target must be an object");
15708
15755
  }
15709
15756
  formData = formData || new (FormData_default || FormData)();
15710
- options = utils_default.toFlatObject(options, {
15711
- metaTokens: true,
15712
- dots: false,
15713
- indexes: false
15714
- }, false, function defined(option, source) {
15715
- return !utils_default.isUndefined(source[option]);
15716
- });
15757
+ options = utils_default.toFlatObject(
15758
+ options,
15759
+ {
15760
+ metaTokens: true,
15761
+ dots: false,
15762
+ indexes: false
15763
+ },
15764
+ false,
15765
+ function defined(option, source) {
15766
+ return !utils_default.isUndefined(source[option]);
15767
+ }
15768
+ );
15717
15769
  const metaTokens = options.metaTokens;
15718
15770
  const visitor = options.visitor || defaultVisitor;
15719
15771
  const dots = options.dots;
@@ -15741,6 +15793,10 @@ function toFormData(obj, formData, options) {
15741
15793
  }
15742
15794
  function defaultVisitor(value, key, path2) {
15743
15795
  let arr = value;
15796
+ if (utils_default.isReactNative(formData) && utils_default.isReactNativeBlob(value)) {
15797
+ formData.append(renderKey(path2, key, dots), convertValue(value));
15798
+ return false;
15799
+ }
15744
15800
  if (value && !path2 && typeof value === "object") {
15745
15801
  if (utils_default.endsWith(key, "{}")) {
15746
15802
  key = metaTokens ? key : key.slice(0, -2);
@@ -15776,13 +15832,7 @@ function toFormData(obj, formData, options) {
15776
15832
  }
15777
15833
  stack.push(value);
15778
15834
  utils_default.forEach(value, function each(el, key) {
15779
- const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(
15780
- formData,
15781
- el,
15782
- utils_default.isString(key) ? key.trim() : key,
15783
- path2,
15784
- exposedHelpers
15785
- );
15835
+ const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(formData, el, utils_default.isString(key) ? key.trim() : key, path2, exposedHelpers);
15786
15836
  if (result === true) {
15787
15837
  build(el, path2 ? path2.concat(key) : [key]);
15788
15838
  }
@@ -15816,11 +15866,11 @@ function AxiosURLSearchParams(params, options) {
15816
15866
  this._pairs = [];
15817
15867
  params && toFormData_default(params, this, options);
15818
15868
  }
15819
- var prototype2 = AxiosURLSearchParams.prototype;
15820
- prototype2.append = function append(name, value) {
15869
+ var prototype = AxiosURLSearchParams.prototype;
15870
+ prototype.append = function append(name, value) {
15821
15871
  this._pairs.push([name, value]);
15822
15872
  };
15823
- prototype2.toString = function toString3(encoder) {
15873
+ prototype.toString = function toString3(encoder) {
15824
15874
  const _encode = encoder ? function(value) {
15825
15875
  return encoder.call(this, value, encode);
15826
15876
  } : encode;
@@ -15839,17 +15889,15 @@ function buildURL(url2, params, options) {
15839
15889
  return url2;
15840
15890
  }
15841
15891
  const _encode = options && options.encode || encode2;
15842
- if (utils_default.isFunction(options)) {
15843
- options = {
15844
- serialize: options
15845
- };
15846
- }
15847
- const serializeFn = options && options.serialize;
15892
+ const _options = utils_default.isFunction(options) ? {
15893
+ serialize: options
15894
+ } : options;
15895
+ const serializeFn = _options && _options.serialize;
15848
15896
  let serializedParams;
15849
15897
  if (serializeFn) {
15850
- serializedParams = serializeFn(params, options);
15898
+ serializedParams = serializeFn(params, _options);
15851
15899
  } else {
15852
- serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode);
15900
+ serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, _options).toString(_encode);
15853
15901
  }
15854
15902
  if (serializedParams) {
15855
15903
  const hashmarkIndex = url2.indexOf("#");
@@ -15871,6 +15919,7 @@ var InterceptorManager = class {
15871
15919
  *
15872
15920
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
15873
15921
  * @param {Function} rejected The function to handle `reject` for a `Promise`
15922
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
15874
15923
  *
15875
15924
  * @return {Number} An ID used to remove interceptor later
15876
15925
  */
@@ -15929,7 +15978,8 @@ var InterceptorManager_default = InterceptorManager;
15929
15978
  var transitional_default = {
15930
15979
  silentJSONParsing: true,
15931
15980
  forcedJSONParsing: true,
15932
- clarifyTimeoutError: false
15981
+ clarifyTimeoutError: false,
15982
+ legacyInterceptorReqResOrdering: true
15933
15983
  };
15934
15984
 
15935
15985
  // node_modules/axios/lib/platform/node/index.js
@@ -16077,70 +16127,74 @@ function stringifySafely(rawValue, parser2, encoder) {
16077
16127
  var defaults = {
16078
16128
  transitional: transitional_default,
16079
16129
  adapter: ["xhr", "http", "fetch"],
16080
- transformRequest: [function transformRequest(data, headers) {
16081
- const contentType = headers.getContentType() || "";
16082
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
16083
- const isObjectPayload = utils_default.isObject(data);
16084
- if (isObjectPayload && utils_default.isHTMLForm(data)) {
16085
- data = new FormData(data);
16086
- }
16087
- const isFormData2 = utils_default.isFormData(data);
16088
- if (isFormData2) {
16089
- return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
16090
- }
16091
- if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
16092
- return data;
16093
- }
16094
- if (utils_default.isArrayBufferView(data)) {
16095
- return data.buffer;
16096
- }
16097
- if (utils_default.isURLSearchParams(data)) {
16098
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
16099
- return data.toString();
16100
- }
16101
- let isFileList2;
16102
- if (isObjectPayload) {
16103
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
16104
- return toURLEncodedForm(data, this.formSerializer).toString();
16130
+ transformRequest: [
16131
+ function transformRequest(data, headers) {
16132
+ const contentType = headers.getContentType() || "";
16133
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
16134
+ const isObjectPayload = utils_default.isObject(data);
16135
+ if (isObjectPayload && utils_default.isHTMLForm(data)) {
16136
+ data = new FormData(data);
16137
+ }
16138
+ const isFormData2 = utils_default.isFormData(data);
16139
+ if (isFormData2) {
16140
+ return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
16141
+ }
16142
+ if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data) || utils_default.isReadableStream(data)) {
16143
+ return data;
16144
+ }
16145
+ if (utils_default.isArrayBufferView(data)) {
16146
+ return data.buffer;
16147
+ }
16148
+ if (utils_default.isURLSearchParams(data)) {
16149
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
16150
+ return data.toString();
16151
+ }
16152
+ let isFileList2;
16153
+ if (isObjectPayload) {
16154
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
16155
+ return toURLEncodedForm(data, this.formSerializer).toString();
16156
+ }
16157
+ if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
16158
+ const _FormData = this.env && this.env.FormData;
16159
+ return toFormData_default(
16160
+ isFileList2 ? { "files[]": data } : data,
16161
+ _FormData && new _FormData(),
16162
+ this.formSerializer
16163
+ );
16164
+ }
16105
16165
  }
16106
- if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
16107
- const _FormData = this.env && this.env.FormData;
16108
- return toFormData_default(
16109
- isFileList2 ? { "files[]": data } : data,
16110
- _FormData && new _FormData(),
16111
- this.formSerializer
16112
- );
16166
+ if (isObjectPayload || hasJSONContentType) {
16167
+ headers.setContentType("application/json", false);
16168
+ return stringifySafely(data);
16113
16169
  }
16114
- }
16115
- if (isObjectPayload || hasJSONContentType) {
16116
- headers.setContentType("application/json", false);
16117
- return stringifySafely(data);
16118
- }
16119
- return data;
16120
- }],
16121
- transformResponse: [function transformResponse(data) {
16122
- const transitional2 = this.transitional || defaults.transitional;
16123
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
16124
- const JSONRequested = this.responseType === "json";
16125
- if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
16126
16170
  return data;
16127
16171
  }
16128
- if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
16129
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
16130
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
16131
- try {
16132
- return JSON.parse(data, this.parseReviver);
16133
- } catch (e) {
16134
- if (strictJSONParsing) {
16135
- if (e.name === "SyntaxError") {
16136
- throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
16172
+ ],
16173
+ transformResponse: [
16174
+ function transformResponse(data) {
16175
+ const transitional2 = this.transitional || defaults.transitional;
16176
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
16177
+ const JSONRequested = this.responseType === "json";
16178
+ if (utils_default.isResponse(data) || utils_default.isReadableStream(data)) {
16179
+ return data;
16180
+ }
16181
+ if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
16182
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
16183
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
16184
+ try {
16185
+ return JSON.parse(data, this.parseReviver);
16186
+ } catch (e) {
16187
+ if (strictJSONParsing) {
16188
+ if (e.name === "SyntaxError") {
16189
+ throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
16190
+ }
16191
+ throw e;
16137
16192
  }
16138
- throw e;
16139
16193
  }
16140
16194
  }
16195
+ return data;
16141
16196
  }
16142
- return data;
16143
- }],
16197
+ ],
16144
16198
  /**
16145
16199
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
16146
16200
  * timeout is not created.
@@ -16159,7 +16213,7 @@ var defaults = {
16159
16213
  },
16160
16214
  headers: {
16161
16215
  common: {
16162
- "Accept": "application/json, text/plain, */*",
16216
+ Accept: "application/json, text/plain, */*",
16163
16217
  "Content-Type": void 0
16164
16218
  }
16165
16219
  }
@@ -16418,11 +16472,11 @@ var AxiosHeaders = class {
16418
16472
  accessors: {}
16419
16473
  };
16420
16474
  const accessors = internals.accessors;
16421
- const prototype3 = this.prototype;
16475
+ const prototype2 = this.prototype;
16422
16476
  function defineAccessor(_header) {
16423
16477
  const lHeader = normalizeHeader(_header);
16424
16478
  if (!accessors[lHeader]) {
16425
- buildAccessors(prototype3, _header);
16479
+ buildAccessors(prototype2, _header);
16426
16480
  accessors[lHeader] = true;
16427
16481
  }
16428
16482
  }
@@ -16430,7 +16484,14 @@ var AxiosHeaders = class {
16430
16484
  return this;
16431
16485
  }
16432
16486
  };
16433
- AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
16487
+ AxiosHeaders.accessor([
16488
+ "Content-Type",
16489
+ "Content-Length",
16490
+ "Accept",
16491
+ "Accept-Encoding",
16492
+ "User-Agent",
16493
+ "Authorization"
16494
+ ]);
16434
16495
  utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
16435
16496
  let mapped = key[0].toUpperCase() + key.slice(1);
16436
16497
  return {
@@ -16462,13 +16523,22 @@ function isCancel(value) {
16462
16523
  }
16463
16524
 
16464
16525
  // node_modules/axios/lib/cancel/CanceledError.js
16465
- function CanceledError(message, config, request) {
16466
- AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
16467
- this.name = "CanceledError";
16468
- }
16469
- utils_default.inherits(CanceledError, AxiosError_default, {
16470
- __CANCEL__: true
16471
- });
16526
+ var CanceledError = class extends AxiosError_default {
16527
+ /**
16528
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
16529
+ *
16530
+ * @param {string=} message The message.
16531
+ * @param {Object=} config The config.
16532
+ * @param {Object=} request The request.
16533
+ *
16534
+ * @returns {CanceledError} The created error.
16535
+ */
16536
+ constructor(message, config, request) {
16537
+ super(message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
16538
+ this.name = "CanceledError";
16539
+ this.__CANCEL__ = true;
16540
+ }
16541
+ };
16472
16542
  var CanceledError_default = CanceledError;
16473
16543
 
16474
16544
  // node_modules/axios/lib/core/settle.js
@@ -16477,18 +16547,23 @@ function settle(resolve6, reject, response) {
16477
16547
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
16478
16548
  resolve6(response);
16479
16549
  } else {
16480
- reject(new AxiosError_default(
16481
- "Request failed with status code " + response.status,
16482
- [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
16483
- response.config,
16484
- response.request,
16485
- response
16486
- ));
16550
+ reject(
16551
+ new AxiosError_default(
16552
+ "Request failed with status code " + response.status,
16553
+ [AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
16554
+ response.config,
16555
+ response.request,
16556
+ response
16557
+ )
16558
+ );
16487
16559
  }
16488
16560
  }
16489
16561
 
16490
16562
  // node_modules/axios/lib/helpers/isAbsoluteURL.js
16491
16563
  function isAbsoluteURL(url2) {
16564
+ if (typeof url2 !== "string") {
16565
+ return false;
16566
+ }
16492
16567
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
16493
16568
  }
16494
16569
 
@@ -16516,7 +16591,7 @@ import util2 from "util";
16516
16591
  import zlib from "zlib";
16517
16592
 
16518
16593
  // node_modules/axios/lib/env/data.js
16519
- var VERSION = "1.13.2";
16594
+ var VERSION = "1.13.6";
16520
16595
 
16521
16596
  // node_modules/axios/lib/helpers/parseProtocol.js
16522
16597
  function parseProtocol(url2) {
@@ -16561,16 +16636,21 @@ import stream from "stream";
16561
16636
  var kInternals = Symbol("internals");
16562
16637
  var AxiosTransformStream = class extends stream.Transform {
16563
16638
  constructor(options) {
16564
- options = utils_default.toFlatObject(options, {
16565
- maxRate: 0,
16566
- chunkSize: 64 * 1024,
16567
- minChunkSize: 100,
16568
- timeWindow: 500,
16569
- ticksRate: 2,
16570
- samplesCount: 15
16571
- }, null, (prop, source) => {
16572
- return !utils_default.isUndefined(source[prop]);
16573
- });
16639
+ options = utils_default.toFlatObject(
16640
+ options,
16641
+ {
16642
+ maxRate: 0,
16643
+ chunkSize: 64 * 1024,
16644
+ minChunkSize: 100,
16645
+ timeWindow: 500,
16646
+ ticksRate: 2,
16647
+ samplesCount: 15
16648
+ },
16649
+ null,
16650
+ (prop, source) => {
16651
+ return !utils_default.isUndefined(source[prop]);
16652
+ }
16653
+ );
16574
16654
  super({
16575
16655
  readableHighWaterMark: options.chunkSize
16576
16656
  });
@@ -16653,9 +16733,12 @@ var AxiosTransformStream = class extends stream.Transform {
16653
16733
  chunkRemainder = _chunk.subarray(maxChunkSize);
16654
16734
  _chunk = _chunk.subarray(0, maxChunkSize);
16655
16735
  }
16656
- pushChunk(_chunk, chunkRemainder ? () => {
16657
- process.nextTick(_callback, null, chunkRemainder);
16658
- } : _callback);
16736
+ pushChunk(
16737
+ _chunk,
16738
+ chunkRemainder ? () => {
16739
+ process.nextTick(_callback, null, chunkRemainder);
16740
+ } : _callback
16741
+ );
16659
16742
  };
16660
16743
  transformChunk(chunk, function transformNextChunk(err, _chunk) {
16661
16744
  if (err) {
@@ -16726,11 +16809,14 @@ var FormDataPart = class {
16726
16809
  yield CRLF_BYTES;
16727
16810
  }
16728
16811
  static escapeName(name) {
16729
- return String(name).replace(/[\r\n"]/g, (match) => ({
16730
- "\r": "%0D",
16731
- "\n": "%0A",
16732
- '"': "%22"
16733
- })[match]);
16812
+ return String(name).replace(
16813
+ /[\r\n"]/g,
16814
+ (match) => ({
16815
+ "\r": "%0D",
16816
+ "\n": "%0A",
16817
+ '"': "%22"
16818
+ })[match]
16819
+ );
16734
16820
  }
16735
16821
  };
16736
16822
  var formDataToStream = (form, headersHandler, options) => {
@@ -16762,13 +16848,15 @@ var formDataToStream = (form, headersHandler, options) => {
16762
16848
  computedHeaders["Content-Length"] = contentLength;
16763
16849
  }
16764
16850
  headersHandler && headersHandler(computedHeaders);
16765
- return Readable.from(async function* () {
16766
- for (const part of parts) {
16767
- yield boundaryBytes;
16768
- yield* part.encode();
16769
- }
16770
- yield footerBytes;
16771
- }());
16851
+ return Readable.from(
16852
+ async function* () {
16853
+ for (const part of parts) {
16854
+ yield boundaryBytes;
16855
+ yield* part.encode();
16856
+ }
16857
+ yield footerBytes;
16858
+ }()
16859
+ );
16772
16860
  };
16773
16861
  var formDataToStream_default = formDataToStream;
16774
16862
 
@@ -16907,11 +16995,14 @@ var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
16907
16995
  };
16908
16996
  var progressEventDecorator = (total, throttled) => {
16909
16997
  const lengthComputable = total != null;
16910
- return [(loaded) => throttled[0]({
16911
- lengthComputable,
16912
- total,
16913
- loaded
16914
- }), throttled[1]];
16998
+ return [
16999
+ (loaded) => throttled[0]({
17000
+ lengthComputable,
17001
+ total,
17002
+ loaded
17003
+ }),
17004
+ throttled[1]
17005
+ ];
16915
17006
  };
16916
17007
  var asyncDecorator = (fn) => (...args) => utils_default.asap(() => fn(...args));
16917
17008
 
@@ -16990,9 +17081,12 @@ var Http2Sessions = class {
16990
17081
  this.sessions = /* @__PURE__ */ Object.create(null);
16991
17082
  }
16992
17083
  getSession(authority, options) {
16993
- options = Object.assign({
16994
- sessionTimeout: 1e3
16995
- }, options);
17084
+ options = Object.assign(
17085
+ {
17086
+ sessionTimeout: 1e3
17087
+ },
17088
+ options
17089
+ );
16996
17090
  let authoritySessions = this.sessions[authority];
16997
17091
  if (authoritySessions) {
16998
17092
  let len = authoritySessions.length;
@@ -17046,10 +17140,7 @@ var Http2Sessions = class {
17046
17140
  };
17047
17141
  }
17048
17142
  session.once("close", removeSession);
17049
- let entry = [
17050
- session,
17051
- options
17052
- ];
17143
+ let entry = [session, options];
17053
17144
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
17054
17145
  return session;
17055
17146
  }
@@ -17076,8 +17167,11 @@ function setProxy(options, configProxy, location) {
17076
17167
  proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
17077
17168
  }
17078
17169
  if (proxy.auth) {
17079
- if (proxy.auth.username || proxy.auth.password) {
17170
+ const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
17171
+ if (validProxyAuth) {
17080
17172
  proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
17173
+ } else if (typeof proxy.auth === "object") {
17174
+ throw new AxiosError_default("Invalid proxy authorization", AxiosError_default.ERR_BAD_OPTION, { proxy });
17081
17175
  }
17082
17176
  const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
17083
17177
  options.headers["Proxy-Authorization"] = "Basic " + base64;
@@ -17129,15 +17223,10 @@ var resolveFamily = ({ address, family }) => {
17129
17223
  var buildAddressEntry = (address, family) => resolveFamily(utils_default.isObject(address) ? address : { address, family });
17130
17224
  var http2Transport = {
17131
17225
  request(options, cb) {
17132
- const authority = options.protocol + "//" + options.hostname + ":" + (options.port || 80);
17226
+ const authority = options.protocol + "//" + options.hostname + ":" + (options.port || (options.protocol === "https:" ? 443 : 80));
17133
17227
  const { http2Options, headers } = options;
17134
17228
  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;
17229
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } = http2.constants;
17141
17230
  const http2Headers = {
17142
17231
  [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
17143
17232
  [HTTP2_HEADER_METHOD]: options.method,
@@ -17190,7 +17279,10 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17190
17279
  const abortEmitter = new EventEmitter();
17191
17280
  function abort(reason) {
17192
17281
  try {
17193
- abortEmitter.emit("abort", !reason || reason.type ? new CanceledError_default(null, config, req) : reason);
17282
+ abortEmitter.emit(
17283
+ "abort",
17284
+ !reason || reason.type ? new CanceledError_default(null, config, req) : reason
17285
+ );
17194
17286
  } catch (err) {
17195
17287
  console.warn("emit error", err);
17196
17288
  }
@@ -17236,11 +17328,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17236
17328
  const dataUrl = String(config.url || fullPath || "");
17237
17329
  const estimated = estimateDataURLDecodedBytes(dataUrl);
17238
17330
  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
- ));
17331
+ return reject(
17332
+ new AxiosError_default(
17333
+ "maxContentLength size of " + config.maxContentLength + " exceeded",
17334
+ AxiosError_default.ERR_BAD_RESPONSE,
17335
+ config
17336
+ )
17337
+ );
17244
17338
  }
17245
17339
  }
17246
17340
  let convertedData;
@@ -17276,11 +17370,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17276
17370
  });
17277
17371
  }
17278
17372
  if (supportedProtocols.indexOf(protocol) === -1) {
17279
- return reject(new AxiosError_default(
17280
- "Unsupported protocol " + protocol,
17281
- AxiosError_default.ERR_BAD_REQUEST,
17282
- config
17283
- ));
17373
+ return reject(
17374
+ new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_BAD_REQUEST, config)
17375
+ );
17284
17376
  }
17285
17377
  const headers = AxiosHeaders_default.from(config.headers).normalize();
17286
17378
  headers.set("User-Agent", "axios/" + VERSION, false);
@@ -17290,12 +17382,16 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17290
17382
  let maxDownloadRate = void 0;
17291
17383
  if (utils_default.isSpecCompliantForm(data)) {
17292
17384
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
17293
- data = formDataToStream_default(data, (formHeaders) => {
17294
- headers.set(formHeaders);
17295
- }, {
17296
- tag: `axios-${VERSION}-boundary`,
17297
- boundary: userBoundary && userBoundary[1] || void 0
17298
- });
17385
+ data = formDataToStream_default(
17386
+ data,
17387
+ (formHeaders) => {
17388
+ headers.set(formHeaders);
17389
+ },
17390
+ {
17391
+ tag: `axios-${VERSION}-boundary`,
17392
+ boundary: userBoundary && userBoundary[1] || void 0
17393
+ }
17394
+ );
17299
17395
  } else if (utils_default.isFormData(data) && utils_default.isFunction(data.getHeaders)) {
17300
17396
  headers.set(data.getHeaders());
17301
17397
  if (!headers.hasContentLength()) {
@@ -17316,19 +17412,23 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17316
17412
  } else if (utils_default.isString(data)) {
17317
17413
  data = Buffer.from(data, "utf-8");
17318
17414
  } else {
17319
- return reject(new AxiosError_default(
17320
- "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
17321
- AxiosError_default.ERR_BAD_REQUEST,
17322
- config
17323
- ));
17415
+ return reject(
17416
+ new AxiosError_default(
17417
+ "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
17418
+ AxiosError_default.ERR_BAD_REQUEST,
17419
+ config
17420
+ )
17421
+ );
17324
17422
  }
17325
17423
  headers.setContentLength(data.length, false);
17326
17424
  if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
17327
- return reject(new AxiosError_default(
17328
- "Request body larger than maxBodyLength limit",
17329
- AxiosError_default.ERR_BAD_REQUEST,
17330
- config
17331
- ));
17425
+ return reject(
17426
+ new AxiosError_default(
17427
+ "Request body larger than maxBodyLength limit",
17428
+ AxiosError_default.ERR_BAD_REQUEST,
17429
+ config
17430
+ )
17431
+ );
17332
17432
  }
17333
17433
  }
17334
17434
  const contentLength = utils_default.toFiniteNumber(headers.getContentLength());
@@ -17342,16 +17442,25 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17342
17442
  if (!utils_default.isStream(data)) {
17343
17443
  data = stream3.Readable.from(data, { objectMode: false });
17344
17444
  }
17345
- data = stream3.pipeline([data, new AxiosTransformStream_default({
17346
- maxRate: utils_default.toFiniteNumber(maxUploadRate)
17347
- })], utils_default.noop);
17348
- onUploadProgress && data.on("progress", flushOnFinish(
17349
- data,
17350
- progressEventDecorator(
17351
- contentLength,
17352
- progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
17445
+ data = stream3.pipeline(
17446
+ [
17447
+ data,
17448
+ new AxiosTransformStream_default({
17449
+ maxRate: utils_default.toFiniteNumber(maxUploadRate)
17450
+ })
17451
+ ],
17452
+ utils_default.noop
17453
+ );
17454
+ onUploadProgress && data.on(
17455
+ "progress",
17456
+ flushOnFinish(
17457
+ data,
17458
+ progressEventDecorator(
17459
+ contentLength,
17460
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
17461
+ )
17353
17462
  )
17354
- ));
17463
+ );
17355
17464
  }
17356
17465
  let auth = void 0;
17357
17466
  if (config.auth) {
@@ -17402,7 +17511,11 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17402
17511
  } else {
17403
17512
  options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
17404
17513
  options.port = parsed.port;
17405
- setProxy(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
17514
+ setProxy(
17515
+ options,
17516
+ config.proxy,
17517
+ protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path
17518
+ );
17406
17519
  }
17407
17520
  let transport;
17408
17521
  const isHttpsRequest = isHttps.test(options.protocol);
@@ -17440,13 +17553,16 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17440
17553
  const transformStream = new AxiosTransformStream_default({
17441
17554
  maxRate: utils_default.toFiniteNumber(maxDownloadRate)
17442
17555
  });
17443
- onDownloadProgress && transformStream.on("progress", flushOnFinish(
17444
- transformStream,
17445
- progressEventDecorator(
17446
- responseLength,
17447
- progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
17556
+ onDownloadProgress && transformStream.on(
17557
+ "progress",
17558
+ flushOnFinish(
17559
+ transformStream,
17560
+ progressEventDecorator(
17561
+ responseLength,
17562
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
17563
+ )
17448
17564
  )
17449
- ));
17565
+ );
17450
17566
  streams.push(transformStream);
17451
17567
  }
17452
17568
  let responseStream = res;
@@ -17496,12 +17612,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17496
17612
  if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
17497
17613
  rejected = true;
17498
17614
  responseStream.destroy();
17499
- abort(new AxiosError_default(
17500
- "maxContentLength size of " + config.maxContentLength + " exceeded",
17501
- AxiosError_default.ERR_BAD_RESPONSE,
17502
- config,
17503
- lastRequest
17504
- ));
17615
+ abort(
17616
+ new AxiosError_default(
17617
+ "maxContentLength size of " + config.maxContentLength + " exceeded",
17618
+ AxiosError_default.ERR_BAD_RESPONSE,
17619
+ config,
17620
+ lastRequest
17621
+ )
17622
+ );
17505
17623
  }
17506
17624
  });
17507
17625
  responseStream.on("aborted", function handlerStreamAborted() {
@@ -17560,12 +17678,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17560
17678
  if (config.timeout) {
17561
17679
  const timeout = parseInt(config.timeout, 10);
17562
17680
  if (Number.isNaN(timeout)) {
17563
- abort(new AxiosError_default(
17564
- "error trying to parse `config.timeout` to int",
17565
- AxiosError_default.ERR_BAD_OPTION_VALUE,
17566
- config,
17567
- req
17568
- ));
17681
+ abort(
17682
+ new AxiosError_default(
17683
+ "error trying to parse `config.timeout` to int",
17684
+ AxiosError_default.ERR_BAD_OPTION_VALUE,
17685
+ config,
17686
+ req
17687
+ )
17688
+ );
17569
17689
  return;
17570
17690
  }
17571
17691
  req.setTimeout(timeout, function handleRequestTimeout() {
@@ -17575,12 +17695,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
17575
17695
  if (config.timeoutErrorMessage) {
17576
17696
  timeoutErrorMessage = config.timeoutErrorMessage;
17577
17697
  }
17578
- abort(new AxiosError_default(
17579
- timeoutErrorMessage,
17580
- transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
17581
- config,
17582
- req
17583
- ));
17698
+ abort(
17699
+ new AxiosError_default(
17700
+ timeoutErrorMessage,
17701
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
17702
+ config,
17703
+ req
17704
+ )
17705
+ );
17584
17706
  });
17585
17707
  } else {
17586
17708
  req.setTimeout(0);
@@ -17736,7 +17858,8 @@ function mergeConfig(config1, config2) {
17736
17858
  headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
17737
17859
  };
17738
17860
  utils_default.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
17739
- const merge3 = mergeMap[prop] || mergeDeepProperties;
17861
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
17862
+ const merge3 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
17740
17863
  const configValue = merge3(config1[prop], config2[prop], prop);
17741
17864
  utils_default.isUndefined(configValue) && merge3 !== mergeDirectKeys || (config[prop] = configValue);
17742
17865
  });
@@ -17748,11 +17871,17 @@ var resolveConfig_default = (config) => {
17748
17871
  const newConfig = mergeConfig({}, config);
17749
17872
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
17750
17873
  newConfig.headers = headers = AxiosHeaders_default.from(headers);
17751
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
17874
+ newConfig.url = buildURL(
17875
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
17876
+ config.params,
17877
+ config.paramsSerializer
17878
+ );
17752
17879
  if (auth) {
17753
17880
  headers.set(
17754
17881
  "Authorization",
17755
- "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
17882
+ "Basic " + btoa(
17883
+ (auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : "")
17884
+ )
17756
17885
  );
17757
17886
  }
17758
17887
  if (utils_default.isFormData(data)) {
@@ -17816,13 +17945,17 @@ var xhr_default = isXHRAdapterSupported && function(config) {
17816
17945
  config,
17817
17946
  request
17818
17947
  };
17819
- settle(function _resolve(value) {
17820
- resolve6(value);
17821
- done();
17822
- }, function _reject(err) {
17823
- reject(err);
17824
- done();
17825
- }, response);
17948
+ settle(
17949
+ function _resolve(value) {
17950
+ resolve6(value);
17951
+ done();
17952
+ },
17953
+ function _reject(err) {
17954
+ reject(err);
17955
+ done();
17956
+ },
17957
+ response
17958
+ );
17826
17959
  request = null;
17827
17960
  }
17828
17961
  if ("onloadend" in request) {
@@ -17858,12 +17991,14 @@ var xhr_default = isXHRAdapterSupported && function(config) {
17858
17991
  if (_config.timeoutErrorMessage) {
17859
17992
  timeoutErrorMessage = _config.timeoutErrorMessage;
17860
17993
  }
17861
- reject(new AxiosError_default(
17862
- timeoutErrorMessage,
17863
- transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
17864
- config,
17865
- request
17866
- ));
17994
+ reject(
17995
+ new AxiosError_default(
17996
+ timeoutErrorMessage,
17997
+ transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
17998
+ config,
17999
+ request
18000
+ )
18001
+ );
17867
18002
  request = null;
17868
18003
  };
17869
18004
  requestData === void 0 && requestHeaders.setContentType(null);
@@ -17903,7 +18038,13 @@ var xhr_default = isXHRAdapterSupported && function(config) {
17903
18038
  }
17904
18039
  const protocol = parseProtocol(_config.url);
17905
18040
  if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
17906
- reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config));
18041
+ reject(
18042
+ new AxiosError_default(
18043
+ "Unsupported protocol " + protocol + ":",
18044
+ AxiosError_default.ERR_BAD_REQUEST,
18045
+ config
18046
+ )
18047
+ );
17907
18048
  return;
17908
18049
  }
17909
18050
  request.send(requestData || null);
@@ -17921,12 +18062,14 @@ var composeSignals = (signals, timeout) => {
17921
18062
  aborted = true;
17922
18063
  unsubscribe();
17923
18064
  const err = reason instanceof Error ? reason : this.reason;
17924
- controller.abort(err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err));
18065
+ controller.abort(
18066
+ err instanceof AxiosError_default ? err : new CanceledError_default(err instanceof Error ? err.message : err)
18067
+ );
17925
18068
  }
17926
18069
  };
17927
18070
  let timer = timeout && setTimeout(() => {
17928
18071
  timer = null;
17929
- onabort(new AxiosError_default(`timeout ${timeout} of ms exceeded`, AxiosError_default.ETIMEDOUT));
18072
+ onabort(new AxiosError_default(`timeout of ${timeout}ms exceeded`, AxiosError_default.ETIMEDOUT));
17930
18073
  }, timeout);
17931
18074
  const unsubscribe = () => {
17932
18075
  if (signals) {
@@ -17994,33 +18137,36 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
17994
18137
  onFinish && onFinish(e);
17995
18138
  }
17996
18139
  };
17997
- return new ReadableStream({
17998
- async pull(controller) {
17999
- try {
18000
- const { done: done2, value } = await iterator2.next();
18001
- if (done2) {
18002
- _onFinish();
18003
- controller.close();
18004
- return;
18005
- }
18006
- let len = value.byteLength;
18007
- if (onProgress) {
18008
- let loadedBytes = bytes += len;
18009
- onProgress(loadedBytes);
18140
+ return new ReadableStream(
18141
+ {
18142
+ async pull(controller) {
18143
+ try {
18144
+ const { done: done2, value } = await iterator2.next();
18145
+ if (done2) {
18146
+ _onFinish();
18147
+ controller.close();
18148
+ return;
18149
+ }
18150
+ let len = value.byteLength;
18151
+ if (onProgress) {
18152
+ let loadedBytes = bytes += len;
18153
+ onProgress(loadedBytes);
18154
+ }
18155
+ controller.enqueue(new Uint8Array(value));
18156
+ } catch (err) {
18157
+ _onFinish(err);
18158
+ throw err;
18010
18159
  }
18011
- controller.enqueue(new Uint8Array(value));
18012
- } catch (err) {
18013
- _onFinish(err);
18014
- throw err;
18160
+ },
18161
+ cancel(reason) {
18162
+ _onFinish(reason);
18163
+ return iterator2.return();
18015
18164
  }
18016
18165
  },
18017
- cancel(reason) {
18018
- _onFinish(reason);
18019
- return iterator2.return();
18166
+ {
18167
+ highWaterMark: 2
18020
18168
  }
18021
- }, {
18022
- highWaterMark: 2
18023
- });
18169
+ );
18024
18170
  };
18025
18171
 
18026
18172
  // node_modules/axios/lib/adapters/fetch.js
@@ -18030,10 +18176,7 @@ var globalFetchAPI = (({ Request, Response }) => ({
18030
18176
  Request,
18031
18177
  Response
18032
18178
  }))(utils_default.global);
18033
- var {
18034
- ReadableStream: ReadableStream2,
18035
- TextEncoder: TextEncoder2
18036
- } = utils_default.global;
18179
+ var { ReadableStream: ReadableStream2, TextEncoder: TextEncoder2 } = utils_default.global;
18037
18180
  var test = (fn, ...args) => {
18038
18181
  try {
18039
18182
  return !!fn(...args);
@@ -18042,9 +18185,13 @@ var test = (fn, ...args) => {
18042
18185
  }
18043
18186
  };
18044
18187
  var factory = (env2) => {
18045
- env2 = utils_default.merge.call({
18046
- skipUndefined: true
18047
- }, globalFetchAPI, env2);
18188
+ env2 = utils_default.merge.call(
18189
+ {
18190
+ skipUndefined: true
18191
+ },
18192
+ globalFetchAPI,
18193
+ env2
18194
+ );
18048
18195
  const { fetch: envFetch, Request, Response } = env2;
18049
18196
  const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
18050
18197
  const isRequestSupported = isFunction2(Request);
@@ -18077,7 +18224,11 @@ var factory = (env2) => {
18077
18224
  if (method) {
18078
18225
  return method.call(res);
18079
18226
  }
18080
- throw new AxiosError_default(`Response type '${type2}' is not supported`, AxiosError_default.ERR_NOT_SUPPORT, config);
18227
+ throw new AxiosError_default(
18228
+ `Response type '${type2}' is not supported`,
18229
+ AxiosError_default.ERR_NOT_SUPPORT,
18230
+ config
18231
+ );
18081
18232
  });
18082
18233
  });
18083
18234
  })();
@@ -18126,7 +18277,10 @@ var factory = (env2) => {
18126
18277
  } = resolveConfig_default(config);
18127
18278
  let _fetch = envFetch || fetch;
18128
18279
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
18129
- let composedSignal = composeSignals_default([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
18280
+ let composedSignal = composeSignals_default(
18281
+ [signal, cancelToken && cancelToken.toAbortSignal()],
18282
+ timeout
18283
+ );
18130
18284
  let request = null;
18131
18285
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
18132
18286
  composedSignal.unsubscribe();
@@ -18186,7 +18340,10 @@ var factory = (env2) => {
18186
18340
  );
18187
18341
  }
18188
18342
  responseType = responseType || "text";
18189
- let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
18343
+ let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](
18344
+ response,
18345
+ config
18346
+ );
18190
18347
  !isStreamResponse && unsubscribe && unsubscribe();
18191
18348
  return await new Promise((resolve6, reject) => {
18192
18349
  settle(resolve6, reject, {
@@ -18202,13 +18359,19 @@ var factory = (env2) => {
18202
18359
  unsubscribe && unsubscribe();
18203
18360
  if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
18204
18361
  throw Object.assign(
18205
- new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config, request),
18362
+ new AxiosError_default(
18363
+ "Network Error",
18364
+ AxiosError_default.ERR_NETWORK,
18365
+ config,
18366
+ request,
18367
+ err && err.response
18368
+ ),
18206
18369
  {
18207
18370
  cause: err.cause || err
18208
18371
  }
18209
18372
  );
18210
18373
  }
18211
- throw AxiosError_default.from(err, err && err.code, config, request);
18374
+ throw AxiosError_default.from(err, err && err.code, config, request, err && err.response);
18212
18375
  }
18213
18376
  };
18214
18377
  };
@@ -18216,11 +18379,7 @@ var seedCache = /* @__PURE__ */ new Map();
18216
18379
  var getFetch = (config) => {
18217
18380
  let env2 = config && config.env || {};
18218
18381
  const { fetch: fetch2, Request, Response } = env2;
18219
- const seeds = [
18220
- Request,
18221
- Response,
18222
- fetch2
18223
- ];
18382
+ const seeds = [Request, Response, fetch2];
18224
18383
  let len = seeds.length, i = len, seed, target, map2 = seedCache;
18225
18384
  while (i--) {
18226
18385
  seed = seeds[i];
@@ -18309,37 +18468,33 @@ function throwIfCancellationRequested(config) {
18309
18468
  function dispatchRequest(config) {
18310
18469
  throwIfCancellationRequested(config);
18311
18470
  config.headers = AxiosHeaders_default.from(config.headers);
18312
- config.data = transformData.call(
18313
- config,
18314
- config.transformRequest
18315
- );
18471
+ config.data = transformData.call(config, config.transformRequest);
18316
18472
  if (["post", "put", "patch"].indexOf(config.method) !== -1) {
18317
18473
  config.headers.setContentType("application/x-www-form-urlencoded", false);
18318
18474
  }
18319
18475
  const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
18320
- return adapter2(config).then(function onAdapterResolution(response) {
18321
- throwIfCancellationRequested(config);
18322
- response.data = transformData.call(
18323
- config,
18324
- config.transformResponse,
18325
- response
18326
- );
18327
- response.headers = AxiosHeaders_default.from(response.headers);
18328
- return response;
18329
- }, function onAdapterRejection(reason) {
18330
- if (!isCancel(reason)) {
18476
+ return adapter2(config).then(
18477
+ function onAdapterResolution(response) {
18331
18478
  throwIfCancellationRequested(config);
18332
- if (reason && reason.response) {
18333
- reason.response.data = transformData.call(
18334
- config,
18335
- config.transformResponse,
18336
- reason.response
18337
- );
18338
- reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
18479
+ response.data = transformData.call(config, config.transformResponse, response);
18480
+ response.headers = AxiosHeaders_default.from(response.headers);
18481
+ return response;
18482
+ },
18483
+ function onAdapterRejection(reason) {
18484
+ if (!isCancel(reason)) {
18485
+ throwIfCancellationRequested(config);
18486
+ if (reason && reason.response) {
18487
+ reason.response.data = transformData.call(
18488
+ config,
18489
+ config.transformResponse,
18490
+ reason.response
18491
+ );
18492
+ reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
18493
+ }
18339
18494
  }
18495
+ return Promise.reject(reason);
18340
18496
  }
18341
- return Promise.reject(reason);
18342
- });
18497
+ );
18343
18498
  }
18344
18499
 
18345
18500
  // node_modules/axios/lib/helpers/validator.js
@@ -18392,7 +18547,10 @@ function assertOptions(options, schema2, allowUnknown) {
18392
18547
  const value = options[opt];
18393
18548
  const result = value === void 0 || validator(value, opt, options);
18394
18549
  if (result !== true) {
18395
- throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
18550
+ throw new AxiosError_default(
18551
+ "option " + opt + " must be " + result,
18552
+ AxiosError_default.ERR_BAD_OPTION_VALUE
18553
+ );
18396
18554
  }
18397
18555
  continue;
18398
18556
  }
@@ -18454,11 +18612,16 @@ var Axios = class {
18454
18612
  config = mergeConfig(this.defaults, config);
18455
18613
  const { transitional: transitional2, paramsSerializer, headers } = config;
18456
18614
  if (transitional2 !== void 0) {
18457
- validator_default.assertOptions(transitional2, {
18458
- silentJSONParsing: validators2.transitional(validators2.boolean),
18459
- forcedJSONParsing: validators2.transitional(validators2.boolean),
18460
- clarifyTimeoutError: validators2.transitional(validators2.boolean)
18461
- }, false);
18615
+ validator_default.assertOptions(
18616
+ transitional2,
18617
+ {
18618
+ silentJSONParsing: validators2.transitional(validators2.boolean),
18619
+ forcedJSONParsing: validators2.transitional(validators2.boolean),
18620
+ clarifyTimeoutError: validators2.transitional(validators2.boolean),
18621
+ legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean)
18622
+ },
18623
+ false
18624
+ );
18462
18625
  }
18463
18626
  if (paramsSerializer != null) {
18464
18627
  if (utils_default.isFunction(paramsSerializer)) {
@@ -18466,10 +18629,14 @@ var Axios = class {
18466
18629
  serialize: paramsSerializer
18467
18630
  };
18468
18631
  } else {
18469
- validator_default.assertOptions(paramsSerializer, {
18470
- encode: validators2.function,
18471
- serialize: validators2.function
18472
- }, true);
18632
+ validator_default.assertOptions(
18633
+ paramsSerializer,
18634
+ {
18635
+ encode: validators2.function,
18636
+ serialize: validators2.function
18637
+ },
18638
+ true
18639
+ );
18473
18640
  }
18474
18641
  }
18475
18642
  if (config.allowAbsoluteUrls !== void 0) {
@@ -18478,21 +18645,19 @@ var Axios = class {
18478
18645
  } else {
18479
18646
  config.allowAbsoluteUrls = true;
18480
18647
  }
18481
- validator_default.assertOptions(config, {
18482
- baseUrl: validators2.spelling("baseURL"),
18483
- withXsrfToken: validators2.spelling("withXSRFToken")
18484
- }, true);
18485
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
18486
- let contextHeaders = headers && utils_default.merge(
18487
- headers.common,
18488
- headers[config.method]
18489
- );
18490
- headers && utils_default.forEach(
18491
- ["delete", "get", "head", "post", "put", "patch", "common"],
18492
- (method) => {
18493
- delete headers[method];
18494
- }
18648
+ validator_default.assertOptions(
18649
+ config,
18650
+ {
18651
+ baseUrl: validators2.spelling("baseURL"),
18652
+ withXsrfToken: validators2.spelling("withXSRFToken")
18653
+ },
18654
+ true
18495
18655
  );
18656
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
18657
+ let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
18658
+ headers && utils_default.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
18659
+ delete headers[method];
18660
+ });
18496
18661
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
18497
18662
  const requestInterceptorChain = [];
18498
18663
  let synchronousRequestInterceptors = true;
@@ -18501,7 +18666,13 @@ var Axios = class {
18501
18666
  return;
18502
18667
  }
18503
18668
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
18504
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
18669
+ const transitional3 = config.transitional || transitional_default;
18670
+ const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
18671
+ if (legacyInterceptorReqResOrdering) {
18672
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
18673
+ } else {
18674
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
18675
+ }
18505
18676
  });
18506
18677
  const responseInterceptorChain = [];
18507
18678
  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
@@ -18553,24 +18724,28 @@ var Axios = class {
18553
18724
  };
18554
18725
  utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
18555
18726
  Axios.prototype[method] = function(url2, config) {
18556
- return this.request(mergeConfig(config || {}, {
18557
- method,
18558
- url: url2,
18559
- data: (config || {}).data
18560
- }));
18727
+ return this.request(
18728
+ mergeConfig(config || {}, {
18729
+ method,
18730
+ url: url2,
18731
+ data: (config || {}).data
18732
+ })
18733
+ );
18561
18734
  };
18562
18735
  });
18563
18736
  utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
18564
18737
  function generateHTTPMethod(isForm) {
18565
18738
  return function httpMethod(url2, data, config) {
18566
- return this.request(mergeConfig(config || {}, {
18567
- method,
18568
- headers: isForm ? {
18569
- "Content-Type": "multipart/form-data"
18570
- } : {},
18571
- url: url2,
18572
- data
18573
- }));
18739
+ return this.request(
18740
+ mergeConfig(config || {}, {
18741
+ method,
18742
+ headers: isForm ? {
18743
+ "Content-Type": "multipart/form-data"
18744
+ } : {},
18745
+ url: url2,
18746
+ data
18747
+ })
18748
+ );
18574
18749
  };
18575
18750
  }
18576
18751
  Axios.prototype[method] = generateHTTPMethod();
@@ -18857,6 +19032,8 @@ function isGetLikeMethod(method) {
18857
19032
  var SYSTEM_CONTROLLED_HEADERS = /* @__PURE__ */ new Set([
18858
19033
  "host",
18859
19034
  // Controlled by HTTP client based on URL
19035
+ "content-type",
19036
+ // Set automatically based on OpenAPI spec or defaults
18860
19037
  "content-length",
18861
19038
  // Calculated by HTTP client from body
18862
19039
  "transfer-encoding",
@@ -18886,8 +19063,9 @@ var ApiClient = class {
18886
19063
  * @param baseUrl - Base URL for the API
18887
19064
  * @param authProviderOrHeaders - AuthProvider instance or static headers for backward compatibility
18888
19065
  * @param specLoader - Optional OpenAPI spec loader for dynamic meta-tools
19066
+ * @param options - Optional HTTP client configuration
18889
19067
  */
18890
- constructor(baseUrl, authProviderOrHeaders, specLoader) {
19068
+ constructor(baseUrl, authProviderOrHeaders, specLoader, options) {
18891
19069
  this.axiosInstance = axios_default.create({
18892
19070
  baseURL: baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`,
18893
19071
  timeout: 3e4,
@@ -18896,8 +19074,9 @@ var ApiClient = class {
18896
19074
  // 50MB response body limit
18897
19075
  maxBodyLength: 50 * 1024 * 1024,
18898
19076
  // 50MB request body limit
18899
- maxRedirects: 5
19077
+ maxRedirects: 5,
18900
19078
  // Limit redirect chains to prevent abuse
19079
+ httpsAgent: options?.httpsAgent
18901
19080
  });
18902
19081
  if (!authProviderOrHeaders) {
18903
19082
  this.authProvider = new StaticAuthProvider();
@@ -18933,6 +19112,41 @@ var ApiClient = class {
18933
19112
  getToolDefinition(toolId) {
18934
19113
  return this.toolsMap.get(toolId);
18935
19114
  }
19115
+ resolveRequestBodyObject(requestBody) {
19116
+ if (!requestBody || !("$ref" in requestBody)) {
19117
+ return requestBody;
19118
+ }
19119
+ const refPrefix = "#/components/requestBodies/";
19120
+ if (!requestBody.$ref.startsWith(refPrefix)) {
19121
+ return void 0;
19122
+ }
19123
+ const requestBodyName = requestBody.$ref.slice(refPrefix.length);
19124
+ const resolvedRequestBody = this.openApiSpec?.components?.requestBodies?.[requestBodyName];
19125
+ if (!resolvedRequestBody || "$ref" in resolvedRequestBody) {
19126
+ return void 0;
19127
+ }
19128
+ return resolvedRequestBody;
19129
+ }
19130
+ getRequestContentType(method, path2) {
19131
+ const pathItem = this.openApiSpec?.paths[path2];
19132
+ const normalizedMethod = method.toLowerCase();
19133
+ if (!isValidHttpMethod(normalizedMethod)) {
19134
+ return void 0;
19135
+ }
19136
+ const operation = pathItem?.[normalizedMethod];
19137
+ if (!operation || "$ref" in operation) {
19138
+ return void 0;
19139
+ }
19140
+ const requestBody = this.resolveRequestBodyObject(operation.requestBody);
19141
+ const content = requestBody?.content;
19142
+ if (!content) {
19143
+ return void 0;
19144
+ }
19145
+ if (content["application/json"]) {
19146
+ return "application/json";
19147
+ }
19148
+ return Object.keys(content)[0];
19149
+ }
18936
19150
  /**
18937
19151
  * Execute an API call based on the tool ID and parameters
18938
19152
  *
@@ -19057,6 +19271,8 @@ var ApiClient = class {
19057
19271
  }
19058
19272
  } else {
19059
19273
  config.data = Object.keys(paramsCopy).length > 0 ? paramsCopy : {};
19274
+ const contentType = toolDef?.inputSchema?.["x-content-type"] || "application/json";
19275
+ config.headers["Content-Type"] = contentType;
19060
19276
  }
19061
19277
  const response = await this.axiosInstance(config);
19062
19278
  return response.data;
@@ -19293,12 +19509,13 @@ var ApiClient = class {
19293
19509
  const config = {
19294
19510
  method: method.toLowerCase(),
19295
19511
  url: path2,
19296
- headers: authHeaders
19512
+ headers: { ...authHeaders }
19297
19513
  };
19298
19514
  if (isGetLikeMethod(method)) {
19299
19515
  config.params = this.processQueryParams(params);
19300
19516
  } else {
19301
19517
  config.data = params;
19518
+ config.headers["Content-Type"] = this.getRequestContentType(method, path2) || "application/json";
19302
19519
  }
19303
19520
  try {
19304
19521
  const response = await this.axiosInstance.request(config);
@@ -19574,19 +19791,60 @@ var OpenAPIServer = class {
19574
19791
  if (this.resourcesManager) {
19575
19792
  capabilities.resources = {};
19576
19793
  }
19577
- this.server = new Server(
19578
- { name: config.name, version: config.version },
19579
- { capabilities }
19580
- );
19794
+ this.server = new Server({ name: config.name, version: config.version }, { capabilities });
19581
19795
  this.toolsManager = new ToolsManager(config);
19582
19796
  const authProviderOrHeaders = config.authProvider || new StaticAuthProvider(config.headers);
19583
- this.apiClient = new ApiClient(
19797
+ const apiClientOptions = this.createApiClientOptions();
19798
+ this.apiClient = apiClientOptions ? new ApiClient(
19584
19799
  config.apiBaseUrl,
19585
19800
  authProviderOrHeaders,
19586
- this.toolsManager.getSpecLoader()
19587
- );
19801
+ this.toolsManager.getSpecLoader(),
19802
+ apiClientOptions
19803
+ ) : new ApiClient(config.apiBaseUrl, authProviderOrHeaders, this.toolsManager.getSpecLoader());
19588
19804
  this.initializeHandlers();
19589
19805
  }
19806
+ createApiClientOptions() {
19807
+ const hasClientCert = !!this.config.clientCertPath;
19808
+ const hasClientKey = !!this.config.clientKeyPath;
19809
+ if (hasClientCert !== hasClientKey) {
19810
+ throw new Error("clientCertPath and clientKeyPath must be provided together");
19811
+ }
19812
+ if (this.config.clientKeyPassphrase && !hasClientKey) {
19813
+ throw new Error("clientKeyPassphrase requires clientKeyPath and clientCertPath");
19814
+ }
19815
+ const rejectUnauthorized = this.config.rejectUnauthorized ?? true;
19816
+ const shouldConfigureHttpsAgent = hasClientCert || hasClientKey || !!this.config.caCertPath || rejectUnauthorized === false;
19817
+ if (!shouldConfigureHttpsAgent) {
19818
+ return void 0;
19819
+ }
19820
+ let apiUrl;
19821
+ try {
19822
+ apiUrl = new URL(this.config.apiBaseUrl.trim());
19823
+ } catch {
19824
+ throw new Error("TLS options require apiBaseUrl to be a valid https:// URL");
19825
+ }
19826
+ if (apiUrl.protocol !== "https:") {
19827
+ throw new Error("TLS options require apiBaseUrl to use https://");
19828
+ }
19829
+ const httpsAgentOptions = {
19830
+ rejectUnauthorized
19831
+ };
19832
+ if (this.config.clientCertPath) {
19833
+ httpsAgentOptions.cert = readFileSync(this.config.clientCertPath, "utf8");
19834
+ }
19835
+ if (this.config.clientKeyPath) {
19836
+ httpsAgentOptions.key = readFileSync(this.config.clientKeyPath, "utf8");
19837
+ }
19838
+ if (this.config.caCertPath) {
19839
+ httpsAgentOptions.ca = readFileSync(this.config.caCertPath, "utf8");
19840
+ }
19841
+ if (this.config.clientKeyPassphrase) {
19842
+ httpsAgentOptions.passphrase = this.config.clientKeyPassphrase;
19843
+ }
19844
+ return {
19845
+ httpsAgent: new HttpsAgent(httpsAgentOptions)
19846
+ };
19847
+ }
19590
19848
  /**
19591
19849
  * Initialize request handlers
19592
19850
  */
@@ -19643,10 +19901,7 @@ var OpenAPIServer = class {
19643
19901
  prompts: this.promptsManager.getAllPrompts()
19644
19902
  }));
19645
19903
  this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
19646
- return this.promptsManager.getPrompt(
19647
- request.params.name,
19648
- request.params.arguments
19649
- );
19904
+ return this.promptsManager.getPrompt(request.params.name, request.params.arguments);
19650
19905
  });
19651
19906
  }
19652
19907
  if (this.resourcesManager) {
@@ -19998,7 +20253,7 @@ function sync_default(start, callback) {
19998
20253
 
19999
20254
  // node_modules/yargs/lib/platform-shims/esm.mjs
20000
20255
  import { inspect } from "util";
20001
- import { readFileSync as readFileSync3 } from "fs";
20256
+ import { readFileSync as readFileSync4 } from "fs";
20002
20257
  import { fileURLToPath } from "url";
20003
20258
 
20004
20259
  // node_modules/yargs-parser/build/lib/index.js
@@ -20941,7 +21196,7 @@ function stripQuotes(val) {
20941
21196
  }
20942
21197
 
20943
21198
  // node_modules/yargs-parser/build/lib/index.js
20944
- import { readFileSync } from "fs";
21199
+ import { readFileSync as readFileSync2 } from "fs";
20945
21200
  var _a;
20946
21201
  var _b;
20947
21202
  var _c;
@@ -20968,7 +21223,7 @@ var parser = new YargsParser({
20968
21223
  if (typeof __require !== "undefined") {
20969
21224
  return __require(path2);
20970
21225
  } else if (path2.match(/\.json$/)) {
20971
- return JSON.parse(readFileSync(path2, "utf8"));
21226
+ return JSON.parse(readFileSync2(path2, "utf8"));
20972
21227
  } else {
20973
21228
  throw Error("only .json config files are supported in ESM");
20974
21229
  }
@@ -21020,12 +21275,12 @@ var YError = class _YError extends Error {
21020
21275
  };
21021
21276
 
21022
21277
  // node_modules/y18n/build/lib/platform-shims/node.js
21023
- import { readFileSync as readFileSync2, statSync as statSync2, writeFile } from "fs";
21278
+ import { readFileSync as readFileSync3, statSync as statSync2, writeFile } from "fs";
21024
21279
  import { format as format2 } from "util";
21025
21280
  import { resolve as resolve3 } from "path";
21026
21281
  var node_default2 = {
21027
21282
  fs: {
21028
- readFileSync: readFileSync2,
21283
+ readFileSync: readFileSync3,
21029
21284
  writeFile
21030
21285
  },
21031
21286
  format: format2,
@@ -21249,7 +21504,7 @@ var esm_default = {
21249
21504
  nextTick: process.nextTick,
21250
21505
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
21251
21506
  },
21252
- readFileSync: readFileSync3,
21507
+ readFileSync: readFileSync4,
21253
21508
  require: () => {
21254
21509
  throw new YError(REQUIRE_ERROR);
21255
21510
  },
@@ -24552,6 +24807,25 @@ function parseHeaders(headerStr) {
24552
24807
  }
24553
24808
  return headers;
24554
24809
  }
24810
+ function parseOptionalBoolean(value, optionName) {
24811
+ if (value === void 0 || value === null || value === "") {
24812
+ return void 0;
24813
+ }
24814
+ if (typeof value === "boolean") {
24815
+ return value;
24816
+ }
24817
+ if (typeof value !== "string") {
24818
+ throw new Error(`${optionName} must be a boolean value`);
24819
+ }
24820
+ const normalized = value.trim().toLowerCase();
24821
+ if (["true", "1", "yes", "on"].includes(normalized)) {
24822
+ return true;
24823
+ }
24824
+ if (["false", "0", "no", "off"].includes(normalized)) {
24825
+ return false;
24826
+ }
24827
+ throw new Error(`${optionName} must be one of: true, false, 1, 0, yes, no, on, off`);
24828
+ }
24555
24829
  function loadConfig() {
24556
24830
  const argv = yargs_default(hideBin(process.argv)).option("transport", {
24557
24831
  alias: "t",
@@ -24586,6 +24860,21 @@ function loadConfig() {
24586
24860
  alias: "H",
24587
24861
  type: "string",
24588
24862
  description: "API headers in format 'key1:value1,key2:value2'"
24863
+ }).option("client-cert", {
24864
+ type: "string",
24865
+ description: "Path to client certificate PEM file for mutual TLS"
24866
+ }).option("client-key", {
24867
+ type: "string",
24868
+ description: "Path to client private key PEM file for mutual TLS"
24869
+ }).option("ca-cert", {
24870
+ type: "string",
24871
+ description: "Path to custom CA certificate PEM file"
24872
+ }).option("client-key-passphrase", {
24873
+ type: "string",
24874
+ description: "Passphrase for encrypted client private key"
24875
+ }).option("reject-unauthorized", {
24876
+ type: "string",
24877
+ description: "Whether to reject untrusted server certificates"
24589
24878
  }).option("name", {
24590
24879
  alias: "n",
24591
24880
  type: "string",
@@ -24680,15 +24969,17 @@ function loadConfig() {
24680
24969
  if (normalized === "all" || normalized === "dynamic" || normalized === "explicit") {
24681
24970
  toolsMode = normalized;
24682
24971
  } else {
24683
- throw new Error(
24684
- "Invalid tools mode. Expected one of: all, dynamic, explicit"
24685
- );
24972
+ throw new Error("Invalid tools mode. Expected one of: all, dynamic, explicit");
24686
24973
  }
24687
24974
  }
24688
24975
  if (!apiBaseUrl) {
24689
24976
  throw new Error("API base URL is required (--api-base-url or API_BASE_URL)");
24690
24977
  }
24691
24978
  const headers = parseHeaders(argv.headers || process.env.API_HEADERS);
24979
+ const rejectUnauthorizedInput = parseOptionalBoolean(
24980
+ argv["reject-unauthorized"] ?? process.env.REJECT_UNAUTHORIZED,
24981
+ "--reject-unauthorized/REJECT_UNAUTHORIZED"
24982
+ );
24692
24983
  return {
24693
24984
  name: argv.name || process.env.SERVER_NAME || "mcp-openapi-server",
24694
24985
  version: argv["server-version"] || process.env.SERVER_VERSION || "1.0.0",
@@ -24697,6 +24988,11 @@ function loadConfig() {
24697
24988
  specInputMethod,
24698
24989
  inlineSpecContent,
24699
24990
  headers,
24991
+ clientCertPath: argv["client-cert"] || process.env.CLIENT_CERT_PATH,
24992
+ clientKeyPath: argv["client-key"] || process.env.CLIENT_KEY_PATH,
24993
+ caCertPath: argv["ca-cert"] || process.env.CA_CERT_PATH,
24994
+ clientKeyPassphrase: argv["client-key-passphrase"] || process.env.CLIENT_KEY_PASSPHRASE,
24995
+ rejectUnauthorized: rejectUnauthorizedInput ?? true,
24700
24996
  transportType,
24701
24997
  httpPort,
24702
24998
  httpHost,