@zuplo/cli 6.70.71 → 6.71.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 (38) hide show
  1. package/node_modules/@zuplo/core/package.json +1 -1
  2. package/node_modules/@zuplo/graphql/package.json +1 -1
  3. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  4. package/node_modules/@zuplo/otel/package.json +1 -1
  5. package/node_modules/@zuplo/runtime/package.json +1 -1
  6. package/node_modules/axios/CHANGELOG.md +52 -1
  7. package/node_modules/axios/README.md +30 -2
  8. package/node_modules/axios/dist/axios.js +350 -134
  9. package/node_modules/axios/dist/axios.min.js +3 -3
  10. package/node_modules/axios/dist/axios.min.js.map +1 -1
  11. package/node_modules/axios/dist/browser/axios.cjs +355 -90
  12. package/node_modules/axios/dist/esm/axios.js +355 -90
  13. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  14. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  15. package/node_modules/axios/dist/node/axios.cjs +399 -104
  16. package/node_modules/axios/index.d.cts +2 -0
  17. package/node_modules/axios/index.d.ts +2 -0
  18. package/node_modules/axios/lib/adapters/fetch.js +113 -37
  19. package/node_modules/axios/lib/adapters/http.js +132 -43
  20. package/node_modules/axios/lib/core/Axios.js +3 -2
  21. package/node_modules/axios/lib/core/AxiosHeaders.js +10 -7
  22. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  23. package/node_modules/axios/lib/core/mergeConfig.js +34 -0
  24. package/node_modules/axios/lib/defaults/transitional.js +1 -0
  25. package/node_modules/axios/lib/env/data.js +1 -1
  26. package/node_modules/axios/lib/helpers/buildURL.js +5 -3
  27. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  28. package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -3
  29. package/node_modules/axios/lib/helpers/resolveConfig.js +5 -3
  30. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  31. package/node_modules/axios/lib/helpers/toFormData.js +40 -10
  32. package/node_modules/axios/lib/utils.js +75 -11
  33. package/node_modules/axios/package.json +1 -1
  34. package/node_modules/form-data/CHANGELOG.md +29 -2
  35. package/node_modules/form-data/README.md +4 -4
  36. package/node_modules/form-data/lib/form_data.js +14 -2
  37. package/node_modules/form-data/package.json +7 -7
  38. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- /*! Axios v1.17.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.18.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  /**
3
3
  * Create a bound version of a function with a specified `this` context
4
4
  *
@@ -18,6 +18,57 @@ const { toString } = Object.prototype;
18
18
  const { getPrototypeOf } = Object;
19
19
  const { iterator, toStringTag } = Symbol;
20
20
 
21
+ /* Creating a function that will check if an object has a property. */
22
+ const hasOwnProperty = (
23
+ ({ hasOwnProperty }) =>
24
+ (obj, prop) =>
25
+ hasOwnProperty.call(obj, prop)
26
+ )(Object.prototype);
27
+
28
+ /**
29
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
30
+ * an own `prop`. This distinguishes genuine own/inherited members — including
31
+ * class accessors and template prototypes — from members injected via
32
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
33
+ * live on Object.prototype itself and are therefore never matched.
34
+ *
35
+ * @param {*} thing The value whose chain to inspect
36
+ * @param {string|symbol} prop The property key to look for
37
+ *
38
+ * @returns {boolean} True when `prop` is owned below Object.prototype
39
+ */
40
+ const hasOwnInPrototypeChain = (thing, prop) => {
41
+ let obj = thing;
42
+ const seen = [];
43
+
44
+ while (obj != null && obj !== Object.prototype) {
45
+ if (seen.indexOf(obj) !== -1) {
46
+ return false;
47
+ }
48
+ seen.push(obj);
49
+
50
+ if (hasOwnProperty(obj, prop)) {
51
+ return true;
52
+ }
53
+ obj = getPrototypeOf(obj);
54
+ }
55
+ return false;
56
+ };
57
+
58
+ /**
59
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
60
+ * properties and members inherited from a non-Object.prototype source (a class
61
+ * instance or template object) are honored; a value reachable only through a
62
+ * polluted Object.prototype is ignored and `undefined` is returned.
63
+ *
64
+ * @param {*} obj The source object
65
+ * @param {string|symbol} prop The property key to read
66
+ *
67
+ * @returns {*} The resolved value, or undefined when unsafe/absent
68
+ */
69
+ const getSafeProp = (obj, prop) =>
70
+ obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
71
+
21
72
  const kindOf = ((cache) => (thing) => {
22
73
  const str = toString.call(thing);
23
74
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -143,7 +194,7 @@ const isBoolean = (thing) => thing === true || thing === false;
143
194
  * @returns {boolean} True if value is a plain Object, otherwise false
144
195
  */
145
196
  const isPlainObject = (val) => {
146
- if (kindOf(val) !== 'object') {
197
+ if (!isObject(val)) {
147
198
  return false;
148
199
  }
149
200
 
@@ -151,9 +202,12 @@ const isPlainObject = (val) => {
151
202
  return (
152
203
  (prototype === null ||
153
204
  prototype === Object.prototype ||
154
- Object.getPrototypeOf(prototype) === null) &&
155
- !(toStringTag in val) &&
156
- !(iterator in val)
205
+ getPrototypeOf(prototype) === null) &&
206
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
207
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
208
+ // than a plain object, while ignoring keys injected onto Object.prototype.
209
+ !hasOwnInPrototypeChain(val, toStringTag) &&
210
+ !hasOwnInPrototypeChain(val, iterator)
157
211
  );
158
212
  };
159
213
 
@@ -680,13 +734,6 @@ const toCamelCase = (str) => {
680
734
  });
681
735
  };
682
736
 
683
- /* Creating a function that will check if an object has a property. */
684
- const hasOwnProperty = (
685
- ({ hasOwnProperty }) =>
686
- (obj, prop) =>
687
- hasOwnProperty.call(obj, prop)
688
- )(Object.prototype);
689
-
690
737
  const { propertyIsEnumerable } = Object.prototype;
691
738
 
692
739
  /**
@@ -900,6 +947,20 @@ const asap =
900
947
 
901
948
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
902
949
 
950
+ /**
951
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
952
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
953
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
954
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
955
+ * into an attacker-controlled entries iterator.
956
+ *
957
+ * @param {*} thing The value to test
958
+ *
959
+ * @returns {boolean} True if value has a non-polluted iterator
960
+ */
961
+ const isSafeIterable = (thing) =>
962
+ thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
963
+
903
964
  var utils$1 = {
904
965
  isArray,
905
966
  isArrayBuffer,
@@ -944,6 +1005,8 @@ var utils$1 = {
944
1005
  isHTMLForm,
945
1006
  hasOwnProperty,
946
1007
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
1008
+ hasOwnInPrototypeChain,
1009
+ getSafeProp,
947
1010
  reduceDescriptors,
948
1011
  freezeMethods,
949
1012
  toObjectSet,
@@ -960,6 +1023,7 @@ var utils$1 = {
960
1023
  setImmediate: _setImmediate,
961
1024
  asap,
962
1025
  isIterable,
1026
+ isSafeIterable,
963
1027
  };
964
1028
 
965
1029
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1192,8 +1256,8 @@ let AxiosHeaders$1 = class AxiosHeaders {
1192
1256
  setHeaders(header, valueOrRewrite);
1193
1257
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1194
1258
  setHeaders(parseHeaders(header), valueOrRewrite);
1195
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1196
- let obj = {},
1259
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1260
+ let obj = Object.create(null),
1197
1261
  dest,
1198
1262
  key;
1199
1263
  for (const entry of header) {
@@ -1201,11 +1265,14 @@ let AxiosHeaders$1 = class AxiosHeaders {
1201
1265
  throw new TypeError('Object iterator must return a key-value pair');
1202
1266
  }
1203
1267
 
1204
- obj[(key = entry[0])] = (dest = obj[key])
1205
- ? utils$1.isArray(dest)
1206
- ? [...dest, entry[1]]
1207
- : [dest, entry[1]]
1208
- : entry[1];
1268
+ key = entry[0];
1269
+
1270
+ if (utils$1.hasOwnProp(obj, key)) {
1271
+ dest = obj[key];
1272
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
1273
+ } else {
1274
+ obj[key] = entry[1];
1275
+ }
1209
1276
  }
1210
1277
 
1211
1278
  setHeaders(obj, valueOrRewrite);
@@ -1599,6 +1666,10 @@ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1599
1666
  // eslint-disable-next-line strict
1600
1667
  var httpAdapter = null;
1601
1668
 
1669
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
1670
+ // the FormData <-> JSON round-trip stays symmetric.
1671
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1672
+
1602
1673
  /**
1603
1674
  * Determines if the given thing is a array or js object.
1604
1675
  *
@@ -1709,8 +1780,9 @@ function toFormData$1(obj, formData, options) {
1709
1780
  const dots = options.dots;
1710
1781
  const indexes = options.indexes;
1711
1782
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1712
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1783
+ const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
1713
1784
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1785
+ const stack = [];
1714
1786
 
1715
1787
  if (!utils$1.isFunction(visitor)) {
1716
1788
  throw new TypeError('visitor must be a function');
@@ -1738,6 +1810,38 @@ function toFormData$1(obj, formData, options) {
1738
1810
  return value;
1739
1811
  }
1740
1812
 
1813
+ function throwIfMaxDepthExceeded(depth) {
1814
+ if (depth > maxDepth) {
1815
+ throw new AxiosError$1(
1816
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1817
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1818
+ );
1819
+ }
1820
+ }
1821
+
1822
+ function stringifyWithDepthLimit(value, depth) {
1823
+ if (maxDepth === Infinity) {
1824
+ return JSON.stringify(value);
1825
+ }
1826
+
1827
+ const ancestors = [];
1828
+
1829
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1830
+ if (!utils$1.isObject(currentValue)) {
1831
+ return currentValue;
1832
+ }
1833
+
1834
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1835
+ ancestors.pop();
1836
+ }
1837
+
1838
+ ancestors.push(currentValue);
1839
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1840
+
1841
+ return currentValue;
1842
+ });
1843
+ }
1844
+
1741
1845
  /**
1742
1846
  * Default visitor.
1743
1847
  *
@@ -1761,7 +1865,7 @@ function toFormData$1(obj, formData, options) {
1761
1865
  // eslint-disable-next-line no-param-reassign
1762
1866
  key = metaTokens ? key : key.slice(0, -2);
1763
1867
  // eslint-disable-next-line no-param-reassign
1764
- value = JSON.stringify(value);
1868
+ value = stringifyWithDepthLimit(value, 1);
1765
1869
  } else if (
1766
1870
  (utils$1.isArray(value) && isFlatArray(value)) ||
1767
1871
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -1794,8 +1898,6 @@ function toFormData$1(obj, formData, options) {
1794
1898
  return false;
1795
1899
  }
1796
1900
 
1797
- const stack = [];
1798
-
1799
1901
  const exposedHelpers = Object.assign(predicates, {
1800
1902
  defaultVisitor,
1801
1903
  convertValue,
@@ -1805,12 +1907,7 @@ function toFormData$1(obj, formData, options) {
1805
1907
  function build(value, path, depth = 0) {
1806
1908
  if (utils$1.isUndefined(value)) return;
1807
1909
 
1808
- if (depth > maxDepth) {
1809
- throw new AxiosError$1(
1810
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1811
- AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1812
- );
1813
- }
1910
+ throwIfMaxDepthExceeded(depth);
1814
1911
 
1815
1912
  if (stack.indexOf(value) !== -1) {
1816
1913
  throw new Error('Circular reference detected in ' + path.join('.'));
@@ -1926,15 +2023,17 @@ function buildURL(url, params, options) {
1926
2023
  return url;
1927
2024
  }
1928
2025
 
1929
- const _encode = (options && options.encode) || encode;
1930
-
1931
2026
  const _options = utils$1.isFunction(options)
1932
2027
  ? {
1933
2028
  serialize: options,
1934
2029
  }
1935
2030
  : options;
1936
2031
 
1937
- const serializeFn = _options && _options.serialize;
2032
+ // Read serializer options pollution-safely: own properties and methods on a
2033
+ // class/template prototype are honored, but values injected onto a polluted
2034
+ // Object.prototype are ignored.
2035
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2036
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
1938
2037
 
1939
2038
  let serializedParams;
1940
2039
 
@@ -2031,6 +2130,7 @@ var transitionalDefaults = {
2031
2130
  clarifyTimeoutError: false,
2032
2131
  legacyInterceptorReqResOrdering: true,
2033
2132
  advertiseZstdAcceptEncoding: false,
2133
+ validateStatusUndefinedResolves: true,
2034
2134
  };
2035
2135
 
2036
2136
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2122,6 +2222,17 @@ function toURLEncodedForm(data, options) {
2122
2222
  });
2123
2223
  }
2124
2224
 
2225
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2226
+
2227
+ function throwIfDepthExceeded(index) {
2228
+ if (index > MAX_DEPTH) {
2229
+ throw new AxiosError$1(
2230
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
2231
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
2232
+ );
2233
+ }
2234
+ }
2235
+
2125
2236
  /**
2126
2237
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2127
2238
  *
@@ -2134,9 +2245,16 @@ function parsePropPath(name) {
2134
2245
  // foo.x.y.z
2135
2246
  // foo-x-y-z
2136
2247
  // foo x y z
2137
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2138
- return match[0] === '[]' ? '' : match[1] || match[0];
2139
- });
2248
+ const path = [];
2249
+ const pattern = /\w+|\[(\w*)]/g;
2250
+ let match;
2251
+
2252
+ while ((match = pattern.exec(name)) !== null) {
2253
+ throwIfDepthExceeded(path.length);
2254
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2255
+ }
2256
+
2257
+ return path;
2140
2258
  }
2141
2259
 
2142
2260
  /**
@@ -2168,6 +2286,8 @@ function arrayToObject(arr) {
2168
2286
  */
2169
2287
  function formDataToJSON(formData) {
2170
2288
  function buildPath(path, value, target, index) {
2289
+ throwIfDepthExceeded(index);
2290
+
2171
2291
  let name = path[index++];
2172
2292
 
2173
2293
  if (name === '__proto__') return true;
@@ -2704,6 +2824,31 @@ function combineURLs(baseURL, relativeURL) {
2704
2824
  : baseURL;
2705
2825
  }
2706
2826
 
2827
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
2828
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
2829
+
2830
+ function stripLeadingC0ControlOrSpace(url) {
2831
+ let i = 0;
2832
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
2833
+ i++;
2834
+ }
2835
+ return url.slice(i);
2836
+ }
2837
+
2838
+ function normalizeURLForProtocolCheck(url) {
2839
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
2840
+ }
2841
+
2842
+ function assertValidHttpProtocolURL(url, config) {
2843
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
2844
+ throw new AxiosError$1(
2845
+ 'Invalid URL: missing "//" after protocol',
2846
+ AxiosError$1.ERR_INVALID_URL,
2847
+ config
2848
+ );
2849
+ }
2850
+ }
2851
+
2707
2852
  /**
2708
2853
  * Creates a new URL by combining the baseURL with the requestedURL,
2709
2854
  * only when the requestedURL is not already an absolute URL.
@@ -2714,9 +2859,11 @@ function combineURLs(baseURL, relativeURL) {
2714
2859
  *
2715
2860
  * @returns {string} The combined full path
2716
2861
  */
2717
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2862
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2863
+ assertValidHttpProtocolURL(requestedURL, config);
2718
2864
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2719
2865
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2866
+ assertValidHttpProtocolURL(baseURL, config);
2720
2867
  return combineURLs(baseURL, requestedURL);
2721
2868
  }
2722
2869
  return requestedURL;
@@ -2787,6 +2934,28 @@ function mergeConfig$1(config1, config2) {
2787
2934
  }
2788
2935
  }
2789
2936
 
2937
+ function getMergedTransitionalOption(prop) {
2938
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
2939
+
2940
+ if (!utils$1.isUndefined(transitional2)) {
2941
+ if (utils$1.isPlainObject(transitional2)) {
2942
+ if (utils$1.hasOwnProp(transitional2, prop)) {
2943
+ return transitional2[prop];
2944
+ }
2945
+ } else {
2946
+ return undefined;
2947
+ }
2948
+ }
2949
+
2950
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
2951
+
2952
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2953
+ return transitional1[prop];
2954
+ }
2955
+
2956
+ return undefined;
2957
+ }
2958
+
2790
2959
  // eslint-disable-next-line consistent-return
2791
2960
  function mergeDirectKeys(a, b, prop) {
2792
2961
  if (utils$1.hasOwnProp(config2, prop)) {
@@ -2839,6 +3008,18 @@ function mergeConfig$1(config1, config2) {
2839
3008
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2840
3009
  });
2841
3010
 
3011
+ if (
3012
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
3013
+ utils$1.isUndefined(config2.validateStatus) &&
3014
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
3015
+ ) {
3016
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3017
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3018
+ } else {
3019
+ delete config.validateStatus;
3020
+ }
3021
+ }
3022
+
2842
3023
  return config;
2843
3024
  }
