@scalar/api-client 0.7.29 → 0.7.31

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/CHANGELOG.md +12 -0
  2. package/dist/index.js +156 -139
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 0.7.31
4
+
5
+ ### Patch Changes
6
+
7
+ - ceb7952: fix: show non 200 responses when not using the proxy
8
+
9
+ ## 0.7.30
10
+
11
+ ### Patch Changes
12
+
13
+ - 5da1fc6: security: update axios from 1.5.0 to 1.6.1
14
+
3
15
  ## 0.7.29
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -5217,7 +5217,7 @@ const toJSONObject = (obj) => {
5217
5217
  };
5218
5218
  const isAsyncFn = kindOfTest("AsyncFunction");
5219
5219
  const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
5220
- const utils = {
5220
+ const utils$1 = {
5221
5221
  isArray,
5222
5222
  isArrayBuffer,
5223
5223
  isBuffer,
@@ -5285,7 +5285,7 @@ function AxiosError(message, code, config, request, response) {
5285
5285
  request && (this.request = request);
5286
5286
  response && (this.response = response);
5287
5287
  }
5288
- utils.inherits(AxiosError, Error, {
5288
+ utils$1.inherits(AxiosError, Error, {
5289
5289
  toJSON: function toJSON() {
5290
5290
  return {
5291
5291
  // Standard
@@ -5300,7 +5300,7 @@ utils.inherits(AxiosError, Error, {
5300
5300
  columnNumber: this.columnNumber,
5301
5301
  stack: this.stack,
5302
5302
  // Axios
5303
- config: utils.toJSONObject(this.config),
5303
+ config: utils$1.toJSONObject(this.config),
5304
5304
  code: this.code,
5305
5305
  status: this.response && this.response.status ? this.response.status : null
5306
5306
  };
@@ -5329,7 +5329,7 @@ Object.defineProperties(AxiosError, descriptors);
5329
5329
  Object.defineProperty(prototype$1, "isAxiosError", { value: true });
5330
5330
  AxiosError.from = (error, code, config, request, response, customProps) => {
5331
5331
  const axiosError = Object.create(prototype$1);
5332
- utils.toFlatObject(error, axiosError, function filter2(obj) {
5332
+ utils$1.toFlatObject(error, axiosError, function filter2(obj) {
5333
5333
  return obj !== Error.prototype;
5334
5334
  }, (prop) => {
5335
5335
  return prop !== "isAxiosError";
@@ -5342,10 +5342,10 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
5342
5342
  };
5343
5343
  const httpAdapter = null;
5344
5344
  function isVisitable(thing) {
5345
- return utils.isPlainObject(thing) || utils.isArray(thing);
5345
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
5346
5346
  }
5347
5347
  function removeBrackets(key) {
5348
- return utils.endsWith(key, "[]") ? key.slice(0, -2) : key;
5348
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
5349
5349
  }
5350
5350
  function renderKey(path, key, dots) {
5351
5351
  if (!path)
@@ -5356,42 +5356,42 @@ function renderKey(path, key, dots) {
5356
5356
  }).join(dots ? "." : "");
5357
5357
  }
5358
5358
  function isFlatArray(arr) {
5359
- return utils.isArray(arr) && !arr.some(isVisitable);
5359
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
5360
5360
  }
5361
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
5361
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
5362
5362
  return /^is[A-Z]/.test(prop);
5363
5363
  });
5364
5364
  function toFormData(obj, formData, options) {
5365
- if (!utils.isObject(obj)) {
5365
+ if (!utils$1.isObject(obj)) {
5366
5366
  throw new TypeError("target must be an object");
5367
5367
  }
5368
5368
  formData = formData || new FormData();
5369
- options = utils.toFlatObject(options, {
5369
+ options = utils$1.toFlatObject(options, {
5370
5370
  metaTokens: true,
5371
5371
  dots: false,
5372
5372
  indexes: false
5373
5373
  }, false, function defined(option, source) {
5374
- return !utils.isUndefined(source[option]);
5374
+ return !utils$1.isUndefined(source[option]);
5375
5375
  });
5376
5376
  const metaTokens = options.metaTokens;
5377
5377
  const visitor = options.visitor || defaultVisitor;
5378
5378
  const dots = options.dots;
5379
5379
  const indexes = options.indexes;
5380
5380
  const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
5381
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
5382
- if (!utils.isFunction(visitor)) {
5381
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
5382
+ if (!utils$1.isFunction(visitor)) {
5383
5383
  throw new TypeError("visitor must be a function");
5384
5384
  }
5385
5385
  function convertValue(value) {
5386
5386
  if (value === null)
5387
5387
  return "";
5388
- if (utils.isDate(value)) {
5388
+ if (utils$1.isDate(value)) {
5389
5389
  return value.toISOString();
5390
5390
  }
5391
- if (!useBlob && utils.isBlob(value)) {
5391
+ if (!useBlob && utils$1.isBlob(value)) {
5392
5392
  throw new AxiosError("Blob is not supported. Use a Buffer instead.");
5393
5393
  }
5394
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
5394
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
5395
5395
  return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
5396
5396
  }
5397
5397
  return value;
@@ -5399,13 +5399,13 @@ function toFormData(obj, formData, options) {
5399
5399
  function defaultVisitor(value, key, path) {
5400
5400
  let arr = value;
5401
5401
  if (value && !path && typeof value === "object") {
5402
- if (utils.endsWith(key, "{}")) {
5402
+ if (utils$1.endsWith(key, "{}")) {
5403
5403
  key = metaTokens ? key : key.slice(0, -2);
5404
5404
  value = JSON.stringify(value);
5405
- } else if (utils.isArray(value) && isFlatArray(value) || (utils.isFileList(value) || utils.endsWith(key, "[]")) && (arr = utils.toArray(value))) {
5405
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
5406
5406
  key = removeBrackets(key);
5407
5407
  arr.forEach(function each(el, index) {
5408
- !(utils.isUndefined(el) || el === null) && formData.append(
5408
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
5409
5409
  // eslint-disable-next-line no-nested-ternary
5410
5410
  indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
5411
5411
  convertValue(el)
@@ -5427,17 +5427,17 @@ function toFormData(obj, formData, options) {
5427
5427
  isVisitable
5428
5428
  });
5429
5429
  function build(value, path) {
5430
- if (utils.isUndefined(value))
5430
+ if (utils$1.isUndefined(value))
5431
5431
  return;
5432
5432
  if (stack.indexOf(value) !== -1) {
5433
5433
  throw Error("Circular reference detected in " + path.join("."));
5434
5434
  }
5435
5435
  stack.push(value);
5436
- utils.forEach(value, function each(el, key) {
5437
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
5436
+ utils$1.forEach(value, function each(el, key) {
5437
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
5438
5438
  formData,
5439
5439
  el,
5440
- utils.isString(key) ? key.trim() : key,
5440
+ utils$1.isString(key) ? key.trim() : key,
5441
5441
  path,
5442
5442
  exposedHelpers
5443
5443
  );
@@ -5447,7 +5447,7 @@ function toFormData(obj, formData, options) {
5447
5447
  });
5448
5448
  stack.pop();
5449
5449
  }
5450
- if (!utils.isObject(obj)) {
5450
+ if (!utils$1.isObject(obj)) {
5451
5451
  throw new TypeError("data must be an object");
5452
5452
  }
5453
5453
  build(obj);
@@ -5496,7 +5496,7 @@ function buildURL(url, params, options) {
5496
5496
  if (serializeFn) {
5497
5497
  serializedParams = serializeFn(params, options);
5498
5498
  } else {
5499
- serializedParams = utils.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
5499
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
5500
5500
  }
5501
5501
  if (serializedParams) {
5502
5502
  const hashmarkIndex = url.indexOf("#");
@@ -5561,7 +5561,7 @@ class InterceptorManager {
5561
5561
  * @returns {void}
5562
5562
  */
5563
5563
  forEach(fn) {
5564
- utils.forEach(this.handlers, function forEachHandler(h2) {
5564
+ utils$1.forEach(this.handlers, function forEachHandler(h2) {
5565
5565
  if (h2 !== null) {
5566
5566
  fn(h2);
5567
5567
  }
@@ -5577,32 +5577,37 @@ const transitionalDefaults = {
5577
5577
  const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
5578
5578
  const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
5579
5579
  const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
5580
- const isStandardBrowserEnv = (() => {
5581
- let product;
5582
- if (typeof navigator !== "undefined" && ((product = navigator.product) === "ReactNative" || product === "NativeScript" || product === "NS")) {
5583
- return false;
5584
- }
5585
- return typeof window !== "undefined" && typeof document !== "undefined";
5586
- })();
5587
- const isStandardBrowserWebWorkerEnv = (() => {
5588
- return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
5589
- self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
5590
- })();
5591
- const platform = {
5580
+ const platform$1 = {
5592
5581
  isBrowser: true,
5593
5582
  classes: {
5594
5583
  URLSearchParams: URLSearchParams$1,
5595
5584
  FormData: FormData$1,
5596
5585
  Blob: Blob$1
5597
5586
  },
5598
- isStandardBrowserEnv,
5599
- isStandardBrowserWebWorkerEnv,
5600
5587
  protocols: ["http", "https", "file", "blob", "url", "data"]
5601
5588
  };
5589
+ const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
5590
+ const hasStandardBrowserEnv = ((product) => {
5591
+ return hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(product) < 0;
5592
+ })(typeof navigator !== "undefined" && navigator.product);
5593
+ const hasStandardBrowserWebWorkerEnv = (() => {
5594
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
5595
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
5596
+ })();
5597
+ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5598
+ __proto__: null,
5599
+ hasBrowserEnv,
5600
+ hasStandardBrowserEnv,
5601
+ hasStandardBrowserWebWorkerEnv
5602
+ }, Symbol.toStringTag, { value: "Module" }));
5603
+ const platform = {
5604
+ ...utils,
5605
+ ...platform$1
5606
+ };
5602
5607
  function toURLEncodedForm(data, options) {
5603
5608
  return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
5604
5609
  visitor: function(value, key, path, helpers) {
5605
- if (platform.isNode && utils.isBuffer(value)) {
5610
+ if (platform.isNode && utils$1.isBuffer(value)) {
5606
5611
  this.append(key, value.toString("base64"));
5607
5612
  return false;
5608
5613
  }
@@ -5611,7 +5616,7 @@ function toURLEncodedForm(data, options) {
5611
5616
  }, options));
5612
5617
  }
5613
5618
  function parsePropPath(name) {
5614
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
5619
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
5615
5620
  return match[0] === "[]" ? "" : match[1] || match[0];
5616
5621
  });
5617
5622
  }
@@ -5632,27 +5637,27 @@ function formDataToJSON(formData) {
5632
5637
  let name = path[index++];
5633
5638
  const isNumericKey = Number.isFinite(+name);
5634
5639
  const isLast = index >= path.length;
5635
- name = !name && utils.isArray(target) ? target.length : name;
5640
+ name = !name && utils$1.isArray(target) ? target.length : name;
5636
5641
  if (isLast) {
5637
- if (utils.hasOwnProp(target, name)) {
5642
+ if (utils$1.hasOwnProp(target, name)) {
5638
5643
  target[name] = [target[name], value];
5639
5644
  } else {
5640
5645
  target[name] = value;
5641
5646
  }
5642
5647
  return !isNumericKey;
5643
5648
  }
5644
- if (!target[name] || !utils.isObject(target[name])) {
5649
+ if (!target[name] || !utils$1.isObject(target[name])) {
5645
5650
  target[name] = [];
5646
5651
  }
5647
5652
  const result = buildPath(path, value, target[name], index);
5648
- if (result && utils.isArray(target[name])) {
5653
+ if (result && utils$1.isArray(target[name])) {
5649
5654
  target[name] = arrayToObject(target[name]);
5650
5655
  }
5651
5656
  return !isNumericKey;
5652
5657
  }
5653
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
5658
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
5654
5659
  const obj = {};
5655
- utils.forEachEntry(formData, (name, value) => {
5660
+ utils$1.forEachEntry(formData, (name, value) => {
5656
5661
  buildPath(parsePropPath(name), value, obj, 0);
5657
5662
  });
5658
5663
  return obj;
@@ -5660,10 +5665,10 @@ function formDataToJSON(formData) {
5660
5665
  return null;
5661
5666
  }
5662
5667
  function stringifySafely(rawValue, parser, encoder) {
5663
- if (utils.isString(rawValue)) {
5668
+ if (utils$1.isString(rawValue)) {
5664
5669
  try {
5665
5670
  (parser || JSON.parse)(rawValue);
5666
- return utils.trim(rawValue);
5671
+ return utils$1.trim(rawValue);
5667
5672
  } catch (e2) {
5668
5673
  if (e2.name !== "SyntaxError") {
5669
5674
  throw e2;
@@ -5674,28 +5679,28 @@ function stringifySafely(rawValue, parser, encoder) {
5674
5679
  }
5675
5680
  const defaults = {
5676
5681
  transitional: transitionalDefaults,
5677
- adapter: platform.isNode ? "http" : "xhr",
5682
+ adapter: ["xhr", "http"],
5678
5683
  transformRequest: [function transformRequest(data, headers) {
5679
5684
  const contentType2 = headers.getContentType() || "";
5680
5685
  const hasJSONContentType = contentType2.indexOf("application/json") > -1;
5681
- const isObjectPayload = utils.isObject(data);
5682
- if (isObjectPayload && utils.isHTMLForm(data)) {
5686
+ const isObjectPayload = utils$1.isObject(data);
5687
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
5683
5688
  data = new FormData(data);
5684
5689
  }
5685
- const isFormData2 = utils.isFormData(data);
5690
+ const isFormData2 = utils$1.isFormData(data);
5686
5691
  if (isFormData2) {
5687
5692
  if (!hasJSONContentType) {
5688
5693
  return data;
5689
5694
  }
5690
5695
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
5691
5696
  }
5692
- if (utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
5697
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
5693
5698
  return data;
5694
5699
  }
5695
- if (utils.isArrayBufferView(data)) {
5700
+ if (utils$1.isArrayBufferView(data)) {
5696
5701
  return data.buffer;
5697
5702
  }
5698
- if (utils.isURLSearchParams(data)) {
5703
+ if (utils$1.isURLSearchParams(data)) {
5699
5704
  headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
5700
5705
  return data.toString();
5701
5706
  }
@@ -5704,7 +5709,7 @@ const defaults = {
5704
5709
  if (contentType2.indexOf("application/x-www-form-urlencoded") > -1) {
5705
5710
  return toURLEncodedForm(data, this.formSerializer).toString();
5706
5711
  }
5707
- if ((isFileList2 = utils.isFileList(data)) || contentType2.indexOf("multipart/form-data") > -1) {
5712
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType2.indexOf("multipart/form-data") > -1) {
5708
5713
  const _FormData = this.env && this.env.FormData;
5709
5714
  return toFormData(
5710
5715
  isFileList2 ? { "files[]": data } : data,
@@ -5723,7 +5728,7 @@ const defaults = {
5723
5728
  const transitional2 = this.transitional || defaults.transitional;
5724
5729
  const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
5725
5730
  const JSONRequested = this.responseType === "json";
5726
- if (data && utils.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
5731
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
5727
5732
  const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
5728
5733
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
5729
5734
  try {
@@ -5762,11 +5767,11 @@ const defaults = {
5762
5767
  }
5763
5768
  }
5764
5769
  };
5765
- utils.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
5770
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
5766
5771
  defaults.headers[method] = {};
5767
5772
  });
5768
5773
  const defaults$1 = defaults;
5769
- const ignoreDuplicateOf = utils.toObjectSet([
5774
+ const ignoreDuplicateOf = utils$1.toObjectSet([
5770
5775
  "age",
5771
5776
  "authorization",
5772
5777
  "content-length",
@@ -5817,7 +5822,7 @@ function normalizeValue(value) {
5817
5822
  if (value === false || value == null) {
5818
5823
  return value;
5819
5824
  }
5820
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
5825
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
5821
5826
  }
5822
5827
  function parseTokens(str) {
5823
5828
  const tokens = /* @__PURE__ */ Object.create(null);
@@ -5830,18 +5835,18 @@ function parseTokens(str) {
5830
5835
  }
5831
5836
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
5832
5837
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
5833
- if (utils.isFunction(filter2)) {
5838
+ if (utils$1.isFunction(filter2)) {
5834
5839
  return filter2.call(this, value, header);
5835
5840
  }
5836
5841
  if (isHeaderNameFilter) {
5837
5842
  value = header;
5838
5843
  }
5839
- if (!utils.isString(value))
5844
+ if (!utils$1.isString(value))
5840
5845
  return;
5841
- if (utils.isString(filter2)) {
5846
+ if (utils$1.isString(filter2)) {
5842
5847
  return value.indexOf(filter2) !== -1;
5843
5848
  }
5844
- if (utils.isRegExp(filter2)) {
5849
+ if (utils$1.isRegExp(filter2)) {
5845
5850
  return filter2.test(value);
5846
5851
  }
5847
5852
  }
@@ -5851,7 +5856,7 @@ function formatHeader(header) {
5851
5856
  });
5852
5857
  }
5853
5858
  function buildAccessors(obj, header) {
5854
- const accessorName = utils.toCamelCase(" " + header);
5859
+ const accessorName = utils$1.toCamelCase(" " + header);
5855
5860
  ["get", "set", "has"].forEach((methodName) => {
5856
5861
  Object.defineProperty(obj, methodName + accessorName, {
5857
5862
  value: function(arg1, arg2, arg3) {
@@ -5872,15 +5877,15 @@ class AxiosHeaders {
5872
5877
  if (!lHeader) {
5873
5878
  throw new Error("header name must be a non-empty string");
5874
5879
  }
5875
- const key = utils.findKey(self2, lHeader);
5880
+ const key = utils$1.findKey(self2, lHeader);
5876
5881
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
5877
5882
  self2[key || _header] = normalizeValue(_value);
5878
5883
  }
5879
5884
  }
5880
- const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
5881
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
5885
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
5886
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
5882
5887
  setHeaders(header, valueOrRewrite);
5883
- } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
5888
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
5884
5889
  setHeaders(parseHeaders(header), valueOrRewrite);
5885
5890
  } else {
5886
5891
  header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -5890,7 +5895,7 @@ class AxiosHeaders {
5890
5895
  get(header, parser) {
5891
5896
  header = normalizeHeader(header);
5892
5897
  if (header) {
5893
- const key = utils.findKey(this, header);
5898
+ const key = utils$1.findKey(this, header);
5894
5899
  if (key) {
5895
5900
  const value = this[key];
5896
5901
  if (!parser) {
@@ -5899,10 +5904,10 @@ class AxiosHeaders {
5899
5904
  if (parser === true) {
5900
5905
  return parseTokens(value);
5901
5906
  }
5902
- if (utils.isFunction(parser)) {
5907
+ if (utils$1.isFunction(parser)) {
5903
5908
  return parser.call(this, value, key);
5904
5909
  }
5905
- if (utils.isRegExp(parser)) {
5910
+ if (utils$1.isRegExp(parser)) {
5906
5911
  return parser.exec(value);
5907
5912
  }
5908
5913
  throw new TypeError("parser must be boolean|regexp|function");
@@ -5912,7 +5917,7 @@ class AxiosHeaders {
5912
5917
  has(header, matcher) {
5913
5918
  header = normalizeHeader(header);
5914
5919
  if (header) {
5915
- const key = utils.findKey(this, header);
5920
+ const key = utils$1.findKey(this, header);
5916
5921
  return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
5917
5922
  }
5918
5923
  return false;
@@ -5923,14 +5928,14 @@ class AxiosHeaders {
5923
5928
  function deleteHeader(_header) {
5924
5929
  _header = normalizeHeader(_header);
5925
5930
  if (_header) {
5926
- const key = utils.findKey(self2, _header);
5931
+ const key = utils$1.findKey(self2, _header);
5927
5932
  if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
5928
5933
  delete self2[key];
5929
5934
  deleted = true;
5930
5935
  }
5931
5936
  }
5932
5937
  }
5933
- if (utils.isArray(header)) {
5938
+ if (utils$1.isArray(header)) {
5934
5939
  header.forEach(deleteHeader);
5935
5940
  } else {
5936
5941
  deleteHeader(header);
@@ -5953,8 +5958,8 @@ class AxiosHeaders {
5953
5958
  normalize(format4) {
5954
5959
  const self2 = this;
5955
5960
  const headers = {};
5956
- utils.forEach(this, (value, header) => {
5957
- const key = utils.findKey(headers, header);
5961
+ utils$1.forEach(this, (value, header) => {
5962
+ const key = utils$1.findKey(headers, header);
5958
5963
  if (key) {
5959
5964
  self2[key] = normalizeValue(value);
5960
5965
  delete self2[header];
@@ -5974,8 +5979,8 @@ class AxiosHeaders {
5974
5979
  }
5975
5980
  toJSON(asStrings) {
5976
5981
  const obj = /* @__PURE__ */ Object.create(null);
5977
- utils.forEach(this, (value, header) => {
5978
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
5982
+ utils$1.forEach(this, (value, header) => {
5983
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
5979
5984
  });
5980
5985
  return obj;
5981
5986
  }
@@ -6009,12 +6014,12 @@ class AxiosHeaders {
6009
6014
  accessors[lHeader] = true;
6010
6015
  }
6011
6016
  }
6012
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
6017
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
6013
6018
  return this;
6014
6019
  }
6015
6020
  }
6016
6021
  AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
6017
- utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
6022
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
6018
6023
  let mapped = key[0].toUpperCase() + key.slice(1);
6019
6024
  return {
6020
6025
  get: () => value,
@@ -6023,14 +6028,14 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
6023
6028
  }
6024
6029
  };
6025
6030
  });
6026
- utils.freezeMethods(AxiosHeaders);
6031
+ utils$1.freezeMethods(AxiosHeaders);
6027
6032
  const AxiosHeaders$1 = AxiosHeaders;
6028
6033
  function transformData(fns, response) {
6029
6034
  const config = this || defaults$1;
6030
6035
  const context = response || config;
6031
6036
  const headers = AxiosHeaders$1.from(context.headers);
6032
6037
  let data = context.data;
6033
- utils.forEach(fns, function transform(fn) {
6038
+ utils$1.forEach(fns, function transform(fn) {
6034
6039
  data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
6035
6040
  });
6036
6041
  headers.normalize();
@@ -6043,7 +6048,7 @@ function CanceledError(message, config, request) {
6043
6048
  AxiosError.call(this, message == null ? "canceled" : message, AxiosError.ERR_CANCELED, config, request);
6044
6049
  this.name = "CanceledError";
6045
6050
  }
6046
- utils.inherits(CanceledError, AxiosError, {
6051
+ utils$1.inherits(CanceledError, AxiosError, {
6047
6052
  __CANCEL__: true
6048
6053
  });
6049
6054
  function settle(resolve, reject, response) {
@@ -6060,20 +6065,20 @@ function settle(resolve, reject, response) {
6060
6065
  ));
6061
6066
  }
6062
6067
  }
6063
- const cookies = platform.isStandardBrowserEnv ? (
6068
+ const cookies = platform.hasStandardBrowserEnv ? (
6064
6069
  // Standard browser envs support document.cookie
6065
6070
  function standardBrowserEnv() {
6066
6071
  return {
6067
6072
  write: function write(name, value, expires, path, domain, secure) {
6068
6073
  const cookie = [];
6069
6074
  cookie.push(name + "=" + encodeURIComponent(value));
6070
- if (utils.isNumber(expires)) {
6075
+ if (utils$1.isNumber(expires)) {
6071
6076
  cookie.push("expires=" + new Date(expires).toGMTString());
6072
6077
  }
6073
- if (utils.isString(path)) {
6078
+ if (utils$1.isString(path)) {
6074
6079
  cookie.push("path=" + path);
6075
6080
  }
6076
- if (utils.isString(domain)) {
6081
+ if (utils$1.isString(domain)) {
6077
6082
  cookie.push("domain=" + domain);
6078
6083
  }
6079
6084
  if (secure === true) {
@@ -6116,7 +6121,7 @@ function buildFullPath(baseURL, requestedURL) {
6116
6121
  }
6117
6122
  return requestedURL;
6118
6123
  }
6119
- const isURLSameOrigin = platform.isStandardBrowserEnv ? (
6124
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? (
6120
6125
  // Standard browser envs have full support of the APIs needed to test
6121
6126
  // whether the request URL is of the same origin as current location.
6122
6127
  function standardBrowserEnv2() {
@@ -6143,7 +6148,7 @@ const isURLSameOrigin = platform.isStandardBrowserEnv ? (
6143
6148
  }
6144
6149
  originURL = resolveURL(window.location.href);
6145
6150
  return function isURLSameOrigin2(requestURL) {
6146
- const parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
6151
+ const parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
6147
6152
  return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
6148
6153
  };
6149
6154
  }()
@@ -6230,11 +6235,13 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
6230
6235
  config.signal.removeEventListener("abort", onCanceled);
6231
6236
  }
6232
6237
  }
6233
- if (utils.isFormData(requestData)) {
6234
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
6238
+ let contentType2;
6239
+ if (utils$1.isFormData(requestData)) {
6240
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
6235
6241
  requestHeaders.setContentType(false);
6236
- } else {
6237
- requestHeaders.setContentType("multipart/form-data;", false);
6242
+ } else if ((contentType2 = requestHeaders.getContentType()) !== false) {
6243
+ const [type, ...tokens] = contentType2 ? contentType2.split(";").map((token) => token.trim()).filter(Boolean) : [];
6244
+ requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; "));
6238
6245
  }
6239
6246
  }
6240
6247
  let request = new XMLHttpRequest();
@@ -6309,19 +6316,19 @@ const xhrAdapter = isXHRAdapterSupported && function(config) {
6309
6316
  ));
6310
6317
  request = null;
6311
6318
  };
6312
- if (platform.isStandardBrowserEnv) {
6313
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
6319
+ if (platform.hasStandardBrowserEnv) {
6320
+ const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
6314
6321
  if (xsrfValue) {
6315
6322
  requestHeaders.set(config.xsrfHeaderName, xsrfValue);
6316
6323
  }
6317
6324
  }
6318
6325
  requestData === void 0 && requestHeaders.setContentType(null);
6319
6326
  if ("setRequestHeader" in request) {
6320
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
6327
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
6321
6328
  request.setRequestHeader(key, val);
6322
6329
  });
6323
6330
  }
6324
- if (!utils.isUndefined(config.withCredentials)) {
6331
+ if (!utils$1.isUndefined(config.withCredentials)) {
6325
6332
  request.withCredentials = !!config.withCredentials;
6326
6333
  }
6327
6334
  if (responseType && responseType !== "json") {
@@ -6359,7 +6366,7 @@ const knownAdapters = {
6359
6366
  http: httpAdapter,
6360
6367
  xhr: xhrAdapter
6361
6368
  };
6362
- utils.forEach(knownAdapters, (fn, value) => {
6369
+ utils$1.forEach(knownAdapters, (fn, value) => {
6363
6370
  if (fn) {
6364
6371
  try {
6365
6372
  Object.defineProperty(fn, "name", { value });
@@ -6368,31 +6375,39 @@ utils.forEach(knownAdapters, (fn, value) => {
6368
6375
  Object.defineProperty(fn, "adapterName", { value });
6369
6376
  }
6370
6377
  });
6378
+ const renderReason = (reason) => `- ${reason}`;
6379
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
6371
6380
  const adapters = {
6372
6381
  getAdapter: (adapters2) => {
6373
- adapters2 = utils.isArray(adapters2) ? adapters2 : [adapters2];
6382
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
6374
6383
  const { length } = adapters2;
6375
6384
  let nameOrAdapter;
6376
6385
  let adapter;
6386
+ const rejectedReasons = {};
6377
6387
  for (let i2 = 0; i2 < length; i2++) {
6378
6388
  nameOrAdapter = adapters2[i2];
6379
- if (adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
6389
+ let id;
6390
+ adapter = nameOrAdapter;
6391
+ if (!isResolvedHandle(nameOrAdapter)) {
6392
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6393
+ if (adapter === void 0) {
6394
+ throw new AxiosError(`Unknown adapter '${id}'`);
6395
+ }
6396
+ }
6397
+ if (adapter) {
6380
6398
  break;
6381
6399
  }
6400
+ rejectedReasons[id || "#" + i2] = adapter;
6382
6401
  }
6383
6402
  if (!adapter) {
6384
- if (adapter === false) {
6385
- throw new AxiosError(
6386
- `Adapter ${nameOrAdapter} is not supported by the environment`,
6387
- "ERR_NOT_SUPPORT"
6388
- );
6389
- }
6390
- throw new Error(
6391
- utils.hasOwnProp(knownAdapters, nameOrAdapter) ? `Adapter '${nameOrAdapter}' is not available in the build` : `Unknown adapter '${nameOrAdapter}'`
6403
+ const reasons = Object.entries(rejectedReasons).map(
6404
+ ([id, state2]) => `adapter ${id} ` + (state2 === false ? "is not supported by the environment" : "is not available in the build")
6405
+ );
6406
+ let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
6407
+ throw new AxiosError(
6408
+ `There is no suitable adapter to dispatch the request ` + s2,
6409
+ "ERR_NOT_SUPPORT"
6392
6410
  );
6393
- }
6394
- if (!utils.isFunction(adapter)) {
6395
- throw new TypeError("adapter is not a function");
6396
6411
  }
6397
6412
  return adapter;
6398
6413
  },
@@ -6446,31 +6461,31 @@ function mergeConfig(config1, config2) {
6446
6461
  config2 = config2 || {};
6447
6462
  const config = {};
6448
6463
  function getMergedValue(target, source, caseless) {
6449
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
6450
- return utils.merge.call({ caseless }, target, source);
6451
- } else if (utils.isPlainObject(source)) {
6452
- return utils.merge({}, source);
6453
- } else if (utils.isArray(source)) {
6464
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
6465
+ return utils$1.merge.call({ caseless }, target, source);
6466
+ } else if (utils$1.isPlainObject(source)) {
6467
+ return utils$1.merge({}, source);
6468
+ } else if (utils$1.isArray(source)) {
6454
6469
  return source.slice();
6455
6470
  }
6456
6471
  return source;
6457
6472
  }
6458
6473
  function mergeDeepProperties(a2, b2, caseless) {
6459
- if (!utils.isUndefined(b2)) {
6474
+ if (!utils$1.isUndefined(b2)) {
6460
6475
  return getMergedValue(a2, b2, caseless);
6461
- } else if (!utils.isUndefined(a2)) {
6476
+ } else if (!utils$1.isUndefined(a2)) {
6462
6477
  return getMergedValue(void 0, a2, caseless);
6463
6478
  }
6464
6479
  }
6465
6480
  function valueFromConfig2(a2, b2) {
6466
- if (!utils.isUndefined(b2)) {
6481
+ if (!utils$1.isUndefined(b2)) {
6467
6482
  return getMergedValue(void 0, b2);
6468
6483
  }
6469
6484
  }
6470
6485
  function defaultToConfig2(a2, b2) {
6471
- if (!utils.isUndefined(b2)) {
6486
+ if (!utils$1.isUndefined(b2)) {
6472
6487
  return getMergedValue(void 0, b2);
6473
- } else if (!utils.isUndefined(a2)) {
6488
+ } else if (!utils$1.isUndefined(a2)) {
6474
6489
  return getMergedValue(void 0, a2);
6475
6490
  }
6476
6491
  }
@@ -6511,14 +6526,14 @@ function mergeConfig(config1, config2) {
6511
6526
  validateStatus: mergeDirectKeys,
6512
6527
  headers: (a2, b2) => mergeDeepProperties(headersToObject(a2), headersToObject(b2), true)
6513
6528
  };
6514
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
6529
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
6515
6530
  const merge2 = mergeMap[prop] || mergeDeepProperties;
6516
6531
  const configValue = merge2(config1[prop], config2[prop], prop);
6517
- utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
6532
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
6518
6533
  });
6519
6534
  return config;
6520
6535
  }
6521
- const VERSION = "1.5.0";
6536
+ const VERSION = "1.6.1";
6522
6537
  const validators$1 = {};
6523
6538
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
6524
6539
  validators$1[type] = function validator2(thing) {
@@ -6609,7 +6624,7 @@ class Axios {
6609
6624
  }, false);
6610
6625
  }
6611
6626
  if (paramsSerializer != null) {
6612
- if (utils.isFunction(paramsSerializer)) {
6627
+ if (utils$1.isFunction(paramsSerializer)) {
6613
6628
  config.paramsSerializer = {
6614
6629
  serialize: paramsSerializer
6615
6630
  };
@@ -6621,11 +6636,11 @@ class Axios {
6621
6636
  }
6622
6637
  }
6623
6638
  config.method = (config.method || this.defaults.method || "get").toLowerCase();
6624
- let contextHeaders = headers && utils.merge(
6639
+ let contextHeaders = headers && utils$1.merge(
6625
6640
  headers.common,
6626
6641
  headers[config.method]
6627
6642
  );
6628
- headers && utils.forEach(
6643
+ headers && utils$1.forEach(
6629
6644
  ["delete", "get", "head", "post", "put", "patch", "common"],
6630
6645
  (method) => {
6631
6646
  delete headers[method];
@@ -6690,7 +6705,7 @@ class Axios {
6690
6705
  return buildURL(fullPath, config.params, config.paramsSerializer);
6691
6706
  }
6692
6707
  }
6693
- utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
6708
+ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
6694
6709
  Axios.prototype[method] = function(url, config) {
6695
6710
  return this.request(mergeConfig(config || {}, {
6696
6711
  method,
@@ -6699,7 +6714,7 @@ utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData
6699
6714
  }));
6700
6715
  };
6701
6716
  });
6702
- utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
6717
+ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
6703
6718
  function generateHTTPMethod(isForm) {
6704
6719
  return function httpMethod(url, data, config) {
6705
6720
  return this.request(mergeConfig(config || {}, {
@@ -6810,7 +6825,7 @@ function spread(callback) {
6810
6825
  };
6811
6826
  }
6812
6827
  function isAxiosError(payload) {
6813
- return utils.isObject(payload) && payload.isAxiosError === true;
6828
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
6814
6829
  }
6815
6830
  const HttpStatusCode = {
6816
6831
  Continue: 100,
@@ -6884,8 +6899,8 @@ const HttpStatusCode$1 = HttpStatusCode;
6884
6899
  function createInstance(defaultConfig) {
6885
6900
  const context = new Axios$1(defaultConfig);
6886
6901
  const instance = bind(Axios$1.prototype.request, context);
6887
- utils.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
6888
- utils.extend(instance, context, null, { allOwnKeys: true });
6902
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
6903
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
6889
6904
  instance.create = function create(instanceConfig) {
6890
6905
  return createInstance(mergeConfig(defaultConfig, instanceConfig));
6891
6906
  };
@@ -6907,7 +6922,7 @@ axios.spread = spread;
6907
6922
  axios.isAxiosError = isAxiosError;
6908
6923
  axios.mergeConfig = mergeConfig;
6909
6924
  axios.AxiosHeaders = AxiosHeaders$1;
6910
- axios.formToJSON = (thing) => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
6925
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
6911
6926
  axios.getAdapter = adapters.getAdapter;
6912
6927
  axios.HttpStatusCode = HttpStatusCode$1;
6913
6928
  axios.default = axios;
@@ -7004,12 +7019,14 @@ async function sendRequest(request, proxyUrl) {
7004
7019
  error: false
7005
7020
  };
7006
7021
  }).catch((error) => {
7022
+ const { response: errorResponse } = error;
7007
7023
  return {
7008
- error: true,
7009
- ...error == null ? void 0 : error.response
7024
+ ...errorResponse,
7025
+ statusCode: errorResponse.status,
7026
+ data: JSON.stringify(errorResponse.data)
7010
7027
  };
7011
7028
  });
7012
- return response.error ? null : {
7029
+ return {
7013
7030
  sentTime: Date.now(),
7014
7031
  request: {
7015
7032
  ...request,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@scalar/api-client",
3
3
  "description": "the open source API testing client",
4
- "version": "0.7.29",
4
+ "version": "0.7.31",
5
5
  "author": "Scalar (https://github.com/scalar)",
6
6
  "bugs": "https://github.com/scalar/scalar/issues/new",
7
7
  "dependencies": {
8
8
  "@headlessui/vue": "1.7.16",
9
9
  "@vueuse/core": "10.4.1",
10
- "axios": "1.5.0",
10
+ "axios": "1.6.1",
11
11
  "content-type": "1.0.5",
12
12
  "javascript-time-ago": "2.5.9",
13
13
  "nanoid": "5.0.1",