2844
3025
 
@@ -2890,17 +3071,19 @@ function resolveConfig(config) {
2890
3071
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2891
3072
 
2892
3073
  newConfig.url = buildURL(
2893
- buildFullPath(baseURL, url, allowAbsoluteUrls),
3074
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
2894
3075
  own('params'),
2895
3076
  own('paramsSerializer')
2896
3077
  );
2897
3078
 
2898
3079
  // HTTP basic authentication
2899
3080
  if (auth) {
3081
+ const username = utils$1.getSafeProp(auth, 'username') || '';
3082
+ const password = utils$1.getSafeProp(auth, 'password') || '';
3083
+
2900
3084
  headers.set(
2901
3085
  'Authorization',
2902
- 'Basic ' +
2903
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8$1(auth.password) : ''))
3086
+ 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
2904
3087
  );
2905
3088
  }
2906
3089
 
@@ -3306,11 +3489,19 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3306
3489
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3307
3490
  * - For base64: compute exact decoded size using length and padding;
3308
3491
  * handle %XX at the character-count level (no string allocation).
3309
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3492
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
3310
3493
  *
3311
3494
  * @param {string} url
3312
3495
  * @returns {number}
3313
3496
  */
3497
+ const isHexDigit = (charCode) =>
3498
+ (charCode >= 48 && charCode <= 57) ||
3499
+ (charCode >= 65 && charCode <= 70) ||
3500
+ (charCode >= 97 && charCode <= 102);
3501
+
3502
+ const isPercentEncodedByte = (str, i, len) =>
3503
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3504
+
3314
3505
  function estimateDataURLDecodedBytes(url) {
3315
3506
  if (!url || typeof url !== 'string') return 0;
3316
3507
  if (!url.startsWith('data:')) return 0;
@@ -3330,9 +3521,7 @@ function estimateDataURLDecodedBytes(url) {
3330
3521
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3331
3522
  const a = body.charCodeAt(i + 1);
3332
3523
  const b = body.charCodeAt(i + 2);
3333
- const isHex =
3334
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
3335
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
3524
+ const isHex = isHexDigit(a) && isHexDigit(b);
3336
3525
 
3337
3526
  if (isHex) {
3338
3527
  effectiveLen -= 2;
@@ -3373,18 +3562,17 @@ function estimateDataURLDecodedBytes(url) {
3373
3562
  return bytes > 0 ? bytes : 0;
3374
3563
  }
3375
3564
 
3376
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3377
- return Buffer.byteLength(body, 'utf8');
3378
- }
3379
-
3380
3565
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3381
3566
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3382
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3383
- // but 3 UTF-8 bytes).
3567
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3568
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3384
3569
  let bytes = 0;
3385
3570
  for (let i = 0, len = body.length; i < len; i++) {
3386
3571
  const c = body.charCodeAt(i);
3387
- if (c < 0x80) {
3572
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3573
+ bytes += 1;
3574
+ i += 2;
3575
+ } else if (c < 0x80) {
3388
3576
  bytes += 1;
3389
3577
  } else if (c < 0x800) {
3390
3578
  bytes += 2;
@@ -3403,7 +3591,7 @@ function estimateDataURLDecodedBytes(url) {
3403
3591
  return bytes;
3404
3592
  }
3405
3593
 
3406
- const VERSION$1 = "1.17.0";
3594
+ const VERSION$1 = "1.18.0";
3407
3595
 
3408
3596
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
3409
3597
 
@@ -3624,14 +3812,28 @@ const factory = (env) => {
3624
3812
 
3625
3813
  let requestContentLength;
3626
3814
 
3815
+ // AxiosError we raise while the request body is being streamed. Captured
3816
+ // by identity so the catch block can surface it directly, regardless of
3817
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
3818
+ // as `err.cause`; some browsers drop the original error entirely).
3819
+ let pendingBodyError = null;
3820
+
3821
+ const maxBodyLengthError = () =>
3822
+ new AxiosError$1(
3823
+ 'Request body larger than maxBodyLength limit',
3824
+ AxiosError$1.ERR_BAD_REQUEST,
3825
+ config,
3826
+ request
3827
+ );
3828
+
3627
3829
  try {
3628
3830
  // HTTP basic authentication
3629
3831
  let auth = undefined;
3630
3832
  const configAuth = own('auth');
3631
3833
 
3632
3834
  if (configAuth) {
3633
- const username = configAuth.username || '';
3634
- const password = configAuth.password || '';
3835
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
3836
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
3635
3837
  auth = {
3636
3838
  username,
3637
3839
  password
@@ -3680,53 +3882,96 @@ const factory = (env) => {
3680
3882
  }
3681
3883
  }
3682
3884
 
3683
- // Enforce maxBodyLength against the outbound request body before dispatch.
3684
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
3685
- // maxBodyLength limit'). Skip when the body length cannot be determined
3686
- // (e.g. a live ReadableStream supplied by the caller).
3885
+ // Enforce maxBodyLength against known-size bodies before dispatch using
3886
+ // the body's *actual* size never a caller-declared Content-Length,
3887
+ // which could under-report to slip an oversized body past the check.
3888
+ // Unknown-size streams return undefined here and are counted per-chunk
3889
+ // below as fetch consumes them.
3687
3890
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
3688
- const outboundLength = await resolveBodyLength(headers, data);
3689
- if (
3690
- typeof outboundLength === 'number' &&
3691
- isFinite(outboundLength) &&
3692
- outboundLength > maxBodyLength
3693
- ) {
3694
- throw new AxiosError$1(
3695
- 'Request body larger than maxBodyLength limit',
3696
- AxiosError$1.ERR_BAD_REQUEST,
3697
- config,
3698
- request
3699
- );
3891
+ const outboundLength = await getBodyLength(data);
3892
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
3893
+ requestContentLength = outboundLength;
3894
+ if (outboundLength > maxBodyLength) {
3895
+ throw maxBodyLengthError();
3896
+ }
3700
3897
  }
3701
3898
  }
3702
3899
 
3900
+ // A streamed body under maxBodyLength must be counted as fetch consumes
3901
+ // it; its size is never trusted from a caller-declared Content-Length.
3902
+ const mustEnforceStreamBody =
3903
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
3904
+
3905
+ const trackRequestStream = (stream, onProgress, flush) =>
3906
+ trackStream(
3907
+ stream,
3908
+ DEFAULT_CHUNK_SIZE,
3909
+ (loadedBytes) => {
3910
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
3911
+ throw (pendingBodyError = maxBodyLengthError());
3912
+ }
3913
+ onProgress && onProgress(loadedBytes);
3914
+ },
3915
+ flush
3916
+ );
3917
+
3703
3918
  if (
3704
- onUploadProgress &&
3705
3919
  supportsRequestStream &&
3706
3920
  method !== 'get' &&
3707
3921
  method !== 'head' &&
3708
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3922
+ (onUploadProgress || mustEnforceStreamBody)
3709
3923
  ) {
3710
- let _request = new Request(url, {
3711
- method: 'POST',
3712
- body: data,
3713
- duplex: 'half',
3714
- });
3924
+ requestContentLength =
3925
+ requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
3926
+
3927
+ // A declared length of 0 is only trusted to skip the wrap when we are
3928
+ // not enforcing a stream limit (which must not rely on that header).
3929
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
3930
+ let _request = new Request(url, {
3931
+ method: 'POST',
3932
+ body: data,
3933
+ duplex: 'half',
3934
+ });
3715
3935
 
3716
- let contentTypeHeader;
3936
+ let contentTypeHeader;
3717
3937
 
3718
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3719
- headers.setContentType(contentTypeHeader);
3720
- }
3938
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3939
+ headers.setContentType(contentTypeHeader);
3940
+ }
3721
3941
 
3722
- if (_request.body) {
3723
- const [onProgress, flush] = progressEventDecorator(
3724
- requestContentLength,
3725
- progressEventReducer(asyncDecorator(onUploadProgress))
3726
- );
3942
+ if (_request.body) {
3943
+ const [onProgress, flush] =
3944
+ (onUploadProgress &&
3945
+ progressEventDecorator(
3946
+ requestContentLength,
3947
+ progressEventReducer(asyncDecorator(onUploadProgress))
3948
+ )) ||
3949
+ [];
3727
3950
 
3728
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3951
+ data = trackRequestStream(_request.body, onProgress, flush);
3952
+ }
3729
3953
  }
3954
+ } else if (
3955
+ mustEnforceStreamBody &&
3956
+ !isRequestSupported &&
3957
+ isReadableStreamSupported &&
3958
+ method !== 'get' &&
3959
+ method !== 'head'
3960
+ ) {
3961
+ data = trackRequestStream(data);
3962
+ } else if (
3963
+ mustEnforceStreamBody &&
3964
+ isRequestSupported &&
3965
+ !supportsRequestStream &&
3966
+ method !== 'get' &&
3967
+ method !== 'head'
3968
+ ) {
3969
+ throw new AxiosError$1(
3970
+ 'Stream request bodies are not supported by the current fetch implementation',
3971
+ AxiosError$1.ERR_NOT_SUPPORT,
3972
+ config,
3973
+ request
3974
+ );
3730
3975
  }
3731
3976
 
3732
3977
  if (!utils$1.isString(withCredentials)) {
@@ -3769,10 +4014,12 @@ const factory = (env) => {
3769
4014
  ? _fetch(request, fetchOptions)
3770
4015
  : _fetch(url, resolvedOptions));
3771
4016
 
4017
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
4018
+
3772
4019
  // Cheap pre-check: if the server honestly declares a content-length that
3773
4020
  // already exceeds the cap, reject before we start streaming.
3774
4021
  if (hasMaxContentLength) {
3775
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4022
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3776
4023
  if (declaredLength != null && declaredLength > maxContentLength) {
3777
4024
  throw new AxiosError$1(
3778
4025
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -3797,7 +4044,7 @@ const factory = (env) => {
3797
4044
  options[prop] = response[prop];
3798
4045
  });
3799
4046
 
3800
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4047
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3801
4048
 
3802
4049
  const [onProgress, flush] =
3803
4050
  (onDownloadProgress &&
@@ -3892,6 +4139,23 @@ const factory = (env) => {
3892
4139
  throw canceledError;
3893
4140
  }
3894
4141
 
4142
+ // Surface a maxBodyLength violation we raised while the request body was
4143
+ // being streamed. Matching by identity (rather than reading
4144
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
4145
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
4146
+ // AxiosError that merely happened to land in `err.cause`.
4147
+ if (pendingBodyError) {
4148
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
4149
+ throw pendingBodyError;
4150
+ }
4151
+
4152
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
4153
+ // pre-checks, response size enforcement) without re-wrapping them.
4154
+ if (err instanceof AxiosError$1) {
4155
+ request && !err.request && (err.request = request);
4156
+ throw err;
4157
+ }
4158
+
3895
4159
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3896
4160
  throw Object.assign(
3897
4161
  new AxiosError$1(
@@ -4347,6 +4611,7 @@ let Axios$1 = class Axios {
4347
4611
  clarifyTimeoutError: validators.transitional(validators.boolean),
4348
4612
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4349
4613
  advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
4614
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
4350
4615
  },
4351
4616
  false
4352
4617
  );
@@ -4476,7 +4741,7 @@ let Axios$1 = class Axios {
4476
4741
 
4477
4742
  getUri(config) {
4478
4743
  config = mergeConfig$1(this.defaults, config);
4479
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4744
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4480
4745
  return buildURL(fullPath, config.params, config.paramsSerializer);
4481
4746
  }
4482
4747
  };
@@ -4489,7 +4754,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
4489
4754
  mergeConfig$1(config || {}, {
4490
4755
  method,
4491
4756
  url,
4492
- data: (config || {}).data,
4757
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
4493
4758
  })
4494
4759
  );
4495
4760
  };